From 2e6279bc8e528833704bc6b77635f0eeae6bbe44 Mon Sep 17 00:00:00 2001 From: fig02 Date: Sat, 21 May 2022 14:23:43 -0400 Subject: [PATCH] PlayState Rename (#1231) * global context -> play * fix PlayState* PlayState --- docs/tutorial/beginning_decomp.md | 150 +- docs/tutorial/data.md | 24 +- docs/tutorial/draw_functions.md | 82 +- docs/tutorial/other_functions.md | 166 +- docs/tutorial/types_structs_padding.md | 2 +- include/functions.h | 1080 ++-- include/macros.h | 4 +- include/variables.h | 2 +- include/z64.h | 23 +- include/z64actor.h | 14 +- include/z64animation.h | 12 +- include/z64bgcheck.h | 4 +- include/z64camera.h | 8 +- include/z64curve.h | 14 +- include/z64effect.h | 10 +- include/z64player.h | 6 +- include/z64skin.h | 4 +- src/code/code_80043480.c | 6 +- src/code/code_8006C3A0.c | 18 +- src/code/code_80097A00.c | 8 +- src/code/db_camera.c | 202 +- src/code/flg_set.c | 8 +- src/code/sys_math3d.c | 4 +- src/code/z_actor.c | 1073 ++-- src/code/z_bgcheck.c | 187 +- src/code/z_camera.c | 247 +- src/code/z_camera_data.c | 2 +- src/code/z_cheap_proc.c | 20 +- src/code/z_collision_check.c | 778 ++- src/code/z_construct.c | 34 +- src/code/z_debug_display.c | 32 +- src/code/z_demo.c | 1117 ++-- src/code/z_draw.c | 479 +- src/code/z_eff_shield_particle.c | 8 +- src/code/z_eff_spark.c | 4 +- src/code/z_eff_ss_dead.c | 40 +- src/code/z_effect.c | 24 +- src/code/z_effect_soft_sprite.c | 37 +- src/code/z_effect_soft_sprite_old_init.c | 376 +- src/code/z_elf_message.c | 12 +- src/code/z_en_a_keep.c | 72 +- src/code/z_en_item00.c | 279 +- src/code/z_face_reaction.c | 4 +- src/code/z_fcurve_data_skelanime.c | 34 +- src/code/z_game_dlftbls.c | 2 +- src/code/z_game_over.c | 26 +- src/code/z_horse.c | 117 +- src/code/z_kaleido_manager.c | 4 +- src/code/z_kaleido_scope_call.c | 32 +- src/code/z_kaleido_setup.c | 24 +- src/code/z_kankyo.c | 579 +- src/code/z_lifemeter.c | 36 +- src/code/z_lights.c | 30 +- src/code/z_map_exp.c | 147 +- src/code/z_map_mark.c | 26 +- src/code/z_message_PAL.c | 431 +- src/code/z_onepointdemo.c | 540 +- src/code/z_parameter.c | 477 +- src/code/z_path.c | 4 +- src/code/z_play.c | 102 +- src/code/z_player_call.c | 40 +- src/code/z_player_lib.c | 234 +- src/code/z_quake.c | 6 +- src/code/z_rcp.c | 6 +- src/code/z_room.c | 140 +- src/code/z_sample.c | 2 +- src/code/z_scene.c | 197 +- src/code/z_scene_table.c | 894 ++-- src/code/z_skelanime.c | 337 +- src/code/z_skin.c | 24 +- src/code/z_skin_awb.c | 12 +- src/code/z_sound_source.c | 24 +- src/code/z_sram.c | 2 +- src/code/z_vr_box.c | 124 +- .../actors/ovl_Arms_Hook/z_arms_hook.c | 66 +- .../actors/ovl_Arms_Hook/z_arms_hook.h | 2 +- .../actors/ovl_Arrow_Fire/z_arrow_fire.c | 49 +- .../actors/ovl_Arrow_Fire/z_arrow_fire.h | 2 +- .../actors/ovl_Arrow_Ice/z_arrow_ice.c | 47 +- .../actors/ovl_Arrow_Ice/z_arrow_ice.h | 2 +- .../actors/ovl_Arrow_Light/z_arrow_light.c | 47 +- .../actors/ovl_Arrow_Light/z_arrow_light.h | 2 +- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c | 168 +- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h | 2 +- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c | 148 +- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h | 2 +- .../actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c | 28 +- .../actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h | 2 +- .../actors/ovl_Bg_Bombwall/z_bg_bombwall.c | 82 +- .../actors/ovl_Bg_Bombwall/z_bg_bombwall.h | 2 +- .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c | 65 +- .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h | 2 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.c | 81 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.h | 2 +- .../actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c | 56 +- .../actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.h | 2 +- .../actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c | 70 +- .../actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h | 2 +- .../actors/ovl_Bg_Dodoago/z_bg_dodoago.c | 118 +- .../actors/ovl_Bg_Dodoago/z_bg_dodoago.h | 2 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 337 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h | 2 +- .../ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c | 78 +- .../ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h | 2 +- .../ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c | 48 +- .../ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h | 2 +- .../ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c | 63 +- .../ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.h | 2 +- .../ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c | 100 +- .../ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h | 2 +- .../ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c | 46 +- .../ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h | 2 +- .../ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c | 58 +- .../ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.h | 2 +- .../ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c | 22 +- .../ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c | 74 +- .../ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.h | 2 +- src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c | 73 +- src/overlays/actors/ovl_Bg_Haka/z_bg_haka.h | 2 +- .../actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c | 128 +- .../actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h | 2 +- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c | 76 +- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h | 2 +- .../ovl_Bg_Haka_Megane/z_bg_haka_megane.c | 56 +- .../ovl_Bg_Haka_Megane/z_bg_haka_megane.h | 2 +- .../ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c | 64 +- .../ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h | 2 +- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c | 66 +- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h | 2 +- .../actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c | 78 +- .../actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h | 2 +- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c | 125 +- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h | 2 +- .../actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c | 81 +- .../actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.h | 2 +- .../ovl_Bg_Haka_Water/z_bg_haka_water.c | 61 +- .../ovl_Bg_Haka_Water/z_bg_haka_water.h | 2 +- .../actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c | 114 +- .../actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h | 2 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.c | 147 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.h | 2 +- .../ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c | 90 +- .../ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h | 2 +- .../ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c | 60 +- .../ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h | 2 +- .../z_bg_hidan_firewall.c | 72 +- .../z_bg_hidan_firewall.h | 2 +- .../ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c | 46 +- .../ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h | 2 +- .../ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c | 92 +- .../ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.h | 2 +- .../ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c | 94 +- .../ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h | 2 +- .../ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c | 52 +- .../ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h | 2 +- .../ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c | 56 +- .../ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h | 2 +- .../z_bg_hidan_kowarerukabe.c | 84 +- .../ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c | 112 +- .../ovl_Bg_Hidan_Rock/z_bg_hidan_rock.h | 2 +- .../z_bg_hidan_rsekizou.c | 50 +- .../ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c | 100 +- .../ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h | 2 +- .../ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c | 70 +- .../ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h | 2 +- .../ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c | 44 +- .../ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h | 2 +- .../ovl_Bg_Ice_Objects/z_bg_ice_objects.c | 68 +- .../ovl_Bg_Ice_Objects/z_bg_ice_objects.h | 2 +- .../ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c | 112 +- .../ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h | 2 +- .../ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c | 54 +- .../ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h | 2 +- .../ovl_Bg_Ice_Turara/z_bg_ice_turara.c | 73 +- .../ovl_Bg_Ice_Turara/z_bg_ice_turara.h | 2 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 48 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.h | 2 +- .../ovl_Bg_Jya_1flift/z_bg_jya_1flift.c | 70 +- .../ovl_Bg_Jya_1flift/z_bg_jya_1flift.h | 2 +- .../z_bg_jya_amishutter.c | 27 +- .../ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c | 70 +- .../actors/ovl_Bg_Jya_Block/z_bg_jya_block.c | 32 +- .../z_bg_jya_bombchuiwa.c | 106 +- .../z_bg_jya_bombchuiwa.h | 2 +- .../ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c | 52 +- .../actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c | 114 +- .../actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h | 2 +- .../ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c | 50 +- .../ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h | 2 +- .../ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c | 60 +- .../ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h | 2 +- .../ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c | 75 +- .../ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h | 2 +- .../ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c | 44 +- .../ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h | 2 +- .../actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c | 54 +- .../actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h | 2 +- .../ovl_Bg_Jya_Megami/z_bg_jya_megami.c | 102 +- .../ovl_Bg_Jya_Megami/z_bg_jya_megami.h | 2 +- .../z_bg_jya_zurerukabe.c | 49 +- .../z_bg_jya_zurerukabe.h | 2 +- .../ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c | 40 +- .../z_bg_menkuri_kaiten.c | 24 +- .../z_bg_menkuri_nisekabe.c | 22 +- .../ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c | 129 +- .../ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h | 2 +- .../ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c | 94 +- .../ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h | 2 +- .../ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c | 60 +- .../ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h | 2 +- .../actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c | 32 +- .../actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h | 2 +- .../ovl_Bg_Mizu_Water/z_bg_mizu_water.c | 124 +- .../ovl_Bg_Mizu_Water/z_bg_mizu_water.h | 2 +- src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c | 48 +- src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h | 2 +- .../ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c | 154 +- .../ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h | 2 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c | 88 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h | 2 +- .../ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c | 91 +- .../ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h | 2 +- .../ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c | 65 +- .../ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h | 2 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 132 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h | 2 +- .../ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c | 66 +- .../ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h | 2 +- .../z_bg_mori_kaitenkabe.c | 58 +- .../z_bg_mori_kaitenkabe.h | 2 +- .../z_bg_mori_rakkatenjo.c | 80 +- .../z_bg_mori_rakkatenjo.h | 2 +- .../actors/ovl_Bg_Po_Event/z_bg_po_event.c | 163 +- .../actors/ovl_Bg_Po_Event/z_bg_po_event.h | 2 +- .../ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c | 80 +- .../actors/ovl_Bg_Pushbox/z_bg_pushbox.c | 36 +- .../actors/ovl_Bg_Pushbox/z_bg_pushbox.h | 2 +- .../ovl_Bg_Relay_Objects/z_bg_relay_objects.c | 70 +- .../ovl_Bg_Relay_Objects/z_bg_relay_objects.h | 2 +- .../ovl_Bg_Spot00_Break/z_bg_spot00_break.c | 24 +- .../z_bg_spot00_hanebasi.c | 90 +- .../z_bg_spot00_hanebasi.h | 2 +- .../ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c | 30 +- .../ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h | 2 +- .../z_bg_spot01_idohashira.c | 113 +- .../z_bg_spot01_idohashira.h | 4 +- .../z_bg_spot01_idomizu.c | 36 +- .../z_bg_spot01_idomizu.h | 2 +- .../z_bg_spot01_idosoko.c | 34 +- .../z_bg_spot01_idosoko.h | 2 +- .../z_bg_spot01_objects2.c | 46 +- .../z_bg_spot01_objects2.h | 2 +- .../z_bg_spot02_objects.c | 143 +- .../z_bg_spot02_objects.h | 2 +- .../ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c | 50 +- .../ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h | 2 +- .../ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c | 44 +- .../ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h | 2 +- .../z_bg_spot06_objects.c | 167 +- .../z_bg_spot06_objects.h | 2 +- .../ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c | 52 +- .../ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h | 2 +- .../z_bg_spot08_bakudankabe.c | 54 +- .../z_bg_spot08_iceblock.c | 59 +- .../z_bg_spot08_iceblock.h | 2 +- .../ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 64 +- .../z_bg_spot11_bakudankabe.c | 54 +- .../ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c | 64 +- .../ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h | 2 +- .../ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c | 52 +- .../ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h | 2 +- .../ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c | 46 +- .../ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h | 2 +- .../ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c | 130 +- .../ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h | 2 +- .../ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c | 42 +- .../ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h | 2 +- .../z_bg_spot16_bombstone.c | 142 +- .../z_bg_spot16_bombstone.h | 2 +- .../z_bg_spot16_doughnut.c | 53 +- .../z_bg_spot17_bakudankabe.c | 62 +- .../ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c | 35 +- .../ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c | 111 +- .../ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h | 2 +- .../ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c | 22 +- .../ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c | 96 +- .../ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h | 4 +- .../z_bg_spot18_shutter.c | 52 +- .../z_bg_spot18_shutter.h | 2 +- .../actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c | 38 +- .../ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c | 82 +- .../ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h | 2 +- .../actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c | 83 +- .../actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h | 2 +- .../actors/ovl_Bg_Treemouth/z_bg_treemouth.c | 103 +- .../actors/ovl_Bg_Treemouth/z_bg_treemouth.h | 2 +- .../actors/ovl_Bg_Umajump/z_bg_umajump.c | 22 +- .../actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c | 32 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c | 79 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h | 2 +- .../ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c | 64 +- .../ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h | 2 +- .../actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c | 104 +- .../actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h | 2 +- src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c | 48 +- src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h | 4 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 343 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.h | 2 +- src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c | 284 +- src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h | 2 +- src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c | 254 +- src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h | 2 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 946 ++-- .../actors/ovl_Boss_Ganon/z_boss_ganon.h | 2 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 851 ++- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.h | 2 +- .../ovl_Boss_Ganondrof/z_boss_ganondrof.c | 260 +- .../ovl_Boss_Ganondrof/z_boss_ganondrof.h | 2 +- .../actors/ovl_Boss_Goma/z_boss_goma.c | 444 +- .../actors/ovl_Boss_Goma/z_boss_goma.h | 2 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 458 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h | 2 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 628 ++- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h | 2 +- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 1195 +++-- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h | 2 +- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 966 ++-- src/overlays/actors/ovl_Boss_Va/z_boss_va.h | 2 +- src/overlays/actors/ovl_Demo_6K/z_demo_6k.c | 252 +- src/overlays/actors/ovl_Demo_6K/z_demo_6k.h | 2 +- src/overlays/actors/ovl_Demo_Du/z_demo_du.c | 451 +- src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 650 ++- src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h | 6 +- .../actors/ovl_Demo_Effect/z_demo_effect.c | 653 ++- .../actors/ovl_Demo_Effect/z_demo_effect.h | 2 +- src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c | 52 +- src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h | 4 +- .../actors/ovl_Demo_Geff/z_demo_geff.c | 78 +- .../actors/ovl_Demo_Geff/z_demo_geff.h | 6 +- src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c | 632 ++- src/overlays/actors/ovl_Demo_Go/z_demo_go.c | 152 +- src/overlays/actors/ovl_Demo_Go/z_demo_go.h | 4 +- src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c | 636 ++- src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h | 4 +- src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c | 164 +- src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h | 4 +- src/overlays/actors/ovl_Demo_Im/z_demo_im.c | 553 +- src/overlays/actors/ovl_Demo_Im/z_demo_im.h | 4 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 282 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.h | 2 +- .../actors/ovl_Demo_Kekkai/z_demo_kekkai.c | 114 +- .../actors/ovl_Demo_Kekkai/z_demo_kekkai.h | 2 +- src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c | 349 +- src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h | 4 +- src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c | 54 +- src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h | 2 +- .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c | 54 +- .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h | 2 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 66 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.h | 2 +- .../actors/ovl_Door_Gerudo/z_door_gerudo.c | 68 +- .../actors/ovl_Door_Gerudo/z_door_gerudo.h | 2 +- .../actors/ovl_Door_Killer/z_door_killer.c | 152 +- .../actors/ovl_Door_Killer/z_door_killer.h | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 266 +- .../actors/ovl_Door_Shutter/z_door_shutter.h | 2 +- .../actors/ovl_Door_Toki/z_door_toki.c | 20 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 402 +- .../actors/ovl_Door_Warp1/z_door_warp1.h | 2 +- .../actors/ovl_Efc_Erupc/z_efc_erupc.c | 76 +- .../actors/ovl_Efc_Erupc/z_efc_erupc.h | 2 +- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 56 +- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h | 4 +- src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c | 60 +- src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h | 2 +- src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c | 60 +- src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h | 2 +- src/overlays/actors/ovl_En_Am/z_en_am.c | 194 +- src/overlays/actors/ovl_En_Am/z_en_am.h | 2 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 140 +- src/overlays/actors/ovl_En_Ani/z_en_ani.h | 2 +- .../actors/ovl_En_Anubice/z_en_anubice.c | 111 +- .../actors/ovl_En_Anubice/z_en_anubice.h | 2 +- .../ovl_En_Anubice_Fire/z_en_anubice_fire.c | 62 +- .../ovl_En_Anubice_Fire/z_en_anubice_fire.h | 2 +- .../ovl_En_Anubice_Tag/z_en_anubice_tag.c | 30 +- .../ovl_En_Anubice_Tag/z_en_anubice_tag.h | 2 +- .../actors/ovl_En_Arow_Trap/z_en_arow_trap.c | 18 +- src/overlays/actors/ovl_En_Arrow/z_en_arrow.c | 114 +- src/overlays/actors/ovl_En_Arrow/z_en_arrow.h | 2 +- .../ovl_En_Attack_Niw/z_en_attack_niw.c | 80 +- .../ovl_En_Attack_Niw/z_en_attack_niw.h | 2 +- src/overlays/actors/ovl_En_Ba/z_en_ba.c | 102 +- src/overlays/actors/ovl_En_Ba/z_en_ba.h | 2 +- src/overlays/actors/ovl_En_Bb/z_en_bb.c | 194 +- src/overlays/actors/ovl_En_Bb/z_en_bb.h | 2 +- .../actors/ovl_En_Bdfire/z_en_bdfire.c | 50 +- .../actors/ovl_En_Bdfire/z_en_bdfire.h | 4 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 215 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.h | 2 +- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 120 +- src/overlays/actors/ovl_En_Bili/z_en_bili.h | 2 +- src/overlays/actors/ovl_En_Bird/z_en_bird.c | 30 +- src/overlays/actors/ovl_En_Bird/z_en_bird.h | 2 +- .../actors/ovl_En_Blkobj/z_en_blkobj.c | 75 +- .../actors/ovl_En_Blkobj/z_en_blkobj.h | 2 +- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 127 +- src/overlays/actors/ovl_En_Bom/z_en_bom.h | 2 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 205 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h | 2 +- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c | 104 +- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h | 2 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.c | 132 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.h | 2 +- src/overlays/actors/ovl_En_Bombf/z_en_bombf.c | 166 +- src/overlays/actors/ovl_En_Bombf/z_en_bombf.h | 2 +- src/overlays/actors/ovl_En_Boom/z_en_boom.c | 57 +- src/overlays/actors/ovl_En_Boom/z_en_boom.h | 2 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 182 +- src/overlays/actors/ovl_En_Box/z_en_box.h | 2 +- src/overlays/actors/ovl_En_Brob/z_en_brob.c | 112 +- src/overlays/actors/ovl_En_Brob/z_en_brob.h | 2 +- .../actors/ovl_En_Bubble/z_en_bubble.c | 90 +- .../actors/ovl_En_Bubble/z_en_bubble.h | 2 +- src/overlays/actors/ovl_En_Butte/z_en_butte.c | 77 +- src/overlays/actors/ovl_En_Butte/z_en_butte.h | 2 +- src/overlays/actors/ovl_En_Bw/z_en_bw.c | 182 +- src/overlays/actors/ovl_En_Bw/z_en_bw.h | 2 +- src/overlays/actors/ovl_En_Bx/z_en_bx.c | 59 +- .../actors/ovl_En_Changer/z_en_changer.c | 108 +- .../actors/ovl_En_Changer/z_en_changer.h | 2 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 162 +- src/overlays/actors/ovl_En_Cow/z_en_cow.c | 140 +- src/overlays/actors/ovl_En_Cow/z_en_cow.h | 2 +- src/overlays/actors/ovl_En_Crow/z_en_crow.c | 95 +- src/overlays/actors/ovl_En_Crow/z_en_crow.h | 2 +- src/overlays/actors/ovl_En_Cs/z_en_cs.c | 116 +- src/overlays/actors/ovl_En_Cs/z_en_cs.h | 2 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.c | 170 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.h | 2 +- .../z_en_daiku_kakariko.c | 94 +- .../z_en_daiku_kakariko.h | 2 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 212 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.h | 2 +- .../actors/ovl_En_Dekunuts/z_en_dekunuts.c | 113 +- .../actors/ovl_En_Dekunuts/z_en_dekunuts.h | 2 +- src/overlays/actors/ovl_En_Dh/z_en_dh.c | 134 +- src/overlays/actors/ovl_En_Dh/z_en_dh.h | 2 +- src/overlays/actors/ovl_En_Dha/z_en_dha.c | 72 +- src/overlays/actors/ovl_En_Dha/z_en_dha.h | 2 +- .../ovl_En_Diving_Game/z_en_diving_game.c | 235 +- .../ovl_En_Diving_Game/z_en_diving_game.h | 2 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 124 +- src/overlays/actors/ovl_En_Dns/z_en_dns.h | 2 +- .../actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c | 56 +- .../actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h | 2 +- .../actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c | 159 +- .../actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h | 2 +- .../actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c | 255 +- .../actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h | 2 +- .../actors/ovl_En_Dodojr/z_en_dodojr.c | 168 +- .../actors/ovl_En_Dodojr/z_en_dodojr.h | 2 +- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 168 +- .../actors/ovl_En_Dodongo/z_en_dodongo.h | 2 +- src/overlays/actors/ovl_En_Dog/z_en_dog.c | 90 +- src/overlays/actors/ovl_En_Dog/z_en_dog.h | 2 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 127 +- src/overlays/actors/ovl_En_Door/z_en_door.h | 2 +- src/overlays/actors/ovl_En_Ds/z_en_ds.c | 124 +- src/overlays/actors/ovl_En_Ds/z_en_ds.h | 2 +- src/overlays/actors/ovl_En_Du/z_en_du.c | 173 +- src/overlays/actors/ovl_En_Du/z_en_du.h | 2 +- .../actors/ovl_En_Dy_Extra/z_en_dy_extra.c | 36 +- .../actors/ovl_En_Dy_Extra/z_en_dy_extra.h | 2 +- src/overlays/actors/ovl_En_Eg/z_en_eg.c | 28 +- src/overlays/actors/ovl_En_Eg/z_en_eg.h | 2 +- src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c | 143 +- src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 376 +- src/overlays/actors/ovl_En_Elf/z_en_elf.h | 4 +- .../actors/ovl_En_Encount1/z_en_encount1.c | 66 +- .../actors/ovl_En_Encount1/z_en_encount1.h | 2 +- .../actors/ovl_En_Encount2/z_en_encount2.c | 105 +- .../actors/ovl_En_Encount2/z_en_encount2.h | 2 +- .../actors/ovl_En_Ex_Item/z_en_ex_item.c | 150 +- .../actors/ovl_En_Ex_Item/z_en_ex_item.h | 4 +- .../actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c | 79 +- .../actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h | 2 +- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 198 +- src/overlays/actors/ovl_En_Fd/z_en_fd.h | 2 +- .../actors/ovl_En_Fd_Fire/z_en_fd_fire.c | 74 +- .../actors/ovl_En_Fd_Fire/z_en_fd_fire.h | 2 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c | 163 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h | 2 +- .../actors/ovl_En_Fire_Rock/z_en_fire_rock.c | 102 +- .../actors/ovl_En_Fire_Rock/z_en_fire_rock.h | 2 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 150 +- .../actors/ovl_En_Firefly/z_en_firefly.h | 2 +- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 135 +- src/overlays/actors/ovl_En_Fish/z_en_fish.h | 2 +- .../actors/ovl_En_Floormas/z_en_floormas.c | 218 +- .../actors/ovl_En_Floormas/z_en_floormas.h | 2 +- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 268 +- src/overlays/actors/ovl_En_Fr/z_en_fr.h | 2 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 138 +- src/overlays/actors/ovl_En_Fu/z_en_fu.h | 2 +- src/overlays/actors/ovl_En_Fw/z_en_fw.c | 95 +- src/overlays/actors/ovl_En_Fw/z_en_fw.h | 2 +- src/overlays/actors/ovl_En_Fz/z_en_fz.c | 172 +- src/overlays/actors/ovl_En_Fz/z_en_fz.h | 2 +- .../actors/ovl_En_G_Switch/z_en_g_switch.c | 142 +- .../actors/ovl_En_G_Switch/z_en_g_switch.h | 2 +- .../ovl_En_Ganon_Mant/z_en_ganon_mant.c | 32 +- .../ovl_En_Ganon_Organ/z_en_ganon_organ.c | 32 +- src/overlays/actors/ovl_En_Gb/z_en_gb.c | 146 +- src/overlays/actors/ovl_En_Gb/z_en_gb.h | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 291 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.h | 2 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 229 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.h | 2 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 121 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.h | 2 +- src/overlays/actors/ovl_En_GeldB/z_en_geldb.c | 377 +- src/overlays/actors/ovl_En_GeldB/z_en_geldb.h | 2 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.c | 314 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.h | 8 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 124 +- src/overlays/actors/ovl_En_Gm/z_en_gm.h | 4 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 307 +- src/overlays/actors/ovl_En_Go/z_en_go.h | 6 +- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 547 +- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 2 +- src/overlays/actors/ovl_En_Goma/z_en_goma.c | 223 +- src/overlays/actors/ovl_En_Goma/z_en_goma.h | 2 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 198 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.h | 2 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 144 +- src/overlays/actors/ovl_En_Gs/z_en_gs.h | 2 +- src/overlays/actors/ovl_En_Guest/z_en_guest.c | 79 +- src/overlays/actors/ovl_En_Guest/z_en_guest.h | 2 +- src/overlays/actors/ovl_En_Hata/z_en_hata.c | 52 +- .../actors/ovl_En_Heishi1/z_en_heishi1.c | 112 +- .../actors/ovl_En_Heishi1/z_en_heishi1.h | 2 +- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 325 +- .../actors/ovl_En_Heishi2/z_en_heishi2.h | 2 +- .../actors/ovl_En_Heishi3/z_en_heishi3.c | 86 +- .../actors/ovl_En_Heishi3/z_en_heishi3.h | 2 +- .../actors/ovl_En_Heishi4/z_en_heishi4.c | 119 +- .../actors/ovl_En_Heishi4/z_en_heishi4.h | 2 +- .../actors/ovl_En_Hintnuts/z_en_hintnuts.c | 147 +- .../actors/ovl_En_Hintnuts/z_en_hintnuts.h | 2 +- src/overlays/actors/ovl_En_Holl/z_en_holl.c | 158 +- src/overlays/actors/ovl_En_Holl/z_en_holl.h | 2 +- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 141 +- .../actors/ovl_En_Honotrap/z_en_honotrap.h | 2 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 690 ++- src/overlays/actors/ovl_En_Horse/z_en_horse.h | 2 +- .../z_en_horse_game_check.c | 107 +- .../z_en_horse_game_check.h | 2 +- .../ovl_En_Horse_Ganon/z_en_horse_ganon.c | 66 +- .../ovl_En_Horse_Ganon/z_en_horse_ganon.h | 2 +- .../z_en_horse_link_child.c | 93 +- .../z_en_horse_link_child.h | 2 +- .../ovl_En_Horse_Normal/z_en_horse_normal.c | 118 +- .../ovl_En_Horse_Normal/z_en_horse_normal.h | 2 +- .../ovl_En_Horse_Zelda/z_en_horse_zelda.c | 66 +- .../ovl_En_Horse_Zelda/z_en_horse_zelda.h | 2 +- src/overlays/actors/ovl_En_Hs/z_en_hs.c | 104 +- src/overlays/actors/ovl_En_Hs/z_en_hs.h | 2 +- src/overlays/actors/ovl_En_Hs2/z_en_hs2.c | 58 +- src/overlays/actors/ovl_En_Hs2/z_en_hs2.h | 2 +- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 238 +- src/overlays/actors/ovl_En_Hy/z_en_hy.h | 2 +- .../actors/ovl_En_Ice_Hono/z_en_ice_hono.c | 108 +- .../actors/ovl_En_Ice_Hono/z_en_ice_hono.h | 2 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 418 +- src/overlays/actors/ovl_En_Ik/z_en_ik.h | 2 +- src/overlays/actors/ovl_En_In/z_en_in.c | 332 +- src/overlays/actors/ovl_En_In/z_en_in.h | 2 +- .../actors/ovl_En_Insect/z_en_insect.c | 102 +- .../actors/ovl_En_Insect/z_en_insect.h | 2 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 166 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.h | 6 +- src/overlays/actors/ovl_En_It/z_en_it.c | 20 +- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 103 +- src/overlays/actors/ovl_En_Jj/z_en_jj.h | 2 +- src/overlays/actors/ovl_En_Js/z_en_js.c | 88 +- src/overlays/actors/ovl_En_Js/z_en_js.h | 2 +- .../actors/ovl_En_Jsjutan/z_en_jsjutan.c | 68 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 128 +- .../actors/ovl_En_Kakasi/z_en_kakasi.h | 2 +- .../actors/ovl_En_Kakasi2/z_en_kakasi2.c | 91 +- .../actors/ovl_En_Kakasi2/z_en_kakasi2.h | 2 +- .../actors/ovl_En_Kakasi3/z_en_kakasi3.c | 197 +- .../actors/ovl_En_Kakasi3/z_en_kakasi3.h | 2 +- .../actors/ovl_En_Kanban/z_en_kanban.c | 90 +- .../actors/ovl_En_Karebaba/z_en_karebaba.c | 151 +- .../actors/ovl_En_Karebaba/z_en_karebaba.h | 2 +- src/overlays/actors/ovl_En_Ko/z_en_ko.c | 415 +- src/overlays/actors/ovl_En_Ko/z_en_ko.h | 2 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 148 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.h | 2 +- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 179 +- src/overlays/actors/ovl_En_Kz/z_en_kz.h | 2 +- src/overlays/actors/ovl_En_Light/z_en_light.c | 56 +- .../actors/ovl_En_Lightbox/z_en_lightbox.c | 30 +- .../actors/ovl_En_M_Fire1/z_en_m_fire1.c | 22 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 106 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.h | 2 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 152 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.h | 2 +- src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 124 +- src/overlays/actors/ovl_En_Ma2/z_en_ma2.h | 2 +- src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 104 +- src/overlays/actors/ovl_En_Ma3/z_en_ma3.h | 2 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 48 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 284 +- src/overlays/actors/ovl_En_Mb/z_en_mb.h | 2 +- src/overlays/actors/ovl_En_Md/z_en_md.c | 187 +- src/overlays/actors/ovl_En_Md/z_en_md.h | 2 +- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 118 +- src/overlays/actors/ovl_En_Mk/z_en_mk.h | 2 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 136 +- src/overlays/actors/ovl_En_Mm/z_en_mm.h | 2 +- src/overlays/actors/ovl_En_Mm2/z_en_mm2.c | 104 +- src/overlays/actors/ovl_En_Mm2/z_en_mm2.h | 2 +- src/overlays/actors/ovl_En_Ms/z_en_ms.c | 88 +- src/overlays/actors/ovl_En_Ms/z_en_ms.h | 2 +- src/overlays/actors/ovl_En_Mu/z_en_mu.c | 69 +- src/overlays/actors/ovl_En_Mu/z_en_mu.h | 2 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 535 +- src/overlays/actors/ovl_En_Nb/z_en_nb.h | 4 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 234 +- src/overlays/actors/ovl_En_Niw/z_en_niw.h | 2 +- .../actors/ovl_En_Niw_Girl/z_en_niw_girl.c | 76 +- .../actors/ovl_En_Niw_Girl/z_en_niw_girl.h | 2 +- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 204 +- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.h | 2 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 62 +- .../actors/ovl_En_Nutsball/z_en_nutsball.h | 2 +- src/overlays/actors/ovl_En_Nwc/z_en_nwc.c | 74 +- src/overlays/actors/ovl_En_Nwc/z_en_nwc.h | 4 +- src/overlays/actors/ovl_En_Ny/z_en_ny.c | 132 +- src/overlays/actors/ovl_En_Ny/z_en_ny.h | 2 +- src/overlays/actors/ovl_En_OE2/z_en_oe2.c | 20 +- src/overlays/actors/ovl_En_OE2/z_en_oe2.h | 2 +- .../z_en_okarina_effect.c | 78 +- .../z_en_okarina_effect.h | 2 +- .../ovl_En_Okarina_Tag/z_en_okarina_tag.c | 139 +- .../ovl_En_Okarina_Tag/z_en_okarina_tag.h | 2 +- src/overlays/actors/ovl_En_Okuta/z_en_okuta.c | 185 +- src/overlays/actors/ovl_En_Okuta/z_en_okuta.h | 2 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 953 ++-- src/overlays/actors/ovl_En_Ossan/z_en_ossan.h | 10 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 504 +- src/overlays/actors/ovl_En_Owl/z_en_owl.h | 2 +- src/overlays/actors/ovl_En_Part/z_en_part.c | 91 +- src/overlays/actors/ovl_En_Part/z_en_part.h | 2 +- .../actors/ovl_En_Peehat/z_en_peehat.c | 226 +- .../actors/ovl_En_Peehat/z_en_peehat.h | 2 +- .../actors/ovl_En_Po_Desert/z_en_po_desert.c | 86 +- .../actors/ovl_En_Po_Desert/z_en_po_desert.h | 2 +- .../actors/ovl_En_Po_Field/z_en_po_field.c | 291 +- .../actors/ovl_En_Po_Field/z_en_po_field.h | 2 +- .../actors/ovl_En_Po_Relay/z_en_po_relay.c | 153 +- .../actors/ovl_En_Po_Relay/z_en_po_relay.h | 2 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 309 +- .../ovl_En_Po_Sisters/z_en_po_sisters.h | 2 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 345 +- src/overlays/actors/ovl_En_Poh/z_en_poh.h | 2 +- .../actors/ovl_En_Pu_box/z_en_pu_box.c | 24 +- src/overlays/actors/ovl_En_Rd/z_en_rd.c | 197 +- src/overlays/actors/ovl_En_Rd/z_en_rd.h | 2 +- src/overlays/actors/ovl_En_Reeba/z_en_reeba.c | 148 +- src/overlays/actors/ovl_En_Reeba/z_en_reeba.h | 2 +- .../ovl_En_River_Sound/z_en_river_sound.c | 27 +- src/overlays/actors/ovl_En_Rl/z_en_rl.c | 194 +- src/overlays/actors/ovl_En_Rl/z_en_rl.h | 4 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 158 +- src/overlays/actors/ovl_En_Rr/z_en_rr.h | 2 +- src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 980 ++-- src/overlays/actors/ovl_En_Ru1/z_en_ru1.h | 6 +- src/overlays/actors/ovl_En_Ru2/z_en_ru2.c | 376 +- src/overlays/actors/ovl_En_Ru2/z_en_ru2.h | 4 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 147 +- src/overlays/actors/ovl_En_Sa/z_en_sa.h | 2 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 101 +- src/overlays/actors/ovl_En_Sb/z_en_sb.h | 2 +- .../ovl_En_Scene_Change/z_en_scene_change.c | 30 +- .../ovl_En_Scene_Change/z_en_scene_change.h | 2 +- src/overlays/actors/ovl_En_Sda/z_en_sda.c | 42 +- .../actors/ovl_En_Shopnuts/z_en_shopnuts.c | 79 +- .../actors/ovl_En_Shopnuts/z_en_shopnuts.h | 2 +- src/overlays/actors/ovl_En_Si/z_en_si.c | 72 +- src/overlays/actors/ovl_En_Si/z_en_si.h | 2 +- .../actors/ovl_En_Siofuki/z_en_siofuki.c | 110 +- .../actors/ovl_En_Siofuki/z_en_siofuki.h | 2 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 138 +- src/overlays/actors/ovl_En_Skb/z_en_skb.h | 2 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 494 +- src/overlays/actors/ovl_En_Skj/z_en_skj.h | 2 +- .../actors/ovl_En_Skjneedle/z_en_skjneedle.c | 38 +- src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 190 +- src/overlays/actors/ovl_En_Ssh/z_en_ssh.h | 2 +- src/overlays/actors/ovl_En_St/z_en_st.c | 204 +- src/overlays/actors/ovl_En_St/z_en_st.h | 2 +- src/overlays/actors/ovl_En_Sth/z_en_sth.c | 152 +- src/overlays/actors/ovl_En_Sth/z_en_sth.h | 2 +- .../actors/ovl_En_Stream/z_en_stream.c | 42 +- .../actors/ovl_En_Stream/z_en_stream.h | 2 +- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 242 +- src/overlays/actors/ovl_En_Sw/z_en_sw.h | 2 +- .../ovl_En_Syateki_Itm/z_en_syateki_itm.c | 71 +- .../ovl_En_Syateki_Itm/z_en_syateki_itm.h | 2 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 129 +- .../ovl_En_Syateki_Man/z_en_syateki_man.h | 2 +- .../ovl_En_Syateki_Niw/z_en_syateki_niw.c | 119 +- .../ovl_En_Syateki_Niw/z_en_syateki_niw.h | 2 +- src/overlays/actors/ovl_En_Ta/z_en_ta.c | 399 +- src/overlays/actors/ovl_En_Ta/z_en_ta.h | 2 +- .../ovl_En_Takara_Man/z_en_takara_man.c | 97 +- .../ovl_En_Takara_Man/z_en_takara_man.h | 2 +- src/overlays/actors/ovl_En_Tana/z_en_tana.c | 36 +- src/overlays/actors/ovl_En_Test/z_en_test.c | 398 +- src/overlays/actors/ovl_En_Test/z_en_test.h | 2 +- src/overlays/actors/ovl_En_Tg/z_en_tg.c | 64 +- src/overlays/actors/ovl_En_Tg/z_en_tg.h | 2 +- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 203 +- src/overlays/actors/ovl_En_Tite/z_en_tite.h | 2 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 144 +- src/overlays/actors/ovl_En_Tk/z_en_tk.h | 2 +- src/overlays/actors/ovl_En_Torch/z_en_torch.c | 6 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 129 +- src/overlays/actors/ovl_En_Toryo/z_en_toryo.c | 122 +- src/overlays/actors/ovl_En_Toryo/z_en_toryo.h | 2 +- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 108 +- src/overlays/actors/ovl_En_Tp/z_en_tp.h | 2 +- src/overlays/actors/ovl_En_Tr/z_en_tr.c | 194 +- src/overlays/actors/ovl_En_Tr/z_en_tr.h | 2 +- src/overlays/actors/ovl_En_Trap/z_en_trap.c | 48 +- .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c | 114 +- .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h | 2 +- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 166 +- src/overlays/actors/ovl_En_Vali/z_en_vali.h | 2 +- src/overlays/actors/ovl_En_Vase/z_en_vase.c | 14 +- .../actors/ovl_En_Vb_Ball/z_en_vb_ball.c | 76 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 345 +- .../actors/ovl_En_Viewer/z_en_viewer.h | 6 +- src/overlays/actors/ovl_En_Vm/z_en_vm.c | 120 +- src/overlays/actors/ovl_En_Vm/z_en_vm.h | 2 +- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c | 44 +- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h | 2 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 191 +- .../actors/ovl_En_Wallmas/z_en_wallmas.h | 2 +- .../ovl_En_Weather_Tag/z_en_weather_tag.c | 226 +- .../ovl_En_Weather_Tag/z_en_weather_tag.h | 2 +- .../actors/ovl_En_Weiyer/z_en_weiyer.c | 127 +- .../actors/ovl_En_Weiyer/z_en_weiyer.h | 2 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 310 +- src/overlays/actors/ovl_En_Wf/z_en_wf.h | 2 +- .../ovl_En_Wonder_Item/z_en_wonder_item.c | 105 +- .../ovl_En_Wonder_Item/z_en_wonder_item.h | 2 +- .../ovl_En_Wonder_Talk/z_en_wonder_talk.c | 64 +- .../ovl_En_Wonder_Talk/z_en_wonder_talk.h | 2 +- .../ovl_En_Wonder_Talk2/z_en_wonder_talk2.c | 76 +- .../ovl_En_Wonder_Talk2/z_en_wonder_talk2.h | 2 +- .../actors/ovl_En_Wood02/z_en_wood02.c | 71 +- src/overlays/actors/ovl_En_Xc/z_en_xc.c | 970 ++-- src/overlays/actors/ovl_En_Xc/z_en_xc.h | 4 +- .../ovl_En_Yabusame_Mark/z_en_yabusame_mark.c | 32 +- .../ovl_En_Yabusame_Mark/z_en_yabusame_mark.h | 2 +- .../actors/ovl_En_Yukabyun/z_en_yukabyun.c | 59 +- .../actors/ovl_En_Yukabyun/z_en_yukabyun.h | 2 +- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 490 +- src/overlays/actors/ovl_En_Zf/z_en_zf.h | 2 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 230 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.h | 2 +- src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 669 ++- src/overlays/actors/ovl_En_Zl2/z_en_zl2.h | 4 +- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 913 ++-- src/overlays/actors/ovl_En_Zl3/z_en_zl3.h | 4 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 466 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.h | 4 +- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 143 +- src/overlays/actors/ovl_En_Zo/z_en_zo.h | 2 +- src/overlays/actors/ovl_En_fHG/z_en_fhg.c | 165 +- src/overlays/actors/ovl_En_fHG/z_en_fhg.h | 2 +- .../actors/ovl_End_Title/z_end_title.c | 42 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 848 ++- .../actors/ovl_Item_B_Heart/z_item_b_heart.c | 46 +- .../ovl_Item_Etcetera/z_item_etcetera.c | 100 +- .../ovl_Item_Etcetera/z_item_etcetera.h | 2 +- .../actors/ovl_Item_Inbox/z_item_inbox.c | 30 +- .../actors/ovl_Item_Inbox/z_item_inbox.h | 2 +- .../actors/ovl_Item_Ocarina/z_item_ocarina.c | 82 +- .../actors/ovl_Item_Ocarina/z_item_ocarina.h | 2 +- .../actors/ovl_Item_Shield/z_item_shield.c | 63 +- .../actors/ovl_Item_Shield/z_item_shield.h | 2 +- .../actors/ovl_Magic_Dark/z_magic_dark.c | 99 +- .../actors/ovl_Magic_Fire/z_magic_fire.c | 50 +- .../actors/ovl_Magic_Wind/z_magic_wind.c | 83 +- .../actors/ovl_Magic_Wind/z_magic_wind.h | 2 +- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 78 +- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 216 +- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h | 2 +- .../ovl_Obj_Blockstop/z_obj_blockstop.c | 20 +- .../actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c | 54 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 64 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h | 2 +- .../actors/ovl_Obj_Dekujr/z_obj_dekujr.c | 59 +- .../actors/ovl_Obj_Elevator/z_obj_elevator.c | 36 +- .../actors/ovl_Obj_Elevator/z_obj_elevator.h | 2 +- .../actors/ovl_Obj_Hamishi/z_obj_hamishi.c | 62 +- src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c | 26 +- .../actors/ovl_Obj_Hsblock/z_obj_hsblock.c | 58 +- .../actors/ovl_Obj_Hsblock/z_obj_hsblock.h | 2 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c | 68 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h | 2 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.c | 116 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.h | 2 +- .../actors/ovl_Obj_Kibako2/z_obj_kibako2.c | 71 +- .../actors/ovl_Obj_Kibako2/z_obj_kibako2.h | 2 +- src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 62 +- src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h | 2 +- .../ovl_Obj_Lightswitch/z_obj_lightswitch.c | 139 +- .../ovl_Obj_Lightswitch/z_obj_lightswitch.h | 2 +- .../ovl_Obj_Makekinsuta/z_obj_makekinsuta.c | 22 +- .../ovl_Obj_Makekinsuta/z_obj_makekinsuta.h | 2 +- .../ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c | 27 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c | 80 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h | 2 +- .../actors/ovl_Obj_Mure2/z_obj_mure2.c | 38 +- .../actors/ovl_Obj_Mure2/z_obj_mure2.h | 2 +- .../actors/ovl_Obj_Mure3/z_obj_mure3.c | 58 +- .../actors/ovl_Obj_Mure3/z_obj_mure3.h | 4 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 191 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h | 2 +- .../ovl_Obj_Roomtimer/z_obj_roomtimer.c | 32 +- .../ovl_Obj_Roomtimer/z_obj_roomtimer.h | 2 +- .../actors/ovl_Obj_Switch/z_obj_switch.c | 224 +- .../actors/ovl_Obj_Switch/z_obj_switch.h | 2 +- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 80 +- .../ovl_Obj_Timeblock/z_obj_timeblock.c | 128 +- .../ovl_Obj_Timeblock/z_obj_timeblock.h | 4 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 131 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.h | 2 +- .../ovl_Obj_Warp2block/z_obj_warp2block.c | 111 +- .../ovl_Obj_Warp2block/z_obj_warp2block.h | 4 +- .../ovl_Object_Kankyo/z_object_kankyo.c | 280 +- .../ovl_Object_Kankyo/z_object_kankyo.h | 2 +- .../actors/ovl_Oceff_Spot/z_oceff_spot.c | 67 +- .../actors/ovl_Oceff_Spot/z_oceff_spot.h | 2 +- .../actors/ovl_Oceff_Storm/z_oceff_storm.c | 64 +- .../actors/ovl_Oceff_Storm/z_oceff_storm.h | 2 +- .../actors/ovl_Oceff_Wipe/z_oceff_wipe.c | 42 +- .../actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c | 42 +- .../actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c | 42 +- .../actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c | 40 +- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 68 +- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h | 2 +- .../actors/ovl_player_actor/z_player.c | 4655 ++++++++--------- .../ovl_Effect_Ss_Blast/z_eff_ss_blast.c | 18 +- .../ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c | 16 +- .../ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c | 26 +- .../ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c | 18 +- .../ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c | 24 +- .../ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c | 16 +- .../ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c | 14 +- .../ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c | 24 +- .../z_eff_ss_dead_sound.c | 8 +- .../z_eff_ss_dt_bubble.c | 14 +- .../ovl_Effect_Ss_Dust/z_eff_ss_dust.c | 20 +- .../ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c | 26 +- .../ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c | 26 +- .../ovl_Effect_Ss_Extra/z_eff_ss_extra.c | 32 +- .../ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c | 20 +- .../z_eff_ss_fhg_flash.c | 44 +- .../z_eff_ss_fire_tail.c | 34 +- .../ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c | 14 +- .../ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c | 14 +- .../z_eff_ss_g_magma2.c | 22 +- .../z_eff_ss_g_ripple.c | 26 +- .../ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c | 20 +- .../z_eff_ss_g_splash.c | 20 +- .../ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c | 40 +- .../ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c | 16 +- .../z_eff_ss_ice_piece.c | 22 +- .../z_eff_ss_ice_smoke.c | 43 +- .../ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c | 24 +- .../ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c | 44 +- .../z_eff_ss_kirakira.c | 24 +- .../z_eff_ss_lightning.c | 28 +- .../ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c | 18 +- .../ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c | 14 +- .../z_eff_ss_solder_srch_ball.c | 12 +- .../ovl_Effect_Ss_Stick/z_eff_ss_stick.c | 20 +- .../ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c | 16 +- .../ovl_file_choose/z_file_choose.c | 2 +- .../gamestates/ovl_opening/z_opening.c | 2 +- src/overlays/gamestates/ovl_select/z_select.c | 2 +- .../ovl_kaleido_scope/z_kaleido_collect.c | 10 +- .../misc/ovl_kaleido_scope/z_kaleido_debug.c | 69 +- .../ovl_kaleido_scope/z_kaleido_equipment.c | 67 +- .../misc/ovl_kaleido_scope/z_kaleido_item.c | 62 +- .../ovl_kaleido_scope/z_kaleido_map_PAL.c | 30 +- .../misc/ovl_kaleido_scope/z_kaleido_prompt.c | 6 +- .../misc/ovl_kaleido_scope/z_kaleido_scope.h | 28 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 258 +- .../misc/ovl_kaleido_scope/z_lmap_mark.c | 32 +- tools/bootstrap_actors.py | 8 +- tools/bootstrap_fx.py | 6 +- tools/namefixer.py | 4 +- 912 files changed, 40489 insertions(+), 41078 deletions(-) diff --git a/docs/tutorial/beginning_decomp.md b/docs/tutorial/beginning_decomp.md index c9421ffd30..f6b0025349 100644 --- a/docs/tutorial/beginning_decomp.md +++ b/docs/tutorial/beginning_decomp.md @@ -43,7 +43,7 @@ The general rule for order of decompilation is - Next, decompile any other functions from the actor you have found in `Init`. You generally start with the action functions, because they return nothing and all take the same arguments, ```C -void func_80whatever(EnJj* this, GlobalContext* globalCtx); +void func_80whatever(EnJj* this, PlayState* play); ``` - Decompile each action function in turn until you run out. Along the way, do any other functions in the actor for which you have discovered the argument types. (You are probably better doing depth-first on action functions than breadth-first: it's normally easier to follow along one branch of the actions than ) @@ -103,7 +103,7 @@ Copy the entire contents of this file into the upper box, labelled "MIPS assembl Now press "Decompile". This should produce C code: ```C -void EnJj_Init(EnJj *this, GlobalContext *globalCtx) { +void EnJj_Init(EnJj *this, PlayState *play) { CollisionHeader *sp4C; DynaCollisionContext *sp44; DynaCollisionContext *temp_a1; @@ -146,7 +146,7 @@ While we are carrying out initial changes, you can also find-and-replace any ins ```C -void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { +void EnJj_Init(Actor *thisx, PlayState *play) { EnJj* this = THIS; CollisionHeader *sp4C; @@ -164,7 +164,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { temp_a1 = this + 0x164; if (temp_v0 == -1) { sp44 = temp_a1; - SkelAnime_InitFlex(globalCtx, (SkelAnime *) temp_a1, (FlexSkeletonHeader *) &D_0600B9A8, (AnimationHeader *) &D_06001F4C, this + 0x1A8, this + 0x22C, 0x16); + SkelAnime_InitFlex(play, (SkelAnime *) temp_a1, (FlexSkeletonHeader *) &D_0600B9A8, (AnimationHeader *) &D_06001F4C, this + 0x1A8, this + 0x22C, 0x16); Animation_PlayLoop((SkelAnime *) sp44, (AnimationHeader *) &D_06001F4C); this->unk30A = (u16)0; this->unk30E = (u8)0; @@ -176,25 +176,25 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { } else { func_80A87800(this, &func_80A87C30); } - this->unk300 = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, (u16)0x5A, this->actor.world.pos.x - 10.0f, this->actor.world.pos.y, this->actor.world.pos.z, 0, (?32) this->actor.world.rot.y, 0, 0); + this->unk300 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, (u16)0x5A, this->actor.world.pos.x - 10.0f, this->actor.world.pos.y, this->actor.world.pos.z, 0, (?32) this->actor.world.rot.y, 0, 0); DynaPolyActor_Init((DynaPolyActor *) this, 0); CollisionHeader_GetVirtual((void *) &D_06000A1C, &sp4C); - this->unk_14C = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, sp4C); + this->unk_14C = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->actor, sp4C); temp_a1_3 = this + 0x2B0; sp44 = temp_a1_3; - Collider_InitCylinder(globalCtx, (ColliderCylinder *) temp_a1_3); - Collider_SetCylinder(globalCtx, (ColliderCylinder *) temp_a1_3, &this->actor, &D_80A88CB4); + Collider_InitCylinder(play, (ColliderCylinder *) temp_a1_3); + Collider_SetCylinder(play, (ColliderCylinder *) temp_a1_3, &this->actor, &D_80A88CB4); this->actor.colChkInfo.mass = 0xFF; return; } if (temp_v0 == 0) { DynaPolyActor_Init((DynaPolyActor *) this, 0); CollisionHeader_GetVirtual((void *) &D_06001830, &sp4C); - temp_a1_2 = &globalCtx->colCtx.dyna; + temp_a1_2 = &play->colCtx.dyna; sp44 = temp_a1_2; - temp_v0_2 = DynaPoly_SetBgActor(globalCtx, temp_a1_2, &this->actor, sp4C); + temp_v0_2 = DynaPoly_SetBgActor(play, temp_a1_2, &this->actor, sp4C); this->unk_14C = temp_v0_2; - func_8003ECA8(globalCtx, temp_a1_2, (s32) temp_v0_2); + func_8003ECA8(play, temp_a1_2, (s32) temp_v0_2); this->actor.update = &func_80A87F44; this->actor.draw = NULL; Actor_SetScale(&this->actor, 0.087f); @@ -205,7 +205,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { } DynaPolyActor_Init((DynaPolyActor *) this, 0); CollisionHeader_GetVirtual((void *) &D_0600BA8C, &sp4C); - this->unk_14C = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, sp4C); + this->unk_14C = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->actor, sp4C); this->actor.update = &func_80A87F44; this->actor.draw = NULL; Actor_SetScale(&this->actor, 0.087f); @@ -281,7 +281,7 @@ Glancing through the rest of `EnJj_Init`, we notice some references to DynaPoly, ```C DynaPolyActor_Init((DynaPolyActor *) this, 0); CollisionHeader_GetVirtual((void *) &D_06000A1C, &sp4C); -this->unk_14C = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, sp4C); +this->unk_14C = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->actor, sp4C); ``` This means that EnJj is not an ordinary actor: it is instead a DynaPoly actor. In-game this is to do with how the actor interacts with Link and the environment (a good rule of thumb is that Link can often stand on DynaPoly actors as if they were ground). For decompilation purposes, it means that the actor struct is wrong: the first element of a DynaPoly actor's struct is not an `Actor` struct, but a `DynaPolyActor`, usually called `dyna`. We should fix this immediately to avoid confusion later. (Some actors have this correctly identified already; we were unlucky with this one.) @@ -318,7 +318,7 @@ Now that we know this, it is worth remaking the context file and running mips2c ```C DynaPolyActor_Init((DynaPolyActor *) this, 0); CollisionHeader_GetVirtual((void *) &D_06000A1C, &sp4C); -this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C); +this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); ``` Next, replace `(DynaPolyActor *) this` by `&this->dyna`. There's not a lot more we can do to the DynaPoly stuff right now, so just remove the casts to void and move on. @@ -331,8 +331,8 @@ The relevant functions in this actor are ```C temp_a1_3 = this + 0x2B0; sp44 = temp_a1_3; -Collider_InitCylinder(globalCtx, (ColliderCylinder *) temp_a1_3); -Collider_SetCylinder(globalCtx, (ColliderCylinder *) temp_a1_3, &this->dyna.actor, &D_80A88CB4); +Collider_InitCylinder(play, (ColliderCylinder *) temp_a1_3); +Collider_SetCylinder(play, (ColliderCylinder *) temp_a1_3, &this->dyna.actor, &D_80A88CB4); ``` Notice that `sp44` is set, but actually not used anywhere in the actor. This is a good indication that it is fake. We'll get back to that. Similarly, `temp_a1_3` is only used in these functions, so is likely to be fake as well: it's simply trying to get the pointer into the `a1` register. @@ -349,8 +349,8 @@ typedef struct EnJj { Now replace the temps, so we have ```C -Collider_InitCylinder(globalCtx, &this->collider); -Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &D_80A88CB4); +Collider_InitCylinder(play, &this->collider); +Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &D_80A88CB4); ``` (You may prefer to just comment out temps initially, to keep track of where they were.) @@ -398,7 +398,7 @@ This is the combined system that handles actors' skeletons and their animations. temp_a1 = this->unk_164; ... sp44 = (DynaCollisionContext *) temp_a1; -SkelAnime_InitFlex(globalCtx, (SkelAnime *) temp_a1, (FlexSkeletonHeader *) &D_0600B9A8, (AnimationHeader *) &D_06001F4C, this + 0x1A8, this + 0x22C, 0x16); +SkelAnime_InitFlex(play, (SkelAnime *) temp_a1, (FlexSkeletonHeader *) &D_0600B9A8, (AnimationHeader *) &D_06001F4C, this + 0x1A8, this + 0x22C, 0x16); Animation_PlayLoop((SkelAnime *) sp44, (AnimationHeader *) &D_06001F4C); ``` @@ -438,7 +438,7 @@ extern UNK_TYPE D_0600BA8C; and removing the temps, ```C -SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22); +SkelAnime_InitFlex(play, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22); Animation_PlayLoop(&this->skelAnime, &D_06001F4C); ``` @@ -446,13 +446,13 @@ Animation_PlayLoop(&this->skelAnime, &D_06001F4C); This function also gives us information about other things in the struct. One obvious thing that sticks out is ```C -this->unk300 = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, (u16)0x5A, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, (?32) this->dyna.actor.world.rot.y, 0, 0); +this->unk300 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, (u16)0x5A, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, (?32) this->dyna.actor.world.rot.y, 0, 0); ``` Hovering over this function tells us it outputs a pointer to the spawned actor, so `this->unk_300` is an `Actor*`. We may or may not care what this actor actually is, depending on how it is used later on, so let's just add `/* 0x0300 */ Actor* childActor` to the struct for now. We can look up what the actor with ID 0x5A is in `z64actor.h`: we find it is `ACTOR_EN_JJ`. So some Jabus spawn another Jabu. Filling this in and removing the spurious cast, we have ```C -this->childActor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, 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->childActor = 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); ``` Finally, we have this block: @@ -491,7 +491,7 @@ typedef struct EnJj { We can remove a few more temps that don't look real, and end up with ```C -void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { +void EnJj_Init(Actor *thisx, PlayState *play) { EnJj* this = THIS; CollisionHeader *sp4C; @@ -509,7 +509,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { // temp_a1 = this->unk_164; if (temp_v0 == -1) { // sp44 = (DynaCollisionContext *) temp_a1; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22); Animation_PlayLoop(&this->skelAnime, &D_06001F4C); this->unk_30A = 0; this->unk_30E = 0; @@ -521,24 +521,24 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { } else { func_80A87800(this, &func_80A87C30); } - this->childActor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, 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->childActor = 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); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&D_06000A1C, &sp4C); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); // temp_a1_3 = this + 0x2B0; // sp44 = temp_a1_3; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &D_80A88CB4); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &D_80A88CB4); this->dyna.actor.colChkInfo.mass = 0xFF; return; } if (temp_v0 == 0) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&D_06001830, &sp4C); - // temp_a1_2 = &globalCtx->colCtx.dyna; + // temp_a1_2 = &play->colCtx.dyna; // sp44 = temp_a1_2; - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C); - func_8003ECA8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); + func_8003ECA8(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.update = &func_80A87F44; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); @@ -549,7 +549,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { } DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&D_0600BA8C, &sp4C); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, 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); @@ -563,12 +563,12 @@ This will still not compile without errors: we need to know what the functions i Function pointers do not need `&`, so remove all those. There are three functions that are called in this actor. Firstly, `this->dyna.actor.update = func_80A87F44;` tells us that `func_80A87F44` is an alternative update function for this actor. We therefore give it a prototype similar to the original Update: ```C -void EnJj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Draw(Actor* thisx, GlobalContext* globalCtx); +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* play); -void func_80A87F44(Actor* thisx, GlobalContext* globalCtx); +void func_80A87F44(Actor* thisx, PlayState* play); ``` Unfortunately the others are not so easy to deal with. In order to find out what type the functions called by `func_80A87800`, we have to look at `func_80A87800` itself. But fortunately, this is the entire MIPS for `func_80A87800`: @@ -583,7 +583,7 @@ This is simple enough to read that we don't even need to appeal to mips2c: it sa *Action functions* are the main other kind of function in most actors: they are usually run by Update every frame, and carry out the main actions that the actor does (hence the name). They all have the same arguments, and so we have a typedef for such things: it is ```C -typedef void (*EnJjActionFunc)(struct EnJj*, GlobalContext*); +typedef void (*EnJjActionFunc)(struct EnJj*, PlayState*); ``` Put this between `struct EnJj;` and the actor struct in the header file. This also gives us another bit of the struct, conveniently plugging the gap at `0x2FC`: ```C @@ -599,14 +599,14 @@ void func_80A87800(EnJj* this, EnJjActionFunc actionFunc) { and that `func_80A87BEC` and `func_80A87C30`, passed to it in `EnJj_Init`, are action functions. Since they are first used above where they are defined, we prototype them at the top as well, ```C -void EnJj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Draw(Actor* thisx, GlobalContext* globalCtx); +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* play); -void func_80A87F44(Actor* thisx, GlobalContext* globalCtx); -void func_80A87BEC(EnJj* this, GlobalContext* globalCtx); -void func_80A87C30(EnJj* this, GlobalContext* globalCtx); +void func_80A87F44(Actor* thisx, PlayState* play); +void func_80A87BEC(EnJj* this, PlayState* play); +void func_80A87C30(EnJj* this, PlayState* play); ``` @@ -629,14 +629,14 @@ With all of this implemented, the function should now compile without errors. Th ```C -void EnJj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Draw(Actor* thisx, GlobalContext* globalCtx); +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* play); -void func_80A87F44(Actor* thisx, GlobalContext* globalCtx); -void func_80A87BEC(EnJj* this, GlobalContext* globalCtx); -void func_80A87C30(EnJj* this, GlobalContext* globalCtx); +void func_80A87F44(Actor* thisx, PlayState* play); +void func_80A87BEC(EnJj* this, PlayState* play); +void func_80A87C30(EnJj* this, PlayState* play); /* const ActorInit En_Jj_InitVars = { @@ -699,7 +699,7 @@ void func_80A87800(EnJj* this, EnJjActionFunc actionFunc) { } // #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Jj/EnJj_Init.s") -void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { +void EnJj_Init(Actor *thisx, PlayState *play) { EnJj* this = THIS; CollisionHeader *sp4C; @@ -717,7 +717,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { // temp_a1 = this->unk_164; if (temp_v0 == -1) { // sp44 = (DynaCollisionContext *) temp_a1; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22); Animation_PlayLoop(&this->skelAnime, &D_06001F4C); this->unk_30A = 0; this->unk_30E = 0; @@ -729,24 +729,24 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { } else { func_80A87800(this, func_80A87C30); } - this->childActor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, 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->childActor = 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); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&D_06000A1C, &sp4C); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); // temp_a1_3 = this + 0x2B0; // sp44 = temp_a1_3; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &D_80A88CB4); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &D_80A88CB4); this->dyna.actor.colChkInfo.mass = 0xFF; return; } if (temp_v0 == 0) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&D_06001830, &sp4C); - // temp_a1_2 = &globalCtx->colCtx.dyna; + // temp_a1_2 = &play->colCtx.dyna; // sp44 = temp_a1_2; - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C); - func_8003ECA8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); + func_8003ECA8(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.update = func_80A87F44; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); @@ -757,7 +757,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) { } DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&D_0600BA8C, &sp4C); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, 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); @@ -827,7 +827,7 @@ You can keep the diff open in the terminal, and it will refresh when the C file In this case, we see that various branches are happening in the wrong place. Here I fear experience is necessary: notice that the function has three blocks that look quite similar, and three separate conditionals that depend on the same variable. This is a good indicator of a switch. Changing the function to use a switch, ```C -void EnJj_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnJj_Init(Actor* thisx, PlayState* play) { EnJj* this = THIS; s32 sp4C; @@ -840,7 +840,7 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx) { switch (temp_v0) { case -1: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22); Animation_PlayLoop(&this->skelAnime, &D_06001F4C); this->unk_30A = 0; @@ -854,24 +854,24 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A87800(this, func_80A87C30); } this->childActor = Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, + &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(&D_06000A1C, &sp4C); this->dyna.bgId = - DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &D_80A88CB4); + DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &D_80A88CB4); this->dyna.actor.colChkInfo.mass = 0xFF; break; case 0: DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&D_06001830, &sp4C); - // temp_a1_2 = &globalCtx->colCtx.dyna; + // temp_a1_2 = &play->colCtx.dyna; // sp44 = temp_a1_2; this->dyna.bgId = - DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C); - func_8003ECA8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); + func_8003ECA8(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.update = func_80A87F44; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); @@ -880,7 +880,7 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&D_0600BA8C, &sp4C); this->dyna.bgId = - DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C); + 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); @@ -899,10 +899,10 @@ we see that the diff is nearly correct (note that `-3` lets you compare current ![Init diff 2](images/init_diff2.png) -except we still have some stack issues. Now that `temp_v0` is only used once, it looks fake. Eliminating it actually seems to make the stack worse. To fix this, we employ something that we have evidence that the developers did: namely, we make a copy of `globalCtx` (the theory is that they actually used `gameState` as an argument of the main 4 functions, just like we used `Actor* thisx` as the first argument.) The quick way to do this is to change the top of the function to +except we still have some stack issues. Now that `temp_v0` is only used once, it looks fake. Eliminating it actually seems to make the stack worse. To fix this, we employ something that we have evidence that the developers did: namely, we make a copy of `play` (the theory is that they actually used `gameState` as an argument of the main 4 functions, just like we used `Actor* thisx` as the first argument.) The quick way to do this is to change the top of the function to ```C -void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnJj_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnJj* this = THIS; ... ``` diff --git a/docs/tutorial/data.md b/docs/tutorial/data.md index d3d1648d04..3385224367 100644 --- a/docs/tutorial/data.md +++ b/docs/tutorial/data.md @@ -84,10 +84,10 @@ Large code block, click to show #define THIS ((EnTg*)thisx) -void EnTg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTg_Init(Actor* thisx, PlayState* play); +void EnTg_Destroy(Actor* thisx, PlayState* play); +void EnTg_Update(Actor* thisx, PlayState* play); +void EnTg_Draw(Actor* thisx, PlayState* play); s32 D_80B18910[] = { 0x0A000039, 0x20010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00140040, 0x00000000, 0x00000000 }; @@ -136,18 +136,18 @@ to tell the compiler not to look for the data in that file any more. Now run `ma Now carry out the usual steps to decompile `Init`. The usual cleanup and struct population gets us to ```C -void EnTg_Init(Actor *thisx, GlobalContext *globalCtx) { +void EnTg_Init(Actor *thisx, PlayState *play) { EnTg *this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 28.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600AE40, &D_06005040, 0, 0, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, (ColliderCylinderInit *) D_80B18910); + SkelAnime_InitFlex(play, &this->skelAnime, &D_0600AE40, &D_06005040, 0, 0, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, (ColliderCylinderInit *) D_80B18910); func_80061EFC(&this->actor.colChkInfo, NULL, (CollisionCheckInfoInit2 *) D_80B1893C); this->actor.unk_1F = 6; Actor_SetScale(&this->actor, 0.01f); this->actionFunc = func_80B185C0; - this->unk_208 = globalCtx->state.frames & 1; + this->unk_208 = play->state.frames & 1; } ``` and it remains to deal with the data. mips2c has told us what the types should be. We run `colliderinit` on `D_80B18910` as usual, which gives @@ -182,7 +182,7 @@ CollisionCheckInfoInit2 D_80B1893C = { 0, 0, 0, 0, 0xFF }; One more thing needs to change: since both are no longer arrays, we need to make the uses in the functions pointers: ```C -Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80B18910); +Collider_SetCylinder(play, &this->collider, &this->actor, &D_80B18910); func_80061EFC(&this->actor.colChkInfo, NULL, &D_80B1893C); ``` @@ -190,7 +190,7 @@ A quick check of the diff shows that we just need to put the action function set Following the function tree as usual, we find the only other place any data is used is in `func_80B1871C`. From its use in `EnTg_Draw`, we realise that this is a `PostLimbDraw` function. Giving mips2c the correct prototype, it comes out as ```C -void func_80B1871C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void func_80B1871C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { ? sp18; sp18.unk0 = (s32) D_80B18968->unk0; @@ -207,7 +207,7 @@ Vec3f D_80B18968 = { 0.0f, 800.0f, 0.0f }; ``` and the function matches as ```C -void func_80B1871C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void func_80B1871C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnTg* this = THIS; Vec3f sp18 = D_80B18968; diff --git a/docs/tutorial/draw_functions.md b/docs/tutorial/draw_functions.md index 8678ac03c3..77d333b5eb 100644 --- a/docs/tutorial/draw_functions.md +++ b/docs/tutorial/draw_functions.md @@ -12,13 +12,13 @@ For this tutorial we will first look at the `EnJj` draw function, `EnJj_Draw`, t Unless it is completely invisible, an actor usually has a draw function as one of the main four actor functions. Hence its prototype looks like ```C -EnJj_Draw(Actor* thisx, GlobalContext* globalCtx); +EnJj_Draw(Actor* thisx, PlayState* play); ``` As in Init, Destroy and Update, it is much more convenient to feed mips2c the fake prototype ```C -EnJj_Draw(EnJj* this, GlobalContext* globalCtx); +EnJj_Draw(EnJj* this, PlayState* play); ``` so that it fills out the struct fields from the actuar actor; we then put a @@ -29,7 +29,7 @@ EnJj* this = THIS; in the declarations as before. From now on, the process is rather different from the decompilation process used for the other functions. Here is the output of mips2c after sorting out the actor struct from Init, and with the arguments set back to `Actor* thisx`: ```C -void EnJj_Draw(Actor *thisx, GlobalContext *globalCtx) { +void EnJj_Draw(Actor *thisx, PlayState *play) { EnJj* this = THIS; GraphicsContext *sp4C; @@ -39,10 +39,10 @@ void EnJj_Draw(Actor *thisx, GlobalContext *globalCtx) { GraphicsContext *temp_a1; s32 temp_a0; - temp_a1 = globalCtx->state.gfxCtx; + temp_a1 = play->state.gfxCtx; sp4C = temp_a1; Graph_OpenDisps(&sp3C, temp_a1, (const char *) "../z_en_jj.c", 0x36F); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); Matrix_Translate(0.0f, (cosf(this->skelAnime.curFrame * 0.076624215f) * 10.0f) - 10.0f, 0.0f, (u8)1U); Matrix_Scale(10.0f, 10.0f, 10.0f, (u8)1U); temp_v1 = temp_a1->polyOpa.p; @@ -51,8 +51,8 @@ void EnJj_Draw(Actor *thisx, GlobalContext *globalCtx) { temp_a0 = *(&D_80A88CFC + (this->unk_30E * 4)); temp_v1->words.w1 = (temp_a0 & 0xFFFFFF) + gSegments[(u32) (temp_a0 * 0x10) >> 0x1C] + 0x80000000; sp18 = this; - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32) this->skelAnime.dListCount, 0, 0); - Graph_CloseDisps(&sp3C, globalCtx->state.gfxCtx, (const char *) "../z_en_jj.c", 0x382); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32) this->skelAnime.dListCount, 0, 0); + Graph_CloseDisps(&sp3C, play->state.gfxCtx, (const char *) "../z_en_jj.c", 0x382); } ``` @@ -131,7 +131,7 @@ OPEN_DISPS(temp_a1, "../z_en_jj.c", 879); ``` (the last argument is a line number, so should be in decimal). -The function may or may not use a temp for `globalCtx->state.gfxCtx`: you have to work it out using the diff. +The function may or may not use a temp for `play->state.gfxCtx`: you have to work it out using the diff. Once you've replaced all the blocks and the open and close with macros, you proceed with the function as usual. @@ -141,21 +141,21 @@ Two last things: the last argument of the matrix functions tells the compiler wh After all that, it turns out that ```C -void EnJj_Draw(Actor *thisx, GlobalContext *globalCtx) { +void EnJj_Draw(Actor *thisx, PlayState *play) { EnJj *this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_jj.c", 879); - func_800943C8(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_jj.c", 879); + func_800943C8(play->state.gfxCtx); Matrix_Translate(0.0f, (cosf(this->skelAnime.curFrame * (M_PI/41.0f)) * 10.0f) - 10.0f, 0.0f, 1); Matrix_Scale(10.0f, 10.0f, 10.0f, 1); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80A88CFC[this->unk_30E])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, 0, 0, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_jj.c", 898); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_jj.c", 898); } ``` -matches apart from a couple of stack differences. This can be resolved by giving it `GlobalContext* globalCtx = globalCtx2;` at the top of the function and changing the second argument to `globalCtx2` as usual. +matches apart from a couple of stack differences. This can be resolved by giving it `PlayState* play = play2;` at the top of the function and changing the second argument to `play2` as usual. We have enums for the last argument of the matrix functions: `0` is `MTXMODE_NEW`, `1` is `MTXMODE_APPLY`. @@ -169,7 +169,7 @@ For more examples of graphics macros and the structure of Draw functions, we loo The mips2c output for ```C -void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) { +void func_809F5A6C(Actor *thisx, PlayState *play) { ? sp60; Gfx *sp48; Gfx *sp38; @@ -187,17 +187,17 @@ void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) { sp60.unk0 = (s32) D_809F5E94.unk0; sp60.unk4 = (s32) D_809F5E94.unk4; sp60.unk8 = (s32) D_809F5E94.unk8; - temp_a1 = globalCtx->state.gfxCtx; + temp_a1 = play->state.gfxCtx; temp_s0 = temp_a1; Graph_OpenDisps(&sp48, temp_a1, (const char *) "../z_en_dnt_nomal.c", 0x6FE); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); temp_v0 = temp_s0->polyOpa.p; temp_s0->polyOpa.p = temp_v0 + 8; temp_v0->words.w0 = 0xDB060020; temp_a0 = *(&D_809F5EA0 + (thisx->unk268 * 4)); temp_v0->words.w1 = (temp_a0 & 0xFFFFFF) + gSegments[(u32) (temp_a0 * 0x10) >> 0x1C] + 0x80000000; sp14 = thisx; - SkelAnime_DrawOpa(globalCtx, thisx->unk150, thisx->unk16C, &func_809F58E4, &func_809F59E4); + SkelAnime_DrawOpa(play, thisx->unk150, thisx->unk16C, &func_809F58E4, &func_809F59E4); Matrix_Translate(thisx->unk21C, thisx->unk220, (bitwise f32) thisx->unk224, (u8)0U); Matrix_Scale(0.01f, 0.01f, 0.01f, (u8)1U); temp_v0_2 = temp_s0->polyOpa.p; @@ -213,14 +213,14 @@ void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) { temp_s0->polyOpa.p = temp_v0_4 + 8; temp_v0_4->words.w0 = 0xDA380003; sp38 = temp_v0_4; - sp38->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx, (char *) "../z_en_dnt_nomal.c", 0x716); + sp38->words.w1 = Matrix_NewMtx(play->state.gfxCtx, (char *) "../z_en_dnt_nomal.c", 0x716); temp_v0_5 = temp_s0->polyOpa.p; temp_s0->polyOpa.p = temp_v0_5 + 8; temp_v0_5->words.w1 = (u32) &D_06001B00; temp_v0_5->words.w0 = 0xDE000000; - Graph_CloseDisps(&sp48, globalCtx->state.gfxCtx, (const char *) "../z_en_dnt_nomal.c", 0x719); + Graph_CloseDisps(&sp48, play->state.gfxCtx, (const char *) "../z_en_dnt_nomal.c", 0x719); if (&func_809F49A4 == thisx->unk214) { - func_80033C30((Vec3f *) &thisx->world, (Vec3f *) &sp60, (u8)0xFFU, globalCtx); + func_80033C30((Vec3f *) &thisx->world, (Vec3f *) &sp60, (u8)0xFFU, play); } } ``` @@ -328,7 +328,7 @@ temp_v0_4 = temp_s0->polyOpa.p; temp_s0->polyOpa.p = temp_v0_4 + 8; temp_v0_4->words.w0 = 0xDA380003; sp38 = temp_v0_4; -sp38->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx, (char *) "../z_en_dnt_nomal.c", 0x716); +sp38->words.w1 = Matrix_NewMtx(play->state.gfxCtx, (char *) "../z_en_dnt_nomal.c", 0x716); ``` The macro is ``` @@ -337,7 +337,7 @@ gSPMatrix(POLY_OPA_DISP++, 0x12345678, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVI ``` and the second argument is filled by the `Matrix_NewMtx` function: ```C -gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1814), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1814), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); ``` Lastly, @@ -359,7 +359,7 @@ gSPDisplayList(POLY_OPA_DISP++, D_06001B00); Putting this all together ```C -void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) { +void func_809F5A6C(Actor *thisx, PlayState *play) { EnDntNormal *this = THIS; ? sp60; Actor *sp14; @@ -369,26 +369,26 @@ void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) { sp60.unk4 = (s32) D_809F5E94.unk4; sp60.unk8 = (s32) D_809F5E94.unk8; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1790); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1790); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809F5EA0[this->unk_268])); sp14 = this; - SkelAnime_DrawOpa(globalCtx, thisx->unk150, thisx->unk16C, &func_809F58E4, &func_809F59E4); + SkelAnime_DrawOpa(play, thisx->unk150, thisx->unk16C, &func_809F58E4, &func_809F59E4); Matrix_Translate(thisx->unk21C, thisx->unk220, (bitwise f32) thisx->unk224, (u8)0U); Matrix_Scale(0.01f, 0.01f, 0.01f, (u8)1U); gDPPipeSync(POLY_OPA_DISP++); temp_v1 = D_809F5E4C[this->unk_26A - 1]; gDPSetEnvColor(POLY_OPA_DISP++, temp_v1.r, temp_v1.g, temp_v1.r, 0xFF); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1814), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1814), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_06001B00); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1817); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1817); if (&func_809F49A4 == this->unk214) { - func_80033C30((Vec3f *) &this.actor->world, (Vec3f *) &sp60, (u8)0xFFU, globalCtx); + func_80033C30((Vec3f *) &this.actor->world, (Vec3f *) &sp60, (u8)0xFFU, play); } } ``` @@ -398,23 +398,23 @@ void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) { Some more general tidying up can be done here (`sp60` and so `D_809F5E94` are `Vec3f`, for example, and under normal circumstances we'd know that ), but the big remaining issue is ```C sp14 = this; -SkelAnime_DrawOpa(globalCtx, thisx->unk150, thisx->unk16C, func_809F58E4, func_809F59E4); +SkelAnime_DrawOpa(play, thisx->unk150, thisx->unk16C, func_809F58E4, func_809F59E4); ``` If we look at the definition of `SkelAnime_DrawOpa`, we find that it's missing the last argument. This is mips2c not noticing why `this` has been put on the stack: this code should actually be ```C -SkelAnime_DrawOpa(globalCtx, thisx->unk150, thisx->unk16C, func_809F58E4, func_809F59E4, this); +SkelAnime_DrawOpa(play, thisx->unk150, thisx->unk16C, func_809F58E4, func_809F59E4, this); ``` mips2c doing this is not especially unusual, so bear it in mind. The other thing this tells us is that `func_809F58E4` is of type `OverrideLimbDraw`, and `func_809F59E4` of type `PostLimbDraw`. Their names are fairly self-explanatory. Filling in the prototypes as ```C -s32 func_809F58E4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -void func_809F59E4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); +s32 func_809F58E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); +void func_809F59E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); ``` and running mips2c gives ```C -s32 func_809F58E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, void *thisx) { +s32 func_809F58E4(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, void *thisx) { GraphicsContext *sp38; Gfx *sp28; Gfx *temp_v1; @@ -423,7 +423,7 @@ s32 func_809F58E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *p void *temp_v0; if ((limbIndex == 1) || (limbIndex == 3) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6)) { - temp_a1 = globalCtx->state.gfxCtx; + temp_a1 = play->state.gfxCtx; sp38 = temp_a1; Graph_OpenDisps(&sp28, temp_a1, (const char *) "../z_en_dnt_nomal.c", 0x6C5); temp_v1 = sp38->polyOpa.p; @@ -435,12 +435,12 @@ s32 func_809F58E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *p temp_v1_2->words.w0 = 0xFB000000; temp_v0 = (thisx->unk26A * 4) + &D_809F5E4C; temp_v1_2->words.w1 = (temp_v0->unk-2 << 8) | (temp_v0->unk-4 << 0x18) | (temp_v0->unk-3 << 0x10) | 0xFF; - Graph_CloseDisps(&sp28, globalCtx->state.gfxCtx, (const char *) "../z_en_dnt_nomal.c", 0x6CF); + Graph_CloseDisps(&sp28, play->state.gfxCtx, (const char *) "../z_en_dnt_nomal.c", 0x6CF); } return 0; } -void func_809F59E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3s *rot, void *thisx) { +void func_809F59E4(PlayState *play, s32 limbIndex, Gfx **dList, Vec3s *rot, void *thisx) { ? sp18; sp18.unk0 = (s32) D_809F5E88.unk0; @@ -459,14 +459,14 @@ void func_809F59E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3s * This structure is pretty typical: both edit what certain limbs do. Both also usually need a `ActorName *this = THIS;` at the top. We have seen both of the macros in the former before: applying the usual procedure, we find that it becomes ```C -s32 func_809F58E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, void *thisx) { +s32 func_809F58E4(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, void *thisx) { EnDntNormal *this = THIS; if ((limbIndex == 1) || (limbIndex == 3) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1733); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1733); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, D_809F5E4C[this->type - 1].r, D_809F5E4C[this->type - 1].g, D_809F5E4C[this->type - 1].b, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1743); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1743); } return 0; } diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md index e284ebf73c..f3381be803 100644 --- a/docs/tutorial/other_functions.md +++ b/docs/tutorial/other_functions.md @@ -20,7 +20,7 @@ glabel func_80A87F44 ``` This is a classic "function with two arguments that does nothing". So we can simply comment out the appropriate pragma and put ```C -void func_80A87F44(Actor* thisx, GlobalContext* globalCtx) { +void func_80A87F44(Actor* thisx, PlayState* play) { } ``` @@ -30,16 +30,16 @@ in the C file. Destroy will be a dead end, but we might as well do it now. Remaking the context and using mips2c on it (main 4 function, so change the prototype to use `EnJj* this`!) gives ```C -void EnJj_Destroy(EnJj *this, GlobalContext *globalCtx) { - GlobalContext *temp_a3; +void EnJj_Destroy(EnJj *this, PlayState *play) { + PlayState *temp_a3; s16 temp_v0; temp_v0 = this->dyna.actor.params; - temp_a3 = globalCtx; + temp_a3 = play; if (temp_v0 == -1) { - globalCtx = temp_a3; + play = temp_a3; DynaPoly_DeleteBgActor(temp_a3, &temp_a3->colCtx.dyna, (s32) this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); return; } if ((temp_v0 != 0) && (temp_v0 != 1)) { @@ -51,15 +51,15 @@ void EnJj_Destroy(EnJj *this, GlobalContext *globalCtx) { Again remember to return the first argument to `Actor* this` and put `EnJj* this = THIS;` in the function body. Based on what we know about this actor already, we expect this to be another switch. Rearranging it as such, and removing the likely fake `temp_v0` gives ```C -void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJj_Destroy(Actor* thisx, PlayState* play) { EnJj* this = THIS; - GlobalContext* temp_a3; - temp_a3 = globalCtx; + PlayState* temp_a3; + temp_a3 = play; switch (this->dyna.actor.params) { case -1: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); break; case 0: case 1: @@ -70,23 +70,23 @@ void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx) { ``` Using `./diff.py -mwo3 EnJj_Destroy` shows that this matches already, but it seems like the temp usage should be more consistent. A little experimentation shows that ```C -void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJj_Destroy(Actor* thisx, PlayState* play) { EnJj* this = THIS; switch (this->dyna.actor.params) { case -1: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); break; case 0: case 1: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); break; } } ``` -also matches, with no need for the `GlobalContext*` temp. +also matches, with no need for the `PlayState*` temp. ## Action Functions @@ -94,7 +94,7 @@ also matches, with no need for the `GlobalContext*` temp. Of the two functions we have available, `func_80A87BEC` is shorter, so we do that next. Since we haven't changed any types or header file information, there is no need to remake the context. mips2c gives ```C -void func_80A87BEC(EnJj *this, GlobalContext *globalCtx) { +void func_80A87BEC(EnJj *this, PlayState *play) { if (this->dyna.actor.xzDistToPlayer < 300.0f) { func_80A87800(this, &func_80A87B9C); } @@ -104,10 +104,10 @@ void func_80A87BEC(EnJj *this, GlobalContext *globalCtx) { We see that this function just sets another action function when Link is close enough to the actor. All we have to do to this is remove the `&`, and prototype `func_80A87B9C` to be an action function. Notably, this time it is not used before it is defined, so we don't need a prototype at the top: putting a placeholder one in at the function position will do, i.e. our total edits this time are ```C #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Jj/func_80A87B9C.s") -void func_80A87B9C(EnJj *this, GlobalContext *globalCtx); +void func_80A87B9C(EnJj *this, PlayState *play); // #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Jj/func_80A87BEC.s") -void func_80A87BEC(EnJj *this, GlobalContext *globalCtx) { +void func_80A87BEC(EnJj *this, PlayState *play) { if (this->dyna.actor.xzDistToPlayer < 300.0f) { func_80A87800(this, func_80A87B9C); } @@ -120,14 +120,14 @@ We can now either follow this chain of action functions down, or start with the We can remake the context, but it's simpler to just stick the function prototype we made at the bottom of the context. Either way, mips2c gives us ```C -void func_80A87B9C(EnJj *this, GlobalContext *globalCtx) { +void func_80A87B9C(EnJj *this, PlayState *play) { s16 temp_v0; temp_v0 = this->unk308; if ((s32) temp_v0 >= -0x1450) { this->unk308 = (s16) (temp_v0 - 0x66); if ((s32) this->unk308 < -0xA28) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->childActor->unk14C); + func_8003EBF8(play, &play->colCtx.dyna, this->childActor->unk14C); } } } @@ -163,11 +163,11 @@ this->childActor = (DynaPolyActor*)Actor_SpawnAsChild(...) Doing so, we are left with ```C -void func_80A87B9C(EnJj *this, GlobalContext *globalCtx) { +void func_80A87B9C(EnJj *this, PlayState *play) { if (this->unk_308 >= -0x1450) { this->unk_308 -= 0x66; if (this->unk_308 < -0xA28) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->childActor->bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->childActor->bgId); } } } @@ -204,7 +204,7 @@ The first suggestion looks plausible: +++ after @@ -1390,12 +1390,14 @@ } EnJj; - void func_80A87B9C(EnJj *this, GlobalContext *globalCtx) + void func_80A87B9C(EnJj *this, PlayState *play) { - if (this->unk_308 >= (-0x1450)) + DynaPolyActor *new_var; @@ -214,8 +214,8 @@ The first suggestion looks plausible: this->unk_308 -= 0x66; if (this->unk_308 < (-0xA28)) { -- func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->childActor->bgId); -+ func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, new_var->bgId); +- func_8003EBF8(play, &play->colCtx.dyna, this->childActor->bgId); ++ func_8003EBF8(play, &play->colCtx.dyna, new_var->bgId); } } @@ -223,13 +223,13 @@ The first suggestion looks plausible: In particular, adding a temp for the actor. Some of the rest is rather puzzling, but let's just try the actor temp, ```C -void func_80A87B9C(EnJj *this, GlobalContext *globalCtx) { +void func_80A87B9C(EnJj *this, PlayState *play) { DynaPolyActor* child = this->childActor; if (this->unk_308 >= -0x1450) { this->unk_308 -= 0x66; if (this->unk_308 < -0xA28) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, child->bgId); + func_8003EBF8(play, &play->colCtx.dyna, child->bgId); } } } @@ -241,13 +241,13 @@ Hooray, that worked. The function now matches (as you can check by running `make However, the hex values look a bit strange, and it turns out the decimal equivalents look less strange, so it's a good idea to translate them: ```C -void func_80A87B9C(EnJj *this, GlobalContext *globalCtx) { +void func_80A87B9C(EnJj *this, PlayState *play) { DynaPolyActor* child = this->childActor; if (this->unk_308 >= -5200) { this->unk_308 -= 102; if (this->unk_308 < -2600) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, child->bgId); + func_8003EBF8(play, &play->colCtx.dyna, child->bgId); } } } @@ -259,29 +259,29 @@ With that, we have reached the end of this action function chain, and now have t Remaking the context and running mips2c on the assembly gives ```C -void func_80A87C30(EnJj *this, GlobalContext *globalCtx) { - if ((Math_Vec3f_DistXZ(&D_80A88CF0, globalCtx->unk1C44 + 0x24) < 300.0f) && (globalCtx->isPlayerDroppingFish(globalCtx) != 0)) { +void func_80A87C30(EnJj *this, PlayState *play) { + if ((Math_Vec3f_DistXZ(&D_80A88CF0, play->unk1C44 + 0x24) < 300.0f) && (play->isPlayerDroppingFish(play) != 0)) { this->unk_30C = 0x64; func_80A87800(this, &func_80A87CEC); } this->collider.dim.pos.x = -0x4DD; this->collider.dim.pos.y = 0x14; this->collider.dim.pos.z = -0x30; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, (Collider *) &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, (Collider *) &this->collider); } ``` If you know anything about this game, this is obviously the function that begins the process of the swallowing Link cutscene. Performing minor cleanups reduces us to ```C -void func_80A87C30(EnJj *this, GlobalContext *globalCtx) { - if ((Math_Vec3f_DistXZ(&D_80A88CF0, globalCtx->unk1C44 + 0x24) < 300.0f) && (globalCtx->isPlayerDroppingFish(globalCtx) != 0)) { +void func_80A87C30(EnJj *this, PlayState *play) { + if ((Math_Vec3f_DistXZ(&D_80A88CF0, play->unk1C44 + 0x24) < 300.0f) && (play->isPlayerDroppingFish(play) != 0)) { this->unk_30C = 100; 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(globalCtx, &globalCtx->colChkCtx, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider); } ``` @@ -294,23 +294,23 @@ extern Vec3f D_80A88CF0; ``` (you must include the `.0f` parts even for integer floats: it can affect codegen, and as such it is part of our style). -- replace the mysterious `globalCtx->unk1C44 + 0x24`. The first part is so common that most people on decomp know it by heart: it is the location of the Player actor. `+ 0x24` is obviously an offset that leats to a `Vec3f`, and if you look in the actor struct, you find that this is the location of `world.pos`. To use `Player`, we put `Player* player = GET_PLAYER(globalCtx)` at the top of the function. +- replace the mysterious `play->unk1C44 + 0x24`. The first part is so common that most people on decomp know it by heart: it is the location of the Player actor. `+ 0x24` is obviously an offset that leats to a `Vec3f`, and if you look in the actor struct, you find that this is the location of `world.pos`. To use `Player`, we put `Player* player = GET_PLAYER(play)` at the top of the function. -**NOTE:** mips_to_c will now output something like `&globalCtx->actorCtx.actorLists[2].head` for the Player pointer instead: this makes a lot more sense, but is not so easy to spot in the ASM without the characteristic `1C44`. +**NOTE:** mips_to_c will now output something like `&play->actorCtx.actorLists[2].head` for the Player pointer instead: this makes a lot more sense, but is not so easy to spot in the ASM without the characteristic `1C44`. After all this, the function becomes ```C -void func_80A87C30(EnJj *this, GlobalContext *globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A87C30(EnJj *this, PlayState *play) { + Player* player = GET_PLAYER(play); - if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && (globalCtx->isPlayerDroppingFish(globalCtx) != 0)) { + if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && (play->isPlayerDroppingFish(play) != 0)) { this->unk_30C = 100; 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(globalCtx, &globalCtx->colChkCtx, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider); } ``` @@ -341,19 +341,19 @@ typedef struct EnJj { } EnJj; // size = 0x0314 ``` -The diff now looks fine for this function, but it gives compiler warnings about `CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider);`: the last argument is the wrong type: we need to give it `&this->collider.base` instead, which points to the same address, but is the right type. So the matching function is +The diff now looks fine for this function, but it gives compiler warnings about `CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider);`: the last argument is the wrong type: we need to give it `&this->collider.base` instead, which points to the same address, but is the right type. So the matching function is ```C -void func_80A87C30(EnJj *this, GlobalContext *globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A87C30(EnJj *this, PlayState *play) { + Player* player = GET_PLAYER(play); - if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && (globalCtx->isPlayerDroppingFish(globalCtx) != 0)) { + if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && (play->isPlayerDroppingFish(play) != 0)) { this->unk_30C = 100; 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(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } ``` @@ -363,7 +363,7 @@ Again we have only one choice for our next function, namely `func_80A87CEC`. Remaking the context and running mips2c on the assembly gives ```C -void func_80A87CEC(EnJj *this, GlobalContext *globalCtx) { +void func_80A87CEC(EnJj *this, PlayState *play) { DynaPolyActor *sp1C; DynaPolyActor *temp_v1; s16 temp_v0; @@ -375,12 +375,12 @@ void func_80A87CEC(EnJj *this, GlobalContext *globalCtx) { return; } sp1C = temp_v1; - globalCtx = globalCtx; + play = play; func_80A87800(this, &func_80A87EF0); - globalCtx->csCtx.segment = &D_80A88164; + play->csCtx.segment = &D_80A88164; gSaveContext.cutsceneTrigger = (u8)1U; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, (s32) temp_v1->bgId); - func_8005B1A4(globalCtx->cameraPtrs[globalCtx->activeCamId]); + func_8003EBF8(play, &play->colCtx.dyna, (s32) temp_v1->bgId); + func_8005B1A4(play->cameraPtrs[play->activeCamId]); gSaveContext.unkEDA = (u16) (gSaveContext.unkEDA | 0x400); func_80078884((u16)0x4802U); } @@ -394,9 +394,9 @@ Easy things to sort out: - We can remove the casts from `(u8)1U` and just leave `1`. -- `globalCtx->cameraPtrs[globalCtx->activeCamId]` has a macro: it is `GET_ACTIVE_CAM(globalCtx)`, so this line can be written as +- `play->cameraPtrs[play->activeCamId]` has a macro: it is `GET_ACTIVE_CAM(play)`, so this line can be written as ```C -func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); +func_8005B1A4(GET_ACTIVE_CAM(play)); ``` - `gSaveContext.unkEDA` we have dealt with before: it is `gSaveContext.eventChkInf[3]`. This is a flag-setting function; it can be written more compactly as @@ -408,17 +408,17 @@ gSaveContext.unkEDA |= 0x400 It remains to work out which, if any, of the temps are real. Based on our previous experience, we expect `temp_v1` to be real. `sp1C` is unused and hence unlikely to be real. `temp_v0` is only used in the short if and so probably not real. Checking the diff shows that our suspicions were correct: ```C -void func_80A87CEC(EnJj *this, GlobalContext *globalCtx) { +void func_80A87CEC(EnJj *this, PlayState *play) { DynaPolyActor *child = this->childActor; if (this->unk_30C > 0) { this->unk_30C--; return; } func_80A87800(this, func_80A87EF0); - globalCtx->csCtx.segment = &D_80A88164; + play->csCtx.segment = &D_80A88164; gSaveContext.cutsceneTrigger = 1; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, child->bgId); - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8003EBF8(play, &play->colCtx.dyna, child->bgId); + func_8005B1A4(GET_ACTIVE_CAM(play)); gSaveContext.eventChkInf[3] |= 0x400; func_80078884(NA_SE_SY_CORRECT_CHIME); } @@ -428,16 +428,16 @@ matches, but generates a complier warning for `func_8005B1A4`, which it can't fi Lastly, we prefer to limit use of early `return`s, and use `else`s instead if possible. That applies here: the function can be rewritten as ```C -void func_80A87CEC(EnJj* this, GlobalContext* globalCtx) { +void func_80A87CEC(EnJj* this, PlayState* play) { DynaPolyActor* child = this->childActor; if (this->unk_30C > 0) { this->unk_30C--; } else { func_80A87800(this, func_80A87EF0); - globalCtx->csCtx.segment = &D_80A88164; + play->csCtx.segment = &D_80A88164; gSaveContext.cutsceneTrigger = 1; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, child->bgId); - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8003EBF8(play, &play->colCtx.dyna, child->bgId); + func_8005B1A4(GET_ACTIVE_CAM(play)); gSaveContext.eventChkInf[3] |= 0x400; func_80078884(NA_SE_SY_CORRECT_CHIME); } @@ -450,7 +450,7 @@ and still match. (Early `return`s are used after an `Actor_Kill` and in a few ot mips2c with updated context gives ```C -void func_80A87EF0(EnJj *this, GlobalContext *globalCtx) { +void func_80A87EF0(EnJj *this, PlayState *play) { char *temp_a0; u16 temp_v0; @@ -475,7 +475,7 @@ lhu $v0, 0x030A($a0) ``` which at last tells us that `unk_30A` is actually a `u16`. We can now eliminate `temp_v0`, and replace the ` == 0` by a `!(...)`, which leaves ```C -void func_80A87EF0(EnJj *this, GlobalContext *globalCtx) { +void func_80A87EF0(EnJj *this, PlayState *play) { Actor *temp_a0; if (!(this->unk_30A & 4)) { @@ -496,8 +496,8 @@ Again we have run out of action functions. The rules suggest that we now look at Update runs every frame and updates the properties of the actor, and usually runs the action functions once per frame. As before we change the first argument to `EnJj* this` to get it to use our actor's struct. mips2c gives ```C -void EnJj_Update(EnJj *this, GlobalContext *globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->unk1D94 != 0)) { +void EnJj_Update(EnJj *this, PlayState *play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->unk1D94 != 0)) { func_80A87D94(); } else { this->actionFunc(this); @@ -512,19 +512,19 @@ void EnJj_Update(EnJj *this, GlobalContext *globalCtx) { } ``` -This has several problems: firstly, the action function is called with the wrong argument. We should thus be suspicious of previous functions this actor calls, and decompile them mith mips2c without context if necessary, if only to find out how many arguments they have. We find that `func_80A87D94` definitely takes `EnJj* this, GlobalContext* globalCtx` as arguments. Again, put this prototype at the function location above to avoid compiler warnings. +This has several problems: firstly, the action function is called with the wrong argument. We should thus be suspicious of previous functions this actor calls, and decompile them mith mips2c without context if necessary, if only to find out how many arguments they have. We find that `func_80A87D94` definitely takes `EnJj* this, PlayState* play` as arguments. Again, put this prototype at the function location above to avoid compiler warnings. `unk40` of an array of `Vec3s`s is `0x40 = 0x6 * 0xA + 0x4`, so is actually `this->skelAnime.jointTable[10].z` -Lastly, what is `globalCtx->unk1D94`? It is at `globalCtx->csCtx + 0x30`, or `globalCtx->csCtx.npcActions + 0x8`, which is `globalCtx->csCtx.npcActions[2]` since this is an array of pointers. Hence it is a pointer, and so should be compared to `NULL`. Looking up the sfx Id again, we end up with +Lastly, what is `play->unk1D94`? It is at `play->csCtx + 0x30`, or `play->csCtx.npcActions + 0x8`, which is `play->csCtx.npcActions[2]` since this is an array of pointers. Hence it is a pointer, and so should be compared to `NULL`. Looking up the sfx Id again, we end up with ```C -void EnJj_Update(Actor *thisx, GlobalContext *globalCtx) { +void EnJj_Update(Actor *thisx, PlayState *play) { EnJj* this = THIS; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[2] != NULL)) { - func_80A87D94(this, globalCtx); + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[2] != NULL)) { + func_80A87D94(this, play); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->skelAnime.curFrame == 41.0f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_JABJAB_GROAN); } @@ -631,7 +631,7 @@ You will also find that the permuter is essentially useless here: most solutions This is our last ordinary function. Unfortunately, even with new context, mips2c gives us a bit of a mess: ```C -void func_80A87D94(EnJj *this, GlobalContext *globalCtx) { +void func_80A87D94(EnJj *this, PlayState *play) { s16 temp_v0_2; u16 temp_t1; u16 temp_t4; @@ -643,7 +643,7 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) { u16 temp_v1_3; u16 phi_v1; - temp_v0 = *globalCtx->unk1D94; + temp_v0 = *play->unk1D94; if (temp_v0 != 1) { if (temp_v0 != 2) { if (temp_v0 != 3) { @@ -667,7 +667,7 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) { this->unk_30A = temp_t1; phi_v1 = temp_v1_2; if ((temp_v1_2 & 8) == 0) { - this->unk_304 = Actor_SpawnAsChild(&globalCtx->actorCtx, (Actor *) this, globalCtx, (u16)0x101, -1100.0f, 105.0f, -27.0f, 0, 0, 0, 0); + this->unk_304 = Actor_SpawnAsChild(&play->actorCtx, (Actor *) this, play, (u16)0x101, -1100.0f, 105.0f, -27.0f, 0, 0, 0, 0); temp_t4 = this->unk_30A | 8; this->unk_30A = temp_t4; phi_v1 = temp_t4 & 0xFFFF; @@ -698,16 +698,16 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) { At the top we have ```C - temp_v0 = *globalCtx->unk1D94; + temp_v0 = *play->unk1D94; if (temp_v0 != 1) { if (temp_v0 != 2) { if (temp_v0 != 3) { ``` -Firstly, we are now comparing with the value of `globalCtx->unk1D94`, not just using a pointer, so we need the first thing in `globalCtx->csCtx.npcActions[2]`. This turns out to be `globalCtx->csCtx.npcActions[2]->action`. +Firstly, we are now comparing with the value of `play->unk1D94`, not just using a pointer, so we need the first thing in `play->csCtx.npcActions[2]`. This turns out to be `play->csCtx.npcActions[2]->action`. The if structure here is another classic indicator of a switch: nested, with the same variable compared multiple times. If you were to diff this as-is, you would find that the code is in completely the wrong order. Reading how the ifs work, we see that if `temp_v0` is `1`, it executes the outermost else block, if it is `2`, the middle, if `3`, the innermost, and if it is anything else, the contents of the innermost if. Hence this becomes ```C -void func_80A87D94(EnJj *this, GlobalContext *globalCtx) { +void func_80A87D94(EnJj *this, PlayState *play) { s16 temp_v0_2; u16 temp_t1; u16 temp_t4; @@ -719,7 +719,7 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) { u16 temp_v1_3; u16 phi_v1; - switch (globalCtx->csCtx.npcActions[2]->action) { + switch (play->csCtx.npcActions[2]->action) { case 1: temp_v1_3 = this->unk_30A; phi_v1 = temp_v1_3; @@ -739,7 +739,7 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) { this->unk_30A = temp_t1; phi_v1 = temp_v1_2; if ((temp_v1_2 & 8) == 0) { - this->unk_304 = Actor_SpawnAsChild(&globalCtx->actorCtx, (Actor *) this, globalCtx, (u16)0x101, -1100.0f, 105.0f, -27.0f, 0, 0, 0, 0); + this->unk_304 = Actor_SpawnAsChild(&play->actorCtx, (Actor *) this, play, (u16)0x101, -1100.0f, 105.0f, -27.0f, 0, 0, 0, 0); temp_t4 = this->unk_30A | 8; this->unk_30A = temp_t4; phi_v1 = temp_t4 & 0xFFFF; @@ -784,8 +784,8 @@ As usual, most of the remaining temps look fake. The only one that does not is p ```C -void func_80A87D94(EnJj* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.npcActions[2]->action) { +void func_80A87D94(EnJj* this, PlayState* play) { + switch (play->csCtx.npcActions[2]->action) { case 1: if ((this->unk_30A & 2) != 0) { this->unk_30E = 0; @@ -798,7 +798,7 @@ void func_80A87D94(EnJj* this, GlobalContext* globalCtx) { case 2: this->unk_30A |= 1; if ((this->unk_30A & 8) == 0) { - this->unk_304 = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EFF_DUST, + this->unk_304 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EFF_DUST, -1100.0f, 105.0f, -27.0f, 0, 0, 0, 0); this->unk_30A |= 8; } diff --git a/docs/tutorial/types_structs_padding.md b/docs/tutorial/types_structs_padding.md index fb87445ead..30c691a0c4 100644 --- a/docs/tutorial/types_structs_padding.md +++ b/docs/tutorial/types_structs_padding.md @@ -29,7 +29,7 @@ Useful data for guessing types: Another useful thing to put here: the prototype for an action function is ```C -typedef void (*ActorNameActionFunc)(struct ActorName*, GlobalContext*); +typedef void (*ActorNameActionFunc)(struct ActorName*, PlayState*); ``` where you replace `ActorName` by the actual actor name as used elsewhere in the actor, e.g. `EnJj`. diff --git a/include/functions.h b/include/functions.h index 76ad620940..0da35981dd 100644 --- a/include/functions.h +++ b/include/functions.h @@ -161,9 +161,9 @@ void osViSetYScale(f32 scale); void osViSetXScale(f32 value); void __osSetWatchLo(u32); -EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params); -EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params); -void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params); +EnItem00* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, s16 params); +EnItem00* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s16 params); +void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params); void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2); void EffectBlure_AddSpace(EffectBlure* this); void EffectBlure_Init1(void* thisx, void* initParamsx); @@ -179,204 +179,204 @@ void EffectSpark_Init(void* thisx, void* initParamsx); void EffectSpark_Destroy(void* thisx); s32 EffectSpark_Update(void* thisx); void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx); -void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026400(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026608(GlobalContext* globalCtx); -void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026860(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026A6C(GlobalContext* globalCtx); -GlobalContext* Effect_GetGlobalCtx(void); +void func_80026230(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026400(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026608(PlayState* play); +void func_80026690(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026860(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026A6C(PlayState* play); +PlayState* Effect_GetPlayState(void); void* Effect_GetByIndex(s32 index); -void Effect_InitContext(GlobalContext* globalCtx); -void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams); +void Effect_InitContext(PlayState* play); +void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams); void Effect_DrawAll(GraphicsContext* gfxCtx); -void Effect_UpdateAll(GlobalContext* globalCtx); -void Effect_Delete(GlobalContext* globalCtx, s32 index); -void Effect_DeleteAll(GlobalContext* globalCtx); -void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize); -void EffectSs_ClearAll(GlobalContext* globalCtx); +void Effect_UpdateAll(PlayState* play); +void Effect_Delete(PlayState* play, s32 index); +void Effect_DeleteAll(PlayState* play); +void EffectSs_InitInfo(PlayState* play, s32 tableSize); +void EffectSs_ClearAll(PlayState* play); void EffectSs_Delete(EffectSs* effectSs); void EffectSs_Reset(EffectSs* effectSs); -void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs); -void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initParams); -void EffectSs_UpdateAll(GlobalContext* globalCtx); -void EffectSs_DrawAll(GlobalContext* globalCtx); +void EffectSs_Insert(PlayState* play, EffectSs* effectSs); +void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams); +void EffectSs_UpdateAll(PlayState* play); +void EffectSs_DrawAll(PlayState* play); s16 func_80027DD4(s16 arg0, s16 arg1, s32 arg2); s16 func_80027E34(s16 arg0, s16 arg1, f32 arg2); u8 func_80027E84(u8 arg0, u8 arg1, f32 arg2); -void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* texture); -void EffectSsDust_Spawn(GlobalContext* globalCtx, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture); +void EffectSsDust_Spawn(PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life, u8 updateMode); -void func_8002829C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002829C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_80028304(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028304(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_8002836C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002836C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_800283D4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800283D4(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_8002843C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002843C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_800284A4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800284A4(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_80028510(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028510(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_8002857C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void func_800285EC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void func_8002865C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void func_800286CC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void func_8002873C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void func_8002857C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void func_800285EC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void func_8002865C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); +void func_800286CC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); +void func_8002873C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life); -void func_800287AC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void func_800287AC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life); -void func_8002881C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002881C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); -void func_80028858(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028858(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); -void func_80028990(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos); -void func_80028A54(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos); -void EffectSsKiraKira_SpawnSmallYellow(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsKiraKira_SpawnSmall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void func_80028990(PlayState* play, f32 randScale, Vec3f* srcPos); +void func_80028A54(PlayState* play, f32 randScale, Vec3f* srcPos); +void EffectSsKiraKira_SpawnSmallYellow(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsKiraKira_SpawnSmall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); -void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsKiraKira_SpawnDispersed(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); -void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsKiraKira_SpawnFocused(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); -void EffectSsBomb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsBomb2_SpawnFade(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsBomb2_SpawnLayered(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, +void EffectSsBomb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsBomb2_SpawnFade(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsBomb2_SpawnLayered(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void EffectSsBlast_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 sclaeStepDecay, s16 life); -void EffectSsBlast_SpawnWhiteCustomScale(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, +void EffectSsBlast_SpawnWhiteCustomScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life); -void EffectSsBlast_SpawnShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsBlast_SpawnShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 life); -void EffectSsBlast_SpawnWhiteShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsGSpk_SpawnAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsGSpk_SpawnAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void EffectSsGSpk_SpawnNoAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnNoAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void EffectSsGSpk_SpawnFuse(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsGSpk_SpawnRandColor(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnFuse(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsGSpk_SpawnRandColor(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnSmall(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); -void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s16 fadeDelay, s32 life); -void EffectSsDFire_SpawnFixedScale(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha, +void EffectSsDFire_SpawnFixedScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha, s16 fadeDelay); -void EffectSsBubble_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, +void EffectSsBubble_Spawn(PlayState* play, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, f32 scale); -void EffectSsGRipple_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 radius, s16 radiusMax, s16 life); -void EffectSsGSplash_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, +void EffectSsGRipple_Spawn(PlayState* play, Vec3f* pos, s16 radius, s16 radiusMax, s16 life); +void EffectSsGSplash_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 scale); -void EffectSsGMagma_Spawn(GlobalContext* globalCtx, Vec3f* pos); -void EffectSsGFire_Spawn(GlobalContext* globalCtx, Vec3f* pos); -void EffectSsLightning_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, +void EffectSsGMagma_Spawn(PlayState* play, Vec3f* pos); +void EffectSsGFire_Spawn(PlayState* play, Vec3f* pos); +void EffectSsLightning_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 yaw, s16 life, s16 numBolts); -void EffectSsDtBubble_SpawnColorProfile(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, +void EffectSsDtBubble_SpawnColorProfile(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 life, s16 colorProfile, s16 randXZ); -void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsDtBubble_SpawnCustomColor(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 life, s16 randXZ); -void EffectSsHahen_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, +void EffectSsHahen_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, s16 objId, s16 life, Gfx* dList); -void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstScale, s16 unused, s16 scale, +void EffectSsHahen_SpawnBurst(PlayState* play, Vec3f* pos, f32 burstScale, s16 unused, s16 scale, s16 randScaleRange, s16 count, s16 objId, s16 life, Gfx* dList); -void EffectSsStick_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 yaw); -void EffectSsSibuki_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, +void EffectSsStick_Spawn(PlayState* play, Vec3f* pos, s16 yaw); +void EffectSsSibuki_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, s16 direction, s16 scale); -void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos); -void EffectSsSibuki2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); -void EffectSsGMagma2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, +void EffectSsSibuki_SpawnBurst(PlayState* play, Vec3f* pos); +void EffectSsSibuki2_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); +void EffectSsGMagma2_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 updateRate, s16 drawMode, s16 scale); -void EffectSsStone1_Spawn(GlobalContext* globalCtx, Vec3f* pos, s32 arg2); -void EffectSsHitMark_Spawn(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos); -void EffectSsHitMark_SpawnFixedScale(GlobalContext* globalCtx, s32 type, Vec3f* pos); -void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos); -void EffectSsFhgFlash_SpawnLightBall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, +void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 arg2); +void EffectSsHitMark_Spawn(PlayState* play, s32 type, s16 scale, Vec3f* pos); +void EffectSsHitMark_SpawnFixedScale(PlayState* play, s32 type, Vec3f* pos); +void EffectSsHitMark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3f* pos); +void EffectSsFhgFlash_SpawnLightBall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, u8 param); -void EffectSsFhgFlash_SpawnShock(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, u8 param); -void EffectSsKFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type); -void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, +void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 param); +void EffectSsKFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type); +void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16* linkDetected); -void EffectSsKakera_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, +void EffectSsKakera_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, s16 objId, Gfx* dList); -void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life); -void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 scale); -void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 primR, s16 primG, s16 primB, +void EffectSsIcePiece_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life); +void EffectSsIcePiece_SpawnBurst(PlayState* play, Vec3f* refPos, f32 scale); +void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, f32 scale); -void EffectSsEnIce_SpawnFlyingVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* pos, s16 primR, s16 primG, s16 primB, +void EffectSsEnIce_SpawnFlyingVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, f32 scale); -void EffectSsEnIce_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, +void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life); -void EffectSsFireTail_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5, +void EffectSsFireTail_Spawn(PlayState* play, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 bodyPart, s32 life); -void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, +void EffectSsFireTail_SpawnFlame(PlayState* play, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, f32 colorIntensity); -void EffectSsFireTail_SpawnFlameOnPlayer(GlobalContext* globalCtx, f32 scale, s16 bodyPart, f32 colorIntensity); -void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, s16 unk_12, s16 flags, +void EffectSsFireTail_SpawnFlameOnPlayer(PlayState* play, f32 scale, s16 bodyPart, f32 colorIntensity); +void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 unk_12, s16 flags, s16 bodyPart); -void EffectSsEnFire_SpawnVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* vec, s16 scale, s16 arg4, s16 flags, +void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* vec, s16 scale, s16 arg4, s16 flags, s16 bodyPart); -void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); -void EffectSsFCircle_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 radius, s16 height); -void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); +void EffectSsFCircle_Spawn(PlayState* play, Actor* actor, Vec3f* pos, s16 radius, s16 height); +void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, s16 unused, s32 arg14, s16 playSound); -void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDeadDd_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 primR, s16 primG, s16 primB, s16 alpha, s16 envR, s16 envG, s16 envB, s16 alphaStep, s32 life); -void EffectSsDeadDd_SpawnRandYellow(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale, +void EffectSsDeadDd_SpawnRandYellow(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale, s32 randIter, s32 life); -void EffectSsDeadDs_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDeadDs_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s32 life); -void EffectSsDeadDs_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, +void EffectSsDeadDs_SpawnStationary(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life); -void EffectSsDeadSound_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId, +void EffectSsDeadSound_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId, s16 lowerPriority, s16 repeatMode, s32 life); -void EffectSsDeadSound_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, u16 sfxId, s16 lowerPriority, +void EffectSsDeadSound_SpawnStationary(PlayState* play, Vec3f* pos, u16 sfxId, s16 lowerPriority, s16 repeatMode, s32 life); -void EffectSsIceSmoke_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); -void FlagSet_Update(GlobalContext* globalCtx); +void EffectSsIceSmoke_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); +void FlagSet_Update(PlayState* play); void Overlay_LoadGameState(GameStateOverlay* overlayEntry); void Overlay_FreeGameState(GameStateOverlay* overlayEntry); void ActorShape_Init(ActorShape* shape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale); -void ActorShadow_DrawCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx); -void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx); -void ActorShadow_DrawHorse(Actor* actor, Lights* lights, GlobalContext* globalCtx); -void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx); +void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play); +void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, PlayState* play); +void ActorShadow_DrawHorse(Actor* actor, Lights* lights, PlayState* play); +void ActorShadow_DrawFeet(Actor* actor, Lights* lights, PlayState* play); void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* leftFootPos, s32 rightFootIndex, Vec3f* rightFootPos); -void Actor_ProjectPos(GlobalContext* globalCtx, Vec3f* src, Vec3f* xyzDest, f32* cappedInvWDest); -void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx); -s32 Flags_GetSwitch(GlobalContext* globalCtx, s32 flag); -void Flags_SetSwitch(GlobalContext* globalCtx, s32 flag); -void Flags_UnsetSwitch(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetUnknown(GlobalContext* globalCtx, s32 flag); -void Flags_SetUnknown(GlobalContext* globalCtx, s32 flag); -void Flags_UnsetUnknown(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetTreasure(GlobalContext* globalCtx, s32 flag); -void Flags_SetTreasure(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetClear(GlobalContext* globalCtx, s32 flag); -void Flags_SetClear(GlobalContext* globalCtx, s32 flag); -void Flags_UnsetClear(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetTempClear(GlobalContext* globalCtx, s32 flag); -void Flags_SetTempClear(GlobalContext* globalCtx, s32 flag); -void Flags_UnsetTempClear(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetCollectible(GlobalContext* globalCtx, s32 flag); -void Flags_SetCollectible(GlobalContext* globalCtx, s32 flag); -void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width, +void Actor_ProjectPos(PlayState* play, Vec3f* src, Vec3f* xyzDest, f32* cappedInvWDest); +void func_8002C124(TargetContext* targetCtx, PlayState* play); +s32 Flags_GetSwitch(PlayState* play, s32 flag); +void Flags_SetSwitch(PlayState* play, s32 flag); +void Flags_UnsetSwitch(PlayState* play, s32 flag); +s32 Flags_GetUnknown(PlayState* play, s32 flag); +void Flags_SetUnknown(PlayState* play, s32 flag); +void Flags_UnsetUnknown(PlayState* play, s32 flag); +s32 Flags_GetTreasure(PlayState* play, s32 flag); +void Flags_SetTreasure(PlayState* play, s32 flag); +s32 Flags_GetClear(PlayState* play, s32 flag); +void Flags_SetClear(PlayState* play, s32 flag); +void Flags_UnsetClear(PlayState* play, s32 flag); +s32 Flags_GetTempClear(PlayState* play, s32 flag); +void Flags_SetTempClear(PlayState* play, s32 flag); +void Flags_UnsetTempClear(PlayState* play, s32 flag); +s32 Flags_GetCollectible(PlayState* play, s32 flag); +void Flags_SetCollectible(PlayState* play, s32 flag); +void TitleCard_InitBossName(PlayState* play, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width, u8 height); -void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s32 x, s32 y, +void TitleCard_InitPlaceName(PlayState* play, TitleCardContext* titleCtx, void* texture, s32 x, s32 y, s32 width, s32 height, s32 delay); -s32 TitleCard_Clear(GlobalContext* globalCtx, TitleCardContext* titleCtx); +s32 TitleCard_Clear(PlayState* play, TitleCardContext* titleCtx); void Actor_Kill(Actor* actor); void Actor_SetFocus(Actor* actor, f32 yOffset); void Actor_SetScale(Actor* actor, f32 scale); -void Actor_SetObjectDependency(GlobalContext* globalCtx, Actor* actor); +void Actor_SetObjectDependency(PlayState* play, Actor* actor); void func_8002D7EC(Actor* actor); void func_8002D868(Actor* actor); void Actor_MoveForward(Actor* actor); @@ -397,145 +397,145 @@ f32 Player_GetHeight(Player* player); f32 func_8002DCE4(Player* player); s32 func_8002DD6C(Player* player); s32 func_8002DD78(Player* player); -s32 func_8002DDE4(GlobalContext* globalCtx); -s32 func_8002DDF4(GlobalContext* globalCtx); -void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB); -void func_8002DE74(GlobalContext* globalCtx, Player* player); -void Actor_MountHorse(GlobalContext* globalCtx, Player* player, Actor* horse); +s32 func_8002DDE4(PlayState* play); +s32 func_8002DDF4(PlayState* play); +void func_8002DE04(PlayState* play, Actor* actorA, Actor* actorB); +void func_8002DE74(PlayState* play, Player* player); +void Actor_MountHorse(PlayState* play, Player* player, Actor* horse); s32 func_8002DEEC(Player* player); -void func_8002DF18(GlobalContext* globalCtx, Player* player); -s32 func_8002DF38(GlobalContext* globalCtx, Actor* actor, u8 csMode); -s32 func_8002DF54(GlobalContext* globalCtx, Actor* actor, u8 csMode); +void func_8002DF18(PlayState* play, Player* player); +s32 func_8002DF38(PlayState* play, Actor* actor, u8 csMode); +s32 func_8002DF54(PlayState* play, Actor* actor, u8 csMode); void func_8002DF90(DynaPolyActor* dynaActor); void func_8002DFA4(DynaPolyActor* dynaActor, f32 arg1, s16 arg2); -s32 Player_IsFacingActor(Actor* actor, s16 maxAngle, GlobalContext* globalCtx); +s32 Player_IsFacingActor(Actor* actor, s16 maxAngle, PlayState* play); s32 Actor_ActorBIsFacingActorA(Actor* actorA, Actor* actorB, s16 maxAngle); s32 Actor_IsFacingPlayer(Actor* actor, s16 maxAngle); s32 Actor_ActorAIsFacingActorB(Actor* actorA, Actor* actorB, s16 maxAngle); s32 Actor_IsFacingAndNearPlayer(Actor* actor, f32 range, s16 maxAngle); s32 Actor_ActorAIsFacingAndNearActorB(Actor* actorA, Actor* actorB, f32 range, s16 maxAngle); -void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, +void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, f32 ceilingCheckHeight, s32 flags); Hilite* func_8002EABC(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx); Hilite* func_8002EB44(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx); -void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag); -void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag); +void func_8002EBCC(Actor* actor, PlayState* play, s32 flag); +void func_8002ED80(Actor* actor, PlayState* play, s32 flag); PosRot* Actor_GetFocus(PosRot* arg0, Actor* actor); PosRot* Actor_GetWorld(PosRot* arg0, Actor* actor); PosRot* Actor_GetWorldPosShapeRot(PosRot* arg0, Actor* actor); s32 func_8002F0C8(Actor* actor, Player* player, s32 flag); -u32 Actor_ProcessTalkRequest(Actor* actor, GlobalContext* globalCtx); -s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u32 exchangeItemId); -s32 func_8002F298(Actor* actor, GlobalContext* globalCtx, f32 arg2, u32 exchangeItemId); -s32 func_8002F2CC(Actor* actor, GlobalContext* globalCtx, f32 arg2); -s32 func_8002F2F4(Actor* actor, GlobalContext* globalCtx); -u32 Actor_TextboxIsClosing(Actor* actor, GlobalContext* globalCtx); -s8 func_8002F368(GlobalContext* globalCtx); -void Actor_GetScreenPos(GlobalContext* globalCtx, Actor* actor, s16* x, s16* y); -u32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx); -s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange); -void func_8002F554(Actor* actor, GlobalContext* globalCtx, s32 getItemId); -void func_8002F580(Actor* actor, GlobalContext* globalCtx); -u32 Actor_HasNoParent(Actor* actor, GlobalContext* globalCtx); -void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx); -void func_8002F5F0(Actor* actor, GlobalContext* globalCtx); -s32 Actor_IsMounted(GlobalContext* globalCtx, Actor* horse); -u32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 mountSide); -s32 Actor_NotMounted(GlobalContext* globalCtx, Actor* horse); -void func_8002F698(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6); -void func_8002F6D4(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); -void func_8002F71C(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4); -void func_8002F758(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); -void func_8002F7A0(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4); +u32 Actor_ProcessTalkRequest(Actor* actor, PlayState* play); +s32 func_8002F1C4(Actor* actor, PlayState* play, f32 arg2, f32 arg3, u32 exchangeItemId); +s32 func_8002F298(Actor* actor, PlayState* play, f32 arg2, u32 exchangeItemId); +s32 func_8002F2CC(Actor* actor, PlayState* play, f32 arg2); +s32 func_8002F2F4(Actor* actor, PlayState* play); +u32 Actor_TextboxIsClosing(Actor* actor, PlayState* play); +s8 func_8002F368(PlayState* play); +void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y); +u32 Actor_HasParent(Actor* actor, PlayState* play); +s32 func_8002F434(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange); +void func_8002F554(Actor* actor, PlayState* play, s32 getItemId); +void func_8002F580(Actor* actor, PlayState* play); +u32 Actor_HasNoParent(Actor* actor, PlayState* play); +void func_8002F5C4(Actor* actorA, Actor* actorB, PlayState* play); +void func_8002F5F0(Actor* actor, PlayState* play); +s32 Actor_IsMounted(PlayState* play, Actor* horse); +u32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide); +s32 Actor_NotMounted(PlayState* play, Actor* horse); +void func_8002F698(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6); +void func_8002F6D4(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); +void func_8002F71C(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4); +void func_8002F758(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); +void func_8002F7A0(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4); void func_8002F7DC(Actor* actor, u16 sfxId); void Audio_PlayActorSound2(Actor* actor, u16 sfxId); -void func_8002F850(GlobalContext* globalCtx, Actor* actor); +void func_8002F850(PlayState* play, Actor* actor); void func_8002F8F0(Actor* actor, u16 sfxId); void func_8002F91C(Actor* actor, u16 sfxId); void func_8002F948(Actor* actor, u16 sfxId); void func_8002F974(Actor* actor, u16 sfxId); void func_8002F994(Actor* actor, s32 arg1); -s32 func_8002F9EC(GlobalContext* globalCtx, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos); -void Actor_DisableLens(GlobalContext* globalCtx); -void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorEntry); -void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx); -s32 func_800314D4(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3); -void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx); -void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx); -void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx); -void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx); -Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId, f32 posX, f32 posY, f32 posZ, +s32 func_8002F9EC(PlayState* play, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos); +void Actor_DisableLens(PlayState* play); +void func_800304DC(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEntry); +void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx); +s32 func_800314D4(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3); +void func_800315AC(PlayState* play, ActorContext* actorCtx); +void func_80031A28(PlayState* play, ActorContext* actorCtx); +void func_80031B14(PlayState* play, ActorContext* actorCtx); +void func_80031C3C(ActorContext* actorCtx, PlayState* play); +Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params); -Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, GlobalContext* globalCtx, s16 actorId, f32 posX, +Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params); -void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCtx); -Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, GlobalContext* globalCtx); -Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalCtx); -Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** actorPtr, Player* player); +void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx); +Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayState* play); +Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play); +Actor* func_80032AF0(PlayState* play, ActorContext* actorCtx, Actor** actorPtr, Player* player); Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory); -void Enemy_StartFinishingBlow(GlobalContext* globalCtx, Actor* actor); +void Enemy_StartFinishingBlow(PlayState* play, Actor* actor); s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3); -void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, GlobalContext* globalCtx); +void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play); void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList, s16 objectId); -s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* globalCtx, s16 type); -void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne, +s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s16 type); +void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne, f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting); -void func_80033480(GlobalContext* globalCtx, Vec3f* posBase, f32 randRangeDiameter, s32 amountMinusOne, s16 scaleBase, +void func_80033480(PlayState* play, Vec3f* posBase, f32 randRangeDiameter, s32 amountMinusOne, s16 scaleBase, s16 scaleStep, u8 arg6); -Actor* Actor_GetCollidedExplosive(GlobalContext* globalCtx, Collider* collider); -Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor); -Actor* Actor_GetProjectileActor(GlobalContext* globalCtx, Actor* refActor, f32 radius); -void Actor_ChangeCategory(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actor, u8 actorCategory); -void Actor_SetTextWithPrefix(GlobalContext* globalCtx, Actor* actor, s16 baseTextId); -s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 distance, s16 angle); -s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor); -s32 Actor_OtherIsTargeted(GlobalContext* globalCtx, Actor* actor); +Actor* Actor_GetCollidedExplosive(PlayState* play, Collider* collider); +Actor* func_80033684(PlayState* play, Actor* explosiveActor); +Actor* Actor_GetProjectileActor(PlayState* play, Actor* refActor, f32 radius); +void Actor_ChangeCategory(PlayState* play, ActorContext* actorCtx, Actor* actor, u8 actorCategory); +void Actor_SetTextWithPrefix(PlayState* play, Actor* actor, s16 baseTextId); +s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 angle); +s32 Actor_IsTargeted(PlayState* play, Actor* actor); +s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor); f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5); -void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx); -void func_80033DB8(GlobalContext* globalCtx, s16 arg1, s16 arg2); -void func_80033E1C(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3); -void func_80033E88(Actor* actor, GlobalContext* globalCtx, s16 arg2, s16 arg3); +void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play); +void func_80033DB8(PlayState* play, s16 arg1, s16 arg2); +void func_80033E1C(PlayState* play, s16 arg1, s16 arg2, s16 arg3); +void func_80033E88(Actor* actor, PlayState* play, s16 arg2, s16 arg3); f32 Rand_ZeroFloat(f32 f); f32 Rand_CenteredFloat(f32 f); -void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type); -void func_8003424C(GlobalContext* globalCtx, Vec3f* arg1); +void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type); +void func_8003424C(PlayState* play, Vec3f* arg1); void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 xluFlag, s16 duration); -Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx); -Hilite* func_8003435C(Vec3f* object, GlobalContext* globalCtx); -s32 func_800343CC(GlobalContext* globalCtx, Actor* actor, s16* arg2, f32 interactRange, - u16 (*unkFunc1)(GlobalContext*, Actor*), s16 (*unkFunc2)(GlobalContext*, Actor*)); +Hilite* func_800342EC(Vec3f* object, PlayState* play); +Hilite* func_8003435C(Vec3f* object, PlayState* play); +s32 func_800343CC(PlayState* play, Actor* actor, s16* arg2, f32 interactRange, + u16 (*unkFunc1)(PlayState*, Actor*), s16 (*unkFunc2)(PlayState*, Actor*)); s16 func_800347E8(s16 arg0); void func_80034A14(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3); -void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, +void func_80034BA0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); -void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, +void func_80034CC4(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); -s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3); +s16 func_80034DD4(Actor* actor, PlayState* play, s16 arg2, f32 arg3); void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, s32 index); -void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3); -void Actor_Noop(Actor* actor, GlobalContext* globalCtx); -void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist); -void Gfx_DrawDListXlu(GlobalContext* globalCtx, Gfx* dlist); -Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, u8 actorCategory, f32 range); -s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5); -void func_8003555C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void func_800355B8(GlobalContext* globalCtx, Vec3f* pos); -u8 func_800355E4(GlobalContext* globalCtx, Collider* collider); +void func_80034F54(PlayState* play, s16* arg1, s16* arg2, s32 arg3); +void Actor_Noop(Actor* actor, PlayState* play); +void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist); +void Gfx_DrawDListXlu(PlayState* play, Gfx* dlist); +Actor* Actor_FindNearby(PlayState* play, Actor* refActor, s16 actorId, u8 actorCategory, f32 range); +s32 func_800354B4(PlayState* play, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5); +void func_8003555C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void func_800355B8(PlayState* play, Vec3f* pos); +u8 func_800355E4(PlayState* play, Collider* collider); u8 Actor_ApplyDamage(Actor* actor); void Actor_SetDropFlag(Actor* actor, ColliderInfo* colInfo, 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, - GlobalContext* globalCtx, s16 params, s32 arg8); + PlayState* play, s16 params, s32 arg8); void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2); s32 Flags_GetEventChkInf(s32 flag); void Flags_SetEventChkInf(s32 flag); s32 Flags_GetInfTable(s32 flag); void Flags_SetInfTable(s32 flag); -u16 func_80037C30(GlobalContext* globalCtx, s16 arg1); -s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3); -s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4); +u16 func_80037C30(PlayState* play, s16 arg1); +s32 func_80037D98(PlayState* play, Actor* actor, s16 arg2, s32* arg3); +s32 func_80038290(PlayState* play, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4); void ActorOverlayTable_LogPrint(void); void ActorOverlayTable_Init(void); void ActorOverlayTable_Cleanup(void); @@ -549,14 +549,14 @@ s32 BgCheck_CheckLineAgainstSSList(SSList* ssList, CollisionContext* colCtx, u16 Vec3f* posB, Vec3f* outPos, CollisionPoly** outPoly, f32* outDistSq, f32 chkDist, s32 bccFlags); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); -void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, CollisionHeader* colHeader); +void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader* colHeader); s32 BgCheck_PosInStaticBoundingBox(CollisionContext* colCtx, Vec3f* pos); f32 BgCheck_EntityRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor2(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, +f32 BgCheck_EntityRaycastFloor2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); f32 BgCheck_EntityRaycastFloor3(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Vec3f* pos); f32 BgCheck_EntityRaycastFloor4(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor5(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, +f32 BgCheck_EntityRaycastFloor5(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); f32 BgCheck_EntityRaycastFloor6(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos, f32 chkDist); @@ -605,21 +605,21 @@ s32 BgCheck_AnyLineTest3(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec s32 chkWall, s32 chkFloor, s32 chkCeil, s32 chkOneFace, s32* bgId); s32 BgCheck_SphVsFirstPoly(CollisionContext* colCtx, Vec3f* center, f32 radius); void SSNodeList_Initialize(SSNodeList*); -void SSNodeList_Alloc(GlobalContext* globalCtx, SSNodeList* this, s32 tblMax, s32 numPolys); +void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys); u16 SSNodeList_GetNextNodeIdx(SSNodeList* this); s32 DynaPoly_IsBgIdBgActor(s32 bgId); -void DynaPoly_Init(GlobalContext* globalCtx, DynaCollisionContext* dyna); -void DynaPoly_Alloc(GlobalContext* globalCtx, DynaCollisionContext* dyna); -void func_8003EBF8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void func_8003EC50(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void func_8003ECA8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -s32 DynaPoly_SetBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader); +void DynaPoly_Init(PlayState* play, DynaCollisionContext* dyna); +void DynaPoly_Alloc(PlayState* play, DynaCollisionContext* dyna); +void func_8003EBF8(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_8003EC50(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_8003ECA8(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader); DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId); -void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void func_8003EE6C(GlobalContext* globalCtx, DynaCollisionContext* dyna); -void func_8003F8EC(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor); -void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna); -void DynaPoly_UpdateBgActorTransforms(GlobalContext* globalCtx, DynaCollisionContext* dyna); +void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_8003EE6C(PlayState* play, DynaCollisionContext* dyna); +void func_8003F8EC(PlayState* play, DynaCollisionContext* dyna, Actor* actor); +void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna); +void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyna); f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast); s32 BgCheck_SphVsDynaWall(CollisionContext* colCtx, u16 xpFlags, f32* outX, f32* outZ, Vec3f* pos, f32 radius, CollisionPoly** outPoly, s32* outBgId, Actor* actor); @@ -631,7 +631,7 @@ s32 BgCheck_CheckLineAgainstDyna(CollisionContext* colCtx, u16 xpFlags, Vec3f* p s32 BgCheck_SphVsFirstDynaPoly(CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* center, f32 radius, Actor* actor, u16 bciFlags); void CollisionHeader_GetVirtual(void* colHeader, CollisionHeader** dest); -void func_800418D0(CollisionContext* colCtx, GlobalContext* globalCtx); +void func_800418D0(CollisionContext* colCtx, PlayState* play); void BgCheck_ResetPolyCheckTbl(SSNodeList* nodeList, s32 numPolys); u32 SurfaceType_GetCamDataIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u16 func_80041A4C(CollisionContext* colCtx, u32 camId, s32 bgId); @@ -661,19 +661,19 @@ s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, +s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); -s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, +s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, WaterBox** outWaterBox); -s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, +s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); u32 WaterBox_GetCamDataIndex(CollisionContext* colCtx, WaterBox* waterBox); u16 WaterBox_GetCameraSType(CollisionContext* colCtx, WaterBox* waterBox); u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox); s32 func_80042708(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* point, Vec3f* closestPoint); s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec3f* pointB, Vec3f* closestPoint); -void BgCheck_DrawDynaCollision(GlobalContext*, CollisionContext*); -void BgCheck_DrawStaticCollision(GlobalContext*, CollisionContext*); +void BgCheck_DrawDynaCollision(PlayState*, CollisionContext*); +void BgCheck_DrawStaticCollision(PlayState*, CollisionContext*); void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId); s32 func_800433A4(CollisionContext* colCtx, s32 bgId, Actor* actor); void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags); @@ -686,8 +686,8 @@ s32 func_80043548(DynaPolyActor* dynaActor); s32 func_8004356C(DynaPolyActor* dynaActor); s32 func_80043590(DynaPolyActor* dynaActor); s32 func_800435B4(DynaPolyActor* dynaActor); -s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4); -void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalContext* globalCtx); +s32 func_800435D8(PlayState* play, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4); +void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState* play); void Camera_InitPlayerSettings(Camera* camera, Player* player); s16 Camera_ChangeStatus(Camera* camera, s16 status); Vec3s Camera_Update(Camera* camera); @@ -720,89 +720,89 @@ DamageTable* DamageTable_Get(s32 index); void DamageTable_Clear(DamageTable* table); void Collider_DrawRedPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC); void Collider_DrawPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC, u8 r, u8 g, u8 b); -s32 Collider_InitJntSph(GlobalContext* globalCtx, ColliderJntSph* collider); -s32 Collider_FreeJntSph(GlobalContext* globalCtx, ColliderJntSph* collider); -s32 Collider_DestroyJntSph(GlobalContext* globalCtx, ColliderJntSph* collider); -s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* dest, ColliderJntSphInitToActor* src); -s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, +s32 Collider_InitJntSph(PlayState* play, ColliderJntSph* collider); +s32 Collider_FreeJntSph(PlayState* play, ColliderJntSph* collider); +s32 Collider_DestroyJntSph(PlayState* play, ColliderJntSph* collider); +s32 Collider_SetJntSphToActor(PlayState* play, ColliderJntSph* dest, ColliderJntSphInitToActor* src); +s32 Collider_SetJntSphAllocType1(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInitType1* src); -s32 Collider_SetJntSphAlloc(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src); -s32 Collider_SetJntSph(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src, +s32 Collider_SetJntSphAlloc(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src); +s32 Collider_SetJntSph(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src, ColliderJntSphElement* elements); -s32 Collider_ResetJntSphAT(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetJntSphAC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetJntSphOC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_InitCylinder(GlobalContext* globalCtx, ColliderCylinder* collider); -s32 Collider_DestroyCylinder(GlobalContext* globalCtx, ColliderCylinder* collider); -s32 Collider_SetCylinderToActor(GlobalContext* globalCtx, ColliderCylinder* collider, ColliderCylinderInitToActor* src); -s32 Collider_SetCylinderType1(GlobalContext* globalCtx, ColliderCylinder* collider, Actor* actor, +s32 Collider_ResetJntSphAT(PlayState* play, Collider* collider); +s32 Collider_ResetJntSphAC(PlayState* play, Collider* collider); +s32 Collider_ResetJntSphOC(PlayState* play, Collider* collider); +s32 Collider_InitCylinder(PlayState* play, ColliderCylinder* collider); +s32 Collider_DestroyCylinder(PlayState* play, ColliderCylinder* collider); +s32 Collider_SetCylinderToActor(PlayState* play, ColliderCylinder* collider, ColliderCylinderInitToActor* src); +s32 Collider_SetCylinderType1(PlayState* play, ColliderCylinder* collider, Actor* actor, ColliderCylinderInitType1* src); -s32 Collider_SetCylinder(GlobalContext* globalCtx, ColliderCylinder* collider, Actor* actor, ColliderCylinderInit* src); -s32 Collider_ResetCylinderAT(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetCylinderAC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetCylinderOC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_InitTris(GlobalContext* globalCtx, ColliderTris* tris); -s32 Collider_FreeTris(GlobalContext* globalCtx, ColliderTris* tris); -s32 Collider_DestroyTris(GlobalContext* globalCtx, ColliderTris* tris); -s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInitType1* src); -s32 Collider_SetTrisAlloc(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInit* src); -s32 Collider_SetTris(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInit* src, +s32 Collider_SetCylinder(PlayState* play, ColliderCylinder* collider, Actor* actor, ColliderCylinderInit* src); +s32 Collider_ResetCylinderAT(PlayState* play, Collider* collider); +s32 Collider_ResetCylinderAC(PlayState* play, Collider* collider); +s32 Collider_ResetCylinderOC(PlayState* play, Collider* collider); +s32 Collider_InitTris(PlayState* play, ColliderTris* tris); +s32 Collider_FreeTris(PlayState* play, ColliderTris* tris); +s32 Collider_DestroyTris(PlayState* play, ColliderTris* tris); +s32 Collider_SetTrisAllocType1(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInitType1* src); +s32 Collider_SetTrisAlloc(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInit* src); +s32 Collider_SetTris(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInit* src, ColliderTrisElement* elements); -s32 Collider_ResetTrisAT(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetTrisAC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetTrisOC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_InitQuad(GlobalContext* globalCtx, ColliderQuad* collider); -s32 Collider_DestroyQuad(GlobalContext* globalCtx, ColliderQuad* collider); -s32 Collider_SetQuadType1(GlobalContext* globalCtx, ColliderQuad* collider, Actor* actor, ColliderQuadInitType1* src); -s32 Collider_SetQuad(GlobalContext* globalCtx, ColliderQuad* collider, Actor* actor, ColliderQuadInit* src); -s32 Collider_ResetQuadAT(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetQuadAC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetQuadOC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_InitLine(GlobalContext* globalCtx, OcLine* line); -s32 Collider_DestroyLine(GlobalContext* globalCtx, OcLine* line); -s32 Collider_SetLinePoints(GlobalContext* globalCtx, OcLine* ocLine, Vec3f* a, Vec3f* b); -s32 Collider_SetLine(GlobalContext* globalCtx, OcLine* dest, OcLine* src); -s32 Collider_ResetLineOC(GlobalContext* globalCtx, OcLine* line); -void CollisionCheck_InitContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void CollisionCheck_DestroyContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void CollisionCheck_ClearContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void CollisionCheck_EnableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void CollisionCheck_DisableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void Collider_Draw(GlobalContext* globalCtx, Collider* collider); -void CollisionCheck_DrawCollision(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider); -s32 CollisionCheck_SetAT_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); -s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider); -s32 CollisionCheck_SetAC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); -s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider); -s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); -s32 CollisionCheck_SetOCLine(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, OcLine* collider); -void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v); -void CollisionCheck_AT(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -void CollisionCheck_OC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); +s32 Collider_ResetTrisAT(PlayState* play, Collider* collider); +s32 Collider_ResetTrisAC(PlayState* play, Collider* collider); +s32 Collider_ResetTrisOC(PlayState* play, Collider* collider); +s32 Collider_InitQuad(PlayState* play, ColliderQuad* collider); +s32 Collider_DestroyQuad(PlayState* play, ColliderQuad* collider); +s32 Collider_SetQuadType1(PlayState* play, ColliderQuad* collider, Actor* actor, ColliderQuadInitType1* src); +s32 Collider_SetQuad(PlayState* play, ColliderQuad* collider, Actor* actor, ColliderQuadInit* src); +s32 Collider_ResetQuadAT(PlayState* play, Collider* collider); +s32 Collider_ResetQuadAC(PlayState* play, Collider* collider); +s32 Collider_ResetQuadOC(PlayState* play, Collider* collider); +s32 Collider_InitLine(PlayState* play, OcLine* line); +s32 Collider_DestroyLine(PlayState* play, OcLine* line); +s32 Collider_SetLinePoints(PlayState* play, OcLine* ocLine, Vec3f* a, Vec3f* b); +s32 Collider_SetLine(PlayState* play, OcLine* dest, OcLine* src); +s32 Collider_ResetLineOC(PlayState* play, OcLine* line); +void CollisionCheck_InitContext(PlayState* play, CollisionCheckContext* colChkCtx); +void CollisionCheck_DestroyContext(PlayState* play, CollisionCheckContext* colChkCtx); +void CollisionCheck_ClearContext(PlayState* play, CollisionCheckContext* colChkCtx); +void CollisionCheck_EnableSAC(PlayState* play, CollisionCheckContext* colChkCtx); +void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colChkCtx); +void Collider_Draw(PlayState* play, Collider* collider); +void CollisionCheck_DrawCollision(PlayState* play, CollisionCheckContext* colChkCtx); +s32 CollisionCheck_SetAT(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider); +s32 CollisionCheck_SetAT_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); +s32 CollisionCheck_SetAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider); +s32 CollisionCheck_SetAC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); +s32 CollisionCheck_SetOC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider); +s32 CollisionCheck_SetOC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index); +s32 CollisionCheck_SetOCLine(PlayState* play, CollisionCheckContext* colChkCtx, OcLine* collider); +void CollisionCheck_BlueBlood(PlayState* play, Collider* collider, Vec3f* v); +void CollisionCheck_AT(PlayState* play, CollisionCheckContext* colChkCtx); +void CollisionCheck_OC(PlayState* play, CollisionCheckContext* colChkCtx); void CollisionCheck_InitInfo(CollisionCheckInfo* info); void CollisionCheck_ResetDamage(CollisionCheckInfo* info); void CollisionCheck_SetInfoNoDamageTable(CollisionCheckInfo* info, CollisionCheckInfoInit* init); void CollisionCheck_SetInfo(CollisionCheckInfo* info, DamageTable* damageTable, CollisionCheckInfoInit* init); void CollisionCheck_SetInfo2(CollisionCheckInfo* info, DamageTable* damageTable, CollisionCheckInfoInit2* init); void CollisionCheck_SetInfoGetDamageTable(CollisionCheckInfo* info, s32 index, CollisionCheckInfoInit2* init); -void CollisionCheck_Damage(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx); -s32 CollisionCheck_LineOCCheckAll(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b); -s32 CollisionCheck_LineOCCheck(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, +void CollisionCheck_Damage(PlayState* play, CollisionCheckContext* colChkCtx); +s32 CollisionCheck_LineOCCheckAll(PlayState* play, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b); +s32 CollisionCheck_LineOCCheck(PlayState* play, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, Actor** exclusions, s32 numExclusions); void Collider_UpdateCylinder(Actor* actor, ColliderCylinder* collider); void Collider_SetCylinderPosition(ColliderCylinder* collider, Vec3s* pos); void Collider_SetQuadVertices(ColliderQuad* collider, Vec3f* a, Vec3f* b, Vec3f* c, Vec3f* d); void Collider_SetTrisVertices(ColliderTris* collider, s32 index, Vec3f* a, Vec3f* b, Vec3f* c); -void Collider_SetTrisDim(GlobalContext* globalCtx, ColliderTris* collider, s32 index, ColliderTrisElementDimInit* init); +void Collider_SetTrisDim(PlayState* play, ColliderTris* collider, s32 index, ColliderTrisElementDimInit* init); void Collider_UpdateSpheres(s32 limb, ColliderJntSph* collider); -void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v); -void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v); -void CollisionCheck_SpawnShieldParticles(GlobalContext* globalCtx, Vec3f* v); -void CollisionCheck_SpawnShieldParticlesMetal(GlobalContext* globalCtx, Vec3f* v); -void CollisionCheck_SpawnShieldParticlesMetalSound(GlobalContext* globalCtx, Vec3f* v, Vec3f* actorPos); -void CollisionCheck_SpawnShieldParticlesMetal2(GlobalContext* globalCtx, Vec3f* v); -void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* globalCtx, Vec3f* v, Vec3f* actorPos); +void CollisionCheck_SpawnRedBlood(PlayState* play, Vec3f* v); +void CollisionCheck_SpawnWaterDroplets(PlayState* play, Vec3f* v); +void CollisionCheck_SpawnShieldParticles(PlayState* play, Vec3f* v); +void CollisionCheck_SpawnShieldParticlesMetal(PlayState* play, Vec3f* v); +void CollisionCheck_SpawnShieldParticlesMetalSound(PlayState* play, Vec3f* v, Vec3f* actorPos); +void CollisionCheck_SpawnShieldParticlesMetal2(PlayState* play, Vec3f* v); +void CollisionCheck_SpawnShieldParticlesWood(PlayState* play, Vec3f* v, Vec3f* actorPos); s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* actorPos, Vec3f* itemPos, Vec3f* itemProjPos, Vec3f* out1, Vec3f* out2); u8 CollisionCheck_GetSwordDamage(s32 dmgFlags); @@ -819,38 +819,38 @@ void DebugDisplay_Init(void); DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type, GraphicsContext* gfxCtx); -void DebugDisplay_DrawObjects(GlobalContext* globalCtx); -void func_8006450C(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80064520(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80064534(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80064558(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx); -void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx); -void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx); -void Cutscene_SetSegment(GlobalContext* globalCtx, void* segment); +void DebugDisplay_DrawObjects(PlayState* play); +void func_8006450C(PlayState* play, CutsceneContext* csCtx); +void func_80064520(PlayState* play, CutsceneContext* csCtx); +void func_80064534(PlayState* play, CutsceneContext* csCtx); +void func_80064558(PlayState* play, CutsceneContext* csCtx); +void func_800645A0(PlayState* play, CutsceneContext* csCtx); +void Cutscene_HandleEntranceTriggers(PlayState* play); +void Cutscene_HandleConditionalTriggers(PlayState* play); +void Cutscene_SetSegment(PlayState* play, void* segment); void* MemCpy(void* dest, const void* src, s32 len); -void GetItem_Draw(GlobalContext* globalCtx, s16 drawId); -void SoundSource_InitAll(GlobalContext* globalCtx); -void SoundSource_UpdateAll(GlobalContext* globalCtx); -void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, s32 duration, u16 sfxId); -u16 ElfMessage_GetSariaText(GlobalContext* globalCtx); -u16 ElfMessage_GetCUpText(GlobalContext* globalCtx); -u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet); -void Flags_UnsetAllEnv(GlobalContext* globalCtx); -void Flags_SetEnv(GlobalContext* globalCtx, s16 flag); -void Flags_UnsetEnv(GlobalContext* globalCtx, s16 flag); -s32 Flags_GetEnv(GlobalContext* globalCtx, s16 flag); +void GetItem_Draw(PlayState* play, s16 drawId); +void SoundSource_InitAll(PlayState* play); +void SoundSource_UpdateAll(PlayState* play); +void SoundSource_PlaySfxAtFixedWorldPos(PlayState* play, Vec3f* worldPos, s32 duration, u16 sfxId); +u16 ElfMessage_GetSariaText(PlayState* play); +u16 ElfMessage_GetCUpText(PlayState* play); +u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet); +void Flags_UnsetAllEnv(PlayState* play); +void Flags_SetEnv(PlayState* play, s16 flag); +void Flags_UnsetEnv(PlayState* play, s16 flag); +s32 Flags_GetEnv(PlayState* play, s16 flag); s32 func_8006CFC0(s32 scene); -void func_8006D074(GlobalContext* globalCtx); -void func_8006D0AC(GlobalContext* globalCtx); -void func_8006D0EC(GlobalContext* globalCtx, Player* player); -void func_8006D684(GlobalContext* globalCtx, Player* player); -void func_8006DC68(GlobalContext* globalCtx, Player* player); +void func_8006D074(PlayState* play); +void func_8006D0AC(PlayState* play); +void func_8006D0EC(PlayState* play, Player* player); +void func_8006D684(PlayState* play, Player* player); +void func_8006DC68(PlayState* play, Player* player); void func_8006DD9C(Actor* actor, Vec3f* arg1, s16 arg2); s32 Jpeg_Decode(void* data, void* zbuffer, void* workBuff, u32 workSize); -void KaleidoSetup_Update(GlobalContext* globalCtx); -void KaleidoSetup_Init(GlobalContext* globalCtx); -void KaleidoSetup_Destroy(GlobalContext* globalCtx); +void KaleidoSetup_Update(PlayState* play); +void KaleidoSetup_Init(PlayState* play); +void KaleidoSetup_Destroy(PlayState* play); void func_8006EE50(Font* font, u16 arg1, u16 arg2); void Font_LoadChar(Font* font, u8 character, u16 codePointIndex); void Font_LoadMessageBoxIcon(Font* font, u16 icon); @@ -858,45 +858,45 @@ void Font_LoadOrderedFont(Font* font); s32 Environment_ZBufValToFixedPoint(s32 zBufferVal); u16 Environment_GetPixelDepth(s32 x, s32 y); void Environment_GraphCallback(GraphicsContext* gfxCtx, void* param); -void Environment_Init(GlobalContext* globalCtx, EnvironmentContext* envCtx, s32 unused); +void Environment_Init(PlayState* play, EnvironmentContext* envCtx, s32 unused); u8 Environment_SmoothStepToU8(u8* pvalue, u8 target, u8 scale, u8 step, u8 minStep); u8 Environment_SmoothStepToS8(s8* pvalue, s8 target, u8 scale, u8 step, u8 minStep); f32 Environment_LerpWeight(u16 max, u16 min, u16 val); f32 Environment_LerpWeightAccelDecel(u16 endFrame, u16 startFrame, u16 curFrame, u16 accelDuration, u16 decelDuration); void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxContext* skyboxCtx); -void Environment_EnableUnderwaterLights(GlobalContext* globalCtx, s32 waterLightsIndex); -void Environment_DisableUnderwaterLights(GlobalContext* globalCtx); -void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightContext* lightCtx, +void Environment_EnableUnderwaterLights(PlayState* play, s32 waterLightsIndex); +void Environment_DisableUnderwaterLights(PlayState* play); +void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContext* lightCtx, PauseContext* pauseCtx, MessageContext* msgCtx, GameOverContext* gameOverCtx, GraphicsContext* gfxCtx); -void Environment_DrawSunAndMoon(GlobalContext* globalCtx); -void Environment_DrawSunLensFlare(GlobalContext* globalCtx, EnvironmentContext* envCtx, View* view, +void Environment_DrawSunAndMoon(PlayState* play); +void Environment_DrawSunLensFlare(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f pos, s32 unused); -void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* envCtx, View* view, +void Environment_DrawLensFlare(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f pos, s32 unused, s16 scale, f32 colorIntensity, s16 glareStrength, u8 isSun); -void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* gfxCtx); -void Environment_ChangeLightSetting(GlobalContext* globalCtx, u32 lightSetting); -void Environment_DrawSkyboxFilters(GlobalContext* globalCtx); -void Environment_UpdateLightningStrike(GlobalContext* globalCtx); -void Environment_AddLightningBolts(GlobalContext* globalCtx, u8 num); -void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused); -void Environment_PlaySceneSequence(GlobalContext* globalCtx); -void Environment_DrawCustomLensFlare(GlobalContext* globalCtx); -void Environment_InitGameOverLights(GlobalContext* globalCtx); -void Environment_FadeInGameOverLights(GlobalContext* globalCtx); -void Environment_FadeOutGameOverLights(GlobalContext* globalCtx); +void Environment_DrawRain(PlayState* play, View* view, GraphicsContext* gfxCtx); +void Environment_ChangeLightSetting(PlayState* play, u32 lightSetting); +void Environment_DrawSkyboxFilters(PlayState* play); +void Environment_UpdateLightningStrike(PlayState* play); +void Environment_AddLightningBolts(PlayState* play, u8 num); +void Environment_DrawLightning(PlayState* play, s32 unused); +void Environment_PlaySceneSequence(PlayState* play); +void Environment_DrawCustomLensFlare(PlayState* play); +void Environment_InitGameOverLights(PlayState* play); +void Environment_FadeInGameOverLights(PlayState* play); +void Environment_FadeOutGameOverLights(PlayState* play); void Environment_FillScreen(GraphicsContext* gfxCtx, u8 red, u8 green, u8 blue, u8 alpha, u8 drawFlags); -void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState); -void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4); +void Environment_DrawSandstorm(PlayState* play, u8 sandstormState); +void Environment_AdjustLights(PlayState* play, f32 arg1, f32 arg2, f32 arg3, f32 arg4); s32 Environment_GetBgsDayCount(void); void Environment_ClearBgsDayCount(void); s32 Environment_GetTotalDays(void); void Environment_ForcePlaySequence(u16 seqId); s32 Environment_IsForcedSequenceDisabled(void); -void Environment_PlayStormNatureAmbience(GlobalContext* globalCtx); -void Environment_StopStormNatureAmbience(GlobalContext* globalCtx); -void Environment_WarpSongLeave(GlobalContext* globalCtx); +void Environment_PlayStormNatureAmbience(PlayState* play); +void Environment_StopStormNatureAmbience(PlayState* play); +void Environment_WarpSongLeave(PlayState* play); void Lib_MemSet(u8* dest, size_t len, u8 val); f32 Math_CosS(s16 angle); f32 Math_SinS(s16 angle); @@ -932,10 +932,10 @@ void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src); void func_80078884(u16 sfxId); void func_800788CC(u16 sfxId); void func_80078914(Vec3f* arg0, u16 sfxId); -void Health_InitMeter(GlobalContext* globalCtx); -void Health_UpdateMeter(GlobalContext* globalCtx); -void Health_DrawMeter(GlobalContext* globalCtx); -void Health_UpdateBeatingHeart(GlobalContext* globalCtx); +void Health_InitMeter(PlayState* play); +void Health_UpdateMeter(PlayState* play); +void Health_DrawMeter(PlayState* play); +void Health_UpdateBeatingHeart(PlayState* play); u32 Health_IsCritical(void); void Lights_PointSetInfo(LightInfo* info, s16 x, s16 y, s16 z, u8 r, u8 g, u8 b, s16 radius, s32 type); void Lights_PointNoGlowSetInfo(LightInfo* info, s16 x, s16 y, s16 z, u8 r, u8 g, u8 b, s16 radius); @@ -945,19 +945,19 @@ void Lights_DirectionalSetInfo(LightInfo* info, s8 x, s8 y, s8 z, u8 r, u8 g, u8 void Lights_Reset(Lights* lights, u8 ambentR, u8 ambentG, u8 ambentB); void Lights_Draw(Lights* lights, GraphicsContext* gfxCtx); void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* vec); -void LightContext_Init(GlobalContext* globalCtx, LightContext* lightCtx); +void LightContext_Init(PlayState* play, LightContext* lightCtx); void LightContext_SetAmbientColor(LightContext* lightCtx, u8 r, u8 g, u8 b); void LightContext_SetFog(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 fogNear, s16 fogFar); Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx); -void LightContext_InitList(GlobalContext* globalCtx, LightContext* lightCtx); -void LightContext_DestroyList(GlobalContext* globalCtx, LightContext* lightCtx); -LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* lightCtx, LightInfo* info); -void LightContext_RemoveLight(GlobalContext* globalCtx, LightContext* lightCtx, LightNode* node); +void LightContext_InitList(PlayState* play, LightContext* lightCtx); +void LightContext_DestroyList(PlayState* play, LightContext* lightCtx); +LightNode* LightContext_InsertLight(PlayState* play, LightContext* lightCtx, LightInfo* info); +void LightContext_RemoveLight(PlayState* play, LightContext* lightCtx, LightNode* node); Lights* Lights_NewAndDraw(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambientB, u8 numLights, u8 r, u8 g, u8 b, s8 x, s8 y, s8 z); Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambientB); -void Lights_GlowCheck(GlobalContext* globalCtx); -void Lights_DrawGlow(GlobalContext* globalCtx); +void Lights_GlowCheck(PlayState* play); +void Lights_DrawGlow(PlayState* play); void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); void* ZeldaArena_Malloc(u32 size); void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line); @@ -974,9 +974,9 @@ void ZeldaArena_Check(void); void ZeldaArena_Init(void* start, u32 size); void ZeldaArena_Cleanup(void); u8 ZeldaArena_IsInitalized(void); -void MapMark_Init(GlobalContext* globalCtx); -void MapMark_ClearPointers(GlobalContext* globalCtx); -void MapMark_Draw(GlobalContext* globalCtx); +void MapMark_Init(PlayState* play); +void MapMark_ClearPointers(PlayState* play); +void MapMark_Draw(PlayState* play); void PreNmiBuff_Init(PreNmiBuff* this); void PreNmiBuff_SetReset(PreNmiBuff* this); u32 PreNmiBuff_IsResetting(PreNmiBuff* this); @@ -991,60 +991,60 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec); VecSph* OLib_Vec3fToVecSphGeo(VecSph* arg0, Vec3f* arg1); VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* arg0, Vec3f* a, Vec3f* b); Vec3f* OLib_Vec3fDiffRad(Vec3f* dest, Vec3f* a, Vec3f* b); -s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* actor, s16 camId); -s16 OnePointCutscene_EndCutscene(GlobalContext* globalCtx, s16 camId); -s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor); -s32 OnePointCutscene_AttentionSetSfx(GlobalContext* globalCtx, Actor* actor, s32 sfxId); +s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 camId); +s16 OnePointCutscene_EndCutscene(PlayState* play, s16 camId); +s32 OnePointCutscene_Attention(PlayState* play, Actor* actor); +s32 OnePointCutscene_AttentionSetSfx(PlayState* play, Actor* actor, s32 sfxId); void OnePointCutscene_EnableAttention(void); void OnePointCutscene_DisableAttention(void); -s32 OnePointCutscene_CheckForCategory(GlobalContext* globalCtx, s32 actorCategory); -void OnePointCutscene_Noop(GlobalContext* globalCtx, s32 arg1); -void Map_SavePlayerInitialInfo(GlobalContext* globalCtx); -void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor); -void Map_InitData(GlobalContext* globalCtx, s16 room); -void Map_InitRoomData(GlobalContext* globalCtx, s16 room); -void Map_Destroy(GlobalContext* globalCtx); -void Map_Init(GlobalContext* globalCtx); -void Minimap_Draw(GlobalContext* globalCtx); -void Map_Update(GlobalContext* globalCtx); +s32 OnePointCutscene_CheckForCategory(PlayState* play, s32 actorCategory); +void OnePointCutscene_Noop(PlayState* play, s32 arg1); +void Map_SavePlayerInitialInfo(PlayState* play); +void Map_SetFloorPalettesData(PlayState* play, s16 floor); +void Map_InitData(PlayState* play, s16 room); +void Map_InitRoomData(PlayState* play, s16 room); +void Map_Destroy(PlayState* play); +void Map_Init(PlayState* play); +void Minimap_Draw(PlayState* play); +void Map_Update(PlayState* play); void Interface_ChangeAlpha(u16 alphaType); -void Interface_SetSceneRestrictions(GlobalContext* globalCtx); +void Interface_SetSceneRestrictions(PlayState* play); void Inventory_SwapAgeEquipment(void); -void Interface_InitHorsebackArchery(GlobalContext* globalCtx); -void func_800849EC(GlobalContext* globalCtx); -void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button); -void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button); -void func_80084BF4(GlobalContext* globalCtx, u16 flag); -u8 Item_Give(GlobalContext* globalCtx, u8 item); +void Interface_InitHorsebackArchery(PlayState* play); +void func_800849EC(PlayState* play); +void Interface_LoadItemIcon1(PlayState* play, u16 button); +void Interface_LoadItemIcon2(PlayState* play, u16 button); +void func_80084BF4(PlayState* play, u16 flag); +u8 Item_Give(PlayState* play, u8 item); u8 Item_CheckObtainability(u8 item); void Inventory_DeleteItem(u16 item, u16 invSlot); -s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem); +s32 Inventory_ReplaceItem(PlayState* play, u16 oldItem, u16 newItem); s32 Inventory_HasEmptyBottle(void); s32 Inventory_HasSpecificBottle(u8 bottleItem); -void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 button); -s32 Inventory_ConsumeFairy(GlobalContext* globalCtx); -void Interface_SetDoAction(GlobalContext* globalCtx, u16 action); -void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState); -void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action); -s32 Health_ChangeBy(GlobalContext* globalCtx, s16 healthChange); +void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 button); +s32 Inventory_ConsumeFairy(PlayState* play); +void Interface_SetDoAction(PlayState* play, u16 action); +void Interface_SetNaviCall(PlayState* play, u16 naviCallState); +void Interface_LoadActionLabelB(PlayState* play, u16 action); +s32 Health_ChangeBy(PlayState* play, s16 healthChange); void Rupees_ChangeBy(s16 rupeeChange); void Inventory_ChangeAmmo(s16 item, s16 ammoChange); -void Magic_Fill(GlobalContext* globalCtx); -void func_800876C8(GlobalContext* globalCtx); -s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2); +void Magic_Fill(PlayState* play); +void func_800876C8(PlayState* play); +s32 func_80087708(PlayState* play, s16 arg1, s16 arg2); void func_80088AA0(s16 arg0); -void func_80088AF0(GlobalContext* globalCtx); +void func_80088AF0(PlayState* play); void func_80088B34(s16 arg0); -void Interface_Draw(GlobalContext* globalCtx); -void Interface_Update(GlobalContext* globalCtx); -Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max); +void Interface_Draw(PlayState* play); +void Interface_Update(PlayState* play); +Path* Path_GetByIndex(PlayState* play, s16 index, s16 max); f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw); void Path_CopyLastPoint(Path* path, Vec3f* dest); void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx); s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input); -void Player_SetBootData(GlobalContext* globalCtx, Player* player); -s32 Player_InBlockingCsMode(GlobalContext* globalCtx, Player* player); -s32 Player_InCsMode(GlobalContext* globalCtx); +void Player_SetBootData(PlayState* play, Player* player); +s32 Player_InBlockingCsMode(PlayState* play, Player* player); +s32 Player_InCsMode(PlayState* play); s32 func_8008E9C4(Player* player); s32 Player_IsChildWithHylianShield(Player* player); s32 Player_ActionToModelGroup(Player* player, s32 actionParam); @@ -1052,18 +1052,18 @@ void Player_SetModelsForHoldingShield(Player* player); void Player_SetModels(Player* player, s32 modelGroup); void Player_SetModelGroup(Player* player, s32 modelGroup); void func_8008EC70(Player* player); -void Player_SetEquipmentData(GlobalContext* globalCtx, Player* player); -void Player_UpdateBottleHeld(GlobalContext* globalCtx, Player* player, s32 item, s32 actionParam); +void Player_SetEquipmentData(PlayState* play, Player* player); +void Player_UpdateBottleHeld(PlayState* play, Player* player, s32 item, s32 actionParam); void func_8008EDF0(Player* player); void func_8008EE08(Player* player); -void func_8008EEAC(GlobalContext* globalCtx, Actor* actor); -s32 func_8008EF44(GlobalContext* globalCtx, s32 ammo); -s32 Player_IsBurningStickInRange(GlobalContext* globalCtx, Vec3f* pos, f32 radius, f32 arg3); +void func_8008EEAC(PlayState* play, Actor* actor); +s32 func_8008EF44(PlayState* play, s32 ammo); +s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 radius, f32 arg3); s32 Player_GetStrength(void); -u8 Player_GetMask(GlobalContext* globalCtx); -Player* Player_UnsetMask(GlobalContext* globalCtx); -s32 Player_HasMirrorShieldEquipped(GlobalContext* globalCtx); -s32 Player_HasMirrorShieldSetToDraw(GlobalContext* globalCtx); +u8 Player_GetMask(PlayState* play); +Player* Player_UnsetMask(PlayState* play); +s32 Player_HasMirrorShieldEquipped(PlayState* play); +s32 Player_HasMirrorShieldSetToDraw(PlayState* play); s32 Player_ActionToMagicSpell(Player* player, s32 actionParam); s32 Player_HoldsHookshot(Player* player); s32 func_8008F128(Player* player); @@ -1076,24 +1076,24 @@ s32 Player_GetBottleHeld(Player* player); s32 Player_ActionToExplosive(Player* player, s32 actionParam); s32 Player_GetExplosiveHeld(Player* player); s32 func_8008F2BC(Player* player, s32 actionParam); -s32 func_8008F2F8(GlobalContext* globalCtx); -void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, +s32 func_8008F2F8(PlayState* play); +void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* data); -s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); -s32 Player_OverrideLimbDrawGameplayDefault(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); -s32 Player_OverrideLimbDrawGameplayFirstPerson(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, +s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); -s32 Player_OverrideLimbDrawGameplay_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, +s32 Player_OverrideLimbDrawGameplay_80090440(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); -u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* weaponDim, Vec3f* newTip, +u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponDim, Vec3f* newTip, Vec3f* newBase); -void Player_DrawGetItem(GlobalContext* globalCtx, Player* player); -void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* data); -u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime); -void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, +void Player_DrawGetItem(PlayState* play, Player* player); +void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* data); +u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime); +void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots); void PreNMI_Init(GameState* thisx); Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, VecSph* arg2); @@ -1129,7 +1129,7 @@ void func_8009398C(GraphicsContext* gfxCtx); void func_80093AD0(GraphicsContext* gfxCtx); void func_80093BA8(GraphicsContext* gfxCtx); void func_80093C14(GraphicsContext* gfxCtx); -void func_80093C80(GlobalContext* globalCtx); +void func_80093C80(PlayState* play); void func_80093D18(GraphicsContext* gfxCtx); void func_80093D84(GraphicsContext* gfxCtx); Gfx* func_80093F34(Gfx* gfx); @@ -1167,37 +1167,37 @@ Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1 Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a); void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b); void func_80095974(GraphicsContext* gfxCtx); -void func_80095AA0(GlobalContext* globalCtx, Room* room, Input* arg2, UNK_TYPE arg3); +void func_80095AA0(PlayState* play, Room* room, Input* arg2, UNK_TYPE arg3); void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0, u16 tlutCount, f32 frameX, f32 frameY); -void func_80096FD4(GlobalContext* globalCtx, Room* room); -u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx); -s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum); -s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx); -void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags); -void func_80097534(GlobalContext* globalCtx, RoomContext* roomCtx); +void func_80096FD4(PlayState* play, Room* room); +u32 func_80096FE8(PlayState* play, RoomContext* roomCtx); +s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum); +s32 func_800973FC(PlayState* play, RoomContext* roomCtx); +void Room_Draw(PlayState* play, Room* room, u32 flags); +void func_80097534(PlayState* play, RoomContext* roomCtx); void Sample_Destroy(GameState* thisx); void Sample_Init(GameState* thisx); void Inventory_ChangeEquipment(s16 equipment, u16 value); -u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment); +u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment); void Inventory_ChangeUpgrade(s16 upgrade, s16 value); s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); -void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx); +void Object_InitBank(PlayState* play, ObjectContext* objectCtx); void Object_UpdateBank(ObjectContext* objectCtx); s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId); s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex); void func_800981B8(ObjectContext* objectCtx); -s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd); +s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd); void TransitionActor_InitContext(GameState* state, TransitionActorContext* transiActorCtx); -void Scene_SetTransitionForNextEntrance(GlobalContext* globalCtx); -void Scene_Draw(GlobalContext* globalCtx); -void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, +void Scene_SetTransitionForNextEntrance(PlayState* play); +void Scene_Draw(PlayState* play); +void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod); -void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod); -void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, +void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg); -void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg); s16 Animation_GetLength(void* animation); s16 Animation_GetLastFrame(void* animation); @@ -1205,57 +1205,57 @@ s32 SkelAnime_GetFrameDataLegacy(LegacyAnimationHeader* animation, s32 frame, Ve s16 Animation_GetLimbCountLegacy(LegacyAnimationHeader* animation); s16 Animation_GetLengthLegacy(LegacyAnimationHeader* animation); s16 Animation_GetLastFrameLegacy(LegacyAnimationHeader* animation); -Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, +Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx); -Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx); void SkelAnime_InterpFrameTable(s32 limbCount, Vec3s* dst, Vec3s* start, Vec3s* target, f32 weight); void AnimationContext_Reset(AnimationContext* animationCtx); -void AnimationContext_SetNextQueue(GlobalContext* globalCtx); -void AnimationContext_DisableQueue(GlobalContext* globalCtx); -void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader* animation, s32 frame, s32 limbCount, +void AnimationContext_SetNextQueue(PlayState* play); +void AnimationContext_DisableQueue(PlayState* play); +void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable); -void AnimationContext_SetCopyAll(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src); -void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight); -void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); -void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); -void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 arg3); -void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animationCtx); -void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, +void AnimationContext_SetCopyAll(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src); +void AnimationContext_SetInterp(PlayState* play, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight); +void AnimationContext_SetCopyTrue(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); +void AnimationContext_SetCopyFalse(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); +void AnimationContext_SetMoveActor(PlayState* play, Actor* actor, SkelAnime* skelAnime, f32 arg3); +void AnimationContext_Update(PlayState* play, AnimationContext* animationCtx); +void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, LinkAnimationHeader* animation, s32 flags, Vec3s* jointTable, Vec3s* morphTable, s32 limbBufCount); void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime); -s32 LinkAnimation_Update(GlobalContext* globalCtx, SkelAnime* skelAnime); -void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime); -void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 morphFrames); -void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, +s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime); +void LinkAnimation_AnimateFrame(PlayState* play, SkelAnime* skelAnime); +void Animation_SetMorph(PlayState* play, SkelAnime* skelAnime, f32 morphFrames); +void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames); -void LinkAnimation_PlayOnce(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation); -void LinkAnimation_PlayOnceSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_PlayOnce(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation); +void LinkAnimation_PlayOnceSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed); -void LinkAnimation_PlayLoop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation); -void LinkAnimation_PlayLoopSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_PlayLoop(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation); +void LinkAnimation_PlayLoopSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed); -void LinkAnimation_CopyJointToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime); -void LinkAnimation_CopyMorphToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime); -void LinkAnimation_LoadToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_CopyJointToMorph(PlayState* play, SkelAnime* skelAnime); +void LinkAnimation_CopyMorphToJoint(PlayState* play, SkelAnime* skelAnime); +void LinkAnimation_LoadToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame); -void LinkAnimation_LoadToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_LoadToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame); -void LinkAnimation_InterpJointMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 weight); -void LinkAnimation_BlendToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1, +void LinkAnimation_InterpJointMorph(PlayState* play, SkelAnime* skelAnime, f32 weight); +void LinkAnimation_BlendToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable); -void LinkAnimation_BlendToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1, +void LinkAnimation_BlendToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable); void LinkAnimation_EndLoop(SkelAnime* skelAnime); s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame); -s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, +s32 SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); -s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, +s32 SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); -s32 SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, +s32 SkelAnime_InitSkin(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation); s32 SkelAnime_Update(SkelAnime* skelAnime); void Animation_ChangeImpl(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame, @@ -1274,22 +1274,22 @@ void SkelAnime_CopyFrameTableTrue(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, void SkelAnime_CopyFrameTableFalse(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* copyFlag); void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle); s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame); -void SkelAnime_Free(SkelAnime* skelAnime, GlobalContext* globalCtx); +void SkelAnime_Free(SkelAnime* skelAnime, PlayState* play); void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src); void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos); void Skin_DrawAnimatedLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3, s32 drawFlags); void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dlistOverride, s32 drawFlags); -void func_800A6330(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation); -void func_800A6360(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_800A6330(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, s32 setTranslation); +void func_800A6360(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation); -void func_800A6394(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_800A6394(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6); -void func_800A63CC(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_800A63CC(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags); void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* arg2, Vec3f* dst); -void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader); -void Skin_Free(GlobalContext* globalCtx, Skin* skin); +void Skin_Init(PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader); +void Skin_Free(PlayState* play, Skin* skin); s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* mf, Actor* actor, s32 setTranslation); void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest); @@ -1318,7 +1318,7 @@ void Sram_CopySave(FileChooseContext* fileChoose, SramContext* sramCtx); void Sram_WriteSramHeader(SramContext* sramCtx); void Sram_InitSram(GameState* gameState, SramContext* sramCtx); void Sram_Alloc(GameState* gameState, SramContext* sramCtx); -void Sram_Init(GlobalContext* globalCtx, SramContext* sramCtx); +void Sram_Init(PlayState* play, SramContext* sramCtx); void SsSram_Init(u32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, u8 handlePulse, u32 handleSpeed); void SsSram_Dma(void* dramAddr, size_t size, s32 direction); @@ -1473,47 +1473,47 @@ s32 Mempak_DeleteFile(s32 controllerNb, char idx); s32 Mempak_GetFileSize(s32 controllerNb, char idx); void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl); void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl); -void KaleidoManager_Init(GlobalContext* globalCtx); +void KaleidoManager_Init(PlayState* play); void KaleidoManager_Destroy(void); void* KaleidoManager_GetRamAddr(void* vram); void KaleidoScopeCall_LoadPlayer(void); -void KaleidoScopeCall_Init(GlobalContext* globalCtx); -void KaleidoScopeCall_Destroy(GlobalContext* globalCtx); -void KaleidoScopeCall_Update(GlobalContext* globalCtx); -void KaleidoScopeCall_Draw(GlobalContext* globalCtx); -void func_800BC490(GlobalContext* globalCtx, s16 point); -s32 func_800BC56C(GlobalContext* globalCtx, s16 arg1); -void func_800BC590(GlobalContext* globalCtx); -Gfx* Play_SetFog(GlobalContext* globalCtx, Gfx* gfx); +void KaleidoScopeCall_Init(PlayState* play); +void KaleidoScopeCall_Destroy(PlayState* play); +void KaleidoScopeCall_Update(PlayState* play); +void KaleidoScopeCall_Draw(PlayState* play); +void func_800BC490(PlayState* play, s16 point); +s32 func_800BC56C(PlayState* play, s16 arg1); +void func_800BC590(PlayState* play); +Gfx* Play_SetFog(PlayState* play, Gfx* gfx); void Play_Destroy(GameState* thisx); void Play_Init(GameState* thisx); void Play_Main(GameState* thisx); -s32 Play_InCsMode(GlobalContext* globalCtx); -f32 func_800BFCB8(GlobalContext* globalCtx, MtxF* mf, Vec3f* vec); -void* Play_LoadFile(GlobalContext* globalCtx, RomFile* file); -void Play_GetScreenPos(GlobalContext* globalCtx, Vec3f* src, Vec3f* dest); -s16 Play_CreateSubCamera(GlobalContext* globalCtx); -s16 Play_GetActiveCamId(GlobalContext* globalCtx); -s16 Play_ChangeCameraStatus(GlobalContext* globalCtx, s16 camId, s16 status); -void Play_ClearCamera(GlobalContext* globalCtx, s16 camId); -void Play_ClearAllSubCameras(GlobalContext* globalCtx); -Camera* Play_GetCamera(GlobalContext* globalCtx, s16 camId); -s32 Play_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye); -s32 Play_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); -s32 Play_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov); -s32 Play_SetCameraRoll(GlobalContext* globalCtx, s16 camId, s16 roll); -void Play_CopyCamera(GlobalContext* globalCtx, s16 destCamId, s16 srcCamId); -s32 func_800C0808(GlobalContext* globalCtx, s16 camId, Player* player, s16 setting); -s32 Play_CameraChangeSetting(GlobalContext* globalCtx, s16 camId, s16 setting); -void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2); -void Play_SaveSceneFlags(GlobalContext* globalCtx); -void Play_SetupRespawnPoint(GlobalContext* globalCtx, s32 respawnMode, s32 playerParams); -void Play_TriggerVoidOut(GlobalContext* globalCtx); -void Play_TriggerRespawn(GlobalContext* globalCtx); -s32 func_800C0CB8(GlobalContext* globalCtx); -s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx); -s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw); -s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos); +s32 Play_InCsMode(PlayState* play); +f32 func_800BFCB8(PlayState* play, MtxF* mf, Vec3f* vec); +void* Play_LoadFile(PlayState* play, RomFile* file); +void Play_GetScreenPos(PlayState* play, Vec3f* src, Vec3f* dest); +s16 Play_CreateSubCamera(PlayState* play); +s16 Play_GetActiveCamId(PlayState* play); +s16 Play_ChangeCameraStatus(PlayState* play, s16 camId, s16 status); +void Play_ClearCamera(PlayState* play, s16 camId); +void Play_ClearAllSubCameras(PlayState* play); +Camera* Play_GetCamera(PlayState* play, s16 camId); +s32 Play_CameraSetAtEye(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye); +s32 Play_CameraSetAtEyeUp(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); +s32 Play_CameraSetFov(PlayState* play, s16 camId, f32 fov); +s32 Play_SetCameraRoll(PlayState* play, s16 camId, s16 roll); +void Play_CopyCamera(PlayState* play, s16 destCamId, s16 srcCamId); +s32 func_800C0808(PlayState* play, s16 camId, Player* player, s16 setting); +s32 Play_CameraChangeSetting(PlayState* play, s16 camId, s16 setting); +void func_800C08AC(PlayState* play, s16 camId, s16 arg2); +void Play_SaveSceneFlags(PlayState* play); +void Play_SetupRespawnPoint(PlayState* play, s32 respawnMode, s32 playerParams); +void Play_TriggerVoidOut(PlayState* play); +void Play_TriggerRespawn(PlayState* play); +s32 func_800C0CB8(PlayState* play); +s32 FrameAdvance_IsEnabled(PlayState* play); +s32 func_800C0D34(PlayState* play, Actor* actor, s16* yaw); +s32 func_800C0DB4(PlayState* play, Vec3f* pos); void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg); void PreRender_Init(PreRender* this); void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); @@ -1732,8 +1732,8 @@ s32 Math3D_TriVsTriIntersect(TriNorm* ta, TriNorm* tb, Vec3f* intersect); s32 Math3D_XZInSphere(Sphere16* sphere, f32 x, f32 z); s32 Math3D_XYInSphere(Sphere16* sphere, f32 x, f32 y); s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z); -void Math3D_DrawSphere(GlobalContext* globalCtx, Sphere16* sph); -void Math3D_DrawCylinder(GlobalContext* globalCtx, Cylinder16* cyl); +void Math3D_DrawSphere(PlayState* play, Sphere16* sph); +void Math3D_DrawCylinder(PlayState* play, Cylinder16* cyl); s16 Math_Atan2S(f32 x, f32 y); f32 Math_Atan2F(f32 x, f32 y); void Matrix_Init(GameState* gameState); @@ -2269,24 +2269,24 @@ s32 __osSpSetPc(void* pc); f32 absf(f32); void* __osMemset(void* dest, s32 val, size_t len); void* __osMemmove(void* dest, const void* src, size_t len); -void Message_UpdateOcarinaMemoryGame(GlobalContext* globalCtx); -u8 Message_ShouldAdvance(GlobalContext* globalCtx); -void Message_CloseTextbox(GlobalContext*); -void Message_StartTextbox(GlobalContext* globalCtx, u16 textId, Actor* actor); -void Message_ContinueTextbox(GlobalContext* globalCtx, u16 textId); -void func_8010BD58(GlobalContext* globalCtx, u16 ocarinaActionId); -void func_8010BD88(GlobalContext* globalCtx, u16 ocarinaActionId); +void Message_UpdateOcarinaMemoryGame(PlayState* play); +u8 Message_ShouldAdvance(PlayState* play); +void Message_CloseTextbox(PlayState*); +void Message_StartTextbox(PlayState* play, u16 textId, Actor* actor); +void Message_ContinueTextbox(PlayState* play, u16 textId); +void func_8010BD58(PlayState* play, u16 ocarinaActionId); +void func_8010BD88(PlayState* play, u16 ocarinaActionId); u8 Message_GetState(MessageContext* msgCtx); -void Message_Draw(GlobalContext* globalCtx); -void Message_Update(GlobalContext* globalCtx); +void Message_Draw(PlayState* play); +void Message_Update(PlayState* play); void Message_SetTables(void); -void GameOver_Init(GlobalContext* globalCtx); -void GameOver_FadeInLights(GlobalContext* globalCtx); -void GameOver_Update(GlobalContext* globalCtx); -void func_80110990(GlobalContext* globalCtx); -void func_801109B0(GlobalContext* globalCtx); -void Message_Init(GlobalContext* globalCtx); -void func_80112098(GlobalContext* globalCtx); +void GameOver_Init(PlayState* play); +void GameOver_FadeInLights(PlayState* play); +void GameOver_Update(PlayState* play); +void func_80110990(PlayState* play); +void func_801109B0(PlayState* play); +void Message_Init(PlayState* play); +void func_80112098(PlayState* play); void Title_Init(GameState* thisx); void Title_Destroy(GameState* thisx); diff --git a/include/macros.h b/include/macros.h index b17b959d93..87fa315718 100644 --- a/include/macros.h +++ b/include/macros.h @@ -20,9 +20,9 @@ #define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0)) -#define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorLists[ACTORCAT_PLAYER].head) +#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].head) -#define GET_ACTIVE_CAM(globalCtx) ((globalCtx)->cameraPtrs[(globalCtx)->activeCamId]) +#define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamId]) #define LINK_IS_ADULT (gSaveContext.linkAge == LINK_AGE_ADULT) #define LINK_IS_CHILD (gSaveContext.linkAge == LINK_AGE_CHILD) diff --git a/include/variables.h b/include/variables.h index 200fac2539..ba807fa97a 100644 --- a/include/variables.h +++ b/include/variables.h @@ -91,7 +91,7 @@ extern u32 gGsFlagsMasks[4]; extern u32 gGsFlagsShifts[4]; extern void* gItemIcons[0x82]; extern u8 gItemSlots[56]; -extern void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(GlobalContext*, SceneCmd*); +extern void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*); extern s16 gLinkObjectIds[2]; extern u32 gObjectTableSize; extern RomFile gObjectTable[OBJECT_ID_MAX]; diff --git a/include/z64.h b/include/z64.h index 5647d4588a..e5345193c6 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1177,8 +1177,7 @@ typedef struct { /* 0x04 */ TransitionActorEntry* list; } TransitionActorContext; -// Global Context (dbg ram start: 80212020) -typedef struct GlobalContext { +typedef struct PlayState { /* 0x00000 */ GameState state; /* 0x000A4 */ s16 sceneNum; /* 0x000A6 */ u8 sceneConfig; @@ -1208,15 +1207,15 @@ typedef struct GlobalContext { /* 0x117A4 */ ObjectContext objectCtx; /* 0x11CBC */ RoomContext roomCtx; /* 0x11D34 */ TransitionActorContext transiActorCtx; - /* 0x11D3C */ void (*playerInit)(Player* player, struct GlobalContext* globalCtx, FlexSkeletonHeader* skelHeader); - /* 0x11D40 */ void (*playerUpdate)(Player* player, struct GlobalContext* globalCtx, Input* input); - /* 0x11D44 */ s32 (*isPlayerDroppingFish)(struct GlobalContext* globalCtx); - /* 0x11D48 */ s32 (*startPlayerFishing)(struct GlobalContext* globalCtx); - /* 0x11D4C */ s32 (*grabPlayer)(struct GlobalContext* globalCtx, Player* player); - /* 0x11D50 */ s32 (*startPlayerCutscene)(struct GlobalContext* globalCtx, Actor* actor, s32 mode); - /* 0x11D54 */ void (*func_11D54)(Player* player, struct GlobalContext* globalCtx); - /* 0x11D58 */ s32 (*damagePlayer)(struct GlobalContext* globalCtx, s32 damage); - /* 0x11D5C */ void (*talkWithPlayer)(struct GlobalContext* globalCtx, Actor* actor); + /* 0x11D3C */ void (*playerInit)(Player* player, struct PlayState* play, FlexSkeletonHeader* skelHeader); + /* 0x11D40 */ void (*playerUpdate)(Player* player, struct PlayState* play, Input* input); + /* 0x11D44 */ s32 (*isPlayerDroppingFish)(struct PlayState* play); + /* 0x11D48 */ s32 (*startPlayerFishing)(struct PlayState* play); + /* 0x11D4C */ s32 (*grabPlayer)(struct PlayState* play, Player* player); + /* 0x11D50 */ s32 (*startPlayerCutscene)(struct PlayState* play, Actor* actor, s32 mode); + /* 0x11D54 */ void (*func_11D54)(Player* player, struct PlayState* play); + /* 0x11D58 */ s32 (*damagePlayer)(struct PlayState* play, s32 damage); + /* 0x11D5C */ void (*talkWithPlayer)(struct PlayState* play, Actor* actor); /* 0x11D60 */ MtxF viewProjectionMtxF; /* 0x11DA0 */ MtxF billboardMtxF; /* 0x11DE0 */ Mtx* billboardMtx; @@ -1257,7 +1256,7 @@ typedef struct GlobalContext { /* 0x1242B */ u8 unk_1242B; /* 0x1242C */ SceneTableEntry* loadedScene; /* 0x12430 */ char unk_12430[0xE8]; -} GlobalContext; // size = 0x12518 +} PlayState; // size = 0x12518 typedef struct { /* 0x0000 */ GameState state; diff --git a/include/z64actor.h b/include/z64actor.h index f1cdf30e2d..dfcfa5c291 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -13,13 +13,13 @@ #define MASS_HEAVY 0xFE // Can only be pushed by OC colliders from actors with IMMOVABLE or HEAVY mass. struct Actor; -struct GlobalContext; +struct PlayState; struct Lights; -typedef void (*ActorFunc)(struct Actor*, struct GlobalContext*); -typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct GlobalContext*); -typedef u16 (*callback1_800343CC)(struct GlobalContext*, struct Actor*); -typedef s16 (*callback2_800343CC)(struct GlobalContext*, struct Actor*); +typedef void (*ActorFunc)(struct Actor*, struct PlayState*); +typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct PlayState*); +typedef u16 (*callback1_800343CC)(struct PlayState*, struct Actor*); +typedef s16 (*callback2_800343CC)(struct PlayState*, struct Actor*); typedef struct { Vec3f pos; @@ -272,7 +272,7 @@ typedef enum { struct EnItem00; -typedef void (*EnItem00ActionFunc)(struct EnItem00*, struct GlobalContext*); +typedef void (*EnItem00ActionFunc)(struct EnItem00*, struct PlayState*); typedef struct EnItem00 { /* 0x000 */ Actor actor; @@ -306,7 +306,7 @@ typedef enum { struct EnAObj; -typedef void (*EnAObjActionFunc)(struct EnAObj*, struct GlobalContext*); +typedef void (*EnAObjActionFunc)(struct EnAObj*, struct PlayState*); typedef struct EnAObj { /* 0x000 */ DynaPolyActor dyna; diff --git a/include/z64animation.h b/include/z64animation.h index faba103974..871e7f5a8b 100755 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -5,7 +5,7 @@ #include "z64dma.h" #include "z64math.h" -struct GlobalContext; +struct PlayState; struct Actor; struct SkelAnime; @@ -106,15 +106,15 @@ typedef struct { /* 0x08 */ JointKey* jointKey; } LegacyAnimationHeader; // size = 0xC -typedef s32 (*OverrideLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +typedef s32 (*OverrideLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void*); -typedef void (*PostLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void*); +typedef void (*PostLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*); -typedef s32 (*OverrideLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +typedef s32 (*OverrideLimbDraw)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void*, Gfx** gfx); -typedef void (*PostLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void*, Gfx** gfx); +typedef void (*PostLimbDraw)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*, Gfx** gfx); typedef enum { ANIMENTRY_LOADFRAME, @@ -187,7 +187,7 @@ typedef struct AnimationContext { AnimationEntry entries[ANIMATION_ENTRY_MAX]; } AnimationContext; // size = 0xC84 -typedef void (*AnimationEntryCallback)(struct GlobalContext* globalCtx, AnimationEntryData* data); +typedef void (*AnimationEntryCallback)(struct PlayState* play, AnimationEntryData* data); typedef s32 (*AnimUpdateFunc)(); diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index 87c8e246a2..f79aee9b2a 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -1,7 +1,7 @@ #ifndef Z_BGCHECK_H #define Z_BGCHECK_H -struct GlobalContext; +struct PlayState; struct Actor; struct DynaPolyActor; @@ -165,7 +165,7 @@ typedef struct CollisionContext { } CollisionContext; // size = 0x1464 typedef struct { - /* 0x00 */ struct GlobalContext* globalCtx; + /* 0x00 */ struct PlayState* play; /* 0x04 */ struct CollisionContext* colCtx; /* 0x08 */ u16 xpFlags; /* 0x0C */ CollisionPoly** resultPoly; diff --git a/include/z64camera.h b/include/z64camera.h index 9042f86052..5c7fa1f299 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -16,7 +16,7 @@ #define NUM_CAMS 4 -// Camera IDs are indices into `GlobalContext.cameraPtrs` +// Camera IDs are indices into `PlayState.cameraPtrs` #define CAM_ID_MAIN 0 // The index of the main camera #define CAM_ID_SUB_FIRST 1 // The index sub cameras start at #define CAM_ID_NONE -1 // Used to indicate no camera. Can be used to default to the active camera in some scenarios @@ -24,8 +24,8 @@ #define SUB_CAM_ID_DONE 0 // Used in some actors for variables holding sub camera IDs to indicate "subcam is finished" #define ONEPOINT_CS_INFO(camera) (&camera->paramData.uniq9.csInfo) -#define PARENT_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->parentCamId]) -#define CHILD_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->childCamId]) +#define PARENT_CAM(cam) ((cam)->play->cameraPtrs[(cam)->parentCamId]) +#define CHILD_CAM(cam) ((cam)->play->cameraPtrs[(cam)->childCamId]) typedef enum { /* 0x00 */ CAM_SET_NONE, @@ -1342,7 +1342,7 @@ typedef struct { /* 0x068 */ Vec3f up; /* 0x074 */ Vec3f eyeNext; /* 0x080 */ Vec3f skyboxOffset; - /* 0x08C */ struct GlobalContext* globalCtx; + /* 0x08C */ struct PlayState* play; /* 0x090 */ struct Player* player; /* 0x094 */ PosRot playerPosRot; /* 0x0A8 */ struct Actor* target; diff --git a/include/z64curve.h b/include/z64curve.h index a25fdaca1a..0ccacd472f 100644 --- a/include/z64curve.h +++ b/include/z64curve.h @@ -4,7 +4,7 @@ #include "ultra64/types.h" #include "z64math.h" -struct GlobalContext; +struct PlayState; typedef struct { /* 0x0 */ u16 flags; // Only the bottom two bits are used, although others are set in objects @@ -44,19 +44,19 @@ typedef struct { /* 0x1C */ s16 (*jointTable)[9]; } SkelCurve; // size = 0x20 -typedef s32 (*OverrideCurveLimbDraw)(struct GlobalContext* globalCtx, SkelCurve* skelCuve, s32 limbIndex, void* thisx); -typedef void (*PostCurveLimbDraw)(struct GlobalContext* globalCtx, SkelCurve* skelCuve, s32 limbIndex, void* thisx); +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* transData, s32 refIdx); void SkelCurve_Clear(SkelCurve* skelCurve); -s32 SkelCurve_Init(struct GlobalContext* globalCtx, SkelCurve* skelCurve, CurveSkeletonHeader* limbListSeg, CurveAnimationHeader* transUpdIdx); -void SkelCurve_Destroy(struct GlobalContext* globalCtx, SkelCurve* skelCurve); +s32 SkelCurve_Init(struct PlayState* play, SkelCurve* skelCurve, CurveSkeletonHeader* limbListSeg, CurveAnimationHeader* transUpdIdx); +void SkelCurve_Destroy(struct PlayState* play, SkelCurve* skelCurve); void SkelCurve_SetAnim(SkelCurve* skelCurve, CurveAnimationHeader* transUpdIdx, f32 arg2, f32 endFrame, f32 curFrame, f32 playSpeed); -s32 SkelCurve_Update(struct GlobalContext* globalCtx, SkelCurve* skelCurve); -void SkelCurve_Draw(Actor* actor, struct GlobalContext* globalCtx, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* thisx); +s32 SkelCurve_Update(struct PlayState* play, SkelCurve* skelCurve); +void SkelCurve_Draw(Actor* actor, struct PlayState* play, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* thisx); // ZAPD compatibility typedefs diff --git a/include/z64effect.h b/include/z64effect.h index 79875f900c..e0445e477f 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -4,7 +4,7 @@ #include "color.h" struct GraphicsContext; -struct GlobalContext; +struct PlayState; /* Effects */ @@ -158,7 +158,7 @@ typedef struct { } EffectShieldParticle; // size = 0x1C8 typedef struct { - /* 0x0000 */ struct GlobalContext* globalCtx; + /* 0x0000 */ struct PlayState* play; struct { EffectStatus status; EffectSpark effect; @@ -192,9 +192,9 @@ typedef enum { struct EffectSs; -typedef u32 (*EffectSsInitFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs, void* initParams); -typedef void (*EffectSsUpdateFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs); -typedef void (*EffectSsDrawFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs); +typedef u32 (*EffectSsInitFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs, void* initParams); +typedef void (*EffectSsUpdateFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs); +typedef void (*EffectSsDrawFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs); typedef struct { /* 0x00 */ u32 type; diff --git a/include/z64player.h b/include/z64player.h index c1c3be8315..aadd8a1e88 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -458,9 +458,9 @@ typedef struct { #define PLAYER_STATE3_6 (1 << 6) #define PLAYER_STATE3_7 (1 << 7) -typedef void (*PlayerFunc674)(struct Player*, struct GlobalContext*); -typedef s32 (*PlayerFunc82C)(struct Player*, struct GlobalContext*); -typedef void (*PlayerFuncA74)(struct GlobalContext*, struct Player*); +typedef void (*PlayerFunc674)(struct Player*, struct PlayState*); +typedef s32 (*PlayerFunc82C)(struct Player*, struct PlayState*); +typedef void (*PlayerFuncA74)(struct PlayState*, struct Player*); typedef struct Player { /* 0x0000 */ Actor actor; diff --git a/include/z64skin.h b/include/z64skin.h index 1be53966c1..e9d8689d89 100644 --- a/include/z64skin.h +++ b/include/z64skin.h @@ -74,8 +74,8 @@ typedef struct { /* 0x04C */ SkelAnime skelAnime; } Skin; // size = 0x90 -typedef void (*SkinPostDraw)(struct Actor*, struct GlobalContext*, Skin*); -typedef s32 (*SkinOverrideLimbDraw)(struct Actor*, struct GlobalContext*, s32, Skin*); +typedef void (*SkinPostDraw)(struct Actor*, struct PlayState*, Skin*); +typedef s32 (*SkinOverrideLimbDraw)(struct Actor*, struct PlayState*, s32, Skin*); #define SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS (1 << 0) #define SKIN_DRAW_FLAG_CUSTOM_MATRIX (1 << 1) diff --git a/src/code/code_80043480.c b/src/code/code_80043480.c index eda615d35a..3ba733e267 100644 --- a/src/code/code_80043480.c +++ b/src/code/code_80043480.c @@ -76,7 +76,7 @@ s32 func_800435B4(DynaPolyActor* dynaActor) { } } -s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4) { +s32 func_800435D8(PlayState* play, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4) { Vec3f posA; Vec3f posB; Vec3f posResult; @@ -98,7 +98,7 @@ s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2, posB.y = posA.y; posB.z = sign * a3 * cos + posA.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId, + if (BgCheck_EntityLineTest3(&play->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId, &dynaActor->actor, 0.0f)) { return false; } @@ -106,7 +106,7 @@ s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2, posA.z = (dynaActor->actor.world.pos.z * 2) - posA.z; posB.x = sign * a3 * sin + posA.x; posB.z = sign * a3 * cos + posA.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId, + if (BgCheck_EntityLineTest3(&play->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId, &dynaActor->actor, 0.0f)) { return false; } diff --git a/src/code/code_8006C3A0.c b/src/code/code_8006C3A0.c index 928b13443c..8943d8b938 100644 --- a/src/code/code_8006C3A0.c +++ b/src/code/code_8006C3A0.c @@ -1,33 +1,33 @@ #include "global.h" -void Flags_UnsetAllEnv(GlobalContext* globalCtx) { +void Flags_UnsetAllEnv(PlayState* play) { u8 i; - for (i = 0; i < ARRAY_COUNT(globalCtx->envFlags); i++) { - globalCtx->envFlags[i] = 0; + for (i = 0; i < ARRAY_COUNT(play->envFlags); i++) { + play->envFlags[i] = 0; } } -void Flags_SetEnv(GlobalContext* globalCtx, s16 flag) { +void Flags_SetEnv(PlayState* play, s16 flag) { s16 index = flag / 16; s16 bit = flag % 16; s16 mask = 1 << bit; - globalCtx->envFlags[index] |= mask; + play->envFlags[index] |= mask; } -void Flags_UnsetEnv(GlobalContext* globalCtx, s16 flag) { +void Flags_UnsetEnv(PlayState* play, s16 flag) { s16 index = flag / 16; s16 bit = flag % 16; s16 mask = (1 << bit) ^ 0xFFFF; - globalCtx->envFlags[index] &= mask; + play->envFlags[index] &= mask; } -s32 Flags_GetEnv(GlobalContext* globalCtx, s16 flag) { +s32 Flags_GetEnv(PlayState* play, s16 flag) { s16 index = flag / 16; s16 bit = flag % 16; s16 mask = 1 << bit; - return globalCtx->envFlags[index] & mask; + return play->envFlags[index] & mask; } diff --git a/src/code/code_80097A00.c b/src/code/code_80097A00.c index bf9d205fa1..68c51e7e2a 100644 --- a/src/code/code_80097A00.c +++ b/src/code/code_80097A00.c @@ -229,8 +229,8 @@ void Inventory_ChangeEquipment(s16 equipment, u16 value) { gSaveContext.equips.equipment |= value << gEquipShifts[equipment]; } -u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) { - Player* player = GET_PLAYER(globalCtx); +u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) { + Player* player = GET_PLAYER(play); s32 pad; u16 equipValue = gSaveContext.equips.equipment & gEquipMasks[equipment]; @@ -252,8 +252,8 @@ u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) { gSaveContext.infTable[INFTABLE_1DX_INDEX] = 1; } - Player_SetEquipmentData(globalCtx, player); - globalCtx->pauseCtx.cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT; + Player_SetEquipmentData(play, player); + play->pauseCtx.cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT; } return equipValue; diff --git a/src/code/db_camera.c b/src/code/db_camera.c index d48c416a60..1e5564a31e 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1,7 +1,7 @@ #include "ultra64.h" #include "global.h" -static GlobalContext* sGlobalCtx; +static PlayState* sPlay; // TODO: cleanup these arrays and UB access char* D_8012CEE0[] = { GFXP_KATAKANA "キ-フレ-ム" GFXP_HIRAGANA "ガ" }; @@ -346,7 +346,7 @@ s32 func_800B4370(DbCamera* dbCamera, s16 idx, Camera* cam) { void func_800B44E0(DbCamera* dbCamera, Camera* cam) { s32 i; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CRIGHT)) { sDbCamAnim.keyframe = 0; sDbCamAnim.unk_0A = 1; sDbCamAnim.curFrame = 0.0f; @@ -522,7 +522,7 @@ void DbCamera_Init(DbCamera* dbCamera, Camera* cameraPtr) { dbCamera->sub.unk_104A.x = dbCamera->sub.unk_104A.z; dbCamera->fov = 0.0f; dbCamera->rollDegrees = 0.0f; - sGlobalCtx = cameraPtr->globalCtx; + sPlay = cameraPtr->play; dbCamera->sub.mode = 0; dbCamera->sub.nFrames = -1; dbCamera->sub.nPoints = 1; @@ -597,7 +597,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { sp80 = &dbCamera->eye; sp7C = &dbCamera->at; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_Z)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_Z)) { dbCamera->unk_00++; dbCamera->unk_00 %= 3; dbCamera->unk_38 = 1; @@ -688,7 +688,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } dbCamera->unk_3C = D_80161140; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B | BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_B | BTN_L)) { sp104.r += temp_f2; if (sp104.r > 30000.0f) { @@ -702,7 +702,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } dbCamera->unk_40 = 7; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_B)) { spFC = sp104; spFC.r = temp_f2; if (!D_80161144) { @@ -719,7 +719,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 0xB; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_A | BTN_L)) { sp104.r -= temp_f2; if (sp104.r < 10.0f) { sp104.r = 10.0f; @@ -730,7 +730,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 8; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_A)) { spFC = sp104; spFC.r = -temp_f2; if (!D_80161144) { @@ -752,7 +752,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_40 = -1; } - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DDOWN | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DDOWN | BTN_L)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0; @@ -770,7 +770,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 1; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DUP | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DUP | BTN_L)) { spFC = sp104; spFC.r = -temp_f2; spFC.pitch = 0; @@ -787,7 +787,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 2; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DUP)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DUP)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0x3FFF; @@ -803,7 +803,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 3; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DDOWN)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DDOWN)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = -0x3FFF; @@ -819,8 +819,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 4; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, (BTN_DRIGHT | BTN_L)) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DRIGHT)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, (BTN_DRIGHT | BTN_L)) || + CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DRIGHT)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0; @@ -837,8 +837,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 5; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, (BTN_DLEFT | BTN_L)) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DLEFT)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, (BTN_DLEFT | BTN_L)) || + CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DLEFT)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0; @@ -855,7 +855,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 6; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_B | BTN_L)) { sp104.r = sp104.r + temp_f2; if (sp104.r > 30000.0f) { sp104.r = 30000.0f; @@ -866,7 +866,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 7; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_B)) { spFC = sp104; spFC.r = temp_f2; if (!D_80161144) { @@ -883,7 +883,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 0xB; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_A | BTN_L)) { sp104.r -= temp_f2; if (sp104.r < 10.0f) { @@ -895,7 +895,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 8; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_A)) { spFC = sp104; spFC.r = -temp_f2; if (!D_80161144) { @@ -917,7 +917,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_40 = -1; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_R)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_R)) { if (dbCamera->unk_00 == 0) { dbCamera->sub.unk_104A = cam->inputDir; *sp7C = cam->at; @@ -932,13 +932,13 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { func_800B41DC(dbCamera, dbCamera->sub.unkIdx, cam); } else { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_R) && + CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.nPoints = dbCamera->sub.unkIdx + 1; func_800B4088(dbCamera, cam); - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_R)) { if (dbCamera->sub.unkIdx == 0x80) { Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -955,8 +955,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } } else { - temp_f0_5 = sGlobalCtx->state.input[2].rel.stick_y; - temp_f2_2 = sGlobalCtx->state.input[2].rel.stick_x; + temp_f0_5 = sPlay->state.input[2].rel.stick_y; + temp_f2_2 = sPlay->state.input[2].rel.stick_x; pitch = CAM_DEG_TO_BINANG((SQ(temp_f0_5) / 600.0f) * 0.8f); yaw = CAM_DEG_TO_BINANG((SQ(temp_f2_2) / 600.0f) * 0.8f); if (!D_80161144) { @@ -977,7 +977,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, spF4.pitch, spF4.yaw, CAM_DEG_TO_BINANG(dbCamera->rollDegrees)); if (dbCamera->unk_00 == 1) { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_CRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_CRIGHT)) { cam->inputDir = dbCamera->sub.unk_104A; new_var2 = OLib_Vec3fDist(&cam->at, &cam->eye); cam->at = *sp7C; @@ -991,12 +991,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { if (dbCamera->unk_00 == 1) { OREG(0) = 8; func_8006376C(0xC, 5, 0, D_8012CEF4); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_CRIGHT) && - !CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_CRIGHT) && + !CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { func_800B44E0(dbCamera, cam); } else { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CRIGHT) && + CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); osSyncPrintf("@@@\n@@@\n@@@/* *** spline point data ** start here *** */\n@@@\n"); @@ -1006,14 +1006,14 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { osSyncPrintf("@@@static short nFrames = %d;\n@@@\n", dbCamera->sub.nFrames); osSyncPrintf("@@@static short Mode = %d;\n@@@\n", dbCamera->sub.mode); osSyncPrintf("@@@\n@@@\n@@@/* *** spline point data ** finish! *** */\n@@@\n"); - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.unk_08 = (dbCamera->sub.unk_08 + 1) % 3; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CUP) && + CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unkIdx > 0) { @@ -1022,7 +1022,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unkIdx = dbCamera->sub.nPoints - 1; } } else { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CUP)) { Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unkIdx > 0) { @@ -1043,8 +1043,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L) && + CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CDOWN)) { Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unkIdx < (dbCamera->sub.nPoints - 1)) { @@ -1053,7 +1053,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unkIdx = 0; } } else { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CDOWN)) { Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unkIdx < (dbCamera->sub.nPoints - 1)) { @@ -1123,7 +1123,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { break; case 1: dbCamera->unk_3C = true; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DUP)) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unk_0A == 0) { @@ -1132,7 +1132,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0A--; } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DDOWN)) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unk_0A == 5) { @@ -1141,12 +1141,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0A++; } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); switch (dbCamera->sub.unk_0A) { case 1: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame -= 5; } else { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame--; @@ -1178,7 +1178,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0C = false; break; case 2: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll -= 5; dbCamera->roll = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll; } else { @@ -1190,7 +1190,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DLEFT)) { if ((D_8012D10C++ % 5) == 0) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, @@ -1199,7 +1199,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { switch (dbCamera->sub.unk_0A) { case 0: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle -= 1.0f; dbCamera->fov = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle; } else { @@ -1208,7 +1208,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } break; case 5: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { dbCamera->sub.nFrames -= 10; } else { dbCamera->sub.nFrames--; @@ -1230,13 +1230,13 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DRIGHT)) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); switch (dbCamera->sub.unk_0A) { case 1: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame += 5; } else { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame++; @@ -1267,7 +1267,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0C = true; break; case 2: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll += 5; dbCamera->roll = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll; } else { @@ -1278,7 +1278,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { break; } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DRIGHT)) { if ((D_8012D10C++ % 5) == 0) { Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, @@ -1287,7 +1287,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { switch (dbCamera->sub.unk_0A) { case 0: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle += 1.0f; dbCamera->fov = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle; } else { @@ -1296,7 +1296,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } break; case 5: - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { dbCamera->sub.nFrames += 10; } else { dbCamera->sub.nFrames++; @@ -1398,11 +1398,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 2.0f, 0.02f, - 0xFF, 0xFF, 0x7F, 0x40, 0, cam->globalCtx->view.gfxCtx); + 0xFF, 0xFF, 0x7F, 0x40, 0, cam->play->view.gfxCtx); DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 2.0f, 0.02f, 0.02f, - 0x7F, 0xFF, 0xFF, 0x40, 0, cam->globalCtx->view.gfxCtx); + 0x7F, 0xFF, 0xFF, 0x40, 0, cam->play->view.gfxCtx); DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 0.02f, 2.0f, - 0xFF, 0x7F, 0xFF, 0x40, 0, cam->globalCtx->view.gfxCtx); + 0xFF, 0x7F, 0xFF, 0x40, 0, cam->play->view.gfxCtx); if (dbCamera->sub.unk_08 == 2) { for (i = 0; i < (dbCamera->sub.nPoints - 1); i++) { if (dbCamera->sub.mode != 1) { @@ -1416,14 +1416,14 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { spAA = dbCamera->sub.lookAt[i].cameraRoll * 0xB6; if (i == dbCamera->sub.unkIdx) { DebugDisplay_AddObject(spAC.x, spAC.y, spAC.z, spFC.pitch * -1, spFC.yaw, spAA, .5f, .5f, .5f, - 0x7F, 0xFF, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx); + 0x7F, 0xFF, 0x7F, 0x80, 5, cam->play->view.gfxCtx); DebugDisplay_AddObject(spB8.x, spB8.y, spB8.z, spFC.pitch * -1, spFC.yaw, spAA, 1.5f, 2.0f, - 1.0f, 0x7F, 0xFF, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx); + 1.0f, 0x7F, 0xFF, 0x7F, 0x80, 4, cam->play->view.gfxCtx); } else { DebugDisplay_AddObject(spAC.x, spAC.y, spAC.z, spFC.pitch * -1, spFC.yaw, spAA, .5f, .5f, .5f, - 0xFF, 0x7F, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx); + 0xFF, 0x7F, 0x7F, 0x80, 5, cam->play->view.gfxCtx); DebugDisplay_AddObject(spB8.x, spB8.y, spB8.z, spFC.pitch * -1, spFC.yaw, spAA, 1.5f, 2.0f, - 1.0f, 0xFF, 0x7F, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx); + 1.0f, 0xFF, 0x7F, 0x7F, 0x80, 4, cam->play->view.gfxCtx); } } } @@ -1433,7 +1433,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->roll = 0; dbCamera->fov = 60.0f; dbCamera->rollDegrees = dbCamera->roll * 1.40625f; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->unk_78 = (dbCamera->unk_78 + 1) % 3; @@ -1482,18 +1482,18 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eye, &cam->at); DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 2.0f, 0.02f, 0xFF, - 0xFF, 0x7F, 0x2D, 0, cam->globalCtx->view.gfxCtx); + 0xFF, 0x7F, 0x2D, 0, cam->play->view.gfxCtx); DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 2.0f, 0.02f, 0.02f, 0x7F, - 0xFF, 0xFF, 0x2D, 0, cam->globalCtx->view.gfxCtx); + 0xFF, 0xFF, 0x2D, 0, cam->play->view.gfxCtx); DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 0.02f, 2.0f, 0xFF, - 0x7F, 0xFF, 0x2D, 0, cam->globalCtx->view.gfxCtx); + 0x7F, 0xFF, 0x2D, 0, cam->play->view.gfxCtx); DebugDisplay_AddObject(cam->eye.x, cam->eye.y, cam->eye.z, spA0.pitch * -1, spA0.yaw, 0, .5f, .5f, .5f, 0xFF, - 0x7F, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx); + 0x7F, 0x7F, 0x80, 5, cam->play->view.gfxCtx); DebugDisplay_AddObject(cam->at.x, cam->at.y, cam->at.z, spA0.pitch * -1, spA0.yaw, 0, 1.5f, 2.0f, 1.0f, 0xFF, - 0x7F, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx); + 0x7F, 0x7F, 0x80, 4, cam->play->view.gfxCtx); OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eyeNext, &cam->at); DebugDisplay_AddObject(cam->eyeNext.x, cam->eyeNext.y, cam->eyeNext.z, spA0.pitch * -1, spA0.yaw, 0, .5f, .5f, - .5f, 0xFF, 0xC0, 0x7F, 0x50, 5, cam->globalCtx->view.gfxCtx); + .5f, 0xFF, 0xC0, 0x7F, 0x50, 5, cam->play->view.gfxCtx); } } @@ -1862,8 +1862,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { case DEMO_CTRL_MENU(ACTION_LOAD, MENU_INFO): case DEMO_CTRL_MENU(ACTION_CLEAR, MENU_INFO): { if ((1 << sCurFileIdx) & sMempakFiles) { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DLEFT) || + CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DRIGHT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlToggleSwitch ^= 1; @@ -1876,7 +1876,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(0x11, 8, dbCamera->sub.demoCtrlToggleSwitch ? 4 : 7, D_8012CF94); func_8006376C(0x15, 8, dbCamera->sub.demoCtrlToggleSwitch ? 7 : 4, D_8012CF98); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_A)) { if (dbCamera->sub.demoCtrlToggleSwitch == 0) { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1898,7 +1898,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(0xD, 9, dbCamera->sub.demoCtrlToggleSwitch ? 1 : 6, "PRESS B BUTTON"); } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlMenu = 0; @@ -1934,8 +1934,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(0x17, 7, 5, D_8012CFA4); func_8006376C(0xD, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? 1 : 6, "PRESS B BUTTON"); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_A) || + CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.demoCtrlMenu == DEMO_CTRL_MENU(ACTION_LOAD, MENU_SUCCESS)) { @@ -1957,8 +1957,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(0x17, 7, 5, D_8012CFA4); func_8006376C(0xD, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? 1 : 6, "PRESS B BUTTON"); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_A) || + CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlMenu -= 9; @@ -1993,7 +1993,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sp74[i * 2 + 0] = '-'; sp74[i * 2 + 1] = '\0'; - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DRIGHT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (sCurFileIdx >= 4) { @@ -2010,7 +2010,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.demoCtrlActionIdx = ACTION_SAVE; } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (sCurFileIdx <= 0) { @@ -2053,24 +2053,24 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(0xD, 0x1A, 5, D_8012CF60[0]); func_8006376C(0x14, 0x1A, 5, D_8012CF70); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DUP)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx - 1) % 4u; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DDOWN)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx + 1) % 4u; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_A)) { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlToggleSwitch = 0; dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(dbCamera->sub.demoCtrlActionIdx, MENU_INFO); } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlActionIdx = ACTION_E; @@ -2080,9 +2080,9 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { } else { func_8006376C(0xC, 0x1A, 4, D_8012CF60[0]); func_8006376C(0x13, 0x1A, 4, D_8012CF80); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP) || - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B) || + CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DUP) || + CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DDOWN)) { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -2096,14 +2096,14 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { break; default: { - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DUP)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(ACTION_E, MENU_INFO); dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx - 1) % 4u; sCurFileIdx = 0; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DDOWN)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(ACTION_E, MENU_INFO); @@ -2117,7 +2117,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { func_8006376C(4, 7, 5, D_8012CF4C); func_8006376C(D_8016110C * 2 + 6, 7, 7, ">"); - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CUP)) { if (D_8016110C > 0) { D_8016110C--; } @@ -2125,7 +2125,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sDbCamAnim.curFrame = 0.0f; sDbCamAnim.keyframe = 0; sDbCamAnim.unk_04 = 0; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CDOWN)) { if (D_8016110C < 14) { D_8016110C++; } @@ -2133,7 +2133,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sDbCamAnim.curFrame = 0.0f; sDbCamAnim.keyframe = 0; sDbCamAnim.unk_04 = 0; - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CLEFT)) { sDbCamAnim.unk_0A = 0; Interface_ChangeAlpha(2); ShrinkWindow_SetVal(0); @@ -2153,7 +2153,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { return 2; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[1].press.button, BTN_CRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[1].press.button, BTN_CRIGHT)) { D_8015FCC8 = 0; gSaveContext.cutsceneIndex = 0xFFFD; gSaveContext.cutsceneTrigger = 1; @@ -2167,7 +2167,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_L)) { if (sp74[sCurFileIdx] == '?') { sLastFileIdx = -1; D_801612EA = '*'; @@ -2176,7 +2176,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { D_801612EA = sDbCameraCuts[idx1].letter; } if (1) {} - } else if (!CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) { + } else if (!CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) { if (sLastFileIdx != -1) { switch (sp74[sCurFileIdx]) { case '?': @@ -2218,7 +2218,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sLastFileIdx = -1; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_A)) { if (sp74[sCurFileIdx] == '?') { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -2229,7 +2229,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B)) { if (sp74[sCurFileIdx] != '?' && sp74[sCurFileIdx] != '-') { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -2238,7 +2238,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_R)) { if (sp74[sCurFileIdx] != '?' && sp74[sCurFileIdx] != '-') { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -2262,7 +2262,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DRIGHT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (sCurFileIdx == 0x1E) { @@ -2271,22 +2271,22 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sCurFileIdx++; } } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); sCurFileIdx = (sCurFileIdx == 0) ? 0x1E : sCurFileIdx - 1; } - if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L) && + CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CRIGHT)) { for (i = 0; i < ARRAY_COUNT(sDbCameraCuts) - 1; i++) { osSyncPrintf("###%2d:(%c) (%d %d) %d %d %d\n", i, sDbCameraCuts[i].letter, sDbCameraCuts[i].position, sDbCameraCuts[i].lookAt, sDbCameraCuts[i].nFrames, sDbCameraCuts[i].nPoints, sDbCameraCuts[i].mode); } DbCamera_PrintAllCuts(cam); - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) && - CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L) && + CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CLEFT)) { Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); for (i = 0; i < ARRAY_COUNT(sDbCameraCuts) - 1; i++) { @@ -2295,7 +2295,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { DbCamera_PrintCutBytes(&sDbCameraCuts[i]); } } - } else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CRIGHT)) { sDbCamAnim.curFrame = 0.0f; sDbCamAnim.keyframe = 0; sDbCamAnim.unk_04 = 0.0f; diff --git a/src/code/flg_set.c b/src/code/flg_set.c index 55850d5b0d..8d7814cfa3 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -1,6 +1,6 @@ #include "global.h" -void FlagSet_Update(GlobalContext* globalCtx) { +void FlagSet_Update(PlayState* play) { static s32 entryIdx = 0; static u32 curBit = 0; static s32 timer = 0; @@ -35,8 +35,8 @@ void FlagSet_Update(GlobalContext* globalCtx) { { &gSaveContext.eventInf[2], "event_inf[2]" }, { &gSaveContext.eventInf[3], "event_inf[3]" }, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Input* input = &globalCtx->state.input[0]; + GraphicsContext* gfxCtx = play->state.gfxCtx; + Input* input = &play->state.input[0]; Gfx* gfx; Gfx* polyOpa; @@ -145,7 +145,7 @@ void FlagSet_Update(GlobalContext* globalCtx) { } if (CHECK_BTN_ALL(input->press.button, BTN_L)) { - globalCtx->pauseCtx.debugState = 0; + play->pauseCtx.debugState = 0; } CLOSE_DISPS(gfxCtx, "../flg_set.c", 241); diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 12b59fb5c9..7b409ce096 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -2147,8 +2147,8 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z) { return false; } -void Math3D_DrawSphere(GlobalContext* globalCtx, Sphere16* sph) { +void Math3D_DrawSphere(PlayState* play, Sphere16* sph) { } -void Math3D_DrawCylinder(GlobalContext* globalCtx, Cylinder16* cyl) { +void Math3D_DrawCylinder(PlayState* play, Cylinder16* cyl) { } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 6a5560d6b0..4a45d50ab1 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -17,7 +17,7 @@ void ActorShape_Init(ActorShape* shape, f32 yOffset, ActorShadowFunc shadowDraw, shape->shadowAlpha = 255; } -void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx* dlist, Color_RGBA8* color) { +void ActorShadow_Draw(Actor* actor, Lights* lights, PlayState* play, Gfx* dlist, Color_RGBA8* color) { f32 temp1; f32 temp2; MtxF sp60; @@ -26,7 +26,7 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf temp1 = actor->world.pos.y - actor->floorHeight; if (temp1 >= -50.0f && temp1 < 500.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1553); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 1553); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); @@ -53,35 +53,35 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf temp2 = (1.0f - (temp1 * (1.0f / 350))) * actor->shape.shadowScale; Matrix_Scale(actor->scale.x * temp2, 1.0f, actor->scale.z * temp2, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1588), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 1588), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dlist); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1594); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 1594); } } } -void ActorShadow_DrawCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx) { - ActorShadow_Draw(actor, lights, globalCtx, gCircleShadowDL, NULL); +void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play) { + ActorShadow_Draw(actor, lights, play, gCircleShadowDL, NULL); } -void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx) { +void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, PlayState* play) { static Color_RGBA8 white = { 255, 255, 255, 255 }; - ActorShadow_Draw(actor, lights, globalCtx, gCircleShadowDL, &white); + ActorShadow_Draw(actor, lights, play, gCircleShadowDL, &white); } -void ActorShadow_DrawHorse(Actor* actor, Lights* lights, GlobalContext* globalCtx) { - ActorShadow_Draw(actor, lights, globalCtx, gHorseShadowDL, NULL); +void ActorShadow_DrawHorse(Actor* actor, Lights* lights, PlayState* play) { + ActorShadow_Draw(actor, lights, play, gHorseShadowDL, NULL); } -void ActorShadow_DrawFoot(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) { +void ActorShadow_DrawFoot(PlayState* play, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) { s32 pad1; f32 sp58; s32 pad2[2]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1661); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 1661); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u32)(((arg3 * 0.00005f) > 1.0f ? 1.0f : (arg3 * 0.00005f)) * arg4) & 0xFF); @@ -93,14 +93,13 @@ void ActorShadow_DrawFoot(GlobalContext* globalCtx, Light* light, MtxF* arg2, s3 Matrix_RotateY(sp58, MTXMODE_APPLY); Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1687), - G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 1687), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gFootShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1693); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 1693); } -void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx) { +void ActorShadow_DrawFeet(Actor* actor, Lights* lights, PlayState* play) { f32 distToFloor = actor->world.pos.y - actor->floorHeight; if (distToFloor > 20.0f) { @@ -111,7 +110,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx actor->shape.shadowScale *= 0.3f; alphaRatio = (distToFloor - 20.0f) * 0.02f; actor->shape.shadowAlpha = (f32)actor->shape.shadowAlpha * CLAMP_MAX(alphaRatio, 1.0f); - ActorShadow_DrawCircle(actor, lights, globalCtx); + ActorShadow_DrawCircle(actor, lights, play); actor->shape.shadowScale = shadowScale; actor->shape.shadowAlpha = shadowAlpha; } @@ -133,7 +132,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx Vec3f* feetPosPtr = actor->shape.feetPos; f32* floorHeightPtr = floorHeight; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1741); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 1741); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); @@ -143,7 +142,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx for (i = 0; i < 2; i++) { feetPosPtr->y += 50.0f; - *floorHeightPtr = func_800BFCB8(globalCtx, &floorMtx, feetPosPtr); + *floorHeightPtr = func_800BFCB8(play, &floorMtx, feetPosPtr); feetPosPtr->y -= 50.0f; actor->shape.feetFloorFlag <<= 1; distToFloor = feetPosPtr->y - *floorHeightPtr; @@ -166,7 +165,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx (lightPtr->l.col[0] + lightPtr->l.col[1] + lightPtr->l.col[2]) * ABS(lightPtr->l.dir[1]); if (lightNum > 0) { lightNumMax += lightNum; - ActorShadow_DrawFoot(globalCtx, lightPtr, &floorMtx, lightNum, shadowAlpha, shadowScaleX, + ActorShadow_DrawFoot(play, lightPtr, &floorMtx, lightNum, shadowAlpha, shadowScaleX, shadowScaleZ); } } @@ -179,7 +178,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx ((lightPtr->l.col[0] + lightPtr->l.col[1] + lightPtr->l.col[2]) * ABS(lightPtr->l.dir[1])) - (lightNumMax * 8); if (lightNum > 0) { - ActorShadow_DrawFoot(globalCtx, lightPtr, &floorMtx, lightNum, shadowAlpha, shadowScaleX, + ActorShadow_DrawFoot(play, lightPtr, &floorMtx, lightNum, shadowAlpha, shadowScaleX, shadowScaleZ); } } @@ -202,7 +201,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1831); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 1831); } } @@ -215,8 +214,8 @@ void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* lef } } -void Actor_ProjectPos(GlobalContext* globalCtx, Vec3f* src, Vec3f* xyzDest, f32* cappedInvWDest) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, src, xyzDest, cappedInvWDest); +void Actor_ProjectPos(PlayState* play, Vec3f* src, Vec3f* xyzDest, f32* cappedInvWDest) { + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, src, xyzDest, cappedInvWDest); *cappedInvWDest = (*cappedInvWDest < 1.0f) ? 1.0f : (1.0f / *cappedInvWDest); } @@ -247,12 +246,12 @@ void func_8002BE64(TargetContext* targetCtx, s32 index, f32 arg2, f32 arg3, f32 targetCtx->arr_50[index].unk_0C = targetCtx->unk_44; } -void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, GlobalContext* globalCtx) { +void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, PlayState* play) { TargetContextEntry* entry; NaviColor* naviColor; s32 i; - Math_Vec3f_Copy(&targetCtx->targetCenterPos, &globalCtx->view.eye); + Math_Vec3f_Copy(&targetCtx->targetCenterPos, &play->view.eye); targetCtx->unk_44 = 500.0f; targetCtx->unk_48 = 0x100; @@ -268,7 +267,7 @@ void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, GlobalContext* g } } -void Actor_SetNaviToActor(TargetContext* targetCtx, Actor* actor, s32 actorCategory, GlobalContext* globalCtx) { +void Actor_SetNaviToActor(TargetContext* targetCtx, Actor* actor, s32 actorCategory, PlayState* play) { NaviColor* naviColor = &sNaviColorList[actorCategory]; targetCtx->naviRefPos.x = actor->focus.pos.x; targetCtx->naviRefPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y); @@ -283,7 +282,7 @@ void Actor_SetNaviToActor(TargetContext* targetCtx, Actor* actor, s32 actorCateg targetCtx->naviOuter.a = naviColor->outer.a; } -void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* globalCtx) { +void func_8002C0C0(TargetContext* targetCtx, Actor* actor, PlayState* play) { targetCtx->arrowPointedActor = NULL; targetCtx->targetedActor = NULL; targetCtx->unk_40 = 0.0f; @@ -291,14 +290,14 @@ void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* global targetCtx->bgmEnemy = NULL; targetCtx->unk_4B = 0; targetCtx->unk_4C = 0; - Actor_SetNaviToActor(targetCtx, actor, actor->category, globalCtx); - func_8002BE98(targetCtx, actor->category, globalCtx); + Actor_SetNaviToActor(targetCtx, actor, actor->category, play); + func_8002BE98(targetCtx, actor->category, play); } -void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { +void func_8002C124(TargetContext* targetCtx, PlayState* play) { Actor* actor = targetCtx->targetedActor; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2029); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 2029); if (targetCtx->unk_48 != 0) { TargetContextEntry* entry; @@ -314,7 +313,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { f32 var2; s32 i; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); spCE = 0xFF; var1 = 1.0f; @@ -336,7 +335,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { spCE = targetCtx->unk_48; } - Actor_ProjectPos(globalCtx, &targetCtx->targetCenterPos, &projTargetCenter, &projTargetCappedInvW); + Actor_ProjectPos(play, &targetCtx->targetCenterPos, &projTargetCenter, &projTargetCappedInvW); projTargetCenter.x = (160 * (projTargetCenter.x * projTargetCappedInvW)) * var1; projTargetCenter.x = CLAMP(projTargetCenter.x, -320.0f, 320.0f); @@ -377,7 +376,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); Matrix_Push(); Matrix_Translate(entry->unk_0C, entry->unk_0C, 0.0f, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2116), + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 2116), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(OVERLAY_DISP++, gZTargetLockOnTriangleDL); Matrix_Pop(); @@ -400,19 +399,19 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { Matrix_Translate(actor->focus.pos.x, actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y) + 17.0f, actor->focus.pos.z, MTXMODE_NEW); - Matrix_RotateY(BINANG_TO_RAD((u16)(globalCtx->gameplayFrames * 3000)), MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD((u16)(play->gameplayFrames * 3000)), MTXMODE_APPLY); Matrix_Scale((iREG(27) + 35) / 1000.0f, (iREG(28) + 60) / 1000.0f, (iREG(29) + 50) / 1000.0f, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, naviColor->inner.r, naviColor->inner.g, naviColor->inner.b, 255); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2153), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 2153), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gZTargetArrowDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2158); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 2158); } -void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, GlobalContext* globalCtx) { +void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, PlayState* play) { s32 pad; Actor* unkActor; s32 actorCategory; @@ -431,7 +430,7 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl if ((player->unk_664 != NULL) && (player->unk_84B[player->unk_846] == 2)) { targetCtx->unk_94 = NULL; } else { - func_80032AF0(globalCtx, &globalCtx->actorCtx, &unkActor, player); + func_80032AF0(play, &play->actorCtx, &unkActor, player); targetCtx->unk_94 = unkActor; } @@ -467,11 +466,11 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl targetCtx->naviRefPos.y += temp3 * temp1; targetCtx->naviRefPos.z += temp4 * temp1; } else { - Actor_SetNaviToActor(targetCtx, unkActor, actorCategory, globalCtx); + Actor_SetNaviToActor(targetCtx, unkActor, actorCategory, play); } if ((actorArg != NULL) && (targetCtx->unk_4B == 0)) { - Actor_ProjectPos(globalCtx, &actorArg->focus.pos, &projectedFocusPos, &cappedInvWDest); + Actor_ProjectPos(play, &actorArg->focus.pos, &projectedFocusPos, &cappedInvWDest); if (((projectedFocusPos.z <= 0.0f) || (1.0f <= fabsf(projectedFocusPos.x * cappedInvWDest))) || (1.0f <= fabsf(projectedFocusPos.y * cappedInvWDest))) { actorArg = NULL; @@ -480,7 +479,7 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl if (actorArg != NULL) { if (actorArg != targetCtx->targetedActor) { - func_8002BE98(targetCtx, actorArg->category, globalCtx); + func_8002BE98(targetCtx, actorArg->category, play); targetCtx->targetedActor = actorArg; if (actorArg->id == ACTOR_EN_BOOM) { @@ -515,154 +514,154 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl /** * Tests if current scene switch flag is set. */ -s32 Flags_GetSwitch(GlobalContext* globalCtx, s32 flag) { +s32 Flags_GetSwitch(PlayState* play, s32 flag) { if (flag < 0x20) { - return globalCtx->actorCtx.flags.swch & (1 << flag); + return play->actorCtx.flags.swch & (1 << flag); } else { - return globalCtx->actorCtx.flags.tempSwch & (1 << (flag - 0x20)); + return play->actorCtx.flags.tempSwch & (1 << (flag - 0x20)); } } /** * Sets current scene switch flag. */ -void Flags_SetSwitch(GlobalContext* globalCtx, s32 flag) { +void Flags_SetSwitch(PlayState* play, s32 flag) { if (flag < 0x20) { - globalCtx->actorCtx.flags.swch |= (1 << flag); + play->actorCtx.flags.swch |= (1 << flag); } else { - globalCtx->actorCtx.flags.tempSwch |= (1 << (flag - 0x20)); + play->actorCtx.flags.tempSwch |= (1 << (flag - 0x20)); } } /** * Unsets current scene switch flag. */ -void Flags_UnsetSwitch(GlobalContext* globalCtx, s32 flag) { +void Flags_UnsetSwitch(PlayState* play, s32 flag) { if (flag < 0x20) { - globalCtx->actorCtx.flags.swch &= ~(1 << flag); + play->actorCtx.flags.swch &= ~(1 << flag); } else { - globalCtx->actorCtx.flags.tempSwch &= ~(1 << (flag - 0x20)); + play->actorCtx.flags.tempSwch &= ~(1 << (flag - 0x20)); } } /** * Tests if unknown flag is set. */ -s32 Flags_GetUnknown(GlobalContext* globalCtx, s32 flag) { +s32 Flags_GetUnknown(PlayState* play, s32 flag) { if (flag < 0x20) { - return globalCtx->actorCtx.flags.unk0 & (1 << flag); + return play->actorCtx.flags.unk0 & (1 << flag); } else { - return globalCtx->actorCtx.flags.unk1 & (1 << (flag - 0x20)); + return play->actorCtx.flags.unk1 & (1 << (flag - 0x20)); } } /** * Sets unknown flag. */ -void Flags_SetUnknown(GlobalContext* globalCtx, s32 flag) { +void Flags_SetUnknown(PlayState* play, s32 flag) { if (flag < 0x20) { - globalCtx->actorCtx.flags.unk0 |= (1 << flag); + play->actorCtx.flags.unk0 |= (1 << flag); } else { - globalCtx->actorCtx.flags.unk1 |= (1 << (flag - 0x20)); + play->actorCtx.flags.unk1 |= (1 << (flag - 0x20)); } } /** * Unsets unknown flag. */ -void Flags_UnsetUnknown(GlobalContext* globalCtx, s32 flag) { +void Flags_UnsetUnknown(PlayState* play, s32 flag) { if (flag < 0x20) { - globalCtx->actorCtx.flags.unk0 &= ~(1 << flag); + play->actorCtx.flags.unk0 &= ~(1 << flag); } else { - globalCtx->actorCtx.flags.unk1 &= ~(1 << (flag - 0x20)); + play->actorCtx.flags.unk1 &= ~(1 << (flag - 0x20)); } } /** * Tests if current scene chest flag is set. */ -s32 Flags_GetTreasure(GlobalContext* globalCtx, s32 flag) { - return globalCtx->actorCtx.flags.chest & (1 << flag); +s32 Flags_GetTreasure(PlayState* play, s32 flag) { + return play->actorCtx.flags.chest & (1 << flag); } /** * Sets current scene chest flag. */ -void Flags_SetTreasure(GlobalContext* globalCtx, s32 flag) { - globalCtx->actorCtx.flags.chest |= (1 << flag); +void Flags_SetTreasure(PlayState* play, s32 flag) { + play->actorCtx.flags.chest |= (1 << flag); } /** * Tests if current scene clear flag is set. */ -s32 Flags_GetClear(GlobalContext* globalCtx, s32 flag) { - return globalCtx->actorCtx.flags.clear & (1 << flag); +s32 Flags_GetClear(PlayState* play, s32 flag) { + return play->actorCtx.flags.clear & (1 << flag); } /** * Sets current scene clear flag. */ -void Flags_SetClear(GlobalContext* globalCtx, s32 flag) { - globalCtx->actorCtx.flags.clear |= (1 << flag); +void Flags_SetClear(PlayState* play, s32 flag) { + play->actorCtx.flags.clear |= (1 << flag); } /** * Unsets current scene clear flag. */ -void Flags_UnsetClear(GlobalContext* globalCtx, s32 flag) { - globalCtx->actorCtx.flags.clear &= ~(1 << flag); +void Flags_UnsetClear(PlayState* play, s32 flag) { + play->actorCtx.flags.clear &= ~(1 << flag); } /** * Tests if current scene temp clear flag is set. */ -s32 Flags_GetTempClear(GlobalContext* globalCtx, s32 flag) { - return globalCtx->actorCtx.flags.tempClear & (1 << flag); +s32 Flags_GetTempClear(PlayState* play, s32 flag) { + return play->actorCtx.flags.tempClear & (1 << flag); } /** * Sets current scene temp clear flag. */ -void Flags_SetTempClear(GlobalContext* globalCtx, s32 flag) { - globalCtx->actorCtx.flags.tempClear |= (1 << flag); +void Flags_SetTempClear(PlayState* play, s32 flag) { + play->actorCtx.flags.tempClear |= (1 << flag); } /** * Unsets current scene temp clear flag. */ -void Flags_UnsetTempClear(GlobalContext* globalCtx, s32 flag) { - globalCtx->actorCtx.flags.tempClear &= ~(1 << flag); +void Flags_UnsetTempClear(PlayState* play, s32 flag) { + play->actorCtx.flags.tempClear &= ~(1 << flag); } /** * Tests if current scene collectible flag is set. */ -s32 Flags_GetCollectible(GlobalContext* globalCtx, s32 flag) { +s32 Flags_GetCollectible(PlayState* play, s32 flag) { if (flag < 0x20) { - return globalCtx->actorCtx.flags.collect & (1 << flag); + return play->actorCtx.flags.collect & (1 << flag); } else { - return globalCtx->actorCtx.flags.tempCollect & (1 << (flag - 0x20)); + return play->actorCtx.flags.tempCollect & (1 << (flag - 0x20)); } } /** * Sets current scene collectible flag. */ -void Flags_SetCollectible(GlobalContext* globalCtx, s32 flag) { +void Flags_SetCollectible(PlayState* play, s32 flag) { if (flag != 0) { if (flag < 0x20) { - globalCtx->actorCtx.flags.collect |= (1 << flag); + play->actorCtx.flags.collect |= (1 << flag); } else { - globalCtx->actorCtx.flags.tempCollect |= (1 << (flag - 0x20)); + play->actorCtx.flags.tempCollect |= (1 << (flag - 0x20)); } } } -void TitleCard_Init(GlobalContext* globalCtx, TitleCardContext* titleCtx) { +void TitleCard_Init(PlayState* play, TitleCardContext* titleCtx) { titleCtx->durationTimer = titleCtx->delayTimer = titleCtx->intensity = titleCtx->alpha = 0; } -void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width, +void TitleCard_InitBossName(PlayState* play, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width, u8 height) { titleCtx->texture = texture; titleCtx->x = x; @@ -673,9 +672,9 @@ void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx titleCtx->delayTimer = 0; } -void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s32 x, s32 y, - s32 width, s32 height, s32 delay) { - SceneTableEntry* loadedScene = globalCtx->loadedScene; +void TitleCard_InitPlaceName(PlayState* play, TitleCardContext* titleCtx, void* texture, s32 x, s32 y, s32 width, + s32 height, s32 delay) { + SceneTableEntry* loadedScene = play->loadedScene; u32 size = loadedScene->titleFile.vromEnd - loadedScene->titleFile.vromStart; if ((size != 0) && (size <= 0x3000)) { @@ -691,7 +690,7 @@ void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCt titleCtx->delayTimer = delay; } -void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) { +void TitleCard_Update(PlayState* play, TitleCardContext* titleCtx) { if (DECR(titleCtx->delayTimer) == 0) { if (DECR(titleCtx->durationTimer) == 0) { Math_StepToS(&titleCtx->alpha, 0, 30); @@ -703,7 +702,7 @@ void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) { } } -void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { +void TitleCard_Draw(PlayState* play, TitleCardContext* titleCtx) { s32 width; s32 height; s32 unused; @@ -720,7 +719,7 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { titleY = (titleCtx->y * 4) - (height * 2); doubleWidth = width * 2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2824); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 2824); textureLanguageOffset = width * height * gSaveContext.language; height = (width * height > 0x1000) ? 0x1000 / width : height; @@ -750,12 +749,12 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { titleSecondY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2880); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 2880); } } -s32 TitleCard_Clear(GlobalContext* globalCtx, TitleCardContext* titleCtx) { - if ((globalCtx->actorCtx.titleCtx.delayTimer != 0) || (globalCtx->actorCtx.titleCtx.alpha != 0)) { +s32 TitleCard_Clear(PlayState* play, TitleCardContext* titleCtx) { + if ((play->actorCtx.titleCtx.delayTimer != 0) || (play->actorCtx.titleCtx.alpha != 0)) { titleCtx->durationTimer = 0; titleCtx->delayTimer = 0; return false; @@ -798,11 +797,11 @@ void Actor_SetScale(Actor* actor, f32 scale) { actor->scale.x = scale; } -void Actor_SetObjectDependency(GlobalContext* globalCtx, Actor* actor) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[actor->objBankIndex].segment); +void Actor_SetObjectDependency(PlayState* play, Actor* actor) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[actor->objBankIndex].segment); } -void Actor_Init(Actor* actor, GlobalContext* globalCtx) { +void Actor_Init(Actor* actor, PlayState* play) { Actor_SetWorldToHome(actor); Actor_SetShapeRotToWorld(actor); Actor_SetFocus(actor, 0.0f); @@ -818,19 +817,19 @@ void Actor_Init(Actor* actor, GlobalContext* globalCtx) { CollisionCheck_InitInfo(&actor->colChkInfo); actor->floorBgId = BGCHECK_SCENE; ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f); - if (Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { - Actor_SetObjectDependency(globalCtx, actor); - actor->init(actor, globalCtx); + if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { + Actor_SetObjectDependency(play, actor); + actor->init(actor, play); actor->init = NULL; } } -void Actor_Destroy(Actor* actor, GlobalContext* globalCtx) { +void Actor_Destroy(Actor* actor, PlayState* play) { ActorOverlay* overlayEntry; char* name; if (actor->destroy != NULL) { - actor->destroy(actor, globalCtx); + actor->destroy(actor, play); actor->destroy = NULL; } else { overlayEntry = actor->overlayEntry; @@ -979,26 +978,26 @@ s32 func_8002DD78(Player* player) { return func_8002DD6C(player) && player->unk_834; } -s32 func_8002DDA8(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002DDA8(PlayState* play) { + Player* player = GET_PLAYER(play); return (player->stateFlags1 & PLAYER_STATE1_11) || func_8002DD78(player); } -s32 func_8002DDE4(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002DDE4(PlayState* play) { + Player* player = GET_PLAYER(play); return player->stateFlags2 & PLAYER_STATE2_3; } -s32 func_8002DDF4(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002DDF4(PlayState* play) { + Player* player = GET_PLAYER(play); return player->stateFlags2 & PLAYER_STATE2_12; } -void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) { - ArmsHook* hookshot = (ArmsHook*)Actor_Find(&globalCtx->actorCtx, ACTOR_ARMS_HOOK, ACTORCAT_ITEMACTION); +void func_8002DE04(PlayState* play, Actor* actorA, Actor* actorB) { + ArmsHook* hookshot = (ArmsHook*)Actor_Find(&play->actorCtx, ACTOR_ARMS_HOOK, ACTORCAT_ITEMACTION); hookshot->grabbed = actorB; hookshot->grabbedDistDiff.x = 0.0f; @@ -1008,13 +1007,13 @@ void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) { actorA->flags &= ~ACTOR_FLAG_13; } -void func_8002DE74(GlobalContext* globalCtx, Player* player) { - if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_4) && func_800C0CB8(globalCtx)) { - Camera_ChangeSetting(Play_GetCamera(globalCtx, CAM_ID_MAIN), CAM_SET_HORSE); +void func_8002DE74(PlayState* play, Player* player) { + if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_4) && func_800C0CB8(play)) { + Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_HORSE); } } -void Actor_MountHorse(GlobalContext* globalCtx, Player* player, Actor* horse) { +void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) { player->rideActor = horse; player->stateFlags1 |= PLAYER_STATE1_23; horse->child = &player->actor; @@ -1024,12 +1023,12 @@ s32 func_8002DEEC(Player* player) { return (player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (player->csMode != 0); } -void func_8002DF18(GlobalContext* globalCtx, Player* player) { - func_8006DC68(globalCtx, player); +void func_8002DF18(PlayState* play, Player* player) { + func_8006DC68(play, player); } -s32 func_8002DF38(GlobalContext* globalCtx, Actor* actor, u8 csMode) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002DF38(PlayState* play, Actor* actor, u8 csMode) { + Player* player = GET_PLAYER(play); player->csMode = csMode; player->unk_448 = actor; @@ -1038,10 +1037,10 @@ s32 func_8002DF38(GlobalContext* globalCtx, Actor* actor, u8 csMode) { return true; } -s32 func_8002DF54(GlobalContext* globalCtx, Actor* actor, u8 csMode) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002DF54(PlayState* play, Actor* actor, u8 csMode) { + Player* player = GET_PLAYER(play); - func_8002DF38(globalCtx, actor, csMode); + func_8002DF38(play, actor, csMode); player->unk_46A = 1; return true; @@ -1061,8 +1060,8 @@ void func_8002DFA4(DynaPolyActor* dynaActor, f32 arg1, s16 arg2) { * Chcek if the player is facing the specified actor. * The maximum angle difference that qualifies as "facing" is specified by `maxAngle`. */ -s32 Player_IsFacingActor(Actor* actor, s16 maxAngle, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 Player_IsFacingActor(Actor* actor, s16 maxAngle, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff = (s16)(actor->yawTowardsPlayer + 0x8000) - player->actor.shape.rot.y; if (ABS(yawDiff) < maxAngle) { @@ -1169,14 +1168,13 @@ s32 func_8002E234(Actor* actor, f32 arg1, s32 arg2) { return true; } -s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) { +s32 func_8002E2AC(PlayState* play, Actor* actor, Vec3f* arg2, s32 arg3) { f32 floorHeightDiff; s32 floorBgId; arg2->y += 50.0f; - actor->floorHeight = - BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &actor->floorPoly, &floorBgId, actor, arg2); + actor->floorHeight = BgCheck_EntityRaycastFloor5(play, &play->colCtx, &actor->floorPoly, &floorBgId, actor, arg2); actor->bgCheckFlags &= ~(BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_GROUND_LEAVE | BGCHECKFLAG_GROUND_STRICT); if (actor->floorHeight <= BGCHECK_Y_MIN) { @@ -1212,11 +1210,11 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) } actor->bgCheckFlags |= BGCHECKFLAG_GROUND; - func_80043334(&globalCtx->colCtx, actor, actor->floorBgId); + func_80043334(&play->colCtx, actor, actor->floorBgId); } } else { // actor is above ground if ((actor->bgCheckFlags & BGCHECKFLAG_GROUND) && (floorHeightDiff >= -11.0f)) { - func_80043334(&globalCtx->colCtx, actor, actor->floorBgId); + func_80043334(&play->colCtx, actor, actor->floorBgId); } return func_8002E234(actor, floorHeightDiff, arg3); @@ -1225,7 +1223,7 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) return true; } -void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, +void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, f32 ceilingCheckHeight, s32 flags) { f32 sp74; s32 pad; @@ -1240,15 +1238,15 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe sp74 = actor->world.pos.y - actor->prevPos.y; if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_800433A4(&globalCtx->colCtx, actor->floorBgId, actor); + func_800433A4(&play->colCtx, actor->floorBgId, actor); } if (flags & UPDBGCHECKINFO_FLAG_0) { if ((!(flags & UPDBGCHECKINFO_FLAG_7) && - BgCheck_EntitySphVsWall3(&globalCtx->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius, + BgCheck_EntitySphVsWall3(&play->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius, &actor->wallPoly, &bgId, actor, wallCheckHeight)) || ((flags & UPDBGCHECKINFO_FLAG_7) && - BgCheck_EntitySphVsWall4(&globalCtx->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius, + BgCheck_EntitySphVsWall4(&play->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius, &actor->wallPoly, &bgId, actor, wallCheckHeight))) { wallPoly = actor->wallPoly; Math_Vec3f_Copy(&actor->world.pos, &sp64); @@ -1265,7 +1263,7 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe if (flags & UPDBGCHECKINFO_FLAG_1) { sp64.y = actor->prevPos.y + 10.0f; - if (BgCheck_EntityCheckCeiling(&globalCtx->colCtx, &sp58, &sp64, (ceilingCheckHeight + sp74) - 10.0f, + if (BgCheck_EntityCheckCeiling(&play->colCtx, &sp58, &sp64, (ceilingCheckHeight + sp74) - 10.0f, &sCurCeilingPoly, &sCurCeilingBgId, actor)) { actor->bgCheckFlags |= BGCHECKFLAG_CEILING; actor->world.pos.y = (sp58 + sp74) - 10.0f; @@ -1276,10 +1274,10 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe if (flags & UPDBGCHECKINFO_FLAG_2) { sp64.y = actor->prevPos.y; - func_8002E2AC(globalCtx, actor, &sp64, flags); + func_8002E2AC(play, actor, &sp64, flags); waterBoxYSurface = actor->world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, actor->world.pos.x, actor->world.pos.z, - &waterBoxYSurface, &waterBox)) { + if (WaterBox_GetSurface1(play, &play->colCtx, actor->world.pos.x, actor->world.pos.z, &waterBoxYSurface, + &waterBox)) { actor->yDistToWater = waterBoxYSurface - actor->world.pos.y; if (actor->yDistToWater < 0.0f) { actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); @@ -1290,9 +1288,9 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe ripplePos.x = actor->world.pos.x; ripplePos.y = waterBoxYSurface; ripplePos.z = actor->world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 4); - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 8); + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 4); + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 8); } } actor->bgCheckFlags |= BGCHECKFLAG_WATER; @@ -1356,60 +1354,60 @@ Hilite* func_8002EB44(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContex return hilite; } -void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag) { +void func_8002EBCC(Actor* actor, PlayState* play, s32 flag) { Hilite* hilite; Vec3f lightDir; Gfx* displayListHead; Gfx* displayList; - lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x; - lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y; - lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z; + lightDir.x = play->envCtx.dirLight1.params.dir.x; + lightDir.y = play->envCtx.dirLight1.params.dir.y; + lightDir.z = play->envCtx.dirLight1.params.dir.z; if (HREG(80) == 6) { - osSyncPrintf("z_actor.c 3637 game_play->view.eye=[%f(%f) %f %f]\n", globalCtx->view.eye.x, - globalCtx->view.eye.y, globalCtx->view.eye.z); + osSyncPrintf("z_actor.c 3637 game_play->view.eye=[%f(%f) %f %f]\n", play->view.eye.x, play->view.eye.y, + play->view.eye.z); } - hilite = func_8002EABC(&actor->world.pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + hilite = func_8002EABC(&actor->world.pos, &play->view.eye, &lightDir, play->state.gfxCtx); if (flag != 0) { - displayList = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); + displayList = Graph_Alloc(play->state.gfxCtx, 2 * sizeof(Gfx)); displayListHead = displayList; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 4384); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 4384); gDPSetHilite1Tile(displayListHead++, 1, hilite, 0x10, 0x10); gSPEndDisplayList(displayListHead); gSPSegment(POLY_OPA_DISP++, 0x07, displayList); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 4394); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 4394); } } -void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag) { +void func_8002ED80(Actor* actor, PlayState* play, s32 flag) { Hilite* hilite; Vec3f lightDir; Gfx* displayListHead; Gfx* displayList; - lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x; - lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y; - lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z; + lightDir.x = play->envCtx.dirLight1.params.dir.x; + lightDir.y = play->envCtx.dirLight1.params.dir.y; + lightDir.z = play->envCtx.dirLight1.params.dir.z; - hilite = func_8002EB44(&actor->world.pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + hilite = func_8002EB44(&actor->world.pos, &play->view.eye, &lightDir, play->state.gfxCtx); if (flag != 0) { - displayList = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); + displayList = Graph_Alloc(play->state.gfxCtx, 2 * sizeof(Gfx)); displayListHead = displayList; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 4429); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 4429); gDPSetHilite1Tile(displayListHead++, 1, hilite, 0x10, 0x10); gSPEndDisplayList(displayListHead); gSPSegment(POLY_XLU_DISP++, 0x07, displayList); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 4439); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 4439); } } @@ -1497,7 +1495,7 @@ s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) { return false; } -u32 Actor_ProcessTalkRequest(Actor* actor, GlobalContext* globalCtx) { +u32 Actor_ProcessTalkRequest(Actor* actor, PlayState* play) { if (actor->flags & ACTOR_FLAG_8) { actor->flags &= ~ACTOR_FLAG_8; return true; @@ -1506,11 +1504,11 @@ u32 Actor_ProcessTalkRequest(Actor* actor, GlobalContext* globalCtx) { return false; } -s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u32 exchangeItemId) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002F1C4(Actor* actor, PlayState* play, f32 arg2, f32 arg3, u32 exchangeItemId) { + Player* player = GET_PLAYER(play); // This is convoluted but it seems like it must be a single if statement to match - if ((player->actor.flags & ACTOR_FLAG_8) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(globalCtx)) || + if ((player->actor.flags & ACTOR_FLAG_8) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(play)) || (!actor->isTargeted && ((arg3 < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) || (arg2 < actor->xzDistToPlayer)))) { @@ -1524,44 +1522,44 @@ s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u3 return true; } -s32 func_8002F298(Actor* actor, GlobalContext* globalCtx, f32 arg2, u32 exchangeItemId) { - return func_8002F1C4(actor, globalCtx, arg2, arg2, exchangeItemId); +s32 func_8002F298(Actor* actor, PlayState* play, f32 arg2, u32 exchangeItemId) { + return func_8002F1C4(actor, play, arg2, arg2, exchangeItemId); } -s32 func_8002F2CC(Actor* actor, GlobalContext* globalCtx, f32 arg2) { - return func_8002F298(actor, globalCtx, arg2, EXCH_ITEM_NONE); +s32 func_8002F2CC(Actor* actor, PlayState* play, f32 arg2) { + return func_8002F298(actor, play, arg2, EXCH_ITEM_NONE); } -s32 func_8002F2F4(Actor* actor, GlobalContext* globalCtx) { +s32 func_8002F2F4(Actor* actor, PlayState* play) { f32 var1 = 50.0f + actor->colChkInfo.cylRadius; - return func_8002F2CC(actor, globalCtx, var1); + return func_8002F2CC(actor, play, var1); } -u32 Actor_TextboxIsClosing(Actor* actor, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +u32 Actor_TextboxIsClosing(Actor* actor, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return true; } else { return false; } } -s8 func_8002F368(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s8 func_8002F368(PlayState* play) { + Player* player = GET_PLAYER(play); return player->exchangeItemId; } -void Actor_GetScreenPos(GlobalContext* globalCtx, Actor* actor, s16* x, s16* y) { +void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y) { Vec3f projectedPos; f32 cappedInvW; - Actor_ProjectPos(globalCtx, &actor->focus.pos, &projectedPos, &cappedInvW); + Actor_ProjectPos(play, &actor->focus.pos, &projectedPos, &cappedInvW); *x = projectedPos.x * cappedInvW * (SCREEN_WIDTH / 2) + (SCREEN_WIDTH / 2); *y = projectedPos.y * cappedInvW * -(SCREEN_HEIGHT / 2) + (SCREEN_HEIGHT / 2); } -u32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx) { +u32 Actor_HasParent(Actor* actor, PlayState* play) { if (actor->parent != NULL) { return true; } else { @@ -1569,8 +1567,8 @@ u32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx) { } } -s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8002F434(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_12 | PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_21)) && @@ -1595,15 +1593,15 @@ s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzR return false; } -void func_8002F554(Actor* actor, GlobalContext* globalCtx, s32 getItemId) { - func_8002F434(actor, globalCtx, getItemId, 50.0f, 10.0f); +void func_8002F554(Actor* actor, PlayState* play, s32 getItemId) { + func_8002F434(actor, play, getItemId, 50.0f, 10.0f); } -void func_8002F580(Actor* actor, GlobalContext* globalCtx) { - func_8002F554(actor, globalCtx, GI_NONE); +void func_8002F580(Actor* actor, PlayState* play) { + func_8002F554(actor, play, GI_NONE); } -u32 Actor_HasNoParent(Actor* actor, GlobalContext* globalCtx) { +u32 Actor_HasNoParent(Actor* actor, PlayState* play) { if (actor->parent == NULL) { return true; } else { @@ -1611,7 +1609,7 @@ u32 Actor_HasNoParent(Actor* actor, GlobalContext* globalCtx) { } } -void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) { +void func_8002F5C4(Actor* actorA, Actor* actorB, PlayState* play) { Actor* parent = actorA->parent; if (parent->id == ACTOR_PLAYER) { @@ -1626,15 +1624,15 @@ void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) { actorA->parent = NULL; } -void func_8002F5F0(Actor* actor, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8002F5F0(Actor* actor, PlayState* play) { + Player* player = GET_PLAYER(play); if (actor->xyzDistToPlayerSq < player->unk_6A4) { player->unk_6A4 = actor->xyzDistToPlayerSq; } } -s32 Actor_IsMounted(GlobalContext* globalCtx, Actor* horse) { +s32 Actor_IsMounted(PlayState* play, Actor* horse) { if (horse->child != NULL) { return true; } else { @@ -1642,8 +1640,8 @@ s32 Actor_IsMounted(GlobalContext* globalCtx, Actor* horse) { } } -u32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 mountSide) { - Player* player = GET_PLAYER(globalCtx); +u32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_11 | PLAYER_STATE1_12 | PLAYER_STATE1_13 | PLAYER_STATE1_14 | @@ -1656,7 +1654,7 @@ u32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 mountSide) { return false; } -s32 Actor_NotMounted(GlobalContext* globalCtx, Actor* horse) { +s32 Actor_NotMounted(PlayState* play, Actor* horse) { if (horse->child == NULL) { return true; } else { @@ -1664,8 +1662,8 @@ s32 Actor_NotMounted(GlobalContext* globalCtx, Actor* horse) { } } -void func_8002F698(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) { - Player* player = GET_PLAYER(globalCtx); +void func_8002F698(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) { + Player* player = GET_PLAYER(play); player->unk_8A0 = arg6; player->unk_8A1 = arg5; @@ -1674,20 +1672,20 @@ void func_8002F698(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f player->unk_8A8 = arg4; } -void func_8002F6D4(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { - func_8002F698(globalCtx, actor, arg2, arg3, arg4, 2, arg5); +void func_8002F6D4(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { + func_8002F698(play, actor, arg2, arg3, arg4, 2, arg5); } -void func_8002F71C(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { - func_8002F6D4(globalCtx, actor, arg2, arg3, arg4, 0); +void func_8002F71C(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { + func_8002F6D4(play, actor, arg2, arg3, arg4, 0); } -void func_8002F758(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { - func_8002F698(globalCtx, actor, arg2, arg3, arg4, 1, arg5); +void func_8002F758(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { + func_8002F698(play, actor, arg2, arg3, arg4, 1, arg5); } -void func_8002F7A0(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { - func_8002F758(globalCtx, actor, arg2, arg3, arg4, 0); +void func_8002F7A0(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { + func_8002F758(play, actor, arg2, arg3, arg4, 0); } void func_8002F7DC(Actor* actor, u16 sfxId) { @@ -1699,7 +1697,7 @@ void Audio_PlayActorSound2(Actor* actor, u16 sfxId) { func_80078914(&actor->projectedPos, sfxId); } -void func_8002F850(GlobalContext* globalCtx, Actor* actor) { +void func_8002F850(PlayState* play, Actor* actor) { s32 sfxId; if (actor->bgCheckFlags & BGCHECKFLAG_WATER) { @@ -1709,7 +1707,7 @@ void func_8002F850(GlobalContext* globalCtx, Actor* actor) { sfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; } } else { - sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, actor->floorPoly, actor->floorBgId); + sfxId = SurfaceType_GetSfx(&play->colCtx, actor->floorPoly, actor->floorBgId); } func_80078914(&actor->projectedPos, NA_SE_EV_BOMB_BOUND); @@ -1752,10 +1750,10 @@ void func_8002F994(Actor* actor, s32 arg1) { } // Tests if something hit Jabu Jabu surface, displaying hit splash and playing sfx if true -s32 func_8002F9EC(GlobalContext* globalCtx, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos) { - if (func_80041D4C(&globalCtx->colCtx, poly, bgId) == 8) { - globalCtx->roomCtx.unk_74[0] = 1; - CollisionCheck_BlueBlood(globalCtx, NULL, pos); +s32 func_8002F9EC(PlayState* play, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos) { + if (func_80041D4C(&play->colCtx, poly, bgId) == 8) { + play->roomCtx.unk_74[0] = 1; + CollisionCheck_BlueBlood(play, NULL, pos); Audio_PlayActorSound2(actor, NA_SE_IT_WALL_HIT_BUYO); return true; } @@ -1769,7 +1767,7 @@ LightNode* D_8015BC10; s32 D_8015BC14; f32 D_8015BC18; -void func_8002FA60(GlobalContext* globalCtx) { +void func_8002FA60(PlayState* play) { Vec3f lightPos; if (gSaveContext.fw.set) { @@ -1796,16 +1794,16 @@ void func_8002FA60(GlobalContext* globalCtx) { Lights_PointNoGlowSetInfo(&D_8015BC00, lightPos.x, lightPos.y, lightPos.z, 0xFF, 0xFF, 0xFF, -1); - D_8015BC10 = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &D_8015BC00); + D_8015BC10 = LightContext_InsertLight(play, &play->lightCtx, &D_8015BC00); D_8015BC14 = 0; D_8015BC18 = 0.0f; } -void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { +void Actor_DrawFaroresWindPointer(PlayState* play) { s32 lightRadius = -1; s32 params; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 5308); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 5308); params = gSaveContext.respawn[RESPAWN_MODE_TOP].data; @@ -1860,8 +1858,8 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { effectPos.y = curPos->y + 80.0f + (6.0f * Rand_ZeroOne()); effectPos.z = curPos->z + Rand_CenteredFloat(6.0f); - EffectSsKiraKira_SpawnDispersed(globalCtx, &effectPos, &effectVel, &effectAccel, &effectPrimCol, - &effectEnvCol, 1000, 16); + EffectSsKiraKira_SpawnDispersed(play, &effectPos, &effectVel, &effectAccel, &effectPrimCol, &effectEnvCol, + 1000, 16); if (D_8015BC18 == 0.0f) { gSaveContext.respawn[RESPAWN_MODE_TOP] = gSaveContext.respawn[RESPAWN_MODE_DOWN]; @@ -1879,9 +1877,9 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { f32 diff; if (nextRatio > 0.0f) { - eye.x = globalCtx->view.eye.x; - eye.y = globalCtx->view.eye.y - yOffset; - eye.z = globalCtx->view.eye.z; + eye.x = play->view.eye.x; + eye.y = play->view.eye.y - yOffset; + eye.z = play->view.eye.z; diff = Math_Vec3f_DistXYZAndStoreDiff(&eye, curPos, &dist); diff = (diff * (nextRatio / curRatio)) / diff; curPos->x = eye.x + (dist.x * diff); @@ -1905,10 +1903,10 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { lightRadius = 500.0f * ratio; - if ((globalCtx->csCtx.state == CS_STATE_IDLE) && + if ((play->csCtx.state == CS_STATE_IDLE) && (((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex) == ((void)0, gSaveContext.entranceIndex)) && - (((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].roomIndex) == globalCtx->roomCtx.curRoom.num)) { + (((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].roomIndex) == play->roomCtx.curRoom.num)) { f32 scale = 0.025f * ratio; POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x19); @@ -1917,22 +1915,22 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { ((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y) + yOffset, ((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z), MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 200, alpha); gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 255); - Matrix_RotateZ(BINANG_TO_RAD_ALT2((globalCtx->gameplayFrames * 1500) & 0xFFFF), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5458), + Matrix_RotateZ(BINANG_TO_RAD_ALT2((play->gameplayFrames * 1500) & 0xFFFF), MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 5458), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); Matrix_Pop(); - Matrix_RotateZ(BINANG_TO_RAD_ALT2(~((globalCtx->gameplayFrames * 1200) & 0xFFFF)), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT2(~((play->gameplayFrames * 1200) & 0xFFFF)), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5463), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 5463), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); } @@ -1941,34 +1939,34 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) { ((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y) + yOffset, ((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z), 255, 255, 255, lightRadius); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 5474); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 5474); } } -void func_80030488(GlobalContext* globalCtx) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, D_8015BC10); +void func_80030488(PlayState* play) { + LightContext_RemoveLight(play, &play->lightCtx, D_8015BC10); } -void Actor_DisableLens(GlobalContext* globalCtx) { - if (globalCtx->actorCtx.lensActive) { - globalCtx->actorCtx.lensActive = false; - func_800876C8(globalCtx); +void Actor_DisableLens(PlayState* play) { + if (play->actorCtx.lensActive) { + play->actorCtx.lensActive = false; + func_800876C8(play); } } // Actor_InitContext -void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorEntry) { +void func_800304DC(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEntry) { ActorOverlay* overlayEntry; SavedSceneFlags* savedSceneFlags; s32 i; - savedSceneFlags = &gSaveContext.sceneFlags[globalCtx->sceneNum]; + savedSceneFlags = &gSaveContext.sceneFlags[play->sceneNum]; bzero(actorCtx, sizeof(*actorCtx)); ActorOverlayTable_Init(); - Matrix_MtxFCopy(&globalCtx->billboardMtxF, &gMtxFClear); - Matrix_MtxFCopy(&globalCtx->viewProjectionMtxF, &gMtxFClear); + Matrix_MtxFCopy(&play->billboardMtxF, &gMtxFClear); + Matrix_MtxFCopy(&play->viewProjectionMtxF, &gMtxFClear); overlayEntry = &gActorOverlayTable[0]; for (i = 0; i < ARRAY_COUNT(gActorOverlayTable); i++) { @@ -1982,13 +1980,13 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorCtx->flags.clear = savedSceneFlags->clear; actorCtx->flags.collect = savedSceneFlags->collect; - TitleCard_Init(globalCtx, &actorCtx->titleCtx); + TitleCard_Init(play, &actorCtx->titleCtx); actorCtx->absoluteSpace = NULL; - Actor_SpawnEntry(actorCtx, actorEntry, globalCtx); - func_8002C0C0(&actorCtx->targetCtx, actorCtx->actorLists[ACTORCAT_PLAYER].head, globalCtx); - func_8002FA60(globalCtx); + Actor_SpawnEntry(actorCtx, actorEntry, play); + func_8002C0C0(&actorCtx->targetCtx, actorCtx->actorLists[ACTORCAT_PLAYER].head, play); + func_8002FA60(play); } u32 D_80116068[ACTORCAT_MAX] = { @@ -2006,7 +2004,7 @@ u32 D_80116068[ACTORCAT_MAX] = { PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28, }; -void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { +void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { Actor* refActor; Actor* actor; Player* player; @@ -2017,7 +2015,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { ActorEntry* actorEntry; s32 i; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (0) { // This ASSERT is optimized out but it exists due to its presence in rodata @@ -2027,12 +2025,12 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { sp74 = NULL; unkFlag = 0; - if (globalCtx->numSetupActors != 0) { - actorEntry = &globalCtx->setupActorList[0]; - for (i = 0; i < globalCtx->numSetupActors; i++) { - Actor_SpawnEntry(&globalCtx->actorCtx, actorEntry++, globalCtx); + if (play->numSetupActors != 0) { + actorEntry = &play->setupActorList[0]; + for (i = 0; i < play->numSetupActors; i++) { + Actor_SpawnEntry(&play->actorCtx, actorEntry++, play); } - globalCtx->numSetupActors = 0; + play->numSetupActors = 0; } if (actorCtx->unk_02 != 0) { @@ -2040,10 +2038,10 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } if (KREG(0) == -100) { - refActor = &GET_PLAYER(globalCtx)->actor; + refActor = &GET_PLAYER(play)->actor; KREG(0) = 0; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, refActor->world.pos.x, - refActor->world.pos.y + 100.0f, refActor->world.pos.z, 0, 0, 0, 1); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, refActor->world.pos.x, refActor->world.pos.y + 100.0f, + refActor->world.pos.z, 0, 0, 0, 1); } sp80 = &D_80116068[0]; @@ -2068,13 +2066,13 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { actor->sfx = 0; if (actor->init != NULL) { - if (Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { - Actor_SetObjectDependency(globalCtx, actor); - actor->init(actor, globalCtx); + if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { + Actor_SetObjectDependency(play, actor); + actor->init(actor, play); actor->init = NULL; } actor = actor->next; - } else if (!Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { + } else if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { Actor_Kill(actor); actor = actor->next; } else if ((unkFlag && !(actor->flags & unkFlag)) || @@ -2084,9 +2082,9 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { actor = actor->next; } else if (actor->update == NULL) { if (!actor->isDrawn) { - actor = Actor_Delete(&globalCtx->actorCtx, actor, globalCtx); + actor = Actor_Delete(&play->actorCtx, actor, play); } else { - Actor_Destroy(actor, globalCtx); + Actor_Destroy(actor, play); actor = actor->next; } } else { @@ -2109,12 +2107,12 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { actor->targetPriority = 0; } - Actor_SetObjectDependency(globalCtx, actor); + Actor_SetObjectDependency(play, actor); if (actor->colorFilterTimer != 0) { actor->colorFilterTimer--; } - actor->update(actor, globalCtx); - func_8003F8EC(globalCtx, &globalCtx->colCtx.dyna, actor); + actor->update(actor, play); + func_8003F8EC(play, &play->colCtx.dyna, actor); } CollisionCheck_ResetDamage(&actor->colChkInfo); @@ -2124,7 +2122,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } if (i == ACTORCAT_BG) { - DynaPoly_Setup(globalCtx, &globalCtx->colCtx.dyna); + DynaPoly_Setup(play, &play->colCtx.dyna); } } @@ -2143,9 +2141,9 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } } - func_8002C7BC(&actorCtx->targetCtx, player, actor, globalCtx); - TitleCard_Update(globalCtx, &actorCtx->titleCtx); - DynaPoly_UpdateBgActorTransforms(globalCtx, &globalCtx->colCtx.dyna); + func_8002C7BC(&actorCtx->targetCtx, player, actor, play); + TitleCard_Update(play, &actorCtx->titleCtx); + DynaPoly_UpdateBgActorTransforms(play, &play->colCtx.dyna); } void Actor_FaultPrint(Actor* actor, char* command) { @@ -2170,34 +2168,34 @@ void Actor_FaultPrint(Actor* actor, char* command) { FaultDrawer_Printf("ACTOR NAME %08x:%s", actor, name); } -void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { +void Actor_Draw(PlayState* play, Actor* actor) { FaultClient faultClient; Lights* lights; Fault_AddClient(&faultClient, Actor_FaultPrint, actor, "Actor_draw"); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6035); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 6035); - lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx); + lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); - Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos); - Lights_Draw(lights, globalCtx->state.gfxCtx); + Lights_BindAll(lights, play->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos); + Lights_Draw(lights, play->state.gfxCtx); if (actor->flags & ACTOR_FLAG_12) { Matrix_SetTranslateRotateYXZ( - actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x, - actor->world.pos.y + (f32)((actor->shape.yOffset * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y), - actor->world.pos.z + globalCtx->mainCamera.skyboxOffset.z, &actor->shape.rot); + actor->world.pos.x + play->mainCamera.skyboxOffset.x, + actor->world.pos.y + (f32)((actor->shape.yOffset * actor->scale.y) + play->mainCamera.skyboxOffset.y), + actor->world.pos.z + play->mainCamera.skyboxOffset.z, &actor->shape.rot); } else { Matrix_SetTranslateRotateYXZ(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y), actor->world.pos.z, &actor->shape.rot); } Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY); - Actor_SetObjectDependency(globalCtx, actor); + Actor_SetObjectDependency(play, actor); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); - gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment); if (actor->colorFilterTimer != 0) { Color_RGBA8 color = { 0, 0, 0, 255 }; @@ -2211,27 +2209,27 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { } if (actor->colorFilterParams & 0x2000) { - func_80026860(globalCtx, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); + func_80026860(play, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); } else { - func_80026400(globalCtx, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); + func_80026400(play, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); } } - actor->draw(actor, globalCtx); + actor->draw(actor, play); if (actor->colorFilterTimer != 0) { if (actor->colorFilterParams & 0x2000) { - func_80026A6C(globalCtx); + func_80026A6C(play); } else { - func_80026608(globalCtx); + func_80026608(play); } } if (actor->shape.shadowDraw != NULL) { - actor->shape.shadowDraw(actor, lights, globalCtx); + actor->shape.shadowDraw(actor, lights, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6119); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 6119); Fault_RemoveClient(&faultClient); } @@ -2276,12 +2274,12 @@ void Actor_DrawLensOverlay(GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../z_actor.c", 6183); } -void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** invisibleActors) { +void Actor_DrawLensActors(PlayState* play, s32 numInvisibleActors, Actor** invisibleActors) { Actor** invisibleActor; GraphicsContext* gfxCtx; s32 i; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_actor.c", 6197); @@ -2289,7 +2287,7 @@ void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Acto gDPPipeSync(POLY_XLU_DISP++); - if (globalCtx->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) { + if (play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) { // Update both the color frame buffer and the z-buffer gDPSetOtherMode(POLY_XLU_DISP++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | @@ -2332,13 +2330,13 @@ void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Acto for (i = 0; i < numInvisibleActors; i++) { // "Magic lens invisible Actor display" gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示", i); - Actor_Draw(globalCtx, *(invisibleActor++)); + Actor_Draw(play, *(invisibleActor++)); } // "Magic lens invisible Actor display END" gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 END", numInvisibleActors); - if (globalCtx->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { + if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { // Draw the lens overlay to the color frame buffer gDPNoOpString(POLY_OPA_DISP++, "青い眼鏡(外側)", 0); // "Blue spectacles (exterior)" @@ -2362,11 +2360,11 @@ void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Acto CLOSE_DISPS(gfxCtx, "../z_actor.c", 6284); } -s32 func_800314B0(GlobalContext* globalCtx, Actor* actor) { - return func_800314D4(globalCtx, actor, &actor->projectedPos, actor->projectedW); +s32 func_800314B0(PlayState* play, Actor* actor) { + return func_800314D4(play, actor, &actor->projectedPos, actor->projectedW); } -s32 func_800314D4(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3) { +s32 func_800314D4(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3) { f32 var; if ((arg2->z > -actor->uncullZoneScale) && (arg2->z < (actor->uncullZoneForward + actor->uncullZoneScale))) { @@ -2382,7 +2380,7 @@ s32 func_800314D4(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3) return false; } -void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { +void func_800315AC(PlayState* play, ActorContext* actorCtx) { s32 invisibleActorCounter; Actor* invisibleActors[INVISIBLE_ACTOR_MAX]; ActorListEntry* actorListEntry; @@ -2391,7 +2389,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { invisibleActorCounter = 0; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6336); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 6336); actorListEntry = &actorCtx->actorLists[0]; @@ -2408,7 +2406,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { HREG(66) = i; if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos, &actor->projectedW); } @@ -2419,7 +2417,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { } if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) { - if (func_800314B0(globalCtx, actor)) { + if (func_800314B0(play, actor)) { actor->flags |= ACTOR_FLAG_6; } else { actor->flags &= ~ACTOR_FLAG_6; @@ -2431,15 +2429,15 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) { if ((actor->flags & ACTOR_FLAG_7) && - ((globalCtx->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) || - globalCtx->actorCtx.lensActive || (actor->room != globalCtx->roomCtx.curRoom.num))) { + ((play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) || play->actorCtx.lensActive || + (actor->room != play->roomCtx.curRoom.num))) { ASSERT(invisibleActorCounter < INVISIBLE_ACTOR_MAX, "invisible_actor_counter < INVISIBLE_ACTOR_MAX", "../z_actor.c", 6464); invisibleActors[invisibleActorCounter] = actor; invisibleActorCounter++; } else { if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(72) == 0)) { - Actor_Draw(globalCtx, actor); + Actor_Draw(play, actor); actor->isDrawn = true; } } @@ -2451,47 +2449,47 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { } if ((HREG(64) != 1) || (HREG(73) != 0)) { - Effect_DrawAll(globalCtx->state.gfxCtx); + Effect_DrawAll(play->state.gfxCtx); } if ((HREG(64) != 1) || (HREG(74) != 0)) { - EffectSs_DrawAll(globalCtx); + EffectSs_DrawAll(play); } if ((HREG(64) != 1) || (HREG(72) != 0)) { - if (globalCtx->actorCtx.lensActive) { - Actor_DrawLensActors(globalCtx, invisibleActorCounter, invisibleActors); - if ((globalCtx->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(globalCtx)) { - Actor_DisableLens(globalCtx); + if (play->actorCtx.lensActive) { + Actor_DrawLensActors(play, invisibleActorCounter, invisibleActors); + if ((play->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(play)) { + Actor_DisableLens(play); } } } - Actor_DrawFaroresWindPointer(globalCtx); + Actor_DrawFaroresWindPointer(play); if (IREG(32) == 0) { - Lights_DrawGlow(globalCtx); + Lights_DrawGlow(play); } if ((HREG(64) != 1) || (HREG(75) != 0)) { - TitleCard_Draw(globalCtx, &actorCtx->titleCtx); + TitleCard_Draw(play, &actorCtx->titleCtx); } if ((HREG(64) != 1) || (HREG(76) != 0)) { - CollisionCheck_DrawCollision(globalCtx, &globalCtx->colChkCtx); + CollisionCheck_DrawCollision(play, &play->colChkCtx); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6563); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 6563); } -void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx) { +void func_80031A28(PlayState* play, ActorContext* actorCtx) { Actor* actor; s32 i; for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { actor = actorCtx->actorLists[i].head; while (actor != NULL) { - if (!Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { + if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { Actor_Kill(actor); } actor = actor->next; @@ -2501,7 +2499,7 @@ void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx) { u8 sEnemyActorCategories[] = { ACTORCAT_ENEMY, ACTORCAT_BOSS }; -void Actor_FreezeAllEnemies(GlobalContext* globalCtx, ActorContext* actorCtx, s32 duration) { +void Actor_FreezeAllEnemies(PlayState* play, ActorContext* actorCtx, s32 duration) { Actor* actor; s32 i; @@ -2514,20 +2512,20 @@ void Actor_FreezeAllEnemies(GlobalContext* globalCtx, ActorContext* actorCtx, s3 } } -void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx) { +void func_80031B14(PlayState* play, ActorContext* actorCtx) { Actor* actor; s32 i; for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { actor = actorCtx->actorLists[i].head; while (actor != NULL) { - if ((actor->room >= 0) && (actor->room != globalCtx->roomCtx.curRoom.num) && - (actor->room != globalCtx->roomCtx.prevRoom.num)) { + if ((actor->room >= 0) && (actor->room != play->roomCtx.curRoom.num) && + (actor->room != play->roomCtx.prevRoom.num)) { if (!actor->isDrawn) { - actor = Actor_Delete(actorCtx, actor, globalCtx); + actor = Actor_Delete(actorCtx, actor, play); } else { Actor_Kill(actor); - Actor_Destroy(actor, globalCtx); + Actor_Destroy(actor, play); actor = actor->next; } } else { @@ -2536,21 +2534,21 @@ void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx) { } } - CollisionCheck_ClearContext(globalCtx, &globalCtx->colChkCtx); + CollisionCheck_ClearContext(play, &play->colChkCtx); actorCtx->flags.tempClear = 0; actorCtx->flags.tempSwch &= 0xFFFFFF; - globalCtx->msgCtx.unk_E3F4 = 0; + play->msgCtx.unk_E3F4 = 0; } // Actor_CleanupContext -void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx) { +void func_80031C3C(ActorContext* actorCtx, PlayState* play) { Actor* actor; s32 i; for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { actor = actorCtx->actorLists[i].head; while (actor != NULL) { - Actor_Delete(actorCtx, actor, globalCtx); + Actor_Delete(actorCtx, actor, play); actor = actorCtx->actorLists[i].head; } } @@ -2564,8 +2562,8 @@ void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx) { actorCtx->absoluteSpace = NULL; } - Play_SaveSceneFlags(globalCtx); - func_80030488(globalCtx); + Play_SaveSceneFlags(play); + func_80030488(play); ActorOverlayTable_Cleanup(); } @@ -2594,7 +2592,7 @@ void Actor_AddToCategory(ActorContext* actorCtx, Actor* actorToAdd, u8 actorCate * Removes a given actor instance from its actor list. * Also sets the temp clear flag of the current room if the actor removed was the last enemy loaded. */ -Actor* Actor_RemoveFromCategory(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actorToRemove) { +Actor* Actor_RemoveFromCategory(PlayState* play, ActorContext* actorCtx, Actor* actorToRemove) { Actor* newHead; actorCtx->total--; @@ -2615,9 +2613,9 @@ Actor* Actor_RemoveFromCategory(GlobalContext* globalCtx, ActorContext* actorCtx actorToRemove->next = NULL; actorToRemove->prev = NULL; - if ((actorToRemove->room == globalCtx->roomCtx.curRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) && + if ((actorToRemove->room == play->roomCtx.curRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) && (actorCtx->actorLists[ACTORCAT_ENEMY].length == 0)) { - Flags_SetTempClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetTempClear(play, play->roomCtx.curRoom.num); } return newHead; @@ -2658,8 +2656,8 @@ void Actor_FreeOverlay(ActorOverlay* actorOverlay) { osSyncPrintf(VT_RST); } -Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId, f32 posX, f32 posY, f32 posZ, - s16 rotX, s16 rotY, s16 rotZ, s16 params) { +Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, + s16 rotY, s16 rotZ, s16 params) { s32 pad; Actor* actor; ActorInit* actorInit; @@ -2742,10 +2740,10 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId : NULL); } - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, actorInit->objectId); + objBankIndex = Object_GetIndex(&play->objectCtx, actorInit->objectId); if ((objBankIndex < 0) || - ((actorInit->category == ACTORCAT_ENEMY) && Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num))) { + ((actorInit->category == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num))) { // "No data bank!! (profilep->bank=%d)" osSyncPrintf(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST, objBankIndex, actorInit->objectId); @@ -2788,7 +2786,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId actor->destroy = actorInit->destroy; actor->update = actorInit->update; actor->draw = actorInit->draw; - actor->room = globalCtx->roomCtx.curRoom.num; + actor->room = play->roomCtx.curRoom.num; actor->home.pos.x = posX; actor->home.pos.y = posY; actor->home.pos.z = posZ; @@ -2800,15 +2798,15 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId Actor_AddToCategory(actorCtx, actor, actorInit->category); temp = gSegments[6]; - Actor_Init(actor, globalCtx); + Actor_Init(actor, play); gSegments[6] = temp; return actor; } -Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, GlobalContext* globalCtx, s16 actorId, f32 posX, - f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params) { - Actor* spawnedActor = Actor_Spawn(actorCtx, globalCtx, actorId, posX, posY, posZ, rotX, rotY, rotZ, params); +Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play, s16 actorId, f32 posX, f32 posY, + f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params) { + Actor* spawnedActor = Actor_Spawn(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params); if (spawnedActor == NULL) { return NULL; @@ -2824,46 +2822,46 @@ Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, GlobalContext* return spawnedActor; } -void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCtx) { +void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) { TransitionActorEntry* transitionActor; u8 numActors; s32 i; - transitionActor = globalCtx->transiActorCtx.list; - numActors = globalCtx->transiActorCtx.numActors; + transitionActor = play->transiActorCtx.list; + numActors = play->transiActorCtx.numActors; for (i = 0; i < numActors; i++) { if (transitionActor->id >= 0) { if (((transitionActor->sides[0].room >= 0) && - ((transitionActor->sides[0].room == globalCtx->roomCtx.curRoom.num) || - (transitionActor->sides[0].room == globalCtx->roomCtx.prevRoom.num))) || + ((transitionActor->sides[0].room == play->roomCtx.curRoom.num) || + (transitionActor->sides[0].room == play->roomCtx.prevRoom.num))) || ((transitionActor->sides[1].room >= 0) && - ((transitionActor->sides[1].room == globalCtx->roomCtx.curRoom.num) || - (transitionActor->sides[1].room == globalCtx->roomCtx.prevRoom.num)))) { - Actor_Spawn(actorCtx, globalCtx, (s16)(transitionActor->id & 0x1FFF), transitionActor->pos.x, + ((transitionActor->sides[1].room == play->roomCtx.curRoom.num) || + (transitionActor->sides[1].room == play->roomCtx.prevRoom.num)))) { + Actor_Spawn(actorCtx, play, (s16)(transitionActor->id & 0x1FFF), transitionActor->pos.x, transitionActor->pos.y, transitionActor->pos.z, 0, transitionActor->rotY, 0, (i << 0xA) + transitionActor->params); transitionActor->id = -transitionActor->id; - numActors = globalCtx->transiActorCtx.numActors; + numActors = play->transiActorCtx.numActors; } } transitionActor++; } } -Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, GlobalContext* globalCtx) { - return Actor_Spawn(actorCtx, globalCtx, actorEntry->id, actorEntry->pos.x, actorEntry->pos.y, actorEntry->pos.z, +Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayState* play) { + return Actor_Spawn(actorCtx, play, actorEntry->id, actorEntry->pos.x, actorEntry->pos.y, actorEntry->pos.z, actorEntry->rot.x, actorEntry->rot.y, actorEntry->rot.z, actorEntry->params); } -Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalCtx) { +Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { char* name; Player* player; Actor* newHead; ActorOverlay* overlayEntry; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); overlayEntry = actor->overlayEntry; name = overlayEntry->name != NULL ? overlayEntry->name : ""; @@ -2874,7 +2872,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC if ((player != NULL) && (actor == player->unk_664)) { func_8008EDF0(player); - Camera_ChangeMode(Play_GetCamera(globalCtx, Play_GetActiveCamId(globalCtx)), 0); + Camera_ChangeMode(Play_GetCamera(play, Play_GetActiveCamId(play)), 0); } if (actor == actorCtx->targetCtx.arrowPointedActor) { @@ -2890,9 +2888,9 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC } Audio_StopSfxByPos(&actor->projectedPos); - Actor_Destroy(actor, globalCtx); + Actor_Destroy(actor, play); - newHead = Actor_RemoveFromCategory(globalCtx, actorCtx, actor); + newHead = Actor_RemoveFromCategory(play, actorCtx, actor); ZeldaArena_FreeDebug(actor, "../z_actor.c", 7242); @@ -2910,11 +2908,11 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC return newHead; } -s32 func_80032880(GlobalContext* globalCtx, Actor* actor) { +s32 func_80032880(PlayState* play, Actor* actor) { s16 sp1E; s16 sp1C; - Actor_GetScreenPos(globalCtx, actor, &sp1E, &sp1C); + Actor_GetScreenPos(play, actor, &sp1E, &sp1C); return (sp1E > -20) && (sp1E < 340) && (sp1C > -160) && (sp1C < 400); } @@ -2926,7 +2924,7 @@ f32 sbgmEnemyDistSq; s32 D_8015BBF8; s16 D_8015BBFC; -void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* player, u32 actorCategory) { +void func_800328D4(PlayState* play, ActorContext* actorCtx, Player* player, u32 actorCategory) { f32 var; Actor* actor; Actor* sp84; @@ -2950,10 +2948,10 @@ void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* pla if (actor != sp84) { var = func_8002EFC0(actor, player, D_8015BBFC); - if ((var < D_8015BBF0) && func_8002F090(actor, var) && func_80032880(globalCtx, actor) && - (!BgCheck_CameraLineTest1(&globalCtx->colCtx, &player->actor.focus.pos, &actor->focus.pos, &sp70, - &sp80, 1, 1, 1, 1, &sp7C) || - SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, sp80, sp7C))) { + if ((var < D_8015BBF0) && func_8002F090(actor, var) && func_80032880(play, actor) && + (!BgCheck_CameraLineTest1(&play->colCtx, &player->actor.focus.pos, &actor->focus.pos, &sp70, &sp80, + 1, 1, 1, 1, &sp7C) || + SurfaceType_IsIgnoredByProjectiles(&play->colCtx, sp80, sp7C))) { if (actor->targetPriority != 0) { if (actor->targetPriority < D_8015BBF8) { D_8015BBEC = actor; @@ -2976,7 +2974,7 @@ u8 D_801160A0[] = { ACTORCAT_CHEST, ACTORCAT_SWITCH, ACTORCAT_PROP, ACTORCAT_MISC, ACTORCAT_DOOR, ACTORCAT_SWITCH, }; -Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** actorPtr, Player* player) { +Actor* func_80032AF0(PlayState* play, ActorContext* actorCtx, Actor** actorPtr, Player* player) { s32 i; u8* entry; @@ -2984,20 +2982,20 @@ Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** a D_8015BBF0 = sbgmEnemyDistSq = FLT_MAX; D_8015BBF8 = 0x7FFFFFFF; - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { entry = &D_801160A0[0]; actorCtx->targetCtx.bgmEnemy = NULL; D_8015BBFC = player->actor.shape.rot.y; for (i = 0; i < 3; i++) { - func_800328D4(globalCtx, actorCtx, player, *entry); + func_800328D4(play, actorCtx, player, *entry); entry++; } if (D_8015BBE8 == NULL) { for (; i < ARRAY_COUNT(D_801160A0); i++) { - func_800328D4(globalCtx, actorCtx, player, *entry); + func_800328D4(play, actorCtx, player, *entry); entry++; } } @@ -3032,9 +3030,9 @@ Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory) { * Play the death sound effect and flash the screen white for 4 frames. * While the screen flashes, the game freezes. */ -void Enemy_StartFinishingBlow(GlobalContext* globalCtx, Actor* actor) { - globalCtx->actorCtx.freezeFlashTimer = 5; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE); +void Enemy_StartFinishingBlow(PlayState* play, Actor* actor) { + play->actorCtx.freezeFlashTimer = 5; + SoundSource_PlaySfxAtFixedWorldPos(play, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE); } s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3) { @@ -3066,7 +3064,7 @@ s16 func_80032D60(s16* arg0, s16 arg1, s16 arg2, s16 arg3) { return arg0[0]; } -void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, GlobalContext* globalCtx) { +void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) { u32 matricesSize; u32 dListsSize; u32 objectIdsSize; @@ -3107,9 +3105,9 @@ void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, GlobalContext* globalCtx) void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList, s16 objectId) { - GlobalContext* globalCtx = Effect_GetGlobalCtx(); + PlayState* play = Effect_GetPlayState(); - if ((globalCtx->actorCtx.freezeFlashTimer == 0) && (bodyBreak->val > 0)) { + if ((play->actorCtx.freezeFlashTimer == 0) && (bodyBreak->val > 0)) { if ((limbIndex >= minLimbIndex) && (limbIndex <= maxLimbIndex) && (*dList != NULL)) { bodyBreak->dLists[bodyBreak->val] = *dList; Matrix_Get(&bodyBreak->matrices[bodyBreak->val]); @@ -3130,7 +3128,7 @@ void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s3 bodyBreak->prevLimbIndex = limbIndex; } -s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* globalCtx, s16 type) { +s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s16 type) { EnPart* spawnedEnPart; MtxF* mtx; s16 objBankIndex; @@ -3154,8 +3152,8 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* glob mtx = &bodyBreak->matrices[bodyBreak->count]; - spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, mtx->xw, - mtx->yw, mtx->zw, 0, 0, objBankIndex, type); + spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, mtx->xw, mtx->yw, + mtx->zw, 0, 0, objBankIndex, type); if (spawnedEnPart != NULL) { Matrix_MtxFToYXZRotS(&bodyBreak->matrices[bodyBreak->count], &spawnedEnPart->actor.shape.rot, 0); @@ -3175,7 +3173,7 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* glob return true; } -void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne, +void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne, f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting) { Vec3f pos; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -3194,12 +3192,12 @@ void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* pos accel.z = (Rand_ZeroOne() - 0.5f) * randAccelWeight; if (scale == 0) { - func_8002857C(globalCtx, &pos, &velocity, &accel); + func_8002857C(play, &pos, &velocity, &accel); } else { if (useLighting) { - func_800286CC(globalCtx, &pos, &velocity, &accel, scale, scaleStep); + func_800286CC(play, &pos, &velocity, &accel, scale, scaleStep); } else { - func_8002865C(globalCtx, &pos, &velocity, &accel, scale, scaleStep); + func_8002865C(play, &pos, &velocity, &accel, scale, scaleStep); } } @@ -3207,7 +3205,7 @@ void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* pos } } -void func_80033480(GlobalContext* globalCtx, Vec3f* posBase, f32 randRangeDiameter, s32 amountMinusOne, s16 scaleBase, +void func_80033480(PlayState* play, Vec3f* posBase, f32 randRangeDiameter, s32 amountMinusOne, s16 scaleBase, s16 scaleStep, u8 arg6) { Vec3f pos; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -3225,14 +3223,14 @@ void func_80033480(GlobalContext* globalCtx, Vec3f* posBase, f32 randRangeDiamet var2 = arg6; if (var2 != 0) { - func_800286CC(globalCtx, &pos, &velocity, &accel, scale, scaleStep); + func_800286CC(play, &pos, &velocity, &accel, scale, scaleStep); } else { - func_8002865C(globalCtx, &pos, &velocity, &accel, scale, scaleStep); + func_8002865C(play, &pos, &velocity, &accel, scale, scaleStep); } } } -Actor* Actor_GetCollidedExplosive(GlobalContext* globalCtx, Collider* collider) { +Actor* Actor_GetCollidedExplosive(PlayState* play, Collider* collider) { if ((collider->acFlags & AC_HIT) && (collider->ac->category == ACTORCAT_EXPLOSIVE)) { collider->acFlags &= ~AC_HIT; return collider->ac; @@ -3241,8 +3239,8 @@ Actor* Actor_GetCollidedExplosive(GlobalContext* globalCtx, Collider* collider) return NULL; } -Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; +Actor* func_80033684(PlayState* play, Actor* explosiveActor) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (actor != NULL) { if ((actor == explosiveActor) || (actor->params != 1)) { @@ -3263,8 +3261,8 @@ Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor) { * Dynamically changes the category of a given actor instance. * This is done by moving it to the corresponding category list and setting its category variable accordingly. */ -void Actor_ChangeCategory(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actor, u8 actorCategory) { - Actor_RemoveFromCategory(globalCtx, actorCtx, actor); +void Actor_ChangeCategory(PlayState* play, ActorContext* actorCtx, Actor* actor, u8 actorCategory) { + Actor_RemoveFromCategory(play, actorCtx, actor); Actor_AddToCategory(actorCtx, actor, actorCategory); } @@ -3275,7 +3273,7 @@ void Actor_ChangeCategory(GlobalContext* globalCtx, ActorContext* actorCtx, Acto * * Returns the actor if there will be collision, NULL otherwise. */ -Actor* Actor_GetProjectileActor(GlobalContext* globalCtx, Actor* refActor, f32 radius) { +Actor* Actor_GetProjectileActor(PlayState* play, Actor* refActor, f32 radius) { Actor* actor; Vec3f spA8; f32 deltaX; @@ -3284,7 +3282,7 @@ Actor* Actor_GetProjectileActor(GlobalContext* globalCtx, Actor* refActor, f32 r Vec3f sp90; Vec3f sp84; - actor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (actor != NULL) { if (((actor->id != ACTOR_ARMS_HOOK) && (actor->id != ACTOR_EN_ARROW)) || (actor == refActor)) { actor = actor->next; @@ -3322,10 +3320,10 @@ Actor* Actor_GetProjectileActor(GlobalContext* globalCtx, Actor* refActor, f32 r /** * Sets the actor's text id with a dynamic prefix based on the current scene. */ -void Actor_SetTextWithPrefix(GlobalContext* globalCtx, Actor* actor, s16 baseTextId) { +void Actor_SetTextWithPrefix(PlayState* play, Actor* actor, s16 baseTextId) { s16 prefix; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_YDAN_BOSS: case SCENE_MORIBOSSROOM: @@ -3405,7 +3403,7 @@ void Actor_SetTextWithPrefix(GlobalContext* globalCtx, Actor* actor, s16 baseTex * * Returns true if the actor will be standing on ground. */ -s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 distance, s16 angle) { +s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 angle) { s16 ret; s16 prevBgCheckFlags; f32 dx; @@ -3420,7 +3418,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 dista actor->world.pos.x += dx; actor->world.pos.z += dz; - Actor_UpdateBgCheckInfo(globalCtx, actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); Math_Vec3f_Copy(&actor->world.pos, &prevActorPos); @@ -3433,8 +3431,8 @@ s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 dista /** * Returns true if the player is targeting the provided actor */ -s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor) { - Player* player = GET_PLAYER(globalCtx); +s32 Actor_IsTargeted(PlayState* play, Actor* actor) { + Player* player = GET_PLAYER(play); if ((player->stateFlags1 & PLAYER_STATE1_4) && actor->isTargeted) { return true; @@ -3446,8 +3444,8 @@ s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor) { /** * Returns true if the player is targeting an actor other than the provided actor */ -s32 Actor_OtherIsTargeted(GlobalContext* globalCtx, Actor* actor) { - Player* player = GET_PLAYER(globalCtx); +s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor) { + Player* player = GET_PLAYER(play); if ((player->stateFlags1 & PLAYER_STATE1_4) && !actor->isTargeted) { return true; @@ -3472,13 +3470,13 @@ f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 ar return ret; } -void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) { +void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) { MtxF sp60; f32 var; Vec3f sp50; CollisionPoly* sp4C; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8120); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 8120); if (0) {} // Necessary to match @@ -3490,7 +3488,7 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) sp50.y = arg0->y + 1.0f; sp50.z = arg0->z; - var = BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &sp4C, &sp50); + var = BgCheck_EntityRaycastFloor2(play, &play->colCtx, &sp4C, &sp50); if (sp4C != NULL) { func_80038A28(sp4C, arg0->x, var, arg0->z, &sp60); @@ -3501,37 +3499,36 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) Matrix_Scale(arg1->x, 1.0f, arg1->z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8149), - G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 8149), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gCircleShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8155); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8155); } -void func_80033DB8(GlobalContext* globalCtx, s16 arg1, s16 arg2) { - s16 var = Quake_Add(&globalCtx->mainCamera, 3); +void func_80033DB8(PlayState* play, s16 arg1, s16 arg2) { + s16 var = Quake_Add(&play->mainCamera, 3); Quake_SetSpeed(var, 20000); Quake_SetQuakeValues(var, arg1, 0, 0, 0); Quake_SetCountdown(var, arg2); } -void func_80033E1C(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3) { - s16 var = Quake_Add(&globalCtx->mainCamera, 3); +void func_80033E1C(PlayState* play, s16 arg1, s16 arg2, s16 arg3) { + s16 var = Quake_Add(&play->mainCamera, 3); Quake_SetSpeed(var, arg3); Quake_SetQuakeValues(var, arg1, 0, 0, 0); Quake_SetCountdown(var, arg2); } -void func_80033E88(Actor* actor, GlobalContext* globalCtx, s16 arg2, s16 arg3) { +void func_80033E88(Actor* actor, PlayState* play, s16 arg2, s16 arg3) { if (arg2 >= 5) { func_800AA000(actor->xyzDistToPlayerSq, 0xFF, 0x14, 0x96); } else { func_800AA000(actor->xyzDistToPlayerSq, 0xB4, 0x14, 0x64); } - func_80033DB8(globalCtx, arg2, arg3); + func_80033DB8(play, arg2, arg3); } f32 Rand_ZeroFloat(f32 f) { @@ -3562,7 +3559,7 @@ static DoorLockInfo sDoorLocksInfo[] = { * Draws chains and lock of a locked door, of the specified `type` (see `DoorLockType`). * `frame` can be 0 to 10, where 0 is "open" and 10 is "closed", the chains slide accordingly. */ -void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { +void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type) { DoorLockInfo* entry; s32 i; MtxF baseMtxF; @@ -3574,7 +3571,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { entry = &sDoorLocksInfo[type]; chainRotZ = entry->chainsRotZInit; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8265); + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 8265); Matrix_Translate(0.0f, entry->yShift, 500.0f, MTXMODE_APPLY); Matrix_Get(&baseMtxF); @@ -3591,7 +3588,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { Matrix_Scale(entry->chainsScale, entry->chainsScale, entry->chainsScale, MTXMODE_APPLY); } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8299), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 8299), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, entry->chainDL); @@ -3607,15 +3604,14 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { Matrix_Put(&baseMtxF); Matrix_Scale(frame * 0.1f, frame * 0.1f, frame * 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8314), - G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 8314), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, entry->lockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8319); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8319); } -void func_8003424C(GlobalContext* globalCtx, Vec3f* arg1) { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, arg1); +void func_8003424C(PlayState* play, Vec3f* arg1) { + CollisionCheck_SpawnShieldParticlesMetal(play, arg1); } void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 xluFlag, s16 duration) { @@ -3627,52 +3623,52 @@ void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s1 actor->colorFilterTimer = duration; } -Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx) { +Hilite* func_800342EC(Vec3f* object, PlayState* play) { Vec3f lightDir; - lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x; - lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y; - lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z; + lightDir.x = play->envCtx.dirLight1.params.dir.x; + lightDir.y = play->envCtx.dirLight1.params.dir.y; + lightDir.z = play->envCtx.dirLight1.params.dir.z; - return func_8002EABC(object, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + return func_8002EABC(object, &play->view.eye, &lightDir, play->state.gfxCtx); } -Hilite* func_8003435C(Vec3f* object, GlobalContext* globalCtx) { +Hilite* func_8003435C(Vec3f* object, PlayState* play) { Vec3f lightDir; - lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x; - lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y; - lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z; + lightDir.x = play->envCtx.dirLight1.params.dir.x; + lightDir.y = play->envCtx.dirLight1.params.dir.y; + lightDir.z = play->envCtx.dirLight1.params.dir.z; - return func_8002EB44(object, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + return func_8002EB44(object, &play->view.eye, &lightDir, play->state.gfxCtx); } -s32 func_800343CC(GlobalContext* globalCtx, Actor* actor, s16* arg2, f32 interactRange, callback1_800343CC unkFunc1, +s32 func_800343CC(PlayState* play, Actor* actor, s16* arg2, f32 interactRange, callback1_800343CC unkFunc1, callback2_800343CC unkFunc2) { s16 x; s16 y; - if (Actor_ProcessTalkRequest(actor, globalCtx)) { + if (Actor_ProcessTalkRequest(actor, play)) { *arg2 = 1; return true; } if (*arg2 != 0) { - *arg2 = unkFunc2(globalCtx, actor); + *arg2 = unkFunc2(play, actor); return false; } - Actor_GetScreenPos(globalCtx, actor, &x, &y); + Actor_GetScreenPos(play, actor, &x, &y); if ((x < 0) || (x > SCREEN_WIDTH) || (y < 0) || (y > SCREEN_HEIGHT)) { return false; } - if (!func_8002F2CC(actor, globalCtx, interactRange)) { + if (!func_8002F2CC(actor, play, interactRange)) { return false; } - actor->textId = unkFunc1(globalCtx, actor); + actor->textId = unkFunc1(play, actor); return false; } @@ -3851,45 +3847,45 @@ Gfx* func_80034B54(GraphicsContext* gfxCtx) { return displayList; } -void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, - PostLimbDraw postLimbDraw, Actor* actor, s16 alpha) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8831); +void func_80034BA0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, + Actor* actor, s16 alpha) { + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 8831); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, alpha); gDPPipeSync(POLY_OPA_DISP++); - gSPSegment(POLY_OPA_DISP++, 0x0C, func_80034B28(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, func_80034B28(play->state.gfxCtx)); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, overrideLimbDraw, postLimbDraw, actor, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8860); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8860); } -void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, - PostLimbDraw postLimbDraw, Actor* actor, s16 alpha) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8876); +void func_80034CC4(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, + Actor* actor, s16 alpha) { + OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 8876); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, alpha); - gSPSegment(POLY_XLU_DISP++, 0x0C, func_80034B54(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x0C, func_80034B54(play->state.gfxCtx)); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, overrideLimbDraw, postLimbDraw, actor, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8904); + CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8904); } -s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) { - Player* player = GET_PLAYER(globalCtx); +s16 func_80034DD4(Actor* actor, PlayState* play, s16 arg2, f32 arg3) { + Player* player = GET_PLAYER(play); f32 var; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) { - var = Math_Vec3f_DistXYZ(&actor->world.pos, &globalCtx->view.eye) * 0.25f; + if ((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) { + var = Math_Vec3f_DistXYZ(&actor->world.pos, &play->view.eye) * 0.25f; } else { var = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos); } @@ -3920,8 +3916,8 @@ void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, frameCount, animationInfo->mode, animationInfo->morphFrames); } -void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3) { - u32 frames = globalCtx->gameplayFrames; +void func_80034F54(PlayState* play, s16* arg1, s16* arg2, s32 arg3) { + u32 frames = play->gameplayFrames; s32 i; for (i = 0; i < arg3; i++) { @@ -3930,15 +3926,15 @@ void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3) { } } -void Actor_Noop(Actor* actor, GlobalContext* globalCtx) { +void Actor_Noop(Actor* actor, PlayState* play) { } -s32 func_80035124(Actor* actor, GlobalContext* globalCtx) { +s32 func_80035124(Actor* actor, PlayState* play) { s32 ret = 0; switch (actor->params) { case 0: - if (Actor_HasParent(actor, globalCtx)) { + if (Actor_HasParent(actor, play)) { actor->params = 1; } else if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { Actor_MoveForward(actor); @@ -3947,18 +3943,18 @@ s32 func_80035124(Actor* actor, GlobalContext* globalCtx) { ret = 1; } else { actor->shape.rot.x = actor->shape.rot.z = 0; - func_8002F580(actor, globalCtx); + func_8002F580(actor, play); } break; case 1: - if (Actor_HasNoParent(actor, globalCtx)) { + if (Actor_HasNoParent(actor, play)) { actor->params = 0; } break; } Actor_UpdateBgCheckInfo( - globalCtx, actor, actor->colChkInfo.cylHeight, actor->colChkInfo.cylRadius, actor->colChkInfo.cylRadius, + play, actor, actor->colChkInfo.cylHeight, actor->colChkInfo.cylRadius, actor->colChkInfo.cylRadius, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); return ret; @@ -3966,8 +3962,8 @@ s32 func_80035124(Actor* actor, GlobalContext* globalCtx) { #include "z_cheap_proc.c" -u8 func_800353E8(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +u8 func_800353E8(PlayState* play) { + Player* player = GET_PLAYER(play); return player->unk_845; } @@ -3977,8 +3973,8 @@ u8 func_800353E8(GlobalContext* globalCtx) { * an actor if there is one. If the ID provided is -1, this will look for any actor of the * specified category rather than a specific ID. */ -Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, u8 actorCategory, f32 range) { - Actor* actor = globalCtx->actorCtx.actorLists[actorCategory].head; +Actor* Actor_FindNearby(PlayState* play, Actor* refActor, s16 actorId, u8 actorCategory, f32 range) { + Actor* actor = play->actorCtx.actorLists[actorCategory].head; while (actor != NULL) { if (actor == refActor || ((actorId != -1) && (actorId != actor->id))) { @@ -3995,8 +3991,8 @@ Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, return NULL; } -s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5) { - Player* player = GET_PLAYER(globalCtx); +s32 func_800354B4(PlayState* play, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5) { + Player* player = GET_PLAYER(play); s16 var1; s16 var2; @@ -4011,7 +4007,7 @@ s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s } } -void func_8003555C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void func_8003555C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { Color_RGBA8 color1; Color_RGBA8 color2; @@ -4024,7 +4020,7 @@ void func_8003555C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* color2.b = 50; //! @bug color1 and color2 alpha components not set before being passed on - EffectSsKiraKira_SpawnSmall(globalCtx, pos, velocity, accel, &color1, &color2); + EffectSsKiraKira_SpawnSmall(play, pos, velocity, accel, &color1, &color2); } Vec3f D_80116268 = { 0.0f, -1.5f, 0.0f }; @@ -4037,12 +4033,12 @@ Gfx D_80116280[] = { gsSPEndDisplayList(), }; -void func_800355B8(GlobalContext* globalCtx, Vec3f* pos) { - func_8003555C(globalCtx, pos, &D_80116268, &D_80116274); +void func_800355B8(PlayState* play, Vec3f* pos) { + func_8003555C(play, pos, &D_80116268, &D_80116274); } -u8 func_800355E4(GlobalContext* globalCtx, Collider* collider) { - Player* player = GET_PLAYER(globalCtx); +u8 func_800355E4(PlayState* play, Collider* collider) { + Player* player = GET_PLAYER(play); if ((collider->acFlags & AC_TYPE_PLAYER) && (player->meleeWeaponState != 0) && (player->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD)) { @@ -4140,13 +4136,12 @@ 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, - GlobalContext* globalCtx, s16 params, s32 arg8) { +Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, s32 timer, s16* unused, PlayState* play, + s16 params, s32 arg8) { EnPart* spawnedEnPart; - spawnedEnPart = - (EnPart*)Actor_SpawnAsChild(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, spawnPos->x, spawnPos->y, - spawnPos->z, spawnRot->x, spawnRot->y, actor->objBankIndex, params); + spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, spawnPos->x, spawnPos->y, + spawnPos->z, spawnRot->x, spawnRot->y, actor->objBankIndex, params); if (spawnedEnPart != NULL) { spawnedEnPart->actor.scale = actor->scale; spawnedEnPart->actor.speedXZ = arg3[0]; @@ -4192,8 +4187,8 @@ void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) { } } -void func_80035B18(GlobalContext* globalCtx, Actor* actor, u16 textId) { - Message_ContinueTextbox(globalCtx, textId); +void func_80035B18(PlayState* play, Actor* actor, u16 textId) { + Message_ContinueTextbox(play, textId); actor->textId = textId; } @@ -4225,7 +4220,7 @@ void Flags_SetInfTable(s32 flag) { SET_INFTABLE(flag); } -u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) { +u32 func_80035BFC(PlayState* play, s16 arg1) { u16 retTextId = 0; switch (arg1) { @@ -4515,7 +4510,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) { } break; case 16: - if (globalCtx->sceneNum == SCENE_SPOT15) { + if (play->sceneNum == SCENE_SPOT15) { retTextId = 0x7002; } else if (Flags_GetInfTable(INFTABLE_6A)) { retTextId = 0x7004; @@ -5224,24 +5219,24 @@ void func_80036E50(u16 textId, s16 arg1) { } } -s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { - MessageContext* msgCtx = &globalCtx->msgCtx; +s32 func_800374E0(PlayState* play, Actor* actor, u16 textId) { + MessageContext* msgCtx = &play->msgCtx; s32 ret = 1; switch (textId) { case 0x1035: if (msgCtx->choiceIndex == 0) { if (Flags_GetInfTable(INFTABLE_2A)) { - func_80035B18(globalCtx, actor, 0x1036); + func_80035B18(play, actor, 0x1036); } else { - func_80035B18(globalCtx, actor, 0x1041); + func_80035B18(play, actor, 0x1041); } } if (msgCtx->choiceIndex == 1) { if (Flags_GetInfTable(INFTABLE_2B)) { - func_80035B18(globalCtx, actor, 0x1037); + func_80035B18(play, actor, 0x1037); } else { - func_80035B18(globalCtx, actor, 0x1041); + func_80035B18(play, actor, 0x1041); } } ret = 0; @@ -5249,58 +5244,58 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { case 0x1038: if (msgCtx->choiceIndex == 0) { if (Flags_GetInfTable(INFTABLE_2E)) { - func_80035B18(globalCtx, actor, 0x1039); + func_80035B18(play, actor, 0x1039); } else { - func_80035B18(globalCtx, actor, 0x1041); + func_80035B18(play, actor, 0x1041); } } if (msgCtx->choiceIndex == 1) { if (Flags_GetInfTable(INFTABLE_2F)) { - func_80035B18(globalCtx, actor, 0x103A); + func_80035B18(play, actor, 0x103A); } else { - func_80035B18(globalCtx, actor, 0x1041); + func_80035B18(play, actor, 0x1041); } } if (msgCtx->choiceIndex == 2) { if (Flags_GetInfTable(INFTABLE_30)) { - func_80035B18(globalCtx, actor, 0x103B); + func_80035B18(play, actor, 0x103B); } else { - func_80035B18(globalCtx, actor, 0x1041); + func_80035B18(play, actor, 0x1041); } } ret = 0; break; case 0x103E: if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x103F); + func_80035B18(play, actor, 0x103F); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x1040); + func_80035B18(play, actor, 0x1040); } ret = 0; break; case 0x1041: if (msgCtx->choiceTextId == 0x1035) { if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x1036); + func_80035B18(play, actor, 0x1036); Flags_SetInfTable(INFTABLE_2A); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x1037); + func_80035B18(play, actor, 0x1037); Flags_SetInfTable(INFTABLE_2B); } } if (msgCtx->choiceTextId == 0x1038) { if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x1039); + func_80035B18(play, actor, 0x1039); Flags_SetInfTable(INFTABLE_2E); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x103A); + func_80035B18(play, actor, 0x103A); Flags_SetInfTable(INFTABLE_2F); } if (msgCtx->choiceIndex == 2) { - func_80035B18(globalCtx, actor, 0x103B); + func_80035B18(play, actor, 0x103B); Flags_SetInfTable(INFTABLE_30); } } @@ -5308,10 +5303,10 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { break; case 0x1062: if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x1063); + func_80035B18(play, actor, 0x1063); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x1064); + func_80035B18(play, actor, 0x1064); } ret = 0; break; @@ -5319,14 +5314,14 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { case 0x2031: if (msgCtx->choiceIndex == 0) { if (gSaveContext.rupees >= 10) { - func_80035B18(globalCtx, actor, 0x2034); + func_80035B18(play, actor, 0x2034); Rupees_ChangeBy(-10); } else { - func_80035B18(globalCtx, actor, 0x2032); + func_80035B18(play, actor, 0x2032); } } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x2032); + func_80035B18(play, actor, 0x2032); } Flags_SetInfTable(INFTABLE_9A); ret = 0; @@ -5334,10 +5329,10 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { case 0x2036: case 0x2037: if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x201F); + func_80035B18(play, actor, 0x201F); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x205A); + func_80035B18(play, actor, 0x205A); } ret = 0; break; @@ -5346,7 +5341,7 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { break; } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x205A); + func_80035B18(play, actor, 0x205A); } ret = 0; break; @@ -5354,14 +5349,14 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { if (msgCtx->choiceIndex != 0) { break; } - func_80035B18(globalCtx, actor, 0x2035); + func_80035B18(play, actor, 0x2035); ret = 0; break; case 0x2043: if (Flags_GetEventChkInf(EVENTCHKINF_12)) { break; } - func_80035B18(globalCtx, actor, 0x2044); + func_80035B18(play, actor, 0x2044); ret = 0; break; case 0x205A: @@ -5369,52 +5364,52 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { case 0x300A: if (msgCtx->choiceIndex == 0) { if (Flags_GetEventChkInf(EVENTCHKINF_22)) { - func_80035B18(globalCtx, actor, 0x300B); + func_80035B18(play, actor, 0x300B); } else { - func_80035B18(globalCtx, actor, 0x300C); + func_80035B18(play, actor, 0x300C); } } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x300D); + func_80035B18(play, actor, 0x300D); } ret = 0; break; case 0x301B: if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x301D); + func_80035B18(play, actor, 0x301D); } if (msgCtx->choiceIndex == 1) { if (Flags_GetInfTable(INFTABLE_113)) { - func_80035B18(globalCtx, actor, 0x301F); + func_80035B18(play, actor, 0x301F); } else { - func_80035B18(globalCtx, actor, 0x301E); + func_80035B18(play, actor, 0x301E); } } ret = 0; break; case 0x301E: - func_80035B18(globalCtx, actor, 0x3020); + func_80035B18(play, actor, 0x3020); ret = 0; break; case 0x400C: if (msgCtx->choiceIndex == 0) { - func_80035B18(globalCtx, actor, 0x400D); + func_80035B18(play, actor, 0x400D); } if (msgCtx->choiceIndex == 1) { - func_80035B18(globalCtx, actor, 0x400E); + func_80035B18(play, actor, 0x400E); } ret = 0; break; case 0x7007: - func_80035B18(globalCtx, actor, 0x703E); + func_80035B18(play, actor, 0x703E); ret = 0; break; case 0x703E: - func_80035B18(globalCtx, actor, 0x703F); + func_80035B18(play, actor, 0x703F); ret = 0; break; case 0x703F: - func_80035B18(globalCtx, actor, 0x7042); + func_80035B18(play, actor, 0x7042); ret = 0; break; } @@ -5422,31 +5417,31 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { return ret; } -u16 func_80037C30(GlobalContext* globalCtx, s16 arg1) { - return func_80035BFC(globalCtx, arg1); +u16 func_80037C30(PlayState* play, s16 arg1) { + return func_80035BFC(play, arg1); } -s32 func_80037C5C(GlobalContext* globalCtx, s16 arg1, u16 textId) { +s32 func_80037C5C(PlayState* play, s16 arg1, u16 textId) { func_80036E50(textId, arg1); return false; } -s32 func_80037C94(GlobalContext* globalCtx, Actor* actor, s32 arg2) { - return func_800374E0(globalCtx, actor, actor->textId); +s32 func_80037C94(PlayState* play, Actor* actor, s32 arg2) { + return func_800374E0(play, actor, actor->textId); } -s32 func_80037CB8(GlobalContext* globalCtx, Actor* actor, s16 arg2) { - MessageContext* msgCtx = &globalCtx->msgCtx; +s32 func_80037CB8(PlayState* play, Actor* actor, s16 arg2) { + MessageContext* msgCtx = &play->msgCtx; s32 ret = false; switch (Message_GetState(msgCtx)) { case TEXT_STATE_CLOSING: - func_80037C5C(globalCtx, arg2, actor->textId); + func_80037C5C(play, arg2, actor->textId); ret = true; break; case TEXT_STATE_CHOICE: case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx) && func_80037C94(globalCtx, actor, arg2)) { + if (Message_ShouldAdvance(play) && func_80037C94(play, actor, arg2)) { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); msgCtx->msgMode = MSGMODE_TEXT_CLOSING; @@ -5458,25 +5453,25 @@ s32 func_80037CB8(GlobalContext* globalCtx, Actor* actor, s16 arg2) { return ret; } -s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3) { +s32 func_80037D98(PlayState* play, Actor* actor, s16 arg2, s32* arg3) { s16 var; s16 sp2C; s16 sp2A; s16 abs_var; - if (Actor_ProcessTalkRequest(actor, globalCtx)) { + if (Actor_ProcessTalkRequest(actor, play)) { *arg3 = 1; return true; } if (*arg3 == 1) { - if (func_80037CB8(globalCtx, actor, arg2)) { + if (func_80037CB8(play, actor, arg2)) { *arg3 = 0; } return false; } - Actor_GetScreenPos(globalCtx, actor, &sp2C, &sp2A); + Actor_GetScreenPos(play, actor, &sp2C, &sp2A); if (0) {} // Necessary to match @@ -5496,12 +5491,12 @@ s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3) { } if (actor->xyzDistToPlayerSq <= SQ(80.0f)) { - if (func_8002F2CC(actor, globalCtx, 80.0f)) { - actor->textId = func_80037C30(globalCtx, arg2); + if (func_8002F2CC(actor, play, 80.0f)) { + actor->textId = func_80037C30(play, arg2); } } else { - if (func_8002F2F4(actor, globalCtx)) { - actor->textId = func_80037C30(globalCtx, arg2); + if (func_8002F2F4(actor, play)) { + actor->textId = func_80037C30(play, arg2); } } @@ -5540,8 +5535,8 @@ s32 func_80037FC8(Actor* actor, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3) { return true; } -s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, f32 arg4) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80038154(PlayState* play, Actor* actor, Vec3s* arg2, Vec3s* arg3, f32 arg4) { + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp2C; s16 var; @@ -5550,8 +5545,7 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar actor->focus.pos = actor->world.pos; actor->focus.pos.y += arg4; - if (!(((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && - (gSaveContext.entranceIndex == ENTR_SPOT04_0))) { + if (!(((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && (gSaveContext.entranceIndex == ENTR_SPOT04_0))) { var = actor->yawTowardsPlayer - actor->shape.rot.y; abs_var = ABS(var); if (abs_var >= 0x4300) { @@ -5560,9 +5554,8 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar } } - if (((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && - (gSaveContext.entranceIndex == ENTR_SPOT04_0)) { - sp2C = globalCtx->view.eye; + if (((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && (gSaveContext.entranceIndex == ENTR_SPOT04_0)) { + sp2C = play->view.eye; } else { sp2C = player->actor.focus.pos; } @@ -5572,8 +5565,8 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar return true; } -s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80038290(PlayState* play, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4) { + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp24; s16 var; @@ -5581,8 +5574,7 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar actor->focus.pos = arg4; - if (!(((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && - (gSaveContext.entranceIndex == ENTR_SPOT04_0))) { + if (!(((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && (gSaveContext.entranceIndex == ENTR_SPOT04_0))) { var = actor->yawTowardsPlayer - actor->shape.rot.y; abs_var = ABS(var); if (abs_var >= 0x4300) { @@ -5591,9 +5583,8 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar } } - if (((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && - (gSaveContext.entranceIndex == ENTR_SPOT04_0)) { - sp24 = globalCtx->view.eye; + if (((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && (gSaveContext.entranceIndex == ENTR_SPOT04_0)) { + sp24 = play->view.eye; } else { sp24 = player->actor.focus.pos; } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index f3a11e8967..4d871982f0 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -93,7 +93,7 @@ void DynaSSNodeList_SetSSListHead(DynaSSNodeList* nodeList, SSList* ssList, s16* /** * Initialize DynaSSNodeList */ -void DynaSSNodeList_Initialize(GlobalContext* globalCtx, DynaSSNodeList* nodeList) { +void DynaSSNodeList_Initialize(PlayState* play, DynaSSNodeList* nodeList) { nodeList->tbl = NULL; nodeList->count = 0; } @@ -101,8 +101,8 @@ void DynaSSNodeList_Initialize(GlobalContext* globalCtx, DynaSSNodeList* nodeLis /** * Initialize DynaSSNodeList tbl */ -void DynaSSNodeList_Alloc(GlobalContext* globalCtx, DynaSSNodeList* nodeList, s32 max) { - nodeList->tbl = THA_AllocEndAlign(&globalCtx->state.tha, max * sizeof(SSNode), -2); +void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* nodeList, s32 max) { + nodeList->tbl = THA_AllocEndAlign(&play->state.tha, max * sizeof(SSNode), -2); ASSERT(nodeList->tbl != NULL, "psst->tbl != NULL", "../z_bgcheck.c", 1811); @@ -1344,7 +1344,7 @@ s32 BgCheck_PolyIntersectsSubdivision(Vec3f* min, Vec3f* max, CollisionPoly* pol * Initialize StaticLookup Table * returns size of table, in bytes */ -u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, GlobalContext* globalCtx, StaticLookup* lookupTbl) { +u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, PlayState* play, StaticLookup* lookupTbl) { Vec3s* vtxList; CollisionPoly* polyList; s32 polyMax; @@ -1428,7 +1428,7 @@ u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, GlobalContext* glob /** * Is current scene a SPOT scene */ -s32 BgCheck_IsSpotScene(GlobalContext* globalCtx) { +s32 BgCheck_IsSpotScene(PlayState* play) { static s16 spotScenes[] = { SCENE_SPOT00, SCENE_SPOT01, SCENE_SPOT02, SCENE_SPOT03, SCENE_SPOT04, SCENE_SPOT05, SCENE_SPOT06, SCENE_SPOT07, SCENE_SPOT08, SCENE_SPOT09, SCENE_SPOT10, SCENE_SPOT11, SCENE_SPOT12, SCENE_SPOT13, @@ -1437,7 +1437,7 @@ s32 BgCheck_IsSpotScene(GlobalContext* globalCtx) { s16* i; for (i = spotScenes; i < spotScenes + ARRAY_COUNT(spotScenes); i++) { - if (globalCtx->sceneNum == *i) { + if (play->sceneNum == *i) { return true; } } @@ -1491,7 +1491,7 @@ typedef struct { /** * Allocate CollisionContext */ -void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, CollisionHeader* colHeader) { +void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader* colHeader) { static BgCheckSceneSubdivisionEntry sceneSubdivisionList[] = { { SCENE_HAKADAN, { 23, 7, 14 }, -1 }, { SCENE_BMORI1, { 38, 1, 38 }, -1 }, @@ -1512,7 +1512,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis osSyncPrintf("/*---------------- BGCheck バッファーメモリサイズ -------------*/\n"); if (YREG(15) == 0x10 || YREG(15) == 0x20 || YREG(15) == 0x30 || YREG(15) == 0x40) { - if (globalCtx->sceneNum == SCENE_MALON_STABLE) { + if (play->sceneNum == SCENE_MALON_STABLE) { // "/* BGCheck LonLon Size %dbyte */\n" osSyncPrintf("/* BGCheck LonLonサイズ %dbyte */\n", 0x3520); colCtx->memSize = 0x3520; @@ -1527,7 +1527,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis colCtx->subdivAmount.x = 2; colCtx->subdivAmount.y = 2; colCtx->subdivAmount.z = 2; - } else if (BgCheck_IsSpotScene(globalCtx) == true) { + } else if (BgCheck_IsSpotScene(play) == true) { colCtx->memSize = 0xF000; // "/* BGCheck Spot Size %dbyte */\n" osSyncPrintf("/* BGCheck Spot用サイズ %dbyte */\n", 0xF000); @@ -1538,7 +1538,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis colCtx->subdivAmount.y = 4; colCtx->subdivAmount.z = 16; } else { - if (BgCheck_TryGetCustomMemsize(globalCtx->sceneNum, &customMemSize)) { + if (BgCheck_TryGetCustomMemsize(play->sceneNum, &customMemSize)) { colCtx->memSize = customMemSize; } else { colCtx->memSize = 0x1CC00; @@ -1551,7 +1551,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis useCustomSubdivisions = false; for (i = 0; i < ARRAY_COUNT(sceneSubdivisionList); i++) { - if (globalCtx->sceneNum == sceneSubdivisionList[i].sceneId) { + if (play->sceneNum == sceneSubdivisionList[i].sceneId) { colCtx->subdivAmount.x = sceneSubdivisionList[i].subdivAmount.x; colCtx->subdivAmount.y = sceneSubdivisionList[i].subdivAmount.y; colCtx->subdivAmount.z = sceneSubdivisionList[i].subdivAmount.z; @@ -1566,7 +1566,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis } } colCtx->lookupTbl = THA_AllocEndAlign( - &globalCtx->state.tha, + &play->state.tha, colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z, ~1); if (colCtx->lookupTbl == NULL) { LogUtils_HungupThread("../z_bgcheck.c", 4176); @@ -1599,15 +1599,15 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis } SSNodeList_Initialize(&colCtx->polyNodes); - SSNodeList_Alloc(globalCtx, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons); + SSNodeList_Alloc(play, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons); - lookupTblMemSize = BgCheck_InitializeStaticLookup(colCtx, globalCtx, colCtx->lookupTbl); + lookupTblMemSize = BgCheck_InitializeStaticLookup(colCtx, play, colCtx->lookupTbl); osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("/*---結局 BG使用サイズ %dbyte---*/\n", memSize + lookupTblMemSize); osSyncPrintf(VT_RST); - DynaPoly_Init(globalCtx, &colCtx->dyna); - DynaPoly_Alloc(globalCtx, &colCtx->dyna); + DynaPoly_Init(play, &colCtx->dyna); + DynaPoly_Alloc(play, &colCtx->dyna); } /** @@ -1650,7 +1650,7 @@ s32 BgCheck_PosInStaticBoundingBox(CollisionContext* colCtx, Vec3f* pos) { * returns the yIntersect of the nearest poly found directly below `pos`, or BGCHECK_Y_MIN if no floor detected * returns the poly found in `outPoly`, and the bgId of the entity in `outBgId` */ -f32 BgCheck_RaycastFloorImpl(GlobalContext* globalCtx, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, +f32 BgCheck_RaycastFloorImpl(PlayState* play, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* pos, Actor* actor, u32 arg7, f32 chkDist) { f32 yIntersectDyna; @@ -1695,7 +1695,7 @@ f32 BgCheck_RaycastFloorImpl(GlobalContext* globalCtx, CollisionContext* colCtx, dynaRaycast.actor = actor; dynaRaycast.unk_20 = arg7; dynaRaycast.chkDist = chkDist; - dynaRaycast.globalCtx = globalCtx; + dynaRaycast.play = play; dynaRaycast.resultPoly = outPoly; dynaRaycast.bgId = outBgId; @@ -1735,11 +1735,10 @@ f32 BgCheck_EntityRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPol * Public raycast toward floor * returns yIntersect of the poly found, or BGCHECK_Y_MIN if no poly detected */ -f32 BgCheck_EntityRaycastFloor2(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, - Vec3f* pos) { +f32 BgCheck_EntityRaycastFloor2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos) { s32 bgId; - return BgCheck_RaycastFloorImpl(globalCtx, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f); + return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f); } /** @@ -1763,9 +1762,9 @@ f32 BgCheck_EntityRaycastFloor4(CollisionContext* colCtx, CollisionPoly** outPol * Public raycast toward floor * returns yIntersect of the poly found, or BGCHECK_Y_MIN if no poly detected */ -f32 BgCheck_EntityRaycastFloor5(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, +f32 BgCheck_EntityRaycastFloor5(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos) { - return BgCheck_RaycastFloorImpl(globalCtx, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x1C, 1.0f); + return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x1C, 1.0f); } /** @@ -2412,14 +2411,14 @@ void SSNodeList_Initialize(SSNodeList* this) { * tblMax is the number of SSNode records to allocate * numPolys is the number of polygons defined within the CollisionHeader */ -void SSNodeList_Alloc(GlobalContext* globalCtx, SSNodeList* this, s32 tblMax, s32 numPolys) { +void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys) { this->max = tblMax; this->count = 0; - this->tbl = THA_AllocEndAlign(&globalCtx->state.tha, tblMax * sizeof(SSNode), -2); + this->tbl = THA_AllocEndAlign(&play->state.tha, tblMax * sizeof(SSNode), -2); ASSERT(this->tbl != NULL, "this->short_slist_node_tbl != NULL", "../z_bgcheck.c", 5975); - this->polyCheckTbl = GameState_Alloc(&globalCtx->state, numPolys, "../z_bgcheck.c", 5979); + this->polyCheckTbl = GameState_Alloc(&play->state, numPolys, "../z_bgcheck.c", 5979); ASSERT(this->polyCheckTbl != NULL, "this->polygon_check != NULL", "../z_bgcheck.c", 5981); } @@ -2506,7 +2505,7 @@ void DynaLookup_ResetVtxStartIndex(u16* vtxStartIndex) { /** * Initialize BgActor */ -void BgActor_Initialize(GlobalContext* globalCtx, BgActor* bgActor) { +void BgActor_Initialize(PlayState* play, BgActor* bgActor) { bgActor->actor = NULL; bgActor->colHeader = NULL; ScaleRotPos_Initialize(&bgActor->prevTransform); @@ -2549,8 +2548,8 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) { /** * Allocate dyna.polyList */ -void DynaPoly_AllocPolyList(GlobalContext* globalCtx, CollisionPoly** polyList, s32 numPolys) { - *polyList = THA_AllocEndAlign(&globalCtx->state.tha, numPolys * sizeof(CollisionPoly), -2); +void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys) { + *polyList = THA_AllocEndAlign(&play->state.tha, numPolys * sizeof(CollisionPoly), -2); ASSERT(*polyList != NULL, "ptbl->pbuf != NULL", "../z_bgcheck.c", 6247); } @@ -2564,15 +2563,15 @@ void DynaPoly_NullVtxList(Vec3s** vtxList) { /** * Allocate dyna.vtxList */ -void DynaPoly_AllocVtxList(GlobalContext* globalCtx, Vec3s** vtxList, s32 numVtx) { - *vtxList = THA_AllocEndAlign(&globalCtx->state.tha, numVtx * sizeof(Vec3s), -2); +void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx) { + *vtxList = THA_AllocEndAlign(&play->state.tha, numVtx * sizeof(Vec3s), -2); ASSERT(*vtxList != NULL, "ptbl->pbuf != NULL", "../z_bgcheck.c", 6277); } /** * Update BgActor's prevTransform */ -void DynaPoly_SetBgActorPrevTransform(GlobalContext* globalCtx, BgActor* bgActor) { +void DynaPoly_SetBgActorPrevTransform(PlayState* play, BgActor* bgActor) { bgActor->prevTransform = bgActor->curTransform; } @@ -2589,39 +2588,38 @@ s32 DynaPoly_IsBgIdBgActor(s32 bgId) { /** * Init DynaCollisionContext */ -void DynaPoly_Init(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void DynaPoly_Init(PlayState* play, DynaCollisionContext* dyna) { dyna->bitFlag = DYNAPOLY_INVALIDATE_LOOKUP; DynaPoly_NullPolyList(&dyna->polyList); DynaPoly_NullVtxList(&dyna->vtxList); - DynaSSNodeList_Initialize(globalCtx, &dyna->polyNodes); + DynaSSNodeList_Initialize(play, &dyna->polyNodes); } /** * Set DynaCollisionContext */ -void DynaPoly_Alloc(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void DynaPoly_Alloc(PlayState* play, DynaCollisionContext* dyna) { s32 i; for (i = 0; i < BG_ACTOR_MAX; i++) { - BgActor_Initialize(globalCtx, &dyna->bgActors[i]); + BgActor_Initialize(play, &dyna->bgActors[i]); dyna->bgActorFlags[i] = 0; } DynaPoly_NullPolyList(&dyna->polyList); - DynaPoly_AllocPolyList(globalCtx, &dyna->polyList, dyna->polyListMax); + DynaPoly_AllocPolyList(play, &dyna->polyList, dyna->polyListMax); DynaPoly_NullVtxList(&dyna->vtxList); - DynaPoly_AllocVtxList(globalCtx, &dyna->vtxList, dyna->vtxListMax); + DynaPoly_AllocVtxList(play, &dyna->vtxList, dyna->vtxListMax); - DynaSSNodeList_Initialize(globalCtx, &dyna->polyNodes); - DynaSSNodeList_Alloc(globalCtx, &dyna->polyNodes, dyna->polyNodesMax); + DynaSSNodeList_Initialize(play, &dyna->polyNodes); + DynaSSNodeList_Alloc(play, &dyna->polyNodes, dyna->polyNodesMax); } /** * Set BgActor * original name: DynaPolyInfo_setActor */ -s32 DynaPoly_SetBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor, - CollisionHeader* colHeader) { +s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader) { s32 bgId; s32 foundSlot = false; @@ -2662,28 +2660,28 @@ DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId) { return (DynaPolyActor*)colCtx->dyna.bgActors[bgId].actor; } -void func_8003EBF8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_8003EBF8(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] |= 4; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_8003EC50(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_8003EC50(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] &= ~4; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_8003ECA8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_8003ECA8(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] |= 8; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_8003ED00(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_8003ED00(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] &= ~8; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; @@ -2693,7 +2691,7 @@ void func_8003ED00(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgI /** * original name: DynaPolyInfo_delReserve */ -void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { DynaPolyActor* actor; osSyncPrintf(VT_FGCOL(GREEN)); @@ -2718,7 +2716,7 @@ void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna return; } } - actor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + actor = DynaPoly_GetActor(&play->colCtx, bgId); if (actor != NULL) { actor->bgId = BGACTOR_NEG_ONE; @@ -2727,14 +2725,14 @@ void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna } } -void func_8003EE6C(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void func_8003EE6C(PlayState* play, DynaCollisionContext* dyna) { dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } /** * original name: DynaPolyInfo_expandSRT */ -void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, +void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex) { MtxF mtx; Actor* actor; @@ -2915,13 +2913,13 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 } } -void func_8003F8EC(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor) { +void func_8003F8EC(PlayState* play, DynaCollisionContext* dyna, Actor* actor) { DynaPolyActor* dynaActor; s32 i; for (i = 0; i < BG_ACTOR_MAX; i++) { if (dyna->bgActorFlags[i] & 1) { - dynaActor = DynaPoly_GetActor(&globalCtx->colCtx, i); + dynaActor = DynaPoly_GetActor(&play->colCtx, i); if (dynaActor != NULL && &dynaActor->actor == actor) { func_800434A0((DynaPolyActor*)actor); return; @@ -2933,7 +2931,7 @@ void func_8003F8EC(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* /** * DynaPolyInfo_setup */ -void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna) { DynaPolyActor* actor; s32 vtxStartIndex; s32 polyStartIndex; @@ -2953,7 +2951,7 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { osSyncPrintf(VT_RST); dyna->bgActorFlags[i] = 0; - BgActor_Initialize(globalCtx, &dyna->bgActors[i]); + BgActor_Initialize(play, &dyna->bgActors[i]); dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } if (dyna->bgActors[i].actor != NULL && dyna->bgActors[i].actor->update == NULL) { @@ -2961,14 +2959,14 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("DynaPolyInfo_setup():削除 index=%d\n", i); osSyncPrintf(VT_RST); - actor = DynaPoly_GetActor(&globalCtx->colCtx, i); + actor = DynaPoly_GetActor(&play->colCtx, i); if (actor == NULL) { return; } actor->bgId = BGACTOR_NEG_ONE; dyna->bgActorFlags[i] = 0; - BgActor_Initialize(globalCtx, &dyna->bgActors[i]); + BgActor_Initialize(play, &dyna->bgActors[i]); dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } @@ -2976,7 +2974,7 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { polyStartIndex = 0; for (i = 0; i < BG_ACTOR_MAX; i++) { if (dyna->bgActorFlags[i] & 1) { - DynaPoly_ExpandSRT(globalCtx, dyna, i, &vtxStartIndex, &polyStartIndex); + DynaPoly_ExpandSRT(play, dyna, i, &vtxStartIndex, &polyStartIndex); } } dyna->bitFlag &= ~DYNAPOLY_INVALIDATE_LOOKUP; @@ -2985,12 +2983,12 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { /** * Update all BgActor's previous ScaleRotPos */ -void DynaPoly_UpdateBgActorTransforms(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyna) { s32 i; for (i = 0; i < BG_ACTOR_MAX; i++) { if (dyna->bgActorFlags[i] & 1) { - DynaPoly_SetBgActorPrevTransform(globalCtx, &dyna->bgActors[i]); + DynaPoly_SetBgActorPrevTransform(play, &dyna->bgActors[i]); } } } @@ -3129,10 +3127,10 @@ f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast) { } dynaActor = DynaPoly_GetActor(dynaRaycast->colCtx, *dynaRaycast->bgId); - if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->globalCtx != NULL)) { - pauseState = dynaRaycast->globalCtx->pauseCtx.state != 0; + if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->play != NULL)) { + pauseState = dynaRaycast->play->pauseCtx.state != 0; if (pauseState == 0) { - pauseState = dynaRaycast->globalCtx->pauseCtx.debugState != 0; + pauseState = dynaRaycast->play->pauseCtx.debugState != 0; } if (!pauseState && (dynaRaycast->colCtx->dyna.bgActorFlags[*dynaRaycast->bgId] & 2)) { curTransform = &dynaRaycast->dyna->bgActors[*dynaRaycast->bgId].curTransform; @@ -3787,7 +3785,7 @@ void CollisionHeader_GetVirtual(void* colHeader, CollisionHeader** dest) { /** * SEGMENT_TO_VIRTUAL all active BgActor CollisionHeaders */ -void func_800418D0(CollisionContext* colCtx, GlobalContext* globalCtx) { +void func_800418D0(CollisionContext* colCtx, PlayState* play) { DynaCollisionContext* dyna = &colCtx->dyna; s32 i; u16 flag; @@ -3795,7 +3793,7 @@ void func_800418D0(CollisionContext* colCtx, GlobalContext* globalCtx) { for (i = 0; i < BG_ACTOR_MAX; i++) { flag = dyna->bgActorFlags[i]; if ((flag & 1) && !(flag & 2)) { - Actor_SetObjectDependency(globalCtx, dyna->bgActors[i].actor); + Actor_SetObjectDependency(play, dyna->bgActors[i].actor); CollisionHeader_SegmentedToVirtual(dyna->bgActors[i].colHeader); } } @@ -4173,9 +4171,9 @@ f32 zdWaterBoxMaxZ = -967.0f; * returns true if point is within the xz boundaries of an active water box, else false * `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox */ -s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, +s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) { - if (globalCtx->sceneNum == SCENE_SPOT07) { + if (play->sceneNum == SCENE_SPOT07) { if (zdWaterBoxMinX < x && x < zdWaterBoxMaxX && zdWaterBoxMinY < *ySurface && *ySurface < zdWaterBoxMaxY && zdWaterBoxMinZ < z && z < zdWaterBoxMaxZ) { *outWaterBox = &zdWaterBox; @@ -4183,7 +4181,7 @@ s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32 return true; } } - return WaterBox_GetSurfaceImpl(globalCtx, colCtx, x, z, ySurface, outWaterBox); + return WaterBox_GetSurfaceImpl(play, colCtx, x, z, ySurface, outWaterBox); } /** @@ -4191,7 +4189,7 @@ s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32 * returns true if point is within the xz boundaries of an active water box, else false * `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox */ -s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, +s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) { CollisionHeader* colHeader = colCtx->colHeader; u32 room; @@ -4204,7 +4202,7 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = (curWaterBox->properties >> 13) & 0x3F; - if (room == (u32)globalCtx->roomCtx.curRoom.num || room == 0x3F) { + if (room == (u32)play->roomCtx.curRoom.num || room == 0x3F) { if ((curWaterBox->properties & 0x80000) == 0) { if (curWaterBox->xMin < x && x < curWaterBox->xMin + curWaterBox->xLength) { if (curWaterBox->zMin < z && z < curWaterBox->zMin + curWaterBox->zLength) { @@ -4225,7 +4223,7 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, * returns the index of the waterbox found, or -1 if no waterbox is found * `outWaterBox` returns the pointer to the waterbox found, or NULL if none is found */ -s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, +s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, WaterBox** outWaterBox) { CollisionHeader* colHeader = colCtx->colHeader; s32 room; @@ -4242,7 +4240,7 @@ s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec waterBox = &colHeader->waterBoxes[i]; room = WATERBOX_ROOM(waterBox->properties); - if (!(room == globalCtx->roomCtx.curRoom.num || room == 0x3F)) { + if (!(room == play->roomCtx.curRoom.num || room == 0x3F)) { continue; } if (waterBox->properties & 0x80000) { @@ -4302,8 +4300,7 @@ u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox) * returns true if point is within the xz boundaries of an active water box, else false * `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox */ -s32 func_800425B0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, - WaterBox** outWaterBox) { +s32 func_800425B0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) { CollisionHeader* colHeader = colCtx->colHeader; u32 room; WaterBox* curWaterBox; @@ -4315,7 +4312,7 @@ s32 func_800425B0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = (curWaterBox->properties >> 0xD) & 0x3F; - if ((room == (u32)globalCtx->roomCtx.curRoom.num) || (room == 0x3F)) { + if ((room == (u32)play->roomCtx.curRoom.num) || (room == 0x3F)) { if ((curWaterBox->properties & 0x80000) != 0) { if (curWaterBox->xMin < x && x < (curWaterBox->xMin + curWaterBox->xLength)) { if (curWaterBox->zMin < z && z < (curWaterBox->zMin + curWaterBox->zLength)) { @@ -4371,8 +4368,8 @@ s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec /** * Draw a list of dyna polys, specified by `ssList` */ -void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx, DynaCollisionContext* dyna, - SSList* ssList, u8 r, u8 g, u8 b) { +void BgCheck_DrawDynaPolyList(PlayState* play, CollisionContext* colCtx, DynaCollisionContext* dyna, SSList* ssList, + u8 r, u8 g, u8 b) { s16 curPolyId; CollisionPoly* poly; SSNode* curNode; @@ -4405,7 +4402,7 @@ void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx vC.y += AREG(26) * ny; vC.z += AREG(26) * nz; } - Collider_DrawPoly(globalCtx->state.gfxCtx, &vA, &vB, &vC, r, g, b); + Collider_DrawPoly(play->state.gfxCtx, &vA, &vB, &vC, r, g, b); if (curNode->next == SS_NULL) { break; } @@ -4418,25 +4415,23 @@ void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx * Draw a BgActor's dyna polys * `bgId` is the BgActor index that should be drawn */ -void BgCheck_DrawBgActor(GlobalContext* globalCtx, CollisionContext* colCtx, s32 bgId) { +void BgCheck_DrawBgActor(PlayState* play, CollisionContext* colCtx, s32 bgId) { if (AREG(21)) { - BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.ceiling, 255, - 0, 0); - } - if (AREG(22)) { - BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.wall, 0, 255, + BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.ceiling, 255, 0, 0); } + if (AREG(22)) { + BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.wall, 0, 255, 0); + } if (AREG(23)) { - BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.floor, 0, 0, - 255); + BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.floor, 0, 0, 255); } } /** * Draw all dyna polys */ -void BgCheck_DrawDynaCollision(GlobalContext* globalCtx, CollisionContext* colCtx) { +void BgCheck_DrawDynaCollision(PlayState* play, CollisionContext* colCtx) { s32 bgId; for (bgId = 0; bgId < BG_ACTOR_MAX; bgId++) { @@ -4444,14 +4439,14 @@ void BgCheck_DrawDynaCollision(GlobalContext* globalCtx, CollisionContext* colCt if (!(colCtx->dyna.bgActorFlags[bgId] & 1)) { continue; } - BgCheck_DrawBgActor(globalCtx, colCtx, bgId); + BgCheck_DrawBgActor(play, colCtx, bgId); } } /** * Draw a static poly */ -void BgCheck_DrawStaticPoly(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly* poly, u8 r, u8 g, u8 b) { +void BgCheck_DrawStaticPoly(PlayState* play, CollisionContext* colCtx, CollisionPoly* poly, u8 r, u8 g, u8 b) { Vec3f vA; Vec3f vB; Vec3f vC; @@ -4476,13 +4471,13 @@ void BgCheck_DrawStaticPoly(GlobalContext* globalCtx, CollisionContext* colCtx, vC.y += AREG(26) * ny; vC.z += AREG(26) * nz; } - Collider_DrawPoly(globalCtx->state.gfxCtx, &vA, &vB, &vC, r, g, b); + Collider_DrawPoly(play->state.gfxCtx, &vA, &vB, &vC, r, g, b); } /** * Draw a list of static polys, specified by `ssList` */ -void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colCtx, SSList* ssList, u8 r, u8 g, u8 b) { +void BgCheck_DrawStaticPolyList(PlayState* play, CollisionContext* colCtx, SSList* ssList, u8 r, u8 g, u8 b) { SSNode* curNode; CollisionPoly* polyList = colCtx->colHeader->polyList; s16 curPolyId; @@ -4491,7 +4486,7 @@ void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colC curNode = &colCtx->polyNodes.tbl[ssList->head]; while (true) { curPolyId = curNode->polyId; - BgCheck_DrawStaticPoly(globalCtx, colCtx, &polyList[curPolyId], r, g, b); + BgCheck_DrawStaticPoly(play, colCtx, &polyList[curPolyId], r, g, b); if (curNode->next == SS_NULL) { break; } @@ -4503,17 +4498,17 @@ void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colC /** * Draw scene collision */ -void BgCheck_DrawStaticCollision(GlobalContext* globalCtx, CollisionContext* colCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgCheck_DrawStaticCollision(PlayState* play, CollisionContext* colCtx) { + Player* player = GET_PLAYER(play); StaticLookup* lookup = BgCheck_GetNearestStaticLookup(colCtx, colCtx->lookupTbl, &player->actor.world.pos); if (AREG(23) != 0) { - BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->floor, 0, 0, 255); + BgCheck_DrawStaticPolyList(play, colCtx, &lookup->floor, 0, 0, 255); } if (AREG(22) != 0) { - BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->wall, 0, 255, 0); + BgCheck_DrawStaticPolyList(play, colCtx, &lookup->wall, 0, 255, 0); } if (AREG(21) != 0) { - BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->ceiling, 255, 0, 0); + BgCheck_DrawStaticPolyList(play, colCtx, &lookup->ceiling, 255, 0, 0); } } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index f7b675c35b..7e8abdda24 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -215,7 +215,7 @@ Vec3f* Camera_Vec3fTranslateByUnitVector(Vec3f* dest, Vec3f* src, Vec3f* unitVec * Detects the collision poly between `from` and `to`, places collision info in `to` */ s32 Camera_BGCheckInfo(Camera* camera, Vec3f* from, CamColChk* to) { - CollisionContext* colCtx = &camera->globalCtx->colCtx; + CollisionContext* colCtx = &camera->play->colCtx; Vec3f toNewPos; Vec3f toPoint; Vec3f fromToNorm; @@ -278,7 +278,7 @@ s32 Camera_BGCheck(Camera* camera, Vec3f* from, Vec3f* to) { } s32 func_80043F94(Camera* camera, Vec3f* from, CamColChk* to) { - CollisionContext* colCtx = &camera->globalCtx->colCtx; + CollisionContext* colCtx = &camera->play->colCtx; Vec3f toNewPos; Vec3f toPos; Vec3f fromToNorm; @@ -363,7 +363,7 @@ s32 Camera_CheckOOB(Camera* camera, Vec3f* from, Vec3f* to) { s32 pad2; s32 bgId; CollisionPoly* poly; - CollisionContext* colCtx = &camera->globalCtx->colCtx; + CollisionContext* colCtx = &camera->play->colCtx; poly = NULL; if (BgCheck_CameraLineTest1(colCtx, from, to, &intersect, &poly, 1, 1, 1, 0, &bgId) && @@ -382,7 +382,7 @@ s32 Camera_CheckOOB(Camera* camera, Vec3f* from, Vec3f* to) { f32 Camera_GetFloorYNorm(Camera* camera, Vec3f* floorNorm, Vec3f* chkPos, s32* bgId) { s32 pad; CollisionPoly* floorPoly; - f32 floorY = BgCheck_EntityRaycastFloor3(&camera->globalCtx->colCtx, &floorPoly, bgId, chkPos); + f32 floorY = BgCheck_EntityRaycastFloor3(&camera->play->colCtx, &floorPoly, bgId, chkPos); if (floorY == BGCHECK_Y_MIN) { // no floor @@ -418,7 +418,7 @@ f32 Camera_GetFloorY(Camera* camera, Vec3f* pos) { */ f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) { CollisionPoly* floorPoly; - CollisionContext* colCtx = &camera->globalCtx->colCtx; + CollisionContext* colCtx = &camera->play->colCtx; f32 floorY; s32 i; @@ -453,14 +453,14 @@ f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) { * Returns the CameraSettingType of the camera at index `camDataIdx` */ s16 Camera_GetCamDataSetting(Camera* camera, s32 camDataIdx) { - return func_80041A4C(&camera->globalCtx->colCtx, camDataIdx, BGCHECK_SCENE); + return func_80041A4C(&camera->play->colCtx, camDataIdx, BGCHECK_SCENE); } /** * Returns the scene camera info for the current camera data index */ Vec3s* Camera_GetCamBGData(Camera* camera) { - return func_80041C10(&camera->globalCtx->colCtx, camera->camDataIdx, BGCHECK_SCENE); + return func_80041C10(&camera->play->colCtx, camera->camDataIdx, BGCHECK_SCENE); } /** @@ -473,9 +473,9 @@ s32 Camera_GetDataIdxForPoly(Camera* camera, s32* bgId, CollisionPoly* poly) { s32 ret; Actor_GetWorldPosShapeRot(&playerPosRot, &camera->player->actor); // unused. - camDataIdx = SurfaceType_GetCamDataIndex(&camera->globalCtx->colCtx, poly, *bgId); + camDataIdx = SurfaceType_GetCamDataIndex(&camera->play->colCtx, poly, *bgId); - if (func_80041A4C(&camera->globalCtx->colCtx, camDataIdx, *bgId) == CAM_SET_NONE) { + if (func_80041A4C(&camera->play->colCtx, camDataIdx, *bgId) == CAM_SET_NONE) { ret = -1; } else { ret = camDataIdx; @@ -496,13 +496,12 @@ Vec3s* Camera_GetCamBgDataUnderPlayer(Camera* camera, u16* dataCnt) { Actor_GetWorldPosShapeRot(&playerPosShape, &camera->player->actor); playerPosShape.pos.y += Player_GetHeight(camera->player); - if (BgCheck_EntityRaycastFloor3(&camera->globalCtx->colCtx, &floorPoly, &bgId, &playerPosShape.pos) == - BGCHECK_Y_MIN) { + if (BgCheck_EntityRaycastFloor3(&camera->play->colCtx, &floorPoly, &bgId, &playerPosShape.pos) == BGCHECK_Y_MIN) { // no floor return NULL; } - *dataCnt = SurfaceType_GetNumCameras(&camera->globalCtx->colCtx, floorPoly, bgId); - return SurfaceType_GetCamPosData(&camera->globalCtx->colCtx, floorPoly, bgId); + *dataCnt = SurfaceType_GetNumCameras(&camera->play->colCtx, floorPoly, bgId); + return SurfaceType_GetCamPosData(&camera->play->colCtx, floorPoly, bgId); } /** @@ -519,8 +518,8 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) { Actor_GetWorldPosShapeRot(&playerPosShape, &camera->player->actor); *waterY = playerPosShape.pos.y; - if (!WaterBox_GetSurface1(camera->globalCtx, &camera->globalCtx->colCtx, playerPosShape.pos.x, playerPosShape.pos.z, - waterY, &waterBox)) { + if (!WaterBox_GetSurface1(camera->play, &camera->play->colCtx, playerPosShape.pos.x, playerPosShape.pos.z, waterY, + &waterBox)) { // player's position is not in a water box. *waterY = BGCHECK_Y_MIN; return -1; @@ -532,8 +531,8 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) { return -1; } - ret = WaterBox_GetCamDataIndex(&camera->globalCtx->colCtx, waterBox); - if ((ret <= 0) || (WaterBox_GetCameraSType(&camera->globalCtx->colCtx, waterBox) <= 0)) { + ret = WaterBox_GetCamDataIndex(&camera->play->colCtx, waterBox); + if ((ret <= 0) || (WaterBox_GetCameraSType(&camera->play->colCtx, waterBox) <= 0)) { // no camera data index, or no CameraSettingType return -2; } @@ -554,8 +553,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) { Actor_GetWorldPosShapeRot(&playerPosRot, &camera->player->actor); waterY = playerPosRot.pos.y; - if (!WaterBox_GetSurface1(camera->globalCtx, &camera->globalCtx->colCtx, chkPos->x, chkPos->z, &waterY, - &waterBox)) { + if (!WaterBox_GetSurface1(camera->play, &camera->play->colCtx, chkPos->x, chkPos->z, &waterY, &waterBox)) { // chkPos is not within the x/z boundaries of a water box. return BGCHECK_Y_MIN; } @@ -566,7 +564,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) { return BGCHECK_Y_MIN; } - *envProp = WaterBox_GetLightSettingIndex(&camera->globalCtx->colCtx, waterBox); + *envProp = WaterBox_GetLightSettingIndex(&camera->play->colCtx, waterBox); return waterY; } @@ -608,7 +606,7 @@ s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) { rotatedPos.x = playerPos.x + (sp30 * sinYaw); rotatedPos.y = playerPos.y; rotatedPos.z = playerPos.z + (sp30 * cosYaw); - if (arg2 || (camera->globalCtx->state.frames % 2) == 0) { + if (arg2 || (camera->play->state.frames % 2) == 0) { D_8015CE58.pos.x = playerPos.x + (sp2C * sinYaw); D_8015CE58.pos.y = playerPos.y; D_8015CE58.pos.z = playerPos.z + (sp2C * cosYaw); @@ -1638,7 +1636,7 @@ s32 Camera_Normal1(Camera* camera) { } // crit wiggle - if (gSaveContext.health <= 16 && ((camera->globalCtx->state.frames % 256) == 0)) { + if (gSaveContext.health <= 16 && ((camera->play->state.frames % 256) == 0)) { wiggleAdj = Rand_ZeroOne() * 10000.0f; camera->inputDir.y = wiggleAdj + camera->inputDir.y; } @@ -1805,7 +1803,7 @@ s32 Camera_Normal2(Camera* camera) { if (camera->status == CAM_STAT_ACTIVE) { bgChk.pos = *eyeNext; - if (!camera->globalCtx->envCtx.skyboxDisabled || roData->interfaceFlags & 0x10) { + if (!camera->play->envCtx.skyboxDisabled || roData->interfaceFlags & 0x10) { Camera_BGCheckInfo(camera, at, &bgChk); *eye = bgChk.pos; } else { @@ -2140,7 +2138,7 @@ s32 Camera_Parallel1(Camera* camera) { Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spA8); if (camera->status == CAM_STAT_ACTIVE) { sp6C.pos = *eyeNext; - if (!camera->globalCtx->envCtx.skyboxDisabled || roData->interfaceFlags & 0x10) { + if (!camera->play->envCtx.skyboxDisabled || roData->interfaceFlags & 0x10) { Camera_BGCheckInfo(camera, at, &sp6C); *eye = sp6C.pos; } else { @@ -2950,7 +2948,7 @@ s32 Camera_Battle1(Camera* camera) { Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spB4); spBC.pos = *eyeNext; if (camera->status == CAM_STAT_ACTIVE) { - if (!camera->globalCtx->envCtx.skyboxDisabled || roData->flags & 1) { + if (!camera->play->envCtx.skyboxDisabled || roData->flags & 1) { Camera_BGCheckInfo(camera, at, &spBC); } else if (roData->flags & 2) { func_80043F94(camera, at, &spBC); @@ -3277,7 +3275,7 @@ s32 Camera_KeepOn1(Camera* camera) { Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spD8); sp8C.pos = *eyeNext; if (camera->status == CAM_STAT_ACTIVE) { - if (!camera->globalCtx->envCtx.skyboxDisabled || roData->interfaceFlags & 1) { + if (!camera->play->envCtx.skyboxDisabled || roData->interfaceFlags & 1) { Camera_BGCheckInfo(camera, at, &sp8C); } else if (roData->interfaceFlags & 2) { func_80043F94(camera, at, &sp8C); @@ -3343,9 +3341,9 @@ s32 Camera_KeepOn3(Camera* camera) { return 1; } if (RELOAD_PARAMS(camera)) { - if (camera->globalCtx->view.unk_124 == 0) { + if (camera->play->view.unk_124 == 0) { camera->unk_14C |= 0x20; - camera->globalCtx->view.unk_124 = camera->camId | 0x50; + camera->play->view.unk_124 = camera->camId | 0x50; return 1; } camera->unk_14C &= ~0x20; @@ -3433,7 +3431,7 @@ s32 Camera_KeepOn3(Camera* camera) { Camera_Vec3fVecSphGeoAdd(&lineChkPointB, &rwData->atTarget, &atToEyeAdj); if (!(roData->flags & 0x80)) { while (i < angleCnt) { - if (!CollisionCheck_LineOCCheck(camera->globalCtx, &camera->globalCtx->colChkCtx, &rwData->atTarget, + if (!CollisionCheck_LineOCCheck(camera->play, &camera->play->colChkCtx, &rwData->atTarget, &lineChkPointB, colChkActors, 2) && !Camera_BGCheck(camera, &rwData->atTarget, &lineChkPointB)) { break; @@ -3517,15 +3515,15 @@ s32 Camera_KeepOn4(Camera* camera) { KeepOn4ReadWriteData* rwData = &camera->paramData.keep4.rwData; s32 pad; f32 playerHeight; - Player* player = GET_PLAYER(camera->globalCtx); + Player* player = GET_PLAYER(camera->play); s16 angleCnt; s32 i; if (RELOAD_PARAMS(camera)) { - if (camera->globalCtx->view.unk_124 == 0) { + if (camera->play->view.unk_124 == 0) { camera->unk_14C |= 0x20; camera->unk_14C &= ~(0x4 | 0x2); - camera->globalCtx->view.unk_124 = camera->camId | 0x50; + camera->play->view.unk_124 = camera->camId | 0x50; return 1; } rwData->unk_14 = *temp_s0; @@ -3538,7 +3536,7 @@ s32 Camera_KeepOn4(Camera* camera) { camera->animState = 20; camera->unk_14C |= 0x20; camera->unk_14C &= ~(0x4 | 0x2); - camera->globalCtx->view.unk_124 = camera->camId | 0x50; + camera->play->view.unk_124 = camera->camId | 0x50; return 1; } @@ -3656,7 +3654,7 @@ s32 Camera_KeepOn4(Camera* camera) { OLib_Vec3fDiffToVecSphGeo(&spA8, at, eyeNext); D_8015BD50 = playerPosRot->pos; D_8015BD50.y += playerHeight; - temp_f0_2 = BgCheck_CameraRaycastFloor2(&camera->globalCtx->colCtx, &spC0, &i, &D_8015BD50); + temp_f0_2 = BgCheck_CameraRaycastFloor2(&camera->play->colCtx, &spC0, &i, &D_8015BD50); if (temp_f0_2 > (roData->unk_00 + D_8015BD50.y)) { D_8015BD50.y = temp_f0_2 + 10.0f; } else { @@ -3716,8 +3714,8 @@ s32 Camera_KeepOn4(Camera* camera) { if (!(roData->unk_1C & 1)) { angleCnt = ARRAY_COUNT(D_8011D3B0); for (i = 0; i < angleCnt; i++) { - if (!CollisionCheck_LineOCCheck(camera->globalCtx, &camera->globalCtx->colChkCtx, &D_8015BD50, - &D_8015BD70, spCC, sp9C) && + if (!CollisionCheck_LineOCCheck(camera->play, &camera->play->colChkCtx, &D_8015BD50, &D_8015BD70, + spCC, sp9C) && !Camera_BGCheck(camera, &D_8015BD50, &D_8015BD70)) { break; } @@ -4204,8 +4202,8 @@ s32 Camera_Subj3(Camera* camera) { Actor_GetFocus(&sp60, &camera->player->actor); playerHeight = Player_GetHeight(camera->player); - if (camera->globalCtx->view.unk_124 == 0) { - camera->globalCtx->view.unk_124 = camera->camId | 0x50; + if (camera->play->view.unk_124 == 0) { + camera->play->view.unk_124 = camera->camId | 0x50; return true; } @@ -4266,7 +4264,7 @@ s32 Camera_Subj3(Camera* camera) { *eye = *eyeNext; rwData->animTimer--; - if (!camera->globalCtx->envCtx.skyboxDisabled) { + if (!camera->play->envCtx.skyboxDisabled) { Camera_BGCheck(camera, at, eye); } else { func_80044340(camera, at, eye); @@ -4333,8 +4331,8 @@ s32 Camera_Subj4(Camera* camera) { Camera_CopyPREGToModeValues(camera); } - if (camera->globalCtx->view.unk_124 == 0) { - camera->globalCtx->view.unk_124 = (camera->camId | 0x50); + if (camera->play->view.unk_124 == 0) { + camera->play->view.unk_124 = (camera->camId | 0x50); rwData->unk_24 = camera->xzSpeed; return true; } @@ -5128,11 +5126,11 @@ s32 Camera_Unique9(Camera* camera) { Camera_UpdateInterface(0xF000 | ((rwData->curKeyFrame->unk_01 & 0xF) << 8)); } else if (camera->player->stateFlags1 & PLAYER_STATE1_27 && player->currentBoots != PLAYER_BOOTS_IRON) { - func_8002DF38(camera->globalCtx, camera->target, 8); + func_8002DF38(camera->play, camera->target, 8); osSyncPrintf("camera: demo: player demo set WAIT\n"); } else { osSyncPrintf("camera: demo: player demo set %d\n", rwData->curKeyFrame->unk_01); - func_8002DF38(camera->globalCtx, camera->target, rwData->curKeyFrame->unk_01); + func_8002DF38(camera->play, camera->target, rwData->curKeyFrame->unk_01); } } } else { @@ -5151,9 +5149,9 @@ s32 Camera_Unique9(Camera* camera) { rwData->atTarget = rwData->curKeyFrame->atTargetInit; } else if (atInitFlags == 2) { if (rwData->isNewKeyFrame) { - rwData->atTarget.x = camera->globalCtx->view.at.x + rwData->curKeyFrame->atTargetInit.x; - rwData->atTarget.y = camera->globalCtx->view.at.y + rwData->curKeyFrame->atTargetInit.y; - rwData->atTarget.z = camera->globalCtx->view.at.z + rwData->curKeyFrame->atTargetInit.z; + rwData->atTarget.x = camera->play->view.at.x + rwData->curKeyFrame->atTargetInit.x; + rwData->atTarget.y = camera->play->view.at.y + rwData->curKeyFrame->atTargetInit.y; + rwData->atTarget.z = camera->play->view.at.z + rwData->curKeyFrame->atTargetInit.z; } } else if (atInitFlags == 3) { if (rwData->isNewKeyFrame) { @@ -5233,9 +5231,9 @@ s32 Camera_Unique9(Camera* camera) { rwData->eyeTarget = rwData->curKeyFrame->eyeTargetInit; } else if (eyeInitFlags == 0x200) { if (rwData->isNewKeyFrame) { - rwData->eyeTarget.x = camera->globalCtx->view.eye.x + rwData->curKeyFrame->eyeTargetInit.x; - rwData->eyeTarget.y = camera->globalCtx->view.eye.y + rwData->curKeyFrame->eyeTargetInit.y; - rwData->eyeTarget.z = camera->globalCtx->view.eye.z + rwData->curKeyFrame->eyeTargetInit.z; + rwData->eyeTarget.x = camera->play->view.eye.x + rwData->curKeyFrame->eyeTargetInit.x; + rwData->eyeTarget.y = camera->play->view.eye.y + rwData->curKeyFrame->eyeTargetInit.y; + rwData->eyeTarget.z = camera->play->view.eye.z + rwData->curKeyFrame->eyeTargetInit.z; } } else if (eyeInitFlags == 0x300) { if (rwData->isNewKeyFrame) { @@ -5322,7 +5320,7 @@ s32 Camera_Unique9(Camera* camera) { } if (rwData->curKeyFrame->initFlags == 2) { - rwData->fovTarget = camera->globalCtx->view.fovy; + rwData->fovTarget = camera->play->view.fovy; rwData->rollTarget = 0; } else if (rwData->curKeyFrame->initFlags == 0) { rwData->fovTarget = camera->fov; @@ -5477,12 +5475,12 @@ s32 Camera_Unique9(Camera* camera) { // Change the parent camera (or default)'s mode to normal s32 camIdx = camera->parentCamId <= CAM_ID_NONE ? CAM_ID_MAIN : camera->parentCamId; - Camera_ChangeModeFlags(camera->globalCtx->cameraPtrs[camIdx], CAM_MODE_NORMAL, 1); + Camera_ChangeModeFlags(camera->play->cameraPtrs[camIdx], CAM_MODE_NORMAL, 1); } case 18: { // copy the current camera to the parent (or default)'s camera. s32 camIdx = camera->parentCamId <= CAM_ID_NONE ? CAM_ID_MAIN : camera->parentCamId; - Camera* cam = camera->globalCtx->cameraPtrs[camIdx]; + Camera* cam = camera->play->cameraPtrs[camIdx]; *eye = *eyeNext; Camera_Copy(cam, camera); @@ -5603,8 +5601,8 @@ s32 Camera_Demo1(Camera* camera) { rwData->curFrame = 0.0f; camera->animState++; // "absolute" : "relative" - osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: spline demo: start %s \n", - camera->globalCtx->state.frames, *relativeToPlayer == 0 ? "絶対" : "相対"); + osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: spline demo: start %s \n", camera->play->state.frames, + *relativeToPlayer == 0 ? "絶対" : "相対"); if (PREG(93)) { Camera_DebugPrintSplineArray("CENTER", 5, csAtPoints); @@ -5700,7 +5698,7 @@ s32 Camera_Demo3(Camera* camera) { sp68.x = rwData->initialAt.x + (Math_SinS(angle) * 40.0f); sp68.y = rwData->initialAt.y + 40.0f; sp68.z = rwData->initialAt.z + (Math_CosS(angle) * 40.0f); - if (camera->globalCtx->state.frames & 1) { + if (camera->play->state.frames & 1) { angle -= 0x3FFF; rwData->yawDir = 1; } else { @@ -5899,7 +5897,7 @@ s32 Camera_Demo5(Camera* camera) { Actor_GetFocus(&camera->targetPosRot, camera->target); OLib_Vec3fDiffToVecSphGeo(&playerTargetGeo, &camera->targetPosRot.pos, &camera->playerPosRot.pos); D_8011D3AC = camera->target->category; - Actor_GetScreenPos(camera->globalCtx, camera->target, &targetScreenPosX, &targetScreenPosY); + Actor_GetScreenPos(camera->play, camera->target, &targetScreenPosX, &targetScreenPosY); eyeTargetDist = OLib_Vec3fDist(&camera->targetPosRot.pos, &camera->eye); OLib_Vec3fDiffToVecSphGeo(&eyePlayerGeo, &playerhead.pos, &camera->eyeNext); sp4A = eyePlayerGeo.yaw - playerTargetGeo.yaw; @@ -5997,7 +5995,7 @@ s32 Camera_Demo5(Camera* camera) { // the target is a door. D_8011D954[0].timerInit = camera->timer - 5; sp4A = 0; - if (!func_800C0D34(camera->globalCtx, camera->target, &sp4A)) { + if (!func_800C0D34(camera->play, camera->target, &sp4A)) { osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: attention demo: this door is dummy door!\n" VT_RST); if (ABS(playerTargetGeo.yaw - camera->target->shape.rot.y) >= 0x4000) { sp4A = camera->target->shape.rot.y; @@ -6050,7 +6048,7 @@ s32 Camera_Demo5(Camera* camera) { ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D9F4; ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D9F4); if (camera->parentCamId != CAM_ID_MAIN) { - if (camera->globalCtx->state.frames & 1) { + if (camera->play->state.frames & 1) { D_8011D9F4[0].rollTargetInit = -D_8011D9F4[0].rollTargetInit; D_8011D9F4[1].rollTargetInit = -D_8011D9F4[1].rollTargetInit; } @@ -6061,12 +6059,12 @@ s32 Camera_Demo5(Camera* camera) { } } - framesDiff = sDemo5PrevSfxFrame - camera->globalCtx->state.frames; + framesDiff = sDemo5PrevSfxFrame - camera->play->state.frames; if ((framesDiff > 50) || (framesDiff < -50)) { func_80078884(camera->data1); } - sDemo5PrevSfxFrame = camera->globalCtx->state.frames; + sDemo5PrevSfxFrame = camera->play->state.frames; if (camera->player->stateFlags1 & PLAYER_STATE1_27 && (player->currentBoots != PLAYER_BOOTS_IRON)) { // swimming, and not iron boots @@ -6076,21 +6074,21 @@ s32 Camera_Demo5(Camera* camera) { } else { sp4A = playerhead.rot.y - playerTargetGeo.yaw; if (camera->target->category == ACTORCAT_PLAYER) { - framesDiff = camera->globalCtx->state.frames - sDemo5PrevAction12Frame; + framesDiff = camera->play->state.frames - sDemo5PrevAction12Frame; if (player->stateFlags1 & PLAYER_STATE1_11) { // holding object over head. - func_8002DF54(camera->globalCtx, camera->target, 8); + func_8002DF54(camera->play, camera->target, 8); } else if (ABS(framesDiff) > 3000) { - func_8002DF54(camera->globalCtx, camera->target, 12); + func_8002DF54(camera->play, camera->target, 12); } else { - func_8002DF54(camera->globalCtx, camera->target, 69); + func_8002DF54(camera->play, camera->target, 69); } } else { - func_8002DF54(camera->globalCtx, camera->target, 1); + func_8002DF54(camera->play, camera->target, 1); } } - sDemo5PrevAction12Frame = camera->globalCtx->state.frames; + sDemo5PrevAction12Frame = camera->play->state.frames; Camera_ChangeSettingFlags(camera, CAM_SET_CS_C, (4 | 1)); Camera_Unique9(camera); return true; @@ -6111,7 +6109,7 @@ s32 Camera_Demo6(Camera* camera) { s16 stateTimers[4]; Demo6ReadWriteData* rwData = &camera->paramData.demo6.rwData; - mainCam = Play_GetCamera(camera->globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(camera->play, CAM_ID_MAIN); camFocus = camera->target; stateTimers[1] = 0x37; stateTimers[2] = 0x46; @@ -6145,7 +6143,7 @@ s32 Camera_Demo6(Camera* camera) { camera->animState++; case 1: if (stateTimers[camera->animState] < rwData->animTimer) { - func_8002DF54(camera->globalCtx, &camera->player->actor, 8); + func_8002DF54(camera->play, &camera->player->actor, 8); Actor_GetWorld(&focusPosRot, camFocus); rwData->atTarget.x = focusPosRot.pos.x; rwData->atTarget.y = focusPosRot.pos.y - 20.0f; @@ -6216,7 +6214,7 @@ s32 Camera_Demo9(Camera* camera) { f32* camFOV = &camera->fov; Demo9ReadWriteData* rwData = &camera->paramData.demo9.rwData; - mainCam = Play_GetCamera(camera->globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(camera->play, CAM_ID_MAIN); mainCamPlayerPosRot = &mainCam->playerPosRot; if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; @@ -6306,7 +6304,7 @@ s32 Camera_Demo9(Camera* camera) { if (rwData->finishAction == 0x2000) { // finish action = 0x2000, run OnePointCs 0x3FC (Dramatic Return to Link) onePointTimer = onePointCamData->initTimer < 50 ? 5 : onePointCamData->initTimer / 5; - OnePointCutscene_Init(camera->globalCtx, 1020, onePointTimer, NULL, camera->parentCamId); + OnePointCutscene_Init(camera->play, 1020, onePointTimer, NULL, camera->parentCamId); } } else { // finish action = 0x1000, copy the current camera's values to the @@ -6529,7 +6527,7 @@ s32 Camera_Special7(Camera* camera) { yOffset = Player_GetHeight(camera->player); if (camera->animState == 0) { - if (camera->globalCtx->sceneNum == SCENE_JYASINZOU) { + if (camera->play->sceneNum == SCENE_JYASINZOU) { // Spirit Temple rwData->index = 3; } else if (playerPosRot->pos.x < 1500.0f) { @@ -6754,7 +6752,7 @@ s32 Camera_Special9(Camera* camera) { // 0xE38 ~ 20 degrees eyeAdjustment.pitch = 0xE38; // 0xAAA ~ 15 degrees. - yaw = 0xAAA * ((camera->globalCtx->state.frames & 1) ? 1 : -1); + yaw = 0xAAA * ((camera->play->state.frames & 1) ? 1 : -1); eyeAdjustment.yaw = rwData->targetYaw + yaw; eyeAdjustment.r = 200.0f * yNormal; Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeAdjustment); @@ -6826,12 +6824,12 @@ s32 Camera_Special9(Camera* camera) { return true; } -Camera* Camera_Create(View* view, CollisionContext* colCtx, GlobalContext* globalCtx) { +Camera* Camera_Create(View* view, CollisionContext* colCtx, PlayState* play) { Camera* newCamera = ZeldaArena_MallocDebug(sizeof(*newCamera), "../z_camera.c", 9370); if (newCamera != NULL) { osSyncPrintf(VT_FGCOL(BLUE) "camera: create --- allocate %d byte" VT_RST "\n", sizeof(*newCamera) * 4); - Camera_Init(newCamera, view, colCtx, globalCtx); + Camera_Init(newCamera, view, colCtx, play); } else { osSyncPrintf(VT_COL(RED, WHITE) "camera: create: not enough memory\n" VT_RST); } @@ -6847,7 +6845,7 @@ void Camera_Destroy(Camera* camera) { } } -void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalContext* globalCtx) { +void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState* play) { Camera* camP; s32 i; s16 curUID; @@ -6867,7 +6865,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon sInitRegs = false; PREG(88) = -1; } - camera->globalCtx = D_8015BD7C = globalCtx; + camera->play = D_8015BD7C = play; DbCamera_Init(&D_8015BD80, camera); curUID = sNextUID; sNextUID++; @@ -6877,7 +6875,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon } for (j = 0; j < NUM_CAMS; j++) { - camP = camera->globalCtx->cameraPtrs[j]; + camP = camera->play->cameraPtrs[j]; if (camP != NULL && curUID == camP->uid) { break; } @@ -6926,11 +6924,11 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon } void func_80057FC4(Camera* camera) { - if (camera != &camera->globalCtx->mainCamera) { + if (camera != &camera->play->mainCamera) { camera->prevSetting = camera->setting = CAM_SET_FREE0; camera->unk_14C &= ~0x4; - } else if (camera->globalCtx->roomCtx.curRoom.meshHeader->base.type != 1) { - switch (camera->globalCtx->roomCtx.curRoom.behaviorType1) { + } else if (camera->play->roomCtx.curRoom.meshHeader->base.type != 1) { + switch (camera->play->roomCtx.curRoom.behaviorType1) { case ROOM_BEHAVIOR_TYPE1_1: Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10); camera->prevSetting = camera->setting = CAM_SET_DUNGEON0; @@ -6941,8 +6939,7 @@ void func_80057FC4(Camera* camera) { camera->prevSetting = camera->setting = CAM_SET_NORMAL0; break; default: - osSyncPrintf("camera: room type: default set etc (%d)\n", - camera->globalCtx->roomCtx.curRoom.behaviorType1); + osSyncPrintf("camera: room type: default set etc (%d)\n", camera->play->roomCtx.curRoom.behaviorType1); Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10); camera->prevSetting = camera->setting = CAM_SET_NORMAL0; camera->unk_14C |= 4; @@ -7005,7 +7002,7 @@ void Camera_InitPlayerSettings(Camera* camera, Player* player) { camera->waterPrevCamSetting = -1; camera->unk_14C |= 4; - if (camera == &camera->globalCtx->mainCamera) { + if (camera == &camera->play->mainCamera) { sCameraInterfaceFlags = 0xB200; } else { sCameraInterfaceFlags = 0; @@ -7059,13 +7056,13 @@ void Camera_PrintSettings(Camera* camera) { char sp48[8]; s32 i; - if ((OREG(0) & 1) && (camera->globalCtx->activeCamId == camera->camId) && !gDbgCamEnabled) { + if ((OREG(0) & 1) && (camera->play->activeCamId == camera->camId) && !gDbgCamEnabled) { for (i = 0; i < NUM_CAMS; i++) { - if (camera->globalCtx->cameraPtrs[i] == NULL) { + if (camera->play->cameraPtrs[i] == NULL) { sp58[i] = '-'; sp48[i] = ' '; } else { - switch (camera->globalCtx->cameraPtrs[i]->status) { + switch (camera->play->cameraPtrs[i]->status) { case 0: sp58[i] = 'c'; break; @@ -7091,7 +7088,7 @@ void Camera_PrintSettings(Camera* camera) { sp58[i] = '\0'; sp48[i] = '\0'; - sp48[camera->globalCtx->activeCamId] = 'a'; + sp48[camera->play->activeCamId] = 'a'; func_8006376C(3, 0x16, 5, sp58); func_8006376C(3, 0x16, 1, sp48); func_8006376C(3, 0x17, 5, "S:"); @@ -7205,7 +7202,7 @@ s32 Camera_UpdateWater(Camera* camera) { if (!(camera->unk_14C & 0x100)) { camera->unk_14C |= 0x100; osSyncPrintf("kankyo changed water, sound on\n"); - Environment_EnableUnderwaterLights(camera->globalCtx, waterLightsIndex); + Environment_EnableUnderwaterLights(camera->play, waterLightsIndex); camera->waterDistortionTimer = 80; } @@ -7228,7 +7225,7 @@ s32 Camera_UpdateWater(Camera* camera) { if (camera->waterDistortionTimer > 0) { camera->waterDistortionTimer--; camera->distortionFlags |= DISTORTION_UNDERWATER_STRONG; - } else if (camera->globalCtx->sceneNum == SCENE_TURIBORI) { + } else if (camera->play->sceneNum == SCENE_TURIBORI) { camera->distortionFlags |= DISTORTION_UNDERWATER_FISHING; } else { camera->distortionFlags |= DISTORTION_UNDERWATER_WEAK; @@ -7237,7 +7234,7 @@ s32 Camera_UpdateWater(Camera* camera) { if (camera->unk_14C & 0x100) { camera->unk_14C &= ~0x100; osSyncPrintf("kankyo changed water off, sound off\n"); - Environment_DisableUnderwaterLights(camera->globalCtx); + Environment_DisableUnderwaterLights(camera->play); if (*quakeId != 0) { Quake_RemoveFromIdx(*quakeId); } @@ -7251,7 +7248,7 @@ s32 Camera_UpdateWater(Camera* camera) { s32 Camera_UpdateHotRoom(Camera* camera) { camera->distortionFlags &= ~DISTORTION_HOT_ROOM; - if (camera->globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { + if (camera->play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { camera->distortionFlags |= DISTORTION_HOT_ROOM; } @@ -7261,7 +7258,7 @@ s32 Camera_UpdateHotRoom(Camera* camera) { s32 Camera_DbgChangeMode(Camera* camera) { s32 changeDir = 0; - if (!gDbgCamEnabled && camera->globalCtx->activeCamId == CAM_ID_MAIN) { + if (!gDbgCamEnabled && camera->play->activeCamId == CAM_ID_MAIN) { if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CUP)) { osSyncPrintf("attention sound URGENCY\n"); func_80078884(NA_SE_SY_ATTENTION_URGENCY); @@ -7357,17 +7354,17 @@ void Camera_UpdateDistortion(Camera* camera) { depthPhase += CAM_DEG_TO_BINANG(depthPhaseStep); screenPlanePhase += CAM_DEG_TO_BINANG(screenPlanePhaseStep); - View_SetDistortionOrientation(&camera->globalCtx->view, Math_CosS(depthPhase) * 0.0f, - Math_SinS(depthPhase) * 0.0f, Math_SinS(screenPlanePhase) * 0.0f); - View_SetDistortionScale(&camera->globalCtx->view, Math_SinS(screenPlanePhase) * (xScale * scaleFactor) + 1.0f, + View_SetDistortionOrientation(&camera->play->view, Math_CosS(depthPhase) * 0.0f, Math_SinS(depthPhase) * 0.0f, + Math_SinS(screenPlanePhase) * 0.0f); + View_SetDistortionScale(&camera->play->view, Math_SinS(screenPlanePhase) * (xScale * scaleFactor) + 1.0f, Math_CosS(screenPlanePhase) * (yScale * scaleFactor) + 1.0f, Math_CosS(depthPhase) * (zScale * scaleFactor) + 1.0f); - View_SetDistortionSpeed(&camera->globalCtx->view, speed * speedFactor); + View_SetDistortionSpeed(&camera->play->view, speed * speedFactor); camera->unk_14C |= 0x40; } else if (camera->unk_14C & 0x40) { - View_ClearDistortion(&camera->globalCtx->view); + View_ClearDistortion(&camera->play->view); camera->unk_14C &= ~0x40; } } @@ -7388,7 +7385,7 @@ Vec3s Camera_Update(Camera* camera) { QuakeCamCalc quake; Player* player; - player = camera->globalCtx->cameraPtrs[CAM_ID_MAIN]->player; + player = camera->play->cameraPtrs[CAM_ID_MAIN]->player; if (R_DBG_CAM_UPDATE) { osSyncPrintf("camera: in %x\n", camera); @@ -7415,8 +7412,8 @@ Vec3s Camera_Update(Camera* camera) { spAC = curPlayerPosRot.pos; spAC.y += Player_GetHeight(camera->player); - playerGroundY = BgCheck_EntityRaycastFloor5(camera->globalCtx, &camera->globalCtx->colCtx, &playerFloorPoly, - &bgId, &camera->player->actor, &spAC); + playerGroundY = BgCheck_EntityRaycastFloor5(camera->play, &camera->play->colCtx, &playerFloorPoly, &bgId, + &camera->player->actor, &spAC); if (playerGroundY != BGCHECK_Y_MIN) { // player is above ground. sOOBTimer = 0; @@ -7499,10 +7496,10 @@ Vec3s Camera_Update(Camera* camera) { D_8011D3F0--; sCameraInterfaceFlags = 0x3200; Camera_UpdateInterface(sCameraInterfaceFlags); - } else if (camera->globalCtx->transitionMode != TRANS_MODE_OFF) { + } else if (camera->play->transitionMode != TRANS_MODE_OFF) { sCameraInterfaceFlags = 0xF200; Camera_UpdateInterface(sCameraInterfaceFlags); - } else if (camera->globalCtx->csCtx.state != CS_STATE_IDLE) { + } else if (camera->play->csCtx.state != CS_STATE_IDLE) { sCameraInterfaceFlags = 0x3200; Camera_UpdateInterface(sCameraInterfaceFlags); } else { @@ -7511,7 +7508,7 @@ Vec3s Camera_Update(Camera* camera) { } if (R_DBG_CAM_UPDATE) { - osSyncPrintf("camera: shrink_and_bitem %x(%d)\n", sCameraInterfaceFlags, camera->globalCtx->transitionMode); + osSyncPrintf("camera: shrink_and_bitem %x(%d)\n", sCameraInterfaceFlags, camera->play->transitionMode); } if (R_DBG_CAM_UPDATE) { @@ -7526,16 +7523,16 @@ Vec3s Camera_Update(Camera* camera) { gDbgCamEnabled ^= 1; if (gDbgCamEnabled) { DbgCamera_Enable(&D_8015BD80, camera); - } else if (camera->globalCtx->csCtx.state != CS_STATE_IDLE) { - func_80064534(camera->globalCtx, &camera->globalCtx->csCtx); + } else if (camera->play->csCtx.state != CS_STATE_IDLE) { + func_80064534(camera->play, &camera->play->csCtx); } } // Debug cam update if (gDbgCamEnabled) { - camera->globalCtx->view.fovy = D_8015BD80.fov; + camera->play->view.fovy = D_8015BD80.fov; DbCamera_Update(&D_8015BD80, camera); - View_LookAt(&camera->globalCtx->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C); + View_LookAt(&camera->play->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C); if (R_DBG_CAM_UPDATE) { osSyncPrintf("camera: debug out\n"); } @@ -7580,13 +7577,13 @@ Vec3s Camera_Update(Camera* camera) { Camera_UpdateDistortion(camera); - if ((camera->globalCtx->sceneNum == SCENE_SPOT00) && (camera->fov < 59.0f)) { - View_SetScale(&camera->globalCtx->view, 0.79f); + if ((camera->play->sceneNum == SCENE_SPOT00) && (camera->fov < 59.0f)) { + View_SetScale(&camera->play->view, 0.79f); } else { - View_SetScale(&camera->globalCtx->view, 1.0f); + View_SetScale(&camera->play->view, 1.0f); } - camera->globalCtx->view.fovy = viewFov; - View_LookAt(&camera->globalCtx->view, &viewEye, &viewAt, &viewUp); + camera->play->view.fovy = viewFov; + View_LookAt(&camera->play->view, &viewEye, &viewAt, &viewUp); camera->camDir.x = eyeAtAngle.pitch; camera->camDir.y = eyeAtAngle.yaw; camera->camDir.z = 0; @@ -7627,18 +7624,18 @@ Vec3s Camera_Update(Camera* camera) { * When the camera's timer is 0, change the camera to its parent */ void Camera_Finish(Camera* camera) { - Camera* mainCam = camera->globalCtx->cameraPtrs[CAM_ID_MAIN]; - Player* player = GET_PLAYER(camera->globalCtx); + Camera* mainCam = camera->play->cameraPtrs[CAM_ID_MAIN]; + Player* player = GET_PLAYER(camera->play); if (camera->timer == 0) { - Play_ChangeCameraStatus(camera->globalCtx, camera->parentCamId, CAM_STAT_ACTIVE); + Play_ChangeCameraStatus(camera->play, camera->parentCamId, CAM_STAT_ACTIVE); if ((camera->parentCamId == CAM_ID_MAIN) && (camera->csId != 0)) { player->actor.freezeTimer = 0; player->stateFlags1 &= ~PLAYER_STATE1_29; if (player->csMode != 0) { - func_8002DF54(camera->globalCtx, &player->actor, 7); + func_8002DF54(camera->play, &player->actor, 7); osSyncPrintf("camera: player demo end!!\n"); } @@ -7659,9 +7656,9 @@ void Camera_Finish(Camera* camera) { camera->childCamId = camera->parentCamId = CAM_ID_MAIN; camera->timer = -1; - camera->globalCtx->envCtx.fillScreen = false; + camera->play->envCtx.fillScreen = false; - Play_ClearCamera(camera->globalCtx, camera->camId); + Play_ClearCamera(camera->play, camera->camId); } } @@ -7675,7 +7672,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) { static s32 modeChangeFlags = 0; if (QREG(89)) { - osSyncPrintf("+=+(%d)+=+ recive request -> %s\n", camera->globalCtx->state.frames, sCameraModeNames[mode]); + osSyncPrintf("+=+(%d)+=+ recive request -> %s\n", camera->play->state.frames, sCameraModeNames[mode]); } if (camera->unk_14C & 0x20 && flags == 0) { @@ -7777,7 +7774,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) { func_80078884(0); break; case 2: - if (camera->globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) { + if (camera->play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) { func_80078884(NA_SE_SY_ATTENTION_URGENCY); } else { func_80078884(NA_SE_SY_ATTENTION_ON); @@ -7824,7 +7821,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) { } } if (((setting == CAM_SET_MEADOW_BIRDS_EYE) || (setting == CAM_SET_MEADOW_UNUSED)) && LINK_IS_ADULT && - (camera->globalCtx->sceneNum == SCENE_SPOT05)) { + (camera->play->sceneNum == SCENE_SPOT05)) { camera->unk_14A |= 0x10; return -5; } @@ -7871,7 +7868,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) { Camera_CopyDataToRegs(camera, camera->mode); } - osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->globalCtx->state.frames, + osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->play->state.frames, camera->camId, sCameraSettingNames[camera->setting]); return setting; @@ -8198,9 +8195,9 @@ s32 func_8005B198(void) { s16 func_8005B1A4(Camera* camera) { camera->unk_14C |= 0x8; - if ((camera->camId == CAM_ID_MAIN) && (camera->globalCtx->activeCamId != CAM_ID_MAIN)) { - GET_ACTIVE_CAM(camera->globalCtx)->unk_14C |= 0x8; - return camera->globalCtx->activeCamId; + if ((camera->camId == CAM_ID_MAIN) && (camera->play->activeCamId != CAM_ID_MAIN)) { + GET_ACTIVE_CAM(camera->play)->unk_14C |= 0x8; + return camera->play->activeCamId; } return camera->camId; diff --git a/src/code/z_camera_data.c b/src/code/z_camera_data.c index 1f457888e5..f7bd995492 100644 --- a/src/code/z_camera_data.c +++ b/src/code/z_camera_data.c @@ -2398,6 +2398,6 @@ s16 D_8011DAFC[] = { CAM_SET_NORMAL0, CAM_SET_NORMAL1, CAM_SET_NORMAL2, CAM_SET_DUNGEON0, CAM_SET_DUNGEON1, CAM_SET_DUNGEON2, }; -GlobalContext* D_8015BD7C; +PlayState* D_8015BD7C; DbCamera D_8015BD80; CollisionPoly* playerFloorPoly; diff --git a/src/code/z_cheap_proc.c b/src/code/z_cheap_proc.c index d611c08d2c..772ef3ec69 100644 --- a/src/code/z_cheap_proc.c +++ b/src/code/z_cheap_proc.c @@ -1,23 +1,23 @@ #include "global.h" -void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 214); +void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist) { + OPEN_DISPS(play->state.gfxCtx, "../z_cheap_proc.c", 214); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 216), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_cheap_proc.c", 216), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dlist); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 219); + CLOSE_DISPS(play->state.gfxCtx, "../z_cheap_proc.c", 219); } -void Gfx_DrawDListXlu(GlobalContext* globalCtx, Gfx* dlist) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 228); +void Gfx_DrawDListXlu(PlayState* play, Gfx* dlist) { + OPEN_DISPS(play->state.gfxCtx, "../z_cheap_proc.c", 228); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 230), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_cheap_proc.c", 230), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, dlist); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 233); + CLOSE_DISPS(play->state.gfxCtx, "../z_cheap_proc.c", 233); } diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 6d63f4ffb8..f0e54f095f 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -2,11 +2,11 @@ #include "vt.h" #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" -typedef s32 (*ColChkResetFunc)(GlobalContext*, Collider*); -typedef void (*ColChkBloodFunc)(GlobalContext*, Collider*, Vec3f*); -typedef void (*ColChkApplyFunc)(GlobalContext*, CollisionCheckContext*, Collider*); -typedef void (*ColChkVsFunc)(GlobalContext*, CollisionCheckContext*, Collider*, Collider*); -typedef s32 (*ColChkLineFunc)(GlobalContext*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*); +typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); +typedef void (*ColChkBloodFunc)(PlayState*, Collider*, Vec3f*); +typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); +typedef void (*ColChkVsFunc)(PlayState*, CollisionCheckContext*, Collider*, Collider*); +typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*); typedef struct { /* 0 */ u8 blood; @@ -100,7 +100,7 @@ void Collider_DrawPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC, CLOSE_DISPS(gfxCtx, "../z_collision_check.c", 757); } -s32 Collider_InitBase(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_InitBase(PlayState* play, Collider* collider) { static Collider init = { NULL, NULL, NULL, NULL, AT_NONE, AC_NONE, OC1_NONE, OC2_NONE, COLTYPE_HIT3, COLSHAPE_MAX, }; @@ -109,14 +109,14 @@ s32 Collider_InitBase(GlobalContext* globalCtx, Collider* collider) { return true; } -s32 Collider_DestroyBase(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_DestroyBase(PlayState* play, Collider* collider) { return true; } /** * Uses default OC2_TYPE_1 and COLTYPE_HIT0 */ -s32 Collider_SetBaseToActor(GlobalContext* globalCtx, Collider* collider, ColliderInitToActor* src) { +s32 Collider_SetBaseToActor(PlayState* play, Collider* collider, ColliderInitToActor* src) { collider->actor = src->actor; collider->atFlags = src->atFlags; collider->acFlags = src->acFlags; @@ -129,7 +129,7 @@ s32 Collider_SetBaseToActor(GlobalContext* globalCtx, Collider* collider, Collid /** * Uses default OC2_TYPE_1 */ -s32 Collider_SetBaseType1(GlobalContext* globalCtx, Collider* collider, Actor* actor, ColliderInitType1* src) { +s32 Collider_SetBaseType1(PlayState* play, Collider* collider, Actor* actor, ColliderInitType1* src) { collider->actor = actor; collider->colType = src->colType; collider->atFlags = src->atFlags; @@ -140,7 +140,7 @@ s32 Collider_SetBaseType1(GlobalContext* globalCtx, Collider* collider, Actor* a return true; } -s32 Collider_SetBase(GlobalContext* globalCtx, Collider* collider, Actor* actor, ColliderInit* src) { +s32 Collider_SetBase(PlayState* play, Collider* collider, Actor* actor, ColliderInit* src) { collider->actor = actor; collider->colType = src->colType; collider->atFlags = src->atFlags; @@ -151,62 +151,62 @@ s32 Collider_SetBase(GlobalContext* globalCtx, Collider* collider, Actor* actor, return true; } -void Collider_ResetATBase(GlobalContext* globalCtx, Collider* collider) { +void Collider_ResetATBase(PlayState* play, Collider* collider) { collider->at = NULL; collider->atFlags &= ~(AT_HIT | AT_BOUNCED); } -void Collider_ResetACBase(GlobalContext* globalCtx, Collider* collider) { +void Collider_ResetACBase(PlayState* play, Collider* collider) { collider->ac = NULL; collider->acFlags &= ~(AC_HIT | AC_BOUNCED); } -void Collider_ResetOCBase(GlobalContext* globalCtx, Collider* collider) { +void Collider_ResetOCBase(PlayState* play, Collider* collider) { collider->oc = NULL; collider->ocFlags1 &= ~OC1_HIT; collider->ocFlags2 &= ~OC2_HIT_PLAYER; } -s32 Collider_InitTouch(GlobalContext* globalCtx, ColliderTouch* touch) { +s32 Collider_InitTouch(PlayState* play, ColliderTouch* touch) { static ColliderTouch init = { 0x00000000, 0, 0 }; *touch = init; return true; } -s32 Collider_DestroyTouch(GlobalContext* globalCtx, ColliderTouch* touch) { +s32 Collider_DestroyTouch(PlayState* play, ColliderTouch* touch) { return true; } -s32 Collider_SetTouch(GlobalContext* globalCtx, ColliderTouch* dest, ColliderTouch* src) { +s32 Collider_SetTouch(PlayState* play, ColliderTouch* dest, ColliderTouch* src) { dest->dmgFlags = src->dmgFlags; dest->effect = src->effect; dest->damage = src->damage; return true; } -void Collider_ResetATInfo_Unk(GlobalContext* globalCtx, ColliderInfo* info) { +void Collider_ResetATInfo_Unk(PlayState* play, ColliderInfo* info) { } -s32 Collider_InitBump(GlobalContext* globalCtx, ColliderBump* bump) { +s32 Collider_InitBump(PlayState* play, ColliderBump* bump) { static ColliderBump init = { 0xFFCFFFFF, 0, 0, { 0, 0, 0 } }; *bump = init; return true; } -s32 Collider_DestroyBump(GlobalContext* globalCtx, ColliderBump* bump) { +s32 Collider_DestroyBump(PlayState* play, ColliderBump* bump) { return true; } -s32 Collider_SetBump(GlobalContext* globalCtx, ColliderBump* bump, ColliderBumpInit* init) { +s32 Collider_SetBump(PlayState* play, ColliderBump* bump, ColliderBumpInit* init) { bump->dmgFlags = init->dmgFlags; bump->effect = init->effect; bump->defense = init->defense; return true; } -s32 Collider_InitInfo(GlobalContext* globalCtx, ColliderInfo* info) { +s32 Collider_InitInfo(PlayState* play, ColliderInfo* info) { static ColliderInfo init = { { 0, 0, 0 }, { 0xFFCFFFFF, 0, 0, { 0, 0, 0 } }, ELEMTYPE_UNK0, TOUCH_NONE, @@ -216,36 +216,36 @@ s32 Collider_InitInfo(GlobalContext* globalCtx, ColliderInfo* info) { }; *info = init; - Collider_InitTouch(globalCtx, &info->toucher); - Collider_InitBump(globalCtx, &info->bumper); + Collider_InitTouch(play, &info->toucher); + Collider_InitBump(play, &info->bumper); return true; } -s32 Collider_DestroyInfo(GlobalContext* globalCtx, ColliderInfo* info) { - Collider_DestroyTouch(globalCtx, &info->toucher); - Collider_DestroyBump(globalCtx, &info->bumper); +s32 Collider_DestroyInfo(PlayState* play, ColliderInfo* info) { + Collider_DestroyTouch(play, &info->toucher); + Collider_DestroyBump(play, &info->bumper); return true; } -s32 Collider_SetInfo(GlobalContext* globalCtx, ColliderInfo* info, ColliderInfoInit* infoInit) { +s32 Collider_SetInfo(PlayState* play, ColliderInfo* info, ColliderInfoInit* infoInit) { info->elemType = infoInit->elemType; - Collider_SetTouch(globalCtx, &info->toucher, &infoInit->toucher); - Collider_SetBump(globalCtx, &info->bumper, &infoInit->bumper); + Collider_SetTouch(play, &info->toucher, &infoInit->toucher); + Collider_SetBump(play, &info->bumper, &infoInit->bumper); info->toucherFlags = infoInit->toucherFlags; info->bumperFlags = infoInit->bumperFlags; info->ocElemFlags = infoInit->ocElemFlags; return true; } -void Collider_ResetATInfo(GlobalContext* globalCtx, ColliderInfo* info) { +void Collider_ResetATInfo(PlayState* play, ColliderInfo* info) { info->atHit = NULL; info->atHitInfo = NULL; info->toucherFlags &= ~TOUCH_HIT; info->toucherFlags &= ~TOUCH_DREW_HITMARK; - Collider_ResetATInfo_Unk(globalCtx, info); + Collider_ResetATInfo_Unk(play, info); } -void Collider_ResetACInfo(GlobalContext* globalCtx, ColliderInfo* info) { +void Collider_ResetACInfo(PlayState* play, ColliderInfo* info) { info->bumper.hitPos.x = info->bumper.hitPos.y = info->bumper.hitPos.z = 0; info->bumperFlags &= ~BUMP_HIT; info->bumperFlags &= ~BUMP_DRAW_HITMARK; @@ -253,11 +253,11 @@ void Collider_ResetACInfo(GlobalContext* globalCtx, ColliderInfo* info) { info->acHitInfo = NULL; } -void Collider_ResetOCInfo(GlobalContext* globalCtx, ColliderInfo* info) { +void Collider_ResetOCInfo(PlayState* play, ColliderInfo* info) { info->ocElemFlags &= ~OCELEM_HIT; } -s32 Collider_InitJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElementDim* dim) { +s32 Collider_InitJntSphElementDim(PlayState* play, ColliderJntSphElementDim* dim) { static ColliderJntSphElementDim init = { { { 0, 0, 0 }, 0 }, { { 0, 0, 0 }, 0 }, @@ -268,56 +268,55 @@ s32 Collider_InitJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElemen return true; } -s32 Collider_DestroyJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElementDim* element) { +s32 Collider_DestroyJntSphElementDim(PlayState* play, ColliderJntSphElementDim* element) { return true; } -s32 Collider_SetJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElementDim* dest, - ColliderJntSphElementDimInit* src) { +s32 Collider_SetJntSphElementDim(PlayState* play, ColliderJntSphElementDim* dest, ColliderJntSphElementDimInit* src) { dest->limb = src->limb; dest->modelSphere = src->modelSphere; dest->scale = src->scale * 0.01f; return true; } -s32 Collider_InitJntSphElement(GlobalContext* globalCtx, ColliderJntSphElement* element) { - Collider_InitInfo(globalCtx, &element->info); - Collider_InitJntSphElementDim(globalCtx, &element->dim); +s32 Collider_InitJntSphElement(PlayState* play, ColliderJntSphElement* element) { + Collider_InitInfo(play, &element->info); + Collider_InitJntSphElementDim(play, &element->dim); return true; } -s32 Collider_DestroyJntSphElement(GlobalContext* globalCtx, ColliderJntSphElement* element) { - Collider_DestroyInfo(globalCtx, &element->info); - Collider_DestroyJntSphElementDim(globalCtx, &element->dim); +s32 Collider_DestroyJntSphElement(PlayState* play, ColliderJntSphElement* element) { + Collider_DestroyInfo(play, &element->info); + Collider_DestroyJntSphElementDim(play, &element->dim); return true; } -s32 Collider_SetJntSphElement(GlobalContext* globalCtx, ColliderJntSphElement* dest, ColliderJntSphElementInit* src) { - Collider_SetInfo(globalCtx, &dest->info, &src->info); - Collider_SetJntSphElementDim(globalCtx, &dest->dim, &src->dim); +s32 Collider_SetJntSphElement(PlayState* play, ColliderJntSphElement* dest, ColliderJntSphElementInit* src) { + Collider_SetInfo(play, &dest->info, &src->info); + Collider_SetJntSphElementDim(play, &dest->dim, &src->dim); return true; } -s32 Collider_ResetJntSphElementAT(GlobalContext* globalCtx, ColliderJntSphElement* collider) { - Collider_ResetATInfo(globalCtx, &collider->info); +s32 Collider_ResetJntSphElementAT(PlayState* play, ColliderJntSphElement* collider) { + Collider_ResetATInfo(play, &collider->info); return true; } -s32 Collider_ResetJntSphElementAC(GlobalContext* globalCtx, ColliderJntSphElement* collider) { - Collider_ResetACInfo(globalCtx, &collider->info); +s32 Collider_ResetJntSphElementAC(PlayState* play, ColliderJntSphElement* collider) { + Collider_ResetACInfo(play, &collider->info); return true; } -s32 Collider_ResetJntSphElementOC(GlobalContext* globalCtx, ColliderJntSphElement* collider) { - Collider_ResetOCInfo(globalCtx, &collider->info); +s32 Collider_ResetJntSphElementOC(PlayState* play, ColliderJntSphElement* collider) { + Collider_ResetOCInfo(play, &collider->info); return true; } /** * Initializes a ColliderJntSph to default values */ -s32 Collider_InitJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { - Collider_InitBase(globalCtx, &collider->base); +s32 Collider_InitJntSph(PlayState* play, ColliderJntSph* collider) { + Collider_InitBase(play, &collider->base); collider->count = 0; collider->elements = NULL; return true; @@ -326,12 +325,12 @@ s32 Collider_InitJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { /** * Destroys a dynamically allocated ColliderJntSph */ -s32 Collider_FreeJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { +s32 Collider_FreeJntSph(PlayState* play, ColliderJntSph* collider) { ColliderJntSphElement* element; - Collider_DestroyBase(globalCtx, &collider->base); + Collider_DestroyBase(play, &collider->base); for (element = collider->elements; element < collider->elements + collider->count; element++) { - Collider_DestroyJntSphElement(globalCtx, element); + Collider_DestroyJntSphElement(play, element); } collider->count = 0; @@ -345,12 +344,12 @@ s32 Collider_FreeJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { /** * Destroys a preallocated ColliderJntSph */ -s32 Collider_DestroyJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { +s32 Collider_DestroyJntSph(PlayState* play, ColliderJntSph* collider) { ColliderJntSphElement* element; - Collider_DestroyBase(globalCtx, &collider->base); + Collider_DestroyBase(play, &collider->base); for (element = collider->elements; element < collider->elements + collider->count; element++) { - Collider_DestroyJntSphElement(globalCtx, element); + Collider_DestroyJntSphElement(play, element); } collider->count = 0; collider->elements = NULL; @@ -361,11 +360,11 @@ s32 Collider_DestroyJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { * Sets up the ColliderJntSph using the values in src, sets it to the actor specified in src, and dynamically allocates * the element array. Uses default OC2_TYPE_1 and COLTYPE_HIT0. Unused. */ -s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* dest, ColliderJntSphInitToActor* src) { +s32 Collider_SetJntSphToActor(PlayState* play, ColliderJntSph* dest, ColliderJntSphInitToActor* src) { ColliderJntSphElement* destElem; ColliderJntSphElementInit* srcElem; - Collider_SetBaseToActor(globalCtx, &dest->base, &src->base); + Collider_SetBaseToActor(play, &dest->base, &src->base); dest->count = src->count; dest->elements = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphElement), "../z_collision_check.c", 1443); @@ -379,8 +378,8 @@ s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* dest, Co for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitJntSphElement(globalCtx, destElem); - Collider_SetJntSphElement(globalCtx, destElem, srcElem); + Collider_InitJntSphElement(play, destElem); + Collider_SetJntSphElement(play, destElem, srcElem); } return true; } @@ -389,12 +388,11 @@ s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* dest, Co * Sets up the ColliderJntSph using the values in src and dynamically allocates the element array. Uses default * OC2_TYPE_1. Only used by En_Nwc, an unused and unfinished actor. */ -s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, - ColliderJntSphInitType1* src) { +s32 Collider_SetJntSphAllocType1(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInitType1* src) { ColliderJntSphElement* destElem; ColliderJntSphElementInit* srcElem; - Collider_SetBaseType1(globalCtx, &dest->base, actor, &src->base); + Collider_SetBaseType1(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphElement), "../z_collision_check.c", 1490); @@ -408,8 +406,8 @@ s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* dest, for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitJntSphElement(globalCtx, destElem); - Collider_SetJntSphElement(globalCtx, destElem, srcElem); + Collider_InitJntSphElement(play, destElem); + Collider_SetJntSphElement(play, destElem, srcElem); } return true; } @@ -418,11 +416,11 @@ s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* dest, * Sets up the ColliderJntSph using the values in src and dynamically allocates the element array. * Unused. */ -s32 Collider_SetJntSphAlloc(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src) { +s32 Collider_SetJntSphAlloc(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src) { ColliderJntSphElement* destElem; ColliderJntSphElementInit* srcElem; - Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + Collider_SetBase(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphElement), "../z_collision_check.c", 1551); @@ -435,8 +433,8 @@ s32 Collider_SetJntSphAlloc(GlobalContext* globalCtx, ColliderJntSph* dest, Acto } for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitJntSphElement(globalCtx, destElem); - Collider_SetJntSphElement(globalCtx, destElem, srcElem); + Collider_InitJntSphElement(play, destElem); + Collider_SetJntSphElement(play, destElem, srcElem); } return true; } @@ -444,20 +442,20 @@ s32 Collider_SetJntSphAlloc(GlobalContext* globalCtx, ColliderJntSph* dest, Acto /** * Sets up the ColliderJntSph using the values in src, placing the element array in elements. */ -s32 Collider_SetJntSph(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src, +s32 Collider_SetJntSph(PlayState* play, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src, ColliderJntSphElement* elements) { ColliderJntSphElement* destElem; ColliderJntSphElementInit* srcElem; - Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + Collider_SetBase(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = elements; ASSERT(dest->elements != NULL, "pclobj_jntsph->elem_tbl != NULL", "../z_collision_check.c", 1603); for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitJntSphElement(globalCtx, destElem); - Collider_SetJntSphElement(globalCtx, destElem, srcElem); + Collider_InitJntSphElement(play, destElem); + Collider_SetJntSphElement(play, destElem, srcElem); } return true; } @@ -465,14 +463,14 @@ s32 Collider_SetJntSph(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* ac /** * Resets the collider's AT collision flags. */ -s32 Collider_ResetJntSphAT(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetJntSphAT(PlayState* play, Collider* collider) { ColliderJntSphElement* element; ColliderJntSph* jntSph = (ColliderJntSph*)collider; - Collider_ResetATBase(globalCtx, &jntSph->base); + Collider_ResetATBase(play, &jntSph->base); for (element = jntSph->elements; element < jntSph->elements + jntSph->count; element++) { - Collider_ResetJntSphElementAT(globalCtx, element); + Collider_ResetJntSphElementAT(play, element); } return true; } @@ -480,14 +478,14 @@ s32 Collider_ResetJntSphAT(GlobalContext* globalCtx, Collider* collider) { /** * Resets the collider's AC collision flags. */ -s32 Collider_ResetJntSphAC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetJntSphAC(PlayState* play, Collider* collider) { ColliderJntSphElement* element; ColliderJntSph* jntSph = (ColliderJntSph*)collider; - Collider_ResetACBase(globalCtx, &jntSph->base); + Collider_ResetACBase(play, &jntSph->base); for (element = jntSph->elements; element < jntSph->elements + jntSph->count; element++) { - Collider_ResetJntSphElementAC(globalCtx, element); + Collider_ResetJntSphElementAC(play, element); } return true; } @@ -495,30 +493,30 @@ s32 Collider_ResetJntSphAC(GlobalContext* globalCtx, Collider* collider) { /** * Resets the collider's OC collision flags. */ -s32 Collider_ResetJntSphOC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetJntSphOC(PlayState* play, Collider* collider) { ColliderJntSphElement* element; ColliderJntSph* jntSph = (ColliderJntSph*)collider; - Collider_ResetOCBase(globalCtx, &jntSph->base); + Collider_ResetOCBase(play, &jntSph->base); for (element = jntSph->elements; element < jntSph->elements + jntSph->count; element++) { - Collider_ResetJntSphElementOC(globalCtx, element); + Collider_ResetJntSphElementOC(play, element); } return true; } -s32 Collider_InitCylinderDim(GlobalContext* globalCtx, Cylinder16* dim) { +s32 Collider_InitCylinderDim(PlayState* play, Cylinder16* dim) { Cylinder16 init = { 0, 0, 0, { 0, 0, 0 } }; *dim = init; return true; } -s32 Collider_DestroyCylinderDim(GlobalContext* globalCtx, Cylinder16* dim) { +s32 Collider_DestroyCylinderDim(PlayState* play, Cylinder16* dim) { return true; } -s32 Collider_SetCylinderDim(GlobalContext* globalCtx, Cylinder16* dest, Cylinder16* src) { +s32 Collider_SetCylinderDim(PlayState* play, Cylinder16* dest, Cylinder16* src) { *dest = *src; return true; } @@ -526,20 +524,20 @@ s32 Collider_SetCylinderDim(GlobalContext* globalCtx, Cylinder16* dest, Cylinder /** * Initializes a ColliderCylinder to default values */ -s32 Collider_InitCylinder(GlobalContext* globalCtx, ColliderCylinder* collider) { - Collider_InitBase(globalCtx, &collider->base); - Collider_InitInfo(globalCtx, &collider->info); - Collider_InitCylinderDim(globalCtx, &collider->dim); +s32 Collider_InitCylinder(PlayState* play, ColliderCylinder* collider) { + Collider_InitBase(play, &collider->base); + Collider_InitInfo(play, &collider->info); + Collider_InitCylinderDim(play, &collider->dim); return true; } /** * Destroys a ColliderCylinder */ -s32 Collider_DestroyCylinder(GlobalContext* globalCtx, ColliderCylinder* collider) { - Collider_DestroyBase(globalCtx, &collider->base); - Collider_DestroyInfo(globalCtx, &collider->info); - Collider_DestroyCylinderDim(globalCtx, &collider->dim); +s32 Collider_DestroyCylinder(PlayState* play, ColliderCylinder* collider) { + Collider_DestroyBase(play, &collider->base); + Collider_DestroyInfo(play, &collider->info); + Collider_DestroyCylinderDim(play, &collider->dim); return true; } @@ -547,70 +545,68 @@ s32 Collider_DestroyCylinder(GlobalContext* globalCtx, ColliderCylinder* collide * Sets up the ColliderCylinder using the values in src and sets it to the actor specified in src. Uses default * OC2_TYPE_1 and COLTYPE_0. Used only by DekuJr, who sets it to himself anyways. */ -s32 Collider_SetCylinderToActor(GlobalContext* globalCtx, ColliderCylinder* collider, - ColliderCylinderInitToActor* src) { - Collider_SetBaseToActor(globalCtx, &collider->base, &src->base); - Collider_SetInfo(globalCtx, &collider->info, &src->info); - Collider_SetCylinderDim(globalCtx, &collider->dim, &src->dim); +s32 Collider_SetCylinderToActor(PlayState* play, ColliderCylinder* collider, ColliderCylinderInitToActor* src) { + Collider_SetBaseToActor(play, &collider->base, &src->base); + Collider_SetInfo(play, &collider->info, &src->info); + Collider_SetCylinderDim(play, &collider->dim, &src->dim); return true; } /** * Sets up the ColliderCylinder using the values in src. Uses default OC2_TYPE_1 */ -s32 Collider_SetCylinderType1(GlobalContext* globalCtx, ColliderCylinder* collider, Actor* actor, +s32 Collider_SetCylinderType1(PlayState* play, ColliderCylinder* collider, Actor* actor, ColliderCylinderInitType1* src) { - Collider_SetBaseType1(globalCtx, &collider->base, actor, &src->base); - Collider_SetInfo(globalCtx, &collider->info, &src->info); - Collider_SetCylinderDim(globalCtx, &collider->dim, &src->dim); + Collider_SetBaseType1(play, &collider->base, actor, &src->base); + Collider_SetInfo(play, &collider->info, &src->info); + Collider_SetCylinderDim(play, &collider->dim, &src->dim); return true; } /** * Sets up the ColliderCylinder using the values in src. */ -s32 Collider_SetCylinder(GlobalContext* globalCtx, ColliderCylinder* collider, Actor* actor, - ColliderCylinderInit* src) { - Collider_SetBase(globalCtx, &collider->base, actor, &src->base); - Collider_SetInfo(globalCtx, &collider->info, &src->info); - Collider_SetCylinderDim(globalCtx, &collider->dim, &src->dim); +s32 Collider_SetCylinder(PlayState* play, ColliderCylinder* collider, Actor* actor, ColliderCylinderInit* src) { + Collider_SetBase(play, &collider->base, actor, &src->base); + Collider_SetInfo(play, &collider->info, &src->info); + Collider_SetCylinderDim(play, &collider->dim, &src->dim); return true; } /** * Resets the collider's AT collision flags. */ -s32 Collider_ResetCylinderAT(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetCylinderAT(PlayState* play, Collider* collider) { ColliderCylinder* cylinder = (ColliderCylinder*)collider; - Collider_ResetATBase(globalCtx, &cylinder->base); - Collider_ResetATInfo(globalCtx, &cylinder->info); + Collider_ResetATBase(play, &cylinder->base); + Collider_ResetATInfo(play, &cylinder->info); return true; } /** * Resets the collider's AC collision flags. */ -s32 Collider_ResetCylinderAC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetCylinderAC(PlayState* play, Collider* collider) { ColliderCylinder* cylinder = (ColliderCylinder*)collider; - Collider_ResetACBase(globalCtx, &cylinder->base); - Collider_ResetACInfo(globalCtx, &cylinder->info); + Collider_ResetACBase(play, &cylinder->base); + Collider_ResetACInfo(play, &cylinder->info); return true; } /** * Resets the collider's OC collision flags. */ -s32 Collider_ResetCylinderOC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetCylinderOC(PlayState* play, Collider* collider) { ColliderCylinder* cylinder = (ColliderCylinder*)collider; - Collider_ResetOCBase(globalCtx, &cylinder->base); - Collider_ResetOCInfo(globalCtx, &cylinder->info); + Collider_ResetOCBase(play, &cylinder->base); + Collider_ResetOCInfo(play, &cylinder->info); return true; } -s32 Collider_InitTrisElementDim(GlobalContext* globalCtx, TriNorm* dim) { +s32 Collider_InitTrisElementDim(PlayState* play, TriNorm* dim) { static TriNorm init = { { { 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 }, @@ -620,11 +616,11 @@ s32 Collider_InitTrisElementDim(GlobalContext* globalCtx, TriNorm* dim) { return true; } -s32 Collider_DestroyTrisElementDim(GlobalContext* globalCtx, TriNorm* dim) { +s32 Collider_DestroyTrisElementDim(PlayState* play, TriNorm* dim) { return true; } -s32 Collider_SetTrisElementDim(GlobalContext* globalCtx, TriNorm* dest, ColliderTrisElementDimInit* src) { +s32 Collider_SetTrisElementDim(PlayState* play, TriNorm* dest, ColliderTrisElementDimInit* src) { Vec3f* destVtx; Vec3f* srcVtx; f32 nx; @@ -645,44 +641,44 @@ s32 Collider_SetTrisElementDim(GlobalContext* globalCtx, TriNorm* dest, Collider return true; } -s32 Collider_InitTrisElement(GlobalContext* globalCtx, ColliderTrisElement* collider) { - Collider_InitInfo(globalCtx, &collider->info); - Collider_InitTrisElementDim(globalCtx, &collider->dim); +s32 Collider_InitTrisElement(PlayState* play, ColliderTrisElement* collider) { + Collider_InitInfo(play, &collider->info); + Collider_InitTrisElementDim(play, &collider->dim); return true; } -s32 Collider_DestroyTrisElement(GlobalContext* globalCtx, ColliderTrisElement* collider) { - Collider_DestroyInfo(globalCtx, &collider->info); - Collider_DestroyTrisElementDim(globalCtx, &collider->dim); +s32 Collider_DestroyTrisElement(PlayState* play, ColliderTrisElement* collider) { + Collider_DestroyInfo(play, &collider->info); + Collider_DestroyTrisElementDim(play, &collider->dim); return true; } -s32 Collider_SetTrisElement(GlobalContext* globalCtx, ColliderTrisElement* dest, ColliderTrisElementInit* src) { - Collider_SetInfo(globalCtx, &dest->info, &src->info); - Collider_SetTrisElementDim(globalCtx, &dest->dim, &src->dim); +s32 Collider_SetTrisElement(PlayState* play, ColliderTrisElement* dest, ColliderTrisElementInit* src) { + Collider_SetInfo(play, &dest->info, &src->info); + Collider_SetTrisElementDim(play, &dest->dim, &src->dim); return true; } -s32 Collider_ResetTrisElementAT(GlobalContext* globalCtx, ColliderTrisElement* element) { - Collider_ResetATInfo(globalCtx, &element->info); +s32 Collider_ResetTrisElementAT(PlayState* play, ColliderTrisElement* element) { + Collider_ResetATInfo(play, &element->info); return true; } -s32 Collider_ResetTrisElementAC(GlobalContext* globalCtx, ColliderTrisElement* element) { - Collider_ResetACInfo(globalCtx, &element->info); +s32 Collider_ResetTrisElementAC(PlayState* play, ColliderTrisElement* element) { + Collider_ResetACInfo(play, &element->info); return true; } -s32 Collider_ResetTrisElementOC(GlobalContext* globalCtx, ColliderTrisElement* element) { - Collider_ResetOCInfo(globalCtx, &element->info); +s32 Collider_ResetTrisElementOC(PlayState* play, ColliderTrisElement* element) { + Collider_ResetOCInfo(play, &element->info); return true; } /** * Initializes a ColliderTris to default values */ -s32 Collider_InitTris(GlobalContext* globalCtx, ColliderTris* tris) { - Collider_InitBase(globalCtx, &tris->base); +s32 Collider_InitTris(PlayState* play, ColliderTris* tris) { + Collider_InitBase(play, &tris->base); tris->count = 0; tris->elements = 0; return true; @@ -692,12 +688,12 @@ s32 Collider_InitTris(GlobalContext* globalCtx, ColliderTris* tris) { * Destroys a dynamically allocated ColliderTris * Unused */ -s32 Collider_FreeTris(GlobalContext* globalCtx, ColliderTris* tris) { +s32 Collider_FreeTris(PlayState* play, ColliderTris* tris) { ColliderTrisElement* element; - Collider_DestroyBase(globalCtx, &tris->base); + Collider_DestroyBase(play, &tris->base); for (element = tris->elements; element < tris->elements + tris->count; element++) { - Collider_DestroyTrisElement(globalCtx, element); + Collider_DestroyTrisElement(play, element); } tris->count = 0; @@ -711,12 +707,12 @@ s32 Collider_FreeTris(GlobalContext* globalCtx, ColliderTris* tris) { /** * Destroys a preallocated ColliderTris */ -s32 Collider_DestroyTris(GlobalContext* globalCtx, ColliderTris* tris) { +s32 Collider_DestroyTris(PlayState* play, ColliderTris* tris) { ColliderTrisElement* element; - Collider_DestroyBase(globalCtx, &tris->base); + Collider_DestroyBase(play, &tris->base); for (element = tris->elements; element < tris->elements + tris->count; element++) { - Collider_DestroyTrisElement(globalCtx, element); + Collider_DestroyTrisElement(play, element); } tris->count = 0; @@ -728,11 +724,11 @@ s32 Collider_DestroyTris(GlobalContext* globalCtx, ColliderTris* tris) { * Sets up the ColliderTris using the values in src and dynamically allocates the element array. Uses default OC2_TYPE_1 * Unused. */ -s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInitType1* src) { +s32 Collider_SetTrisAllocType1(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInitType1* src) { ColliderTrisElement* destElem; ColliderTrisElementInit* srcElem; - Collider_SetBaseType1(globalCtx, &dest->base, actor, &src->base); + Collider_SetBaseType1(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = ZeldaArena_MallocDebug(dest->count * sizeof(ColliderTrisElement), "../z_collision_check.c", 2156); if (dest->elements == NULL) { @@ -744,8 +740,8 @@ s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* dest, Act } for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitTrisElement(globalCtx, destElem); - Collider_SetTrisElement(globalCtx, destElem, srcElem); + Collider_InitTrisElement(play, destElem); + Collider_SetTrisElement(play, destElem, srcElem); } return true; } @@ -754,11 +750,11 @@ s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* dest, Act * Sets up the ColliderTris using the values in src and dynamically allocates the element array. * Unused */ -s32 Collider_SetTrisAlloc(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInit* src) { +s32 Collider_SetTrisAlloc(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInit* src) { ColliderTrisElement* destElem; ColliderTrisElementInit* srcElem; - Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + Collider_SetBase(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = ZeldaArena_MallocDebug(dest->count * sizeof(ColliderTrisElement), "../z_collision_check.c", 2207); @@ -772,8 +768,8 @@ s32 Collider_SetTrisAlloc(GlobalContext* globalCtx, ColliderTris* dest, Actor* a for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitTrisElement(globalCtx, destElem); - Collider_SetTrisElement(globalCtx, destElem, srcElem); + Collider_InitTrisElement(play, destElem); + Collider_SetTrisElement(play, destElem, srcElem); } return true; } @@ -781,20 +777,20 @@ s32 Collider_SetTrisAlloc(GlobalContext* globalCtx, ColliderTris* dest, Actor* a /** * Sets up the ColliderTris using the values in src, placing the element array in elements. */ -s32 Collider_SetTris(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInit* src, +s32 Collider_SetTris(PlayState* play, ColliderTris* dest, Actor* actor, ColliderTrisInit* src, ColliderTrisElement* elements) { ColliderTrisElement* destElem; ColliderTrisElementInit* srcElem; - Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + Collider_SetBase(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = elements; ASSERT(dest->elements != NULL, "pclobj_tris->elem_tbl != NULL", "../z_collision_check.c", 2258); for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { - Collider_InitTrisElement(globalCtx, destElem); - Collider_SetTrisElement(globalCtx, destElem, srcElem); + Collider_InitTrisElement(play, destElem); + Collider_SetTrisElement(play, destElem, srcElem); } return true; } @@ -802,13 +798,13 @@ s32 Collider_SetTris(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, /** * Resets the collider's AT collision flags. */ -s32 Collider_ResetTrisAT(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetTrisAT(PlayState* play, Collider* collider) { ColliderTrisElement* element; ColliderTris* tris = (ColliderTris*)collider; - Collider_ResetATBase(globalCtx, &tris->base); + Collider_ResetATBase(play, &tris->base); for (element = tris->elements; element < tris->elements + tris->count; element++) { - Collider_ResetTrisElementAT(globalCtx, element); + Collider_ResetTrisElementAT(play, element); } return true; } @@ -816,13 +812,13 @@ s32 Collider_ResetTrisAT(GlobalContext* globalCtx, Collider* collider) { /** * Resets the collider's AC collision flags. */ -s32 Collider_ResetTrisAC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetTrisAC(PlayState* play, Collider* collider) { ColliderTrisElement* element; ColliderTris* tris = (ColliderTris*)collider; - Collider_ResetACBase(globalCtx, &tris->base); + Collider_ResetACBase(play, &tris->base); for (element = tris->elements; element < tris->elements + tris->count; element++) { - Collider_ResetTrisElementAC(globalCtx, element); + Collider_ResetTrisElementAC(play, element); } return true; } @@ -830,18 +826,18 @@ s32 Collider_ResetTrisAC(GlobalContext* globalCtx, Collider* collider) { /** * Resets the collider's OC collision flags. */ -s32 Collider_ResetTrisOC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetTrisOC(PlayState* play, Collider* collider) { ColliderTrisElement* element; ColliderTris* tris = (ColliderTris*)collider; - Collider_ResetOCBase(globalCtx, &tris->base); + Collider_ResetOCBase(play, &tris->base); for (element = tris->elements; element < tris->elements + tris->count; element++) { - Collider_ResetTrisElementOC(globalCtx, element); + Collider_ResetTrisElementOC(play, element); } return true; } -s32 Collider_InitQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim) { +s32 Collider_InitQuadDim(PlayState* play, ColliderQuadDim* dim) { static ColliderQuadDim init = { { { 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, 0, 0 }, @@ -853,11 +849,11 @@ s32 Collider_InitQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim) { return true; } -s32 Collider_DestroyQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim) { +s32 Collider_DestroyQuadDim(PlayState* play, ColliderQuadDim* dim) { return true; } -s32 Collider_ResetQuadACDist(GlobalContext* globalCtx, ColliderQuadDim* dim) { +s32 Collider_ResetQuadACDist(PlayState* play, ColliderQuadDim* dim) { dim->acDistSq = 1.0e38f; return true; } @@ -871,7 +867,7 @@ void Collider_SetQuadMidpoints(ColliderQuadDim* dim) { dim->baMid.z = (dim->quad[1].z + dim->quad[0].z) * 0.5f; } -s32 Collider_SetQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dest, ColliderQuadDimInit* src) { +s32 Collider_SetQuadDim(PlayState* play, ColliderQuadDim* dest, ColliderQuadDimInit* src) { dest->quad[0] = src->quad[0]; dest->quad[1] = src->quad[1]; dest->quad[2] = src->quad[2]; @@ -883,74 +879,74 @@ s32 Collider_SetQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dest, Collide /** * Initializes a ColliderQuad to default values. */ -s32 Collider_InitQuad(GlobalContext* globalCtx, ColliderQuad* collider) { - Collider_InitBase(globalCtx, &collider->base); - Collider_InitInfo(globalCtx, &collider->info); - Collider_InitQuadDim(globalCtx, &collider->dim); +s32 Collider_InitQuad(PlayState* play, ColliderQuad* collider) { + Collider_InitBase(play, &collider->base); + Collider_InitInfo(play, &collider->info); + Collider_InitQuadDim(play, &collider->dim); return true; } /** * Destroys a ColliderQuad. */ -s32 Collider_DestroyQuad(GlobalContext* globalCtx, ColliderQuad* collider) { - Collider_DestroyBase(globalCtx, &collider->base); - Collider_DestroyInfo(globalCtx, &collider->info); - Collider_DestroyQuadDim(globalCtx, &collider->dim); +s32 Collider_DestroyQuad(PlayState* play, ColliderQuad* collider) { + Collider_DestroyBase(play, &collider->base); + Collider_DestroyInfo(play, &collider->info); + Collider_DestroyQuadDim(play, &collider->dim); return true; } /** * Sets up the ColliderQuad using the values in src. Uses the default OC2_TYPE_1 */ -s32 Collider_SetQuadType1(GlobalContext* globalCtx, ColliderQuad* collider, Actor* actor, ColliderQuadInitType1* src) { - Collider_SetBaseType1(globalCtx, &collider->base, actor, &src->base); - Collider_SetInfo(globalCtx, &collider->info, &src->info); - Collider_SetQuadDim(globalCtx, &collider->dim, &src->dim); +s32 Collider_SetQuadType1(PlayState* play, ColliderQuad* collider, Actor* actor, ColliderQuadInitType1* src) { + Collider_SetBaseType1(play, &collider->base, actor, &src->base); + Collider_SetInfo(play, &collider->info, &src->info); + Collider_SetQuadDim(play, &collider->dim, &src->dim); return true; } /** * Sets up the ColliderQuad using the values in src. */ -s32 Collider_SetQuad(GlobalContext* globalCtx, ColliderQuad* collider, Actor* actor, ColliderQuadInit* src) { - Collider_SetBase(globalCtx, &collider->base, actor, &src->base); - Collider_SetInfo(globalCtx, &collider->info, &src->info); - Collider_SetQuadDim(globalCtx, &collider->dim, &src->dim); +s32 Collider_SetQuad(PlayState* play, ColliderQuad* collider, Actor* actor, ColliderQuadInit* src) { + Collider_SetBase(play, &collider->base, actor, &src->base); + Collider_SetInfo(play, &collider->info, &src->info); + Collider_SetQuadDim(play, &collider->dim, &src->dim); return true; } /** * Resets the collider's AT collision flags. */ -s32 Collider_ResetQuadAT(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetQuadAT(PlayState* play, Collider* collider) { ColliderQuad* quad = (ColliderQuad*)collider; - Collider_ResetATBase(globalCtx, &quad->base); - Collider_ResetATInfo(globalCtx, &quad->info); - Collider_ResetQuadACDist(globalCtx, &quad->dim); + Collider_ResetATBase(play, &quad->base); + Collider_ResetATInfo(play, &quad->info); + Collider_ResetQuadACDist(play, &quad->dim); return true; } /** * Resets the collider's AC collision flags. */ -s32 Collider_ResetQuadAC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetQuadAC(PlayState* play, Collider* collider) { ColliderQuad* quad = (ColliderQuad*)collider; - Collider_ResetACBase(globalCtx, &quad->base); - Collider_ResetACInfo(globalCtx, &quad->info); + Collider_ResetACBase(play, &quad->base); + Collider_ResetACInfo(play, &quad->info); return true; } /** * Resets the collider's OC collision flags. */ -s32 Collider_ResetQuadOC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetQuadOC(PlayState* play, Collider* collider) { ColliderQuad* quad = (ColliderQuad*)collider; - Collider_ResetOCBase(globalCtx, &quad->base); - Collider_ResetOCInfo(globalCtx, &quad->info); + Collider_ResetOCBase(play, &quad->base); + Collider_ResetOCInfo(play, &quad->info); return true; } @@ -958,7 +954,7 @@ s32 Collider_ResetQuadOC(GlobalContext* globalCtx, Collider* collider) { * For quad colliders with AT_NEAREST, resets the previous AC collider it hit if the current element is closer, * otherwise returns false. Used on player AT colliders to prevent multiple collisions from registering. */ -s32 Collider_QuadSetNearestAC(GlobalContext* globalCtx, ColliderQuad* quad, Vec3f* hitPos) { +s32 Collider_QuadSetNearestAC(PlayState* play, ColliderQuad* quad, Vec3f* hitPos) { f32 acDistSq; Vec3f dcMid; @@ -970,10 +966,10 @@ s32 Collider_QuadSetNearestAC(GlobalContext* globalCtx, ColliderQuad* quad, Vec3 if (acDistSq < quad->dim.acDistSq) { quad->dim.acDistSq = acDistSq; if (quad->info.atHit != NULL) { - Collider_ResetACBase(globalCtx, quad->info.atHit); + Collider_ResetACBase(play, quad->info.atHit); } if (quad->info.atHitInfo != NULL) { - Collider_ResetACInfo(globalCtx, quad->info.atHitInfo); + Collider_ResetACInfo(play, quad->info.atHitInfo); } return true; } @@ -984,7 +980,7 @@ s32 Collider_QuadSetNearestAC(GlobalContext* globalCtx, ColliderQuad* quad, Vec3 * Initializes an OcLine to default values * OcLines are entirely unused. */ -s32 Collider_InitLine(GlobalContext* globalCtx, OcLine* line) { +s32 Collider_InitLine(PlayState* play, OcLine* line) { Vec3f init = { 0.0f, 0.0f, 0.0f }; Math_Vec3f_Copy(&line->line.a, &init); @@ -996,7 +992,7 @@ s32 Collider_InitLine(GlobalContext* globalCtx, OcLine* line) { * Destroys an OcLine * OcLines are entirely unused. */ -s32 Collider_DestroyLine(GlobalContext* globalCtx, OcLine* line) { +s32 Collider_DestroyLine(PlayState* play, OcLine* line) { return true; } @@ -1004,7 +1000,7 @@ s32 Collider_DestroyLine(GlobalContext* globalCtx, OcLine* line) { * Sets up an OcLine with endpoints a and b. * OcLines are entirely unused. */ -s32 Collider_SetLinePoints(GlobalContext* globalCtx, OcLine* ocLine, Vec3f* a, Vec3f* b) { +s32 Collider_SetLinePoints(PlayState* play, OcLine* ocLine, Vec3f* a, Vec3f* b) { Math_Vec3f_Copy(&ocLine->line.a, a); Math_Vec3f_Copy(&ocLine->line.b, b); return true; @@ -1014,9 +1010,9 @@ s32 Collider_SetLinePoints(GlobalContext* globalCtx, OcLine* ocLine, Vec3f* a, V * Sets up an OcLine using the values in src. * OcLines are entirely unused. */ -s32 Collider_SetLine(GlobalContext* globalCtx, OcLine* dest, OcLine* src) { +s32 Collider_SetLine(PlayState* play, OcLine* dest, OcLine* src) { dest->ocFlags = src->ocFlags; - Collider_SetLinePoints(globalCtx, dest, &src->line.a, &src->line.b); + Collider_SetLinePoints(play, dest, &src->line.a, &src->line.b); return true; } @@ -1024,7 +1020,7 @@ s32 Collider_SetLine(GlobalContext* globalCtx, OcLine* dest, OcLine* src) { * Resets the OcLine's collision flags. * OcLines are entirely unused. */ -s32 Collider_ResetLineOC(GlobalContext* globalCtx, OcLine* line) { +s32 Collider_ResetLineOC(PlayState* play, OcLine* line) { line->ocFlags &= ~OCLINE_HIT; return true; } @@ -1032,21 +1028,21 @@ s32 Collider_ResetLineOC(GlobalContext* globalCtx, OcLine* line) { /** * Initializes CollisionCheckContext. Clears all collider arrays, disables SAC, and sets flags for drawing colliders. */ -void CollisionCheck_InitContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_InitContext(PlayState* play, CollisionCheckContext* colChkCtx) { colChkCtx->sacFlags = 0; - CollisionCheck_ClearContext(globalCtx, colChkCtx); + CollisionCheck_ClearContext(play, colChkCtx); AREG(21) = true; AREG(22) = true; AREG(23) = true; } -void CollisionCheck_DestroyContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_DestroyContext(PlayState* play, CollisionCheckContext* colChkCtx) { } /** * Clears all collider lists in CollisionCheckContext when not in SAC mode. */ -void CollisionCheck_ClearContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_ClearContext(PlayState* play, CollisionCheckContext* colChkCtx) { Collider** col; OcLine** line; @@ -1076,14 +1072,14 @@ void CollisionCheck_ClearContext(GlobalContext* globalCtx, CollisionCheckContext /** * Enables SAC, an alternate collision check mode that allows direct management of collider lists. Unused. */ -void CollisionCheck_EnableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_EnableSAC(PlayState* play, CollisionCheckContext* colChkCtx) { colChkCtx->sacFlags |= SAC_ENABLE; } /** * Disables SAC, an alternate collision check mode that allows direct management of collider lists. Unused. */ -void CollisionCheck_DisableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colChkCtx) { colChkCtx->sacFlags &= ~SAC_ENABLE; } @@ -1091,7 +1087,7 @@ void CollisionCheck_DisableSAC(GlobalContext* globalCtx, CollisionCheckContext* * Draws a collider of any shape. * Math3D_DrawSphere and Math3D_DrawCylinder are noops, so JntSph and Cylinder are not drawn. */ -void Collider_Draw(GlobalContext* globalCtx, Collider* collider) { +void Collider_Draw(PlayState* play, Collider* collider) { ColliderJntSph* jntSph; ColliderCylinder* cylinder; ColliderTris* tris; @@ -1105,24 +1101,24 @@ void Collider_Draw(GlobalContext* globalCtx, Collider* collider) { case COLSHAPE_JNTSPH: jntSph = (ColliderJntSph*)collider; for (i = 0; i < jntSph->count; i++) { - Math3D_DrawSphere(globalCtx, &jntSph->elements[i].dim.worldSphere); + Math3D_DrawSphere(play, &jntSph->elements[i].dim.worldSphere); } break; case COLSHAPE_CYLINDER: cylinder = (ColliderCylinder*)collider; - Math3D_DrawCylinder(globalCtx, &cylinder->dim); + Math3D_DrawCylinder(play, &cylinder->dim); break; case COLSHAPE_TRIS: tris = (ColliderTris*)collider; for (i = 0; i < tris->count; i++) { - Collider_DrawRedPoly(globalCtx->state.gfxCtx, &tris->elements[i].dim.vtx[0], - &tris->elements[i].dim.vtx[1], &tris->elements[i].dim.vtx[2]); + Collider_DrawRedPoly(play->state.gfxCtx, &tris->elements[i].dim.vtx[0], &tris->elements[i].dim.vtx[1], + &tris->elements[i].dim.vtx[2]); } break; case COLSHAPE_QUAD: quad = (ColliderQuad*)collider; - Collider_DrawRedPoly(globalCtx->state.gfxCtx, &quad->dim.quad[2], &quad->dim.quad[3], &quad->dim.quad[1]); - Collider_DrawRedPoly(globalCtx->state.gfxCtx, &quad->dim.quad[1], &quad->dim.quad[0], &quad->dim.quad[2]); + Collider_DrawRedPoly(play->state.gfxCtx, &quad->dim.quad[2], &quad->dim.quad[3], &quad->dim.quad[1]); + Collider_DrawRedPoly(play->state.gfxCtx, &quad->dim.quad[1], &quad->dim.quad[0], &quad->dim.quad[2]); break; } } @@ -1131,34 +1127,34 @@ void Collider_Draw(GlobalContext* globalCtx, Collider* collider) { * Draws collision if AREG(15) and other AREGs are set. AREG(21) draws AT colliders, AREG(22) draws AC colliders, * AREG(23) draws OC colliders, AREG(24) draws dynapolys, and AREG(25) draws bg polys */ -void CollisionCheck_DrawCollision(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_DrawCollision(PlayState* play, CollisionCheckContext* colChkCtx) { Collider* collider; s32 i; if (AREG(15)) { if (AREG(21)) { for (i = 0; i < colChkCtx->colATCount; i++) { - Collider_Draw(globalCtx, colChkCtx->colAT[i]); + Collider_Draw(play, colChkCtx->colAT[i]); } } if (AREG(22)) { for (i = 0; i < colChkCtx->colACCount; i++) { - Collider_Draw(globalCtx, colChkCtx->colAC[i]); + Collider_Draw(play, colChkCtx->colAC[i]); } } if (AREG(23)) { for (i = 0; i < colChkCtx->colOCCount; i++) { collider = colChkCtx->colOC[i]; if (collider->ocFlags1 & OC1_ON) { - Collider_Draw(globalCtx, collider); + Collider_Draw(play, collider); } } } if (AREG(24)) { - BgCheck_DrawDynaCollision(globalCtx, &globalCtx->colCtx); + BgCheck_DrawDynaCollision(play, &play->colCtx); } if (AREG(25)) { - BgCheck_DrawStaticCollision(globalCtx, &globalCtx->colCtx); + BgCheck_DrawStaticCollision(play, &play->colCtx); } } } @@ -1174,14 +1170,14 @@ static ColChkResetFunc sATResetFuncs[] = { * Sets collider as an AT (attack) for the current frame, which will be checked against ACs (attack colliders) * The last argument takes a Collider, so pass collider.base rather than the raw collider. */ -s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +s32 CollisionCheck_SetAT(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } ASSERT(collider->shape < COLSHAPE_MAX, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 2997); - sATResetFuncs[collider->shape](globalCtx, collider); + sATResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1203,13 +1199,12 @@ s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colChk * If CollisionCheck_SAC is enabled, the collider will be inserted into the list at the specified index, otherwise it * will be inserted into the next slot */ -s32 CollisionCheck_SetAT_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, - s32 index) { +s32 CollisionCheck_SetAT_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { ASSERT(collider->shape < COLSHAPE_MAX, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3037); - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } - sATResetFuncs[collider->shape](globalCtx, collider); + sATResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1243,14 +1238,14 @@ static ColChkResetFunc sACResetFuncs[] = { * Sets collider as an AC (attack collider) for the current frame, allowing it to detect ATs (attacks) * The last argument takes a Collider, so pass collider.base rather than the raw collider. */ -s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +s32 CollisionCheck_SetAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } ASSERT(collider->shape < COLSHAPE_MAX, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3114); - sACResetFuncs[collider->shape](globalCtx, collider); + sACResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1272,13 +1267,12 @@ s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colChk * If CollisionCheck_SAC is enabled, the collider will be inserted into the list at the specified index, otherwise it * will be inserted into the next slot */ -s32 CollisionCheck_SetAC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, - s32 index) { +s32 CollisionCheck_SetAC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { ASSERT(collider->shape < COLSHAPE_MAX, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3153); - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } - sACResetFuncs[collider->shape](globalCtx, collider); + sACResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1312,16 +1306,16 @@ static ColChkResetFunc sOCResetFuncs[] = { * Sets collider as an OC (object collider) for the current frame, allowing it to detect other OCs * The last argument takes a Collider, so pass collider.base rather than the raw collider. */ -s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +s32 CollisionCheck_SetOC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } ASSERT(collider->shape < COLSHAPE_MAX, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3229); - sOCResetFuncs[collider->shape](globalCtx, collider); + sOCResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1343,13 +1337,12 @@ s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colChk * If CollisionCheck_SAC is enabled, the collider will be inserted into the list at the specified index, otherwise it * will be inserted into the next slot */ -s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, - s32 index) { - if (FrameAdvance_IsEnabled(globalCtx) == true) { +s32 CollisionCheck_SetOC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } ASSERT(collider->shape < COLSHAPE_MAX, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3274); - sOCResetFuncs[collider->shape](globalCtx, collider); + sOCResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; } @@ -1377,13 +1370,13 @@ s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* co * Sets a line as an OC collider for this frame. * OC lines are entirely unused, and do not even have collision check functions. */ -s32 CollisionCheck_SetOCLine(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, OcLine* collider) { +s32 CollisionCheck_SetOCLine(PlayState* play, CollisionCheckContext* colChkCtx, OcLine* collider) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx) == true) { + if (FrameAdvance_IsEnabled(play) == true) { return -1; } - Collider_ResetLineOC(globalCtx, collider); + Collider_ResetLineOC(play, collider); if (!(colChkCtx->colLineCount < COLLISION_CHECK_OC_LINE_MAX)) { // "Index exceeded and cannot add more" osSyncPrintf("CollisionCheck_setOCLine():インデックスがオーバして追加不能\n"); @@ -1428,14 +1421,14 @@ s32 CollisionCheck_NoSharedFlags(ColliderInfo* atInfo, ColliderInfo* acInfo) { * Spawns no blood drops. * Used by collider types HIT1, HIT3, HIT5, METAL, NONE, WOOD, HARD, and TREE */ -void CollisionCheck_NoBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { +void CollisionCheck_NoBlood(PlayState* play, Collider* collider, Vec3f* v) { } /** * Spawns blue blood drops. * Used by collider types HIT0 and HIT8. */ -void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { +void CollisionCheck_BlueBlood(PlayState* play, Collider* collider, Vec3f* v) { static EffectSparkInit sparkInit; s32 effectIndex; @@ -1481,14 +1474,14 @@ void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3 sparkInit.speed = 8.0f; sparkInit.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &sparkInit); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &sparkInit); } /** * Spawns green blood drops. * Used by collider types HIT2 and HIT6. No actor has type HIT2. */ -void CollisionCheck_GreenBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { +void CollisionCheck_GreenBlood(PlayState* play, Collider* collider, Vec3f* v) { static EffectSparkInit sparkInit; s32 effectIndex; @@ -1534,42 +1527,42 @@ void CollisionCheck_GreenBlood(GlobalContext* globalCtx, Collider* collider, Vec sparkInit.speed = 8.0f; sparkInit.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &sparkInit); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &sparkInit); } /** * Spawns a burst of water. * Used by collider type HIT4, which no actor has. */ -void CollisionCheck_WaterBurst(GlobalContext* globalCtx, Collider* collider, Vec3f* pos) { - EffectSsSibuki_SpawnBurst(globalCtx, pos); - CollisionCheck_SpawnWaterDroplets(globalCtx, pos); +void CollisionCheck_WaterBurst(PlayState* play, Collider* collider, Vec3f* pos) { + EffectSsSibuki_SpawnBurst(play, pos); + CollisionCheck_SpawnWaterDroplets(play, pos); } /** * Spawns red blood drops. * Used by collider type HIT7, which no actor has. */ -void CollisionCheck_RedBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { - CollisionCheck_SpawnRedBlood(globalCtx, v); +void CollisionCheck_RedBlood(PlayState* play, Collider* collider, Vec3f* v) { + CollisionCheck_SpawnRedBlood(play, v); } /** * Spawns red blood drops. * Unused. */ -void CollisionCheck_RedBloodUnused(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { - CollisionCheck_SpawnRedBlood(globalCtx, v); +void CollisionCheck_RedBloodUnused(PlayState* play, Collider* collider, Vec3f* v) { + CollisionCheck_SpawnRedBlood(play, v); } /** * Plays sound effects and displays hitmarks for solid-type AC colliders (METAL, WOOD, HARD, and TREE) */ -void CollisionCheck_HitSolid(GlobalContext* globalCtx, ColliderInfo* info, Collider* collider, Vec3f* hitPos) { +void CollisionCheck_HitSolid(PlayState* play, ColliderInfo* info, Collider* collider, Vec3f* hitPos) { s32 flags = info->toucherFlags & TOUCH_SFX_NONE; if (flags == TOUCH_SFX_NORMAL && collider->colType != COLTYPE_METAL) { - EffectSsHitMark_SpawnFixedScale(globalCtx, EFFECT_HITMARK_WHITE, hitPos); + EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_WHITE, hitPos); if (collider->actor == NULL) { Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1578,14 +1571,14 @@ void CollisionCheck_HitSolid(GlobalContext* globalCtx, ColliderInfo* info, Colli &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } else if (flags == TOUCH_SFX_NORMAL) { // collider->colType == COLTYPE_METAL - EffectSsHitMark_SpawnFixedScale(globalCtx, EFFECT_HITMARK_METAL, hitPos); + EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_METAL, hitPos); if (collider->actor == NULL) { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, hitPos); + CollisionCheck_SpawnShieldParticlesMetal(play, hitPos); } else { - CollisionCheck_SpawnShieldParticlesMetalSound(globalCtx, hitPos, &collider->actor->projectedPos); + CollisionCheck_SpawnShieldParticlesMetalSound(play, hitPos, &collider->actor->projectedPos); } } else if (flags == TOUCH_SFX_HARD) { - EffectSsHitMark_SpawnFixedScale(globalCtx, EFFECT_HITMARK_WHITE, hitPos); + EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_WHITE, hitPos); if (collider->actor == NULL) { Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1594,7 +1587,7 @@ void CollisionCheck_HitSolid(GlobalContext* globalCtx, ColliderInfo* info, Colli &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } else if (flags == TOUCH_SFX_WOOD) { - EffectSsHitMark_SpawnFixedScale(globalCtx, EFFECT_HITMARK_DUST, hitPos); + EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_DUST, hitPos); if (collider->actor == NULL) { Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1641,8 +1634,8 @@ static HitInfo sHitInfo[] = { /** * Handles hitmarks, blood, and sound effects for each AC collision, determined by the AC collider's colType */ -void CollisionCheck_HitEffects(GlobalContext* globalCtx, Collider* at, ColliderInfo* atInfo, Collider* ac, - ColliderInfo* acInfo, Vec3f* hitPos) { +void CollisionCheck_HitEffects(PlayState* play, Collider* at, ColliderInfo* atInfo, Collider* ac, ColliderInfo* acInfo, + Vec3f* hitPos) { if (acInfo->bumperFlags & BUMP_NO_HITMARK) { return; } @@ -1650,27 +1643,27 @@ void CollisionCheck_HitEffects(GlobalContext* globalCtx, Collider* at, ColliderI return; } if (ac->actor != NULL) { - sBloodFuncs[sHitInfo[ac->colType].blood](globalCtx, ac, hitPos); + sBloodFuncs[sHitInfo[ac->colType].blood](play, ac, hitPos); } if (ac->actor != NULL) { if (sHitInfo[ac->colType].effect == HIT_SOLID) { - CollisionCheck_HitSolid(globalCtx, atInfo, ac, hitPos); + CollisionCheck_HitSolid(play, atInfo, ac, hitPos); } else if (sHitInfo[ac->colType].effect == HIT_WOOD) { if (at->actor == NULL) { - CollisionCheck_SpawnShieldParticles(globalCtx, hitPos); + CollisionCheck_SpawnShieldParticles(play, hitPos); Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } else { - CollisionCheck_SpawnShieldParticlesWood(globalCtx, hitPos, &at->actor->projectedPos); + CollisionCheck_SpawnShieldParticlesWood(play, hitPos, &at->actor->projectedPos); } } else if (sHitInfo[ac->colType].effect != HIT_NONE) { - EffectSsHitMark_SpawnFixedScale(globalCtx, sHitInfo[ac->colType].effect, hitPos); + EffectSsHitMark_SpawnFixedScale(play, sHitInfo[ac->colType].effect, hitPos); if (!(acInfo->bumperFlags & BUMP_NO_SWORD_SFX)) { CollisionCheck_SwordHitAudio(at, acInfo); } } } else { - EffectSsHitMark_SpawnFixedScale(globalCtx, EFFECT_HITMARK_WHITE, hitPos); + EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_WHITE, hitPos); if (ac->actor == NULL) { Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1692,7 +1685,7 @@ void CollisionCheck_SetBounce(Collider* at, Collider* ac) { /** * Performs the AC collision between the AT element and AC element that collided. */ -s32 CollisionCheck_SetATvsAC(GlobalContext* globalCtx, Collider* at, ColliderInfo* atInfo, Vec3f* atPos, Collider* ac, +s32 CollisionCheck_SetATvsAC(PlayState* play, Collider* at, ColliderInfo* atInfo, Vec3f* atPos, Collider* ac, ColliderInfo* acInfo, Vec3f* acPos, Vec3f* hitPos) { if (ac->acFlags & AC_HARD && at->actor != NULL && ac->actor != NULL) { CollisionCheck_SetBounce(at, ac); @@ -1722,7 +1715,7 @@ s32 CollisionCheck_SetATvsAC(GlobalContext* globalCtx, Collider* at, ColliderInf ac->colType != COLTYPE_HARD) { acInfo->bumperFlags |= BUMP_DRAW_HITMARK; } else { - CollisionCheck_HitEffects(globalCtx, at, atInfo, ac, acInfo, hitPos); + CollisionCheck_HitEffects(play, at, atInfo, ac, acInfo, hitPos); atInfo->toucherFlags |= TOUCH_DREW_HITMARK; } return true; @@ -1731,7 +1724,7 @@ s32 CollisionCheck_SetATvsAC(GlobalContext* globalCtx, Collider* at, ColliderInf /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderJntSph* at = (ColliderJntSph*)colAT; ColliderJntSphElement* atItem; @@ -1773,8 +1766,8 @@ void CollisionCheck_AC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckCo } else { Math_Vec3f_Copy(&hitPos, &atPos); } - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, - &acPos, &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, &acPos, + &hitPos); if (!(ac->base.ocFlags2 & OC2_FIRST_ONLY)) { return; } @@ -1787,7 +1780,7 @@ void CollisionCheck_AC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckCo /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderJntSph* at = (ColliderJntSph*)colAT; ColliderJntSphElement* atItem; @@ -1830,8 +1823,7 @@ void CollisionCheck_AC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckConte } else { Math_Vec3f_Copy(&hitPos, &atPos); } - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, - &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); return; } } @@ -1841,7 +1833,7 @@ void CollisionCheck_AC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckConte /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_CylVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderJntSph* ac = (ColliderJntSph*)colAC; @@ -1884,8 +1876,7 @@ void CollisionCheck_AC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckConte } else { Math_Vec3f_Copy(&hitPos, &atPos); } - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, - &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, &hitPos); if (!(ac->base.ocFlags2 & OC2_FIRST_ONLY)) { break; } @@ -1897,7 +1888,7 @@ void CollisionCheck_AC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckConte /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_JntSphVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_JntSphVsTris(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderJntSph* at = (ColliderJntSph*)colAT; ColliderJntSphElement* atSph; @@ -1927,8 +1918,8 @@ void CollisionCheck_AC_JntSphVsTris(GlobalContext* globalCtx, CollisionCheckCont acPos.x = (acTri->dim.vtx[0].x + acTri->dim.vtx[1].x + acTri->dim.vtx[2].x) * (1.0f / 3); acPos.y = (acTri->dim.vtx[0].y + acTri->dim.vtx[1].y + acTri->dim.vtx[2].y) * (1.0f / 3); acPos.z = (acTri->dim.vtx[0].z + acTri->dim.vtx[1].z + acTri->dim.vtx[2].z) * (1.0f / 3); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atSph->info, &atPos, &ac->base, &acTri->info, - &acPos, &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atSph->info, &atPos, &ac->base, &acTri->info, &acPos, + &hitPos); return; } } @@ -1939,7 +1930,7 @@ void CollisionCheck_AC_JntSphVsTris(GlobalContext* globalCtx, CollisionCheckCont /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_TrisVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_TrisVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderTris* at = (ColliderTris*)colAT; ColliderTrisElement* atItem; @@ -1967,8 +1958,8 @@ void CollisionCheck_AC_TrisVsJntSph(GlobalContext* globalCtx, CollisionCheckCont atPos.x = (atItem->dim.vtx[0].x + atItem->dim.vtx[1].x + atItem->dim.vtx[2].x) * (1.0f / 3); atPos.y = (atItem->dim.vtx[0].y + atItem->dim.vtx[1].y + atItem->dim.vtx[2].y) * (1.0f / 3); atPos.z = (atItem->dim.vtx[0].z + atItem->dim.vtx[1].z + atItem->dim.vtx[2].z) * (1.0f / 3); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, - &acPos, &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, &acPos, + &hitPos); if (!(ac->base.ocFlags2 & OC2_FIRST_ONLY)) { return; } @@ -1981,7 +1972,7 @@ void CollisionCheck_AC_TrisVsJntSph(GlobalContext* globalCtx, CollisionCheckCont /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_JntSphVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_JntSphVsQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static TriNorm tri1; static TriNorm tri2; @@ -2014,8 +2005,7 @@ void CollisionCheck_AC_JntSphVsQuad(GlobalContext* globalCtx, CollisionCheckCont acPos.y = (ac->dim.quad[0].y + (ac->dim.quad[1].y + (ac->dim.quad[3].y + ac->dim.quad[2].y))) / 4.0f; acPos.z = (ac->dim.quad[0].z + (ac->dim.quad[1].z + (ac->dim.quad[3].z + ac->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, - &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); return; } } @@ -2025,7 +2015,7 @@ void CollisionCheck_AC_JntSphVsQuad(GlobalContext* globalCtx, CollisionCheckCont /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_QuadVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, +void CollisionCheck_AC_QuadVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static TriNorm tri1; static TriNorm tri2; @@ -2049,7 +2039,7 @@ void CollisionCheck_AC_QuadVsJntSph(GlobalContext* globalCtx, CollisionCheckCont } if (Math3D_TriVsSphIntersect(&acElem->dim.worldSphere, &tri1, &hitPos) == true || Math3D_TriVsSphIntersect(&acElem->dim.worldSphere, &tri2, &hitPos) == true) { - if (Collider_QuadSetNearestAC(globalCtx, at, &hitPos)) { + if (Collider_QuadSetNearestAC(play, at, &hitPos)) { Vec3f atPos; Vec3f acPos; @@ -2063,7 +2053,7 @@ void CollisionCheck_AC_QuadVsJntSph(GlobalContext* globalCtx, CollisionCheckCont (at->dim.quad[0].y + (at->dim.quad[1].y + (at->dim.quad[3].y + at->dim.quad[2].y))) / 4.0f; atPos.z = (at->dim.quad[0].z + (at->dim.quad[1].z + (at->dim.quad[3].z + at->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, &hitPos); if (!(ac->base.ocFlags2 & OC2_FIRST_ONLY)) { return; @@ -2077,8 +2067,7 @@ void CollisionCheck_AC_QuadVsJntSph(GlobalContext* globalCtx, CollisionCheckCont /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_CylVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderCylinder* ac = (ColliderCylinder*)colAC; f32 deadSpace; @@ -2110,7 +2099,7 @@ void CollisionCheck_AC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* } else { Math_Vec3s_ToVec3f(&hitPos, &ac->dim.pos); } - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); } } } @@ -2118,8 +2107,7 @@ void CollisionCheck_AC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_CylVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_CylVsTris(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderTris* ac = (ColliderTris*)colAC; ColliderTrisElement* acElem; @@ -2145,8 +2133,7 @@ void CollisionCheck_AC_CylVsTris(GlobalContext* globalCtx, CollisionCheckContext acPos.x = (acElem->dim.vtx[0].x + acElem->dim.vtx[1].x + acElem->dim.vtx[2].x) * (1.0f / 3); acPos.y = (acElem->dim.vtx[0].y + acElem->dim.vtx[1].y + acElem->dim.vtx[2].y) * (1.0f / 3); acPos.z = (acElem->dim.vtx[0].z + acElem->dim.vtx[1].z + acElem->dim.vtx[2].z) * (1.0f / 3); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atpos, &ac->base, &acElem->info, &acPos, - &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atpos, &ac->base, &acElem->info, &acPos, &hitPos); return; } } @@ -2156,8 +2143,7 @@ void CollisionCheck_AC_CylVsTris(GlobalContext* globalCtx, CollisionCheckContext /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_TrisVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_TrisVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static Vec3f hitPos; ColliderTris* at = (ColliderTris*)colAT; ColliderTrisElement* atItem; @@ -2182,8 +2168,7 @@ void CollisionCheck_AC_TrisVsCyl(GlobalContext* globalCtx, CollisionCheckContext atPos.y = (atItem->dim.vtx[0].y + atItem->dim.vtx[1].y + atItem->dim.vtx[2].y) * (1.0f / 3); atPos.z = (atItem->dim.vtx[0].z + atItem->dim.vtx[1].z + atItem->dim.vtx[2].z) * (1.0f / 3); Math_Vec3s_ToVec3f(&acPos, &ac->dim.pos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, - &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); return; } } @@ -2193,8 +2178,7 @@ void CollisionCheck_AC_TrisVsCyl(GlobalContext* globalCtx, CollisionCheckContext /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_CylVsQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static TriNorm tri1; static TriNorm tri2; static Vec3f hitPos; @@ -2218,7 +2202,7 @@ void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext acPos1.x = (ac->dim.quad[0].x + (ac->dim.quad[1].x + (ac->dim.quad[3].x + ac->dim.quad[2].x))) / 4.0f; acPos1.y = (ac->dim.quad[0].y + (ac->dim.quad[1].y + (ac->dim.quad[3].y + ac->dim.quad[2].y))) / 4.0f; acPos1.z = (ac->dim.quad[0].z + (ac->dim.quad[1].z + (ac->dim.quad[3].z + ac->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos1, &ac->base, &ac->info, &acPos1, &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos1, &ac->base, &ac->info, &acPos1, &hitPos); } else if (Math3D_CylTriVsIntersect(&at->dim, &tri2, &hitPos) == true) { Vec3f atPos2; Vec3f acPos2; @@ -2227,7 +2211,7 @@ void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext acPos2.x = (ac->dim.quad[0].x + (ac->dim.quad[1].x + (ac->dim.quad[3].x + ac->dim.quad[2].x))) / 4.0f; acPos2.y = (ac->dim.quad[0].y + (ac->dim.quad[1].y + (ac->dim.quad[3].y + ac->dim.quad[2].y))) / 4.0f; acPos2.z = (ac->dim.quad[0].z + (ac->dim.quad[1].z + (ac->dim.quad[3].z + ac->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos2, &ac->base, &ac->info, &acPos2, &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos2, &ac->base, &ac->info, &acPos2, &hitPos); } } } @@ -2238,8 +2222,7 @@ static s8 sBssDummy1; /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_QuadVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static TriNorm tri1; static TriNorm tri2; static Vec3f hitPos; @@ -2256,7 +2239,7 @@ void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext Math3D_TriNorm(&tri1, &at->dim.quad[2], &at->dim.quad[3], &at->dim.quad[1]); Math3D_TriNorm(&tri2, &at->dim.quad[2], &at->dim.quad[1], &at->dim.quad[0]); if (Math3D_CylTriVsIntersect(&ac->dim, &tri1, &hitPos) == true) { - if (Collider_QuadSetNearestAC(globalCtx, at, &hitPos)) { + if (Collider_QuadSetNearestAC(play, at, &hitPos)) { Vec3f atPos1; Vec3f acPos1; @@ -2264,13 +2247,12 @@ void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext atPos1.y = (at->dim.quad[0].y + (at->dim.quad[1].y + (at->dim.quad[3].y + at->dim.quad[2].y))) / 4.0f; atPos1.z = (at->dim.quad[0].z + (at->dim.quad[1].z + (at->dim.quad[3].z + at->dim.quad[2].z))) / 4.0f; Math_Vec3s_ToVec3f(&acPos1, &ac->dim.pos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos1, &ac->base, &ac->info, &acPos1, - &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos1, &ac->base, &ac->info, &acPos1, &hitPos); return; } } if (Math3D_CylTriVsIntersect(&ac->dim, &tri2, &hitPos) == true) { - if (Collider_QuadSetNearestAC(globalCtx, at, &hitPos)) { + if (Collider_QuadSetNearestAC(play, at, &hitPos)) { Vec3f atPos2; Vec3f acPos2; @@ -2278,8 +2260,7 @@ void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext atPos2.y = (at->dim.quad[0].y + (at->dim.quad[1].y + (at->dim.quad[3].y + at->dim.quad[2].y))) / 4.0f; atPos2.z = (at->dim.quad[0].z + (at->dim.quad[1].z + (at->dim.quad[3].z + at->dim.quad[2].z))) / 4.0f; Math_Vec3s_ToVec3f(&acPos2, &ac->dim.pos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos2, &ac->base, &ac->info, &acPos2, - &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos2, &ac->base, &ac->info, &acPos2, &hitPos); } } } @@ -2293,8 +2274,7 @@ static s8 sBssDummy6; /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_TrisVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_TrisVsTris(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static Vec3f hitPos; ColliderTris* at = (ColliderTris*)colAT; ColliderTrisElement* atItem; @@ -2323,8 +2303,8 @@ void CollisionCheck_AC_TrisVsTris(GlobalContext* globalCtx, CollisionCheckContex acPos.x = (acElem->dim.vtx[0].x + acElem->dim.vtx[1].x + acElem->dim.vtx[2].x) * (1.0f / 3); acPos.y = (acElem->dim.vtx[0].y + acElem->dim.vtx[1].y + acElem->dim.vtx[2].y) * (1.0f / 3); acPos.z = (acElem->dim.vtx[0].z + acElem->dim.vtx[1].z + acElem->dim.vtx[2].z) * (1.0f / 3); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, - &acPos, &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &acElem->info, &acPos, + &hitPos); return; } } @@ -2340,8 +2320,7 @@ static s8 sBssDummy10; /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_TrisVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_TrisVsQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static Vec3f hitPos; static TriNorm tri1; static TriNorm tri2; @@ -2373,8 +2352,7 @@ void CollisionCheck_AC_TrisVsQuad(GlobalContext* globalCtx, CollisionCheckContex acPos.x = (ac->dim.quad[0].x + (ac->dim.quad[1].x + (ac->dim.quad[3].x + ac->dim.quad[2].x))) / 4.0f; acPos.y = (ac->dim.quad[0].y + (ac->dim.quad[1].y + (ac->dim.quad[3].y + ac->dim.quad[2].y))) / 4.0f; acPos.z = (ac->dim.quad[0].z + (ac->dim.quad[1].z + (ac->dim.quad[3].z + ac->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, - &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atItem->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); return; } } @@ -2384,8 +2362,7 @@ void CollisionCheck_AC_TrisVsQuad(GlobalContext* globalCtx, CollisionCheckContex /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_QuadVsTris(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static Vec3f hitPos; static TriNorm tri1; static TriNorm tri2; @@ -2408,7 +2385,7 @@ void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContex } if (Math3D_TriVsTriIntersect(&tri1, &acElem->dim, &hitPos) == true || Math3D_TriVsTriIntersect(&tri2, &acElem->dim, &hitPos) == true) { - if (Collider_QuadSetNearestAC(globalCtx, at, &hitPos)) { + if (Collider_QuadSetNearestAC(play, at, &hitPos)) { Vec3f atPos; Vec3f acPos; @@ -2421,7 +2398,7 @@ void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContex (at->dim.quad[0].y + (at->dim.quad[1].y + (at->dim.quad[3].y + at->dim.quad[2].y))) / 4.0f; atPos.z = (at->dim.quad[0].z + (at->dim.quad[1].z + (at->dim.quad[3].z + at->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &acElem->info, &acPos, &hitPos); return; } @@ -2433,8 +2410,7 @@ void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContex /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_QuadVsQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT, Collider* colAC) { static TriNorm acTris[2]; static Vec3f hitPos; static TriNorm atTris[2]; @@ -2461,7 +2437,7 @@ void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContex for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) { if (Math3D_TriVsTriIntersect(&atTris[j], &acTris[i], &hitPos) == true) { - if (Collider_QuadSetNearestAC(globalCtx, at, &hitPos)) { + if (Collider_QuadSetNearestAC(play, at, &hitPos)) { Vec3f atPos; Vec3f acPos; @@ -2477,8 +2453,7 @@ void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContex (ac->dim.quad[0].y + (ac->dim.quad[1].y + (ac->dim.quad[3].y + ac->dim.quad[2].y))) / 4.0f; acPos.z = (ac->dim.quad[0].z + (ac->dim.quad[1].z + (ac->dim.quad[3].z + ac->dim.quad[2].z))) / 4.0f; - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, - &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); return; } } @@ -2489,7 +2464,7 @@ void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContex /** * Sets a ColliderJntSph's hit effects */ -void CollisionCheck_SetJntSphHitFX(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_SetJntSphHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderJntSph* jntSph = (ColliderJntSph*)collider; ColliderJntSphElement* element; Vec3f hitPos; @@ -2498,8 +2473,8 @@ void CollisionCheck_SetJntSphHitFX(GlobalContext* globalCtx, CollisionCheckConte if ((element->info.bumperFlags & BUMP_DRAW_HITMARK) && (element->info.acHitInfo != NULL) && !(element->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Math_Vec3s_ToVec3f(&hitPos, &element->info.bumper.hitPos); - CollisionCheck_HitEffects(globalCtx, element->info.acHit, element->info.acHitInfo, &jntSph->base, - &element->info, &hitPos); + CollisionCheck_HitEffects(play, element->info.acHit, element->info.acHitInfo, &jntSph->base, &element->info, + &hitPos); element->info.acHitInfo->toucherFlags |= TOUCH_DREW_HITMARK; return; } @@ -2509,14 +2484,14 @@ void CollisionCheck_SetJntSphHitFX(GlobalContext* globalCtx, CollisionCheckConte /** * Sets a ColliderCylinder's hit effects */ -void CollisionCheck_SetCylHitFX(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_SetCylHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderCylinder* cylinder = (ColliderCylinder*)collider; Vec3f hitPos; if ((cylinder->info.bumperFlags & BUMP_DRAW_HITMARK) && (cylinder->info.acHitInfo != NULL) && !(cylinder->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Math_Vec3s_ToVec3f(&hitPos, &cylinder->info.bumper.hitPos); - CollisionCheck_HitEffects(globalCtx, cylinder->info.acHit, cylinder->info.acHitInfo, &cylinder->base, + CollisionCheck_HitEffects(play, cylinder->info.acHit, cylinder->info.acHitInfo, &cylinder->base, &cylinder->info, &hitPos); cylinder->info.acHitInfo->toucherFlags |= TOUCH_DREW_HITMARK; } @@ -2525,7 +2500,7 @@ void CollisionCheck_SetCylHitFX(GlobalContext* globalCtx, CollisionCheckContext* /** * Sets a ColliderTris's hit effects */ -void CollisionCheck_SetTrisHitFX(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_SetTrisHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderTris* tris = (ColliderTris*)collider; ColliderTrisElement* element; Vec3f hitPos; @@ -2534,8 +2509,8 @@ void CollisionCheck_SetTrisHitFX(GlobalContext* globalCtx, CollisionCheckContext if ((element->info.bumperFlags & BUMP_DRAW_HITMARK) && (element->info.acHitInfo != NULL) && !(element->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Math_Vec3s_ToVec3f(&hitPos, &element->info.bumper.hitPos); - CollisionCheck_HitEffects(globalCtx, element->info.acHit, element->info.acHitInfo, &tris->base, - &element->info, &hitPos); + CollisionCheck_HitEffects(play, element->info.acHit, element->info.acHitInfo, &tris->base, &element->info, + &hitPos); element->info.acHitInfo->toucherFlags |= TOUCH_DREW_HITMARK; return; } @@ -2545,14 +2520,14 @@ void CollisionCheck_SetTrisHitFX(GlobalContext* globalCtx, CollisionCheckContext /** * Sets a ColliderQuad's hit effects */ -void CollisionCheck_SetQuadHitFX(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_SetQuadHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderQuad* quad = (ColliderQuad*)collider; Vec3f hitPos; if ((quad->info.bumperFlags & BUMP_DRAW_HITMARK) && (quad->info.acHitInfo != NULL) && !(quad->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Math_Vec3s_ToVec3f(&hitPos, &quad->info.bumper.hitPos); - CollisionCheck_HitEffects(globalCtx, quad->info.acHit, quad->info.acHitInfo, &quad->base, &quad->info, &hitPos); + CollisionCheck_HitEffects(play, quad->info.acHit, quad->info.acHitInfo, &quad->base, &quad->info, &hitPos); quad->info.acHitInfo->toucherFlags |= TOUCH_DREW_HITMARK; } } @@ -2567,7 +2542,7 @@ static ColChkApplyFunc sColChkApplyFuncs[] = { /** * Handles hit effects for each AC collider that had an AC collision. Spawns hitmarks and plays sound effects. */ -void CollisionCheck_SetHitEffects(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_SetHitEffects(PlayState* play, CollisionCheckContext* colChkCtx) { Collider** col; for (col = colChkCtx->colAC; col < colChkCtx->colAC + colChkCtx->colACCount; col++) { @@ -2577,7 +2552,7 @@ void CollisionCheck_SetHitEffects(GlobalContext* globalCtx, CollisionCheckContex if (colAC->actor != NULL && colAC->actor->update == NULL) { continue; } - sColChkApplyFuncs[colAC->shape](globalCtx, colChkCtx, colAC); + sColChkApplyFuncs[colAC->shape](play, colChkCtx, colAC); } } } @@ -2596,7 +2571,7 @@ static ColChkVsFunc sACVsFuncs[COLSHAPE_MAX][COLSHAPE_MAX] = { /** * Iterates through all AC colliders, performing AC collisions with the AT collider. */ -void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* colAT) { +void CollisionCheck_AC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* colAT) { Collider** col; for (col = colChkCtx->colAC; col < colChkCtx->colAC + colChkCtx->colACCount; col++) { @@ -2610,7 +2585,7 @@ void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colChkCt if (!(colAT->atFlags & AT_SELF) && colAT->actor != NULL && colAC->actor == colAT->actor) { continue; } - sACVsFuncs[colAT->shape][colAC->shape](globalCtx, colChkCtx, colAT, colAC); + sACVsFuncs[colAT->shape][colAC->shape](play, colChkCtx, colAT, colAC); } } } @@ -2622,7 +2597,7 @@ void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colChkCt * successful collision. To collide, an AT collider must share a type (AC_TYPE_PLAYER, AC_TYPE_ENEMY, or AC_TYPE_OTHER) * with the AC collider and the toucher and bumper elements that overlapped must share a dmgFlag. */ -void CollisionCheck_AT(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_AT(PlayState* play, CollisionCheckContext* colChkCtx) { Collider** col; if (colChkCtx->colATCount == 0 || colChkCtx->colACCount == 0) { @@ -2635,10 +2610,10 @@ void CollisionCheck_AT(GlobalContext* globalCtx, CollisionCheckContext* colChkCt if (colAT->actor != NULL && colAT->actor->update == NULL) { continue; } - CollisionCheck_AC(globalCtx, colChkCtx, colAT); + CollisionCheck_AC(play, colChkCtx, colAT); } } - CollisionCheck_SetHitEffects(globalCtx, colChkCtx); + CollisionCheck_SetHitEffects(play, colChkCtx); } /** @@ -2752,8 +2727,7 @@ void CollisionCheck_SetOCvsOC(Collider* left, ColliderInfo* leftInfo, Vec3f* lef /** * OC overlap check for two JntSphs */ -void CollisionCheck_OC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, - Collider* r) { +void CollisionCheck_OC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { ColliderJntSph* left = (ColliderJntSph*)l; ColliderJntSphElement* leftElem; ColliderJntSph* right = (ColliderJntSph*)r; @@ -2786,8 +2760,7 @@ void CollisionCheck_OC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckCo /** * OC overlap check for a JntSph and Cylinder */ -void CollisionCheck_OC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, - Collider* r) { +void CollisionCheck_OC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { ColliderJntSph* left = (ColliderJntSph*)l; ColliderJntSphElement* leftElem; ColliderCylinder* right = (ColliderCylinder*)r; @@ -2816,15 +2789,14 @@ void CollisionCheck_OC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckConte /** * OC overlap check for a Cylinder and JntSph */ -void CollisionCheck_OC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, - Collider* r) { - CollisionCheck_OC_JntSphVsCyl(globalCtx, colChkCtx, r, l); +void CollisionCheck_OC_CylVsJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { + CollisionCheck_OC_JntSphVsCyl(play, colChkCtx, r, l); } /** * OC overlap check for two Cylinders */ -void CollisionCheck_OC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { +void CollisionCheck_OC_CylVsCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { ColliderCylinder* left = (ColliderCylinder*)l; ColliderCylinder* right = (ColliderCylinder*)r; f32 deadSpace; @@ -2886,7 +2858,7 @@ static ColChkVsFunc sOCVsFuncs[COLSHAPE_MAX][COLSHAPE_MAX] = { * can collide, and each collider must have the OC flag corresponding to the other's OC type. Additionally, OC2_UNK1 * cannot collide with OC2_UNK2, nor can two colliders that share an actor. */ -void CollisionCheck_OC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_OC(PlayState* play, CollisionCheckContext* colChkCtx) { Collider** left; Collider** right; ColChkVsFunc vsFunc; @@ -2906,7 +2878,7 @@ void CollisionCheck_OC(GlobalContext* globalCtx, CollisionCheckContext* colChkCt osSyncPrintf("CollisionCheck_OC():未対応 %d, %d\n", (*left)->shape, (*right)->shape); continue; } - vsFunc(globalCtx, colChkCtx, *left, *right); + vsFunc(play, colChkCtx, *left, *right); } } } @@ -2978,7 +2950,7 @@ void CollisionCheck_SetInfoGetDamageTable(CollisionCheckInfo* info, s32 index, C /** * Apply AC damage effect */ -void CollisionCheck_ApplyDamage(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, +void CollisionCheck_ApplyDamage(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, ColliderInfo* info) { DamageTable* tbl; f32 damage; @@ -3018,13 +2990,13 @@ void CollisionCheck_ApplyDamage(GlobalContext* globalCtx, CollisionCheckContext* /** * Apply ColliderJntSph AC damage effect */ -void CollisionCheck_ApplyDamageJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_ApplyDamageJntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderJntSph* jntSph = (ColliderJntSph*)collider; s32 i; if (jntSph->count > 0 && jntSph->elements != NULL) { for (i = 0; i < jntSph->count; i++) { - CollisionCheck_ApplyDamage(globalCtx, colChkCtx, &jntSph->base, &jntSph->elements[i].info); + CollisionCheck_ApplyDamage(play, colChkCtx, &jntSph->base, &jntSph->elements[i].info); } } } @@ -3032,29 +3004,29 @@ void CollisionCheck_ApplyDamageJntSph(GlobalContext* globalCtx, CollisionCheckCo /** * Apply ColliderCylinder AC damage effect */ -void CollisionCheck_ApplyDamageCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_ApplyDamageCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderCylinder* cylinder = (ColliderCylinder*)collider; - CollisionCheck_ApplyDamage(globalCtx, colChkCtx, &cylinder->base, &cylinder->info); + CollisionCheck_ApplyDamage(play, colChkCtx, &cylinder->base, &cylinder->info); } /** * Apply ColliderTris AC damage effect */ -void CollisionCheck_ApplyDamageTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_ApplyDamageTris(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderTris* tris = (ColliderTris*)collider; s32 i; for (i = 0; i < tris->count; i++) { - CollisionCheck_ApplyDamage(globalCtx, colChkCtx, collider, &tris->elements[i].info); + CollisionCheck_ApplyDamage(play, colChkCtx, collider, &tris->elements[i].info); } } /** * Apply ColliderQuad AC damage effect */ -void CollisionCheck_ApplyDamageQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { +void CollisionCheck_ApplyDamageQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider) { ColliderQuad* quad = (ColliderQuad*)collider; - CollisionCheck_ApplyDamage(globalCtx, colChkCtx, &quad->base, &quad->info); + CollisionCheck_ApplyDamage(play, colChkCtx, &quad->base, &quad->info); } static ColChkApplyFunc sApplyDamageFuncs[COLSHAPE_MAX] = { @@ -3068,7 +3040,7 @@ static ColChkApplyFunc sApplyDamageFuncs[COLSHAPE_MAX] = { * For all AC colliders, sets any damage effects from collisions with AT colliders to their corresponding actor's * CollisionCheckInfo. */ -void CollisionCheck_Damage(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +void CollisionCheck_Damage(PlayState* play, CollisionCheckContext* colChkCtx) { s32 i; for (i = 0; i < colChkCtx->colACCount; i++) { @@ -3080,15 +3052,15 @@ void CollisionCheck_Damage(GlobalContext* globalCtx, CollisionCheckContext* colC if (collider->acFlags & AC_NO_DAMAGE) { continue; } - sApplyDamageFuncs[collider->shape](globalCtx, colChkCtx, collider); + sApplyDamageFuncs[collider->shape](play, colChkCtx, collider); } } /** * Checks if the line ab intersects any of the ColliderJntSph's elements */ -s32 CollisionCheck_LineOC_JntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, - Vec3f* a, Vec3f* b) { +s32 CollisionCheck_LineOC_JntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, + Vec3f* b) { static Linef lineSeg; ColliderJntSph* jntSph = (ColliderJntSph*)collider; s32 i; @@ -3111,7 +3083,7 @@ s32 CollisionCheck_LineOC_JntSph(GlobalContext* globalCtx, CollisionCheckContext /** * Checks if the line segment ab intersects the ColliderCylinder */ -s32 CollisionCheck_LineOC_Cyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, +s32 CollisionCheck_LineOC_Cyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, Vec3f* b) { static Vec3f intersectA; static Vec3f intersectB; @@ -3137,8 +3109,8 @@ static ColChkLineFunc sOCLineCheckFuncs[COLSHAPE_MAX] = { * Checks if the line segment ab intersects any OC colliders, excluding those attached to actors * on the exclusion list. Returns true if there are any intersections and false otherwise. */ -s32 CollisionCheck_LineOC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, - Actor** exclusions, s32 numExclusions) { +s32 CollisionCheck_LineOC(PlayState* play, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, Actor** exclusions, + s32 numExclusions) { ColChkLineFunc lineCheck; Collider** col; s32 i; @@ -3164,7 +3136,7 @@ s32 CollisionCheck_LineOC(GlobalContext* globalCtx, CollisionCheckContext* colCh // "type %d not supported" osSyncPrintf("CollisionCheck_generalLineOcCheck():未対応 %dタイプ\n", (*col)->shape); } else { - result = lineCheck(globalCtx, colChkCtx, (*col), a, b); + result = lineCheck(play, colChkCtx, (*col), a, b); if (result) { break; } @@ -3177,17 +3149,17 @@ s32 CollisionCheck_LineOC(GlobalContext* globalCtx, CollisionCheckContext* colCh * Checks if the line segment ab intersects any OC colliders. Returns true if there are any intersections and false * otherwise. Unused. */ -s32 CollisionCheck_LineOCCheckAll(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b) { - return CollisionCheck_LineOC(globalCtx, colChkCtx, a, b, NULL, 0); +s32 CollisionCheck_LineOCCheckAll(PlayState* play, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b) { + return CollisionCheck_LineOC(play, colChkCtx, a, b, NULL, 0); } /** * Checks if the line segment ab intersects any OC colliders, excluding those attached to actors on the exclusion list. * Returns true if there are any intersections and false otherwise. */ -s32 CollisionCheck_LineOCCheck(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, +s32 CollisionCheck_LineOCCheck(PlayState* play, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, Actor** exclusions, s32 numExclusions) { - return CollisionCheck_LineOC(globalCtx, colChkCtx, a, b, exclusions, numExclusions); + return CollisionCheck_LineOC(play, colChkCtx, a, b, exclusions, numExclusions); } /** @@ -3242,10 +3214,10 @@ void Collider_SetTrisVertices(ColliderTris* collider, s32 index, Vec3f* a, Vec3f /** * Sets the specified ColliderTrisElement's dim using the values in src */ -void Collider_SetTrisDim(GlobalContext* globalCtx, ColliderTris* collider, s32 index, ColliderTrisElementDimInit* src) { +void Collider_SetTrisDim(PlayState* play, ColliderTris* collider, s32 index, ColliderTrisElementDimInit* src) { ColliderTrisElement* element = &collider->elements[index]; - Collider_SetTrisElementDim(globalCtx, &element->dim, src); + Collider_SetTrisElementDim(play, &element->dim, src); } // Due to an unknown reason, bss ordering changed between the 2 static Vec3f variables in the function below. @@ -3284,7 +3256,7 @@ void Collider_UpdateSpheres(s32 limb, ColliderJntSph* collider) { * Spawns red blood droplets. * No actor has a collision type that spawns red blood. */ -void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v) { +void CollisionCheck_SpawnRedBlood(PlayState* play, Vec3f* v) { static EffectSparkInit sparkInit; s32 effectIndex; @@ -3330,14 +3302,14 @@ void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v) { sparkInit.speed = 8.0f; sparkInit.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &sparkInit); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &sparkInit); } /** * Spawns water droplets. * No actor has a collision type that spawns water droplets. */ -void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v) { +void CollisionCheck_SpawnWaterDroplets(PlayState* play, Vec3f* v) { static EffectSparkInit sparkInit; s32 effectIndex; @@ -3383,13 +3355,13 @@ void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v) { sparkInit.speed = 8.0f; sparkInit.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &sparkInit); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &sparkInit); } /** * Spawns streaks of light from hits against solid objects */ -void CollisionCheck_SpawnShieldParticles(GlobalContext* globalCtx, Vec3f* v) { +void CollisionCheck_SpawnShieldParticles(PlayState* play, Vec3f* v) { static EffectShieldParticleInit metalInit = { 16, { 0, 0, 0 }, @@ -3415,14 +3387,14 @@ void CollisionCheck_SpawnShieldParticles(GlobalContext* globalCtx, Vec3f* v) { metalInit.lightPoint.y = metalInit.position.y; metalInit.lightPoint.z = metalInit.position.z; - Effect_Add(globalCtx, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &metalInit); + Effect_Add(play, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &metalInit); } /** * Spawns streaks of light and makes a metallic sound */ -void CollisionCheck_SpawnShieldParticlesMetal(GlobalContext* globalCtx, Vec3f* v) { - CollisionCheck_SpawnShieldParticles(globalCtx, v); +void CollisionCheck_SpawnShieldParticlesMetal(PlayState* play, Vec3f* v) { + CollisionCheck_SpawnShieldParticles(play, v); Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_REFLECT_SW, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } @@ -3430,8 +3402,8 @@ void CollisionCheck_SpawnShieldParticlesMetal(GlobalContext* globalCtx, Vec3f* v /** * Spawns streaks of light and makes a metallic sound at the specified position */ -void CollisionCheck_SpawnShieldParticlesMetalSound(GlobalContext* globalCtx, Vec3f* v, Vec3f* pos) { - CollisionCheck_SpawnShieldParticles(globalCtx, v); +void CollisionCheck_SpawnShieldParticlesMetalSound(PlayState* play, Vec3f* v, Vec3f* pos) { + CollisionCheck_SpawnShieldParticles(play, v); Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_REFLECT_SW, pos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } @@ -3439,14 +3411,14 @@ void CollisionCheck_SpawnShieldParticlesMetalSound(GlobalContext* globalCtx, Vec /** * Spawns streaks of light and makes a metallic sound */ -void CollisionCheck_SpawnShieldParticlesMetal2(GlobalContext* globalCtx, Vec3f* v) { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, v); +void CollisionCheck_SpawnShieldParticlesMetal2(PlayState* play, Vec3f* v) { + CollisionCheck_SpawnShieldParticlesMetal(play, v); } /** * Spawns streaks of light and makes a wooden sound */ -void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* globalCtx, Vec3f* v, Vec3f* actorPos) { +void CollisionCheck_SpawnShieldParticlesWood(PlayState* play, Vec3f* v, Vec3f* actorPos) { static EffectShieldParticleInit woodInit = { 16, { 0, 0, 0 }, @@ -3472,7 +3444,7 @@ void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* globalCtx, Vec3f* v, woodInit.lightPoint.y = woodInit.position.y; woodInit.lightPoint.z = woodInit.position.z; - Effect_Add(globalCtx, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &woodInit); + Effect_Add(play, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &woodInit); Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, actorPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } diff --git a/src/code/z_construct.c b/src/code/z_construct.c index cbf9983ad3..f4ce2ad7c0 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -1,11 +1,11 @@ #include "global.h" -void func_80110990(GlobalContext* globalCtx) { - Map_Destroy(globalCtx); +void func_80110990(PlayState* play) { + Map_Destroy(play); } -void func_801109B0(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_801109B0(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; u32 parameterSize; u16 doActionOffset; u8 temp; @@ -13,7 +13,7 @@ void func_801109B0(GlobalContext* globalCtx) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; gSaveContext.unk_13E8 = gSaveContext.unk_13EA = 0; - View_Init(&interfaceCtx->view, globalCtx->state.gfxCtx); + View_Init(&interfaceCtx->view, play->state.gfxCtx); interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0; interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = interfaceCtx->unk_1F0 = 0; @@ -32,7 +32,7 @@ void func_801109B0(GlobalContext* globalCtx) { // "Permanent PARAMETER Segment = %x" osSyncPrintf("常駐PARAMETERセグメント=%x\n", parameterSize); - interfaceCtx->parameterSegment = GameState_Alloc(&globalCtx->state, parameterSize, "../z_construct.c", 159); + interfaceCtx->parameterSegment = GameState_Alloc(&play->state, parameterSize, "../z_construct.c", 159); osSyncPrintf("parameter->parameterSegment=%x\n", interfaceCtx->parameterSegment); @@ -40,7 +40,7 @@ void func_801109B0(GlobalContext* globalCtx) { DmaMgr_SendRequest1(interfaceCtx->parameterSegment, (u32)_parameter_staticSegmentRomStart, parameterSize, "../z_construct.c", 162); - interfaceCtx->doActionSegment = GameState_Alloc(&globalCtx->state, 0x480, "../z_construct.c", 166); + interfaceCtx->doActionSegment = GameState_Alloc(&play->state, 0x480, "../z_construct.c", 166); osSyncPrintf("DOアクション テクスチャ初期=%x\n", 0x480); // "DO Action Texture Initialization" osSyncPrintf("parameter->do_actionSegment=%x\n", interfaceCtx->doActionSegment); @@ -69,7 +69,7 @@ void func_801109B0(GlobalContext* globalCtx) { DmaMgr_SendRequest1(interfaceCtx->doActionSegment + 0x300, (u32)_do_action_staticSegmentRomStart + doActionOffset, 0x180, "../z_construct.c", 178); - interfaceCtx->iconItemSegment = GameState_Alloc(&globalCtx->state, 0x4000, "../z_construct.c", 190); + interfaceCtx->iconItemSegment = GameState_Alloc(&play->state, 0x4000, "../z_construct.c", 190); // "Icon Item Texture Initialization = %x" osSyncPrintf("アイコンアイテム テクスチャ初期=%x\n", 0x4000); @@ -146,8 +146,8 @@ void func_801109B0(GlobalContext* globalCtx) { osSyncPrintf("PARAMETER領域=%x\n", parameterSize + 0x5300); // "Parameter Area = %x" - Health_InitMeter(globalCtx); - Map_Init(globalCtx); + Health_InitMeter(play); + Map_Init(play); interfaceCtx->unk_23C = interfaceCtx->unk_242 = 0; @@ -164,29 +164,29 @@ void func_801109B0(GlobalContext* globalCtx) { R_A_BTN_COLOR(2) = 50; } -void Message_Init(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_Init(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; s32 pad; Message_SetTables(); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + play->msgCtx.ocarinaMode = OCARINA_MODE_00; msgCtx->msgMode = MSGMODE_NONE; msgCtx->msgLength = 0; msgCtx->textId = msgCtx->textboxEndType = msgCtx->choiceIndex = msgCtx->ocarinaAction = msgCtx->textUnskippable = 0; msgCtx->textColorAlpha = 255; - View_Init(&msgCtx->view, globalCtx->state.gfxCtx); + View_Init(&msgCtx->view, play->state.gfxCtx); - msgCtx->textboxSegment = GameState_Alloc(&globalCtx->state, 0x2200, "../z_construct.c", 349); + msgCtx->textboxSegment = GameState_Alloc(&play->state, 0x2200, "../z_construct.c", 349); osSyncPrintf("message->fukidashiSegment=%x\n", msgCtx->textboxSegment); osSyncPrintf("吹き出しgame_alloc=%x\n", 0x2200); // "Textbox game_alloc=%x" ASSERT(msgCtx->textboxSegment != NULL, "message->fukidashiSegment != NULL", "../z_construct.c", 352); - Font_LoadOrderedFont(&globalCtx->msgCtx.font); + Font_LoadOrderedFont(&play->msgCtx.font); YREG(31) = 0; } @@ -600,6 +600,6 @@ void func_80111070(void) { VREG(92) = -63; } -void func_80112098(GlobalContext* globalCtx) { +void func_80112098(PlayState* play) { func_80111070(); } diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c index c405d58df1..c24f946544 100644 --- a/src/code/z_debug_display.c +++ b/src/code/z_debug_display.c @@ -6,10 +6,10 @@ typedef struct { /* 0x04 */ void* drawArg; // segment address (display list or texture) passed to the draw function when called } DebugDispObjectInfo; // size = 0x8 -typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, GlobalContext*); +typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, PlayState*); -void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, GlobalContext* globalCtx); -void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalContext* globalCtx); +void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, PlayState* play); +void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, PlayState* play); static DebugDispObject_DrawFunc sDebugObjectDrawFuncTable[] = { DebugDisplay_DrawSpriteI8, @@ -55,43 +55,43 @@ DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, return sDebugObjectListHead; } -void DebugDisplay_DrawObjects(GlobalContext* globalCtx) { +void DebugDisplay_DrawObjects(PlayState* play) { DebugDispObject* dispObj = sDebugObjectListHead; DebugDispObjectInfo* objInfo; while (dispObj != NULL) { objInfo = &sDebugObjectInfoTable[dispObj->type]; - sDebugObjectDrawFuncTable[objInfo->drawType](dispObj, objInfo->drawArg, globalCtx); + sDebugObjectDrawFuncTable[objInfo->drawType](dispObj, objInfo->drawArg, play); dispObj = dispObj->next; } } -void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 169); +void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_debug_display.c", 169); - func_80094678(globalCtx->state.gfxCtx); + func_80094678(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a); Matrix_Translate(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, MTXMODE_NEW); Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZYX(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY); gDPLoadTextureBlock(POLY_XLU_DISP++, texture, G_IM_FMT_I, G_IM_SIZ_8b, 16, 16, 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); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 189), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_debug_display.c", 189), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gDebugSpriteDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 192); + CLOSE_DISPS(play->state.gfxCtx, "../z_debug_display.c", 192); } -void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 211); +void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_debug_display.c", 211); - func_8009435C(globalCtx->state.gfxCtx); + func_8009435C(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a); @@ -100,9 +100,9 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalConte Matrix_SetTranslateRotateYXZ(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot); Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 228), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_debug_display.c", 228), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, dlist); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 231); + CLOSE_DISPS(play->state.gfxCtx, "../z_debug_display.c", 231); } diff --git a/src/code/z_demo.c b/src/code/z_demo.c index f7bc14e793..f5b730a0e8 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -32,14 +32,14 @@ u16 D_8011E1C0 = 0; u16 D_8011E1C4 = 0; -typedef void (*CutsceneStateHandler)(GlobalContext*, CutsceneContext*); +typedef void (*CutsceneStateHandler)(PlayState*, CutsceneContext*); -void func_80064720(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80064760(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_800647C0(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80068D84(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx); +void func_80064720(PlayState* play, CutsceneContext* csCtx); +void func_80064760(PlayState* play, CutsceneContext* csCtx); +void func_800647C0(PlayState* play, CutsceneContext* csCtx); +void func_80068C3C(PlayState* play, CutsceneContext* csCtx); +void func_80068D84(PlayState* play, CutsceneContext* csCtx); +void func_80068DC0(PlayState* play, CutsceneContext* csCtx); CutsceneStateHandler sCsStateHandlers1[] = { func_80064720, func_80064760, func_80064720, func_80068D84, func_80064720, @@ -103,9 +103,9 @@ u16 D_8015FCCC; // only written to, never read char D_8015FCD0[20]; // unreferenced u8 D_8015FCE4; // only written to, never read -void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx); +void func_80068ECC(PlayState* play, CutsceneContext* csCtx); -void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneContext* csCtx) { +void Cutscene_DrawDebugInfo(PlayState* play, Gfx** dlist, CutsceneContext* csCtx) { GfxPrint printer; s32 pad[2]; @@ -125,30 +125,30 @@ void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneConte GfxPrint_Destroy(&printer); } -void func_8006450C(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_8006450C(PlayState* play, CutsceneContext* csCtx) { csCtx->state = CS_STATE_IDLE; csCtx->unk_0C = 0.0f; } -void func_80064520(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80064520(PlayState* play, CutsceneContext* csCtx) { csCtx->state = CS_STATE_SKIPPABLE_INIT; csCtx->linkAction = NULL; } -void func_80064534(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80064534(PlayState* play, CutsceneContext* csCtx) { if (csCtx->state != CS_STATE_UNSKIPPABLE_EXEC) { csCtx->state = CS_STATE_UNSKIPPABLE_INIT; } } -void func_80064558(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80064558(PlayState* play, CutsceneContext* csCtx) { if (gSaveContext.cutsceneIndex < 0xFFF0) { - sCsStateHandlers1[csCtx->state](globalCtx, csCtx); + sCsStateHandlers1[csCtx->state](play, csCtx); } } -void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) { - Input* input = &globalCtx->state.input[0]; +void func_800645A0(PlayState* play, CutsceneContext* csCtx) { + Input* input = &play->state.input[0]; if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneSetupIndex >= 4)) { @@ -164,7 +164,7 @@ void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) { gSaveContext.cutsceneTrigger = 1; } - if ((gSaveContext.cutsceneTrigger != 0) && (globalCtx->transitionTrigger == TRANS_TRIGGER_START)) { + if ((gSaveContext.cutsceneTrigger != 0) && (play->transitionTrigger == TRANS_TRIGGER_START)) { gSaveContext.cutsceneTrigger = 0; } @@ -175,42 +175,42 @@ void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) { } if (gSaveContext.cutsceneIndex >= 0xFFF0) { - func_80068ECC(globalCtx, csCtx); - sCsStateHandlers2[csCtx->state](globalCtx, csCtx); + func_80068ECC(play, csCtx); + sCsStateHandlers2[csCtx->state](play, csCtx); } } -void func_80064720(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80064720(PlayState* play, CutsceneContext* csCtx) { } -u32 func_8006472C(GlobalContext* globalCtx, CutsceneContext* csCtx, f32 target) { +u32 func_8006472C(PlayState* play, CutsceneContext* csCtx, f32 target) { return Math_StepToF(&csCtx->unk_0C, target, 0.1f); } -void func_80064760(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80064760(PlayState* play, CutsceneContext* csCtx) { Interface_ChangeAlpha(1); ShrinkWindow_SetVal(0x20); - if (func_8006472C(globalCtx, csCtx, 1.0f)) { + if (func_8006472C(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(1); csCtx->state++; } } -void func_800647C0(GlobalContext* globalCtx, CutsceneContext* csCtx) { - func_80068C3C(globalCtx, csCtx); +void func_800647C0(PlayState* play, CutsceneContext* csCtx) { + func_80068C3C(play, csCtx); Interface_ChangeAlpha(1); ShrinkWindow_SetVal(0x20); - if (func_8006472C(globalCtx, csCtx, 1.0f)) { + if (func_8006472C(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(1); csCtx->state++; } } // Command 3: Misc. Actions -void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { - Player* player = GET_PLAYER(globalCtx); +void func_80064824(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { + Player* player = GET_PLAYER(play); f32 temp; u8 sp3F = 0; @@ -229,60 +229,60 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* if (sp3F != 0) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_4, 0x3F); Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 1); - globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] = 20; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 20; } break; case 2: if (sp3F != 0) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0); - Environment_AddLightningBolts(globalCtx, 3); + Environment_AddLightningBolts(play, 3); gLightningStrike.state = LIGHTNING_STRIKE_START; } break; case 3: if (sp3F != 0) { - Flags_SetEnv(globalCtx, 0); + Flags_SetEnv(play, 0); if (gSaveContext.entranceIndex == ENTR_TOKINOMA_0) { - Flags_SetEnv(globalCtx, 2); + Flags_SetEnv(play, 2); } } break; case 6: - if (globalCtx->envCtx.adjFogFar < 12800) { - globalCtx->envCtx.adjFogFar += 35; + if (play->envCtx.adjFogFar < 12800) { + play->envCtx.adjFogFar += 35; } break; case 7: if (sp3F != 0) { - globalCtx->envCtx.changeSkyboxState = CHANGE_SKYBOX_REQUESTED; - globalCtx->envCtx.skyboxConfig = 1; - globalCtx->envCtx.changeSkyboxNextConfig = 0; - globalCtx->envCtx.changeSkyboxTimer = 60; - globalCtx->envCtx.changeLightEnabled = true; - globalCtx->envCtx.lightConfig = 0; - globalCtx->envCtx.changeLightNextConfig = 1; - globalCtx->envCtx.changeLightTimer = globalCtx->envCtx.changeDuration = 60; + play->envCtx.changeSkyboxState = CHANGE_SKYBOX_REQUESTED; + play->envCtx.skyboxConfig = 1; + play->envCtx.changeSkyboxNextConfig = 0; + play->envCtx.changeSkyboxTimer = 60; + play->envCtx.changeLightEnabled = true; + play->envCtx.lightConfig = 0; + play->envCtx.changeLightNextConfig = 1; + play->envCtx.changeLightTimer = play->envCtx.changeDuration = 60; } break; case 8: - if (globalCtx->roomCtx.unk_74[0] < 0x80) { - globalCtx->roomCtx.unk_74[0] += 4; + if (play->roomCtx.unk_74[0] < 0x80) { + play->roomCtx.unk_74[0] += 4; } break; case 9: - globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX] = 16; + play->envCtx.precipitation[PRECIP_SNOW_MAX] = 16; break; case 10: - Flags_SetEnv(globalCtx, 1); + Flags_SetEnv(play, 1); break; case 11: - if (globalCtx->roomCtx.unk_74[0] < 0x672) { - globalCtx->roomCtx.unk_74[0] += 0x14; + if (play->roomCtx.unk_74[0] < 0x672) { + play->roomCtx.unk_74[0] += 0x14; } if (csCtx->frames == 0x30F) { func_80078884(NA_SE_EV_DEKU_DEATH); } else if (csCtx->frames == 0x2CD) { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; } break; case 12: @@ -293,27 +293,26 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* } break; case 13: - if (globalCtx->roomCtx.unk_74[1] == 0) { + if (play->roomCtx.unk_74[1] == 0) { func_80078884(NA_SE_EV_TRIFORCE_FLASH); } - if (globalCtx->roomCtx.unk_74[1] < 0xFF) { - globalCtx->roomCtx.unk_74[1] += 5; + if (play->roomCtx.unk_74[1] < 0xFF) { + play->roomCtx.unk_74[1] += 5; } break; case 14: if (sp3F != 0) { - func_800BC490(globalCtx, 1); + func_800BC490(play, 1); } break; case 15: if (sp3F != 0) { - TitleCard_InitPlaceName(globalCtx, &globalCtx->actorCtx.titleCtx, player->giObjectSegment, 160, 120, - 144, 24, 20); + TitleCard_InitPlaceName(play, &play->actorCtx.titleCtx, player->giObjectSegment, 160, 120, 144, 24, 20); } break; case 16: if (sp3F != 0) { - sQuakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 6); + sQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6); Quake_SetSpeed(sQuakeIndex, 0x7FFF); Quake_SetQuakeValues(sQuakeIndex, 4, 0, 1000, 0); Quake_SetCountdown(sQuakeIndex, 800); @@ -325,12 +324,12 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* } break; case 18: - globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; - globalCtx->envCtx.stormRequest = STORM_REQUEST_STOP; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; + play->envCtx.stormRequest = STORM_REQUEST_STOP; if (gSaveContext.dayTime < CLOCK_TIME(7, 0)) { gSaveContext.dayTime += 30; } - if (globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR] == 0) { + if (play->envCtx.precipitation[PRECIP_RAIN_CUR] == 0) { gWeatherMode = WEATHER_MODE_CLEAR; Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0); } @@ -357,7 +356,7 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* D_801614B0.a = 255.0f * temp; break; case 24: - globalCtx->roomCtx.curRoom.segment = NULL; + play->roomCtx.curRoom.segment = NULL; break; case 25: gSaveContext.dayTime += 30; @@ -368,45 +367,45 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* case 26: if ((gSaveContext.dayTime < CLOCK_TIME(4, 30)) || (gSaveContext.dayTime >= CLOCK_TIME(6, 30))) { if ((gSaveContext.dayTime >= CLOCK_TIME(6, 30)) && (gSaveContext.dayTime < CLOCK_TIME(16, 0))) { - globalCtx->envCtx.lightSettingOverride = 1; + play->envCtx.lightSettingOverride = 1; } else if ((gSaveContext.dayTime >= CLOCK_TIME(16, 0)) && (gSaveContext.dayTime <= CLOCK_TIME(18, 30))) { - globalCtx->envCtx.lightSettingOverride = 2; + play->envCtx.lightSettingOverride = 2; } else { - globalCtx->envCtx.lightSettingOverride = 3; + play->envCtx.lightSettingOverride = 3; } } break; case 27: - if (globalCtx->state.frames & 8) { - if (globalCtx->envCtx.adjAmbientColor[0] < 40) { - globalCtx->envCtx.adjAmbientColor[0] += 2; - globalCtx->envCtx.adjLight1Color[1] -= 3; - globalCtx->envCtx.adjLight1Color[2] -= 3; + if (play->state.frames & 8) { + if (play->envCtx.adjAmbientColor[0] < 40) { + play->envCtx.adjAmbientColor[0] += 2; + play->envCtx.adjLight1Color[1] -= 3; + play->envCtx.adjLight1Color[2] -= 3; } } else { - if (globalCtx->envCtx.adjAmbientColor[0] > 2) { - globalCtx->envCtx.adjAmbientColor[0] -= 2; - globalCtx->envCtx.adjLight1Color[1] += 3; - globalCtx->envCtx.adjLight1Color[2] += 3; + if (play->envCtx.adjAmbientColor[0] > 2) { + play->envCtx.adjAmbientColor[0] -= 2; + play->envCtx.adjLight1Color[1] += 3; + play->envCtx.adjLight1Color[2] += 3; } } break; case 28: - globalCtx->unk_11DE9 = true; + play->unk_11DE9 = true; break; case 29: - globalCtx->unk_11DE9 = false; + play->unk_11DE9 = false; break; case 30: - Flags_SetEnv(globalCtx, 3); + Flags_SetEnv(play, 3); break; case 31: - Flags_SetEnv(globalCtx, 4); + Flags_SetEnv(play, 4); break; case 32: if (sp3F != 0) { - globalCtx->envCtx.sandstormState = SANDSTORM_FILL; + play->envCtx.sandstormState = SANDSTORM_FILL; } func_800788CC(NA_SE_EV_SAND_STORM - SFX_FLAG); break; @@ -428,29 +427,29 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* } // Command 4: Set Environment Lighting -void Cutscene_Command_SetLighting(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdEnvLighting* cmd) { +void Cutscene_Command_SetLighting(PlayState* play, CutsceneContext* csCtx, CsCmdEnvLighting* cmd) { if (csCtx->frames == cmd->startFrame) { - globalCtx->envCtx.lightSettingOverride = cmd->setting - 1; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightSettingOverride = cmd->setting - 1; + play->envCtx.lightBlend = 1.0f; } } // Command 0x56: Play Background Music -void Cutscene_Command_PlayBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicChange* cmd) { +void Cutscene_Command_PlayBGM(PlayState* play, CutsceneContext* csCtx, CsCmdMusicChange* cmd) { if (csCtx->frames == cmd->startFrame) { func_800F595C(cmd->sequence - 1); } } // Command 0x57: Stop Background Music -void Cutscene_Command_StopBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicChange* cmd) { +void Cutscene_Command_StopBGM(PlayState* play, CutsceneContext* csCtx, CsCmdMusicChange* cmd) { if (csCtx->frames == cmd->startFrame) { func_800F59E8(cmd->sequence - 1); } } // Command 0x7C: Fade Background Music over duration -void Cutscene_Command_FadeBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicFade* cmd) { +void Cutscene_Command_FadeBGM(PlayState* play, CutsceneContext* csCtx, CsCmdMusicFade* cmd) { u8 var1; if ((csCtx->frames == cmd->startFrame) && (csCtx->frames < cmd->endFrame)) { @@ -465,14 +464,14 @@ void Cutscene_Command_FadeBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, } // Command 9: ? -void Cutscene_Command_09(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdUnknown9* cmd) { +void Cutscene_Command_09(PlayState* play, CutsceneContext* csCtx, CsCmdUnknown9* cmd) { if (csCtx->frames == cmd->startFrame) { func_800AA000(0.0f, cmd->unk_06, cmd->unk_07, cmd->unk_08); } } // Command 0x8C: Set Time of Day & Environment Time -void func_80065134(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdDayTime* cmd) { +void func_80065134(PlayState* play, CutsceneContext* csCtx, CsCmdDayTime* cmd) { s16 temp1; s16 temp2; @@ -486,23 +485,23 @@ void func_80065134(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdDayTim } // Command 0x3E8: Code Execution (& Terminates Cutscene?) -void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { - Player* player = GET_PLAYER(globalCtx); +void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { + Player* player = GET_PLAYER(play); s32 temp = 0; - if ((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 3) && (globalCtx->sceneNum != SCENE_SPOT00) && + if ((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 3) && (play->sceneNum != SCENE_SPOT00) && (csCtx->frames > 20) && - (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START)) && - (gSaveContext.fileNum != 0xFEDC) && (globalCtx->transitionTrigger == TRANS_TRIGGER_OFF)) { + (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START)) && + (gSaveContext.fileNum != 0xFEDC) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); temp = 1; } if ((csCtx->frames == cmd->startFrame) || (temp != 0) || - ((csCtx->frames > 20) && CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) && + ((csCtx->frames > 20) && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) && (gSaveContext.fileNum != 0xFEDC))) { csCtx->state = CS_STATE_UNSKIPPABLE_EXEC; Audio_SetCutsceneFlag(0); @@ -518,477 +517,477 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt switch (cmd->base) { case 1: - globalCtx->nextEntranceIndex = ENTR_HIRAL_DEMO_0; + play->nextEntranceIndex = ENTR_HIRAL_DEMO_0; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 2: - globalCtx->nextEntranceIndex = ENTR_HIRAL_DEMO_0; + play->nextEntranceIndex = ENTR_HIRAL_DEMO_0; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FILL_WHITE; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FILL_WHITE; break; case 3: - globalCtx->nextEntranceIndex = ENTR_SPOT09_0; + play->nextEntranceIndex = ENTR_SPOT09_0; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FILL_WHITE; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FILL_WHITE; break; case 4: - globalCtx->nextEntranceIndex = ENTR_SPOT16_0; + play->nextEntranceIndex = ENTR_SPOT16_0; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FILL_WHITE; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FILL_WHITE; break; case 5: - globalCtx->nextEntranceIndex = ENTR_SPOT04_0; + play->nextEntranceIndex = ENTR_SPOT04_0; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FILL_WHITE; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FILL_WHITE; break; case 6: - globalCtx->nextEntranceIndex = ENTR_HIRAL_DEMO_0; + play->nextEntranceIndex = ENTR_HIRAL_DEMO_0; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FILL_WHITE; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FILL_WHITE; break; case 7: - globalCtx->nextEntranceIndex = ENTR_SPOT04_0; + play->nextEntranceIndex = ENTR_SPOT04_0; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_INSTANT; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_INSTANT; break; case 8: gSaveContext.fw.set = 0; gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0; if (!GET_EVENTCHKINF(EVENTCHKINF_45)) { SET_EVENTCHKINF(EVENTCHKINF_45); - globalCtx->nextEntranceIndex = ENTR_HIRAL_DEMO_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_HIRAL_DEMO_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->transitionType = TRANS_TYPE_INSTANT; + play->transitionType = TRANS_TYPE_INSTANT; } else { if (gSaveContext.sceneSetupIndex < 4) { if (!LINK_IS_ADULT) { - globalCtx->linkAgeOnLoad = LINK_AGE_ADULT; + play->linkAgeOnLoad = LINK_AGE_ADULT; } else { - globalCtx->linkAgeOnLoad = LINK_AGE_CHILD; + play->linkAgeOnLoad = LINK_AGE_CHILD; } } - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_2; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = ENTR_TOKINOMA_2; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; } break; case 9: - globalCtx->nextEntranceIndex = ENTR_SPOT09_0; + play->nextEntranceIndex = ENTR_SPOT09_0; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FILL_BROWN; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FILL_BROWN; break; case 10: - globalCtx->nextEntranceIndex = ENTR_LINK_HOME_0; + play->nextEntranceIndex = ENTR_LINK_HOME_0; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 11: - globalCtx->nextEntranceIndex = ENTR_SPOT04_0; + play->nextEntranceIndex = ENTR_SPOT04_0; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 12: - globalCtx->nextEntranceIndex = ENTR_SPOT16_5; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT16_5; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 13: - globalCtx->nextEntranceIndex = ENTR_SPOT08_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT08_0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; case 14: - globalCtx->nextEntranceIndex = ENTR_SPOT04_11; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT04_11; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 15: - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_TOKINOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 16: - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_TOKINOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF5; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 17: - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_TOKINOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF6; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 18: SET_EVENTCHKINF(EVENTCHKINF_4F); - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_4; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_TOKINOMA_4; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; case 19: - globalCtx->nextEntranceIndex = ENTR_SPOT16_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->nextEntranceIndex = ENTR_SPOT16_0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; gSaveContext.cutsceneIndex = 0x8000; break; case 21: - globalCtx->nextEntranceIndex = ENTR_SPOT06_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT06_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 22: - Item_Give(globalCtx, ITEM_SONG_REQUIEM); - globalCtx->nextEntranceIndex = ENTR_SPOT11_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + Item_Give(play, ITEM_SONG_REQUIEM); + play->nextEntranceIndex = ENTR_SPOT11_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 23: - globalCtx->nextEntranceIndex = ENTR_HIRAL_DEMO_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_HIRAL_DEMO_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF8; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 24: - globalCtx->nextEntranceIndex = ENTR_BDAN_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_BDAN_0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 25: - globalCtx->linkAgeOnLoad = LINK_AGE_ADULT; - globalCtx->nextEntranceIndex = ENTR_KENJYANOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->linkAgeOnLoad = LINK_AGE_ADULT; + play->nextEntranceIndex = ENTR_KENJYANOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 26: - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_TOKINOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 27: - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_TOKINOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF5; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 28: - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_TOKINOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF6; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 29: - globalCtx->nextEntranceIndex = ENTR_KENJYANOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_KENJYANOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.chamberCutsceneNum = 0; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 30: - globalCtx->nextEntranceIndex = ENTR_KENJYANOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; - Item_Give(globalCtx, ITEM_MEDALLION_FIRE); + play->nextEntranceIndex = ENTR_KENJYANOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; + Item_Give(play, ITEM_MEDALLION_FIRE); gSaveContext.chamberCutsceneNum = 1; break; case 31: - globalCtx->nextEntranceIndex = ENTR_KENJYANOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = ENTR_KENJYANOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.chamberCutsceneNum = 2; break; case 32: - globalCtx->linkAgeOnLoad = LINK_AGE_CHILD; - globalCtx->nextEntranceIndex = ENTR_SPOT00_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->linkAgeOnLoad = LINK_AGE_CHILD; + play->nextEntranceIndex = ENTR_SPOT00_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->transitionType = TRANS_TYPE_INSTANT; + play->transitionType = TRANS_TYPE_INSTANT; break; case 33: - globalCtx->nextEntranceIndex = ENTR_SPOT00_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = ENTR_SPOT00_0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 34: - globalCtx->nextEntranceIndex = ENTR_HIRAL_DEMO_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_HIRAL_DEMO_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 35: - globalCtx->nextEntranceIndex = ENTR_SPOT00_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT00_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case 38: - globalCtx->nextEntranceIndex = ENTR_HIRAL_DEMO_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_HIRAL_DEMO_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case 39: - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_TOKINOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF9; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case 40: - globalCtx->linkAgeOnLoad = LINK_AGE_ADULT; - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->linkAgeOnLoad = LINK_AGE_ADULT; + play->nextEntranceIndex = ENTR_TOKINOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFFA; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case 41: - globalCtx->nextEntranceIndex = ENTR_SPOT06_5; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT06_5; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 42: - globalCtx->nextEntranceIndex = ENTR_SPOT01_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT01_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case 43: - globalCtx->nextEntranceIndex = ENTR_HAKASITARELAY_2; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->nextEntranceIndex = ENTR_HAKASITARELAY_2; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case 44: - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_3; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE_INSTANT; + play->nextEntranceIndex = ENTR_TOKINOMA_3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE_INSTANT; break; case 46: SET_EVENTCHKINF(EVENTCHKINF_4F); - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_4; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->nextEntranceIndex = ENTR_TOKINOMA_4; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case 47: - Item_Give(globalCtx, ITEM_SONG_NOCTURNE); + Item_Give(play, ITEM_SONG_NOCTURNE); SET_EVENTCHKINF(EVENTCHKINF_54); - globalCtx->nextEntranceIndex = ENTR_SPOT01_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT01_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case 48: - globalCtx->nextEntranceIndex = ENTR_SPOT11_4; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_SANDSTORM_END; + play->nextEntranceIndex = ENTR_SPOT11_4; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_SANDSTORM_END; gSaveContext.nextTransitionType = TRANS_TYPE_SANDSTORM_END; break; case 49: - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_5; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->nextEntranceIndex = ENTR_TOKINOMA_5; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case 50: - globalCtx->nextEntranceIndex = ENTR_SPOT01_13; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE_INSTANT; + play->nextEntranceIndex = ENTR_SPOT01_13; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE_INSTANT; break; case 51: - globalCtx->nextEntranceIndex = ENTR_SPOT00_0; + play->nextEntranceIndex = ENTR_SPOT00_0; gSaveContext.cutsceneIndex = 0xFFF8; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_WHITE, TCS_SLOW); + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_WHITE, TCS_SLOW); break; case 52: - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_0; + play->nextEntranceIndex = ENTR_TOKINOMA_0; gSaveContext.cutsceneIndex = 0xFFF7; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_INSTANT; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_INSTANT; break; case 53: - globalCtx->nextEntranceIndex = ENTR_SPOT00_16; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = ENTR_SPOT00_16; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 54: gSaveContext.gameMode = 3; Audio_SetSoundBanksMute(0x6F); - globalCtx->linkAgeOnLoad = LINK_AGE_CHILD; - globalCtx->nextEntranceIndex = ENTR_SPOT09_0; + play->linkAgeOnLoad = LINK_AGE_CHILD; + play->nextEntranceIndex = ENTR_SPOT09_0; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 55: - globalCtx->nextEntranceIndex = ENTR_SPOT12_0; + play->nextEntranceIndex = ENTR_SPOT12_0; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 56: - globalCtx->nextEntranceIndex = ENTR_SPOT01_0; + play->nextEntranceIndex = ENTR_SPOT01_0; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 57: - globalCtx->nextEntranceIndex = ENTR_SPOT16_0; + play->nextEntranceIndex = ENTR_SPOT16_0; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 58: - globalCtx->nextEntranceIndex = ENTR_SPOT18_0; + play->nextEntranceIndex = ENTR_SPOT18_0; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 59: - globalCtx->nextEntranceIndex = ENTR_SPOT06_0; + play->nextEntranceIndex = ENTR_SPOT06_0; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 60: - globalCtx->nextEntranceIndex = ENTR_SPOT08_0; + play->nextEntranceIndex = ENTR_SPOT08_0; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 61: - globalCtx->nextEntranceIndex = ENTR_SPOT07_0; + play->nextEntranceIndex = ENTR_SPOT07_0; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 62: - globalCtx->linkAgeOnLoad = LINK_AGE_ADULT; - globalCtx->nextEntranceIndex = ENTR_SPOT04_0; + play->linkAgeOnLoad = LINK_AGE_ADULT; + play->nextEntranceIndex = ENTR_SPOT04_0; gSaveContext.cutsceneIndex = 0xFFF6; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 63: - globalCtx->nextEntranceIndex = ENTR_SPOT04_0; + play->nextEntranceIndex = ENTR_SPOT04_0; gSaveContext.cutsceneIndex = 0xFFF7; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 64: - globalCtx->nextEntranceIndex = ENTR_SPOT00_0; + play->nextEntranceIndex = ENTR_SPOT00_0; gSaveContext.cutsceneIndex = 0xFFF5; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 65: - globalCtx->linkAgeOnLoad = LINK_AGE_CHILD; - globalCtx->nextEntranceIndex = ENTR_SPOT20_0; + play->linkAgeOnLoad = LINK_AGE_CHILD; + play->nextEntranceIndex = ENTR_SPOT20_0; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 66: - globalCtx->nextEntranceIndex = ENTR_SPOT01_14; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT01_14; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 67: - globalCtx->nextEntranceIndex = ENTR_SPOT00_9; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT00_9; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 68: - globalCtx->nextEntranceIndex = ENTR_HIRAL_DEMO_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_HIRAL_DEMO_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF5; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 69: - globalCtx->nextEntranceIndex = ENTR_SPOT04_12; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT04_12; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 70: - globalCtx->nextEntranceIndex = ENTR_SPOT16_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT16_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; case 71: gSaveContext.equips.equipment |= EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4); - Player_SetEquipmentData(globalCtx, player); + Player_SetEquipmentData(play, player); gSaveContext.equips.equipment |= EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4); - Player_SetEquipmentData(globalCtx, player); - globalCtx->linkAgeOnLoad = LINK_AGE_CHILD; - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + Player_SetEquipmentData(play, player); + play->linkAgeOnLoad = LINK_AGE_CHILD; + play->nextEntranceIndex = ENTR_TOKINOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 72: - globalCtx->nextEntranceIndex = ENTR_NAKANIWA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_NAKANIWA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; case 73: - globalCtx->linkAgeOnLoad = LINK_AGE_CHILD; - globalCtx->nextEntranceIndex = ENTR_SPOT20_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->linkAgeOnLoad = LINK_AGE_CHILD; + play->nextEntranceIndex = ENTR_SPOT20_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 74: - globalCtx->nextEntranceIndex = ENTR_SPOT20_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT20_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; break; case 75: - globalCtx->linkAgeOnLoad = LINK_AGE_CHILD; - globalCtx->nextEntranceIndex = ENTR_SPOT20_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->linkAgeOnLoad = LINK_AGE_CHILD; + play->nextEntranceIndex = ENTR_SPOT20_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF4; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 76: - globalCtx->linkAgeOnLoad = LINK_AGE_ADULT; - globalCtx->nextEntranceIndex = ENTR_SPOT20_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->linkAgeOnLoad = LINK_AGE_ADULT; + play->nextEntranceIndex = ENTR_SPOT20_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF5; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 77: - globalCtx->linkAgeOnLoad = LINK_AGE_CHILD; - globalCtx->nextEntranceIndex = ENTR_SPOT20_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->linkAgeOnLoad = LINK_AGE_CHILD; + play->nextEntranceIndex = ENTR_SPOT20_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF6; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 78: - globalCtx->nextEntranceIndex = ENTR_SPOT20_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT20_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF7; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 79: case 80: @@ -1005,177 +1004,177 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt case 91: case 92: case 93: - globalCtx->nextEntranceIndex = ENTR_SPOT20_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT20_0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 94: - globalCtx->nextEntranceIndex = ENTR_SPOT20_1; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = ENTR_SPOT20_1; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 95: if (GET_EVENTCHKINF(EVENTCHKINF_48) && GET_EVENTCHKINF(EVENTCHKINF_49) && GET_EVENTCHKINF(EVENTCHKINF_4A)) { - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_TOKINOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; } else { switch (gSaveContext.sceneSetupIndex) { case 8: - globalCtx->nextEntranceIndex = ENTR_SPOT05_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT05_0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 9: - globalCtx->nextEntranceIndex = ENTR_SPOT17_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT17_0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 10: - globalCtx->nextEntranceIndex = ENTR_SPOT06_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT06_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF0; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; } } break; case 96: if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) { - globalCtx->nextEntranceIndex = ENTR_KENJYANOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_KENJYANOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE_FAST; + play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; } else { SET_EVENTCHKINF(EVENTCHKINF_C8); - globalCtx->nextEntranceIndex = ENTR_SPOT11_8; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = ENTR_SPOT11_8; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; } break; case 97: if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { - globalCtx->nextEntranceIndex = ENTR_KENJYANOMA_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_KENJYANOMA_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE_FAST; + play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT02_8; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = ENTR_SPOT02_8; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; } break; case 98: - globalCtx->nextEntranceIndex = ENTR_SPOT17_5; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = ENTR_SPOT17_5; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; break; case 99: - globalCtx->nextEntranceIndex = ENTR_SPOT05_3; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT05_3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; case 100: - globalCtx->nextEntranceIndex = ENTR_SPOT04_0; + play->nextEntranceIndex = ENTR_SPOT04_0; gSaveContext.cutsceneIndex = 0xFFF8; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; break; case 101: - globalCtx->nextEntranceIndex = ENTR_SPOT11_6; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_SANDSTORM_END; + play->nextEntranceIndex = ENTR_SPOT11_6; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_SANDSTORM_END; break; case 102: - globalCtx->nextEntranceIndex = ENTR_TOKINOMA_6; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_TOKINOMA_6; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 103: - globalCtx->nextEntranceIndex = ENTR_SPOT00_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT00_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF3; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 104: switch (sTitleCsState) { case 0: - globalCtx->nextEntranceIndex = ENTR_JYASINBOSS_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_JYASINBOSS_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF2; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleCsState++; break; case 1: - globalCtx->nextEntranceIndex = ENTR_SPOT17_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT17_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleCsState++; break; case 2: - globalCtx->nextEntranceIndex = ENTR_HIRAL_DEMO_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_HIRAL_DEMO_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF6; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleCsState = 0; break; } break; case 105: - globalCtx->nextEntranceIndex = ENTR_SPOT02_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT02_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.cutsceneIndex = 0xFFF1; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 106: - globalCtx->nextEntranceIndex = ENTR_HAKAANA_OUKE_1; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_HAKAANA_OUKE_1; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 107: - globalCtx->nextEntranceIndex = ENTR_GANONTIKA_2; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_GANONTIKA_2; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 108: - globalCtx->nextEntranceIndex = ENTR_GANONTIKA_3; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_GANONTIKA_3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 109: - globalCtx->nextEntranceIndex = ENTR_GANONTIKA_4; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_GANONTIKA_4; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 110: - globalCtx->nextEntranceIndex = ENTR_GANONTIKA_5; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_GANONTIKA_5; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 111: - globalCtx->nextEntranceIndex = ENTR_GANONTIKA_6; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_GANONTIKA_6; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 112: - globalCtx->nextEntranceIndex = ENTR_GANONTIKA_7; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_GANONTIKA_7; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 113: if (Flags_GetEventChkInf(EVENTCHKINF_BB) && Flags_GetEventChkInf(EVENTCHKINF_BC) && Flags_GetEventChkInf(EVENTCHKINF_BD) && Flags_GetEventChkInf(EVENTCHKINF_BE) && Flags_GetEventChkInf(EVENTCHKINF_BF) && Flags_GetEventChkInf(EVENTCHKINF_AD)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTowerBarrierCs); - globalCtx->csCtx.frames = 0; + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTowerBarrierCs); + play->csCtx.frames = 0; gSaveContext.cutsceneTrigger = 1; gSaveContext.cutsceneIndex = 0xFFFF; csCtx->state = CS_STATE_UNSKIPPABLE_INIT; @@ -1185,70 +1184,70 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt } break; case 114: - globalCtx->nextEntranceIndex = ENTR_SPOT00_3; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT00_3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; break; case 115: - globalCtx->nextEntranceIndex = ENTR_SPOT00_17; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->nextEntranceIndex = ENTR_SPOT00_17; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; case 116: if (GET_EVENTCHKINF(EVENTCHKINF_C8)) { - globalCtx->nextEntranceIndex = ENTR_SPOT02_8; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = ENTR_SPOT02_8; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT11_8; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = ENTR_SPOT11_8; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; } gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; break; case 117: gSaveContext.gameMode = 3; Audio_SetSoundBanksMute(0x6F); - globalCtx->linkAgeOnLoad = LINK_AGE_ADULT; - globalCtx->nextEntranceIndex = ENTR_SPOT00_0; + play->linkAgeOnLoad = LINK_AGE_ADULT; + play->nextEntranceIndex = ENTR_SPOT00_0; gSaveContext.cutsceneIndex = 0xFFF7; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 118: gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = ENTR_GANON_DEMO_0; - Play_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); gSaveContext.respawnFlag = -2; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; case 119: gSaveContext.dayTime = CLOCK_TIME(12, 0); gSaveContext.skyboxTime = CLOCK_TIME(12, 0); - globalCtx->nextEntranceIndex = ENTR_NAKANIWA_1; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = ENTR_NAKANIWA_1; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; break; } } } // Command 0x2D: Transition Effects -void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void Cutscene_Command_TransitionFX(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { f32 temp; if ((csCtx->frames >= cmd->startFrame) && (csCtx->frames <= cmd->endFrame)) { - globalCtx->envCtx.fillScreen = true; + play->envCtx.fillScreen = true; temp = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->frames); switch (cmd->base) { case 1: case 5: - globalCtx->envCtx.screenFillColor[0] = 160; - globalCtx->envCtx.screenFillColor[1] = 160; - globalCtx->envCtx.screenFillColor[2] = 160; + play->envCtx.screenFillColor[0] = 160; + play->envCtx.screenFillColor[1] = 160; + play->envCtx.screenFillColor[2] = 160; if (cmd->base == 1) { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp; + play->envCtx.screenFillColor[3] = 255.0f * temp; if ((temp == 0.0f) && (gSaveContext.entranceIndex == ENTR_KENJYANOMA_0)) { Audio_PlaySoundGeneral(NA_SE_SY_WHITE_OUT_S, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1257,47 +1256,47 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs (gSaveContext.entranceIndex == ENTR_YOUSEI_IZUMI_YOKO_0))) { Audio_PlaySoundGeneral(NA_SE_EV_WHITE_OUT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - } else if ((temp == 0.0f) && (globalCtx->sceneNum == SCENE_GANONTIKA)) { + } else if ((temp == 0.0f) && (play->sceneNum == SCENE_GANONTIKA)) { func_800788CC(NA_SE_EV_WHITE_OUT); } } else { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; } break; case 2: case 6: - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 255; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 255; if (cmd->base == 2) { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp; + play->envCtx.screenFillColor[3] = 255.0f * temp; } else { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; } break; case 3: case 7: - globalCtx->envCtx.screenFillColor[0] = 255; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[0] = 255; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 0; if (cmd->base == 3) { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; } else { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp; + play->envCtx.screenFillColor[3] = 255.0f * temp; } break; case 4: case 8: - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 255; - globalCtx->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 255; + play->envCtx.screenFillColor[2] = 0; if (cmd->base == 4) { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; } else { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp; + play->envCtx.screenFillColor[3] = 255.0f * temp; } break; @@ -1307,13 +1306,13 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs case 10: case 11: - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 0; if (cmd->base == 10) { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f; } else { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp; + play->envCtx.screenFillColor[3] = 255.0f * temp; } break; @@ -1322,17 +1321,17 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs break; case 13: - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 0; - globalCtx->envCtx.screenFillColor[3] = 255.0f - ((1.0f - temp) * 155.0f); + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[3] = 255.0f - ((1.0f - temp) * 155.0f); break; } } } // Command 0x1 & 0x5: Camera Eye Points -s32 Cutscene_Command_CameraEyePoints(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { +s32 Cutscene_Command_CameraEyePoints(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { s32 shouldContinue = 1; CsCmdBase* cmdBase = (CsCmdBase*)cmd; s32 size; @@ -1347,12 +1346,12 @@ s32 Cutscene_Command_CameraEyePoints(GlobalContext* globalCtx, CutsceneContext* if (csCtx->unk_1A != 0) { csCtx->unk_18 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - Play_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_CS_0); - Play_ChangeCameraStatus(globalCtx, sReturnToCamId, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE); - Camera_ResetAnim(Play_GetCamera(globalCtx, csCtx->subCamId)); - Camera_SetCSParams(Play_GetCamera(globalCtx, csCtx->subCamId), csCtx->subCamLookAtPoints, - csCtx->subCamEyePoints, GET_PLAYER(globalCtx), relativeToLink); + Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_CS_0); + Play_ChangeCameraStatus(play, sReturnToCamId, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE); + Camera_ResetAnim(Play_GetCamera(play, csCtx->subCamId)); + Camera_SetCSParams(Play_GetCamera(play, csCtx->subCamId), csCtx->subCamLookAtPoints, + csCtx->subCamEyePoints, GET_PLAYER(play), relativeToLink); } } } @@ -1369,7 +1368,7 @@ s32 Cutscene_Command_CameraEyePoints(GlobalContext* globalCtx, CutsceneContext* } // Command 0x2 & 0x6: Camera At Points -s32 Cutscene_Command_CameraLookAtPoints(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { +s32 Cutscene_Command_CameraLookAtPoints(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { s32 shouldContinue = 1; CsCmdBase* cmdBase = (CsCmdBase*)cmd; s32 size; @@ -1384,12 +1383,12 @@ s32 Cutscene_Command_CameraLookAtPoints(GlobalContext* globalCtx, CutsceneContex if (csCtx->unk_1B != 0) { D_8015FCC0 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - Play_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_CS_0); - Play_ChangeCameraStatus(globalCtx, sReturnToCamId, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE); - Camera_ResetAnim(Play_GetCamera(globalCtx, csCtx->subCamId)); - Camera_SetCSParams(Play_GetCamera(globalCtx, csCtx->subCamId), csCtx->subCamLookAtPoints, - csCtx->subCamEyePoints, GET_PLAYER(globalCtx), relativeToLink); + Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_CS_0); + Play_ChangeCameraStatus(play, sReturnToCamId, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE); + Camera_ResetAnim(Play_GetCamera(play, csCtx->subCamId)); + Camera_SetCSParams(Play_GetCamera(play, csCtx->subCamId), csCtx->subCamLookAtPoints, + csCtx->subCamEyePoints, GET_PLAYER(play), relativeToLink); } } } @@ -1406,7 +1405,7 @@ s32 Cutscene_Command_CameraLookAtPoints(GlobalContext* globalCtx, CutsceneContex } // Command 0x7: ? (Related to camera positons) -s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 unused) { +s32 Cutscene_Command_07(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 unused) { CsCmdBase* cmdBase = (CsCmdBase*)cmd; s32 size; Vec3f sp3C; @@ -1424,11 +1423,11 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm if (csCtx->unk_1A != 0) { D_8015FCC2 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - subCam = Play_GetCamera(globalCtx, csCtx->subCamId); + subCam = Play_GetCamera(play, csCtx->subCamId); subCam->player = NULL; - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE); - Play_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_FREE0); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE); + Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_FREE0); sp28 = csCtx->subCamLookAtPoints->cameraRoll * 1.40625f; Camera_SetParam(subCam, 64, &sp28); sp3C.x = csCtx->subCamLookAtPoints->pos.x; @@ -1437,8 +1436,8 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm sp30.x = csCtx->subCamEyePoints->pos.x; sp30.y = csCtx->subCamEyePoints->pos.y; sp30.z = csCtx->subCamEyePoints->pos.z; - Play_CameraSetAtEye(globalCtx, csCtx->subCamId, &sp3C, &sp30); - Play_CameraSetFov(globalCtx, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle); + Play_CameraSetAtEye(play, csCtx->subCamId, &sp3C, &sp30); + Play_CameraSetFov(play, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle); } } } @@ -1449,7 +1448,7 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm } // Command 0x8: ? (Related to camera focus points) -s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 unused) { +s32 Cutscene_Command_08(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 unused) { CsCmdBase* cmdBase = (CsCmdBase*)cmd; s32 size; Vec3f sp3C; @@ -1467,19 +1466,19 @@ s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm if (csCtx->unk_1B != 0) { D_8015FCC4 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - subCam = Play_GetCamera(globalCtx, csCtx->subCamId); + subCam = Play_GetCamera(play, csCtx->subCamId); subCam->player = NULL; - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE); - Play_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_FREE0); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE); + Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_FREE0); sp3C.x = csCtx->subCamLookAtPoints->pos.x; sp3C.y = csCtx->subCamLookAtPoints->pos.y; sp3C.z = csCtx->subCamLookAtPoints->pos.z; sp30.x = csCtx->subCamEyePoints->pos.x; sp30.y = csCtx->subCamEyePoints->pos.y; sp30.z = csCtx->subCamEyePoints->pos.z; - Play_CameraSetAtEye(globalCtx, csCtx->subCamId, &sp3C, &sp30); - Play_CameraSetFov(globalCtx, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle); + Play_CameraSetAtEye(play, csCtx->subCamId, &sp3C, &sp30); + Play_CameraSetFov(play, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle); } } } @@ -1490,7 +1489,7 @@ s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm } // Command 0x13: Textbox -void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdTextbox* cmd) { +void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdTextbox* cmd) { u8 dialogState; s16 originalCsFrames; @@ -1499,40 +1498,40 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, if (D_8011E1C0 != cmd->base) { D_8011E1C0 = cmd->base; if ((cmd->type == 3) && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) { - Message_StartTextbox(globalCtx, cmd->textId1, NULL); + Message_StartTextbox(play, cmd->textId1, NULL); } else if ((cmd->type == 4) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { - Message_StartTextbox(globalCtx, cmd->textId1, NULL); + Message_StartTextbox(play, cmd->textId1, NULL); } else { - Message_StartTextbox(globalCtx, cmd->base, NULL); + Message_StartTextbox(play, cmd->base, NULL); } return; } } else { if (D_8011E1C4 != cmd->base) { D_8011E1C4 = cmd->base; - func_8010BD58(globalCtx, cmd->base); + func_8010BD58(play, cmd->base); return; } } if (csCtx->frames >= cmd->endFrame) { originalCsFrames = csCtx->frames; - dialogState = Message_GetState(&globalCtx->msgCtx); + dialogState = Message_GetState(&play->msgCtx); if ((dialogState != TEXT_STATE_CLOSING) && (dialogState != TEXT_STATE_NONE) && (dialogState != TEXT_STATE_SONG_DEMO_DONE) && (dialogState != TEXT_STATE_8)) { csCtx->frames--; - if ((dialogState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if ((dialogState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { if (cmd->textId1 != 0xFFFF) { - Message_ContinueTextbox(globalCtx, cmd->textId1); + Message_ContinueTextbox(play, cmd->textId1); } else { csCtx->frames++; } } else { if (cmd->textId2 != 0xFFFF) { - Message_ContinueTextbox(globalCtx, cmd->textId2); + Message_ContinueTextbox(play, cmd->textId2); } else { csCtx->frames++; } @@ -1541,15 +1540,15 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, if (dialogState == TEXT_STATE_9) { if (cmd->textId1 != 0xFFFF) { - Message_ContinueTextbox(globalCtx, cmd->textId1); + Message_ContinueTextbox(play, cmd->textId1); } else { csCtx->frames++; } } if (dialogState == TEXT_STATE_EVENT) { - if (Message_ShouldAdvance(globalCtx)) { - func_8010BD58(globalCtx, cmd->base); + if (Message_ShouldAdvance(play)) { + func_8010BD58(play, cmd->base); } } } @@ -1563,7 +1562,7 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, } } -void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cutscenePtr) { +void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutscenePtr) { s16 i; s32 totalEntries; s32 cmdType; @@ -1582,7 +1581,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, return; } - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_DRIGHT)) { csCtx->state = CS_STATE_UNSKIPPABLE_INIT; return; } @@ -1600,7 +1599,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, MemCpy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; for (j = 0; j < cmdEntries; j++) { - func_80064824(globalCtx, csCtx, (void*)cutscenePtr); + func_80064824(play, csCtx, (void*)cutscenePtr); cutscenePtr += 0x30; } break; @@ -1608,7 +1607,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, MemCpy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_SetLighting(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_SetLighting(play, csCtx, (void*)cutscenePtr); cutscenePtr += 0x30; } break; @@ -1616,7 +1615,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, MemCpy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_PlayBGM(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_PlayBGM(play, csCtx, (void*)cutscenePtr); cutscenePtr += 0x30; } break; @@ -1624,7 +1623,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, MemCpy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_StopBGM(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_StopBGM(play, csCtx, (void*)cutscenePtr); cutscenePtr += 0x30; } break; @@ -1632,7 +1631,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, MemCpy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_FadeBGM(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_FadeBGM(play, csCtx, (void*)cutscenePtr); cutscenePtr += 0x30; } break; @@ -1640,7 +1639,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, MemCpy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_09(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_09(play, csCtx, (void*)cutscenePtr); cutscenePtr += 0xC; } break; @@ -1648,7 +1647,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, MemCpy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; for (j = 0; j < cmdEntries; j++) { - func_80065134(globalCtx, csCtx, (void*)cutscenePtr); + func_80065134(play, csCtx, (void*)cutscenePtr); cutscenePtr += 0xC; } break; @@ -1860,26 +1859,26 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, } break; case CS_CMD_CAM_EYE: - cutscenePtr += Cutscene_Command_CameraEyePoints(globalCtx, csCtx, (void*)cutscenePtr, 0); + cutscenePtr += Cutscene_Command_CameraEyePoints(play, csCtx, (void*)cutscenePtr, 0); break; case CS_CMD_CAM_EYE_REL_TO_PLAYER: - cutscenePtr += Cutscene_Command_CameraEyePoints(globalCtx, csCtx, (void*)cutscenePtr, 1); + cutscenePtr += Cutscene_Command_CameraEyePoints(play, csCtx, (void*)cutscenePtr, 1); break; case CS_CMD_CAM_AT: - cutscenePtr += Cutscene_Command_CameraLookAtPoints(globalCtx, csCtx, (void*)cutscenePtr, 0); + cutscenePtr += Cutscene_Command_CameraLookAtPoints(play, csCtx, (void*)cutscenePtr, 0); break; case CS_CMD_CAM_AT_REL_TO_PLAYER: - cutscenePtr += Cutscene_Command_CameraLookAtPoints(globalCtx, csCtx, (void*)cutscenePtr, 1); + cutscenePtr += Cutscene_Command_CameraLookAtPoints(play, csCtx, (void*)cutscenePtr, 1); break; case CS_CMD_07: - cutscenePtr += Cutscene_Command_07(globalCtx, csCtx, (void*)cutscenePtr, 0); + cutscenePtr += Cutscene_Command_07(play, csCtx, (void*)cutscenePtr, 0); break; case CS_CMD_08: - cutscenePtr += Cutscene_Command_08(globalCtx, csCtx, (void*)cutscenePtr, 0); + cutscenePtr += Cutscene_Command_08(play, csCtx, (void*)cutscenePtr, 0); break; case CS_CMD_TERMINATOR: cutscenePtr += 4; - Cutscene_Command_Terminator(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_Terminator(play, csCtx, (void*)cutscenePtr); cutscenePtr += 8; break; case CS_CMD_TEXTBOX: @@ -1888,14 +1887,14 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; if (cmd->base != 0xFFFF) { - Cutscene_Command_Textbox(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_Textbox(play, csCtx, (void*)cutscenePtr); } cutscenePtr += 0xC; } break; case CS_CMD_SCENE_TRANS_FX: cutscenePtr += 4; - Cutscene_Command_TransitionFX(globalCtx, csCtx, (void*)cutscenePtr); + Cutscene_Command_TransitionFX(play, csCtx, (void*)cutscenePtr); cutscenePtr += 8; break; default: @@ -1909,7 +1908,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, } } -void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80068C3C(PlayState* play, CutsceneContext* csCtx) { Gfx* displayList; Gfx* prevDisplayList; @@ -1919,39 +1918,39 @@ void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx) { if (0) {} // Also necessary to match if (BREG(0) != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo.c", 4101); + OPEN_DISPS(play->state.gfxCtx, "../z_demo.c", 4101); prevDisplayList = POLY_OPA_DISP; displayList = Graph_GfxPlusOne(POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, displayList); - Cutscene_DrawDebugInfo(globalCtx, &displayList, csCtx); + Cutscene_DrawDebugInfo(play, &displayList, csCtx); gSPEndDisplayList(displayList++); Graph_BranchDlist(prevDisplayList, displayList); POLY_OPA_DISP = displayList; - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo.c", 4108); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo.c", 4108); } csCtx->frames++; if (dREG(95) != 0) { - Cutscene_ProcessCommands(globalCtx, csCtx, D_8012D1F0); + Cutscene_ProcessCommands(play, csCtx, D_8012D1F0); } else { - Cutscene_ProcessCommands(globalCtx, csCtx, globalCtx->csCtx.segment); + Cutscene_ProcessCommands(play, csCtx, play->csCtx.segment); } } } -void func_80068D84(GlobalContext* globalCtx, CutsceneContext* csCtx) { - if (func_8006472C(globalCtx, csCtx, 0.0f)) { +void func_80068D84(PlayState* play, CutsceneContext* csCtx) { + if (func_8006472C(play, csCtx, 0.0f)) { Audio_SetCutsceneFlag(0); csCtx->state = CS_STATE_IDLE; } } -void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80068DC0(PlayState* play, CutsceneContext* csCtx) { s16 i; - if (func_8006472C(globalCtx, csCtx, 0.0f)) { + if (func_8006472C(play, csCtx, 0.0f)) { csCtx->linkAction = NULL; for (i = 0; i < 10; i++) { @@ -1968,12 +1967,12 @@ void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) { case 0x028E: case 0x0292: case 0x0476: - Play_CopyCamera(globalCtx, sReturnToCamId, csCtx->subCamId); + Play_CopyCamera(play, sReturnToCamId, csCtx->subCamId); } - Play_ChangeCameraStatus(globalCtx, sReturnToCamId, CAM_STAT_ACTIVE); - Play_ClearCamera(globalCtx, csCtx->subCamId); - func_8005B1A4(globalCtx->cameraPtrs[sReturnToCamId]); + Play_ChangeCameraStatus(play, sReturnToCamId, CAM_STAT_ACTIVE); + Play_ClearCamera(play, csCtx->subCamId); + func_8005B1A4(play->cameraPtrs[sReturnToCamId]); } Audio_SetCutsceneFlag(0); @@ -1981,15 +1980,15 @@ void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) { } } -void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_80068ECC(PlayState* play, CutsceneContext* csCtx) { u8 i; - if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE) && !Player_InCsMode(globalCtx)) { + if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE) && !Player_InCsMode(play)) { gSaveContext.cutsceneIndex = 0xFFFD; } if ((gSaveContext.cutsceneIndex >= 0xFFF0) && (csCtx->state == CS_STATE_IDLE)) { - Flags_UnsetEnv(globalCtx, 0); + Flags_UnsetEnv(play, 0); D_8011E1C0 = 0; D_8011E1C4 = 0; @@ -2012,10 +2011,10 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) { D_8015FCC4 = 0xFFFF; csCtx->unk_1A = 0; csCtx->unk_1B = 0; - sReturnToCamId = globalCtx->activeCamId; + sReturnToCamId = play->activeCamId; if (D_8015FCC8 != 0) { - csCtx->subCamId = Play_CreateSubCamera(globalCtx); + csCtx->subCamId = Play_CreateSubCamera(play); } if (gSaveContext.cutsceneTrigger == 0) { @@ -2025,14 +2024,14 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) { csCtx->state++; } - func_80068C3C(globalCtx, csCtx); + func_80068C3C(play, csCtx); } gSaveContext.cutsceneTrigger = 0; } } -void func_80069048(GlobalContext* globalCtx) { +void func_80069048(PlayState* play) { s16 i; D_8015FCCC = 0; @@ -2042,13 +2041,13 @@ void func_80069048(GlobalContext* globalCtx) { D_8015FCE4 = 0; } -void func_8006907C(GlobalContext* globalCtx) { +void func_8006907C(PlayState* play) { if (D_8015FCCC != 0) { D_8015FCCC = 0; } } -void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx) { +void Cutscene_HandleEntranceTriggers(PlayState* play) { EntranceCutscene* entranceCutscene; u8 requiredAge; s16 i; @@ -2066,7 +2065,7 @@ void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx) { (gSaveContext.cutsceneIndex < 0xFFF0) && ((u8)gSaveContext.linkAge == requiredAge) && (gSaveContext.respawnFlag <= 0)) { Flags_SetEventChkInf(entranceCutscene->flag); - Cutscene_SetSegment(globalCtx, entranceCutscene->segAddr); + Cutscene_SetSegment(play, entranceCutscene->segAddr); gSaveContext.cutsceneTrigger = 2; gSaveContext.showTitleCard = false; break; @@ -2074,7 +2073,7 @@ void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx) { } } -void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx) { +void Cutscene_HandleConditionalTriggers(PlayState* play) { osSyncPrintf("\ngame_info.mode=[%d] restart_flag", ((void)0, gSaveContext.respawnFlag)); if ((gSaveContext.gameMode == 0) && (gSaveContext.respawnFlag <= 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) { @@ -2089,7 +2088,7 @@ void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx) { gSaveContext.cutsceneIndex = 0xFFF0; } else if ((gSaveContext.entranceIndex == ENTR_SPOT10_9) && !Flags_GetEventChkInf(EVENTCHKINF_C1)) { Flags_SetEventChkInf(EVENTCHKINF_C1); - Item_Give(globalCtx, ITEM_OCARINA_FAIRY); + Item_Give(play, ITEM_OCARINA_FAIRY); gSaveContext.entranceIndex = ENTR_SPOT10_0; gSaveContext.cutsceneIndex = 0xFFF0; } else if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && @@ -2107,10 +2106,10 @@ void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx) { } } -void Cutscene_SetSegment(GlobalContext* globalCtx, void* segment) { +void Cutscene_SetSegment(PlayState* play, void* segment) { if (SEGMENT_NUMBER(segment) != 0) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(segment); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(segment); } else { - globalCtx->csCtx.segment = segment; + play->csCtx.segment = segment; } } diff --git a/src/code/z_draw.c b/src/code/z_draw.c index 20ff39b0b0..3631f4c14f 100644 --- a/src/code/z_draw.c +++ b/src/code/z_draw.c @@ -79,35 +79,35 @@ #include "objects/object_st/object_st.h" // "Get Item" Model Draw Functions -void GetItem_DrawMaskOrBombchu(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawSoldOut(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawBlueFire(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawPoes(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawFairy(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawMirrorShield(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawSkullToken(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawEggOrMedallion(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawCompass(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawPotion(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawGoronSword(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawDekuNuts(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawRecoveryHeart(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawFish(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawOpa0(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawOpa0Xlu1(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawXlu01(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawOpa10Xlu2(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawMagicArrow(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawMagicSpell(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawOpa1023(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawOpa10Xlu32(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawSmallRupee(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawScale(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawBulletBag(GlobalContext* globalCtx, s16 drawId); -void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId); +void GetItem_DrawMaskOrBombchu(PlayState* play, s16 drawId); +void GetItem_DrawSoldOut(PlayState* play, s16 drawId); +void GetItem_DrawBlueFire(PlayState* play, s16 drawId); +void GetItem_DrawPoes(PlayState* play, s16 drawId); +void GetItem_DrawFairy(PlayState* play, s16 drawId); +void GetItem_DrawMirrorShield(PlayState* play, s16 drawId); +void GetItem_DrawSkullToken(PlayState* play, s16 drawId); +void GetItem_DrawEggOrMedallion(PlayState* play, s16 drawId); +void GetItem_DrawCompass(PlayState* play, s16 drawId); +void GetItem_DrawPotion(PlayState* play, s16 drawId); +void GetItem_DrawGoronSword(PlayState* play, s16 drawId); +void GetItem_DrawDekuNuts(PlayState* play, s16 drawId); +void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId); +void GetItem_DrawFish(PlayState* play, s16 drawId); +void GetItem_DrawOpa0(PlayState* play, s16 drawId); +void GetItem_DrawOpa0Xlu1(PlayState* play, s16 drawId); +void GetItem_DrawXlu01(PlayState* play, s16 drawId); +void GetItem_DrawOpa10Xlu2(PlayState* play, s16 drawId); +void GetItem_DrawMagicArrow(PlayState* play, s16 drawId); +void GetItem_DrawMagicSpell(PlayState* play, s16 drawId); +void GetItem_DrawOpa1023(PlayState* play, s16 drawId); +void GetItem_DrawOpa10Xlu32(PlayState* play, s16 drawId); +void GetItem_DrawSmallRupee(PlayState* play, s16 drawId); +void GetItem_DrawScale(PlayState* play, s16 drawId); +void GetItem_DrawBulletBag(PlayState* play, s16 drawId); +void GetItem_DrawWallet(PlayState* play, s16 drawId); typedef struct { - /* 0x00 */ void (*drawFunc)(GlobalContext*, s16); + /* 0x00 */ void (*drawFunc)(PlayState*, s16); /* 0x04 */ Gfx* dlists[8]; } DrawItemTableEntry; // size = 0x24 @@ -373,501 +373,448 @@ DrawItemTableEntry sDrawItemTable[] = { * Draw "Get Item" Model * Calls the corresponding draw function for the given draw ID */ -void GetItem_Draw(GlobalContext* globalCtx, s16 drawId) { - sDrawItemTable[drawId].drawFunc(globalCtx, drawId); +void GetItem_Draw(PlayState* play, s16 drawId) { + sDrawItemTable[drawId].drawFunc(play, drawId); } // All remaining functions in this file are draw functions referenced in the table and called by the function above -void GetItem_DrawMaskOrBombchu(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawMaskOrBombchu(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 556); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 556); - func_80093BA8(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 560), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093BA8(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 560), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 565); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 565); } -void GetItem_DrawSoldOut(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawSoldOut(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 572); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 572); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 5); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 576), - G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 576), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 581); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 581); } -void GetItem_DrawBlueFire(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawBlueFire(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 588); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 588); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 592), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 592), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), - 0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1), - 1 * -(globalCtx->state.frames * 8), 16, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), 0 * (play->state.frames * 0), 16, + 32, 1, 1 * (play->state.frames * 1), 1 * -(play->state.frames * 8), 16, 32)); Matrix_Push(); Matrix_Translate(-8.0f, -2.0f, 0.0f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 615), - G_MTX_MODELVIEW | G_MTX_LOAD); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 615), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 621); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 621); } -void GetItem_DrawPoes(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawPoes(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 628); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 628); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 632), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 632), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 641), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 641), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), - 0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1), - 1 * -(globalCtx->state.frames * 6), 16, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), 0 * (play->state.frames * 0), 16, + 32, 1, 1 * (play->state.frames * 1), 1 * -(play->state.frames * 6), 16, 32)); Matrix_Push(); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 656), - G_MTX_MODELVIEW | G_MTX_LOAD); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 656), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 663); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 663); } -void GetItem_DrawFairy(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawFairy(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 670); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 670); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 674), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 674), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 683), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 683), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), - 0 * (globalCtx->state.frames * 0), 32, 32, 1, 1 * (globalCtx->state.frames * 1), - 1 * -(globalCtx->state.frames * 6), 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), 0 * (play->state.frames * 0), 32, + 32, 1, 1 * (play->state.frames * 1), 1 * -(play->state.frames * 6), 32, 32)); Matrix_Push(); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 698), - G_MTX_MODELVIEW | G_MTX_LOAD); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 698), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 704); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 704); } -void GetItem_DrawMirrorShield(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawMirrorShield(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 712); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 712); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0) % 256, - 1 * (globalCtx->state.frames * 2) % 256, 64, 64, 1, - 0 * (globalCtx->state.frames * 0) % 128, 1 * (globalCtx->state.frames * 1) % 128, 32, - 32)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 723), - G_MTX_MODELVIEW | G_MTX_LOAD); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0) % 256, + 1 * (play->state.frames * 2) % 256, 64, 64, 1, 0 * (play->state.frames * 0) % 128, + 1 * (play->state.frames * 1) % 128, 32, 32)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 723), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 730), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 730), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 735); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 735); } -void GetItem_DrawSkullToken(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawSkullToken(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 742); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 742); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 746), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 746), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), - 1 * -(globalCtx->state.frames * 5), 32, 32, 1, 0 * (globalCtx->state.frames * 0), - 0 * (globalCtx->state.frames * 0), 32, 64)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 760), - G_MTX_MODELVIEW | G_MTX_LOAD); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), 1 * -(play->state.frames * 5), 32, + 32, 1, 0 * (play->state.frames * 0), 0 * (play->state.frames * 0), 32, 64)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 760), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 765); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 765); } -void GetItem_DrawEggOrMedallion(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawEggOrMedallion(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 772); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 772); - func_80093BA8(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 776), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093BA8(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 776), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 783); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 783); } -void GetItem_DrawCompass(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawCompass(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 811); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 811); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 815), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 815), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 5); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 822), - G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 822), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 827); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 827); } -void GetItem_DrawPotion(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawPotion(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 834); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 834); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -1 * (globalCtx->state.frames * 1), - 1 * (globalCtx->state.frames * 1), 32, 32, 1, -1 * (globalCtx->state.frames * 1), - 1 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 845), - G_MTX_MODELVIEW | G_MTX_LOAD); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -1 * (play->state.frames * 1), 1 * (play->state.frames * 1), 32, + 32, 1, -1 * (play->state.frames * 1), 1 * (play->state.frames * 1), 32, 32)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 845), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[2]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[3]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 855), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 855), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[4]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[5]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 861); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 861); } -void GetItem_DrawGoronSword(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawGoronSword(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 868); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 868); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 1), - 0 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 1), - 0 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 878), - G_MTX_MODELVIEW | G_MTX_LOAD); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 1), 0 * (play->state.frames * 1), 32, + 32, 1, 0 * (play->state.frames * 1), 0 * (play->state.frames * 1), 32, 32)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 878), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 883); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 883); } -void GetItem_DrawDekuNuts(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawDekuNuts(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 890); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 890); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 6), - 1 * (globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 6), - 1 * (globalCtx->state.frames * 6), 32, 32)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 901), - G_MTX_MODELVIEW | G_MTX_LOAD); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 6), 1 * (play->state.frames * 6), 32, + 32, 1, 1 * (play->state.frames * 6), 1 * (play->state.frames * 6), 32, 32)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 901), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 906); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 906); } -void GetItem_DrawRecoveryHeart(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 913); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 913); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 1), - 1 * -(globalCtx->state.frames * 3), 32, 32, 1, 0 * (globalCtx->state.frames * 1), - 1 * -(globalCtx->state.frames * 2), 32, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 924), - G_MTX_MODELVIEW | G_MTX_LOAD); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 1), 1 * -(play->state.frames * 3), 32, + 32, 1, 0 * (play->state.frames * 1), 1 * -(play->state.frames * 2), 32, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 924), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 929); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 929); } -void GetItem_DrawFish(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawFish(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 936); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 936); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), - 1 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 0), - 1 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 947), - G_MTX_MODELVIEW | G_MTX_LOAD); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), 1 * (play->state.frames * 1), 32, + 32, 1, 0 * (play->state.frames * 0), 1 * (play->state.frames * 1), 32, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 947), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 952); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 952); } -void GetItem_DrawOpa0(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawOpa0(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 959); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 959); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 963), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 963), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 968); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 968); } -void GetItem_DrawOpa0Xlu1(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawOpa0Xlu1(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 975); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 975); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 979), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 979), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 986), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 986), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 991); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 991); } -void GetItem_DrawXlu01(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawXlu01(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 998); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 998); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1002), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1002), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1008); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1008); } -void GetItem_DrawOpa10Xlu2(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawOpa10Xlu2(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1015); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1015); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1019), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1019), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1027), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1027), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1032); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1032); } -void GetItem_DrawMagicArrow(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawMagicArrow(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1039); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1039); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1043), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1043), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1050), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1050), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1056); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1056); } -void GetItem_DrawMagicSpell(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawMagicSpell(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1063); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1063); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2), - 1 * -(globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 1), - -1 * (globalCtx->state.frames * 2), 32, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1074), - G_MTX_MODELVIEW | G_MTX_LOAD); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2), 1 * -(play->state.frames * 6), 32, + 32, 1, 1 * (play->state.frames * 1), -1 * (play->state.frames * 2), 32, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1074), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1081); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1081); } -void GetItem_DrawOpa1023(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawOpa1023(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1088); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1088); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1092), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1092), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[2]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[3]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1100); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1100); } -void GetItem_DrawOpa10Xlu32(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawOpa10Xlu32(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1108); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1108); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1112), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1112), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1120), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1120), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1126); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1126); } -void GetItem_DrawSmallRupee(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawSmallRupee(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1133); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1133); Matrix_Scale(0.7f, 0.7f, 0.7f, MTXMODE_APPLY); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1140), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1140), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1148), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1148), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1154); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1154); } -void GetItem_DrawScale(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawScale(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1162); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1162); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2), - -1 * (globalCtx->state.frames * 2), 64, 64, 1, 1 * (globalCtx->state.frames * 4), - 1 * -(globalCtx->state.frames * 4), 32, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1173), - G_MTX_MODELVIEW | G_MTX_LOAD); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2), -1 * (play->state.frames * 2), 64, + 64, 1, 1 * (play->state.frames * 4), 1 * -(play->state.frames * 4), 32, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1173), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1181); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1181); } -void GetItem_DrawBulletBag(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawBulletBag(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1188); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1188); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1192), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1192), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1200), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1200), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[4]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1207); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1207); } -void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId) { +void GetItem_DrawWallet(PlayState* play, s16 drawId) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1214); + OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1214); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1218), - G_MTX_MODELVIEW | G_MTX_LOAD); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1218), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[2]); @@ -877,5 +824,5 @@ void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId) { gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[6]); gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[7]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1230); + CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1230); } diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index fad499286c..cafee26555 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -52,7 +52,7 @@ void EffectShieldParticle_Init(void* thisx, void* initParamsx) { this->lightInfo.type = LIGHT_POINT_NOGLOW; this->lightInfo.params.point = initParams->lightPoint; this->lightNode = - LightContext_InsertLight(Effect_GetGlobalCtx(), &Effect_GetGlobalCtx()->lightCtx, &this->lightInfo); + LightContext_InsertLight(Effect_GetPlayState(), &Effect_GetPlayState()->lightCtx, &this->lightInfo); } else { this->lightNode = NULL; } @@ -63,10 +63,10 @@ void EffectShieldParticle_Destroy(void* thisx) { EffectShieldParticle* this = (EffectShieldParticle*)thisx; if ((this != NULL) && (this->lightDecay == true)) { - if (this->lightNode == Effect_GetGlobalCtx()->lightCtx.listHead) { - Effect_GetGlobalCtx()->lightCtx.listHead = this->lightNode->next; + if (this->lightNode == Effect_GetPlayState()->lightCtx.listHead) { + Effect_GetPlayState()->lightCtx.listHead = this->lightNode->next; } - LightContext_RemoveLight(Effect_GetGlobalCtx(), &Effect_GetGlobalCtx()->lightCtx, this->lightNode); + LightContext_RemoveLight(Effect_GetPlayState(), &Effect_GetPlayState()->lightCtx, this->lightNode); } } diff --git a/src/code/z_eff_spark.c b/src/code/z_eff_spark.c index cfe8f628f2..cc4910fa9e 100644 --- a/src/code/z_eff_spark.c +++ b/src/code/z_eff_spark.c @@ -131,7 +131,7 @@ s32 EffectSpark_Update(void* thisx) { void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { Vtx* vertices; EffectSpark* this = (EffectSpark*)thisx; - GlobalContext* globalCtx = Effect_GetGlobalCtx(); + PlayState* play = Effect_GetPlayState(); s32 i; s32 j; u8 sp1D3; @@ -210,7 +210,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { SkinMatrix_SetTranslate(&spEC, elem->position.x, elem->position.y, elem->position.z); temp = ((Rand_ZeroOne() * 2.5f) + 1.5f) / 64.0f; SkinMatrix_SetScale(&spAC, temp, temp, 1.0f); - SkinMatrix_MtxFMtxFMult(&spEC, &globalCtx->billboardMtxF, &sp6C); + SkinMatrix_MtxFMtxFMult(&spEC, &play->billboardMtxF, &sp6C); SkinMatrix_MtxFMtxFMult(&sp6C, &spAC, &sp12C); vertices[j].v.ob[0] = -32; diff --git a/src/code/z_eff_ss_dead.c b/src/code/z_eff_ss_dead.c index af2c6ee737..444712d6b7 100644 --- a/src/code/z_eff_ss_dead.c +++ b/src/code/z_eff_ss_dead.c @@ -1,11 +1,11 @@ #include "global.h" -void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_80026230(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; Gfx* displayListHead; f32 absCos; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 113); + OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 113); displayListHead = POLY_OPA_DISP; cos = Math_CosS((0x8000 / arg3) * arg2); @@ -25,15 +25,15 @@ void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a if (1) {} // Necessary to match - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 129); + CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 129); } -void func_80026400(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_80026400(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { Gfx* displayListHead; f32 cos; if (arg3 != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 141); + OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 141); cos = Math_CosS((0x4000 / arg3) * arg2); displayListHead = POLY_OPA_DISP; @@ -46,27 +46,27 @@ void func_80026400(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a if (1) {} // Necessary to match - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 153); + CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 153); } } -void func_80026608(GlobalContext* globalCtx) { +void func_80026608(PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 159); + OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 159); gDPPipeSync(POLY_OPA_DISP++); - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 164); + CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 164); } -void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_80026690(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; Gfx* displayListHead; f32 absCos; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 178); + OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 178); displayListHead = POLY_XLU_DISP; cos = Math_CosS((0x8000 / arg3) * arg2); @@ -86,14 +86,14 @@ void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a if (1) {} // Necessary to match - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 194); + CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 194); } -void func_80026860(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_80026860(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; Gfx* displayListHead; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 201); + OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 201); displayListHead = POLY_XLU_DISP; cos = Math_CosS((0x4000 / arg3) * arg2); @@ -106,16 +106,16 @@ void func_80026860(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a if (1) {} // Necessary to match - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 212); + CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 212); } -void func_80026A6C(GlobalContext* globalCtx) { +void func_80026A6C(PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 217); + OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 217); gDPPipeSync(POLY_XLU_DISP++); - POLY_XLU_DISP = Play_SetFog(globalCtx, POLY_XLU_DISP); + POLY_XLU_DISP = Play_SetFog(play, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 222); + CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 222); } diff --git a/src/code/z_effect.c b/src/code/z_effect.c index d024d08923..a72fbc4947 100644 --- a/src/code/z_effect.c +++ b/src/code/z_effect.c @@ -33,8 +33,8 @@ EffectInfo sEffectInfoTable[] = { }, }; -GlobalContext* Effect_GetGlobalCtx(void) { - return sEffectContext.globalCtx; +PlayState* Effect_GetPlayState(void) { + return sEffectContext.play; } void* Effect_GetByIndex(s32 index) { @@ -77,7 +77,7 @@ void Effect_InitStatus(EffectStatus* status) { status->unk_02 = 0; } -void Effect_InitContext(GlobalContext* globalCtx) { +void Effect_InitContext(PlayState* play) { s32 i; for (i = 0; i < SPARK_COUNT; i++) { @@ -93,10 +93,10 @@ void Effect_InitContext(GlobalContext* globalCtx) { Effect_InitStatus(&sEffectContext.blures[i].status); } - sEffectContext.globalCtx = globalCtx; + sEffectContext.play = play; } -void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams) { +void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams) { s32 i; u32 slotFound; void* effect = NULL; @@ -104,7 +104,7 @@ void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg *pIndex = TOTAL_EFFECT_COUNT; - if (FrameAdvance_IsEnabled(globalCtx) != true) { + if (FrameAdvance_IsEnabled(play) != true) { slotFound = false; switch (type) { case EFFECT_SPARK: @@ -181,13 +181,13 @@ void Effect_DrawAll(GraphicsContext* gfxCtx) { } } -void Effect_UpdateAll(GlobalContext* globalCtx) { +void Effect_UpdateAll(PlayState* play) { s32 i; for (i = 0; i < SPARK_COUNT; i++) { if (sEffectContext.sparks[i].status.active) { if (sEffectInfoTable[EFFECT_SPARK].update(&sEffectContext.sparks[i].effect) == 1) { - Effect_Delete(globalCtx, i); + Effect_Delete(play, i); } } } @@ -195,7 +195,7 @@ void Effect_UpdateAll(GlobalContext* globalCtx) { for (i = 0; i < BLURE_COUNT; i++) { if (sEffectContext.blures[i].status.active) { if (sEffectInfoTable[EFFECT_BLURE1].update(&sEffectContext.blures[i].effect) == 1) { - Effect_Delete(globalCtx, i + SPARK_COUNT); + Effect_Delete(play, i + SPARK_COUNT); } } } @@ -203,13 +203,13 @@ void Effect_UpdateAll(GlobalContext* globalCtx) { for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { if (sEffectContext.shieldParticles[i].status.active) { if (sEffectInfoTable[EFFECT_SHIELD_PARTICLE].update(&sEffectContext.shieldParticles[i].effect) == 1) { - Effect_Delete(globalCtx, i + SPARK_COUNT + BLURE_COUNT); + Effect_Delete(play, i + SPARK_COUNT + BLURE_COUNT); } } } } -void Effect_Delete(GlobalContext* globalCtx, s32 index) { +void Effect_Delete(PlayState* play, s32 index) { if (index == TOTAL_EFFECT_COUNT) { return; } @@ -235,7 +235,7 @@ void Effect_Delete(GlobalContext* globalCtx, s32 index) { } } -void Effect_DeleteAll(GlobalContext* globalCtx) { +void Effect_DeleteAll(PlayState* play) { s32 i; osSyncPrintf("エフェクト総て解放\n"); // "All effect release" diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index a51d3ea071..004f4af02e 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -3,7 +3,7 @@ EffectSsInfo sEffectSsInfo = { 0 }; // "EffectSS2Info" -void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) { +void EffectSs_InitInfo(PlayState* play, s32 tableSize) { u32 i; EffectSs* effectSs; EffectSsOverlay* overlay; @@ -14,8 +14,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) { (u32)overlay->vramEnd - (u32)overlay->vramStart, overlay->vromEnd - overlay->vromStart); } - sEffectSsInfo.table = - GameState_Alloc(&globalCtx->state, tableSize * sizeof(EffectSs), "../z_effect_soft_sprite.c", 289); + sEffectSsInfo.table = GameState_Alloc(&play->state, tableSize * sizeof(EffectSs), "../z_effect_soft_sprite.c", 289); ASSERT(sEffectSsInfo.table != NULL, "EffectSS2Info.data_table != NULL", "../z_effect_soft_sprite.c", 290); sEffectSsInfo.searchStartIndex = 0; @@ -32,7 +31,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) { } } -void EffectSs_ClearAll(GlobalContext* globalCtx) { +void EffectSs_ClearAll(PlayState* play) { u32 i; EffectSs* effectSs; EffectSsOverlay* overlay; @@ -153,10 +152,10 @@ s32 EffectSs_FindSlot(s32 priority, s32* pIndex) { return 0; } -void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs) { +void EffectSs_Insert(PlayState* play, EffectSs* effectSs) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx) != true) { + if (FrameAdvance_IsEnabled(play) != true) { if (EffectSs_FindSlot(effectSs->priority, &index) == 0) { sEffectSsInfo.searchStartIndex = index + 1; sEffectSsInfo.table[index] = *effectSs; @@ -165,7 +164,7 @@ void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs) { } // original name: "EffectSoftSprite2_makeEffect" -void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initParams) { +void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) { s32 index; u32 overlaySize; EffectSsOverlay* overlayEntry; @@ -234,7 +233,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init sEffectSsInfo.table[index].type = type; sEffectSsInfo.table[index].priority = priority; - if (initInfo->init(globalCtx, index, &sEffectSsInfo.table[index], initParams) == 0) { + if (initInfo->init(play, index, &sEffectSsInfo.table[index], initParams) == 0) { osSyncPrintf(VT_FGCOL(GREEN)); // "Construction failed for some reason. The constructor returned an error. // Ceasing effect addition." @@ -246,7 +245,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init } } -void EffectSs_Update(GlobalContext* globalCtx, s32 index) { +void EffectSs_Update(PlayState* play, s32 index) { EffectSs* effectSs = &sEffectSsInfo.table[index]; if (effectSs->update != NULL) { @@ -258,11 +257,11 @@ void EffectSs_Update(GlobalContext* globalCtx, s32 index) { effectSs->pos.y += effectSs->velocity.y; effectSs->pos.z += effectSs->velocity.z; - effectSs->update(globalCtx, index, effectSs); + effectSs->update(play, index, effectSs); } } -void EffectSs_UpdateAll(GlobalContext* globalCtx) { +void EffectSs_UpdateAll(PlayState* play) { s32 i; for (i = 0; i < sEffectSsInfo.tableSize; i++) { @@ -275,26 +274,26 @@ void EffectSs_UpdateAll(GlobalContext* globalCtx) { } if (sEffectSsInfo.table[i].life > -1) { - EffectSs_Update(globalCtx, i); + EffectSs_Update(play, i); } } } -void EffectSs_Draw(GlobalContext* globalCtx, s32 index) { +void EffectSs_Draw(PlayState* play, s32 index) { EffectSs* effectSs = &sEffectSsInfo.table[index]; if (effectSs->draw != NULL) { - effectSs->draw(globalCtx, index, effectSs); + effectSs->draw(play, index, effectSs); } } // original name: "EffectSoftSprite2_disp" -void EffectSs_DrawAll(GlobalContext* globalCtx) { - Lights* lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx); +void EffectSs_DrawAll(PlayState* play) { + Lights* lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); s32 i; - Lights_BindAll(lights, globalCtx->lightCtx.listHead, NULL); - Lights_Draw(lights, globalCtx->state.gfxCtx); + Lights_BindAll(lights, play->lightCtx.listHead, NULL); + Lights_Draw(lights, play->state.gfxCtx); for (i = 0; i < sEffectSsInfo.tableSize; i++) { if (sEffectSsInfo.table[i].life > -1) { @@ -317,7 +316,7 @@ void EffectSs_DrawAll(GlobalContext* globalCtx) { EffectSs_Delete(&sEffectSsInfo.table[i]); } else { - EffectSs_Draw(globalCtx, i); + EffectSs_Draw(play, i); } } } diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 8d052a8bf1..04966a3575 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -40,8 +40,8 @@ static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; // effects that use this draw function are responsible for making sure their regs line up with the usage here -void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* texture) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale; MtxF mfTrans; MtxF mfScale; @@ -49,14 +49,14 @@ void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* textur MtxF mfTrans11DA0; s32 pad1; Mtx* mtx; - void* object = globalCtx->objectCtx.status[this->rgObjBankIdx].segment; + void* object = play->objectCtx.status[this->rgObjBankIdx].segment; OPEN_DISPS(gfxCtx, "../z_effect_soft_sprite_old_init.c", 196); scale = this->rgScale * 0.0025f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, scale); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); gSegments[6] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); @@ -78,7 +78,7 @@ void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* textur // EffectSsDust Spawn Functions -void EffectSsDust_Spawn(GlobalContext* globalCtx, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsDust_Spawn(PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life, u8 updateMode) { EffectSsDustInitParams initParams; @@ -94,86 +94,84 @@ void EffectSsDust_Spawn(GlobalContext* globalCtx, u16 drawFlags, Vec3f* pos, Vec initParams.life = life; initParams.updateMode = updateMode; - EffectSs_Spawn(globalCtx, EFFECT_SS_DUST, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DUST, 128, &initParams); } -void func_8002829C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002829C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); + EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); } -void func_80028304(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028304(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); + EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); } -void func_8002836C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002836C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); + EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); } -void func_800283D4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800283D4(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); + EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); } -void func_8002843C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002843C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(globalCtx, 2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); + EffectSsDust_Spawn(play, 2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); } // unused -void func_800284A4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800284A4(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); + EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); } // unused -void func_80028510(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028510(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); + EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); } static Color_RGBA8 sDustBrownPrim = { 170, 130, 90, 255 }; static Color_RGBA8 sDustBrownEnv = { 100, 60, 20, 255 }; -void func_8002857C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); +void func_8002857C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); } // unused -void func_800285EC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); +void func_800285EC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); } -void func_8002865C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); +void func_8002865C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { + EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); } -void func_800286CC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); +void func_800286CC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { + EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); } -void func_8002873C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, - s16 life) { - EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0); +void func_8002873C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) { + EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0); } -void func_800287AC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, - s16 life) { - EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0); +void func_800287AC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) { + EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0); } // unused -void func_8002881C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_8002881C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor) { - func_8002829C(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5); + func_8002829C(play, pos, velocity, accel, primColor, envColor, 100, 5); } // unused -void func_80028858(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_80028858(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor) { - func_80028304(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5); + func_80028304(play, pos, velocity, accel, primColor, envColor, 100, 5); } void func_80028894(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, Vec3f* accel) { @@ -196,7 +194,7 @@ void func_80028894(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, accel->z = 0.0f; } -void func_80028990(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { +void func_80028990(PlayState* play, f32 randScale, Vec3f* srcPos) { s32 i; Vec3f pos; Vec3f velocity; @@ -204,11 +202,11 @@ void func_80028990(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { for (i = 0; i < 20; i++) { func_80028894(srcPos, randScale, &pos, &velocity, &accel); - func_8002873C(globalCtx, &pos, &velocity, &accel, 100, 30, 7); + func_8002873C(play, &pos, &velocity, &accel, 100, 30, 7); } } -void func_80028A54(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { +void func_80028A54(PlayState* play, f32 randScale, Vec3f* srcPos) { s32 i; Vec3f pos; Vec3f velocity; @@ -216,26 +214,26 @@ void func_80028A54(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { for (i = 0; i < 20; i++) { func_80028894(srcPos, randScale, &pos, &velocity, &accel); - func_800287AC(globalCtx, &pos, &velocity, &accel, 100, 30, 7); + func_800287AC(play, &pos, &velocity, &accel, 100, 30, 7); } } // EffectSsKiraKira Spawn Functions -void EffectSsKiraKira_SpawnSmallYellow(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void EffectSsKiraKira_SpawnSmallYellow(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { Color_RGBA8 primColor = { 255, 255, 200, 255 }; Color_RGBA8 envColor = { 255, 200, 0, 0 }; - EffectSsKiraKira_SpawnDispersed(globalCtx, pos, velocity, accel, &primColor, &envColor, 1000, 16); + EffectSsKiraKira_SpawnDispersed(play, pos, velocity, accel, &primColor, &envColor, 1000, 16); } -void EffectSsKiraKira_SpawnSmall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor) { - EffectSsKiraKira_SpawnDispersed(globalCtx, pos, velocity, accel, primColor, envColor, 1000, 16); +void EffectSsKiraKira_SpawnSmall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor) { + EffectSsKiraKira_SpawnDispersed(play, pos, velocity, accel, primColor, envColor, 1000, 16); } -void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) { +void EffectSsKiraKira_SpawnDispersed(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s32 life) { EffectSsKiraKiraInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -252,11 +250,11 @@ void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f initParams.envColor = *envColor; initParams.alphaStep = (-(255.0f / initParams.life)) + (-(255.0f / initParams.life)); - EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_KIRAKIRA, 128, &initParams); } -void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) { +void EffectSsKiraKira_SpawnFocused(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s32 life) { EffectSsKiraKiraInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -271,26 +269,26 @@ void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* Color_RGBA8_Copy(&initParams.envColor, envColor); initParams.alphaStep = (-(255.0f / initParams.life)) + (-(255.0f / initParams.life)); - EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_KIRAKIRA, 128, &initParams); } // EffectSsBomb Spawn Functions // unused -void EffectSsBomb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void EffectSsBomb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { EffectSsBombInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); Math_Vec3f_Copy(&initParams.velocity, velocity); Math_Vec3f_Copy(&initParams.accel, accel); - EffectSs_Spawn(globalCtx, EFFECT_SS_BOMB, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_BOMB, 128, &initParams); } // EffectSsBomb2 Spawn Functions // unused -void EffectSsBomb2_SpawnFade(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void EffectSsBomb2_SpawnFade(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { EffectSsBomb2InitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -300,11 +298,10 @@ void EffectSsBomb2_SpawnFade(GlobalContext* globalCtx, Vec3f* pos, Vec3f* veloci initParams.scaleStep = 0; initParams.drawMode = 0; - EffectSs_Spawn(globalCtx, EFFECT_SS_BOMB2, 10, &initParams); + EffectSs_Spawn(play, EFFECT_SS_BOMB2, 10, &initParams); } -void EffectSsBomb2_SpawnLayered(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, - s16 scaleStep) { +void EffectSsBomb2_SpawnLayered(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { EffectSsBomb2InitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -314,12 +311,12 @@ void EffectSsBomb2_SpawnLayered(GlobalContext* globalCtx, Vec3f* pos, Vec3f* vel initParams.scaleStep = scaleStep; initParams.drawMode = 1; - EffectSs_Spawn(globalCtx, EFFECT_SS_BOMB2, 10, &initParams); + EffectSs_Spawn(play, EFFECT_SS_BOMB2, 10, &initParams); } // EffectSsBlast Spawn Functions -void EffectSsBlast_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 sclaeStepDecay, s16 life) { EffectSsBlastParams initParams; @@ -333,32 +330,32 @@ void EffectSsBlast_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.sclaeStepDecay = sclaeStepDecay; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_BLAST, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_BLAST, 128, &initParams); } -void EffectSsBlast_SpawnWhiteCustomScale(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, +void EffectSsBlast_SpawnWhiteCustomScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) { static Color_RGBA8 primColor = { 255, 255, 255, 255 }; static Color_RGBA8 envColor = { 200, 200, 200, 0 }; - EffectSsBlast_Spawn(globalCtx, pos, velocity, accel, &primColor, &envColor, scale, scaleStep, 35, life); + EffectSsBlast_Spawn(play, pos, velocity, accel, &primColor, &envColor, scale, scaleStep, 35, life); } -void EffectSsBlast_SpawnShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor, s16 life) { - EffectSsBlast_Spawn(globalCtx, pos, velocity, accel, primColor, envColor, 100, 375, 35, life); +void EffectSsBlast_SpawnShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 life) { + EffectSsBlast_Spawn(play, pos, velocity, accel, primColor, envColor, 100, 375, 35, life); } -void EffectSsBlast_SpawnWhiteShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { static Color_RGBA8 primColor = { 255, 255, 255, 255 }; static Color_RGBA8 envColor = { 200, 200, 200, 0 }; - EffectSsBlast_SpawnShockwave(globalCtx, pos, velocity, accel, &primColor, &envColor, 10); + EffectSsBlast_SpawnShockwave(play, pos, velocity, accel, &primColor, &envColor, 10); } // EffectSsGSpk Spawn Functions -void EffectSsGSpk_SpawnAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { EffectSsGSpkInitParams initParams; @@ -372,11 +369,11 @@ void EffectSsGSpk_SpawnAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, initParams.scaleStep = scaleStep; initParams.updateMode = 0; - EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPK, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_SPK, 128, &initParams); } // unused -void EffectSsGSpk_SpawnNoAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnNoAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { EffectSsGSpkInitParams initParams; @@ -390,19 +387,19 @@ void EffectSsGSpk_SpawnNoAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* po initParams.scaleStep = scaleStep; initParams.updateMode = 1; - EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPK, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_SPK, 128, &initParams); } -void EffectSsGSpk_SpawnFuse(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void EffectSsGSpk_SpawnFuse(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { Color_RGBA8 primColor = { 255, 255, 150, 255 }; Color_RGBA8 envColor = { 255, 0, 0, 0 }; - EffectSsGSpk_SpawnSmall(globalCtx, actor, pos, velocity, accel, &primColor, &envColor); + EffectSsGSpk_SpawnSmall(play, actor, pos, velocity, accel, &primColor, &envColor); } // unused -void EffectSsGSpk_SpawnRandColor(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - s16 scale, s16 scaleStep) { +void EffectSsGSpk_SpawnRandColor(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, + s16 scaleStep) { Color_RGBA8 primColor = { 255, 255, 150, 255 }; Color_RGBA8 envColor = { 255, 0, 0, 0 }; s32 randOffset = (Rand_ZeroOne() * 20.0f) - 10.0f; @@ -416,17 +413,17 @@ void EffectSsGSpk_SpawnRandColor(GlobalContext* globalCtx, Actor* actor, Vec3f* envColor.b += randOffset; envColor.a += randOffset; - EffectSsGSpk_SpawnAccel(globalCtx, actor, pos, velocity, accel, &primColor, &envColor, scale, scaleStep); + EffectSsGSpk_SpawnAccel(play, actor, pos, velocity, accel, &primColor, &envColor, scale, scaleStep); } -void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsGSpk_SpawnSmall(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor) { - EffectSsGSpk_SpawnAccel(globalCtx, actor, pos, velocity, accel, primColor, envColor, 100, 5); + EffectSsGSpk_SpawnAccel(play, actor, pos, velocity, accel, primColor, envColor, 100, 5); } // EffectSsDFire Spawn Functions -void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s16 fadeDelay, s32 life) { EffectSsDFireInitParams initParams; @@ -439,17 +436,17 @@ void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.fadeDelay = fadeDelay; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_D_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_D_FIRE, 128, &initParams); } -void EffectSsDFire_SpawnFixedScale(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha, +void EffectSsDFire_SpawnFixedScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha, s16 fadeDelay) { - EffectSsDFire_Spawn(globalCtx, pos, velocity, accel, 100, 35, alpha, fadeDelay, 8); + EffectSsDFire_Spawn(play, pos, velocity, accel, 100, 35, alpha, fadeDelay, 8); } // EffectSsBubble Spawn Functions -void EffectSsBubble_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, +void EffectSsBubble_Spawn(PlayState* play, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, f32 scale) { EffectSsBubbleInitParams initParams; @@ -459,12 +456,12 @@ void EffectSsBubble_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 yPosOffset, initParams.xzPosRandScale = xzPosRandScale; initParams.scale = scale; - EffectSs_Spawn(globalCtx, EFFECT_SS_BUBBLE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_BUBBLE, 128, &initParams); } // EffectSsGRipple Spawn Functions -void EffectSsGRipple_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 radius, s16 radiusMax, s16 life) { +void EffectSsGRipple_Spawn(PlayState* play, Vec3f* pos, s16 radius, s16 radiusMax, s16 life) { EffectSsGRippleInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -472,13 +469,13 @@ void EffectSsGRipple_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 radius, s16 initParams.radiusMax = radiusMax; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_G_RIPPLE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_RIPPLE, 128, &initParams); } // EffectSsGSplash Spawn Functions -void EffectSsGSplash_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, - s16 type, s16 scale) { +void EffectSsGSplash_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, + s16 scale) { EffectSsGSplashInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -493,33 +490,33 @@ void EffectSsGSplash_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* pr initParams.customColor = false; } - EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPLASH, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_SPLASH, 128, &initParams); } // EffectSsGMagma Spawn Functions -void EffectSsGMagma_Spawn(GlobalContext* globalCtx, Vec3f* pos) { +void EffectSsGMagma_Spawn(PlayState* play, Vec3f* pos) { EffectSsGMagmaInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); - EffectSs_Spawn(globalCtx, EFFECT_SS_G_MAGMA, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_MAGMA, 128, &initParams); } // EffectSsGFire Spawn Functions -void EffectSsGFire_Spawn(GlobalContext* globalCtx, Vec3f* pos) { +void EffectSsGFire_Spawn(PlayState* play, Vec3f* pos) { EffectSsGFireInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); - EffectSs_Spawn(globalCtx, EFFECT_SS_G_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_FIRE, 128, &initParams); } // EffectSsLightning Spawn Functions -void EffectSsLightning_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, - s16 scale, s16 yaw, s16 life, s16 numBolts) { +void EffectSsLightning_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, + s16 yaw, s16 life, s16 numBolts) { EffectSsLightningInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -530,13 +527,13 @@ void EffectSsLightning_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* initParams.life = life; initParams.numBolts = numBolts; - EffectSs_Spawn(globalCtx, EFFECT_SS_LIGHTNING, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_LIGHTNING, 128, &initParams); } // EffectSsDtBubble Spawn Functions -void EffectSsDtBubble_SpawnColorProfile(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, - s16 life, s16 colorProfile, s16 randXZ) { +void EffectSsDtBubble_SpawnColorProfile(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 life, + s16 colorProfile, s16 randXZ) { EffectSsDtBubbleInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -548,10 +545,10 @@ void EffectSsDtBubble_SpawnColorProfile(GlobalContext* globalCtx, Vec3f* pos, Ve initParams.life = life; initParams.randXZ = randXZ; - EffectSs_Spawn(globalCtx, EFFECT_SS_DT_BUBBLE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DT_BUBBLE, 128, &initParams); } -void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsDtBubble_SpawnCustomColor(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 life, s16 randXZ) { EffectSsDtBubbleInitParams initParams; @@ -565,7 +562,7 @@ void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec initParams.randXZ = randXZ; initParams.customColor = true; - EffectSs_Spawn(globalCtx, EFFECT_SS_DT_BUBBLE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DT_BUBBLE, 128, &initParams); } // EffectSsHahen Spawn Functions @@ -579,8 +576,8 @@ void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec * - due to how life is implemented it is capped at 200. Any value over 200 is accepted, but the fragment will * only live for 200 frames */ -void EffectSsHahen_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, - s16 objId, s16 life, Gfx* dList) { +void EffectSsHahen_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, s16 objId, + s16 life, Gfx* dList) { EffectSsHahenInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -592,7 +589,7 @@ void EffectSsHahen_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.objId = objId; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_HAHEN, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_HAHEN, 128, &initParams); } /** @@ -604,8 +601,8 @@ void EffectSsHahen_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, * - due to how life is implemented it is capped at 200. Any value over 200 is accepted, but the fragment will * only live for 200 frames */ -void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstScale, s16 unused, s16 scale, - s16 randScaleRange, s16 count, s16 objId, s16 life, Gfx* dList) { +void EffectSsHahen_SpawnBurst(PlayState* play, Vec3f* pos, f32 burstScale, s16 unused, s16 scale, s16 randScaleRange, + s16 count, s16 objId, s16 life, Gfx* dList) { s32 i; Vec3f velocity; Vec3f accel; @@ -618,8 +615,8 @@ void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstSca velocity.z = (Rand_ZeroOne() - 0.5f) * burstScale; velocity.y = ((Rand_ZeroOne() * 0.5f) + 0.5f) * burstScale; - EffectSsHahen_Spawn(globalCtx, pos, &velocity, &accel, unused, Rand_S16Offset(scale, randScaleRange), objId, - life, dList); + EffectSsHahen_Spawn(play, pos, &velocity, &accel, unused, Rand_S16Offset(scale, randScaleRange), objId, life, + dList); } } @@ -629,19 +626,19 @@ void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstSca * As child, spawn a broken stick fragment * As adult, spawn a broken sword fragment */ -void EffectSsStick_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 yaw) { +void EffectSsStick_Spawn(PlayState* play, Vec3f* pos, s16 yaw) { EffectSsStickInitParams initParams; initParams.pos = *pos; initParams.yaw = yaw; - EffectSs_Spawn(globalCtx, EFFECT_SS_STICK, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_STICK, 128, &initParams); } // EffectSsSibuki Spawn Functions -void EffectSsSibuki_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, - s16 direction, s16 scale) { +void EffectSsSibuki_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, s16 direction, + s16 scale) { EffectSsSibukiInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -651,10 +648,10 @@ void EffectSsSibuki_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.direction = direction; initParams.scale = scale; - EffectSs_Spawn(globalCtx, EFFECT_SS_SIBUKI, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_SIBUKI, 128, &initParams); } -void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos) { +void EffectSsSibuki_SpawnBurst(PlayState* play, Vec3f* pos) { s16 i; Vec3f unusedZeroVec1 = { 0.0f, 0.0f, 0.0f }; Vec3f unusedZeroVec2 = { 0.0f, 0.0f, 0.0f }; @@ -662,27 +659,27 @@ void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos) { s16 randDirection = Rand_ZeroOne() * 1.99f; for (i = 0; i < KREG(19) + 30; i++) { - EffectSsSibuki_Spawn(globalCtx, pos, &zeroVec, &zeroVec, i / (KREG(27) + 6), randDirection, KREG(18) + 40); + EffectSsSibuki_Spawn(play, pos, &zeroVec, &zeroVec, i / (KREG(27) + 6), randDirection, KREG(18) + 40); } } // EffectSsSibuki2 Spawn Functions // unused -void EffectSsSibuki2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { +void EffectSsSibuki2_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { EffectSsSibuki2InitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); Math_Vec3f_Copy(&initParams.velocity, velocity); Math_Vec3f_Copy(&initParams.accel, accel); initParams.scale = scale; - EffectSs_Spawn(globalCtx, EFFECT_SS_SIBUKI2, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_SIBUKI2, 128, &initParams); } // EffectSsGMagma2 Spawn Functions -void EffectSsGMagma2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, - s16 updateRate, s16 drawMode, s16 scale) { +void EffectSsGMagma2_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 updateRate, + s16 drawMode, s16 scale) { EffectSsGMagma2InitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -692,38 +689,38 @@ void EffectSsGMagma2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* pr initParams.drawMode = drawMode; initParams.scale = scale; - EffectSs_Spawn(globalCtx, EFFECT_SS_G_MAGMA2, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_MAGMA2, 128, &initParams); } // EffectSsStone1 Spawn Functions -void EffectSsStone1_Spawn(GlobalContext* globalCtx, Vec3f* pos, s32 arg2) { +void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 arg2) { EffectSsStone1InitParams initParams; initParams.pos = *pos; initParams.unk_C = arg2; - EffectSs_Spawn(globalCtx, EFFECT_SS_STONE1, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_STONE1, 128, &initParams); } // EffectSsHitMark Spawn Functions -void EffectSsHitMark_Spawn(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos) { +void EffectSsHitMark_Spawn(PlayState* play, s32 type, s16 scale, Vec3f* pos) { EffectSsHitMarkInitParams initParams; initParams.type = type; initParams.scale = scale; Math_Vec3f_Copy(&initParams.pos, pos); - EffectSs_Spawn(globalCtx, EFFECT_SS_HITMARK, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_HITMARK, 128, &initParams); } -void EffectSsHitMark_SpawnFixedScale(GlobalContext* globalCtx, s32 type, Vec3f* pos) { - EffectSsHitMark_Spawn(globalCtx, type, 300, pos); +void EffectSsHitMark_SpawnFixedScale(PlayState* play, s32 type, Vec3f* pos) { + EffectSsHitMark_Spawn(play, type, 300, pos); } -void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos) { - EffectSsHitMark_Spawn(globalCtx, type, scale, pos); +void EffectSsHitMark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3f* pos) { + EffectSsHitMark_Spawn(play, type, scale, pos); } // EffectSsFhgFlash Spawn Functions @@ -734,8 +731,7 @@ void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, s32 type, s16 sc * param changes the color of the ball. Refer to FhgFlashLightBallParam for the options. * Note: this type requires OBJECT_FHG to be loaded */ -void EffectSsFhgFlash_SpawnLightBall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, - u8 param) { +void EffectSsFhgFlash_SpawnLightBall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, u8 param) { EffectSsFhgFlashInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -745,7 +741,7 @@ void EffectSsFhgFlash_SpawnLightBall(GlobalContext* globalCtx, Vec3f* pos, Vec3f initParams.param = param; initParams.type = FHGFLASH_LIGHTBALL; - EffectSs_Spawn(globalCtx, EFFECT_SS_FHG_FLASH, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_FHG_FLASH, 128, &initParams); } /** @@ -756,7 +752,7 @@ void EffectSsFhgFlash_SpawnLightBall(GlobalContext* globalCtx, Vec3f* pos, Vec3f * 1: spawn at one of Player's body parts, chosen at random * 2: spawn at one of Phantom Ganon's body parts, chosen at random */ -void EffectSsFhgFlash_SpawnShock(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, u8 param) { +void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 param) { EffectSsFhgFlashInitParams initParams; initParams.actor = actor; @@ -765,12 +761,12 @@ void EffectSsFhgFlash_SpawnShock(GlobalContext* globalCtx, Actor* actor, Vec3f* initParams.param = param; initParams.type = FHGFLASH_SHOCK; - EffectSs_Spawn(globalCtx, EFFECT_SS_FHG_FLASH, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_FHG_FLASH, 128, &initParams); } // EffectSsKFire Spawn Functions -void EffectSsKFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type) { +void EffectSsKFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type) { EffectSsKFireInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -779,12 +775,12 @@ void EffectSsKFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.scaleMax = scaleMax; initParams.type = type; - EffectSs_Spawn(globalCtx, EFFECT_SS_K_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_K_FIRE, 128, &initParams); } // EffectSsSolderSrchBall Spawn Functions -void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, +void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16* linkDetected) { EffectSsSolderSrchBallInitParams initParams; @@ -794,14 +790,14 @@ void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* v initParams.unused = unused; initParams.linkDetected = linkDetected; - EffectSs_Spawn(globalCtx, EFFECT_SS_SOLDER_SRCH_BALL, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_SOLDER_SRCH_BALL, 128, &initParams); } // EffectSsKakera Spawn Functions -void EffectSsKakera_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, - s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, - s16 objId, Gfx* dList) { +void EffectSsKakera_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, s16 arg6, + s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, s16 objId, + Gfx* dList) { EffectSsKakeraInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -820,12 +816,12 @@ void EffectSsKakera_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.objId = objId; initParams.dList = dList; - EffectSs_Spawn(globalCtx, EFFECT_SS_KAKERA, 101, &initParams); + EffectSs_Spawn(play, EFFECT_SS_KAKERA, 101, &initParams); } // EffectSsIcePiece Spawn Functions -void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life) { +void EffectSsIcePiece_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life) { EffectSsIcePieceInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -833,10 +829,10 @@ void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec Math_Vec3f_Copy(&initParams.accel, accel); initParams.scale = scale; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_PIECE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_ICE_PIECE, 128, &initParams); } -void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 scale) { +void EffectSsIcePiece_SpawnBurst(PlayState* play, Vec3f* refPos, f32 scale) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Vec3f vecScales[] = { { 0.0f, 70.0f, 0.0f }, @@ -867,14 +863,14 @@ void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 sc pos.y += vecScales[i].y; pos.z += vecScales[i].z; - EffectSsIcePiece_Spawn(globalCtx, &pos, (Rand_ZeroFloat(1.0f) + 0.5f) * ((scale * 1.3f) * 100.0f), &velocity, - &accel, 25); + EffectSsIcePiece_Spawn(play, &pos, (Rand_ZeroFloat(1.0f) + 0.5f) * ((scale * 1.3f) * 100.0f), &velocity, &accel, + 25); } } // EffectSsEnIce Spawn Functions -void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 primR, s16 primG, s16 primB, +void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, f32 scale) { EffectSsEnIceInitParams initParams; @@ -895,10 +891,10 @@ void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3 Audio_PlayActorSound2(actor, NA_SE_PL_FREEZE_S); } - EffectSs_Spawn(globalCtx, EFFECT_SS_EN_ICE, 80, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 80, &initParams); } -void EffectSsEnIce_SpawnFlyingVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* pos, s16 primR, s16 primG, s16 primB, +void EffectSsEnIce_SpawnFlyingVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, f32 scale) { EffectSsEnIceInitParams initParams; @@ -921,11 +917,11 @@ void EffectSsEnIce_SpawnFlyingVec3s(GlobalContext* globalCtx, Actor* actor, Vec3 Audio_PlayActorSound2(actor, NA_SE_PL_FREEZE_S); } - EffectSs_Spawn(globalCtx, EFFECT_SS_EN_ICE, 80, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 80, &initParams); } -void EffectSsEnIce_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life) { +void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s32 life) { EffectSsEnIceInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -937,12 +933,12 @@ void EffectSsEnIce_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* initParams.life = life; initParams.type = 1; - EffectSs_Spawn(globalCtx, EFFECT_SS_EN_ICE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 128, &initParams); } // EffectSsFireTail Spawn Functions -void EffectSsFireTail_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5, +void EffectSsFireTail_Spawn(PlayState* play, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 bodyPart, s32 life) { EffectSsFireTailInitParams initParams; @@ -957,10 +953,10 @@ void EffectSsFireTail_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, initParams.bodyPart = bodyPart; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_FIRE_TAIL, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_FIRE_TAIL, 128, &initParams); } -void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, +void EffectSsFireTail_SpawnFlame(PlayState* play, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, f32 colorIntensity) { static Color_RGBA8 primColor = { 255, 255, 0, 255 }; static Color_RGBA8 envColor = { 255, 0, 0, 255 }; @@ -972,21 +968,20 @@ void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* envColor.b = 0; primColor.r = envColor.r = (s32)(255.0f * colorIntensity); - EffectSsFireTail_Spawn(globalCtx, actor, pos, arg3, &actor->velocity, 15, &primColor, &envColor, + EffectSsFireTail_Spawn(play, actor, pos, arg3, &actor->velocity, 15, &primColor, &envColor, (colorIntensity == 1.0f) ? 0 : 1, bodyPart, 1); } -void EffectSsFireTail_SpawnFlameOnPlayer(GlobalContext* globalCtx, f32 scale, s16 bodyPart, f32 colorIntensity) { - Player* player = GET_PLAYER(globalCtx); +void EffectSsFireTail_SpawnFlameOnPlayer(PlayState* play, f32 scale, s16 bodyPart, f32 colorIntensity) { + Player* player = GET_PLAYER(play); - EffectSsFireTail_SpawnFlame(globalCtx, &player->actor, &player->bodyPartsPos[bodyPart], scale, bodyPart, - colorIntensity); + EffectSsFireTail_SpawnFlame(play, &player->actor, &player->bodyPartsPos[bodyPart], scale, bodyPart, colorIntensity); } // EffectSsEnFire Spawn Functions // note: if bodyPart is greater than -1 the actor MUST have a table of Vec3f positions at offset 0x14C in the instance -void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, +void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, s16 bodyPart) { EffectSsEnFireInitParams initParams; @@ -1001,11 +996,11 @@ void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* po Audio_PlayActorSound2(actor, NA_SE_EV_FLAME_IGNITION); } - EffectSs_Spawn(globalCtx, EFFECT_SS_EN_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams); } // note: if bodyPart is greater than -1 the actor MUST have a table of Vec3s positions at offset 0x14C in the instance -void EffectSsEnFire_SpawnVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags, +void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags, s16 bodyPart) { EffectSsEnFireInitParams initParams; @@ -1022,12 +1017,12 @@ void EffectSsEnFire_SpawnVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* po Audio_PlayActorSound2(actor, NA_SE_EV_FLAME_IGNITION); } - EffectSs_Spawn(globalCtx, EFFECT_SS_EN_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams); } // EffectSsExtra Spawn Functions -void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx) { +void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx) { EffectSsExtraInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -1036,12 +1031,12 @@ void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.scale = scale; initParams.scoreIdx = scoreIdx; - EffectSs_Spawn(globalCtx, EFFECT_SS_EXTRA, 100, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EXTRA, 100, &initParams); } // EffectSsFCircle Spawn Functions -void EffectSsFCircle_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 radius, s16 height) { +void EffectSsFCircle_Spawn(PlayState* play, Actor* actor, Vec3f* pos, s16 radius, s16 height) { EffectSsFcircleInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -1049,12 +1044,12 @@ void EffectSsFCircle_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s initParams.radius = radius; initParams.height = height; - EffectSs_Spawn(globalCtx, EFFECT_SS_FCIRCLE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_FCIRCLE, 128, &initParams); } // EffectSsDeadDb Spawn Functions -void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, s16 unused, s32 arg14, s16 playSound) { EffectSsDeadDbInitParams initParams; @@ -1075,12 +1070,12 @@ void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.unk_34 = arg14; initParams.playSound = playSound; - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DB, 120, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_DB, 120, &initParams); } // EffectSsDeadDd Spawn Functions -void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDeadDd_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 primR, s16 primG, s16 primB, s16 alpha, s16 envR, s16 envG, s16 envB, s16 alphaStep, s32 life) { EffectSsDeadDdInitParams initParams; @@ -1101,11 +1096,11 @@ void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.alphaStep = alphaStep; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DD, 120, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_DD, 120, &initParams); } // unused -void EffectSsDeadDd_SpawnRandYellow(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale, +void EffectSsDeadDd_SpawnRandYellow(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale, s32 randIter, s32 life) { EffectSsDeadDdInitParams initParams; @@ -1117,12 +1112,12 @@ void EffectSsDeadDd_SpawnRandYellow(GlobalContext* globalCtx, Vec3f* pos, s16 sc initParams.life = life; initParams.type = 1; - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DD, 120, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_DD, 120, &initParams); } // EffectSsDeadDs Spawn Functions -void EffectSsDeadDs_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void EffectSsDeadDs_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s32 life) { EffectSsDeadDsInitParams initParams; @@ -1133,18 +1128,17 @@ void EffectSsDeadDs_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.scaleStep = scaleStep; initParams.alpha = alpha; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DS, 100, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_DS, 100, &initParams); } -void EffectSsDeadDs_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, - s32 life) { - EffectSsDeadDs_Spawn(globalCtx, pos, &sZeroVec, &sZeroVec, scale, scaleStep, alpha, life); +void EffectSsDeadDs_SpawnStationary(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life) { + EffectSsDeadDs_Spawn(play, pos, &sZeroVec, &sZeroVec, scale, scaleStep, alpha, life); } // EffectSsDeadSound Spawn Functions -void EffectSsDeadSound_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId, - s16 lowerPriority, s16 repeatMode, s32 life) { +void EffectSsDeadSound_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId, s16 lowerPriority, + s16 repeatMode, s32 life) { EffectSsDeadSoundInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -1156,15 +1150,15 @@ void EffectSsDeadSound_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* veloci initParams.life = life; if (!lowerPriority) { - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_SOUND, 100, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_SOUND, 100, &initParams); } else { - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_SOUND, 127, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_SOUND, 127, &initParams); } } -void EffectSsDeadSound_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, u16 sfxId, s16 lowerPriority, - s16 repeatMode, s32 life) { - EffectSsDeadSound_Spawn(globalCtx, pos, &sZeroVec, &sZeroVec, sfxId, lowerPriority, repeatMode, life); +void EffectSsDeadSound_SpawnStationary(PlayState* play, Vec3f* pos, u16 sfxId, s16 lowerPriority, s16 repeatMode, + s32 life) { + EffectSsDeadSound_Spawn(play, pos, &sZeroVec, &sZeroVec, sfxId, lowerPriority, repeatMode, life); } // EffectSsIceSmoke Spawn Functions @@ -1174,7 +1168,7 @@ void EffectSsDeadSound_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, u16 * * Note: this effect requires OBJECT_FZ to be loaded */ -void EffectSsIceSmoke_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { +void EffectSsIceSmoke_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { EffectSsIceSmokeInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -1182,5 +1176,5 @@ void EffectSsIceSmoke_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocit Math_Vec3f_Copy(&initParams.accel, accel); initParams.scale = scale; - EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_SMOKE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_ICE_SMOKE, 128, &initParams); } diff --git a/src/code/z_elf_message.c b/src/code/z_elf_message.c index 62c6ddb2ff..0d119e1ced 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -148,12 +148,12 @@ u16 ElfMessage_GetTextFromMsgs(ElfMessage* msg) { } } -u16 ElfMessage_GetSariaText(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +u16 ElfMessage_GetSariaText(PlayState* play) { + Player* player = GET_PLAYER(play); ElfMessage* msgs; if (!LINK_IS_ADULT) { - if (Actor_FindNearby(globalCtx, &player->actor, ACTOR_EN_SA, 4, 800.0f) == NULL) { + if (Actor_FindNearby(play, &player->actor, ACTOR_EN_SA, 4, 800.0f) == NULL) { msgs = sChildSariaMsgs; } else { return 0x0160; // Special text about Saria preferring to talk to you face-to-face @@ -165,10 +165,10 @@ u16 ElfMessage_GetSariaText(GlobalContext* globalCtx) { return ElfMessage_GetTextFromMsgs(msgs); } -u16 ElfMessage_GetCUpText(GlobalContext* globalCtx) { - if (globalCtx->cUpElfMsgs == NULL) { +u16 ElfMessage_GetCUpText(PlayState* play) { + if (play->cUpElfMsgs == NULL) { return 0; } else { - return ElfMessage_GetTextFromMsgs(globalCtx->cUpElfMsgs); + return ElfMessage_GetTextFromMsgs(play->cUpElfMsgs); } } diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index bab2955771..2bfd53cc2b 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -4,16 +4,16 @@ #define FLAGS ACTOR_FLAG_4 -void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAObj_Init(Actor* thisx, PlayState* play); +void EnAObj_Destroy(Actor* thisx, PlayState* play); +void EnAObj_Update(Actor* thisx, PlayState* play); +void EnAObj_Draw(Actor* thisx, PlayState* play); -void EnAObj_WaitFinishedTalking(EnAObj* this, GlobalContext* globalCtx); -void EnAObj_WaitTalk(EnAObj* this, GlobalContext* globalCtx); -void EnAObj_BlockRot(EnAObj* this, GlobalContext* globalCtx); -void EnAObj_BoulderFragment(EnAObj* this, GlobalContext* globalCtx); -void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx); +void EnAObj_WaitFinishedTalking(EnAObj* this, PlayState* play); +void EnAObj_WaitTalk(EnAObj* this, PlayState* play); +void EnAObj_BlockRot(EnAObj* this, PlayState* play); +void EnAObj_BoulderFragment(EnAObj* this, PlayState* play); +void EnAObj_Block(EnAObj* this, PlayState* play); void EnAObj_SetupWaitTalk(EnAObj* this, s16 type); void EnAObj_SetupBlockRot(EnAObj* this, s16 type); @@ -82,7 +82,7 @@ void EnAObj_SetupAction(EnAObj* this, EnAObjActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAObj_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; s32 pad; EnAObj* this = (EnAObj*)thisx; @@ -129,13 +129,13 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { case A_OBJ_BLOCK_LARGE: case A_OBJ_BLOCK_HUGE: this->dyna.bgId = 1; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BG); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_BG); EnAObj_SetupBlock(this, thisx->params); break; case A_OBJ_BLOCK_SMALL_ROT: case A_OBJ_BLOCK_LARGE_ROT: this->dyna.bgId = 3; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BG); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_BG); EnAObj_SetupBlockRot(this, thisx->params); break; case A_OBJ_UNKNOWN_6: @@ -157,8 +157,8 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; this->focusYoffset = 45.0f; EnAObj_SetupWaitTalk(this, thisx->params); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); thisx->colChkInfo.mass = MASS_IMMOVABLE; thisx->targetMode = 0; break; @@ -178,25 +178,25 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->dyna.bgId != BGACTOR_NEG_ONE) { CollisionHeader_GetVirtual(sColHeaders[this->dyna.bgId], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } } -void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAObj_Destroy(Actor* thisx, PlayState* play) { EnAObj* this = (EnAObj*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); switch (this->dyna.actor.params) { case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_ARROW: - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); break; } } -void EnAObj_WaitFinishedTalking(EnAObj* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->dyna.actor, globalCtx)) { +void EnAObj_WaitFinishedTalking(EnAObj* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->dyna.actor, play)) { EnAObj_SetupWaitTalk(this, this->dyna.actor.params); } } @@ -205,17 +205,17 @@ void EnAObj_SetupWaitTalk(EnAObj* this, s16 type) { EnAObj_SetupAction(this, EnAObj_WaitTalk); } -void EnAObj_WaitTalk(EnAObj* this, GlobalContext* globalCtx) { +void EnAObj_WaitTalk(EnAObj* this, PlayState* play) { s16 relYawTowardsPlayer; if (this->dyna.actor.textId != 0) { relYawTowardsPlayer = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y; if (ABS(relYawTowardsPlayer) < 0x2800 || (this->dyna.actor.params == A_OBJ_SIGNPOST_ARROW && ABS(relYawTowardsPlayer) > 0x5800)) { - if (Actor_ProcessTalkRequest(&this->dyna.actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, play)) { EnAObj_SetupAction(this, EnAObj_WaitFinishedTalking); } else { - func_8002F2F4(&this->dyna.actor, globalCtx); + func_8002F2F4(&this->dyna.actor, play); } } } @@ -229,7 +229,7 @@ void EnAObj_SetupBlockRot(EnAObj* this, s16 type) { EnAObj_SetupAction(this, EnAObj_BlockRot); } -void EnAObj_BlockRot(EnAObj* this, GlobalContext* globalCtx) { +void EnAObj_BlockRot(EnAObj* this, PlayState* play) { if (this->rotateState == 0) { if (this->dyna.unk_160 != 0) { this->rotateState++; @@ -272,7 +272,7 @@ void EnAObj_SetupBoulderFragment(EnAObj* this, s16 type) { EnAObj_SetupAction(this, EnAObj_BoulderFragment); } -void EnAObj_BoulderFragment(EnAObj* this, GlobalContext* globalCtx) { +void EnAObj_BoulderFragment(EnAObj* this, PlayState* play) { Math_SmoothStepToF(&this->dyna.actor.speedXZ, 1.0f, 1.0f, 0.5f, 0.0f); this->dyna.actor.shape.rot.x += this->dyna.actor.world.rot.x >> 1; this->dyna.actor.shape.rot.z += this->dyna.actor.world.rot.z >> 1; @@ -301,7 +301,7 @@ void EnAObj_SetupBlock(EnAObj* this, s16 type) { EnAObj_SetupAction(this, EnAObj_Block); } -void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx) { +void EnAObj_Block(EnAObj* this, PlayState* play) { this->dyna.actor.speedXZ += this->dyna.unk_150; this->dyna.actor.world.rot.y = this->dyna.unk_158; this->dyna.actor.speedXZ = CLAMP(this->dyna.actor.speedXZ, -2.5f, 2.5f); @@ -316,19 +316,19 @@ void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx) { this->dyna.unk_150 = 0.0f; } -void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAObj_Update(Actor* thisx, PlayState* play) { EnAObj* this = (EnAObj*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->dyna.actor); if (this->dyna.actor.gravity != 0.0f) { if (this->dyna.actor.params != A_OBJ_BOULDER_FRAGMENT) { - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 5.0f, 40.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 5.0f, 40.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 5.0f, 20.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 5.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } @@ -341,17 +341,17 @@ void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) { case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_ARROW: Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); break; } } -void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAObj_Draw(Actor* thisx, PlayState* play) { s32 type = thisx->params; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 701); + OPEN_DISPS(play->state.gfxCtx, "../z_en_a_keep.c", 701); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (type >= A_OBJ_MAX) { type = A_OBJ_BOULDER_FRAGMENT; @@ -361,9 +361,9 @@ void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 1, 60, 60, 60, 50); } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 712), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_a_keep.c", 712), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDLists[type]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 715); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_a_keep.c", 715); } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 196a1c8eb4..f1b69c759d 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -5,20 +5,20 @@ #define FLAGS 0 -void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx); -void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx); -void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnItem00_Init(Actor* thisx, PlayState* play); +void EnItem00_Destroy(Actor* thisx, PlayState* play); +void EnItem00_Update(Actor* thisx, PlayState* play); +void EnItem00_Draw(Actor* thisx, PlayState* play); -void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx); -void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx); -void func_8001E304(EnItem00* this, GlobalContext* globalCtx); -void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx); +void func_8001DFC8(EnItem00* this, PlayState* play); +void func_8001E1C8(EnItem00* this, PlayState* play); +void func_8001E304(EnItem00* this, PlayState* play); +void func_8001E5C8(EnItem00* this, PlayState* play); -void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx); -void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx); -void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx); -void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx); +void EnItem00_DrawRupee(EnItem00* this, PlayState* play); +void EnItem00_DrawCollectible(EnItem00* this, PlayState* play); +void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play); +void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play); const ActorInit En_Item00_InitVars = { ACTOR_EN_ITEM00, @@ -136,7 +136,7 @@ void EnItem00_SetupAction(EnItem00* this, EnItem00ActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Init(Actor* thisx, PlayState* play) { EnItem00* this = (EnItem00*)thisx; s32 pad; f32 yOffset = 980.0f; @@ -149,14 +149,14 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.params &= 0xFF; - if (Flags_GetCollectible(globalCtx, this->collectibleFlag)) { + if (Flags_GetCollectible(play, this->collectibleFlag)) { Actor_Kill(&this->actor); return; } Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_158 = 1; @@ -236,8 +236,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->scale = 0.01f; break; case ITEM00_SHIELD_DEKU: - this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_1); - Actor_SetObjectDependency(globalCtx, &this->actor); + this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_1); + Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.5f); this->scale = 0.5f; yOffset = 0.0f; @@ -245,8 +245,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.rot.x = 0x4000; break; case ITEM00_SHIELD_HYLIAN: - this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2); - Actor_SetObjectDependency(globalCtx, &this->actor); + this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_2); + Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.5f); this->scale = 0.5f; yOffset = 0.0f; @@ -255,8 +255,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { break; case ITEM00_TUNIC_ZORA: case ITEM00_TUNIC_GORON: - this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_CLOTHES); - Actor_SetObjectDependency(globalCtx, &this->actor); + this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_CLOTHES); + Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.5f); this->scale = 0.5f; yOffset = 0.0f; @@ -286,41 +286,41 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params) { case ITEM00_RUPEE_GREEN: - Item_Give(globalCtx, ITEM_RUPEE_GREEN); + Item_Give(play, ITEM_RUPEE_GREEN); break; case ITEM00_RUPEE_BLUE: - Item_Give(globalCtx, ITEM_RUPEE_BLUE); + Item_Give(play, ITEM_RUPEE_BLUE); break; case ITEM00_RUPEE_RED: - Item_Give(globalCtx, ITEM_RUPEE_RED); + Item_Give(play, ITEM_RUPEE_RED); break; case ITEM00_RUPEE_PURPLE: - Item_Give(globalCtx, ITEM_RUPEE_PURPLE); + Item_Give(play, ITEM_RUPEE_PURPLE); break; case ITEM00_RUPEE_ORANGE: - Item_Give(globalCtx, ITEM_RUPEE_GOLD); + Item_Give(play, ITEM_RUPEE_GOLD); break; case ITEM00_HEART: - Item_Give(globalCtx, ITEM_HEART); + Item_Give(play, ITEM_HEART); break; case ITEM00_FLEXIBLE: - Health_ChangeBy(globalCtx, 0x70); + Health_ChangeBy(play, 0x70); break; case ITEM00_BOMBS_A: case ITEM00_BOMBS_B: - Item_Give(globalCtx, ITEM_BOMBS_5); + Item_Give(play, ITEM_BOMBS_5); break; case ITEM00_ARROWS_SINGLE: - Item_Give(globalCtx, ITEM_BOW); + Item_Give(play, ITEM_BOW); break; case ITEM00_ARROWS_SMALL: - Item_Give(globalCtx, ITEM_ARROWS_SMALL); + Item_Give(play, ITEM_ARROWS_SMALL); break; case ITEM00_ARROWS_MEDIUM: - Item_Give(globalCtx, ITEM_ARROWS_MEDIUM); + Item_Give(play, ITEM_ARROWS_MEDIUM); break; case ITEM00_ARROWS_LARGE: - Item_Give(globalCtx, ITEM_ARROWS_LARGE); + Item_Give(play, ITEM_ARROWS_LARGE); break; case ITEM00_MAGIC_LARGE: getItemId = GI_MAGIC_SMALL; @@ -329,7 +329,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { getItemId = GI_MAGIC_LARGE; break; case ITEM00_SMALL_KEY: - Item_Give(globalCtx, ITEM_KEY_SMALL); + Item_Give(play, ITEM_KEY_SMALL); break; case ITEM00_SEEDS: getItemId = GI_SEEDS_5; @@ -350,21 +350,21 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { break; } - if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) { - func_8002F554(&this->actor, globalCtx, getItemId); + if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, play)) { + func_8002F554(&this->actor, play, getItemId); } EnItem00_SetupAction(this, func_8001E5C8); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Destroy(Actor* thisx, PlayState* play) { EnItem00* this = (EnItem00*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) { +void func_8001DFC8(EnItem00* this, PlayState* play) { if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk_15A < 0)) || (this->actor.params == ITEM00_HEART_PIECE)) { this->actor.shape.rot.y += 960; @@ -410,7 +410,7 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) { } } -void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) { +void func_8001E1C8(EnItem00* this, PlayState* play) { f32 originalVelocity; Vec3f effectPos; @@ -418,11 +418,11 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) { this->actor.shape.rot.y += 960; } - if (globalCtx->gameplayFrames & 1) { + if (play->gameplayFrames & 1) { effectPos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f); effectPos.y = this->actor.world.pos.y + Rand_CenteredFloat(10.0f); effectPos.z = this->actor.world.pos.z + Rand_CenteredFloat(10.0f); - EffectSsKiraKira_SpawnSmall(globalCtx, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, + EffectSsKiraKira_SpawnSmall(play, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor); } @@ -438,7 +438,7 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) { } } -void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { +void func_8001E304(EnItem00* this, PlayState* play) { s32 pad; Vec3f pos; s32 rotOffset; @@ -477,12 +477,11 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { } } - if (!(globalCtx->gameplayFrames & 1)) { + if (!(play->gameplayFrames & 1)) { pos.x = this->actor.world.pos.x + (Rand_ZeroOne() - 0.5f) * 10.0f; pos.y = this->actor.world.pos.y + (Rand_ZeroOne() - 0.5f) * 10.0f; pos.z = this->actor.world.pos.z + (Rand_ZeroOne() - 0.5f) * 10.0f; - EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, - &sEffectEnvColor); + EffectSsKiraKira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor); } if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { @@ -493,12 +492,12 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { } } -void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8001E5C8(EnItem00* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->getItemId != GI_NONE) { - if (!Actor_HasParent(&this->actor, globalCtx)) { - func_8002F434(&this->actor, globalCtx, this->getItemId, 50.0f, 80.0f); + if (!Actor_HasParent(&this->actor, play)) { + func_8002F434(&this->actor, play, this->getItemId, 50.0f, 80.0f); this->unk_15A++; } else { this->getItemId = GI_NONE; @@ -526,7 +525,7 @@ void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) { } // The BSS in the function acted weird in the past. It is matching now but might cause issues in the future -void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Update(Actor* thisx, PlayState* play) { static u32 D_80157D90; static s16 D_80157D94[1]; s16* params; @@ -546,7 +545,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_156 = this->unk_15A; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Math_SmoothStepToF(&this->actor.scale.x, this->scale, 0.1f, this->scale * 0.1f, 0.0f); temp = &D_80157D90; @@ -555,12 +554,12 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.gravity) { if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { - if (*temp != globalCtx->gameplayFrames) { - D_80157D90 = globalCtx->gameplayFrames; + if (*temp != play->gameplayFrames) { + D_80157D90 = play->gameplayFrames; D_80157D94[0] = 0; for (i = 0; i < 50; i++) { - if (globalCtx->colCtx.dyna.bgActorFlags[i] & 1) { - dynaActor = globalCtx->colCtx.dyna.bgActors[i].actor; + if (play->colCtx.dyna.bgActorFlags[i] & 1) { + dynaActor = play->colCtx.dyna.bgActors[i].actor; if ((dynaActor != NULL) && (dynaActor->update != NULL)) { if ((dynaActor->world.pos.x != dynaActor->prevPos.x) || (dynaActor->world.pos.y != dynaActor->prevPos.y) || @@ -579,7 +578,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { } if (sp3A || D_80157D94[0]) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 15.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 15.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); @@ -591,7 +590,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if ((this->actor.params == ITEM00_SHIELD_DEKU) || (this->actor.params == ITEM00_SHIELD_HYLIAN) || (this->actor.params == ITEM00_TUNIC_ZORA) || (this->actor.params == ITEM00_TUNIC_GORON)) { @@ -605,30 +604,30 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { if (!((this->actor.xzDistToPlayer <= 30.0f) && (this->actor.yDistToPlayer >= -50.0f) && (this->actor.yDistToPlayer <= 50.0f))) { - if (!Actor_HasParent(&this->actor, globalCtx)) { + if (!Actor_HasParent(&this->actor, play)) { return; } } - if (globalCtx->gameOverCtx.state != GAMEOVER_INACTIVE) { + if (play->gameOverCtx.state != GAMEOVER_INACTIVE) { return; } switch (this->actor.params) { case ITEM00_RUPEE_GREEN: - Item_Give(globalCtx, ITEM_RUPEE_GREEN); + Item_Give(play, ITEM_RUPEE_GREEN); break; case ITEM00_RUPEE_BLUE: - Item_Give(globalCtx, ITEM_RUPEE_BLUE); + Item_Give(play, ITEM_RUPEE_BLUE); break; case ITEM00_RUPEE_RED: - Item_Give(globalCtx, ITEM_RUPEE_RED); + Item_Give(play, ITEM_RUPEE_RED); break; case ITEM00_RUPEE_PURPLE: - Item_Give(globalCtx, ITEM_RUPEE_PURPLE); + Item_Give(play, ITEM_RUPEE_PURPLE); break; case ITEM00_RUPEE_ORANGE: - Item_Give(globalCtx, ITEM_RUPEE_GOLD); + Item_Give(play, ITEM_RUPEE_GOLD); break; case ITEM00_STICK: getItemId = GI_STICKS_1; @@ -637,26 +636,26 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { getItemId = GI_NUTS_5; break; case ITEM00_HEART: - Item_Give(globalCtx, ITEM_HEART); + Item_Give(play, ITEM_HEART); break; case ITEM00_FLEXIBLE: - Health_ChangeBy(globalCtx, 0x70); + Health_ChangeBy(play, 0x70); break; case ITEM00_BOMBS_A: case ITEM00_BOMBS_B: - Item_Give(globalCtx, ITEM_BOMBS_5); + Item_Give(play, ITEM_BOMBS_5); break; case ITEM00_ARROWS_SINGLE: - Item_Give(globalCtx, ITEM_BOW); + Item_Give(play, ITEM_BOW); break; case ITEM00_ARROWS_SMALL: - Item_Give(globalCtx, ITEM_ARROWS_SMALL); + Item_Give(play, ITEM_ARROWS_SMALL); break; case ITEM00_ARROWS_MEDIUM: - Item_Give(globalCtx, ITEM_ARROWS_MEDIUM); + Item_Give(play, ITEM_ARROWS_MEDIUM); break; case ITEM00_ARROWS_LARGE: - Item_Give(globalCtx, ITEM_ARROWS_LARGE); + Item_Give(play, ITEM_ARROWS_LARGE); break; case ITEM00_SEEDS: getItemId = GI_SEEDS_5; @@ -694,8 +693,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { params = &this->actor.params; - if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) { - func_8002F554(&this->actor, globalCtx, getItemId); + if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, play)) { + func_8002F554(&this->actor, play, getItemId); } switch (*params) { @@ -706,8 +705,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { case ITEM00_SHIELD_HYLIAN: case ITEM00_TUNIC_ZORA: case ITEM00_TUNIC_GORON: - if (Actor_HasParent(&this->actor, globalCtx)) { - Flags_SetCollectible(globalCtx, this->collectibleFlag); + if (Actor_HasParent(&this->actor, play)) { + Flags_SetCollectible(play, this->collectibleFlag); Actor_Kill(&this->actor); } return; @@ -717,8 +716,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } else if (getItemId != GI_NONE) { - if (Actor_HasParent(&this->actor, globalCtx)) { - Flags_SetCollectible(globalCtx, this->collectibleFlag); + if (Actor_HasParent(&this->actor, play)) { + Flags_SetCollectible(play, this->collectibleFlag); Actor_Kill(&this->actor); } return; @@ -727,7 +726,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - Flags_SetCollectible(globalCtx, this->collectibleFlag); + Flags_SetCollectible(play, this->collectibleFlag); this->unk_15A = 15; this->unk_154 = 35; @@ -742,7 +741,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { EnItem00_SetupAction(this, func_8001E5C8); } -void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Draw(Actor* thisx, PlayState* play) { EnItem00* this = (EnItem00*)thisx; f32 mtxScale; @@ -753,28 +752,28 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { case ITEM00_RUPEE_RED: case ITEM00_RUPEE_ORANGE: case ITEM00_RUPEE_PURPLE: - EnItem00_DrawRupee(this, globalCtx); + EnItem00_DrawRupee(this, play); break; case ITEM00_HEART_PIECE: - EnItem00_DrawHeartPiece(this, globalCtx); + EnItem00_DrawHeartPiece(this, play); break; case ITEM00_HEART_CONTAINER: - EnItem00_DrawHeartContainer(this, globalCtx); + EnItem00_DrawHeartContainer(this, play); break; case ITEM00_HEART: if (this->unk_15A < 0) { if (this->unk_15A == -1) { - s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART); + s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART); - if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, bankIndex)) { this->actor.objBankIndex = bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); this->unk_15A = -2; } } else { mtxScale = 16.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); - GetItem_Draw(globalCtx, GID_HEART); + GetItem_Draw(play, GID_HEART); } break; } @@ -791,19 +790,19 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { case ITEM00_MAGIC_SMALL: case ITEM00_SEEDS: case ITEM00_SMALL_KEY: - EnItem00_DrawCollectible(this, globalCtx); + EnItem00_DrawCollectible(this, play); break; case ITEM00_SHIELD_DEKU: - GetItem_Draw(globalCtx, GID_SHIELD_DEKU); + GetItem_Draw(play, GID_SHIELD_DEKU); break; case ITEM00_SHIELD_HYLIAN: - GetItem_Draw(globalCtx, GID_SHIELD_HYLIAN); + GetItem_Draw(play, GID_SHIELD_HYLIAN); break; case ITEM00_TUNIC_ZORA: - GetItem_Draw(globalCtx, GID_TUNIC_ZORA); + GetItem_Draw(play, GID_TUNIC_ZORA); break; case ITEM00_TUNIC_GORON: - GetItem_Draw(globalCtx, GID_TUNIC_GORON); + GetItem_Draw(play, GID_TUNIC_GORON); break; case ITEM00_FLEXIBLE: break; @@ -814,14 +813,14 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { /** * Draw Function used for Rupee types of En_Item00. */ -void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_DrawRupee(EnItem00* this, PlayState* play) { s32 pad; s32 texIndex; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1546); + OPEN_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1546); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); if (this->actor.params <= ITEM00_RUPEE_RED) { texIndex = this->actor.params; @@ -829,25 +828,25 @@ void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) { texIndex = this->actor.params - 0x10; } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1562), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_item00.c", 1562), G_MTX_MODELVIEW | G_MTX_LOAD); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTex[texIndex])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1568); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1568); } /** * Draw Function used for most collectible types of En_Item00 (ammo, bombs, sticks, nuts, magic...). */ -void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_DrawCollectible(EnItem00* this, PlayState* play) { s32 texIndex = this->actor.params - 3; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1594); + OPEN_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1594); - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); if (this->actor.params == ITEM00_BOMBS_SPECIAL) { texIndex = 1; @@ -859,51 +858,51 @@ void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sItemDropTex[texIndex])); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1607), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_item00.c", 1607), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gItemDropDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1611); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1611); } /** * Draw Function used for the Heart Container type of En_Item00. */ -void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1623); + OPEN_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1623); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1634), + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_item00.c", 1634), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gHeartPieceExteriorDL); - func_80093D84(globalCtx->state.gfxCtx); - func_8002ED80(&this->actor, globalCtx, 0); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1644), + func_80093D84(play->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_item00.c", 1644), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gHeartContainerInteriorDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1647); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1647); } /** * Draw Function used for the Piece of Heart type of En_Item00. */ -void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1658); + OPEN_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1658); - func_80093D84(globalCtx->state.gfxCtx); - func_8002ED80(&this->actor, globalCtx, 0); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1670), + func_80093D84(play->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_item00.c", 1670), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gHeartPieceInteriorDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1673); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1673); } /** @@ -942,7 +941,7 @@ s16 func_8001F404(s16 dropId) { // External functions used by other actors to drop collectibles, which usually results in spawning an En_Item00 actor. -EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) { +EnItem00* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, s16 params) { s32 pad[2]; EnItem00* spawnedActor = NULL; s16 param4000 = params & 0x4000; @@ -953,18 +952,18 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) { // TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf) - spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, - spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED); - EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, - DEADSOUND_REPEAT_MODE_OFF, 40); + spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, + spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED); + EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, DEADSOUND_REPEAT_MODE_OFF, + 40); } else { if (!param8000) { params = func_8001F404(params & 0x00FF); } if (params != -1) { - spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, - spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param3F00); + spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, + spawnPos->z, 0, 0, 0, params | param8000 | param3F00); if ((spawnedActor != NULL) && !param8000) { spawnedActor->actor.velocity.y = !param4000 ? 8.0f : -2.0f; spawnedActor->actor.speedXZ = 2.0f; @@ -985,7 +984,7 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa return spawnedActor; } -EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) { +EnItem00* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s16 params) { EnItem00* spawnedActor = NULL; s32 pad; s16 param4000 = params & 0x4000; @@ -996,15 +995,15 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) { // TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf) - spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, - spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED); - EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, - DEADSOUND_REPEAT_MODE_OFF, 40); + spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, + spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED); + EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, DEADSOUND_REPEAT_MODE_OFF, + 40); } else { params = func_8001F404(params & 0x00FF); if (params != -1) { - spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, - spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param3F00); + spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, + spawnPos->z, 0, 0, 0, params | param8000 | param3F00); if ((spawnedActor != NULL) && !param8000) { spawnedActor->actor.velocity.y = 0.0f; spawnedActor->actor.speedXZ = 0.0f; @@ -1018,7 +1017,7 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p return spawnedActor; } -void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params) { +void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params) { s32 pad; EnItem00* spawnedActor; s16 dropQuantity; @@ -1065,9 +1064,9 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 if (dropId == ITEM00_FLEXIBLE) { if (gSaveContext.health <= 0x10) { // 1 heart or less - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, - 0, 0, FAIRY_HEAL_TIMED); - EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, + FAIRY_HEAL_TIMED); + EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, DEADSOUND_REPEAT_MODE_OFF, 40); return; } else if (gSaveContext.health <= 0x30) { // 3 hearts or less @@ -1113,7 +1112,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 if (!param8000) { dropId = func_8001F404(dropId); if (dropId != ITEM00_NONE) { - spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, + spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, dropId); if ((spawnedActor != NULL) && (dropId != ITEM00_NONE)) { spawnedActor->actor.velocity.y = 8.0f; @@ -1132,7 +1131,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 } } } else { - Item_DropCollectible(globalCtx, spawnPos, params | 0x8000); + Item_DropCollectible(play, spawnPos, params | 0x8000); } dropQuantity--; } diff --git a/src/code/z_face_reaction.c b/src/code/z_face_reaction.c index d463da4f7f..2dbd56df2f 100644 --- a/src/code/z_face_reaction.c +++ b/src/code/z_face_reaction.c @@ -63,8 +63,8 @@ u16 sReactionTextIds[][PLAYER_MASK_MAX] = { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x710C, 0x7105, 0x7107, 0x7107 }, }; -u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet) { - u8 currentMask = Player_GetMask(globalCtx); +u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) { + u8 currentMask = Player_GetMask(play); return sReactionTextIds[reactionSet][currentMask]; } diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index 23889413a9..20e8aa2599 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -44,7 +44,7 @@ void SkelCurve_Clear(SkelCurve* skelCurve) { * * @return bool always true */ -s32 SkelCurve_Init(GlobalContext* globalCtx, SkelCurve* skelCurve, CurveSkeletonHeader* skeletonHeaderSeg, +s32 SkelCurve_Init(PlayState* play, SkelCurve* skelCurve, CurveSkeletonHeader* skeletonHeaderSeg, CurveAnimationHeader* animation) { SkelCurveLimb** limbs; CurveSkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg); @@ -62,7 +62,7 @@ s32 SkelCurve_Init(GlobalContext* globalCtx, SkelCurve* skelCurve, CurveSkeleton /** * Frees the joint table. */ -void SkelCurve_Destroy(GlobalContext* globalCtx, SkelCurve* skelCurve) { +void SkelCurve_Destroy(PlayState* play, SkelCurve* skelCurve) { if (skelCurve->jointTable != NULL) { ZeldaArena_FreeDebug(skelCurve->jointTable, "../z_fcurve_data_skelanime.c", 146); } @@ -92,7 +92,7 @@ typedef enum { * * @return bool true when the animation has finished. */ -s32 SkelCurve_Update(GlobalContext* globalCtx, SkelCurve* skelCurve) { +s32 SkelCurve_Update(PlayState* play, SkelCurve* skelCurve) { s16* jointData; u8* knotCounts; CurveAnimationHeader* animation; @@ -156,16 +156,16 @@ s32 SkelCurve_Update(GlobalContext* globalCtx, SkelCurve* skelCurve) { /** * Recursively draws limbs with appropriate properties. */ -void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skelCurve, - OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data) { +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]); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 279); + OPEN_DISPS(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 279); Matrix_Push(); if ((overrideLimbDraw == NULL) || - ((overrideLimbDraw != NULL) && overrideLimbDraw(globalCtx, skelCurve, limbIndex, data))) { + ((overrideLimbDraw != NULL) && overrideLimbDraw(play, skelCurve, limbIndex, data))) { Vec3f scale; Vec3s rot; Vec3f pos; @@ -192,7 +192,7 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skel dList = limb->dList[0]; if (dList != NULL) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 321), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 321), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, dList); } @@ -201,13 +201,13 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skel dList = limb->dList[0]; if (dList != NULL) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 332), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 332), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, dList); } dList = limb->dList[1]; if (dList != NULL) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 338), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 338), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, dList); } @@ -218,25 +218,25 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skel } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, skelCurve, limbIndex, data); + postLimbDraw(play, skelCurve, limbIndex, data); } if (limb->child != LIMB_DONE) { - SkelCurve_DrawLimb(globalCtx, limb->child, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); + SkelCurve_DrawLimb(play, limb->child, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelCurve_DrawLimb(globalCtx, limb->sibling, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); + SkelCurve_DrawLimb(play, limb->sibling, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 371); + CLOSE_DISPS(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 371); } -void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelCurve* skelCurve, - OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data) { +void SkelCurve_Draw(Actor* actor, PlayState* play, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, + PostCurveLimbDraw postLimbDraw, s32 lod, void* data) { if (skelCurve->jointTable != NULL) { - SkelCurve_DrawLimb(globalCtx, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); + SkelCurve_DrawLimb(play, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); } } diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 6f66976193..278cb5620b 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -12,7 +12,7 @@ GameStateOverlay gGameStateOverlayTable[] = { GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)), GAMESTATE_OVERLAY(select, Select_Init, Select_Destroy, sizeof(SelectContext)), GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)), - GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Destroy, sizeof(GlobalContext)), + GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Destroy, sizeof(PlayState)), GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)), GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)), }; diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index e66b66e647..a0551a91e8 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -1,23 +1,23 @@ #include "global.h" -void GameOver_Init(GlobalContext* globalCtx) { - globalCtx->gameOverCtx.state = GAMEOVER_INACTIVE; +void GameOver_Init(PlayState* play) { + play->gameOverCtx.state = GAMEOVER_INACTIVE; } -void GameOver_FadeInLights(GlobalContext* globalCtx) { - GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; +void GameOver_FadeInLights(PlayState* play) { + GameOverContext* gameOverCtx = &play->gameOverCtx; if ((gameOverCtx->state >= GAMEOVER_DEATH_WAIT_GROUND && gameOverCtx->state < GAMEOVER_REVIVE_START) || (gameOverCtx->state >= GAMEOVER_REVIVE_RUMBLE && gameOverCtx->state < GAMEOVER_REVIVE_FADE_OUT)) { - Environment_FadeInGameOverLights(globalCtx); + Environment_FadeInGameOverLights(play); } } // This variable cannot be moved into this file as all of z_message_PAL rodata is in the way extern s16 gGameOverTimer; -void GameOver_Update(GlobalContext* globalCtx) { - GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; +void GameOver_Update(PlayState* play) { + GameOverContext* gameOverCtx = &play->gameOverCtx; s16 i; s16 j; s32 v90; @@ -26,7 +26,7 @@ void GameOver_Update(GlobalContext* globalCtx) { switch (gameOverCtx->state) { case GAMEOVER_DEATH_START: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); gSaveContext.timer1State = 0; gSaveContext.timer2State = 0; @@ -41,7 +41,7 @@ void GameOver_Update(GlobalContext* globalCtx) { for (j = 1; j < ARRAY_COUNT(gSaveContext.equips.buttonItems); j++) { if (gSaveContext.equips.buttonItems[j] == gSpoilingItems[i]) { gSaveContext.equips.buttonItems[j] = gSpoilingItemReverts[i]; - Interface_LoadItemIcon1(globalCtx, j); + Interface_LoadItemIcon1(play, j); } } } @@ -72,7 +72,7 @@ void GameOver_Update(GlobalContext* globalCtx) { gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED; gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0; - Environment_InitGameOverLights(globalCtx); + Environment_InitGameOverLights(play); gGameOverTimer = 20; if (1) {} v90 = VREG(90); @@ -92,7 +92,7 @@ void GameOver_Update(GlobalContext* globalCtx) { gGameOverTimer--; if (gGameOverTimer == 0) { - globalCtx->pauseCtx.state = 8; + play->pauseCtx.state = 8; gameOverCtx->state++; func_800AA15C(); } @@ -101,7 +101,7 @@ void GameOver_Update(GlobalContext* globalCtx) { case GAMEOVER_REVIVE_START: gameOverCtx->state++; gGameOverTimer = 0; - Environment_InitGameOverLights(globalCtx); + Environment_InitGameOverLights(play); ShrinkWindow_SetVal(0x20); return; @@ -137,7 +137,7 @@ void GameOver_Update(GlobalContext* globalCtx) { break; case GAMEOVER_REVIVE_FADE_OUT: - Environment_FadeOutGameOverLights(globalCtx); + Environment_FadeOutGameOverLights(play); gGameOverTimer--; if (gGameOverTimer == 0) { diff --git a/src/code/z_horse.c b/src/code/z_horse.c index d194448120..0cddd54b7e 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -15,7 +15,7 @@ s32 func_8006CFC0(s32 scene) { return 0; } -void func_8006D074(GlobalContext* globalCtx) { +void func_8006D074(PlayState* play) { gSaveContext.horseData.scene = SCENE_SPOT00; gSaveContext.horseData.pos.x = -1840; gSaveContext.horseData.pos.y = 72; @@ -23,7 +23,7 @@ void func_8006D074(GlobalContext* globalCtx) { gSaveContext.horseData.angle = -27353; } -void func_8006D0AC(GlobalContext* globalCtx) { +void func_8006D0AC(PlayState* play) { if (gSaveContext.horseData.scene == SCENE_SPOT06) { gSaveContext.horseData.scene = SCENE_SPOT06; gSaveContext.horseData.pos.x = -2065; @@ -40,7 +40,7 @@ typedef struct { /* 0x0A */ s16 type; } HorseSpawn; -void func_8006D0EC(GlobalContext* globalCtx, Player* player) { +void func_8006D0EC(PlayState* play, Player* player) { s32 i; HorseSpawn horseSpawns[] = { { SCENE_SPOT00, -460, 100, 6640, 0, 2 }, { SCENE_SPOT06, -1929, -1025, 768, 0, 2 }, @@ -49,41 +49,40 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { }; if ((AREG(6) != 0) && (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0))) { - player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, player->actor.world.pos.x, + player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z, player->actor.shape.rot.x, player->actor.shape.rot.y, player->actor.shape.rot.z, 9); ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 343); - Actor_MountHorse(globalCtx, player, player->rideActor); - func_8002DE74(globalCtx, player); - gSaveContext.horseData.scene = globalCtx->sceneNum; + Actor_MountHorse(play, player, player->rideActor); + func_8002DE74(play, player); + gSaveContext.horseData.scene = play->sceneNum; - if (globalCtx->sceneNum == SCENE_SPOT12) { + if (play->sceneNum == SCENE_SPOT12) { player->rideActor->room = -1; } - } else if ((globalCtx->sceneNum == SCENE_SPOT12) && (gSaveContext.minigameState == 3)) { + } else if ((play->sceneNum == SCENE_SPOT12) && (gSaveContext.minigameState == 3)) { Actor* horseActor; gSaveContext.minigameState = 0; - horseActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1); + horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1); horseActor->room = -1; } else if ((gSaveContext.entranceIndex == ENTR_SPOT20_7) && GET_EVENTCHKINF(EVENTCHKINF_18)) { Actor* horseActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1); ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 389); - } else if ((globalCtx->sceneNum == gSaveContext.horseData.scene) && + } else if ((play->sceneNum == gSaveContext.horseData.scene) && (Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1) != 0)) { // "Set by existence of horse %d %d %d" osSyncPrintf("馬存在によるセット %d %d %d\n", gSaveContext.horseData.scene, Flags_GetEventChkInf(EVENTCHKINF_18), DREG(1)); if (func_8006CFC0(gSaveContext.horseData.scene)) { - Actor* horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - gSaveContext.horseData.pos.x, gSaveContext.horseData.pos.y, - gSaveContext.horseData.pos.z, 0, gSaveContext.horseData.angle, 0, 1); + Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, gSaveContext.horseData.pos.x, + gSaveContext.horseData.pos.y, gSaveContext.horseData.pos.z, 0, + gSaveContext.horseData.angle, 0, 1); ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 414); - if (globalCtx->sceneNum == SCENE_SPOT12) { + if (play->sceneNum == SCENE_SPOT12) { horseActor->room = -1; } } else { @@ -91,21 +90,20 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { // "Horse_SetNormal():%d set spot is no good." osSyncPrintf("Horse_SetNormal():%d セットスポットまずいです。\n", gSaveContext.horseData.scene); osSyncPrintf(VT_RST); - func_8006D074(globalCtx); + func_8006D074(play); } - } else if ((globalCtx->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) { - Actor* horseActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1); + } else if ((play->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) { + Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1); ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 443); } else if (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0)) { for (i = 0; i < ARRAY_COUNT(horseSpawns); i++) { HorseSpawn* horseSpawn = &horseSpawns[i]; - if (horseSpawn->scene == globalCtx->sceneNum) { + if (horseSpawn->scene == play->sceneNum) { Actor* horseActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, horseSpawn->pos.x, horseSpawn->pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, horseSpawn->pos.x, horseSpawn->pos.y, horseSpawn->pos.z, 0, horseSpawn->angle, 0, horseSpawn->type); ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 466); - if (globalCtx->sceneNum == SCENE_SPOT12) { + if (play->sceneNum == SCENE_SPOT12) { horseActor->room = -1; } @@ -113,8 +111,8 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { } } } else if (!Flags_GetEventChkInf(EVENTCHKINF_18)) { - if ((DREG(1) == 0) && (globalCtx->sceneNum == SCENE_SOUKO) && !IS_DAY) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1); + if ((DREG(1) == 0) && (play->sceneNum == SCENE_SOUKO) && !IS_DAY) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1); } } } @@ -127,7 +125,7 @@ typedef struct { /* 0x10 */ s16 type; } struct_8011F9B8; -void func_8006D684(GlobalContext* globalCtx, Player* player) { +void func_8006D684(PlayState* play, Player* player) { s32 pad; s32 i; Vec3s spawnPos; @@ -152,24 +150,24 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { spawnPos = spawnPositions[3]; } - player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y, - spawnPos.z, 0, player->actor.world.rot.y, 0, 7); + player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y, spawnPos.z, 0, + player->actor.world.rot.y, 0, 7); ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 561); - Actor_MountHorse(globalCtx, player, player->rideActor); - func_8002DE74(globalCtx, player); - gSaveContext.horseData.scene = globalCtx->sceneNum; - } else if ((globalCtx->sceneNum == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) && + Actor_MountHorse(play, player, player->rideActor); + func_8002DE74(play, player); + gSaveContext.horseData.scene = play->sceneNum; + } else if ((play->sceneNum == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) && !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) { player->rideActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5); ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 582); - Actor_MountHorse(globalCtx, player, player->rideActor); - func_8002DE74(globalCtx, player); - gSaveContext.horseData.scene = globalCtx->sceneNum; + Actor_MountHorse(play, player, player->rideActor); + func_8002DE74(play, player); + gSaveContext.horseData.scene = play->sceneNum; - if (globalCtx->sceneNum == SCENE_SPOT12) { + if (play->sceneNum == SCENE_SPOT12) { player->rideActor->room = -1; } } else { @@ -181,22 +179,22 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { }; for (i = 0; i < ARRAY_COUNT(D_8011F9B8); i++) { - if ((globalCtx->sceneNum == D_8011F9B8[i].scene) && + if ((play->sceneNum == D_8011F9B8[i].scene) && (((void)0, gSaveContext.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) { if (D_8011F9B8[i].type == 7) { - if ((globalCtx->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) { + if ((play->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) { D_8011F9B8[i].pos.x = player->actor.world.pos.x; D_8011F9B8[i].pos.y = player->actor.world.pos.y; D_8011F9B8[i].pos.z = player->actor.world.pos.z; } - player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, - player->actor.world.rot.y, 0, D_8011F9B8[i].type); + player->rideActor = + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, + D_8011F9B8[i].pos.z, 0, player->actor.world.rot.y, 0, D_8011F9B8[i].type); ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 628); - Actor_MountHorse(globalCtx, player, player->rideActor); - func_8002DE74(globalCtx, player); + Actor_MountHorse(play, player, player->rideActor); + func_8002DE74(play, player); } else if ((D_8011F9B8[i].type == 5) || (D_8011F9B8[i].type == 6) || (D_8011F9B8[i].type == 8)) { Vec3f sp54; s32 temp = 0; @@ -205,9 +203,9 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { temp = 0x8000; } - player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, - D_8011F9B8[i].angle, 0, D_8011F9B8[i].type | temp); + player->rideActor = + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, + D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type | temp); ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 667); player->actor.world.pos.x = D_8011F9B8[i].pos.x; @@ -216,18 +214,17 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { player->actor.shape.rot.x = player->actor.shape.rot.z = 0; player->actor.shape.rot.y = D_8011F9B8[i].angle; - Actor_MountHorse(globalCtx, player, player->rideActor); - func_8002DE74(globalCtx, player); + Actor_MountHorse(play, player, player->rideActor); + func_8002DE74(play, player); sp54.x = player->actor.world.pos.x - 200.0f; sp54.y = player->actor.world.pos.y + 100.0f; sp54.z = player->actor.world.pos.z; - Play_CameraSetAtEye(globalCtx, globalCtx->activeCamId, &player->actor.world.pos, &sp54); + Play_CameraSetAtEye(play, play->activeCamId, &player->actor.world.pos, &sp54); } else { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, - D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, - D_8011F9B8[i].type); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, + D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type); } break; } @@ -235,26 +232,26 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { } } -void func_8006DC68(GlobalContext* globalCtx, Player* player) { +void func_8006DC68(PlayState* play, Player* player) { if (LINK_IS_ADULT) { if (!func_8006CFC0(gSaveContext.horseData.scene)) { osSyncPrintf(VT_COL(RED, WHITE)); // "Horse_Set_Check():%d set spot is no good." osSyncPrintf("Horse_Set_Check():%d セットスポットまずいです。\n", gSaveContext.horseData.scene); osSyncPrintf(VT_RST); - func_8006D074(globalCtx); + func_8006D074(play); } - if (func_8006CFC0(globalCtx->sceneNum)) { + if (func_8006CFC0(play->sceneNum)) { if ((gSaveContext.sceneSetupIndex > 3) || ((gSaveContext.entranceIndex == ENTR_SPOT00_11 || gSaveContext.entranceIndex == ENTR_SPOT00_12 || gSaveContext.entranceIndex == ENTR_SPOT00_13 || gSaveContext.entranceIndex == ENTR_SPOT00_15) && (gSaveContext.respawnFlag == 0)) || - ((globalCtx->sceneNum == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) && + ((play->sceneNum == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) && !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0))) { - func_8006D684(globalCtx, player); + func_8006D684(play, player); } else { - func_8006D0EC(globalCtx, player); + func_8006D0EC(play, player); } } } diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index acc0ccb364..1c988043d6 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -41,7 +41,7 @@ void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl) { } } -void KaleidoManager_Init(GlobalContext* globalCtx) { +void KaleidoManager_Init(PlayState* play) { s32 largestSize = 0; s32 size; u32 i; @@ -57,7 +57,7 @@ void KaleidoManager_Init(GlobalContext* globalCtx) { osSyncPrintf("KaleidoArea の最大サイズは %d バイトを確保します\n", largestSize); osSyncPrintf(VT_RST); - sKaleidoAreaPtr = GameState_Alloc(&globalCtx->state, largestSize, "../z_kaleido_manager.c", 150); + sKaleidoAreaPtr = GameState_Alloc(&play->state, largestSize, "../z_kaleido_manager.c", 150); LogUtils_CheckNullPointer("KaleidoArea_allocp", sKaleidoAreaPtr, "../z_kaleido_manager.c", 151); osSyncPrintf(VT_FGCOL(GREEN)); diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 13f7ab2054..cb2fcf3d89 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,14 +1,14 @@ #include "global.h" #include "vt.h" -void (*sKaleidoScopeUpdateFunc)(GlobalContext* globalCtx); -void (*sKaleidoScopeDrawFunc)(GlobalContext* globalCtx); +void (*sKaleidoScopeUpdateFunc)(PlayState* play); +void (*sKaleidoScopeDrawFunc)(PlayState* play); f32 gBossMarkScale; u32 D_8016139C; PauseMapMarksData* gLoadedPauseMarkDataTable; -extern void KaleidoScope_Update(GlobalContext* globalCtx); -extern void KaleidoScope_Draw(GlobalContext* globalCtx); +extern void KaleidoScope_Update(PlayState* play); +extern void KaleidoScope_Draw(PlayState* play); void KaleidoScopeCall_LoadPlayer(void) { KaleidoMgrOverlay* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR]; @@ -30,7 +30,7 @@ void KaleidoScopeCall_LoadPlayer(void) { } } -void KaleidoScopeCall_Init(GlobalContext* globalCtx) { +void KaleidoScopeCall_Init(PlayState* play) { // "Kaleidoscope replacement construction" osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n"); @@ -42,19 +42,19 @@ void KaleidoScopeCall_Init(GlobalContext* globalCtx) { LOG_ADDRESS("kaleido_scope_draw", KaleidoScope_Draw, "../z_kaleido_scope_call.c", 100); LOG_ADDRESS("kaleido_scope_draw_func", sKaleidoScopeDrawFunc, "../z_kaleido_scope_call.c", 101); - KaleidoSetup_Init(globalCtx); + KaleidoSetup_Init(play); } -void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) { +void KaleidoScopeCall_Destroy(PlayState* play) { // "Kaleidoscope replacement destruction" osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n"); - KaleidoSetup_Destroy(globalCtx); + KaleidoSetup_Destroy(play); } -void KaleidoScopeCall_Update(GlobalContext* globalCtx) { +void KaleidoScopeCall_Update(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + PauseContext* pauseCtx = &play->pauseCtx; if ((pauseCtx->state != 0) || (pauseCtx->debugState != 0)) { if (pauseCtx->state == 1) { @@ -99,9 +99,9 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) { } if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { - sKaleidoScopeUpdateFunc(globalCtx); + sKaleidoScopeUpdateFunc(play); - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { osSyncPrintf(VT_FGCOL(GREEN)); // "Kaleido area Kaleidoscope Emission" osSyncPrintf("カレイド領域 カレイドスコープ排出\n"); @@ -115,14 +115,14 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) { } } -void KaleidoScopeCall_Draw(GlobalContext* globalCtx) { +void KaleidoScopeCall_Draw(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; if (R_PAUSE_MENU_MODE >= 3) { - if (((globalCtx->pauseCtx.state >= 4) && (globalCtx->pauseCtx.state <= 7)) || - ((globalCtx->pauseCtx.state >= 11) && (globalCtx->pauseCtx.state <= 18))) { + if (((play->pauseCtx.state >= 4) && (play->pauseCtx.state <= 7)) || + ((play->pauseCtx.state >= 11) && (play->pauseCtx.state <= 18))) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { - sKaleidoScopeDrawFunc(globalCtx); + sKaleidoScopeDrawFunc(play); } } } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index cb05b520e7..bbc66d5bcd 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -8,15 +8,15 @@ s16 sKaleidoSetupKscpPos1[] = { PAUSE_MAP, PAUSE_QUEST, PAUSE_EQUIP, PAUSE_ITEM f32 sKaleidoSetupEyeX1[] = { -64.0f, 0.0f, 64.0f, 0.0f }; f32 sKaleidoSetupEyeZ1[] = { 0.0f, -64.0f, 0.0f, 64.0f }; -void KaleidoSetup_Update(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; +void KaleidoSetup_Update(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; - if (pauseCtx->state == 0 && pauseCtx->debugState == 0 && globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE && - globalCtx->transitionTrigger == TRANS_TRIGGER_OFF && globalCtx->transitionMode == TRANS_MODE_OFF && - gSaveContext.cutsceneIndex < 0xFFF0 && gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(globalCtx) && - globalCtx->shootingGalleryStatus <= 1 && gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 && - (globalCtx->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(globalCtx, 0x38))) { + if (pauseCtx->state == 0 && pauseCtx->debugState == 0 && play->gameOverCtx.state == GAMEOVER_INACTIVE && + play->transitionTrigger == TRANS_TRIGGER_OFF && play->transitionMode == TRANS_MODE_OFF && + gSaveContext.cutsceneIndex < 0xFFF0 && gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(play) && + play->shootingGalleryStatus <= 1 && gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 && + (play->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(play, 0x38))) { if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) { if (BREG(0)) { @@ -61,8 +61,8 @@ void KaleidoSetup_Update(GlobalContext* globalCtx) { } } -void KaleidoSetup_Init(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoSetup_Init(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; u64 temp = 0; // Necessary to match pauseCtx->state = 0; @@ -114,8 +114,8 @@ void KaleidoSetup_Init(GlobalContext* globalCtx) { pauseCtx->ocarinaSongIdx = -1; pauseCtx->cursorSpecialPos = 0; - View_Init(&pauseCtx->view, globalCtx->state.gfxCtx); + View_Init(&pauseCtx->view, play->state.gfxCtx); } -void KaleidoSetup_Destroy(GlobalContext* globalCtx) { +void KaleidoSetup_Destroy(PlayState* play) { } diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 3a4d426b1d..5715e84e58 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -239,15 +239,15 @@ u16 Environment_GetPixelDepth(s32 x, s32 y) { } void Environment_GraphCallback(GraphicsContext* gfxCtx, void* param) { - GlobalContext* globalCtx = (GlobalContext*)param; + PlayState* play = (PlayState*)param; sSunScreenDepth = Environment_GetPixelDepth(sSunDepthTestX, sSunDepthTestY); - Lights_GlowCheck(globalCtx); + Lights_GlowCheck(play); } -void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 unused) { +void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) { u8 i; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; gSaveContext.sunsSongState = SUNSSONG_INACTIVE; @@ -257,14 +257,14 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 ((void)0, gSaveContext.nightFlag = 0); } - globalCtx->state.gfxCtx->callback = Environment_GraphCallback; - globalCtx->state.gfxCtx->callbackParam = globalCtx; + play->state.gfxCtx->callback = Environment_GraphCallback; + play->state.gfxCtx->callbackParam = play; Lights_DirectionalSetInfo(&envCtx->dirLight1, 80, 80, 80, 80, 80, 80); - LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &envCtx->dirLight1); + LightContext_InsertLight(play, &play->lightCtx, &envCtx->dirLight1); Lights_DirectionalSetInfo(&envCtx->dirLight2, 80, 80, 80, 80, 80, 80); - LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &envCtx->dirLight2); + LightContext_InsertLight(play, &play->lightCtx, &envCtx->dirLight2); envCtx->skybox1Index = 99; envCtx->skybox2Index = 99; @@ -340,11 +340,11 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 gSaveContext.chamberCutsceneNum = CREG(3) - 1; } - globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; - globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR] = 0; - globalCtx->envCtx.precipitation[PRECIP_SNOW_CUR] = 0; - globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; - globalCtx->envCtx.precipitation[PRECIP_SOS_MAX] = 0; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; + play->envCtx.precipitation[PRECIP_RAIN_CUR] = 0; + play->envCtx.precipitation[PRECIP_SNOW_CUR] = 0; + play->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; + play->envCtx.precipitation[PRECIP_SOS_MAX] = 0; if (gSaveContext.retainWeatherMode) { if (((void)0, gSaveContext.sceneSetupIndex) < 4) { @@ -354,8 +354,8 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 envCtx->changeSkyboxNextConfig = 1; envCtx->lightConfig = 3; envCtx->changeLightNextConfig = 3; - globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; - globalCtx->envCtx.precipitation[PRECIP_SNOW_CUR] = 0; + play->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; + play->envCtx.precipitation[PRECIP_SNOW_CUR] = 0; break; case WEATHER_MODE_CLOUDY_CONFIG2: @@ -365,8 +365,8 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 envCtx->changeSkyboxNextConfig = 1; envCtx->lightConfig = 2; envCtx->changeLightNextConfig = 2; - globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; - globalCtx->envCtx.precipitation[PRECIP_SNOW_CUR] = 0; + play->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; + play->envCtx.precipitation[PRECIP_SNOW_CUR] = 0; break; case WEATHER_MODE_HEAVY_RAIN: @@ -374,24 +374,23 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 envCtx->changeSkyboxNextConfig = 1; envCtx->lightConfig = 4; envCtx->changeLightNextConfig = 4; - globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; - globalCtx->envCtx.precipitation[PRECIP_SNOW_CUR] = 0; + play->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; + play->envCtx.precipitation[PRECIP_SNOW_CUR] = 0; break; default: break; } - if (globalCtx->skyboxId == SKYBOX_NORMAL_SKY) { + if (play->skyboxId == SKYBOX_NORMAL_SKY) { if (gWeatherMode == WEATHER_MODE_SNOW) { - globalCtx->envCtx.precipitation[PRECIP_SNOW_CUR] = - globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX] = 64; + play->envCtx.precipitation[PRECIP_SNOW_CUR] = play->envCtx.precipitation[PRECIP_SNOW_MAX] = 64; } else if (gWeatherMode == WEATHER_MODE_RAIN) { - globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] = 20; - globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR] = 20; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 20; + play->envCtx.precipitation[PRECIP_RAIN_CUR] = 20; } else if (gWeatherMode == WEATHER_MODE_HEAVY_RAIN) { - globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] = 30; - globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR] = 30; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 30; + play->envCtx.precipitation[PRECIP_RAIN_CUR] = 30; } } } @@ -424,15 +423,15 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 sLightningBolts[i].state = LIGHTNING_BOLT_INACTIVE; } - globalCtx->roomCtx.unk_74[0] = 0; - globalCtx->roomCtx.unk_74[1] = 0; + play->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[1] = 0; - for (i = 0; i < ARRAY_COUNT(globalCtx->csCtx.npcActions); i++) { - globalCtx->csCtx.npcActions[i] = 0; + for (i = 0; i < ARRAY_COUNT(play->csCtx.npcActions); i++) { + play->csCtx.npcActions[i] = 0; } - if (Object_GetIndex(&globalCtx->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) < 0 && !globalCtx->envCtx.sunMoonDisabled) { - globalCtx->envCtx.sunMoonDisabled = true; + if (Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) < 0 && !play->envCtx.sunMoonDisabled) { + play->envCtx.sunMoonDisabled = true; // "Sun setting other than field keep! So forced release!" osSyncPrintf(VT_COL(YELLOW, BLACK) "\n\nフィールド常駐以外、太陽設定!よって強制解除!\n" VT_RST); } @@ -783,38 +782,38 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon } } -void Environment_EnableUnderwaterLights(GlobalContext* globalCtx, s32 waterLightsIndex) { +void Environment_EnableUnderwaterLights(PlayState* play, s32 waterLightsIndex) { if (waterLightsIndex == 0x1F) { waterLightsIndex = 0; // "Underwater color is not set in the water poly data!" osSyncPrintf(VT_COL(YELLOW, BLACK) "\n水ポリゴンデータに水中カラーが設定されておりません!" VT_RST); } - if (globalCtx->envCtx.lightMode == LIGHT_MODE_TIME) { - gLightConfigAfterUnderwater = globalCtx->envCtx.changeLightNextConfig; + if (play->envCtx.lightMode == LIGHT_MODE_TIME) { + gLightConfigAfterUnderwater = play->envCtx.changeLightNextConfig; - if (globalCtx->envCtx.lightConfig != waterLightsIndex) { - globalCtx->envCtx.lightConfig = waterLightsIndex; - globalCtx->envCtx.changeLightNextConfig = waterLightsIndex; + if (play->envCtx.lightConfig != waterLightsIndex) { + play->envCtx.lightConfig = waterLightsIndex; + play->envCtx.changeLightNextConfig = waterLightsIndex; } } else { - globalCtx->envCtx.lightBlendEnabled = false; // instantly switch to water lights - globalCtx->envCtx.lightSettingOverride = waterLightsIndex; + play->envCtx.lightBlendEnabled = false; // instantly switch to water lights + play->envCtx.lightSettingOverride = waterLightsIndex; } } -void Environment_DisableUnderwaterLights(GlobalContext* globalCtx) { - if (globalCtx->envCtx.lightMode == LIGHT_MODE_TIME) { - globalCtx->envCtx.lightConfig = gLightConfigAfterUnderwater; - globalCtx->envCtx.changeLightNextConfig = gLightConfigAfterUnderwater; +void Environment_DisableUnderwaterLights(PlayState* play) { + if (play->envCtx.lightMode == LIGHT_MODE_TIME) { + play->envCtx.lightConfig = gLightConfigAfterUnderwater; + play->envCtx.changeLightNextConfig = gLightConfigAfterUnderwater; } else { - globalCtx->envCtx.lightBlendEnabled = false; // instantly switch to previous lights - globalCtx->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlendEnabled = false; // instantly switch to previous lights + play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; + play->envCtx.lightBlend = 1.0f; } } -void Environment_PrintDebugInfo(GlobalContext* globalCtx, Gfx** gfx) { +void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) { GfxPrint printer; s32 pad[2]; @@ -869,18 +868,17 @@ void Environment_PrintDebugInfo(GlobalContext* globalCtx, Gfx** gfx) { GfxPrint_Destroy(&printer); } -void Environment_PlayTimeBasedSequence(GlobalContext* globalCtx); -void Environment_UpdateRain(GlobalContext* globalCtx); +void Environment_PlayTimeBasedSequence(PlayState* play); +void Environment_UpdateRain(PlayState* play); -void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightContext* lightCtx, - PauseContext* pauseCtx, MessageContext* msgCtx, GameOverContext* gameOverCtx, - GraphicsContext* gfxCtx) { +void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContext* lightCtx, PauseContext* pauseCtx, + MessageContext* msgCtx, GameOverContext* gameOverCtx, GraphicsContext* gfxCtx) { f32 sp8C; f32 sp88 = 0.0f; u16 i; u16 j; u16 time; - EnvLightSettings* lightSettingsList = globalCtx->envCtx.lightSettingsList; + EnvLightSettings* lightSettingsList = play->envCtx.lightSettingsList; s32 adjustment; if ((((void)0, gSaveContext.gameMode) != 0) && (((void)0, gSaveContext.gameMode) != 3)) { @@ -888,16 +886,16 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li } if (pauseCtx->state == 0) { - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) { - if (globalCtx->skyboxId == SKYBOX_NORMAL_SKY) { - globalCtx->skyboxCtx.rot.y -= 0.001f; - } else if (globalCtx->skyboxId == SKYBOX_CUTSCENE_MAP) { - globalCtx->skyboxCtx.rot.y -= 0.005f; + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if (play->skyboxId == SKYBOX_NORMAL_SKY) { + play->skyboxCtx.rot.y -= 0.001f; + } else if (play->skyboxId == SKYBOX_CUTSCENE_MAP) { + play->skyboxCtx.rot.y -= 0.005f; } } - Environment_UpdateRain(globalCtx); - Environment_PlayTimeBasedSequence(globalCtx); + Environment_UpdateRain(play); + Environment_PlayTimeBasedSequence(play); if (((void)0, gSaveContext.nextDayTime) >= 0xFF00 && ((void)0, gSaveContext.nextDayTime) != NEXT_TIME_NONE) { gSaveContext.nextDayTime -= 0x10; @@ -921,8 +919,8 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li if ((pauseCtx->state == 0) && (gameOverCtx->state == GAMEOVER_INACTIVE)) { if (((msgCtx->msgLength == 0) && (msgCtx->msgMode == 0)) || (((void)0, gSaveContext.gameMode) == 3)) { - if ((envCtx->changeSkyboxTimer == 0) && !FrameAdvance_IsEnabled(globalCtx) && - (globalCtx->transitionMode == TRANS_MODE_OFF || ((void)0, gSaveContext.gameMode) != 0)) { + if ((envCtx->changeSkyboxTimer == 0) && !FrameAdvance_IsEnabled(play) && + (play->transitionMode == TRANS_MODE_OFF || ((void)0, gSaveContext.gameMode) != 0)) { if (IS_DAY || gTimeSpeed >= 400) { gSaveContext.dayTime += gTimeSpeed; @@ -953,17 +951,17 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li Gfx* displayList; Gfx* prevDisplayList; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 1682); + OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1682); prevDisplayList = POLY_OPA_DISP; displayList = Graph_GfxPlusOne(POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, displayList); - Environment_PrintDebugInfo(globalCtx, &displayList); + Environment_PrintDebugInfo(play, &displayList); gSPEndDisplayList(displayList++); Graph_BranchDlist(prevDisplayList, displayList); POLY_OPA_DISP = displayList; if (1) {} - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 1690); + CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1690); } if ((envCtx->lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE) && @@ -1361,38 +1359,37 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li } } -void Environment_DrawSunAndMoon(GlobalContext* globalCtx) { +void Environment_DrawSunAndMoon(PlayState* play) { f32 alpha; f32 color; f32 y; f32 scale; f32 temp; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 2266); + OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 2266); - if (globalCtx->csCtx.state != 0) { - Math_SmoothStepToF(&globalCtx->envCtx.sunPos.x, + if (play->csCtx.state != 0) { + Math_SmoothStepToF(&play->envCtx.sunPos.x, -(Math_SinS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f, 1.0f, 0.8f, 0.8f); - Math_SmoothStepToF(&globalCtx->envCtx.sunPos.y, + Math_SmoothStepToF(&play->envCtx.sunPos.y, (Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f, 1.0f, 0.8f, 0.8f); //! @bug This should be z. - Math_SmoothStepToF(&globalCtx->envCtx.sunPos.y, + Math_SmoothStepToF(&play->envCtx.sunPos.y, (Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f, 1.0f, 0.8f, 0.8f); } else { - globalCtx->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; - globalCtx->envCtx.sunPos.y = +(Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; - globalCtx->envCtx.sunPos.z = +(Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; + play->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; + play->envCtx.sunPos.y = +(Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; + play->envCtx.sunPos.z = +(Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; } if (gSaveContext.entranceIndex != ENTR_SPOT00_0 || ((void)0, gSaveContext.sceneSetupIndex) != 5) { - Matrix_Translate(globalCtx->view.eye.x + globalCtx->envCtx.sunPos.x, - globalCtx->view.eye.y + globalCtx->envCtx.sunPos.y, - globalCtx->view.eye.z + globalCtx->envCtx.sunPos.z, MTXMODE_NEW); + Matrix_Translate(play->view.eye.x + play->envCtx.sunPos.x, play->view.eye.y + play->envCtx.sunPos.y, + play->view.eye.z + play->envCtx.sunPos.z, MTXMODE_NEW); - y = globalCtx->envCtx.sunPos.y / 25.0f; + y = play->envCtx.sunPos.y / 25.0f; temp = y / 80.0f; alpha = temp * 255.0f; @@ -1419,13 +1416,12 @@ void Environment_DrawSunAndMoon(GlobalContext* globalCtx) { scale = (color * 2.0f) + 10.0f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_kankyo.c", 2364), G_MTX_LOAD); - func_80093AD0(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_kankyo.c", 2364), G_MTX_LOAD); + func_80093AD0(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gSunDL); - Matrix_Translate(globalCtx->view.eye.x - globalCtx->envCtx.sunPos.x, - globalCtx->view.eye.y - globalCtx->envCtx.sunPos.y, - globalCtx->view.eye.z - globalCtx->envCtx.sunPos.z, MTXMODE_NEW); + Matrix_Translate(play->view.eye.x - play->envCtx.sunPos.x, play->view.eye.y - play->envCtx.sunPos.y, + play->view.eye.z - play->envCtx.sunPos.z, MTXMODE_NEW); color = -y / 120.0f; color = CLAMP_MIN(color, 0.0f); @@ -1439,8 +1435,8 @@ void Environment_DrawSunAndMoon(GlobalContext* globalCtx) { alpha = temp * 255.0f; if (alpha > 0.0f) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_kankyo.c", 2406), G_MTX_LOAD); - func_8009398C(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_kankyo.c", 2406), G_MTX_LOAD); + func_8009398C(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 240, 255, 180, alpha); gDPSetEnvColor(POLY_OPA_DISP++, 80, 70, 20, alpha); @@ -1448,15 +1444,14 @@ void Environment_DrawSunAndMoon(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 2429); + CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 2429); } -void Environment_DrawSunLensFlare(GlobalContext* globalCtx, EnvironmentContext* envCtx, View* view, - GraphicsContext* gfxCtx, Vec3f pos, s32 unused) { - if ((globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR] == 0) && (globalCtx->envCtx.skyboxConfig == 0)) { - Environment_DrawLensFlare(globalCtx, &globalCtx->envCtx, &globalCtx->view, globalCtx->state.gfxCtx, pos, 2000, - 370, Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f, 400, - true); +void Environment_DrawSunLensFlare(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, + Vec3f pos, s32 unused) { + if ((play->envCtx.precipitation[PRECIP_RAIN_CUR] == 0) && (play->envCtx.skyboxConfig == 0)) { + Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, pos, 2000, 370, + Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f, 400, true); } } @@ -1468,9 +1463,8 @@ typedef enum { /* 2 */ LENS_FLARE_RING } LensFlareType; -void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* envCtx, View* view, - GraphicsContext* gfxCtx, Vec3f pos, s32 unused, s16 scale, f32 colorIntensity, - s16 glareStrength, u8 isSun) { +void Environment_DrawLensFlare(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, + Vec3f pos, s32 unused, s16 scale, f32 colorIntensity, s16 glareStrength, u8 isSun) { s16 i; f32 tempX; f32 tempY; @@ -1565,7 +1559,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env // don't draw lens flare } else { if (isSun) { - Play_GetScreenPos(globalCtx, &pos, &screenPos); + Play_GetScreenPos(play, &pos, &screenPos); sSunDepthTestX = (s16)screenPos.x; sSunDepthTestY = (s16)screenPos.y - 5.0f; if (sSunScreenDepth != GPACK_ZDZ(G_MAXFBZ, 0) || screenPos.x < 0.0f || screenPos.y < 0.0f || @@ -1578,7 +1572,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW); if (isSun) { - temp = Environment_LerpWeight(60, 15, globalCtx->view.fovy); + temp = Environment_LerpWeight(60, 15, play->view.fovy); } Matrix_Translate(-posDirX * i * dist, -posDirY * i * dist, -posDirZ * i * dist, MTXMODE_APPLY); @@ -1597,7 +1591,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env alpha = alpha * lensFlareAlphas[i]; alpha = CLAMP_MIN(alpha, 0.0f); - fogInfluence = (996 - globalCtx->lightCtx.fogNear) / 50.0f; + fogInfluence = (996 - play->lightCtx.fogNear) / 50.0f; fogInfluence = CLAMP_MAX(fogInfluence, 1.0f); @@ -1644,7 +1638,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env alpha = alpha * glareStrength; alpha = CLAMP_MIN(alpha, 0.0f); - fogInfluence = (996 - globalCtx->lightCtx.fogNear) / 50.0f; + fogInfluence = (996 - play->lightCtx.fogNear) / 50.0f; fogInfluence = CLAMP_MAX(fogInfluence, 1.0f); @@ -1678,7 +1672,7 @@ f32 Environment_RandCentered(void) { return Rand_ZeroOne() - 0.5f; } -void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* gfxCtx) { +void Environment_DrawRain(PlayState* play, View* view, GraphicsContext* gfxCtx) { s16 i; s32 pad; Vec3f vec; @@ -1695,9 +1689,9 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* f32 z280; Vec3f unused = { 0.0f, 0.0f, 0.0f }; Vec3f windDirection = { 0.0f, 0.0f, 0.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (!(globalCtx->cameraPtrs[0]->unk_14C & 0x100) && (globalCtx->envCtx.precipitation[PRECIP_SNOW_CUR] == 0)) { + if (!(play->cameraPtrs[0]->unk_14C & 0x100) && (play->envCtx.precipitation[PRECIP_SNOW_CUR] == 0)) { OPEN_DISPS(gfxCtx, "../z_kankyo.c", 2799); vec.x = view->at.x - view->eye.x; @@ -1717,14 +1711,14 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* x280 = view->eye.x + temp1 * 280.0f; z280 = view->eye.z + temp3 * 280.0f; - if (globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR]) { + if (play->envCtx.precipitation[PRECIP_RAIN_CUR]) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 150, 255, 255, 30); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20); } // draw rain drops - for (i = 0; i < globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR]; i++) { + for (i = 0; i < play->envCtx.precipitation[PRECIP_RAIN_CUR]; i++) { temp2 = Rand_ZeroOne(); temp1 = Rand_ZeroOne(); temp3 = Rand_ZeroOne(); @@ -1732,9 +1726,9 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* Matrix_Translate((temp2 - 0.7f) * 100.0f + x50, (temp1 - 0.7f) * 100.0f + y50, (temp3 - 0.7f) * 100.0f + z50, MTXMODE_NEW); - windDirection.x = globalCtx->envCtx.windDirection.x; - windDirection.y = globalCtx->envCtx.windDirection.y; - windDirection.z = globalCtx->envCtx.windDirection.z; + windDirection.x = play->envCtx.windDirection.x; + windDirection.y = play->envCtx.windDirection.y; + windDirection.z = play->envCtx.windDirection.z; vec.x = windDirection.x; vec.y = windDirection.y + 500.0f + Rand_ZeroOne() * 200.0f; @@ -1756,7 +1750,7 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* if (player->actor.world.pos.y < view->eye.y) { u8 materialFlag = false; - for (i = 0; i < globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR]; i++) { + for (i = 0; i < play->envCtx.precipitation[PRECIP_RAIN_CUR]; i++) { if (!materialFlag) { func_80093D84(gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0); @@ -1784,16 +1778,16 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* } } -void Environment_ChangeLightSetting(GlobalContext* globalCtx, u32 lightSetting) { - if ((globalCtx->envCtx.lightSetting != lightSetting) && (globalCtx->envCtx.lightBlend >= 1.0f) && - (globalCtx->envCtx.lightSettingOverride == LIGHT_SETTING_OVERRIDE_NONE)) { +void Environment_ChangeLightSetting(PlayState* play, u32 lightSetting) { + if ((play->envCtx.lightSetting != lightSetting) && (play->envCtx.lightBlend >= 1.0f) && + (play->envCtx.lightSettingOverride == LIGHT_SETTING_OVERRIDE_NONE)) { if (lightSetting >= LIGHT_SETTING_MAX) { lightSetting = 0; } - globalCtx->envCtx.lightBlend = 0.0f; - globalCtx->envCtx.prevLightSetting = globalCtx->envCtx.lightSetting; - globalCtx->envCtx.lightSetting = lightSetting; + play->envCtx.lightBlend = 0.0f; + play->envCtx.prevLightSetting = play->envCtx.lightSetting; + play->envCtx.lightSetting = lightSetting; } } @@ -1809,18 +1803,17 @@ void Environment_ChangeLightSetting(GlobalContext* globalCtx, u32 lightSetting) * * An example usage of a filter is to dim the skybox in cloudy conditions. */ -void Environment_DrawSkyboxFilters(GlobalContext* globalCtx) { - if (((globalCtx->skyboxId != SKYBOX_NONE) && (globalCtx->lightCtx.fogNear < 980)) || - (globalCtx->skyboxId == SKYBOX_UNSET_1D)) { +void Environment_DrawSkyboxFilters(PlayState* play) { + if (((play->skyboxId != SKYBOX_NONE) && (play->lightCtx.fogNear < 980)) || (play->skyboxId == SKYBOX_UNSET_1D)) { f32 alpha; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 3032); + OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 3032); - func_800938B4(globalCtx->state.gfxCtx); + func_800938B4(play->state.gfxCtx); - alpha = (1000 - globalCtx->lightCtx.fogNear) * 0.02f; + alpha = (1000 - play->lightCtx.fogNear) * 0.02f; - if (globalCtx->skyboxId == SKYBOX_UNSET_1D) { + if (play->skyboxId == SKYBOX_UNSET_1D) { alpha = 1.0f; } @@ -1828,38 +1821,37 @@ void Environment_DrawSkyboxFilters(GlobalContext* globalCtx) { alpha = 1.0f; } - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, globalCtx->lightCtx.fogColor[0], globalCtx->lightCtx.fogColor[1], - globalCtx->lightCtx.fogColor[2], 255.0f * alpha); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, play->lightCtx.fogColor[0], play->lightCtx.fogColor[1], + play->lightCtx.fogColor[2], 255.0f * alpha); gDPFillRectangle(POLY_OPA_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 3043); + CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 3043); } - if (globalCtx->envCtx.customSkyboxFilter) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 3048); + if (play->envCtx.customSkyboxFilter) { + OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 3048); - func_800938B4(globalCtx->state.gfxCtx); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, globalCtx->envCtx.skyboxFilterColor[0], - globalCtx->envCtx.skyboxFilterColor[1], globalCtx->envCtx.skyboxFilterColor[2], - globalCtx->envCtx.skyboxFilterColor[3]); + func_800938B4(play->state.gfxCtx); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, play->envCtx.skyboxFilterColor[0], play->envCtx.skyboxFilterColor[1], + play->envCtx.skyboxFilterColor[2], play->envCtx.skyboxFilterColor[3]); gDPFillRectangle(POLY_OPA_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 3056); + CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 3056); } } -void Environment_DrawLightningFlash(GlobalContext* globalCtx, u8 red, u8 green, u8 blue, u8 alpha) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 3069); +void Environment_DrawLightningFlash(PlayState* play, u8 red, u8 green, u8 blue, u8 alpha) { + OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 3069); - func_800938B4(globalCtx->state.gfxCtx); + func_800938B4(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, red, green, blue, alpha); gDPFillRectangle(POLY_OPA_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 3079); + CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 3079); } -void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { - if (globalCtx->envCtx.lightningState != LIGHTNING_OFF) { +void Environment_UpdateLightningStrike(PlayState* play) { + if (play->envCtx.lightningState != LIGHTNING_OFF) { switch (gLightningStrike.state) { case LIGHTNING_STRIKE_WAIT: // every frame theres a 10% chance of the timer advancing 50 units @@ -1876,7 +1868,7 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { gLightningStrike.flashAlphaTarget = 200; gLightningStrike.delayTimer = 0.0f; - Environment_AddLightningBolts(globalCtx, + Environment_AddLightningBolts(play, (u8)(Rand_ZeroOne() * (ARRAY_COUNT(sLightningBolts) - 0.1f)) + 1); sLightningFlashAlpha = 0; gLightningStrike.state++; @@ -1887,9 +1879,9 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { gLightningStrike.flashGreen = 200; gLightningStrike.flashBlue = 255; - globalCtx->envCtx.adjAmbientColor[0] += 80; - globalCtx->envCtx.adjAmbientColor[1] += 80; - globalCtx->envCtx.adjAmbientColor[2] += 100; + play->envCtx.adjAmbientColor[0] += 80; + play->envCtx.adjAmbientColor[1] += 80; + play->envCtx.adjAmbientColor[2] += 100; sLightningFlashAlpha += 100; @@ -1900,26 +1892,26 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { } break; case LIGHTNING_STRIKE_END: - if (globalCtx->envCtx.adjAmbientColor[0] > 0) { - globalCtx->envCtx.adjAmbientColor[0] -= 10; - globalCtx->envCtx.adjAmbientColor[1] -= 10; + if (play->envCtx.adjAmbientColor[0] > 0) { + play->envCtx.adjAmbientColor[0] -= 10; + play->envCtx.adjAmbientColor[1] -= 10; } - if (globalCtx->envCtx.adjAmbientColor[2] > 0) { - globalCtx->envCtx.adjAmbientColor[2] -= 10; + if (play->envCtx.adjAmbientColor[2] > 0) { + play->envCtx.adjAmbientColor[2] -= 10; } sLightningFlashAlpha -= 10; if (sLightningFlashAlpha <= gLightningStrike.flashAlphaTarget) { - globalCtx->envCtx.adjAmbientColor[0] = 0; - globalCtx->envCtx.adjAmbientColor[1] = 0; - globalCtx->envCtx.adjAmbientColor[2] = 0; + play->envCtx.adjAmbientColor[0] = 0; + play->envCtx.adjAmbientColor[1] = 0; + play->envCtx.adjAmbientColor[2] = 0; gLightningStrike.state = LIGHTNING_STRIKE_WAIT; - if (globalCtx->envCtx.lightningState == LIGHTNING_LAST) { - globalCtx->envCtx.lightningState = LIGHTNING_OFF; + if (play->envCtx.lightningState == LIGHTNING_LAST) { + play->envCtx.lightningState = LIGHTNING_OFF; } } break; @@ -1927,7 +1919,7 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { } if (gLightningStrike.state != LIGHTNING_STRIKE_WAIT) { - Environment_DrawLightningFlash(globalCtx, gLightningStrike.flashRed, gLightningStrike.flashGreen, + Environment_DrawLightningFlash(play, gLightningStrike.flashRed, gLightningStrike.flashGreen, gLightningStrike.flashBlue, sLightningFlashAlpha); } } @@ -1936,7 +1928,7 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { * Request the number of lightning bolts specified by `num` * Note: only 3 lightning bolts can be active at the same time. */ -void Environment_AddLightningBolts(GlobalContext* globalCtx, u8 num) { +void Environment_AddLightningBolts(PlayState* play, u8 num) { s16 boltsAdded = 0; s16 i; @@ -1955,7 +1947,7 @@ void Environment_AddLightningBolts(GlobalContext* globalCtx, u8 num) { /** * Draw any active lightning bolt entries contained in `sLightningBolts` */ -void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { +void Environment_DrawLightning(PlayState* play, s32 unused) { static void* lightningTextures[] = { gEffLightning1Tex, gEffLightning2Tex, gEffLightning3Tex, gEffLightning4Tex, gEffLightning5Tex, gEffLightning6Tex, @@ -1970,20 +1962,20 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { Vec3f unused1 = { 0.0f, 0.0f, 0.0f }; Vec3f unused2 = { 0.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 3253); + OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 3253); for (i = 0; i < ARRAY_COUNT(sLightningBolts); i++) { switch (sLightningBolts[i].state) { case LIGHTNING_BOLT_START: - dx = globalCtx->view.at.x - globalCtx->view.eye.x; - dz = globalCtx->view.at.z - globalCtx->view.eye.z; + dx = play->view.at.x - play->view.eye.x; + dz = play->view.at.z - play->view.eye.z; x = dx / sqrtf(SQ(dx) + SQ(dz)); z = dz / sqrtf(SQ(dx) + SQ(dz)); - sLightningBolts[i].pos.x = globalCtx->view.eye.x + x * 9500.0f; + sLightningBolts[i].pos.x = play->view.eye.x + x * 9500.0f; sLightningBolts[i].pos.y = Rand_ZeroOne() * 1000.0f + 4000.0f; - sLightningBolts[i].pos.z = globalCtx->view.eye.z + z * 9500.0f; + sLightningBolts[i].pos.z = play->view.eye.z + z * 9500.0f; sLightningBolts[i].offset.x = (Rand_ZeroOne() - 0.5f) * 5000.0f; sLightningBolts[i].offset.y = 0.0f; @@ -2020,20 +2012,20 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { Matrix_Scale(22.0f, 100.0f, 22.0f, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 128); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, 128); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_kankyo.c", 3333), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_kankyo.c", 3333), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(lightningTextures[sLightningBolts[i].textureIndex])); - func_80094C50(globalCtx->state.gfxCtx); + func_80094C50(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &D_01000000, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffLightningDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 3353); + CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 3353); } -void Environment_PlaySceneSequence(GlobalContext* globalCtx) { - globalCtx->envCtx.timeSeqState = TIMESEQ_DISABLED; +void Environment_PlaySceneSequence(PlayState* play) { + play->envCtx.timeSeqState = TIMESEQ_DISABLED; // both lost woods exits on the bridge from kokiri to hyrule field if (((void)0, gSaveContext.entranceIndex) == ENTR_SPOT10_8 || @@ -2044,111 +2036,108 @@ void Environment_PlaySceneSequence(GlobalContext* globalCtx) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | (s32)((void)0, gSaveContext.forcedSeqId)); } gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; - } else if (globalCtx->sequenceCtx.seqId == NA_BGM_NO_MUSIC) { - if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { + } else if (play->sequenceCtx.seqId == NA_BGM_NO_MUSIC) { + if (play->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { return; } - if (((void)0, gSaveContext.natureAmbienceId) != globalCtx->sequenceCtx.natureAmbienceId) { - Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); + if (((void)0, gSaveContext.natureAmbienceId) != play->sequenceCtx.natureAmbienceId) { + Audio_PlayNatureAmbienceSequence(play->sequenceCtx.natureAmbienceId); } - } else if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { + } else if (play->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { // "BGM Configuration" - osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", globalCtx->sequenceCtx.seqId, + osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", play->sequenceCtx.seqId, ((void)0, gSaveContext.seqId)); - if (((void)0, gSaveContext.seqId) != globalCtx->sequenceCtx.seqId) { - func_800F5550(globalCtx->sequenceCtx.seqId); + if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) { + func_800F5550(play->sequenceCtx.seqId); } } else if (((void)0, gSaveContext.dayTime) >= CLOCK_TIME(7, 0) && ((void)0, gSaveContext.dayTime) <= CLOCK_TIME(17, 10)) { - if (((void)0, gSaveContext.seqId) != globalCtx->sequenceCtx.seqId) { - func_800F5550(globalCtx->sequenceCtx.seqId); + if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) { + func_800F5550(play->sequenceCtx.seqId); } - globalCtx->envCtx.timeSeqState = TIMESEQ_FADE_DAY_BGM; + play->envCtx.timeSeqState = TIMESEQ_FADE_DAY_BGM; } else { - if (((void)0, gSaveContext.natureAmbienceId) != globalCtx->sequenceCtx.natureAmbienceId) { - Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); + if (((void)0, gSaveContext.natureAmbienceId) != play->sequenceCtx.natureAmbienceId) { + Audio_PlayNatureAmbienceSequence(play->sequenceCtx.natureAmbienceId); } if (((void)0, gSaveContext.dayTime) > CLOCK_TIME(17, 10) && ((void)0, gSaveContext.dayTime) <= CLOCK_TIME(19, 0)) { - globalCtx->envCtx.timeSeqState = TIMESEQ_EARLY_NIGHT_CRITTERS; + play->envCtx.timeSeqState = TIMESEQ_EARLY_NIGHT_CRITTERS; } else if (((void)0, gSaveContext.dayTime) > CLOCK_TIME(19, 0) + 1 || ((void)0, gSaveContext.dayTime) < CLOCK_TIME(6, 30)) { - globalCtx->envCtx.timeSeqState = TIMESEQ_NIGHT_CRITTERS; + play->envCtx.timeSeqState = TIMESEQ_NIGHT_CRITTERS; } else { - globalCtx->envCtx.timeSeqState = TIMESEQ_MORNING_CRITTERS; + play->envCtx.timeSeqState = TIMESEQ_MORNING_CRITTERS; } } osSyncPrintf("\n-----------------\n", ((void)0, gSaveContext.forcedSeqId)); osSyncPrintf("\n 強制BGM=[%d]", ((void)0, gSaveContext.forcedSeqId)); // "Forced BGM" - osSyncPrintf("\n BGM=[%d]", globalCtx->sequenceCtx.seqId); - osSyncPrintf("\n エンブ=[%d]", globalCtx->sequenceCtx.natureAmbienceId); - osSyncPrintf("\n status=[%d]", globalCtx->envCtx.timeSeqState); + osSyncPrintf("\n BGM=[%d]", play->sequenceCtx.seqId); + osSyncPrintf("\n エンブ=[%d]", play->sequenceCtx.natureAmbienceId); + osSyncPrintf("\n status=[%d]", play->envCtx.timeSeqState); - Audio_SetEnvReverb(globalCtx->roomCtx.curRoom.echo); + Audio_SetEnvReverb(play->roomCtx.curRoom.echo); } -void Environment_PlayTimeBasedSequence(GlobalContext* globalCtx) { - switch (globalCtx->envCtx.timeSeqState) { +void Environment_PlayTimeBasedSequence(PlayState* play) { + switch (play->envCtx.timeSeqState) { case TIMESEQ_DAY_BGM: Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_1, 0); - if (globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && - globalCtx->envCtx.precipitation[PRECIP_SOS_MAX] == 0) { + if (play->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) { osSyncPrintf("\n\n\nNa_StartMorinigBgm\n\n"); - func_800F5510(globalCtx->sequenceCtx.seqId); + func_800F5510(play->sequenceCtx.seqId); } - globalCtx->envCtx.timeSeqState++; + play->envCtx.timeSeqState++; break; case TIMESEQ_FADE_DAY_BGM: if (gSaveContext.dayTime > CLOCK_TIME(17, 10)) { - if (globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && - globalCtx->envCtx.precipitation[PRECIP_SOS_MAX] == 0) { + if (play->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && + play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xF000FF); } - globalCtx->envCtx.timeSeqState++; + play->envCtx.timeSeqState++; } break; case TIMESEQ_NIGHT_BEGIN_SFX: if (gSaveContext.dayTime > CLOCK_TIME(18, 0)) { func_800788CC(NA_SE_EV_DOG_CRY_EVENING); - globalCtx->envCtx.timeSeqState++; + play->envCtx.timeSeqState++; } break; case TIMESEQ_EARLY_NIGHT_CRITTERS: - if (globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && - globalCtx->envCtx.precipitation[PRECIP_SOS_MAX] == 0) { - Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); + if (play->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) { + Audio_PlayNatureAmbienceSequence(play->sequenceCtx.natureAmbienceId); Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_1, 1); } - globalCtx->envCtx.timeSeqState++; + play->envCtx.timeSeqState++; break; case TIMESEQ_NIGHT_DELAY: if (gSaveContext.dayTime > CLOCK_TIME(19, 0)) { - globalCtx->envCtx.timeSeqState++; + play->envCtx.timeSeqState++; } break; case TIMESEQ_NIGHT_CRITTERS: Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_1, 0); - if (globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && - globalCtx->envCtx.precipitation[PRECIP_SOS_MAX] == 0) { + if (play->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_1, 1); } - globalCtx->envCtx.timeSeqState++; + play->envCtx.timeSeqState++; break; case TIMESEQ_DAY_BEGIN_SFX: @@ -2158,13 +2147,13 @@ void Environment_PlayTimeBasedSequence(GlobalContext* globalCtx) { gSaveContext.dogIsLost = true; func_80078884(NA_SE_EV_CHICKEN_CRY_M); - if ((Inventory_ReplaceItem(globalCtx, ITEM_WEIRD_EGG, ITEM_CHICKEN) || - Inventory_ReplaceItem(globalCtx, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO)) && - globalCtx->csCtx.state == 0 && !Player_InCsMode(globalCtx)) { - Message_StartTextbox(globalCtx, 0x3066, NULL); + if ((Inventory_ReplaceItem(play, ITEM_WEIRD_EGG, ITEM_CHICKEN) || + Inventory_ReplaceItem(play, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO)) && + play->csCtx.state == 0 && !Player_InCsMode(play)) { + Message_StartTextbox(play, 0x3066, NULL); } - globalCtx->envCtx.timeSeqState++; + play->envCtx.timeSeqState++; } break; @@ -2172,24 +2161,23 @@ void Environment_PlayTimeBasedSequence(GlobalContext* globalCtx) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_1, 0); - if (globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && - globalCtx->envCtx.precipitation[PRECIP_SOS_MAX] == 0) { + if (play->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_1, 1); } - globalCtx->envCtx.timeSeqState++; + play->envCtx.timeSeqState++; break; case TIMESEQ_DAY_DELAY: if (gSaveContext.dayTime > CLOCK_TIME(7, 0)) { - globalCtx->envCtx.timeSeqState = 0; + play->envCtx.timeSeqState = 0; } break; } } -void Environment_DrawCustomLensFlare(GlobalContext* globalCtx) { +void Environment_DrawCustomLensFlare(PlayState* play) { Vec3f pos; if (gCustomLensFlareOn) { @@ -2197,31 +2185,30 @@ void Environment_DrawCustomLensFlare(GlobalContext* globalCtx) { pos.y = gCustomLensFlarePos.y; pos.z = gCustomLensFlarePos.z; - Environment_DrawLensFlare(globalCtx, &globalCtx->envCtx, &globalCtx->view, globalCtx->state.gfxCtx, pos, - gLensFlareUnused, gLensFlareScale, gLensFlareColorIntensity, gLensFlareGlareStrength, - false); + Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, pos, gLensFlareUnused, + gLensFlareScale, gLensFlareColorIntensity, gLensFlareGlareStrength, false); } } -void Environment_InitGameOverLights(GlobalContext* globalCtx) { +void Environment_InitGameOverLights(PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); sGameOverLightsIntensity = 0; Lights_PointNoGlowSetInfo(&sNGameOverLightInfo, (s16)player->actor.world.pos.x - 10.0f, (s16)player->actor.world.pos.y + 10.0f, (s16)player->actor.world.pos.z - 10.0f, 0, 0, 0, 255); - sNGameOverLightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &sNGameOverLightInfo); + sNGameOverLightNode = LightContext_InsertLight(play, &play->lightCtx, &sNGameOverLightInfo); Lights_PointNoGlowSetInfo(&sSGameOverLightInfo, (s16)player->actor.world.pos.x + 10.0f, (s16)player->actor.world.pos.y + 10.0f, (s16)player->actor.world.pos.z + 10.0f, 0, 0, 0, 255); - sSGameOverLightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &sSGameOverLightInfo); + sSGameOverLightNode = LightContext_InsertLight(play, &play->lightCtx, &sSGameOverLightInfo); } -void Environment_FadeInGameOverLights(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Environment_FadeInGameOverLights(PlayState* play) { + Player* player = GET_PLAYER(play); s16 i; Lights_PointNoGlowSetInfo(&sNGameOverLightInfo, (s16)player->actor.world.pos.x - 10.0f, @@ -2235,33 +2222,33 @@ void Environment_FadeInGameOverLights(GlobalContext* globalCtx) { sGameOverLightsIntensity += 2; } - if (func_800C0CB8(globalCtx)) { + if (func_800C0CB8(play)) { for (i = 0; i < 3; i++) { - if (globalCtx->envCtx.adjAmbientColor[i] > -255) { - globalCtx->envCtx.adjAmbientColor[i] -= 12; - globalCtx->envCtx.adjLight1Color[i] -= 12; + if (play->envCtx.adjAmbientColor[i] > -255) { + play->envCtx.adjAmbientColor[i] -= 12; + play->envCtx.adjLight1Color[i] -= 12; } - globalCtx->envCtx.adjFogColor[i] = -255; + play->envCtx.adjFogColor[i] = -255; } - if (globalCtx->envCtx.lightSettings.fogFar + globalCtx->envCtx.adjFogFar > 900) { - globalCtx->envCtx.adjFogFar -= 100; + if (play->envCtx.lightSettings.fogFar + play->envCtx.adjFogFar > 900) { + play->envCtx.adjFogFar -= 100; } - if (globalCtx->envCtx.lightSettings.fogNear + globalCtx->envCtx.adjFogNear > 950) { - globalCtx->envCtx.adjFogNear -= 10; + if (play->envCtx.lightSettings.fogNear + play->envCtx.adjFogNear > 950) { + play->envCtx.adjFogNear -= 10; } } else { - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 0; - globalCtx->envCtx.screenFillColor[3] = sGameOverLightsIntensity; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[3] = sGameOverLightsIntensity; } } -void Environment_FadeOutGameOverLights(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Environment_FadeOutGameOverLights(PlayState* play) { + Player* player = GET_PLAYER(play); s16 i; if (sGameOverLightsIntensity >= 3) { @@ -2271,8 +2258,8 @@ void Environment_FadeOutGameOverLights(GlobalContext* globalCtx) { } if (sGameOverLightsIntensity == 1) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, sNGameOverLightNode); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, sSGameOverLightNode); + LightContext_RemoveLight(play, &play->lightCtx, sNGameOverLightNode); + LightContext_RemoveLight(play, &play->lightCtx, sSGameOverLightNode); } else if (sGameOverLightsIntensity >= 2) { Lights_PointNoGlowSetInfo(&sNGameOverLightInfo, (s16)player->actor.world.pos.x - 10.0f, (s16)player->actor.world.pos.y + 10.0f, (s16)player->actor.world.pos.z - 10.0f, @@ -2282,34 +2269,34 @@ void Environment_FadeOutGameOverLights(GlobalContext* globalCtx) { sGameOverLightsIntensity, sGameOverLightsIntensity, sGameOverLightsIntensity, 255); } - if (func_800C0CB8(globalCtx)) { + if (func_800C0CB8(play)) { for (i = 0; i < 3; i++) { - Math_SmoothStepToS(&globalCtx->envCtx.adjAmbientColor[i], 0, 5, 12, 1); - Math_SmoothStepToS(&globalCtx->envCtx.adjLight1Color[i], 0, 5, 12, 1); - globalCtx->envCtx.adjFogColor[i] = 0; + Math_SmoothStepToS(&play->envCtx.adjAmbientColor[i], 0, 5, 12, 1); + Math_SmoothStepToS(&play->envCtx.adjLight1Color[i], 0, 5, 12, 1); + play->envCtx.adjFogColor[i] = 0; } - globalCtx->envCtx.adjFogFar = 0; - globalCtx->envCtx.adjFogNear = 0; + play->envCtx.adjFogFar = 0; + play->envCtx.adjFogNear = 0; } else { - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[2] = 0; - globalCtx->envCtx.screenFillColor[3] = sGameOverLightsIntensity; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[3] = sGameOverLightsIntensity; if (sGameOverLightsIntensity == 0) { - globalCtx->envCtx.fillScreen = false; + play->envCtx.fillScreen = false; } } } -void Environment_UpdateRain(GlobalContext* globalCtx) { - u8 max = MAX(globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX], globalCtx->envCtx.precipitation[PRECIP_SOS_MAX]); +void Environment_UpdateRain(PlayState* play) { + u8 max = MAX(play->envCtx.precipitation[PRECIP_RAIN_MAX], play->envCtx.precipitation[PRECIP_SOS_MAX]); - if (globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR] != max && ((globalCtx->state.frames % 8) == 0)) { - if (globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR] < max) { - globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR] += 2; + if (play->envCtx.precipitation[PRECIP_RAIN_CUR] != max && ((play->state.frames % 8) == 0)) { + if (play->envCtx.precipitation[PRECIP_RAIN_CUR] < max) { + play->envCtx.precipitation[PRECIP_RAIN_CUR] += 2; } else { - globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR] -= 2; + play->envCtx.precipitation[PRECIP_RAIN_CUR] -= 2; } } } @@ -2357,11 +2344,11 @@ Color_RGB8 sSandstormEnvColors[] = { { 50, 40, 0 }, }; -void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) { +void Environment_DrawSandstorm(PlayState* play, u8 sandstormState) { s32 primA1; s32 envA1; - s32 primA = globalCtx->envCtx.sandstormPrimA; - s32 envA = globalCtx->envCtx.sandstormEnvA; + s32 primA = play->envCtx.sandstormPrimA; + s32 envA = play->envCtx.sandstormEnvA; Color_RGBA8 primColor; Color_RGBA8 envColor; s32 pad; @@ -2372,11 +2359,11 @@ void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) { switch (sandstormState) { case SANDSTORM_ACTIVE: - if ((globalCtx->sceneNum == SCENE_SPOT13) && (globalCtx->roomCtx.curRoom.num == 0)) { + if ((play->sceneNum == SCENE_SPOT13) && (play->roomCtx.curRoom.num == 0)) { envA1 = 0; - primA1 = (globalCtx->envCtx.sandstormEnvA > 128) ? 255 : globalCtx->envCtx.sandstormEnvA >> 1; + primA1 = (play->envCtx.sandstormEnvA > 128) ? 255 : play->envCtx.sandstormEnvA >> 1; } else { - primA1 = globalCtx->state.frames % 128; + primA1 = play->state.frames % 128; if (primA1 > 64) { primA1 = 128 - primA1; } @@ -2387,31 +2374,31 @@ void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) { case SANDSTORM_FILL: primA1 = 255; - envA1 = (globalCtx->envCtx.sandstormPrimA >= 255) ? 255 : 128; + envA1 = (play->envCtx.sandstormPrimA >= 255) ? 255 : 128; break; case SANDSTORM_UNFILL: envA1 = 128; - if (globalCtx->envCtx.sandstormEnvA > 128) { + if (play->envCtx.sandstormEnvA > 128) { primA1 = 255; } else { - primA1 = globalCtx->state.frames % 128; + primA1 = play->state.frames % 128; if (primA1 > 64) { primA1 = 128 - primA1; } primA1 += 73; } if ((primA1 >= primA) && (primA1 != 255)) { - globalCtx->envCtx.sandstormState = SANDSTORM_ACTIVE; + play->envCtx.sandstormState = SANDSTORM_ACTIVE; } break; case SANDSTORM_DISSIPATE: envA1 = 0; - primA1 = (globalCtx->envCtx.sandstormEnvA > 128) ? 255 : globalCtx->envCtx.sandstormEnvA >> 1; + primA1 = (play->envCtx.sandstormEnvA > 128) ? 255 : play->envCtx.sandstormEnvA >> 1; if (primA == 0) { - globalCtx->envCtx.sandstormState = SANDSTORM_OFF; + play->envCtx.sandstormState = SANDSTORM_OFF; } break; } @@ -2432,8 +2419,8 @@ void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) { envA = envA + 9; } - globalCtx->envCtx.sandstormPrimA = primA; - globalCtx->envCtx.sandstormEnvA = envA; + play->envCtx.sandstormPrimA = primA; + play->envCtx.sandstormEnvA = envA; sp98 = (512.0f - (primA + envA)) * (3.0f / 128.0f); @@ -2441,8 +2428,8 @@ void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) { sp98 = 6.0f; } - if ((globalCtx->envCtx.lightMode != LIGHT_MODE_TIME) || - (globalCtx->envCtx.lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE)) { + if ((play->envCtx.lightMode != LIGHT_MODE_TIME) || + (play->envCtx.lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE)) { primColor.r = sSandstormPrimColors[1].r; primColor.g = sSandstormPrimColors[1].g; primColor.b = sSandstormPrimColors[1].b; @@ -2479,30 +2466,30 @@ void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) { sp94 = (s32)(sSandstormScroll * (9.0f / 6.0f)); sp92 = (s32)(sSandstormScroll * (6.0f / 6.0f)); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 4044); + OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 4044); POLY_XLU_DISP = func_80093F34(POLY_XLU_DISP); gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColor.r, primColor.g, primColor.b, globalCtx->envCtx.sandstormPrimA); - gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, globalCtx->envCtx.sandstormEnvA); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColor.r, primColor.g, primColor.b, play->envCtx.sandstormPrimA); + gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, play->envCtx.sandstormEnvA); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (u32)sp96 % 0x1000, 0, 0x200, 0x20, 1, (u32)sp94 % 0x1000, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (u32)sp96 % 0x1000, 0, 0x200, 0x20, 1, (u32)sp94 % 0x1000, 0xFFF - ((u32)sp92 % 0x1000), 0x100, 0x40)); gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE); gSPDisplayList(POLY_XLU_DISP++, gFieldSandstormDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 4068); + CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 4068); sSandstormScroll += (s32)sp98; } -void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { +void Environment_AdjustLights(PlayState* play, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { f32 temp; s32 i; - if (globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5 && func_800C0CB8(globalCtx)) { + if (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5 && func_800C0CB8(play)) { arg1 = CLAMP_MIN(arg1, 0.0f); arg1 = CLAMP_MAX(arg1, 1.0f); @@ -2512,18 +2499,18 @@ void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 temp = 0.0f; } - globalCtx->envCtx.adjFogNear = (arg2 - globalCtx->envCtx.lightSettings.fogNear) * temp; + play->envCtx.adjFogNear = (arg2 - play->envCtx.lightSettings.fogNear) * temp; if (arg1 == 0.0f) { for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjFogColor[i] = 0; + play->envCtx.adjFogColor[i] = 0; } } else { temp = arg1 * 5.0f; temp = CLAMP_MAX(temp, 1.0f); for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjFogColor[i] = -(s16)(globalCtx->envCtx.lightSettings.fogColor[i] * temp); + play->envCtx.adjFogColor[i] = -(s16)(play->envCtx.lightSettings.fogColor[i] * temp); } } @@ -2534,8 +2521,8 @@ void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 arg1 *= arg4; for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjAmbientColor[i] = -(s16)(globalCtx->envCtx.lightSettings.ambientColor[i] * arg1); - globalCtx->envCtx.adjLight1Color[i] = -(s16)(globalCtx->envCtx.lightSettings.light1Color[i] * arg1); + play->envCtx.adjAmbientColor[i] = -(s16)(play->envCtx.lightSettings.ambientColor[i] * arg1); + play->envCtx.adjLight1Color[i] = -(s16)(play->envCtx.lightSettings.light1Color[i] * arg1); } } } @@ -2566,37 +2553,37 @@ s32 Environment_IsForcedSequenceDisabled(void) { return isDisabled; } -void Environment_PlayStormNatureAmbience(GlobalContext* globalCtx) { - if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { +void Environment_PlayStormNatureAmbience(PlayState* play) { + if (play->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { Audio_PlayNatureAmbienceSequence(NATURE_ID_MARKET_NIGHT); } else { - Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); + Audio_PlayNatureAmbienceSequence(play->sequenceCtx.natureAmbienceId); } Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 1); Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 1); } -void Environment_StopStormNatureAmbience(GlobalContext* globalCtx) { +void Environment_StopStormNatureAmbience(PlayState* play) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0); Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 0); if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) { gSaveContext.seqId = NA_BGM_NATURE_SFX_RAIN; - Environment_PlaySceneSequence(globalCtx); + Environment_PlaySceneSequence(play); } } -void Environment_WarpSongLeave(GlobalContext* globalCtx) { +void Environment_WarpSongLeave(PlayState* play) { gWeatherMode = WEATHER_MODE_CLEAR; gSaveContext.cutsceneIndex = 0; gSaveContext.respawnFlag = -3; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; - switch (globalCtx->nextEntranceIndex) { + switch (play->nextEntranceIndex) { case ENTR_SPOT17_0: Flags_SetEventChkInf(EVENTCHKINF_B9); break; diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index df2d552a99..f4ba1ffb49 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -111,8 +111,8 @@ s16 sBeatingHeartsDDEnv[3]; s16 sHeartsDDPrim[2][3]; s16 sHeartsDDEnv[2][3]; -void Health_InitMeter(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Health_InitMeter(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; interfaceCtx->unk_228 = 0x140; interfaceCtx->unk_226 = gSaveContext.health; @@ -144,8 +144,8 @@ void Health_InitMeter(GlobalContext* globalCtx) { sHeartsDDEnv[0][2] = sHeartsDDEnv[1][2] = HEARTS_DD_ENV_B; } -void Health_UpdateMeter(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Health_UpdateMeter(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; f32 factor = interfaceCtx->heartColorOscillator * 0.1f; f32 ddFactor; s32 type = 0; @@ -241,14 +241,14 @@ void Health_UpdateMeter(GlobalContext* globalCtx) { } // Unused -s32 func_80078E18(GlobalContext* globalCtx) { - gSaveContext.health = globalCtx->interfaceCtx.unk_226; +s32 func_80078E18(PlayState* play) { + gSaveContext.health = play->interfaceCtx.unk_226; return 1; } // Unused -s32 func_80078E34(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +s32 func_80078E34(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; interfaceCtx->unk_228 = 0x140; interfaceCtx->unk_226 += 0x10; @@ -262,8 +262,8 @@ s32 func_80078E34(GlobalContext* globalCtx) { } // Unused -s32 func_80078E84(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +s32 func_80078E84(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (interfaceCtx->unk_228 != 0) { interfaceCtx->unk_228--; @@ -272,7 +272,7 @@ s32 func_80078E84(GlobalContext* globalCtx) { interfaceCtx->unk_226 -= 0x10; if (interfaceCtx->unk_226 <= 0) { interfaceCtx->unk_226 = 0; - globalCtx->damagePlayer(globalCtx, -(gSaveContext.health + 1)); + play->damagePlayer(play, -(gSaveContext.health + 1)); return 1; } } @@ -295,7 +295,7 @@ static void* sHeartDDTextures[] = { gDefenseHeartThreeQuarterTex, }; -void Health_DrawMeter(GlobalContext* globalCtx) { +void Health_DrawMeter(PlayState* play) { s32 pad[5]; void* heartBgImg; u32 curColorSet; @@ -306,8 +306,8 @@ void Health_DrawMeter(GlobalContext* globalCtx) { f32 heartCenterX; f32 heartCenterY; f32 heartTexCoordPerPixel; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; Vtx* beatingHeartVtx = interfaceCtx->beatingHeartVtx; s32 curHeartFraction = gSaveContext.health % 0x10; s16 totalHeartCount = gSaveContext.healthCapacity / 0x10; @@ -498,16 +498,16 @@ void Health_DrawMeter(GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_lifemeter.c", 606); } -void Health_UpdateBeatingHeart(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Health_UpdateBeatingHeart(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (interfaceCtx->beatingHeartOscillatorDirection != 0) { interfaceCtx->beatingHeartOscillator--; if (interfaceCtx->beatingHeartOscillator <= 0) { interfaceCtx->beatingHeartOscillator = 0; interfaceCtx->beatingHeartOscillatorDirection = 0; - if (!Player_InCsMode(globalCtx) && (globalCtx->pauseCtx.state == 0) && - (globalCtx->pauseCtx.debugState == 0) && Health_IsCritical() && !Play_InCsMode(globalCtx)) { + if (!Player_InCsMode(play) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && + Health_IsCritical() && !Play_InCsMode(play)) { func_80078884(NA_SE_SY_HITPOINT_ALARM); } } diff --git a/src/code/z_lights.c b/src/code/z_lights.c index e4f690b530..18967a89de 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -195,8 +195,8 @@ s32 Lights_FreeNode(LightNode* light) { } } -void LightContext_Init(GlobalContext* globalCtx, LightContext* lightCtx) { - LightContext_InitList(globalCtx, lightCtx); +void LightContext_Init(PlayState* play, LightContext* lightCtx) { + LightContext_InitList(play, lightCtx); LightContext_SetAmbientColor(lightCtx, 80, 80, 80); LightContext_SetFog(lightCtx, 0, 0, 0, 996, 12800); bzero(&sLightsBuffer, sizeof(sLightsBuffer)); @@ -223,13 +223,13 @@ Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx) return Lights_New(gfxCtx, lightCtx->ambientColor[0], lightCtx->ambientColor[1], lightCtx->ambientColor[2]); } -void LightContext_InitList(GlobalContext* globalCtx, LightContext* lightCtx) { +void LightContext_InitList(PlayState* play, LightContext* lightCtx) { lightCtx->listHead = NULL; } -void LightContext_DestroyList(GlobalContext* globalCtx, LightContext* lightCtx) { +void LightContext_DestroyList(PlayState* play, LightContext* lightCtx) { while (lightCtx->listHead != NULL) { - LightContext_RemoveLight(globalCtx, lightCtx, lightCtx->listHead); + LightContext_RemoveLight(play, lightCtx, lightCtx->listHead); lightCtx->listHead = lightCtx->listHead->next; } } @@ -240,7 +240,7 @@ void LightContext_DestroyList(GlobalContext* globalCtx, LightContext* lightCtx) * Note: Due to the limited number of slots in a Lights group, inserting too many lights in the * list may result in older entries not being bound to a Light when calling Lights_BindAll */ -LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* lightCtx, LightInfo* info) { +LightNode* LightContext_InsertLight(PlayState* play, LightContext* lightCtx, LightInfo* info) { LightNode* node; node = Lights_FindBufSlot(); @@ -260,7 +260,7 @@ LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* ligh return node; } -void LightContext_RemoveLight(GlobalContext* globalCtx, LightContext* lightCtx, LightNode* node) { +void LightContext_RemoveLight(PlayState* play, LightContext* lightCtx, LightNode* node) { if (node != NULL) { if (node->prev != NULL) { node->prev->next = node->next; @@ -316,7 +316,7 @@ Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambient return lights; } -void Lights_GlowCheck(GlobalContext* globalCtx) { +void Lights_GlowCheck(PlayState* play) { LightNode* node; LightPoint* params; Vec3f pos; @@ -327,7 +327,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) { s32 wZ; s32 zBuf; - node = globalCtx->lightCtx.listHead; + node = play->lightCtx.listHead; while (node != NULL) { params = &node->info->params.point; @@ -336,7 +336,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) { pos.x = params->x; pos.y = params->y; pos.z = params->z; - Actor_ProjectPos(globalCtx, &pos, &multDest, &cappedInvWDest); + Actor_ProjectPos(play, &pos, &multDest, &cappedInvWDest); params->drawGlow = false; wX = multDest.x * cappedInvWDest; wY = multDest.y * cappedInvWDest; @@ -356,13 +356,13 @@ void Lights_GlowCheck(GlobalContext* globalCtx) { } } -void Lights_DrawGlow(GlobalContext* globalCtx) { +void Lights_DrawGlow(PlayState* play) { s32 pad; LightNode* node; - node = globalCtx->lightCtx.listHead; + node = play->lightCtx.listHead; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_lights.c", 887); + OPEN_DISPS(play->state.gfxCtx, "../z_lights.c", 887); POLY_XLU_DISP = func_800947AC(POLY_XLU_DISP++); gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); @@ -384,7 +384,7 @@ void Lights_DrawGlow(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, params->color[0], params->color[1], params->color[2], 50); Matrix_Translate(params->x, params->y, params->z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_lights.c", 918), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_lights.c", 918), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGlowCircleDL); } @@ -392,5 +392,5 @@ void Lights_DrawGlow(GlobalContext* globalCtx) { node = node->next; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_lights.c", 927); + CLOSE_DISPS(play->state.gfxCtx, "../z_lights.c", 927); } diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 144f830ecc..670623c1a3 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -10,17 +10,17 @@ s16 sPlayerInitialPosZ = 0; s16 sPlayerInitialDirection = 0; s16 sEntranceIconMapIndex = 0; -void Map_SavePlayerInitialInfo(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Map_SavePlayerInitialInfo(PlayState* play) { + Player* player = GET_PLAYER(play); sPlayerInitialPosX = player->actor.world.pos.x; sPlayerInitialPosZ = player->actor.world.pos.z; sPlayerInitialDirection = (s16)((0x7FFF - player->actor.shape.rot.y) / 0x400); } -void Map_SetPaletteData(GlobalContext* globalCtx, s16 room) { +void Map_SetPaletteData(PlayState* play, s16 room) { s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 paletteIndex = gMapData->roomPalette[mapIndex][room]; if (interfaceCtx->mapRoomNum == room) { @@ -37,9 +37,9 @@ void Map_SetPaletteData(GlobalContext* globalCtx, s16 room) { interfaceCtx->mapPalette[paletteIndex * 2 + 1] = 0xBF; } -void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) { +void Map_SetFloorPalettesData(PlayState* play, s16 floor) { s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 room; s16 i; @@ -53,7 +53,7 @@ void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) { interfaceCtx->mapPalette[31] = 1; } - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -75,19 +75,19 @@ void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) { for (i = 0; i < gMapData->maxPaletteCount[mapIndex]; i++) { room = gMapData->paletteRoom[mapIndex][floor][i]; if ((room != 0xFF) && (gSaveContext.sceneFlags[mapIndex].rooms & gBitFlags[room])) { - Map_SetPaletteData(globalCtx, room); + Map_SetPaletteData(play, room); } } break; } } -void Map_InitData(GlobalContext* globalCtx, s16 room) { +void Map_InitData(PlayState* play, s16 room) { s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 extendedMapIndex; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT00: case SCENE_SPOT01: case SCENE_SPOT02: @@ -109,19 +109,19 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) { case SCENE_SPOT20: case SCENE_GANON_TOU: extendedMapIndex = mapIndex; - if (globalCtx->sceneNum == SCENE_SPOT02) { + if (play->sceneNum == SCENE_SPOT02) { if (CHECK_QUEST_ITEM(QUEST_SONG_NOCTURNE)) { extendedMapIndex = 0x14; } - } else if (globalCtx->sceneNum == SCENE_SPOT06) { + } else if (play->sceneNum == SCENE_SPOT06) { if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !CHECK_QUEST_ITEM(QUEST_MEDALLION_WATER)) { extendedMapIndex = 0x15; } - } else if (globalCtx->sceneNum == SCENE_SPOT09) { + } else if (play->sceneNum == SCENE_SPOT09) { if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { extendedMapIndex = 0x16; } - } else if (globalCtx->sceneNum == SCENE_SPOT12) { + } else if (play->sceneNum == SCENE_SPOT12) { if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { extendedMapIndex = 0x17; } @@ -158,27 +158,27 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) { osSyncPrintf("デクの樹ダンジョンMAP テクスチャDMA(%x) scene_id_offset=%d VREG(30)=%d\n", room, mapIndex, VREG(30)); osSyncPrintf(VT_RST); - DmaMgr_SendRequest1(globalCtx->interfaceCtx.mapSegment, + DmaMgr_SendRequest1(play->interfaceCtx.mapSegment, (u32)_map_i_staticSegmentRomStart + ((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * 0xFF0), 0xFF0, "../z_map_exp.c", 346); R_COMPASS_OFFSET_X = gMapData->roomCompassOffsetX[mapIndex][room]; R_COMPASS_OFFSET_Y = gMapData->roomCompassOffsetY[mapIndex][room]; - Map_SetFloorPalettesData(globalCtx, VREG(30)); + Map_SetFloorPalettesData(play, VREG(30)); osSyncPrintf("MAP 各階ONチェック\n"); // "MAP Individual Floor ON Check" break; } } -void Map_InitRoomData(GlobalContext* globalCtx, s16 room) { +void Map_InitRoomData(PlayState* play, s16 room) { s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; osSyncPrintf("*******\n*******\nroom_no=%d (%d)(%d)\n*******\n*******\n", room, - mapIndex, globalCtx->sceneNum); + mapIndex, play->sceneNum); if (room >= 0) { - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -201,11 +201,11 @@ void Map_InitRoomData(GlobalContext* globalCtx, s16 room) { osSyncPrintf("ROOM_INF=%d\n", gSaveContext.sceneFlags[mapIndex].rooms); interfaceCtx->mapRoomNum = room; interfaceCtx->unk_25A = mapIndex; - Map_SetPaletteData(globalCtx, room); + Map_SetPaletteData(play, room); osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("部屋部屋=%d\n", room); // "Room Room = %d" osSyncPrintf(VT_RST); - Map_InitData(globalCtx, room); + Map_InitData(play, room); break; } } else { @@ -217,27 +217,27 @@ void Map_InitRoomData(GlobalContext* globalCtx, s16 room) { } } -void Map_Destroy(GlobalContext* globalCtx) { - MapMark_ClearPointers(globalCtx); +void Map_Destroy(PlayState* play) { + MapMark_ClearPointers(play); gMapData = NULL; } -void Map_Init(GlobalContext* globalCtx) { +void Map_Init(PlayState* play) { s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; gMapData = &gMapDataTable; interfaceCtx->unk_258 = -1; interfaceCtx->unk_25A = -1; - interfaceCtx->mapSegment = GameState_Alloc(&globalCtx->state, 0x1000, "../z_map_exp.c", 457); + interfaceCtx->mapSegment = GameState_Alloc(&play->state, 0x1000, "../z_map_exp.c", 457); // "MAP texture initialization scene_data_ID=%d mapSegment=%x" - osSyncPrintf("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", globalCtx->sceneNum, - interfaceCtx->mapSegment, globalCtx); + osSyncPrintf("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", play->sceneNum, + interfaceCtx->mapSegment, play); ASSERT(interfaceCtx->mapSegment != NULL, "parameter->mapSegment != NULL", "../z_map_exp.c", 459); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT00: case SCENE_SPOT01: case SCENE_SPOT02: @@ -258,13 +258,13 @@ void Map_Init(GlobalContext* globalCtx) { case SCENE_SPOT18: case SCENE_SPOT20: case SCENE_GANON_TOU: - mapIndex = globalCtx->sceneNum - SCENE_SPOT00; + mapIndex = play->sceneNum - SCENE_SPOT00; R_MAP_INDEX = gSaveContext.mapIndex = mapIndex; R_COMPASS_SCALE_X = gMapData->owCompassInfo[mapIndex][0]; R_COMPASS_SCALE_Y = gMapData->owCompassInfo[mapIndex][1]; R_COMPASS_OFFSET_X = gMapData->owCompassInfo[mapIndex][2]; R_COMPASS_OFFSET_Y = gMapData->owCompassInfo[mapIndex][3]; - Map_InitData(globalCtx, mapIndex); + Map_InitData(play, mapIndex); R_OW_MINIMAP_X = gMapData->owMinimapPosX[mapIndex]; R_OW_MINIMAP_Y = gMapData->owMinimapPosY[mapIndex]; break; @@ -293,31 +293,30 @@ void Map_Init(GlobalContext* globalCtx) { case SCENE_MIZUSIN_BS: case SCENE_JYASINBOSS: case SCENE_HAKADAN_BS: - mapIndex = - (globalCtx->sceneNum >= SCENE_YDAN_BOSS) ? globalCtx->sceneNum - SCENE_YDAN_BOSS : globalCtx->sceneNum; + mapIndex = (play->sceneNum >= SCENE_YDAN_BOSS) ? play->sceneNum - SCENE_YDAN_BOSS : play->sceneNum; R_MAP_INDEX = gSaveContext.mapIndex = mapIndex; - if ((globalCtx->sceneNum <= SCENE_ICE_DOUKUTO) || (globalCtx->sceneNum >= SCENE_YDAN_BOSS)) { + if ((play->sceneNum <= SCENE_ICE_DOUKUTO) || (play->sceneNum >= SCENE_YDAN_BOSS)) { R_COMPASS_SCALE_X = gMapData->dgnCompassInfo[mapIndex][0]; R_COMPASS_SCALE_Y = gMapData->dgnCompassInfo[mapIndex][1]; R_COMPASS_OFFSET_X = gMapData->dgnCompassInfo[mapIndex][2]; R_COMPASS_OFFSET_Y = gMapData->dgnCompassInfo[mapIndex][3]; R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE = gMapData->dgnTexIndexBase[mapIndex]; - Map_InitRoomData(globalCtx, globalCtx->roomCtx.curRoom.num); - MapMark_Init(globalCtx); + Map_InitRoomData(play, play->roomCtx.curRoom.num); + MapMark_Init(play); } break; } } -void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { +void Minimap_DrawCompassIcons(PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 tempX, tempZ; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 565); + OPEN_DISPS(play->state.gfxCtx, "../z_map_exp.c", 565); - if (globalCtx->interfaceCtx.minimapAlpha >= 0xAA) { - func_80094A14(globalCtx->state.gfxCtx); + if (play->interfaceCtx.minimapAlpha >= 0xAA) { + func_80094A14(play->state.gfxCtx); gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, @@ -334,7 +333,7 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { Matrix_RotateX(-1.6f, MTXMODE_APPLY); tempX = (0x7FFF - player->actor.shape.rot.y) / 0x400; Matrix_RotateY(tempX / 10.0f, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_map_exp.c", 585), + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_map_exp.c", 585), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 0, 255); @@ -348,25 +347,25 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { Matrix_Scale(VREG(9) / 100.0f, VREG(9) / 100.0f, VREG(9) / 100.0f, MTXMODE_APPLY); Matrix_RotateX(VREG(52) / 10.0f, MTXMODE_APPLY); Matrix_RotateY(sPlayerInitialDirection / 10.0f, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_map_exp.c", 603), + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_map_exp.c", 603), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, 200, 0, 0, 255); gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 607); + CLOSE_DISPS(play->state.gfxCtx, "../z_map_exp.c", 607); } -void Minimap_Draw(GlobalContext* globalCtx) { +void Minimap_Draw(PlayState* play) { s32 pad[2]; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s32 mapIndex = gSaveContext.mapIndex; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 626); + OPEN_DISPS(play->state.gfxCtx, "../z_map_exp.c", 626); - if (globalCtx->pauseCtx.state < 4) { - switch (globalCtx->sceneNum) { + if (play->pauseCtx.state < 4) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -378,7 +377,7 @@ void Minimap_Draw(GlobalContext* globalCtx) { case SCENE_HAKADANCH: case SCENE_ICE_DOUKUTO: if (!R_MINIMAP_DISABLED) { - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); gDPSetCombineLERP(OVERLAY_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); @@ -395,14 +394,14 @@ void Minimap_Draw(GlobalContext* globalCtx) { } if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, mapIndex)) { - Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position - func_80094520(globalCtx->state.gfxCtx); - MapMark_Draw(globalCtx); + Minimap_DrawCompassIcons(play); // Draw icons for the player spawn and current position + func_80094520(play->state.gfxCtx); + MapMark_Draw(play); } } - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Play_InCsMode(globalCtx)) { - osSyncPrintf("Game_play_demo_mode_check=%d\n", Play_InCsMode(globalCtx)); + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_L) && !Play_InCsMode(play)) { + osSyncPrintf("Game_play_demo_mode_check=%d\n", Play_InCsMode(play)); // clang-format off if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, @@ -438,7 +437,7 @@ void Minimap_Draw(GlobalContext* globalCtx) { case SCENE_SPOT20: case SCENE_GANON_TOU: if (!R_MINIMAP_DISABLED) { - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2), @@ -454,8 +453,8 @@ void Minimap_Draw(GlobalContext* globalCtx) { (R_OW_MINIMAP_Y + gMapData->owMinimapHeight[mapIndex]) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); - if (((globalCtx->sceneNum != SCENE_SPOT01) && (globalCtx->sceneNum != SCENE_SPOT04) && - (globalCtx->sceneNum != SCENE_SPOT08)) || + if (((play->sceneNum != SCENE_SPOT01) && (play->sceneNum != SCENE_SPOT04) && + (play->sceneNum != SCENE_SPOT08)) || (LINK_AGE_IN_YEARS != YEARS_ADULT)) { if ((gMapData->owEntranceFlag[sEntranceIconMapIndex] == 0xFFFF) || ((gMapData->owEntranceFlag[sEntranceIconMapIndex] != 0xFFFF) && @@ -475,7 +474,7 @@ void Minimap_Draw(GlobalContext* globalCtx) { } } - if ((globalCtx->sceneNum == SCENE_SPOT08) && + if ((play->sceneNum == SCENE_SPOT08) && (gSaveContext.infTable[INFTABLE_1AX_INDEX] & gBitFlags[INFTABLE_1A9_SHIFT])) { gDPLoadTextureBlock(OVERLAY_DISP++, gMapDungeonEntranceIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, @@ -485,10 +484,10 @@ void Minimap_Draw(GlobalContext* globalCtx) { 0, 1 << 10, 1 << 10); } - Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position + Minimap_DrawCompassIcons(play); // Draw icons for the player spawn and current position } - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Play_InCsMode(globalCtx)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_L) && !Play_InCsMode(play)) { // clang-format off if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, @@ -506,23 +505,23 @@ void Minimap_Draw(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 782); + CLOSE_DISPS(play->state.gfxCtx, "../z_map_exp.c", 782); } s16 Map_GetFloorTextIndexOffset(s32 mapIndex, s32 floor) { return gMapData->floorTexIndexOffset[mapIndex][floor]; } -void Map_Update(GlobalContext* globalCtx) { +void Map_Update(PlayState* play) { static s16 sLastRoomNum = 99; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 mapIndex = gSaveContext.mapIndex; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 floor; s16 i; - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) { - switch (globalCtx->sceneNum) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -568,9 +567,9 @@ void Map_Update(GlobalContext* globalCtx) { // "Layer switching = %x" osSyncPrintf("階層切替=%x\n", interfaceCtx->mapRoomNum); osSyncPrintf(VT_RST); - Map_InitData(globalCtx, interfaceCtx->mapRoomNum); + Map_InitData(play, interfaceCtx->mapRoomNum); gSaveContext.sunsSongState = SUNSSONG_INACTIVE; - Map_SavePlayerInitialInfo(globalCtx); + Map_SavePlayerInitialInfo(play); } } @@ -584,9 +583,9 @@ void Map_Update(GlobalContext* globalCtx) { case SCENE_MIZUSIN_BS: case SCENE_JYASINBOSS: case SCENE_HAKADAN_BS: - VREG(30) = gMapData->bossFloor[globalCtx->sceneNum - SCENE_YDAN_BOSS]; - R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE + - gMapData->floorTexIndexOffset[globalCtx->sceneNum - SCENE_YDAN_BOSS][VREG(30)]; + VREG(30) = gMapData->bossFloor[play->sceneNum - SCENE_YDAN_BOSS]; + R_MAP_TEX_INDEX = + R_MAP_TEX_INDEX_BASE + gMapData->floorTexIndexOffset[play->sceneNum - SCENE_YDAN_BOSS][VREG(30)]; break; } } diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index 8718b8de4b..1cc055a036 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -53,11 +53,11 @@ static MapMarkDataOverlay sMapMarkDataOvl = { static MapMarkData** sLoadedMarkDataTable; -void MapMark_Init(GlobalContext* globalCtx) { +void MapMark_Init(PlayState* play) { MapMarkDataOverlay* overlay = &sMapMarkDataOvl; u32 overlaySize = (u32)overlay->vramEnd - (u32)overlay->vramStart; - overlay->loadedRamAddr = GameState_Alloc(&globalCtx->state, overlaySize, "../z_map_mark.c", 235); + overlay->loadedRamAddr = GameState_Alloc(&play->state, overlaySize, "../z_map_mark.c", 235); LogUtils_CheckNullPointer("dlftbl->allocp", overlay->loadedRamAddr, "../z_map_mark.c", 236); Overlay_Load(overlay->vromStart, overlay->vromEnd, overlay->vramStart, overlay->vramEnd, overlay->loadedRamAddr); @@ -69,12 +69,12 @@ void MapMark_Init(GlobalContext* globalCtx) { : NULL); } -void MapMark_ClearPointers(GlobalContext* globalCtx) { +void MapMark_ClearPointers(PlayState* play) { sMapMarkDataOvl.loadedRamAddr = NULL; sLoadedMarkDataTable = NULL; } -void MapMark_DrawForDungeon(GlobalContext* globalCtx) { +void MapMark_DrawForDungeon(PlayState* play) { InterfaceContext* interfaceCtx; MapMarkIconData* mapMarkIconData; MapMarkPoint* markPoint; @@ -84,18 +84,18 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) { s32 rectLeft; s32 rectTop; - interfaceCtx = &globalCtx->interfaceCtx; + interfaceCtx = &play->interfaceCtx; - if ((gMapData != NULL) && (globalCtx->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon])) { + if ((gMapData != NULL) && (play->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon])) { // "Room number exceeded, yikes %d/%d MapMarkDraw processing interrupted" osSyncPrintf(VT_COL(RED, WHITE) "部屋番号がオーバーしてるで,ヤバイで %d/%d \nMapMarkDraw の処理を中断します\n", - VT_RST, globalCtx->interfaceCtx.mapRoomNum, gMapData->dgnMinimapCount[dungeon]); + VT_RST, play->interfaceCtx.mapRoomNum, gMapData->dgnMinimapCount[dungeon]); return; } mapMarkIconData = &sLoadedMarkDataTable[dungeon][interfaceCtx->mapRoomNum][0]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_mark.c", 303); + OPEN_DISPS(play->state.gfxCtx, "../z_map_mark.c", 303); while (true) { if (mapMarkIconData->markType == MAP_MARK_NONE) { @@ -109,7 +109,7 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) { markPoint = &mapMarkIconData->points[0]; for (i = 0; i < mapMarkIconData->count; i++) { - if ((mapMarkIconData->markType != MAP_MARK_CHEST) || !Flags_GetTreasure(globalCtx, markPoint->chestFlag)) { + if ((mapMarkIconData->markType != MAP_MARK_CHEST) || !Flags_GetTreasure(play, markPoint->chestFlag)) { markInfo = &sMapMarkInfoTable[mapMarkIconData->markType]; gDPPipeSync(OVERLAY_DISP++); @@ -128,11 +128,11 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) { mapMarkIconData++; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_mark.c", 339); + CLOSE_DISPS(play->state.gfxCtx, "../z_map_mark.c", 339); } -void MapMark_Draw(GlobalContext* globalCtx) { - switch (globalCtx->sceneNum) { +void MapMark_Draw(PlayState* play) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -148,7 +148,7 @@ void MapMark_Draw(GlobalContext* globalCtx) { case SCENE_BDAN_BOSS: case SCENE_MORIBOSSROOM: case SCENE_FIRE_BS: - MapMark_DrawForDungeon(globalCtx); + MapMark_DrawForDungeon(play); break; } } diff --git a/src/code/z_message_PAL.c b/src/code/z_message_PAL.c index 18fd1d7325..7d54ff2cb4 100644 --- a/src/code/z_message_PAL.c +++ b/src/code/z_message_PAL.c @@ -132,12 +132,12 @@ void Message_ResetOcarinaNoteState(void) { sOcarinaButtonCEnvB = 10; } -void Message_UpdateOcarinaMemoryGame(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_UpdateOcarinaMemoryGame(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; - globalCtx->msgCtx.msgMode++; + play->msgCtx.msgMode++; - if (globalCtx->msgCtx.msgMode == MSGMODE_MEMORY_GAME_PLAYER_PLAYING) { + if (play->msgCtx.msgMode == MSGMODE_MEMORY_GAME_PLAYER_PLAYING) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0; @@ -153,8 +153,8 @@ void Message_UpdateOcarinaMemoryGame(GlobalContext* globalCtx) { Message_ResetOcarinaNoteState(); } -u8 Message_ShouldAdvance(GlobalContext* globalCtx) { - Input* input = &globalCtx->state.input[0]; +u8 Message_ShouldAdvance(PlayState* play) { + Input* input = &play->state.input[0]; if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_B) || CHECK_BTN_ALL(input->press.button, BTN_CUP)) { @@ -165,8 +165,8 @@ u8 Message_ShouldAdvance(GlobalContext* globalCtx) { CHECK_BTN_ALL(input->press.button, BTN_CUP); } -u8 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) { - Input* input = &globalCtx->state.input[0]; +u8 Message_ShouldAdvanceSilent(PlayState* play) { + Input* input = &play->state.input[0]; return CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_B) || CHECK_BTN_ALL(input->press.button, BTN_CUP); @@ -176,8 +176,8 @@ u8 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) { * Closes any currently displayed textbox immediately, without waiting for * input from the player. */ -void Message_CloseTextbox(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_CloseTextbox(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; if (msgCtx->msgLength != 0) { msgCtx->stateTimer = 2; @@ -188,10 +188,10 @@ void Message_CloseTextbox(GlobalContext* globalCtx) { } } -void Message_HandleChoiceSelection(GlobalContext* globalCtx, u8 numChoices) { +void Message_HandleChoiceSelection(PlayState* play, u8 numChoices) { static s16 sAnalogStickHeld = false; - MessageContext* msgCtx = &globalCtx->msgCtx; - Input* input = &globalCtx->state.input[0]; + MessageContext* msgCtx = &play->msgCtx; + Input* input = &play->state.input[0]; if (input->rel.stick_y >= 30 && !sAnalogStickHeld) { sAnalogStickHeld = true; @@ -219,8 +219,8 @@ void Message_HandleChoiceSelection(GlobalContext* globalCtx, u8 numChoices) { (numChoices == 1) ? R_TEXT_CHOICE_YPOS(msgCtx->choiceIndex + 1) : R_TEXT_CHOICE_YPOS(msgCtx->choiceIndex); } -void Message_DrawTextChar(GlobalContext* globalCtx, void* textureImage, Gfx** p) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_DrawTextChar(PlayState* play, void* textureImage, Gfx** p) { + MessageContext* msgCtx = &play->msgCtx; Gfx* gfx = *p; s16 x = msgCtx->textPosX; s16 y = msgCtx->textPosY; @@ -288,7 +288,7 @@ void Message_GrowTextbox(MessageContext* msgCtx) { R_TEXTBOX_X = (R_TEXTBOX_X_TARGET + R_TEXTBOX_WIDTH_TARGET) - (R_TEXTBOX_WIDTH / 2); } -void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { +void Message_FindMessage(PlayState* play, u16 textId) { const char* foundSeg; const char* nextSeg; MessageTableEntry* messageTableEntry = sNesMessageEntryTablePtr; @@ -300,7 +300,7 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { seg = messageTableEntry->segment; while (messageTableEntry->textId != 0xFFFF) { - font = &globalCtx->msgCtx.font; + font = &play->msgCtx.font; if (messageTableEntry->textId == textId) { foundSeg = messageTableEntry->segment; @@ -323,7 +323,7 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { seg = messageTableEntry->segment; while (messageTableEntry->textId != 0xFFFF) { - font = &globalCtx->msgCtx.font; + font = &play->msgCtx.font; if (messageTableEntry->textId == textId) { foundSeg = *languageSegmentTable; @@ -344,7 +344,7 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { } // "Message not found!!!" osSyncPrintf(" メッセージが,見つからなかった!!! = %x\n", textId); - font = &globalCtx->msgCtx.font; + font = &play->msgCtx.font; messageTableEntry = sNesMessageEntryTablePtr; if (gSaveContext.language == LANGUAGE_ENG) { @@ -364,7 +364,7 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { font->msgLength = nextSeg - foundSeg; } -void Message_FindCreditsMessage(GlobalContext* globalCtx, u16 textId) { +void Message_FindCreditsMessage(PlayState* play, u16 textId) { const char* foundSeg; const char* nextSeg; const char* seg; @@ -373,7 +373,7 @@ void Message_FindCreditsMessage(GlobalContext* globalCtx, u16 textId) { seg = messageTableEntry->segment; while (messageTableEntry->textId != 0xFFFF) { - font = &globalCtx->msgCtx.font; + font = &play->msgCtx.font; if (messageTableEntry->textId == textId) { foundSeg = messageTableEntry->segment; @@ -477,7 +477,7 @@ void Message_SetTextColor(MessageContext* msgCtx, u16 colorParameter) { } } -void Message_DrawTextboxIcon(GlobalContext* globalCtx, Gfx** p, s16 x, s16 y) { +void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) { static s16 sIconPrimColors[][3] = { { 0, 200, 80 }, { 50, 255, 130 }, @@ -494,7 +494,7 @@ void Message_DrawTextboxIcon(GlobalContext* globalCtx, Gfx** p, s16 x, s16 y) { static s16 sIconEnvR = 0; static s16 sIconEnvG = 0; static s16 sIconEnvB = 0; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; Font* font = &msgCtx->font; Gfx* gfx = *p; s16 primR; @@ -737,10 +737,10 @@ f32 sFontWidths[144] = { 14.0f, // ? }; -u16 Message_DrawItemIcon(GlobalContext* globalCtx, u16 itemId, Gfx** p, u16 i) { +u16 Message_DrawItemIcon(PlayState* play, u16 itemId, Gfx** p, u16 i) { s32 pad; Gfx* gfx = *p; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; // clang-format off if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySoundGeneral(0, &gSfxDefaultPos, 4, @@ -777,11 +777,11 @@ u16 Message_DrawItemIcon(GlobalContext* globalCtx, u16 itemId, Gfx** p, u16 i) { return i; } -void Message_HandleOcarina(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_HandleOcarina(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; - if (globalCtx->msgCtx.msgMode == MSGMODE_TEXT_DISPLAYING) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + if (play->msgCtx.msgMode == MSGMODE_TEXT_DISPLAYING) { + play->msgCtx.ocarinaMode = OCARINA_MODE_01; if (msgCtx->ocarinaAction == OCARINA_ACTION_SCARECROW_LONG_RECORDING) { msgCtx->msgMode = MSGMODE_SCARECROW_LONG_RECORDING_START; @@ -847,18 +847,18 @@ void Message_HandleOcarina(GlobalContext* globalCtx) { * Draws the text contents of a textbox, up to the current point that has * been scrolled to so far. */ -void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_DrawText(PlayState* play, Gfx** gfxP) { + MessageContext* msgCtx = &play->msgCtx; u16 lookAheadCharacter; u8 character; u16 j; u16 i; u16 sfxHi; u16 charTexIdx; - Font* font = &globalCtx->msgCtx.font; + Font* font = &play->msgCtx.font; Gfx* gfx = *gfxP; - globalCtx->msgCtx.textPosX = R_TEXT_INIT_XPOS; + play->msgCtx.textPosX = R_TEXT_INIT_XPOS; if (sTextIsCredits == false) { msgCtx->textPosY = R_TEXT_INIT_YPOS; @@ -993,7 +993,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { i += 2; break; case MESSAGE_ITEM_ICON: - i = Message_DrawItemIcon(globalCtx, msgCtx->msgBufDecoded[i + 1], &gfx, i); + i = Message_DrawItemIcon(play, msgCtx->msgBufDecoded[i + 1], &gfx, i); break; case MESSAGE_BACKGROUND: // clang-format off @@ -1086,8 +1086,8 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { Audio_PlaySoundGeneral(NA_SE_SY_MESSAGE_END, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_SQUARE); - if (globalCtx->csCtx.state == 0) { - Interface_SetDoAction(globalCtx, DO_ACTION_RETURN); + if (play->csCtx.state == 0) { + Interface_SetDoAction(play, DO_ACTION_RETURN); } } } @@ -1095,7 +1095,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { return; case MESSAGE_OCARINA: if (i + 1 == msgCtx->textDrawPos) { - Message_HandleOcarina(globalCtx); + Message_HandleOcarina(play); *gfxP = gfx; return; } @@ -1106,8 +1106,8 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADING; msgCtx->stateTimer = msgCtx->msgBufDecoded[++i]; Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_SQUARE); - if (globalCtx->csCtx.state == 0) { - Interface_SetDoAction(globalCtx, DO_ACTION_RETURN); + if (play->csCtx.state == 0) { + Interface_SetDoAction(play, DO_ACTION_RETURN); } } *gfxP = gfx; @@ -1137,7 +1137,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { Audio_PlaySoundGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - Message_DrawTextChar(globalCtx, &font->charTexBuf[charTexIdx], &gfx); + Message_DrawTextChar(play, &font->charTexBuf[charTexIdx], &gfx); charTexIdx += FONT_CHAR_TEX_SIZE; msgCtx->textPosX += (s32)(sFontWidths[character - ' '] * (R_TEXT_CHAR_SCALE / 100.0f)); @@ -1153,11 +1153,11 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { *gfxP = gfx; } -void Message_LoadItemIcon(GlobalContext* globalCtx, u16 itemId, s16 y) { +void Message_LoadItemIcon(PlayState* play, u16 itemId, s16 y) { static s16 sIconItem32XOffsets[] = { 74, 74, 74 }; static s16 sIconItem24XOffsets[] = { 72, 72, 72 }; - MessageContext* msgCtx = &globalCtx->msgCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (itemId == ITEM_DUNGEON_MAP) { interfaceCtx->mapPalette[30] = 0xFF; @@ -1186,7 +1186,7 @@ void Message_LoadItemIcon(GlobalContext* globalCtx, u16 itemId, s16 y) { msgCtx->choiceNum = 1; } -void Message_Decode(GlobalContext* globalCtx) { +void Message_Decode(PlayState* play) { u8 curChar; u8 curChar2; u16 value; @@ -1198,11 +1198,11 @@ void Message_Decode(GlobalContext* globalCtx) { s16 i; s16 digits[4]; f32 timeInSeconds; - MessageContext* msgCtx = &globalCtx->msgCtx; - Font* font = &globalCtx->msgCtx.font; + MessageContext* msgCtx = &play->msgCtx; + Font* font = &play->msgCtx.font; - globalCtx->msgCtx.textDelayTimer = 0; - globalCtx->msgCtx.textUnskippable = globalCtx->msgCtx.textDelay = globalCtx->msgCtx.textDelayTimer = 0; + play->msgCtx.textDelayTimer = 0; + play->msgCtx.textUnskippable = play->msgCtx.textDelay = play->msgCtx.textDelayTimer = 0; sTextFade = false; while (true) { @@ -1528,7 +1528,7 @@ void Message_Decode(GlobalContext* globalCtx) { msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[msgCtx->msgBufPos + 1]; osSyncPrintf("ITEM_NO=(%d) (%d)\n", msgCtx->msgBufDecoded[decodedBufPos], font->msgBuf[msgCtx->msgBufPos + 1]); - Message_LoadItemIcon(globalCtx, font->msgBuf[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); + Message_LoadItemIcon(play, font->msgBuf[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); } else if (curChar == MESSAGE_BACKGROUND) { msgCtx->textboxBackgroundIdx = font->msgBuf[msgCtx->msgBufPos + 1] * 2; msgCtx->textboxBackgroundForeColorIdx = (font->msgBuf[msgCtx->msgBufPos + 2] & 0xF0) >> 4; @@ -1581,9 +1581,9 @@ void Message_Decode(GlobalContext* globalCtx) { } } -void Message_OpenText(GlobalContext* globalCtx, u16 textId) { +void Message_OpenText(PlayState* play, u16 textId) { static s16 messageStaticIndices[] = { 0, 1, 3, 2 }; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; Font* font = &msgCtx->font; s16 textBoxType; @@ -1634,23 +1634,23 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) { } if (sTextIsCredits) { - Message_FindCreditsMessage(globalCtx, textId); + Message_FindCreditsMessage(play, textId); msgCtx->msgLength = font->msgLength; DmaMgr_SendRequest1(font->msgBuf, (u32)(_staff_message_data_staticSegmentRomStart + font->msgOffset), font->msgLength, "../z_message_PAL.c", 1954); } else { if (gSaveContext.language == LANGUAGE_ENG) { - Message_FindMessage(globalCtx, textId); + Message_FindMessage(play, textId); msgCtx->msgLength = font->msgLength; DmaMgr_SendRequest1(font->msgBuf, (u32)(_nes_message_data_staticSegmentRomStart + font->msgOffset), font->msgLength, "../z_message_PAL.c", 1966); } else if (gSaveContext.language == LANGUAGE_GER) { - Message_FindMessage(globalCtx, textId); + Message_FindMessage(play, textId); msgCtx->msgLength = font->msgLength; DmaMgr_SendRequest1(font->msgBuf, (u32)(_ger_message_data_staticSegmentRomStart + font->msgOffset), font->msgLength, "../z_message_PAL.c", 1978); } else { - Message_FindMessage(globalCtx, textId); + Message_FindMessage(play, textId); msgCtx->msgLength = font->msgLength; DmaMgr_SendRequest1(font->msgBuf, (u32)(_fra_message_data_staticSegmentRomStart + font->msgOffset), font->msgLength, "../z_message_PAL.c", 1990); @@ -1697,8 +1697,8 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) { msgCtx->msgBufPos = msgCtx->unk_E3D0 = msgCtx->textDrawPos = 0; } -void Message_StartTextbox(GlobalContext* globalCtx, u16 textId, Actor* actor) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_StartTextbox(PlayState* play, u16 textId, Actor* actor) { + MessageContext* msgCtx = &play->msgCtx; osSyncPrintf(VT_FGCOL(BLUE)); // "Message" @@ -1706,16 +1706,16 @@ void Message_StartTextbox(GlobalContext* globalCtx, u16 textId, Actor* actor) { osSyncPrintf(VT_RST); msgCtx->ocarinaAction = 0xFFFF; - Message_OpenText(globalCtx, textId); + Message_OpenText(play, textId); msgCtx->talkActor = actor; msgCtx->msgMode = MSGMODE_TEXT_START; msgCtx->stateTimer = 0; msgCtx->textDelayTimer = 0; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + play->msgCtx.ocarinaMode = OCARINA_MODE_00; } -void Message_ContinueTextbox(GlobalContext* globalCtx, u16 textId) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_ContinueTextbox(PlayState* play, u16 textId) { + MessageContext* msgCtx = &play->msgCtx; osSyncPrintf(VT_FGCOL(GREEN)); // "Message" @@ -1723,7 +1723,7 @@ void Message_ContinueTextbox(GlobalContext* globalCtx, u16 textId) { osSyncPrintf(VT_RST); msgCtx->msgLength = 0; - Message_OpenText(globalCtx, textId); + Message_OpenText(play, textId); msgCtx->msgMode = MSGMODE_NONE; msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget; msgCtx->msgMode = MSGMODE_TEXT_CONTINUING; @@ -1731,13 +1731,13 @@ void Message_ContinueTextbox(GlobalContext* globalCtx, u16 textId) { msgCtx->textboxEndType = msgCtx->msgBufPos = msgCtx->unk_E3D0 = msgCtx->textDrawPos = msgCtx->textDelayTimer = 0; msgCtx->textColorAlpha = 255; - if (YREG(31) == 0 && globalCtx->interfaceCtx.unk_1FA == 0) { - Interface_SetDoAction(globalCtx, DO_ACTION_NEXT); + if (YREG(31) == 0 && play->interfaceCtx.unk_1FA == 0) { + Interface_SetDoAction(play, DO_ACTION_NEXT); } msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget; } -void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { +void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) { static u16 sOcarinaSongFlagsMap[] = { (1 << OCARINA_SONG_MINUET), (1 << OCARINA_SONG_BOLERO), @@ -1753,7 +1753,7 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { (1 << OCARINA_SONG_STORMS), (1 << OCARINA_SONG_SCARECROW_SPAWN), }; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; s32 textId; s16 j; s16 i; @@ -1785,11 +1785,11 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ オカリナ番号=%d(%d) ☆☆☆☆☆\n" VT_RST, ocarinaActionId, 2); noStop = false; if (ocarinaActionId >= 0x893) { - Message_OpenText(globalCtx, ocarinaActionId); // You played the [song name] + Message_OpenText(play, ocarinaActionId); // You played the [song name] textId = ocarinaActionId + 0x86E; } else if (ocarinaActionId == OCARINA_ACTION_MEMORY_GAME) { msgCtx->ocarinaAction = ocarinaActionId; - Message_OpenText(globalCtx, 0x86D); // Play using [A] and [C]. + Message_OpenText(play, 0x86D); // Play using [A] and [C]. textId = ocarinaActionId + 0x86E; } else if (ocarinaActionId == OCARINA_ACTION_FREE_PLAY || ocarinaActionId >= OCARINA_ACTION_CHECK_SARIA) { osSyncPrintf("ocarina_set 000000000000000000 = %d\n", ocarinaActionId); @@ -1799,10 +1799,10 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } if (ocarinaActionId == OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK) { - Message_OpenText(globalCtx, 0x86F); // Ocarina + Message_OpenText(play, 0x86F); // Ocarina textId = ocarinaActionId + 0x86E; } else { - Message_OpenText(globalCtx, 0x86E); // Play using [A] and [C]; [B] to Stop. + Message_OpenText(play, 0x86E); // Play using [A] and [C]; [B] to Stop. textId = ocarinaActionId + 0x86E; } } else { @@ -1810,19 +1810,19 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { noStop = true; if (ocarinaActionId >= OCARINA_ACTION_PLAYBACK_MINUET) { osSyncPrintf("222222222\n"); - Message_OpenText(globalCtx, 0x86D); // Play using [A] and [C]. + Message_OpenText(play, 0x86D); // Play using [A] and [C]. textId = ocarinaActionId + 0x86E; } else { osSyncPrintf("333333333\n"); textId = ocarinaActionId + 0x86E; - Message_OpenText(globalCtx, textId); // Play using [A] and [C]; [B] to Stop. + Message_OpenText(play, textId); // Play using [A] and [C]; [B] to Stop. } } msgCtx->talkActor = NULL; // "Ocarina Mode" osSyncPrintf("オカリナモード = %d (%x)\n", msgCtx->ocarinaAction, textId); msgCtx->textDelayTimer = 0; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + play->msgCtx.ocarinaMode = OCARINA_MODE_00; R_TEXTBOX_X = 34; R_TEXTBOX_Y = 142; R_TEXTBOX_TEXWIDTH = 512; @@ -1838,7 +1838,7 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { } msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget; if (noStop == false) { - Interface_LoadActionLabelB(globalCtx, DO_ACTION_STOP); + Interface_LoadActionLabelB(play, DO_ACTION_STOP); noStop = gSaveContext.unk_13EA; Interface_ChangeAlpha(0xA); gSaveContext.unk_13EA = noStop; @@ -1853,7 +1853,7 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { msgCtx->textBoxType = TEXTBOX_TYPE_BLUE; } else if (ocarinaActionId == OCARINA_ACTION_MEMORY_GAME) { Interface_ChangeAlpha(1); - Message_Decode(globalCtx); + Message_Decode(play); msgCtx->msgMode = MSGMODE_MEMORY_GAME_START; } else if (ocarinaActionId == OCARINA_ACTION_SCARECROW_LONG_PLAYBACK) { // "?????Recording Playback / Recording Playback / Recording Playback / Recording Playback -> " @@ -1871,18 +1871,18 @@ void Message_StartOcarina(GlobalContext* globalCtx, u16 ocarinaActionId) { Interface_ChangeAlpha(1); } for (k = 0, j = 0; j < 48; j++, k += 0x80) { - func_8006EE50(&globalCtx->msgCtx.font, 0x8140, k); + func_8006EE50(&play->msgCtx.font, 0x8140, k); } } -void func_8010BD58(GlobalContext* globalCtx, u16 ocarinaActionId) { - globalCtx->msgCtx.unk_E40E = 0; - Message_StartOcarina(globalCtx, ocarinaActionId); +void func_8010BD58(PlayState* play, u16 ocarinaActionId) { + play->msgCtx.unk_E40E = 0; + Message_StartOcarina(play, ocarinaActionId); } -void func_8010BD88(GlobalContext* globalCtx, u16 ocarinaActionId) { - globalCtx->msgCtx.unk_E40E = 1; - Message_StartOcarina(globalCtx, ocarinaActionId); +void func_8010BD88(PlayState* play, u16 ocarinaActionId) { + play->msgCtx.unk_E40E = 1; + Message_StartOcarina(play, ocarinaActionId); } u8 Message_GetState(MessageContext* msgCtx) { @@ -1920,8 +1920,8 @@ u8 Message_GetState(MessageContext* msgCtx) { return state; } -void Message_DrawTextBox(GlobalContext* globalCtx, Gfx** p) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_DrawTextBox(PlayState* play, Gfx** p) { + MessageContext* msgCtx = &play->msgCtx; Gfx* gfx = *p; gDPPipeSync(gfx++); @@ -1969,7 +1969,7 @@ void Message_SetView(View* view) { /** * Draws the textbox in full and updates ocarina state */ -void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { +void Message_DrawMain(PlayState* play, Gfx** p) { static s16 sOcarinaEffectActorIds[] = { ACTOR_OCEFF_WIPE3, ACTOR_OCEFF_WIPE2, ACTOR_OCEFF_WIPE, ACTOR_OCEFF_SPOT, ACTOR_OCEFF_WIPE, ACTOR_OCEFF_STORM, ACTOR_OCEFF_WIPE4, @@ -2001,10 +2001,10 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { NA_BGM_OCA_NOCTURNE, NA_BGM_OCA_LIGHT, NA_BGM_OCA_SARIA, NA_BGM_OCA_EPONA, NA_BGM_OCA_ZELDA, NA_BGM_OCA_SUNS, NA_BGM_OCA_TIME, NA_BGM_OCA_STORM, }; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - MessageContext* msgCtx = &globalCtx->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + MessageContext* msgCtx = &play->msgCtx; u16 buttonIndexPos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; Gfx* gfx = *p; s16 r; @@ -2015,7 +2015,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { u16 pad1; u16 j; - gSPSegment(gfx++, 0x02, globalCtx->interfaceCtx.parameterSegment); + gSPSegment(gfx++, 0x02, play->interfaceCtx.parameterSegment); gSPSegment(gfx++, 0x07, msgCtx->textboxSegment); if (msgCtx->msgLength != 0) { @@ -2024,7 +2024,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { msgCtx->textBoxType < TEXTBOX_TYPE_NONE_BOTTOM) { Message_SetView(&msgCtx->view); func_8009457C(&gfx); - Message_DrawTextBox(globalCtx, &gfx); + Message_DrawTextBox(play, &gfx); } func_8009457C(&gfx); @@ -2042,19 +2042,19 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { case MSGMODE_TEXT_CONTINUING: if (msgCtx->stateTimer == 1) { for (j = 0, i = 0; i < 48; i++, j += 0x80) { - func_8006EE50(&globalCtx->msgCtx.font, 0x8140, j); + func_8006EE50(&play->msgCtx.font, 0x8140, j); } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); } break; case MSGMODE_TEXT_DISPLAYING: case MSGMODE_TEXT_DELAYED_BREAK: - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_TEXT_AWAIT_INPUT: case MSGMODE_TEXT_AWAIT_NEXT: - Message_DrawText(globalCtx, &gfx); - Message_DrawTextboxIcon(globalCtx, &gfx, R_TEXTBOX_END_XPOS, R_TEXTBOX_END_YPOS); + Message_DrawText(play, &gfx); + Message_DrawTextboxIcon(play, &gfx, R_TEXTBOX_END_XPOS, R_TEXTBOX_END_YPOS); break; case MSGMODE_OCARINA_STARTING: case MSGMODE_SONG_DEMONSTRATION_STARTING: @@ -2062,7 +2062,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; Message_ResetOcarinaNoteState(); sOcarinaNoteFlashTimer = 3; sOcarinaNoteFlashColorIndex = 1; @@ -2096,7 +2096,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } if (msgCtx->ocarinaAction != OCARINA_ACTION_FREE_PLAY && msgCtx->ocarinaAction != OCARINA_ACTION_CHECK_NOWARP) { - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); } break; case MSGMODE_OCARINA_PLAYING: @@ -2131,7 +2131,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } else { // "Ocarina_Flog Correct Example Performance" osSyncPrintf("Ocarina_Flog 正解模範演奏=%x\n", msgCtx->lastPlayedSong); - Message_ContinueTextbox(globalCtx, 0x86F); // Ocarina + Message_ContinueTextbox(play, 0x86F); // Ocarina msgCtx->msgMode = MSGMODE_SONG_PLAYED; msgCtx->textBoxType = TEXTBOX_TYPE_OCARINA; msgCtx->stateTimer = 10; @@ -2151,7 +2151,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } else { // "Ocarina_Flog Correct Example Performance" osSyncPrintf("Ocarina_Flog 正解模範演奏=%x\n", msgCtx->lastPlayedSong); - Message_ContinueTextbox(globalCtx, 0x86F); // Ocarina + Message_ContinueTextbox(play, 0x86F); // Ocarina msgCtx->msgMode = MSGMODE_SONG_PLAYED; msgCtx->textBoxType = TEXTBOX_TYPE_OCARINA; msgCtx->stateTimer = 10; @@ -2163,7 +2163,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } else if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY) { // "Ocarina_Free Correct Example Performance" osSyncPrintf("Ocarina_Free 正解模範演奏=%x\n", msgCtx->lastPlayedSong); - Message_ContinueTextbox(globalCtx, 0x86F); // Ocarina + Message_ContinueTextbox(play, 0x86F); // Ocarina msgCtx->msgMode = MSGMODE_SONG_PLAYED; msgCtx->textBoxType = TEXTBOX_TYPE_OCARINA; msgCtx->stateTimer = 10; @@ -2188,14 +2188,14 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); msgCtx->stateTimer = 10; msgCtx->msgMode = MSGMODE_OCARINA_FAIL; - } else if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B)) { + } else if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - Message_CloseTextbox(globalCtx); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); } if (msgCtx->ocarinaAction != OCARINA_ACTION_FREE_PLAY && msgCtx->ocarinaAction != OCARINA_ACTION_CHECK_NOWARP) { - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); } break; case MSGMODE_OCARINA_CORRECT_PLAYBACK: @@ -2317,30 +2317,30 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { if (msgCtx->msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) { // "Correct Example Performance" osSyncPrintf("正解模範演奏=%x\n", msgCtx->lastPlayedSong); - Message_ContinueTextbox(globalCtx, 0x86F); // Ocarina + Message_ContinueTextbox(play, 0x86F); // Ocarina msgCtx->msgMode = MSGMODE_SONG_PLAYED; msgCtx->textBoxType = TEXTBOX_TYPE_OCARINA; msgCtx->stateTimer = 1; } else if (msgCtx->msgMode == MSGMODE_SONG_PLAYBACK_SUCCESS) { if (msgCtx->lastPlayedSong >= OCARINA_SONG_SARIAS) { - Message_ContinueTextbox(globalCtx, 0x86F); // Ocarina + Message_ContinueTextbox(play, 0x86F); // Ocarina msgCtx->msgMode = MSGMODE_SONG_PLAYED; msgCtx->textBoxType = TEXTBOX_TYPE_OCARINA; msgCtx->stateTimer = 1; } else { - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } } else { - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_03; + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_03; } } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_OCARINA_FAIL: case MSGMODE_SONG_PLAYBACK_FAIL: - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); case MSGMODE_OCARINA_FAIL_NO_TEXT: msgCtx->stateTimer--; if (msgCtx->stateTimer == 0) { @@ -2348,8 +2348,8 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { if (msgCtx->msgMode == MSGMODE_SONG_PLAYBACK_FAIL) { // "kokokokokoko" osSyncPrintf("ここここここ\n"); - Message_ContinueTextbox(globalCtx, 0x88B); // red X background - Message_Decode(globalCtx); + Message_ContinueTextbox(play, 0x88B); // red X background + Message_Decode(play); msgCtx->msgMode = MSGMODE_SONG_PLAYBACK_NOTES_DROP; } else { msgCtx->msgMode = MSGMODE_OCARINA_NOTES_DROP; @@ -2386,14 +2386,14 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { osSyncPrintf("Na_StopOcarinaMode();\n"); osSyncPrintf("Na_StopOcarinaMode();\n"); osSyncPrintf(VT_RST); - Message_Decode(globalCtx); + Message_Decode(play); msgCtx->msgMode = MSGMODE_SETUP_DISPLAY_SONG_PLAYED; msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0; Message_ResetOcarinaNoteState(); if (msgCtx->lastPlayedSong >= OCARINA_SONG_SARIAS && msgCtx->lastPlayedSong < OCARINA_SONG_MEMORY_GAME) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, + Actor_Spawn(&play->actorCtx, play, sOcarinaEffectActorIds[msgCtx->lastPlayedSong - OCARINA_SONG_SARIAS], player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, sOcarinaEffectActorParams[msgCtx->lastPlayedSong - OCARINA_SONG_SARIAS]); @@ -2401,7 +2401,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } break; case MSGMODE_SETUP_DISPLAY_SONG_PLAYED: - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); AudioOcarina_SetPlaybackSong(msgCtx->lastPlayedSong + 1, 1); @@ -2409,7 +2409,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { Audio_PlayFanfare(sOcarinaSongFanfares[msgCtx->lastPlayedSong]); Audio_SetSoundBanksMute(0x20); } - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY) { msgCtx->ocarinaAction = OCARINA_ACTION_FREE_PLAY_DONE; } @@ -2441,28 +2441,28 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { sOcarinaButtonIndexBufPos = 0; msgCtx->msgMode = MSGMODE_SONG_DEMONSTRATION; } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_DISPLAY_SONG_PLAYED_TEXT_BEGIN: - Message_ContinueTextbox(globalCtx, msgCtx->lastPlayedSong + 0x893); // You played [song name] - Message_Decode(globalCtx); + Message_ContinueTextbox(play, msgCtx->lastPlayedSong + 0x893); // You played [song name] + Message_Decode(play); msgCtx->msgMode = MSGMODE_DISPLAY_SONG_PLAYED_TEXT; msgCtx->stateTimer = 20; - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_DISPLAY_SONG_PLAYED_TEXT: msgCtx->stateTimer--; if (msgCtx->stateTimer == 0) { msgCtx->msgMode = MSGMODE_SONG_PLAYED_ACT_BEGIN; } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SONG_PLAYED_ACT_BEGIN: AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); Message_ResetOcarinaNoteState(); msgCtx->msgMode = MSGMODE_SONG_PLAYED_ACT; msgCtx->stateTimer = 2; - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SONG_PLAYED_ACT: msgCtx->stateTimer--; @@ -2471,17 +2471,17 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { (msgCtx->ocarinaAction < OCARINA_ACTION_PLAYBACK_MINUET || msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_SARIA)) { if (msgCtx->disableWarpSongs || interfaceCtx->restrictions.warpSongs == 3) { - Message_StartTextbox(globalCtx, 0x88C, NULL); // "You can't warp here!" - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_StartTextbox(play, 0x88C, NULL); // "You can't warp here!" + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else if (GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_1) { - Message_StartTextbox(globalCtx, msgCtx->lastPlayedSong + 0x88D, + Message_StartTextbox(play, msgCtx->lastPlayedSong + 0x88D, NULL); // "Warp to [place name]?" - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; } else { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } } else { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); if (msgCtx->lastPlayedSong == OCARINA_SONG_EPONAS) { DREG(53) = 1; } @@ -2489,31 +2489,31 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { osSyncPrintf("☆☆☆ocarina=%d message->ocarina_no=%d ", msgCtx->lastPlayedSong, msgCtx->ocarinaAction); if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; if (msgCtx->lastPlayedSong == OCARINA_SONG_SCARECROW_SPAWN) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_0B; + play->msgCtx.ocarinaMode = OCARINA_MODE_0B; } } else if (msgCtx->ocarinaAction >= OCARINA_ACTION_CHECK_MINUET) { osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("Ocarina_PC_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_CHECK_MINUET, msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET); if (msgCtx->lastPlayedSong + OCARINA_ACTION_CHECK_MINUET == msgCtx->ocarinaAction) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_03; + play->msgCtx.ocarinaMode = OCARINA_MODE_03; } else { - globalCtx->msgCtx.ocarinaMode = msgCtx->lastPlayedSong - 1; + play->msgCtx.ocarinaMode = msgCtx->lastPlayedSong - 1; } } else { osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("Ocarina_C_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_PLAYBACK_MINUET, msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET); if (msgCtx->lastPlayedSong + OCARINA_ACTION_PLAYBACK_MINUET == msgCtx->ocarinaAction) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_03; + play->msgCtx.ocarinaMode = OCARINA_MODE_03; } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } } osSyncPrintf(VT_RST); - osSyncPrintf("→ OCARINA_MODE=%d\n", globalCtx->msgCtx.ocarinaMode); + osSyncPrintf("→ OCARINA_MODE=%d\n", play->msgCtx.ocarinaMode); } } break; @@ -2540,7 +2540,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } } case MSGMODE_SONG_DEMONSTRATION_DONE: - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SONG_PLAYBACK: msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); @@ -2554,7 +2554,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { msgCtx->ocarinaStaff->state); msgCtx->lastPlayedSong = msgCtx->ocarinaStaff->state; msgCtx->msgMode = MSGMODE_SONG_PLAYBACK_SUCCESS; - Item_Give(globalCtx, ITEM_SONG_MINUET + gOcarinaSongItemMap[msgCtx->ocarinaStaff->state]); + Item_Give(play, ITEM_SONG_MINUET + gOcarinaSongItemMap[msgCtx->ocarinaStaff->state]); osSyncPrintf(VT_FGCOL(YELLOW)); // "z_message.c Song Acquired" osSyncPrintf("z_message.c 取得メロディ=%d\n", ITEM_SONG_MINUET + msgCtx->ocarinaStaff->state); @@ -2568,12 +2568,12 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { msgCtx->stateTimer = 10; msgCtx->msgMode = MSGMODE_SONG_PLAYBACK_FAIL; } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_OCARINA_AWAIT_INPUT: - Message_DrawText(globalCtx, &gfx); - if (Message_ShouldAdvance(globalCtx)) { - func_8010BD58(globalCtx, msgCtx->ocarinaAction); + Message_DrawText(play, &gfx); + if (Message_ShouldAdvance(play)) { + func_8010BD58(play, msgCtx->ocarinaAction); } break; case MSGMODE_SCARECROW_LONG_RECORDING_START: @@ -2586,7 +2586,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { sOcarinaButtonIndexBufLen = 0; Message_ResetOcarinaNoteState(); msgCtx->msgMode = MSGMODE_SCARECROW_LONG_RECORDING_ONGOING; - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SCARECROW_LONG_RECORDING_ONGOING: msgCtx->ocarinaStaff = AudioOcarina_GetRecordingStaff(); @@ -2611,7 +2611,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { } } if (msgCtx->ocarinaStaff->state == OCARINA_RECORD_OFF || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B)) { + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { if (sOcarinaButtonIndexBufLen != 0) { // "Recording complete!!!!!!!!!" osSyncPrintf("録音終了!!!!!!!!! message->info->status=%d \n", @@ -2623,8 +2623,8 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { osSyncPrintf("aaaaaaaaaaaaaa\n"); AudioOcarina_SetRecordingState(OCARINA_RECORD_OFF); msgCtx->stateTimer = 10; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - Message_CloseTextbox(globalCtx); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); // "Recording complete!!!!!!!!!Recording Complete" osSyncPrintf("録音終了!!!!!!!!!録音終了\n"); osSyncPrintf(VT_FGCOL(YELLOW)); @@ -2637,7 +2637,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { osSyncPrintf(VT_RST); osSyncPrintf("\n====================================================================\n"); } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SCARECROW_LONG_PLAYBACK: case MSGMODE_SCARECROW_SPAWN_PLAYBACK: @@ -2662,8 +2662,8 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { if (msgCtx->ocarinaStaff->state == 0) { osSyncPrintf("bbbbbbbbbbb\n"); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_0F; - Message_CloseTextbox(globalCtx); + play->msgCtx.ocarinaMode = OCARINA_MODE_0F; + Message_CloseTextbox(play); } } else { msgCtx->stateTimer--; @@ -2673,7 +2673,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { AudioOcarina_SetRecordingState(OCARINA_RECORD_SCARECROW_SPAWN); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); msgCtx->msgMode = MSGMODE_SCARECROW_SPAWN_RECORDING_ONGOING; - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SCARECROW_SPAWN_RECORDING_ONGOING: msgCtx->ocarinaStaff = AudioOcarina_GetRecordingStaff(); @@ -2701,22 +2701,22 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { osSyncPrintf(VT_RST); osSyncPrintf("\n====================================================================\n"); } else if (msgCtx->ocarinaStaff->state == OCARINA_RECORD_REJECTED || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B)) { + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { // "Played an existing song!!!" osSyncPrintf("すでに存在する曲吹いた!!! \n"); AudioOcarina_SetRecordingState(OCARINA_RECORD_OFF); Audio_PlaySoundGeneral(NA_SE_SY_OCARINA_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); msgCtx->msgMode = MSGMODE_SCARECROW_SPAWN_RECORDING_FAILED; } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_SCARECROW_SPAWN_RECORDING_FAILED: osSyncPrintf("cccccccccccc\n"); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); - Message_StartTextbox(globalCtx, 0x40AD, NULL); // Bonooru doesn't remember your song - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_StartTextbox(play, 0x40AD, NULL); // Bonooru doesn't remember your song + play->msgCtx.ocarinaMode = OCARINA_MODE_04; break; case MSGMODE_MEMORY_GAME_START: AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); @@ -2780,7 +2780,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { Audio_PlaySoundGeneral(NA_SE_SY_OCARINA_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); msgCtx->stateTimer = 10; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_03; + play->msgCtx.ocarinaMode = OCARINA_MODE_03; } else if (msgCtx->ocarinaStaff->state == OCARINA_SONG_MEMORY_GAME) { // "Musical round succeeded!!!!!!!!!" osSyncPrintf("輪唱成功!!!!!!!!!\n"); @@ -2789,7 +2789,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { msgCtx->msgMode = MSGMODE_MEMORY_GAME_ROUND_SUCCESS; msgCtx->stateTimer = 30; } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_MEMORY_GAME_ROUND_SUCCESS: msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); @@ -2808,10 +2808,10 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { Message_ResetOcarinaNoteState(); msgCtx->msgMode = MSGMODE_MEMORY_GAME_START_NEXT_ROUND; } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_0F; + play->msgCtx.ocarinaMode = OCARINA_MODE_0F; } } - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); break; case MSGMODE_MEMORY_GAME_START_NEXT_ROUND: if (!Audio_IsSfxPlaying(NA_SE_SY_METRONOME)) { @@ -2825,7 +2825,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; Message_ResetOcarinaNoteState(); AudioOcarina_Start(sOcarinaSongBitFlags + 0xC000); msgCtx->msgMode = MSGMODE_FROGS_PLAYING; @@ -2841,16 +2841,16 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { case MSGMODE_FROGS_WAITING: break; case MSGMODE_TEXT_DONE: - Message_DrawText(globalCtx, &gfx); + Message_DrawText(play, &gfx); switch (msgCtx->textboxEndType) { case TEXTBOX_ENDTYPE_2_CHOICE: - Message_HandleChoiceSelection(globalCtx, 1); - Message_DrawTextboxIcon(globalCtx, &gfx, msgCtx->textPosX, msgCtx->textPosY); + Message_HandleChoiceSelection(play, 1); + Message_DrawTextboxIcon(play, &gfx, msgCtx->textPosX, msgCtx->textPosY); break; case TEXTBOX_ENDTYPE_3_CHOICE: - Message_HandleChoiceSelection(globalCtx, 2); - Message_DrawTextboxIcon(globalCtx, &gfx, msgCtx->textPosX, msgCtx->textPosY); + Message_HandleChoiceSelection(play, 2); + Message_DrawTextboxIcon(play, &gfx, msgCtx->textPosX, msgCtx->textPosY); break; case TEXTBOX_ENDTYPE_PERSISTENT: if (msgCtx->textId >= 0x6D && msgCtx->textId < 0x73) { @@ -2863,7 +2863,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { break; case TEXTBOX_ENDTYPE_EVENT: default: - Message_DrawTextboxIcon(globalCtx, &gfx, R_TEXTBOX_END_XPOS, R_TEXTBOX_END_YPOS); + Message_DrawTextboxIcon(play, &gfx, R_TEXTBOX_END_XPOS, R_TEXTBOX_END_YPOS); case TEXTBOX_ENDTYPE_FADING: break; } @@ -2979,7 +2979,7 @@ void Message_DrawDebugVariableChanged(s16* var, GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../z_message_PAL.c", 3513); } -void Message_DrawDebugText(GlobalContext* globalCtx, Gfx** p) { +void Message_DrawDebugText(PlayState* play, Gfx** p) { s32 pad; GfxPrint printer; s32 pad1; @@ -2992,24 +2992,24 @@ void Message_DrawDebugText(GlobalContext* globalCtx, Gfx** p) { GfxPrint_SetPos(&printer, 14, 26); GfxPrint_Printf(&printer, "%s", "="); GfxPrint_SetPos(&printer, 16, 26); - GfxPrint_Printf(&printer, "%x", globalCtx->msgCtx.textId); + GfxPrint_Printf(&printer, "%x", play->msgCtx.textId); *p = GfxPrint_Close(&printer); GfxPrint_Destroy(&printer); } -void Message_Draw(GlobalContext* globalCtx) { +void Message_Draw(PlayState* play) { Gfx* plusOne; Gfx* polyOpaP; s16 watchVar; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_message_PAL.c", 3554); + OPEN_DISPS(play->state.gfxCtx, "../z_message_PAL.c", 3554); watchVar = gSaveContext.scarecrowLongSongSet; - Message_DrawDebugVariableChanged(&watchVar, globalCtx->state.gfxCtx); - if (BREG(0) != 0 && globalCtx->msgCtx.textId != 0) { + Message_DrawDebugVariableChanged(&watchVar, play->state.gfxCtx); + if (BREG(0) != 0 && play->msgCtx.textId != 0) { plusOne = Graph_GfxPlusOne(polyOpaP = POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, plusOne); - Message_DrawDebugText(globalCtx, &plusOne); + Message_DrawDebugText(play, &plusOne); gSPEndDisplayList(plusOne++); Graph_BranchDlist(polyOpaP, plusOne); POLY_OPA_DISP = plusOne; @@ -3017,14 +3017,14 @@ void Message_Draw(GlobalContext* globalCtx) { if (1) {} plusOne = Graph_GfxPlusOne(polyOpaP = POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, plusOne); - Message_DrawMain(globalCtx, &plusOne); + Message_DrawMain(play, &plusOne); gSPEndDisplayList(plusOne++); Graph_BranchDlist(polyOpaP, plusOne); POLY_OPA_DISP = plusOne; - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_message_PAL.c", 3582); + CLOSE_DISPS(play->state.gfxCtx, "../z_message_PAL.c", 3582); } -void Message_Update(GlobalContext* globalCtx) { +void Message_Update(PlayState* play) { static s16 sTextboxXPositions[] = { 34, 34, 34, 34, 34, 34, }; @@ -3047,10 +3047,10 @@ void Message_Update(GlobalContext* globalCtx) { }; static u8 D_80153D74 = 0; static u16 D_80153D78 = 0; - MessageContext* msgCtx = &globalCtx->msgCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - Player* player = GET_PLAYER(globalCtx); - Input* input = &globalCtx->state.input[0]; + MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + Input* input = &play->state.input[0]; s16 var; s16 focusScreenPosX; s16 averageY; @@ -3060,7 +3060,7 @@ void Message_Update(GlobalContext* globalCtx) { if (BREG(0) != 0) { if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN) && CHECK_BTN_ALL(input->cur.button, BTN_L)) { osSyncPrintf("msgno=%d\n", D_80153D78); - Message_StartTextbox(globalCtx, R_MESSAGE_DEBUGGER_TEXTID, NULL); + Message_StartTextbox(play, R_MESSAGE_DEBUGGER_TEXTID, NULL); D_80153D78 = (D_80153D78 + 1) % 10; } if (R_MESSAGE_DEBUGGER_SELECT != 0) { @@ -3071,7 +3071,7 @@ void Message_Update(GlobalContext* globalCtx) { if (entry->textId == R_MESSAGE_DEBUGGER_TEXTID) { // "The message was found! !! !!" osSyncPrintf(" メッセージが,見つかった!!! = %x\n", R_MESSAGE_DEBUGGER_TEXTID); - Message_StartTextbox(globalCtx, R_MESSAGE_DEBUGGER_TEXTID, NULL); + Message_StartTextbox(play, R_MESSAGE_DEBUGGER_TEXTID, NULL); R_MESSAGE_DEBUGGER_TEXTID++; R_MESSAGE_DEBUGGER_SELECT = 0; return; @@ -3096,7 +3096,7 @@ void Message_Update(GlobalContext* globalCtx) { if (D_8014B2F4 >= 4) { var = true; } - } else if (YREG(15) != 0 || globalCtx->sceneNum == SCENE_HAIRAL_NIWA) { + } else if (YREG(15) != 0 || play->sceneNum == SCENE_HAIRAL_NIWA) { var = true; } else if (D_8014B2F4 >= 4 || msgCtx->talkActor == NULL) { var = true; @@ -3104,9 +3104,8 @@ void Message_Update(GlobalContext* globalCtx) { if (var) { if (msgCtx->talkActor != NULL) { - Actor_GetScreenPos(globalCtx, &GET_PLAYER(globalCtx)->actor, &focusScreenPosX, - &playerFocusScreenPosY); - Actor_GetScreenPos(globalCtx, msgCtx->talkActor, &focusScreenPosX, &actorFocusScreenPosY); + Actor_GetScreenPos(play, &GET_PLAYER(play)->actor, &focusScreenPosX, &playerFocusScreenPosY); + Actor_GetScreenPos(play, msgCtx->talkActor, &focusScreenPosX, &actorFocusScreenPosY); if (playerFocusScreenPosY >= actorFocusScreenPosY) { averageY = ((playerFocusScreenPosY - actorFocusScreenPosY) / 2) + actorFocusScreenPosY; @@ -3123,14 +3122,14 @@ void Message_Update(GlobalContext* globalCtx) { var = msgCtx->textBoxType; if (!msgCtx->textBoxPos) { // variable position - if (YREG(15) != 0 || globalCtx->sceneNum == SCENE_HAIRAL_NIWA) { + if (YREG(15) != 0 || play->sceneNum == SCENE_HAIRAL_NIWA) { if (averageY < XREG(92)) { R_TEXTBOX_Y_TARGET = sTextboxMidYPositions[var]; } else { R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var]; } - } else if (globalCtx->sceneNum == SCENE_MARKET_DAY || globalCtx->sceneNum == SCENE_MARKET_NIGHT || - globalCtx->sceneNum == SCENE_MARKET_RUINS) { + } else if (play->sceneNum == SCENE_MARKET_DAY || play->sceneNum == SCENE_MARKET_NIGHT || + play->sceneNum == SCENE_MARKET_RUINS) { if (averageY < XREG(93)) { R_TEXTBOX_Y_TARGET = sTextboxMidYPositions[var]; } else { @@ -3182,11 +3181,11 @@ void Message_Update(GlobalContext* globalCtx) { case MSGMODE_TEXT_STARTING: msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG; if (YREG(31) == 0) { - Interface_SetDoAction(globalCtx, DO_ACTION_NEXT); + Interface_SetDoAction(play, DO_ACTION_NEXT); } break; case MSGMODE_TEXT_NEXT_MSG: - Message_Decode(globalCtx); + Message_Decode(play); if (sTextFade) { Interface_ChangeAlpha(1); } @@ -3198,18 +3197,18 @@ void Message_Update(GlobalContext* globalCtx) { case MSGMODE_TEXT_CONTINUING: msgCtx->stateTimer--; if (msgCtx->stateTimer == 0) { - Message_Decode(globalCtx); + Message_Decode(play); } break; case MSGMODE_TEXT_DISPLAYING: if (msgCtx->textBoxType != TEXTBOX_TYPE_NONE_BOTTOM && YREG(31) == 0 && - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B) && !msgCtx->textUnskippable) { + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B) && !msgCtx->textUnskippable) { sTextboxSkipped = true; msgCtx->textDrawPos = msgCtx->decodedTextLen; } break; case MSGMODE_TEXT_AWAIT_INPUT: - if (YREG(31) == 0 && Message_ShouldAdvance(globalCtx)) { + if (YREG(31) == 0 && Message_ShouldAdvance(play)) { msgCtx->msgMode = MSGMODE_TEXT_DISPLAYING; msgCtx->textDrawPos++; } @@ -3221,7 +3220,7 @@ void Message_Update(GlobalContext* globalCtx) { } break; case MSGMODE_TEXT_AWAIT_NEXT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG; msgCtx->textUnskippable = false; msgCtx->msgBufPos++; @@ -3231,30 +3230,29 @@ void Message_Update(GlobalContext* globalCtx) { if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADING) { msgCtx->stateTimer--; if (msgCtx->stateTimer == 0) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } } else if (msgCtx->textboxEndType != TEXTBOX_ENDTYPE_PERSISTENT && msgCtx->textboxEndType != TEXTBOX_ENDTYPE_EVENT && YREG(31) == 0) { - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_2_CHOICE && - globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { - if (Message_ShouldAdvance(globalCtx)) { - osSyncPrintf("OCARINA_MODE=%d -> ", globalCtx->msgCtx.ocarinaMode); - globalCtx->msgCtx.ocarinaMode = (msgCtx->choiceIndex == 0) ? OCARINA_MODE_02 : OCARINA_MODE_04; + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_2_CHOICE && play->msgCtx.ocarinaMode == OCARINA_MODE_01) { + if (Message_ShouldAdvance(play)) { + osSyncPrintf("OCARINA_MODE=%d -> ", play->msgCtx.ocarinaMode); + play->msgCtx.ocarinaMode = (msgCtx->choiceIndex == 0) ? OCARINA_MODE_02 : OCARINA_MODE_04; osSyncPrintf("InRaceSeq=%d(%d) OCARINA_MODE=%d --> ", GET_EVENTINF_HORSES_STATE(), 1, - globalCtx->msgCtx.ocarinaMode); - Message_CloseTextbox(globalCtx); - osSyncPrintf("OCARINA_MODE=%d\n", globalCtx->msgCtx.ocarinaMode); + play->msgCtx.ocarinaMode); + Message_CloseTextbox(play); + osSyncPrintf("OCARINA_MODE=%d\n", play->msgCtx.ocarinaMode); } - } else if (Message_ShouldAdvanceSilent(globalCtx)) { + } else if (Message_ShouldAdvanceSilent(play)) { osSyncPrintf("select=%d\n", msgCtx->textboxEndType); if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_HAS_NEXT) { Audio_PlaySoundGeneral(NA_SE_SY_MESSAGE_PASS, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - Message_ContinueTextbox(globalCtx, sNextTextId); + Message_ContinueTextbox(play, sNextTextId); } else { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } } } @@ -3273,15 +3271,15 @@ void Message_Update(GlobalContext* globalCtx) { msgCtx->textId == 0x2015 || msgCtx->textId == 0x3040) { gSaveContext.unk_13EE = 0x32; } - if (globalCtx->csCtx.state == 0) { + if (play->csCtx.state == 0) { osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("day_time=%x active_camera=%d ", gSaveContext.cutsceneIndex, globalCtx->activeCamId); + osSyncPrintf("day_time=%x active_camera=%d ", gSaveContext.cutsceneIndex, play->activeCamId); if (msgCtx->textId != 0x2061 && msgCtx->textId != 0x2025 && msgCtx->textId != 0x208C && ((msgCtx->textId < 0x88D || msgCtx->textId >= 0x893) || msgCtx->choiceIndex != 0) && (msgCtx->textId != 0x3055 && gSaveContext.cutsceneIndex < 0xFFF0)) { osSyncPrintf("=== day_time=%x ", ((void)0, gSaveContext.cutsceneIndex)); - if (globalCtx->activeCamId == CAM_ID_MAIN) { + if (play->activeCamId == CAM_ID_MAIN) { if (gSaveContext.unk_13EE == 0 || gSaveContext.unk_13EE == 1 || gSaveContext.unk_13EE == 2) { gSaveContext.unk_13EE = 0x32; } @@ -3298,7 +3296,7 @@ void Message_Update(GlobalContext* globalCtx) { if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_PERSISTENT) { msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_02; + play->msgCtx.ocarinaMode = OCARINA_MODE_02; } else { msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; } @@ -3317,16 +3315,15 @@ void Message_Update(GlobalContext* globalCtx) { player->naviActor->flags |= 0x10000; } if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE && - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01 || - globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_0B)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + (play->msgCtx.ocarinaMode == OCARINA_MODE_01 || play->msgCtx.ocarinaMode == OCARINA_MODE_0B)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; if (msgCtx->unk_E3F2 == OCARINA_SONG_SUNS) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01; + play->msgCtx.ocarinaMode = OCARINA_MODE_01; } } } sLastPlayedSong = 0xFF; - osSyncPrintf("OCARINA_MODE=%d chk_ocarina_no=%d\n", globalCtx->msgCtx.ocarinaMode, msgCtx->unk_E3F2); + osSyncPrintf("OCARINA_MODE=%d chk_ocarina_no=%d\n", play->msgCtx.ocarinaMode, msgCtx->unk_E3F2); break; case MSGMODE_PAUSED: break; diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 0eb0b946c6..832caf2541 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -56,10 +56,10 @@ void OnePointCutscene_SetCsCamPoints(Camera* camera, s16 actionParameters, s16 i onePointCamData->initTimer = initTimer; } -s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, Actor* actor, s16 timer) { - Camera* subCam = globalCtx->cameraPtrs[subCamId]; - Camera* childCam = globalCtx->cameraPtrs[subCam->childCamId]; - Camera* mainCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; +s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* actor, s16 timer) { + Camera* subCam = play->cameraPtrs[subCamId]; + Camera* childCam = play->cameraPtrs[subCam->childCamId]; + Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; Player* player = mainCam->player; VecSph spD0; s32 i; @@ -75,9 +75,9 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A if (timer < 20) { timer = 20; } - D_801208EC[0].atTargetInit = globalCtx->view.at; - D_801208EC[0].eyeTargetInit = globalCtx->view.eye; - D_801208EC[0].fovTargetInit = globalCtx->view.fovy; + D_801208EC[0].atTargetInit = play->view.at; + D_801208EC[0].eyeTargetInit = play->view.eye; + D_801208EC[0].fovTargetInit = play->view.fovy; D_801208EC[1].atTargetInit = mainCam->at; D_801208EC[1].eyeTargetInit = mainCam->eye; D_801208EC[1].fovTargetInit = mainCam->fov; @@ -88,12 +88,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_801208EC; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 1030: - D_80120964[0].atTargetInit = globalCtx->view.at; - D_80120964[0].eyeTargetInit = globalCtx->view.eye; - D_80120964[0].fovTargetInit = globalCtx->view.fovy; + D_80120964[0].atTargetInit = play->view.at; + D_80120964[0].eyeTargetInit = play->view.eye; + D_80120964[0].fovTargetInit = play->view.fovy; OLib_Vec3fDiffToVecSphGeo(&spD0, &mainCam->at, &mainCam->eye); D_80120964[1].eyeTargetInit.y = CAM_BINANG_TO_DEG(spD0.yaw); D_80120964[1].timerInit = timer - 1; @@ -101,12 +101,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80120964; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 5000: - D_801209B4[0].atTargetInit = D_801209B4[1].atTargetInit = globalCtx->view.at; - D_801209B4[0].eyeTargetInit = globalCtx->view.eye; - D_801209B4[0].fovTargetInit = D_801209B4[2].fovTargetInit = globalCtx->view.fovy; + D_801209B4[0].atTargetInit = D_801209B4[1].atTargetInit = play->view.at; + D_801209B4[0].eyeTargetInit = play->view.eye; + D_801209B4[0].fovTargetInit = D_801209B4[2].fovTargetInit = play->view.fovy; OLib_Vec3fDiffToVecSphGeo(&spD0, &actor->focus.pos, &mainCam->at); spD0.r = mainCam->dist; OnePointCutscene_AddVecSphToVec3f(&D_801209B4[1].eyeTargetInit, &D_801209B4[1].atTargetInit, &spD0); @@ -115,29 +115,29 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_801209B4; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 5010: - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_ATTENTION); - Play_CameraSetAtEye(globalCtx, subCamId, &mainCam->at, &mainCam->eye); + func_800C0808(play, subCamId, player, CAM_SET_CS_ATTENTION); + Play_CameraSetAtEye(play, subCamId, &mainCam->at, &mainCam->eye); subCam->roll = 0; break; case 9500: csInfo->keyFrames = D_80120A54; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 2260: D_80120ACC[0].atTargetInit.x = D_80120ACC[2].atTargetInit.x = - ((mainCam->globalCtx->state.frames & 1) ? -10.0f : 10.0f) + (Rand_ZeroOne() * 8.0f); + ((mainCam->play->state.frames & 1) ? -10.0f : 10.0f) + (Rand_ZeroOne() * 8.0f); D_80120ACC[0].eyeTargetInit.x = D_80120ACC[2].eyeTargetInit.x = - ((mainCam->globalCtx->state.frames & 1) ? 20.0f : -20.0f) + (Rand_ZeroOne() * 5.0f); + ((mainCam->play->state.frames & 1) ? 20.0f : -20.0f) + (Rand_ZeroOne() * 5.0f); csInfo->keyFrames = D_80120ACC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 2270: csInfo->keyFrames = D_80120B94; @@ -153,8 +153,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A } D_80120B94[subCamId - 1].eyeTargetInit.y = - ((mainCam->globalCtx->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + ((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 5); Quake_SetSpeed(i, 400); @@ -174,8 +174,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A } } D_80120D4C[subCamId - 1].eyeTargetInit.y = - ((mainCam->globalCtx->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + ((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 5); Quake_SetSpeed(i, 400); @@ -186,7 +186,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80120E64; csInfo->keyFrameCnt = 8; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 5); Quake_SetSpeed(i, 400); @@ -202,13 +202,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80120FA4; csInfo->keyFrameCnt = 6; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 2340: csInfo->keyFrames = D_80121094; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 5); Quake_SetSpeed(i, 400); @@ -219,7 +219,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_8012110C; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 2200: { s16 sp82; @@ -227,15 +227,15 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A s16 sp7E; s16 sp7C; - Actor_GetScreenPos(globalCtx, &player->actor, &sp82, &sp7E); - Actor_GetScreenPos(globalCtx, actor, &sp80, &sp7C); + Actor_GetScreenPos(play, &player->actor, &sp82, &sp7E); + Actor_GetScreenPos(play, actor, &sp80, &sp7C); if ((sp82 > 0) && (sp82 < 320) && (sp7E > 0) && (sp7E < 240) && (sp80 > 0) && (sp80 < 320) && (sp7C > 0) && (sp7C < 240) && - !OnePointCutscene_BgCheckLineTest(&globalCtx->colCtx, &actor->focus.pos, &player->actor.focus.pos)) { - D_80121184[0].atTargetInit.x = (globalCtx->view.at.x + actor->focus.pos.x) * 0.5f; - D_80121184[0].atTargetInit.y = (globalCtx->view.at.y + actor->focus.pos.y) * 0.5f; - D_80121184[0].atTargetInit.z = (globalCtx->view.at.z + actor->focus.pos.z) * 0.5f; - D_80121184[0].eyeTargetInit = globalCtx->view.eye; + !OnePointCutscene_BgCheckLineTest(&play->colCtx, &actor->focus.pos, &player->actor.focus.pos)) { + D_80121184[0].atTargetInit.x = (play->view.at.x + actor->focus.pos.x) * 0.5f; + D_80121184[0].atTargetInit.y = (play->view.at.y + actor->focus.pos.y) * 0.5f; + D_80121184[0].atTargetInit.z = (play->view.at.z + actor->focus.pos.z) * 0.5f; + D_80121184[0].eyeTargetInit = play->view.eye; D_80121184[0].eyeTargetInit.y = player->actor.focus.pos.y + 20.0f; D_80121184[0].fovTargetInit = mainCam->fov * 0.75f; @@ -255,13 +255,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_801211D4; csInfo->keyFrameCnt = 2; } - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_UNK3); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); } break; case 2290: { Actor* rideActor = player->rideActor; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); if (rideActor != NULL) { rideActor->freezeTimer = 180; } @@ -269,42 +269,42 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80121224; csInfo->keyFrameCnt = 6; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); } break; case 5120: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); csInfo->keyFrames = D_80121314; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4510: D_8012133C[0].eyeTargetInit = actor->world.pos; D_8012133C[0].eyeTargetInit.y = player->actor.world.pos.y + 40.0f; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); csInfo->keyFrames = D_8012133C; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4500: Actor_GetFocus(&spA0, actor); spC0 = spA0.pos; - spC0.y = OnePointCutscene_RaycastFloor(&globalCtx->colCtx, &spC0) + 40.0f; + spC0.y = OnePointCutscene_RaycastFloor(&play->colCtx, &spC0) + 40.0f; spD0.r = 150.0f; spD0.yaw = spA0.rot.y; spD0.pitch = 0x3E8; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); - func_8002DF54(globalCtx, NULL, 8); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); + Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + func_8002DF54(play, NULL, 8); subCam->roll = 0; subCam->fov = 50.0f; if (subCam->childCamId != CAM_ID_MAIN) { - OnePointCutscene_EndCutscene(globalCtx, subCam->childCamId); + OnePointCutscene_EndCutscene(play, subCam->childCamId); } break; case 2210: @@ -314,34 +314,34 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A if (Rand_ZeroOne() < 0.0f) { D_801213B4[3].eyeTargetInit.x = -D_801213B4[3].eyeTargetInit.x; } - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); csInfo->keyFrames = D_801213B4; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 1010: - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(globalCtx, subCamId, &childCam->at, &childCam->eye); - Play_CameraSetFov(globalCtx, subCamId, childCam->fov); - Play_SetCameraRoll(globalCtx, subCamId, childCam->roll); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); + Play_CameraSetAtEye(play, subCamId, &childCam->at, &childCam->eye); + Play_CameraSetFov(play, subCamId, childCam->fov); + Play_SetCameraRoll(play, subCamId, childCam->roll); break; case 9601: - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_CS_3); - Play_CameraChangeSetting(globalCtx, CAM_ID_MAIN, mainCam->prevSetting); + Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3); + Play_CameraChangeSetting(play, CAM_ID_MAIN, mainCam->prevSetting); OnePointCutscene_SetCsCamPoints(subCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120398); break; case 9602: - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_CS_3); - Play_CameraChangeSetting(globalCtx, CAM_ID_MAIN, mainCam->prevSetting); + Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3); + Play_CameraChangeSetting(play, CAM_ID_MAIN, mainCam->prevSetting); OnePointCutscene_SetCsCamPoints(subCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120434); break; case 4175: csInfo->keyFrames = D_8012147C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4180: spC0.x = -1881.0f; @@ -350,24 +350,24 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A spB4.x = -1979.0f; spB4.y = 703.0f; spB4.z = -269.0f; - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); + Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 6; subCam->fov = 75.0f; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); break; case 3040: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); D_8012151C[0].timerInit = timer - 1; csInfo->keyFrames = D_8012151C; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3020: D_8012156C[1].timerInit = timer - 1; - if (mainCam->globalCtx->state.frames & 1) { + if (mainCam->play->state.frames & 1) { D_8012156C[0].atTargetInit.x = -D_8012156C[0].atTargetInit.x; D_8012156C[0].eyeTargetInit.x = -D_8012156C[0].eyeTargetInit.x; D_8012156C[1].atTargetInit.x = -D_8012156C[1].atTargetInit.x; @@ -380,8 +380,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_8012156C; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - func_8002DF54(globalCtx, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); break; case 3010: D_801215BC[0].timerInit = timer; @@ -389,13 +389,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_801215BC; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3070: csInfo->keyFrames = D_801215E4; csInfo->keyFrameCnt = 10; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 22000); @@ -406,34 +406,34 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80121774; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3090: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); csInfo->keyFrames = D_80121814; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3100: VEC_SET(spB4, 0.0f, -280.0f, -1400.0f); Actor_GetFocus(&spA0, actor); spC0 = spA0.pos; - func_800C0808(globalCtx, subCamId, player, CAM_SET_PIVOT_VERTICAL); - Play_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + func_800C0808(play, subCamId, player, CAM_SET_PIVOT_VERTICAL); + Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 70.0f; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); break; case 3380: case 3065: csInfo->keyFrames = D_801218B4; csInfo->keyFrameCnt = 2; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 24000); @@ -444,12 +444,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80121904; csInfo->keyFrameCnt = 2; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3050: - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_CS_3); - func_8002DF54(globalCtx, &player->actor, 5); + Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3); + func_8002DF54(play, &player->actor, 5); OnePointCutscene_SetCsCamPoints(subCam, D_80120304 | 0x2000, D_80120300, D_8012013C, D_8012021C); func_80078884(NA_SE_SY_CORRECT_CHIME); OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_8012013C[D_801202FC - 2].pos); @@ -478,26 +478,26 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A subCam->unk_14C |= 2; csInfo->keyFrameCnt = 2; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3130: csInfo->keyFrames = D_80121A44; csInfo->keyFrameCnt = 12; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); subCam->unk_14C |= 2; break; case 3140: - D_80121C24[0].atTargetInit = globalCtx->view.at; - D_80121C24[0].eyeTargetInit = globalCtx->view.eye; - D_80121C24[0].fovTargetInit = globalCtx->view.fovy; + D_80121C24[0].atTargetInit = play->view.at; + D_80121C24[0].eyeTargetInit = play->view.eye; + D_80121C24[0].fovTargetInit = play->view.fovy; csInfo->keyFrames = D_80121C24; csInfo->keyFrameCnt = 7; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3150: spC0.x = 1890.0f; @@ -506,11 +506,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A spB4.x = 1729.0f; spB4.y = 995.0f; spB4.z = -1405.0f; - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); + Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0x50; subCam->fov = 55.0f; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); break; case 3170: Actor_GetWorld(&spA0, actor); @@ -521,12 +521,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A Actor_GetWorld(&spA0, &player->actor); spD0.yaw = OnePointCutscene_Vec3fYaw(&spC0, &spA0.pos) - 0x7D0; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); - Play_CopyCamera(globalCtx, CAM_ID_MAIN, subCamId); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); + Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + Play_CopyCamera(play, CAM_ID_MAIN, subCamId); subCam->roll = -1; subCam->fov = 55.0f; - func_8002DF38(globalCtx, actor, 1); + func_8002DF38(play, actor, 1); break; case 3160: Actor_GetWorld(&spA0, actor); @@ -535,11 +535,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A spD0.yaw = spA0.rot.y; spD0.r = 150.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); + Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 55.0f; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); break; case 3180: Actor_GetWorldPosShapeRot(&spA0, actor); @@ -549,16 +549,16 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A spD0.yaw = spA0.rot.y; spD0.pitch = -0xAF0; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); + Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 60.0f; - func_8002DF38(globalCtx, actor, 1); + func_8002DF38(play, actor, 1); break; case 3190: - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FOREST_DEFEAT_POE); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FOREST_DEFEAT_POE); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_8002DF38(globalCtx, actor, 0xC); + func_8002DF38(play, actor, 0xC); break; case 3230: spC0.x = 120.0f; @@ -567,11 +567,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A spB4.x = 80.0f; spB4.y = 445.0f; spB4.z = -1425.0f; - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); + Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0x1E; subCam->fov = 75.0f; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); Actor_GetWorldPosShapeRot(&spA0, actor); Actor_GetFocus(&sp8C, &player->actor); spC0.x = sp8C.pos.x; @@ -581,7 +581,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A spD0.pitch = 0x5DC; spD0.r = 120.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Play_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &spC0, &spB4); + Play_CameraSetAtEye(play, CAM_ID_MAIN, &spC0, &spB4); i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 22000); @@ -596,27 +596,27 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A spD0.yaw = spA0.rot.y + 0x7FFF; spD0.r = 300.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); + Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 45.0f; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); break; case 3220: Actor_GetFocus(&spA0, actor); spC0 = spA0.pos; - func_800C0808(globalCtx, subCamId, player, CAM_SET_PIVOT_VERTICAL); + func_800C0808(play, subCamId, player, CAM_SET_PIVOT_VERTICAL); Actor_GetWorld(&spA0, &player->actor); OLib_Vec3fDiffToVecSphGeo(&spD0, &spC0, &spA0.pos); spD0.yaw += 0x3E8; spD0.r = 400.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); spB4.y = spA0.pos.y + 60.0f; - Play_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 75.0f; player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = spD0.yaw + 0x7FFF; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); break; case 3240: D_80121D3C[2].timerInit = timer - 5; @@ -624,12 +624,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80121D3C; csInfo->keyFrameCnt = 3; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 6001: - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_CS_3); - func_8002DF54(globalCtx, NULL, 8); + Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3); + func_8002DF54(play, NULL, 8); Actor_GetWorld(&spA0, actor); if (spA0.pos.z > -750.0f) { OnePointCutscene_SetCsCamPoints(subCam, D_801208E8, D_801208E4, D_801206A0, D_80120820); @@ -643,8 +643,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A Quake_SetCountdown(i, D_801208E4 - 10); break; case 3400: - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_CS_3); - func_8002DF38(globalCtx, &player->actor, 8); + Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3); + func_8002DF38(play, &player->actor, 8); OnePointCutscene_SetCsCamPoints(subCam, D_8012069C | 0x2000, D_80120698, D_801204D4, D_801205B4); OnePointCutscene_Vec3sToVec3f(&mainCam->eye, &D_801205B4[D_80120694 - 2].pos); OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_801204D4[D_80120694 - 2].pos); @@ -660,13 +660,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80121DB4; csInfo->keyFrameCnt = 9; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3310: - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FIRE_STAIRCASE); - func_8002DF54(globalCtx, NULL, 8); - Play_CopyCamera(globalCtx, subCamId, CAM_ID_MAIN); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FIRE_STAIRCASE); + func_8002DF54(play, NULL, 8); + Play_CopyCamera(play, subCamId, CAM_ID_MAIN); i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 32000); @@ -674,16 +674,16 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A Quake_SetCountdown(i, timer); break; case 3290: - D_80121F1C[0].atTargetInit = globalCtx->view.at; - D_80121F1C[0].eyeTargetInit = globalCtx->view.eye; - D_80121F1C[0].fovTargetInit = globalCtx->view.fovy; + D_80121F1C[0].atTargetInit = play->view.at; + D_80121F1C[0].eyeTargetInit = play->view.eye; + D_80121F1C[0].fovTargetInit = play->view.fovy; Actor_GetFocus(&spA0, actor); player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = spA0.rot.y; csInfo->keyFrames = D_80121F1C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 12000); @@ -691,15 +691,15 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A Quake_SetCountdown(i, 5); break; case 3340: - D_80121FBC[0].atTargetInit = globalCtx->view.at; - D_80121FBC[0].eyeTargetInit = globalCtx->view.eye; - D_80121FBC[0].fovTargetInit = globalCtx->view.fovy; + D_80121FBC[0].atTargetInit = play->view.at; + D_80121FBC[0].eyeTargetInit = play->view.eye; + D_80121FBC[0].fovTargetInit = play->view.fovy; csInfo->keyFrames = D_80121FBC; csInfo->keyFrameCnt = 4; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 12000); @@ -710,13 +710,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_8012205C; csInfo->keyFrameCnt = 3; - func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF38(play, &player->actor, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3350: - D_801220D4[0].atTargetInit = globalCtx->view.at; - D_801220D4[0].eyeTargetInit = globalCtx->view.eye; - D_801220D4[0].fovTargetInit = globalCtx->view.fovy; + D_801220D4[0].atTargetInit = play->view.at; + D_801220D4[0].eyeTargetInit = play->view.eye; + D_801220D4[0].fovTargetInit = play->view.fovy; if (actor->world.pos.x > 0.0f) { D_801220D4[1].rollTargetInit = -D_801220D4[1].rollTargetInit; D_801220D4[2].rollTargetInit = -D_801220D4[2].rollTargetInit; @@ -725,26 +725,26 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A D_801220D4[1].eyeTargetInit.y = 80.0f; D_801220D4[1].eyeTargetInit.x = -D_801220D4[1].eyeTargetInit.x; } - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); csInfo->keyFrames = D_801220D4; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3330: csInfo->keyFrames = D_8012219C; csInfo->keyFrameCnt = 7; - func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF38(play, &player->actor, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3410: csInfo->keyFrames = D_801222B4; csInfo->keyFrameCnt = 5; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 32000); @@ -755,8 +755,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_8012237C; csInfo->keyFrameCnt = 2; - func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF38(play, &player->actor, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 32000); @@ -767,8 +767,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_801223CC; csInfo->keyFrameCnt = 6; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); player->stateFlags1 |= PLAYER_STATE1_29; player->actor.freezeTimer = 90; @@ -781,8 +781,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_801224BC; csInfo->keyFrameCnt = 7; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 32000); @@ -794,70 +794,70 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrameCnt = 5; player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = 0x3FFC; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - func_8002DF54(globalCtx, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); break; case 4110: csInfo->keyFrames = D_8012269C; csInfo->keyFrameCnt = 3; - func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF38(play, &player->actor, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4120: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); D_80122714[1].timerInit = 80; csInfo->keyFrames = D_80122714; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4140: csInfo->keyFrames = D_801227B4; csInfo->keyFrameCnt = 6; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); break; case 4150: csInfo->keyFrames = D_801228A4; csInfo->keyFrameCnt = 5; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4160: csInfo->keyFrames = D_8012296C; csInfo->keyFrameCnt = 4; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4170: csInfo->keyFrames = D_80122A0C; csInfo->keyFrameCnt = 2; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4190: csInfo->keyFrames = D_80122A5C; csInfo->keyFrameCnt = 8; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4200: csInfo->keyFrames = D_80122B9C; csInfo->keyFrameCnt = 3; - func_8002DF38(globalCtx, &player->actor, 8); + func_8002DF38(play, &player->actor, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4210: player->actor.freezeTimer = timer; @@ -865,7 +865,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80122C14; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 12000); @@ -876,8 +876,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = (player->actor.world.pos.z < -15.0f) ? D_80122C3C : D_80122C64; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - func_8002DF38(globalCtx, &player->actor, 1); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); + func_8002DF38(play, &player->actor, 1); i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 12000); @@ -888,38 +888,38 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80122C8C; csInfo->keyFrameCnt = 1; - func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_8002DF54(play, NULL, 8); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3260: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); D_80122CB4[1].timerInit = timer - 5; csInfo->keyFrames = D_80122CB4; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 3261: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); D_80122D04[1].timerInit = timer - 10; csInfo->keyFrames = D_80122D04; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 8010: csInfo->keyFrames = D_80122D54; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 8002: csInfo->keyFrames = D_80122DCC; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 8700: Actor_GetFocus(&spA0, actor); @@ -930,16 +930,16 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80122E44[timer & 1]; csInfo->keyFrameCnt = 7; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 1100: { - s32 tempDiff = globalCtx->state.frames - sPrevFrameCs1100; + s32 tempDiff = play->state.frames - sPrevFrameCs1100; if ((tempDiff > 3600) || (tempDiff < -3600)) { csInfo->keyFrames = D_80123074; csInfo->keyFrameCnt = 5; } else { - if (globalCtx->state.frames & 1) { + if (play->state.frames & 1) { D_8012313C[0].rollTargetInit = -D_8012313C[0].rollTargetInit; D_8012313C[0].atTargetInit.y = -D_8012313C[0].atTargetInit.y; D_8012313C[0].eyeTargetInit.y = -D_8012313C[0].eyeTargetInit.y; @@ -948,22 +948,22 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_8012313C; csInfo->keyFrameCnt = 3; } - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - sPrevFrameCs1100 = globalCtx->state.frames; + func_800C0808(play, subCamId, player, CAM_SET_CS_C); + sPrevFrameCs1100 = play->state.frames; } break; case 9806: subCam->timer = -99; - if (func_800C0CB8(globalCtx)) { - func_800C0808(globalCtx, subCamId, player, CAM_SET_TURN_AROUND); + if (func_800C0CB8(play)) { + func_800C0808(play, subCamId, player, CAM_SET_TURN_AROUND); subCam->data2 = 0xC; } else { - Play_CopyCamera(globalCtx, subCamId, CAM_ID_MAIN); - Play_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); + Play_CopyCamera(play, subCamId, CAM_ID_MAIN); + Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); } break; case 9908: - if (func_800C0CB8(globalCtx)) { + if (func_800C0CB8(play)) { D_801231B4[0].eyeTargetInit.z = D_801231B4[1].eyeTargetInit.z = !LINK_IS_ADULT ? 100.0f : 120.0f; if (player->stateFlags1 & PLAYER_STATE1_27) { @@ -982,7 +982,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_801231B4; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); } else { D_80123254[1].timerInit = timer - 1; D_80123254[0].fovTargetInit = mainCam->fov; @@ -992,60 +992,60 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80123254; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); } break; case 1000: - D_801232A4[0].atTargetInit = globalCtx->view.at; - D_801232A4[0].eyeTargetInit = globalCtx->view.eye; - D_801232A4[0].fovTargetInit = globalCtx->view.fovy; + D_801232A4[0].atTargetInit = play->view.at; + D_801232A4[0].eyeTargetInit = play->view.eye; + D_801232A4[0].fovTargetInit = play->view.fovy; csInfo->keyFrames = D_801232A4; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 8603: csInfo->keyFrames = D_801232CC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 8604: csInfo->keyFrames = D_80123394; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4000: csInfo->keyFrames = D_8012345C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4010: csInfo->keyFrames = D_801234FC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4011: csInfo->keyFrames = D_801235C4; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4020: csInfo->keyFrames = D_8012368C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4021: csInfo->keyFrames = D_8012372C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 4022: subCam->timer = D_801237CC[0].timerInit + D_801237CC[3].timerInit + D_801237CC[1].timerInit + @@ -1054,12 +1054,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_801237CC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 9703: - D_80123894[0].atTargetInit = globalCtx->view.at; - D_80123894[0].eyeTargetInit = globalCtx->view.eye; - D_80123894[0].fovTargetInit = globalCtx->view.fovy; + D_80123894[0].atTargetInit = play->view.at; + D_80123894[0].eyeTargetInit = play->view.eye; + D_80123894[0].fovTargetInit = play->view.fovy; if (LINK_IS_ADULT) { D_80123894[1].atTargetInit.y = 60.0f; D_80123894[1].eyeTargetInit.y = 52.0f; @@ -1068,27 +1068,27 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_80123894; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 9704: - D_8012390C[0].atTargetInit = globalCtx->view.at; - D_8012390C[0].eyeTargetInit = globalCtx->view.eye; - D_8012390C[0].fovTargetInit = globalCtx->view.fovy; + D_8012390C[0].atTargetInit = play->view.at; + D_8012390C[0].eyeTargetInit = play->view.eye; + D_8012390C[0].fovTargetInit = play->view.fovy; csInfo->keyFrames = D_8012390C; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 9705: - D_8012395C[0].atTargetInit = globalCtx->view.at; - D_8012395C[0].eyeTargetInit = globalCtx->view.eye; - D_8012395C[0].fovTargetInit = globalCtx->view.fovy; + D_8012395C[0].atTargetInit = play->view.at; + D_8012395C[0].eyeTargetInit = play->view.eye; + D_8012395C[0].fovTargetInit = play->view.fovy; csInfo->keyFrames = D_8012395C; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + func_800C0808(play, subCamId, player, CAM_SET_CS_C); break; case 5110: D_801239D4[1].timerInit = 10; @@ -1096,7 +1096,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A csInfo->keyFrames = D_801239D4; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, subCamId, (Player*)actor, CAM_SET_CS_C); + func_800C0808(play, subCamId, (Player*)actor, CAM_SET_CS_C); break; default: osSyncPrintf(VT_COL(RED, WHITE) "onepointdemo camera: demo number not found !! (%d)\n" VT_RST, csId); @@ -1105,11 +1105,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, A return 0; } -s16 OnePointCutscene_SetAsChild(GlobalContext* globalCtx, s16 newCamId, s16 parentCamId) { - s16 prevCamId = globalCtx->cameraPtrs[parentCamId]->childCamId; +s16 OnePointCutscene_SetAsChild(PlayState* play, s16 newCamId, s16 parentCamId) { + s16 prevCamId = play->cameraPtrs[parentCamId]->childCamId; - globalCtx->cameraPtrs[newCamId]->parentCamId = parentCamId; - globalCtx->cameraPtrs[parentCamId]->childCamId = newCamId; + play->cameraPtrs[newCamId]->parentCamId = parentCamId; + play->cameraPtrs[parentCamId]->childCamId = newCamId; return prevCamId; } @@ -1118,8 +1118,8 @@ s16 OnePointCutscene_SetAsChild(GlobalContext* globalCtx, s16 newCamId, s16 pare * Removes a cutscene camera from the list. Returns the parent cam if the removed camera is active, otherwise returns * CAM_ID_NONE */ -s32 OnePointCutscene_RemoveCamera(GlobalContext* globalCtx, s16 subCamId) { - Camera* subCam = globalCtx->cameraPtrs[subCamId]; +s32 OnePointCutscene_RemoveCamera(PlayState* play, s16 subCamId) { + Camera* subCam = play->cameraPtrs[subCamId]; s32 nextCamId; if (subCam->camId == CHILD_CAM(subCam)->parentCamId) { @@ -1128,11 +1128,11 @@ s32 OnePointCutscene_RemoveCamera(GlobalContext* globalCtx, s16 subCamId) { if (subCam->camId == PARENT_CAM(subCam)->childCamId) { PARENT_CAM(subCam)->childCamId = subCam->childCamId; } - nextCamId = (globalCtx->activeCamId == subCamId) ? subCam->parentCamId : CAM_ID_NONE; + nextCamId = (play->activeCamId == subCamId) ? subCam->parentCamId : CAM_ID_NONE; subCam->parentCamId = CAM_ID_MAIN; subCam->childCamId = subCam->parentCamId; subCam->timer = -1; - Play_ClearCamera(subCam->globalCtx, subCam->camId); + Play_ClearCamera(subCam->play, subCam->camId); return nextCamId; } @@ -1146,16 +1146,16 @@ s32 OnePointCutscene_RemoveCamera(GlobalContext* globalCtx, s16 subCamId) { * cutscene queue in front of the specified camera, then all lower priority demos in front of it are removed from the * queue. */ -s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* actor, s16 parentCamId) { +s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 parentCamId) { s16 temp1; s16 temp2; s16 subCamId; Camera* subCam; if (parentCamId == CAM_ID_NONE) { - parentCamId = globalCtx->activeCamId; + parentCamId = play->activeCamId; } - subCamId = Play_CreateSubCamera(globalCtx); + subCamId = Play_CreateSubCamera(play); if (subCamId == CAM_ID_NONE) { osSyncPrintf(VT_COL(RED, WHITE) "onepoint demo: error: too many cameras ... give up! type=%d\n" VT_RST, csId); return CAM_ID_NONE; @@ -1163,58 +1163,58 @@ s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* // Inserts the cutscene camera into the cutscene queue in front of parentCam - vChildCamId = globalCtx->cameraPtrs[parentCamId]->childCamId; + vChildCamId = play->cameraPtrs[parentCamId]->childCamId; vSubCamStatus = CAM_STAT_ACTIVE; if (vChildCamId >= CAM_ID_SUB_FIRST) { - OnePointCutscene_SetAsChild(globalCtx, vChildCamId, subCamId); + OnePointCutscene_SetAsChild(play, vChildCamId, subCamId); vSubCamStatus = CAM_STAT_WAIT; } else { Interface_ChangeAlpha(2); } - OnePointCutscene_SetAsChild(globalCtx, subCamId, parentCamId); + OnePointCutscene_SetAsChild(play, subCamId, parentCamId); - subCam = globalCtx->cameraPtrs[subCamId]; + subCam = play->cameraPtrs[subCamId]; subCam->timer = timer; subCam->target = actor; - subCam->at = globalCtx->view.at; - subCam->eye = globalCtx->view.eye; - subCam->fov = globalCtx->view.fovy; + subCam->at = play->view.at; + subCam->eye = play->view.eye; + subCam->fov = play->view.fovy; subCam->csId = csId; if (parentCamId == CAM_ID_MAIN) { - Play_ChangeCameraStatus(globalCtx, parentCamId, CAM_STAT_UNK3); + Play_ChangeCameraStatus(play, parentCamId, CAM_STAT_UNK3); } else { - Play_ChangeCameraStatus(globalCtx, parentCamId, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, parentCamId, CAM_STAT_WAIT); } - OnePointCutscene_SetInfo(globalCtx, subCamId, csId, actor, timer); - Play_ChangeCameraStatus(globalCtx, subCamId, vSubCamStatus); + OnePointCutscene_SetInfo(play, subCamId, csId, actor, timer); + Play_ChangeCameraStatus(play, subCamId, vSubCamStatus); // Removes all lower priority cutscenes in front of this cutscene from the queue. vCurCamId = subCamId; - vNextCamId = globalCtx->cameraPtrs[subCamId]->childCamId; + vNextCamId = play->cameraPtrs[subCamId]->childCamId; while (vNextCamId >= CAM_ID_SUB_FIRST) { - s16 nextCsId = globalCtx->cameraPtrs[vNextCamId]->csId; - s16 thisCsId = globalCtx->cameraPtrs[subCamId]->csId; + s16 nextCsId = play->cameraPtrs[vNextCamId]->csId; + s16 thisCsId = play->cameraPtrs[subCamId]->csId; if ((nextCsId / 100) < (thisCsId / 100)) { osSyncPrintf(VT_COL(YELLOW, BLACK) "onepointdemo camera[%d]: killed 'coz low priority (%d < %d)\n" VT_RST, vNextCamId, nextCsId, thisCsId); - if (globalCtx->cameraPtrs[vNextCamId]->csId != 5010) { - if ((vNextCamId = OnePointCutscene_RemoveCamera(globalCtx, vNextCamId)) != CAM_ID_NONE) { - Play_ChangeCameraStatus(globalCtx, vNextCamId, CAM_STAT_ACTIVE); + if (play->cameraPtrs[vNextCamId]->csId != 5010) { + if ((vNextCamId = OnePointCutscene_RemoveCamera(play, vNextCamId)) != CAM_ID_NONE) { + Play_ChangeCameraStatus(play, vNextCamId, CAM_STAT_ACTIVE); } } else { vCurCamId = vNextCamId; - OnePointCutscene_EndCutscene(globalCtx, vNextCamId); + OnePointCutscene_EndCutscene(play, vNextCamId); } } else { vCurCamId = vNextCamId; } - vNextCamId = globalCtx->cameraPtrs[vCurCamId]->childCamId; + vNextCamId = play->cameraPtrs[vCurCamId]->childCamId; } return subCamId; } @@ -1222,17 +1222,17 @@ s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* /** * Ends the cutscene in subCamId by setting its timer to 0. For attention cutscenes, it is set to 5 instead. */ -s16 OnePointCutscene_EndCutscene(GlobalContext* globalCtx, s16 subCamId) { +s16 OnePointCutscene_EndCutscene(PlayState* play, s16 subCamId) { if (subCamId == CAM_ID_NONE) { - subCamId = globalCtx->activeCamId; + subCamId = play->activeCamId; } - if (globalCtx->cameraPtrs[subCamId] != NULL) { - osSyncPrintf("onepointdemo camera[%d]: delete timer=%d next=%d\n", subCamId, - globalCtx->cameraPtrs[subCamId]->timer, globalCtx->cameraPtrs[subCamId]->parentCamId); - if (globalCtx->cameraPtrs[subCamId]->csId == 5010) { - globalCtx->cameraPtrs[subCamId]->timer = 5; + if (play->cameraPtrs[subCamId] != NULL) { + osSyncPrintf("onepointdemo camera[%d]: delete timer=%d next=%d\n", subCamId, play->cameraPtrs[subCamId]->timer, + play->cameraPtrs[subCamId]->parentCamId); + if (play->cameraPtrs[subCamId]->csId == 5010) { + play->cameraPtrs[subCamId]->timer = 5; } else { - globalCtx->cameraPtrs[subCamId]->timer = 0; + play->cameraPtrs[subCamId]->timer = 0; } } return subCamId; @@ -1246,7 +1246,7 @@ s16 OnePointCutscene_EndCutscene(GlobalContext* globalCtx, s16 subCamId) { /** * Adds an attention cutscene to the cutscene queue. */ -s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { +s32 OnePointCutscene_Attention(PlayState* play, Actor* actor) { Camera* parentCam; s32 temp1; s32 temp2; @@ -1258,7 +1258,7 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { } sUnused = -1; - parentCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; + parentCam = play->cameraPtrs[CAM_ID_MAIN]; if (parentCam->mode == CAM_MODE_FOLLOWBOOMERANG) { osSyncPrintf(VT_COL(YELLOW, BLACK) "actor attention demo camera: change mode BOOKEEPON -> NORMAL\n" VT_RST); Camera_ChangeMode(parentCam, CAM_MODE_NORMAL); @@ -1269,7 +1269,7 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { vLastHigherCat = -1; while (parentCam->childCamId != CAM_ID_MAIN) { - parentCam = globalCtx->cameraPtrs[parentCam->childCamId]; + parentCam = play->cameraPtrs[parentCam->childCamId]; if (parentCam == NULL) { break; } else if (parentCam->setting != CAM_SET_CS_ATTENTION) { @@ -1309,11 +1309,11 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { case ACTORCAT_BOSS: default: osSyncPrintf(VT_COL(YELLOW, BLACK) "actor attention demo camera: %d: unkown part of actor %d\n" VT_RST, - globalCtx->state.frames, actor->category); + play->state.frames, actor->category); timer = 30; break; } - osSyncPrintf(VT_FGCOL(CYAN) "%06u:" VT_RST " actor attention demo camera: request %d ", globalCtx->state.frames, + osSyncPrintf(VT_FGCOL(CYAN) "%06u:" VT_RST " actor attention demo camera: request %d ", play->state.frames, actor->category); // If the previous attention cutscene has an actor in the same category, skip this actor. @@ -1322,12 +1322,12 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { return CAM_ID_NONE; } osSyncPrintf("→ " VT_FGCOL(BLUE) "○" VT_RST " (%d)\n", actor->id); - vSubCamId = OnePointCutscene_Init(globalCtx, 5010, timer, actor, vParentCamId); + vSubCamId = OnePointCutscene_Init(play, 5010, timer, actor, vParentCamId); if (vSubCamId == CAM_ID_NONE) { osSyncPrintf(VT_COL(RED, WHITE) "actor attention demo: give up! \n" VT_RST, actor->id); return CAM_ID_NONE; } else { - s32* data = (s32*)&globalCtx->cameraPtrs[vSubCamId]->data1; + s32* data = (s32*)&play->cameraPtrs[vSubCamId]->data1; *data = NA_SE_SY_CORRECT_CHIME; return vSubCamId; @@ -1337,11 +1337,11 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { /** * Adds an attention cutscene to the cutscene queue with the specified sound effect */ -s32 OnePointCutscene_AttentionSetSfx(GlobalContext* globalCtx, Actor* actor, s32 sfxId) { - s32 subCamId = OnePointCutscene_Attention(globalCtx, actor); +s32 OnePointCutscene_AttentionSetSfx(PlayState* play, Actor* actor, s32 sfxId) { + s32 subCamId = OnePointCutscene_Attention(play, actor); if (subCamId != CAM_ID_NONE) { - s32* data = (s32*)&globalCtx->cameraPtrs[subCamId]->data1; + s32* data = (s32*)&play->cameraPtrs[subCamId]->data1; *data = sfxId; } @@ -1358,11 +1358,11 @@ void OnePointCutscene_DisableAttention(void) { sDisableAttention = true; } -s32 OnePointCutscene_CheckForCategory(GlobalContext* globalCtx, s32 actorCategory) { - Camera* parentCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; +s32 OnePointCutscene_CheckForCategory(PlayState* play, s32 actorCategory) { + Camera* parentCam = play->cameraPtrs[CAM_ID_MAIN]; while (parentCam->childCamId != CAM_ID_MAIN) { - parentCam = globalCtx->cameraPtrs[parentCam->childCamId]; + parentCam = play->cameraPtrs[parentCam->childCamId]; if ((parentCam == NULL) || (parentCam->setting != CAM_SET_CS_ATTENTION)) { break; } else if (actorCategory == parentCam->target->category) { @@ -1373,5 +1373,5 @@ s32 OnePointCutscene_CheckForCategory(GlobalContext* globalCtx, s32 actorCategor } // unused, also empty. -void OnePointCutscene_Noop(GlobalContext* globalCtx, s32 arg1) { +void OnePointCutscene_Noop(PlayState* play, s32 arg1) { } diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 46866eea88..20255ca485 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -177,8 +177,8 @@ void Interface_ChangeAlpha(u16 alphaType) { } } -void func_80082644(GlobalContext* globalCtx, s16 alpha) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_80082644(PlayState* play, s16 alpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (gSaveContext.buttonStatus[0] == BTN_DISABLED) { if (interfaceCtx->bAlpha != 70) { @@ -231,11 +231,11 @@ void func_80082644(GlobalContext* globalCtx, s16 alpha) { } } -void func_8008277C(GlobalContext* globalCtx, s16 maxAlpha, s16 alpha) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_8008277C(PlayState* play, s16 maxAlpha, s16 alpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (gSaveContext.unk_13E7 != 0) { - func_80082644(globalCtx, alpha); + func_80082644(play, alpha); return; } @@ -260,8 +260,8 @@ void func_8008277C(GlobalContext* globalCtx, s16 maxAlpha, s16 alpha) { } } -void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_80082850(PlayState* play, s16 maxAlpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 alpha = 255 - maxAlpha; switch (gSaveContext.unk_13E8) { @@ -316,7 +316,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { interfaceCtx->aAlpha = maxAlpha; } - func_8008277C(globalCtx, maxAlpha, alpha); + func_8008277C(play, maxAlpha, alpha); if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { interfaceCtx->magicAlpha = maxAlpha; @@ -370,7 +370,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { break; case 5: - func_8008277C(globalCtx, maxAlpha, alpha); + func_8008277C(play, maxAlpha, alpha); if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; @@ -390,7 +390,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { break; case 6: - func_8008277C(globalCtx, maxAlpha, alpha); + func_8008277C(play, maxAlpha, alpha); if (interfaceCtx->aAlpha != 255) { interfaceCtx->aAlpha = alpha; @@ -404,7 +404,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { interfaceCtx->magicAlpha = alpha; } - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT00: case SCENE_SPOT01: case SCENE_SPOT02: @@ -443,7 +443,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { interfaceCtx->minimapAlpha = maxAlpha; } - func_80082644(globalCtx, alpha); + func_80082644(play, alpha); if (interfaceCtx->healthAlpha != 255) { interfaceCtx->healthAlpha = alpha; @@ -591,7 +591,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { break; case 13: - func_8008277C(globalCtx, maxAlpha, alpha); + func_8008277C(play, maxAlpha, alpha); if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; @@ -612,24 +612,24 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { break; } - if ((globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) && (interfaceCtx->minimapAlpha >= 255)) { + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) && (interfaceCtx->minimapAlpha >= 255)) { interfaceCtx->minimapAlpha = 255; } } -void func_80083108(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; - Player* player = GET_PLAYER(globalCtx); - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_80083108(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; + Player* player = GET_PLAYER(play); + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 i; s16 sp28 = false; if ((gSaveContext.cutsceneIndex < 0xFFF0) || - ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF0))) { + ((play->sceneNum == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF0))) { gSaveContext.unk_13E7 = 0; - if ((player->stateFlags1 & PLAYER_STATE1_23) || (globalCtx->shootingGalleryStatus > 1) || - ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { + if ((player->stateFlags1 & PLAYER_STATE1_23) || (play->shootingGalleryStatus > 1) || + ((play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38))) { if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { gSaveContext.unk_13E7 = 1; @@ -644,22 +644,22 @@ void func_80083108(GlobalContext* globalCtx) { (gSaveContext.equips.buttonItems[0] != ITEM_NONE)) { gSaveContext.buttonStatus[0] = gSaveContext.equips.buttonItems[0]; - if ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) { + if ((play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38)) { gSaveContext.equips.buttonItems[0] = ITEM_BOMBCHU; - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } else { gSaveContext.equips.buttonItems[0] = ITEM_BOW; - if (globalCtx->shootingGalleryStatus > 1) { + if (play->shootingGalleryStatus > 1) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { gSaveContext.equips.buttonItems[0] = ITEM_SLINGSHOT; } - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } else { if (gSaveContext.inventory.items[SLOT_BOW] == ITEM_NONE) { gSaveContext.equips.buttonItems[0] = ITEM_NONE; } else { - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } } } @@ -669,13 +669,13 @@ void func_80083108(GlobalContext* globalCtx) { Interface_ChangeAlpha(6); } - if (globalCtx->transitionMode != TRANS_MODE_OFF) { + if (play->transitionMode != TRANS_MODE_OFF) { Interface_ChangeAlpha(1); } else if (gSaveContext.minigameState == 1) { Interface_ChangeAlpha(8); - } else if (globalCtx->shootingGalleryStatus > 1) { + } else if (play->shootingGalleryStatus > 1) { Interface_ChangeAlpha(8); - } else if ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) { + } else if ((play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38)) { Interface_ChangeAlpha(8); } else if (player->stateFlags1 & PLAYER_STATE1_23) { Interface_ChangeAlpha(12); @@ -685,16 +685,16 @@ void func_80083108(GlobalContext* globalCtx) { Interface_ChangeAlpha(12); } } - } else if (globalCtx->sceneNum == SCENE_KENJYANOMA) { + } else if (play->sceneNum == SCENE_KENJYANOMA) { Interface_ChangeAlpha(1); - } else if (globalCtx->sceneNum == SCENE_TURIBORI) { + } else if (play->sceneNum == SCENE_TURIBORI) { gSaveContext.unk_13E7 = 2; - if (globalCtx->interfaceCtx.unk_260 != 0) { + if (play->interfaceCtx.unk_260 != 0) { if (gSaveContext.equips.buttonItems[0] != ITEM_FISHING_POLE) { gSaveContext.buttonStatus[0] = gSaveContext.equips.buttonItems[0]; gSaveContext.equips.buttonItems[0] = ITEM_FISHING_POLE; gSaveContext.unk_13EA = 0; - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); Interface_ChangeAlpha(12); } @@ -706,7 +706,7 @@ void func_80083108(GlobalContext* globalCtx) { gSaveContext.unk_13EA = 0; if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = @@ -722,7 +722,7 @@ void func_80083108(GlobalContext* globalCtx) { Interface_ChangeAlpha(50); } } else if (msgCtx->msgMode == MSGMODE_NONE) { - if ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) { + if ((func_8008F2F8(play) >= 2) && (func_8008F2F8(play) < 5)) { if (gSaveContext.buttonStatus[0] != BTN_DISABLED) { sp28 = true; } @@ -730,7 +730,7 @@ void func_80083108(GlobalContext* globalCtx) { gSaveContext.buttonStatus[0] = BTN_DISABLED; for (i = 1; i < 4; i++) { - if (func_8008F2F8(globalCtx) == 2) { + if (func_8008F2F8(play) == 2) { if ((gSaveContext.equips.buttonItems[i] != ITEM_HOOKSHOT) && (gSaveContext.equips.buttonItems[i] != ITEM_LONGSHOT)) { if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { @@ -796,7 +796,7 @@ void func_80083108(GlobalContext* globalCtx) { } if (sp28) { - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); sp28 = false; } @@ -834,7 +834,7 @@ void func_80083108(GlobalContext* globalCtx) { sp28 = true; if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } } } else if ((gSaveContext.buttonStatus[0] & 0xFF) == BTN_DISABLED) { @@ -858,7 +858,7 @@ void func_80083108(GlobalContext* globalCtx) { sp28 = true; if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } } } else { @@ -1021,7 +1021,7 @@ void func_80083108(GlobalContext* globalCtx) { (gSaveContext.equips.buttonItems[i] <= ITEM_POE)) && !((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) && (gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) { - if ((globalCtx->sceneNum != SCENE_TAKARAYA) || + if ((play->sceneNum != SCENE_TAKARAYA) || (gSaveContext.equips.buttonItems[i] != ITEM_LENS)) { if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { sp28 = true; @@ -1064,7 +1064,7 @@ void func_80083108(GlobalContext* globalCtx) { if (sp28) { gSaveContext.unk_13EA = 0; - if ((globalCtx->transitionTrigger == TRANS_TRIGGER_OFF) && (globalCtx->transitionMode == TRANS_MODE_OFF)) { + if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { Interface_ChangeAlpha(50); osSyncPrintf("???????? alpha_change( 50 ); ?????\n"); } else { @@ -1073,8 +1073,8 @@ void func_80083108(GlobalContext* globalCtx) { } } -void Interface_SetSceneRestrictions(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_SetSceneRestrictions(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 i; u8 currentScene; @@ -1088,10 +1088,10 @@ void Interface_SetSceneRestrictions(GlobalContext* globalCtx) { i = 0; // "Data settings related to button display scene_data_ID=%d\n" - osSyncPrintf("ボタン表示関係データ設定 scene_data_ID=%d\n", globalCtx->sceneNum); + osSyncPrintf("ボタン表示関係データ設定 scene_data_ID=%d\n", play->sceneNum); do { - currentScene = (u8)globalCtx->sceneNum; + currentScene = (u8)play->sceneNum; if (sRestrictionFlags[i].scene == currentScene) { interfaceCtx->restrictions.hGauge = (sRestrictionFlags[i].flags1 & 0xC0) >> 6; interfaceCtx->restrictions.bButton = (sRestrictionFlags[i].flags1 & 0x30) >> 4; @@ -1250,8 +1250,8 @@ void Inventory_SwapAgeEquipment(void) { } } -void Interface_InitHorsebackArchery(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_InitHorsebackArchery(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; gSaveContext.minigameState = 1; interfaceCtx->unk_23C = interfaceCtx->unk_240 = interfaceCtx->unk_242 = 0; @@ -1259,7 +1259,7 @@ void Interface_InitHorsebackArchery(GlobalContext* globalCtx) { interfaceCtx->hbaAmmo = 20; } -void func_800849EC(GlobalContext* globalCtx) { +void func_800849EC(PlayState* play) { gSaveContext.inventory.equipment |= OWNED_EQUIP_FLAG(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BGS); gSaveContext.inventory.equipment ^= OWNED_EQUIP_FLAG_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE); @@ -1269,11 +1269,11 @@ void func_800849EC(GlobalContext* globalCtx) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS; } - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } -void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_LoadItemIcon1(PlayState* play, u16 button) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK); DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->iconItemSegment + button * 0x1000, @@ -1282,8 +1282,8 @@ void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button) { osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); } -void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_LoadItemIcon2(PlayState* play, u16 button) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK); DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_180, interfaceCtx->iconItemSegment + button * 0x1000, @@ -1292,7 +1292,7 @@ void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button) { osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); } -void func_80084BF4(GlobalContext* globalCtx, u16 flag) { +void func_80084BF4(PlayState* play, u16 flag) { if (flag) { if ((gSaveContext.equips.buttonItems[0] == ITEM_SLINGSHOT) || (gSaveContext.equips.buttonItems[0] == ITEM_BOW) || (gSaveContext.equips.buttonItems[0] == ITEM_BOMBCHU) || @@ -1303,12 +1303,12 @@ void func_80084BF4(GlobalContext* globalCtx, u16 flag) { (gSaveContext.equips.buttonItems[0] == ITEM_BOMBCHU) || (gSaveContext.equips.buttonItems[0] == ITEM_FISHING_POLE)) { gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0]; - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } } else if (gSaveContext.equips.buttonItems[0] == ITEM_NONE) { if ((gSaveContext.equips.buttonItems[0] != ITEM_NONE) || (gSaveContext.infTable[INFTABLE_1DX_INDEX] == 0)) { gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0]; - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } } @@ -1318,11 +1318,11 @@ void func_80084BF4(GlobalContext* globalCtx, u16 flag) { } else { gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_ENABLED; - func_80083108(globalCtx); + func_80083108(play); } } -u8 Item_Give(GlobalContext* globalCtx, u8 item) { +u8 Item_Give(PlayState* play, u8 item) { static s16 sAmmoRefillCounts[] = { 5, 10, 20, 30 }; // Sticks, nuts, bombs static s16 sArrowRefillCounts[] = { 5, 10, 30 }; static s16 sBombchuRefillCounts[] = { 5, 20 }; @@ -1348,7 +1348,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { osSyncPrintf(VT_RST); if (item == ITEM_MEDALLION_WATER) { - func_8006D0AC(globalCtx); + func_8006D0AC(play); } return ITEM_NONE; @@ -1403,14 +1403,14 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { OWNED_EQUIP_FLAG_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE); if (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KNIFE) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS; - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } } } else if (item == ITEM_SWORD_MASTER) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4)); gSaveContext.equips.equipment |= EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4); - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } return ITEM_NONE; @@ -1536,7 +1536,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { for (i = 1; i < 4; i++) { if (gSaveContext.equips.buttonItems[i] == ITEM_HOOKSHOT) { gSaveContext.equips.buttonItems[i] = ITEM_LONGSHOT; - Interface_LoadItemIcon1(globalCtx, i); + Interface_LoadItemIcon1(play, i); } } return ITEM_NONE; @@ -1670,7 +1670,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { for (i = 1; i < 4; i++) { if (gSaveContext.equips.buttonItems[i] == ITEM_OCARINA_FAIRY) { gSaveContext.equips.buttonItems[i] = ITEM_OCARINA_TIME; - Interface_LoadItemIcon1(globalCtx, i); + Interface_LoadItemIcon1(play, i); } } return ITEM_NONE; @@ -1693,14 +1693,14 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { return ITEM_NONE; } else if (item == ITEM_HEART) { osSyncPrintf("回復ハート回復ハート回復ハート\n"); // "Recovery Heart" - Health_ChangeBy(globalCtx, 0x10); + Health_ChangeBy(play, 0x10); return item; } else if (item == ITEM_MAGIC_SMALL) { if (gSaveContext.unk_13F0 != 10) { - Magic_Fill(globalCtx); + Magic_Fill(play); } - func_80087708(globalCtx, 12, 5); + func_80087708(play, 12, 5); if (!GET_INFTABLE(INFTABLE_198)) { SET_INFTABLE(INFTABLE_198); @@ -1710,10 +1710,10 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { return item; } else if (item == ITEM_MAGIC_LARGE) { if (gSaveContext.unk_13F0 != 10) { - Magic_Fill(globalCtx); + Magic_Fill(play); } - func_80087708(globalCtx, 24, 5); + func_80087708(play, 24, 5); if (!GET_INFTABLE(INFTABLE_198)) { SET_INFTABLE(INFTABLE_198); @@ -1751,15 +1751,15 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { if ((temp + i) == gSaveContext.equips.cButtonSlots[0]) { gSaveContext.equips.buttonItems[1] = item; - Interface_LoadItemIcon2(globalCtx, 1); + Interface_LoadItemIcon2(play, 1); gSaveContext.buttonStatus[1] = BTN_ENABLED; } else if ((temp + i) == gSaveContext.equips.cButtonSlots[1]) { gSaveContext.equips.buttonItems[2] = item; - Interface_LoadItemIcon2(globalCtx, 2); + Interface_LoadItemIcon2(play, 2); gSaveContext.buttonStatus[2] = BTN_ENABLED; } else if ((temp + i) == gSaveContext.equips.cButtonSlots[2]) { gSaveContext.equips.buttonItems[3] = item; - Interface_LoadItemIcon1(globalCtx, 3); + Interface_LoadItemIcon1(play, 3); gSaveContext.buttonStatus[3] = BTN_ENABLED; } @@ -1788,7 +1788,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { if (temp == gSaveContext.equips.buttonItems[i]) { if (item != ITEM_SOLD_OUT) { gSaveContext.equips.buttonItems[i] = item; - Interface_LoadItemIcon1(globalCtx, i); + Interface_LoadItemIcon1(play, i); } else { gSaveContext.equips.buttonItems[i] = ITEM_NONE; } @@ -1953,7 +1953,7 @@ void Inventory_DeleteItem(u16 item, u16 invSlot) { } } -s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) { +s32 Inventory_ReplaceItem(PlayState* play, u16 oldItem, u16 newItem) { s16 i; for (i = 0; i < ARRAY_COUNT(gSaveContext.inventory.items); i++) { @@ -1963,7 +1963,7 @@ s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) { for (i = 1; i < 4; i++) { if (gSaveContext.equips.buttonItems[i] == oldItem) { gSaveContext.equips.buttonItems[i] = newItem; - Interface_LoadItemIcon1(globalCtx, i); + Interface_LoadItemIcon1(play, i); break; } } @@ -2006,7 +2006,7 @@ s32 Inventory_HasSpecificBottle(u8 bottleItem) { } } -void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 button) { +void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 button) { osSyncPrintf("item_no=%x, c_no=%x, Pt=%x Item_Register=%x\n", item, button, gSaveContext.equips.cButtonSlots[button - 1], gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[button - 1]]); @@ -2020,13 +2020,13 @@ void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 button) { gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[button - 1]] = item; gSaveContext.equips.buttonItems[button] = item; - Interface_LoadItemIcon1(globalCtx, button); + Interface_LoadItemIcon1(play, button); - globalCtx->pauseCtx.cursorItem[PAUSE_ITEM] = item; + play->pauseCtx.cursorItem[PAUSE_ITEM] = item; gSaveContext.buttonStatus[button] = BTN_ENABLED; } -s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) { +s32 Inventory_ConsumeFairy(PlayState* play) { s32 bottleSlot = SLOT(ITEM_FAIRY); s16 i; s16 j; @@ -2036,7 +2036,7 @@ s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) { for (j = 1; j < 4; j++) { if (gSaveContext.equips.buttonItems[j] == ITEM_FAIRY) { gSaveContext.equips.buttonItems[j] = ITEM_BOTTLE; - Interface_LoadItemIcon1(globalCtx, j); + Interface_LoadItemIcon1(play, j); i = 0; bottleSlot = gSaveContext.equips.cButtonSlots[j - 1]; break; @@ -2088,9 +2088,9 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 l } } -void Interface_SetDoAction(GlobalContext* globalCtx, u16 action) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void Interface_SetDoAction(PlayState* play, u16 action) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + PauseContext* pauseCtx = &play->pauseCtx; if (interfaceCtx->unk_1F0 != action) { interfaceCtx->unk_1F0 = action; @@ -2103,11 +2103,11 @@ void Interface_SetDoAction(GlobalContext* globalCtx, u16 action) { } } -void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_SetNaviCall(PlayState* play, u16 naviCallState) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (((naviCallState == 0x1D) || (naviCallState == 0x1E)) && !interfaceCtx->naviCalling && - (globalCtx->csCtx.state == CS_STATE_IDLE)) { + (play->csCtx.state == CS_STATE_IDLE)) { // clang-format off if (naviCallState == 0x1E) { Audio_PlaySoundGeneral(NA_SE_VO_NAVY_CALL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, @@ -2127,8 +2127,8 @@ void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState) { } } -void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_LoadActionLabelB(PlayState* play, u16 action) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (gSaveContext.language != LANGUAGE_ENG) { action += DO_ACTION_MAX; @@ -2149,7 +2149,7 @@ void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action) { interfaceCtx->unk_1FA = true; } -s32 Health_ChangeBy(GlobalContext* globalCtx, s16 healthChange) { +s32 Health_ChangeBy(PlayState* play, s16 healthChange) { u16 heartCount; u16 healthLevel; @@ -2264,7 +2264,7 @@ void Inventory_ChangeAmmo(s16 item, s16 ammoChange) { osSyncPrintf("合計 = (%d)\n", AMMO(item)); // "Total = (%d)" } -void Magic_Fill(GlobalContext* globalCtx) { +void Magic_Fill(PlayState* play) { if (gSaveContext.magicAcquired) { gSaveContext.unk_13F2 = gSaveContext.unk_13F0; gSaveContext.unk_13F6 = (gSaveContext.doubleMagic * 0x30) + 0x30; @@ -2272,7 +2272,7 @@ void Magic_Fill(GlobalContext* globalCtx) { } } -void func_800876C8(GlobalContext* globalCtx) { +void func_800876C8(PlayState* play) { if ((gSaveContext.unk_13F0 != 8) && (gSaveContext.unk_13F0 != 9)) { if (gSaveContext.unk_13F0 == 10) { gSaveContext.unk_13F2 = gSaveContext.unk_13F0; @@ -2281,7 +2281,7 @@ void func_800876C8(GlobalContext* globalCtx) { } } -s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { +s32 func_80087708(PlayState* play, s16 arg1, s16 arg2) { if (!gSaveContext.magicAcquired) { return 0; } @@ -2299,7 +2299,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 2: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.lensActive = false; + play->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 1; @@ -2312,7 +2312,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 1: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.lensActive = false; + play->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 6; @@ -2325,7 +2325,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 3: if (gSaveContext.unk_13F0 == 0) { if (gSaveContext.magic != 0) { - globalCtx->interfaceCtx.unk_230 = 80; + play->interfaceCtx.unk_230 = 80; gSaveContext.unk_13F0 = 7; return 1; } else { @@ -2341,7 +2341,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 4: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.lensActive = false; + play->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 4; @@ -2368,7 +2368,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { return 0; } -void Interface_UpdateMagicBar(GlobalContext* globalCtx) { +void Interface_UpdateMagicBar(PlayState* play) { static s16 sMagicBorderColors[][3] = { { 255, 255, 255 }, { 150, 150, 150 }, @@ -2378,8 +2378,8 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { static s16 sMagicBorderIndices[] = { 0, 1, 1, 0 }; static s16 sMagicBorderRatio = 2; static s16 sMagicBorderStep = 1; - MessageContext* msgCtx = &globalCtx->msgCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 borderChangeR; s16 borderChangeG; s16 borderChangeB; @@ -2482,16 +2482,15 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { break; case 7: - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && - (msgCtx->msgMode == MSGMODE_NONE) && (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && - (globalCtx->transitionTrigger == TRANS_TRIGGER_OFF) && (globalCtx->transitionMode == TRANS_MODE_OFF) && - !Play_InCsMode(globalCtx)) { - if ((gSaveContext.magic == 0) || ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) || + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && (msgCtx->msgMode == MSGMODE_NONE) && + (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) { + if ((gSaveContext.magic == 0) || ((func_8008F2F8(play) >= 2) && (func_8008F2F8(play) < 5)) || ((gSaveContext.equips.buttonItems[1] != ITEM_LENS) && (gSaveContext.equips.buttonItems[2] != ITEM_LENS) && (gSaveContext.equips.buttonItems[3] != ITEM_LENS)) || - !globalCtx->actorCtx.lensActive) { - globalCtx->actorCtx.lensActive = false; + !play->actorCtx.lensActive) { + play->actorCtx.lensActive = false; Audio_PlaySoundGeneral(NA_SE_SY_GLASSMODE_OFF, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); gSaveContext.unk_13F0 = 0; @@ -2559,11 +2558,11 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { } } -void Interface_DrawMagicBar(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_DrawMagicBar(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 magicBarY; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 2650); + OPEN_DISPS(play->state.gfxCtx, "../z_parameter.c", 2650); if (gSaveContext.magicLevel != 0) { if (gSaveContext.healthCapacity > 0xA0) { @@ -2572,7 +2571,7 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) { magicBarY = R_MAGIC_BAR_SMALL_Y; } - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMagicBorderR, sMagicBorderG, sMagicBorderB, interfaceCtx->magicAlpha); gDPSetEnvColor(OVERLAY_DISP++, 100, 50, 50, 255); @@ -2630,7 +2629,7 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 2731); + CLOSE_DISPS(play->state.gfxCtx, "../z_parameter.c", 2731); } void func_80088AA0(s16 arg0) { @@ -2646,7 +2645,7 @@ void func_80088AA0(s16 arg0) { } } -void func_80088AF0(GlobalContext* globalCtx) { +void func_80088AF0(PlayState* play) { if (gSaveContext.timer2State != 0) { if (GET_EVENTINF(EVENTINF_10)) { gSaveContext.timer2Value = 239; @@ -2681,18 +2680,18 @@ void Interface_DrawActionLabel(GraphicsContext* gfxCtx, void* texture) { CLOSE_DISPS(gfxCtx, "../z_parameter.c", 2829); } -void Interface_DrawItemButtons(GlobalContext* globalCtx) { +void Interface_DrawItemButtons(PlayState* play) { static void* cUpLabelTextures[] = { gNaviCUpENGTex, gNaviCUpENGTex, gNaviCUpENGTex }; static s16 startButtonLeftPos[] = { 132, 130, 130 }; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - Player* player = GET_PLAYER(globalCtx); - PauseContext* pauseCtx = &globalCtx->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + PauseContext* pauseCtx = &play->pauseCtx; s16 temp; // Used as both an alpha value and a button index s16 dxdy; s16 width; s16 height; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 2900); + OPEN_DISPS(play->state.gfxCtx, "../z_parameter.c", 2900); // B Button Color & Texture // Also loads the Item Button Texture reused by other buttons afterwards @@ -2727,7 +2726,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) << 1, R_ITEM_BTN_DD(3) << 1); if ((pauseCtx->state < 8) || (pauseCtx->state >= 18)) { - if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) { + if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0)) { // Start Button Texture, Color & Label gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 120, 120, interfaceCtx->startAlpha); @@ -2754,15 +2753,15 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { } } - if (interfaceCtx->naviCalling && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && - (globalCtx->csCtx.state == CS_STATE_IDLE)) { + if (interfaceCtx->naviCalling && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && + (play->csCtx.state == CS_STATE_IDLE)) { if (!sCUpInvisible) { // C-Up Button Texture, Color & Label (Navi Text) gDPPipeSync(OVERLAY_DISP++); if ((gSaveContext.unk_13EA == 1) || (gSaveContext.unk_13EA == 2) || (gSaveContext.unk_13EA == 5)) { temp = 0; - } else if ((player->stateFlags1 & PLAYER_STATE1_21) || (func_8008F2F8(globalCtx) == 4) || + } else if ((player->stateFlags1 & PLAYER_STATE1_21) || (func_8008F2F8(play) == 4) || (player->stateFlags2 & PLAYER_STATE2_18)) { temp = 70; } else { @@ -2816,11 +2815,11 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3071); + CLOSE_DISPS(play->state.gfxCtx, "../z_parameter.c", 3071); } -void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 button) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3079); +void Interface_DrawItemIconTexture(PlayState* play, void* texture, s16 button) { + OPEN_DISPS(play->state.gfxCtx, "../z_parameter.c", 3079); gDPLoadTextureBlock(OVERLAY_DISP++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 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); @@ -2830,14 +2829,14 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 (R_ITEM_ICON_Y(button) + R_ITEM_ICON_WIDTH(button)) << 2, G_TX_RENDERTILE, 0, 0, R_ITEM_ICON_DD(button) << 1, R_ITEM_ICON_DD(button) << 1); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3094); + CLOSE_DISPS(play->state.gfxCtx, "../z_parameter.c", 3094); } -void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { +void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { s16 i; s16 ammo; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3105); + OPEN_DISPS(play->state.gfxCtx, "../z_parameter.c", 3105); i = gSaveContext.equips.buttonItems[button]; @@ -2854,11 +2853,11 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { gDPPipeSync(OVERLAY_DISP++); if ((button == 0) && (gSaveContext.minigameState == 1)) { - ammo = globalCtx->interfaceCtx.hbaAmmo; - } else if ((button == 0) && (globalCtx->shootingGalleryStatus > 1)) { - ammo = globalCtx->shootingGalleryStatus - 1; - } else if ((button == 0) && (globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) { - ammo = globalCtx->bombchuBowlingStatus; + ammo = play->interfaceCtx.hbaAmmo; + } else if ((button == 0) && (play->shootingGalleryStatus > 1)) { + ammo = play->shootingGalleryStatus - 1; + } else if ((button == 0) && (play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38)) { + ammo = play->bombchuBowlingStatus; if (ammo < 0) { ammo = 0; } @@ -2888,19 +2887,19 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { R_ITEM_AMMO_X(button) + 6, R_ITEM_AMMO_Y(button), 8, 8, 1 << 10, 1 << 10); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3158); + CLOSE_DISPS(play->state.gfxCtx, "../z_parameter.c", 3158); } -void Interface_DrawActionButton(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_DrawActionButton(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3172); + OPEN_DISPS(play->state.gfxCtx, "../z_parameter.c", 3172); Matrix_Translate(0.0f, 0.0f, XREG(18) / 10.0f, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateX(interfaceCtx->unk_1F4 / 10000.0f, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3177), + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_parameter.c", 3177), G_MTX_MODELVIEW | G_MTX_LOAD); gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[0], 4, 0); @@ -2910,14 +2909,14 @@ void Interface_DrawActionButton(GlobalContext* globalCtx) { gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3187); + CLOSE_DISPS(play->state.gfxCtx, "../z_parameter.c", 3187); } -void Interface_InitVertices(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void Interface_InitVertices(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 i; - interfaceCtx->actionVtx = Graph_Alloc(globalCtx->state.gfxCtx, 8 * sizeof(Vtx)); + interfaceCtx->actionVtx = Graph_Alloc(play->state.gfxCtx, 8 * sizeof(Vtx)); interfaceCtx->actionVtx[0].v.ob[0] = interfaceCtx->actionVtx[2].v.ob[0] = -14; interfaceCtx->actionVtx[1].v.ob[0] = interfaceCtx->actionVtx[3].v.ob[0] = interfaceCtx->actionVtx[0].v.ob[0] + 28; @@ -2959,7 +2958,7 @@ void Interface_InitVertices(GlobalContext* globalCtx) { interfaceCtx->actionVtx[5].v.tc[0] = interfaceCtx->actionVtx[7].v.tc[0] = 1536; interfaceCtx->actionVtx[6].v.tc[1] = interfaceCtx->actionVtx[7].v.tc[1] = 512; - interfaceCtx->beatingHeartVtx = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Vtx)); + interfaceCtx->beatingHeartVtx = Graph_Alloc(play->state.gfxCtx, 4 * sizeof(Vtx)); interfaceCtx->beatingHeartVtx[0].v.ob[0] = interfaceCtx->beatingHeartVtx[2].v.ob[0] = -8; interfaceCtx->beatingHeartVtx[1].v.ob[0] = interfaceCtx->beatingHeartVtx[3].v.ob[0] = 8; @@ -2988,8 +2987,8 @@ void Interface_InitVertices(GlobalContext* globalCtx) { 255; } -void func_8008A8B8(GlobalContext* globalCtx, s32 topY, s32 bottomY, s32 leftX, s32 rightX) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_8008A8B8(PlayState* play, s32 topY, s32 bottomY, s32 leftX, s32 rightX) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; Vec3f eye; Vec3f lookAt; Vec3f up; @@ -3017,7 +3016,7 @@ void func_8008A994(InterfaceContext* interfaceCtx) { View_ApplyOrthoToOverlay(&interfaceCtx->view); } -void Interface_Draw(GlobalContext* globalCtx) { +void Interface_Draw(PlayState* play) { static s16 magicArrowEffectsR[] = { 255, 100, 255 }; static s16 magicArrowEffectsG[] = { 0, 100, 255 }; static s16 magicArrowEffectsB[] = { 0, 255, 100 }; @@ -3037,10 +3036,10 @@ void Interface_Draw(GlobalContext* globalCtx) { static s16 D_8015FFE4; static s16 D_8015FFE6; static s16 timerDigits[5]; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - MessageContext* msgCtx = &globalCtx->msgCtx; - Player* player = GET_PLAYER(globalCtx); + InterfaceContext* interfaceCtx = &play->interfaceCtx; + PauseContext* pauseCtx = &play->pauseCtx; + MessageContext* msgCtx = &play->msgCtx; + Player* player = GET_PLAYER(play); s16 svar1; s16 svar2; s16 svar3; @@ -3048,7 +3047,7 @@ void Interface_Draw(GlobalContext* globalCtx) { s16 svar5; s16 svar6; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3405); + OPEN_DISPS(play->state.gfxCtx, "../z_parameter.c", 3405); gSPSegment(OVERLAY_DISP++, 0x02, interfaceCtx->parameterSegment); gSPSegment(OVERLAY_DISP++, 0x07, interfaceCtx->doActionSegment); @@ -3056,18 +3055,18 @@ void Interface_Draw(GlobalContext* globalCtx) { gSPSegment(OVERLAY_DISP++, 0x0B, interfaceCtx->mapSegment); if (pauseCtx->debugState == 0) { - Interface_InitVertices(globalCtx); + Interface_InitVertices(play); func_8008A994(interfaceCtx); - Health_DrawMeter(globalCtx); + Health_DrawMeter(play); - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); // Rupee Icon gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 100, interfaceCtx->magicAlpha); gDPSetEnvColor(OVERLAY_DISP++, 0, 80, 0, 255); OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, 26, 206, 16, 16, 1 << 10, 1 << 10); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_BMORI1: case SCENE_HIDAN: case SCENE_MIZUSIN: @@ -3162,16 +3161,16 @@ void Interface_Draw(GlobalContext* globalCtx) { 16, svar3, 206, 8, 16, 1 << 10, 1 << 10); } - Interface_DrawMagicBar(globalCtx); - Minimap_Draw(globalCtx); + Interface_DrawMagicBar(play); + Minimap_Draw(play); if ((R_PAUSE_MENU_MODE != 2) && (R_PAUSE_MENU_MODE != 3)) { - func_8002C124(&globalCtx->actorCtx.targetCtx, globalCtx); // Draw Z-Target + func_8002C124(&play->actorCtx.targetCtx, play); // Draw Z-Target } - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); - Interface_DrawItemButtons(globalCtx); + Interface_DrawItemButtons(play); gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); @@ -3180,14 +3179,14 @@ void Interface_Draw(GlobalContext* globalCtx) { if (!(interfaceCtx->unk_1FA)) { // B Button Icon & Ammo Count if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { - Interface_DrawItemIconTexture(globalCtx, interfaceCtx->iconItemSegment, 0); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment, 0); - if ((player->stateFlags1 & PLAYER_STATE1_23) || (globalCtx->shootingGalleryStatus > 1) || - ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { + if ((player->stateFlags1 & PLAYER_STATE1_23) || (play->shootingGalleryStatus > 1) || + ((play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38))) { gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 0, interfaceCtx->bAlpha); + Interface_DrawAmmoCount(play, 0, interfaceCtx->bAlpha); } } } else { @@ -3215,11 +3214,11 @@ void Interface_Draw(GlobalContext* globalCtx) { if (gSaveContext.equips.buttonItems[1] < 0xF0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cLeftAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); - Interface_DrawItemIconTexture(globalCtx, interfaceCtx->iconItemSegment + 0x1000, 1); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x1000, 1); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 1, interfaceCtx->cLeftAlpha); + Interface_DrawAmmoCount(play, 1, interfaceCtx->cLeftAlpha); } gDPPipeSync(OVERLAY_DISP++); @@ -3228,11 +3227,11 @@ void Interface_Draw(GlobalContext* globalCtx) { if (gSaveContext.equips.buttonItems[2] < 0xF0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cDownAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); - Interface_DrawItemIconTexture(globalCtx, interfaceCtx->iconItemSegment + 0x2000, 2); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x2000, 2); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 2, interfaceCtx->cDownAlpha); + Interface_DrawAmmoCount(play, 2, interfaceCtx->cDownAlpha); } gDPPipeSync(OVERLAY_DISP++); @@ -3241,23 +3240,23 @@ void Interface_Draw(GlobalContext* globalCtx) { if (gSaveContext.equips.buttonItems[3] < 0xF0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cRightAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); - Interface_DrawItemIconTexture(globalCtx, interfaceCtx->iconItemSegment + 0x3000, 3); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x3000, 3); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - Interface_DrawAmmoCount(globalCtx, 3, interfaceCtx->cRightAlpha); + Interface_DrawAmmoCount(play, 3, interfaceCtx->cRightAlpha); } // A Button - func_80094A14(globalCtx->state.gfxCtx); - func_8008A8B8(globalCtx, R_A_BTN_Y, R_A_BTN_Y + 45, R_A_BTN_X, R_A_BTN_X + 45); + func_80094A14(play->state.gfxCtx); + func_8008A8B8(play, R_A_BTN_Y, R_A_BTN_Y + 45, R_A_BTN_X, R_A_BTN_X + 45); gSPClearGeometryMode(OVERLAY_DISP++, G_CULL_BOTH); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2), interfaceCtx->aAlpha); - Interface_DrawActionButton(globalCtx); + Interface_DrawActionButton(play); gDPPipeSync(OVERLAY_DISP++); - func_8008A8B8(globalCtx, R_A_ICON_Y, R_A_ICON_Y + 45, R_A_ICON_X, R_A_ICON_X + 45); + func_8008A8B8(play, R_A_ICON_Y, R_A_ICON_Y + 45, R_A_ICON_X, R_A_ICON_X + 45); gSPSetGeometryMode(OVERLAY_DISP++, G_CULL_BACK); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); @@ -3266,14 +3265,14 @@ void Interface_Draw(GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, WREG(46 + gSaveContext.language) / 10.0f, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateX(interfaceCtx->unk_1F4 / 10000.0f, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3701), + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_parameter.c", 3701), G_MTX_MODELVIEW | G_MTX_LOAD); gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[4], 4, 0); if ((interfaceCtx->unk_1EC < 2) || (interfaceCtx->unk_1EC == 3)) { - Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment); + Interface_DrawActionLabel(play->state.gfxCtx, interfaceCtx->doActionSegment); } else { - Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE); + Interface_DrawActionLabel(play->state.gfxCtx, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE); } gDPPipeSync(OVERLAY_DISP++); @@ -3283,7 +3282,7 @@ void Interface_Draw(GlobalContext* globalCtx) { if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 3)) { // Inventory Equip Effects gSPSegment(OVERLAY_DISP++, 0x08, pauseCtx->iconItemSegment); - func_80094A14(globalCtx->state.gfxCtx); + func_80094A14(play->state.gfxCtx); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); @@ -3329,9 +3328,9 @@ void Interface_Draw(GlobalContext* globalCtx) { gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); } - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { if (gSaveContext.minigameState != 1) { // Carrots rendering if the action corresponds to riding a horse if (interfaceCtx->unk_1EE == 8) { @@ -3388,12 +3387,12 @@ void Interface_Draw(GlobalContext* globalCtx) { } } - if ((gSaveContext.timer2State == 5) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT)) { + if ((gSaveContext.timer2State == 5) && (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT)) { // Trade quest timer reached 0 D_8015FFE6 = 40; gSaveContext.cutsceneIndex = 0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.timer2State = 0; if ((gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI) && @@ -3414,25 +3413,24 @@ void Interface_Draw(GlobalContext* globalCtx) { (u16) ~(EVENTINF_HORSES_STATE_MASK | EVENTINF_HORSES_HORSETYPE_MASK | EVENTINF_HORSES_05_MASK | EVENTINF_HORSES_06_MASK | EVENTINF_HORSES_0F_MASK); osSyncPrintf("EVENT_INF=%x\n", gSaveContext.eventInf[EVENTINF_HORSES_INDEX]); - globalCtx->nextEntranceIndex = spoilingItemEntrances[svar1]; + play->nextEntranceIndex = spoilingItemEntrances[svar1]; INV_CONTENT(gSpoilingItemReverts[svar1]) = gSpoilingItemReverts[svar1]; for (svar2 = 1; svar2 < 4; svar2++) { if (gSaveContext.equips.buttonItems[svar2] == gSpoilingItems[svar1]) { gSaveContext.equips.buttonItems[svar2] = gSpoilingItemReverts[svar1]; - Interface_LoadItemIcon1(globalCtx, svar2); + Interface_LoadItemIcon1(play, svar2); } } } } } - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && - (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == MSGMODE_NONE) && - !(player->stateFlags2 & PLAYER_STATE2_24) && (globalCtx->transitionTrigger == TRANS_TRIGGER_OFF) && - (globalCtx->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(globalCtx) && - (gSaveContext.minigameState != 1) && (globalCtx->shootingGalleryStatus <= 1) && - !((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && + (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == MSGMODE_NONE) && + !(player->stateFlags2 & PLAYER_STATE2_24) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play) && (gSaveContext.minigameState != 1) && + (play->shootingGalleryStatus <= 1) && !((play->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38))) { svar6 = 0; switch (gSaveContext.timer1State) { case 1: @@ -3522,7 +3520,7 @@ void Interface_Draw(GlobalContext* globalCtx) { gSaveContext.timer1State = 10; if (D_80125A5C) { gSaveContext.health = 0; - globalCtx->damagePlayer(globalCtx, -(gSaveContext.health + 2)); + play->damagePlayer(play, -(gSaveContext.health + 2)); } D_80125A5C = false; } else if (gSaveContext.timer1Value > 60) { @@ -3690,16 +3688,16 @@ void Interface_Draw(GlobalContext* globalCtx) { osSyncPrintf("TOTAL_EVENT_TM=%d\n", gSaveContext.timer2Value); if (gSaveContext.timer2Value <= 0) { - if (!Flags_GetSwitch(globalCtx, 0x37) || - ((globalCtx->sceneNum != SCENE_GANON_DEMO) && - (globalCtx->sceneNum != SCENE_GANON_FINAL) && - (globalCtx->sceneNum != SCENE_GANON_SONOGO) && - (globalCtx->sceneNum != SCENE_GANONTIKA_SONOGO))) { + if (!Flags_GetSwitch(play, 0x37) || + ((play->sceneNum != SCENE_GANON_DEMO) && + (play->sceneNum != SCENE_GANON_FINAL) && + (play->sceneNum != SCENE_GANON_SONOGO) && + (play->sceneNum != SCENE_GANONTIKA_SONOGO))) { D_8015FFE6 = 40; gSaveContext.timer2State = 5; gSaveContext.cutsceneIndex = 0; - Message_StartTextbox(globalCtx, 0x71B0, NULL); - func_8002DF54(globalCtx, NULL, 8); + Message_StartTextbox(play, 0x71B0, NULL); + func_8002DF54(play, NULL, 8); } else { D_8015FFE6 = 40; gSaveContext.timer2State = 6; @@ -3725,7 +3723,7 @@ void Interface_Draw(GlobalContext* globalCtx) { gSaveContext.timer2Value++; if (GET_EVENTINF(EVENTINF_10)) { if (gSaveContext.timer2Value == 240) { - Message_StartTextbox(globalCtx, 0x6083, NULL); + Message_StartTextbox(play, 0x6083, NULL); CLEAR_EVENTINF(EVENTINF_10); gSaveContext.timer2State = 0; } @@ -3814,7 +3812,7 @@ void Interface_Draw(GlobalContext* globalCtx) { } if (pauseCtx->debugState == 3) { - FlagSet_Update(globalCtx); + FlagSet_Update(play); } if (interfaceCtx->unk_244 != 0) { @@ -3824,19 +3822,19 @@ void Interface_Draw(GlobalContext* globalCtx) { gDPFillRectangle(OVERLAY_DISP++, 0, 0, gScreenWidth - 1, gScreenHeight - 1); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 4269); + CLOSE_DISPS(play->state.gfxCtx, "../z_parameter.c", 4269); } -void Interface_Update(GlobalContext* globalCtx) { +void Interface_Update(PlayState* play) { static u8 D_80125B60 = false; static s16 sPrevTimeSpeed = 0; - MessageContext* msgCtx = &globalCtx->msgCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - Player* player = GET_PLAYER(globalCtx); + MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); s16 alpha; s16 alpha1; u16 action; - Input* debugInput = &globalCtx->state.input[2]; + Input* debugInput = &play->state.input[2]; if (CHECK_BTN_ALL(debugInput->press.button, BTN_DLEFT)) { gSaveContext.language = LANGUAGE_ENG; @@ -3849,13 +3847,13 @@ void Interface_Update(GlobalContext* globalCtx) { osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language); } - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { if ((gSaveContext.minigameState == 1) || (gSaveContext.sceneSetupIndex < 4) || - ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex == 4))) { + ((play->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex == 4))) { if ((msgCtx->msgMode == MSGMODE_NONE) || - ((msgCtx->msgMode != MSGMODE_NONE) && (globalCtx->sceneNum == SCENE_BOWLING))) { - if (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) { - func_80083108(globalCtx); + ((msgCtx->msgMode != MSGMODE_NONE) && (play->sceneNum == SCENE_BOWLING))) { + if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { + func_80083108(play); } } } @@ -3880,7 +3878,7 @@ void Interface_Update(GlobalContext* globalCtx) { alpha = 0; } - func_80082850(globalCtx, alpha); + func_80082850(play, alpha); gSaveContext.unk_13EC++; if (alpha == 0) { @@ -3899,7 +3897,7 @@ void Interface_Update(GlobalContext* globalCtx) { } osSyncPrintf("case 50 : alpha=%d alpha1=%d\n", alpha, alpha1); - func_80082644(globalCtx, alpha1); + func_80082644(play, alpha1); if (interfaceCtx->healthAlpha != 255) { interfaceCtx->healthAlpha = alpha1; @@ -3909,7 +3907,7 @@ void Interface_Update(GlobalContext* globalCtx) { interfaceCtx->magicAlpha = alpha1; } - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT00: case SCENE_SPOT01: case SCENE_SPOT02: @@ -3951,13 +3949,13 @@ void Interface_Update(GlobalContext* globalCtx) { break; case 52: gSaveContext.unk_13E8 = 1; - func_80082850(globalCtx, 0); + func_80082850(play, 0); gSaveContext.unk_13E8 = 0; default: break; } - Map_Update(globalCtx); + Map_Update(play); if (gSaveContext.healthAccumulator != 0) { gSaveContext.healthAccumulator -= 4; @@ -3978,25 +3976,25 @@ void Interface_Update(GlobalContext* globalCtx) { } } - Health_UpdateBeatingHeart(globalCtx); - D_80125A58 = func_8008F2F8(globalCtx); + Health_UpdateBeatingHeart(play); + D_80125A58 = func_8008F2F8(play); if (D_80125A58 == 1) { if (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) == EQUIP_VALUE_TUNIC_GORON) { D_80125A58 = 0; } - } else if ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) { + } else if ((func_8008F2F8(play) >= 2) && (func_8008F2F8(play) < 5)) { if (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) == EQUIP_VALUE_TUNIC_ZORA) { D_80125A58 = 0; } } - Health_UpdateMeter(globalCtx); + Health_UpdateMeter(play); - if ((gSaveContext.timer1State >= 3) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && + if ((gSaveContext.timer1State >= 3) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && (msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & PLAYER_STATE2_24) && - (globalCtx->transitionTrigger == TRANS_TRIGGER_OFF) && (globalCtx->transitionMode == TRANS_MODE_OFF) && - !Play_InCsMode(globalCtx)) {} + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && + !Play_InCsMode(play)) {} if (gSaveContext.rupeeAccumulator != 0) { if (gSaveContext.rupeeAccumulator > 0) { @@ -4078,10 +4076,9 @@ void Interface_Update(GlobalContext* globalCtx) { WREG(7) = interfaceCtx->unk_1F4; - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && - (msgCtx->msgMode == MSGMODE_NONE) && (globalCtx->transitionTrigger == TRANS_TRIGGER_OFF) && - (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && (globalCtx->transitionMode == TRANS_MODE_OFF) && - ((globalCtx->csCtx.state == CS_STATE_IDLE) || !Player_InCsMode(globalCtx))) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && (msgCtx->msgMode == MSGMODE_NONE) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + (play->transitionMode == TRANS_MODE_OFF) && ((play->csCtx.state == CS_STATE_IDLE) || !Player_InCsMode(play))) { if ((gSaveContext.magicAcquired != 0) && (gSaveContext.magicLevel == 0)) { gSaveContext.magicLevel = gSaveContext.doubleMagic + 1; gSaveContext.unk_13F0 = 8; @@ -4094,7 +4091,7 @@ void Interface_Update(GlobalContext* globalCtx) { osSyncPrintf(VT_RST); } - Interface_UpdateMagicBar(globalCtx); + Interface_UpdateMagicBar(play); } if (gSaveContext.timer1State == 0) { @@ -4148,11 +4145,11 @@ void Interface_Update(GlobalContext* globalCtx) { // exit out of ocarina mode after suns song finishes playing if ((msgCtx->ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE) && (gSaveContext.sunsSongState == SUNSSONG_START)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } // handle suns song in areas where time moves - if (globalCtx->envCtx.sceneTimeSpeed != 0) { + if (play->envCtx.sceneTimeSpeed != 0) { if (gSaveContext.sunsSongState != SUNSSONG_SPEED_TIME) { D_80125B60 = false; if ((gSaveContext.dayTime >= CLOCK_TIME(6, 30)) && (gSaveContext.dayTime <= CLOCK_TIME(18, 0) + 1)) { @@ -4166,35 +4163,35 @@ void Interface_Update(GlobalContext* globalCtx) { if ((gSaveContext.dayTime >= CLOCK_TIME(6, 30)) && (gSaveContext.dayTime <= CLOCK_TIME(18, 0) + 1)) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; gTimeSpeed = sPrevTimeSpeed; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } } else if (gSaveContext.dayTime > CLOCK_TIME(18, 0) + 1) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; gTimeSpeed = sPrevTimeSpeed; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } - } else if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_1) && + } else if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_1) && (interfaceCtx->restrictions.sunsSong != 3)) { if ((gSaveContext.dayTime >= CLOCK_TIME(6, 30)) && (gSaveContext.dayTime < CLOCK_TIME(18, 0) + 1)) { gSaveContext.nextDayTime = NEXT_TIME_NIGHT; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; - globalCtx->unk_11DE9 = true; + play->unk_11DE9 = true; } else { gSaveContext.nextDayTime = NEXT_TIME_DAY; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE_FAST; + play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; - globalCtx->unk_11DE9 = true; + play->unk_11DE9 = true; } - if (globalCtx->sceneNum == SCENE_SPOT13) { - globalCtx->transitionType = TRANS_TYPE_SANDSTORM_PERSIST; + if (play->sceneNum == SCENE_SPOT13) { + play->transitionType = TRANS_TYPE_SANDSTORM_PERSIST; gSaveContext.nextTransitionType = TRANS_TYPE_SANDSTORM_PERSIST; } gSaveContext.respawnFlag = -2; - globalCtx->nextEntranceIndex = gSaveContext.entranceIndex; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = gSaveContext.entranceIndex; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.sunsSongState = SUNSSONG_INACTIVE; func_800F6964(30); gSaveContext.seqId = (u8)NA_BGM_DISABLED; diff --git a/src/code/z_path.c b/src/code/z_path.c index 1c2f94d901..db3c8af4d2 100644 --- a/src/code/z_path.c +++ b/src/code/z_path.c @@ -1,10 +1,10 @@ #include "global.h" -Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max) { +Path* Path_GetByIndex(PlayState* play, s16 index, s16 max) { Path* path; if (index != max) { - path = &globalCtx->setupPathList[index]; + path = &play->setupPathList[index]; } else { path = NULL; } diff --git a/src/code/z_play.c b/src/code/z_play.c index f841cd4c1c..706b12a325 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -13,13 +13,13 @@ FaultClient D_801614B8; s16 sTransitionFillTimer; u64 D_801614D0[0xA00]; -void Play_SpawnScene(GlobalContext* this, s32 sceneNum, s32 spawn); +void Play_SpawnScene(PlayState* this, s32 sceneNum, s32 spawn); -void func_800BC450(GlobalContext* this) { +void func_800BC450(PlayState* this) { Camera_ChangeDataIdx(GET_ACTIVE_CAM(this), this->unk_1242B - 1); } -void func_800BC490(GlobalContext* this, s16 point) { +void func_800BC490(PlayState* this, s16 point) { ASSERT(point == 1 || point == 2, "point == 1 || point == 2", "../z_play.c", 2160); this->unk_1242B = point; @@ -32,12 +32,12 @@ void func_800BC490(GlobalContext* this, s16 point) { func_800BC450(this); } -s32 func_800BC56C(GlobalContext* this, s16 arg1) { +s32 func_800BC56C(PlayState* this, s16 arg1) { return (arg1 == this->unk_1242B); } // original name: "Game_play_shop_pr_vr_switch_set" -void func_800BC590(GlobalContext* this) { +void func_800BC590(PlayState* this) { osSyncPrintf("Game_play_shop_pr_vr_switch_set()\n"); if (YREG(15) == 0x10) { @@ -45,7 +45,7 @@ void func_800BC590(GlobalContext* this) { } } -void Play_SetupTransition(GlobalContext* this, s32 transitionType) { +void Play_SetupTransition(PlayState* this, s32 transitionType) { TransitionContext* transitionCtx = &this->transitionCtx; bzero(transitionCtx, sizeof(TransitionContext)); @@ -143,17 +143,17 @@ void Play_SetupTransition(GlobalContext* this, s32 transitionType) { } } -void func_800BC88C(GlobalContext* this) { +void func_800BC88C(PlayState* this) { this->transitionCtx.transitionType = -1; } -Gfx* Play_SetFog(GlobalContext* this, Gfx* gfx) { +Gfx* Play_SetFog(PlayState* this, Gfx* gfx) { return Gfx_SetFog2(gfx, this->lightCtx.fogColor[0], this->lightCtx.fogColor[1], this->lightCtx.fogColor[2], 0, this->lightCtx.fogNear, 1000); } void Play_Destroy(GameState* thisx) { - GlobalContext* this = (GlobalContext*)thisx; + PlayState* this = (PlayState*)thisx; Player* player = GET_PLAYER(this); this->state.gfxCtx->callback = NULL; @@ -195,7 +195,7 @@ void Play_Destroy(GameState* thisx) { } void Play_Init(GameState* thisx) { - GlobalContext* this = (GlobalContext*)thisx; + PlayState* this = (PlayState*)thisx; GraphicsContext* gfxCtx = this->state.gfxCtx; u32 zAlloc; u32 zAllocAligned; @@ -418,7 +418,7 @@ void Play_Init(GameState* thisx) { } } -void Play_Update(GlobalContext* this) { +void Play_Update(PlayState* this) { s32 pad1; s32 sp80; Input* input; @@ -603,7 +603,7 @@ void Play_Update(GlobalContext* this) { this->state.running = false; if (gSaveContext.gameMode != 2) { - SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); gSaveContext.entranceIndex = this->nextEntranceIndex; if (gSaveContext.minigameState == 1) { @@ -654,7 +654,7 @@ void Play_Update(GlobalContext* this) { if (sTransitionFillTimer >= 20) { this->state.running = false; - SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); gSaveContext.entranceIndex = this->nextEntranceIndex; this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -696,7 +696,7 @@ void Play_Update(GlobalContext* this) { case TRANS_MODE_INSTANT: if (this->transitionTrigger != TRANS_TRIGGER_END) { this->state.running = false; - SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); gSaveContext.entranceIndex = this->nextEntranceIndex; this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -742,7 +742,7 @@ void Play_Update(GlobalContext* this) { } else { if (this->envCtx.sandstormEnvA == 255) { this->state.running = false; - SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); gSaveContext.entranceIndex = this->nextEntranceIndex; this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -1073,7 +1073,7 @@ skip: this->state.gfxCtx); } -void Play_DrawOverlayElements(GlobalContext* this) { +void Play_DrawOverlayElements(PlayState* this) { if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0)) { KaleidoScopeCall_Draw(this); } @@ -1089,7 +1089,7 @@ void Play_DrawOverlayElements(GlobalContext* this) { } } -void Play_Draw(GlobalContext* this) { +void Play_Draw(PlayState* this) { GraphicsContext* gfxCtx = this->state.gfxCtx; Lights* sp228; Vec3f sp21C; @@ -1346,7 +1346,7 @@ void Play_Draw(GlobalContext* this) { } void Play_Main(GameState* thisx) { - GlobalContext* this = (GlobalContext*)thisx; + PlayState* this = (PlayState*)thisx; D_8012D1F8 = &this->state.input[0]; @@ -1389,11 +1389,11 @@ void Play_Main(GameState* thisx) { } // original name: "Game_play_demo_mode_check" -s32 Play_InCsMode(GlobalContext* this) { +s32 Play_InCsMode(PlayState* this) { return (this->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(this); } -f32 func_800BFCB8(GlobalContext* this, MtxF* mf, Vec3f* vec) { +f32 func_800BFCB8(PlayState* this, MtxF* mf, Vec3f* vec) { CollisionPoly poly; f32 temp1; f32 temp2; @@ -1459,7 +1459,7 @@ f32 func_800BFCB8(GlobalContext* this, MtxF* mf, Vec3f* vec) { return floorY; } -void* Play_LoadFile(GlobalContext* this, RomFile* file) { +void* Play_LoadFile(PlayState* this, RomFile* file) { u32 size; void* allocp; @@ -1470,12 +1470,12 @@ void* Play_LoadFile(GlobalContext* this, RomFile* file) { return allocp; } -void Play_InitEnvironment(GlobalContext* this, s16 skyboxId) { +void Play_InitEnvironment(PlayState* this, s16 skyboxId) { Skybox_Init(&this->state, &this->skyboxCtx, skyboxId); Environment_Init(this, &this->envCtx, 0); } -void Play_InitScene(GlobalContext* this, s32 spawn) { +void Play_InitScene(PlayState* this, s32 spawn) { this->curSpawn = spawn; this->linkActorEntry = NULL; this->unk_11DFC = NULL; @@ -1494,7 +1494,7 @@ void Play_InitScene(GlobalContext* this, s32 spawn) { Play_InitEnvironment(this, this->skyboxId); } -void Play_SpawnScene(GlobalContext* this, s32 sceneNum, s32 spawn) { +void Play_SpawnScene(PlayState* this, s32 sceneNum, s32 spawn) { SceneTableEntry* scene = &gSceneTable[sceneNum]; scene->unk_13 = 0; @@ -1515,7 +1515,7 @@ void Play_SpawnScene(GlobalContext* this, s32 sceneNum, s32 spawn) { osSyncPrintf("ROOM SIZE=%fK\n", func_80096FE8(this, &this->roomCtx) / 1024.0f); } -void Play_GetScreenPos(GlobalContext* this, Vec3f* src, Vec3f* dest) { +void Play_GetScreenPos(PlayState* this, Vec3f* src, Vec3f* dest) { f32 w; Matrix_Mult(&this->viewProjectionMtxF, MTXMODE_NEW); @@ -1528,7 +1528,7 @@ void Play_GetScreenPos(GlobalContext* this, Vec3f* src, Vec3f* dest) { dest->y = (SCREEN_HEIGHT / 2) - ((dest->y / w) * (SCREEN_HEIGHT / 2)); } -s16 Play_CreateSubCamera(GlobalContext* this) { +s16 Play_CreateSubCamera(PlayState* this) { s16 i; for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) { @@ -1553,11 +1553,11 @@ s16 Play_CreateSubCamera(GlobalContext* this) { return i; } -s16 Play_GetActiveCamId(GlobalContext* this) { +s16 Play_GetActiveCamId(PlayState* this) { return this->activeCamId; } -s16 Play_ChangeCameraStatus(GlobalContext* this, s16 camId, s16 status) { +s16 Play_ChangeCameraStatus(PlayState* this, s16 camId, s16 status) { s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; if (status == CAM_STAT_ACTIVE) { @@ -1567,7 +1567,7 @@ s16 Play_ChangeCameraStatus(GlobalContext* this, s16 camId, s16 status) { return Camera_ChangeStatus(this->cameraPtrs[camIdx], status); } -void Play_ClearCamera(GlobalContext* this, s16 camId) { +void Play_ClearCamera(PlayState* this, s16 camId) { s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; if (camIdx == CAM_ID_MAIN) { @@ -1585,7 +1585,7 @@ void Play_ClearCamera(GlobalContext* this, s16 camId) { } } -void Play_ClearAllSubCameras(GlobalContext* this) { +void Play_ClearAllSubCameras(PlayState* this) { s16 subCamId; for (subCamId = CAM_ID_SUB_FIRST; subCamId < NUM_CAMS; subCamId++) { @@ -1597,13 +1597,13 @@ void Play_ClearAllSubCameras(GlobalContext* this) { this->activeCamId = CAM_ID_MAIN; } -Camera* Play_GetCamera(GlobalContext* this, s16 camId) { +Camera* Play_GetCamera(PlayState* this, s16 camId) { s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; return this->cameraPtrs[camIdx]; } -s32 Play_CameraSetAtEye(GlobalContext* this, s16 camId, Vec3f* at, Vec3f* eye) { +s32 Play_CameraSetAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) { s32 ret = 0; s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; Camera* camera = this->cameraPtrs[camIdx]; @@ -1629,7 +1629,7 @@ s32 Play_CameraSetAtEye(GlobalContext* this, s16 camId, Vec3f* at, Vec3f* eye) { return ret; } -s32 Play_CameraSetAtEyeUp(GlobalContext* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) { +s32 Play_CameraSetAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) { s32 ret = 0; s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; Camera* camera = this->cameraPtrs[camIdx]; @@ -1657,14 +1657,14 @@ s32 Play_CameraSetAtEyeUp(GlobalContext* this, s16 camId, Vec3f* at, Vec3f* eye, return ret; } -s32 Play_CameraSetFov(GlobalContext* this, s16 camId, f32 fov) { +s32 Play_CameraSetFov(PlayState* this, s16 camId, f32 fov) { s32 ret = Camera_SetParam(this->cameraPtrs[camId], 0x20, &fov) & 1; if (1) {} return ret; } -s32 Play_SetCameraRoll(GlobalContext* this, s16 camId, s16 roll) { +s32 Play_SetCameraRoll(PlayState* this, s16 camId, s16 roll) { s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; Camera* camera = this->cameraPtrs[camIdx]; @@ -1673,14 +1673,14 @@ s32 Play_SetCameraRoll(GlobalContext* this, s16 camId, s16 roll) { return 1; } -void Play_CopyCamera(GlobalContext* this, s16 destCamId, s16 srcCamId) { +void Play_CopyCamera(PlayState* this, s16 destCamId, s16 srcCamId) { s16 srcCamId2 = (srcCamId == CAM_ID_NONE) ? this->activeCamId : srcCamId; s16 destCamId1 = (destCamId == CAM_ID_NONE) ? this->activeCamId : destCamId; Camera_Copy(this->cameraPtrs[destCamId1], this->cameraPtrs[srcCamId2]); } -s32 func_800C0808(GlobalContext* this, s16 camId, Player* player, s16 setting) { +s32 func_800C0808(PlayState* this, s16 camId, Player* player, s16 setting) { Camera* camera; s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; @@ -1689,11 +1689,11 @@ s32 func_800C0808(GlobalContext* this, s16 camId, Player* player, s16 setting) { return Camera_ChangeSetting(camera, setting); } -s32 Play_CameraChangeSetting(GlobalContext* this, s16 camId, s16 setting) { +s32 Play_CameraChangeSetting(PlayState* this, s16 camId, s16 setting) { return Camera_ChangeSetting(Play_GetCamera(this, camId), setting); } -void func_800C08AC(GlobalContext* this, s16 camId, s16 arg2) { +void func_800C08AC(PlayState* this, s16 camId, s16 arg2) { s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; s16 i; @@ -1716,7 +1716,7 @@ void func_800C08AC(GlobalContext* this, s16 camId, s16 arg2) { } } -s16 Play_CameraGetUID(GlobalContext* this, s16 camId) { +s16 Play_CameraGetUID(PlayState* this, s16 camId) { Camera* camera = this->cameraPtrs[camId]; if (camera != NULL) { @@ -1726,7 +1726,7 @@ s16 Play_CameraGetUID(GlobalContext* this, s16 camId) { } } -s16 func_800C09D8(GlobalContext* this, s16 camId, s16 arg2) { +s16 func_800C09D8(PlayState* this, s16 camId, s16 arg2) { Camera* camera = this->cameraPtrs[camId]; if (camera != NULL) { @@ -1740,7 +1740,7 @@ s16 func_800C09D8(GlobalContext* this, s16 camId, s16 arg2) { } } -void Play_SaveSceneFlags(GlobalContext* this) { +void Play_SaveSceneFlags(PlayState* this) { SavedSceneFlags* savedSceneFlags = &gSaveContext.sceneFlags[this->sceneNum]; savedSceneFlags->chest = this->actorCtx.flags.chest; @@ -1749,7 +1749,7 @@ void Play_SaveSceneFlags(GlobalContext* this) { savedSceneFlags->collect = this->actorCtx.flags.collect; } -void Play_SetRespawnData(GlobalContext* this, s32 respawnMode, s16 entranceIndex, s32 roomIndex, s32 playerParams, +void Play_SetRespawnData(PlayState* this, s32 respawnMode, s16 entranceIndex, s32 roomIndex, s32 playerParams, Vec3f* pos, s16 yaw) { RespawnData* respawnData = &gSaveContext.respawn[respawnMode]; @@ -1762,7 +1762,7 @@ void Play_SetRespawnData(GlobalContext* this, s32 respawnMode, s16 entranceIndex respawnData->tempCollectFlags = this->actorCtx.flags.tempCollect; } -void Play_SetupRespawnPoint(GlobalContext* this, s32 respawnMode, s32 playerParams) { +void Play_SetupRespawnPoint(PlayState* this, s32 respawnMode, s32 playerParams) { Player* player = GET_PLAYER(this); s32 entranceIndex; s8 roomIndex; @@ -1775,7 +1775,7 @@ void Play_SetupRespawnPoint(GlobalContext* this, s32 respawnMode, s32 playerPara } } -void Play_TriggerVoidOut(GlobalContext* this) { +void Play_TriggerVoidOut(PlayState* this) { gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = this->actorCtx.flags.tempSwch; gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = this->actorCtx.flags.tempCollect; gSaveContext.respawnFlag = 1; @@ -1784,7 +1784,7 @@ void Play_TriggerVoidOut(GlobalContext* this) { this->transitionType = TRANS_TYPE_FADE_BLACK; } -void Play_LoadToLastEntrance(GlobalContext* this) { +void Play_LoadToLastEntrance(PlayState* this) { gSaveContext.respawnFlag = -1; this->transitionTrigger = TRANS_TRIGGER_START; @@ -1802,21 +1802,21 @@ void Play_LoadToLastEntrance(GlobalContext* this) { this->transitionType = TRANS_TYPE_FADE_BLACK; } -void Play_TriggerRespawn(GlobalContext* this) { +void Play_TriggerRespawn(PlayState* this) { Play_SetupRespawnPoint(this, RESPAWN_MODE_DOWN, 0xDFF); Play_LoadToLastEntrance(this); } -s32 func_800C0CB8(GlobalContext* this) { +s32 func_800C0CB8(PlayState* this) { return (this->roomCtx.curRoom.meshHeader->base.type != 1) && (YREG(15) != 0x20) && (YREG(15) != 0x30) && (YREG(15) != 0x40) && (this->sceneNum != SCENE_HAIRAL_NIWA); } -s32 FrameAdvance_IsEnabled(GlobalContext* this) { +s32 FrameAdvance_IsEnabled(PlayState* this) { return !!this->frameAdvCtx.enabled; } -s32 func_800C0D34(GlobalContext* this, Actor* actor, s16* yaw) { +s32 func_800C0D34(PlayState* this, Actor* actor, s16* yaw) { TransitionActorEntry* transitionActor; s32 frontRoom; @@ -1840,7 +1840,7 @@ s32 func_800C0D34(GlobalContext* this, Actor* actor, s16* yaw) { return 1; } -s32 func_800C0DB4(GlobalContext* this, Vec3f* pos) { +s32 func_800C0DB4(PlayState* this, Vec3f* pos) { WaterBox* waterBox; CollisionPoly* poly; Vec3f waterSurfacePos; diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 0663dc6aec..ea9a4be3e9 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -2,20 +2,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_26) -void (*sPlayerCallInitFunc)(Actor* thisx, GlobalContext* globalCtx); -void (*sPlayerCallDestroyFunc)(Actor* thisx, GlobalContext* globalCtx); -void (*sPlayerCallUpdateFunc)(Actor* thisx, GlobalContext* globalCtx); -void (*sPlayerCallDrawFunc)(Actor* thisx, GlobalContext* globalCtx); +void (*sPlayerCallInitFunc)(Actor* thisx, PlayState* play); +void (*sPlayerCallDestroyFunc)(Actor* thisx, PlayState* play); +void (*sPlayerCallUpdateFunc)(Actor* thisx, PlayState* play); +void (*sPlayerCallDrawFunc)(Actor* thisx, PlayState* play); -void PlayerCall_Init(Actor* thisx, GlobalContext* globalCtx); -void PlayerCall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void PlayerCall_Update(Actor* thisx, GlobalContext* globalCtx); -void PlayerCall_Draw(Actor* thisx, GlobalContext* globalCtx); +void PlayerCall_Init(Actor* thisx, PlayState* play); +void PlayerCall_Destroy(Actor* thisx, PlayState* play); +void PlayerCall_Update(Actor* thisx, PlayState* play); +void PlayerCall_Draw(Actor* thisx, PlayState* play); -void Player_Init(Actor* thisx, GlobalContext* globalCtx); -void Player_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Player_Update(Actor* thisx, GlobalContext* globalCtx); -void Player_Draw(Actor* thisx, GlobalContext* globalCtx); +void Player_Init(Actor* thisx, PlayState* play); +void Player_Destroy(Actor* thisx, PlayState* play); +void Player_Update(Actor* thisx, PlayState* play); +void Player_Draw(Actor* thisx, PlayState* play); const ActorInit Player_InitVars = { ACTOR_PLAYER, @@ -36,23 +36,23 @@ void PlayerCall_InitFuncPtrs(void) { sPlayerCallDrawFunc = KaleidoManager_GetRamAddr(Player_Draw); } -void PlayerCall_Init(Actor* thisx, GlobalContext* globalCtx) { +void PlayerCall_Init(Actor* thisx, PlayState* play) { KaleidoScopeCall_LoadPlayer(); PlayerCall_InitFuncPtrs(); - sPlayerCallInitFunc(thisx, globalCtx); + sPlayerCallInitFunc(thisx, play); } -void PlayerCall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void PlayerCall_Destroy(Actor* thisx, PlayState* play) { KaleidoScopeCall_LoadPlayer(); - sPlayerCallDestroyFunc(thisx, globalCtx); + sPlayerCallDestroyFunc(thisx, play); } -void PlayerCall_Update(Actor* thisx, GlobalContext* globalCtx) { +void PlayerCall_Update(Actor* thisx, PlayState* play) { KaleidoScopeCall_LoadPlayer(); - sPlayerCallUpdateFunc(thisx, globalCtx); + sPlayerCallUpdateFunc(thisx, play); } -void PlayerCall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void PlayerCall_Draw(Actor* thisx, PlayState* play) { KaleidoScopeCall_LoadPlayer(); - sPlayerCallDrawFunc(thisx, globalCtx); + sPlayerCallDrawFunc(thisx, play); } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 6f15c1c073..b71c89ccc8 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -435,7 +435,7 @@ Vec3f sGetItemRefPos; s32 sLeftHandType; s32 sRightHandType; -void Player_SetBootData(GlobalContext* globalCtx, Player* this) { +void Player_SetBootData(PlayState* play, Player* this) { s32 currentBoots; s16* bootRegs; @@ -474,22 +474,22 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) { IREG(69) = bootRegs[15]; MREG(95) = bootRegs[16]; - if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) { + if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) { REG(45) = 500; } } -s32 Player_InBlockingCsMode(GlobalContext* globalCtx, Player* this) { +s32 Player_InBlockingCsMode(PlayState* play, Player* this) { return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csMode != 0) || - (globalCtx->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0) || + (play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0) || (this->stateFlags3 & PLAYER_STATE3_7) || ((gSaveContext.unk_13F0 != 0) && (Player_ActionToMagicSpell(this, this->itemActionParam) >= 0)); } -s32 Player_InCsMode(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_InCsMode(PlayState* play) { + Player* this = GET_PLAYER(play); - return Player_InBlockingCsMode(globalCtx, this) || (this->unk_6AD == 4); + return Player_InBlockingCsMode(play, this) || (this->unk_6AD == 4); } s32 func_8008E9C4(Player* this) { @@ -568,19 +568,19 @@ void func_8008EC70(Player* this) { this->unk_6AD = 0; } -void Player_SetEquipmentData(GlobalContext* globalCtx, Player* this) { +void Player_SetEquipmentData(PlayState* play, Player* this) { if (this->csMode != 0x56) { this->currentShield = SHIELD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD)); this->currentTunic = TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC)); this->currentBoots = BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS)); this->currentSwordItemId = B_BTN_ITEM; Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam)); - Player_SetBootData(globalCtx, this); + Player_SetBootData(play, this); } } -void Player_UpdateBottleHeld(GlobalContext* globalCtx, Player* this, s32 item, s32 actionParam) { - Inventory_UpdateBottleItem(globalCtx, item, this->heldItemButton); +void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 actionParam) { + Inventory_UpdateBottleItem(play, item, this->heldItemButton); if (item != ITEM_BOTTLE) { this->heldItemId = item; @@ -609,30 +609,30 @@ void func_8008EE08(Player* this) { func_8008EDF0(this); } -void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) { - Player* this = GET_PLAYER(globalCtx); +void func_8008EEAC(PlayState* play, Actor* actor) { + Player* this = GET_PLAYER(play); func_8008EE08(this); this->unk_664 = actor; this->unk_684 = actor; this->stateFlags1 |= PLAYER_STATE1_16; - Camera_SetParam(Play_GetCamera(globalCtx, CAM_ID_MAIN), 8, actor); - Camera_ChangeMode(Play_GetCamera(globalCtx, CAM_ID_MAIN), CAM_MODE_FOLLOWTARGET); + Camera_SetParam(Play_GetCamera(play, CAM_ID_MAIN), 8, actor); + Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_FOLLOWTARGET); } -s32 func_8008EF30(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 func_8008EF30(PlayState* play) { + Player* this = GET_PLAYER(play); return (this->stateFlags1 & PLAYER_STATE1_23); } -s32 func_8008EF44(GlobalContext* globalCtx, s32 ammo) { - globalCtx->shootingGalleryStatus = ammo + 1; +s32 func_8008EF44(PlayState* play, s32 ammo) { + play->shootingGalleryStatus = ammo + 1; return 1; } -s32 Player_IsBurningStickInRange(GlobalContext* globalCtx, Vec3f* pos, f32 xzRange, f32 yRange) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange) { + Player* this = GET_PLAYER(play); Vec3f diff; s32 pad; @@ -656,28 +656,28 @@ s32 Player_GetStrength(void) { } } -u8 Player_GetMask(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +u8 Player_GetMask(PlayState* play) { + Player* this = GET_PLAYER(play); return this->currentMask; } -Player* Player_UnsetMask(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +Player* Player_UnsetMask(PlayState* play) { + Player* this = GET_PLAYER(play); this->currentMask = PLAYER_MASK_NONE; return this; } -s32 Player_HasMirrorShieldEquipped(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_HasMirrorShieldEquipped(PlayState* play) { + Player* this = GET_PLAYER(play); return (this->currentShield == PLAYER_SHIELD_MIRROR); } -s32 Player_HasMirrorShieldSetToDraw(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_HasMirrorShieldSetToDraw(PlayState* play) { + Player* this = GET_PLAYER(play); return (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && (this->currentShield == PLAYER_SHIELD_MIRROR); } @@ -770,12 +770,12 @@ return_neg: return -1; } -s32 func_8008F2F8(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 func_8008F2F8(PlayState* play) { + Player* this = GET_PLAYER(play); TextTriggerEntry* triggerEntry; s32 var; - if (globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot + if (play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot var = 0; } else if ((this->unk_840 > 80) && ((this->currentBoots == PLAYER_BOOTS_IRON) || (this->unk_840 >= 300))) { // Deep underwater @@ -787,7 +787,7 @@ s32 func_8008F2F8(GlobalContext* globalCtx) { } // Trigger general textboxes under certain conditions, like "It's so hot in here!" - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { triggerEntry = &sTextTriggers[var]; if (0) {} @@ -796,7 +796,7 @@ s32 func_8008F2F8(GlobalContext* globalCtx) { (((var == 0) && (this->currentTunic != PLAYER_TUNIC_GORON)) || (((var == 1) || (var == 3)) && (this->currentBoots == PLAYER_BOOTS_IRON) && (this->currentTunic != PLAYER_TUNIC_ZORA)))) { - Message_StartTextbox(globalCtx, triggerEntry->textId, NULL); + Message_StartTextbox(play, triggerEntry->textId, NULL); gSaveContext.textTriggerFlags |= triggerEntry->flag; } } @@ -858,14 +858,13 @@ Gfx* sBootDListGroups[][2] = { { gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, // PLAYER_BOOTS_HOVER }; -void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, - s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, - void* data) { +void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, s32 boots, + s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* data) { Color_RGB8* color; s32 eyeIndex = (jointTable[22].x & 0xF) - 1; s32 mouthIndex = (jointTable[22].x >> 4) - 1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 1721); + OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 1721); if (eyeIndex < 0) { eyeIndex = sEyeMouthIndices[face][0]; @@ -892,7 +891,7 @@ void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTabl sDListsLodOffset = lod * 2; - SkelAnime_DrawFlexLod(globalCtx, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod); + SkelAnime_DrawFlexLod(play, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod); if ((overrideLimbDraw != Player_OverrideLimbDrawGameplayFirstPerson) && (overrideLimbDraw != Player_OverrideLimbDrawGameplay_80090440) && (gSaveContext.gameMode != 3)) { @@ -928,7 +927,7 @@ void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTabl } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 1803); + CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 1803); } Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; @@ -945,8 +944,8 @@ f32 D_80126068[] = { 5.0f, 3.0f }; Vec3f D_80126070 = { 0.0f, -300.0f, 0.0f }; -void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, - s32 thighLimbIndex, s32 shinLimbIndex, s32 footLimbIndex) { +void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, s32 thighLimbIndex, + s32 shinLimbIndex, s32 footLimbIndex) { Vec3f spA4; Vec3f sp98; Vec3f footprintPos; @@ -988,7 +987,7 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, footprintPos.y += 15.0f; - sp80 = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &sp88, &sp84, &this->actor, &footprintPos) + sp74; + sp80 = BgCheck_EntityRaycastFloor4(&play->colCtx, &sp88, &sp84, &this->actor, &footprintPos) + sp74; if (sp98.y < sp80) { sp70 = sp98.x - spA4.x; @@ -1028,17 +1027,17 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, skelAnime->jointTable[shinLimbIndex].z = skelAnime->jointTable[shinLimbIndex].z + temp1; skelAnime->jointTable[footLimbIndex].z = skelAnime->jointTable[footLimbIndex].z + temp2 - temp1; - temp3 = func_80041D4C(&globalCtx->colCtx, sp88, sp84); + temp3 = func_80041D4C(&play->colCtx, sp88, sp84); - if ((temp3 >= 2) && (temp3 < 4) && !SurfaceType_IsWallDamage(&globalCtx->colCtx, sp88, sp84)) { + if ((temp3 >= 2) && (temp3 < 4) && !SurfaceType_IsWallDamage(&play->colCtx, sp88, sp84)) { footprintPos.y = sp80; - EffectSsGFire_Spawn(globalCtx, &footprintPos); + EffectSsGFire_Spawn(play, &footprintPos); } } } } -s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Player* this = (Player*)thisx; @@ -1097,10 +1096,10 @@ s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbInde Matrix_RotateZ(BINANG_TO_RAD(this->unk_6C0), MTXMODE_APPLY); } } else if (limbIndex == PLAYER_LIMB_L_THIGH) { - func_8008F87C(globalCtx, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN, + func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN, PLAYER_LIMB_L_FOOT); } else if (limbIndex == PLAYER_LIMB_R_THIGH) { - func_8008F87C(globalCtx, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN, + func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN, PLAYER_LIMB_R_FOOT); return false; } else { @@ -1111,11 +1110,11 @@ s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbInde return false; } -s32 Player_OverrideLimbDrawGameplayDefault(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Player* this = (Player*)thisx; - if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) { + if (!Player_OverrideLimbDrawGameplayCommon(play, limbIndex, dList, pos, rot, thisx)) { if (limbIndex == PLAYER_LIMB_L_HAND) { Gfx** dLists = this->leftHandDLists; @@ -1168,11 +1167,11 @@ s32 Player_OverrideLimbDrawGameplayDefault(GlobalContext* globalCtx, s32 limbInd return false; } -s32 Player_OverrideLimbDrawGameplayFirstPerson(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, - Vec3s* rot, void* thisx) { +s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + void* thisx) { Player* this = (Player*)thisx; - if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) { + if (!Player_OverrideLimbDrawGameplayCommon(play, limbIndex, dList, pos, rot, thisx)) { if (this->unk_6AD != 2) { *dList = NULL; } else if (limbIndex == PLAYER_LIMB_L_FOREARM) { @@ -1194,20 +1193,19 @@ s32 Player_OverrideLimbDrawGameplayFirstPerson(GlobalContext* globalCtx, s32 lim return false; } -s32 Player_OverrideLimbDrawGameplay_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, - Vec3s* rot, void* thisx) { - if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) { +s32 Player_OverrideLimbDrawGameplay_80090440(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + void* thisx) { + if (!Player_OverrideLimbDrawGameplayCommon(play, limbIndex, dList, pos, rot, thisx)) { *dList = NULL; } return false; } -u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, - Vec3f* newBase) { +u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase) { if (weaponInfo->active == 0) { if (collider != NULL) { - Collider_ResetQuadAT(globalCtx, &collider->base); + Collider_ResetQuadAT(play, &collider->base); } Math_Vec3f_Copy(&weaponInfo->tip, newTip); Math_Vec3f_Copy(&weaponInfo->base, newBase); @@ -1217,13 +1215,13 @@ u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* w (weaponInfo->tip.z == newTip->z) && (weaponInfo->base.x == newBase->x) && (weaponInfo->base.y == newBase->y) && (weaponInfo->base.z == newBase->z)) { if (collider != NULL) { - Collider_ResetQuadAT(globalCtx, &collider->base); + Collider_ResetQuadAT(play, &collider->base); } return 0; } else { if (collider != NULL) { Collider_SetQuadVertices(collider, newBase, newTip, &weaponInfo->base, &weaponInfo->tip); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base); } Math_Vec3f_Copy(&weaponInfo->base, newBase); Math_Vec3f_Copy(&weaponInfo->tip, newTip); @@ -1232,7 +1230,7 @@ u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* w } } -void func_80090604(GlobalContext* globalCtx, Player* this, ColliderQuad* collider, Vec3f* quadSrc) { +void func_80090604(PlayState* play, Player* this, ColliderQuad* collider, Vec3f* quadSrc) { static u8 shieldColTypes[PLAYER_SHIELD_MAX] = { COLTYPE_METAL, COLTYPE_WOOD, @@ -1251,8 +1249,8 @@ void func_80090604(GlobalContext* globalCtx, Player* this, ColliderQuad* collide Matrix_MultVec3f(&quadSrc[3], &quadDest[3]); Collider_SetQuadVertices(collider, &quadDest[0], &quadDest[1], &quadDest[2], &quadDest[3]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &collider->base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetAC(play, &play->colChkCtx, &collider->base); + CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base); } } @@ -1266,14 +1264,14 @@ Vec3f D_801260A4[3] = { { 0.0f, -400.0f, 1000.0f }, }; -void func_800906D4(GlobalContext* globalCtx, Player* this, Vec3f* newTipPos) { +void func_800906D4(PlayState* play, Player* this, Vec3f* newTipPos) { Vec3f newBasePos[3]; Matrix_MultVec3f(&D_801260A4[0], &newBasePos[0]); Matrix_MultVec3f(&D_801260A4[1], &newBasePos[1]); Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]); - if (func_80090480(globalCtx, NULL, &this->meleeWeaponInfo[0], &newTipPos[0], &newBasePos[0]) && + if (func_80090480(play, NULL, &this->meleeWeaponInfo[0], &newTipPos[0], &newBasePos[0]) && !(this->stateFlags1 & PLAYER_STATE1_22)) { EffectBlure_AddVertex(Effect_GetByIndex(this->meleeWeaponEffectIndex), &this->meleeWeaponInfo[0].tip, &this->meleeWeaponInfo[0].base); @@ -1281,15 +1279,15 @@ void func_800906D4(GlobalContext* globalCtx, Player* this, Vec3f* newTipPos) { if ((this->meleeWeaponState > 0) && ((this->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H) || (this->stateFlags2 & PLAYER_STATE2_17))) { - func_80090480(globalCtx, &this->meleeWeaponQuads[0], &this->meleeWeaponInfo[1], &newTipPos[1], &newBasePos[1]); - func_80090480(globalCtx, &this->meleeWeaponQuads[1], &this->meleeWeaponInfo[2], &newTipPos[2], &newBasePos[2]); + func_80090480(play, &this->meleeWeaponQuads[0], &this->meleeWeaponInfo[1], &newTipPos[1], &newBasePos[1]); + func_80090480(play, &this->meleeWeaponQuads[1], &this->meleeWeaponInfo[2], &newTipPos[2], &newBasePos[2]); } } -void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPos, s32 drawIdPlusOne) { +void Player_DrawGetItemImpl(PlayState* play, Player* this, Vec3f* refPos, s32 drawIdPlusOne) { f32 height = (this->exchangeItemId != EXCH_ITEM_NONE) ? 6.0f : 14.0f; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2401); + OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2401); gSegments[6] = VIRTUAL_TO_PHYSICAL(this->giObjectSegment); @@ -1298,18 +1296,18 @@ void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPo Matrix_Translate(refPos->x + (3.3f * Math_SinS(this->actor.shape.rot.y)), refPos->y + height, refPos->z + ((3.3f + (IREG(90) / 10.0f)) * Math_CosS(this->actor.shape.rot.y)), MTXMODE_NEW); - Matrix_RotateZYX(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, play->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); - GetItem_Draw(globalCtx, drawIdPlusOne - 1); + GetItem_Draw(play, drawIdPlusOne - 1); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2421); + CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2421); } -void Player_DrawGetItem(GlobalContext* globalCtx, Player* this) { +void Player_DrawGetItem(PlayState* play, Player* this) { if (!this->giObjectLoading || osRecvMesg(&this->giObjectLoadQueue, NULL, OS_MESG_NOBLOCK) == 0) { this->giObjectLoading = false; - Player_DrawGetItemImpl(globalCtx, this, &sGetItemRefPos, ABS(this->unk_862)); + Player_DrawGetItemImpl(play, this, &sGetItemRefPos, ABS(this->unk_862)); } } @@ -1329,7 +1327,7 @@ void func_80090A28(Player* this, Vec3f* vecs) { Matrix_MultVec3f(&D_80126098, &vecs[2]); } -void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2) { +void Player_DrawHookshotReticle(PlayState* play, Player* this, f32 arg2) { static Vec3f D_801260C8 = { -500.0f, -100.0f, 0.0f }; CollisionPoly* sp9C; s32 bgId; @@ -1347,24 +1345,24 @@ void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2 if (1) {} - if (BgCheck_AnyLineTest3(&globalCtx->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2572); + if (BgCheck_AnyLineTest3(&play->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) { + OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2572); OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x07); - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp74, &sp68, &sp64); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sp74, &sp68, &sp64); sp60 = (sp64 < 200.0f) ? 0.08f : (sp64 / 200.0f) * 0.08f; Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); Matrix_Scale(sp60, sp60, sp60, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587), + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2587), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(OVERLAY_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(OVERLAY_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); gSPDisplayList(OVERLAY_DISP++, gLinkAdultHookshotReticleDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2592); + CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2592); } } @@ -1414,7 +1412,7 @@ Vec3f D_801261E0[] = { { 200.0f, 200.0f, 0.0f }, }; -void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Player* this = (Player*)thisx; if (*dList != NULL) { @@ -1430,13 +1428,13 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** if (this->itemActionParam == PLAYER_AP_STICK) { Vec3f sp124[3]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2633); + OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2633); if (this->actor.scale.y >= 0.0f) { D_80126080.x = this->unk_85C * 5000.0f; func_80090A28(this, sp124); if (this->meleeWeaponState != 0) { - func_800906D4(globalCtx, this, sp124); + func_800906D4(play, this, sp124); } else { Math_Vec3f_Copy(&this->meleeWeaponInfo[0].tip, &sp124[0]); } @@ -1446,11 +1444,11 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** Matrix_RotateZYX(-0x8000, 0, 0x4000, MTXMODE_APPLY); Matrix_Scale(1.0f, this->unk_85C, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2653), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2653), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gLinkChildLinkDekuStickDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2656); + CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2656); } else if ((this->actor.scale.y >= 0.0f) && (this->meleeWeaponState != 0)) { Vec3f spE4[3]; @@ -1461,18 +1459,18 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** } func_80090A28(this, spE4); - func_800906D4(globalCtx, this, spE4); + func_800906D4(play, this, spE4); } else if ((*dList != NULL) && (this->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE)) { Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemActionParam)]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2710); + OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2710); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2712), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2712), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetEnvColor(POLY_XLU_DISP++, bottleColor->r, bottleColor->g, bottleColor->b, 0); gSPDisplayList(POLY_XLU_DISP++, sBottleDLists[((void)0, gSaveContext.linkAge)]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2717); + CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2717); } if (this->actor.scale.y >= 0.0f) { @@ -1509,7 +1507,7 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** (this->rightHandType == PLAYER_MODELTYPE_12)) { BowStringData* stringData = &sBowStringData[gSaveContext.linkAge]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2783); + OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2783); Matrix_Push(); Matrix_Translate(stringData->pos.x, stringData->pos.y, stringData->pos.z, MTXMODE_APPLY); @@ -1540,16 +1538,16 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** Matrix_RotateZ(this->unk_858 * -0.2f, MTXMODE_APPLY); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2804), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2804), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, stringData->dList); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2809); + CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2809); } else if ((this->actor.scale.y >= 0.0f) && (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD)) { Matrix_Get(&this->shieldMf); - func_80090604(globalCtx, this, &this->shieldQuad, D_80126154); + func_80090604(play, this, &this->shieldQuad, D_80126154); } if (this->actor.scale.y >= 0.0f) { @@ -1570,7 +1568,7 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** if (func_8002DD78(this) != 0) { Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY); Player_DrawHookshotReticle( - globalCtx, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f); + play, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f); } } } @@ -1595,7 +1593,7 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** if ((this->rightHandType != PLAYER_MODELTYPE_RH_SHIELD) && (this->rightHandType != PLAYER_MODELTYPE_RH_FF)) { if (Player_IsChildWithHylianShield(this)) { - func_80090604(globalCtx, this, &this->shieldQuad, D_8012619C); + func_80090604(play, this, &this->shieldQuad, D_8012619C); } Matrix_TranslateRotateZYX(&D_801261CC, &D_801261D8); @@ -1611,7 +1609,7 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** } } -u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) { +u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime) { s16 linkObjectId = gLinkObjectIds[(void)0, gSaveContext.linkAge]; u32 size; void* ptr; @@ -1630,8 +1628,8 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) { gSegments[6] = VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE); - SkelAnime_InitLink(globalCtx, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.linkAge], &gPlayerAnim_003238, 9, - ptr, ptr, PLAYER_LIMB_MAX); + SkelAnime_InitLink(play, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.linkAge], &gPlayerAnim_003238, 9, ptr, + ptr, PLAYER_LIMB_MAX); return size + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE + sizeof(Vec3s[PLAYER_LIMB_BUF_COUNT]); @@ -1643,8 +1641,7 @@ u8 D_801261F8[] = { PLAYER_MODELGROUP_BGS, // PLAYER_SWORD_BGS }; -s32 Player_OverrideLimbDrawPause(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* arg) { +s32 Player_OverrideLimbDrawPause(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* arg) { u8* playerSwordAndShield = arg; //! @bug `playerSwordAndShield[0]` can be 0 (`PLAYER_SWORD_NONE`), which indexes `D_801261F8[-1]`. The result //! happens to be 0 (`PLAYER_MODELGROUP_0`) in vanilla, but weird values are likely to cause a crash @@ -1687,9 +1684,9 @@ s32 Player_OverrideLimbDrawPause(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* linkObject, SkelAnime* skelAnime, - Vec3f* pos, Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, - s32 height, Vec3f* eye, Vec3f* at, f32 fovy, void* colorFrameBuffer, void* depthFrameBuffer) { +void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject, SkelAnime* skelAnime, Vec3f* pos, + Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, s32 height, + Vec3f* eye, Vec3f* at, f32 fovy, void* colorFrameBuffer, void* depthFrameBuffer) { // Note: the viewport x and y values are overwritten below, before usage static Vp viewport = { (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0, (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0 }; @@ -1699,10 +1696,10 @@ void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* li Gfx* opaRef; Gfx* xluRef; u16 perspNorm; - Mtx* perspMtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx)); - Mtx* lookAtMtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx)); + Mtx* perspMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx)); + Mtx* lookAtMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx)); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 3129); + OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 3129); { s32 pad[2]; } @@ -1772,15 +1769,15 @@ void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* li gSPSetLights1(POLY_OPA_DISP++, lights1); - func_80093C80(globalCtx); + func_80093C80(play); POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP++, 0, 0, 0, 0, 997, 1000); - func_8002EABC(pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + func_8002EABC(pos, &play->view.eye, &lightDir, play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList); - Player_DrawImpl(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0, + Player_DrawImpl(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0, Player_OverrideLimbDrawPause, NULL, &playerSwordAndShield); gSPEndDisplayList(POLY_OPA_DISP++); @@ -1789,11 +1786,11 @@ void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* li gSPBranchList(opaRef, POLY_OPA_DISP); gSPBranchList(xluRef, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 3288); + CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 3288); } -void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, - s32 sword, s32 tunic, s32 shield, s32 boots) { +void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, s32 sword, + s32 tunic, s32 shield, s32 boots) { static Vec3f eye = { 0.0f, 0.0f, -400.0f }; static Vec3f at = { 0.0f, 0.0f, 0.0f }; Vec3s* destTable; @@ -1826,10 +1823,9 @@ void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnim *destTable++ = *srcTable++; } - Player_DrawPauseImpl(globalCtx, segment + PAUSE_EQUIP_BUFFER_SIZE, + Player_DrawPauseImpl(play, segment + PAUSE_EQUIP_BUFFER_SIZE, segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE, skelAnime, pos, rot, scale, sword, tunic, shield, boots, PAUSE_EQUIP_PLAYER_WIDTH, - PAUSE_EQUIP_PLAYER_HEIGHT, &eye, &at, 60.0f, globalCtx->state.gfxCtx->curFrameBuffer, - globalCtx->state.gfxCtx->curFrameBuffer + - (PAUSE_EQUIP_PLAYER_WIDTH * PAUSE_EQUIP_PLAYER_HEIGHT)); + PAUSE_EQUIP_PLAYER_HEIGHT, &eye, &at, 60.0f, play->state.gfxCtx->curFrameBuffer, + play->state.gfxCtx->curFrameBuffer + (PAUSE_EQUIP_PLAYER_WIDTH * PAUSE_EQUIP_PLAYER_HEIGHT)); } diff --git a/src/code/z_quake.c b/src/code/z_quake.c index ac9290e09a..02fb8e63d4 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -317,9 +317,9 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { s32 ret; u32 eq; Vec3f vec; - GlobalContext* globalCtx; + PlayState* play; - globalCtx = camera->globalCtx; + play = camera->play; vec.x = 0.0f; vec.y = 0.0f; vec.z = 0.0f; @@ -342,7 +342,7 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) { req = &sQuakeRequest[idx]; if (req->callbackIdx != 0) { - if (globalCtx->cameraPtrs[req->camPtrIdx] == NULL) { + if (play->cameraPtrs[req->camPtrIdx] == NULL) { osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: stopped! 'coz camera [%d] killed!!\n" VT_RST, req->camPtrIdx); Quake_Remove(req); diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 395f5434ba..7130768bba 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1007,12 +1007,12 @@ void func_80093C14(GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1443); } -void func_80093C80(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80093C80(PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; func_80093D18(gfxCtx); - if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_3) { + if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_3) { OPEN_DISPS(gfxCtx, "../z_rcp.c", 1460); gDPSetColorDither(POLY_OPA_DISP++, G_CD_DISABLE); diff --git a/src/code/z_room.c b/src/code/z_room.c index e2f9292e77..7c97bc43d2 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -1,9 +1,9 @@ #include "global.h" #include "vt.h" -void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags); -void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags); -void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags); +void func_80095AB4(PlayState* play, Room* room, u32 flags); +void func_80095D04(PlayState* play, Room* room, u32 flags); +void func_80096F6C(PlayState* play, Room* room, u32 flags); Vec3f D_801270A0 = { 0.0f, 0.0f, 0.0f }; @@ -22,34 +22,34 @@ Gfx D_801270B0[] = { gsSPEndDisplayList(), }; -void (*sRoomDrawHandlers[])(GlobalContext* globalCtx, Room* room, u32 flags) = { +void (*sRoomDrawHandlers[])(PlayState* play, Room* room, u32 flags) = { func_80095AB4, func_80096F6C, func_80095D04, }; -void func_80095AA0(GlobalContext* globalCtx, Room* room, Input* arg2, UNK_TYPE arg3) { +void func_80095AA0(PlayState* play, Room* room, Input* arg2, UNK_TYPE arg3) { } // Room Draw Polygon Type 0 -void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) { +void func_80095AB4(PlayState* play, Room* room, u32 flags) { s32 i; PolygonType0* polygon0; PolygonDlist* polygonDlist; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 193); + OPEN_DISPS(play->state.gfxCtx, "../z_room.c", 193); if (flags & 1) { - func_800342EC(&D_801270A0, globalCtx); + func_800342EC(&D_801270A0, play); gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); - func_80093C80(globalCtx); + func_80093C80(play); gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } if (flags & 2) { - func_8003435C(&D_801270A0, globalCtx); + func_8003435C(&D_801270A0, play); gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } @@ -67,7 +67,7 @@ void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) { polygonDlist++; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 239); + CLOSE_DISPS(play->state.gfxCtx, "../z_room.c", 239); } #define SHAPE_SORT_MAX 64 @@ -80,7 +80,7 @@ typedef struct struct_80095D04 { } struct_80095D04; // size = 0x10 // Room Draw Polygon Type 2 -void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { +void func_80095D04(PlayState* play, Room* room, u32 flags) { PolygonType2* polygon2; PolygonDlist2* polygonDlist; struct_80095D04 spB8[SHAPE_SORT_MAX]; @@ -99,18 +99,18 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { PolygonDlist2* polygonDlistIter; f32 temp_f2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 287); + OPEN_DISPS(play->state.gfxCtx, "../z_room.c", 287); if (flags & 1) { - func_800342EC(&D_801270A0, globalCtx); + func_800342EC(&D_801270A0, play); gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); - func_80093C80(globalCtx); + func_80093C80(play); gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } if (1) {} if (flags & 2) { - func_8003435C(&D_801270A0, globalCtx); + func_8003435C(&D_801270A0, play); gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } @@ -125,10 +125,10 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { pos.x = polygonDlist->pos.x; pos.y = polygonDlist->pos.y; pos.z = polygonDlist->pos.z; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &pos, &projectedPos, &projectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &projectedPos, &projectedW); if (-(f32)polygonDlist->unk_06 < projectedPos.z) { temp_f2 = projectedPos.z - polygonDlist->unk_06; - if (temp_f2 < globalCtx->lightCtx.fogFar) { + if (temp_f2 < play->lightCtx.fogFar) { spA4->unk_00 = polygonDlist; spA4->unk_04 = temp_f2; iter = spB4; @@ -212,7 +212,7 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { iREG(88) = i - 1; - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 430); + CLOSE_DISPS(play->state.gfxCtx, "../z_room.c", 430); } #define JPEG_MARKER 0xFFD8FFE0 @@ -306,7 +306,7 @@ void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 h } // Room Draw Polygon Type 1 - Single Format -void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { +void func_80096680(PlayState* play, Room* room, u32 flags) { Camera* activeCam; Gfx* spA8; PolygonType1* polygon1; @@ -316,9 +316,9 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { u32 drawOpa; u32 drawXlu; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 628); + OPEN_DISPS(play->state.gfxCtx, "../z_room.c", 628); - activeCam = GET_ACTIVE_CAM(globalCtx); + activeCam = GET_ACTIVE_CAM(play); isFixedCamera = (activeCam->setting == CAM_SET_PREREND_FIXED); polygon1 = &room->meshHeader->polygon1; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist); @@ -330,7 +330,7 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); if (drawOpa) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, polygonDlist->opa); } @@ -355,16 +355,16 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { if (drawXlu) { gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, polygonDlist->xlu); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 691); + CLOSE_DISPS(play->state.gfxCtx, "../z_room.c", 691); } -BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { - Camera* activeCam = GET_ACTIVE_CAM(globalCtx); +BgImage* func_80096A74(PolygonType1* polygon1, PlayState* play) { + Camera* activeCam = GET_ACTIVE_CAM(play); s32 camDataIdx; s16 camDataIdx2; Player* player; @@ -373,12 +373,12 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { camDataIdx = activeCam->camDataIdx; // jfifid - camDataIdx2 = func_80041C10(&globalCtx->colCtx, camDataIdx, BGCHECK_SCENE)[2].y; + camDataIdx2 = func_80041C10(&play->colCtx, camDataIdx, BGCHECK_SCENE)[2].y; if (camDataIdx2 >= 0) { camDataIdx = camDataIdx2; } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); player->actor.params = (player->actor.params & 0xFF00) | camDataIdx; bgImage = SEGMENTED_TO_VIRTUAL(polygon1->multi.list); @@ -397,7 +397,7 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { } // Room Draw Polygon Type 1 - Multi Format -void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { +void func_80096B6C(PlayState* play, Room* room, u32 flags) { Camera* activeCam; Gfx* gfx; PolygonType1* polygon1; @@ -408,13 +408,13 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { u32 drawOpa; u32 drawXlu; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 752); + OPEN_DISPS(play->state.gfxCtx, "../z_room.c", 752); - activeCam = GET_ACTIVE_CAM(globalCtx); + activeCam = GET_ACTIVE_CAM(play); isFixedCamera = (activeCam->setting == CAM_SET_PREREND_FIXED); polygon1 = &room->meshHeader->polygon1; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist); - bgImage = func_80096A74(polygon1, globalCtx); + bgImage = func_80096A74(polygon1, play); drawBg = (flags & 1) && isFixedCamera && bgImage->source && !(SREG(25) & 1); drawOpa = (flags & 1) && (polygonDlist->opa != NULL) && !(SREG(25) & 2); drawXlu = (flags & 2) && (polygonDlist->xlu != NULL) && !(SREG(25) & 4); @@ -423,7 +423,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); if (drawOpa) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, polygonDlist->opa); } @@ -449,35 +449,35 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { if (drawXlu) { gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, polygonDlist->xlu); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 819); + CLOSE_DISPS(play->state.gfxCtx, "../z_room.c", 819); } // Room Draw Polygon Type 1 -void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags) { +void func_80096F6C(PlayState* play, Room* room, u32 flags) { PolygonType1* polygon1 = &room->meshHeader->polygon1; if (polygon1->format == 1) { - func_80096680(globalCtx, room, flags); + func_80096680(play, room, flags); } else if (polygon1->format == 2) { - func_80096B6C(globalCtx, room, flags); + func_80096B6C(play, room, flags); } else { LogUtils_HungupThread("../z_room.c", 841); } } -void func_80096FD4(GlobalContext* globalCtx, Room* room) { +void func_80096FD4(PlayState* play, Room* room) { room->num = -1; room->segment = NULL; } -u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { +u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) { u32 maxRoomSize = 0; - RomFile* roomList = globalCtx->roomList; + RomFile* roomList = play->roomList; u32 roomSize; s32 i; s32 j; @@ -487,7 +487,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { u32 backRoomSize; u32 cumulRoomSize; - for (i = 0; i < globalCtx->numRooms; i++) { + for (i = 0; i < play->numRooms; i++) { roomSize = roomList[i].vromEnd - roomList[i].vromStart; osSyncPrintf("ROOM%d size=%d\n", i, roomSize); if (maxRoomSize < roomSize) { @@ -495,13 +495,13 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { } } - if (globalCtx->transiActorCtx.numActors != 0) { - RomFile* roomList = globalCtx->roomList; - TransitionActorEntry* transitionActor = &globalCtx->transiActorCtx.list[0]; + if (play->transiActorCtx.numActors != 0) { + RomFile* roomList = play->roomList; + TransitionActorEntry* transitionActor = &play->transiActorCtx.list[0]; - LOG_NUM("game_play->room_rom_address.num", globalCtx->numRooms, "../z_room.c", 912); + LOG_NUM("game_play->room_rom_address.num", play->numRooms, "../z_room.c", 912); - for (j = 0; j < globalCtx->transiActorCtx.numActors; j++) { + for (j = 0; j < play->transiActorCtx.numActors; j++) { frontRoom = transitionActor->sides[0].room; backRoom = transitionActor->sides[1].room; frontRoomSize = (frontRoom < 0) ? 0 : roomList[frontRoom].vromEnd - roomList[frontRoom].vromStart; @@ -520,7 +520,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { osSyncPrintf(VT_FGCOL(YELLOW)); // "Room buffer size=%08x(%5.1fK)" osSyncPrintf("部屋バッファサイズ=%08x(%5.1fK)\n", maxRoomSize, maxRoomSize / 1024.0f); - roomCtx->bufPtrs[0] = GameState_Alloc(&globalCtx->state, maxRoomSize, "../z_room.c", 946); + roomCtx->bufPtrs[0] = GameState_Alloc(&play->state, maxRoomSize, "../z_room.c", 946); // "Room buffer initial pointer=%08x" osSyncPrintf("部屋バッファ開始ポインタ=%08x\n", roomCtx->bufPtrs[0]); roomCtx->bufPtrs[1] = (void*)((s32)roomCtx->bufPtrs[0] + maxRoomSize); @@ -531,13 +531,13 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { roomCtx->status = 0; frontRoom = gSaveContext.respawnFlag > 0 ? ((void)0, gSaveContext.respawn[gSaveContext.respawnFlag - 1].roomIndex) - : globalCtx->setupEntranceList[globalCtx->curSpawn].room; - func_8009728C(globalCtx, roomCtx, frontRoom); + : play->setupEntranceList[play->curSpawn].room; + func_8009728C(play, roomCtx, frontRoom); return maxRoomSize; } -s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) { +s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) { u32 size; if (roomCtx->status == 0) { @@ -546,13 +546,13 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) { roomCtx->curRoom.segment = NULL; roomCtx->status = 1; - ASSERT(roomNum < globalCtx->numRooms, "read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009); + ASSERT(roomNum < play->numRooms, "read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009); - size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart; + size = play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart; roomCtx->unk_34 = (void*)ALIGN16((u32)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7)); osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1); - DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0, + DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, play->roomList[roomNum].vromStart, size, 0, &roomCtx->loadQueue, NULL, "../z_room.c", 1036); roomCtx->unk_30 ^= 1; @@ -562,16 +562,16 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) { return 0; } -s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) { +s32 func_800973FC(PlayState* play, RoomContext* roomCtx) { if (roomCtx->status == 1) { if (osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) { roomCtx->status = 0; roomCtx->curRoom.segment = roomCtx->unk_34; gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->unk_34); - Scene_ExecuteCommands(globalCtx, roomCtx->curRoom.segment); - Player_SetBootData(globalCtx, GET_PLAYER(globalCtx)); - Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); + Scene_ExecuteCommands(play, roomCtx->curRoom.segment); + Player_SetBootData(play, GET_PLAYER(play)); + Actor_SpawnTransitionActors(play, &play->actorCtx); return 1; } @@ -582,23 +582,23 @@ s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) { return 1; } -void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) { +void Room_Draw(PlayState* play, Room* room, u32 flags) { if (room->segment != NULL) { gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment); ASSERT(room->meshHeader->base.type < ARRAY_COUNTU(sRoomDrawHandlers), "this->ground_shape->polygon.type < number(Room_Draw_Proc)", "../z_room.c", 1125); - sRoomDrawHandlers[room->meshHeader->base.type](globalCtx, room, flags); + sRoomDrawHandlers[room->meshHeader->base.type](play, room, flags); } } -void func_80097534(GlobalContext* globalCtx, RoomContext* roomCtx) { +void func_80097534(PlayState* play, RoomContext* roomCtx) { roomCtx->prevRoom.num = -1; roomCtx->prevRoom.segment = NULL; - func_80031B14(globalCtx, &globalCtx->actorCtx); - Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); - Map_InitRoomData(globalCtx, roomCtx->curRoom.num); - if (!((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_SPOT20))) { - Map_SavePlayerInitialInfo(globalCtx); + func_80031B14(play, &play->actorCtx); + Actor_SpawnTransitionActors(play, &play->actorCtx); + Map_InitRoomData(play, roomCtx->curRoom.num); + if (!((play->sceneNum >= SCENE_SPOT00) && (play->sceneNum <= SCENE_SPOT20))) { + Map_SavePlayerInitialInfo(play); } - Audio_SetEnvReverb(globalCtx->roomCtx.curRoom.echo); + Audio_SetEnvReverb(play->roomCtx.curRoom.echo); } diff --git a/src/code/z_sample.c b/src/code/z_sample.c index 2957aea9b5..4d0bae9aea 100644 --- a/src/code/z_sample.c +++ b/src/code/z_sample.c @@ -2,7 +2,7 @@ void Sample_HandleStateChange(SampleContext* this) { if (CHECK_BTN_ALL(this->state.input[0].press.button, BTN_START)) { - SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); this->state.running = false; } } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index b558b6f152..8c63346c5e 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -33,24 +33,24 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) { return objectCtx->num - 1; } -void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) { - GlobalContext* globalCtx2 = globalCtx; // Needs to be a new variable to match (possibly a sub struct?) +void Object_InitBank(PlayState* play, ObjectContext* objectCtx) { + PlayState* play2 = play; // Needs to be a new variable to match (possibly a sub struct?) u32 spaceSize; s32 i; - if (globalCtx2->sceneNum == SCENE_SPOT00) { + if (play2->sceneNum == SCENE_SPOT00) { spaceSize = 1024000; - } else if (globalCtx2->sceneNum == SCENE_GANON_DEMO) { + } else if (play2->sceneNum == SCENE_GANON_DEMO) { if (gSaveContext.sceneSetupIndex != 4) { spaceSize = 1177600; } else { spaceSize = 1024000; } - } else if (globalCtx2->sceneNum == SCENE_JYASINBOSS) { + } else if (play2->sceneNum == SCENE_JYASINBOSS) { spaceSize = 1075200; - } else if (globalCtx2->sceneNum == SCENE_KENJYANOMA) { + } else if (play2->sceneNum == SCENE_KENJYANOMA) { spaceSize = 1075200; - } else if (globalCtx2->sceneNum == SCENE_GANON_BOSS) { + } else if (play2->sceneNum == SCENE_GANON_BOSS) { spaceSize = 1075200; } else { spaceSize = 1024000; @@ -69,7 +69,7 @@ void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) { osSyncPrintf(VT_RST); objectCtx->spaceStart = objectCtx->status[0].segment = - GameState_Alloc(&globalCtx->state, spaceSize, "../z_scene.c", 219); + GameState_Alloc(&play->state, spaceSize, "../z_scene.c", 219); objectCtx->spaceEnd = (void*)((s32)objectCtx->spaceStart + spaceSize); objectCtx->mainKeepIndex = Object_Spawn(objectCtx, OBJECT_GAMEPLAY_KEEP); @@ -158,7 +158,7 @@ void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) { return nextPtr; } -s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) { +s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd) { u32 cmdCode; while (true) { @@ -171,7 +171,7 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) { } if (cmdCode < ARRAY_COUNT(gSceneCmdHandlers)) { - gSceneCmdHandlers[cmdCode](globalCtx, sceneCmd); + gSceneCmdHandlers[cmdCode](play, sceneCmd); } else { osSyncPrintf(VT_FGCOL(RED)); osSyncPrintf("code の値が異常です\n"); // "code variable is abnormal" @@ -182,29 +182,29 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) { return 0; } -void Scene_CommandSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) { - ActorEntry* linkEntry = globalCtx->linkActorEntry = (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) + - globalCtx->setupEntranceList[globalCtx->curSpawn].spawn; +void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) { + ActorEntry* linkEntry = play->linkActorEntry = + (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) + play->setupEntranceList[play->curSpawn].spawn; s16 linkObjectId; - globalCtx->linkAgeOnLoad = ((void)0, gSaveContext.linkAge); + play->linkAgeOnLoad = ((void)0, gSaveContext.linkAge); linkObjectId = gLinkObjectIds[((void)0, gSaveContext.linkAge)]; gActorOverlayTable[linkEntry->id].initInfo->objectId = linkObjectId; - Object_Spawn(&globalCtx->objectCtx, linkObjectId); + Object_Spawn(&play->objectCtx, linkObjectId); } -void Scene_CommandActorList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->numSetupActors = cmd->actorList.num; - globalCtx->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment); +void Scene_CommandActorList(PlayState* play, SceneCmd* cmd) { + play->numSetupActors = cmd->actorList.num; + play->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment); } -void Scene_CommandUnused2(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment); +void Scene_CommandUnused2(PlayState* play, SceneCmd* cmd) { + play->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment); } -void Scene_CommandCollisionHeader(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandCollisionHeader(PlayState* play, SceneCmd* cmd) { CollisionHeader* colHeader = SEGMENTED_TO_VIRTUAL(cmd->colHeader.segment); colHeader->vtxList = SEGMENTED_TO_VIRTUAL(colHeader->vtxList); @@ -213,41 +213,41 @@ void Scene_CommandCollisionHeader(GlobalContext* globalCtx, SceneCmd* cmd) { colHeader->cameraDataList = SEGMENTED_TO_VIRTUAL(colHeader->cameraDataList); colHeader->waterBoxes = SEGMENTED_TO_VIRTUAL(colHeader->waterBoxes); - BgCheck_Allocate(&globalCtx->colCtx, globalCtx, colHeader); + BgCheck_Allocate(&play->colCtx, play, colHeader); } -void Scene_CommandRoomList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->numRooms = cmd->roomList.num; - globalCtx->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment); +void Scene_CommandRoomList(PlayState* play, SceneCmd* cmd) { + play->numRooms = cmd->roomList.num; + play->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment); } -void Scene_CommandEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.segment); +void Scene_CommandEntranceList(PlayState* play, SceneCmd* cmd) { + play->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.segment); } -void Scene_CommandSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) { if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) { - globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.keepObjectId); - gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); + play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, cmd->specialFiles.keepObjectId); + gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment); } if (cmd->specialFiles.cUpElfMsgNum != 0) { - globalCtx->cUpElfMsgs = Play_LoadFile(globalCtx, &sNaviMsgFiles[cmd->specialFiles.cUpElfMsgNum - 1]); + play->cUpElfMsgs = Play_LoadFile(play, &sNaviMsgFiles[cmd->specialFiles.cUpElfMsgNum - 1]); } } -void Scene_CommandRoomBehavior(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1; - globalCtx->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF; - globalCtx->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1; - globalCtx->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1; +void Scene_CommandRoomBehavior(PlayState* play, SceneCmd* cmd) { + play->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1; + play->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF; + play->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1; + play->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1; } -void Scene_CommandMeshHeader(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.curRoom.meshHeader = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment); +void Scene_CommandMeshHeader(PlayState* play, SceneCmd* cmd) { + play->roomCtx.curRoom.meshHeader = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment); } -void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) { s32 i; s32 j; s32 k; @@ -258,19 +258,19 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { void* nextPtr; k = 0; - i = globalCtx->objectCtx.unk_09; - firstStatus = &globalCtx->objectCtx.status[0]; - status = &globalCtx->objectCtx.status[i]; + i = play->objectCtx.unk_09; + firstStatus = &play->objectCtx.status[0]; + status = &play->objectCtx.status[i]; - while (i < globalCtx->objectCtx.num) { + while (i < play->objectCtx.num) { if (status->id != *objectEntry) { - status2 = &globalCtx->objectCtx.status[i]; - for (j = i; j < globalCtx->objectCtx.num; j++) { + status2 = &play->objectCtx.status[i]; + for (j = i; j < play->objectCtx.num; j++) { status2->id = OBJECT_INVALID; status2++; } - globalCtx->objectCtx.num = i; - func_80031A28(globalCtx, &globalCtx->actorCtx); + play->objectCtx.num = i; + func_80031A28(play, &play->actorCtx); continue; } @@ -285,7 +285,7 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { "../z_scene.c", 705); while (k < cmd->objectList.num) { - nextPtr = func_800982FC(&globalCtx->objectCtx, i, *objectEntry); + nextPtr = func_800982FC(&play->objectCtx, i, *objectEntry); if (i < OBJECT_EXCHANGE_BANK_MAX - 1) { firstStatus[i + 1].segment = nextPtr; } @@ -294,71 +294,72 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { objectEntry++; } - globalCtx->objectCtx.num = i; + play->objectCtx.num = i; } -void Scene_CommandLightList(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) { s32 i; LightInfo* lightInfo = SEGMENTED_TO_VIRTUAL(cmd->lightList.segment); for (i = 0; i < cmd->lightList.num; i++) { - LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, lightInfo); + LightContext_InsertLight(play, &play->lightCtx, lightInfo); lightInfo++; } } -void Scene_CommandPathList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.segment); +void Scene_CommandPathList(PlayState* play, SceneCmd* cmd) { + play->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.segment); } -void Scene_CommandTransitionActorList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->transiActorCtx.numActors = cmd->transiActorList.num; - globalCtx->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment); +void Scene_CommandTransitionActorList(PlayState* play, SceneCmd* cmd) { + play->transiActorCtx.numActors = cmd->transiActorList.num; + play->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment); } void TransitionActor_InitContext(GameState* state, TransitionActorContext* transiActorCtx) { transiActorCtx->numActors = 0; } -void Scene_CommandLightSettingsList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->envCtx.numLightSettings = cmd->lightSettingList.num; - globalCtx->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment); +void Scene_CommandLightSettingsList(PlayState* play, SceneCmd* cmd) { + play->envCtx.numLightSettings = cmd->lightSettingList.num; + play->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment); } -void Scene_CommandSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->skyboxId = cmd->skyboxSettings.skyboxId; - globalCtx->envCtx.skyboxConfig = globalCtx->envCtx.changeSkyboxNextConfig = cmd->skyboxSettings.unk_05; - globalCtx->envCtx.lightMode = cmd->skyboxSettings.unk_06; +void Scene_CommandSkyboxSettings(PlayState* play, SceneCmd* cmd) { + play->skyboxId = cmd->skyboxSettings.skyboxId; + play->envCtx.skyboxConfig = play->envCtx.changeSkyboxNextConfig = cmd->skyboxSettings.unk_05; + play->envCtx.lightMode = cmd->skyboxSettings.unk_06; } -void Scene_CommandSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->envCtx.skyboxDisabled = cmd->skyboxDisables.unk_04; - globalCtx->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk_05; +void Scene_CommandSkyboxDisables(PlayState* play, SceneCmd* cmd) { + play->envCtx.skyboxDisabled = cmd->skyboxDisables.unk_04; + play->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk_05; } -void Scene_CommandTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) { if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) { gSaveContext.skyboxTime = gSaveContext.dayTime = ((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / ((f32)(24 * 60) / 0x10000); } if (cmd->timeSettings.unk_06 != 0xFF) { - globalCtx->envCtx.sceneTimeSpeed = cmd->timeSettings.unk_06; + play->envCtx.sceneTimeSpeed = cmd->timeSettings.unk_06; } else { - globalCtx->envCtx.sceneTimeSpeed = 0; + play->envCtx.sceneTimeSpeed = 0; } if (gSaveContext.sunsSongState == SUNSSONG_INACTIVE) { - gTimeSpeed = globalCtx->envCtx.sceneTimeSpeed; + gTimeSpeed = play->envCtx.sceneTimeSpeed; } - globalCtx->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; - globalCtx->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; - globalCtx->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; + play->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; + play->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; + play->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; - if (((globalCtx->envCtx.sceneTimeSpeed == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) || + if (((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) || (gSaveContext.entranceIndex == ENTR_SPOT06_8)) { gSaveContext.skyboxTime = ((void)0, gSaveContext.dayTime); + if ((gSaveContext.skyboxTime > CLOCK_TIME(4, 0)) && (gSaveContext.skyboxTime < CLOCK_TIME(6, 30))) { gSaveContext.skyboxTime = CLOCK_TIME(5, 0) + 1; } else if ((gSaveContext.skyboxTime >= CLOCK_TIME(6, 30)) && (gSaveContext.skyboxTime <= CLOCK_TIME(8, 0))) { @@ -372,39 +373,39 @@ void Scene_CommandTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { } } -void Scene_CommandWindSettings(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandWindSettings(PlayState* play, SceneCmd* cmd) { s8 x = cmd->windSettings.x; s8 y = cmd->windSettings.y; s8 z = cmd->windSettings.z; - globalCtx->envCtx.windDirection.x = x; - globalCtx->envCtx.windDirection.y = y; - globalCtx->envCtx.windDirection.z = z; + play->envCtx.windDirection.x = x; + play->envCtx.windDirection.y = y; + play->envCtx.windDirection.z = z; - globalCtx->envCtx.windSpeed = cmd->windSettings.unk_07; + play->envCtx.windSpeed = cmd->windSettings.unk_07; } -void Scene_CommandExitList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.segment); +void Scene_CommandExitList(PlayState* play, SceneCmd* cmd) { + play->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.segment); } -void Scene_CommandUndefined9(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandUndefined9(PlayState* play, SceneCmd* cmd) { } -void Scene_CommandSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->sequenceCtx.seqId = cmd->soundSettings.seqId; - globalCtx->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId; +void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd) { + play->sequenceCtx.seqId = cmd->soundSettings.seqId; + play->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId; if (gSaveContext.seqId == (u8)NA_BGM_DISABLED) { Audio_QueueSeqCmd(cmd->soundSettings.specId | 0xF0000000); } } -void Scene_CommandEchoSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.curRoom.echo = cmd->echoSettings.echo; +void Scene_CommandEchoSettings(PlayState* play, SceneCmd* cmd) { + play->roomCtx.curRoom.echo = cmd->echoSettings.echo; } -void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) { s32 pad; SceneCmd* altHeader; @@ -418,7 +419,7 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { if (1) {} if (altHeader != NULL) { - Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader)); + Scene_ExecuteCommands(play, SEGMENTED_TO_VIRTUAL(altHeader)); (cmd + 1)->base.code = SCENE_CMD_ID_END; } else { // "Coughh! There is no specified dataaaaa!" @@ -432,7 +433,7 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!"); if (altHeader != NULL) { - Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader)); + Scene_ExecuteCommands(play, SEGMENTED_TO_VIRTUAL(altHeader)); (cmd + 1)->base.code = SCENE_CMD_ID_END; } } @@ -440,24 +441,24 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { } } -void Scene_CommandCutsceneData(GlobalContext* globalCtx, SceneCmd* cmd) { - osSyncPrintf("\ngame_play->demo_play.data=[%x]", globalCtx->csCtx.segment); - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.segment); +void Scene_CommandCutsceneData(PlayState* play, SceneCmd* cmd) { + osSyncPrintf("\ngame_play->demo_play.data=[%x]", play->csCtx.segment); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.segment); } // Camera & World Map Area -void Scene_CommandMiscSettings(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_CommandMiscSettings(PlayState* play, SceneCmd* cmd) { YREG(15) = cmd->miscSettings.cameraMovement; gSaveContext.worldMapArea = cmd->miscSettings.area; - if ((globalCtx->sceneNum == SCENE_SHOP1) || (globalCtx->sceneNum == SCENE_SYATEKIJYOU)) { + if ((play->sceneNum == SCENE_SHOP1) || (play->sceneNum == SCENE_SYATEKIJYOU)) { if (LINK_AGE_IN_YEARS == YEARS_ADULT) { gSaveContext.worldMapArea = 1; } } - if (((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_GANON_TOU)) || - ((globalCtx->sceneNum >= SCENE_ENTRA) && (globalCtx->sceneNum <= SCENE_SHRINE_R))) { + if (((play->sceneNum >= SCENE_SPOT00) && (play->sceneNum <= SCENE_GANON_TOU)) || + ((play->sceneNum >= SCENE_ENTRA) && (play->sceneNum <= SCENE_SHRINE_R))) { if (gSaveContext.cutsceneIndex < 0xFFF0) { gSaveContext.worldMapAreaData |= gBitFlags[gSaveContext.worldMapArea]; osSyncPrintf("000 area_arrival=%x (%d)\n", gSaveContext.worldMapAreaData, @@ -466,7 +467,7 @@ void Scene_CommandMiscSettings(GlobalContext* globalCtx, SceneCmd* cmd) { } } -void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(GlobalContext*, SceneCmd*) = { +void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*) = { Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2 diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index a80de06a1b..44f6b19d7f 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -73,34 +73,34 @@ Gfx sDefaultDisplayList[] = { gsSPEndDisplayList(), }; -void Scene_SetTransitionForNextEntrance(GlobalContext* globalCtx) { +void Scene_SetTransitionForNextEntrance(PlayState* play) { s16 entranceIndex; if (!IS_DAY) { if (!LINK_IS_ADULT) { - entranceIndex = globalCtx->nextEntranceIndex + 1; + entranceIndex = play->nextEntranceIndex + 1; } else { - entranceIndex = globalCtx->nextEntranceIndex + 3; + entranceIndex = play->nextEntranceIndex + 3; } } else { if (!LINK_IS_ADULT) { - entranceIndex = globalCtx->nextEntranceIndex; + entranceIndex = play->nextEntranceIndex; } else { - entranceIndex = globalCtx->nextEntranceIndex + 2; + entranceIndex = play->nextEntranceIndex + 2; } } - globalCtx->transitionType = gEntranceTable[entranceIndex].field & 0x7F; // Fade out + play->transitionType = gEntranceTable[entranceIndex].field & 0x7F; // Fade out } // Scene Draw Config 0 -void func_80099550(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4725); +void func_80099550(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4725); gSPDisplayList(POLY_OPA_DISP++, sDefaultDisplayList); gSPDisplayList(POLY_XLU_DISP++, sDefaultDisplayList); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4735); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4735); } void* D_8012A2F8[] = { @@ -109,38 +109,38 @@ void* D_8012A2F8[] = { }; // Scene Draw Config 19 -void func_800995DC(GlobalContext* globalCtx) { - u32 gameplayFrames = globalCtx->gameplayFrames; +void func_800995DC(PlayState* play) { + u32 gameplayFrames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4763); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4763); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, - 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A2F8[((void)0, gSaveContext.nightFlag)])); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4783); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4783); } // Scene Draw Config 28 -void func_80099760(GlobalContext* globalCtx) { +void func_80099760(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4845); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4845); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 0, 64, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 0, 64, 32, 1, 0, (gameplayFrames * 2) % 128, 64, 32)); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4859); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4859); } void* gDCEntranceTextures[] = { @@ -153,21 +153,21 @@ void* sDCLavaFloorTextures[] = { }; // Scene Draw Config 20 - Dodongo's Cavern -void func_80099878(GlobalContext* globalCtx) { +void func_80099878(PlayState* play) { u32 gameplayFrames; s32 pad; - Gfx* displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx[3])); + Gfx* displayListHead = Graph_Alloc(play->state.gfxCtx, 2 * sizeof(Gfx[3])); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4905); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4905); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gDCEntranceTextures[((void)0, gSaveContext.nightFlag)])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sDCLavaFloorTextures[(s32)(gameplayFrames & 14) >> 1])); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 0, 64, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 0, 64, 32, 1, 0, (gameplayFrames * 1) % 128, 64, 32)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, (gameplayFrames * 2) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -178,25 +178,25 @@ void func_80099878(GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x0B, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT]); + gDPSetEnvColor(displayListHead++, 255, 255, 255, play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT]); + gDPSetEnvColor(displayListHead++, 255, 255, 255, play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT]); gSPEndDisplayList(displayListHead); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4956); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4956); } // Scene Draw Config 30 -void func_80099BD8(GlobalContext* globalCtx) { +void func_80099BD8(PlayState* play) { f32 temp; - Gfx* displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 18 * sizeof(Gfx)); + Gfx* displayListHead = Graph_Alloc(play->state.gfxCtx, 18 * sizeof(Gfx)); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5069); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5069); - temp = globalCtx->roomCtx.unk_74[0] / 255.0f; + temp = play->roomCtx.unk_74[0] / 255.0f; gSPSegment(POLY_XLU_DISP++, 0x08, displayListHead); gSPSegment(POLY_OPA_DISP++, 0x08, displayListHead); @@ -213,7 +213,7 @@ void func_80099BD8(GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x0A, displayListHead); gSPSegment(POLY_XLU_DISP++, 0x0A, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, play->roomCtx.unk_74[0]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0B, displayListHead); @@ -221,7 +221,7 @@ void func_80099BD8(GlobalContext* globalCtx) { gDPSetPrimColor(displayListHead++, 0, 0, 89 + (u8)(166.0f * temp), 89 + (u8)(166.0f * temp), 89 + (u8)(166.0f * temp), 255); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, play->roomCtx.unk_74[0]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead); @@ -229,16 +229,16 @@ void func_80099BD8(GlobalContext* globalCtx) { gDPSetPrimColor(displayListHead++, 0, 0, 255 + (u8)(179.0f * temp), 255 + (u8)(179.0f * temp), 255 + (u8)(179.0f * temp), 255); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, play->roomCtx.unk_74[0]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0D, displayListHead); gSPSegment(POLY_XLU_DISP++, 0x0D, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[1]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, play->roomCtx.unk_74[1]); gSPEndDisplayList(displayListHead); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5145); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5145); if (gSaveContext.sceneSetupIndex == 5) { gCustomLensFlareOn = true; @@ -252,25 +252,24 @@ void func_80099BD8(GlobalContext* globalCtx) { } // Scene Draw Config 31 -void func_8009A45C(GlobalContext* globalCtx) { +void func_8009A45C(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5171); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5171); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, - 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment( - POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(POLY_OPA_DISP++, 0x0B, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + gSPSegment(POLY_OPA_DISP++, 0x0A, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 1) % 128, 32, 32)); + gSPSegment(POLY_OPA_DISP++, 0x0B, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0C, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 50) % 2048, 8, 512, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 50) % 2048, 8, 512, 1, 0, (gameplayFrames * 60) % 2048, 8, 512)); gSPSegment(POLY_OPA_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); @@ -278,27 +277,27 @@ void func_8009A45C(GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5212); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5212); } // Scene Draw Config 32 -void func_8009A798(GlobalContext* globalCtx) { +void func_8009A798(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5226); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5226); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 64, 64)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 64, 64)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, - (gameplayFrames * 1) % 256, 32, 64, 1, 0, 0, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 256, 32, + 64, 1, 0, 0, 32, 128)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -306,22 +305,22 @@ void func_8009A798(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5264); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5264); } // Scene Draw Config 33 -void func_8009A9DC(GlobalContext* globalCtx) { +void func_8009A9DC(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5278); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5278); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, - 64, 1, gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, 64)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, 64, + 1, gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, 64)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -329,17 +328,17 @@ void func_8009A9DC(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5301); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5301); } // Scene Draw Config 48 -void func_8009AB98(GlobalContext* globalCtx) { +void func_8009AB98(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5317); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5317); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); @@ -347,20 +346,20 @@ void func_8009AB98(GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5330); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5330); } // Scene Draw Config 39 -void func_8009ACA8(GlobalContext* globalCtx) { +void func_8009ACA8(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5346); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5346); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); - gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -368,24 +367,24 @@ void func_8009ACA8(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5367); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5367); } // Scene Draw Config 24 -void func_8009AE30(GlobalContext* globalCtx) { +void func_8009AE30(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5384); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5384); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; - if (globalCtx->sceneNum == SCENE_HAKADAN_BS) { + if (play->sceneNum == SCENE_HAKADAN_BS) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, (gameplayFrames * 2) % 128, 0, 32, 32)); } else { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, (gameplayFrames * 2) % 128, 0, 32, 32)); } @@ -395,7 +394,7 @@ void func_8009AE30(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5416); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5416); } void* sThievesHideoutEntranceTextures[] = { @@ -404,18 +403,18 @@ void* sThievesHideoutEntranceTextures[] = { }; // Scene Draw Config 40 -void func_8009AFE0(GlobalContext* globalCtx) { +void func_8009AFE0(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5490); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5490); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sThievesHideoutEntranceTextures[((void)0, gSaveContext.nightFlag)])); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5507); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5507); } void* D_8012A330[] = { @@ -424,123 +423,122 @@ void* D_8012A330[] = { }; // Scene Draw Config 23 (Water Temple) -void func_8009B0FC(GlobalContext* globalCtx) { +void func_8009B0FC(PlayState* play) { u32 gameplayFrames; s32 spB0; s32 spAC; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5535); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5535); if (1) {} // Necessary to match - spB0 = (globalCtx->roomCtx.unk_74[1] >> 8) & 0xFF; - spAC = globalCtx->roomCtx.unk_74[1] & 0xFF; - gameplayFrames = globalCtx->gameplayFrames; + spB0 = (play->roomCtx.unk_74[1] >> 8) & 0xFF; + spAC = play->roomCtx.unk_74[1] & 0xFF; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A330[((void)0, gSaveContext.nightFlag)])); if (spB0 == 1) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, - 0, 0, 0, spAC)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, + 0, spAC)); } else if (spB0 < 1) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, - 0, 0, 0, 255)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, + 0, 255)); } else { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, - 0, 0, 0, 160)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, + 0, 160)); } if (spB0 == 2) { gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, - 0, 0, 0, spAC)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, + 0, spAC)); } else if (spB0 < 2) { gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, - 0, 0, 0, 255)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, + 0, 255)); } else { gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, - 0, 0, 0, 160)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, + 0, 160)); } if (spB0 != 0) { gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, - 0, 0, 0, 160)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, + 0, 160)); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, - 0, 0, 0, 180)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, + 0, 180)); } else { gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, - 32, 32, 0, 0, 0, 160 + (s32)((spAC / 200.0f) * 95.0f))); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, 32, + 32, 0, 0, 0, 160 + (s32)((spAC / 200.0f) * 95.0f))); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, - 0, 0, 0, 185 + (s32)((spAC / 200.0f) * 70.0f))); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, + 0, 185 + (s32)((spAC / 200.0f) * 70.0f))); } gSPSegment(POLY_XLU_DISP++, 0x0C, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, gameplayFrames * 1, 32, 32, 1, - 0, 127 - (gameplayFrames * 1), 32, 32, 0, 0, 0, 128)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 1, gameplayFrames * 1, 32, 32, 1, 0, + 127 - (gameplayFrames * 1), 32, 32, 0, 0, 0, 128)); gSPSegment(POLY_XLU_DISP++, 0x0D, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 4, 0, 32, 32, 1, - gameplayFrames * 4, 0, 32, 32, 0, 0, 0, 128)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames * 4, 0, 32, 32, 1, gameplayFrames * 4, 0, + 32, 32, 0, 0, 0, 128)); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5644); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5644); } // Scene Draw Config 29 -void func_8009B86C(GlobalContext* globalCtx) { +void func_8009B86C(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5791); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5791); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); - gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, globalCtx->roomCtx.unk_74[0]); + gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, play->roomCtx.unk_74[0]); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 145); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5808); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5808); } // Scene Draw Config 34 -void func_8009B9BC(GlobalContext* globalCtx) { +void func_8009B9BC(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5822); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5822); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 4, 16)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, gameplayFrames % 64, 4, 16)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5836); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5836); } // Scene Draw Config 35 -void func_8009BAA4(GlobalContext* globalCtx) { +void func_8009BAA4(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5850); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5850); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); - if (globalCtx->sceneNum == SCENE_HAIRAL_NIWA) { - gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 10) % 256, 32, 64)); + if (play->sceneNum == SCENE_HAIRAL_NIWA) { + gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 10) % 256, 32, 64)); } gDPPipeSync(POLY_OPA_DISP++); @@ -549,34 +547,32 @@ void func_8009BAA4(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5876); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5876); } // Scene Draw Config 36 -void func_8009BC44(GlobalContext* globalCtx) { +void func_8009BC44(PlayState* play) { u32 gameplayFrames; s8 sp83; if (1) {} // Necessary to match - sp83 = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; + sp83 = coss((play->gameplayFrames * 1500) & 0xFFFF) >> 8; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5894); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5894); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; - if (globalCtx->sceneNum == SCENE_GANON_TOU) { - gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 64, 64)); + if (play->sceneNum == SCENE_GANON_TOU) { + gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 64, 64)); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 1) % 256, 64, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 1) % 256, 64, 64, 1, 0, (gameplayFrames * 1) % 256, 64, 64)); } gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 255 - (gameplayFrames * 1) % 128, - (gameplayFrames * 1) % 128, 32, 32, 1, (gameplayFrames * 1) % 128, - (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 255 - (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -588,22 +584,22 @@ void func_8009BC44(GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sp83, sp83, sp83, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5930); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5930); } // Screen Shake for Ganon's Tower Collapse -void func_8009BEEC(GlobalContext* globalCtx) { +void func_8009BEEC(PlayState* play) { s32 var; - if (globalCtx->gameplayFrames % 128 == 13) { - var = Quake_Add(GET_ACTIVE_CAM(globalCtx), 2); + if (play->gameplayFrames % 128 == 13) { + var = Quake_Add(GET_ACTIVE_CAM(play), 2); Quake_SetSpeed(var, 10000); Quake_SetQuakeValues(var, 4, 0, 0, 0); Quake_SetCountdown(var, 127); } - if ((globalCtx->gameplayFrames % 64 == 0) && (Rand_ZeroOne() > 0.6f)) { - var = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + if ((play->gameplayFrames % 64 == 0) && (Rand_ZeroOne() > 0.6f)) { + var = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(var, 32000.0f + (Rand_ZeroOne() * 3000.0f)); Quake_SetQuakeValues(var, 10.0f - (Rand_ZeroOne() * 9.0f), 0, 0, 0); Quake_SetCountdown(var, 48.0f - (Rand_ZeroOne() * 15.0f)); @@ -611,25 +607,25 @@ void func_8009BEEC(GlobalContext* globalCtx) { } // Scene Draw Config 38 -void func_8009C0AC(GlobalContext* globalCtx) { +void func_8009C0AC(PlayState* play) { u32 gameplayFrames; s8 sp7B; if (1) {} // Necessary to match - sp7B = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; + sp7B = coss((play->gameplayFrames * 1500) & 0xFFFF) >> 8; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5968); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5968); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 512, 64, 128, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 512, 64, 128, 1, 0, 511 - (gameplayFrames * 1) % 512, 64, 128)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 32, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 32, 64, 1, 0, 255 - (gameplayFrames * 1) % 256, 32, 64)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 20) % 2048, 16, 512, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 20) % 2048, 16, 512, 1, 0, (gameplayFrames * 30) % 2048, 16, 512)); gDPPipeSync(POLY_OPA_DISP++); @@ -642,12 +638,12 @@ void func_8009C0AC(GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sp7B, sp7B, sp7B, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6004); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6004); - if (Flags_GetSwitch(globalCtx, 0x37)) { - if ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)) { - func_8009BEEC(globalCtx); + if (Flags_GetSwitch(play, 0x37)) { + if ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)) { + func_8009BEEC(play); } } } @@ -658,22 +654,22 @@ void* sIceCavernEntranceTextures[] = { }; // Scene Draw Config 37 -void func_8009C3EC(GlobalContext* globalCtx) { +void func_8009C3EC(PlayState* play) { u32 gameplayFrames; if (0) {} // Necessary to match - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6042); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6042); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sIceCavernEntranceTextures[((void)0, gSaveContext.nightFlag)])); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -681,25 +677,25 @@ void func_8009C3EC(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6076); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6076); } // Scene Draw Config 42 -void func_8009C608(GlobalContext* globalCtx) { +void func_8009C608(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6151); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6151); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 60) % 2048, 8, 512, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 60) % 2048, 8, 512, 1, 0, (gameplayFrames * 50) % 2048, 8, 512)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, 0, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, 0, 32, 32, 1, (gameplayFrames * 1) % 128, 0, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0B, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 6) % 1024, 16, 256, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 6) % 1024, 16, 256, 1, 0, 1023 - (gameplayFrames * 3) % 1024, 16, 256)); gDPPipeSync(POLY_OPA_DISP++); @@ -708,23 +704,22 @@ void func_8009C608(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6187); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6187); } // Scene Draw Config 43 -void func_8009C8B8(GlobalContext* globalCtx) { +void func_8009C8B8(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6201); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6201); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, 255 - (gameplayFrames * 10) % 256, 32, 64)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, 255 - (gameplayFrames * 10) % 256, 32, 64)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -732,19 +727,19 @@ void func_8009C8B8(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6232); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6232); } // Scene Draw Config 47 -void func_8009CAC0(GlobalContext* globalCtx) { +void func_8009CAC0(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6249); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6249); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -752,7 +747,7 @@ void func_8009CAC0(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6264); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6264); } void* sGTGEntranceTextures[] = { @@ -761,21 +756,21 @@ void* sGTGEntranceTextures[] = { }; // Scene Draw Config 27 -void func_8009CC00(GlobalContext* globalCtx) { +void func_8009CC00(PlayState* play) { u32 gameplayFrames; if (0) {} // Necessary to match - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6290); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6290); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sGTGEntranceTextures[((void)0, gSaveContext.nightFlag)])); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -783,7 +778,7 @@ void func_8009CC00(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6320); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6320); } Gfx* Gfx_TwoTexScrollPrimColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, @@ -806,17 +801,16 @@ Gfx* Gfx_TwoTexScrollPrimColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y } // Scene Draw Config 50 -void func_8009CF84(GlobalContext* globalCtx) { +void func_8009CF84(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6433); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6433); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScrollPrimColor(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, - (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, - (gameplayFrames * 1) % 128, 32, 32, 255, 255, 255, - globalCtx->roomCtx.unk_74[0] + 127)); + Gfx_TwoTexScrollPrimColor(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, + 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 255, 255, + 255, play->roomCtx.unk_74[0] + 127)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -824,24 +818,21 @@ void func_8009CF84(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6449); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6449); } // Scene Draw Config 41 -void func_8009D0E8(GlobalContext* globalCtx) { +void func_8009D0E8(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6463); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6463); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 127 - (gameplayFrames * 4) % 128, 0, 32, 32)); - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 5) % 64, 16, 16)); - gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, 63 - (gameplayFrames * 2) % 64, 16, 16)); - gSPSegment( - POLY_XLU_DISP++, 0x0B, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - (gameplayFrames * 3) % 128, 32, 32, 1, 0, 0, 32, 32)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 127 - (gameplayFrames * 4) % 128, 0, 32, 32)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 5) % 64, 16, 16)); + gSPSegment(POLY_OPA_DISP++, 0x0A, Gfx_TexScroll(play->state.gfxCtx, 0, 63 - (gameplayFrames * 2) % 64, 16, 16)); + gSPSegment(POLY_XLU_DISP++, 0x0B, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 127 - (gameplayFrames * 3) % 128, 32, 32, 1, 0, 0, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -849,7 +840,7 @@ void func_8009D0E8(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6491); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6491); } void* sLonLonHouseEntranceTextures[] = { @@ -858,8 +849,8 @@ void* sLonLonHouseEntranceTextures[] = { }; // Scene Draw Config 44 -void func_8009D31C(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6515); +void func_8009D31C(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6515); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sLonLonHouseEntranceTextures[((void)0, gSaveContext.nightFlag)])); @@ -870,7 +861,7 @@ void func_8009D31C(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6528); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6528); } void* sGuardHouseView2Textures[] = { @@ -883,10 +874,10 @@ void* sGuardHouseView1Textures[] = { }; // Scene Draw Config 45 -void func_8009D438(GlobalContext* globalCtx) { +void func_8009D438(PlayState* play) { s32 var; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6560); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6560); if (LINK_IS_ADULT) { var = 1; @@ -903,19 +894,19 @@ void func_8009D438(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6581); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6581); } // Scene Draw Config 46 -void func_8009D5B4(GlobalContext* globalCtx) { +void func_8009D5B4(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6595); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6595); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 3) % 1024, 16, 256, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 3) % 1024, 16, 256, 1, 0, 1023 - (gameplayFrames * 6) % 1024, 16, 256)); gDPPipeSync(POLY_OPA_DISP++); @@ -924,7 +915,7 @@ void func_8009D5B4(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6615); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6615); } void* sForestTempleEntranceTextures[] = { @@ -933,22 +924,22 @@ void* sForestTempleEntranceTextures[] = { }; // Scene Draw Config 22 -void func_8009D758(GlobalContext* globalCtx) { +void func_8009D758(PlayState* play) { u32 gameplayFrames; if (0) {} // Necessary to match - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6640); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6640); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sForestTempleEntranceTextures[((void)0, gSaveContext.nightFlag)])); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -956,7 +947,7 @@ void func_8009D758(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6671); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6671); } void* sSpiritTempleEntranceTextures[] = { @@ -965,31 +956,31 @@ void* sSpiritTempleEntranceTextures[] = { }; // Scene Draw Config 25 -void func_8009D974(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6752); +void func_8009D974(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6752); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sSpiritTempleEntranceTextures[((void)0, gSaveContext.nightFlag)])); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6762); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6762); } // Scene Draw Config 1 -void func_8009DA30(GlobalContext* globalCtx) { +void func_8009DA30(PlayState* play) { u32 gameplayFrames; Gfx* displayListHead; - displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 3 * sizeof(Gfx)); + displayListHead = Graph_Alloc(play->state.gfxCtx, 3 * sizeof(Gfx)); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6814); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6814); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1003,21 +994,21 @@ void func_8009DA30(GlobalContext* globalCtx) { gSPEndDisplayList(displayListHead); } else { if (gSaveContext.dayTime > CLOCK_TIME(18, 30)) { - if (globalCtx->roomCtx.unk_74[0] != 255) { - Math_StepToS(&globalCtx->roomCtx.unk_74[0], 255, 5); + if (play->roomCtx.unk_74[0] != 255) { + Math_StepToS(&play->roomCtx.unk_74[0], 255, 5); } } else if (gSaveContext.dayTime >= CLOCK_TIME(6, 0)) { - if (globalCtx->roomCtx.unk_74[0] != 0) { - Math_StepToS(&globalCtx->roomCtx.unk_74[0], 0, 10); + if (play->roomCtx.unk_74[0] != 0) { + Math_StepToS(&play->roomCtx.unk_74[0], 0, 10); } } - gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->roomCtx.unk_74[0]); + gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, play->roomCtx.unk_74[0]); gSPDisplayList(displayListHead++, spot00_room_0DL_012B20); gSPEndDisplayList(displayListHead); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6866); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6866); } void* sKakarikoWindowTextures[] = { @@ -1026,8 +1017,8 @@ void* sKakarikoWindowTextures[] = { }; // Scene Draw Config 2 -void func_8009DD5C(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6890); +void func_8009DD5C(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6890); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sKakarikoWindowTextures[((void)0, gSaveContext.nightFlag)])); @@ -1037,25 +1028,25 @@ void func_8009DD5C(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6903); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6903); } // Scene Draw Config 3 -void func_8009DE78(GlobalContext* globalCtx) { +void func_8009DE78(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6917); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6917); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1063,11 +1054,11 @@ void func_8009DE78(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6948); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6948); } // Scene Draw Config 4 -void func_8009E0B8(GlobalContext* globalCtx) { +void func_8009E0B8(PlayState* play) { u32 gameplayFrames; u8 spA3; u16 spA0; @@ -1075,20 +1066,20 @@ void func_8009E0B8(GlobalContext* globalCtx) { spA3 = 128; spA0 = 500; - displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 6 * sizeof(Gfx)); + displayListHead = Graph_Alloc(play->state.gfxCtx, 6 * sizeof(Gfx)); if (1) {} if (1) {} - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6965); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6965); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1097,9 +1088,9 @@ void func_8009E0B8(GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); if (gSaveContext.sceneSetupIndex == 4) { - spA3 = 255 - (u8)globalCtx->roomCtx.unk_74[0]; + spA3 = 255 - (u8)play->roomCtx.unk_74[0]; } else if (gSaveContext.sceneSetupIndex == 6) { - spA0 = globalCtx->roomCtx.unk_74[0] + 500; + spA0 = play->roomCtx.unk_74[0] + 500; } else if (((gSaveContext.sceneSetupIndex < 4) || LINK_IS_ADULT) && GET_EVENTCHKINF(EVENTCHKINF_07)) { spA0 = 2150; } @@ -1116,34 +1107,34 @@ void func_8009E0B8(GlobalContext* globalCtx) { gSPEndDisplayList(displayListHead); gSPSegment(POLY_OPA_DISP++, 0x0C, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (s16)(-globalCtx->roomCtx.unk_74[0] * 0.02f), 32, 16, 1, - 0, (s16)(-globalCtx->roomCtx.unk_74[0] * 0.02f), 32, 16)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (s16)(-play->roomCtx.unk_74[0] * 0.02f), 32, 16, 1, 0, + (s16)(-play->roomCtx.unk_74[0] * 0.02f), 32, 16)); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7044); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7044); } // Scene Draw Config 5 -void func_8009E54C(GlobalContext* globalCtx) { +void func_8009E54C(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7058); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7058); if ((gSaveContext.sceneSetupIndex > 3) || (LINK_IS_ADULT && !GET_EVENTCHKINF(EVENTCHKINF_69))) { - globalCtx->roomCtx.unk_74[0] = 87; + play->roomCtx.unk_74[0] = 87; } - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames, gameplayFrames, 32, 32, 1, 0, 0, 32, - 32, 0, 0, 0, globalCtx->roomCtx.unk_74[0] + 168)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, gameplayFrames, gameplayFrames, 32, 32, 1, 0, 0, 32, 32, + 0, 0, 0, play->roomCtx.unk_74[0] + 168)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, -gameplayFrames, -gameplayFrames, 32, 32, 1, 0, 0, - 16, 64, 0, 0, 0, globalCtx->roomCtx.unk_74[0] + 168)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, -gameplayFrames, -gameplayFrames, 32, 32, 1, 0, 0, 16, + 64, 0, 0, 0, play->roomCtx.unk_74[0] + 168)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7097); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7097); } void* sZorasDomainEntranceTextures[] = { @@ -1152,18 +1143,18 @@ void* sZorasDomainEntranceTextures[] = { }; // Scene Draw Config 6 -void func_8009E730(GlobalContext* globalCtx) { +void func_8009E730(PlayState* play) { u32 gameplayFrames; u32 var; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7123); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7123); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; var = 127 - (gameplayFrames * 1) % 128; if (LINK_IS_ADULT) { var = 0; } - gSPSegment(POLY_OPA_DISP++, 0x0C, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 64, 32, 1, 0, var, 64, 32)); + gSPSegment(POLY_OPA_DISP++, 0x0C, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 64, 32, 1, 0, var, 64, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1171,23 +1162,23 @@ void func_8009E730(GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sZorasDomainEntranceTextures[((void)0, gSaveContext.nightFlag)])); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7147); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7147); } // Scene Draw Config 7 -void func_8009E8C0(GlobalContext* globalCtx) { +void func_8009E8C0(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7161); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7161); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 2) % 256, 64, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 2) % 256, 64, 64, 1, 0, 255 - (gameplayFrames * 2) % 256, 64, 64)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); @@ -1196,33 +1187,32 @@ void func_8009E8C0(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7192); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7192); } // Scene Draw Config 8 -void func_8009EAD8(GlobalContext* globalCtx) { +void func_8009EAD8(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7206); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7206); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 3) % 1024, 32, 256, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 3) % 1024, 32, 256, 1, 0, (gameplayFrames * 3) % 1024, 32, 256)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 64, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 64, 64, 1, 0, (gameplayFrames * 1) % 256, 64, 64)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 2) % 128, 32, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 2) % 128, 32, 32, 1, 0, (gameplayFrames * 2) % 128, 32, 32)); - gSPSegment( - POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 3) % 128, 32, 32)); + gSPSegment(POLY_OPA_DISP++, 0x0B, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0C, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 64, 16, 16, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 64, 16, 16, 1, 0, (gameplayFrames * 1) % 64, 16, 16)); gDPPipeSync(POLY_OPA_DISP++); @@ -1231,23 +1221,23 @@ void func_8009EAD8(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7260); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7260); } // Scene Draw Config 9 -void func_8009EE44(GlobalContext* globalCtx) { +void func_8009EE44(PlayState* play) { u32 gameplayFrames; if (0) {} // Necessary to match - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7274); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7274); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 128, 0, 32, 16, 1, gameplayFrames % 128, 0, - 32, 16)); + gameplayFrames = play->gameplayFrames; + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames % 128, 0, 32, 16, 1, gameplayFrames % 128, 0, 32, 16)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, gameplayFrames % 128, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, gameplayFrames % 128, 32, 32, 1, gameplayFrames % 128, gameplayFrames % 128, 32, 32)); gDPPipeSync(POLY_XLU_DISP++); @@ -1256,26 +1246,26 @@ void func_8009EE44(GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); - if ((globalCtx->roomCtx.unk_74[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) { - if (globalCtx->roomCtx.unk_74[1] == 50) { - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_EV_CHICKEN_CRY_M); - globalCtx->roomCtx.unk_74[0] = 1; + if ((play->roomCtx.unk_74[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) { + if (play->roomCtx.unk_74[1] == 50) { + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_EV_CHICKEN_CRY_M); + play->roomCtx.unk_74[0] = 1; } - globalCtx->roomCtx.unk_74[1]++; + play->roomCtx.unk_74[1]++; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7309); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7309); } // Scene Draw Config 10 -void func_8009F074(GlobalContext* globalCtx) { +void func_8009F074(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7323); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7323); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - gameplayFrames % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - gameplayFrames % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1283,7 +1273,7 @@ void func_8009F074(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7339); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7339); } void* D_8012A380[] = { @@ -1292,27 +1282,27 @@ void* D_8012A380[] = { }; // Scene Draw Config 11 -void func_8009F1B4(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7363); +void func_8009F1B4(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7363); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A380[((void)0, gSaveContext.nightFlag)])); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7371); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7371); } // Scene Draw Config 12 -void func_8009F270(GlobalContext* globalCtx) { +void func_8009F270(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7385); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7385); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, - 32, 32)); - gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, - 32, 32)); + gameplayFrames = play->gameplayFrames; + gSPSegment( + POLY_OPA_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, 32, 32)); + gSPSegment( + POLY_XLU_DISP++, 0x09, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1320,22 +1310,22 @@ void func_8009F270(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7409); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7409); } // Scene Draw Config 13 -void func_8009F40C(GlobalContext* globalCtx) { +void func_8009F40C(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7423); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7423); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1343,14 +1333,14 @@ void func_8009F40C(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7443); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7443); } // Scene Draw Config 14 -void func_8009F5D4(GlobalContext* globalCtx) { - Gfx* displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 3 * sizeof(Gfx)); +void func_8009F5D4(PlayState* play) { + Gfx* displayListHead = Graph_Alloc(play->state.gfxCtx, 3 * sizeof(Gfx)); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7461); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7461); gSPSegment(POLY_XLU_DISP++, 0x08, displayListHead); @@ -1358,16 +1348,16 @@ void func_8009F5D4(GlobalContext* globalCtx) { gSPEndDisplayList(displayListHead); } else { if (gSaveContext.dayTime > CLOCK_TIME(18, 0)) { - if (globalCtx->roomCtx.unk_74[0] != 255) { - Math_StepToS(&globalCtx->roomCtx.unk_74[0], 255, 5); + if (play->roomCtx.unk_74[0] != 255) { + Math_StepToS(&play->roomCtx.unk_74[0], 255, 5); } } else if (gSaveContext.dayTime >= CLOCK_TIME(6, 0)) { - if (globalCtx->roomCtx.unk_74[0] != 0) { - Math_StepToS(&globalCtx->roomCtx.unk_74[0], 0, 10); + if (play->roomCtx.unk_74[0] != 0) { + Math_StepToS(&play->roomCtx.unk_74[0], 0, 10); } } - gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->roomCtx.unk_74[0]); + gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, play->roomCtx.unk_74[0]); gSPDisplayList(displayListHead++, spot16_room_0DL_00AA48); gSPEndDisplayList(displayListHead); } @@ -1378,24 +1368,24 @@ void func_8009F5D4(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7495); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7495); } // Scene Draw Config 15 -void func_8009F7D4(GlobalContext* globalCtx) { - s8 sp6F = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; - s8 sp6E = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; +void func_8009F7D4(PlayState* play) { + s8 sp6F = coss((play->gameplayFrames * 1500) & 0xFFFF) >> 8; + s8 sp6E = coss((play->gameplayFrames * 1500) & 0xFFFF) >> 8; u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7512); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7512); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; sp6F = (sp6F >> 1) + 192; sp6E = (sp6E >> 1) + 192; - gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, - 32, 32)); + gSPSegment( + POLY_OPA_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sp6F, sp6E, 255, 128); @@ -1403,7 +1393,7 @@ void func_8009F7D4(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7530); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7530); } void* sGoronCityEntranceTextures[] = { @@ -1412,15 +1402,15 @@ void* sGoronCityEntranceTextures[] = { }; // Scene Draw Config 16 -void func_8009F9D0(GlobalContext* globalCtx) { +void func_8009F9D0(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7555); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7555); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, - gameplayFrames % 128, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, gameplayFrames % 128, + 0, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1431,7 +1421,7 @@ void func_8009F9D0(GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sGoronCityEntranceTextures[((void)0, gSaveContext.nightFlag)])); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7578); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7578); } void* sLonLonRanchWindowTextures[] = { @@ -1440,8 +1430,8 @@ void* sLonLonRanchWindowTextures[] = { }; // Scene Draw Config 17 -void func_8009FB74(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7602); +void func_8009FB74(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7602); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sLonLonRanchWindowTextures[((void)0, gSaveContext.nightFlag)])); @@ -1452,23 +1442,22 @@ void func_8009FB74(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7615); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7615); } // Scene Draw Config 18 -void func_8009FC90(GlobalContext* globalCtx) { +void func_8009FC90(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7630); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7630); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, 127 - gameplayFrames % 128, 0, 32, 32)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, - 127 - (gameplayFrames * 6) % 128, 32, 32, 1, (gameplayFrames * 6) % 128, - 127 - (gameplayFrames * 3) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 127 - (gameplayFrames * 6) % 128, 32, + 32, 1, (gameplayFrames * 6) % 128, 127 - (gameplayFrames * 3) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 64); @@ -1476,31 +1465,31 @@ void func_8009FC90(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 64); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7653); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7653); } f32 D_8012A398 = 0.0f; -void func_8009FE58(GlobalContext* globalCtx) { +void func_8009FE58(PlayState* play) { static s16 D_8012A39C = 538; static s16 D_8012A3A0 = 4272; u32 gameplayFrames; f32 temp; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7712); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7712); - gameplayFrames = globalCtx->gameplayFrames; - if (globalCtx->sceneNum == SCENE_BDAN) { + gameplayFrames = play->gameplayFrames; + if (play->sceneNum == SCENE_BDAN) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, - 32, 1, 127 - gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, 32, 1, + 127 - gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, 32)); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 4) % 256, 32, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 4) % 256, 32, 64, 1, 0, 255 - (gameplayFrames * 4) % 256, 32, 64)); } else { - gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, (127 - (gameplayFrames * 1)) % 128, - (gameplayFrames * 1) % 128, 32, 32)); + gSPSegment( + POLY_OPA_DISP++, 0x08, + Gfx_TexScroll(play->state.gfxCtx, (127 - (gameplayFrames * 1)) % 128, (gameplayFrames * 1) % 128, 32, 32)); } gDPPipeSync(POLY_OPA_DISP++); @@ -1509,71 +1498,71 @@ void func_8009FE58(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - if (FrameAdvance_IsEnabled(globalCtx) != true) { + if (FrameAdvance_IsEnabled(play) != true) { D_8012A39C += 1820; D_8012A3A0 += 1820; temp = 0.020000001f; - View_SetDistortionOrientation(&globalCtx->view, + View_SetDistortionOrientation(&play->view, ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_CosS(D_8012A39C), ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_SinS(D_8012A39C), ((360.00018f / 65535.0f) * (M_PI / 180.0f)) * temp * Math_SinS(D_8012A3A0)); - View_SetDistortionScale(&globalCtx->view, 1.f + (0.79999995f * temp * Math_SinS(D_8012A3A0)), + View_SetDistortionScale(&play->view, 1.f + (0.79999995f * temp * Math_SinS(D_8012A3A0)), 1.f + (0.39999998f * temp * Math_CosS(D_8012A3A0)), 1.f + (1 * temp * Math_CosS(D_8012A39C))); - View_SetDistortionSpeed(&globalCtx->view, 0.95f); + View_SetDistortionSpeed(&play->view, 0.95f); - switch (globalCtx->roomCtx.unk_74[0]) { + switch (play->roomCtx.unk_74[0]) { case 0: break; case 1: - if (globalCtx->roomCtx.unk_74[1] < 1200) { - globalCtx->roomCtx.unk_74[1] += 200; + if (play->roomCtx.unk_74[1] < 1200) { + play->roomCtx.unk_74[1] += 200; } else { - globalCtx->roomCtx.unk_74[0]++; + play->roomCtx.unk_74[0]++; } break; case 2: - if (globalCtx->roomCtx.unk_74[1] > 0) { - globalCtx->roomCtx.unk_74[1] -= 30; + if (play->roomCtx.unk_74[1] > 0) { + play->roomCtx.unk_74[1] -= 30; } else { - globalCtx->roomCtx.unk_74[1] = 0; - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[1] = 0; + play->roomCtx.unk_74[0] = 0; } break; } - D_8012A398 += 0.15f + (globalCtx->roomCtx.unk_74[1] * 0.001f); + D_8012A398 += 0.15f + (play->roomCtx.unk_74[1] * 0.001f); } - if (globalCtx->roomCtx.curRoom.num == 2) { + if (play->roomCtx.curRoom.num == 2) { Matrix_Scale(1.0f, sinf(D_8012A398) * 0.8f, 1.0f, MTXMODE_NEW); } else { Matrix_Scale(1.005f, sinf(D_8012A398) * 0.8f, 1.005f, MTXMODE_NEW); } - gSPSegment(POLY_OPA_DISP++, 0x0D, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_scene_table.c", 7809)); + gSPSegment(POLY_OPA_DISP++, 0x0D, Matrix_NewMtx(play->state.gfxCtx, "../z_scene_table.c", 7809)); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7811); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7811); } // Scene Draw Config 26 -void func_800A0334(GlobalContext* globalCtx) { +void func_800A0334(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7825); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7825); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, - 128, 1, gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, 128, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, 128)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, - 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1581,29 +1570,28 @@ void func_800A0334(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7852); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7852); } // Scene Draw Config 52 -void func_800A055C(GlobalContext* globalCtx) { - func_8009BEEC(globalCtx); +void func_800A055C(PlayState* play) { + func_8009BEEC(play); } // Scene Draw Config 51 -void func_800A057C(GlobalContext* globalCtx) { - func_8009BEEC(globalCtx); +void func_800A057C(PlayState* play) { + func_8009BEEC(play); } // Scene Draw Config 49 -void func_800A059C(GlobalContext* globalCtx) { +void func_800A059C(PlayState* play) { u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7893); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7893); - gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 127 - (gameplayFrames * 2) % 128, 0, 32, 64)); - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 512, 128, 128)); + gameplayFrames = play->gameplayFrames; + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 127 - (gameplayFrames * 2) % 128, 0, 32, 64)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 512, 128, 128)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1611,10 +1599,10 @@ void func_800A059C(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7910); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7910); } -void (*sSceneDrawHandlers[])(GlobalContext*) = { +void (*sSceneDrawHandlers[])(PlayState*) = { func_80099550, func_8009DA30, func_8009DD5C, func_8009DE78, func_8009E0B8, func_8009E54C, func_8009E730, func_8009E8C0, func_8009EAD8, func_8009EE44, func_8009F074, func_8009F1B4, func_8009F270, func_8009F40C, func_8009F5D4, func_8009F7D4, func_8009F9D0, func_8009FB74, func_8009FC90, func_800995DC, func_80099878, @@ -1625,7 +1613,7 @@ void (*sSceneDrawHandlers[])(GlobalContext*) = { func_800A059C, func_8009CF84, func_800A057C, func_800A055C, }; -void Scene_Draw(GlobalContext* globalCtx) { +void Scene_Draw(PlayState* play) { if (HREG(80) == 17) { if (HREG(95) != 17) { HREG(95) = 17; @@ -1644,19 +1632,19 @@ void Scene_Draw(GlobalContext* globalCtx) { HREG(94) = 0; } - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 8104); + OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 8104); if (HREG(81) == 1) { gSPDisplayList(POLY_OPA_DISP++, sDefaultDisplayList); gSPDisplayList(POLY_XLU_DISP++, sDefaultDisplayList); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 8109); + CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 8109); if (HREG(82) == 1) { - sSceneDrawHandlers[globalCtx->sceneConfig](globalCtx); + sSceneDrawHandlers[play->sceneConfig](play); } } else { - sSceneDrawHandlers[globalCtx->sceneConfig](globalCtx); + sSceneDrawHandlers[play->sceneConfig](play); } } diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 844903e141..9ccf57a568 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -3,8 +3,8 @@ #define ANIM_INTERP 1 -s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime); -s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime); +s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime); +s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime); s32 SkelAnime_LoopFull(SkelAnime* skelAnime); s32 SkelAnime_Once(SkelAnime* skelAnime); s32 SkelAnime_LoopPartial(SkelAnime* skelAnime); @@ -18,14 +18,14 @@ static u32 sAnimQueueFlags; * Draw a limb of type `LodLimb` * Near or far display list is specified via `lod` */ -void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) { LodLimb* limb; Gfx* dList; Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 773); + OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 773); Matrix_Push(); limb = (LodLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]); @@ -38,10 +38,10 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele dList = limb->dLists[lod]; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 805), G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 805), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); } } @@ -49,28 +49,28 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele if (1) {} if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg); + postLimbDraw(play, limbIndex, &dList, &rot, arg); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod); + SkelAnime_DrawLimbLod(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod); + SkelAnime_DrawLimbLod(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 821); + CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 821); } /** * Draw all limbs of type `LodLimb` in a given skeleton * Near or far display list is specified via `lod` */ -void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, - OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) { +void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, + PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) { LodLimb* rootLimb; s32 pad; Gfx* dList; @@ -84,7 +84,7 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa return; } - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 849); + OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 849); Matrix_Push(); @@ -96,32 +96,31 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa rot = jointTable[1]; dList = rootLimb->dLists[lod]; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 881), G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 881), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &dList, &rot, arg); + postLimbDraw(play, 1, &dList, &rot, arg); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, - lod); + SkelAnime_DrawLimbLod(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 894); + CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 894); } /** * Draw a limb of type `LodLimb` contained within a flexible skeleton * Near or far display list is specified via `lod` */ -void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod, Mtx** mtx) { LodLimb* limb; @@ -143,15 +142,15 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s newDList = limbDList = limb->dLists[lod]; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(*mtx, "../z_skelanime.c", 945); { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 946); + OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 946); gSPMatrix(POLY_OPA_DISP++, *mtx, G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, newDList); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 949); + CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 949); } (*mtx)++; } else if (limbDList != NULL) { @@ -160,18 +159,18 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg); + postLimbDraw(play, limbIndex, &limbDList, &rot, arg); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, - lod, mtx); + SkelAnime_DrawFlexLimbLod(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod, + mtx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawFlexLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, - lod, mtx); + SkelAnime_DrawFlexLimbLod(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod, + mtx); } } @@ -180,7 +179,7 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s * Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs. * An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up. */ -void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) { LodLimb* rootLimb; s32 pad; @@ -188,7 +187,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi Gfx* limbDList; Vec3f pos; Vec3s rot; - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(Mtx)); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(Mtx)); if (skeleton == NULL) { osSyncPrintf(VT_FGCOL(RED)); @@ -197,7 +196,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi return; } - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1000); + OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1000); gSPSegment(POLY_OPA_DISP++, 0xD, mtx); Matrix_Push(); @@ -211,7 +210,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi newDList = limbDList = rootLimb->dLists[lod]; - if ((overrideLimbDraw == 0) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg)) { + if ((overrideLimbDraw == 0) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 1033); @@ -225,29 +224,29 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &limbDList, &rot, arg); + postLimbDraw(play, 1, &limbDList, &rot, arg); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, - lod, &mtx); + SkelAnime_DrawFlexLimbLod(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod, + &mtx); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1053); + CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1053); } /** * Draw a limb of type `StandardLimb` to the polyOpa buffer */ -void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +void SkelAnime_DrawLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) { StandardLimb* limb; Gfx* dList; Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1076); + OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1076); Matrix_Push(); limb = (StandardLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]); @@ -258,10 +257,10 @@ void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skele pos.z = limb->jointPos.z; dList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1103), G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 1103), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); } } @@ -269,26 +268,26 @@ void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skele if (1) {} if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg); + postLimbDraw(play, limbIndex, &dList, &rot, arg); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); + SkelAnime_DrawLimbOpa(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); + SkelAnime_DrawLimbOpa(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1121); + CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1121); } /** * Draw all limbs of type `StandardLimb` in a given skeleton to the polyOpa buffer */ -void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, - OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) { +void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, + PostLimbDrawOpa postLimbDraw, void* arg) { StandardLimb* rootLimb; s32 pad; Gfx* dList; @@ -302,7 +301,7 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa return; } - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1148); + OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1148); Matrix_Push(); rootLimb = (StandardLimb*)SEGMENTED_TO_VIRTUAL(skeleton[0]); @@ -314,31 +313,31 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa rot = jointTable[1]; dList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1176), G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 1176), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &dList, &rot, arg); + postLimbDraw(play, 1, &dList, &rot, arg); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); + SkelAnime_DrawLimbOpa(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1190); + CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1190); } /** * Draw a limb of type `StandardLimb` contained within a flexible skeleton to the polyOpa buffer */ -void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, Mtx** limbMatrices) { StandardLimb* limb; @@ -347,7 +346,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1214); + OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1214); Matrix_Push(); @@ -361,7 +360,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s newDList = limbDList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(*limbMatrices, "../z_skelanime.c", 1242); @@ -375,21 +374,21 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg); + postLimbDraw(play, limbIndex, &limbDList, &rot, arg); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + SkelAnime_DrawFlexLimbOpa(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, limbMatrices); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawFlexLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + SkelAnime_DrawFlexLimbOpa(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, limbMatrices); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1265); + CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1265); } /** @@ -397,7 +396,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s * Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs. * An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up. */ -void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) { StandardLimb* rootLimb; s32 pad; @@ -405,7 +404,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi Gfx* limbDList; Vec3f pos; Vec3s rot; - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(Mtx)); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(Mtx)); if (skeleton == NULL) { osSyncPrintf(VT_FGCOL(RED)); @@ -414,7 +413,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi return; } - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1294); + OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1294); gSPSegment(POLY_OPA_DISP++, 0xD, mtx); @@ -430,7 +429,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi newDList = limbDList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 1327); @@ -444,16 +443,16 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &limbDList, &rot, arg); + postLimbDraw(play, 1, &limbDList, &rot, arg); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + SkelAnime_DrawFlexLimbOpa(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, &mtx); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1347); + CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1347); } /** @@ -502,7 +501,7 @@ s16 Animation_GetLastFrame(void* animation) { /** * Draw a limb of type `StandardLimb` to the specified display buffer */ -Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +Gfx* SkelAnime_DrawLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) { StandardLimb* limb; Gfx* dList; @@ -522,28 +521,26 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton dList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1489), G_MTX_LOAD); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 1489), G_MTX_LOAD); gSPDisplayList(gfx++, dList); } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg, &gfx); + postLimbDraw(play, limbIndex, &dList, &rot, arg, &gfx); } if (limb->child != LIMB_DONE) { - gfx = - SkelAnime_DrawLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx); + gfx = SkelAnime_DrawLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - gfx = SkelAnime_DrawLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, - gfx); + gfx = SkelAnime_DrawLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx); } return gfx; @@ -552,7 +549,7 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton /** * Draw all limbs of type `StandardLimb` in a given skeleton to the specified display buffer */ -Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, +Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) { StandardLimb* rootLimb; s32 pad; @@ -580,21 +577,20 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable dList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1558), G_MTX_LOAD); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 1558), G_MTX_LOAD); gSPDisplayList(gfx++, dList); } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &dList, &rot, arg, &gfx); + postLimbDraw(play, 1, &dList, &rot, arg, &gfx); } if (rootLimb->child != LIMB_DONE) { - gfx = SkelAnime_DrawLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, - gfx); + gfx = SkelAnime_DrawLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx); } Matrix_Pop(); @@ -605,7 +601,7 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable /** * Draw a limb of type `StandardLimb` contained within a flexible skeleton to the specified display buffer */ -Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +Gfx* SkelAnime_DrawFlexLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Mtx** mtx, Gfx* gfx) { StandardLimb* limb; @@ -625,7 +621,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel pos.z = limb->jointPos.z; newDList = limbDList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(*mtx, "../z_skelanime.c", 1623); @@ -638,18 +634,18 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg, &gfx); + postLimbDraw(play, limbIndex, &limbDList, &rot, arg, &gfx); } if (limb->child != LIMB_DONE) { - gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, - mtx, gfx); + gfx = SkelAnime_DrawFlexLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, mtx, + gfx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, - arg, mtx, gfx); + gfx = SkelAnime_DrawFlexLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + mtx, gfx); } return gfx; @@ -660,7 +656,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel * Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs. * An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up. */ -Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) { StandardLimb* rootLimb; s32 pad; @@ -668,7 +664,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT Gfx* limbDList; Vec3f pos; Vec3s rot; - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(*mtx)); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(*mtx)); if (skeleton == NULL) { osSyncPrintf(VT_FGCOL(RED)); @@ -690,7 +686,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT newDList = limbDList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 1710); @@ -703,11 +699,11 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &limbDList, &rot, arg, &gfx); + postLimbDraw(play, 1, &limbDList, &rot, arg, &gfx); } if (rootLimb->child != LIMB_DONE) { - gfx = SkelAnime_DrawFlexLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, - arg, &mtx, gfx); + gfx = SkelAnime_DrawFlexLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, + &mtx, gfx); } Matrix_Pop(); @@ -810,14 +806,14 @@ void AnimationContext_Reset(AnimationContext* animationCtx) { /** * Shifts the queue flag to the next queue */ -void AnimationContext_SetNextQueue(GlobalContext* globalCtx) { +void AnimationContext_SetNextQueue(PlayState* play) { sAnimQueueFlags <<= 1; } /** * Disables the current animation queue. Only load and move actor requests will be processed for that queue. */ -void AnimationContext_DisableQueue(GlobalContext* globalCtx) { +void AnimationContext_DisableQueue(PlayState* play) { sDisableAnimQueueFlags |= sAnimQueueFlags; } @@ -838,9 +834,9 @@ AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, Animat /** * Requests loading frame data from the Link animation into frameTable */ -void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader* animation, s32 frame, s32 limbCount, +void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable) { - AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_LOADFRAME); + AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_LOADFRAME); if (entry != NULL) { LinkAnimationHeader* linkAnimHeader = SEGMENTED_TO_VIRTUAL(animation); @@ -857,8 +853,8 @@ void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader /** * Requests copying all vectors from src frame table into dst frame table */ -void AnimationContext_SetCopyAll(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src) { - AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYALL); +void AnimationContext_SetCopyAll(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src) { + AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_COPYALL); if (entry != NULL) { entry->data.copy.queueFlag = sAnimQueueFlags; @@ -871,8 +867,8 @@ void AnimationContext_SetCopyAll(GlobalContext* globalCtx, s32 vecCount, Vec3s* /** * Requests interpolating between base and mod frame tables with the given weight, placing the result in base */ -void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight) { - AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_INTERP); +void AnimationContext_SetInterp(PlayState* play, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight) { + AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_INTERP); if (entry != NULL) { entry->data.interp.queueFlag = sAnimQueueFlags; @@ -886,8 +882,8 @@ void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 vecCount, Vec3s* b /** * Requests copying vectors from src frame table to dst frame table whose copy flag is true */ -void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) { - AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYTRUE); +void AnimationContext_SetCopyTrue(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) { + AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_COPYTRUE); if (entry != NULL) { entry->data.copy1.queueFlag = sAnimQueueFlags; @@ -901,8 +897,8 @@ void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s* /** * Requests copying vectors from src frame table to dst frame table whose copy flag is false */ -void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) { - AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYFALSE); +void AnimationContext_SetCopyFalse(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) { + AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_COPYFALSE); if (entry != NULL) { entry->data.copy0.queueFlag = sAnimQueueFlags; @@ -916,8 +912,8 @@ void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s /** * Requests moving an actor according to the translation of its root limb */ -void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 arg3) { - AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_MOVEACTOR); +void AnimationContext_SetMoveActor(PlayState* play, Actor* actor, SkelAnime* skelAnime, f32 arg3) { + AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_MOVEACTOR); if (entry != NULL) { entry->data.move.actor = actor; @@ -929,7 +925,7 @@ void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelA /** * Receives the request for Link's animation frame data */ -void AnimationContext_LoadFrame(GlobalContext* globalCtx, AnimationEntryData* data) { +void AnimationContext_LoadFrame(PlayState* play, AnimationEntryData* data) { AnimEntryLoadFrame* entry = &data->load; osRecvMesg(&entry->msgQueue, NULL, OS_MESG_BLOCK); @@ -938,7 +934,7 @@ void AnimationContext_LoadFrame(GlobalContext* globalCtx, AnimationEntryData* da /** * If the entry's queue is enabled, copies all vectors from src frame table to dst frame table */ -void AnimationContext_CopyAll(GlobalContext* globalCtx, AnimationEntryData* data) { +void AnimationContext_CopyAll(PlayState* play, AnimationEntryData* data) { AnimEntryCopyAll* entry = &data->copy; if (!(entry->queueFlag & sDisableAnimQueueFlags)) { @@ -955,7 +951,7 @@ void AnimationContext_CopyAll(GlobalContext* globalCtx, AnimationEntryData* data /** * If the entry's queue is enabled, interpolates between the base and mod frame tables, placing the result in base */ -void AnimationContext_Interp(GlobalContext* globalCtx, AnimationEntryData* data) { +void AnimationContext_Interp(PlayState* play, AnimationEntryData* data) { AnimEntryInterp* entry = &data->interp; if (!(entry->queueFlag & sDisableAnimQueueFlags)) { @@ -966,7 +962,7 @@ void AnimationContext_Interp(GlobalContext* globalCtx, AnimationEntryData* data) /** * If the entry's queue is enabled, copies all vectors from src frame table to dst frame table whose copy flag is true */ -void AnimationContext_CopyTrue(GlobalContext* globalCtx, AnimationEntryData* data) { +void AnimationContext_CopyTrue(PlayState* play, AnimationEntryData* data) { AnimEntryCopyTrue* entry = &data->copy1; if (!(entry->queueFlag & sDisableAnimQueueFlags)) { @@ -986,7 +982,7 @@ void AnimationContext_CopyTrue(GlobalContext* globalCtx, AnimationEntryData* dat /** * If the entry's queue is enabled, copies all vectors from src frame table to dst frame table whose copy flag is false */ -void AnimationContext_CopyFalse(GlobalContext* globalCtx, AnimationEntryData* data) { +void AnimationContext_CopyFalse(PlayState* play, AnimationEntryData* data) { AnimEntryCopyFalse* entry = &data->copy0; if (!(entry->queueFlag & sDisableAnimQueueFlags)) { @@ -1006,7 +1002,7 @@ void AnimationContext_CopyFalse(GlobalContext* globalCtx, AnimationEntryData* da /** * Moves an actor according to the translation of its root limb */ -void AnimationContext_MoveActor(GlobalContext* globalCtx, AnimationEntryData* data) { +void AnimationContext_MoveActor(PlayState* play, AnimationEntryData* data) { AnimEntryMoveActor* entry = &data->move; Actor* actor = entry->actor; Vec3f diff; @@ -1020,7 +1016,7 @@ void AnimationContext_MoveActor(GlobalContext* globalCtx, AnimationEntryData* da /** * Performs all requests in the animation queue, then resets the queue flags. */ -void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animationCtx) { +void AnimationContext_Update(PlayState* play, AnimationContext* animationCtx) { static AnimationEntryCallback animFuncs[] = { AnimationContext_LoadFrame, AnimationContext_CopyAll, AnimationContext_Interp, AnimationContext_CopyTrue, AnimationContext_CopyFalse, AnimationContext_MoveActor, @@ -1028,7 +1024,7 @@ void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animati AnimationEntry* entry; for (entry = animationCtx->entries; animationCtx->animationCount != 0; entry++, animationCtx->animationCount--) { - animFuncs[entry->type](globalCtx, &entry->data); + animFuncs[entry->type](play, &entry->data); } sAnimQueueFlags = 1; @@ -1039,7 +1035,7 @@ void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animati * Initializes a skeleton to be used with Link animations to a looping animation, dynamically allocating the frame * tables if not given. */ -void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, +void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, LinkAnimationHeader* animation, s32 flags, Vec3s* jointTable, Vec3s* morphTable, s32 limbBufCount) { FlexSkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg); @@ -1084,7 +1080,7 @@ void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkel osSyncPrintf(VT_RST); } - LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f); + LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f); } /** @@ -1103,15 +1099,15 @@ void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime) { * Advances the current Link animation and updates all frame tables. If the animation plays once, returns true when it * finishes. */ -s32 LinkAnimation_Update(GlobalContext* globalCtx, SkelAnime* skelAnime) { - return skelAnime->update(globalCtx, skelAnime); +s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime) { + return skelAnime->update(play, skelAnime); } /** * Requests an interpolation between the pose in jointTable to the one in morphTable, advancing the morph but not the * animation frame */ -s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) { +s32 LinkAnimation_Morph(PlayState* play, SkelAnime* skelAnime) { f32 prevMorphWeight = skelAnime->morphWeight; f32 updateRate = R_UPDATE_RATE * 0.5f; @@ -1121,7 +1117,7 @@ s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) { LinkAnimation_SetUpdateFunction(skelAnime); } - AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, + AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, 1.0f - (skelAnime->morphWeight / prevMorphWeight)); return 0; } @@ -1130,8 +1126,8 @@ s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) { * Requests a load of the next frame of a Link animation, advances the morph, and requests an interpolation between * jointTable and morphTable */ -void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime) { - AnimationContext_SetLoadFrame(globalCtx, skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount, +void LinkAnimation_AnimateFrame(PlayState* play, SkelAnime* skelAnime) { + AnimationContext_SetLoadFrame(play, skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount, skelAnime->jointTable); if (skelAnime->morphWeight != 0) { f32 updateRate = R_UPDATE_RATE * 0.5f; @@ -1140,7 +1136,7 @@ void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime) if (skelAnime->morphWeight <= 0.0f) { skelAnime->morphWeight = 0.0f; } else { - AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, + AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, skelAnime->morphWeight); } } @@ -1149,7 +1145,7 @@ void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime) /** * Advances a Link animation that loops over its full length */ -s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime) { +s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime) { f32 updateRate = R_UPDATE_RATE * 0.5f; skelAnime->curFrame += skelAnime->playSpeed * updateRate; @@ -1158,18 +1154,18 @@ s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime) { } else if (skelAnime->animLength <= skelAnime->curFrame) { skelAnime->curFrame -= skelAnime->animLength; } - LinkAnimation_AnimateFrame(globalCtx, skelAnime); + LinkAnimation_AnimateFrame(play, skelAnime); return 0; } /** * Advances a Link animation that stops at endFrame and returns true when it is reached. */ -s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime) { +s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime) { f32 updateRate = R_UPDATE_RATE * 0.5f; if (skelAnime->curFrame == skelAnime->endFrame) { - LinkAnimation_AnimateFrame(globalCtx, skelAnime); + LinkAnimation_AnimateFrame(play, skelAnime); return 1; } skelAnime->curFrame += skelAnime->playSpeed * updateRate; @@ -1180,14 +1176,14 @@ s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime) { } else if (skelAnime->animLength <= skelAnime->curFrame) { skelAnime->curFrame -= skelAnime->animLength; } - LinkAnimation_AnimateFrame(globalCtx, skelAnime); + LinkAnimation_AnimateFrame(play, skelAnime); return 0; } /** * Sets a new morph and resets the morph weight for the current animation. */ -void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 morphFrames) { +void Animation_SetMorph(PlayState* play, SkelAnime* skelAnime, f32 morphFrames) { skelAnime->morphWeight = 1.0f; skelAnime->morphRate = 1.0f / morphFrames; } @@ -1198,7 +1194,7 @@ void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 morp * animation, then start the new animation. Negative morph frames start the new animation immediately, modified by the * pose immediately before the animation change. */ -void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, +void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames) { skelAnime->mode = mode; if ((morphFrames != 0.0f) && ((animation != skelAnime->animation) || (startFrame != skelAnime->curFrame))) { @@ -1208,15 +1204,14 @@ void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAn morphFrames = -morphFrames; } else { skelAnime->update = LinkAnimation_Morph; - AnimationContext_SetLoadFrame(globalCtx, animation, (s32)startFrame, skelAnime->limbCount, + AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount, skelAnime->morphTable); } skelAnime->morphWeight = 1.0f; skelAnime->morphRate = 1.0f / morphFrames; } else { LinkAnimation_SetUpdateFunction(skelAnime); - AnimationContext_SetLoadFrame(globalCtx, animation, (s32)startFrame, skelAnime->limbCount, - skelAnime->jointTable); + AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount, skelAnime->jointTable); skelAnime->morphWeight = 0.0f; } @@ -1232,105 +1227,101 @@ void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAn /** * Immediately changes to a Link animation that plays once at the default speed. */ -void LinkAnimation_PlayOnce(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation) { - LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, +void LinkAnimation_PlayOnce(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) { + LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); } /** * Immediately changes to a Link animation that plays once at the specified speed. */ -void LinkAnimation_PlayOnceSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_PlayOnceSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed) { - LinkAnimation_Change(globalCtx, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation), - ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, + 0.0f); } /** * Immediately changes to a Link animation that loops at the default speed. */ -void LinkAnimation_PlayLoop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation) { - LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, +void LinkAnimation_PlayLoop(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) { + LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, 0.0f); } /** * Immediately changes to a Link animation that loops at the specified speed. */ -void LinkAnimation_PlayLoopSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, +void LinkAnimation_PlayLoopSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed) { - LinkAnimation_Change(globalCtx, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation), - ANIMMODE_LOOP, 0.0f); + LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, + 0.0f); } /** * Requests copying jointTable to morphTable */ -void LinkAnimation_CopyJointToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime) { - AnimationContext_SetCopyAll(globalCtx, skelAnime->limbCount, skelAnime->morphTable, skelAnime->jointTable); +void LinkAnimation_CopyJointToMorph(PlayState* play, SkelAnime* skelAnime) { + AnimationContext_SetCopyAll(play, skelAnime->limbCount, skelAnime->morphTable, skelAnime->jointTable); } /** * Requests copying morphTable to jointTable * unused */ -void LinkAnimation_CopyMorphToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime) { - AnimationContext_SetCopyAll(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable); +void LinkAnimation_CopyMorphToJoint(PlayState* play, SkelAnime* skelAnime) { + AnimationContext_SetCopyAll(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable); } /** * Requests loading frame data from the Link animation into morphTable */ -void LinkAnimation_LoadToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, - f32 frame) { - AnimationContext_SetLoadFrame(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->morphTable); +void LinkAnimation_LoadToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame) { + AnimationContext_SetLoadFrame(play, animation, (s32)frame, skelAnime->limbCount, skelAnime->morphTable); } /** * Requests loading frame data from the Link animation into jointTable */ -void LinkAnimation_LoadToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, - f32 frame) { - AnimationContext_SetLoadFrame(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->jointTable); +void LinkAnimation_LoadToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame) { + AnimationContext_SetLoadFrame(play, animation, (s32)frame, skelAnime->limbCount, skelAnime->jointTable); } /** * Requests interpolating between jointTable and morphTable, placing the result in jointTable */ -void LinkAnimation_InterpJointMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 weight) { - AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, weight); +void LinkAnimation_InterpJointMorph(PlayState* play, SkelAnime* skelAnime, f32 weight) { + AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, weight); } /** * Requests loading frame data from the Link animations and blending them, placing the result in jointTable */ -void LinkAnimation_BlendToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1, - f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, - Vec3s* blendTable) { +void LinkAnimation_BlendToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, + LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable) { Vec3s* alignedBlendTable; - AnimationContext_SetLoadFrame(globalCtx, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->jointTable); + AnimationContext_SetLoadFrame(play, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->jointTable); alignedBlendTable = (Vec3s*)ALIGN16((u32)blendTable); - AnimationContext_SetLoadFrame(globalCtx, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable); - AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, alignedBlendTable, blendWeight); + AnimationContext_SetLoadFrame(play, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable); + AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, alignedBlendTable, blendWeight); } /** * Requests loading frame data from the Link animations and blending them, placing the result in morphTable */ -void LinkAnimation_BlendToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1, - f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, - Vec3s* blendTable) { +void LinkAnimation_BlendToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, + LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable) { Vec3s* alignedBlendTable; - AnimationContext_SetLoadFrame(globalCtx, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->morphTable); + AnimationContext_SetLoadFrame(play, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->morphTable); alignedBlendTable = (Vec3s*)ALIGN16((u32)blendTable); - AnimationContext_SetLoadFrame(globalCtx, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable); - AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->morphTable, alignedBlendTable, blendWeight); + AnimationContext_SetLoadFrame(play, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable); + AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->morphTable, alignedBlendTable, blendWeight); } /** @@ -1380,8 +1371,8 @@ s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame) { /** * Initializes a normal skeleton to a looping animation, dynamically allocating the frame tables if not provided. */ -s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, - AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) { +s32 SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, + Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) { SkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg); skelAnime->limbCount = skeletonHeader->limbCount + 1; @@ -1410,7 +1401,7 @@ s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeade /** * Initializes a flex skeleton to a looping animation, dynamically allocating the frame tables if not given. */ -s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, +s32 SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) { FlexSkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg); @@ -1444,7 +1435,7 @@ s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkele /** * Initializes a skeleton with SkinLimbs to a looping animation, dynamically allocating the frame tables. */ -s32 SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, +s32 SkelAnime_InitSkin(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation) { SkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg); @@ -1839,7 +1830,7 @@ s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame) { /** * Frees the frame tables for a skelAnime with dynamically allocated tables. */ -void SkelAnime_Free(SkelAnime* skelAnime, GlobalContext* globalCtx) { +void SkelAnime_Free(SkelAnime* skelAnime, PlayState* play) { if (skelAnime->jointTable != NULL) { ZeldaArena_FreeDebug(skelAnime->jointTable, "../z_skelanime.c", 3729); } else { diff --git a/src/code/z_skin.c b/src/code/z_skin.c index 9c886fa2e1..e61ed3d09d 100644 --- a/src/code/z_skin.c +++ b/src/code/z_skin.c @@ -185,12 +185,12 @@ void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dlis CLOSE_DISPS(gfxCtx, "../z_skin.c", 433); } -void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void Skin_DrawImpl(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) { s32 i; s32 segmentType; SkinLimb** skeleton; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; OPEN_DISPS(gfxCtx, "../z_skin.c", 471); @@ -218,7 +218,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD s32 shouldDraw = true; if (overrideLimbDraw != NULL) { - shouldDraw = overrideLimbDraw(actor, globalCtx, i, skin); + shouldDraw = overrideLimbDraw(actor, play, i, skin); } segmentType = ((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[i]))->segmentType; @@ -231,7 +231,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD } if (postDraw != NULL) { - postDraw(actor, globalCtx, skin); + postDraw(actor, play, skin); } close_disps: @@ -239,26 +239,26 @@ close_disps: } // allows specifying PostLimbDraw and setTranslation -void func_800A6330(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) { - Skin_DrawImpl(actor, globalCtx, skin, postDraw, NULL, setTranslation, false, 0); +void func_800A6330(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) { + Skin_DrawImpl(actor, play, skin, postDraw, NULL, setTranslation, false, 0); } // allows specifying OverrideLimbDraw, PostLimbDraw and setTranslation -void func_800A6360(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_800A6360(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation) { - Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, false, 0); + Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, false, 0); } // allows specifying OverrideLimbDraw, PostLimbDraw, setTranslation, and arg6 -void func_800A6394(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_800A6394(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6) { - Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, 0); + Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, arg6, 0); } // allows specifying all variables -void func_800A63CC(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_800A63CC(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) { - Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, drawFlags); + Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, arg6, drawFlags); } void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* offset, Vec3f* dst) { diff --git a/src/code/z_skin_awb.c b/src/code/z_skin_awb.c index 13ceafa91d..e16556ca6a 100644 --- a/src/code/z_skin_awb.c +++ b/src/code/z_skin_awb.c @@ -4,7 +4,7 @@ /** * Initialises the Vtx buffers used for limb at index `limbIndex` */ -void Skin_InitAnimatedLimb(GlobalContext* globalCtx, Skin* skin, s32 limbIndex) { +void Skin_InitAnimatedLimb(PlayState* play, Skin* skin, s32 limbIndex) { s32 i; SkinLimb** skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment); SkinAnimatedLimbData* animatedLimbData = @@ -36,7 +36,7 @@ void Skin_InitAnimatedLimb(GlobalContext* globalCtx, Skin* skin, s32 limbIndex) * Initializes a skin skeleton to looping animation, dynamically allocating the frame tables, * and dynamically allocating and initializing the Vtx and SkinLimbVtx buffers for its animated limbs */ -void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) { +void Skin_Init(PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) { s32 limbCount; s32 i; SkinLimb** skeleton; @@ -74,17 +74,17 @@ void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHea ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx), "../z_skin_awb.c", 240); ASSERT(vtxEntry->buf[1] != NULL, "psavb->buf[1] != NULL", "../z_skin_awb.c", 242); - Skin_InitAnimatedLimb(globalCtx, skin, i); + Skin_InitAnimatedLimb(play, skin, i); } } - SkelAnime_InitSkin(globalCtx, &skin->skelAnime, skeletonHeader, animationHeader); + SkelAnime_InitSkin(play, &skin->skelAnime, skeletonHeader, animationHeader); } /** * Frees the dynamically allocated Vtx and SkinLimbVtx buffers and tables */ -void Skin_Free(GlobalContext* globalCtx, Skin* skin) { +void Skin_Free(PlayState* play, Skin* skin) { if (skin->vtxTable != NULL) { s32 i; @@ -103,7 +103,7 @@ void Skin_Free(GlobalContext* globalCtx, Skin* skin) { ZeldaArena_FreeDebug(skin->vtxTable, "../z_skin_awb.c", 286); } - SkelAnime_Free(&skin->skelAnime, globalCtx); + SkelAnime_Free(&skin->skelAnime, play); } } diff --git a/src/code/z_sound_source.c b/src/code/z_sound_source.c index fe9088a70b..6e89130d7d 100644 --- a/src/code/z_sound_source.c +++ b/src/code/z_sound_source.c @@ -1,24 +1,24 @@ #include "global.h" -void SoundSource_InitAll(GlobalContext* globalCtx) { - SoundSource* sources = &globalCtx->soundSources[0]; +void SoundSource_InitAll(PlayState* play) { + SoundSource* sources = &play->soundSources[0]; s32 i; // clang-format off - for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { sources[i].countdown = 0; } + for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) { sources[i].countdown = 0; } // clang-format on } -void SoundSource_UpdateAll(GlobalContext* globalCtx) { - SoundSource* source = &globalCtx->soundSources[0]; +void SoundSource_UpdateAll(PlayState* play) { + SoundSource* source = &play->soundSources[0]; s32 i; - for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { + for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) { if (source->countdown != 0) { if (DECR(source->countdown) == 0) { Audio_StopSfxByPos(&source->projectedPos); } else { - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos); } } @@ -26,15 +26,15 @@ void SoundSource_UpdateAll(GlobalContext* globalCtx) { } } -void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, s32 duration, u16 sfxId) { +void SoundSource_PlaySfxAtFixedWorldPos(PlayState* play, Vec3f* worldPos, s32 duration, u16 sfxId) { s32 countdown; SoundSource* source; s32 smallestCountdown = 0xFFFF; SoundSource* backupSource; s32 i; - source = &globalCtx->soundSources[0]; - for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { + source = &play->soundSources[0]; + for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) { if (source->countdown == 0) { break; } @@ -49,7 +49,7 @@ void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPo } // If no sound source is available, replace the sound source with the smallest remaining countdown - if (i >= ARRAY_COUNT(globalCtx->soundSources)) { + if (i >= ARRAY_COUNT(play->soundSources)) { source = backupSource; Audio_StopSfxByPos(&source->projectedPos); } @@ -57,7 +57,7 @@ void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPo source->worldPos = *worldPos; source->countdown = duration; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos); Audio_PlaySoundGeneral(sfxId, &source->projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 83e7ba9e06..746413491e 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -899,5 +899,5 @@ void Sram_Alloc(GameState* gameState, SramContext* sramCtx) { ASSERT(sramCtx->readBuff != NULL, "sram->read_buff != NULL", "../z_sram.c", 1295); } -void Sram_Init(GlobalContext* globalCtx, SramContext* sramCtx) { +void Sram_Init(PlayState* play, SramContext* sramCtx) { } diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index fd87904d1e..9c9da69fbc 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -370,7 +370,7 @@ void func_800AF178(SkyboxContext* skyboxCtx, s32 arg1) { } } -void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyboxId) { +void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) { u32 size; s16 i; u8 skybox1Index; @@ -390,25 +390,23 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox if (gSaveContext.skyboxTime >= gTimeBasedSkyboxConfigs[skyboxConfig][i].startTime && (gSaveContext.skyboxTime < gTimeBasedSkyboxConfigs[skyboxConfig][i].endTime || gTimeBasedSkyboxConfigs[skyboxConfig][i].endTime == 0xFFFF)) { - globalCtx->envCtx.skybox1Index = skybox1Index = - gTimeBasedSkyboxConfigs[skyboxConfig][i].skybox1Index; - globalCtx->envCtx.skybox2Index = skybox2Index = - gTimeBasedSkyboxConfigs[skyboxConfig][i].skybox2Index; + play->envCtx.skybox1Index = skybox1Index = gTimeBasedSkyboxConfigs[skyboxConfig][i].skybox1Index; + play->envCtx.skybox2Index = skybox2Index = gTimeBasedSkyboxConfigs[skyboxConfig][i].skybox2Index; if (gTimeBasedSkyboxConfigs[skyboxConfig][i].changeSkybox) { - globalCtx->envCtx.skyboxBlend = + play->envCtx.skyboxBlend = Environment_LerpWeight(gTimeBasedSkyboxConfigs[skyboxConfig][i].endTime, gTimeBasedSkyboxConfigs[skyboxConfig][i].startTime, ((void)0, gSaveContext.skyboxTime)) * 255.0f; } else { - globalCtx->envCtx.skyboxBlend = 0; + play->envCtx.skyboxBlend = 0; } break; } } size = gNormalSkyFiles[skybox1Index].file.vromEnd - gNormalSkyFiles[skybox1Index].file.vromStart; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1054); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1054); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1055); @@ -416,7 +414,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox "../z_vr_box.c", 1058); size = gNormalSkyFiles[skybox2Index].file.vromEnd - gNormalSkyFiles[skybox2Index].file.vromStart; - skyboxCtx->staticSegments[1] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1060); + skyboxCtx->staticSegments[1] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1060); ASSERT(skyboxCtx->staticSegments[1] != NULL, "vr_box->vr_box_staticSegment[1] != NULL", "../z_vr_box.c", 1061); @@ -426,7 +424,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox if ((skybox1Index & 1) ^ ((skybox1Index & 4) >> 2)) { size = gNormalSkyFiles[skybox1Index].palette.vromEnd - gNormalSkyFiles[skybox1Index].palette.vromStart; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1072); + skyboxCtx->palettes = GameState_Alloc(&play->state, size * 2, "../z_vr_box.c", 1072); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1073); @@ -437,7 +435,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox } else { size = gNormalSkyFiles[skybox1Index].palette.vromEnd - gNormalSkyFiles[skybox1Index].palette.vromStart; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1085); + skyboxCtx->palettes = GameState_Alloc(&play->state, size * 2, "../z_vr_box.c", 1085); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1086); @@ -453,7 +451,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_SP1a_staticSegmentRomStart; size = _vr_SP1a_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1127); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1127); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1128); @@ -461,7 +459,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_SP1a_pal_staticSegmentRomStart; size = _vr_SP1a_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1132); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1132); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1133); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1134); @@ -470,13 +468,13 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox case SKYBOX_OVERCAST_SUNSET: start = _vr_cloud2_staticSegmentRomStart; size = _vr_cloud2_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1155); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1155); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1156); DmaMgr_SendRequest1(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1159); - skyboxCtx->staticSegments[1] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1162); + skyboxCtx->staticSegments[1] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1162); ASSERT(skyboxCtx->staticSegments[1] != NULL, "vr_box->vr_box_staticSegment[1] != NULL", "../z_vr_box.c", 1163); @@ -484,7 +482,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_cloud2_pal_staticSegmentRomStart; size = _vr_cloud2_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1170); + skyboxCtx->palettes = GameState_Alloc(&play->state, size * 2, "../z_vr_box.c", 1170); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1171); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1173); @@ -495,7 +493,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_RUVR_staticSegmentRomStart; size = _vr_RUVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1182); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1182); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1183); @@ -505,7 +503,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox size = _vr_RUVR_pal_staticSegmentRomEnd - start; osSyncPrintf("SIZE = %d\n", size); - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1188); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1188); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1189); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1190); @@ -513,7 +511,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox case SKYBOX_CUTSCENE_MAP: start = _vr_holy0_staticSegmentRomStart; size = _vr_holy0_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1196); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1196); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1197); @@ -521,7 +519,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_holy1_staticSegmentRomStart; size = _vr_holy1_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[1] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1203); + skyboxCtx->staticSegments[1] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1203); ASSERT(skyboxCtx->staticSegments[1] != NULL, "vr_box->vr_box_staticSegment[1] != NULL", "../z_vr_box.c", 1204); @@ -529,7 +527,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_holy0_pal_staticSegmentRomStart; size = _vr_holy0_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1211); + skyboxCtx->palettes = GameState_Alloc(&play->state, size * 2, "../z_vr_box.c", 1211); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1212); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1214); @@ -541,7 +539,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_LHVR_staticSegmentRomStart; size = _vr_LHVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1226); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1226); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1227); @@ -549,7 +547,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_LHVR_pal_staticSegmentRomStart; size = _vr_LHVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1231); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1231); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1232); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1233); @@ -559,7 +557,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_MDVR_staticSegmentRomStart; size = _vr_MDVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1257); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1257); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1258); @@ -567,7 +565,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_MDVR_pal_staticSegmentRomStart; size = _vr_MDVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1262); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1262); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1263); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1264); @@ -577,7 +575,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_MNVR_staticSegmentRomStart; size = _vr_MNVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1271); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1271); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1272); @@ -587,7 +585,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox size = _vr_MNVR_pal_staticSegmentRomEnd - start; osSyncPrintf("SIZE = %d\n", size); - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1277); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1277); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1278); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1279); @@ -597,7 +595,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_FCVR_staticSegmentRomStart; size = _vr_FCVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1286); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1286); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1287); @@ -605,7 +603,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_FCVR_pal_staticSegmentRomStart; size = _vr_FCVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1291); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1291); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1292); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1293); @@ -616,7 +614,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_KHVR_staticSegmentRomStart; size = _vr_KHVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1301); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1301); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1302); @@ -624,7 +622,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_KHVR_pal_staticSegmentRomStart; size = _vr_KHVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1306); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1306); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1307); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1308); @@ -634,7 +632,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_K3VR_staticSegmentRomStart; size = _vr_K3VR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1331); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1331); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1332); @@ -642,7 +640,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_K3VR_pal_staticSegmentRomStart; size = _vr_K3VR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1336); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1336); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1337); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1338); @@ -652,7 +650,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_MLVR_staticSegmentRomStart; size = _vr_MLVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1345); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1345); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1346); @@ -660,7 +658,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_MLVR_pal_staticSegmentRomStart; size = _vr_MLVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1350); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1350); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1351); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1352); @@ -670,7 +668,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_KKRVR_staticSegmentRomStart; size = _vr_KKRVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1359); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1359); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1360); @@ -678,7 +676,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_KKRVR_pal_staticSegmentRomStart; size = _vr_KKRVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1364); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1364); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1365); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1366); @@ -688,7 +686,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_KSVR_staticSegmentRomStart; size = _vr_KSVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1373); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1373); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1374); @@ -696,7 +694,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_KSVR_pal_staticSegmentRomStart; size = _vr_KSVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1378); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1378); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1379); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1380); @@ -707,7 +705,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_GLVR_staticSegmentRomStart; size = _vr_GLVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1405); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1405); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1406); @@ -715,7 +713,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_GLVR_pal_staticSegmentRomStart; size = _vr_GLVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1410); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1410); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1411); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1412); @@ -726,7 +724,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_ZRVR_staticSegmentRomStart; size = _vr_ZRVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1420); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1420); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1421); @@ -734,7 +732,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_ZRVR_pal_staticSegmentRomStart; size = _vr_ZRVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1425); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1425); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1426); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1427); @@ -745,7 +743,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_DGVR_staticSegmentRomStart; size = _vr_DGVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1451); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1451); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1452); @@ -753,7 +751,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_DGVR_pal_staticSegmentRomStart; size = _vr_DGVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1456); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1456); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1457); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1458); @@ -764,7 +762,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_ALVR_staticSegmentRomStart; size = _vr_ALVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1466); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1466); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1467); @@ -772,7 +770,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_ALVR_pal_staticSegmentRomStart; size = _vr_ALVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1471); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1471); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1472); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1473); @@ -783,7 +781,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_NSVR_staticSegmentRomStart; size = _vr_NSVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1481); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1481); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1482); @@ -791,7 +789,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_NSVR_pal_staticSegmentRomStart; size = _vr_NSVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1486); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1486); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1487); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1488); @@ -802,7 +800,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_IPVR_staticSegmentRomStart; size = _vr_IPVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1512); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1512); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1513); @@ -810,7 +808,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_IPVR_pal_staticSegmentRomStart; size = _vr_IPVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1517); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1517); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1518); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1519); @@ -820,7 +818,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_LBVR_staticSegmentRomStart; size = _vr_LBVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1526); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1526); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1527); @@ -828,7 +826,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_LBVR_pal_staticSegmentRomStart; size = _vr_LBVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1531); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1531); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1532); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1533); @@ -838,7 +836,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_TTVR_staticSegmentRomStart; size = _vr_TTVR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1540); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1540); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1541); @@ -846,7 +844,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_TTVR_pal_staticSegmentRomStart; size = _vr_TTVR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1545); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1545); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1546); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1547); @@ -856,7 +854,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_K4VR_staticSegmentRomStart; size = _vr_K4VR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1560); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1560); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1561); @@ -864,7 +862,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_K4VR_pal_staticSegmentRomStart; size = _vr_K4VR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1565); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1565); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1566); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1567); @@ -874,7 +872,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_K5VR_staticSegmentRomStart; size = _vr_K5VR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1574); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1574); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1575); @@ -882,7 +880,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_K5VR_pal_staticSegmentRomStart; size = _vr_K5VR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1579); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1579); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1580); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1581); @@ -892,7 +890,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_KR3VR_staticSegmentRomStart; size = _vr_KR3VR_staticSegmentRomEnd - start; - skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1588); + skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1588); ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c", 1589); @@ -900,7 +898,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox start = _vr_KR3VR_pal_staticSegmentRomStart; size = _vr_KR3VR_pal_staticSegmentRomEnd - start; - skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1593); + skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1593); ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1594); DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1595); @@ -911,12 +909,12 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox } void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId) { - GlobalContext* globalCtx = (GlobalContext*)state; + PlayState* play = (PlayState*)state; skyboxCtx->unk_140 = 0; skyboxCtx->rot.x = skyboxCtx->rot.y = skyboxCtx->rot.z = 0.0f; - Skybox_Setup(globalCtx, skyboxCtx, skyboxId); + Skybox_Setup(play, skyboxCtx, skyboxId); osSyncPrintf("\n\n\n********************\n\n\n" "TYPE=%d" "\n\n\n********************\n\n\n", 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 e68372e680..d419aad490 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -3,13 +3,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx); -void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx); -void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx); +void ArmsHook_Init(Actor* thisx, PlayState* play); +void ArmsHook_Destroy(Actor* thisx, PlayState* play); +void ArmsHook_Update(Actor* thisx, PlayState* play); +void ArmsHook_Draw(Actor* thisx, PlayState* play); -void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx); -void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx); +void ArmsHook_Wait(ArmsHook* this, PlayState* play); +void ArmsHook_Shoot(ArmsHook* this, PlayState* play); const ActorInit Arms_Hook_InitVars = { ACTOR_ARMS_HOOK, @@ -62,33 +62,33 @@ void ArmsHook_SetupAction(ArmsHook* this, ArmsHookActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx) { +void ArmsHook_Init(Actor* thisx, PlayState* play) { ArmsHook* this = (ArmsHook*)thisx; - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->actor, &sQuadInit); ArmsHook_SetupAction(this, ArmsHook_Wait); this->unk_1E8 = this->actor.world.pos; } -void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ArmsHook_Destroy(Actor* thisx, PlayState* play) { ArmsHook* this = (ArmsHook*)thisx; if (this->grabbed != NULL) { this->grabbed->flags &= ~ACTOR_FLAG_13; } - Collider_DestroyQuad(globalCtx, &this->collider); + Collider_DestroyQuad(play, &this->collider); } -void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx) { +void ArmsHook_Wait(ArmsHook* this, PlayState* play) { if (this->actor.parent == NULL) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); // get correct timer length for hookshot or longshot s32 length = (player->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 13 : 26; ArmsHook_SetupAction(this, ArmsHook_Shoot); func_8002D9A4(&this->actor, 20.0f); - this->actor.parent = &GET_PLAYER(globalCtx)->actor; + this->actor.parent = &GET_PLAYER(play)->actor; this->timer = length; } } @@ -137,8 +137,8 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) { Math_Vec3f_Diff(&actor->world.pos, &this->actor.world.pos, &this->grabbedDistDiff); } -void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* touchedActor; Actor* grabbed; Vec3f bodyDistDiffVec; @@ -257,18 +257,18 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { sp60.x = this->unk_1F4.x - (this->unk_1E8.x - this->unk_1F4.x); sp60.y = this->unk_1F4.y - (this->unk_1E8.y - this->unk_1F4.y); sp60.z = this->unk_1F4.z - (this->unk_1E8.z - this->unk_1F4.z); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp60, &this->unk_1E8, &intersectPos, &poly, true, true, true, - true, &bgId) && - !func_8002F9EC(globalCtx, &this->actor, poly, bgId, &intersectPos)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &intersectPos, &poly, true, true, true, true, + &bgId) && + !func_8002F9EC(play, &this->actor, poly, bgId, &intersectPos)) { polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x); polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z); Math_Vec3f_Copy(&this->actor.world.pos, &intersectPos); this->actor.world.pos.x += 10.0f * polyNormalX; this->actor.world.pos.z += 10.0f * polyNormalZ; this->timer = 0; - if (SurfaceType_IsHookshotSurface(&globalCtx->colCtx, poly, bgId)) { + if (SurfaceType_IsHookshotSurface(&play->colCtx, poly, bgId)) { if (bgId != BGCHECK_SCENE) { - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if (dynaPolyActor != NULL) { ArmsHook_AttachHookToActor(this, &dynaPolyActor->actor); } @@ -277,28 +277,28 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_IT_HOOKSHOT_STICK_OBJ, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } else { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &this->actor.world.pos); + CollisionCheck_SpawnShieldParticlesMetal(play, &this->actor.world.pos); Audio_PlaySoundGeneral(NA_SE_IT_HOOKSHOT_REFLECT, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - } else if (CHECK_BTN_ANY(globalCtx->state.input[0].press.button, + } else if (CHECK_BTN_ANY(play->state.input[0].press.button, (BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN))) { this->timer = 0; } } } -void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) { +void ArmsHook_Update(Actor* thisx, PlayState* play) { ArmsHook* this = (ArmsHook*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk_1F4 = this->unk_1E8; } -void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ArmsHook_Draw(Actor* thisx, PlayState* play) { s32 pad; ArmsHook* this = (ArmsHook*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f sp78; Vec3f hookNewTip; Vec3f hookNewBase; @@ -306,7 +306,7 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 sp58; if ((player->actor.draw != NULL) && (player->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 850); + OPEN_DISPS(play->state.gfxCtx, "../z_arms_hook.c", 850); if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) { Matrix_MultVec3f(&D_80865B70, &this->unk_1E8); @@ -319,9 +319,9 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&D_80865BAC, &hookNewBase); } - func_80090480(globalCtx, &this->collider, &this->hookInfo, &hookNewTip, &hookNewBase); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 895), + func_80090480(play, &this->collider, &this->hookInfo, &hookNewTip, &hookNewBase); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arms_hook.c", 895), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotTipDL); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); @@ -331,10 +331,10 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(Math_FAtan2F(sp78.x, sp78.z), MTXMODE_APPLY); Matrix_RotateX(Math_FAtan2F(-sp78.y, sp5C), MTXMODE_APPLY); Matrix_Scale(0.015f, 0.015f, sqrtf(SQ(sp78.y) + sp58) * 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 910), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arms_hook.c", 910), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotChainDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 913); + CLOSE_DISPS(play->state.gfxCtx, "../z_arms_hook.c", 913); } } diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h index 822d87fecc..b624599a53 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h @@ -6,7 +6,7 @@ struct ArmsHook; -typedef void (*ArmsHookActionFunc)(struct ArmsHook*, GlobalContext*); +typedef void (*ArmsHookActionFunc)(struct ArmsHook*, PlayState*); typedef struct ArmsHook { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index b519b13cb1..651ce5ae52 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx); -void ArrowFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ArrowFire_Update(Actor* thisx, GlobalContext* globalCtx); -void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx); +void ArrowFire_Init(Actor* thisx, PlayState* play); +void ArrowFire_Destroy(Actor* thisx, PlayState* play); +void ArrowFire_Update(Actor* thisx, PlayState* play); +void ArrowFire_Draw(Actor* thisx, PlayState* play); -void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx); -void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx); -void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx); +void ArrowFire_Charge(ArrowFire* this, PlayState* play); +void ArrowFire_Fly(ArrowFire* this, PlayState* play); +void ArrowFire_Hit(ArrowFire* this, PlayState* play); #include "overlays/ovl_Arrow_Fire/ovl_Arrow_Fire.c" @@ -40,7 +40,7 @@ void ArrowFire_SetupAction(ArrowFire* this, ArrowFireActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) { +void ArrowFire_Init(Actor* thisx, PlayState* play) { ArrowFire* this = (ArrowFire*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -53,12 +53,12 @@ void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_15C = 0.0f; } -void ArrowFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { - func_800876C8(globalCtx); +void ArrowFire_Destroy(Actor* thisx, PlayState* play) { + func_800876C8(play); LOG_STRING("消滅", "../z_arrow_fire.c", 421); // "Disappearance" } -void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx) { +void ArrowFire_Charge(ArrowFire* this, PlayState* play) { EnArrow* arrow; arrow = (EnArrow*)this->actor.parent; @@ -91,7 +91,7 @@ void func_80865ECC(Vec3f* unkPos, Vec3f* firePos, f32 scale) { unkPos->z += ((firePos->z - unkPos->z) * scale); } -void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx) { +void ArrowFire_Hit(ArrowFire* this, PlayState* play) { f32 scale; f32 offset; u16 timer; @@ -143,7 +143,7 @@ void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx) { } } -void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) { +void ArrowFire_Fly(ArrowFire* this, PlayState* play) { EnArrow* arrow; f32 distanceScaled; s32 pad; @@ -177,25 +177,24 @@ void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) { } } -void ArrowFire_Update(Actor* thisx, GlobalContext* globalCtx) { +void ArrowFire_Update(Actor* thisx, PlayState* play) { ArrowFire* this = (ArrowFire*)thisx; - if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || - globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { + if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { Actor_Kill(&this->actor); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void ArrowFire_Draw(Actor* thisx, PlayState* play2) { ArrowFire* this = (ArrowFire*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; u32 stateFrames; EnArrow* arrow; Actor* transform; - stateFrames = globalCtx->state.frames; + stateFrames = play->state.frames; arrow = (EnArrow*)this->actor.parent; if (1) {} @@ -203,7 +202,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { if (1) {} transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 618); + OPEN_DISPS(play->state.gfxCtx, "../z_arrow_fire.c", 618); Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY); @@ -222,7 +221,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { } // Draw fire on the arrow - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); @@ -233,14 +232,14 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { } Matrix_Scale(this->radius * 0.2f, this->unk_158 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY); Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 666), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_fire.c", 666), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 255 - (stateFrames * 2) % 256, 0, 64, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 255 - (stateFrames * 2) % 256, 0, 64, 32, 1, 255 - stateFrames % 256, 511 - (stateFrames * 10) % 512, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, sModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 682); + CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_fire.c", 682); } } diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.h b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.h index f5b2d3f63a..44af3decf3 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.h +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.h @@ -6,7 +6,7 @@ struct ArrowFire; -typedef void (*ArrowFireActionFunc)(struct ArrowFire*, GlobalContext*); +typedef void (*ArrowFireActionFunc)(struct ArrowFire*, PlayState*); typedef struct ArrowFire { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index bc728b0e0f..81f6d8665c 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -10,14 +10,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx); -void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx); -void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx); +void ArrowIce_Init(Actor* thisx, PlayState* play); +void ArrowIce_Destroy(Actor* thisx, PlayState* play); +void ArrowIce_Update(Actor* thisx, PlayState* play); +void ArrowIce_Draw(Actor* thisx, PlayState* play); -void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx); -void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx); -void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx); +void ArrowIce_Charge(ArrowIce* this, PlayState* play); +void ArrowIce_Fly(ArrowIce* this, PlayState* play); +void ArrowIce_Hit(ArrowIce* this, PlayState* play); #include "overlays/ovl_Arrow_Ice/ovl_Arrow_Ice.c" @@ -41,7 +41,7 @@ void ArrowIce_SetupAction(ArrowIce* this, ArrowIceActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx) { +void ArrowIce_Init(Actor* thisx, PlayState* play) { ArrowIce* this = (ArrowIce*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -54,12 +54,12 @@ void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_164 = 0.0f; } -void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx) { - func_800876C8(globalCtx); +void ArrowIce_Destroy(Actor* thisx, PlayState* play) { + func_800876C8(play); LOG_STRING("消滅", "../z_arrow_ice.c", 415); // "Disappearance" } -void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx) { +void ArrowIce_Charge(ArrowIce* this, PlayState* play) { EnArrow* arrow; arrow = (EnArrow*)this->actor.parent; @@ -92,7 +92,7 @@ void func_80867E8C(Vec3f* unkPos, Vec3f* icePos, f32 scale) { unkPos->z += ((icePos->z - unkPos->z) * scale); } -void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) { +void ArrowIce_Hit(ArrowIce* this, PlayState* play) { f32 scale; f32 offset; u16 timer; @@ -144,7 +144,7 @@ void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) { } } -void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) { +void ArrowIce_Fly(ArrowIce* this, PlayState* play) { EnArrow* arrow; f32 distanceScaled; s32 pad; @@ -178,22 +178,21 @@ void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) { } } -void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx) { +void ArrowIce_Update(Actor* thisx, PlayState* play) { ArrowIce* this = (ArrowIce*)thisx; - if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || - globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { + if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { Actor_Kill(&this->actor); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ArrowIce_Draw(Actor* thisx, PlayState* play) { ArrowIce* this = (ArrowIce*)thisx; s32 pad; Actor* transform; - u32 stateFrames = globalCtx->state.frames; + u32 stateFrames = play->state.frames; EnArrow* arrow = (EnArrow*)this->actor.parent; if (1) {} @@ -202,7 +201,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { if (1) {} transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 610); + OPEN_DISPS(play->state.gfxCtx, "../z_arrow_ice.c", 610); Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY); @@ -221,7 +220,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { } // Draw ice on the arrow - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 128); Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); @@ -232,14 +231,14 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(this->radius * 0.2f, this->unk_160 * 3.0f, this->radius * 0.2f, MTXMODE_APPLY); Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 660), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_ice.c", 660), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1, 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 10) % 512, 4, 16)); gSPDisplayList(POLY_XLU_DISP++, sModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 676); + CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_ice.c", 676); } } diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h index b326f7c43e..1a6ed24b36 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h @@ -6,7 +6,7 @@ struct ArrowIce; -typedef void (*ArrowIceActionFunc)(struct ArrowIce*, GlobalContext*); +typedef void (*ArrowIceActionFunc)(struct ArrowIce*, PlayState*); typedef struct ArrowIce { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index f8a743e893..b31dc0e21f 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -10,14 +10,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx); -void ArrowLight_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ArrowLight_Update(Actor* thisx, GlobalContext* globalCtx); -void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx); +void ArrowLight_Init(Actor* thisx, PlayState* play); +void ArrowLight_Destroy(Actor* thisx, PlayState* play); +void ArrowLight_Update(Actor* thisx, PlayState* play); +void ArrowLight_Draw(Actor* thisx, PlayState* play); -void ArrowLight_Charge(ArrowLight* this, GlobalContext* globalCtx); -void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx); -void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx); +void ArrowLight_Charge(ArrowLight* this, PlayState* play); +void ArrowLight_Fly(ArrowLight* this, PlayState* play); +void ArrowLight_Hit(ArrowLight* this, PlayState* play); #include "overlays/ovl_Arrow_Light/ovl_Arrow_Light.c" @@ -41,7 +41,7 @@ void ArrowLight_SetupAction(ArrowLight* this, ArrowLightActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx) { +void ArrowLight_Init(Actor* thisx, PlayState* play) { ArrowLight* this = (ArrowLight*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -54,12 +54,12 @@ void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_164 = 0.0f; } -void ArrowLight_Destroy(Actor* thisx, GlobalContext* globalCtx) { - func_800876C8(globalCtx); +void ArrowLight_Destroy(Actor* thisx, PlayState* play) { + func_800876C8(play); LOG_STRING("消滅", "../z_arrow_light.c", 403); // "Disappearance" } -void ArrowLight_Charge(ArrowLight* this, GlobalContext* globalCtx) { +void ArrowLight_Charge(ArrowLight* this, PlayState* play) { EnArrow* arrow = (EnArrow*)this->actor.parent; if ((arrow == NULL) || (arrow->actor.update == NULL)) { @@ -91,7 +91,7 @@ void func_80869E6C(Vec3f* unkPos, Vec3f* lightPos, f32 scale) { unkPos->z += ((lightPos->z - unkPos->z) * scale); } -void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx) { +void ArrowLight_Hit(ArrowLight* this, PlayState* play) { f32 scale; f32 offset; u16 timer; @@ -143,7 +143,7 @@ void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx) { } } -void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) { +void ArrowLight_Fly(ArrowLight* this, PlayState* play) { EnArrow* arrow = (EnArrow*)this->actor.parent; f32 distanceScaled; s32 pad; @@ -176,21 +176,20 @@ void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) { } } -void ArrowLight_Update(Actor* thisx, GlobalContext* globalCtx) { +void ArrowLight_Update(Actor* thisx, PlayState* play) { ArrowLight* this = (ArrowLight*)thisx; - if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || - globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { + if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { Actor_Kill(&this->actor); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ArrowLight_Draw(Actor* thisx, PlayState* play) { ArrowLight* this = (ArrowLight*)thisx; s32 pad; - u32 stateFrames = globalCtx->state.frames; + u32 stateFrames = play->state.frames; EnArrow* arrow = (EnArrow*)this->actor.parent; Actor* transform; @@ -200,7 +199,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { if (1) {} transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_light.c", 598); + OPEN_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 598); Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY); @@ -219,7 +218,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { } // Draw light on the arrow - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128); Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); @@ -230,14 +229,14 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(this->radius * 0.2f, this->unk_160 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY); Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_light.c", 648), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_light.c", 648), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1, 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 30) % 512, 8, 16)); gSPDisplayList(POLY_XLU_DISP++, sModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arrow_light.c", 664); + CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 664); } } diff --git a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.h b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.h index 79db3621a6..78bef515e5 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.h +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.h @@ -6,7 +6,7 @@ struct ArrowLight; -typedef void (*ArrowLightActionFunc)(struct ArrowLight*, GlobalContext*); +typedef void (*ArrowLightActionFunc)(struct ArrowLight*, PlayState*); typedef struct ArrowLight { /* 0x0000 */ Actor actor; 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 833adda9aa..95a94a0210 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 @@ -9,27 +9,27 @@ #define FLAGS ACTOR_FLAG_4 -void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBdanObjects_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBdanObjects_Update(Actor* thisx, GlobalContext* globalCtx); -void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgBdanObjects_Init(Actor* thisx, PlayState* play); +void BgBdanObjects_Destroy(Actor* thisx, PlayState* play); +void BgBdanObjects_Update(Actor* thisx, PlayState* play); +void BgBdanObjects_Draw(Actor* thisx, PlayState* play); -void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C55C(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx); -void BgBdanObjects_DoNothing(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx); -void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx); +void func_8086C054(BgBdanObjects* this, PlayState* play); +void func_8086C1A0(BgBdanObjects* this, PlayState* play); +void func_8086C29C(BgBdanObjects* this, PlayState* play); +void func_8086C55C(BgBdanObjects* this, PlayState* play); +void func_8086C5BC(BgBdanObjects* this, PlayState* play); +void func_8086C618(BgBdanObjects* this, PlayState* play); +void func_8086C6EC(BgBdanObjects* this, PlayState* play); +void func_8086C76C(BgBdanObjects* this, PlayState* play); +void func_8086C7D0(BgBdanObjects* this, PlayState* play); +void BgBdanObjects_DoNothing(BgBdanObjects* this, PlayState* play); +void func_8086C874(BgBdanObjects* this, PlayState* play); +void func_8086C9A8(BgBdanObjects* this, PlayState* play); +void func_8086C9F0(BgBdanObjects* this, PlayState* play); +void func_8086CABC(BgBdanObjects* this, PlayState* play); +void func_8086CB10(BgBdanObjects* this, PlayState* play); +void func_8086CB8C(BgBdanObjects* this, PlayState* play); const ActorInit Bg_Bdan_Objects_InitVars = { ACTOR_BG_BDAN_OBJECTS, @@ -104,7 +104,7 @@ void BgBdanObjects_SetContactRu1(BgBdanObjects* this, s32 arg1) { } } -void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanObjects_Init(Actor* thisx, PlayState* play) { s32 pad; BgBdanObjects* this = (BgBdanObjects*)thisx; CollisionHeader* colHeader = NULL; @@ -115,30 +115,30 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params &= 0xFF; if (thisx->params == 2) { thisx->flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5; - globalCtx->colCtx.colHeader->waterBoxes[7].ySurface = thisx->world.pos.y; + play->colCtx.colHeader->waterBoxes[7].ySurface = thisx->world.pos.y; this->actionFunc = func_8086C9A8; return; } if (thisx->params == 0) { CollisionHeader_GetVirtual(&gJabuBigOctoPlatformCol, &colHeader); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); thisx->world.pos.y += -79.0f; - if (Flags_GetClear(globalCtx, thisx->room)) { - Flags_SetSwitch(globalCtx, this->switchFlag); + if (Flags_GetClear(play, thisx->room)) { + Flags_SetSwitch(play, this->switchFlag); this->actionFunc = func_8086C6EC; } else { if (BgBdanObjects_GetContactRu1(this, 4)) { - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_BIGOKUTA, - thisx->home.pos.x, thisx->home.pos.y, thisx->home.pos.z, 0, - thisx->shape.rot.y + 0x8000, 0, 3) != NULL) { + if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_BIGOKUTA, thisx->home.pos.x, + thisx->home.pos.y, thisx->home.pos.z, 0, thisx->shape.rot.y + 0x8000, 0, + 3) != NULL) { thisx->child->world.pos.z = thisx->child->home.pos.z + 263.0f; } thisx->world.rot.y = 0; this->actionFunc = func_8086C618; thisx->world.pos.y = thisx->home.pos.y + -70.0f; } else { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); this->timer = 0; this->actionFunc = func_8086C054; } @@ -151,7 +151,7 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_8086C874; } else { CollisionHeader_GetVirtual(&gJabuLoweringPlatformCol, &colHeader); - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgBdanObjects_DoNothing; thisx->world.pos.y = thisx->home.pos.y - 400.0f; } else { @@ -159,26 +159,26 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { } } } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } -void BgBdanObjects_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanObjects_Destroy(Actor* thisx, PlayState* play) { BgBdanObjects* this = (BgBdanObjects*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if (thisx->params == 0) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8086C054(BgBdanObjects* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (BgBdanObjects_GetContactRu1(this, 0)) { if (this->dyna.actor.xzDistToPlayer < 250.0f) { BgBdanObjects_SetContactRu1(this, 1); this->timer = 20; - OnePointCutscene_Init(globalCtx, 3070, -99, &this->dyna.actor, CAM_ID_MAIN); + 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; @@ -193,14 +193,14 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) { } } - if (!Play_InCsMode(globalCtx) && !BgBdanObjects_GetContactRu1(this, 0)) { + if (!Play_InCsMode(play) && !BgBdanObjects_GetContactRu1(this, 0)) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + -79.0f; } else { this->dyna.actor.world.pos.y = (this->dyna.actor.home.pos.y + -79.0f) - 5.0f; } } -void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C1A0(BgBdanObjects* this, PlayState* play) { if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 500.0f, 0.5f, 7.5f, 1.0f) < 0.1f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A); @@ -220,13 +220,13 @@ void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C29C(BgBdanObjects* this, PlayState* play) { s32 temp; if (this->timer != 0) { this->timer--; if (this->timer == 0) { - temp = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); + temp = Quake_Add(GET_ACTIVE_CAM(play), 1); Quake_SetSpeed(temp, 0x3A98); Quake_SetQuakeValues(temp, 0, 1, 0xFA, 1); Quake_SetCountdown(temp, 0xA); @@ -234,18 +234,18 @@ void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) { } if (BgBdanObjects_GetContactRu1(this, 3)) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_BIGOKUTA, - this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 140.0f, - this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_BIGOKUTA, this->dyna.actor.world.pos.x, + 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_SetContactRu1(this, 4); this->timer = 10; this->actionFunc = func_8086C55C; - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); } } -void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8086C3D8(BgBdanObjects* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->dyna.actor.velocity.y += 0.5f; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -70.0f, @@ -255,7 +255,7 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&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 = func_8086C5BC; - OnePointCutscene_Init(globalCtx, 3080, -99, this->dyna.actor.child, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3080, -99, this->dyna.actor.child, CAM_ID_MAIN); player->actor.world.pos.x = -1130.0f; player->actor.world.pos.y = -1025.0f; player->actor.world.pos.z = -3500.0f; @@ -277,18 +277,18 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C55C(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C55C(BgBdanObjects* this, PlayState* play) { this->timer--; if (this->timer == 0) { - Flags_UnsetSwitch(globalCtx, this->switchFlag); + Flags_UnsetSwitch(play, this->switchFlag); } else if (this->timer == -40) { this->timer = 0; this->actionFunc = func_8086C3D8; } } -void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C5BC(BgBdanObjects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -301,11 +301,11 @@ void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C618(BgBdanObjects* this, PlayState* play) { Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - if (Flags_GetClear(globalCtx, this->dyna.actor.room)) { - Flags_SetSwitch(globalCtx, this->switchFlag); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + if (Flags_GetClear(play, this->dyna.actor.room)) { + Flags_SetSwitch(play, this->switchFlag); this->dyna.actor.home.rot.y = (s16)(this->dyna.actor.shape.rot.y + 0x2000) & 0xC000; this->actionFunc = func_8086C6EC; } else { @@ -314,7 +314,7 @@ void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C6EC(BgBdanObjects* this, PlayState* play) { s32 cond = Math_ScaledStepToS(&this->dyna.actor.shape.rot.y, this->dyna.actor.home.rot.y, 0x200); if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -125.0f, 3.0f)) { @@ -324,16 +324,16 @@ void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C76C(BgBdanObjects* this, PlayState* play) { if (func_8004356C(&this->dyna)) { if (this->dyna.actor.xzDistToPlayer < 120.0f) { this->actionFunc = func_8086C7D0; - OnePointCutscene_Init(globalCtx, 3090, -99, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3090, -99, &this->dyna.actor, CAM_ID_MAIN); } } } -void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C7D0(BgBdanObjects* this, PlayState* play) { if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 965.0f, 0.5f, 15.0f, 0.2f) < 0.01f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A); @@ -343,22 +343,22 @@ void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void BgBdanObjects_DoNothing(BgBdanObjects* this, GlobalContext* globalCtx) { +void BgBdanObjects_DoNothing(BgBdanObjects* this, PlayState* play) { } -void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C874(BgBdanObjects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->switchFlag == 0) { if (func_8004356C(&this->dyna)) { - this->cameraSetting = globalCtx->cameraPtrs[CAM_ID_MAIN]->setting; - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2); - func_8005AD1C(globalCtx->cameraPtrs[CAM_ID_MAIN], 4); + this->cameraSetting = play->cameraPtrs[CAM_ID_MAIN]->setting; + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2); + func_8005AD1C(play->cameraPtrs[CAM_ID_MAIN], 4); this->switchFlag = 10; } } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2); if (!func_8004356C(&this->dyna)) { if (this->switchFlag != 0) { this->switchFlag--; @@ -366,8 +366,8 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) { } if (this->switchFlag == 0) { if (1) {} - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], this->cameraSetting); - func_8005ACFC(globalCtx->cameraPtrs[CAM_ID_MAIN], 4); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], this->cameraSetting); + func_8005ACFC(play->cameraPtrs[CAM_ID_MAIN], 4); } } this->dyna.actor.world.pos.y = @@ -377,17 +377,17 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +void func_8086C9A8(BgBdanObjects* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->timer = 100; this->actionFunc = func_8086C9F0; } } -void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086C9F0(BgBdanObjects* this, PlayState* play) { if (this->timer == 0) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 0.5f)) { - Flags_UnsetSwitch(globalCtx, this->switchFlag); + Flags_UnsetSwitch(play, this->switchFlag); this->actionFunc = func_8086C9A8; } func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); @@ -397,10 +397,10 @@ void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx) { } func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); } - globalCtx->colCtx.colHeader->waterBoxes[7].ySurface = this->dyna.actor.world.pos.y; + play->colCtx.colHeader->waterBoxes[7].ySurface = this->dyna.actor.world.pos.y; } -void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086CABC(BgBdanObjects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -410,17 +410,17 @@ void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx) { } } -void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086CB10(BgBdanObjects* this, PlayState* play) { if (func_8004356C(&this->dyna)) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); this->timer = 50; this->actionFunc = func_8086CB8C; this->dyna.actor.home.pos.y -= 200.0f; - OnePointCutscene_Init(globalCtx, 3100, 51, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3100, 51, &this->dyna.actor, CAM_ID_MAIN); } } -void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) { +void func_8086CB8C(BgBdanObjects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -431,20 +431,20 @@ void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); this->actionFunc = BgBdanObjects_DoNothing; // Using `CAM_ID_NONE` here defaults to the active camera - Play_CopyCamera(globalCtx, CAM_ID_MAIN, CAM_ID_NONE); + Play_CopyCamera(play, CAM_ID_MAIN, CAM_ID_NONE); } else { func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_FALL - SFX_FLAG); } } -void BgBdanObjects_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanObjects_Update(Actor* thisx, PlayState* play) { BgBdanObjects* this = (BgBdanObjects*)thisx; Actor_SetFocus(thisx, 50.0f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanObjects_Draw(Actor* thisx, PlayState* play) { BgBdanObjects* this = (BgBdanObjects*)thisx; if (thisx->params == 0) { @@ -456,8 +456,8 @@ void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (thisx->params == 2) { - Gfx_DrawDListXlu(globalCtx, gJabuWaterDL); + Gfx_DrawDListXlu(play, gJabuWaterDL); } else { - Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]); + Gfx_DrawDListOpa(play, sDLists[thisx->params]); } } 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 e21fe6c964..358c6bcaed 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h @@ -6,7 +6,7 @@ struct BgBdanObjects; -typedef void (*BgBdanObjectsActionFunc)(struct BgBdanObjects*, GlobalContext*); +typedef void (*BgBdanObjectsActionFunc)(struct BgBdanObjects*, PlayState*); typedef struct BgBdanObjects { /* 0x0000 */ DynaPolyActor dyna; 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 1de9c7dca1..522e737e64 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 @@ -9,38 +9,38 @@ #define FLAGS ACTOR_FLAG_4 -void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBdanSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx); -void BgBdanSwitch_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgBdanSwitch_Init(Actor* thisx, PlayState* play); +void BgBdanSwitch_Destroy(Actor* thisx, PlayState* play); +void BgBdanSwitch_Update(Actor* thisx, PlayState* play); +void BgBdanSwitch_Draw(Actor* thisx, PlayState* play); void func_8086D5C4(BgBdanSwitch* this); -void func_8086D5E0(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D5E0(BgBdanSwitch* this, PlayState* play); void func_8086D67C(BgBdanSwitch* this); -void func_8086D694(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D694(BgBdanSwitch* this, PlayState* play); void func_8086D730(BgBdanSwitch* this); -void func_8086D754(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D754(BgBdanSwitch* this, PlayState* play); void func_8086D7FC(BgBdanSwitch* this); -void func_8086D80C(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D80C(BgBdanSwitch* this, PlayState* play); void func_8086D86C(BgBdanSwitch* this); -void func_8086D888(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D888(BgBdanSwitch* this, PlayState* play); void func_8086D8BC(BgBdanSwitch* this); -void func_8086D8CC(BgBdanSwitch* this, GlobalContext* globalCtx); -void func_8086D95C(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086D8CC(BgBdanSwitch* this, PlayState* play); +void func_8086D95C(BgBdanSwitch* this, PlayState* play); void func_8086D9F8(BgBdanSwitch* this); -void func_8086DA1C(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DA1C(BgBdanSwitch* this, PlayState* play); void func_8086DAB4(BgBdanSwitch* this); -void func_8086DAC4(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DAC4(BgBdanSwitch* this, PlayState* play); void func_8086DB24(BgBdanSwitch* this); -void func_8086DB40(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DB40(BgBdanSwitch* this, PlayState* play); void func_8086DB4C(BgBdanSwitch* this); -void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DB68(BgBdanSwitch* this, PlayState* play); void func_8086DC30(BgBdanSwitch* this); -void func_8086DC48(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DC48(BgBdanSwitch* this, PlayState* play); void func_8086DCCC(BgBdanSwitch* this); -void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DCE8(BgBdanSwitch* this, PlayState* play); void func_8086DDA8(BgBdanSwitch* this); -void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx); +void func_8086DDC0(BgBdanSwitch* this, PlayState* play); const ActorInit Bg_Bdan_Switch_InitVars = { ACTOR_BG_BDAN_SWITCH, @@ -89,24 +89,24 @@ static InitChainEntry sInitChain[] = { static Vec3f D_8086E0E0 = { 0.0f, 140.0f, 0.0f }; -void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flag) { +void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHeader* collision, s32 flag) { s16 pad1; CollisionHeader* colHeader = NULL; s16 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_bdan_switch.c", 325, this->dyna.actor.id, this->dyna.actor.params); } } -void BgBdanSwitch_InitCollision(BgBdanSwitch* this, GlobalContext* globalCtx) { +void BgBdanSwitch_InitCollision(BgBdanSwitch* this, PlayState* play) { Actor* actor = &this->dyna.actor; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, actor, &sJntSphInit, this->colliderItems); } void func_8086D0EC(BgBdanSwitch* this) { @@ -133,7 +133,7 @@ void func_8086D0EC(BgBdanSwitch* this) { this->dyna.actor.shape.yOffset = 1.2f / this->unk_1D0; } -void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanSwitch_Init(Actor* thisx, PlayState* play) { BgBdanSwitch* this = (BgBdanSwitch*)thisx; s32 pad; s16 type; @@ -155,17 +155,17 @@ void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { case BLUE: case YELLOW_HEAVY: case YELLOW: - BgBdanSwitch_InitDynaPoly(this, globalCtx, &gJabuFloorSwitchCol, DPM_PLAYER); + BgBdanSwitch_InitDynaPoly(this, play, &gJabuFloorSwitchCol, DPM_PLAYER); break; case YELLOW_TALL_1: case YELLOW_TALL_2: - BgBdanSwitch_InitCollision(this, globalCtx); + BgBdanSwitch_InitCollision(this, play); this->dyna.actor.flags |= ACTOR_FLAG_0; this->dyna.actor.targetMode = 4; break; } - flag = Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + flag = Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); switch (type) { case BLUE: @@ -200,42 +200,42 @@ void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(巨大魚ダンジョン 専用スイッチ)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgBdanSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanSwitch_Destroy(Actor* thisx, PlayState* play) { BgBdanSwitch* this = (BgBdanSwitch*)thisx; switch (this->dyna.actor.params & 0xFF) { case BLUE: case YELLOW_HEAVY: case YELLOW: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); break; case YELLOW_TALL_1: case YELLOW_TALL_2: - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); break; } } -void func_8086D4B4(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D4B4(BgBdanSwitch* this, PlayState* play) { s32 pad; s32 type; - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { type = this->dyna.actor.params & 0xFF; - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); if (type == BLUE || type == YELLOW_TALL_2) { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); } else { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_CORRECT_CHIME); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_CORRECT_CHIME); } } } -void func_8086D548(BgBdanSwitch* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { - Flags_UnsetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); +void func_8086D548(BgBdanSwitch* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); if ((this->dyna.actor.params & 0xFF) == YELLOW_TALL_2) { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); } } } @@ -245,18 +245,18 @@ void func_8086D5C4(BgBdanSwitch* this) { this->unk_1C8 = 1.0f; } -void func_8086D5E0(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D5E0(BgBdanSwitch* this, PlayState* play) { switch (this->dyna.actor.params & 0xFF) { case BLUE: if (func_800435B4(&this->dyna)) { func_8086D67C(this); - func_8086D4B4(this, globalCtx); + func_8086D4B4(this, play); } break; case YELLOW: if (func_8004356C(&this->dyna)) { func_8086D67C(this); - func_8086D4B4(this, globalCtx); + func_8086D4B4(this, play); } break; } @@ -267,7 +267,7 @@ void func_8086D67C(BgBdanSwitch* this) { this->unk_1DA = 0x64; } -void func_8086D694(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D694(BgBdanSwitch* this, PlayState* play) { if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.2f; if (this->unk_1C8 <= 0.1f) { @@ -284,20 +284,20 @@ void func_8086D730(BgBdanSwitch* this) { this->unk_1D8 = 6; } -void func_8086D754(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D754(BgBdanSwitch* this, PlayState* play) { switch (this->dyna.actor.params & 0xFF) { case BLUE: if (!func_800435B4(&this->dyna)) { if (this->unk_1D8 <= 0) { func_8086D7FC(this); - func_8086D548(this, globalCtx); + func_8086D548(this, play); } } else { this->unk_1D8 = 6; } break; case YELLOW: - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { func_8086D7FC(this); } break; @@ -308,7 +308,7 @@ void func_8086D7FC(BgBdanSwitch* this) { this->actionFunc = func_8086D80C; } -void func_8086D80C(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D80C(BgBdanSwitch* this, PlayState* play) { this->unk_1C8 += 0.2f; if (this->unk_1C8 >= 1.0f) { func_8086D5C4(this); @@ -321,7 +321,7 @@ void func_8086D86C(BgBdanSwitch* this) { this->unk_1C8 = 1.0f; } -void func_8086D888(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D888(BgBdanSwitch* this, PlayState* play) { if (func_8004356C(&this->dyna)) { func_8086D8BC(this); } @@ -331,7 +331,7 @@ void func_8086D8BC(BgBdanSwitch* this) { this->actionFunc = func_8086D8CC; } -void func_8086D8CC(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D8CC(BgBdanSwitch* this, PlayState* play) { this->unk_1C8 -= 0.2f; if (this->unk_1C8 <= 0.6f) { func_8086D9F8(this); @@ -345,7 +345,7 @@ void func_8086D944(BgBdanSwitch* this) { this->unk_1DA = 0x64; } -void func_8086D95C(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086D95C(BgBdanSwitch* this, PlayState* play) { if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.2f; if (this->unk_1C8 <= 0.1f) { @@ -362,14 +362,14 @@ void func_8086D9F8(BgBdanSwitch* this) { this->unk_1D8 = 6; } -void func_8086DA1C(BgBdanSwitch* this, GlobalContext* globalCtx) { - Actor* heldActor = GET_PLAYER(globalCtx)->heldActor; +void func_8086DA1C(BgBdanSwitch* this, PlayState* play) { + Actor* heldActor = GET_PLAYER(play)->heldActor; if (func_8004356C(&this->dyna)) { if (heldActor != NULL && heldActor->id == ACTOR_EN_RU1) { if (this->unk_1D8 <= 0) { func_8086D944(this); - func_8086D4B4(this, globalCtx); + func_8086D4B4(this, play); } } else { this->unk_1D8 = 6; @@ -385,7 +385,7 @@ void func_8086DAB4(BgBdanSwitch* this) { this->actionFunc = func_8086DAC4; } -void func_8086DAC4(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DAC4(BgBdanSwitch* this, PlayState* play) { this->unk_1C8 += 0.2f; if (this->unk_1C8 >= 1.0f) { func_8086D86C(this); @@ -398,7 +398,7 @@ void func_8086DB24(BgBdanSwitch* this) { this->actionFunc = func_8086DB40; } -void func_8086DB40(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DB40(BgBdanSwitch* this, PlayState* play) { } void func_8086DB4C(BgBdanSwitch* this) { @@ -406,7 +406,7 @@ void func_8086DB4C(BgBdanSwitch* this) { this->unk_1C8 = 2.0f; } -void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DB68(BgBdanSwitch* this, PlayState* play) { switch (this->dyna.actor.params & 0xFF) { default: return; @@ -414,14 +414,14 @@ void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx) { if (((this->collider.base.acFlags & AC_HIT) != 0) && this->unk_1D8 <= 0) { this->unk_1D8 = 0xA; func_8086DC30(this); - func_8086D4B4(this, globalCtx); + func_8086D4B4(this, play); } break; case YELLOW_TALL_2: if (((this->collider.base.acFlags & AC_HIT) != 0) && ((this->unk_1DC & 2) == 0) && this->unk_1D8 <= 0) { this->unk_1D8 = 0xA; func_8086DC30(this); - func_8086D4B4(this, globalCtx); + func_8086D4B4(this, play); } break; } @@ -432,7 +432,7 @@ void func_8086DC30(BgBdanSwitch* this) { this->unk_1DA = 0x64; } -void func_8086DC48(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DC48(BgBdanSwitch* this, PlayState* play) { if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.3f; if (this->unk_1C8 <= 1.0f) { @@ -447,10 +447,10 @@ void func_8086DCCC(BgBdanSwitch* this) { this->unk_1C8 = 1.0f; } -void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DCE8(BgBdanSwitch* this, PlayState* play) { switch (this->dyna.actor.params & 0xFF) { case YELLOW_TALL_1: - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { func_8086DDA8(this); } break; @@ -458,7 +458,7 @@ void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx) { if (((this->collider.base.acFlags & AC_HIT) != 0) && ((this->unk_1DC & 2) == 0) && (this->unk_1D8 <= 0)) { this->unk_1D8 = 0xA; func_8086DDA8(this); - func_8086D548(this, globalCtx); + func_8086D548(this, play); } break; } @@ -469,7 +469,7 @@ void func_8086DDA8(BgBdanSwitch* this) { this->unk_1DA = 0x64; } -void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx) { +void func_8086DDC0(BgBdanSwitch* this, PlayState* play) { if ((((this->dyna.actor.params & 0xFF) != YELLOW_TALL_2) || (func_8005B198() == this->dyna.actor.category)) || (this->unk_1DA <= 0)) { this->unk_1C8 += 0.3f; @@ -480,7 +480,7 @@ void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx) { } } -void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanSwitch_Update(Actor* thisx, PlayState* play) { s32 pad; BgBdanSwitch* this = (BgBdanSwitch*)thisx; s32 type; @@ -488,47 +488,47 @@ void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_1DA > 0) { this->unk_1DA--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_8086D0EC(this); type = this->dyna.actor.params & 0xFF; if (type != 3 && type != 4) { this->unk_1D8--; } else { - if (!Player_InCsMode(globalCtx) && this->unk_1D8 > 0) { + if (!Player_InCsMode(play) && this->unk_1D8 > 0) { this->unk_1D8--; } this->unk_1DC = this->collider.base.acFlags; this->collider.base.acFlags &= ~AC_HIT; this->collider.elements[0].dim.modelSphere.radius = this->unk_1D4 * 370.0f; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void func_8086DF58(BgBdanSwitch* this, GlobalContext* globalCtx, Gfx* dlist) { +void func_8086DF58(BgBdanSwitch* this, PlayState* play, Gfx* dlist) { Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + (this->dyna.actor.shape.yOffset * this->unk_1D0), this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); Matrix_Scale(this->unk_1D4, this->unk_1D0, this->unk_1D4, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, dlist); + Gfx_DrawDListOpa(play, dlist); } -void BgBdanSwitch_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgBdanSwitch_Draw(Actor* thisx, PlayState* play) { BgBdanSwitch* this = (BgBdanSwitch*)thisx; switch (this->dyna.actor.params & 0xFF) { case YELLOW_HEAVY: case YELLOW: - func_8086DF58(this, globalCtx, gJabuYellowFloorSwitchDL); + func_8086DF58(this, play, gJabuYellowFloorSwitchDL); break; case YELLOW_TALL_1: case YELLOW_TALL_2: - func_8086DF58(this, globalCtx, gJabuYellowFloorSwitchDL); + func_8086DF58(this, play, gJabuYellowFloorSwitchDL); Collider_UpdateSpheres(0, &this->collider); Matrix_MultVec3f(&D_8086E0E0, &this->dyna.actor.focus.pos); break; case BLUE: - func_8086DF58(this, globalCtx, gJabuBlueFloorSwitchDL); + func_8086DF58(this, play, gJabuBlueFloorSwitchDL); break; } } diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h index 629643c7e0..cc0d7ccebc 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h @@ -15,7 +15,7 @@ typedef enum { struct BgBdanSwitch; -typedef void (*BgBdanSwitchActionFunc)(struct BgBdanSwitch*, GlobalContext*); +typedef void (*BgBdanSwitchActionFunc)(struct BgBdanSwitch*, PlayState*); typedef struct BgBdanSwitch { /* 0x0000 */ DynaPolyActor dyna; 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 1f85ac95ed..5af6850e5f 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 @@ -11,11 +11,11 @@ #define FLAGS ACTOR_FLAG_4 -void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBomGuard_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBomGuard_Update(Actor* thisx, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); +void func_8086E638(BgBomGuard* this, PlayState* play); const ActorInit Bg_Bom_Guard_InitVars = { ACTOR_BG_BOM_GUARD, @@ -33,14 +33,14 @@ void BgBomGuard_SetupAction(BgBomGuard* this, BgBomGuardActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBomGuard_Init(Actor* thisx, PlayState* play) { BgBomGuard* this = (BgBomGuard*)thisx; s32 pad[2]; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gBowlingDefaultCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 透明ガード出現 ☆☆☆☆☆ \n" VT_RST); @@ -52,22 +52,22 @@ void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx) { BgBomGuard_SetupAction(this, func_8086E638); } -void BgBomGuard_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBomGuard_Destroy(Actor* thisx, PlayState* play) { BgBomGuard* this = (BgBomGuard*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx) { - Actor* it = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; +void func_8086E638(BgBomGuard* this, PlayState* play) { + Actor* it = play->actorCtx.actorLists[ACTORCAT_NPC].head; Actor* thisx = &this->dyna.actor; this->unk_168 = 0; while (it != 0) { if (it->id == ACTOR_EN_BOM_BOWL_MAN) { - if ((((EnBomBowlMan*)it)->minigamePlayStatus != 0) && (fabsf(globalCtx->view.eye.x) > -20.0f) && - (fabsf(globalCtx->view.eye.y) > 110.0f)) { + if ((((EnBomBowlMan*)it)->minigamePlayStatus != 0) && (fabsf(play->view.eye.x) > -20.0f) && + (fabsf(play->view.eye.y) > 110.0f)) { this->unk_168 = 1; } break; @@ -82,8 +82,8 @@ void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx) { } } -void BgBomGuard_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBomGuard_Update(Actor* thisx, PlayState* play) { BgBomGuard* this = (BgBomGuard*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } 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 41a395a383..9df9ab2670 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 @@ -6,7 +6,7 @@ struct BgBomGuard; -typedef void (*BgBomGuardActionFunc)(struct BgBomGuard*, GlobalContext*); +typedef void (*BgBomGuardActionFunc)(struct BgBomGuard*, PlayState*); typedef struct BgBomGuard { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c index bb242f2429..a14c079143 100644 --- a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c @@ -9,16 +9,16 @@ #define FLAGS ACTOR_FLAG_22 -void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBombwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgBombwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgBombwall_Init(Actor* thisx, PlayState* play); +void BgBombwall_Destroy(Actor* thisx, PlayState* play); +void BgBombwall_Update(Actor* thisx, PlayState* play); +void BgBombwall_Draw(Actor* thisx, PlayState* play); -void func_8086ED50(BgBombwall* this, GlobalContext* globalCtx); -void func_8086ED70(BgBombwall* this, GlobalContext* globalCtx); -void func_8086EDFC(BgBombwall* this, GlobalContext* globalCtx); -void func_8086EE40(BgBombwall* this, GlobalContext* globalCtx); -void func_8086EE94(BgBombwall* this, GlobalContext* globalCtx); +void func_8086ED50(BgBombwall* this, PlayState* play); +void func_8086ED70(BgBombwall* this, PlayState* play); +void func_8086EDFC(BgBombwall* this, PlayState* play); +void func_8086EE40(BgBombwall* this, PlayState* play); +void func_8086EE94(BgBombwall* this, PlayState* play); static ColliderTrisElementInit sTrisElementsInit[3] = { { @@ -81,14 +81,14 @@ const ActorInit Bg_Bombwall_InitVars = { (ActorFunc)BgBombwall_Draw, }; -void BgBombwall_InitDynapoly(BgBombwall* this, GlobalContext* globalCtx) { +void BgBombwall_InitDynapoly(BgBombwall* this, PlayState* play) { s32 pad; s32 pad2; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gBgBombwallCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG login failed" @@ -109,7 +109,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBombwall_Init(Actor* thisx, PlayState* play) { s32 i; s32 j; Vec3f vecs[3]; @@ -122,13 +122,13 @@ void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_SetScale(&this->dyna.actor, 0.1f); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { - func_8086EE94(this, globalCtx); + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + func_8086EE94(this, play); } else { - BgBombwall_InitDynapoly(this, globalCtx); + BgBombwall_InitDynapoly(this, play); this->unk_2A2 |= 2; - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems); + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems); for (i = 0; i <= 2; i++) { for (j = 0; j <= 2; j++) { @@ -146,36 +146,36 @@ void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { } this->unk_2A2 |= 1; - func_8086ED50(this, globalCtx); + func_8086ED50(this, play); } osSyncPrintf("(field keep 汎用爆弾壁)(arg_data 0x%04x)(angY %d)\n", this->dyna.actor.params, this->dyna.actor.shape.rot.y); } -void BgBombwall_DestroyCollision(BgBombwall* this, GlobalContext* globalCtx) { +void BgBombwall_DestroyCollision(BgBombwall* this, PlayState* play) { if (this->unk_2A2 & 2) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); this->unk_2A2 &= ~2; } if (this->unk_2A2 & 1) { - Collider_DestroyTris(globalCtx, &this->collider); + Collider_DestroyTris(play, &this->collider); this->unk_2A2 &= ~1; } } -void BgBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBombwall_Destroy(Actor* thisx, PlayState* play) { BgBombwall* this = (BgBombwall*)thisx; - BgBombwall_DestroyCollision(this, globalCtx); + BgBombwall_DestroyCollision(this, play); } static Vec3s D_8086F010[] = { { 40, 85, 21 }, { -43, 107, 14 }, { -1, 142, 14 }, { -27, 44, 27 }, { 28, 24, 20 }, { -39, 54, 21 }, { 49, 50, 20 }, }; -void func_8086EB5C(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086EB5C(BgBombwall* this, PlayState* play) { s16 rand; s16 rand2; Vec3f sp88; @@ -194,43 +194,43 @@ void func_8086EB5C(BgBombwall* this, GlobalContext* globalCtx) { sp88.z = ((D_8086F010[i].z * cos) - (sin * D_8086F010[i].x)) + pos->z; rand = ((s16)(Rand_ZeroOne() * 120.0f)) + 0x14; rand2 = ((s16)(Rand_ZeroOne() * 240.0f)) + 0x14; - func_80033480(globalCtx, &sp88, 50.0f, 2, rand, rand2, 1); + func_80033480(play, &sp88, 50.0f, 2, rand, rand2, 1); } sp88.x = pos->x; new_var = pos->y + 90.0f; sp88.y = pos->y + 90.0f; sp88.z = pos->z + 15.0f; - func_80033480(globalCtx, &sp88, 40.0f, 4, 0xA, 0x32, 1); + func_80033480(play, &sp88, 40.0f, 4, 0xA, 0x32, 1); } -void func_8086ED50(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086ED50(BgBombwall* this, PlayState* play) { this->dList = gBgBombwallNormalDL; this->actionFunc = func_8086ED70; } -void func_8086ED70(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086ED70(BgBombwall* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - func_8086EDFC(this, globalCtx); - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + func_8086EDFC(this, play); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); } else if (this->dyna.actor.xzDistToPlayer < 600.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_8086EDFC(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086EDFC(BgBombwall* this, PlayState* play) { this->dList = gBgBombwallNormalDL; this->unk_2A0 = 1; - func_8086EB5C(this, globalCtx); + func_8086EB5C(this, play); this->actionFunc = func_8086EE40; } -void func_8086EE40(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086EE40(BgBombwall* this, PlayState* play) { if (this->unk_2A0 > 0) { this->unk_2A0--; } else { - func_8086EE94(this, globalCtx); + func_8086EE94(this, play); if (((this->dyna.actor.params >> 0xF) & 1) != 0) { func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -238,22 +238,22 @@ void func_8086EE40(BgBombwall* this, GlobalContext* globalCtx) { } } -void func_8086EE94(BgBombwall* this, GlobalContext* globalCtx) { +void func_8086EE94(BgBombwall* this, PlayState* play) { this->dList = gBgBombwallBrokenDL; - BgBombwall_DestroyCollision(this, globalCtx); + BgBombwall_DestroyCollision(this, play); this->actionFunc = NULL; } -void BgBombwall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBombwall_Update(Actor* thisx, PlayState* play) { BgBombwall* this = (BgBombwall*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgBombwall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgBombwall_Draw(Actor* thisx, PlayState* play) { BgBombwall* this = (BgBombwall*)thisx; - Gfx_DrawDListOpa(globalCtx, this->dList); + Gfx_DrawDListOpa(play, this->dList); } diff --git a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h index 68e17e0287..f5c9cd2b51 100644 --- a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h +++ b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h @@ -6,7 +6,7 @@ struct BgBombwall; -typedef void (*BgBombwallActionFunc)(struct BgBombwall*, GlobalContext*); +typedef void (*BgBombwallActionFunc)(struct BgBombwall*, PlayState*); typedef struct BgBombwall { /* 0x0000 */ DynaPolyActor dyna; 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 3bd4638d73..5f0aa39be0 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 @@ -12,16 +12,16 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBowlWall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBowlWall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgBowlWall_Draw(Actor* thisx, GlobalContext* globalCtx); +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* play); -void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx); -void BgBowlWall_WaitForHit(BgBowlWall* this, GlobalContext* globalCtx); -void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx); -void BgBowlWall_FinishFall(BgBowlWall* this, GlobalContext* globalCtx); -void BgBowlWall_Reset(BgBowlWall* this, GlobalContext* globalCtx); +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); const ActorInit Bg_Bowl_Wall_InitVars = { ACTOR_BG_BOWL_WALL, @@ -44,7 +44,7 @@ static Vec3f sBullseyeOffset[] = { static s16 sTargetRot[] = { 0x0000, 0x0000, 0x3FFF, -0x3FFF }; -void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBowlWall_Init(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; s32 pad1; s32 pad2; @@ -58,7 +58,7 @@ void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gBowlingSecondRoundCol, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->initPos = this->dyna.actor.world.pos; osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ ボーリングおじゃま壁発生 ☆☆☆☆☆ %d\n" VT_RST, this->dyna.actor.params); @@ -66,13 +66,13 @@ void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.scale.x = this->dyna.actor.scale.y = this->dyna.actor.scale.z = 1.0f; } -void BgBowlWall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBowlWall_Destroy(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) { +void BgBowlWall_SpawnBullseyes(BgBowlWall* this, PlayState* play) { s32 pad; EnWallTubo* bullseye; Actor* lookForGirl; @@ -88,7 +88,7 @@ void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) { 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(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_WALL_TUBO, + 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) { @@ -97,7 +97,7 @@ void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) { bullseye->explosionCenter = this->bullseyeCenter = this->dyna.actor.world.pos; } if (this->chuGirl == NULL) { - lookForGirl = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + lookForGirl = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (lookForGirl != NULL) { if (lookForGirl->id != ACTOR_EN_BOM_BOWL_MAN) { lookForGirl = lookForGirl->next; @@ -111,13 +111,13 @@ void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) { } } -void BgBowlWall_WaitForHit(BgBowlWall* this, GlobalContext* globalCtx) { +void BgBowlWall_WaitForHit(BgBowlWall* this, PlayState* play) { if (this->isHit) { this->actionFunc = BgBowlWall_FallDoEffects; } } -void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) { +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 }; @@ -146,12 +146,12 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) { effectPos.x = Rand_CenteredFloat(300.0f) + this->bullseyeCenter.x; effectPos.y = -100.0f; effectPos.z = Rand_CenteredFloat(400.0f) + this->bullseyeCenter.z; - EffectSsBomb2_SpawnLayered(globalCtx, &effectPos, &effectVelocity, &effectAccel, 100, 30); + EffectSsBomb2_SpawnLayered(play, &effectPos, &effectVelocity, &effectAccel, 100, 30); effectPos.y = -50.0f; - EffectSsHahen_SpawnBurst(globalCtx, &effectPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &effectPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION); } - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1); Quake_SetSpeed(quakeIndex, 0x7FFF); Quake_SetQuakeValues(quakeIndex, 300, 0, 0, 0); Quake_SetCountdown(quakeIndex, 30); @@ -160,7 +160,7 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) { } } -void BgBowlWall_FinishFall(BgBowlWall* this, GlobalContext* globalCtx) { +void BgBowlWall_FinishFall(BgBowlWall* this, PlayState* play) { if (this->timer >= 2) { if (this->dyna.actor.params == 0) { Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 1, 200, 0); @@ -175,7 +175,7 @@ void BgBowlWall_FinishFall(BgBowlWall* this, GlobalContext* globalCtx) { } } -void BgBowlWall_Reset(BgBowlWall* this, GlobalContext* globalCtx) { +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) { @@ -186,28 +186,27 @@ void BgBowlWall_Reset(BgBowlWall* this, GlobalContext* globalCtx) { } } -void BgBowlWall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBowlWall_Update(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; if (this->timer != 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgBowlWall_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgBowlWall_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgBowlWall* this = (BgBowlWall*)thisx; u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_bowl_wall.c", 441); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_bowl_wall.c", 441); - func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x8, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, -2 * (frames = globalCtx->state.frames), 16, 16)); + func_80093D84(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x8, Gfx_TexScroll(play->state.gfxCtx, 0, -2 * (frames = play->state.frames), 16, 16)); gDPPipeSync(POLY_OPA_DISP++); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_bowl_wall.c", 453), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_bowl_wall.c", 453), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->dyna.actor.params == 0) { @@ -216,5 +215,5 @@ void BgBowlWall_Draw(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_OPA_DISP++, gBowlingRound2WallDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_bowl_wall.c", 464); + 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 0a5b7a5121..12a4bdf3a4 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 @@ -7,7 +7,7 @@ struct BgBowlWall; -typedef void (*BgBowlWallActionFunc)(struct BgBowlWall*, GlobalContext*); +typedef void (*BgBowlWallActionFunc)(struct BgBowlWall*, PlayState*); typedef struct BgBowlWall { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index 2abe334db5..d0f5d35312 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -17,14 +17,14 @@ typedef struct { /* 0x08 */ s8 colType; } BombableWallInfo; -void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBreakwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBreakwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgBreakwall_Init(Actor* thisx, PlayState* play); +void BgBreakwall_Destroy(Actor* thisx, PlayState* play); +void BgBreakwall_Update(Actor* thisx, PlayState* play); +void BgBreakwall_Draw(Actor* thisx, PlayState* play); -void BgBreakwall_WaitForObject(BgBreakwall* this, GlobalContext* globalCtx); -void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx); -void BgBreakwall_LavaCoverMove(BgBreakwall* this, GlobalContext* globalCtx); +void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play); +void BgBreakwall_Wait(BgBreakwall* this, PlayState* play); +void BgBreakwall_LavaCoverMove(BgBreakwall* this, PlayState* play); const ActorInit Bg_Breakwall_InitVars = { ACTOR_BG_BREAKWALL, @@ -76,7 +76,7 @@ void BgBreakwall_SetupAction(BgBreakwall* this, BgBreakwallActionFunc actionFunc this->actionFunc = actionFunc; } -void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Init(Actor* thisx, PlayState* play) { BgBreakwall* this = (BgBreakwall*)thisx; s32 pad; s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; @@ -91,20 +91,20 @@ void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->bombableWallDList != NULL) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { Actor_Kill(&this->dyna.actor); return; } ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->dyna.actor, &sQuadInit); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->dyna.actor, &sQuadInit); } else { this->dyna.actor.world.pos.y -= 40.0f; } - this->bankIndex = (wallType >= BWALL_KD_FLOOR) ? Object_GetIndex(&globalCtx->objectCtx, OBJECT_KINGDODONGO) - : Object_GetIndex(&globalCtx->objectCtx, OBJECT_BWALL); + this->bankIndex = (wallType >= BWALL_KD_FLOOR) ? Object_GetIndex(&play->objectCtx, OBJECT_KINGDODONGO) + : Object_GetIndex(&play->objectCtx, OBJECT_BWALL); if (this->bankIndex < 0) { Actor_Kill(&this->dyna.actor); @@ -113,18 +113,18 @@ void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgBreakwall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Destroy(Actor* thisx, PlayState* play) { BgBreakwall* this = (BgBreakwall*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } /** * Spawns fragments using ACTOR_EN_A_OBJ whenever the wall or floor is exploded. * Returns the last spawned actor */ -Actor* BgBreakwall_SpawnFragments(GlobalContext* globalCtx, BgBreakwall* this, Vec3f* pos, f32 velocity, f32 scaleY, - f32 scaleX, s32 count, f32 accel) { +Actor* BgBreakwall_SpawnFragments(PlayState* play, BgBreakwall* this, Vec3f* pos, f32 velocity, f32 scaleY, f32 scaleX, + s32 count, f32 accel) { Actor* actor; Vec3f actorPos; s32 k; @@ -171,13 +171,12 @@ Actor* BgBreakwall_SpawnFragments(GlobalContext* globalCtx, BgBreakwall* this, V for (j = 3; j >= 0; j--) { for (k = 3; k >= 0; k--) { Matrix_MultVec3f(&actorPosList[j][k], &actorPos); - actor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_A_OBJ, Rand_CenteredFloat(20.0f) + actorPos.x, - Rand_CenteredFloat(20.0f) + actorPos.y, Rand_CenteredFloat(20.0f) + actorPos.z, - actorRotList[k].x, actorRotList[k].y + angle1, actorRotList[k].z, 0x000B); + actor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_A_OBJ, Rand_CenteredFloat(20.0f) + actorPos.x, + Rand_CenteredFloat(20.0f) + actorPos.y, Rand_CenteredFloat(20.0f) + actorPos.z, + actorRotList[k].x, actorRotList[k].y + angle1, actorRotList[k].z, 0x000B); if ((j & 1) == 0) { - func_80033480(globalCtx, &actorPos, velocity * 200.0f, 1, 650, 150, 1); + func_80033480(play, &actorPos, velocity * 200.0f, 1, 650, 150, 1); } if (actor != NULL) { @@ -201,17 +200,17 @@ Actor* BgBreakwall_SpawnFragments(GlobalContext* globalCtx, BgBreakwall* this, V /** * Sets up the collision model as well is the object dependency and action function to use. */ -void BgBreakwall_WaitForObject(BgBreakwall* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { +void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { CollisionHeader* colHeader = NULL; s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; this->dyna.actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); this->dyna.actor.flags &= ~ACTOR_FLAG_4; this->dyna.actor.draw = BgBreakwall_Draw; CollisionHeader_GetVirtual(sBombableWallInfo[wallType].colHeader, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (wallType == BWALL_KD_LAVA_COVER) { BgBreakwall_SetupAction(this, BgBreakwall_LavaCoverMove); @@ -225,12 +224,12 @@ void BgBreakwall_WaitForObject(BgBreakwall* this, GlobalContext* globalCtx) { * Checks for an explosion using quad collision. If the wall or floor is exploded then it will spawn fragments and * despawn itself. */ -void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) { +void BgBreakwall_Wait(BgBreakwall* this, PlayState* play) { if (this->collider.base.acFlags & 2) { Vec3f effectPos; s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); effectPos.y = effectPos.z = effectPos.x = 0.0f; if (this->dyna.actor.world.rot.x == 0) { @@ -240,8 +239,8 @@ void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) { effectPos.y = -10.0f; } - BgBreakwall_SpawnFragments(globalCtx, this, &effectPos, 0.0f, 6.4f, 5.0f, 1, 2.0f); - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + BgBreakwall_SpawnFragments(play, this, &effectPos, 0.0f, 6.4f, 5.0f, 1, 2.0f); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); if (wallType == BWALL_KD_FLOOR) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_EXPLOSION); @@ -251,11 +250,11 @@ void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) { if ((wallType == BWALL_DC_ENTRANCE) && !Flags_GetEventChkInf(EVENTCHKINF_B0)) { Flags_SetEventChkInf(EVENTCHKINF_B0); - Cutscene_SetSegment(globalCtx, gDcOpeningCs); + Cutscene_SetSegment(play, gDcOpeningCs); gSaveContext.cutsceneTrigger = 1; Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_8002DF54(globalCtx, NULL, 0x31); + func_8002DF54(play, NULL, 0x31); } if (this->dyna.actor.params < 0) { @@ -271,14 +270,14 @@ void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) { * Moves the actor's y position to cover the lava floor in King Dodongo's lair after he is defeated so the player is no * longer hurt by the lava. */ -void BgBreakwall_LavaCoverMove(BgBreakwall* this, GlobalContext* globalCtx) { +void BgBreakwall_LavaCoverMove(BgBreakwall* this, PlayState* play) { Math_StepToF(&this->dyna.actor.world.pos.y, KREG(80) + this->dyna.actor.home.pos.y, 1.0f); } -void BgBreakwall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Update(Actor* thisx, PlayState* play) { BgBreakwall* this = (BgBreakwall*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } /** @@ -290,15 +289,15 @@ static Vec3f sColQuadList[][4] = { { { 10.0f, 0.0f, 10.0f }, { -10.0f, 0.0f, 10.0f }, { 10.0f, 0.0f, -10.0f }, { -10.0f, 0.0f, -10.0f } }, }; -void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Draw(Actor* thisx, PlayState* play) { s32 pad; BgBreakwall* this = (BgBreakwall*)thisx; if (this->bombableWallDList != NULL) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_breakwall.c", 767); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_breakwall.c", 767); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_breakwall.c", 771), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_breakwall.c", 771), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->bombableWallDList); @@ -313,9 +312,9 @@ void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx) { } Collider_SetQuadVertices(&this->collider, &colQuad[0], &colQuad[1], &colQuad[2], &colQuad[3]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_breakwall.c", 822); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_breakwall.c", 822); } } diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h index 43fd4ee930..022a439f29 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h @@ -6,7 +6,7 @@ struct BgBreakwall; -typedef void (*BgBreakwallActionFunc)(struct BgBreakwall*, GlobalContext*); +typedef void (*BgBreakwallActionFunc)(struct BgBreakwall*, PlayState*); typedef struct BgBreakwall { /* 0x0000 */ DynaPolyActor dyna; 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 13219087f6..36cc15538d 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 @@ -9,13 +9,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDdanJd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDdanJd_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDdanJd_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDdanJd_Init(Actor* thisx, PlayState* play); +void BgDdanJd_Destroy(Actor* thisx, PlayState* play); +void BgDdanJd_Update(Actor* thisx, PlayState* play); +void BgDdanJd_Draw(Actor* thisx, PlayState* play); -void BgDdanJd_Idle(BgDdanJd* this, GlobalContext* globalCtx); -void BgDdanJd_Move(BgDdanJd* this, GlobalContext* globalCtx); +void BgDdanJd_Idle(BgDdanJd* this, PlayState* play); +void BgDdanJd_Move(BgDdanJd* this, PlayState* play); const ActorInit Bg_Ddan_Jd_InitVars = { ACTOR_BG_DDAN_JD, @@ -50,7 +50,7 @@ typedef enum { #define DEFAULT_Y_SPEED 1 #define SHORTCUT_Y_SPEED 5 -void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanJd_Init(Actor* thisx, PlayState* play) { s32 pad; BgDdanJd* this = (BgDdanJd*)thisx; CollisionHeader* colHeader = NULL; @@ -58,14 +58,14 @@ void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gDodongoRisingPlatformCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->idleTimer = IDLE_FRAMES; this->state = STATE_GO_BOTTOM; // Missing check for actor.params < 0x40. This will cause inconsistent behavior if params >= 0x40 and the bound // switch state is turned on while in the same room, as the shortcut behavior won't become enabled until the actor // is reloaded. - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { + if (Flags_GetSwitch(play, this->dyna.actor.params)) { this->ySpeed = SHORTCUT_Y_SPEED; } else { this->ySpeed = DEFAULT_Y_SPEED; @@ -73,25 +73,25 @@ void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgDdanJd_Idle; } -void BgDdanJd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanJd_Destroy(Actor* thisx, PlayState* play) { BgDdanJd* this = (BgDdanJd*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgDdanJd_Idle(BgDdanJd* this, GlobalContext* globalCtx) { +void BgDdanJd_Idle(BgDdanJd* this, PlayState* play) { if (this->idleTimer != 0) { this->idleTimer--; } // if this is the platform that rises all the way to the top, and the switch state has just changed to on if (this->ySpeed == DEFAULT_Y_SPEED && this->dyna.actor.params < 0x40 && - Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { + Flags_GetSwitch(play, this->dyna.actor.params)) { this->ySpeed = SHORTCUT_Y_SPEED; this->state = STATE_GO_MIDDLE_FROM_BOTTOM; this->idleTimer = 0; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + MOVE_HEIGHT_MIDDLE; - OnePointCutscene_Init(globalCtx, 3060, -99, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3060, -99, &this->dyna.actor, CAM_ID_MAIN); } if (this->idleTimer == 0) { this->idleTimer = IDLE_FRAMES; @@ -125,25 +125,25 @@ void BgDdanJd_Idle(BgDdanJd* this, GlobalContext* globalCtx) { } // Handles dust particles and sfx when moving -void BgDdanJd_MoveEffects(BgDdanJd* this, GlobalContext* globalCtx) { +void BgDdanJd_MoveEffects(BgDdanJd* this, PlayState* play) { Vec3f dustPos; // Generate random dust particles at the platform's base. dustPos.y = this->dyna.actor.home.pos.y; - if (globalCtx->gameplayFrames & 1) { + if (play->gameplayFrames & 1) { dustPos.x = this->dyna.actor.world.pos.x + 65.0f; dustPos.z = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1); + func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1); dustPos.x = this->dyna.actor.world.pos.x - 65.0f; dustPos.z = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1); + func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1); } else { dustPos.x = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.x; dustPos.z = this->dyna.actor.world.pos.z + 65.0f; - func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1); + func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1); dustPos.x = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.x; dustPos.z = this->dyna.actor.world.pos.z - 65.0f; - func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1); + func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1); } if (this->ySpeed == SHORTCUT_Y_SPEED) { func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); @@ -151,29 +151,29 @@ void BgDdanJd_MoveEffects(BgDdanJd* this, GlobalContext* globalCtx) { } // Implements the platform's movement state -void BgDdanJd_Move(BgDdanJd* this, GlobalContext* globalCtx) { +void BgDdanJd_Move(BgDdanJd* this, PlayState* play) { // if this is the platform that rises all the way to the top, and the switch state has just changed to on if (this->ySpeed == DEFAULT_Y_SPEED && this->dyna.actor.params < 0x40 && - Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { + Flags_GetSwitch(play, this->dyna.actor.params)) { this->ySpeed = SHORTCUT_Y_SPEED; this->state = STATE_GO_MIDDLE_FROM_BOTTOM; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + MOVE_HEIGHT_MIDDLE; this->idleTimer = 0; this->actionFunc = BgDdanJd_Idle; - OnePointCutscene_Init(globalCtx, 3060, -99, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3060, -99, &this->dyna.actor, CAM_ID_MAIN); } else if (Math_StepToF(&this->dyna.actor.world.pos.y, this->targetY, this->ySpeed)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_PILLAR_MOVE_STOP); this->actionFunc = BgDdanJd_Idle; } - BgDdanJd_MoveEffects(this, globalCtx); + BgDdanJd_MoveEffects(this, play); } -void BgDdanJd_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanJd_Update(Actor* thisx, PlayState* play) { BgDdanJd* this = (BgDdanJd*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgDdanJd_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gDodongoRisingPlatformDL); +void BgDdanJd_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gDodongoRisingPlatformDL); } diff --git a/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.h b/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.h index 33ab8be8a3..6497657943 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.h +++ b/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.h @@ -6,7 +6,7 @@ struct BgDdanJd; -typedef void (*BgDdanJdActionFunc)(struct BgDdanJd*, GlobalContext*); +typedef void (*BgDdanJdActionFunc)(struct BgDdanJd*, PlayState*); typedef struct BgDdanJd { /* 0x0000 */ DynaPolyActor dyna; 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 3235397b7e..ea6d212fdb 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 @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDdanKd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDdanKd_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDdanKd_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDdanKd_Init(Actor* thisx, PlayState* play); +void BgDdanKd_Destroy(Actor* thisx, PlayState* play); +void BgDdanKd_Update(Actor* thisx, PlayState* play); +void BgDdanKd_Draw(Actor* thisx, PlayState* play); -void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx); -void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx); -void BgDdanKd_DoNothing(BgDdanKd* this, GlobalContext* globalCtx); +void BgDdanKd_CheckForExplosions(BgDdanKd* this, PlayState* play); +void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play); +void BgDdanKd_DoNothing(BgDdanKd* this, PlayState* play); const ActorInit Bg_Ddan_Kd_InitVars = { ACTOR_BG_DDAN_KD, @@ -61,7 +61,7 @@ void BgDdanKd_SetupAction(BgDdanKd* this, BgDdanKdActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanKd_Init(Actor* thisx, PlayState* play) { BgDdanKd* this = (BgDdanKd*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -70,13 +70,13 @@ void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); CollisionHeader_GetVirtual(&gDodongoFallingStairsCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { + if (!Flags_GetSwitch(play, this->dyna.actor.params)) { BgDdanKd_SetupAction(this, BgDdanKd_CheckForExplosions); } else { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 200.0f - 20.0f; @@ -84,17 +84,17 @@ void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgDdanKd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanKd_Destroy(Actor* thisx, PlayState* play) { BgDdanKd* this = (BgDdanKd*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); } -void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) { +void BgDdanKd_CheckForExplosions(BgDdanKd* this, PlayState* play) { Actor* explosive; - explosive = Actor_GetCollidedExplosive(globalCtx, &this->collider.base); + explosive = Actor_GetCollidedExplosive(play, &this->collider.base); if (explosive != NULL) { osSyncPrintf("dam %d\n", this->dyna.actor.colChkInfo.damage); explosive->params = 2; @@ -103,7 +103,7 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) { if ((explosive != NULL) && (this->prevExplosive != NULL) && (explosive != this->prevExplosive) && (Math_Vec3f_DistXZ(&this->prevExplosivePos, &explosive->world.pos) > 80.0f)) { BgDdanKd_SetupAction(this, BgDdanKd_LowerStairs); - OnePointCutscene_Init(globalCtx, 3050, 999, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3050, 999, &this->dyna.actor, CAM_ID_MAIN); } else { if (this->timer != 0) { this->timer--; @@ -115,11 +115,11 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) { } } Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) { +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 }; Vec3f pos1; @@ -131,16 +131,16 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) { if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 200.0f - 20.0f, 0.075f, this->dyna.actor.speedXZ, 0.0075f) == 0.0f) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params); + Flags_SetSwitch(play, this->dyna.actor.params); BgDdanKd_SetupAction(this, BgDdanKd_DoNothing); } else { effectStrength = (this->dyna.actor.prevPos.y - this->dyna.actor.world.pos.y) + (this->dyna.actor.speedXZ * 0.25f); - if (globalCtx->state.frames & 1) { + if (play->state.frames & 1) { pos1 = pos2 = this->dyna.actor.world.pos; - if (globalCtx->state.frames & 2) { + if (play->state.frames & 2) { pos1.z += 210.0f + Rand_ZeroOne() * 230.0f; pos2.z += 210.0f + Rand_ZeroOne() * 230.0f; } else { @@ -152,38 +152,38 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) { pos1.y = this->dyna.actor.floorHeight + 20.0f + Rand_ZeroOne(); pos2.y = this->dyna.actor.floorHeight + 20.0f + Rand_ZeroOne(); - func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1); - func_80033480(globalCtx, &pos2, 20.0f, 1, effectStrength * 135.0f, 60, 1); + 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); - func_8003555C(globalCtx, &pos1, &velocity, &accel); - func_8003555C(globalCtx, &pos2, &velocity, &accel); + func_8003555C(play, &pos1, &velocity, &accel); + func_8003555C(play, &pos2, &velocity, &accel); pos1 = this->dyna.actor.world.pos; pos1.z += 560.0f + Rand_ZeroOne() * 5.0f; pos1.x += (Rand_ZeroOne() - 0.5f) * 160.0f; pos1.y = Rand_ZeroOne() * 3.0f + (this->dyna.actor.floorHeight + 20.0f); - func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1); - func_8003555C(globalCtx, &pos1, &velocity, &accel); + func_80033480(play, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1); + func_8003555C(play, &pos1, &velocity, &accel); } - Camera_AddQuake(&globalCtx->mainCamera, 0, effectStrength * 0.6f, 3); + Camera_AddQuake(&play->mainCamera, 0, effectStrength * 0.6f, 3); Audio_PlaySoundGeneral(NA_SE_EV_PILLAR_SINK - SFX_FLAG, &this->dyna.actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } -void BgDdanKd_DoNothing(BgDdanKd* this, GlobalContext* globalCtx) { +void BgDdanKd_DoNothing(BgDdanKd* this, PlayState* play) { } -void BgDdanKd_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgDdanKd_Update(Actor* thisx, PlayState* play) { BgDdanKd* this = (BgDdanKd*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgDdanKd_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gDodongoFallingStairsDL); +void BgDdanKd_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gDodongoFallingStairsDL); } diff --git a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h index 12048002b4..2e80b64cb9 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h +++ b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h @@ -6,7 +6,7 @@ struct BgDdanKd; -typedef void (*BgDdanKdActionFunc)(struct BgDdanKd*, GlobalContext*); +typedef void (*BgDdanKdActionFunc)(struct BgDdanKd*, PlayState*); typedef struct BgDdanKd { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index de905f0fd9..3e031bc27a 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -10,15 +10,15 @@ #define FLAGS 0 -void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDodoago_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDodoago_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDodoago_Init(Actor* thisx, PlayState* play); +void BgDodoago_Destroy(Actor* thisx, PlayState* play); +void BgDodoago_Update(Actor* thisx, PlayState* play); +void BgDodoago_Draw(Actor* thisx, PlayState* play); -void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx); -void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx); -void BgDodoago_DoNothing(BgDodoago* this, GlobalContext* globalCtx); -void BgDodoago_LightOneEye(BgDodoago* this, GlobalContext* globalCtx); +void BgDodoago_WaitExplosives(BgDodoago* this, PlayState* play); +void BgDodoago_OpenJaw(BgDodoago* this, PlayState* play); +void BgDodoago_DoNothing(BgDodoago* this, PlayState* play); +void BgDodoago_LightOneEye(BgDodoago* this, PlayState* play); const ActorInit Bg_Dodoago_InitVars = { ACTOR_BG_DODOAGO, @@ -84,7 +84,7 @@ void BgDodoago_SetupAction(BgDodoago* this, BgDodoagoActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgDodoago_SpawnSparkles(Vec3f* meanPos, GlobalContext* globalCtx) { +void BgDodoago_SpawnSparkles(Vec3f* meanPos, PlayState* play) { Vec3f pos; Color_RGBA8 primColor = { 100, 100, 100, 0 }; Color_RGBA8 envColor = { 40, 40, 40, 0 }; @@ -96,7 +96,7 @@ void BgDodoago_SpawnSparkles(Vec3f* meanPos, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + meanPos->x; pos.y = Rand_CenteredFloat(10.0f) + meanPos->y; pos.z = Rand_CenteredFloat(20.0f) + meanPos->z; - EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &velocity, &acceleration, &primColor, &envColor); + EffectSsKiraKira_SpawnSmall(play, &pos, &velocity, &acceleration, &primColor, &envColor); } } @@ -107,7 +107,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; -void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgDodoago_Init(Actor* thisx, PlayState* play) { BgDodoago* this = (BgDodoago*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -115,38 +115,38 @@ void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gDodongoLowerJawCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, 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); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { BgDodoago_SetupAction(this, BgDodoago_DoNothing); this->dyna.actor.shape.rot.x = 0x1333; - globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] = globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] = 255; + play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] = play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] = 255; return; } - Collider_InitCylinder(globalCtx, &this->colliderMain); - Collider_InitCylinder(globalCtx, &this->colliderLeft); - Collider_InitCylinder(globalCtx, &this->colliderRight); - Collider_SetCylinder(globalCtx, &this->colliderMain, &this->dyna.actor, &sColCylinderInitMain); - Collider_SetCylinder(globalCtx, &this->colliderLeft, &this->dyna.actor, &sColCylinderInitLeftRight); - Collider_SetCylinder(globalCtx, &this->colliderRight, &this->dyna.actor, &sColCylinderInitLeftRight); + Collider_InitCylinder(play, &this->colliderMain); + Collider_InitCylinder(play, &this->colliderLeft); + Collider_InitCylinder(play, &this->colliderRight); + Collider_SetCylinder(play, &this->colliderMain, &this->dyna.actor, &sColCylinderInitMain); + Collider_SetCylinder(play, &this->colliderLeft, &this->dyna.actor, &sColCylinderInitLeftRight); + Collider_SetCylinder(play, &this->colliderRight, &this->dyna.actor, &sColCylinderInitLeftRight); BgDodoago_SetupAction(this, BgDodoago_WaitExplosives); sDisableBombCatcher = false; } -void BgDodoago_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgDodoago_Destroy(Actor* thisx, PlayState* play) { BgDodoago* this = (BgDodoago*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->colliderMain); - Collider_DestroyCylinder(globalCtx, &this->colliderLeft); - Collider_DestroyCylinder(globalCtx, &this->colliderRight); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->colliderMain); + Collider_DestroyCylinder(play, &this->colliderLeft); + Collider_DestroyCylinder(play, &this->colliderRight); } -void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) { - Actor* explosive = Actor_GetCollidedExplosive(globalCtx, &this->colliderMain.base); +void BgDodoago_WaitExplosives(BgDodoago* this, PlayState* play) { + Actor* explosive = Actor_GetCollidedExplosive(play, &this->colliderMain.base); if (explosive != NULL) { this->state = @@ -154,21 +154,21 @@ void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) { ? BGDODOAGO_EYE_RIGHT : BGDODOAGO_EYE_LEFT; - if (((globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] == 255) && (this->state == BGDODOAGO_EYE_RIGHT)) || - ((globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] == 255) && (this->state == BGDODOAGO_EYE_LEFT))) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + if (((play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] == 255) && (this->state == BGDODOAGO_EYE_RIGHT)) || + ((play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] == 255) && (this->state == BGDODOAGO_EYE_LEFT))) { + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); this->state = 0; Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); BgDodoago_SetupAction(this, BgDodoago_OpenJaw); - OnePointCutscene_Init(globalCtx, 3380, 160, &this->dyna.actor, CAM_ID_MAIN); - } else if (globalCtx->roomCtx.unk_74[this->state] == 0) { - OnePointCutscene_Init(globalCtx, 3065, 40, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3380, 160, &this->dyna.actor, CAM_ID_MAIN); + } else if (play->roomCtx.unk_74[this->state] == 0) { + OnePointCutscene_Init(play, 3065, 40, &this->dyna.actor, CAM_ID_MAIN); BgDodoago_SetupAction(this, BgDodoago_LightOneEye); Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } else { - OnePointCutscene_Init(globalCtx, 3065, 20, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3065, 20, &this->dyna.actor, CAM_ID_MAIN); Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); sTimer += 30; @@ -195,13 +195,13 @@ void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) { this->colliderRight.dim.pos.z += 215; this->colliderRight.dim.pos.x -= 90; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderMain.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderLeft.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderRight.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderMain.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderLeft.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderRight.base); } } -void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) { +void BgDodoago_OpenJaw(BgDodoago* this, PlayState* play) { Vec3f pos; Vec3f dustOffsets[] = { { 0.0f, -200.0f, 430.0f }, { 20.0f, -200.0f, 420.0f }, { -20.0f, -200.0f, 420.0f }, @@ -212,14 +212,14 @@ void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) { s32 i; // make both eyes red (one already is) - if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] < 255) { - globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] += 5; + if (play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] < 255) { + play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] += 5; } - if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] < 255) { - globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] += 5; + if (play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] < 255) { + play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] += 5; } - if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] != 255 || globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] != 255) { + if (play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] != 255 || play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] != 255) { sTimer--; return; } @@ -229,19 +229,19 @@ void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) { pos.x = dustOffsets[i].x + this->dyna.actor.world.pos.x; pos.y = dustOffsets[i].y + this->dyna.actor.world.pos.y; pos.z = dustOffsets[i].z + this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &pos, 2.0f, 3, 200, 75, 1); + func_80033480(play, &pos, 2.0f, 3, 200, 75, 1); } } pos.x = this->dyna.actor.world.pos.x + 200.0f; pos.y = this->dyna.actor.world.pos.y - 20.0f; pos.z = this->dyna.actor.world.pos.z + 100.0f; - BgDodoago_SpawnSparkles(&pos, globalCtx); + BgDodoago_SpawnSparkles(&pos, play); pos.x = this->dyna.actor.world.pos.x - 200.0f; pos.y = this->dyna.actor.world.pos.y - 20.0f; pos.z = this->dyna.actor.world.pos.z + 100.0f; - BgDodoago_SpawnSparkles(&pos, globalCtx); + BgDodoago_SpawnSparkles(&pos, play); Math_StepToS(&this->state, 100, 3); func_800AA000(500.0f, 0x78, 0x14, 0xA); @@ -256,18 +256,18 @@ void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) { } } -void BgDodoago_DoNothing(BgDodoago* this, GlobalContext* globalCtx) { +void BgDodoago_DoNothing(BgDodoago* this, PlayState* play) { } -void BgDodoago_LightOneEye(BgDodoago* this, GlobalContext* globalCtx) { - globalCtx->roomCtx.unk_74[this->state] += 5; +void BgDodoago_LightOneEye(BgDodoago* this, PlayState* play) { + play->roomCtx.unk_74[this->state] += 5; - if (globalCtx->roomCtx.unk_74[this->state] == 255) { + if (play->roomCtx.unk_74[this->state] == 255) { BgDodoago_SetupAction(this, BgDodoago_WaitExplosives); } } -void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgDodoago_Update(Actor* thisx, PlayState* play) { BgDodoago* this = (BgDodoago*)thisx; Actor* actor; EnBom* bomb; @@ -296,9 +296,9 @@ void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) { } } else { sTimer++; - Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_GetSwitch(play, this->dyna.actor.params & 0x3F); if (!sDisableBombCatcher && sTimer > 140) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { // this prevents clearing the actor's parent pointer, effectively disabling the bomb catcher sDisableBombCatcher++; } else { @@ -306,18 +306,18 @@ void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) { } } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgDodoago_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 672); +void BgDodoago_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_dodoago.c", 672); if (Flags_GetEventChkInf(EVENTCHKINF_B0)) { - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 677), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_dodoago.c", 677), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDodongoLowerJawDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 681); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_dodoago.c", 681); } diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h index 9729162f85..02603c6d01 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h @@ -11,7 +11,7 @@ typedef enum { struct BgDodoago; -typedef void (*BgDodoagoActionFunc)(struct BgDodoago*, GlobalContext*); +typedef void (*BgDodoagoActionFunc)(struct BgDodoago*, PlayState*); typedef struct BgDodoago { /* 0x0000 */ DynaPolyActor dyna; 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 f085f509b2..695f501ddf 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 @@ -25,32 +25,32 @@ typedef enum { /* 2 */ FAIRY_SPELL_NAYRUS_LOVE } BgDyYoseizoSpellType; -void BgDyYoseizo_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDyYoseizo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDyYoseizo_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDyYoseizo_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDyYoseizo_Init(Actor* thisx, PlayState* play); +void BgDyYoseizo_Destroy(Actor* thisx, PlayState* play); +void BgDyYoseizo_Update(Actor* thisx, PlayState* play); +void BgDyYoseizo_Draw(Actor* thisx, PlayState* play); -void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_Vanish(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx); +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 BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, GlobalContext* globalCtx); -void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, GlobalContext* globalCtx); +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 }; @@ -66,11 +66,11 @@ const ActorInit Bg_Dy_Yoseizo_InitVars = { NULL, }; -void BgDyYoseizo_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgDyYoseizo* this = (BgDyYoseizo*)thisx; - this->fountainType = globalCtx->curSpawn; + this->fountainType = play->curSpawn; if (this->fountainType < 0) { this->fountainType = 0; @@ -80,21 +80,21 @@ void BgDyYoseizo_Init(Actor* thisx, GlobalContext* globalCtx2) { this->grownHeight = this->vanishHeight + 40.0f; this->actor.focus.pos = this->actor.world.pos; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { // "Great Fairy Fountain" - osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 大妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, globalCtx->curSpawn); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGreatFairySkel, &gGreatFairySittingTransitionAnim, + osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 大妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, play->curSpawn); + SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairySittingTransitionAnim, this->jointTable, this->morphTable, 28); } else { // "Stone/Jewel Fairy Fountain" - osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 石妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, globalCtx->curSpawn); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGreatFairySkel, &gGreatFairyLayingDownTransitionAnim, + osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 石妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, play->curSpawn); + SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairyLayingDownTransitionAnim, this->jointTable, this->morphTable, 28); } this->actionFunc = BgDyYoseizo_CheckMagicAcquired; } -void BgDyYoseizo_Destroy(Actor* this, GlobalContext* globalCtx) { +void BgDyYoseizo_Destroy(Actor* this, PlayState* play) { } static Color_RGB8 sEffectPrimColors[] = { @@ -107,7 +107,7 @@ static Color_RGB8 sEffectEnvColors[] = { { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 100, 255, 255 }, }; -void BgDyYoseizo_SpawnEffects(BgDyYoseizo* this, GlobalContext* globalCtx, s16 type) { +void BgDyYoseizo_SpawnEffects(BgDyYoseizo* this, PlayState* play, s16 type) { Vec3f vel = { 0.0f, 0.0f, 0.0f }; Vec3f accel; Vec3f pos; @@ -139,7 +139,7 @@ void BgDyYoseizo_SpawnEffects(BgDyYoseizo* this, GlobalContext* globalCtx, s16 t scale = 0.2f; pos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f); - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { 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; @@ -165,22 +165,22 @@ void BgDyYoseizo_SpawnEffects(BgDyYoseizo* this, GlobalContext* globalCtx, s16 t } } -void BgDyYoseizo_Bob(BgDyYoseizo* this, GlobalContext* globalCtx) { +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); - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { this->actor.velocity.y = Math_SinS(this->bobTimer); } else { this->actor.velocity.y = Math_SinS(this->bobTimer) * 0.4f; } } -void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, 0x38)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { +void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, PlayState* play) { + if (Flags_GetSwitch(play, 0x38)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { if (!gSaveContext.magicAcquired && (this->fountainType != FAIRY_UPGRADE_MAGIC)) { Actor_Kill(&this->actor); return; @@ -191,20 +191,20 @@ void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, GlobalContext* globalCtx) return; } } - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->actionFunc = BgDyYoseizo_ChooseType; } } -void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) { s32 givingReward; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); // "Mode" - osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n" VT_RST, globalCtx->msgCtx.ocarinaMode); + osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n" VT_RST, play->msgCtx.ocarinaMode); givingReward = false; - if (globalCtx->sceneNum != SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum != SCENE_DAIYOUSEI_IZUMI) { switch (this->fountainType) { case FAIRY_SPELL_FARORES_WIND: if (!GET_ITEMGETINF(ITEMGETINF_18)) { @@ -253,33 +253,33 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx) { if (givingReward) { if (gSaveContext.sceneSetupIndex < 4) { - if (globalCtx->sceneNum != SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum != SCENE_DAIYOUSEI_IZUMI) { switch (this->fountainType) { case FAIRY_SPELL_FARORES_WIND: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyFaroresWindCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyFaroresWindCs); gSaveContext.cutsceneTrigger = 1; break; case FAIRY_SPELL_DINS_FIRE: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDinsFireCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDinsFireCs); gSaveContext.cutsceneTrigger = 1; break; case FAIRY_SPELL_NAYRUS_LOVE: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyNayrusLoveCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyNayrusLoveCs); gSaveContext.cutsceneTrigger = 1; break; } } else { switch (this->fountainType) { case FAIRY_UPGRADE_MAGIC: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyMagicCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyMagicCs); gSaveContext.cutsceneTrigger = 1; break; case FAIRY_UPGRADE_DOUBLE_MAGIC: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleMagicCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleMagicCs); gSaveContext.cutsceneTrigger = 1; break; case FAIRY_UPGRADE_HALF_DAMAGE: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleDefenceCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleDefenceCs); gSaveContext.cutsceneTrigger = 1; break; } @@ -289,12 +289,12 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx) { return; } - globalCtx->envCtx.lightSettingOverride = 2; + play->envCtx.lightSettingOverride = 2; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { - OnePointCutscene_Init(globalCtx, 8603, -99, NULL, CAM_ID_MAIN); + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + OnePointCutscene_Init(play, 8603, -99, NULL, CAM_ID_MAIN); } else { - OnePointCutscene_Init(globalCtx, 8604, -99, NULL, CAM_ID_MAIN); + OnePointCutscene_Init(play, 8604, -99, NULL, CAM_ID_MAIN); }; Audio_PlayActorSound2(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR); @@ -303,8 +303,8 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx) { } // Sets animations for spingrow -void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { +void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); @@ -315,12 +315,12 @@ void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* global } Audio_PlayActorSound2(&this->actor, NA_SE_VO_FR_LAUGH_0); - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->actionFunc = BgDyYoseizo_SpinGrow_NoReward; } -void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 1); +void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { + func_8002DF54(play, &this->actor, 1); 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); @@ -340,13 +340,13 @@ void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) } else { this->actor.shape.rot.y += 3000; } - BgDyYoseizo_SpawnEffects(this, globalCtx, 0); + BgDyYoseizo_SpawnEffects(this, play, 0); } -void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); if ((this->frameCount * 1273.0f) <= this->bobTimer) { this->bobTimer = 0.0f; @@ -359,10 +359,10 @@ void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* glo } } -void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 1); +void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { + func_8002DF54(play, &this->actor, 1); - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairySittingAnim); Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); @@ -374,13 +374,13 @@ void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* glo this->actor.textId = 0xDB; this->dialogState = TEXT_STATE_EVENT; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); - BgDyYoseizo_SpawnEffects(this, globalCtx, 0); + Message_StartTextbox(play, this->actor.textId, NULL); + BgDyYoseizo_SpawnEffects(this, play, 0); this->actionFunc = BgDyYoseizo_GreetPlayer_NoReward; } -void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 1); +void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { + func_8002DF54(play, &this->actor, 1); this->bobTimer = this->skelAnime.curFrame * 1273.0f; if ((this->frameCount * 1273.0f) <= this->bobTimer) { @@ -389,18 +389,18 @@ void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCt SkelAnime_Update(&this->skelAnime); - if ((this->dialogState == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((this->dialogState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); Interface_ChangeAlpha(5); this->actionFunc = BgDyYoseizo_SetupHealPlayer_NoReward; } - BgDyYoseizo_Bob(this, globalCtx); - BgDyYoseizo_SpawnEffects(this, globalCtx, 0); + BgDyYoseizo_Bob(this, play); + BgDyYoseizo_SpawnEffects(this, play, 0); } -void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { +void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); @@ -415,8 +415,8 @@ void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* glob this->actionFunc = BgDyYoseizo_HealPlayer_NoReward; } -void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; Vec3f beamPos; s16 beamParams; @@ -430,7 +430,7 @@ void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx SkelAnime_Update(&this->skelAnime); if ((this->frameCount <= curFrame) && !(this->animationChanged)) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); @@ -446,11 +446,10 @@ void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx beamPos.y = player->actor.world.pos.y + 200.0f; beamPos.z = player->actor.world.pos.z; - beamParams = ((globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) ? 0 : 1); + beamParams = ((play->sceneNum == SCENE_DAIYOUSEI_IZUMI) ? 0 : 1); - this->beam = - (EnDyExtra*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_DY_EXTRA, - beamPos.x, beamPos.y, beamPos.z, 0, 0, 0, beamParams); + this->beam = (EnDyExtra*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DY_EXTRA, + beamPos.x, beamPos.y, beamPos.z, 0, 0, 0, beamParams); } } if (this->refillTimer > 1) { @@ -463,7 +462,7 @@ void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx if (this->healingTimer == 110) { gSaveContext.healthAccumulator = 0x140; - Magic_Fill(globalCtx); + Magic_Fill(play); this->refillTimer = 200; } @@ -481,14 +480,14 @@ void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx if (this->healingTimer == 1) { this->actor.textId = 0xDA; this->dialogState = TEXT_STATE_EVENT; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = BgDyYoseizo_SayFarewell_NoReward; return; } - BgDyYoseizo_Bob(this, globalCtx); + BgDyYoseizo_Bob(this, play); } -void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, PlayState* play) { this->bobTimer = this->skelAnime.curFrame * 1400.0f; if (this->bobTimer >= (this->frameCount * 1400.0f)) { @@ -497,19 +496,19 @@ void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, GlobalContext* globalCt SkelAnime_Update(&this->skelAnime); - if ((this->dialogState == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((this->dialogState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->mouthState = 0; this->actionFunc = BgDyYoseizo_SetupSpinShrink; - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); } - BgDyYoseizo_Bob(this, globalCtx); - BgDyYoseizo_SpawnEffects(this, globalCtx, 0); + BgDyYoseizo_Bob(this, play); + BgDyYoseizo_SpawnEffects(this, play, 0); } -void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { +void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, PlayState* play) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairyJewelFountainSpinShrinkAnim); Animation_Change(&this->skelAnime, &gGreatFairyJewelFountainSpinShrinkAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); @@ -527,7 +526,7 @@ void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx) { this->actionFunc = BgDyYoseizo_SpinShrink; } -void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->vanishTimer == 0) { if (this->scale < 0.003f) { @@ -539,18 +538,18 @@ void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx) { 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, globalCtx, 0); + BgDyYoseizo_SpawnEffects(this, play, 0); } } } -void BgDyYoseizo_Vanish(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_Vanish(BgDyYoseizo* this, PlayState* play) { Actor* findOcarinaSpot; if (this->vanishTimer == 0) { - func_8002DF54(globalCtx, &this->actor, 7); - globalCtx->envCtx.lightSettingOverride = 0; - findOcarinaSpot = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + func_8002DF54(play, &this->actor, 7); + play->envCtx.lightSettingOverride = 0; + findOcarinaSpot = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (findOcarinaSpot != NULL) { if (findOcarinaSpot->id != ACTOR_EN_OKARINA_TAG) { @@ -561,19 +560,19 @@ void BgDyYoseizo_Vanish(BgDyYoseizo* this, GlobalContext* globalCtx) { break; } - Flags_UnsetSwitch(globalCtx, 0x38); + Flags_UnsetSwitch(play, 0x38); Actor_Kill(&this->actor); } } -void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if ((globalCtx->csCtx.npcActions[0] != NULL) && (globalCtx->csCtx.npcActions[0]->action == 2)) { +void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + if ((play->csCtx.npcActions[0] != NULL) && (play->csCtx.npcActions[0]->action == 2)) { this->actor.draw = BgDyYoseizo_Draw; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->finishedSpinGrow = false; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); @@ -589,7 +588,7 @@ void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, GlobalContext* globalCt } } -void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if (!this->finishedSpinGrow) { @@ -616,7 +615,7 @@ void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* glob SkelAnime_Update(&this->skelAnime); if ((this->frameCount <= curFrame) && !this->animationChanged) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairySittingAnim); Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); @@ -628,10 +627,10 @@ void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* glob this->animationChanged = true; } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && - ((globalCtx->csCtx.npcActions[0] != NULL) && (globalCtx->csCtx.npcActions[0]->action == 3))) { + if ((play->csCtx.state != CS_STATE_IDLE) && + ((play->csCtx.npcActions[0] != NULL) && (play->csCtx.npcActions[0]->action == 3))) { this->finishedSpinGrow = this->animationChanged = false; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); @@ -644,7 +643,7 @@ void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* glob this->actionFunc = BgDyYoseizo_Give_Reward; } } - BgDyYoseizo_SpawnEffects(this, globalCtx, 0); + BgDyYoseizo_SpawnEffects(this, play, 0); } static s16 sDemoEffectLightColors[] = { DEMO_EFFECT_LIGHT_GREEN, DEMO_EFFECT_LIGHT_RED, DEMO_EFFECT_LIGHT_BLUE }; @@ -655,9 +654,9 @@ static s16 sItemGetFlags[] = { ITEMGETINF_18_MASK, ITEMGETINF_19_MASK, ITEMGETIN static u8 sItemIds[] = { ITEM_FARORES_WIND, ITEM_DINS_FIRE, ITEM_NAYRUS_LOVE }; -void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 actionIndex; s16 demoEffectParams; Vec3f itemPos; @@ -671,7 +670,7 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if ((this->frameCount <= curFrame) && !this->animationChanged) { - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); @@ -683,30 +682,30 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { this->animationChanged = true; } - if (globalCtx->csCtx.npcActions[0]->action == 13) { + if (play->csCtx.npcActions[0]->action == 13) { this->actionFunc = BgDyYoseizo_SetupSpinShrink; return; } - if ((globalCtx->csCtx.npcActions[0]->action >= 4) && (globalCtx->csCtx.npcActions[0]->action < 7)) { - actionIndex = globalCtx->csCtx.npcActions[0]->action - 4; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if ((play->csCtx.npcActions[0]->action >= 4) && (play->csCtx.npcActions[0]->action < 7)) { + actionIndex = play->csCtx.npcActions[0]->action - 4; + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { actionIndex++; - BgDyYoseizo_SpawnEffects(this, globalCtx, actionIndex); + BgDyYoseizo_SpawnEffects(this, play, actionIndex); } else if (!this->lightBallSpawned) { demoEffectParams = ((s16)(sDemoEffectLightColors[actionIndex] << 0xC) | DEMO_EFFECT_LIGHT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, (s32)demoEffectParams); + 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; } } else { - BgDyYoseizo_SpawnEffects(this, globalCtx, 0); + BgDyYoseizo_SpawnEffects(this, play, 0); } - if ((globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) && (globalCtx->csCtx.npcActions[0]->action >= 10) && - (globalCtx->csCtx.npcActions[0]->action < 13)) { - actionIndex = globalCtx->csCtx.npcActions[0]->action - 10; + if ((play->sceneNum == SCENE_DAIYOUSEI_IZUMI) && (play->csCtx.npcActions[0]->action >= 10) && + (play->csCtx.npcActions[0]->action < 13)) { + actionIndex = play->csCtx.npcActions[0]->action - 10; switch (actionIndex) { case FAIRY_UPGRADE_MAGIC: @@ -733,36 +732,35 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { gSaveContext.healthAccumulator = 0x140; this->healing = true; if (actionIndex == 2) { - Magic_Fill(globalCtx); + Magic_Fill(play); } } } - if ((globalCtx->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (globalCtx->csCtx.npcActions[0]->action >= 14) && - (globalCtx->csCtx.npcActions[0]->action < 17)) { - actionIndex = globalCtx->csCtx.npcActions[0]->action - 14; + if ((play->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (play->csCtx.npcActions[0]->action >= 14) && + (play->csCtx.npcActions[0]->action < 17)) { + actionIndex = play->csCtx.npcActions[0]->action - 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(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_ITEM, - itemPos.x, itemPos.y, itemPos.z, 0, 0, 0, sExItemTypes[actionIndex]); + this->item = (EnExItem*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, itemPos.x, + itemPos.y, itemPos.z, 0, 0, 0, sExItemTypes[actionIndex]); if (this->item != NULL) { if (gSaveContext.magicAcquired == 0) { gSaveContext.magicAcquired = 1; } else { - Magic_Fill(globalCtx); + Magic_Fill(play); } this->itemSpawned = true; gSaveContext.healthAccumulator = 0x140; Interface_ChangeAlpha(9); gSaveContext.itemGetInf[ITEMGETINF_18_19_1A_INDEX] |= sItemGetFlags[actionIndex]; - Item_Give(globalCtx, sItemIds[actionIndex]); + Item_Give(play, sItemIds[actionIndex]); } } else { this->item->actor.world.pos.x = player->actor.world.pos.x; @@ -773,13 +771,13 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { } } - if ((globalCtx->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (globalCtx->csCtx.npcActions[0]->action == 17) && + if ((play->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (play->csCtx.npcActions[0]->action == 17) && (this->item != NULL)) { Actor_Kill(&this->item->actor); this->item = NULL; } - if ((globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) && (globalCtx->csCtx.npcActions[0]->action == 18)) { + if ((play->sceneNum == SCENE_DAIYOUSEI_IZUMI) && (play->csCtx.npcActions[0]->action == 18)) { this->giveDefenseHearts = true; } @@ -789,18 +787,18 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { } } - if ((globalCtx->csCtx.npcActions[0]->action >= 19) && (globalCtx->csCtx.npcActions[0]->action < 22) && + if ((play->csCtx.npcActions[0]->action >= 19) && (play->csCtx.npcActions[0]->action < 22) && !this->warpEffectSpawned) { - actionIndex = globalCtx->csCtx.npcActions[0]->action - 11; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, player->actor.world.pos.x, - player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, actionIndex); + actionIndex = play->csCtx.npcActions[0]->action - 11; + 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, actionIndex); this->warpEffectSpawned = true; } - BgDyYoseizo_Bob(this, globalCtx); + BgDyYoseizo_Bob(this, play); } -void BgDyYoseizo_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgDyYoseizo_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgDyYoseizo* this = (BgDyYoseizo*)thisx; s32 sfx; @@ -816,24 +814,24 @@ void BgDyYoseizo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unusedTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { sfx = 0; - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { - if ((globalCtx->csCtx.frames == 32) || (globalCtx->csCtx.frames == 291) || - (globalCtx->csCtx.frames == 426) || (globalCtx->csCtx.frames == 851)) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI) { + if ((play->csCtx.frames == 32) || (play->csCtx.frames == 291) || (play->csCtx.frames == 426) || + (play->csCtx.frames == 851)) { sfx = 1; } - if (globalCtx->csCtx.frames == 101) { + if (play->csCtx.frames == 101) { sfx = 2; } } else { - if ((globalCtx->csCtx.frames == 35) || (globalCtx->csCtx.frames == 181) || - (globalCtx->csCtx.frames == 462) || (globalCtx->csCtx.frames == 795)) { + if ((play->csCtx.frames == 35) || (play->csCtx.frames == 181) || (play->csCtx.frames == 462) || + (play->csCtx.frames == 795)) { sfx = 1; } - if (globalCtx->csCtx.frames == 90) { + if (play->csCtx.frames == 90) { sfx = 2; } } @@ -859,13 +857,12 @@ void BgDyYoseizo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->heightOffset = this->scale * 7500.0f; Actor_SetFocus(&this->actor, this->heightOffset); this->actor.focus.pos.y = this->heightOffset; - func_80038290(globalCtx, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); - BgDyYoseizo_UpdateEffects(this, globalCtx); + func_80038290(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); + BgDyYoseizo_UpdateEffects(this, play); Actor_SetScale(&this->actor, this->scale); } -s32 BgDyYoseizo_OverrideLimbDraw(GlobalContext* globalCtx, 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 = (BgDyYoseizo*)thisx; if (limbIndex == 8) { // Torso @@ -889,12 +886,12 @@ static void* sMouthTextures[] = { gGreatFairyMouthOpenTex, // Open }; -void BgDyYoseizo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgDyYoseizo_Draw(Actor* thisx, PlayState* play) { BgDyYoseizo* this = (BgDyYoseizo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_dy_yoseizo.c", 1609); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_dy_yoseizo.c", 1609); if (this->actionFunc != BgDyYoseizo_Vanish) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeState])); @@ -904,11 +901,11 @@ void BgDyYoseizo_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthState])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, BgDyYoseizo_OverrideLimbDraw, NULL, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + BgDyYoseizo_OverrideLimbDraw, NULL, this); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_dy_yoseizo.c", 1629); - BgDyYoseizo_DrawEffects(this, globalCtx); + 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, @@ -938,9 +935,9 @@ void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVeloc } } -void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, GlobalContext* globalCtx) { +void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, PlayState* play) { BgDyYoseizoEffect* effect = this->effects; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f sp94; Vec3f sp88; f32 goalPitch; @@ -1002,14 +999,14 @@ void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, GlobalContext* globalCtx) { } } -void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 materialFlag = 0; BgDyYoseizoEffect* effect = this->effects; s16 i; OPEN_DISPS(gfxCtx, "../z_bg_dy_yoseizo.c", 1767); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) { if (effect->alive == 1) { @@ -1025,7 +1022,7 @@ void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, GlobalContext* globalCtx) { 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); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(effect->roll, MTXMODE_APPLY); 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 d77987077f..a1b6765931 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 @@ -8,7 +8,7 @@ struct BgDyYoseizo; -typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, GlobalContext*); +typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, PlayState*); #define BG_DY_YOSEIZO_EFFECT_COUNT 200 diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index b1971b5342..f94a47ce87 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -16,14 +16,14 @@ typedef enum { /* 0x02 */ FLASH_SHRINK } FlashState; -void BgGanonOtyuka_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGanonOtyuka_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGanonOtyuka_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGanonOtyuka_Init(Actor* thisx, PlayState* play); +void BgGanonOtyuka_Destroy(Actor* thisx, PlayState* play); +void BgGanonOtyuka_Update(Actor* thisx, PlayState* play); +void BgGanonOtyuka_Draw(Actor* thisx, PlayState* play); -void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx); -void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx); -void BgGanonOtyuka_DoNothing(Actor* thisx, GlobalContext* globalCtx); +void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play); +void BgGanonOtyuka_Fall(BgGanonOtyuka* this, PlayState* play); +void BgGanonOtyuka_DoNothing(Actor* thisx, PlayState* play); const ActorInit Bg_Ganon_Otyuka_InitVars = { ACTOR_BG_GANON_OTYUKA, @@ -65,15 +65,15 @@ static f32 sSideAngles[] = { M_PI / 2, -M_PI / 2, 0.0f, M_PI }; #include "overlays/ovl_Bg_Ganon_Otyuka/ovl_Bg_Ganon_Otyuka.c" -void BgGanonOtyuka_Init(Actor* thisx, GlobalContext* globalCtx2) { +void BgGanonOtyuka_Init(Actor* thisx, PlayState* play2) { BgGanonOtyuka* this = (BgGanonOtyuka*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&sCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); if (thisx->params != 0x23) { thisx->draw = NULL; @@ -83,18 +83,18 @@ void BgGanonOtyuka_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void BgGanonOtyuka_Destroy(Actor* thisx, GlobalContext* globalCtx2) { +void BgGanonOtyuka_Destroy(Actor* thisx, PlayState* play2) { BgGanonOtyuka* this = (BgGanonOtyuka*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("WHY !!!!!!!!!!!!!!!!\n"); osSyncPrintf(VT_RST); } -void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx) { +void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) { Actor* thisx = &this->dyna.actor; Actor* prop; BgGanonOtyuka* platform; @@ -104,11 +104,11 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx) { Vec3f center; s16 i; - if (this->isFalling || ((globalCtx->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < SQ(70.0f)))) { + if (this->isFalling || ((play->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < SQ(70.0f)))) { osSyncPrintf("OTC O 1\n"); for (i = 0; i < ARRAY_COUNT(D_80876A68); i++) { - prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + prop = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (prop != NULL) { if ((prop == thisx) || (prop->id != ACTOR_BG_GANON_OTYUKA)) { prop = prop->next; @@ -136,7 +136,7 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx) { center.x = this->dyna.actor.world.pos.x + D_80876A68[i].x; center.y = this->dyna.actor.world.pos.y; center.z = this->dyna.actor.world.pos.z + D_80876A68[i].z; - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, ¢er, 50.0f)) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, ¢er, 50.0f)) { this->unwalledSides |= sSides[i]; } } @@ -157,8 +157,8 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx) { } } -void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgGanonOtyuka_Fall(BgGanonOtyuka* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 i; Vec3f pos; Vec3f velocity; @@ -207,12 +207,12 @@ void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(150.0f) + this->dyna.actor.world.pos.x; pos.y = Rand_ZeroFloat(60.0f) + -750.0f; pos.z = Rand_CenteredFloat(150.0f) + this->dyna.actor.world.pos.z; - func_8002836C(globalCtx, &pos, &velocity, &accel, &sDustPrimColor, &sDustEnvColor, + func_8002836C(play, &pos, &velocity, &accel, &sDustPrimColor, &sDustEnvColor, (s16)Rand_ZeroFloat(100.0f) + 250, 5, (s16)Rand_ZeroFloat(5.0f) + 15); } - func_80033DB8(globalCtx, 10, 15); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_BOX_BREAK); + func_80033DB8(play, 10, 15); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_BOX_BREAK); } Actor_Kill(&this->dyna.actor); } @@ -230,33 +230,33 @@ void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx) { osSyncPrintf("MODE DOWN END\n"); } -void BgGanonOtyuka_DoNothing(Actor* thisx, GlobalContext* globalCtx) { +void BgGanonOtyuka_DoNothing(Actor* thisx, PlayState* play) { } -void BgGanonOtyuka_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGanonOtyuka_Update(Actor* thisx, PlayState* play) { BgGanonOtyuka* this = (BgGanonOtyuka*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->flashTimer++; if (this->dropTimer != 0) { this->dropTimer--; } } -void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgGanonOtyuka_Draw(Actor* thisx, PlayState* play) { BgGanonOtyuka* this = (BgGanonOtyuka*)thisx; s16 i; Gfx* phi_s2; Gfx* phi_s1; - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); Actor* actor; BgGanonOtyuka* platform; BossGanon* ganondorf; f32 spBC = -30.0f; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_ganon_otyuka.c", 702); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_ganon_otyuka.c", 702); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].head; + actor = play->actorCtx.actorLists[ACTORCAT_BOSS].head; while (actor != NULL) { if (actor->id == ACTOR_BOSS_GANON) { ganondorf = (BossGanon*)actor; @@ -273,10 +273,10 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { actor = actor->next; } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, sPlatformMaterialDL); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + actor = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (actor != NULL) { if (actor->id == ACTOR_BG_GANON_OTYUKA) { platform = (BgGanonOtyuka*)actor; @@ -299,7 +299,7 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { phi_s1 = sPlatformTopDL; } } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ganon_otyuka.c", 766), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_ganon_otyuka.c", 766), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, phi_s2); @@ -312,8 +312,7 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); Matrix_Translate(sSideCenters[i].x, 0.0f, sSideCenters[i].z, MTXMODE_APPLY); Matrix_RotateY(sSideAngles[i], MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, - Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ganon_otyuka.c", 785), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_ganon_otyuka.c", 785), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sPlatformSideDL); Matrix_Pop(); @@ -325,15 +324,15 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { actor = actor->next; } - func_80093D84(globalCtx->state.gfxCtx); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + func_80093D84(play->state.gfxCtx); + actor = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (actor != NULL) { if (actor->id == ACTOR_BG_GANON_OTYUKA) { platform = (BgGanonOtyuka*)actor; if ((platform->dyna.actor.projectedPos.z > -30.0f) && (platform->flashState != FLASH_NONE)) { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, platform->flashTimer * 4, 0, 32, 64, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, platform->flashTimer * 4, 0, 32, 64, 1, platform->flashTimer * 4, 0, 32, 64)); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, platform->flashPrimColorR, platform->flashPrimColorG, @@ -348,8 +347,7 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(sSideCenters[i].x, 0.0f, sSideCenters[i].z, MTXMODE_APPLY); Matrix_RotateY(sSideAngles[i], MTXMODE_APPLY); Matrix_Scale(0.3f, platform->flashYScale * 0.3f, 0.3f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, - Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ganon_otyuka.c", 847), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_ganon_otyuka.c", 847), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sFlashDL); Matrix_Pop(); @@ -361,5 +359,5 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { actor = actor->next; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_ganon_otyuka.c", 857); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_ganon_otyuka.c", 857); } diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h index 79ba15e6d3..376130ae54 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h @@ -12,7 +12,7 @@ struct BgGanonOtyuka; -typedef void (*BgGanonOtyukaActionFunc)(struct BgGanonOtyuka*, GlobalContext*); +typedef void (*BgGanonOtyukaActionFunc)(struct BgGanonOtyuka*, PlayState*); typedef struct BgGanonOtyuka { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c index 8df264d1d1..3d378ae8b2 100644 --- a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c +++ b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c @@ -10,15 +10,15 @@ #define FLAGS 0 -void BgGateShutter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGateShutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGateShutter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGateShutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGateShutter_Init(Actor* thisx, PlayState* play); +void BgGateShutter_Destroy(Actor* thisx, PlayState* play); +void BgGateShutter_Update(Actor* thisx, PlayState* play); +void BgGateShutter_Draw(Actor* thisx, PlayState* play); -void func_8087828C(BgGateShutter* this, GlobalContext* globalCtx); -void func_80878300(BgGateShutter* this, GlobalContext* globalCtx); -void func_808783AC(BgGateShutter* this, GlobalContext* globalCtx); -void func_808783D4(BgGateShutter* this, GlobalContext* globalCtx); +void func_8087828C(BgGateShutter* this, PlayState* play); +void func_80878300(BgGateShutter* this, PlayState* play); +void func_808783AC(BgGateShutter* this, PlayState* play); +void func_808783D4(BgGateShutter* this, PlayState* play); const ActorInit Bg_Gate_Shutter_InitVars = { ACTOR_BG_GATE_SHUTTER, @@ -32,18 +32,18 @@ const ActorInit Bg_Gate_Shutter_InitVars = { (ActorFunc)BgGateShutter_Draw, }; -void BgGateShutter_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGateShutter_Init(Actor* thisx, PlayState* play) { BgGateShutter* this = (BgGateShutter*)thisx; s32 pad[2]; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gKakarikoGuardGateCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->somePos.x = thisx->world.pos.x; this->somePos.y = thisx->world.pos.y; this->somePos.z = thisx->world.pos.z; - if ((GET_INFTABLE(INFTABLE_76) || GET_EVENTCHKINF(EVENTCHKINF_45)) && (globalCtx->sceneNum == SCENE_SPOT01)) { + if ((GET_INFTABLE(INFTABLE_76) || GET_EVENTCHKINF(EVENTCHKINF_45)) && (play->sceneNum == SCENE_SPOT01)) { thisx->world.pos.x = -89.0f; thisx->world.pos.z = -1375.0f; } @@ -55,13 +55,13 @@ void BgGateShutter_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_8087828C; } -void BgGateShutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgGateShutter_Destroy(Actor* thisx, PlayState* play) { BgGateShutter* this = (BgGateShutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8087828C(BgGateShutter* this, GlobalContext* globalCtx) { +void func_8087828C(BgGateShutter* this, PlayState* play) { if (this->openingState == 1 && !GET_INFTABLE(INFTABLE_76)) { this->unk_178 = 2; this->actionFunc = func_80878300; @@ -74,7 +74,7 @@ void func_8087828C(BgGateShutter* this, GlobalContext* globalCtx) { } } -void func_80878300(BgGateShutter* this, GlobalContext* globalCtx) { +void func_80878300(BgGateShutter* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (this->unk_178 == 0) { @@ -89,14 +89,14 @@ void func_80878300(BgGateShutter* this, GlobalContext* globalCtx) { } } -void func_808783AC(BgGateShutter* this, GlobalContext* globalCtx) { +void func_808783AC(BgGateShutter* this, PlayState* play) { if (this->unk_178 == 0) { this->openingState = 0; this->actionFunc = func_8087828C; } } -void func_808783D4(BgGateShutter* this, GlobalContext* globalCtx) { +void func_808783D4(BgGateShutter* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (this->unk_178 == 0) { @@ -112,23 +112,23 @@ void func_808783D4(BgGateShutter* this, GlobalContext* globalCtx) { } } -void BgGateShutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGateShutter_Update(Actor* thisx, PlayState* play) { BgGateShutter* this = (BgGateShutter*)thisx; if (this->unk_178 != 0) { this->unk_178 -= 1; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgGateShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 323); +void BgGateShutter_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_gate_shutter.c", 323); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 328), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_gate_shutter.c", 328), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gKakarikoGuardGateDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 333); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_gate_shutter.c", 333); } diff --git a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h index 4f93b6778b..cad1651215 100644 --- a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h +++ b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h @@ -6,7 +6,7 @@ struct BgGateShutter; -typedef void (*BgGateShutterActionFunc)(struct BgGateShutter*, GlobalContext*); +typedef void (*BgGateShutterActionFunc)(struct BgGateShutter*, PlayState*); typedef struct BgGateShutter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c index bb5a068cbe..88bb9d233a 100644 --- a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c +++ b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c @@ -10,14 +10,14 @@ #define FLAGS 0 -void BgGjyoBridge_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGjyoBridge_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGjyoBridge_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGjyoBridge_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGjyoBridge_Init(Actor* thisx, PlayState* play); +void BgGjyoBridge_Destroy(Actor* thisx, PlayState* play); +void BgGjyoBridge_Update(Actor* thisx, PlayState* play); +void BgGjyoBridge_Draw(Actor* thisx, PlayState* play); -void func_808787A4(BgGjyoBridge* this, GlobalContext* globalCtx); -void BgGjyoBridge_TriggerCutscene(BgGjyoBridge* this, GlobalContext* globalCtx); -void BgGjyoBridge_SpawnBridge(BgGjyoBridge* this, GlobalContext* globalCtx); +void func_808787A4(BgGjyoBridge* this, PlayState* play); +void BgGjyoBridge_TriggerCutscene(BgGjyoBridge* this, PlayState* play); +void BgGjyoBridge_SpawnBridge(BgGjyoBridge* this, PlayState* play); const ActorInit Bg_Gjyo_Bridge_InitVars = { ACTOR_BG_GJYO_BRIDGE, @@ -36,7 +36,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgGjyoBridge_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGjyoBridge_Init(Actor* thisx, PlayState* play) { BgGjyoBridge* this = (BgGjyoBridge*)thisx; s32 pad; CollisionHeader* colHeader; @@ -47,73 +47,72 @@ void BgGjyoBridge_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gRainbowBridgeCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); if (GET_EVENTCHKINF(EVENTCHKINF_4D)) { this->actionFunc = func_808787A4; } else { this->dyna.actor.draw = NULL; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgGjyoBridge_TriggerCutscene; } } -void BgGjyoBridge_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgGjyoBridge_Destroy(Actor* thisx, PlayState* play) { BgGjyoBridge* this = (BgGjyoBridge*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808787A4(BgGjyoBridge* this, GlobalContext* globalCtx) { +void func_808787A4(BgGjyoBridge* this, PlayState* play) { } -void BgGjyoBridge_TriggerCutscene(BgGjyoBridge* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgGjyoBridge_TriggerCutscene(BgGjyoBridge* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && (INV_CONTENT(ITEM_ARROW_LIGHT) == ITEM_ARROW_LIGHT) && (player->actor.world.pos.x > -70.0f) && (player->actor.world.pos.x < 300.0f) && (player->actor.world.pos.y > 1340.0f) && - (player->actor.world.pos.z > 1340.0f) && (player->actor.world.pos.z < 1662.0f) && !Play_InCsMode(globalCtx)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gRainbowBridgeCs); + (player->actor.world.pos.z > 1340.0f) && (player->actor.world.pos.z < 1662.0f) && !Play_InCsMode(play)) { + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gRainbowBridgeCs); gSaveContext.cutsceneTrigger = 1; this->actionFunc = BgGjyoBridge_SpawnBridge; } } -void BgGjyoBridge_SpawnBridge(BgGjyoBridge* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[2] != NULL) && - (globalCtx->csCtx.npcActions[2]->action == 2)) { +void BgGjyoBridge_SpawnBridge(BgGjyoBridge* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[2] != NULL) && + (play->csCtx.npcActions[2]->action == 2)) { this->dyna.actor.draw = BgGjyoBridge_Draw; - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); SET_EVENTCHKINF(EVENTCHKINF_4D); } } -void BgGjyoBridge_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGjyoBridge_Update(Actor* thisx, PlayState* play) { BgGjyoBridge* this = (BgGjyoBridge*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgGjyoBridge_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgGjyoBridge_Draw(Actor* thisx, PlayState* play) { BgGjyoBridge* this = (BgGjyoBridge*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gjyo_bridge.c", 260); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_gjyo_bridge.c", 260); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TexScroll(globalCtx->state.gfxCtx, globalCtx->gameplayFrames & 127, - globalCtx->gameplayFrames * -3 & 127, 32, 32)); + Gfx_TexScroll(play->state.gfxCtx, play->gameplayFrames & 127, play->gameplayFrames * -3 & 127, 32, 32)); gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -globalCtx->gameplayFrames & 127, 32, 32, 1, 0, - globalCtx->gameplayFrames & 127, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, -play->gameplayFrames & 127, 32, 32, 1, 0, + play->gameplayFrames & 127, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gjyo_bridge.c", 281), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_gjyo_bridge.c", 281), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gRainbowBridgeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gjyo_bridge.c", 285); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_gjyo_bridge.c", 285); } diff --git a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.h b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.h index f0e74dbaf4..0ca02453bf 100644 --- a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.h +++ b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.h @@ -6,7 +6,7 @@ struct BgGjyoBridge; -typedef void (*BgGjyoBridgeActionFunc)(struct BgGjyoBridge*, GlobalContext*); +typedef void (*BgGjyoBridgeActionFunc)(struct BgGjyoBridge*, PlayState*); typedef struct BgGjyoBridge { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c index 03bc820a94..4621d2d615 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c @@ -9,17 +9,17 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgGndDarkmeiro_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGndDarkmeiro_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGndDarkmeiro_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGndDarkmeiro_DrawInvisiblePath(Actor* thisx, GlobalContext* globalCtx); -void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, GlobalContext* globalCtx); -void BgGndDarkmeiro_DrawStaticBlock(Actor* thisx, GlobalContext* globalCtx); +void BgGndDarkmeiro_Init(Actor* thisx, PlayState* play); +void BgGndDarkmeiro_Destroy(Actor* thisx, PlayState* play); +void BgGndDarkmeiro_Update(Actor* thisx, PlayState* play); +void BgGndDarkmeiro_DrawInvisiblePath(Actor* thisx, PlayState* play); +void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, PlayState* play); +void BgGndDarkmeiro_DrawStaticBlock(Actor* thisx, PlayState* play); -void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, GlobalContext* globalCtx); -void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, GlobalContext* globalCtx); -void BgGndDarkmeiro_UpdateStaticBlock(BgGndDarkmeiro* this, GlobalContext* globalCtx); -void BgGndDarkmeiro_UpdateSwitchBlock(BgGndDarkmeiro* this, GlobalContext* globalCtx); +void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, PlayState* play); +void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, PlayState* play); +void BgGndDarkmeiro_UpdateStaticBlock(BgGndDarkmeiro* this, PlayState* play); +void BgGndDarkmeiro_UpdateSwitchBlock(BgGndDarkmeiro* this, PlayState* play); const ActorInit Bg_Gnd_Darkmeiro_InitVars = { ACTOR_BG_GND_DARKMEIRO, @@ -33,20 +33,20 @@ const ActorInit Bg_Gnd_Darkmeiro_InitVars = { NULL, }; -void BgGndDarkmeiro_ToggleBlock(BgGndDarkmeiro* this, GlobalContext* globalCtx) { +void BgGndDarkmeiro_ToggleBlock(BgGndDarkmeiro* this, PlayState* play) { if (this->actionFlags & 2) { if (this->timer1 == 0) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFlags &= ~2; } } else if (this->timer1 != 0) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFlags |= 2; } } -void BgGndDarkmeiro_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgGndDarkmeiro_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; CollisionHeader* colHeader = NULL; BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx; @@ -59,7 +59,7 @@ void BgGndDarkmeiro_Init(Actor* thisx, GlobalContext* globalCtx2) { break; case DARKMEIRO_CLEAR_BLOCK: CollisionHeader_GetVirtual(&gClearBlockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (((this->dyna.actor.params >> 8) & 0x3F) == 0x3F) { this->updateFunc = BgGndDarkmeiro_UpdateStaticBlock; this->dyna.actor.draw = BgGndDarkmeiro_DrawStaticBlock; @@ -67,8 +67,8 @@ void BgGndDarkmeiro_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFlags = this->timer1 = this->timer2 = 0; thisx->draw = BgGndDarkmeiro_DrawSwitchBlock; this->updateFunc = BgGndDarkmeiro_UpdateSwitchBlock; - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } else { this->timer1 = 64; this->actionFlags |= 2; @@ -79,45 +79,45 @@ void BgGndDarkmeiro_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFlags = this->timer1 = this->timer2 = 0; this->updateFunc = BgGndDarkmeiro_UpdateBlockTimer; thisx->draw = NULL; - if (Flags_GetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) { + if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) { this->timer1 = 64; this->actionFlags |= 4; } - if (Flags_GetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) { + if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) { this->timer2 = 64; this->actionFlags |= 8; } if ((this->timer1 != 0) || (this->timer2 != 0)) { - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); } else { - Flags_UnsetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); } break; } } -void BgGndDarkmeiro_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgGndDarkmeiro_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx; if ((this->dyna.actor.params & 0xFF) == 1) { if (1) {} - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, GlobalContext* globalCtx) { +void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, PlayState* play) { } -void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, GlobalContext* globalCtx) { +void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, PlayState* play) { s16 timeLeft; - if (Flags_GetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) { + if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) { if (this->actionFlags & 4) { if (this->timer1 > 0) { this->timer1--; } else { - Flags_UnsetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 1); + Flags_UnsetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1); this->actionFlags &= ~4; } } else { @@ -128,12 +128,12 @@ void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, GlobalContext* global } } - if (Flags_GetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) { + if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) { if (this->actionFlags & 8) { if (this->timer2 > 0) { this->timer2--; } else { - Flags_UnsetSwitch(globalCtx, ((this->dyna.actor.params >> 8) & 0x3F) + 2); + Flags_UnsetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2); this->actionFlags &= ~8; } } else { @@ -149,39 +149,39 @@ void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, GlobalContext* global func_8002F994(&this->dyna.actor, timeLeft); } if ((this->timer1 >= 64) || (this->timer2 >= 64)) { - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); } else { - Flags_UnsetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); } } -void BgGndDarkmeiro_UpdateStaticBlock(BgGndDarkmeiro* this, GlobalContext* globalCtx) { +void BgGndDarkmeiro_UpdateStaticBlock(BgGndDarkmeiro* this, PlayState* play) { } -void BgGndDarkmeiro_UpdateSwitchBlock(BgGndDarkmeiro* this, GlobalContext* globalCtx) { +void BgGndDarkmeiro_UpdateSwitchBlock(BgGndDarkmeiro* this, PlayState* play) { if (this->timer1 > 0) { this->timer1--; } - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { this->timer1 = 64; } - BgGndDarkmeiro_ToggleBlock(this, globalCtx); + BgGndDarkmeiro_ToggleBlock(this, play); } -void BgGndDarkmeiro_Update(Actor* thisx, GlobalContext* globalCtx2) { +void BgGndDarkmeiro_Update(Actor* thisx, PlayState* play2) { BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; - this->updateFunc(this, globalCtx2); + this->updateFunc(this, play2); } -void BgGndDarkmeiro_DrawInvisiblePath(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListXlu(globalCtx, gShadowTrialPathDL); +void BgGndDarkmeiro_DrawInvisiblePath(Actor* thisx, PlayState* play) { + Gfx_DrawDListXlu(play, gShadowTrialPathDL); } -void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, GlobalContext* globalCtx) { +void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, PlayState* play) { BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx; s16 vanishTimer; @@ -198,19 +198,19 @@ void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, GlobalContext* globalCtx) { this->timer2 = vanishTimer * 8; } - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_darkmeiro.c", 378); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_gnd_darkmeiro.c", 378); //! @bug Due to a bug in the display list, the transparency data is not used. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 198, 202, 208, this->timer2); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_darkmeiro.c", 380); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_gnd_darkmeiro.c", 380); - Gfx_DrawDListXlu(globalCtx, gClearBlockDL); + Gfx_DrawDListXlu(play, gClearBlockDL); } } -void BgGndDarkmeiro_DrawStaticBlock(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_darkmeiro.c", 391); +void BgGndDarkmeiro_DrawStaticBlock(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_gnd_darkmeiro.c", 391); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 198, 202, 208, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_darkmeiro.c", 393); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_gnd_darkmeiro.c", 393); - Gfx_DrawDListXlu(globalCtx, gClearBlockDL); + Gfx_DrawDListXlu(play, gClearBlockDL); } diff --git a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h index 05bafd06d2..0899a3abab 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h +++ b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h @@ -6,7 +6,7 @@ struct BgGndDarkmeiro; -typedef void (*BgGndDarkmeiroUpdateFunc)(struct BgGndDarkmeiro*, GlobalContext*); +typedef void (*BgGndDarkmeiroUpdateFunc)(struct BgGndDarkmeiro*, PlayState*); typedef struct BgGndDarkmeiro { /* 0x0000 */ DynaPolyActor dyna; 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 cb82194d39..91273db9d4 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 @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgGndFiremeiro_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGndFiremeiro_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGndFiremeiro_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGndFiremeiro_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGndFiremeiro_Init(Actor* thisx, PlayState* play); +void BgGndFiremeiro_Destroy(Actor* thisx, PlayState* play); +void BgGndFiremeiro_Update(Actor* thisx, PlayState* play); +void BgGndFiremeiro_Draw(Actor* thisx, PlayState* play); -void BgGndFiremeiro_Sink(BgGndFiremeiro* this, GlobalContext* globalCtx); -void BgGndFiremeiro_Shake(BgGndFiremeiro* this, GlobalContext* globalCtx); -void BgGndFiremeiro_Rise(BgGndFiremeiro* this, GlobalContext* globalCtx); +void BgGndFiremeiro_Sink(BgGndFiremeiro* this, PlayState* play); +void BgGndFiremeiro_Shake(BgGndFiremeiro* this, PlayState* play); +void BgGndFiremeiro_Rise(BgGndFiremeiro* this, PlayState* play); const ActorInit Bg_Gnd_Firemeiro_InitVars = { ACTOR_BG_GND_FIREMEIRO, @@ -30,7 +30,7 @@ const ActorInit Bg_Gnd_Firemeiro_InitVars = { (ActorFunc)BgGndFiremeiro_Draw, }; -void BgGndFiremeiro_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGndFiremeiro_Init(Actor* thisx, PlayState* play) { s32 pad; BgGndFiremeiro* this = (BgGndFiremeiro*)thisx; CollisionHeader* colHeader = NULL; @@ -42,22 +42,22 @@ void BgGndFiremeiro_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->dyna.actor.params == 0) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gFireTrialPlatformCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->actionFunc = BgGndFiremeiro_Rise; } } -void BgGndFiremeiro_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgGndFiremeiro_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgGndFiremeiro* this = (BgGndFiremeiro*)thisx; if (this->dyna.actor.params == 0) { if (1) {} - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void BgGndFiremeiro_Sink(BgGndFiremeiro* this, GlobalContext* globalCtx) { +void BgGndFiremeiro_Sink(BgGndFiremeiro* this, PlayState* play) { f32 sunkHeight = this->initPos.y - 150.0f; if (func_8004356C(&this->dyna)) { @@ -81,7 +81,7 @@ void BgGndFiremeiro_Sink(BgGndFiremeiro* this, GlobalContext* globalCtx) { } } -void BgGndFiremeiro_Shake(BgGndFiremeiro* this, GlobalContext* globalCtx) { +void BgGndFiremeiro_Shake(BgGndFiremeiro* this, PlayState* play) { s32 pad; f32 randSign; @@ -110,8 +110,8 @@ void BgGndFiremeiro_Shake(BgGndFiremeiro* this, GlobalContext* globalCtx) { } } -void BgGndFiremeiro_Rise(BgGndFiremeiro* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgGndFiremeiro_Rise(BgGndFiremeiro* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->dyna.actor; if ((player->currentBoots != PLAYER_BOOTS_HOVER) && func_8004356C(&this->dyna)) { // Player standing on it @@ -132,19 +132,19 @@ void BgGndFiremeiro_Rise(BgGndFiremeiro* this, GlobalContext* globalCtx) { } } -void BgGndFiremeiro_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGndFiremeiro_Update(Actor* thisx, PlayState* play) { BgGndFiremeiro* this = (BgGndFiremeiro*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgGndFiremeiro_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_firemeiro.c", 280); - func_800943C8(globalCtx->state.gfxCtx); +void BgGndFiremeiro_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_gnd_firemeiro.c", 280); + func_800943C8(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gnd_firemeiro.c", 282), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_gnd_firemeiro.c", 282), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFireTrialPlatformDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_firemeiro.c", 285); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_gnd_firemeiro.c", 285); } 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 1a9a55ffe9..60a2254cf3 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 @@ -6,7 +6,7 @@ struct BgGndFiremeiro; -typedef void (*BgGndFiremeiroActionFunc)(struct BgGndFiremeiro*, GlobalContext*); +typedef void (*BgGndFiremeiroActionFunc)(struct BgGndFiremeiro*, PlayState*); typedef struct BgGndFiremeiro { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c index 41618506be..36f70a7e7e 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c @@ -15,13 +15,13 @@ typedef enum { /* 2 */ GNDICE_HOLE } BgGndIceblockAction; -void BgGndIceblock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGndIceblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGndIceblock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGndIceblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGndIceblock_Init(Actor* thisx, PlayState* play); +void BgGndIceblock_Destroy(Actor* thisx, PlayState* play); +void BgGndIceblock_Update(Actor* thisx, PlayState* play); +void BgGndIceblock_Draw(Actor* thisx, PlayState* play); -void BgGndIceblock_Idle(BgGndIceblock* this, GlobalContext* globalCtx); -void BgGndIceblock_Slide(BgGndIceblock* this, GlobalContext* globalCtx); +void BgGndIceblock_Idle(BgGndIceblock* this, PlayState* play); +void BgGndIceblock_Slide(BgGndIceblock* this, PlayState* play); const ActorInit Bg_Gnd_Iceblock_InitVars = { ACTOR_BG_GND_ICEBLOCK, @@ -44,7 +44,7 @@ static InitChainEntry sInitChain[] = { static u8 sBlockPositions[2]; -void BgGndIceblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGndIceblock_Init(Actor* thisx, PlayState* play) { s32 pad; BgGndIceblock* this = (BgGndIceblock*)thisx; CollisionHeader* colHeader = NULL; @@ -54,7 +54,7 @@ void BgGndIceblock_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gWaterTrialIceBlockCol, &colHeader); this->targetPos = this->dyna.actor.home.pos; this->actionFunc = BgGndIceblock_Idle; - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.actor.world.pos.x == 2792.0f) { this->dyna.actor.params = 0; sBlockPositions[0] = 7; @@ -67,11 +67,11 @@ void BgGndIceblock_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgGndIceblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgGndIceblock_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgGndIceblock* this = (BgGndIceblock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } /* @@ -231,15 +231,15 @@ void BgGndIceblock_SetNextPosition(BgGndIceblock* this) { } } -void BgGndIceblock_Idle(BgGndIceblock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgGndIceblock_Idle(BgGndIceblock* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~PLAYER_STATE2_4; if (this->dyna.unk_150 > 0.0f) { BgGndIceblock_SetNextPosition(this); if (Actor_WorldDistXZToPoint(&this->dyna.actor, &this->targetPos) > 1.0f) { - func_8002DF54(globalCtx, &this->dyna.actor, 8); + func_8002DF54(play, &this->dyna.actor, 8); this->actionFunc = BgGndIceblock_Slide; } } @@ -247,8 +247,8 @@ void BgGndIceblock_Idle(BgGndIceblock* this, GlobalContext* globalCtx) { } } -void BgGndIceblock_Reset(BgGndIceblock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgGndIceblock_Reset(BgGndIceblock* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { @@ -270,7 +270,7 @@ void BgGndIceblock_Reset(BgGndIceblock* this, GlobalContext* globalCtx) { } } -void BgGndIceblock_Fall(BgGndIceblock* this, GlobalContext* globalCtx) { +void BgGndIceblock_Fall(BgGndIceblock* this, PlayState* play) { Actor* thisx = &this->dyna.actor; thisx->velocity.y += 1.0f; @@ -279,27 +279,27 @@ void BgGndIceblock_Fall(BgGndIceblock* this, GlobalContext* globalCtx) { thisx->world.pos.x = thisx->home.pos.x; thisx->world.pos.y = thisx->home.pos.y - 100.0f; thisx->world.pos.z = thisx->home.pos.z; - if (Player_InCsMode(globalCtx)) { - func_8002DF54(globalCtx, thisx, 7); + if (Player_InCsMode(play)) { + func_8002DF54(play, thisx, 7); } this->actionFunc = BgGndIceblock_Reset; } } -void BgGndIceblock_Hole(BgGndIceblock* this, GlobalContext* globalCtx) { +void BgGndIceblock_Hole(BgGndIceblock* this, PlayState* play) { Actor* thisx = &this->dyna.actor; thisx->velocity.y += 1.0f; if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y - 100.0f, thisx->velocity.y)) { thisx->velocity.y = 0.0f; - if (Player_InCsMode(globalCtx)) { - func_8002DF54(globalCtx, thisx, 7); + if (Player_InCsMode(play)) { + func_8002DF54(play, thisx, 7); } this->actionFunc = BgGndIceblock_Idle; } } -void BgGndIceblock_Slide(BgGndIceblock* this, GlobalContext* globalCtx) { +void BgGndIceblock_Slide(BgGndIceblock* this, PlayState* play) { s32 atTarget; Vec3f pos; Vec3f velocity; @@ -317,7 +317,7 @@ void BgGndIceblock_Slide(BgGndIceblock* this, GlobalContext* globalCtx) { switch (BgGndIceblock_NextAction(this)) { case GNDICE_IDLE: this->actionFunc = BgGndIceblock_Idle; - func_8002DF54(globalCtx, thisx, 7); + func_8002DF54(play, thisx, 7); break; case GNDICE_FALL: this->actionFunc = BgGndIceblock_Fall; @@ -334,25 +334,25 @@ void BgGndIceblock_Slide(BgGndIceblock* this, GlobalContext* globalCtx) { pos.x = thisx->world.pos.x - (60.0f * Math_SinS(this->dyna.unk_158)) - (Math_CosS(this->dyna.unk_158) * spread); pos.z = thisx->world.pos.z - (60.0f * Math_CosS(this->dyna.unk_158)) + (Math_SinS(this->dyna.unk_158) * spread); pos.y = thisx->world.pos.y; - func_8002829C(globalCtx, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); + func_8002829C(play, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); spread = Rand_CenteredFloat(120.0f); pos.x = thisx->world.pos.x - (60.0f * Math_SinS(this->dyna.unk_158)) + (Math_CosS(this->dyna.unk_158) * spread); pos.z = thisx->world.pos.z - (60.0f * Math_CosS(this->dyna.unk_158)) - (Math_SinS(this->dyna.unk_158) * spread); - func_8002829C(globalCtx, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); + func_8002829C(play, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); func_8002F974(thisx, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); } } -void BgGndIceblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGndIceblock_Update(Actor* thisx, PlayState* play) { s32 pad; BgGndIceblock* this = (BgGndIceblock*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgGndIceblock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgGndIceblock_Draw(Actor* thisx, PlayState* play) { s32 pad; BgGndIceblock* this = (BgGndIceblock*)thisx; - Gfx_DrawDListOpa(globalCtx, gWaterTrialIceBlockDL); + Gfx_DrawDListOpa(play, gWaterTrialIceBlockDL); } diff --git a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.h b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.h index 0010de14a9..1d9da28f7b 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.h +++ b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.h @@ -6,7 +6,7 @@ struct BgGndIceblock; -typedef void (*BgGndIceblockActionFunc)(struct BgGndIceblock*, GlobalContext*); +typedef void (*BgGndIceblockActionFunc)(struct BgGndIceblock*, PlayState*); typedef struct BgGndIceblock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c index 5385e46995..60fc8a4b3a 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c @@ -9,10 +9,10 @@ #define FLAGS ACTOR_FLAG_4 -void BgGndNisekabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGndNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGndNisekabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGndNisekabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGndNisekabe_Init(Actor* thisx, PlayState* play); +void BgGndNisekabe_Destroy(Actor* thisx, PlayState* play); +void BgGndNisekabe_Update(Actor* thisx, PlayState* play); +void BgGndNisekabe_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Gnd_Nisekabe_InitVars = { ACTOR_BG_GND_NISEKABE, @@ -26,27 +26,27 @@ const ActorInit Bg_Gnd_Nisekabe_InitVars = { (ActorFunc)BgGndNisekabe_Draw, }; -void BgGndNisekabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGndNisekabe_Init(Actor* thisx, PlayState* play) { BgGndNisekabe* this = (BgGndNisekabe*)thisx; Actor_SetScale(&this->actor, 0.1); this->actor.uncullZoneForward = 3000.0; } -void BgGndNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgGndNisekabe_Destroy(Actor* thisx, PlayState* play) { } -void BgGndNisekabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGndNisekabe_Update(Actor* thisx, PlayState* play) { BgGndNisekabe* this = (BgGndNisekabe*)thisx; - if (globalCtx->actorCtx.lensActive) { + if (play->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_7; } else { this->actor.flags &= ~ACTOR_FLAG_7; } } -void BgGndNisekabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgGndNisekabe_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gLightTrialFakeWallDL, gGanonsCastleUnusedFakeWallDL, @@ -56,8 +56,8 @@ void BgGndNisekabe_Draw(Actor* thisx, GlobalContext* globalCtx) { u32 index = this->actor.params & 0xFF; if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { - Gfx_DrawDListXlu(globalCtx, dLists[index]); + Gfx_DrawDListXlu(play, dLists[index]); } else { - Gfx_DrawDListOpa(globalCtx, dLists[index]); + Gfx_DrawDListOpa(play, dLists[index]); } } diff --git a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c index 26147ce7b4..5809caf564 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c @@ -10,14 +10,14 @@ #define FLAGS 0 -void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGndSoulmeiro_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGndSoulmeiro_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGndSoulmeiro_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGndSoulmeiro_Init(Actor* thisx, PlayState* play); +void BgGndSoulmeiro_Destroy(Actor* thisx, PlayState* play); +void BgGndSoulmeiro_Update(Actor* thisx, PlayState* play); +void BgGndSoulmeiro_Draw(Actor* thisx, PlayState* play); -void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx); -void func_8087B284(BgGndSoulmeiro* this, GlobalContext* globalCtx); -void func_8087B350(BgGndSoulmeiro* this, GlobalContext* globalCtx); +void func_8087AF38(BgGndSoulmeiro* this, PlayState* play); +void func_8087B284(BgGndSoulmeiro* this, PlayState* play); +void func_8087B350(BgGndSoulmeiro* this, PlayState* play); const ActorInit Bg_Gnd_Soulmeiro_InitVars = { ACTOR_BG_GND_SOULMEIRO, @@ -58,7 +58,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGndSoulmeiro_Init(Actor* thisx, PlayState* play) { s32 pad; BgGndSoulmeiro* this = (BgGndSoulmeiro*)thisx; @@ -67,13 +67,13 @@ void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params & 0xFF) { case 0: - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actionFunc = func_8087B284; - if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 9); + Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 9); this->actor.draw = NULL; Actor_Kill(&this->actor); return; @@ -83,7 +83,7 @@ void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx) { break; case 1: case 2: - if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { this->actor.draw = BgGndSoulmeiro_Draw; } else { this->actor.draw = NULL; @@ -93,15 +93,15 @@ void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgGndSoulmeiro_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgGndSoulmeiro_Destroy(Actor* thisx, PlayState* play) { BgGndSoulmeiro* this = (BgGndSoulmeiro*)thisx; if ((this->actor.params & 0xFF) == 0) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) { +void func_8087AF38(BgGndSoulmeiro* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f vecA; Vec3f vecB; @@ -112,16 +112,16 @@ void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) { } if (this->unk_198 == 20) { - Flags_SetSwitch(globalCtx, (thisx->params >> 8) & 0x3F); + Flags_SetSwitch(play, (thisx->params >> 8) & 0x3F); thisx->draw = NULL; } // This should be this->unk_198 == 0, this is required to match if (!this->unk_198) { - Flags_SetSwitch(globalCtx, (thisx->params >> 8) & 0x3F); + Flags_SetSwitch(play, (thisx->params >> 8) & 0x3F); Actor_Kill(&this->actor); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, thisx->world.pos.x, thisx->world.pos.y, - thisx->world.pos.z, 0, 0, 0, 9); + Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 0, + 0, 0, 9); } else if ((this->unk_198 % 6) == 0) { s32 i; s16 temp_2 = Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f @@ -149,17 +149,17 @@ void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) { vecA.x = 4.0f * temp_3 * distXZ; vecA.y = 0.0f; vecA.z = 4.0f * temp_4 * distXZ; - EffectSsDeadDb_Spawn(globalCtx, &thisx->home.pos, &vecA, &zeroVec, 60, 6, 255, 255, 150, 170, 255, 0, 0, 1, - 14, true); + EffectSsDeadDb_Spawn(play, &thisx->home.pos, &vecA, &zeroVec, 60, 6, 255, 255, 150, 170, 255, 0, 0, 1, 14, + true); temp_2 += 0x2AAA; } } } -void func_8087B284(BgGndSoulmeiro* this, GlobalContext* globalCtx) { +void func_8087B284(BgGndSoulmeiro* this, PlayState* play) { s32 pad; - if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { + if (!Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { this->actor.draw = BgGndSoulmeiro_Draw; if (this->collider.base.acFlags & AC_HIT) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -168,28 +168,28 @@ void func_8087B284(BgGndSoulmeiro* this, GlobalContext* globalCtx) { this->actionFunc = func_8087AF38; } else { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -void func_8087B350(BgGndSoulmeiro* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { +void func_8087B350(BgGndSoulmeiro* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { this->actor.draw = BgGndSoulmeiro_Draw; } else { this->actor.draw = NULL; } } -void BgGndSoulmeiro_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGndSoulmeiro_Update(Actor* thisx, PlayState* play) { BgGndSoulmeiro* this = (BgGndSoulmeiro*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgGndSoulmeiro_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgGndSoulmeiro_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gSpiritTrialWebDL, gSpiritTrialLightSourceDL, @@ -201,18 +201,18 @@ void BgGndSoulmeiro_Draw(Actor* thisx, GlobalContext* globalCtx) { switch (params) { case 0: - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 398); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 400), + OPEN_DISPS(play->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 398); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 400), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, dLists[params]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 403); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 403); break; case 1: - Gfx_DrawDListXlu(globalCtx, dLists[params]); + Gfx_DrawDListXlu(play, dLists[params]); break; case 2: - Gfx_DrawDListOpa(globalCtx, dLists[params]); + Gfx_DrawDListOpa(play, dLists[params]); break; } } diff --git a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.h b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.h index 1d7024fff8..cbf9b854d4 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.h +++ b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.h @@ -6,7 +6,7 @@ struct BgGndSoulmeiro; -typedef void (*BgGndSoulmeiroActionFunc)(struct BgGndSoulmeiro*, GlobalContext*); +typedef void (*BgGndSoulmeiroActionFunc)(struct BgGndSoulmeiro*, PlayState*); typedef struct BgGndSoulmeiro { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c index cbf40164e1..60a585b22a 100644 --- a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c +++ b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgHaka_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHaka_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHaka_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHaka_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHaka_Init(Actor* thisx, PlayState* play); +void BgHaka_Destroy(Actor* thisx, PlayState* play); +void BgHaka_Update(Actor* thisx, PlayState* play); +void BgHaka_Draw(Actor* thisx, PlayState* play); void func_8087B758(BgHaka* this, Player* player); -void func_8087B7E8(BgHaka* this, GlobalContext* globalCtx); -void func_8087B938(BgHaka* this, GlobalContext* globalCtx); -void func_8087BAAC(BgHaka* this, GlobalContext* globalCtx); -void func_8087BAE4(BgHaka* this, GlobalContext* globalCtx); +void func_8087B7E8(BgHaka* this, PlayState* play); +void func_8087B938(BgHaka* this, PlayState* play); +void func_8087BAAC(BgHaka* this, PlayState* play); +void func_8087BAE4(BgHaka* this, PlayState* play); const ActorInit Bg_Haka_InitVars = { ACTOR_BG_HAKA, @@ -37,7 +37,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHaka_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHaka_Init(Actor* thisx, PlayState* play) { BgHaka* this = (BgHaka*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -45,14 +45,14 @@ void BgHaka_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gGravestoneCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->actionFunc = func_8087B7E8; } -void BgHaka_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHaka_Destroy(Actor* thisx, PlayState* play) { BgHaka* this = (BgHaka*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_8087B758(BgHaka* this, Player* player) { @@ -64,20 +64,20 @@ void func_8087B758(BgHaka* this, Player* player) { } } -void func_8087B7E8(BgHaka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8087B7E8(BgHaka* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { - if (globalCtx->sceneNum == SCENE_SPOT02 && !LINK_IS_ADULT && IS_DAY) { + if (play->sceneNum == SCENE_SPOT02 && !LINK_IS_ADULT && IS_DAY) { this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~PLAYER_STATE2_4; - if (!Play_InCsMode(globalCtx)) { - Message_StartTextbox(globalCtx, 0x5073, NULL); + if (!Play_InCsMode(play)) { + Message_StartTextbox(play, 0x5073, NULL); this->dyna.actor.params = 100; this->actionFunc = func_8087BAE4; } } else if (0.0f < this->dyna.unk_150 || - (globalCtx->sceneNum == SCENE_SPOT06 && !LINK_IS_ADULT && !Flags_GetSwitch(globalCtx, 0x23))) { + (play->sceneNum == SCENE_SPOT06 && !LINK_IS_ADULT && !Flags_GetSwitch(play, 0x23))) { this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~PLAYER_STATE2_4; } else { @@ -88,8 +88,8 @@ void func_8087B7E8(BgHaka* this, GlobalContext* globalCtx) { func_8087B758(this, player); } -void func_8087B938(BgHaka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8087B938(BgHaka* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 sp38; this->dyna.actor.speedXZ += 0.05f; @@ -104,18 +104,17 @@ void func_8087B938(BgHaka* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~PLAYER_STATE2_4; if (this->dyna.actor.params == 1) { func_80078884(NA_SE_SY_CORRECT_CHIME); - } else if (!IS_DAY && globalCtx->sceneNum == SCENE_SPOT02) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_POH, this->dyna.actor.home.pos.x, - this->dyna.actor.home.pos.y, this->dyna.actor.home.pos.z, 0, this->dyna.actor.shape.rot.y, 0, - 1); + } else if (!IS_DAY && play->sceneNum == SCENE_SPOT02) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_POH, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, + this->dyna.actor.home.pos.z, 0, this->dyna.actor.shape.rot.y, 0, 1); } this->actionFunc = func_8087BAAC; } func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void func_8087BAAC(BgHaka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8087BAAC(BgHaka* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { this->dyna.unk_150 = 0.0f; @@ -123,8 +122,8 @@ void func_8087BAAC(BgHaka* this, GlobalContext* globalCtx) { } } -void func_8087BAE4(BgHaka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8087BAE4(BgHaka* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; if (this->dyna.actor.params != 0) { @@ -140,25 +139,25 @@ void func_8087BAE4(BgHaka* this, GlobalContext* globalCtx) { func_8087B758(this, player); } -void BgHaka_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHaka_Update(Actor* thisx, PlayState* play) { BgHaka* this = (BgHaka*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHaka_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka.c", 401); +void BgHaka_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka.c", 401); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka.c", 406), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka.c", 406), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGravestoneStoneDL); Matrix_Translate(0.0f, 0.0f, thisx->minVelocityY * 10.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka.c", 416), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka.c", 416), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGravestoneEarthDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka.c", 421); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka.c", 421); } diff --git a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.h b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.h index 20d71be2b6..093cab70fa 100644 --- a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.h +++ b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.h @@ -6,7 +6,7 @@ struct BgHaka; -typedef void (*BgHakaActionFunc)(struct BgHaka*, GlobalContext*); +typedef void (*BgHakaActionFunc)(struct BgHaka*, PlayState*); typedef struct BgHaka { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index ec61b26122..6a8872035e 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -30,21 +30,21 @@ #define SKULL_OF_TRUTH_FOUND 100 -void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaGate_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaGate_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaGate_Draw(Actor* this, GlobalContext* globalCtx); +void BgHakaGate_Init(Actor* thisx, PlayState* play); +void BgHakaGate_Destroy(Actor* thisx, PlayState* play); +void BgHakaGate_Update(Actor* thisx, PlayState* play); +void BgHakaGate_Draw(Actor* this, PlayState* play); -void BgHakaGate_DoNothing(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_FloorOpen(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_GateWait(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_GateOpen(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_SkullOfTruth(BgHakaGate* this, GlobalContext* globalCtx); -void BgHakaGate_FalseSkull(BgHakaGate* this, GlobalContext* globalCtx); +void BgHakaGate_DoNothing(BgHakaGate* this, PlayState* play); +void BgHakaGate_StatueInactive(BgHakaGate* this, PlayState* play); +void BgHakaGate_StatueIdle(BgHakaGate* this, PlayState* play); +void BgHakaGate_StatueTurn(BgHakaGate* this, PlayState* play); +void BgHakaGate_FloorClosed(BgHakaGate* this, PlayState* play); +void BgHakaGate_FloorOpen(BgHakaGate* this, PlayState* play); +void BgHakaGate_GateWait(BgHakaGate* this, PlayState* play); +void BgHakaGate_GateOpen(BgHakaGate* this, PlayState* play); +void BgHakaGate_SkullOfTruth(BgHakaGate* this, PlayState* play); +void BgHakaGate_FalseSkull(BgHakaGate* this, PlayState* play); static s16 sSkullOfTruthRotY = 0x100; static u8 sPuzzleState = 1; @@ -68,7 +68,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaGate_Init(Actor* thisx, PlayState* play) { s32 pad; BgHakaGate* this = (BgHakaGate*)thisx; CollisionHeader* colHeader = NULL; @@ -84,7 +84,7 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) { if ((Rand_ZeroOne() * 3.0f) < sPuzzleState) { this->vIsSkullOfTruth = true; sSkullOfTruthRotY = thisx->shape.rot.y + 0x8000; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgHakaGate_DoNothing; } else { this->actionFunc = BgHakaGate_SkullOfTruth; @@ -98,7 +98,7 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) { } this->vScrollTimer = Rand_ZeroOne() * 20.0f; thisx->flags |= ACTOR_FLAG_4; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->vFlameScale = 350; } } else { @@ -106,21 +106,21 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_haka_objects_Col_0131C4, &colHeader); this->vTimer = 0; sStatueDistToPlayer = 0.0f; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgHakaGate_StatueInactive; } else { this->actionFunc = BgHakaGate_StatueIdle; } } else if (thisx->params == BGHAKAGATE_FLOOR) { CollisionHeader_GetVirtual(&object_haka_objects_Col_010E10, &colHeader); - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgHakaGate_DoNothing; } else { this->actionFunc = BgHakaGate_FloorClosed; } } else { // BGHAKAGATE_GATE CollisionHeader_GetVirtual(&object_haka_objects_Col_00A938, &colHeader); - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgHakaGate_DoNothing; thisx->world.pos.y += 80.0f; } else { @@ -129,26 +129,26 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHakaGate_GateWait; } } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } } -void BgHakaGate_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaGate_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgHakaGate* this = (BgHakaGate*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if (this->dyna.actor.params == BGHAKAGATE_STATUE) { sSkullOfTruthRotY = 0x100; sPuzzleState = 1; } } -void BgHakaGate_DoNothing(BgHakaGate* this, GlobalContext* globalCtx) { +void BgHakaGate_DoNothing(BgHakaGate* this, PlayState* play) { } -void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHakaGate_StatueInactive(BgHakaGate* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~PLAYER_STATE2_4; @@ -156,8 +156,8 @@ void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx) { } } -void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHakaGate_StatueIdle(BgHakaGate* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 linkDirection; f32 forceDirection; @@ -185,8 +185,8 @@ void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx) { } } -void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHakaGate_StatueTurn(BgHakaGate* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 turnFinished; s16 turnAngle; @@ -218,9 +218,9 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx) { +void BgHakaGate_FloorClosed(BgHakaGate* this, PlayState* play) { if ((sStatueDistToPlayer > 1.0f) && (sStatueRotY != 0)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 radialDist; f32 angDist; f32 cos = Math_CosS(sStatueRotY); @@ -236,13 +236,13 @@ void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx) { sStatueDistToPlayer = 0.0f; if (ABS(yawDiff) < 0x80) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); sPuzzleState = SKULL_OF_TRUTH_FOUND; this->actionFunc = BgHakaGate_DoNothing; } else { func_80078884(NA_SE_SY_ERROR); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_GROUND_GATE_OPEN); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->vTimer = 60; this->actionFunc = BgHakaGate_FloorOpen; } @@ -250,13 +250,13 @@ void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx) { } } -void BgHakaGate_FloorOpen(BgHakaGate* this, GlobalContext* globalCtx) { +void BgHakaGate_FloorOpen(BgHakaGate* this, PlayState* play) { if (this->vTimer != 0) { this->vTimer--; } if (this->vTimer == 0) { if (Math_ScaledStepToS(&this->vOpenAngle, 0, 0x800)) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgHakaGate_FloorClosed; } } else { @@ -264,14 +264,14 @@ void BgHakaGate_FloorOpen(BgHakaGate* this, GlobalContext* globalCtx) { } } -void BgHakaGate_GateWait(BgHakaGate* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); +void BgHakaGate_GateWait(BgHakaGate* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { + OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = BgHakaGate_GateOpen; } } -void BgHakaGate_GateOpen(BgHakaGate* this, GlobalContext* globalCtx) { +void BgHakaGate_GateOpen(BgHakaGate* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 80.0f, 1.0f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_STOP); this->dyna.actor.flags &= ~ACTOR_FLAG_4; @@ -281,61 +281,61 @@ void BgHakaGate_GateOpen(BgHakaGate* this, GlobalContext* globalCtx) { } } -void BgHakaGate_SkullOfTruth(BgHakaGate* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag) && Math_StepToS(&this->vFlameScale, 350, 20)) { +void BgHakaGate_SkullOfTruth(BgHakaGate* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag) && Math_StepToS(&this->vFlameScale, 350, 20)) { this->actionFunc = BgHakaGate_DoNothing; } } -void BgHakaGate_FalseSkull(BgHakaGate* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +void BgHakaGate_FalseSkull(BgHakaGate* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { Math_StepToS(&this->vFlameScale, 350, 20); } - if (globalCtx->actorCtx.lensActive) { + if (play->actorCtx.lensActive) { this->dyna.actor.flags |= ACTOR_FLAG_7; } else { this->dyna.actor.flags &= ~ACTOR_FLAG_7; } } -void BgHakaGate_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaGate_Update(Actor* thisx, PlayState* play) { s32 pad; BgHakaGate* this = (BgHakaGate*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->dyna.actor.params == BGHAKAGATE_SKULL) { this->vScrollTimer++; } } -void BgHakaGate_DrawFlame(BgHakaGate* this, GlobalContext* globalCtx) { +void BgHakaGate_DrawFlame(BgHakaGate* this, PlayState* play) { Actor* thisx = &this->dyna.actor; f32 scale; if (this->vFlameScale > 0) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 716); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_gate.c", 716); if (1) {} - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - (this->vScrollTimer * -20) & 0x1FF, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->vScrollTimer * -20) & 0x1FF, + 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y + 15.0f, thisx->world.pos.z, MTXMODE_NEW); - Matrix_RotateY(BINANG_TO_RAD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); scale = this->vFlameScale * 0.00001f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 744), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka_gate.c", 744), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 749); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_gate.c", 749); } } -void BgHakaGate_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaGate_Draw(Actor* thisx, PlayState* play) { static Gfx* displayLists[] = { object_haka_objects_DL_012270, object_haka_objects_DL_010A10, @@ -346,31 +346,31 @@ void BgHakaGate_Draw(Actor* thisx, GlobalContext* globalCtx) { MtxF currentMtxF; if (CHECK_FLAG_ALL(thisx->flags, ACTOR_FLAG_7)) { - Gfx_DrawDListXlu(globalCtx, object_haka_objects_DL_00F1B0); + Gfx_DrawDListXlu(play, object_haka_objects_DL_00F1B0); } else { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (thisx->params == BGHAKAGATE_FLOOR) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 781); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_gate.c", 781); Matrix_Get(¤tMtxF); Matrix_Translate(0.0f, 0.0f, -2000.0f, MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD(this->vOpenAngle), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 2000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 788), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka_gate.c", 788), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_010A10); Matrix_Put(¤tMtxF); Matrix_Translate(0.0f, 0.0f, 2000.0f, MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD(-this->vOpenAngle), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -2000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 796), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka_gate.c", 796), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_010C10); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 800); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_gate.c", 800); } else { - Gfx_DrawDListOpa(globalCtx, displayLists[thisx->params]); + Gfx_DrawDListOpa(play, displayLists[thisx->params]); } } if (thisx->params == BGHAKAGATE_SKULL) { - BgHakaGate_DrawFlame(this, globalCtx); + BgHakaGate_DrawFlame(this, play); } } diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h index 005cdefc29..d111c64b76 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h @@ -6,7 +6,7 @@ struct BgHakaGate; -typedef void (*BgHakaGateActionFunc)(struct BgHakaGate*, GlobalContext*); +typedef void (*BgHakaGateActionFunc)(struct BgHakaGate*, PlayState*); typedef struct BgHakaGate { /* 0x0000 */ DynaPolyActor dyna; 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 c56b019120..08ce5d4d5d 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 @@ -10,18 +10,18 @@ #define FLAGS ACTOR_FLAG_4 -void BgHakaHuta_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaHuta_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaHuta_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaHuta_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaHuta_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); -void BgHakaHuta_PlaySound(BgHakaHuta* this, GlobalContext* globalCtx, u16 sfx); -void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, GlobalContext* globalCtx); -void BgHakaHuta_Open(BgHakaHuta* this, GlobalContext* globalCtx); -void BgHakaHuta_SlideOpen(BgHakaHuta* this, GlobalContext* globalCtx); -void func_8087D720(BgHakaHuta* this, GlobalContext* globalCtx); -void BgHakaHuta_DoNothing(BgHakaHuta* this, GlobalContext* globalCtx); +void BgHakaHuta_SpawnDust(BgHakaHuta* this, PlayState* play); +void BgHakaHuta_PlaySound(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_8087D720(BgHakaHuta* this, PlayState* play); +void BgHakaHuta_DoNothing(BgHakaHuta* this, PlayState* play); const ActorInit Bg_Haka_Huta_InitVars = { ACTOR_BG_HAKA_HUTA, @@ -39,7 +39,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaHuta_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaHuta_Init(Actor* thisx, PlayState* play) { BgHakaHuta* this = (BgHakaHuta*)thisx; s16 pad; CollisionHeader* colHeader = NULL; @@ -47,10 +47,10 @@ void BgHakaHuta_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gBotwCoffinLidCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->unk_16A = (thisx->params >> 8) & 0xFF; thisx->params &= 0xFF; - if (Flags_GetSwitch(globalCtx, thisx->params)) { + if (Flags_GetSwitch(play, thisx->params)) { this->counter = -1; this->actionFunc = func_8087D720; } else { @@ -58,12 +58,12 @@ void BgHakaHuta_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgHakaHuta_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaHuta_Destroy(Actor* thisx, PlayState* play) { BgHakaHuta* this = (BgHakaHuta*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgHakaHuta_SpawnDust(BgHakaHuta* this, GlobalContext* globalCtx) { +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 }; @@ -90,27 +90,27 @@ void BgHakaHuta_SpawnDust(BgHakaHuta* this, GlobalContext* globalCtx) { } effectPos.x = this->dyna.actor.home.pos.x - (Rand_ZeroOne() * xPosOffset); scale = ((Rand_ZeroOne() * 10.0f) + 50.0f); - func_8002829C(globalCtx, &effectPos, &effectVel, sEffectAccel, &primColor, &envColor, scale, 0xA); + func_8002829C(play, &effectPos, &effectVel, sEffectAccel, &primColor, &envColor, scale, 0xA); } } -void BgHakaHuta_PlaySound(BgHakaHuta* this, GlobalContext* globalCtx, u16 sfx) { +void BgHakaHuta_PlaySound(BgHakaHuta* this, PlayState* play, u16 sfx) { Vec3f pos; 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; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &pos, 30, sfx); + SoundSource_PlaySfxAtFixedWorldPos(play, &pos, 30, sfx); } -void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params) && !Player_InCsMode(globalCtx)) { +void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params) && !Player_InCsMode(play)) { this->counter = 25; this->actionFunc = BgHakaHuta_Open; - OnePointCutscene_Init(globalCtx, 6001, 999, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 6001, 999, &this->dyna.actor, CAM_ID_MAIN); if (this->unk_16A == 2) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FIREFLY, + 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.y - 10.0f, @@ -118,7 +118,7 @@ void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, GlobalContext* globalCtx) { Math_CosS(this->dyna.actor.shape.rot.y) * 40.0f), 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 2); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FIREFLY, + 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.y - 10.0f, @@ -127,7 +127,7 @@ void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, GlobalContext* globalCtx) { 0, this->dyna.actor.shape.rot.y, 0, 2); } else if (this->unk_16A == 1) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_RD, + 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.y - 40.0f, @@ -138,7 +138,7 @@ void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, GlobalContext* globalCtx) { } } -void BgHakaHuta_Open(BgHakaHuta* this, GlobalContext* globalCtx) { +void BgHakaHuta_Open(BgHakaHuta* this, PlayState* play) { f32 posOffset; if (this->counter != 0) { @@ -148,12 +148,12 @@ void BgHakaHuta_Open(BgHakaHuta* this, GlobalContext* globalCtx) { 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_PlaySound(this, globalCtx, NA_SE_EV_COFFIN_CAP_OPEN); + BgHakaHuta_PlaySound(this, play, NA_SE_EV_COFFIN_CAP_OPEN); this->actionFunc = BgHakaHuta_SlideOpen; } } -void BgHakaHuta_SlideOpen(BgHakaHuta* this, GlobalContext* globalCtx) { +void BgHakaHuta_SlideOpen(BgHakaHuta* this, PlayState* play) { f32 posOffset; if (this->counter != 0) { @@ -161,15 +161,15 @@ void BgHakaHuta_SlideOpen(BgHakaHuta* this, GlobalContext* globalCtx) { } 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, globalCtx); + BgHakaHuta_SpawnDust(this, play); } if (this->counter == 0) { - BgHakaHuta_PlaySound(this, globalCtx, NA_SE_EV_COFFIN_CAP_BOUND); + BgHakaHuta_PlaySound(this, play, NA_SE_EV_COFFIN_CAP_BOUND); this->actionFunc = func_8087D720; } } -void func_8087D720(BgHakaHuta* this, GlobalContext* globalCtx) { +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; @@ -179,7 +179,7 @@ void func_8087D720(BgHakaHuta* this, GlobalContext* globalCtx) { this->counter++; if (this->counter == 6) { this->actionFunc = BgHakaHuta_DoNothing; - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 0x7530); Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0); Quake_SetCountdown(quakeIndex, 2); @@ -202,15 +202,15 @@ void func_8087D720(BgHakaHuta* this, GlobalContext* globalCtx) { Matrix_MtxFToYXZRotS(&mtx, &this->dyna.actor.shape.rot, 0); } -void BgHakaHuta_DoNothing(BgHakaHuta* this, GlobalContext* globalCtx) { +void BgHakaHuta_DoNothing(BgHakaHuta* this, PlayState* play) { } -void BgHakaHuta_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaHuta_Update(Actor* thisx, PlayState* play) { BgHakaHuta* this = (BgHakaHuta*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHakaHuta_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gBotwCoffinLidDL); +void BgHakaHuta_Draw(Actor* thisx, PlayState* play) { + 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 dff12e313a..8897772b01 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 @@ -6,7 +6,7 @@ struct BgHakaHuta; -typedef void (*BgHakaHutaActionFunc)(struct BgHakaHuta*, GlobalContext*); +typedef void (*BgHakaHutaActionFunc)(struct BgHakaHuta*, PlayState*); typedef struct BgHakaHuta { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index e097b5b59e..9b885bd9d1 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -10,14 +10,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_7) -void BgHakaMegane_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMegane_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMegane_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMegane_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaMegane_Init(Actor* thisx, PlayState* play); +void BgHakaMegane_Destroy(Actor* thisx, PlayState* play); +void BgHakaMegane_Update(Actor* thisx, PlayState* play); +void BgHakaMegane_Draw(Actor* thisx, PlayState* play); -void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx); -void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx); -void BgHakaMegane_DoNothing(BgHakaMegane* this, GlobalContext* globalCtx); +void func_8087DB24(BgHakaMegane* this, PlayState* play); +void func_8087DBF0(BgHakaMegane* this, PlayState* play); +void BgHakaMegane_DoNothing(BgHakaMegane* this, PlayState* play); const ActorInit Bg_Haka_Megane_InitVars = { ACTOR_BG_HAKA_MEGANE, @@ -59,16 +59,16 @@ static Gfx* sDLists[] = { object_haka_objects_DL_002ED0, }; -void BgHakaMegane_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMegane_Init(Actor* thisx, PlayState* play) { BgHakaMegane* this = (BgHakaMegane*)thisx; Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); if (thisx->params < 3) { - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKACH_OBJECTS); + this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS); } else { - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKA_OBJECTS); + this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS); } if (this->objBankIndex < 0) { @@ -78,26 +78,26 @@ void BgHakaMegane_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgHakaMegane_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMegane_Destroy(Actor* thisx, PlayState* play) { BgHakaMegane* this = (BgHakaMegane*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { +void func_8087DB24(BgHakaMegane* this, PlayState* play) { CollisionHeader* colHeader; CollisionHeader* collision; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->dyna.actor.objBankIndex = this->objBankIndex; this->dyna.actor.draw = BgHakaMegane_Draw; - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); - if (globalCtx->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { + Actor_SetObjectDependency(play, &this->dyna.actor); + if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { this->actionFunc = func_8087DBF0; collision = sCollisionHeaders[this->dyna.actor.params]; if (collision != NULL) { CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } } else { this->actionFunc = BgHakaMegane_DoNothing; @@ -105,37 +105,37 @@ void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { } } -void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { +void func_8087DBF0(BgHakaMegane* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - if (globalCtx->actorCtx.lensActive) { + if (play->actorCtx.lensActive) { thisx->flags |= ACTOR_FLAG_7; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } else { thisx->flags &= ~ACTOR_FLAG_7; - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } } -void BgHakaMegane_DoNothing(BgHakaMegane* this, GlobalContext* globalCtx) { +void BgHakaMegane_DoNothing(BgHakaMegane* this, PlayState* play) { } -void BgHakaMegane_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMegane_Update(Actor* thisx, PlayState* play) { BgHakaMegane* this = (BgHakaMegane*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHakaMegane_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMegane_Draw(Actor* thisx, PlayState* play) { BgHakaMegane* this = (BgHakaMegane*)thisx; if (CHECK_FLAG_ALL(thisx->flags, ACTOR_FLAG_7)) { - Gfx_DrawDListXlu(globalCtx, sDLists[thisx->params]); + Gfx_DrawDListXlu(play, sDLists[thisx->params]); } else { - Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]); + Gfx_DrawDListOpa(play, sDLists[thisx->params]); } if (thisx->params == 0) { - Gfx_DrawDListXlu(globalCtx, gBotwBloodSplatterDL); + Gfx_DrawDListXlu(play, gBotwBloodSplatterDL); } } diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h index dabde490e6..9de05508fc 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h @@ -6,7 +6,7 @@ struct BgHakaMegane; -typedef void (*BgHakaMeganeActionFunc)(struct BgHakaMegane*, GlobalContext*); +typedef void (*BgHakaMeganeActionFunc)(struct BgHakaMegane*, PlayState*); typedef struct BgHakaMegane { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c index 14a3cc90a0..012549d9e8 100644 --- a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c +++ b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c @@ -9,19 +9,19 @@ #define FLAGS 0 -void BgHakaMeganeBG_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMeganeBG_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMeganeBG_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaMeganeBG_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaMeganeBG_Init(Actor* thisx, PlayState* play); +void BgHakaMeganeBG_Destroy(Actor* thisx, PlayState* play); +void BgHakaMeganeBG_Update(Actor* thisx, PlayState* play); +void BgHakaMeganeBG_Draw(Actor* thisx, PlayState* play); -void func_8087DFF8(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E040(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E1E0(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E258(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E288(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E2D8(BgHakaMeganeBG* this, GlobalContext* globalCtx); -void func_8087E34C(BgHakaMeganeBG* this, GlobalContext* globalCtx); +void func_8087DFF8(BgHakaMeganeBG* this, PlayState* play); +void func_8087E040(BgHakaMeganeBG* this, PlayState* play); +void func_8087E10C(BgHakaMeganeBG* this, PlayState* play); +void func_8087E1E0(BgHakaMeganeBG* this, PlayState* play); +void func_8087E258(BgHakaMeganeBG* this, PlayState* play); +void func_8087E288(BgHakaMeganeBG* this, PlayState* play); +void func_8087E2D8(BgHakaMeganeBG* this, PlayState* play); +void func_8087E34C(BgHakaMeganeBG* this, PlayState* play); const ActorInit Bg_Haka_MeganeBG_InitVars = { ACTOR_BG_HAKA_MEGANEBG, @@ -53,7 +53,7 @@ static Gfx* D_8087E410[] = { object_haka_objects_DL_000040, }; -void BgHakaMeganeBG_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMeganeBG_Init(Actor* thisx, PlayState* play) { s32 pad; BgHakaMeganeBG* this = (BgHakaMeganeBG*)thisx; CollisionHeader* colHeader = NULL; @@ -79,7 +79,7 @@ void BgHakaMeganeBG_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_haka_objects_Col_000118, &colHeader); thisx->home.pos.y += 100.0f; - if (Flags_GetSwitch(globalCtx, this->unk_168)) { + if (Flags_GetSwitch(play, this->unk_168)) { this->actionFunc = func_8087E34C; thisx->world.pos.y = thisx->home.pos.y; } else { @@ -95,16 +95,16 @@ void BgHakaMeganeBG_Init(Actor* thisx, GlobalContext* globalCtx) { } } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgHakaMeganeBG_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMeganeBG_Destroy(Actor* thisx, PlayState* play) { BgHakaMeganeBG* this = (BgHakaMeganeBG*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8087DFF8(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087DFF8(BgHakaMeganeBG* this, PlayState* play) { if (this->unk_16A != 0) { this->unk_16A--; } @@ -116,7 +116,7 @@ void func_8087DFF8(BgHakaMeganeBG* this, GlobalContext* globalCtx) { } } -void func_8087E040(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E040(BgHakaMeganeBG* this, PlayState* play) { f32 xSub; if (this->unk_16A != 0) { @@ -137,7 +137,7 @@ void func_8087E040(BgHakaMeganeBG* this, GlobalContext* globalCtx) { } } -void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E10C(BgHakaMeganeBG* this, PlayState* play) { this->dyna.actor.velocity.y += 1.0f; if (this->dyna.actor.velocity.y > 20.0f) { @@ -162,7 +162,7 @@ void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx) { } } -void func_8087E1E0(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E1E0(BgHakaMeganeBG* this, PlayState* play) { Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 16.0f / 3.0f); func_8002F974(&this->dyna.actor, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG); @@ -176,19 +176,19 @@ void func_8087E1E0(BgHakaMeganeBG* this, GlobalContext* globalCtx) { } } -void func_8087E258(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E258(BgHakaMeganeBG* this, PlayState* play) { this->dyna.actor.shape.rot.y += 0x180; func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); } -void func_8087E288(BgHakaMeganeBG* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->unk_168)) { - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); +void func_8087E288(BgHakaMeganeBG* this, PlayState* play) { + if (Flags_GetSwitch(play, this->unk_168)) { + OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = func_8087E2D8; } } -void func_8087E2D8(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E2D8(BgHakaMeganeBG* this, PlayState* play) { Math_StepToF(&this->dyna.actor.speedXZ, 30.0f, 2.0f); if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.speedXZ)) { @@ -199,22 +199,22 @@ void func_8087E2D8(BgHakaMeganeBG* this, GlobalContext* globalCtx) { } } -void func_8087E34C(BgHakaMeganeBG* this, GlobalContext* globalCtx) { +void func_8087E34C(BgHakaMeganeBG* this, PlayState* play) { } -void BgHakaMeganeBG_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMeganeBG_Update(Actor* thisx, PlayState* play) { BgHakaMeganeBG* this = (BgHakaMeganeBG*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHakaMeganeBG_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaMeganeBG_Draw(Actor* thisx, PlayState* play) { BgHakaMeganeBG* this = (BgHakaMeganeBG*)thisx; s16 params = this->dyna.actor.params; if (params == 0) { - Gfx_DrawDListXlu(globalCtx, object_haka_objects_DL_008EB0); + Gfx_DrawDListXlu(play, object_haka_objects_DL_008EB0); } else { - Gfx_DrawDListOpa(globalCtx, D_8087E410[params]); + Gfx_DrawDListOpa(play, D_8087E410[params]); } } diff --git a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h index 18a0ba2389..933c49fbba 100644 --- a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h +++ b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h @@ -6,7 +6,7 @@ struct BgHakaMeganeBG; -typedef void (*BgHakaMeganeBGActionFunc)(struct BgHakaMeganeBG*, GlobalContext*); +typedef void (*BgHakaMeganeBGActionFunc)(struct BgHakaMeganeBG*, PlayState*); typedef struct BgHakaMeganeBG { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index 959b490945..ece790a049 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -18,13 +18,13 @@ typedef enum { #define SCYTHE_SPIN_TIME 32 -void BgHakaSgami_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaSgami_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaSgami_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaSgami_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaSgami_Init(Actor* thisx, PlayState* play); +void BgHakaSgami_Destroy(Actor* thisx, PlayState* play); +void BgHakaSgami_Update(Actor* thisx, PlayState* play); +void BgHakaSgami_Draw(Actor* thisx, PlayState* play); -void BgHakaSgami_SetupSpin(BgHakaSgami* this, GlobalContext* globalCtx); -void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx); +void BgHakaSgami_SetupSpin(BgHakaSgami* this, PlayState* play); +void BgHakaSgami_Spin(BgHakaSgami* this, PlayState* play); const ActorInit Bg_Haka_Sgami_InitVars = { ACTOR_BG_HAKA_SGAMI, @@ -126,7 +126,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaSgami_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaSgami_Init(Actor* thisx, PlayState* play) { static u8 sP1StartColor[] = { 250, 250, 250, 200 }; static u8 sP2StartColor[] = { 200, 200, 200, 130 }; static u8 sP1EndColor[] = { 200, 200, 200, 60 }; @@ -145,10 +145,10 @@ void BgHakaSgami_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->flags |= ACTOR_FLAG_7; } - Collider_InitTris(globalCtx, colliderScythe); - Collider_SetTris(globalCtx, colliderScythe, thisx, &sTrisInit, this->colliderScytheItems); - Collider_InitCylinder(globalCtx, &this->colliderScytheCenter); - Collider_SetCylinder(globalCtx, &this->colliderScytheCenter, thisx, &sCylinderInit); + Collider_InitTris(play, colliderScythe); + Collider_SetTris(play, colliderScythe, thisx, &sTrisInit, this->colliderScytheItems); + Collider_InitCylinder(play, &this->colliderScytheCenter); + Collider_SetCylinder(play, &this->colliderScytheCenter, thisx, &sCylinderInit); this->colliderScytheCenter.dim.pos.x = thisx->world.pos.x; this->colliderScytheCenter.dim.pos.y = thisx->world.pos.y; @@ -165,14 +165,14 @@ void BgHakaSgami_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.elemDuration = 10; blureInit.unkFlag = false; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureEffectIndex[0], EFFECT_BLURE1, 0, 0, &blureInit); - Effect_Add(globalCtx, &this->blureEffectIndex[1], EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blureEffectIndex[0], EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blureEffectIndex[1], EFFECT_BLURE1, 0, 0, &blureInit); if (thisx->params == SCYTHE_TRAP_SHADOW_TEMPLE) { - this->requiredObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKA_OBJECTS); + this->requiredObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS); thisx->flags &= ~ACTOR_FLAG_0; } else { - this->requiredObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_ICE_OBJECTS); + this->requiredObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_ICE_OBJECTS); this->colliderScytheCenter.dim.radius = 30; this->colliderScytheCenter.dim.height = 70; Actor_SetFocus(thisx, 40.0f); @@ -186,17 +186,17 @@ void BgHakaSgami_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHakaSgami_SetupSpin; } -void BgHakaSgami_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaSgami_Destroy(Actor* thisx, PlayState* play) { BgHakaSgami* this = (BgHakaSgami*)thisx; - Effect_Delete(globalCtx, this->blureEffectIndex[0]); - Effect_Delete(globalCtx, this->blureEffectIndex[1]); - Collider_DestroyTris(globalCtx, &this->colliderScythe); - Collider_DestroyCylinder(globalCtx, &this->colliderScytheCenter); + Effect_Delete(play, this->blureEffectIndex[0]); + Effect_Delete(play, this->blureEffectIndex[1]); + Collider_DestroyTris(play, &this->colliderScythe); + Collider_DestroyCylinder(play, &this->colliderScytheCenter); } -void BgHakaSgami_SetupSpin(BgHakaSgami* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { +void BgHakaSgami_SetupSpin(BgHakaSgami* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { this->actor.objBankIndex = this->requiredObjBankIndex; this->actor.draw = BgHakaSgami_Draw; this->timer = SCYTHE_SPIN_TIME; @@ -205,7 +205,7 @@ void BgHakaSgami_SetupSpin(BgHakaSgami* this, GlobalContext* globalCtx) { } } -void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx) { +void BgHakaSgami_Spin(BgHakaSgami* this, PlayState* play) { static Vec3f blureEffectVertices2[] = { { -20.0f, 50.0f, 130.0f }, { -50.0f, 33.0f, 20.0f }, @@ -259,7 +259,7 @@ void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx) { &scytheVertices[2]); } - if ((this->unk_151 == 0) || globalCtx->actorCtx.lensActive) { + if ((this->unk_151 == 0) || play->actorCtx.lensActive) { scytheVertices[0].x = this->actor.world.pos.x + blureEffectVertices1[this->actor.params].z * actorRotYSin + blureEffectVertices1[this->actor.params].x * actorRotYCos; scytheVertices[0].y = this->actor.world.pos.y + blureEffectVertices1[this->actor.params].y; @@ -280,29 +280,29 @@ void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx) { EffectBlure_AddVertex(Effect_GetByIndex(this->blureEffectIndex[1]), &scytheVertices[0], &scytheVertices[1]); } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderScythe.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderScytheCenter.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderScythe.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderScytheCenter.base); func_8002F974(&this->actor, NA_SE_EV_ROLLCUTTER_MOTOR - SFX_FLAG); } -void BgHakaSgami_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaSgami_Update(Actor* thisx, PlayState* play) { BgHakaSgami* this = (BgHakaSgami*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29)) || (this->actionFunc == BgHakaSgami_SetupSpin)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgHakaSgami_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaSgami_Draw(Actor* thisx, PlayState* play) { BgHakaSgami* this = (BgHakaSgami*)thisx; if (this->unk_151 != 0) { - Gfx_DrawDListXlu(globalCtx, object_haka_objects_DL_00BF20); + Gfx_DrawDListXlu(play, object_haka_objects_DL_00BF20); } else if (this->actor.params == SCYTHE_TRAP_SHADOW_TEMPLE) { - Gfx_DrawDListOpa(globalCtx, object_haka_objects_DL_00BF20); + Gfx_DrawDListOpa(play, object_haka_objects_DL_00BF20); } else { - Gfx_DrawDListOpa(globalCtx, object_ice_objects_DL_0021F0); + Gfx_DrawDListOpa(play, object_ice_objects_DL_0021F0); } } diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h index 2d97b47947..6f140a39c3 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h @@ -6,7 +6,7 @@ struct BgHakaSgami; -typedef void (*BgHakaSgamiActionFunc)(struct BgHakaSgami*, GlobalContext*); +typedef void (*BgHakaSgamiActionFunc)(struct BgHakaSgami*, PlayState*); typedef struct BgHakaSgami { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c index d6c507014b..8f5871dc2e 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c +++ b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c @@ -9,17 +9,17 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgHakaShip_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaShip_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaShip_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaShip_Draw(Actor* thisx, GlobalContext* globalCtx); -void BgHakaShip_ChildUpdatePosition(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_WaitForSong(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_CutsceneStationary(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_Move(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_SetupCrash(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_CrashShake(BgHakaShip* this, GlobalContext* globalCtx); -void BgHakaShip_CrashFall(BgHakaShip* this, GlobalContext* globalCtx); +void BgHakaShip_Init(Actor* thisx, PlayState* play); +void BgHakaShip_Destroy(Actor* thisx, PlayState* play); +void BgHakaShip_Update(Actor* thisx, PlayState* play); +void BgHakaShip_Draw(Actor* thisx, PlayState* play); +void BgHakaShip_ChildUpdatePosition(BgHakaShip* this, PlayState* play); +void BgHakaShip_WaitForSong(BgHakaShip* this, PlayState* play); +void BgHakaShip_CutsceneStationary(BgHakaShip* this, PlayState* play); +void BgHakaShip_Move(BgHakaShip* this, PlayState* play); +void BgHakaShip_SetupCrash(BgHakaShip* this, PlayState* play); +void BgHakaShip_CrashShake(BgHakaShip* this, PlayState* play); +void BgHakaShip_CrashFall(BgHakaShip* this, PlayState* play); const ActorInit Bg_Haka_Ship_InitVars = { ACTOR_BG_HAKA_SHIP, @@ -37,7 +37,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaShip_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaShip_Init(Actor* thisx, PlayState* play) { BgHakaShip* this = (BgHakaShip*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -55,25 +55,25 @@ void BgHakaShip_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_haka_objects_Col_00ED7C, &colHeader); this->actionFunc = BgHakaShip_ChildUpdatePosition; } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y - 0x4000; this->yOffset = 0; if (this->dyna.actor.params == 0 && - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_HAKA_SHIP, + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_HAKA_SHIP, this->dyna.actor.world.pos.x + -10.0f, this->dyna.actor.world.pos.y + 82.0f, this->dyna.actor.world.pos.z, 0, 0, 0, 1) == NULL) { Actor_Kill(&this->dyna.actor); } } -void BgHakaShip_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaShip_Destroy(Actor* thisx, PlayState* play) { BgHakaShip* this = (BgHakaShip*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); Audio_StopSfxByPos(&this->bellSoundPos); } -void BgHakaShip_ChildUpdatePosition(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_ChildUpdatePosition(BgHakaShip* this, PlayState* play) { Actor* parent = this->dyna.actor.parent; if (parent != NULL && parent->update != NULL) { @@ -85,8 +85,8 @@ void BgHakaShip_ChildUpdatePosition(BgHakaShip* this, GlobalContext* globalCtx) } } -void BgHakaShip_WaitForSong(BgHakaShip* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +void BgHakaShip_WaitForSong(BgHakaShip* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { if (this->counter) { this->counter--; } @@ -94,12 +94,12 @@ void BgHakaShip_WaitForSong(BgHakaShip* this, GlobalContext* globalCtx) { this->counter = 130; this->actionFunc = BgHakaShip_CutsceneStationary; osSyncPrintf("シーン 外輪船 ... アァクション!!\n"); - OnePointCutscene_Init(globalCtx, 3390, 999, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3390, 999, &this->dyna.actor, CAM_ID_MAIN); } } } -void BgHakaShip_CutsceneStationary(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_CutsceneStationary(BgHakaShip* this, PlayState* play) { if (this->counter) { this->counter--; } @@ -110,7 +110,7 @@ void BgHakaShip_CutsceneStationary(BgHakaShip* this, GlobalContext* globalCtx) { } } -void BgHakaShip_Move(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_Move(BgHakaShip* this, PlayState* play) { f32 distanceFromHome; Actor* child; @@ -127,10 +127,10 @@ void BgHakaShip_Move(BgHakaShip* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x - 7650.0f; this->dyna.actor.speedXZ = 0.0f; } - if (distanceFromHome > 7600.0f && !Play_InCsMode(globalCtx)) { + if (distanceFromHome > 7600.0f && !Play_InCsMode(play)) { this->counter = 40; this->dyna.actor.speedXZ = 0.0f; - Message_StartTextbox(globalCtx, 0x5071, NULL); + Message_StartTextbox(play, 0x5071, NULL); this->actionFunc = BgHakaShip_SetupCrash; } else { Math_StepToF(&this->dyna.actor.speedXZ, 4.0f, 0.2f); @@ -144,7 +144,7 @@ void BgHakaShip_Move(BgHakaShip* this, GlobalContext* globalCtx) { this->yOffset = sinf(this->counter * (M_PI / 25)) * 6144.0f; } -void BgHakaShip_SetupCrash(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_SetupCrash(BgHakaShip* this, PlayState* play) { if (this->counter) { this->counter--; } @@ -155,7 +155,7 @@ void BgHakaShip_SetupCrash(BgHakaShip* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->yOffset, 0, 128); } -void BgHakaShip_CrashShake(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_CrashShake(BgHakaShip* this, PlayState* play) { if (this->counter != 0) { this->counter--; } @@ -167,7 +167,7 @@ void BgHakaShip_CrashShake(BgHakaShip* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_BLOCKSINK - SFX_FLAG); } -void BgHakaShip_CrashFall(BgHakaShip* this, GlobalContext* globalCtx) { +void BgHakaShip_CrashFall(BgHakaShip* this, PlayState* play) { Actor* child; if (this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y > 2000.0f) { @@ -179,47 +179,47 @@ void BgHakaShip_CrashFall(BgHakaShip* this, GlobalContext* globalCtx) { } else { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCKSINK - SFX_FLAG); if ((this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y > 500.0f) && func_8004356C(&this->dyna)) { - Play_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); } } } -void BgHakaShip_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaShip_Update(Actor* thisx, PlayState* play) { BgHakaShip* this = (BgHakaShip*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->dyna.actor.params == 0) { Actor_MoveForward(&this->dyna.actor); } } -void BgHakaShip_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaShip_Draw(Actor* thisx, PlayState* play) { BgHakaShip* this = (BgHakaShip*)thisx; f32 angleTemp; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_ship.c", 528); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 528); + func_80093D18(play->state.gfxCtx); if (this->dyna.actor.params == 0) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_ship.c", 534), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka_ship.c", 534), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_00D330); angleTemp = BINANG_TO_RAD(this->yOffset); Matrix_Translate(-3670.0f, 620.0f, 1150.0f, MTXMODE_APPLY); Matrix_RotateZ(angleTemp, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_ship.c", 547), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka_ship.c", 547), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_005A70); Matrix_Translate(0.0f, 0.0f, -2300.0f, MTXMODE_APPLY); Matrix_RotateZ(-(2.0f * angleTemp), MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_ship.c", 556), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka_ship.c", 556), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_005A70); } else { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_ship.c", 562), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka_ship.c", 562), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_00E910); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_ship.c", 568); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 568); if (this->actionFunc == BgHakaShip_CutsceneStationary || this->actionFunc == BgHakaShip_Move) { s32 pad; Vec3f sp2C; @@ -228,7 +228,7 @@ void BgHakaShip_Draw(Actor* thisx, GlobalContext* globalCtx) { sp2C.y = this->dyna.actor.world.pos.y + 62.0f; sp2C.z = this->dyna.actor.world.pos.z; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &sp2C, &this->bellSoundPos); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &sp2C, &this->bellSoundPos); func_80078914(&this->bellSoundPos, NA_SE_EV_SHIP_BELL - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h index 255c4c7d96..80f35d0847 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h +++ b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h @@ -6,7 +6,7 @@ struct BgHakaShip; -typedef void (*BgHakaShipActionFunc)(struct BgHakaShip*, GlobalContext*); +typedef void (*BgHakaShipActionFunc)(struct BgHakaShip*, PlayState*); typedef struct BgHakaShip { /* 0x0000 */ DynaPolyActor dyna; 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 2884fe7237..1e0af7af22 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 @@ -9,22 +9,22 @@ #define FLAGS 0 -void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTrap_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTrap_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaTrap_Init(Actor* thisx, PlayState* play); +void BgHakaTrap_Destroy(Actor* thisx, PlayState* play); +void BgHakaTrap_Update(Actor* thisx, PlayState* play); +void BgHakaTrap_Draw(Actor* thisx, PlayState* play); -void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808802D8(BgHakaTrap* this, GlobalContext* globalCtx); -void func_80880484(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808805C0(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808806BC(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808808F4(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808809B0(BgHakaTrap* this, GlobalContext* globalCtx); -void func_808809E4(BgHakaTrap* this, GlobalContext* globalCtx, s16 arg2); -void func_80880AE8(BgHakaTrap* this, GlobalContext* globalCtx); -void func_80880C0C(BgHakaTrap* this, GlobalContext* globalCtx); +void func_8087FFC0(BgHakaTrap* this, PlayState* play); +void func_808801B8(BgHakaTrap* this, PlayState* play); +void func_808802D8(BgHakaTrap* this, PlayState* play); +void func_80880484(BgHakaTrap* this, PlayState* play); +void func_808805C0(BgHakaTrap* this, PlayState* play); +void func_808806BC(BgHakaTrap* this, PlayState* play); +void func_808808F4(BgHakaTrap* this, PlayState* play); +void func_808809B0(BgHakaTrap* this, PlayState* play); +void func_808809E4(BgHakaTrap* this, PlayState* play, s16 arg2); +void func_80880AE8(BgHakaTrap* this, PlayState* play); +void func_80880C0C(BgHakaTrap* this, PlayState* play); void func_80880D68(BgHakaTrap* this); static UNK_TYPE D_80880F30 = 0; @@ -105,7 +105,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTrap_Init(Actor* thisx, PlayState* play) { static UNK_TYPE D_80881014 = 0; BgHakaTrap* this = (BgHakaTrap*)thisx; s32 pad; @@ -115,8 +115,8 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params &= 0xFF; if (thisx->params != HAKA_TRAP_PROPELLER) { - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinder(globalCtx, &this->colliderCylinder, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, thisx, &sCylinderInit); if ((thisx->params == HAKA_TRAP_GUILLOTINE_SLOW) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) { this->timer = 20; @@ -160,8 +160,8 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_haka_objects_Col_008D10, &colHeader); } - Collider_InitTris(globalCtx, &this->colliderSpikes); - Collider_SetTris(globalCtx, &this->colliderSpikes, thisx, &sTrisInit, this->colliderSpikesItem); + Collider_InitTris(play, &this->colliderSpikes); + Collider_SetTris(play, &this->colliderSpikes, thisx, &sTrisInit, this->colliderSpikesItem); this->colliderCylinder.dim.radius = 18; this->colliderCylinder.dim.height = 115; @@ -172,7 +172,7 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808801B8; } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } } else { this->timer = 40; @@ -183,30 +183,30 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo(&thisx->colChkInfo, 0, &sColChkInfoInit); } -void BgHakaTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTrap_Destroy(Actor* thisx, PlayState* play) { BgHakaTrap* this = (BgHakaTrap*)thisx; if (this->dyna.actor.params != HAKA_TRAP_PROPELLER) { if (this->dyna.actor.params != HAKA_TRAP_GUILLOTINE_SLOW) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL) || (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL_2)) { - Collider_DestroyTris(globalCtx, &this->colliderSpikes); + Collider_DestroyTris(play, &this->colliderSpikes); } } - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); + Collider_DestroyCylinder(play, &this->colliderCylinder); } Audio_StopSfxByPos(&this->unk_16C); } -void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_8087FFC0(BgHakaTrap* this, PlayState* play) { f32 cosine; Vec3f sp28; f32 sine; f32 zNonNegative; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); func_8002DBD0(&this->dyna.actor, &sp28, &player->actor.world.pos); @@ -226,11 +226,11 @@ void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx) { this->colliderCylinder.dim.pos.z = this->dyna.actor.world.pos.z + sp28.x * sine + sp28.z * cosine; } -void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_808801B8(BgHakaTrap* this, PlayState* play) { static UNK_TYPE D_80881018 = 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if ((D_80880F30 == 0) && (!Player_InCsMode(globalCtx))) { + if ((D_80880F30 == 0) && (!Player_InCsMode(play))) { if (!Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x, 0.5f)) { func_8002F974(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG); } else if (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL) { @@ -240,7 +240,7 @@ void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) { } } - func_8087FFC0(this, globalCtx); + func_8087FFC0(this, play); if (this->colliderSpikes.base.acFlags & AC_HIT) { this->timer = 20; @@ -252,7 +252,7 @@ void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) { } } -void func_808802D8(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_808802D8(BgHakaTrap* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f vector; f32 xScale; @@ -273,8 +273,7 @@ void func_808802D8(BgHakaTrap* this, GlobalContext* globalCtx) { 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(globalCtx, &vector, &zeroVec, &zeroVec, 130, 20, 255, 255, 150, 170, 255, 0, 0, 1, 9, - false); + EffectSsDeadDb_Spawn(play, &vector, &zeroVec, &zeroVec, 130, 20, 255, 255, 150, 170, 255, 0, 0, 1, 9, false); } if (this->timer == 0) { @@ -283,7 +282,7 @@ void func_808802D8(BgHakaTrap* this, GlobalContext* globalCtx) { } } -void func_80880484(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_80880484(BgHakaTrap* this, PlayState* play) { s32 sp24; s32 timer; @@ -312,14 +311,14 @@ void func_80880484(BgHakaTrap* this, GlobalContext* globalCtx) { this->actionFunc = func_808805C0; } - func_8087FFC0(this, globalCtx); + func_8087FFC0(this, play); if (sp24 == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); } } -void func_808805C0(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_808805C0(BgHakaTrap* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -345,10 +344,10 @@ void func_808805C0(BgHakaTrap* this, GlobalContext* globalCtx) { this->actionFunc = func_80880484; } - func_8087FFC0(this, globalCtx); + func_8087FFC0(this, play); } -void func_808806BC(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_808806BC(BgHakaTrap* this, PlayState* play) { Vec3f vector; f32 tempf20; f32 temp; @@ -368,9 +367,9 @@ void func_808806BC(BgHakaTrap* this, GlobalContext* globalCtx) { tempf20 = this->dyna.actor.floorHeight; for (i = 0; i < 3; i++) { - temp = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &sp64, &this->dyna.actor, - &vector) - - 25.0f; + temp = + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &sp64, &this->dyna.actor, &vector) - + 25.0f; if (tempf20 < temp) { tempf20 = temp; } @@ -399,7 +398,7 @@ void func_808806BC(BgHakaTrap* this, GlobalContext* globalCtx) { } } -void func_808808F4(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_808808F4(BgHakaTrap* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -418,7 +417,7 @@ void func_808808F4(BgHakaTrap* this, GlobalContext* globalCtx) { } } -void func_808809B0(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_808809B0(BgHakaTrap* this, PlayState* play) { if (this->timer != 0) { this->timer -= 1; } @@ -428,20 +427,20 @@ void func_808809B0(BgHakaTrap* this, GlobalContext* globalCtx) { } } -void func_808809E4(BgHakaTrap* this, GlobalContext* globalCtx, s16 arg2) { - Player* player = GET_PLAYER(globalCtx); +void func_808809E4(BgHakaTrap* this, PlayState* play, s16 arg2) { + Player* player = GET_PLAYER(play); Vec3f sp18; func_8002DBD0(&this->dyna.actor, &sp18, &player->actor.world.pos); if ((fabsf(sp18.x) < 70.0f) && (fabsf(sp18.y) < 100.0f) && (sp18.z < 500.0f) && - (GET_PLAYER(globalCtx)->currentBoots != PLAYER_BOOTS_IRON)) { + (GET_PLAYER(play)->currentBoots != PLAYER_BOOTS_IRON)) { player->pushedSpeed = ((500.0f - sp18.z) * 0.06f + 5.0f) * arg2 * (1.0f / 0x3A00) * (2.0f / 3.0f); player->pushedYaw = this->dyna.actor.shape.rot.y; } } -void func_80880AE8(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_80880AE8(BgHakaTrap* this, PlayState* play) { if (this->timer != 0) { if (Math_ScaledStepToS(&this->dyna.actor.world.rot.z, 0, this->dyna.actor.world.rot.z * 0.03f + 5.0f)) { this->timer = 40; @@ -459,10 +458,10 @@ void func_80880AE8(BgHakaTrap* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_WIND_TRAP - SFX_FLAG); } - func_808809E4(this, globalCtx, this->dyna.actor.world.rot.z); + func_808809E4(this, play, this->dyna.actor.world.rot.z); } -void func_80880C0C(BgHakaTrap* this, GlobalContext* globalCtx) { +void func_80880C0C(BgHakaTrap* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -475,27 +474,27 @@ void func_80880C0C(BgHakaTrap* this, GlobalContext* globalCtx) { } this->dyna.actor.shape.rot.z += this->dyna.actor.world.rot.z; - func_808809E4(this, globalCtx, this->dyna.actor.world.rot.z); + func_808809E4(this, play, this->dyna.actor.world.rot.z); } -void BgHakaTrap_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTrap_Update(Actor* thisx, PlayState* play) { BgHakaTrap* this = (BgHakaTrap*)thisx; Vec3f* actorPos = &this->dyna.actor.world.pos; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->dyna.actor.params != HAKA_TRAP_PROPELLER) && (thisx->params != HAKA_TRAP_SPIKED_BOX)) { this->colliderCylinder.dim.pos.y = actorPos->y; if ((thisx->params == HAKA_TRAP_GUILLOTINE_SLOW) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } else { if (this->actionFunc == func_808801B8) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSpikes.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSpikes.base); } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); } } } @@ -514,7 +513,7 @@ void func_80880D68(BgHakaTrap* this) { Collider_SetTrisVertices(&this->colliderSpikes, 1, &vec1, &vec3, &vec2); } -void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTrap_Draw(Actor* thisx, PlayState* play) { static Gfx* sDLists[5] = { object_haka_objects_DL_007610, object_haka_objects_DL_009860, object_haka_objects_DL_007EF0, object_haka_objects_DL_008A20, object_haka_objects_DL_0072C0, @@ -525,17 +524,17 @@ void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { Vec3f sp2C; if (this->actionFunc == func_808802D8) { - func_80026230(globalCtx, &D_8088103C, this->timer + 20, 0x28); + func_80026230(play, &D_8088103C, this->timer + 20, 0x28); } - Gfx_DrawDListOpa(globalCtx, sDLists[this->dyna.actor.params]); + Gfx_DrawDListOpa(play, sDLists[this->dyna.actor.params]); if (this->actionFunc == func_808801B8) { func_80880D68(this); } if (this->actionFunc == func_808802D8) { - func_80026608(globalCtx); + func_80026608(play); } if ((this->actionFunc == func_808808F4) && !this->unk_169) { @@ -543,7 +542,7 @@ void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { sp2C.z = this->dyna.actor.world.pos.z; sp2C.y = this->dyna.actor.world.pos.y + 110.0f; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &sp2C, &this->unk_16C); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &sp2C, &this->unk_16C); func_80078914(&this->unk_16C, 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 f3024a086e..111e08e242 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 @@ -15,7 +15,7 @@ typedef enum { struct BgHakaTrap; -typedef void (*BgHakaTrapActionFunc)(struct BgHakaTrap*, GlobalContext*); +typedef void (*BgHakaTrapActionFunc)(struct BgHakaTrap*, PlayState*); typedef struct BgHakaTrap { /* 0x0000 */ DynaPolyActor dyna; 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 e61cd2b4b0..a33b2820ff 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 @@ -10,13 +10,13 @@ #define FLAGS ACTOR_FLAG_4 -void BgHakaTubo_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTubo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTubo_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTubo_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaTubo_Init(Actor* thisx, PlayState* play); +void BgHakaTubo_Destroy(Actor* thisx, PlayState* play); +void BgHakaTubo_Update(Actor* thisx, PlayState* play); +void BgHakaTubo_Draw(Actor* thisx, PlayState* play); -void BgHakaTubo_Idle(BgHakaTubo* this, GlobalContext* globalCtx); -void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx); +void BgHakaTubo_Idle(BgHakaTubo* this, PlayState* play); +void BgHakaTubo_DropCollectible(BgHakaTubo* this, PlayState* play); const ActorInit Bg_Haka_Tubo_InitVars = { ACTOR_BG_HAKA_TUBO, @@ -76,7 +76,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaTubo_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTubo_Init(Actor* thisx, PlayState* play) { BgHakaTubo* this = (BgHakaTubo*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -84,25 +84,25 @@ void BgHakaTubo_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK3); CollisionHeader_GetVirtual(&object_haka_objects_Col_0108B8, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitCylinder(globalCtx, &this->potCollider); - Collider_SetCylinder(globalCtx, &this->potCollider, &this->dyna.actor, &sPotColliderInit); - Collider_InitCylinder(globalCtx, &this->flamesCollider); - Collider_SetCylinder(globalCtx, &this->flamesCollider, &this->dyna.actor, &sFlamesColliderInit); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + Collider_InitCylinder(play, &this->potCollider); + Collider_SetCylinder(play, &this->potCollider, &this->dyna.actor, &sPotColliderInit); + Collider_InitCylinder(play, &this->flamesCollider); + Collider_SetCylinder(play, &this->flamesCollider, &this->dyna.actor, &sFlamesColliderInit); this->fireScroll = Rand_ZeroOne() * 15.0f; sPotsDestroyed = 0; this->actionFunc = BgHakaTubo_Idle; } -void BgHakaTubo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTubo_Destroy(Actor* thisx, PlayState* play) { BgHakaTubo* this = (BgHakaTubo*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->potCollider); - Collider_DestroyCylinder(globalCtx, &this->flamesCollider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->potCollider); + Collider_DestroyCylinder(play, &this->flamesCollider); } -void BgHakaTubo_Idle(BgHakaTubo* this, GlobalContext* globalCtx) { +void BgHakaTubo_Idle(BgHakaTubo* this, PlayState* play) { static Vec3f sZeroVector = { 0.0f, 0.0f, 0.0f }; Vec3f pos; @@ -114,7 +114,7 @@ void BgHakaTubo_Idle(BgHakaTubo* this, GlobalContext* globalCtx) { // Colliding with flame circle if (this->flamesCollider.base.atFlags & AT_HIT) { this->flamesCollider.base.atFlags &= ~AT_HIT; - func_8002F71C(globalCtx, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 5.0f); + func_8002F71C(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 5.0f); } // Colliding with hitbox inside the pot if (this->potCollider.base.acFlags & AC_HIT) { @@ -126,10 +126,9 @@ void BgHakaTubo_Idle(BgHakaTubo* this, GlobalContext* globalCtx) { pos.x = this->dyna.actor.world.pos.x; pos.z = this->dyna.actor.world.pos.z; pos.y = this->dyna.actor.world.pos.y + 80.0f; - EffectSsBomb2_SpawnLayered(globalCtx, &pos, &sZeroVector, &sZeroVector, 100, 45); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 50, NA_SE_EV_BOX_BREAK); - EffectSsHahen_SpawnBurst(globalCtx, &pos, 20.0f, 0, 350, 100, 50, OBJECT_HAKA_OBJECTS, 40, - gEffFragments2DL); + EffectSsBomb2_SpawnLayered(play, &pos, &sZeroVector, &sZeroVector, 100, 45); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 50, NA_SE_EV_BOX_BREAK); + EffectSsHahen_SpawnBurst(play, &pos, 20.0f, 0, 350, 100, 50, OBJECT_HAKA_OBJECTS, 40, gEffFragments2DL); this->dropTimer = 5; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.0f); @@ -138,13 +137,13 @@ void BgHakaTubo_Idle(BgHakaTubo* this, GlobalContext* globalCtx) { } else { Collider_UpdateCylinder(&this->dyna.actor, &this->flamesCollider); Collider_UpdateCylinder(&this->dyna.actor, &this->potCollider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->potCollider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->flamesCollider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->flamesCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->potCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->flamesCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->flamesCollider.base); } } -void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { +void BgHakaTubo_DropCollectible(BgHakaTubo* this, PlayState* play) { EnItem00* collectible; f32 rnd; Vec3f spawnPos; @@ -166,7 +165,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { // Drop rupees for (i = 0; i < 9; i++) { collectible = Item_DropCollectible( - globalCtx, &spawnPos, (i % (ITEM00_RUPEE_RED - ITEM00_RUPEE_GREEN + 1)) + ITEM00_RUPEE_GREEN); + play, &spawnPos, (i % (ITEM00_RUPEE_RED - ITEM00_RUPEE_GREEN + 1)) + ITEM00_RUPEE_GREEN); if (collectible != NULL) { collectible->actor.velocity.y = 15.0f; collectible->actor.world.rot.y = this->dyna.actor.shape.rot.y + (i * 0x1C71); @@ -175,7 +174,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { } else if (rnd < 0.2f) { // Unlucky, no reward and spawn keese collectibleParams = -1; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FIREFLY, this->dyna.actor.world.pos.x, + 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); func_80078884(NA_SE_SY_ERROR); @@ -192,7 +191,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { } func_80078884(NA_SE_SY_TRE_BOX_APPEAR); } - } else if (Flags_GetCollectible(globalCtx, this->dyna.actor.params) != 0) { + } else if (Flags_GetCollectible(play, this->dyna.actor.params) != 0) { // If small key already collected, drop recovery heart instead collectibleParams = ITEM00_HEART; func_80078884(NA_SE_SY_TRE_BOX_APPEAR); @@ -202,7 +201,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_CORRECT_CHIME); } if (collectibleParams != -1) { - collectible = Item_DropCollectible(globalCtx, &spawnPos, collectibleParams); + collectible = Item_DropCollectible(play, &spawnPos, collectibleParams); if (collectible != NULL) { collectible->actor.velocity.y = 15.0f; collectible->actor.world.rot.y = this->dyna.actor.shape.rot.y; @@ -212,19 +211,19 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) { } } -void BgHakaTubo_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTubo_Update(Actor* thisx, PlayState* play) { BgHakaTubo* this = (BgHakaTubo*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->fireScroll++; } -void BgHakaTubo_DrawFlameCircle(BgHakaTubo* this, GlobalContext* globalCtx) { +void BgHakaTubo_DrawFlameCircle(BgHakaTubo* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_tubo.c", 476); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_tubo.c", 476); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 235.0f, this->dyna.actor.world.pos.z, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.shape.rot.y), MTXMODE_APPLY); @@ -233,18 +232,18 @@ void BgHakaTubo_DrawFlameCircle(BgHakaTubo* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 0, 170, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 255); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->fireScroll & 127, 0, 32, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->fireScroll & 127, 0, 32, 64, 1, 0, (this->fireScroll * -15) & 0xFF, 32, 64)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_tubo.c", 497), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka_tubo.c", 497), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFireCircleDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_tubo.c", 501); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_tubo.c", 501); } -void BgHakaTubo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTubo_Draw(Actor* thisx, PlayState* play) { BgHakaTubo* this = (BgHakaTubo*)thisx; - Gfx_DrawDListOpa(globalCtx, object_haka_objects_DL_00FE40); - BgHakaTubo_DrawFlameCircle(this, globalCtx); + Gfx_DrawDListOpa(play, object_haka_objects_DL_00FE40); + BgHakaTubo_DrawFlameCircle(this, play); } diff --git a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.h b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.h index 7d13044e3a..fbed37aa20 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.h +++ b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.h @@ -6,7 +6,7 @@ struct BgHakaTubo; -typedef void (*BgHakaTuboActionFunc)(struct BgHakaTubo*, GlobalContext*); +typedef void (*BgHakaTuboActionFunc)(struct BgHakaTubo*, PlayState*); typedef struct BgHakaTubo { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c b/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c index 64e8761328..5dc5eeb16e 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c +++ b/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgHakaWater_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaWater_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaWater_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaWater_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaWater_Init(Actor* thisx, PlayState* play); +void BgHakaWater_Destroy(Actor* thisx, PlayState* play); +void BgHakaWater_Update(Actor* thisx, PlayState* play); +void BgHakaWater_Draw(Actor* thisx, PlayState* play); -void BgHakaWater_LowerWater(BgHakaWater* this, GlobalContext* globalCtx); -void BgHakaWater_Wait(BgHakaWater* this, GlobalContext* globalCtx); -void BgHakaWater_ChangeWaterLevel(BgHakaWater* this, GlobalContext* globalCtx); +void BgHakaWater_LowerWater(BgHakaWater* this, PlayState* play); +void BgHakaWater_Wait(BgHakaWater* this, PlayState* play); +void BgHakaWater_ChangeWaterLevel(BgHakaWater* this, PlayState* play); const ActorInit Bg_Haka_Water_InitVars = { ACTOR_BG_HAKA_WATER, @@ -34,35 +34,35 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaWater_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaWater_Init(Actor* thisx, PlayState* play) { BgHakaWater* this = (BgHakaWater*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { this->isLowered = true; this->actor.home.pos.y -= 200.0f; this->actor.world.pos.y = this->actor.home.pos.y; } else { this->isLowered = false; } - BgHakaWater_LowerWater(this, globalCtx); + BgHakaWater_LowerWater(this, play); this->actionFunc = BgHakaWater_Wait; } -void BgHakaWater_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaWater_Destroy(Actor* thisx, PlayState* play) { } -void BgHakaWater_LowerWater(BgHakaWater* this, GlobalContext* globalCtx) { +void BgHakaWater_LowerWater(BgHakaWater* this, PlayState* play) { s32 i; for (i = 0; i < 9; i++) { - globalCtx->colCtx.colHeader->waterBoxes[i].ySurface = (s16)this->actor.world.pos.y - 8; + play->colCtx.colHeader->waterBoxes[i].ySurface = (s16)this->actor.world.pos.y - 8; } } -void BgHakaWater_Wait(BgHakaWater* this, GlobalContext* globalCtx) { - if ((!this->isLowered && Flags_GetSwitch(globalCtx, this->actor.params)) || - (this->isLowered && !Flags_GetSwitch(globalCtx, this->actor.params))) { +void BgHakaWater_Wait(BgHakaWater* this, PlayState* play) { + if ((!this->isLowered && Flags_GetSwitch(play, this->actor.params)) || + (this->isLowered && !Flags_GetSwitch(play, this->actor.params))) { if (this->isLowered) { this->isLowered = false; this->actor.draw = BgHakaWater_Draw; @@ -75,11 +75,11 @@ void BgHakaWater_Wait(BgHakaWater* this, GlobalContext* globalCtx) { } } -void BgHakaWater_ChangeWaterLevel(BgHakaWater* this, GlobalContext* globalCtx) { - if (!this->isLowered && Flags_GetSwitch(globalCtx, this->actor.params)) { +void BgHakaWater_ChangeWaterLevel(BgHakaWater* this, PlayState* play) { + if (!this->isLowered && Flags_GetSwitch(play, this->actor.params)) { this->isLowered = true; this->actor.home.pos.y -= 200.0f; - } else if (this->isLowered && !Flags_GetSwitch(globalCtx, this->actor.params)) { + } else if (this->isLowered && !Flags_GetSwitch(play, this->actor.params)) { this->isLowered = false; this->actor.home.pos.y += 200.0f; } @@ -96,23 +96,23 @@ void BgHakaWater_ChangeWaterLevel(BgHakaWater* this, GlobalContext* globalCtx) { this->actor.draw = NULL; } } - BgHakaWater_LowerWater(this, globalCtx); + BgHakaWater_LowerWater(this, play); } -void BgHakaWater_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaWater_Update(Actor* thisx, PlayState* play) { BgHakaWater* this = (BgHakaWater*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHakaWater_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaWater_Draw(Actor* thisx, PlayState* play) { BgHakaWater* this = (BgHakaWater*)thisx; s32 pad; f32 temp; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_water.c", 287); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_water.c", 287); + func_80093D84(play->state.gfxCtx); if (this->isLowered) { temp = this->actor.world.pos.y - this->actor.home.pos.y; @@ -122,11 +122,10 @@ void BgHakaWater_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)(0.765f * temp)); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 128, - globalCtx->gameplayFrames % 128, 32, 32, 1, 0, (0 - globalCtx->gameplayFrames) % 128, - 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, play->gameplayFrames % 128, 32, 32, + 1, 0, (0 - play->gameplayFrames) % 128, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_water.c", 312), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka_water.c", 312), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBotwWaterRingDL); @@ -139,9 +138,9 @@ void BgHakaWater_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)(5.1f * temp)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_water.c", 328), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_haka_water.c", 328), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBotwWaterFallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_water.c", 332); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_water.c", 332); } diff --git a/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.h b/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.h index 0374215158..b89d0fa522 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.h +++ b/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.h @@ -6,7 +6,7 @@ struct BgHakaWater; -typedef void (*BgHakaWaterActionFunc)(struct BgHakaWater*, GlobalContext*); +typedef void (*BgHakaWaterActionFunc)(struct BgHakaWater*, PlayState*); typedef struct BgHakaWater { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c index fef5102ece..fc49e86f2f 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c +++ b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c @@ -17,20 +17,20 @@ typedef enum { /* 0x3 */ STA_UNKNOWN } ShadowTempleAssetsType; -void BgHakaZou_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaZou_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaZou_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaZou_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaZou_Init(Actor* thisx, PlayState* play); +void BgHakaZou_Destroy(Actor* thisx, PlayState* play); +void BgHakaZou_Update(Actor* thisx, PlayState* play); +void BgHakaZou_Draw(Actor* thisx, PlayState* play); -void BgHakaZou_Wait(BgHakaZou* this, GlobalContext* globalCtx); -void func_80882BDC(BgHakaZou* this, GlobalContext* globalCtx); -void func_80883000(BgHakaZou* this, GlobalContext* globalCtx); -void func_80883104(BgHakaZou* this, GlobalContext* globalCtx); -void func_80883144(BgHakaZou* this, GlobalContext* globalCtx); -void func_80883254(BgHakaZou* this, GlobalContext* globalCtx); -void func_80883328(BgHakaZou* this, GlobalContext* globalCtx); -void func_808834D8(BgHakaZou* this, GlobalContext* globalCtx); -void BgHakaZou_DoNothing(BgHakaZou* this, GlobalContext* globalCtx); +void BgHakaZou_Wait(BgHakaZou* this, PlayState* play); +void func_80882BDC(BgHakaZou* this, PlayState* play); +void func_80883000(BgHakaZou* this, PlayState* play); +void func_80883104(BgHakaZou* this, PlayState* play); +void func_80883144(BgHakaZou* this, PlayState* play); +void func_80883254(BgHakaZou* this, PlayState* play); +void func_80883328(BgHakaZou* this, PlayState* play); +void func_808834D8(BgHakaZou* this, PlayState* play); +void BgHakaZou_DoNothing(BgHakaZou* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -71,7 +71,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaZou_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaZou_Init(Actor* thisx, PlayState* play) { s32 pad; BgHakaZou* this = (BgHakaZou*)thisx; @@ -89,8 +89,8 @@ void BgHakaZou_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->world.rot.x = Rand_S16Offset(0x100, 0x300) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1); thisx->world.rot.z = Rand_S16Offset(0x400, 0x800) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1); } else { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); Collider_UpdateCylinder(thisx, &this->collider); DynaPolyActor_Init(&this->dyna, 0); @@ -103,12 +103,12 @@ void BgHakaZou_Init(Actor* thisx, GlobalContext* globalCtx) { } this->requiredObjBankIndex = (thisx->params == STA_BOMBABLE_RUBBLE) - ? Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKACH_OBJECTS) - : Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKA_OBJECTS); + ? Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS) + : Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS); if (this->requiredObjBankIndex < 0) { Actor_Kill(thisx); - } else if ((thisx->params != STA_UNKNOWN) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + } else if ((thisx->params != STA_UNKNOWN) && Flags_GetSwitch(play, this->switchFlag)) { if (thisx->params != STA_GIANT_BIRD_STATUE) { Actor_Kill(thisx); } else { @@ -121,16 +121,16 @@ void BgHakaZou_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHakaZou_Wait; } -void BgHakaZou_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaZou_Destroy(Actor* thisx, PlayState* play) { BgHakaZou* this = (BgHakaZou*)thisx; if (this->dyna.actor.params != STA_UNKNOWN) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); } } -void func_808828F4(BgHakaZou* this, GlobalContext* globalCtx) { +void func_808828F4(BgHakaZou* this, PlayState* play) { Vec3f effectPos; Vec3f effectVelocity; f32 rand; @@ -151,21 +151,21 @@ void func_808828F4(BgHakaZou* this, GlobalContext* globalCtx) { effectPos.y = this->dyna.actor.world.pos.y + (60.0f * rand); effectPos.z = this->dyna.actor.world.pos.z + (112.0f * rand); - func_800286CC(globalCtx, &effectPos, &effectVelocity, &sZeroVec, (Rand_ZeroOne() * 200.0f) + 1000.0f, 100); + func_800286CC(play, &effectPos, &effectVelocity, &sZeroVec, (Rand_ZeroOne() * 200.0f) + 1000.0f, 100); } } -void BgHakaZou_Wait(BgHakaZou* this, GlobalContext* globalCtx) { +void BgHakaZou_Wait(BgHakaZou* this, PlayState* play) { CollisionHeader* colHeader; - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { this->dyna.actor.objBankIndex = this->requiredObjBankIndex; this->dyna.actor.draw = BgHakaZou_Draw; if (this->dyna.actor.params == STA_UNKNOWN) { this->actionFunc = func_80882BDC; } else { - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); colHeader = NULL; @@ -186,9 +186,9 @@ void BgHakaZou_Wait(BgHakaZou* this, GlobalContext* globalCtx) { this->collider.dim.height = 20; } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if ((this->dyna.actor.params == STA_GIANT_BIRD_STATUE) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->dyna.actor.params == STA_GIANT_BIRD_STATUE) && Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = BgHakaZou_DoNothing; } else { this->actionFunc = func_80883000; @@ -196,7 +196,7 @@ void BgHakaZou_Wait(BgHakaZou* this, GlobalContext* globalCtx) { } } } -void func_80882BDC(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80882BDC(BgHakaZou* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -220,7 +220,7 @@ void func_80882BDC(BgHakaZou* this, GlobalContext* globalCtx) { } } -void func_80882CC4(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80882CC4(BgHakaZou* this, PlayState* play) { s32 i; s32 j; Vec3f actorSpawnPos; @@ -237,14 +237,14 @@ void func_80882CC4(BgHakaZou* this, GlobalContext* globalCtx) { actorSpawnPos.z = this->dyna.actor.world.pos.z + (j - 1) * cos; actorSpawnPos.y = this->dyna.actor.world.pos.y + (i - 1) * 55; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_HAKA_ZOU, actorSpawnPos.x, actorSpawnPos.y, - actorSpawnPos.z, 0, this->dyna.actor.shape.rot.y, 0, this->dyna.actor.params + 2); - func_800286CC(globalCtx, &actorSpawnPos, &sZeroVec, &sZeroVec, 1000, 50); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_HAKA_ZOU, actorSpawnPos.x, actorSpawnPos.y, actorSpawnPos.z, 0, + this->dyna.actor.shape.rot.y, 0, this->dyna.actor.params + 2); + func_800286CC(play, &actorSpawnPos, &sZeroVec, &sZeroVec, 1000, 50); } } } -void func_80882E54(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80882E54(BgHakaZou* this, PlayState* play) { Vec3f fragmentPos; s32 i; s32 j; @@ -254,44 +254,44 @@ void func_80882E54(BgHakaZou* this, GlobalContext* globalCtx) { fragmentPos.y = this->collider.dim.pos.y; fragmentPos.z = this->collider.dim.pos.z; - EffectSsHahen_SpawnBurst(globalCtx, &fragmentPos, 10.0f, 0, 10, 10, 4, 141, 40, gBotwBombSpotDL); + EffectSsHahen_SpawnBurst(play, &fragmentPos, 10.0f, 0, 10, 10, 4, 141, 40, gBotwBombSpotDL); for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) { fragmentPos.x = this->collider.dim.pos.x + (((j * 2) - 1) * num); fragmentPos.z = this->collider.dim.pos.z + (((i * 2) - 1) * num); - EffectSsHahen_SpawnBurst(globalCtx, &fragmentPos, 10.0f, 0, 10, 10, 4, 141, 40, gBotwBombSpotDL); - func_800286CC(globalCtx, &fragmentPos, &sZeroVec, &sZeroVec, 1000, 50); + EffectSsHahen_SpawnBurst(play, &fragmentPos, 10.0f, 0, 10, 10, 4, 141, 40, gBotwBombSpotDL); + func_800286CC(play, &fragmentPos, &sZeroVec, &sZeroVec, 1000, 50); } } } -void func_80883000(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80883000(BgHakaZou* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); if (this->dyna.actor.params == STA_GIANT_BIRD_STATUE) { this->timer = 20; this->actionFunc = func_80883144; - OnePointCutscene_Init(globalCtx, 3400, 999, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3400, 999, &this->dyna.actor, CAM_ID_MAIN); } else if (this->dyna.actor.params == 2) { - func_80882E54(this, globalCtx); + func_80882E54(this, play); this->dyna.actor.draw = NULL; this->timer = 1; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_EXPLOSION); this->actionFunc = func_80883104; } else { - func_80882CC4(this, globalCtx); + func_80882CC4(this, play); this->timer = 1; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); this->actionFunc = func_80883104; } } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_80883104(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80883104(BgHakaZou* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -301,7 +301,7 @@ void func_80883104(BgHakaZou* this, GlobalContext* globalCtx) { } } -void func_80883144(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80883144(BgHakaZou* this, PlayState* play) { Vec3f explosionPos; if (this->timer != 0) { @@ -313,7 +313,7 @@ void func_80883144(BgHakaZou* this, GlobalContext* globalCtx) { explosionPos.y = (Rand_ZeroOne() * 80.0f) + this->dyna.actor.world.pos.y; explosionPos.z = Rand_CenteredFloat(200.0f) + (this->dyna.actor.world.pos.z + 56.0f); - EffectSsBomb2_SpawnLayered(globalCtx, &explosionPos, &sZeroVec, &sZeroVec, 150, 70); + EffectSsBomb2_SpawnLayered(play, &explosionPos, &sZeroVec, &sZeroVec, 150, 70); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION); } @@ -323,7 +323,7 @@ void func_80883144(BgHakaZou* this, GlobalContext* globalCtx) { } } -void func_80883254(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80883254(BgHakaZou* this, PlayState* play) { f32 moveDist = (Rand_ZeroOne() * 0.5f) + 0.5f; Math_StepToF(&this->dyna.actor.world.pos.z, this->dyna.actor.home.pos.z - 80.0f, 2.0f * moveDist); @@ -339,11 +339,11 @@ void func_80883254(BgHakaZou* this, GlobalContext* globalCtx) { this->actionFunc = func_80883328; } } else { - func_808828F4(this, globalCtx); + func_808828F4(this, play); } } -void func_80883328(BgHakaZou* this, GlobalContext* globalCtx) { +void func_80883328(BgHakaZou* this, PlayState* play) { Vec3f effectPos; s32 i; s32 j; @@ -359,7 +359,7 @@ void func_80883328(BgHakaZou* this, GlobalContext* globalCtx) { for (i = 0; i < 4; i++) { effectPos.z -= (i == 2) ? 550.0f : 50.0f; - func_800286CC(globalCtx, &effectPos, &sZeroVec, &sZeroVec, (Rand_ZeroOne() * 200.0f) + 1000.0f, 200); + func_800286CC(play, &effectPos, &sZeroVec, &sZeroVec, (Rand_ZeroOne() * 200.0f) + 1000.0f, 200); } effectPos.x -= 112.0f; @@ -371,7 +371,7 @@ void func_80883328(BgHakaZou* this, GlobalContext* globalCtx) { } } -void func_808834D8(BgHakaZou* this, GlobalContext* globalCtx) { +void func_808834D8(BgHakaZou* this, PlayState* play) { f32 moveDist; if (this->timer != 0) { @@ -386,20 +386,20 @@ void func_808834D8(BgHakaZou* this, GlobalContext* globalCtx) { } } -void BgHakaZou_DoNothing(BgHakaZou* this, GlobalContext* globalCtx) { +void BgHakaZou_DoNothing(BgHakaZou* this, PlayState* play) { } -void BgHakaZou_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaZou_Update(Actor* thisx, PlayState* play) { BgHakaZou* this = (BgHakaZou*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->dyna.actor.params == 3) { Actor_MoveForward(&this->dyna.actor); } } -void BgHakaZou_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaZou_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { object_haka_objects_DL_0064E0, object_haka_objects_DL_005CE0, @@ -407,5 +407,5 @@ void BgHakaZou_Draw(Actor* thisx, GlobalContext* globalCtx) { object_haka_objects_DL_005CE0, }; - Gfx_DrawDListOpa(globalCtx, dLists[thisx->params]); + Gfx_DrawDListOpa(play, dLists[thisx->params]); } diff --git a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h index eafdcc8881..b5fe2a2fd3 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h +++ b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h @@ -6,7 +6,7 @@ struct BgHakaZou; -typedef void (*BgHakaZouActionFunc)(struct BgHakaZou*, GlobalContext*); +typedef void (*BgHakaZouActionFunc)(struct BgHakaZou*, PlayState*); typedef struct BgHakaZou { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index 3003c60e82..1bb0d0d9f3 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -12,19 +12,19 @@ #define PIECE_FLAG_HIT_FLOOR (1 << 0) -void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHeavyBlock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHeavyBlock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHeavyBlock_Init(Actor* thisx, PlayState* play); +void BgHeavyBlock_Destroy(Actor* thisx, PlayState* play); +void BgHeavyBlock_Update(Actor* thisx, PlayState* play); +void BgHeavyBlock_Draw(Actor* thisx, PlayState* play); -void BgHeavyBlock_DrawPiece(Actor* thisx, GlobalContext* globalCtx); +void BgHeavyBlock_DrawPiece(Actor* thisx, PlayState* play); -void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx); -void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx); -void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx); -void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx); -void BgHeavyBlock_Land(BgHeavyBlock* this, GlobalContext* globalCtx); -void BgHeavyBlock_DoNothing(BgHeavyBlock* this, GlobalContext* globalCtx); +void BgHeavyBlock_MovePiece(BgHeavyBlock* this, PlayState* play); +void BgHeavyBlock_Wait(BgHeavyBlock* this, PlayState* play); +void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, PlayState* play); +void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play); +void BgHeavyBlock_Land(BgHeavyBlock* this, PlayState* play); +void BgHeavyBlock_DoNothing(BgHeavyBlock* this, PlayState* play); const ActorInit Bg_Heavy_Block_InitVars = { ACTOR_BG_HEAVY_BLOCK, @@ -72,23 +72,23 @@ void BgHeavyBlock_InitPiece(BgHeavyBlock* this, f32 scale) { Actor_SetScale(&this->dyna.actor, Rand_CenteredFloat(0.2f) + 1.0f); } -void BgHeavyBlock_SetupDynapoly(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_SetupDynapoly(BgHeavyBlock* this, PlayState* play) { s32 pad[2]; CollisionHeader* colHeader = NULL; this->dyna.actor.flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_17; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gHeavyBlockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHeavyBlock_Init(Actor* thisx, PlayState* play) { BgHeavyBlock* this = (BgHeavyBlock*)thisx; Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); this->pieceFlags = 0; - if (globalCtx->sceneNum == SCENE_GANON_TOU) { + if (play->sceneNum == SCENE_GANON_TOU) { thisx->params &= 0xFF00; thisx->params |= 4; } @@ -111,9 +111,9 @@ void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_164.y = -20.0f; break; case HEAVYBLOCK_BREAKABLE: - BgHeavyBlock_SetupDynapoly(this, globalCtx); + BgHeavyBlock_SetupDynapoly(this, play); - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { Actor_Kill(thisx); return; } @@ -121,9 +121,9 @@ void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHeavyBlock_Wait; break; case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: - BgHeavyBlock_SetupDynapoly(this, globalCtx); + BgHeavyBlock_SetupDynapoly(this, play); - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { this->actionFunc = BgHeavyBlock_DoNothing; thisx->shape.rot.x = thisx->world.rot.x = 0x8AD0; thisx->shape.rot.y = thisx->world.rot.y = 0xC000; @@ -136,11 +136,11 @@ void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHeavyBlock_Wait; break; case HEAVYBLOCK_UNBREAKABLE: - BgHeavyBlock_SetupDynapoly(this, globalCtx); + BgHeavyBlock_SetupDynapoly(this, play); this->actionFunc = BgHeavyBlock_Wait; break; default: - BgHeavyBlock_SetupDynapoly(this, globalCtx); + BgHeavyBlock_SetupDynapoly(this, play); this->actionFunc = BgHeavyBlock_Wait; break; } @@ -148,7 +148,7 @@ void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(CYAN) " 最大 ブロック セーブビット %x\n" VT_RST, thisx->params); } -void BgHeavyBlock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHeavyBlock_Destroy(Actor* thisx, PlayState* play) { BgHeavyBlock* this = (BgHeavyBlock*)thisx; switch (this->dyna.actor.params & 0xFF) { case HEAVYBLOCK_BIG_PIECE: @@ -156,11 +156,11 @@ void BgHeavyBlock_Destroy(Actor* thisx, GlobalContext* globalCtx) { case HEAVYBLOCK_SMALL_PIECE: break; default: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_MovePiece(BgHeavyBlock* this, PlayState* play) { Actor* thisx = &this->dyna.actor; thisx->velocity.y += thisx->gravity; @@ -179,7 +179,7 @@ void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx) { if (!(this->pieceFlags & PIECE_FLAG_HIT_FLOOR)) { thisx->world.pos.y += this->unk_164.y; thisx->prevPos.y += this->unk_164.y; - Actor_UpdateBgCheckInfo(globalCtx, thisx, 50.0f, 50.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, thisx, 50.0f, 50.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); thisx->world.pos.y -= this->unk_164.y; thisx->prevPos.y -= this->unk_164.y; if (thisx->bgCheckFlags & BGCHECKFLAG_GROUND) { @@ -200,7 +200,7 @@ void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx) { } } -void BgHeavyBlock_SpawnDust(GlobalContext* globalCtx, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, +void BgHeavyBlock_SpawnDust(PlayState* play, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ, u8 dustParams) { Color_RGBA8 primColor; Color_RGBA8 envColor; @@ -237,8 +237,8 @@ void BgHeavyBlock_SpawnDust(GlobalContext* globalCtx, f32 posX, f32 posY, f32 po accel.x = 0.0f; accel.y = (dustParams & 8) ? 0.0f : 0.5f; - eye = GET_ACTIVE_CAM(globalCtx)->eye; - at = GET_ACTIVE_CAM(globalCtx)->at; + eye = GET_ACTIVE_CAM(play)->eye; + at = GET_ACTIVE_CAM(play)->at; scale = 1000; scaleStep = 160; @@ -274,11 +274,11 @@ void BgHeavyBlock_SpawnDust(GlobalContext* globalCtx, f32 posX, f32 posY, f32 po break; } - func_8002843C(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, scale, scaleStep, + func_8002843C(play, &pos, &velocity, &accel, &primColor, &envColor, scale, scaleStep, (s32)Rand_ZeroFloat(10.0f) + 20); } -void BgHeavyBlock_SpawnPieces(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_SpawnPieces(BgHeavyBlock* this, PlayState* play) { s32 i; Vec3f spA4[] = { { 0.0f, 300.0f, -20.0f }, { 50.0f, 200.0f, -20.0f }, { -50.0f, 200.0f, -20.0f }, @@ -303,35 +303,35 @@ void BgHeavyBlock_SpawnPieces(BgHeavyBlock* this, GlobalContext* globalCtx) { pos.y = this->dyna.actor.world.pos.y + (spA4[i].y * cosPitch) + (-spA4[i].z * sinPitch); pos.z = this->dyna.actor.world.pos.z + (spA4[i].x * -sinYaw) + (cosYaw * pos.z); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_HEAVY_BLOCK, pos.x, pos.y, pos.z, - this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, 0, 2); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_HEAVY_BLOCK, pos.x, pos.y, pos.z, - this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, 0, 3); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_HEAVY_BLOCK, pos.x, pos.y, pos.z, this->dyna.actor.shape.rot.x, + this->dyna.actor.shape.rot.y, 0, 2); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_HEAVY_BLOCK, pos.x, pos.y, pos.z, this->dyna.actor.shape.rot.x, + this->dyna.actor.shape.rot.y, 0, 3); - BgHeavyBlock_SpawnDust(globalCtx, pos.x, pos.y, pos.z, 0.0f, 0.0f, 0.0f, 0); + BgHeavyBlock_SpawnDust(play, pos.x, pos.y, pos.z, 0.0f, 0.0f, 0.0f, 0); } } -void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_Wait(BgHeavyBlock* this, PlayState* play) { s32 quakeIndex; // if block has a parent link has lifted it, start one point cutscene and quake - if (Actor_HasParent(&this->dyna.actor, globalCtx)) { + if (Actor_HasParent(&this->dyna.actor, play)) { this->timer = 0; switch (this->dyna.actor.params & 0xFF) { case HEAVYBLOCK_BREAKABLE: - OnePointCutscene_Init(globalCtx, 4020, 270, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4020, 270, &this->dyna.actor, CAM_ID_MAIN); break; case HEAVYBLOCK_UNBREAKABLE: - OnePointCutscene_Init(globalCtx, 4021, 220, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4021, 220, &this->dyna.actor, CAM_ID_MAIN); break; case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: - OnePointCutscene_Init(globalCtx, 4022, 210, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4022, 210, &this->dyna.actor, CAM_ID_MAIN); break; } - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 25000); Quake_SetQuakeValues(quakeIndex, 1, 1, 5, 0); Quake_SetCountdown(quakeIndex, 10); @@ -339,8 +339,8 @@ void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx) { } } -void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; f32 cosYaw; f32 zOffset; @@ -359,23 +359,23 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) { zOffset = Rand_CenteredFloat(110.0f); cosYaw = Math_CosS(this->dyna.actor.shape.rot.y); - BgHeavyBlock_SpawnDust(globalCtx, (sinYaw * -70.0f) + (this->dyna.actor.world.pos.x + xOffset), + BgHeavyBlock_SpawnDust(play, (sinYaw * -70.0f) + (this->dyna.actor.world.pos.x + xOffset), this->dyna.actor.world.pos.y + 10.0f, (cosYaw * -70.0f) + (this->dyna.actor.world.pos.z + zOffset), 0.0f, -1.0f, 0.0f, 0xC); } this->timer++; - func_8002DF54(globalCtx, &player->actor, 8); + func_8002DF54(play, &player->actor, 8); // if parent is NULL, link threw it - if (Actor_HasNoParent(&this->dyna.actor, globalCtx)) { + if (Actor_HasNoParent(&this->dyna.actor, play)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_HEAVY_THROW); this->actionFunc = BgHeavyBlock_Fly; } } -void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) { s32 bgId; s32 quakeIndex; Vec3f pos; @@ -386,7 +386,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { pos.y = this->dyna.actor.home.pos.y + 1000.0f; pos.z = this->dyna.actor.home.pos.z; raycastResult = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &pos); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &pos); this->dyna.actor.floorHeight = raycastResult; if (this->dyna.actor.home.pos.y <= raycastResult) { @@ -394,38 +394,37 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { switch (this->dyna.actor.params & 0xFF) { case HEAVYBLOCK_BREAKABLE: - BgHeavyBlock_SpawnPieces(this, globalCtx); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + BgHeavyBlock_SpawnPieces(this, play); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); Actor_Kill(&this->dyna.actor); - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0); Quake_SetCountdown(quakeIndex, 30); - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 2); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 2); Quake_SetSpeed(quakeIndex, 12000); Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0); Quake_SetCountdown(quakeIndex, 999); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, - NA_SE_EV_ELECTRIC_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_ELECTRIC_EXPLOSION); return; case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 16, 2, 120, 0); Quake_SetCountdown(quakeIndex, 40); this->actionFunc = BgHeavyBlock_Land; - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); break; case HEAVYBLOCK_UNBREAKABLE: Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0); Quake_SetCountdown(quakeIndex, 40); @@ -433,7 +432,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { this->actionFunc = BgHeavyBlock_Land; break; default: - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0); Quake_SetCountdown(quakeIndex, 40); @@ -444,10 +443,10 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.x = Math_Atan2S(this->dyna.actor.velocity.y, this->dyna.actor.speedXZ); } -void BgHeavyBlock_DoNothing(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_DoNothing(BgHeavyBlock* this, PlayState* play) { } -void BgHeavyBlock_Land(BgHeavyBlock* this, GlobalContext* globalCtx) { +void BgHeavyBlock_Land(BgHeavyBlock* this, PlayState* play) { s32 pad; if (Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, 0x8AD0, 6, 2000, 100) != 0) { @@ -459,13 +458,13 @@ void BgHeavyBlock_Land(BgHeavyBlock* this, GlobalContext* globalCtx) { this->dyna.actor.home.pos = this->dyna.actor.world.pos; switch (this->dyna.actor.params & 0xFF) { case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: - BgHeavyBlock_SpawnDust(globalCtx, Rand_CenteredFloat(30.0f) + 1678.0f, Rand_ZeroFloat(100.0f) + 1286.0f, + BgHeavyBlock_SpawnDust(play, Rand_CenteredFloat(30.0f) + 1678.0f, Rand_ZeroFloat(100.0f) + 1286.0f, Rand_CenteredFloat(30.0f) + 552.0f, 0.0f, 0.0f, 0.0f, 0); - BgHeavyBlock_SpawnDust(globalCtx, Rand_CenteredFloat(30.0f) + 1729.0f, Rand_ZeroFloat(80.0f) + 1269.0f, + BgHeavyBlock_SpawnDust(play, Rand_CenteredFloat(30.0f) + 1729.0f, Rand_ZeroFloat(80.0f) + 1269.0f, Rand_CenteredFloat(30.0f) + 600.0f, 0.0f, 0.0f, 0.0f, 0); break; case HEAVYBLOCK_UNBREAKABLE: - BgHeavyBlock_SpawnDust(globalCtx, Rand_CenteredFloat(100.0f) + -735.0f, 29.0f, + BgHeavyBlock_SpawnDust(play, Rand_CenteredFloat(100.0f) + -735.0f, 29.0f, Rand_CenteredFloat(100.0f) + -3418.0f, 0.0f, 0.0f, 0.0f, 3); break; } @@ -475,20 +474,20 @@ void BgHeavyBlock_Land(BgHeavyBlock* this, GlobalContext* globalCtx) { } } -void BgHeavyBlock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHeavyBlock_Update(Actor* thisx, PlayState* play) { BgHeavyBlock* this = (BgHeavyBlock*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHeavyBlock_Draw(Actor* thisx, PlayState* play) { static Vec3f D_80884EC8 = { 0.0f, 0.0f, 0.0f }; static Vec3f D_80884ED4 = { 0.0f, 400.0f, 0.0f }; BgHeavyBlock* this = (BgHeavyBlock*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 904); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_heavy_block.c", 904); if (BgHeavyBlock_LiftedUp == this->actionFunc) { Matrix_SetTranslateRotateYXZ(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z, @@ -501,24 +500,24 @@ void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&D_80884EC8, &thisx->world.pos); Matrix_MultVec3f(&D_80884ED4, &thisx->home.pos); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 931), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_heavy_block.c", 931), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gHeavyBlockEntirePillarDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 935); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_heavy_block.c", 935); } -void BgHeavyBlock_DrawPiece(Actor* thisx, GlobalContext* globalCtx) { +void BgHeavyBlock_DrawPiece(Actor* thisx, PlayState* play) { switch (thisx->params & 0xFF) { case HEAVYBLOCK_BIG_PIECE: Matrix_Translate(50.0f, -260.0f, -20.0f, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, gHeavyBlockBigPieceDL); + Gfx_DrawDListOpa(play, gHeavyBlockBigPieceDL); break; case HEAVYBLOCK_SMALL_PIECE: Matrix_Translate(45.0f, -280.0f, -5.0f, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, gHeavyBlockSmallPieceDL); + Gfx_DrawDListOpa(play, gHeavyBlockSmallPieceDL); break; } } diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h index e816bcf7a4..c6c21d2dfb 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h @@ -6,7 +6,7 @@ struct BgHeavyBlock; -typedef void (*BgHeavyBlockActionFunc)(struct BgHeavyBlock*, GlobalContext*); +typedef void (*BgHeavyBlockActionFunc)(struct BgHeavyBlock*, PlayState*); typedef struct BgHeavyBlock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index f014ac8451..c851e14a94 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -9,17 +9,17 @@ #define FLAGS ACTOR_FLAG_4 -void BgHidanCurtain_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanCurtain_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanCurtain_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanCurtain_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanCurtain_Init(Actor* thisx, PlayState* play); +void BgHidanCurtain_Destroy(Actor* thisx, PlayState* play); +void BgHidanCurtain_Update(Actor* thisx, PlayState* play); +void BgHidanCurtain_Draw(Actor* thisx, PlayState* play); -void BgHidanCurtain_WaitForSwitchOn(BgHidanCurtain* this, GlobalContext* globalCtx); -void BgHidanCurtain_WaitForCutscene(BgHidanCurtain* this, GlobalContext* globalCtx); -void BgHidanCurtain_WaitForClear(BgHidanCurtain* this, GlobalContext* globalCtx); -void BgHidanCurtain_TurnOn(BgHidanCurtain* this, GlobalContext* globalCtx); -void BgHidanCurtain_TurnOff(BgHidanCurtain* this, GlobalContext* globalCtx); -void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, GlobalContext* globalCtx); +void BgHidanCurtain_WaitForSwitchOn(BgHidanCurtain* this, PlayState* play); +void BgHidanCurtain_WaitForCutscene(BgHidanCurtain* this, PlayState* play); +void BgHidanCurtain_WaitForClear(BgHidanCurtain* this, PlayState* play); +void BgHidanCurtain_TurnOn(BgHidanCurtain* this, PlayState* play); +void BgHidanCurtain_TurnOff(BgHidanCurtain* this, PlayState* play); +void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, PlayState* play); typedef struct { /* 0x00 */ s16 radius; @@ -65,7 +65,7 @@ const ActorInit Bg_Hidan_Curtain_InitVars = { (ActorFunc)BgHidanCurtain_Draw, }; -void BgHidanCurtain_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanCurtain_Init(Actor* thisx, PlayState* play) { s32 pad; BgHidanCurtain* this = (BgHidanCurtain*)thisx; BgHidanCurtainParams* hcParams; @@ -92,8 +92,8 @@ void BgHidanCurtain_Init(Actor* thisx, GlobalContext* globalCtx) { "../z_bg_hidan_curtain.c", 373, this->actor.params); } Actor_SetScale(&this->actor, hcParams->scale); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + 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; @@ -109,29 +109,29 @@ void BgHidanCurtain_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.y = this->actor.home.pos.y - hcParams->riseDist; } } - if (((this->type == 1) && Flags_GetTreasure(globalCtx, this->treasureFlag)) || - (((this->type == 0) || (this->type == 6)) && Flags_GetClear(globalCtx, this->actor.room))) { + if (((this->type == 1) && Flags_GetTreasure(play, this->treasureFlag)) || + (((this->type == 0) || (this->type == 6)) && Flags_GetClear(play, this->actor.room))) { Actor_Kill(&this->actor); } this->texScroll = Rand_ZeroOne() * 15.0f; } -void BgHidanCurtain_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanCurtain_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgHidanCurtain* this = (BgHidanCurtain*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void BgHidanCurtain_WaitForSwitchOn(BgHidanCurtain* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->actor.params)) { +void BgHidanCurtain_WaitForSwitchOn(BgHidanCurtain* this, PlayState* play) { + if (Flags_GetSwitch(play, this->actor.params)) { if (this->type == 1) { this->actionFunc = BgHidanCurtain_WaitForCutscene; - OnePointCutscene_Init(globalCtx, 3350, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3350, -99, &this->actor, CAM_ID_MAIN); this->timer = 50; } else if (this->type == 3) { this->actionFunc = BgHidanCurtain_WaitForCutscene; - OnePointCutscene_Init(globalCtx, 3360, 60, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3360, 60, &this->actor, CAM_ID_MAIN); this->timer = 30; } else { this->actionFunc = BgHidanCurtain_TurnOff; @@ -139,34 +139,34 @@ void BgHidanCurtain_WaitForSwitchOn(BgHidanCurtain* this, GlobalContext* globalC } } -void BgHidanCurtain_WaitForCutscene(BgHidanCurtain* this, GlobalContext* globalCtx) { +void BgHidanCurtain_WaitForCutscene(BgHidanCurtain* this, PlayState* play) { if (this->timer-- == 0) { this->actionFunc = BgHidanCurtain_TurnOff; } } -void BgHidanCurtain_WaitForClear(BgHidanCurtain* this, GlobalContext* globalCtx) { - if (Flags_GetClear(globalCtx, this->actor.room)) { +void BgHidanCurtain_WaitForClear(BgHidanCurtain* this, PlayState* play) { + if (Flags_GetClear(play, this->actor.room)) { this->actionFunc = BgHidanCurtain_TurnOff; } } -void BgHidanCurtain_WaitForSwitchOff(BgHidanCurtain* this, GlobalContext* globalCtx) { - if (!Flags_GetSwitch(globalCtx, this->actor.params)) { +void BgHidanCurtain_WaitForSwitchOff(BgHidanCurtain* this, PlayState* play) { + if (!Flags_GetSwitch(play, this->actor.params)) { this->actionFunc = BgHidanCurtain_TurnOn; } } -void BgHidanCurtain_TurnOn(BgHidanCurtain* this, GlobalContext* globalCtx) { +void BgHidanCurtain_TurnOn(BgHidanCurtain* this, PlayState* play) { f32 riseSpeed = sHCParams[this->size].riseSpeed; if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, riseSpeed)) { - Flags_UnsetSwitch(globalCtx, this->actor.params); + Flags_UnsetSwitch(play, this->actor.params); this->actionFunc = BgHidanCurtain_WaitForSwitchOn; } } -void BgHidanCurtain_TurnOff(BgHidanCurtain* this, GlobalContext* globalCtx) { +void BgHidanCurtain_TurnOff(BgHidanCurtain* this, PlayState* play) { BgHidanCurtainParams* hcParams = &sHCParams[this->size]; if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - hcParams->riseDist, hcParams->riseSpeed)) { @@ -189,7 +189,7 @@ void BgHidanCurtain_TurnOff(BgHidanCurtain* this, GlobalContext* globalCtx) { } } -void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, GlobalContext* globalCtx) { +void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, PlayState* play) { DECR(this->timer); if (this->timer == 0) { this->actionFunc = BgHidanCurtain_TurnOn; @@ -199,25 +199,25 @@ void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, GlobalContext* globalCtx) } } -void BgHidanCurtain_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgHidanCurtain_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgHidanCurtain* this = (BgHidanCurtain*)thisx; BgHidanCurtainParams* hcParams = &sHCParams[this->size]; f32 riseProgress; - if ((globalCtx->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_SLOW_CHEST_CS) || - (globalCtx->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_TURN_AROUND)) { + if ((play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_SLOW_CHEST_CS) || + (play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_TURN_AROUND)) { this->collider.base.atFlags &= ~AT_HIT; } else { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 1.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 1.0f); } if ((this->type == 4) || (this->type == 5)) { this->actor.world.pos.y = (2.0f * this->actor.home.pos.y) - hcParams->riseDist - this->actor.world.pos.y; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->type == 4) || (this->type == 5)) { this->actor.world.pos.y = (2.0f * this->actor.home.pos.y) - hcParams->riseDist - this->actor.world.pos.y; @@ -226,36 +226,36 @@ void BgHidanCurtain_Update(Actor* thisx, GlobalContext* globalCtx2) { this->alpha = 255.0f * riseProgress; if (this->alpha > 50) { this->collider.dim.height = hcParams->height * riseProgress; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (gSaveContext.sceneSetupIndex <= 3) { func_8002F974(&this->actor, NA_SE_EV_FIRE_PILLAR_S - SFX_FLAG); } - } else if ((this->type == 1) && Flags_GetTreasure(globalCtx, this->treasureFlag)) { + } else if ((this->type == 1) && Flags_GetTreasure(play, this->treasureFlag)) { Actor_Kill(&this->actor); } this->texScroll++; } } -void BgHidanCurtain_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanCurtain_Draw(Actor* thisx, PlayState* play) { BgHidanCurtain* this = (BgHidanCurtain*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_curtain.c", 685); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_hidan_curtain.c", 685); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 220, 0, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->texScroll & 0x7F, 0, 0x20, 0x40, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->texScroll & 0x7F, 0, 0x20, 0x40, 1, 0, (this->texScroll * -0xF) & 0xFF, 0x20, 0x40)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_curtain.c", 698), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_hidan_curtain.c", 698), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFireCircleDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_curtain.c", 702); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_curtain.c", 702); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h index de3b647b77..54a99a7960 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h @@ -6,7 +6,7 @@ struct BgHidanCurtain; -typedef void (*BgHidanCurtainActionFunc)(struct BgHidanCurtain*, GlobalContext*); +typedef void (*BgHidanCurtainActionFunc)(struct BgHidanCurtain*, PlayState*); typedef struct BgHidanCurtain { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c index aedb1977f6..6cb7741214 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c @@ -9,13 +9,13 @@ #define FLAGS 0 -void BgHidanDalm_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanDalm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanDalm_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanDalm_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanDalm_Init(Actor* thisx, PlayState* play); +void BgHidanDalm_Destroy(Actor* thisx, PlayState* play); +void BgHidanDalm_Update(Actor* thisx, PlayState* play); +void BgHidanDalm_Draw(Actor* thisx, PlayState* play); -void BgHidanDalm_Wait(BgHidanDalm* this, GlobalContext* globalCtx); -void BgHidanDalm_Shrink(BgHidanDalm* this, GlobalContext* globalCtx); +void BgHidanDalm_Wait(BgHidanDalm* this, PlayState* play); +void BgHidanDalm_Shrink(BgHidanDalm* this, PlayState* play); const ActorInit Bg_Hidan_Dalm_InitVars = { ACTOR_BG_HIDAN_DALM, @@ -94,7 +94,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -200, ICHAIN_STOP), }; -void BgHidanDalm_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanDalm_Init(Actor* thisx, PlayState* play) { BgHidanDalm* this = (BgHidanDalm*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -102,30 +102,30 @@ void BgHidanDalm_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gFireTempleHammerableTotemCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, thisx, &sTrisInit, this->colliderItems); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); this->switchFlag = (thisx->params >> 8) & 0xFF; thisx->params &= 0xFF; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { Actor_Kill(thisx); } else { this->actionFunc = BgHidanDalm_Wait; } } -void BgHidanDalm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanDalm_Destroy(Actor* thisx, PlayState* play) { BgHidanDalm* this = (BgHidanDalm*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyTris(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyTris(play, &this->collider); } -void BgHidanDalm_Wait(BgHidanDalm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHidanDalm_Wait(BgHidanDalm* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((this->collider.base.acFlags & AC_HIT) && !Player_InCsMode(globalCtx) && + if ((this->collider.base.acFlags & AC_HIT) && !Player_InCsMode(play) && (player->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD || player->meleeWeaponAnimation == PLAYER_MWA_HAMMER_SIDE)) { this->collider.base.acFlags &= ~AC_HIT; @@ -138,28 +138,28 @@ void BgHidanDalm_Wait(BgHidanDalm* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.x += 32.5f * Math_SinS(this->dyna.actor.world.rot.y); this->dyna.actor.world.pos.z += 32.5f * Math_CosS(this->dyna.actor.world.rot.y); - func_8002DF54(globalCtx, &this->dyna.actor, 8); + func_8002DF54(play, &this->dyna.actor, 8); this->dyna.actor.flags |= ACTOR_FLAG_4; this->actionFunc = BgHidanDalm_Shrink; this->dyna.actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->dyna.actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; this->dyna.actor.speedXZ = 10.0f; - Flags_SetSwitch(globalCtx, this->switchFlag); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_IT_HAMMER_HIT); + Flags_SetSwitch(play, this->switchFlag); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_IT_HAMMER_HIT); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_DARUMA_VANISH); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgHidanDalm_Shrink(BgHidanDalm* this, GlobalContext* globalCtx) { +void BgHidanDalm_Shrink(BgHidanDalm* this, PlayState* play) { static Vec3f accel = { 0, 0, 0 }; s32 i; Vec3f velocity; Vec3f pos; if (Math_StepToF(&this->dyna.actor.scale.x, 0.0f, 0.004f)) { - func_8002DF54(globalCtx, &this->dyna.actor, 7); + func_8002DF54(play, &this->dyna.actor, 7); Actor_Kill(&this->dyna.actor); } @@ -173,16 +173,16 @@ void BgHidanDalm_Shrink(BgHidanDalm* this, GlobalContext* globalCtx) { velocity.x = 5.0f * Math_SinS(this->dyna.actor.world.rot.y + 0x8000) + (Rand_ZeroOne() - 0.5f) * 5.0f; velocity.z = 5.0f * Math_CosS(this->dyna.actor.world.rot.y + 0x8000) + (Rand_ZeroOne() - 0.5f) * 5.0f; velocity.y = (Rand_ZeroOne() - 0.5f) * 1.5f; - EffectSsKiraKira_SpawnSmallYellow(globalCtx, &pos, &velocity, &accel); + EffectSsKiraKira_SpawnSmallYellow(play, &pos, &velocity, &accel); } } -void BgHidanDalm_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanDalm_Update(Actor* thisx, PlayState* play) { BgHidanDalm* this = (BgHidanDalm*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 10.0f, 15.0f, 32.0f, + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 10.0f, 15.0f, 32.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } @@ -209,13 +209,13 @@ void BgHidanDalm_UpdateCollider(BgHidanDalm* this) { Collider_SetTrisVertices(&this->collider, 3, &pos0, &pos2, &pos1); } -void BgHidanDalm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanDalm_Draw(Actor* thisx, PlayState* play) { BgHidanDalm* this = (BgHidanDalm*)thisx; if (this->dyna.actor.params == 0) { - Gfx_DrawDListOpa(globalCtx, gFireTempleHammerableTotemBodyDL); + Gfx_DrawDListOpa(play, gFireTempleHammerableTotemBodyDL); } else { - Gfx_DrawDListOpa(globalCtx, gFireTempleHammerableTotemHeadDL); + Gfx_DrawDListOpa(play, gFireTempleHammerableTotemHeadDL); } if (this->actionFunc == BgHidanDalm_Wait) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h index 53d740114e..1ded5bdcb7 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h @@ -6,7 +6,7 @@ struct BgHidanDalm; -typedef void (*BgHidanDalmActionFunc)(struct BgHidanDalm*, GlobalContext*); +typedef void (*BgHidanDalmActionFunc)(struct BgHidanDalm*, PlayState*); typedef struct BgHidanDalm { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c index d95640e7b8..f5451808b9 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c @@ -9,17 +9,17 @@ #define FLAGS 0 -void BgHidanFirewall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFirewall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFirewall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFirewall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanFirewall_Init(Actor* thisx, PlayState* play); +void BgHidanFirewall_Destroy(Actor* thisx, PlayState* play); +void BgHidanFirewall_Update(Actor* thisx, PlayState* play); +void BgHidanFirewall_Draw(Actor* thisx, PlayState* play); -s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx); +s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, PlayState* play); +void BgHidanFirewall_Wait(BgHidanFirewall* this, PlayState* play); +void BgHidanFirewall_Countdown(BgHidanFirewall* this, PlayState* play); +void BgHidanFirewall_Erupt(BgHidanFirewall* this, PlayState* play); +void BgHidanFirewall_Collide(BgHidanFirewall* this, PlayState* play); +void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, PlayState* play); const ActorInit Bg_Hidan_Firewall_InitVars = { ACTOR_BG_HIDAN_FIREWALL, @@ -55,7 +55,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit sColChkInfoInit = { 1, 80, 100, MASS_IMMOVABLE }; -void BgHidanFirewall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFirewall_Init(Actor* thisx, PlayState* play) { BgHidanFirewall* this = (BgHidanFirewall*)thisx; this->actor.scale.x = 0.12f; @@ -64,8 +64,8 @@ void BgHidanFirewall_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_150 = 0; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->collider.dim.pos.y = this->actor.world.pos.y; @@ -74,17 +74,17 @@ void BgHidanFirewall_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgHidanFirewall_Wait; } -void BgHidanFirewall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFirewall_Destroy(Actor* thisx, PlayState* play) { BgHidanFirewall* this = (BgHidanFirewall*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalCtx) { +s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, PlayState* play) { Player* player; Vec3f distance; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); func_8002DBD0(&this->actor, &distance, &player->actor.world.pos); if (fabsf(distance.x) < 100.0f && fabsf(distance.z) < 120.0f) { @@ -93,15 +93,15 @@ s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalC return 0; } -void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx) { - if (BgHidanFirewall_CheckProximity(this, globalCtx) != 0) { +void BgHidanFirewall_Wait(BgHidanFirewall* this, PlayState* play) { + if (BgHidanFirewall_CheckProximity(this, play) != 0) { this->actor.draw = BgHidanFirewall_Draw; this->actor.params = 5; this->actionFunc = BgHidanFirewall_Countdown; } } -void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx) { +void BgHidanFirewall_Countdown(BgHidanFirewall* this, PlayState* play) { if (this->actor.params != 0) { this->actor.params--; @@ -111,8 +111,8 @@ void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx) } } -void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) { - if (BgHidanFirewall_CheckProximity(this, globalCtx) != 0) { +void BgHidanFirewall_Erupt(BgHidanFirewall* this, PlayState* play) { + if (BgHidanFirewall_CheckProximity(this, play) != 0) { Math_StepToF(&this->actor.scale.y, 0.1f, 0.01f / 0.4f); } else { if (Math_StepToF(&this->actor.scale.y, 0.01f, 0.01f) != 0) { @@ -124,7 +124,7 @@ void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) { } } -void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx) { +void BgHidanFirewall_Collide(BgHidanFirewall* this, PlayState* play) { s16 phi_a3; if (Actor_IsFacingPlayer(&this->actor, 0x4000)) { @@ -133,17 +133,17 @@ void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx) { phi_a3 = this->actor.shape.rot.y + 0x8000; } - func_8002F71C(globalCtx, &this->actor, 5.0f, phi_a3, 1.0f); + func_8002F71C(play, &this->actor, 5.0f, phi_a3, 1.0f); } -void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx) { +void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, PlayState* play) { Player* player; Vec3f sp30; f32 temp_ret; f32 sp28; f32 phi_f0; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); func_8002DBD0(&this->actor, &sp30, &player->actor.world.pos); if (sp30.x < -70.0f) { @@ -173,7 +173,7 @@ void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* this->collider.dim.pos.z = this->actor.world.pos.z - sp30.x * sp28 + sp30.z * temp_ret; } -void BgHidanFirewall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFirewall_Update(Actor* thisx, PlayState* play) { BgHidanFirewall* this = (BgHidanFirewall*)thisx; s32 pad; @@ -181,14 +181,14 @@ void BgHidanFirewall_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - BgHidanFirewall_Collide(this, globalCtx); + BgHidanFirewall_Collide(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc == BgHidanFirewall_Erupt) { - BgHidanFirewall_ColliderFollowPlayer(this, globalCtx); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + BgHidanFirewall_ColliderFollowPlayer(this, play); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); func_8002F974(&this->actor, NA_SE_EV_FIRE_PLATE - SFX_FLAG); } } @@ -198,19 +198,19 @@ static void* sFireballTexs[] = { gFireTempleFireball4Tex, gFireTempleFireball5Tex, gFireTempleFireball6Tex, gFireTempleFireball7Tex, }; -void BgHidanFirewall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFirewall_Draw(Actor* thisx, PlayState* play) { BgHidanFirewall* this = (BgHidanFirewall*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 448); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_hidan_firewall.c", 448); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sFireballTexs[this->unk_150])); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x01, 255, 255, 0, 150); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 255); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 458), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_hidan_firewall.c", 458), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFireTempleFireballUpperHalfDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 463); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_firewall.c", 463); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h index 8ea5aedfe1..ab60763f7a 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h @@ -6,7 +6,7 @@ struct BgHidanFirewall; -typedef void (*BgHidanFirewallActionFunc)(struct BgHidanFirewall*, GlobalContext*); +typedef void (*BgHidanFirewallActionFunc)(struct BgHidanFirewall*, PlayState*); typedef struct BgHidanFirewall { /* 0x0000 */ Actor actor; 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 50bdfd7646..2fac89c60a 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 @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void BgHidanFslift_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFslift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFslift_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFslift_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanFslift_Init(Actor* thisx, PlayState* play); +void BgHidanFslift_Destroy(Actor* thisx, PlayState* play); +void BgHidanFslift_Update(Actor* thisx, PlayState* play); +void BgHidanFslift_Draw(Actor* thisx, PlayState* play); -void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx); -void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx); -void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx); +void func_80886FCC(BgHidanFslift* this, PlayState* play); +void func_8088706C(BgHidanFslift* this, PlayState* play); +void func_808870D8(BgHidanFslift* this, PlayState* play); const ActorInit Bg_Hidan_Fslift_InitVars = { ACTOR_BG_HIDAN_FSLIFT, @@ -37,7 +37,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_STOP), }; -void BgHidanFslift_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFslift_Init(Actor* thisx, PlayState* play) { s32 pad1; BgHidanFslift* this = (BgHidanFslift*)thisx; CollisionHeader* colHeader = NULL; @@ -46,10 +46,10 @@ void BgHidanFslift_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gFireTempleHookshotElevatorCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, 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) { + 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); return; } @@ -66,10 +66,10 @@ void func_80886F24(BgHidanFslift* this) { } } -void BgHidanFslift_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFslift_Destroy(Actor* thisx, PlayState* play) { BgHidanFslift* this = (BgHidanFslift*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80886FB4(BgHidanFslift* this) { @@ -77,7 +77,7 @@ void func_80886FB4(BgHidanFslift* this) { this->actionFunc = func_80886FCC; } -void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx) { +void func_80886FCC(BgHidanFslift* this, PlayState* play) { s32 heightBool; if (this->timer) { @@ -97,7 +97,7 @@ void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx) { } } -void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx) { +void func_8088706C(BgHidanFslift* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 4.0f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); func_80886FB4(this); @@ -107,7 +107,7 @@ void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx) { func_80886F24(this); } -void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx) { +void func_808870D8(BgHidanFslift* this, PlayState* play) { if (func_80043590(&this->dyna)) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 790.0f, 4.0f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); @@ -121,23 +121,23 @@ void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx) { func_80886F24(this); } -void BgHidanFslift_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFslift_Update(Actor* thisx, PlayState* play) { BgHidanFslift* this = (BgHidanFslift*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (func_8004356C(&this->dyna)) { if (this->unk_16A == 0) { this->unk_16A = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_16A != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } this->unk_16A = 0; } } -void BgHidanFslift_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gFireTempleHookshotElevatorDL); +void BgHidanFslift_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gFireTempleHookshotElevatorDL); } 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 b18da3e95f..731a8e2ce4 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 @@ -6,7 +6,7 @@ struct BgHidanFslift; -typedef void (*BgHidanFsliftActionFunc)(struct BgHidanFslift*, GlobalContext*); +typedef void (*BgHidanFsliftActionFunc)(struct BgHidanFslift*, PlayState*); typedef struct BgHidanFslift { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c index 68b872a8eb..41f4130a11 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c @@ -17,19 +17,19 @@ typedef enum { /* 2 */ FWBIG_KILL } HidanFwbigMoveState; -void BgHidanFwbig_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFwbig_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFwbig_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanFwbig_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanFwbig_Init(Actor* thisx, PlayState* play); +void BgHidanFwbig_Destroy(Actor* thisx, PlayState* play); +void BgHidanFwbig_Update(Actor* thisx, PlayState* play); +void BgHidanFwbig_Draw(Actor* thisx, PlayState* play); void BgHidanFwbig_UpdatePosition(BgHidanFwbig* this); -void BgHidanFwbig_WaitForSwitch(BgHidanFwbig* this, GlobalContext* globalCtx); -void BgHidanFwbig_WaitForCs(BgHidanFwbig* this, GlobalContext* globalCtx); -void BgHidanFwbig_Lower(BgHidanFwbig* this, GlobalContext* globalCtx); -void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, GlobalContext* globalCtx); -void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, GlobalContext* globalCtx); -void BgHidanFwbig_Move(BgHidanFwbig* this, GlobalContext* globalCtx); +void BgHidanFwbig_WaitForSwitch(BgHidanFwbig* this, PlayState* play); +void BgHidanFwbig_WaitForCs(BgHidanFwbig* this, PlayState* play); +void BgHidanFwbig_Lower(BgHidanFwbig* this, PlayState* play); +void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, PlayState* play); +void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, PlayState* play); +void BgHidanFwbig_Move(BgHidanFwbig* this, PlayState* play); const ActorInit Bg_Hidan_Fwbig_InitVars = { ACTOR_BG_HIDAN_FWBIG, @@ -67,14 +67,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_STOP), }; -void BgHidanFwbig_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgHidanFwbig_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgHidanFwbig* this = (BgHidanFwbig*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->direction = (u16)(thisx->params >> 8); thisx->params &= 0xFF; @@ -104,11 +104,11 @@ void BgHidanFwbig_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void BgHidanFwbig_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFwbig_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgHidanFwbig* this = (BgHidanFwbig*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void BgHidanFwbig_UpdatePosition(BgHidanFwbig* this) { @@ -118,24 +118,24 @@ void BgHidanFwbig_UpdatePosition(BgHidanFwbig* this) { this->actor.world.pos.z = (Math_CosS(startAngle) * 885.4f) + this->actor.home.pos.z; } -void BgHidanFwbig_WaitForSwitch(BgHidanFwbig* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->actor.params)) { +void BgHidanFwbig_WaitForSwitch(BgHidanFwbig* this, PlayState* play) { + if (Flags_GetSwitch(play, this->actor.params)) { this->actionFunc = BgHidanFwbig_WaitForCs; - OnePointCutscene_Init(globalCtx, 3340, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3340, -99, &this->actor, CAM_ID_MAIN); this->timer = 35; } } -void BgHidanFwbig_WaitForCs(BgHidanFwbig* this, GlobalContext* globalCtx) { +void BgHidanFwbig_WaitForCs(BgHidanFwbig* this, PlayState* play) { if (this->timer-- == 0) { this->actionFunc = BgHidanFwbig_Lower; } } -void BgHidanFwbig_Rise(BgHidanFwbig* this, GlobalContext* globalCtx) { +void BgHidanFwbig_Rise(BgHidanFwbig* this, PlayState* play) { if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 10.0f)) { if (this->direction == 0) { - Flags_UnsetSwitch(globalCtx, this->actor.params); + Flags_UnsetSwitch(play, this->actor.params); this->actionFunc = BgHidanFwbig_WaitForSwitch; } else { this->actionFunc = BgHidanFwbig_Move; @@ -143,7 +143,7 @@ void BgHidanFwbig_Rise(BgHidanFwbig* this, GlobalContext* globalCtx) { } } -void BgHidanFwbig_Lower(BgHidanFwbig* this, GlobalContext* globalCtx) { +void BgHidanFwbig_Lower(BgHidanFwbig* this, PlayState* play) { if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - (2400.0f * this->actor.scale.y), 10.0f)) { if (this->direction == 0) { this->actionFunc = BgHidanFwbig_WaitForTimer; @@ -163,7 +163,7 @@ void BgHidanFwbig_Lower(BgHidanFwbig* this, GlobalContext* globalCtx) { } } -void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, GlobalContext* globalCtx) { +void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -173,17 +173,17 @@ void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, GlobalContext* globalCtx) { func_8002F994(&this->actor, this->timer); } -void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->actor.world.pos.x < 1150.0f) { this->actionFunc = BgHidanFwbig_Rise; - OnePointCutscene_Init(globalCtx, 3290, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3290, -99, &this->actor, CAM_ID_MAIN); } } -void BgHidanFwbig_Move(BgHidanFwbig* this, GlobalContext* globalCtx) { - if (!Player_InCsMode(globalCtx)) { +void BgHidanFwbig_Move(BgHidanFwbig* this, PlayState* play) { + if (!Player_InCsMode(play)) { if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y + (this->direction * 0x6390), 0x20)) { this->moveState = FWBIG_RESET; this->actionFunc = BgHidanFwbig_Lower; @@ -193,8 +193,8 @@ void BgHidanFwbig_Move(BgHidanFwbig* this, GlobalContext* globalCtx) { } } -void BgHidanFwbig_MoveCollider(BgHidanFwbig* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgHidanFwbig_MoveCollider(BgHidanFwbig* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f projPos; f32 cs; f32 sn; @@ -216,23 +216,23 @@ void BgHidanFwbig_MoveCollider(BgHidanFwbig* this, GlobalContext* globalCtx) { this->actor.world.rot.y = (projPos.z < 0.0f) ? this->actor.shape.rot.y : this->actor.shape.rot.y + 0x8000; } -void BgHidanFwbig_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFwbig_Update(Actor* thisx, PlayState* play) { s32 pad; BgHidanFwbig* this = (BgHidanFwbig*)thisx; if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.world.rot.y, 1.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.world.rot.y, 1.0f); if (this->direction != 0) { this->actionFunc = BgHidanFwbig_Lower; } } - if ((this->direction != 0) && (globalCtx->roomCtx.prevRoom.num == this->actor.room)) { + if ((this->direction != 0) && (play->roomCtx.prevRoom.num == this->actor.room)) { this->moveState = FWBIG_KILL; this->actionFunc = BgHidanFwbig_Lower; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actor.home.pos.y - 200.0f) < this->actor.world.pos.y) { if (gSaveContext.sceneSetupIndex < 4) { @@ -240,19 +240,19 @@ void BgHidanFwbig_Update(Actor* thisx, GlobalContext* globalCtx) { } else if ((s16)this->actor.world.pos.x == -513) { func_8002F974(&this->actor, NA_SE_EV_FLAME_OF_FIRE - SFX_FLAG); } - BgHidanFwbig_MoveCollider(this, globalCtx); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + BgHidanFwbig_MoveCollider(this, play); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void BgHidanFwbig_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanFwbig_Draw(Actor* thisx, PlayState* play) { s32 pad; f32 height; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_fwbig.c", 630); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_hidan_fwbig.c", 630); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gEffUnknown4Tex)); @@ -265,13 +265,13 @@ void BgHidanFwbig_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 0x80, 0, 0x20, 0x40, 1, 0, - (u8)(globalCtx->gameplayFrames * -15), 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 0x80, 0, 0x20, 0x40, 1, 0, + (u8)(play->gameplayFrames * -15), 0x20, 0x40)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_fwbig.c", 660), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_hidan_fwbig.c", 660), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFireTempleBigFireWallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_fwbig.c", 664); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_fwbig.c", 664); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.h b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.h index c0fd6db5f0..9bf96e22d3 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.h @@ -6,7 +6,7 @@ struct BgHidanFwbig; -typedef void (*BgHidanFwbigActionFunc)(struct BgHidanFwbig*, GlobalContext*); +typedef void (*BgHidanFwbigActionFunc)(struct BgHidanFwbig*, PlayState*); typedef struct BgHidanFwbig { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index 08580febe1..06b8f1c8cf 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHamstep_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHamstep_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHamstep_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanHamstep_Init(Actor* thisx, PlayState* play); +void BgHidanHamstep_Destroy(Actor* thisx, PlayState* play); +void BgHidanHamstep_Update(Actor* thisx, PlayState* play); +void BgHidanHamstep_Draw(Actor* thisx, PlayState* play); -void func_808887C4(BgHidanHamstep* this, GlobalContext* globalCtx); -void func_80888860(BgHidanHamstep* this, GlobalContext* globalCtx); -void func_808889B8(BgHidanHamstep* this, GlobalContext* globalCtx); -void func_80888A58(BgHidanHamstep* this, GlobalContext* globalCtx); -void BgHidanHamstep_DoNothing(BgHidanHamstep* this, GlobalContext* globalCtx); +void func_808887C4(BgHidanHamstep* this, PlayState* play); +void func_80888860(BgHidanHamstep* this, PlayState* play); +void func_808889B8(BgHidanHamstep* this, PlayState* play); +void func_80888A58(BgHidanHamstep* this, PlayState* play); +void BgHidanHamstep_DoNothing(BgHidanHamstep* this, PlayState* play); static f32 sYPosOffsets[] = { -20.0f, -120.0f, -220.0f, -320.0f, -420.0f, @@ -93,14 +93,14 @@ void BgHidanHamstep_SetupAction(BgHidanHamstep* this, s32 action) { this->actionFunc = sActionFuncs[action]; } -s32 BgHidanHamstep_SpawnChildren(BgHidanHamstep* this, GlobalContext* globalCtx2) { +s32 BgHidanHamstep_SpawnChildren(BgHidanHamstep* this, PlayState* play2) { BgHidanHamstep* step = this; s32 i; Vec3f pos; f32 sin; f32 cos; s16 params; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; pos = pos; // Required to match pos.y = this->dyna.actor.home.pos.y - 100.0f; @@ -114,9 +114,9 @@ s32 BgHidanHamstep_SpawnChildren(BgHidanHamstep* this, GlobalContext* globalCtx2 params = (i + 1) & 0xFF; params |= (this->dyna.actor.params & 0xFF00); - step = (BgHidanHamstep*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &step->dyna.actor, globalCtx, ACTOR_BG_HIDAN_HAMSTEP, pos.x, pos.y, pos.z, - this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, params); + step = (BgHidanHamstep*)Actor_SpawnAsChild(&play->actorCtx, &step->dyna.actor, play, ACTOR_BG_HIDAN_HAMSTEP, + pos.x, pos.y, pos.z, this->dyna.actor.world.rot.x, + this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, params); if (step == NULL) { return 0; @@ -125,7 +125,7 @@ s32 BgHidanHamstep_SpawnChildren(BgHidanHamstep* this, GlobalContext* globalCtx2 return 1; } -void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHamstep_Init(Actor* thisx, PlayState* play) { BgHidanHamstep* this = (BgHidanHamstep*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -138,8 +138,8 @@ void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); if ((this->dyna.actor.params & 0xFF) == 0) { - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems); + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems); for (i = 0; i < 2; i++) { for (i2 = 0; i2 < 3; i2++) { @@ -157,9 +157,9 @@ void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gFireTempleStoneStep2Col, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0xFF)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF)) { if ((this->dyna.actor.params & 0xFF) == 0) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + (-20.0f); BgHidanHamstep_SetupAction(this, 4); @@ -180,7 +180,7 @@ void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx) { if ((this->dyna.actor.params & 0xFF) == 0) { // "Fire Temple Object [Hammer Step] appears" osSyncPrintf("◯◯◯炎の神殿オブジェクト【ハンマーステップ】出現\n"); - if (BgHidanHamstep_SpawnChildren(this, globalCtx) == 0) { + if (BgHidanHamstep_SpawnChildren(this, play) == 0) { step = this; // "[Hammer Step] I can't create a step!" @@ -195,17 +195,17 @@ void BgHidanHamstep_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgHidanHamstep_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHamstep_Destroy(Actor* thisx, PlayState* play) { BgHidanHamstep* this = (BgHidanHamstep*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->dyna.actor.params & 0xFF) == 0) { - Collider_DestroyTris(globalCtx, &this->collider); + Collider_DestroyTris(play, &this->collider); } } -void func_808884C8(BgHidanHamstep* step, GlobalContext* globalCtx) { +void func_808884C8(BgHidanHamstep* step, PlayState* play) { Vec3f pos = step->dyna.actor.world.pos; s32 i; f32 sin; @@ -213,7 +213,7 @@ void func_808884C8(BgHidanHamstep* step, GlobalContext* globalCtx) { pos.y -= 20.0f; - func_80033480(globalCtx, &pos, 0.0f, 0, 600, 300, 0); + func_80033480(play, &pos, 0.0f, 0, 600, 300, 0); sin = Math_SinS(step->dyna.actor.shape.rot.y + 0x8000); cos = Math_CosS(step->dyna.actor.shape.rot.y + 0x8000); @@ -223,16 +223,16 @@ void func_808884C8(BgHidanHamstep* step, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sEffectPositions); i++) { pos.x = (sEffectPositions[i][1] * sin) + (sEffectPositions[i][0] * cos) + step->dyna.actor.world.pos.x; pos.z = ((sEffectPositions[i][1] * cos) - (sEffectPositions[i][0] * sin)) + step->dyna.actor.world.pos.z; - func_80033480(globalCtx, &pos, 0.0f, 0, 150, 150, 0); + func_80033480(play, &pos, 0.0f, 0, 150, 150, 0); } } -void func_80888638(BgHidanHamstep* this, GlobalContext* globalCtx) { +void func_80888638(BgHidanHamstep* this, PlayState* play) { BgHidanHamstep* child = (BgHidanHamstep*)this->dyna.actor.child; while (child != NULL) { if ((child->dyna.actor.params & 0xFF) != 0) { - func_808884C8(child, globalCtx); + func_808884C8(child, play); } child = (BgHidanHamstep*)child->dyna.actor.child; } @@ -276,19 +276,19 @@ void func_80888734(BgHidanHamstep* this) { } } -void func_808887C4(BgHidanHamstep* this, GlobalContext* globalCtx) { +void func_808887C4(BgHidanHamstep* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { - OnePointCutscene_Init(globalCtx, 3310, 100, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3310, 100, &this->dyna.actor, CAM_ID_MAIN); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_HAMMER_SWITCH); this->collider.base.acFlags = AC_NONE; BgHidanHamstep_SetupAction(this, 1); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0xFF); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_80888860(BgHidanHamstep* this, GlobalContext* globalCtx) { +void func_80888860(BgHidanHamstep* this, PlayState* play) { s32 pad; s32 pad2; s32 quakeIndex; @@ -308,20 +308,20 @@ void func_80888860(BgHidanHamstep* this, GlobalContext* globalCtx) { if (1) {} if (this->unk_244 == 1) { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, -15536); Quake_SetQuakeValues(quakeIndex, 0, 0, 500, 0); Quake_SetCountdown(quakeIndex, 20); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 255, 20, 150); - func_80888638(this, globalCtx); + func_80888638(this, play); osSyncPrintf("A(%d)\n", this->dyna.actor.params); } } } } -void func_808889B8(BgHidanHamstep* this, GlobalContext* globalCtx) { +void func_808889B8(BgHidanHamstep* this, PlayState* play) { s32 pad; BgHidanHamstep* parent = (BgHidanHamstep*)this->dyna.actor.parent; @@ -338,7 +338,7 @@ void func_808889B8(BgHidanHamstep* this, GlobalContext* globalCtx) { } } -void func_80888A58(BgHidanHamstep* this, GlobalContext* globalCtx) { +void func_80888A58(BgHidanHamstep* this, PlayState* play) { s32 pad; s32 pad2; s32 quakeIndex; @@ -367,14 +367,14 @@ void func_80888A58(BgHidanHamstep* this, GlobalContext* globalCtx) { if (1) {} if (this->unk_244 == 1) { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIndex, -15536); Quake_SetQuakeValues(quakeIndex, 20, 1, 0, 0); Quake_SetCountdown(quakeIndex, 7); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); func_800AA000(10000.0f, 255, 20, 150); - func_808884C8(this, globalCtx); + func_808884C8(this, play); if ((this->dyna.actor.params & 0xFF) == 5) { func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -386,21 +386,21 @@ void func_80888A58(BgHidanHamstep* this, GlobalContext* globalCtx) { } } -void BgHidanHamstep_DoNothing(BgHidanHamstep* this, GlobalContext* globalCtx) { +void BgHidanHamstep_DoNothing(BgHidanHamstep* this, PlayState* play) { } -void BgHidanHamstep_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHamstep_Update(Actor* thisx, PlayState* play) { BgHidanHamstep* this = (BgHidanHamstep*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHidanHamstep_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_hamstep.c", 782); +void BgHidanHamstep_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_hidan_hamstep.c", 782); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_hamstep.c", 787), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_hidan_hamstep.c", 787), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if ((thisx->params & 0xFF) == 0) { @@ -409,5 +409,5 @@ void BgHidanHamstep_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gFireTempleStoneStep2DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_hamstep.c", 796); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_hamstep.c", 796); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h index 223ac6278f..eca062fa95 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h @@ -6,7 +6,7 @@ struct BgHidanHamstep; -typedef void (*BgHidanHamstepActionFunc)(struct BgHidanHamstep*, GlobalContext*); +typedef void (*BgHidanHamstepActionFunc)(struct BgHidanHamstep*, PlayState*); typedef struct BgHidanHamstep { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c index cf17e98a56..45f3ccd824 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c @@ -9,14 +9,14 @@ #define FLAGS 0 -void BgHidanHrock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHrock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHrock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanHrock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanHrock_Init(Actor* thisx, PlayState* play); +void BgHidanHrock_Destroy(Actor* thisx, PlayState* play); +void BgHidanHrock_Update(Actor* thisx, PlayState* play); +void BgHidanHrock_Draw(Actor* thisx, PlayState* play); -void func_8088960C(BgHidanHrock* this, GlobalContext* globalCtx); -void func_808896B8(BgHidanHrock* this, GlobalContext* globalCtx); -void func_808894A4(BgHidanHrock* this, GlobalContext* globalCtx); +void func_8088960C(BgHidanHrock* this, PlayState* play); +void func_808896B8(BgHidanHrock* this, PlayState* play); +void func_808894A4(BgHidanHrock* this, PlayState* play); const ActorInit Bg_Hidan_Hrock_InitVars = { ACTOR_BG_HIDAN_HROCK, @@ -73,7 +73,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(gravity, -1, ICHAIN_STOP), }; -void BgHidanHrock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHrock_Init(Actor* thisx, PlayState* play) { BgHidanHrock* this = (BgHidanHrock*)thisx; ColliderTrisElementInit* colliderElementInit; Vec3f vertices[3]; @@ -86,8 +86,8 @@ void BgHidanHrock_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); this->unk_16A = thisx->params & 0x3F; thisx->params = (thisx->params >> 8) & 0xFF; - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, thisx, &sTrisInit, this->colliderItems); + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); DynaPolyActor_Init(&this->dyna, DPM_UNK); sinRotY = Math_SinS(thisx->shape.rot.y); @@ -113,7 +113,7 @@ void BgHidanHrock_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetTrisVertices(&this->collider, i, &vertices[0], &vertices[1], &vertices[2]); } - if (Flags_GetSwitch(globalCtx, this->unk_16A)) { + if (Flags_GetSwitch(play, this->unk_16A)) { this->actionFunc = func_808894A4; if (thisx->params == 0) { thisx->world.pos.y -= 2800.0f; @@ -137,20 +137,20 @@ void BgHidanHrock_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gFireTemplePillarInsertedInGroundCol, &collisionHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, collisionHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, collisionHeader); } -void BgHidanHrock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHrock_Destroy(Actor* thisx, PlayState* play) { BgHidanHrock* this = (BgHidanHrock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyTris(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyTris(play, &this->collider); } -void func_808894A4(BgHidanHrock* this, GlobalContext* globalCtx) { +void func_808894A4(BgHidanHrock* this, PlayState* play) { } -void func_808894B0(BgHidanHrock* this, GlobalContext* globalCtx) { +void func_808894B0(BgHidanHrock* this, PlayState* play) { if (this->unk_168 != 0) { this->unk_168--; } @@ -180,7 +180,7 @@ void func_808894B0(BgHidanHrock* this, GlobalContext* globalCtx) { } } -void func_8088960C(BgHidanHrock* this, GlobalContext* globalCtx) { +void func_8088960C(BgHidanHrock* this, PlayState* play) { this->dyna.actor.velocity.y++; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { @@ -188,7 +188,7 @@ void func_8088960C(BgHidanHrock* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); if (this->dyna.actor.params == 0) { - if (globalCtx->roomCtx.curRoom.num == 10) { + if (play->roomCtx.curRoom.num == 10) { this->dyna.actor.room = 10; } else { Actor_Kill(&this->dyna.actor); @@ -199,7 +199,7 @@ void func_8088960C(BgHidanHrock* this, GlobalContext* globalCtx) { } } -void func_808896B8(BgHidanHrock* this, GlobalContext* globalCtx) { +void func_808896B8(BgHidanHrock* this, PlayState* play) { if (this->collider.base.acFlags & 2) { this->collider.base.acFlags &= ~2; this->actionFunc = func_808894B0; @@ -210,9 +210,9 @@ void func_808896B8(BgHidanHrock* this, GlobalContext* globalCtx) { } this->unk_168 = 20; - Flags_SetSwitch(globalCtx, this->unk_16A); + Flags_SetSwitch(play, this->unk_16A); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (func_8004356C(&this->dyna)) { @@ -222,18 +222,18 @@ void func_808896B8(BgHidanHrock* this, GlobalContext* globalCtx) { } } -void BgHidanHrock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHrock_Update(Actor* thisx, PlayState* play) { BgHidanHrock* this = (BgHidanHrock*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHidanHrock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanHrock_Draw(Actor* thisx, PlayState* play) { static Gfx* dlists[] = { gFireTempleTallestPillarAboveRoomBeforeBossDL, gFireTemplePillarInsertedInGroundDL, gFireTemplePillarInsertedInGroundDL, }; - Gfx_DrawDListOpa(globalCtx, dlists[thisx->params]); + Gfx_DrawDListOpa(play, dlists[thisx->params]); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h index 3333f5bc4f..9835f68873 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h @@ -6,7 +6,7 @@ struct BgHidanHrock; -typedef void (*BgHidanHrockActionFunc)(struct BgHidanHrock*, GlobalContext*); +typedef void (*BgHidanHrockActionFunc)(struct BgHidanHrock*, PlayState*); typedef struct BgHidanHrock { /* 0x0000 */ DynaPolyActor dyna; 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 71c5b8f1d8..bf02792373 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 @@ -9,17 +9,17 @@ #define FLAGS ACTOR_FLAG_4 -void BgHidanKousi_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKousi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKousi_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKousi_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanKousi_Init(Actor* thisx, PlayState* play); +void BgHidanKousi_Destroy(Actor* thisx, PlayState* play); +void BgHidanKousi_Update(Actor* thisx, PlayState* play); +void BgHidanKousi_Draw(Actor* thisx, PlayState* play); void func_80889ACC(BgHidanKousi* this); -void func_80889B5C(BgHidanKousi* this, GlobalContext* globalCtx); -void func_80889BC0(BgHidanKousi* this, GlobalContext* globalCtx); -void func_80889C18(BgHidanKousi* this, GlobalContext* globalCtx); -void func_80889C90(BgHidanKousi* this, GlobalContext* globalCtx); -void func_80889D28(BgHidanKousi* this, GlobalContext* globalCtx); +void func_80889B5C(BgHidanKousi* this, PlayState* play); +void func_80889BC0(BgHidanKousi* this, PlayState* play); +void func_80889C18(BgHidanKousi* this, PlayState* play); +void func_80889C90(BgHidanKousi* this, PlayState* play); +void func_80889D28(BgHidanKousi* this, PlayState* play); static f32 D_80889E40[] = { 120.0f, 150.0f, 150.0f }; @@ -62,7 +62,7 @@ void BgHidanKousi_SetupAction(BgHidanKousi* this, BgHidanKousiActionFunc actionF this->actionFunc = actionFunc; } -void BgHidanKousi_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKousi_Init(Actor* thisx, PlayState* play) { BgHidanKousi* this = (BgHidanKousi*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -78,9 +78,9 @@ void BgHidanKousi_Init(Actor* thisx, GlobalContext* globalCtx) { } CollisionHeader_GetVirtual(sMetalFencesCollisions[thisx->params & 0xFF], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); thisx->world.rot.y = D_80889E7C[this->dyna.actor.params & 0xFF] + thisx->shape.rot.y; - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0xFF)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0xFF)) { func_80889ACC(this); BgHidanKousi_SetupAction(this, func_80889D28); } else { @@ -88,9 +88,9 @@ void BgHidanKousi_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgHidanKousi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKousi_Destroy(Actor* thisx, PlayState* play) { BgHidanKousi* this = (BgHidanKousi*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80889ACC(BgHidanKousi* this) { @@ -103,22 +103,22 @@ void func_80889ACC(BgHidanKousi* this) { this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + temp2; } -void func_80889B5C(BgHidanKousi* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0xFF)) { +void func_80889B5C(BgHidanKousi* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF)) { BgHidanKousi_SetupAction(this, func_80889BC0); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->unk_168 = 0xC8; } } -void func_80889BC0(BgHidanKousi* this, GlobalContext* globalCtx) { +void func_80889BC0(BgHidanKousi* this, PlayState* play) { this->unk_168 -= 1; if (this->dyna.actor.category == func_8005B198() || (this->unk_168 <= 0)) { BgHidanKousi_SetupAction(this, func_80889C18); } } -void func_80889C18(BgHidanKousi* this, GlobalContext* globalCtx) { +void func_80889C18(BgHidanKousi* this, PlayState* play) { this->dyna.actor.speedXZ += 0.2f; if (this->dyna.actor.speedXZ > 2.0f) { this->dyna.actor.speedXZ = 2.0f; @@ -128,7 +128,7 @@ void func_80889C18(BgHidanKousi* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG); } -void func_80889C90(BgHidanKousi* this, GlobalContext* globalCtx) { +void func_80889C90(BgHidanKousi* this, PlayState* play) { func_8002D7EC(&this->dyna.actor); if (D_80889E40[this->dyna.actor.params & 0xFF] < Math_Vec3f_DistXYZ(&this->dyna.actor.home.pos, &this->dyna.actor.world.pos)) { @@ -140,23 +140,23 @@ void func_80889C90(BgHidanKousi* this, GlobalContext* globalCtx) { } } -void func_80889D28(BgHidanKousi* this, GlobalContext* globalCtx) { +void func_80889D28(BgHidanKousi* this, PlayState* play) { } -void BgHidanKousi_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKousi_Update(Actor* thisx, PlayState* play) { BgHidanKousi* this = (BgHidanKousi*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHidanKousi_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 350); +void BgHidanKousi_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_hidan_kousi.c", 350); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 354), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_hidan_kousi.c", 354), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sMetalFencesDLs[thisx->params & 0xFF]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 359); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_kousi.c", 359); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h index 5507726ae9..94a5aad2a9 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h @@ -6,7 +6,7 @@ struct BgHidanKousi; -typedef void (*BgHidanKousiActionFunc)(struct BgHidanKousi*, GlobalContext*); +typedef void (*BgHidanKousiActionFunc)(struct BgHidanKousi*, PlayState*); typedef struct BgHidanKousi { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c index ad17a3ec47..1c2481326b 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c @@ -17,10 +17,10 @@ typedef enum { /* 2 */ LARGE_BOMBABLE_WALL } FireTempleBombableObjectsType; -void BgHidanKowarerukabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKowarerukabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKowarerukabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanKowarerukabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanKowarerukabe_Init(Actor* thisx, PlayState* play); +void BgHidanKowarerukabe_Destroy(Actor* thisx, PlayState* play); +void BgHidanKowarerukabe_Update(Actor* thisx, PlayState* play); +void BgHidanKowarerukabe_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Hidan_Kowarerukabe_InitVars = { ACTOR_BG_HIDAN_KOWARERUKABE, @@ -67,7 +67,7 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -void BgHidanKowarerukabe_InitDynaPoly(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_InitDynaPoly(BgHidanKowarerukabe* this, PlayState* play) { static CollisionHeader* collisionHeaders[] = { &gFireTempleCrackedStoneFloorCol, &gFireTempleBombableWallCol, @@ -80,19 +80,19 @@ void BgHidanKowarerukabe_InitDynaPoly(BgHidanKowarerukabe* this, GlobalContext* if (collisionHeaders[this->dyna.actor.params & 0xFF] != NULL) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(collisionHeaders[this->dyna.actor.params & 0xFF], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } else { this->dyna.bgId = BGACTOR_NEG_ONE; } } -void BgHidanKowarerukabe_InitColliderSphere(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_InitColliderSphere(BgHidanKowarerukabe* this, PlayState* play) { static s16 sphereRadii[] = { 80, 45, 80 }; static s16 sphereYPositions[] = { 0, 500, 500 }; s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); this->collider.elements[0].dim.modelSphere.radius = sphereRadii[this->dyna.actor.params & 0xFF]; this->collider.elements[0].dim.modelSphere.center.y = sphereYPositions[this->dyna.actor.params & 0xFF]; @@ -110,10 +110,10 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgHidanKowarerukabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_Init(Actor* thisx, PlayState* play) { BgHidanKowarerukabe* this = (BgHidanKowarerukabe*)thisx; - BgHidanKowarerukabe_InitDynaPoly(this, globalCtx); + BgHidanKowarerukabe_InitDynaPoly(this, play); if (((this->dyna.actor.params & 0xFF) < CRACKED_STONE_FLOOR) || ((this->dyna.actor.params & 0xFF) > LARGE_BOMBABLE_WALL)) { @@ -124,43 +124,43 @@ void BgHidanKowarerukabe_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { Actor_Kill(&this->dyna.actor); return; } Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_SetScale(&this->dyna.actor, 0.1f); - BgHidanKowarerukabe_InitColliderSphere(this, globalCtx); + BgHidanKowarerukabe_InitColliderSphere(this, play); BgHidanKowarerukabe_OffsetActorYPos(this); // "(fire walls, floors, destroyed by bombs)(arg_data 0x%04x)" osSyncPrintf("(hidan 爆弾で壊れる 壁 床)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgHidanKowarerukabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_Destroy(Actor* thisx, PlayState* play) { BgHidanKowarerukabe* this = (BgHidanKowarerukabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void BgHidanKowarerukabe_SpawnDust(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_SpawnDust(BgHidanKowarerukabe* this, PlayState* play) { s32 pad; Vec3f pos; pos = this->dyna.actor.world.pos; pos.y += 10.0f; - func_80033480(globalCtx, &pos, 0.0f, 0, 600, 300, 1); + func_80033480(play, &pos, 0.0f, 0, 600, 300, 1); pos.x = ((Rand_ZeroOne() - 0.5f) * 80.0f) + this->dyna.actor.world.pos.x; pos.y = (Rand_ZeroOne() * 100.0f) + this->dyna.actor.world.pos.y; pos.z = ((Rand_ZeroOne() - 0.5f) * 80.0f) + this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &pos, 100.0f, 4, 200, 250, 1); + func_80033480(play, &pos, 100.0f, 4, 200, 250, 1); } -void BgHidanKowarerukabe_FloorBreak(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_FloorBreak(BgHidanKowarerukabe* this, PlayState* play) { s32 i; s32 j; Vec3f velocity; @@ -194,13 +194,13 @@ void BgHidanKowarerukabe_FloorBreak(BgHidanKowarerukabe* this, GlobalContext* gl arg5 = (((i == 0) || (i == 4)) && ((j == 0) || (j == 4))) ? 65 : 64; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &thisx->world.pos, -550, arg5, 15, 15, 0, arg9, 2, 16, 100, + EffectSsKakera_Spawn(play, &pos, &velocity, &thisx->world.pos, -550, arg5, 15, 15, 0, arg9, 2, 16, 100, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gBrownFragmentDL); } } } -void func_8088A67C(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void func_8088A67C(BgHidanKowarerukabe* this, PlayState* play) { s32 i; s32 j; Vec3f velocity; @@ -235,13 +235,13 @@ void func_8088A67C(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { arg5 |= 1; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &thisx->world.pos, -540, arg5, 20, 20, 0, arg9, 2, 32, 100, + EffectSsKakera_Spawn(play, &pos, &velocity, &thisx->world.pos, -540, arg5, 20, 20, 0, arg9, 2, 32, 100, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gBrownFragmentDL); } } } -void BgHidanKowarerukabe_LargeWallBreak(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_LargeWallBreak(BgHidanKowarerukabe* this, PlayState* play) { s32 i; s32 j; Vec3f velocity; @@ -276,40 +276,40 @@ void BgHidanKowarerukabe_LargeWallBreak(BgHidanKowarerukabe* this, GlobalContext arg5 |= 1; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &thisx->world.pos, -650, arg5, 20, 20, 0, arg9, 2, 32, 100, + EffectSsKakera_Spawn(play, &pos, &velocity, &thisx->world.pos, -650, arg5, 20, 20, 0, arg9, 2, 32, 100, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gBrownFragmentDL); } } } -void BgHidanKowarerukabe_Break(BgHidanKowarerukabe* this, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_Break(BgHidanKowarerukabe* this, PlayState* play) { switch (this->dyna.actor.params & 0xFF) { case CRACKED_STONE_FLOOR: - BgHidanKowarerukabe_FloorBreak(this, globalCtx); + BgHidanKowarerukabe_FloorBreak(this, play); break; case BOMBABLE_WALL: - func_8088A67C(this, globalCtx); + func_8088A67C(this, play); break; case LARGE_BOMBABLE_WALL: - BgHidanKowarerukabe_LargeWallBreak(this, globalCtx); + BgHidanKowarerukabe_LargeWallBreak(this, play); break; } - BgHidanKowarerukabe_SpawnDust(this, globalCtx); + BgHidanKowarerukabe_SpawnDust(this, play); } -void BgHidanKowarerukabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_Update(Actor* thisx, PlayState* play) { BgHidanKowarerukabe* this = (BgHidanKowarerukabe*)thisx; s32 pad; - if (Actor_GetCollidedExplosive(globalCtx, &this->collider.base) != NULL) { - BgHidanKowarerukabe_Break(this, globalCtx); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + if (Actor_GetCollidedExplosive(play, &this->collider.base) != NULL) { + BgHidanKowarerukabe_Break(this, play); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); if ((this->dyna.actor.params & 0xFF) == 0) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_EXPLOSION); } else { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); } func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -317,21 +317,21 @@ void BgHidanKowarerukabe_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void BgHidanKowarerukabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanKowarerukabe_Draw(Actor* thisx, PlayState* play) { BgHidanKowarerukabe* this = (BgHidanKowarerukabe*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_kowarerukabe.c", 565); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_hidan_kowarerukabe.c", 565); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_kowarerukabe.c", 568), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_hidan_kowarerukabe.c", 568), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sBreakableWallDLists[this->dyna.actor.params & 0xFF]); Collider_UpdateSpheres(0, &this->collider); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_kowarerukabe.c", 573); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_kowarerukabe.c", 573); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index c9337bfc5c..4efa55925c 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -9,23 +9,23 @@ #define FLAGS 0 -void BgHidanRock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanRock_Init(Actor* thisx, PlayState* play); +void BgHidanRock_Destroy(Actor* thisx, PlayState* play); +void BgHidanRock_Update(Actor* thisx, PlayState* play); +void BgHidanRock_Draw(Actor* thisx, PlayState* play); void func_8088B24C(BgHidanRock* this); -void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B5F4(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B634(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B69C(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B79C(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B90C(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B954(BgHidanRock* this, GlobalContext* globalCtx); -void func_8088B990(BgHidanRock* this, GlobalContext* globalCtx); +void func_8088B268(BgHidanRock* this, PlayState* play); +void func_8088B5F4(BgHidanRock* this, PlayState* play); +void func_8088B634(BgHidanRock* this, PlayState* play); +void func_8088B69C(BgHidanRock* this, PlayState* play); +void func_8088B79C(BgHidanRock* this, PlayState* play); +void func_8088B90C(BgHidanRock* this, PlayState* play); +void func_8088B954(BgHidanRock* this, PlayState* play); +void func_8088B990(BgHidanRock* this, PlayState* play); -void func_8088BC40(GlobalContext* globalCtx, BgHidanRock* this); +void func_8088BC40(PlayState* play, BgHidanRock* this); static Vec3f D_8088BF60 = { 3310.0f, 120.0f, 0.0f }; @@ -66,7 +66,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -600, ICHAIN_STOP), }; -void BgHidanRock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRock_Init(Actor* thisx, PlayState* play) { BgHidanRock* this = (BgHidanRock*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -79,11 +79,11 @@ void BgHidanRock_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params = ((thisx->params) >> 8) & 0xFF; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); if (this->type == 0) { - if (Flags_GetSwitch(globalCtx, thisx->params)) { + if (Flags_GetSwitch(play, thisx->params)) { Math_Vec3f_Copy(&thisx->home.pos, &D_8088BF60); Math_Vec3f_Copy(&thisx->world.pos, &D_8088BF60); this->timer = 60; @@ -101,15 +101,15 @@ void BgHidanRock_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_8088B634; } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->timer = 0; } -void BgHidanRock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRock_Destroy(Actor* thisx, PlayState* play) { BgHidanRock* this = (BgHidanRock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); Audio_StopSfxByPos(&this->unk_170); } @@ -118,12 +118,12 @@ void func_8088B24C(BgHidanRock* this) { this->actionFunc = func_8088B990; } -void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B268(BgHidanRock* this, PlayState* play) { static f32 D_8088BFC0 = 0.0f; f32 sp2C; s32 temp_v1; s32 frame; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { if (this->timer == 0) { @@ -171,7 +171,7 @@ void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { sp2C = this->dyna.actor.world.pos.z - D_8088BF60.z; if (sp2C < 0.5f) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params); + Flags_SetSwitch(play, this->dyna.actor.params); Math_Vec3f_Copy(&this->dyna.actor.home.pos, &D_8088BF60); this->dyna.actor.world.pos.x = D_8088BF60.x; this->dyna.actor.world.pos.z = D_8088BF60.z; @@ -181,8 +181,8 @@ void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { this->actionFunc = func_8088B79C; } - frame = globalCtx->gameplayFrames & 0xFF; - if (globalCtx->gameplayFrames & 0x100) { + frame = play->gameplayFrames & 0xFF; + if (play->gameplayFrames & 0x100) { this->unk_16C = 0.0f; } else if (frame < 128) { this->unk_16C = sinf(frame * (4 * 0.001f * M_PI)) * 19.625f; @@ -198,7 +198,7 @@ void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { } } -void func_8088B5F4(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B5F4(BgHidanRock* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -208,15 +208,15 @@ void func_8088B5F4(BgHidanRock* this, GlobalContext* globalCtx) { } } -void func_8088B634(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B634(BgHidanRock* this, PlayState* play) { if (func_8004356C(&this->dyna)) { this->timer = 20; - this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4000; + this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4000; this->actionFunc = func_8088B69C; } } -void func_8088B69C(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B69C(BgHidanRock* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -238,7 +238,7 @@ void func_8088B69C(BgHidanRock* this, GlobalContext* globalCtx) { } } -void func_8088B79C(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B79C(BgHidanRock* this, PlayState* play) { this->timer--; if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (this->type == 0) { @@ -253,7 +253,7 @@ void func_8088B79C(BgHidanRock* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); Audio_PlayActorSound2( &this->dyna.actor, - SurfaceType_GetSfx(&globalCtx->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + 0x800); + SurfaceType_GetSfx(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + 0x800); } this->unk_16C -= 0.5f; @@ -264,23 +264,23 @@ void func_8088B79C(BgHidanRock* this, GlobalContext* globalCtx) { if (this->unk_169 == 0) { this->unk_169 = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_169 != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } this->unk_169 = 0; } } } -void func_8088B90C(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B90C(BgHidanRock* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f)) { this->actionFunc = func_8088B634; } } -void func_8088B954(BgHidanRock* this, GlobalContext* globalCtx) { +void func_8088B954(BgHidanRock* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -291,8 +291,8 @@ void func_8088B954(BgHidanRock* this, GlobalContext* globalCtx) { } } -void func_8088B990(BgHidanRock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088B990(BgHidanRock* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->timer++; if (this->dyna.unk_150 != 0.0f) { @@ -317,28 +317,28 @@ void func_8088B990(BgHidanRock* this, GlobalContext* globalCtx) { if (this->unk_169 == 0) { this->unk_169 = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_169 != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } this->unk_169 = 0; } } } -void BgHidanRock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRock_Update(Actor* thisx, PlayState* play) { BgHidanRock* this = (BgHidanRock*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc == func_8088B79C) { Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); } if (this->unk_16C > 0.0f) { this->collider.dim.height = sCylinderInit.dim.height * this->unk_16C; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } @@ -348,10 +348,10 @@ static void* sVerticalFlamesTexs[] = { gFireTempleBigVerticalFlame6Tex, gFireTempleBigVerticalFlame7Tex, }; -void func_8088BC40(GlobalContext* globalCtx, BgHidanRock* this) { +void func_8088BC40(PlayState* play, BgHidanRock* this) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_rock.c", 808); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_hidan_rock.c", 808); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x01, 255, 255, 0, 150); @@ -364,36 +364,36 @@ void func_8088BC40(GlobalContext* globalCtx, BgHidanRock* this) { MTXMODE_NEW); } - Matrix_RotateZYX(0, Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000, 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000, 0, MTXMODE_APPLY); Matrix_Translate(-10.5f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(6.0f, this->unk_16C, 6.0f, MTXMODE_APPLY); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sVerticalFlamesTexs[globalCtx->gameplayFrames & 7])); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_rock.c", 853), + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sVerticalFlamesTexs[play->gameplayFrames & 7])); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_hidan_rock.c", 853), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFireTempleBigVerticalFlameDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_rock.c", 857); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_rock.c", 857); } -void BgHidanRock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRock_Draw(Actor* thisx, PlayState* play) { BgHidanRock* this = (BgHidanRock*)thisx; s32 pad; if (this->type == 0) { - Gfx_DrawDListOpa(globalCtx, gFireTempleStoneBlock1DL); + Gfx_DrawDListOpa(play, gFireTempleStoneBlock1DL); } else { - Gfx_DrawDListOpa(globalCtx, gFireTempleStoneBlock2DL); + Gfx_DrawDListOpa(play, gFireTempleStoneBlock2DL); } if (this->unk_16C > 0.0f) { if (this->type == 0) { - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &D_8088BF60, &this->unk_170); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &D_8088BF60, &this->unk_170); } else { - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->dyna.actor.home.pos, &this->unk_170); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->dyna.actor.home.pos, &this->unk_170); } func_80078914(&this->unk_170, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); - func_8088BC40(globalCtx, this); + func_8088BC40(play, this); } } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.h b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.h index a65c4234ea..35ba9ef625 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.h @@ -6,7 +6,7 @@ struct BgHidanRock; -typedef void (*BgHidanRockActionFunc)(struct BgHidanRock*, GlobalContext*); +typedef void (*BgHidanRockActionFunc)(struct BgHidanRock*, PlayState*); typedef struct BgHidanRock { /* 0x0000 */ DynaPolyActor dyna; 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 e7afaa7009..9f7c6dfd51 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 @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgHidanRsekizou_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRsekizou_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRsekizou_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanRsekizou_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanRsekizou_Init(Actor* thisx, PlayState* play); +void BgHidanRsekizou_Destroy(Actor* thisx, PlayState* play); +void BgHidanRsekizou_Update(Actor* thisx, PlayState* play); +void BgHidanRsekizou_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Hidan_Rsekizou_InitVars = { ACTOR_BG_HIDAN_RSEKIZOU, @@ -119,7 +119,7 @@ static void* sFireballsTexs[] = { gFireTempleFireball4Tex, gFireTempleFireball5Tex, gFireTempleFireball6Tex, gFireTempleFireball7Tex, }; -void BgHidanRsekizou_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRsekizou_Init(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; s32 i; s32 pad; @@ -129,9 +129,9 @@ void BgHidanRsekizou_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gFireTempleSpinningFlamethrowerCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + 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->colliderItems); for (i = 0; i < ARRAY_COUNT(this->colliderItems); i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } @@ -139,14 +139,14 @@ void BgHidanRsekizou_Init(Actor* thisx, GlobalContext* globalCtx) { this->bendFrame = 0; } -void BgHidanRsekizou_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRsekizou_Destroy(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void BgHidanRsekizou_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRsekizou_Update(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; s32 i; ColliderJntSphElement* sphere; @@ -177,11 +177,11 @@ void BgHidanRsekizou_Update(Actor* thisx, GlobalContext* globalCtx) { yawCosine * sphere->dim.modelSphere.center.z; } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); func_8002F974(&this->dyna.actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); } -Gfx* BgHidanRsekizou_DrawFireball(GlobalContext* globalCtx, BgHidanRsekizou* this, s16 frame, MtxF* mf, s32 a, +Gfx* BgHidanRsekizou_DrawFireball(PlayState* play, BgHidanRsekizou* this, s16 frame, MtxF* mf, s32 a, Gfx* displayList) { f32 coss; f32 sins; @@ -215,47 +215,47 @@ Gfx* BgHidanRsekizou_DrawFireball(GlobalContext* globalCtx, BgHidanRsekizou* thi gSPMatrix(displayList++, Matrix_MtxFToMtx(Matrix_CheckFloats(mf, "../z_bg_hidan_rsekizou.c", 543), - Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx))), + Graph_Alloc(play->state.gfxCtx, sizeof(Mtx))), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(displayList++, gFireTempleFireballDL); return displayList; } -void BgHidanRsekizou_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanRsekizou_Draw(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; s32 i; s32 pad; MtxF mf; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 564); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 564); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 568), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 568), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFireTempleSpinningFlamethrowerDL); Matrix_MtxFCopy(&mf, &gMtxFClear); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); - if ((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->dyna.actor.shape.rot.y) - 0x2E6C) >= 0) { + 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(globalCtx, this, i, &mf, 0, POLY_XLU_DISP); + POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 0, POLY_XLU_DISP); } for (i = 0; i < 4; i++) { - POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 1, POLY_XLU_DISP); + POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 1, POLY_XLU_DISP); } } else { for (i = 3; i >= 0; i--) { - POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 1, POLY_XLU_DISP); + POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 1, POLY_XLU_DISP); } for (i = 0; i < 4; i++) { - POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 0, POLY_XLU_DISP); + POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 0, POLY_XLU_DISP); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 600); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 600); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c index 5218065e39..2f3addde40 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c @@ -9,13 +9,13 @@ #define FLAGS 0 -void BgHidanSekizou_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSekizou_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSekizou_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSekizou_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanSekizou_Init(Actor* thisx, PlayState* play); +void BgHidanSekizou_Destroy(Actor* thisx, PlayState* play); +void BgHidanSekizou_Update(Actor* thisx, PlayState* play); +void BgHidanSekizou_Draw(Actor* thisx, PlayState* play); -void func_8088D434(BgHidanSekizou* this, GlobalContext* globalCtx); -void func_8088D720(BgHidanSekizou* this, GlobalContext* globalCtx); +void func_8088D434(BgHidanSekizou* this, PlayState* play); +void func_8088D720(BgHidanSekizou* this, PlayState* play); const ActorInit Bg_Hidan_Sekizou_InitVars = { ACTOR_BG_HIDAN_SEKIZOU, @@ -144,7 +144,7 @@ void func_8088CEC0(BgHidanSekizou* this, s32 arg1, s16 arg2) { } } -void BgHidanSekizou_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSekizou_Init(Actor* thisx, PlayState* play) { s32 pad; BgHidanSekizou* this = (BgHidanSekizou*)thisx; s32 i; @@ -152,8 +152,8 @@ void BgHidanSekizou_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->elements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->elements); for (i = 0; i < ARRAY_COUNT(this->elements); i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } @@ -170,20 +170,20 @@ void BgHidanSekizou_Init(Actor* thisx, GlobalContext* globalCtx) { this->updateFunc = func_8088D434; } this->unk_170 = 0; - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); CollisionCheck_SetInfo(&this->dyna.actor.colChkInfo, NULL, &sColChkInfoInit); } -void BgHidanSekizou_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgHidanSekizou_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgHidanSekizou* this = (BgHidanSekizou*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void func_8088D434(BgHidanSekizou* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088D434(BgHidanSekizou* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; s32 isAligned[2]; s32 isClose; @@ -215,14 +215,14 @@ void func_8088D434(BgHidanSekizou* this, GlobalContext* globalCtx) { } } -void func_8088D720(BgHidanSekizou* this, GlobalContext* globalCtx) { +void func_8088D720(BgHidanSekizou* this, PlayState* play) { this->unk_168[0]--; if (this->unk_168[0] <= -36) { this->unk_168[0] = 36; } } -void func_8088D750(BgHidanSekizou* this, GlobalContext* globalCtx) { +void func_8088D750(BgHidanSekizou* this, PlayState* play) { s16 phi_a3; if (this->dyna.actor.xzDistToPlayer > 200.0f) { @@ -258,11 +258,11 @@ void func_8088D750(BgHidanSekizou* this, GlobalContext* globalCtx) { phi_a3 = -0x4000; } } - func_8002F71C(globalCtx, &this->dyna.actor, 5.0f, phi_a3, 1.0f); + func_8002F71C(play, &this->dyna.actor, 5.0f, phi_a3, 1.0f); } -void BgHidanSekizou_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgHidanSekizou_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgHidanSekizou* this = (BgHidanSekizou*)thisx; if (this->unk_170 != 0) { @@ -274,27 +274,27 @@ void BgHidanSekizou_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8088D750(this, globalCtx); + func_8088D750(this, play); } - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); if (this->dyna.actor.params == 0) { if (this->unk_168[0] > 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); func_8002F974(&this->dyna.actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); } } else { if ((this->unk_168[0] > 0) || (this->unk_168[1] > 0) || (this->unk_168[2] > 0) || (this->unk_168[3] > 0)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); func_8002F974(&this->dyna.actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); } } } -Gfx* func_8088D9F4(GlobalContext* globalCtx, BgHidanSekizou* this, s16 arg2, MtxF* arg3, f32 arg4, f32 arg5, s16 arg6, +Gfx* func_8088D9F4(PlayState* play, BgHidanSekizou* this, s16 arg2, MtxF* arg3, f32 arg4, f32 arg5, s16 arg6, Gfx* arg7) { f32 temp_f0; f32 temp_f2; @@ -319,7 +319,7 @@ Gfx* func_8088D9F4(GlobalContext* globalCtx, BgHidanSekizou* this, s16 arg2, Mtx arg3->zw = (temp_f2 * arg5) + this->dyna.actor.world.pos.z; gSPMatrix(arg7++, Matrix_MtxFToMtx(Matrix_CheckFloats(arg3, "../z_bg_hidan_sekizou.c", 711), - Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx))), + Graph_Alloc(play->state.gfxCtx, sizeof(Mtx))), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(arg7++, gFireTempleFireballDL); @@ -327,7 +327,7 @@ Gfx* func_8088D9F4(GlobalContext* globalCtx, BgHidanSekizou* this, s16 arg2, Mtx return arg7; } -Gfx* func_8088DC50(GlobalContext* globalCtx, BgHidanSekizou* this, s16 arg2, s16 arg3, Gfx* arg4) { +Gfx* func_8088DC50(PlayState* play, BgHidanSekizou* this, s16 arg2, s16 arg3, Gfx* arg4) { s32 pad; s16 temp_v1; s32 phi_s1; @@ -348,15 +348,15 @@ Gfx* func_8088DC50(GlobalContext* globalCtx, BgHidanSekizou* this, s16 arg2, s16 temp_f20 = Math_SinS(arg2); temp_f22 = Math_CosS(arg2); Matrix_MtxFCopy(&sp68, &gMtxFClear); - temp_v1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - arg2; + temp_v1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - arg2; if (ABS(temp_v1) < 0x4000) { for (i = phi_s2 - 1; i >= phi_s1; i--) { - arg4 = func_8088D9F4(globalCtx, this, i, &sp68, temp_f20, temp_f22, arg3, arg4); + arg4 = func_8088D9F4(play, this, i, &sp68, temp_f20, temp_f22, arg3, arg4); } } else { for (i = phi_s1; i < phi_s2; i++) { - arg4 = func_8088D9F4(globalCtx, this, i, &sp68, temp_f20, temp_f22, arg3, arg4); + arg4 = func_8088D9F4(play, this, i, &sp68, temp_f20, temp_f22, arg3, arg4); } } return arg4; @@ -388,15 +388,15 @@ void func_8088DE08(s16 arg0, s16 arg1, s32 arg2[]) { } } -void BgHidanSekizou_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgHidanSekizou_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgHidanSekizou* this = (BgHidanSekizou*)thisx; s32 i; s32 sp6C[4]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_sekizou.c", 827); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_sekizou.c", 831), + OPEN_DISPS(play->state.gfxCtx, "../z_bg_hidan_sekizou.c", 827); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_hidan_sekizou.c", 831), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->dyna.actor.params == 0) { gSPDisplayList(POLY_OPA_DISP++, gFireTempleStationaryFlamethrowerShortDL); @@ -406,28 +406,28 @@ void BgHidanSekizou_Draw(Actor* thisx, GlobalContext* globalCtx2) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); if (this->dyna.actor.params == 0) { if (this->unk_168[0] > 0) { - if ((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->dyna.actor.shape.rot.y) >= 0) { - POLY_XLU_DISP = func_8088DC50(globalCtx, this, this->dyna.actor.shape.rot.y + 0x2000, this->unk_168[0], - POLY_XLU_DISP); - POLY_XLU_DISP = func_8088DC50(globalCtx, this, this->dyna.actor.shape.rot.y - 0x2000, this->unk_168[0], - POLY_XLU_DISP); + if ((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->dyna.actor.shape.rot.y) >= 0) { + POLY_XLU_DISP = + func_8088DC50(play, this, this->dyna.actor.shape.rot.y + 0x2000, this->unk_168[0], POLY_XLU_DISP); + POLY_XLU_DISP = + func_8088DC50(play, this, this->dyna.actor.shape.rot.y - 0x2000, this->unk_168[0], POLY_XLU_DISP); } else { - POLY_XLU_DISP = func_8088DC50(globalCtx, this, this->dyna.actor.shape.rot.y - 0x2000, this->unk_168[0], - POLY_XLU_DISP); - POLY_XLU_DISP = func_8088DC50(globalCtx, this, this->dyna.actor.shape.rot.y + 0x2000, this->unk_168[0], - POLY_XLU_DISP); + POLY_XLU_DISP = + func_8088DC50(play, this, this->dyna.actor.shape.rot.y - 0x2000, this->unk_168[0], POLY_XLU_DISP); + POLY_XLU_DISP = + func_8088DC50(play, this, this->dyna.actor.shape.rot.y + 0x2000, this->unk_168[0], POLY_XLU_DISP); } } } else { - func_8088DE08(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)), this->dyna.actor.shape.rot.y, sp6C); + func_8088DE08(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)), this->dyna.actor.shape.rot.y, sp6C); for (i = 0; i < 4; i++) { s32 index = sp6C[i]; if (this->unk_168[index] > 0) { - POLY_XLU_DISP = func_8088DC50(globalCtx, this, this->dyna.actor.shape.rot.y + index * 0x4000, + POLY_XLU_DISP = func_8088DC50(play, this, this->dyna.actor.shape.rot.y + index * 0x4000, this->unk_168[index], POLY_XLU_DISP); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_sekizou.c", 899); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_sekizou.c", 899); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h index ed513f660a..86b9427df2 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h @@ -6,7 +6,7 @@ struct BgHidanSekizou; -typedef void (*BgHidanSekizouUpdateFunc)(struct BgHidanSekizou*, GlobalContext*); +typedef void (*BgHidanSekizouUpdateFunc)(struct BgHidanSekizou*, PlayState*); typedef struct BgHidanSekizou { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index 38fde9541f..903b3f6c5a 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgHidanSima_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSima_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSima_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSima_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanSima_Init(Actor* thisx, PlayState* play); +void BgHidanSima_Destroy(Actor* thisx, PlayState* play); +void BgHidanSima_Update(Actor* thisx, PlayState* play); +void BgHidanSima_Draw(Actor* thisx, PlayState* play); -void func_8088E518(BgHidanSima* this, GlobalContext* globalCtx); -void func_8088E5D0(BgHidanSima* this, GlobalContext* globalCtx); -void func_8088E6D0(BgHidanSima* this, GlobalContext* globalCtx); -void func_8088E760(BgHidanSima* this, GlobalContext* globalCtx); -void func_8088E7A8(BgHidanSima* this, GlobalContext* globalCtx); +void func_8088E518(BgHidanSima* this, PlayState* play); +void func_8088E5D0(BgHidanSima* this, PlayState* play); +void func_8088E6D0(BgHidanSima* this, PlayState* play); +void func_8088E760(BgHidanSima* this, PlayState* play); +void func_8088E7A8(BgHidanSima* this, PlayState* play); void func_8088E90C(BgHidanSima* this); const ActorInit Bg_Hidan_Sima_InitVars = { @@ -80,7 +80,7 @@ static void* sFireballsTexs[] = { gFireTempleFireball4Tex, gFireTempleFireball5Tex, gFireTempleFireball6Tex, gFireTempleFireball7Tex, }; -void BgHidanSima_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSima_Init(Actor* thisx, PlayState* play) { BgHidanSima* this = (BgHidanSima*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -93,9 +93,9 @@ void BgHidanSima_Init(Actor* thisx, GlobalContext* globalCtx) { } else { CollisionHeader_GetVirtual(&gFireTempleStonePlatform2Col, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->elements); + 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->elements); for (i = 0; i < ARRAY_COUNT(sJntSphElementsInit); i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } @@ -106,20 +106,20 @@ void BgHidanSima_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgHidanSima_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSima_Destroy(Actor* thisx, PlayState* play) { BgHidanSima* this = (BgHidanSima*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void func_8088E518(BgHidanSima* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088E518(BgHidanSima* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 3.4f); if (func_8004356C(&this->dyna) && !(player->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14))) { this->timer = 20; - this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4000; + this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4000; if (this->dyna.actor.home.pos.y <= this->dyna.actor.world.pos.y) { this->actionFunc = func_8088E5D0; } else { @@ -128,7 +128,7 @@ void func_8088E518(BgHidanSima* this, GlobalContext* globalCtx) { } } -void func_8088E5D0(BgHidanSima* this, GlobalContext* globalCtx) { +void func_8088E5D0(BgHidanSima* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -148,7 +148,7 @@ void func_8088E5D0(BgHidanSima* this, GlobalContext* globalCtx) { } } -void func_8088E6D0(BgHidanSima* this, GlobalContext* globalCtx) { +void func_8088E6D0(BgHidanSima* this, PlayState* play) { if (func_8004356C(&this->dyna)) { this->timer = 20; } else if (this->timer != 0) { @@ -160,7 +160,7 @@ void func_8088E6D0(BgHidanSima* this, GlobalContext* globalCtx) { } } -void func_8088E760(BgHidanSima* this, GlobalContext* globalCtx) { +void func_8088E760(BgHidanSima* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -171,7 +171,7 @@ void func_8088E760(BgHidanSima* this, GlobalContext* globalCtx) { } } -void func_8088E7A8(BgHidanSima* this, GlobalContext* globalCtx) { +void func_8088E7A8(BgHidanSima* this, PlayState* play) { f32 temp; if (this->timer != 0) { @@ -205,11 +205,11 @@ void func_8088E90C(BgHidanSima* this) { } } -void BgHidanSima_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSima_Update(Actor* thisx, PlayState* play) { BgHidanSima* this = (BgHidanSima*)thisx; s32 pad; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->dyna.actor.params != 0) { s32 temp = (this->dyna.actor.world.rot.y == this->dyna.actor.shape.rot.y) ? this->timer : (this->timer + 80); @@ -219,12 +219,12 @@ void BgHidanSima_Update(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - ((1.0f - cosf(temp * (M_PI / 20))) * 5.0f); if (this->actionFunc == func_8088E7A8) { func_8088E90C(this); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } -Gfx* func_8088EB54(GlobalContext* globalCtx, BgHidanSima* this, Gfx* gfx) { +Gfx* func_8088EB54(PlayState* play, BgHidanSima* this, Gfx* gfx) { MtxF mtxF; s32 phi_s5; s32 s3; @@ -260,7 +260,7 @@ Gfx* func_8088EB54(GlobalContext* globalCtx, BgHidanSima* this, Gfx* gfx) { gSPSegment(gfx++, 0x09, SEGMENTED_TO_VIRTUAL(sFireballsTexs[(this->timer + s3) % 7])); gSPMatrix(gfx++, Matrix_MtxFToMtx(Matrix_CheckFloats(&mtxF, "../z_bg_hidan_sima.c", 611), - Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx))), + Graph_Alloc(play->state.gfxCtx, sizeof(Mtx))), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, gFireTempleFireballDL); } @@ -269,18 +269,18 @@ Gfx* func_8088EB54(GlobalContext* globalCtx, BgHidanSima* this, Gfx* gfx) { gSPSegment(gfx++, 0x09, SEGMENTED_TO_VIRTUAL(sFireballsTexs[(this->timer + s3) % 7])); gSPMatrix(gfx++, Matrix_MtxFToMtx(Matrix_CheckFloats(&mtxF, "../z_bg_hidan_sima.c", 624), - Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx))), + Graph_Alloc(play->state.gfxCtx, sizeof(Mtx))), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, gFireTempleFireballDL); return gfx; } -void BgHidanSima_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSima_Draw(Actor* thisx, PlayState* play) { BgHidanSima* this = (BgHidanSima*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_sima.c", 641); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_sima.c", 645), + OPEN_DISPS(play->state.gfxCtx, "../z_bg_hidan_sima.c", 641); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_hidan_sima.c", 645), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->dyna.actor.params == 0) { gSPDisplayList(POLY_OPA_DISP++, gFireTempleStonePlatform1DL); @@ -290,8 +290,8 @@ void BgHidanSima_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gDPSetPrimColor(POLY_XLU_DISP++, 0, 1, 255, 255, 0, 150); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 255); - POLY_XLU_DISP = func_8088EB54(globalCtx, this, POLY_XLU_DISP); + POLY_XLU_DISP = func_8088EB54(play, this, POLY_XLU_DISP); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_sima.c", 668); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_sima.c", 668); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h index f31999c3bb..927391110b 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h @@ -6,7 +6,7 @@ struct BgHidanSima; -typedef void (*BgHidanSimaActionFunc)(struct BgHidanSima*, GlobalContext*); +typedef void (*BgHidanSimaActionFunc)(struct BgHidanSima*, PlayState*); typedef struct BgHidanSima { /* 0x0000 */ DynaPolyActor dyna; 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 a78868497c..ee4dafc802 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 @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void BgHidanSyoku_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSyoku_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSyoku_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHidanSyoku_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHidanSyoku_Init(Actor* thisx, PlayState* play); +void BgHidanSyoku_Destroy(Actor* thisx, PlayState* play); +void BgHidanSyoku_Update(Actor* thisx, PlayState* play); +void BgHidanSyoku_Draw(Actor* thisx, PlayState* play); -void func_8088F4B8(BgHidanSyoku* this, GlobalContext* globalCtx); -void func_8088F514(BgHidanSyoku* this, GlobalContext* globalCtx); -void func_8088F62C(BgHidanSyoku* this, GlobalContext* globalCtx); +void func_8088F4B8(BgHidanSyoku* this, PlayState* play); +void func_8088F514(BgHidanSyoku* this, PlayState* play); +void func_8088F62C(BgHidanSyoku* this, PlayState* play); const ActorInit Bg_Hidan_Syoku_InitVars = { ACTOR_BG_HIDAN_SYOKU, @@ -34,7 +34,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHidanSyoku_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSyoku_Init(Actor* thisx, PlayState* play) { s32 pad; BgHidanSyoku* this = (BgHidanSyoku*)thisx; CollisionHeader* colHeader = NULL; @@ -42,15 +42,15 @@ void BgHidanSyoku_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gFireTempleFlareDancerPlatformCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->actionFunc = func_8088F4B8; this->dyna.actor.home.pos.y += 540.0f; } -void BgHidanSyoku_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSyoku_Destroy(Actor* thisx, PlayState* play) { BgHidanSyoku* this = (BgHidanSyoku*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_8088F47C(BgHidanSyoku* this) { @@ -59,14 +59,14 @@ void func_8088F47C(BgHidanSyoku* this) { this->actionFunc = func_8088F62C; } -void func_8088F4B8(BgHidanSyoku* this, GlobalContext* globalCtx) { - if (Flags_GetClear(globalCtx, this->dyna.actor.room) && func_8004356C(&this->dyna)) { +void func_8088F4B8(BgHidanSyoku* this, PlayState* play) { + if (Flags_GetClear(play, this->dyna.actor.room) && func_8004356C(&this->dyna)) { this->timer = 140; this->actionFunc = func_8088F514; } } -void func_8088F514(BgHidanSyoku* this, GlobalContext* globalCtx) { +void func_8088F514(BgHidanSyoku* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -78,7 +78,7 @@ void func_8088F514(BgHidanSyoku* this, GlobalContext* globalCtx) { } } -void func_8088F5A0(BgHidanSyoku* this, GlobalContext* globalCtx) { +void func_8088F5A0(BgHidanSyoku* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -90,7 +90,7 @@ void func_8088F5A0(BgHidanSyoku* this, GlobalContext* globalCtx) { } } -void func_8088F62C(BgHidanSyoku* this, GlobalContext* globalCtx) { +void func_8088F62C(BgHidanSyoku* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -104,23 +104,23 @@ void func_8088F62C(BgHidanSyoku* this, GlobalContext* globalCtx) { } } -void BgHidanSyoku_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHidanSyoku_Update(Actor* thisx, PlayState* play) { BgHidanSyoku* this = (BgHidanSyoku*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (func_8004356C(&this->dyna)) { if (this->unk_168 == 0) { this->unk_168 = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_168 != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } this->unk_168 = 0; } } -void BgHidanSyoku_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gFireTempleFlareDancerPlatformDL); +void BgHidanSyoku_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gFireTempleFlareDancerPlatformDL); } 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 9147c8c769..61e3520b76 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 @@ -6,7 +6,7 @@ struct BgHidanSyoku; -typedef void (*BgHidanSyokuActionFunc)(struct BgHidanSyoku*, GlobalContext*); +typedef void (*BgHidanSyokuActionFunc)(struct BgHidanSyoku*, PlayState*); typedef struct BgHidanSyoku { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c index 884e0537d2..8addc43f5c 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c +++ b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c @@ -9,15 +9,15 @@ #define FLAGS 0 -void BgIceObjects_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIceObjects_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIceObjects_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIceObjects_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIceObjects_Init(Actor* thisx, PlayState* play); +void BgIceObjects_Destroy(Actor* thisx, PlayState* play); +void BgIceObjects_Update(Actor* thisx, PlayState* play); +void BgIceObjects_Draw(Actor* thisx, PlayState* play); -void BgIceObjects_Idle(BgIceObjects* this, GlobalContext* globalCtx); -void BgIceObjects_Slide(BgIceObjects* this, GlobalContext* globalCtx); -void BgIceObjects_Reset(BgIceObjects* this, GlobalContext* globalCtx); -void BgIceObjects_Stuck(BgIceObjects* this, GlobalContext* globalCtx); +void BgIceObjects_Idle(BgIceObjects* this, PlayState* play); +void BgIceObjects_Slide(BgIceObjects* this, PlayState* play); +void BgIceObjects_Reset(BgIceObjects* this, PlayState* play); +void BgIceObjects_Stuck(BgIceObjects* this, PlayState* play); static Color_RGBA8 sWhite = { 250, 250, 250, 255 }; static Color_RGBA8 sGray = { 180, 180, 180, 255 }; @@ -39,7 +39,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgIceObjects_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIceObjects_Init(Actor* thisx, PlayState* play) { s32 pad; BgIceObjects* this = (BgIceObjects*)thisx; CollisionHeader* colHeader = NULL; @@ -49,15 +49,15 @@ void BgIceObjects_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_ice_objects_Col_0003F0, &colHeader); Math_Vec3f_Copy(&this->targetPos, &this->dyna.actor.home.pos); this->actionFunc = BgIceObjects_Idle; - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.actor.params = 0; } -void BgIceObjects_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIceObjects_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgIceObjects* this = (BgIceObjects*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } static s16 sXStarts[] = { @@ -79,7 +79,7 @@ static s16 sXStops[7][2] = { * defaulting to the maximum x wall or minimum z wall. Each x and z position * has only one possible wall or pit on each side of it. */ -void BgIceObjects_SetNextTarget(BgIceObjects* this, GlobalContext* globalCtx) { +void BgIceObjects_SetNextTarget(BgIceObjects* this, PlayState* play) { s16 x16; s16 z16 = 0; // needed to match s32 i; @@ -110,7 +110,7 @@ void BgIceObjects_SetNextTarget(BgIceObjects* this, GlobalContext* globalCtx) { /* * Checks if the block has fallen into any of the pits. */ -void BgIceObjects_CheckPits(BgIceObjects* this, GlobalContext* globalCtx) { +void BgIceObjects_CheckPits(BgIceObjects* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if ((thisx->velocity.y > 0.0f) || ((thisx->world.pos.x <= -1660.0f) && (thisx->world.pos.z <= -1060.0f)) || @@ -125,24 +125,24 @@ void BgIceObjects_CheckPits(BgIceObjects* this, GlobalContext* globalCtx) { thisx->world.pos.y = thisx->home.pos.y - 60.0f; thisx->world.pos.z = thisx->home.pos.z; if (thisx->params != 0) { - func_8002DF54(globalCtx, thisx, 7); + func_8002DF54(play, thisx, 7); } this->actionFunc = BgIceObjects_Reset; } } } -void BgIceObjects_Idle(BgIceObjects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgIceObjects_Idle(BgIceObjects* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~PLAYER_STATE2_4; - if ((this->dyna.unk_150 > 0.0f) && !Player_InCsMode(globalCtx)) { - BgIceObjects_SetNextTarget(this, globalCtx); + if ((this->dyna.unk_150 > 0.0f) && !Player_InCsMode(play)) { + BgIceObjects_SetNextTarget(this, play); if (Actor_WorldDistXZToPoint(thisx, &this->targetPos) > 1.0f) { thisx->flags |= ACTOR_FLAG_4; - func_8002DF54(globalCtx, thisx, 8); + func_8002DF54(play, thisx, 8); thisx->params = 1; this->actionFunc = BgIceObjects_Slide; } @@ -150,11 +150,11 @@ void BgIceObjects_Idle(BgIceObjects* this, GlobalContext* globalCtx) { this->dyna.unk_150 = 0.0f; } if (thisx->velocity.y > 0.0f) { - BgIceObjects_CheckPits(this, globalCtx); + BgIceObjects_CheckPits(this, play); } } -void BgIceObjects_Slide(BgIceObjects* this, GlobalContext* globalCtx) { +void BgIceObjects_Slide(BgIceObjects* this, PlayState* play) { s32 atTarget; Vec3f pos; Vec3f velocity; @@ -172,7 +172,7 @@ void BgIceObjects_Slide(BgIceObjects* this, GlobalContext* globalCtx) { thisx->flags &= ~ACTOR_FLAG_4; } thisx->params = 0; - func_8002DF54(globalCtx, thisx, 7); + func_8002DF54(play, thisx, 7); Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND); if ((fabsf(thisx->world.pos.x + 1387.0f) < 1.0f) && (fabsf(thisx->world.pos.z + 260.0f) < 1.0f)) { this->actionFunc = BgIceObjects_Stuck; @@ -187,18 +187,18 @@ void BgIceObjects_Slide(BgIceObjects* this, GlobalContext* globalCtx) { pos.x = thisx->world.pos.x - (60.0f * Math_SinS(this->dyna.unk_158)) - (Math_CosS(this->dyna.unk_158) * spread); pos.z = thisx->world.pos.z - (60.0f * Math_CosS(this->dyna.unk_158)) + (Math_SinS(this->dyna.unk_158) * spread); pos.y = thisx->world.pos.y; - func_8002829C(globalCtx, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); + func_8002829C(play, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); spread = Rand_CenteredFloat(120.0f); pos.x = thisx->world.pos.x - (60.0f * Math_SinS(this->dyna.unk_158)) + (Math_CosS(this->dyna.unk_158) * spread); pos.z = thisx->world.pos.z - (60.0f * Math_CosS(this->dyna.unk_158)) - (Math_SinS(this->dyna.unk_158) * spread); - func_8002829C(globalCtx, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); + func_8002829C(play, &pos, &velocity, &sZeroVec, &sWhite, &sGray, 250, Rand_S16Offset(40, 15)); func_8002F974(thisx, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); } - BgIceObjects_CheckPits(this, globalCtx); + BgIceObjects_CheckPits(this, play); } -void BgIceObjects_Reset(BgIceObjects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgIceObjects_Reset(BgIceObjects* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { @@ -213,8 +213,8 @@ void BgIceObjects_Reset(BgIceObjects* this, GlobalContext* globalCtx) { } } -void BgIceObjects_Stuck(BgIceObjects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgIceObjects_Stuck(BgIceObjects* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~PLAYER_STATE2_4; @@ -222,16 +222,16 @@ void BgIceObjects_Stuck(BgIceObjects* this, GlobalContext* globalCtx) { } } -void BgIceObjects_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIceObjects_Update(Actor* thisx, PlayState* play) { s32 pad; BgIceObjects* this = (BgIceObjects*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIceObjects_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgIceObjects_Draw(Actor* thisx, PlayState* play) { s32 pad; BgIceObjects* this = (BgIceObjects*)thisx; - Gfx_DrawDListOpa(globalCtx, object_ice_objects_DL_000190); + Gfx_DrawDListOpa(play, object_ice_objects_DL_000190); } diff --git a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h index ef9872823f..13a2334c39 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h +++ b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h @@ -6,7 +6,7 @@ struct BgIceObjects; -typedef void (*BgIceObjectsActionFunc) (struct BgIceObjects*, GlobalContext*); +typedef void (*BgIceObjectsActionFunc) (struct BgIceObjects*, PlayState*); typedef struct BgIceObjects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c index 1f30a75b36..6f594ebfbe 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c @@ -3,16 +3,16 @@ #define FLAGS 0 -void BgIceShelter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIceShelter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIceShelter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIceShelter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIceShelter_Init(Actor* thisx, PlayState* play); +void BgIceShelter_Destroy(Actor* thisx, PlayState* play); +void BgIceShelter_Update(Actor* thisx, PlayState* play); +void BgIceShelter_Draw(Actor* thisx, PlayState* play); void func_80891064(BgIceShelter* this); void func_808911BC(BgIceShelter* this); -void func_8089107C(BgIceShelter* this, GlobalContext* globalCtx); -void func_808911D4(BgIceShelter* this, GlobalContext* globalCtx); +void func_8089107C(BgIceShelter* this, PlayState* play); +void func_808911D4(BgIceShelter* this, PlayState* play); const ActorInit Bg_Ice_Shelter_InitVars = { ACTOR_BG_ICE_SHELTER, @@ -71,22 +71,22 @@ static ColliderCylinderInit D_80891738 = { { 0, 0, 0, { 0, 0, 0 } }, }; -void func_80890740(BgIceShelter* this, GlobalContext* globalCtx) { +void func_80890740(BgIceShelter* this, PlayState* play) { static s16 cylinderRadii[] = { 47, 33, 44, 41, 100 }; static s16 cylinderHeights[] = { 80, 54, 90, 60, 200 }; s32 pad; s32 type = (this->dyna.actor.params >> 8) & 7; - Collider_InitCylinder(globalCtx, &this->cylinder1); - Collider_SetCylinder(globalCtx, &this->cylinder1, &this->dyna.actor, &D_8089170C); + Collider_InitCylinder(play, &this->cylinder1); + Collider_SetCylinder(play, &this->cylinder1, &this->dyna.actor, &D_8089170C); Collider_UpdateCylinder(&this->dyna.actor, &this->cylinder1); this->cylinder1.dim.radius = cylinderRadii[type]; this->cylinder1.dim.height = cylinderHeights[type]; if (type == 0 || type == 1 || type == 4) { - Collider_InitCylinder(globalCtx, &this->cylinder2); - Collider_SetCylinder(globalCtx, &this->cylinder2, &this->dyna.actor, &D_80891738); + Collider_InitCylinder(play, &this->cylinder2); + Collider_SetCylinder(play, &this->cylinder2, &this->dyna.actor, &D_80891738); Collider_UpdateCylinder(&this->dyna.actor, &this->cylinder2); this->cylinder2.dim.radius = cylinderRadii[type]; this->cylinder2.dim.height = cylinderHeights[type]; @@ -98,14 +98,14 @@ void func_80890740(BgIceShelter* this, GlobalContext* globalCtx) { } } -void func_80890874(BgIceShelter* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void func_80890874(BgIceShelter* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG registration failed" @@ -129,7 +129,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgIceShelter_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShelter_Init(Actor* thisx, PlayState* play) { static Vec3f kzIceScale = { 0.18f, 0.27f, 0.24f }; BgIceShelter* this = (BgIceShelter*)thisx; s16 type = (this->dyna.actor.params >> 8) & 7; @@ -151,18 +151,18 @@ void BgIceShelter_Init(Actor* thisx, GlobalContext* globalCtx) { switch (type) { case 2: - func_80890874(this, globalCtx, &object_ice_objects_Col_001C1C, 0); + func_80890874(this, play, &object_ice_objects_Col_001C1C, 0); break; case 3: - func_80890874(this, globalCtx, &object_ice_objects_Col_002920, 0); + func_80890874(this, play, &object_ice_objects_Col_002920, 0); break; } - func_80890740(this, globalCtx); + func_80890740(this, play); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - if (!((this->dyna.actor.params >> 6) & 1) && (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F))) { + if (!((this->dyna.actor.params >> 6) & 1) && (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F))) { Actor_Kill(&this->dyna.actor); return; } @@ -172,29 +172,29 @@ void BgIceShelter_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(ice shelter)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgIceShelter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShelter_Destroy(Actor* thisx, PlayState* play) { BgIceShelter* this = (BgIceShelter*)thisx; switch ((this->dyna.actor.params >> 8) & 7) { case 2: case 3: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); break; case 0: case 1: case 4: - Collider_DestroyCylinder(globalCtx, &this->cylinder2); + Collider_DestroyCylinder(play, &this->cylinder2); break; } - Collider_DestroyCylinder(globalCtx, &this->cylinder1); + Collider_DestroyCylinder(play, &this->cylinder1); } static s16 D_80891794[] = { 0x0000, 0x4000, 0x2000, 0x6000, 0x1000, 0x5000, 0x3000, 0x7000 }; static s16 D_808917A4[] = { 0x0000, 0x003C, 0x0018, 0x0054, 0x0030, 0x000C, 0x0048, 0x0024 }; -void func_80890B8C(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 scale) { +void func_80890B8C(BgIceShelter* this, PlayState* play, f32 chance, f32 scale) { f32 cos; f32 sin; f32 xzOffset; @@ -207,7 +207,7 @@ void func_80890B8C(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 Vec3f dustVel; Vec3f dustAccel; - frames = (s16)globalCtx->state.frames & 7; + frames = (s16)play->state.frames & 7; for (i = 0; i < 2; i++) { if (chance < Rand_ZeroOne()) { @@ -232,12 +232,12 @@ void func_80890B8C(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 dustAccel.y = 0.8f; dustAccel.z = 0.07f * cos; - func_8002829C(globalCtx, &dustPos, &dustVel, &dustAccel, &sDustPrimColor, &sDustEnvColor, 450.0f * scale, + func_8002829C(play, &dustPos, &dustVel, &dustAccel, &sDustPrimColor, &sDustEnvColor, 450.0f * scale, (s16)((Rand_ZeroOne() * 40.0f) + 40.0f) * scale); } } -void func_80890E00(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 arg3) { +void func_80890E00(BgIceShelter* this, PlayState* play, f32 chance, f32 arg3) { static f32 D_808917B4[] = { -1.0f, 1.0f }; Vec3f* icePos; s16 frames; @@ -248,7 +248,7 @@ void func_80890E00(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 Vec3f posOffset; s32 i; - frames = (s16)globalCtx->state.frames & 7; + frames = (s16)play->state.frames & 7; for (i = 0; i < 2; i++) { icePos = &this->dyna.actor.world.pos; @@ -272,7 +272,7 @@ void func_80890E00(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 dustAccel.y = 0.8f; dustAccel.z = (Rand_ZeroOne() * 0.14f) - 0.07f; - func_8002829C(globalCtx, &dustPos, &dustVel, &dustAccel, &sDustPrimColor, &sDustEnvColor, 450, + func_8002829C(play, &dustPos, &dustVel, &dustAccel, &sDustPrimColor, &sDustEnvColor, 450, (Rand_ZeroOne() * 40.0f) + 40.0f); } } @@ -282,7 +282,7 @@ void func_80891064(BgIceShelter* this) { this->alpha = 255; } -void func_8089107C(BgIceShelter* this, GlobalContext* globalCtx) { +void func_8089107C(BgIceShelter* this, PlayState* play) { s32 pad; s16 type = (this->dyna.actor.params >> 8) & 7; @@ -311,12 +311,12 @@ void func_8089107C(BgIceShelter* this, GlobalContext* globalCtx) { case 0: case 1: case 4: - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cylinder1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder2.base); break; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder1.base); } void func_808911BC(BgIceShelter* this) { @@ -327,11 +327,11 @@ void func_808911BC(BgIceShelter* this) { static f32 D_808917BC[] = { -0.0015f, -0.0009f, -0.0016f, -0.0016f, -0.00375f }; static f32 D_808917D0[] = { 1.0f, 0.6f, 1.2f, 1.0f, 1.8f }; -static void (*sEffSpawnFuncs[])(BgIceShelter* this, GlobalContext* globalCtx, f32 chance, f32 scale) = { +static void (*sEffSpawnFuncs[])(BgIceShelter* this, PlayState* play, f32 chance, f32 scale) = { func_80890B8C, func_80890B8C, func_80890B8C, func_80890E00, func_80890B8C, }; -void func_808911D4(BgIceShelter* this, GlobalContext* globalCtx) { +void func_808911D4(BgIceShelter* this, PlayState* play) { s32 pad; s32 type = (this->dyna.actor.params >> 8) & 7; @@ -348,8 +348,8 @@ void func_808911D4(BgIceShelter* this, GlobalContext* globalCtx) { case 0: case 1: case 4: - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cylinder1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder2.base); break; } } @@ -362,11 +362,11 @@ void func_808911D4(BgIceShelter* this, GlobalContext* globalCtx) { phi_f0 = 0.0f; } - sEffSpawnFuncs[type](this, globalCtx, phi_f0, D_808917D0[type]); + sEffSpawnFuncs[type](this, play, phi_f0, D_808917D0[type]); if (this->alpha <= 0) { if (!((this->dyna.actor.params >> 6) & 1)) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); } if (type == 4) { @@ -377,21 +377,21 @@ void func_808911D4(BgIceShelter* this, GlobalContext* globalCtx) { } } -void BgIceShelter_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShelter_Update(Actor* thisx, PlayState* play) { BgIceShelter* this = (BgIceShelter*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIceShelter_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgIceShelter_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgIceShelter* this = (BgIceShelter*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_ice_shelter.c", 748); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_ice_shelter.c", 748); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ice_shelter.c", 751), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_ice_shelter.c", 751), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); switch ((this->dyna.actor.params >> 8) & 7) { @@ -399,7 +399,7 @@ void BgIceShelter_Draw(Actor* thisx, GlobalContext* globalCtx2) { case 1: case 2: case 4: - func_8002ED80(&this->dyna.actor, globalCtx, 0); + func_8002ED80(&this->dyna.actor, play, 0); break; } @@ -410,22 +410,20 @@ void BgIceShelter_Draw(Actor* thisx, GlobalContext* globalCtx2) { case 1: case 4: gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -globalCtx->gameplayFrames & 0x7F, - -globalCtx->gameplayFrames & 0x7F, 0x20, 0x20, 1, - -globalCtx->gameplayFrames & 0x7F, globalCtx->gameplayFrames & 0x7F, 0x20, - 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -play->gameplayFrames & 0x7F, + -play->gameplayFrames & 0x7F, 0x20, 0x20, 1, -play->gameplayFrames & 0x7F, + play->gameplayFrames & 0x7F, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, object_ice_objects_DL_0006F0); break; case 2: gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, globalCtx->gameplayFrames & 0xFF, 0x40, 0x40, 1, - 0, -globalCtx->gameplayFrames & 0xFF, 0x40, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames & 0xFF, 0x40, 0x40, 1, 0, + -play->gameplayFrames & 0xFF, 0x40, 0x40)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -globalCtx->gameplayFrames & 0xFF, - globalCtx->gameplayFrames & 0xFF, 0x40, 0x40, 1, - globalCtx->gameplayFrames & 0xFF, globalCtx->gameplayFrames & 0xFF, 0x40, - 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -play->gameplayFrames & 0xFF, + play->gameplayFrames & 0xFF, 0x40, 0x40, 1, play->gameplayFrames & 0xFF, + play->gameplayFrames & 0xFF, 0x40, 0x40)); gSPDisplayList(POLY_XLU_DISP++, object_ice_objects_DL_0012A0); break; @@ -434,5 +432,5 @@ void BgIceShelter_Draw(Actor* thisx, GlobalContext* globalCtx2) { break; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_ice_shelter.c", 815); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_ice_shelter.c", 815); } diff --git a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h index 6f67f274e5..40c715f644 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h +++ b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h @@ -6,7 +6,7 @@ struct BgIceShelter; -typedef void (*BgIceShelterActionFunc)(struct BgIceShelter*, GlobalContext*); +typedef void (*BgIceShelterActionFunc)(struct BgIceShelter*, PlayState*); typedef struct BgIceShelter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c index bae0ba0b96..1965df4f80 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void BgIceShutter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIceShutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIceShutter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIceShutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIceShutter_Init(Actor* thisx, PlayState* play); +void BgIceShutter_Destroy(Actor* thisx, PlayState* play); +void BgIceShutter_Update(Actor* thisx, PlayState* play); +void BgIceShutter_Draw(Actor* thisx, PlayState* play); -void func_80891CF4(BgIceShutter* thisx, GlobalContext* globalCtx); -void func_80891D6C(BgIceShutter* thisx, GlobalContext* globalCtx); -void func_80891DD4(BgIceShutter* thisx, GlobalContext* globalCtx); +void func_80891CF4(BgIceShutter* thisx, PlayState* play); +void func_80891D6C(BgIceShutter* thisx, PlayState* play); +void func_80891DD4(BgIceShutter* thisx, PlayState* play); const ActorInit Bg_Ice_Shutter_InitVars = { ACTOR_BG_ICE_SHUTTER, @@ -44,7 +44,7 @@ void func_80891AC0(BgIceShutter* this) { this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.shape.rot.y) * sp24) + this->dyna.actor.home.pos.z; } -void BgIceShutter_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShutter_Init(Actor* thisx, PlayState* play) { BgIceShutter* this = (BgIceShutter*)thisx; f32 sp24; CollisionHeader* colHeader; @@ -57,20 +57,20 @@ void BgIceShutter_Init(Actor* thisx, GlobalContext* globalCtx) { sp28 = this->dyna.actor.params & 0xFF; this->dyna.actor.params = (this->dyna.actor.params >> 8) & 0xFF; CollisionHeader_GetVirtual(&object_ice_objects_Col_002854, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (sp28 == 2) { this->dyna.actor.shape.rot.x = -0x4000; } if (sp28 != 1) { - if (Flags_GetClear(globalCtx, this->dyna.actor.room)) { + if (Flags_GetClear(play, this->dyna.actor.room)) { Actor_Kill(&this->dyna.actor); } else { this->actionFunc = func_80891CF4; } } else { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { + if (Flags_GetSwitch(play, this->dyna.actor.params)) { Actor_Kill(&this->dyna.actor); } else { this->actionFunc = func_80891D6C; @@ -89,31 +89,31 @@ void BgIceShutter_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgIceShutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShutter_Destroy(Actor* thisx, PlayState* play) { BgIceShutter* this = (BgIceShutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80891CF4(BgIceShutter* this, GlobalContext* globalCtx) { - if (Flags_GetTempClear(globalCtx, this->dyna.actor.room)) { - Flags_SetClear(globalCtx, this->dyna.actor.room); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_SLIDE_DOOR_OPEN); +void func_80891CF4(BgIceShutter* this, PlayState* play) { + if (Flags_GetTempClear(play, this->dyna.actor.room)) { + Flags_SetClear(play, this->dyna.actor.room); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_SLIDE_DOOR_OPEN); this->actionFunc = func_80891DD4; if (this->dyna.actor.shape.rot.x == 0) { - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); } } } -void func_80891D6C(BgIceShutter* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_SLIDE_DOOR_OPEN); +void func_80891D6C(BgIceShutter* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params)) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_SLIDE_DOOR_OPEN); this->actionFunc = func_80891DD4; - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); } } -void func_80891DD4(BgIceShutter* this, GlobalContext* globalCtx) { +void func_80891DD4(BgIceShutter* this, PlayState* play) { Math_StepToF(&this->dyna.actor.speedXZ, 30.0f, 2.0f); if (Math_StepToF(&this->dyna.actor.velocity.y, 210.0f, this->dyna.actor.speedXZ)) { Actor_Kill(&this->dyna.actor); @@ -123,12 +123,12 @@ void func_80891DD4(BgIceShutter* this, GlobalContext* globalCtx) { func_80891AC0(this); } -void BgIceShutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIceShutter_Update(Actor* thisx, PlayState* play) { BgIceShutter* this = (BgIceShutter*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIceShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_ice_objects_DL_002740); +void BgIceShutter_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_ice_objects_DL_002740); } diff --git a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h index 68ac83f102..db8a7ff61c 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h +++ b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h @@ -6,7 +6,7 @@ struct BgIceShutter; -typedef void (*BgIceShutterActionFunc)(struct BgIceShutter*, GlobalContext*); +typedef void (*BgIceShutterActionFunc)(struct BgIceShutter*, PlayState*); typedef struct BgIceShutter { /* 0x0000 */ DynaPolyActor dyna; 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 d7fae4ba53..e48893f446 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 @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgIceTurara_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIceTurara_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIceTurara_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIceTurara_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIceTurara_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); -void BgIceTurara_Wait(BgIceTurara* this, GlobalContext* globalCtx); -void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx); -void BgIceTurara_Fall(BgIceTurara* this, GlobalContext* globalCtx); -void BgIceTurara_Regrow(BgIceTurara* this, GlobalContext* globalCtx); +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 = { { @@ -59,7 +59,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgIceTurara_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIceTurara_Init(Actor* thisx, PlayState* play) { BgIceTurara* this = (BgIceTurara*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -67,10 +67,10 @@ void BgIceTurara_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&object_ice_objects_Col_002594, &colHeader); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + 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(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.actor.params == TURARA_STALAGMITE) { this->actionFunc = BgIceTurara_Stalagmite; } else { @@ -80,14 +80,14 @@ void BgIceTurara_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgIceTurara_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIceTurara_Destroy(Actor* thisx, PlayState* play) { BgIceTurara* this = (BgIceTurara*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); } -void BgIceTurara_Break(BgIceTurara* this, GlobalContext* globalCtx, f32 arg2) { +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 }; @@ -96,7 +96,7 @@ void BgIceTurara_Break(BgIceTurara* this, GlobalContext* globalCtx, f32 arg2) { s32 j; s32 i; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); + SoundSource_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); @@ -107,29 +107,28 @@ void BgIceTurara_Break(BgIceTurara* this, GlobalContext* globalCtx, f32 arg2) { vel.z = Rand_CenteredFloat(7.0f); vel.y = (Rand_ZeroOne() * 4.0f) + 8.0f; - EffectSsEnIce_Spawn(globalCtx, &pos, (Rand_ZeroOne() * 0.2f) + 0.1f, &vel, &accel, &primColor, &envColor, - 30); + EffectSsEnIce_Spawn(play, &pos, (Rand_ZeroOne() * 0.2f) + 0.1f, &vel, &accel, &primColor, &envColor, 30); } } } -void BgIceTurara_Stalagmite(BgIceTurara* this, GlobalContext* globalCtx) { +void BgIceTurara_Stalagmite(BgIceTurara* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { - BgIceTurara_Break(this, globalCtx, 50.0f); + BgIceTurara_Break(this, play, 50.0f); Actor_Kill(&this->dyna.actor); return; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void BgIceTurara_Wait(BgIceTurara* this, GlobalContext* globalCtx) { +void BgIceTurara_Wait(BgIceTurara* this, PlayState* play) { if (this->dyna.actor.xzDistToPlayer < 60.0f) { this->shiverTimer = 10; this->actionFunc = BgIceTurara_Shiver; } } -void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx) { +void BgIceTurara_Shiver(BgIceTurara* this, PlayState* play) { s16 phi_v0_3; s16 phi_v0_2; f32 sp28; @@ -144,8 +143,8 @@ void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx) { 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(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgIceTurara_Fall; } else { sp28 = Rand_ZeroOne(); @@ -157,17 +156,17 @@ void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx) { } } -void BgIceTurara_Fall(BgIceTurara* this, GlobalContext* globalCtx) { +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; 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, globalCtx, 40.0f); + BgIceTurara_Break(this, play, 40.0f); if (this->dyna.actor.params == TURARA_STALACTITE_REGROW) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 120.0f; - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgIceTurara_Regrow; } else { Actor_Kill(&this->dyna.actor); @@ -176,26 +175,26 @@ void BgIceTurara_Fall(BgIceTurara* this, GlobalContext* globalCtx) { } else { Actor_MoveForward(&this->dyna.actor); this->dyna.actor.world.pos.y += 40.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + 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(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } -void BgIceTurara_Regrow(BgIceTurara* this, GlobalContext* globalCtx) { +void BgIceTurara_Regrow(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->dyna.actor.velocity.y = 0.0f; } } -void BgIceTurara_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIceTurara_Update(Actor* thisx, PlayState* play) { BgIceTurara* this = (BgIceTurara*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIceTurara_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_ice_objects_DL_0023D0); +void BgIceTurara_Draw(Actor* thisx, PlayState* play) { + 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 aff6417dfb..a869888a8b 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 @@ -6,7 +6,7 @@ struct BgIceTurara; -typedef void (*BgIceTuraraActionFunc)(struct BgIceTurara*, GlobalContext*); +typedef void (*BgIceTuraraActionFunc)(struct BgIceTurara*, PlayState*); typedef enum { /* 0 */ TURARA_STALAGMITE, diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index ade5659a6e..1717ccc734 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -9,13 +9,13 @@ #define FLAGS 0 -void BgInGate_Init(Actor* thisx, GlobalContext* globalCtx); -void BgInGate_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgInGate_Update(Actor* thisx, GlobalContext* globalCtx); -void BgInGate_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgInGate_Init(Actor* thisx, PlayState* play); +void BgInGate_Destroy(Actor* thisx, PlayState* play); +void BgInGate_Update(Actor* thisx, PlayState* play); +void BgInGate_Draw(Actor* thisx, PlayState* play); -void func_80892890(BgInGate* this, GlobalContext* globalCtx); -void BgInGate_DoNothing(BgInGate* this, GlobalContext* globalCtx); +void func_80892890(BgInGate* this, PlayState* play); +void BgInGate_DoNothing(BgInGate* this, PlayState* play); const ActorInit Bg_Ingate_InitVars = { ACTOR_BG_INGATE, @@ -33,7 +33,7 @@ void BgInGate_SetupAction(BgInGate* this, BgInGateActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgInGate_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgInGate_Init(Actor* thisx, PlayState* play) { BgInGate* this = (BgInGate*)thisx; s32 pad; @@ -42,9 +42,9 @@ void BgInGate_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gIngoGateCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if ((globalCtx->sceneNum != SCENE_SPOT20 || !LINK_IS_ADULT) || + if ((play->sceneNum != SCENE_SPOT20 || !LINK_IS_ADULT) || (GET_EVENTCHKINF(EVENTCHKINF_18) && (gSaveContext.cutsceneIndex != 0xFFF0))) { Actor_Kill(&this->dyna.actor); return; @@ -52,33 +52,33 @@ void BgInGate_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->dyna.actor, 0.1f); if (((this->dyna.actor.params & 1) != 0) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6)) { - globalCtx->csCtx.frames = 0; + play->csCtx.frames = 0; BgInGate_SetupAction(this, func_80892890); } else { BgInGate_SetupAction(this, BgInGate_DoNothing); } } -void BgInGate_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgInGate_Destroy(Actor* thisx, PlayState* play) { BgInGate* this = (BgInGate*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80892890(BgInGate* this, GlobalContext* globalCtx) { +void func_80892890(BgInGate* this, PlayState* play) { s32 phi0; s16 phi1; s16 csFrames; - if (globalCtx->csCtx.frames >= 50) { + if (play->csCtx.frames >= 50) { phi0 = 0x4000; if ((this->dyna.actor.params & 2) == 0) { phi0 = -0x4000; } this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y + phi0; BgInGate_SetupAction(this, BgInGate_DoNothing); - } else if (globalCtx->csCtx.frames >= 10) { - csFrames = globalCtx->csCtx.frames - 10; + } else if (play->csCtx.frames >= 10) { + csFrames = play->csCtx.frames - 10; csFrames *= 400; phi1 = csFrames; if (csFrames > 0x4000) { @@ -93,24 +93,24 @@ void func_80892890(BgInGate* this, GlobalContext* globalCtx) { } } -void BgInGate_DoNothing(BgInGate* this, GlobalContext* globalCtx) { +void BgInGate_DoNothing(BgInGate* this, PlayState* play) { } -void BgInGate_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgInGate_Update(Actor* thisx, PlayState* play) { BgInGate* this = (BgInGate*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgInGate_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_ingate.c", 240); +void BgInGate_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_ingate.c", 240); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ingate.c", 245), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_ingate.c", 245), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gIngoGateDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_ingate.c", 250); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_ingate.c", 250); } diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h index ba6e294d47..2137cc6464 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h @@ -6,7 +6,7 @@ struct BgInGate; -typedef void (*BgInGateActionFunc)(struct BgInGate*, GlobalContext*); +typedef void (*BgInGateActionFunc)(struct BgInGate*, PlayState*); typedef struct BgInGate { /* 0x0000 */ DynaPolyActor dyna; 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 31ae66538a..e5c54dddf3 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 @@ -9,19 +9,19 @@ #define FLAGS ACTOR_FLAG_4 -void BgJya1flift_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJya1flift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJya1flift_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJya1flift_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJya1flift_Init(Actor* thisx, PlayState* play); +void BgJya1flift_Destroy(Actor* thisx, PlayState* play); +void BgJya1flift_Update(Actor* thisx, PlayState* play); +void BgJya1flift_Draw(Actor* thisx, PlayState* play); void BgJya1flift_SetupWaitForSwitch(BgJya1flift* this); -void BgJya1flift_WaitForSwitch(BgJya1flift* this, GlobalContext* globalCtx); -void BgJya1flift_DoNothing(BgJya1flift* this, GlobalContext* globalCtx); +void BgJya1flift_WaitForSwitch(BgJya1flift* this, PlayState* play); +void BgJya1flift_DoNothing(BgJya1flift* this, PlayState* play); void BgJya1flift_ChangeDirection(BgJya1flift* this); -void BgJya1flift_Move(BgJya1flift* this, GlobalContext* globalCtx); +void BgJya1flift_Move(BgJya1flift* this, PlayState* play); void BgJya1flift_SetupDoNothing(BgJya1flift* this); void BgJya1flift_ResetMoveDelay(BgJya1flift* this); -void BgJya1flift_DelayMove(BgJya1flift* this, GlobalContext* globalCtx); +void BgJya1flift_DelayMove(BgJya1flift* this, PlayState* play); static u8 sIsSpawned = false; @@ -66,14 +66,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1200, ICHAIN_STOP), }; -void BgJya1flift_InitDynapoly(BgJya1flift* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void BgJya1flift_InitDynapoly(BgJya1flift* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG login failed" @@ -82,27 +82,27 @@ void BgJya1flift_InitDynapoly(BgJya1flift* this, GlobalContext* globalCtx, Colli } } -void BgJya1flift_InitCollision(Actor* thisx, GlobalContext* globalCtx) { +void BgJya1flift_InitCollision(Actor* thisx, PlayState* play) { BgJya1flift* this = (BgJya1flift*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &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; } -void BgJya1flift_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJya1flift_Init(Actor* thisx, PlayState* play) { BgJya1flift* this = (BgJya1flift*)thisx; // "1 F lift" - osSyncPrintf("(1Fリフト)(flag %d)(room %d)\n", sIsSpawned, globalCtx->roomCtx.curRoom.num); + osSyncPrintf("(1Fリフト)(flag %d)(room %d)\n", sIsSpawned, play->roomCtx.curRoom.num); this->hasInitialized = false; if (sIsSpawned) { Actor_Kill(thisx); return; } - BgJya1flift_InitDynapoly(this, globalCtx, &g1fliftCol, 0); + BgJya1flift_InitDynapoly(this, play, &g1fliftCol, 0); Actor_ProcessInitChain(thisx, sInitChain); - BgJya1flift_InitCollision(thisx, globalCtx); - if (Flags_GetSwitch(globalCtx, (thisx->params & 0x3F))) { + BgJya1flift_InitCollision(thisx, play); + if (Flags_GetSwitch(play, (thisx->params & 0x3F))) { LINK_AGE_IN_YEARS == YEARS_ADULT ? BgJya1flift_ChangeDirection(this) : BgJya1flift_SetupDoNothing(this); } else { BgJya1flift_SetupWaitForSwitch(this); @@ -112,13 +112,13 @@ void BgJya1flift_Init(Actor* thisx, GlobalContext* globalCtx) { this->hasInitialized = true; } -void BgJya1flift_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJya1flift_Destroy(Actor* thisx, PlayState* play) { BgJya1flift* this = (BgJya1flift*)thisx; if (this->hasInitialized) { sIsSpawned = false; - Collider_DestroyCylinder(globalCtx, &this->collider); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -127,8 +127,8 @@ void BgJya1flift_SetupWaitForSwitch(BgJya1flift* this) { this->dyna.actor.world.pos.y = sFinalPositions[0]; } -void BgJya1flift_WaitForSwitch(BgJya1flift* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) { +void BgJya1flift_WaitForSwitch(BgJya1flift* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { BgJya1flift_ChangeDirection(this); } } @@ -138,7 +138,7 @@ void BgJya1flift_SetupDoNothing(BgJya1flift* this) { this->dyna.actor.world.pos.y = sFinalPositions[0]; } -void BgJya1flift_DoNothing(BgJya1flift* this, GlobalContext* globalCtx) { +void BgJya1flift_DoNothing(BgJya1flift* this, PlayState* play) { } void BgJya1flift_ChangeDirection(BgJya1flift* this) { @@ -147,7 +147,7 @@ void BgJya1flift_ChangeDirection(BgJya1flift* this) { this->dyna.actor.velocity.y = 0.0f; } -void BgJya1flift_Move(BgJya1flift* this, GlobalContext* globalCtx) { +void BgJya1flift_Move(BgJya1flift* this, PlayState* play) { f32 tempVelocity; Math_StepToF(&this->dyna.actor.velocity.y, 6.0f, 0.4f); @@ -171,37 +171,37 @@ void BgJya1flift_ResetMoveDelay(BgJya1flift* this) { this->moveDelay = 0; } -void BgJya1flift_DelayMove(BgJya1flift* this, GlobalContext* globalCtx) { +void BgJya1flift_DelayMove(BgJya1flift* this, PlayState* play) { this->moveDelay++; if (this->moveDelay >= 21) { BgJya1flift_ChangeDirection(this); } } -void BgJya1flift_Update(Actor* thisx, GlobalContext* globalCtx2) { +void BgJya1flift_Update(Actor* thisx, PlayState* play2) { BgJya1flift* this = (BgJya1flift*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 tempIsRiding; // Room 0 is the first room and 6 is the room that the lift starts on - if (globalCtx->roomCtx.curRoom.num == 6 || globalCtx->roomCtx.curRoom.num == 0) { - this->actionFunc(this, globalCtx); + if (play->roomCtx.curRoom.num == 6 || play->roomCtx.curRoom.num == 0) { + this->actionFunc(this, play); tempIsRiding = func_8004356C(&this->dyna) ? true : false; if ((this->actionFunc == BgJya1flift_Move) || (this->actionFunc == BgJya1flift_DelayMove)) { if (tempIsRiding) { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); } else if (!tempIsRiding && this->isLinkRiding) { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } } this->isLinkRiding = tempIsRiding; Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } else { Actor_Kill(thisx); } } -void BgJya1flift_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, g1fliftDL); +void BgJya1flift_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, g1fliftDL); } diff --git a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h index fbcc7afc03..31ce5a7f4d 100644 --- a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h +++ b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h @@ -6,7 +6,7 @@ struct BgJya1flift; -typedef void (*BgJya1fliftActionFunc)(struct BgJya1flift*, GlobalContext*); +typedef void (*BgJya1fliftActionFunc)(struct BgJya1flift*, PlayState*); typedef struct BgJya1flift { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c index 7577986ea3..c73e937290 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c +++ b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgJyaAmishutter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaAmishutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaAmishutter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaAmishutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaAmishutter_Init(Actor* thisx, PlayState* play); +void BgJyaAmishutter_Destroy(Actor* thisx, PlayState* play); +void BgJyaAmishutter_Update(Actor* thisx, PlayState* play); +void BgJyaAmishutter_Draw(Actor* thisx, PlayState* play); void BgJyaAmishutter_SetupWaitForPlayer(BgJyaAmishutter* this); void BgJyaAmishutter_WaitForPlayer(BgJyaAmishutter* this); @@ -42,33 +42,32 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, GlobalContext* globalCtx, CollisionHeader* collision, - s32 flag) { +void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, PlayState* play, CollisionHeader* collision, s32 flag) { s32 pad1; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_amishutter.c", 129, this->dyna.actor.id, this->dyna.actor.params); } } -void BgJyaAmishutter_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaAmishutter_Init(Actor* thisx, PlayState* play) { BgJyaAmishutter* this = (BgJyaAmishutter*)thisx; - BgJyaAmishutter_InitDynaPoly(this, globalCtx, &gAmishutterCol, DPM_UNK); + BgJyaAmishutter_InitDynaPoly(this, play, &gAmishutterCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); BgJyaAmishutter_SetupWaitForPlayer(this); } -void BgJyaAmishutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaAmishutter_Destroy(Actor* thisx, PlayState* play) { BgJyaAmishutter* this = (BgJyaAmishutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgJyaAmishutter_SetupWaitForPlayer(BgJyaAmishutter* this) { @@ -117,12 +116,12 @@ void func_8089350C(BgJyaAmishutter* this) { } } -void BgJyaAmishutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaAmishutter_Update(Actor* thisx, PlayState* play) { BgJyaAmishutter* this = (BgJyaAmishutter*)thisx; this->actionFunc(this); } -void BgJyaAmishutter_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gAmishutterDL); +void BgJyaAmishutter_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gAmishutterDL); } 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 1c8f600d59..5ebea042f4 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 @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgJyaBigmirror_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBigmirror_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBigmirror_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBigmirror_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaBigmirror_Init(Actor* thisx, PlayState* play); +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; @@ -40,21 +40,21 @@ static BigMirrorDataEntry sCobraSpawnData[] = { { { 60.0f, 1743.0f, -310.0f }, 0xFF02, 0x8000, 0xA000 }, }; -void BgJyaBigmirror_SetRoomFlag(Actor* thisx, GlobalContext* globalCtx) { +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); - if (globalCtx->roomCtx.curRoom.num == 5) { + if (play->roomCtx.curRoom.num == 5) { this->puzzleFlags |= BIGMIR_PUZZLE_IN_STATUE_ROOM; - } else if (globalCtx->roomCtx.curRoom.num == 0x19) { + } else if (play->roomCtx.curRoom.num == 0x19) { this->puzzleFlags |= BIGMIR_PUZZLE_IN_1ST_TOP_ROOM; - } else if (globalCtx->roomCtx.curRoom.num == 0x1A) { + } else if (play->roomCtx.curRoom.num == 0x1A) { this->puzzleFlags |= BIGMIR_PUZZLE_IN_2ND_TOP_ROOM; } } -void BgJyaBigmirror_HandleCobra(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_HandleCobra(Actor* thisx, PlayState* play) { static u8 cobraPuzzleFlags[] = { BIGMIR_PUZZLE_COBRA1_SOLVED, BIGMIR_PUZZLE_COBRA2_SOLVED }; BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; BigMirrorDataEntry* curSpawnData; @@ -80,8 +80,8 @@ void BgJyaBigmirror_HandleCobra(Actor* thisx, GlobalContext* globalCtx) { } } else { curCobraInfo->cobra = (BgJyaCobra*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BG_JYA_COBRA, curSpawnData->pos.x, - curSpawnData->pos.y, curSpawnData->pos.z, 0, curCobraInfo->rotY, 0, curSpawnData->params); + &play->actorCtx, &this->actor, play, ACTOR_BG_JYA_COBRA, curSpawnData->pos.x, curSpawnData->pos.y, + curSpawnData->pos.z, 0, curCobraInfo->rotY, 0, curSpawnData->params); this->actor.child = NULL; if (&curCobraInfo->cobra->dyna.actor == NULL) { @@ -106,17 +106,17 @@ void BgJyaBigmirror_HandleCobra(Actor* thisx, GlobalContext* globalCtx) { } } -void BgJyaBigmirror_SetBombiwaFlag(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_SetBombiwaFlag(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; - if (Flags_GetSwitch(globalCtx, 0x29)) { + if (Flags_GetSwitch(play, 0x29)) { this->puzzleFlags |= BIGMIR_PUZZLE_BOMBIWA_DESTROYED; } else { this->puzzleFlags &= ~(BIGMIR_PUZZLE_BOMBIWA_DESTROYED); } } -void BgJyaBigmirror_HandleMirRay(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { static s16 sMirRayParamss[] = { 0x0005, 0x0007, 0x0008 }; static Vec3f sMirRayPoss[] = { { 60.0f, 1802.0f, -1102.0f }, @@ -129,7 +129,7 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, GlobalContext* globalCtx) { s32 i; s32 objBankIndex; - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MIR_RAY); + objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MIR_RAY); if ((objBankIndex < 0) || (objBankIndex != this->mirRayObjIndex)) { this->lightBeams[2] = NULL; @@ -152,8 +152,8 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 3; i++) { if (lightBeamToggles[i]) { - if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&globalCtx->objectCtx, objBankIndex)) { - this->lightBeams[i] = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, sMirRayPoss[i].x, + if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&play->objectCtx, objBankIndex)) { + this->lightBeams[i] = Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPoss[i].x, sMirRayPoss[i].y, sMirRayPoss[i].z, 0, 0, 0, sMirRayParamss[i]); if (this->lightBeams[i] == NULL) { @@ -172,7 +172,7 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, GlobalContext* globalCtx) { this->mirRayObjIndex = objBankIndex; } -void BgJyaBigmirror_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_Init(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; if (sIsSpawned) { @@ -192,7 +192,7 @@ void BgJyaBigmirror_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(jya 大鏡)(arg_data 0x%04x)\n", this->actor.params); } -void BgJyaBigmirror_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_Destroy(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; if (this->spawned) { @@ -200,28 +200,28 @@ void BgJyaBigmirror_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void BgJyaBigmirror_Update(Actor* thisx, GlobalContext* globalCtx) { - BgJyaBigmirror_SetRoomFlag(thisx, globalCtx); - BgJyaBigmirror_HandleCobra(thisx, globalCtx); - BgJyaBigmirror_SetBombiwaFlag(thisx, globalCtx); - BgJyaBigmirror_HandleMirRay(thisx, globalCtx); +void BgJyaBigmirror_Update(Actor* thisx, PlayState* play) { + BgJyaBigmirror_SetRoomFlag(thisx, play); + BgJyaBigmirror_HandleCobra(thisx, play); + BgJyaBigmirror_SetBombiwaFlag(thisx, play); + BgJyaBigmirror_HandleMirRay(thisx, play); } -void BgJyaBigmirror_DrawLightBeam(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_DrawLightBeam(Actor* thisx, PlayState* play) { static Vec3s D_80893F4C = { 0, 0, 0 }; BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; Actor* lift; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_bigmirror.c", 435); - func_80093D84(globalCtx->state.gfxCtx); - lift = Actor_Find(&globalCtx->actorCtx, ACTOR_BG_JYA_LIFT, ACTORCAT_BG); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_bigmirror.c", 435); + func_80093D84(play->state.gfxCtx); + lift = Actor_Find(&play->actorCtx, ACTOR_BG_JYA_LIFT, ACTORCAT_BG); if (lift != NULL) { this->liftHeight = lift->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); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_bigmirror.c", 457), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_jya_bigmirror.c", 457), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBigMirror1DL); @@ -229,25 +229,25 @@ void BgJyaBigmirror_DrawLightBeam(Actor* thisx, GlobalContext* globalCtx) { if (1) {} Matrix_SetTranslateRotateYXZ(lift->world.pos.x, lift->world.pos.y, lift->world.pos.z, &D_80893F4C); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_bigmirror.c", 467), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_jya_bigmirror.c", 467), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBigMirror2DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_bigmirror.c", 476); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_jya_bigmirror.c", 476); } -void BgJyaBigmirror_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBigmirror_Draw(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; if (this->puzzleFlags & BIGMIR_PUZZLE_IN_1ST_TOP_ROOM) { - Gfx_DrawDListOpa(globalCtx, gBigMirror3DL); - Gfx_DrawDListXlu(globalCtx, gBigMirror4DL); + 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, globalCtx); + BgJyaBigmirror_DrawLightBeam(&this->actor, play); } } diff --git a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c index 5638409fab..f7e01b256f 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c +++ b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgJyaBlock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBlock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBlock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBlock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaBlock_Init(Actor* thisx, PlayState* play); +void BgJyaBlock_Destroy(Actor* thisx, PlayState* play); +void BgJyaBlock_Update(Actor* thisx, PlayState* play); +void BgJyaBlock_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Jya_Block_InitVars = { ACTOR_BG_JYA_BLOCK, @@ -33,45 +33,45 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1500, ICHAIN_STOP), }; -void BgJyaBlock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBlock_Init(Actor* thisx, PlayState* play) { s32 pad; BgJyaBlock* this = (BgJyaBlock*)thisx; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gPushBlockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if ((LINK_AGE_IN_YEARS != YEARS_CHILD) || !Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + if ((LINK_AGE_IN_YEARS != YEARS_CHILD) || !Flags_GetSwitch(play, thisx->params & 0x3F)) { Actor_Kill(&this->dyna.actor); } } -void BgJyaBlock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBlock_Destroy(Actor* thisx, PlayState* play) { BgJyaBlock* this = (BgJyaBlock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgJyaBlock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBlock_Update(Actor* thisx, PlayState* play) { BgJyaBlock* this = (BgJyaBlock*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->stateFlags2 &= ~PLAYER_STATE2_4; this->dyna.unk_150 = 0.0f; } -void BgJyaBlock_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_block.c", 145); +void BgJyaBlock_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_block.c", 145); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gPushBlockGrayTex)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_block.c", 153), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_jya_block.c", 153), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetEnvColor(POLY_OPA_DISP++, 232, 210, 176, 255); gSPDisplayList(POLY_OPA_DISP++, gPushBlockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_block.c", 158); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_jya_block.c", 158); } 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 caebb2d86d..08e8bd88ef 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 @@ -3,16 +3,16 @@ #include "objects/object_jya_obj/object_jya_obj.h" #define FLAGS ACTOR_FLAG_0 -void BgJyaBombchuiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombchuiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombchuiwa_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombchuiwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaBombchuiwa_Init(Actor* thisx, PlayState* play); +void BgJyaBombchuiwa_Destroy(Actor* thisx, PlayState* play); +void BgJyaBombchuiwa_Update(Actor* thisx, PlayState* play); +void BgJyaBombchuiwa_Draw(Actor* thisx, PlayState* play); -void BgJyaBombchuiwa_WaitForExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx); -void BgJyaBombchuiwa_SetupWaitForExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx); -void func_808949B8(BgJyaBombchuiwa* this, GlobalContext* globalCtx); -void BgJyaBombchuiwa_CleanUpAfterExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx); -void BgJyaBombchuiwa_SpawnLightRay(BgJyaBombchuiwa* this, GlobalContext* globalCtx); +void BgJyaBombchuiwa_WaitForExplosion(BgJyaBombchuiwa* this, PlayState* play); +void BgJyaBombchuiwa_SetupWaitForExplosion(BgJyaBombchuiwa* this, PlayState* play); +void func_808949B8(BgJyaBombchuiwa* this, PlayState* play); +void BgJyaBombchuiwa_CleanUpAfterExplosion(BgJyaBombchuiwa* this, PlayState* play); +void BgJyaBombchuiwa_SpawnLightRay(BgJyaBombchuiwa* this, PlayState* play); const ActorInit Bg_Jya_Bombchuiwa_InitVars = { ACTOR_BG_JYA_BOMBCHUIWA, @@ -61,11 +61,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgJyaBombchuiwa_SetupCollider(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_SetupCollider(BgJyaBombchuiwa* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, &this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderItems); } void BgJyaBombchuiwa_SetDrawFlags(BgJyaBombchuiwa* this, u8 drawFlags) { @@ -73,27 +73,27 @@ void BgJyaBombchuiwa_SetDrawFlags(BgJyaBombchuiwa* this, u8 drawFlags) { this->drawFlags |= drawFlags; } -void BgJyaBombchuiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_Init(Actor* thisx, PlayState* play) { BgJyaBombchuiwa* this = (BgJyaBombchuiwa*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - BgJyaBombchuiwa_SetupCollider(this, globalCtx); - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { - BgJyaBombchuiwa_SpawnLightRay(this, globalCtx); + BgJyaBombchuiwa_SetupCollider(this, play); + if (Flags_GetSwitch(play, this->actor.params & 0x3F)) { + BgJyaBombchuiwa_SpawnLightRay(this, play); } else { - BgJyaBombchuiwa_SetupWaitForExplosion(this, globalCtx); + BgJyaBombchuiwa_SetupWaitForExplosion(this, play); } Actor_SetFocus(&this->actor, 0.0f); } -void BgJyaBombchuiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgJyaBombchuiwa_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgJyaBombchuiwa* this = (BgJyaBombchuiwa*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void BgJyaBombchuiwa_Break(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_Break(BgJyaBombchuiwa* this, PlayState* play) { Vec3f pos; Vec3f velocity; s16 scale; @@ -128,36 +128,36 @@ void BgJyaBombchuiwa_Break(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { arg7 = 0x28; } } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -300, arg5, arg6, arg7, 0, scale, 1, 15, 80, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -300, arg5, arg6, arg7, 0, scale, 1, 15, 80, KAKERA_COLOR_NONE, OBJECT_JYA_OBJ, gBombiwaEffectDL); } - func_80033480(globalCtx, &this->actor.world.pos, 100.0f, 8, 100, 160, 0); + func_80033480(play, &this->actor.world.pos, 100.0f, 8, 100, 160, 0); } -void BgJyaBombchuiwa_SetupWaitForExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_SetupWaitForExplosion(BgJyaBombchuiwa* this, PlayState* play) { this->actionFunc = BgJyaBombchuiwa_WaitForExplosion; BgJyaBombchuiwa_SetDrawFlags(this, 3); this->timer = 0; } -void BgJyaBombchuiwa_WaitForExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_WaitForExplosion(BgJyaBombchuiwa* this, PlayState* play) { if ((this->collider.base.acFlags & AC_HIT) || (this->timer > 0)) { if (this->timer == 0) { - OnePointCutscene_Init(globalCtx, 3410, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3410, -99, &this->actor, CAM_ID_MAIN); } this->timer++; if (this->timer > 10) { - BgJyaBombchuiwa_Break(this, globalCtx); - BgJyaBombchuiwa_CleanUpAfterExplosion(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + BgJyaBombchuiwa_Break(this, play); + BgJyaBombchuiwa_CleanUpAfterExplosion(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); } } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void BgJyaBombchuiwa_CleanUpAfterExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_CleanUpAfterExplosion(BgJyaBombchuiwa* this, PlayState* play) { this->actionFunc = func_808949B8; BgJyaBombchuiwa_SetDrawFlags(this, 4); this->lightRayIntensity = 0.3f; @@ -165,21 +165,21 @@ void BgJyaBombchuiwa_CleanUpAfterExplosion(BgJyaBombchuiwa* this, GlobalContext* this->actor.flags &= ~ACTOR_FLAG_0; } -void func_808949B8(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void func_808949B8(BgJyaBombchuiwa* this, PlayState* play) { this->timer++; if (this->timer & 4) { - func_80033480(globalCtx, &this->actor.world.pos, 60.0f, 3, 100, 100, 0); + func_80033480(play, &this->actor.world.pos, 60.0f, 3, 100, 100, 0); } if (Math_StepToF(&this->lightRayIntensity, 1.0f, 0.028)) { - BgJyaBombchuiwa_SpawnLightRay(this, globalCtx); + BgJyaBombchuiwa_SpawnLightRay(this, play); } } -void BgJyaBombchuiwa_SpawnLightRay(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_SpawnLightRay(BgJyaBombchuiwa* this, PlayState* play) { this->actionFunc = NULL; this->lightRayIntensity = 153.0f; BgJyaBombchuiwa_SetDrawFlags(this, 4); - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, this->actor.world.pos.x, this->actor.world.pos.y, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0) == NULL) { // "Occurrence failure" osSyncPrintf("Error : Mir_Ray 発生失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_jya_bombchuiwa.c", 410, @@ -187,56 +187,56 @@ void BgJyaBombchuiwa_SpawnLightRay(BgJyaBombchuiwa* this, GlobalContext* globalC } } -void BgJyaBombchuiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_Update(Actor* thisx, PlayState* play) { BgJyaBombchuiwa* this = (BgJyaBombchuiwa*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgJyaBombchuiwa_DrawRock(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 436); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 439), +void BgJyaBombchuiwa_DrawRock(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 436); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 439), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBombchuiwa2DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 443); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 443); } -void BgJyaBombchuiwa_DrawLight(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_DrawLight(Actor* thisx, PlayState* play) { BgJyaBombchuiwa* this = (BgJyaBombchuiwa*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 453); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 457), + OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 453); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 457), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, CLAMP_MAX((u32)(this->lightRayIntensity * 153.0f), 153)); gSPDisplayList(POLY_XLU_DISP++, gBombchuiwaLight1DL); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, CLAMP_MAX((u32)(this->lightRayIntensity * 255.0f), 255)); gSPDisplayList(POLY_XLU_DISP++, gBombchuiwaLight2DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 472); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_jya_bombchuiwa.c", 472); } -void BgJyaBombchuiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombchuiwa_Draw(Actor* thisx, PlayState* play) { static Vec3f D_80894F88 = { -920.0f, 480.0f, -889.0f }; static Vec3s D_80894F94 = { 0, 0, 0 }; BgJyaBombchuiwa* this = (BgJyaBombchuiwa*)thisx; if (this->drawFlags & 1) { - Gfx_DrawDListOpa(globalCtx, gBombchuiwaDL); + Gfx_DrawDListOpa(play, gBombchuiwaDL); Collider_UpdateSpheres(0, &this->collider); } if (this->drawFlags & 2) { - BgJyaBombchuiwa_DrawRock(globalCtx); + BgJyaBombchuiwa_DrawRock(play); } if (this->drawFlags & 4) { Matrix_SetTranslateRotateYXZ(D_80894F88.x, D_80894F88.y, D_80894F88.z, &D_80894F94); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); if (this->drawFlags & 4) { - BgJyaBombchuiwa_DrawLight(thisx, globalCtx); + BgJyaBombchuiwa_DrawLight(thisx, play); } } } diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h index aa91448f3d..e936167100 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h +++ b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h @@ -6,7 +6,7 @@ struct BgJyaBombchuiwa; -typedef void (*BgJyaBombchuiwaActionFunc)(struct BgJyaBombchuiwa*, GlobalContext*); +typedef void (*BgJyaBombchuiwaActionFunc)(struct BgJyaBombchuiwa*, PlayState*); typedef struct BgJyaBombchuiwa { /* 0x0000 */ Actor actor; 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 8568a78d50..30cc6f7ea3 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 @@ -11,10 +11,10 @@ #define FLAGS 0 -void BgJyaBombiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombiwa_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaBombiwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaBombiwa_Init(Actor* thisx, PlayState* play); +void BgJyaBombiwa_Destroy(Actor* thisx, PlayState* play); +void BgJyaBombiwa_Update(Actor* thisx, PlayState* play); +void BgJyaBombiwa_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Jya_Bombiwa_InitVars = { ACTOR_BG_JYA_BOMBIWA, @@ -62,14 +62,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flag) { +void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, PlayState* play, CollisionHeader* collision, s32 flag) { s16 pad1; CollisionHeader* colHeader = NULL; s16 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning: move BG registration failed" @@ -78,14 +78,14 @@ void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, GlobalContext* globalCtx, Co } } -void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, GlobalContext* globalCtx) { +void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); } -void BgJyaBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombiwa_Init(Actor* thisx, PlayState* play) { BgJyaBombiwa* this = (BgJyaBombiwa*)thisx; if ((this->dyna.actor.params & 0x3F) != 0x29) { @@ -96,9 +96,9 @@ void BgJyaBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.params & 0x3F); osSyncPrintf(VT_RST); } - BgJyaBombiwa_SetupDynaPoly(this, globalCtx, &gBombiwaCol, DPM_UNK); - BgJyaBombiwa_InitCollider(this, globalCtx); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + BgJyaBombiwa_SetupDynaPoly(this, play, &gBombiwaCol, DPM_UNK); + BgJyaBombiwa_InitCollider(this, play); + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { Actor_Kill(&this->dyna.actor); } else { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -108,14 +108,14 @@ void BgJyaBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgJyaBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombiwa_Destroy(Actor* thisx, PlayState* play) { BgJyaBombiwa* this = (BgJyaBombiwa*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void BgJyaBombiwa_Break(BgJyaBombiwa* this, GlobalContext* globalCtx) { +void BgJyaBombiwa_Break(BgJyaBombiwa* this, PlayState* play) { Vec3f pos; Vec3f velocity; s16 arg5; @@ -150,31 +150,31 @@ void BgJyaBombiwa_Break(BgJyaBombiwa* this, GlobalContext* globalCtx) { arg7 = 80; } } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -400, arg5, arg6, arg7, 0, scale, 1, 20, 80, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -400, arg5, arg6, arg7, 0, scale, 1, 20, 80, KAKERA_COLOR_NONE, OBJECT_JYA_OBJ, gBombiwaEffectDL); } pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 70.0f; pos.z = this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &pos, 100.0f, 0xA, 0x64, 0xA0, 1); + func_80033480(play, &pos, 100.0f, 0xA, 0x64, 0xA0, 1); } -void BgJyaBombiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombiwa_Update(Actor* thisx, PlayState* play) { BgJyaBombiwa* this = (BgJyaBombiwa*)thisx; if (this->collider.base.acFlags & AC_HIT) { - BgJyaBombiwa_Break(this, globalCtx); - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + BgJyaBombiwa_Break(this, play); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); Actor_Kill(&this->dyna.actor); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgJyaBombiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaBombiwa_Draw(Actor* thisx, PlayState* play) { BgJyaBombiwa* this = (BgJyaBombiwa*)thisx; - Gfx_DrawDListOpa(globalCtx, gBombiwaDL); + Gfx_DrawDListOpa(play, gBombiwaDL); Collider_UpdateSpheres(0, &this->collider); } 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 ef46bb2613..2d1dabfde6 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 @@ -6,15 +6,15 @@ #define FLAGS ACTOR_FLAG_4 -void BgJyaCobra_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaCobra_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaCobra_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaCobra_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaCobra_Init(Actor* thisx, PlayState* play); +void BgJyaCobra_Destroy(Actor* thisx, PlayState* play); +void BgJyaCobra_Update(Actor* thisx, PlayState* play); +void BgJyaCobra_Draw(Actor* thisx, PlayState* play); -void func_80896918(BgJyaCobra* this, GlobalContext* globalCtx); -void func_80896950(BgJyaCobra* this, GlobalContext* globalCtx); -void func_808969F8(BgJyaCobra* this, GlobalContext* globalCtx); -void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx); +void func_80896918(BgJyaCobra* this, PlayState* play); +void func_80896950(BgJyaCobra* this, PlayState* play); +void func_808969F8(BgJyaCobra* this, PlayState* play); +void func_80896ABC(BgJyaCobra* this, PlayState* play); #include "overlays/ovl_Bg_Jya_Cobra/ovl_Bg_Jya_Cobra.c" @@ -115,14 +115,14 @@ void func_808958F0(Vec3f* dest, Vec3f* src, f32 arg2, f32 arg3) { dest->z = (src->z * arg3) - (src->x * arg2); } -void BgJyaCobra_InitDynapoly(BgJyaCobra* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flags) { +void BgJyaCobra_InitDynapoly(BgJyaCobra* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG Registration Failure" osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_cobra.c", 247, @@ -130,8 +130,8 @@ void BgJyaCobra_InitDynapoly(BgJyaCobra* this, GlobalContext* globalCtx, Collisi } } -void BgJyaCobra_SpawnRay(BgJyaCobra* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_MIR_RAY, this->dyna.actor.world.pos.x, +void BgJyaCobra_SpawnRay(BgJyaCobra* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_MIR_RAY, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 57.0f, this->dyna.actor.world.pos.z, 0, 0, 0, 6); if (this->dyna.actor.child == NULL) { osSyncPrintf(VT_FGCOL(RED)); @@ -188,8 +188,8 @@ void func_80895A70(BgJyaCobra* this) { } } -void func_80895BEC(BgJyaCobra* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80895BEC(BgJyaCobra* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp2C; @@ -199,7 +199,7 @@ void func_80895BEC(BgJyaCobra* this, GlobalContext* globalCtx) { player->actor.world.pos.z = this->dyna.actor.world.pos.z + sp2C.z; } -void func_80895C74(BgJyaCobra* this, GlobalContext* globalCtx) { +void func_80895C74(BgJyaCobra* this, PlayState* play) { s16 phi_v0; s16 params = this->dyna.actor.params; BgJyaBigmirror* mirror = (BgJyaBigmirror*)this->dyna.actor.parent; @@ -394,20 +394,20 @@ void BgJyaCobra_UpdateShadowFromTop(BgJyaCobra* this) { } } -void BgJyaCobra_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaCobra_Init(Actor* thisx, PlayState* play) { BgJyaCobra* this = (BgJyaCobra*)thisx; - BgJyaCobra_InitDynapoly(this, globalCtx, &gCobraCol, DPM_UNK); + BgJyaCobra_InitDynapoly(this, play, &gCobraCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (!(this->dyna.actor.params & 3) && Flags_GetSwitch(globalCtx, ((s32)this->dyna.actor.params >> 8) & 0x3F)) { + if (!(this->dyna.actor.params & 3) && Flags_GetSwitch(play, ((s32)this->dyna.actor.params >> 8) & 0x3F)) { this->dyna.actor.world.rot.y = this->dyna.actor.home.rot.y = this->dyna.actor.shape.rot.y = 0; } if (!(this->dyna.actor.params & 3)) { - BgJyaCobra_SpawnRay(this, globalCtx); + BgJyaCobra_SpawnRay(this, play); } - func_80896918(this, globalCtx); + func_80896918(this, play); if ((this->dyna.actor.params & 3) == 1 || (this->dyna.actor.params & 3) == 2) { this->dyna.actor.room = -1; @@ -422,26 +422,26 @@ void BgJyaCobra_Init(Actor* thisx, GlobalContext* globalCtx) { &this->shadowTextureBuffer, COBRA_SHADOW_TEX_PTR(this)); } -void BgJyaCobra_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaCobra_Destroy(Actor* thisx, PlayState* play) { BgJyaCobra* this = (BgJyaCobra*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80896918(BgJyaCobra* this, GlobalContext* globalCtx) { +void func_80896918(BgJyaCobra* this, PlayState* play) { this->actionFunc = func_80896950; this->unk_168 = 0; this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y = (this->unk_16C * 0x2000) + this->dyna.actor.home.rot.y; } -void func_80896950(BgJyaCobra* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80896950(BgJyaCobra* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 > 0.001f) { this->unk_168++; if (this->unk_168 >= 15) { - func_808969F8(this, globalCtx); + func_808969F8(this, play); } } else { this->unk_168 = 0; @@ -453,8 +453,8 @@ void func_80896950(BgJyaCobra* this, GlobalContext* globalCtx) { } } -void func_808969F8(BgJyaCobra* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808969F8(BgJyaCobra* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 phi_a3; s16 temp2; @@ -477,9 +477,9 @@ void func_808969F8(BgJyaCobra* this, GlobalContext* globalCtx) { this->unk_172 = true; } -void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx) { +void func_80896ABC(BgJyaCobra* this, PlayState* play) { s16 temp_v0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); temp_v0 = (s16)((this->unk_16C * 0x2000) + this->dyna.actor.home.rot.y) - this->dyna.actor.world.rot.y; if (ABS(temp_v0) < 7424) { @@ -492,7 +492,7 @@ void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx) { this->unk_16C = (this->unk_16C + this->unk_16A) & 7; player->stateFlags2 &= ~PLAYER_STATE2_4; this->dyna.unk_150 = 0.0f; - func_80896918(this, globalCtx); + func_80896918(this, play); } else { this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y = (this->unk_16C * 0x2000) + this->dyna.actor.home.rot.y + this->unk_170; @@ -500,7 +500,7 @@ void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx) { if (player->stateFlags2 & PLAYER_STATE2_4) { if (this->unk_172) { - func_80895BEC(this, globalCtx); + func_80895BEC(this, play); } } else if (fabsf(this->dyna.unk_150) < 0.001f) { this->unk_172 = false; @@ -510,13 +510,13 @@ void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void BgJyaCobra_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgJyaCobra_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgJyaCobra* this = (BgJyaCobra*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80895C74(this, globalCtx); + func_80895C74(this, play); func_80895A70(this); if ((this->dyna.actor.params & 3) == 0 || (this->dyna.actor.params & 3) == 2) { @@ -524,23 +524,23 @@ void BgJyaCobra_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void func_80896CB4(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_cobra.c", 864); +void func_80896CB4(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_cobra.c", 864); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_cobra.c", 867), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_jya_cobra.c", 867), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCobra2DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_cobra.c", 872); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_jya_cobra.c", 872); } -void func_80896D78(BgJyaCobra* this, GlobalContext* globalCtx) { +void func_80896D78(BgJyaCobra* this, PlayState* play) { s32 pad; Vec3s sp44; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_cobra.c", 924); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_cobra.c", 924); + func_80093D84(play->state.gfxCtx); sp44.x = D_80897308[this->dyna.actor.params & 3] + this->dyna.actor.shape.rot.x; sp44.y = this->dyna.actor.shape.rot.y; @@ -548,23 +548,23 @@ void func_80896D78(BgJyaCobra* this, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(this->unk_180.x, this->unk_180.y, this->unk_180.z, &sp44); Matrix_Scale(0.1f, 0.1f, this->unk_190, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_cobra.c", 939), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_jya_cobra.c", 939), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s32)(this->unk_18C * 140.0f)); gSPDisplayList(POLY_XLU_DISP++, gCobra3DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_cobra.c", 947); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_jya_cobra.c", 947); } -void BgJyaCobra_DrawShadow(BgJyaCobra* this, GlobalContext* globalCtx) { +void BgJyaCobra_DrawShadow(BgJyaCobra* this, PlayState* play) { s32 pad; s16 params = this->dyna.actor.params & 3; Vec3f sp64; Vec3s* phi_a3; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_cobra.c", 966); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_cobra.c", 966); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); if (params == 0) { sp64.x = this->dyna.actor.world.pos.x - 50.0f; @@ -587,7 +587,7 @@ void BgJyaCobra_DrawShadow(BgJyaCobra* this, GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, 40.0f, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 120); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_cobra.c", 994), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_jya_cobra.c", 994), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPLoadTextureBlock(POLY_XLU_DISP++, COBRA_SHADOW_TEX_PTR(this), G_IM_FMT_I, G_IM_SIZ_8b, COBRA_SHADOW_TEX_WIDTH, @@ -596,17 +596,17 @@ void BgJyaCobra_DrawShadow(BgJyaCobra* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, sShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_cobra.c", 1006); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_jya_cobra.c", 1006); } -void BgJyaCobra_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaCobra_Draw(Actor* thisx, PlayState* play) { BgJyaCobra* this = (BgJyaCobra*)thisx; - func_80896CB4(globalCtx); - Gfx_DrawDListOpa(globalCtx, gCobra1DL); + func_80896CB4(play); + Gfx_DrawDListOpa(play, gCobra1DL); if (this->unk_18C > 0.0f) { - func_80896D78(this, globalCtx); + func_80896D78(this, play); } if ((this->dyna.actor.params & 3) == 2) { @@ -614,9 +614,9 @@ void BgJyaCobra_Draw(Actor* thisx, GlobalContext* globalCtx) { if (mirror != NULL && (mirror->puzzleFlags & BIGMIR_PUZZLE_BOMBIWA_DESTROYED) && (mirror->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED)) { - BgJyaCobra_DrawShadow(this, globalCtx); + BgJyaCobra_DrawShadow(this, play); } } else { - BgJyaCobra_DrawShadow(this, globalCtx); + BgJyaCobra_DrawShadow(this, play); } } 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 b7006632f3..8389b83220 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 @@ -6,7 +6,7 @@ struct BgJyaCobra; -typedef void (*BgJyaCobraActionFunc)(struct BgJyaCobra*, GlobalContext*); +typedef void (*BgJyaCobraActionFunc)(struct BgJyaCobra*, PlayState*); #define COBRA_SHADOW_TEX_WIDTH 64 #define COBRA_SHADOW_TEX_HEIGHT 64 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 b5ee4e84f1..7e3df18c7a 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 @@ -10,13 +10,13 @@ #define FLAGS ACTOR_FLAG_4 -void BgJyaGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaGoroiwa_Init(Actor* thisx, PlayState* play); +void BgJyaGoroiwa_Destroy(Actor* thisx, PlayState* play); +void BgJyaGoroiwa_Update(Actor* thisx, PlayState* play); +void BgJyaGoroiwa_Draw(Actor* thisx, PlayState* play); -void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, GlobalContext* globalCtx); -void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, GlobalContext* globalCtx); +void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, PlayState* play); +void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, PlayState* play); void BgJyaGoroiwa_SetupWait(BgJyaGoroiwa* this); void BgJyaGoroiwa_SetupMove(BgJyaGoroiwa* this); @@ -79,11 +79,11 @@ void BgJyaGoroiwa_UpdateCollider(BgJyaGoroiwa* this) { worldSphere->center.z = this->actor.world.pos.z; } -void BgJyaGoroiwa_InitCollider(BgJyaGoroiwa* this, GlobalContext* globalCtx) { +void BgJyaGoroiwa_InitCollider(BgJyaGoroiwa* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, &this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderItem); BgJyaGoroiwa_UpdateCollider(this); this->collider.elements[0].dim.worldSphere.radius = 58; } @@ -94,11 +94,11 @@ void BgJyaGoroiwa_UpdateRotation(BgJyaGoroiwa* this) { this->actor.shape.rot.z -= 0x10000 / (119 * M_PI) * xDiff; } -void BgJyaGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaGoroiwa_Init(Actor* thisx, PlayState* play) { BgJyaGoroiwa* this = (BgJyaGoroiwa*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - BgJyaGoroiwa_InitCollider(this, globalCtx); + BgJyaGoroiwa_InitCollider(this, play); this->actor.shape.rot.x = this->actor.shape.rot.y = this->actor.shape.rot.z = 0; CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 595.0f, ActorShadow_DrawCircle, 9.0f); @@ -106,10 +106,10 @@ void BgJyaGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { BgJyaGoroiwa_SetupMove(this); } -void BgJyaGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaGoroiwa_Destroy(Actor* thisx, PlayState* play) { BgJyaGoroiwa* this = (BgJyaGoroiwa*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void BgJyaGoroiwa_SetupMove(BgJyaGoroiwa* this) { @@ -119,7 +119,7 @@ void BgJyaGoroiwa_SetupMove(BgJyaGoroiwa* this) { this->speedFactor = 1.0f; } -void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, GlobalContext* globalCtx) { +void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, PlayState* play) { Actor* thisx = &this->actor; s16 relYawTowardsPlayer; f32 speedXZsqBase = (-100.0f - thisx->world.pos.y) * 2.5f; @@ -152,8 +152,8 @@ void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, GlobalContext* globalCtx) { thisx->world.rot.y += 0x8000; } - func_8002F6D4(globalCtx, thisx, 2.0f, thisx->yawTowardsPlayer, 0.0f, 0); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F6D4(play, thisx, 2.0f, thisx->yawTowardsPlayer, 0.0f, 0); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); this->yOffsetSpeed = 10.0f; this->speedFactor = 0.5f; @@ -185,7 +185,7 @@ void BgJyaGoroiwa_SetupWait(BgJyaGoroiwa* this) { this->waitTimer = 0; } -void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, GlobalContext* globalCtx) { +void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, PlayState* play) { this->waitTimer++; if (this->waitTimer > 60) { BgJyaGoroiwa_SetupMove(this); @@ -193,29 +193,29 @@ void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, GlobalContext* globalCtx) { } } -void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaGoroiwa_Update(Actor* thisx, PlayState* play) { s32 pad; BgJyaGoroiwa* this = (BgJyaGoroiwa*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 bgId; Vec3f pos; if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29))) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); BgJyaGoroiwa_UpdateRotation(this); pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 59.5f; pos.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos); BgJyaGoroiwa_UpdateCollider(this); if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void BgJyaGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gRollingRockDL); +void BgJyaGoroiwa_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gRollingRockDL); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h index 803f30d95c..2722475480 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h +++ b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h @@ -6,7 +6,7 @@ struct BgJyaGoroiwa; -typedef void (*BgJyaGoroiwaFunc)(struct BgJyaGoroiwa*, GlobalContext*); +typedef void (*BgJyaGoroiwaFunc)(struct BgJyaGoroiwa*, PlayState*); typedef struct BgJyaGoroiwa { /* 0x0000 */ Actor actor; 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 8897cc7803..10a093c726 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 @@ -10,17 +10,17 @@ #define FLAGS ACTOR_FLAG_4 -void BgJyaHaheniron_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaHaheniron_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaHaheniron_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaHaheniron_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaHaheniron_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); +void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, PlayState* play); void BgJyaHaheniron_SetupPillarCrumble(BgJyaHaheniron* this); -void BgJyaHaheniron_PillarCrumble(BgJyaHaheniron* this, GlobalContext* globalCtx); +void BgJyaHaheniron_PillarCrumble(BgJyaHaheniron* this, PlayState* play); void BgJyaHaheniron_SetupRubbleCollide(BgJyaHaheniron* this); -void BgJyaHaheniron_RubbleCollide(BgJyaHaheniron* this, GlobalContext* globalCtx); +void BgJyaHaheniron_RubbleCollide(BgJyaHaheniron* this, PlayState* play); const ActorInit Bg_Jya_Haheniron_InitVars = { ACTOR_BG_JYA_HAHENIRON, @@ -75,14 +75,14 @@ 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, GlobalContext* globalCtx) { +void BgJyaHaheniron_ColliderInit(BgJyaHaheniron* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); } -void BgJyaHaheniron_SpawnFragments(GlobalContext* globalCtx, Vec3f* vec1, Vec3f* vec2) { +void BgJyaHaheniron_SpawnFragments(PlayState* play, Vec3f* vec1, Vec3f* vec2) { Vec3f vel; Vec3f pos; s16 arg5; @@ -105,24 +105,24 @@ void BgJyaHaheniron_SpawnFragments(GlobalContext* globalCtx, Vec3f* vec1, Vec3f* arg5 = 32; } - EffectSsKakera_Spawn(globalCtx, vec1, &vel, vec1, -350, arg5, 40, 4, 0, sKakeraScales[i], 0, 20, 40, + 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; } 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(globalCtx, &pos, 100.0f, 4, 100, 160, 1); + func_80033480(play, &pos, 100.0f, 4, 100, 160, 1); } -void BgJyaHaheniron_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaHaheniron_Init(Actor* thisx, PlayState* play) { s32 pad; BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetScale(&this->actor, D_80898794[this->actor.params]); if (this->actor.params == 0) { - BgJyaHaheniron_ColliderInit(this, globalCtx); + BgJyaHaheniron_ColliderInit(this, play); this->actor.shape.rot.z = (Rand_ZeroOne() * 65535.0f); BgJyaHaheniron_SetupChairCrumble(this); } else if (this->actor.params == 1) { @@ -132,12 +132,12 @@ void BgJyaHaheniron_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgJyaHaheniron_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaHaheniron_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; if (this->actor.params == 0) { - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } } @@ -145,11 +145,11 @@ void BgJyaHaheniron_SetupChairCrumble(BgJyaHaheniron* this) { this->actionFunc = BgJyaHaheniron_ChairCrumble; } -void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, GlobalContext* globalCtx) { +void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, PlayState* play) { Vec3f vec; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 8.0f, 0.0f, + 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) && @@ -157,12 +157,12 @@ void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, GlobalContext* globalCtx) 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(globalCtx, &this->actor.world.pos, &vec); + BgJyaHaheniron_SpawnFragments(play, &this->actor.world.pos, &vec); Actor_Kill(&this->actor); } else if (this->timer > 60) { Actor_Kill(&this->actor); } else { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } this->actor.shape.rot.y += 0x4B0; this->actor.shape.rot.x += 0xFA0; @@ -172,11 +172,11 @@ void BgJyaHaheniron_SetupPillarCrumble(BgJyaHaheniron* this) { this->actionFunc = BgJyaHaheniron_PillarCrumble; } -void BgJyaHaheniron_PillarCrumble(BgJyaHaheniron* this, GlobalContext* globalCtx) { +void BgJyaHaheniron_PillarCrumble(BgJyaHaheniron* this, PlayState* play) { if (this->timer >= 8) { Actor_MoveForward(&this->actor); } else if (this->timer >= 17) { - BgJyaHaheniron_SpawnFragments(globalCtx, &this->actor.world.pos, D_808987A0); + BgJyaHaheniron_SpawnFragments(play, &this->actor.world.pos, D_808987A0); Actor_Kill(&this->actor); } this->actor.shape.rot.y += 0x258; @@ -187,23 +187,23 @@ void BgJyaHaheniron_SetupRubbleCollide(BgJyaHaheniron* this) { this->actionFunc = BgJyaHaheniron_RubbleCollide; } -void BgJyaHaheniron_RubbleCollide(BgJyaHaheniron* this, GlobalContext* globalCtx) { +void BgJyaHaheniron_RubbleCollide(BgJyaHaheniron* this, PlayState* play) { if (this->timer >= 17) { - BgJyaHaheniron_SpawnFragments(globalCtx, &this->actor.world.pos, D_808987AC); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EN_IRONNACK_BREAK_PILLAR2); + BgJyaHaheniron_SpawnFragments(play, &this->actor.world.pos, D_808987AC); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EN_IRONNACK_BREAK_PILLAR2); Actor_Kill(&this->actor); } } -void BgJyaHaheniron_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaHaheniron_Update(Actor* thisx, PlayState* play) { s32 pad; BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; this->timer++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgJyaHaheniron_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaHaheniron_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gObjectJyaIronDL_000880, gObjectJyaIronDL_000AE0, @@ -215,5 +215,5 @@ void BgJyaHaheniron_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == 0) { Collider_UpdateSpheres(0, &this->collider); } - Gfx_DrawDListOpa(globalCtx, dLists[this->actor.params]); + Gfx_DrawDListOpa(play, dLists[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 6cdcf6ee5d..60f9c6ef9e 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 @@ -6,7 +6,7 @@ struct BgJyaHaheniron; -typedef void (*BgJyaHahenironActionFunc)(struct BgJyaHaheniron*, GlobalContext*); +typedef void (*BgJyaHahenironActionFunc)(struct BgJyaHaheniron*, PlayState*); typedef struct BgJyaHaheniron { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c index 186fcddbf0..e55f47295f 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c +++ b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c @@ -10,17 +10,17 @@ #define FLAGS 0 -typedef void (*BgJyaIronobjIkFunc)(BgJyaIronobj*, GlobalContext*, EnIk*); +typedef void (*BgJyaIronobjIkFunc)(BgJyaIronobj*, PlayState*, EnIk*); -void BgJyaIronobj_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaIronobj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaIronobj_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaIronobj_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaIronobj_Init(Actor* thisx, PlayState* play); +void BgJyaIronobj_Destroy(Actor* thisx, PlayState* play); +void BgJyaIronobj_Update(Actor* thisx, PlayState* play); +void BgJyaIronobj_Draw(Actor* thisx, PlayState* play); void func_808992D8(BgJyaIronobj* this); -void func_808992E8(BgJyaIronobj* this, GlobalContext* globalCtx); +void func_808992E8(BgJyaIronobj* this, PlayState* play); -void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* globalCtx, EnIk* enIk); -void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, GlobalContext* arg1, EnIk* enIk); +void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, PlayState* play, EnIk* enIk); +void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, PlayState* play, EnIk* enIk); static int sUnused = 0; @@ -79,11 +79,11 @@ static InitChainEntry sInitChain[] = { static CollisionHeader* sCollisionHeaders[] = { &gPillarCol, &gThroneCol }; -void BgJyaIronobj_InitCylinder(BgJyaIronobj* this, GlobalContext* globalCtx) { +void BgJyaIronobj_InitCylinder(BgJyaIronobj* this, PlayState* play) { ColliderCylinder* colCylinder = &this->colCylinder; - Collider_InitCylinder(globalCtx, colCylinder); - Collider_SetCylinder(globalCtx, colCylinder, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, colCylinder); + Collider_SetCylinder(play, colCylinder, &this->dyna.actor, &sCylinderInit); if ((this->dyna.actor.params & 1) == 1) { this->colCylinder.dim.radius = 40; this->colCylinder.dim.height = 100; @@ -94,7 +94,7 @@ void BgJyaIronobj_InitCylinder(BgJyaIronobj* this, GlobalContext* globalCtx) { /* * Spawns particles for the destroyed pillar */ -void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* globalCtx, EnIk* enIk) { +void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, PlayState* play, EnIk* enIk) { s32 i; s32 j; s16 unkArg5; @@ -115,7 +115,7 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* global for (i = 0; i < 8; i++) { Actor* actor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, Rand_ZeroOne() * 80.0f + this->dyna.actor.world.pos.y + 20.0f, this->dyna.actor.world.pos.z, 0, (s16)(Rand_ZeroOne() * 0x4000) + rotY - 0x2000, 0, 0); if (actor != NULL) { @@ -123,9 +123,9 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* global actor->velocity.y = Rand_ZeroOne() * 10.0f + 6.0f; } } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 150.0f, this->dyna.actor.world.pos.z, 0, 0, 0, 1); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0, 2); sins = Math_SinS(rotY); coss = Math_CosS(rotY); @@ -146,10 +146,10 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* global vel.x = 2.0f * ((Rand_ZeroOne() * 6.0f) - 3.0f) + (Rand_ZeroOne() * sins * 8.0f * temp_f22); vel.y = (Rand_ZeroOne() * 8.0f) - 3.0f; vel.z = 2.0f * ((Rand_ZeroOne() * 6.0f) - 3.0f) + (Rand_ZeroOne() * coss * 8.0f * temp_f22); - EffectSsKakera_Spawn(globalCtx, &pos, &vel, &pos, -350, unkArg5, D_80899500[j & 7], 4, 0, D_808994E0[j & 7], 0, - 5, D_808994F0[j & 7], -1, OBJECT_JYA_IRON, gObjectJyaIronDL_000880); + EffectSsKakera_Spawn(play, &pos, &vel, &pos, -350, unkArg5, D_80899500[j & 7], 4, 0, D_808994E0[j & 7], 0, 5, + D_808994F0[j & 7], -1, OBJECT_JYA_IRON, gObjectJyaIronDL_000880); if (Rand_ZeroOne() < 0.26f) { - func_80033480(globalCtx, &pos, 200.0f, 1, D_808994E0[j & 7] * 4 + 60, D_808994E0[j & 7] * 4 + 80, 1); + func_80033480(play, &pos, 200.0f, 1, D_808994E0[j & 7] * 4 + 60, D_808994E0[j & 7] * 4 + 80, 1); } } } @@ -157,7 +157,7 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* global /* * Spawns particles for the destroyed throne */ -void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, GlobalContext* arg1, EnIk* enIk) { +void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, PlayState* play, EnIk* enIk) { s32 i; s32 j; s16 unkArg5; @@ -177,7 +177,7 @@ void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, GlobalContext* arg1, E rotY = Actor_WorldYawTowardActor(&this->dyna.actor, &enIk->actor) + D_808994D8[enIk->unk_2FF - 1]; for (i = 0; i < 8; i++) { Actor* actor = - Actor_Spawn(&arg1->actorCtx, arg1, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_JYA_HAHENIRON, this->dyna.actor.world.pos.x, (Rand_ZeroOne() * 80.0f) + this->dyna.actor.world.pos.y + 10.0f, this->dyna.actor.world.pos.z, 0, ((s16)(s32)(Rand_ZeroOne() * 0x4000) + rotY) - 0x2000, 0, 0); if (actor != NULL) { @@ -205,39 +205,39 @@ void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, GlobalContext* arg1, E vel.x = 2.0f * (Rand_ZeroOne() * 6.0f - 3.0f) + (Rand_ZeroOne() * sins * 8.0f * temp_f22); vel.y = Rand_ZeroOne() * 8.0f - 3.0f; vel.z = 2.0f * (Rand_ZeroOne() * 6.0f - 3.0f) + (Rand_ZeroOne() * coss * 8.0f * temp_f22); - EffectSsKakera_Spawn(arg1, &pos, &vel, &pos, -350, unkArg5, D_80899530[j & 7], 4, 0, D_80899510[j & 7], 0, 5, + EffectSsKakera_Spawn(play, &pos, &vel, &pos, -350, unkArg5, D_80899530[j & 7], 4, 0, D_80899510[j & 7], 0, 5, D_80899520[j & 7], -1, OBJECT_JYA_IRON, gObjectJyaIronDL_000880); if (Rand_ZeroOne() < 0.26f) { - func_80033480(arg1, &pos, 200.0f, 1, D_80899510[j & 7] * 4 + 60, D_80899510[j & 7] * 4 + 80, 1); + func_80033480(play, &pos, 200.0f, 1, D_80899510[j & 7] * 4 + 60, D_80899510[j & 7] * 4 + 80, 1); } } } -void BgJyaIronobj_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaIronobj_Init(Actor* thisx, PlayState* play) { BgJyaIronobj* this = (BgJyaIronobj*)thisx; s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - BgJyaIronobj_InitCylinder(this, globalCtx); + BgJyaIronobj_InitCylinder(this, play); CollisionHeader_GetVirtual(sCollisionHeaders[thisx->params & 1], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); func_808992D8(this); } -void BgJyaIronobj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaIronobj_Destroy(Actor* thisx, PlayState* play) { BgJyaIronobj* this = (BgJyaIronobj*)thisx; - Collider_DestroyCylinder(globalCtx, &this->colCylinder); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->colCylinder); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_808992D8(BgJyaIronobj* this) { this->actionFunc = func_808992E8; } -void func_808992E8(BgJyaIronobj* this, GlobalContext* globalCtx) { +void func_808992E8(BgJyaIronobj* this, PlayState* play) { static BgJyaIronobjIkFunc particleFunc[] = { BgJyaIronobj_SpawnPillarParticles, BgJyaIronobj_SpawnThoneParticles }; Actor* actor; Vec3f dropPos; @@ -247,30 +247,29 @@ void func_808992E8(BgJyaIronobj* this, GlobalContext* globalCtx) { actor = this->colCylinder.base.ac; this->colCylinder.base.acFlags &= ~AC_HIT; if (actor != NULL && actor->id == ACTOR_EN_IK) { - particleFunc[this->dyna.actor.params & 1](this, globalCtx, (EnIk*)actor); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 80, - NA_SE_EN_IRONNACK_BREAK_PILLAR); + particleFunc[this->dyna.actor.params & 1](this, play, (EnIk*)actor); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 80, NA_SE_EN_IRONNACK_BREAK_PILLAR); dropPos.x = this->dyna.actor.world.pos.x; dropPos.y = this->dyna.actor.world.pos.y + 20.0f; dropPos.z = this->dyna.actor.world.pos.z; for (i = 0; i < 3; i++) { - Item_DropCollectible(globalCtx, &dropPos, ITEM00_HEART); + Item_DropCollectible(play, &dropPos, ITEM00_HEART); dropPos.y += 18.0f; } Actor_Kill(&this->dyna.actor); return; } } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder.base); } } -void BgJyaIronobj_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaIronobj_Update(Actor* thisx, PlayState* play) { BgJyaIronobj* this = (BgJyaIronobj*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgJyaIronobj_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sOpaDL[thisx->params & 1]); +void BgJyaIronobj_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sOpaDL[thisx->params & 1]); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h index 1abdd4be19..a8189049af 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h +++ b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h @@ -6,7 +6,7 @@ struct BgJyaIronobj; -typedef void (*BgJyaIronobjActionFunc)(struct BgJyaIronobj*, GlobalContext*); +typedef void (*BgJyaIronobjActionFunc)(struct BgJyaIronobj*, PlayState*); typedef struct BgJyaIronobj { /* 0x0000 */ DynaPolyActor dyna; 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 91b490f168..802a1868c9 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 @@ -9,15 +9,15 @@ #define FLAGS 0 -void BgJyaKanaami_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaKanaami_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaKanaami_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaKanaami_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaKanaami_Init(Actor* thisx, PlayState* play); +void BgJyaKanaami_Destroy(Actor* thisx, PlayState* play); +void BgJyaKanaami_Update(Actor* thisx, PlayState* play); +void BgJyaKanaami_Draw(Actor* thisx, PlayState* play); void func_80899880(BgJyaKanaami* this); -void func_80899894(BgJyaKanaami* this, GlobalContext* globalCtx); +void func_80899894(BgJyaKanaami* this, PlayState* play); void func_8089993C(BgJyaKanaami* this); -void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx); +void func_80899950(BgJyaKanaami* this, PlayState* play); void func_80899A08(BgJyaKanaami* this); const ActorInit Bg_Jya_Kanaami_InitVars = { @@ -39,26 +39,26 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgJyaKanaami_InitDynaPoly(BgJyaKanaami* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flag) { +void BgJyaKanaami_InitDynaPoly(BgJyaKanaami* this, PlayState* play, CollisionHeader* collision, s32 flag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_kanaami.c", 145, this->dyna.actor.id, this->dyna.actor.params); } } -void BgJyaKanaami_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaKanaami_Init(Actor* thisx, PlayState* play) { BgJyaKanaami* this = (BgJyaKanaami*)thisx; - BgJyaKanaami_InitDynaPoly(this, globalCtx, &gKanaamiCol, DPM_UNK); + BgJyaKanaami_InitDynaPoly(this, play, &gKanaamiCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { func_80899A08(this); } else { func_80899880(this); @@ -66,10 +66,10 @@ void BgJyaKanaami_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(jya 金網)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgJyaKanaami_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaKanaami_Destroy(Actor* thisx, PlayState* play) { BgJyaKanaami* this = (BgJyaKanaami*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80899880(BgJyaKanaami* this) { @@ -77,10 +77,10 @@ void func_80899880(BgJyaKanaami* this) { this->unk_16A = 0; } -void func_80899894(BgJyaKanaami* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) || this->unk_16A > 0) { +void func_80899894(BgJyaKanaami* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || this->unk_16A > 0) { if (this->dyna.actor.world.pos.x > -1000.0f && this->unk_16A == 0) { - OnePointCutscene_Init(globalCtx, 3450, -99, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3450, -99, &this->dyna.actor, CAM_ID_MAIN); } this->unk_16A += 1; if (this->unk_16A >= 0xA) { @@ -94,7 +94,7 @@ void func_8089993C(BgJyaKanaami* this) { this->unk_168 = 0; } -void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) { +void func_80899950(BgJyaKanaami* this, PlayState* play) { s32 pad[2]; s32 quakeId; @@ -102,7 +102,7 @@ void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) { if (Math_ScaledStepToS(&this->dyna.actor.world.rot.x, 0x4000, this->unk_168)) { func_80899A08(this); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_TRAP_BOUND); - quakeId = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeId = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeId, 25000); Quake_SetQuakeValues(quakeId, 2, 0, 0, 0); Quake_SetCountdown(quakeId, 16); @@ -114,15 +114,15 @@ void func_80899A08(BgJyaKanaami* this) { this->dyna.actor.world.rot.x = 0x4000; } -void BgJyaKanaami_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaKanaami_Update(Actor* thisx, PlayState* play) { BgJyaKanaami* this = (BgJyaKanaami*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } this->dyna.actor.shape.rot.x = this->dyna.actor.world.rot.x; } -void BgJyaKanaami_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gKanaamiDL); +void BgJyaKanaami_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gKanaamiDL); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h index b57f51838b..6e5d670fde 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h +++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h @@ -6,7 +6,7 @@ struct BgJyaKanaami; -typedef void (*BgJyaKanaamiActionFunc)(struct BgJyaKanaami*, GlobalContext*); +typedef void (*BgJyaKanaamiActionFunc)(struct BgJyaKanaami*, PlayState*); typedef struct BgJyaKanaami { /* 0x0000 */ DynaPolyActor dyna; 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 a850da8bfc..bf2ee1fa9e 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 @@ -9,16 +9,16 @@ #define FLAGS ACTOR_FLAG_4 -void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaLift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaLift_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaLift_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaLift_Init(Actor* thisx, PlayState* play); +void BgJyaLift_Destroy(Actor* thisx, PlayState* play); +void BgJyaLift_Update(Actor* thisx, PlayState* play); +void BgJyaLift_Draw(Actor* thisx, PlayState* play); void BgJyaLift_SetFinalPosY(BgJyaLift* this); void BgJyaLift_SetInitPosY(BgJyaLift* this); -void BgJyaLift_DelayMove(BgJyaLift* this, GlobalContext* globalCtx); +void BgJyaLift_DelayMove(BgJyaLift* this, PlayState* play); void BgJyaLift_SetupMove(BgJyaLift* this); -void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx); +void BgJyaLift_Move(BgJyaLift* this, PlayState* play); static s16 sIsSpawned = false; @@ -41,16 +41,16 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 2500, ICHAIN_STOP), }; -void BgJyaLift_InitDynapoly(BgJyaLift* this, GlobalContext* globalCtx, CollisionHeader* collisionHeader, s32 moveFlag) { +void BgJyaLift_InitDynapoly(BgJyaLift* this, PlayState* play, CollisionHeader* collisionHeader, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collisionHeader, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaLift_Init(Actor* thisx, PlayState* play) { BgJyaLift* this = (BgJyaLift*)thisx; this->isSpawned = false; @@ -61,9 +61,9 @@ void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) { // "Goddess lift CT" osSyncPrintf("女神リフト CT\n"); - BgJyaLift_InitDynapoly(this, globalCtx, &gLiftCol, DPM_UNK); + BgJyaLift_InitDynapoly(this, play, &gLiftCol, DPM_UNK); Actor_ProcessInitChain(thisx, sInitChain); - if (Flags_GetSwitch(globalCtx, (thisx->params & 0x3F))) { + if (Flags_GetSwitch(play, (thisx->params & 0x3F))) { BgJyaLift_SetFinalPosY(this); } else { BgJyaLift_SetInitPosY(this); @@ -73,7 +73,7 @@ void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) { this->isSpawned = true; } -void BgJyaLift_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaLift_Destroy(Actor* thisx, PlayState* play) { BgJyaLift* this = (BgJyaLift*)thisx; if (this->isSpawned) { @@ -81,7 +81,7 @@ void BgJyaLift_Destroy(Actor* thisx, GlobalContext* globalCtx) { // "Goddess Lift DT" osSyncPrintf("女神リフト DT\n"); sIsSpawned = false; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -91,11 +91,11 @@ void BgJyaLift_SetInitPosY(BgJyaLift* this) { this->moveDelay = 0; } -void BgJyaLift_DelayMove(BgJyaLift* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) || (this->moveDelay > 0)) { +void BgJyaLift_DelayMove(BgJyaLift* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || (this->moveDelay > 0)) { this->moveDelay++; if (this->moveDelay >= 20) { - OnePointCutscene_Init(globalCtx, 3430, -99, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3430, -99, &this->dyna.actor, CAM_ID_MAIN); BgJyaLift_SetupMove(this); } } @@ -105,7 +105,7 @@ void BgJyaLift_SetupMove(BgJyaLift* this) { this->actionFunc = BgJyaLift_Move; } -void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx) { +void BgJyaLift_Move(BgJyaLift* this, PlayState* play) { f32 distFromBottom; f32 tempVelocity; @@ -113,7 +113,7 @@ void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx) { tempVelocity = (this->dyna.actor.velocity.y < 0.2f) ? 0.2f : this->dyna.actor.velocity.y; distFromBottom = Math_SmoothStepToF(&this->dyna.actor.world.pos.y, 973.0f, 0.1f, tempVelocity, 0.2f); if ((this->dyna.actor.world.pos.y < 1440.0f) && (1440.0f <= this->dyna.actor.prevPos.y)) { - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); } if (fabsf(distFromBottom) < 0.001f) { BgJyaLift_SetFinalPosY(this); @@ -128,27 +128,27 @@ void BgJyaLift_SetFinalPosY(BgJyaLift* this) { this->dyna.actor.world.pos.y = 973.0f; } -void BgJyaLift_Update(Actor* thisx, GlobalContext* globalCtx2) { +void BgJyaLift_Update(Actor* thisx, PlayState* play2) { BgJyaLift* this = (BgJyaLift*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } if ((this->dyna.unk_160 & 4) && ((this->unk_16B & 4) == 0)) { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DIRECTED_YAW); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DIRECTED_YAW); } else if (((this->dyna.unk_160 & 4) == 0) && (this->unk_16B & 4) && - (globalCtx->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_DIRECTED_YAW)) { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); + (play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_DIRECTED_YAW)) { + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } this->unk_16B = this->dyna.unk_160; // Spirit Temple room 5 is the main room with the statue room 25 is directly above room 5 - if ((globalCtx->roomCtx.curRoom.num != 5) && (globalCtx->roomCtx.curRoom.num != 25)) { + if ((play->roomCtx.curRoom.num != 5) && (play->roomCtx.curRoom.num != 25)) { Actor_Kill(thisx); } } -void BgJyaLift_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gLiftDL); +void BgJyaLift_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gLiftDL); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h index 2b5bc918f5..b6c951dc18 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h +++ b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h @@ -5,7 +5,7 @@ #include "global.h" struct BgJyaLift; -typedef void (*BgJyaLiftActionFunc)(struct BgJyaLift*, GlobalContext*); +typedef void (*BgJyaLiftActionFunc)(struct BgJyaLift*, PlayState*); typedef struct BgJyaLift { /* 0x000 */ DynaPolyActor dyna; 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 20a7231142..595239e384 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 @@ -10,15 +10,15 @@ #define FLAGS 0 -void BgJyaMegami_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaMegami_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaMegami_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaMegami_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaMegami_Init(Actor* thisx, PlayState* play); +void BgJyaMegami_Destroy(Actor* thisx, PlayState* play); +void BgJyaMegami_Update(Actor* thisx, PlayState* play); +void BgJyaMegami_Draw(Actor* thisx, PlayState* play); void BgJyaMegami_SetupDetectLight(BgJyaMegami* this); -void BgJyaMegami_DetectLight(BgJyaMegami* this, GlobalContext* globalCtx); +void BgJyaMegami_DetectLight(BgJyaMegami* this, PlayState* play); void BgJyaMegami_SetupExplode(BgJyaMegami* this); -void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx); +void BgJyaMegami_Explode(BgJyaMegami* this, PlayState* play); const ActorInit Bg_Jya_Megami_InitVars = { ACTOR_BG_JYA_MEGAMI, @@ -110,40 +110,40 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1200, ICHAIN_STOP), }; -void BgJyaMegami_InitDynaPoly(BgJyaMegami* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flag) { +void BgJyaMegami_InitDynaPoly(BgJyaMegami* this, PlayState* play, CollisionHeader* collision, s32 flag) { s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgJyaMegami_InitCollider(BgJyaMegami* this, GlobalContext* globalCtx) { +void BgJyaMegami_InitCollider(BgJyaMegami* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, &this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, &this->colliderItem); } -void BgJyaMegami_SpawnEffect(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, s32 num, s32 arg4) { +void BgJyaMegami_SpawnEffect(PlayState* play, Vec3f* pos, Vec3f* velocity, s32 num, s32 arg4) { Vec3f spB4; s32 i; for (i = 0; i < num; i++) { s32 idx = ((s16)(Rand_ZeroOne() * 8.0f)) & D_8089B17C[arg4]; s16 arg5 = ((idx < 5) && (Rand_ZeroOne() < 0.7f)) ? 0x40 : 0x20; - EffectSsKakera_Spawn(globalCtx, pos, velocity, pos, -90, arg5, D_8089B16C[idx], 4, 0, D_8089B14C[idx], 0, 5, + EffectSsKakera_Spawn(play, pos, velocity, pos, -90, arg5, D_8089B16C[idx], 4, 0, D_8089B14C[idx], 0, 5, D_8089B15C[idx], KAKERA_COLOR_NONE, OBJECT_JYA_OBJ, gMegami2DL); if (Rand_ZeroOne() < 0.45f) { Math_Vec3f_Copy(&spB4, pos); spB4.z += 25.0f; - func_80033480(globalCtx, &spB4, 60.0f, 0, D_8089B14C[idx] * 4 + 50, D_8089B14C[idx] * 4 + 70, 1); + func_80033480(play, &spB4, 60.0f, 0, D_8089B14C[idx] * 4 + 50, D_8089B14C[idx] * 4 + 70, 1); } } } -void BgJyaMegami_SetupSpawnEffect(BgJyaMegami* this, GlobalContext* globalCtx, f32 arg2) { +void BgJyaMegami_SetupSpawnEffect(BgJyaMegami* this, PlayState* play, f32 arg2) { s32 i; Vec3f pos; @@ -151,17 +151,17 @@ void BgJyaMegami_SetupSpawnEffect(BgJyaMegami* this, GlobalContext* globalCtx, f if (Rand_ZeroOne() < arg2) { Math_Vec3f_Sum(&this->dyna.actor.world.pos, &sPiecesInit[i].unk_00, &pos); pos.z += 15.0f; - BgJyaMegami_SpawnEffect(globalCtx, &pos, &sVelocity, 1, 0); + BgJyaMegami_SpawnEffect(play, &pos, &sVelocity, 1, 0); } } } -void BgJyaMegami_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaMegami_Init(Actor* thisx, PlayState* play) { BgJyaMegami* this = (BgJyaMegami*)thisx; - BgJyaMegami_InitDynaPoly(this, globalCtx, &GMegamiCol, DPM_UNK); - BgJyaMegami_InitCollider(this, globalCtx); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + BgJyaMegami_InitDynaPoly(this, play, &GMegamiCol, DPM_UNK); + BgJyaMegami_InitCollider(this, play); + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { Actor_Kill(&this->dyna.actor); } else { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -170,11 +170,11 @@ void BgJyaMegami_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgJyaMegami_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaMegami_Destroy(Actor* thisx, PlayState* play) { BgJyaMegami* this = (BgJyaMegami*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } void BgJyaMegami_SetupDetectLight(BgJyaMegami* this) { @@ -183,22 +183,22 @@ void BgJyaMegami_SetupDetectLight(BgJyaMegami* this) { this->crumbleIndex = 0; } -void BgJyaMegami_DetectLight(BgJyaMegami* this, GlobalContext* globalCtx) { +void BgJyaMegami_DetectLight(BgJyaMegami* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->lightTimer++; this->collider.base.acFlags &= ~AC_HIT; - if (globalCtx->gameplayFrames % 4 == 0) { - BgJyaMegami_SetupSpawnEffect(this, globalCtx, (this->crumbleIndex * 0.04f) + 0.05f); + if (play->gameplayFrames % 4 == 0) { + BgJyaMegami_SetupSpawnEffect(this, play, (this->crumbleIndex * 0.04f) + 0.05f); } func_8002F974(&this->dyna.actor, NA_SE_EV_FACE_CRUMBLE_SLOW - SFX_FLAG); } else if (this->lightTimer > 0) { this->lightTimer--; } if (this->lightTimer > 40) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); BgJyaMegami_SetupExplode(this); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 100, NA_SE_EV_FACE_EXPLOSION); - OnePointCutscene_Init(globalCtx, 3440, -99, &this->dyna.actor, CAM_ID_MAIN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 100, NA_SE_EV_FACE_EXPLOSION); + OnePointCutscene_Init(play, 3440, -99, &this->dyna.actor, CAM_ID_MAIN); } else { if (this->lightTimer < 8) { this->crumbleIndex = 0; @@ -211,7 +211,7 @@ void BgJyaMegami_DetectLight(BgJyaMegami* this, GlobalContext* globalCtx) { } else { this->crumbleIndex = 4; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -226,7 +226,7 @@ void BgJyaMegami_SetupExplode(BgJyaMegami* this) { this->explosionTimer = 0; } -void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) { +void BgJyaMegami_Explode(BgJyaMegami* this, PlayState* play) { static Vec3f sVec = { 0.0f, 0.0f, 0.0f }; BgJyaMegamiPiece* temp; u32 i; @@ -236,7 +236,7 @@ void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) { this->explosionTimer++; if (this->explosionTimer == 30) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 100, NA_SE_EV_FACE_BREAKDOWN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 100, NA_SE_EV_FACE_BREAKDOWN); } for (i = 0; i < ARRAY_COUNT(this->pieces); i++) { @@ -255,12 +255,12 @@ void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) { if (Rand_ZeroOne() < 0.067f) { Math_Vec3f_Sum(&temp->pos, &temp2->unk_00, &sp8C); sp8C.z += 10.0f; - BgJyaMegami_SpawnEffect(globalCtx, &sp8C, &temp->vel, 3, 2); + BgJyaMegami_SpawnEffect(play, &sp8C, &temp->vel, 3, 2); } } else if (this->explosionTimer == temp2->delay) { Math_Vec3f_Sum(&temp->pos, &temp2->unk_00, &sp8C); sp8C.z += 10.0f; - BgJyaMegami_SpawnEffect(globalCtx, &sp8C, &temp->vel, 4, 2); + BgJyaMegami_SpawnEffect(play, &sp8C, &temp->vel, 4, 2); } } @@ -269,13 +269,13 @@ void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) { sp8C.x = ((Rand_ZeroOne() - 0.5f) * 90.0f) + this->dyna.actor.world.pos.x; sp8C.y = (this->dyna.actor.world.pos.y - (Rand_ZeroOne() * 80.0f)) - 20.0f; sp8C.z = this->dyna.actor.world.pos.z - (Rand_ZeroOne() - 0.5f) * 50.0f; - BgJyaMegami_SpawnEffect(globalCtx, &sp8C, &sVec, 1, 0); + BgJyaMegami_SpawnEffect(play, &sp8C, &sVec, 1, 0); } if (this->explosionTimer < ARRAY_COUNT(this->pieces)) { sp8C.x = this->dyna.actor.world.pos.x; sp8C.y = this->dyna.actor.world.pos.y - 60.0f; sp8C.z = this->dyna.actor.world.pos.z; - func_80033480(globalCtx, &sp8C, 100.0f, 1, 150, 100, 1); + func_80033480(play, &sp8C, 100.0f, 1, 150, 100, 1); } if (this->explosionTimer == 60) { func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -285,10 +285,10 @@ void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) { } } -void BgJyaMegami_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaMegami_Update(Actor* thisx, PlayState* play) { BgJyaMegami* this = (BgJyaMegami*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } static void* sRightSideCrumbles[] = { @@ -301,17 +301,17 @@ static void* sLeftSideCrumbles[] = { gMegamiLeftCrumble4Tex, gMegamiLeftCrumble5Tex, }; -void BgJyaMegami_DrawFace(BgJyaMegami* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 706); +void BgJyaMegami_DrawFace(BgJyaMegami* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_megami.c", 706); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRightSideCrumbles[this->crumbleIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sLeftSideCrumbles[this->crumbleIndex])); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 716), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_jya_megami.c", 716), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMegami1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 720); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_jya_megami.c", 720); } static Gfx* sDLists[] = { @@ -320,14 +320,14 @@ static Gfx* sDLists[] = { gMegamiPiece11DL, gMegamiPiece12DL, gMegamiPiece13DL, }; -void BgJyaMegami_DrawExplode(BgJyaMegami* this, GlobalContext* globalCtx) { +void BgJyaMegami_DrawExplode(BgJyaMegami* this, PlayState* play) { s32 pad; BgJyaMegamiPiece* piece; u32 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 746); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_megami.c", 746); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->pieces); i++) { piece = &this->pieces[i]; @@ -339,21 +339,21 @@ void BgJyaMegami_DrawExplode(BgJyaMegami* this, GlobalContext* globalCtx) { Matrix_Translate(sPiecesInit[i].unk_00.x * -10.0f, sPiecesInit[i].unk_00.y * -10.0f, sPiecesInit[i].unk_00.z * -10.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 778), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_jya_megami.c", 778), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDLists[i]); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 783); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_jya_megami.c", 783); } -void BgJyaMegami_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaMegami_Draw(Actor* thisx, PlayState* play) { BgJyaMegami* this = (BgJyaMegami*)thisx; Collider_UpdateSpheres(0, &this->collider); if (this->actionFunc == BgJyaMegami_Explode) { - BgJyaMegami_DrawExplode(this, globalCtx); + BgJyaMegami_DrawExplode(this, play); } else { - BgJyaMegami_DrawFace(this, globalCtx); + BgJyaMegami_DrawFace(this, play); } } diff --git a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h index f4a859c31f..a85222c940 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h +++ b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h @@ -6,7 +6,7 @@ struct BgJyaMegami; -typedef void (*BgJyaMegamiActionFunc)(struct BgJyaMegami*, GlobalContext*); +typedef void (*BgJyaMegamiActionFunc)(struct BgJyaMegami*, PlayState*); typedef struct { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c index 686fd95c4a..9f81471337 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c +++ b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c @@ -10,16 +10,16 @@ #define FLAGS ACTOR_FLAG_4 -void BgJyaZurerukabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgJyaZurerukabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgJyaZurerukabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgJyaZurerukabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgJyaZurerukabe_Init(Actor* thisx, PlayState* play); +void BgJyaZurerukabe_Destroy(Actor* thisx, PlayState* play); +void BgJyaZurerukabe_Update(Actor* thisx, PlayState* play); +void BgJyaZurerukabe_Draw(Actor* thisx, PlayState* play); -void func_8089B4C8(BgJyaZurerukabe* this, GlobalContext* globalCtx); +void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play); void func_8089B7B4(BgJyaZurerukabe* this); -void func_8089B7C4(BgJyaZurerukabe* this, GlobalContext* globalCtx); +void func_8089B7C4(BgJyaZurerukabe* this, PlayState* play); void func_8089B80C(BgJyaZurerukabe* this); -void func_8089B870(BgJyaZurerukabe* this, GlobalContext* globalCtx); +void func_8089B870(BgJyaZurerukabe* this, PlayState* play); static f32 D_8089B9C0[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; @@ -59,23 +59,22 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, GlobalContext* globalCtx, CollisionHeader* collision, - s32 flag) { +void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, PlayState* play, CollisionHeader* collision, s32 flag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_zurerukabe.c", 194, this->dyna.actor.id, this->dyna.actor.params); } } -void func_8089B4C8(BgJyaZurerukabe* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((player->stateFlags1 == PLAYER_STATE1_21) && (player->actor.wallPoly != NULL)) { s32 i; @@ -94,24 +93,24 @@ void func_8089B4C8(BgJyaZurerukabe* this, GlobalContext* globalCtx) { case 3: case 5: if (fabsf(D_8089B9C0[D_8089BA30[i]]) > 1.0f) { - func_8002F6D4(globalCtx, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); + func_8002F6D4(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); } break; case 1: case 4: if (fabsf(D_8089B9C0[D_8089BA30[i]] - D_8089B9C0[D_8089BA30[i + 1]]) > 1.0f) { - func_8002F6D4(globalCtx, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); + func_8002F6D4(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); } break; } } } -void BgJyaZurerukabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaZurerukabe_Init(Actor* thisx, PlayState* play) { BgJyaZurerukabe* this = (BgJyaZurerukabe*)thisx; s32 i; - BgJyaZurerukabe_InitDynaPoly(this, globalCtx, &gZurerukabeCol, DPM_UNK); + BgJyaZurerukabe_InitDynaPoly(this, play, &gZurerukabeCol, DPM_UNK); Actor_ProcessInitChain(thisx, sInitChain); for (i = 0; i < ARRAY_COUNT(D_8089B9F0); i++) { @@ -133,10 +132,10 @@ void BgJyaZurerukabe_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(jya ずれる壁)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgJyaZurerukabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaZurerukabe_Destroy(Actor* thisx, PlayState* play) { BgJyaZurerukabe* this = (BgJyaZurerukabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); D_8089B9C0[this->unk_168] = 0.0f; } @@ -144,7 +143,7 @@ void func_8089B7B4(BgJyaZurerukabe* this) { this->actionFunc = func_8089B7C4; } -void func_8089B7C4(BgJyaZurerukabe* this, GlobalContext* globalCtx) { +void func_8089B7C4(BgJyaZurerukabe* this, PlayState* play) { if (this->unk_16A <= 0) { func_8089B80C(this); } @@ -160,7 +159,7 @@ void func_8089B80C(BgJyaZurerukabe* this) { this->unk_16C += this->unk_16E; } -void func_8089B870(BgJyaZurerukabe* this, GlobalContext* globalCtx) { +void func_8089B870(BgJyaZurerukabe* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + (this->unk_16C * 75), D_8089BA08[this->unk_168])) { func_8089B7B4(this); @@ -170,20 +169,20 @@ void func_8089B870(BgJyaZurerukabe* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); } -void BgJyaZurerukabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgJyaZurerukabe_Update(Actor* thisx, PlayState* play) { BgJyaZurerukabe* this = (BgJyaZurerukabe*)thisx; if (this->unk_16A > 0) { this->unk_16A--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_168 == 0) { - func_8089B4C8(this, globalCtx); + func_8089B4C8(this, play); } } -void BgJyaZurerukabe_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gZurerukabeDL); +void BgJyaZurerukabe_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gZurerukabeDL); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h index d2cb8ff973..683f681999 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h +++ b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h @@ -6,7 +6,7 @@ struct BgJyaZurerukabe; -typedef void (*BgJyaZurerukabeActionFunc)(struct BgJyaZurerukabe*, GlobalContext*); +typedef void (*BgJyaZurerukabeActionFunc)(struct BgJyaZurerukabe*, PlayState*); typedef struct BgJyaZurerukabe { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c index 8a155f0047..1d835a6848 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c @@ -9,10 +9,10 @@ #define FLAGS ACTOR_FLAG_5 -void BgMenkuriEye_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriEye_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriEye_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriEye_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMenkuriEye_Init(Actor* thisx, PlayState* play); +void BgMenkuriEye_Destroy(Actor* thisx, PlayState* play); +void BgMenkuriEye_Update(Actor* thisx, PlayState* play); +void BgMenkuriEye_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Menkuri_Eye_InitVars = { ACTOR_BG_MENKURI_EYE, @@ -59,34 +59,34 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgMenkuriEye_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriEye_Init(Actor* thisx, PlayState* play) { BgMenkuriEye* this = (BgMenkuriEye*)thisx; ColliderJntSphElement* colliderList; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); 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; this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; colliderList = this->collider.elements; colliderList->dim.worldSphere.radius = colliderList->dim.modelSphere.radius; - if (!Flags_GetSwitch(globalCtx, this->actor.params)) { + if (!Flags_GetSwitch(play, this->actor.params)) { D_8089C1A0 = 0; } this->framesUntilDisable = -1; } -void BgMenkuriEye_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriEye_Destroy(Actor* thisx, PlayState* play) { BgMenkuriEye* this = (BgMenkuriEye*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void BgMenkuriEye_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriEye_Update(Actor* thisx, PlayState* play) { BgMenkuriEye* this = (BgMenkuriEye*)thisx; - if (!Flags_GetSwitch(globalCtx, this->actor.params)) { + if (!Flags_GetSwitch(play, this->actor.params)) { if (this->framesUntilDisable != -1) { if (this->framesUntilDisable != 0) { this->framesUntilDisable -= 1; @@ -107,23 +107,23 @@ void BgMenkuriEye_Update(Actor* thisx, GlobalContext* globalCtx) { } this->framesUntilDisable = 416; if (D_8089C1A0 == 4) { - Flags_SetSwitch(globalCtx, this->actor.params); + Flags_SetSwitch(play, this->actor.params); func_80078884(NA_SE_SY_CORRECT_CHIME); } } if (this->framesUntilDisable == -1) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, 0.0f); } -void BgMenkuriEye_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriEye_Draw(Actor* thisx, PlayState* play) { BgMenkuriEye* this = (BgMenkuriEye*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_menkuri_eye.c", 292); - func_80093D84(globalCtx->state.gfxCtx); - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_menkuri_eye.c", 292); + func_80093D84(play->state.gfxCtx); + if (Flags_GetSwitch(play, this->actor.params)) { gDPSetEnvColor(POLY_XLU_DISP++, 200, 0, 0, 255); } else if (this->framesUntilDisable == -1) { gDPSetEnvColor(POLY_XLU_DISP++, 200, 0, 0, 0); @@ -133,9 +133,9 @@ void BgMenkuriEye_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_menkuri_eye.c", 331), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_menkuri_eye.c", 331), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGTGEyeStatueEyeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_menkuri_eye.c", 335); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_menkuri_eye.c", 335); } diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c index 711e17012f..fef12a3c06 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgMenkuriKaiten_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriKaiten_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriKaiten_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriKaiten_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMenkuriKaiten_Init(Actor* thisx, PlayState* play); +void BgMenkuriKaiten_Destroy(Actor* thisx, PlayState* play); +void BgMenkuriKaiten_Update(Actor* thisx, PlayState* play); +void BgMenkuriKaiten_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Menkuri_Kaiten_InitVars = { ACTOR_BG_MENKURI_KAITEN, @@ -30,7 +30,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgMenkuriKaiten_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriKaiten_Init(Actor* thisx, PlayState* play) { BgMenkuriKaiten* this = (BgMenkuriKaiten*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -38,24 +38,24 @@ void BgMenkuriKaiten_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK3); CollisionHeader_GetVirtual(&gGTGRotatingRingPlatformCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgMenkuriKaiten_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriKaiten_Destroy(Actor* thisx, PlayState* play) { BgMenkuriKaiten* this = (BgMenkuriKaiten*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgMenkuriKaiten_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriKaiten_Update(Actor* thisx, PlayState* play) { BgMenkuriKaiten* this = (BgMenkuriKaiten*)thisx; - if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params) && func_80043590(&this->dyna)) { + if (!Flags_GetSwitch(play, this->dyna.actor.params) && func_80043590(&this->dyna)) { func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); this->dyna.actor.shape.rot.y += 0x80; } } -void BgMenkuriKaiten_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gGTGRotatingRingPlatformDL); +void BgMenkuriKaiten_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gGTGRotatingRingPlatformDL); } diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c index 00162c5d02..6965a3f08c 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgMenkuriNisekabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriNisekabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMenkuriNisekabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMenkuriNisekabe_Init(Actor* thisx, PlayState* play); +void BgMenkuriNisekabe_Destroy(Actor* thisx, PlayState* play); +void BgMenkuriNisekabe_Update(Actor* thisx, PlayState* play); +void BgMenkuriNisekabe_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Menkuri_Nisekabe_InitVars = { ACTOR_BG_MENKURI_NISEKABE, @@ -28,32 +28,32 @@ const ActorInit Bg_Menkuri_Nisekabe_InitVars = { static Gfx* sDLists[] = { gGTGFakeWallDL, gGTGFakeCeilingDL }; -void BgMenkuriNisekabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriNisekabe_Init(Actor* thisx, PlayState* play) { BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx; Actor_SetScale(&this->actor, 0.1f); } -void BgMenkuriNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriNisekabe_Destroy(Actor* thisx, PlayState* play) { } -void BgMenkuriNisekabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriNisekabe_Update(Actor* thisx, PlayState* play) { BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx; - if (globalCtx->actorCtx.lensActive) { + if (play->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_7; } else { this->actor.flags &= ~ACTOR_FLAG_7; } } -void BgMenkuriNisekabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMenkuriNisekabe_Draw(Actor* thisx, PlayState* play) { BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx; u32 index = this->actor.params & 0xFF; if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { - Gfx_DrawDListXlu(globalCtx, sDLists[index]); + Gfx_DrawDListXlu(play, sDLists[index]); } else { - Gfx_DrawDListOpa(globalCtx, sDLists[index]); + Gfx_DrawDListOpa(play, sDLists[index]); } } diff --git a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c index 8909ec8cc6..eb058bddc5 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c @@ -10,14 +10,14 @@ #define FLAGS ACTOR_FLAG_4 -void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMizuBwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMizuBwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMizuBwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMizuBwall_Init(Actor* thisx, PlayState* play); +void BgMizuBwall_Destroy(Actor* thisx, PlayState* play); +void BgMizuBwall_Update(Actor* thisx, PlayState* play); +void BgMizuBwall_Draw(Actor* thisx, PlayState* play); -void BgMizuBwall_Idle(BgMizuBwall* this, GlobalContext* globalCtx); -void BgMizuBwall_Break(BgMizuBwall* this, GlobalContext* globalCtx); -void BgMizuBwall_DoNothing(BgMizuBwall* this, GlobalContext* globalCtx); +void BgMizuBwall_Idle(BgMizuBwall* this, PlayState* play); +void BgMizuBwall_Break(BgMizuBwall* this, PlayState* play); +void BgMizuBwall_DoNothing(BgMizuBwall* this, PlayState* play); const ActorInit Bg_Mizu_Bwall_InitVars = { ACTOR_BG_MIZU_BWALL, @@ -169,7 +169,7 @@ void BgMizuBwall_RotateVec3f(Vec3f* out, Vec3f* in, f32 sin, f32 cos) { out->z = (in->z * cos) - (in->x * sin); } -void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuBwall_Init(Actor* thisx, PlayState* play) { s32 pad; BgMizuBwall* this = (BgMizuBwall*)thisx; CollisionHeader* colHeader = NULL; @@ -179,17 +179,17 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { this->dList = sDLists[(u16)this->dyna.actor.params & 0xF]; DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(sColHeaders[(u16)this->dyna.actor.params & 0xF], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); switch ((u16)this->dyna.actor.params & 0xF) { case MIZUBWALL_FLOOR: - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; } else { - Collider_InitTris(globalCtx, &this->collider); - if (!Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInitFloor, this->elements)) { + Collider_InitTris(play, &this->collider); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitFloor, this->elements)) { osSyncPrintf("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 484, this->dyna.actor.params); Actor_Kill(&this->dyna.actor); @@ -218,14 +218,13 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { } break; case MIZUBWALL_RUTO_ROOM: - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; } else { - Collider_InitTris(globalCtx, &this->collider); - if (!Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInitRutoWall, - this->elements)) { + Collider_InitTris(play, &this->collider); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitRutoWall, this->elements)) { osSyncPrintf("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 558, this->dyna.actor.params); Actor_Kill(&this->dyna.actor); @@ -254,14 +253,13 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { } break; case MIZUBWALL_UNUSED: - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; } else { - Collider_InitTris(globalCtx, &this->collider); - if (!Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInitUnusedWall, - this->elements)) { + Collider_InitTris(play, &this->collider); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitUnusedWall, this->elements)) { osSyncPrintf("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 638, this->dyna.actor.params); Actor_Kill(&this->dyna.actor); @@ -292,13 +290,13 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { } break; case MIZUBWALL_STINGER_ROOM_1: - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; } else { - Collider_InitTris(globalCtx, &this->collider); - if (!Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, + Collider_InitTris(play, &this->collider); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, this->elements)) { osSyncPrintf("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 724, this->dyna.actor.params); @@ -330,13 +328,13 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { } break; case MIZUBWALL_STINGER_ROOM_2: - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; this->actionFunc = BgMizuBwall_DoNothing; } else { - Collider_InitTris(globalCtx, &this->collider); - if (!Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, + Collider_InitTris(play, &this->collider); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, this->elements)) { osSyncPrintf("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 798, this->dyna.actor.params); @@ -370,18 +368,18 @@ void BgMizuBwall_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMizuBwall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuBwall_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMizuBwall* this = (BgMizuBwall*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyTris(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyTris(play, &this->collider); } -void BgMizuBwall_SetAlpha(BgMizuBwall* this, GlobalContext* globalCtx) { - f32 waterLevel = globalCtx->colCtx.colHeader->waterBoxes[2].ySurface; +void BgMizuBwall_SetAlpha(BgMizuBwall* this, PlayState* play) { + f32 waterLevel = play->colCtx.colHeader->waterBoxes[2].ySurface; - if (globalCtx->colCtx.colHeader->waterBoxes) {} + if (play->colCtx.colHeader->waterBoxes) {} if (waterLevel < WATER_TEMPLE_WATER_F1_Y) { this->scrollAlpha1 = 255; @@ -413,7 +411,7 @@ void BgMizuBwall_SetAlpha(BgMizuBwall* this, GlobalContext* globalCtx) { this->scrollAlpha4 = this->scrollAlpha3; } -void BgMizuBwall_SpawnDebris(BgMizuBwall* this, GlobalContext* globalCtx) { +void BgMizuBwall_SpawnDebris(BgMizuBwall* this, PlayState* play) { s32 i; s32 pad; s16 rand1; @@ -458,31 +456,30 @@ void BgMizuBwall_SpawnDebris(BgMizuBwall* this, GlobalContext* globalCtx) { rand1 = (s16)(Rand_ZeroOne() * 120.0f) + 20; rand2 = (s16)(Rand_ZeroOne() * 240.0f) + 20; - func_80033480(globalCtx, &debrisPos, 50.0f, 2, rand1, rand2, 0); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_A_OBJ, debrisPos.x, debrisPos.y, debrisPos.z, 0, 0, 0, - 0xB); + func_80033480(play, &debrisPos, 50.0f, 2, rand1, rand2, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_A_OBJ, debrisPos.x, debrisPos.y, debrisPos.z, 0, 0, 0, 0xB); } } -void BgMizuBwall_Idle(BgMizuBwall* this, GlobalContext* globalCtx) { - BgMizuBwall_SetAlpha(this, globalCtx); +void BgMizuBwall_Idle(BgMizuBwall* this, PlayState* play) { + BgMizuBwall_SetAlpha(this, play); if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - Flags_SetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F); this->breakTimer = 1; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; - BgMizuBwall_SpawnDebris(this, globalCtx); + BgMizuBwall_SpawnDebris(this, play); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->actionFunc = BgMizuBwall_Break; } else if (this->dyna.actor.xzDistToPlayer < 600.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgMizuBwall_Break(BgMizuBwall* this, GlobalContext* globalCtx) { +void BgMizuBwall_Break(BgMizuBwall* this, PlayState* play) { if (this->breakTimer > 0) { this->breakTimer--; } else { @@ -490,42 +487,42 @@ void BgMizuBwall_Break(BgMizuBwall* this, GlobalContext* globalCtx) { } } -void BgMizuBwall_DoNothing(BgMizuBwall* this, GlobalContext* globalCtx) { +void BgMizuBwall_DoNothing(BgMizuBwall* this, PlayState* play) { } -void BgMizuBwall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuBwall_Update(Actor* thisx, PlayState* play) { s32 pad; BgMizuBwall* this = (BgMizuBwall*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMizuBwall_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void BgMizuBwall_Draw(Actor* thisx, PlayState* play2) { BgMizuBwall* this = (BgMizuBwall*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_bwall.c", 1095); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mizu_bwall.c", 1095); if (1) {} - frames = globalCtx->gameplayFrames; + frames = play->gameplayFrames; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, - 0, 0, this->scrollAlpha1)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, 0, 0, + this->scrollAlpha1)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, - 0, 0, this->scrollAlpha2)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, 0, 0, + this->scrollAlpha2)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, - 0, 0, this->scrollAlpha3)); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, 1 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, 0, 0, + this->scrollAlpha3)); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, 3 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, - 0, 0, this->scrollAlpha4)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mizu_bwall.c", 1129), 2); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, 3 * frames, 0, 0x20, 0x20, 1, 0, 0, 0x20, 0x20, 0, 0, 0, + this->scrollAlpha4)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mizu_bwall.c", 1129), 2); if (this->dList != NULL) { gSPDisplayList(POLY_OPA_DISP++, this->dList); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_bwall.c", 1136); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mizu_bwall.c", 1136); } diff --git a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h index b4172f8d57..37c0fe2b3b 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h +++ b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h @@ -6,7 +6,7 @@ struct BgMizuBwall; -typedef void (*BgMizuBwallActionFunc)(struct BgMizuBwall*, GlobalContext*); +typedef void (*BgMizuBwallActionFunc)(struct BgMizuBwall*, PlayState*); typedef struct BgMizuBwall { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c index 2cfe883d9d..78dba847a2 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c @@ -16,13 +16,13 @@ #define MOVEBG_POINT_ID(params) ((u16)(params)&0xF) #define MOVEBG_SPEED(params) (((u16)(params) >> 0x4) & 0xF) -void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMizuMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMizuMovebg_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMizuMovebg_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMizuMovebg_Init(Actor* thisx, PlayState* play); +void BgMizuMovebg_Destroy(Actor* thisx, PlayState* play); +void BgMizuMovebg_Update(Actor* thisx, PlayState* play); +void BgMizuMovebg_Draw(Actor* thisx, PlayState* play); -void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx); -void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx); +void func_8089E318(BgMizuMovebg* this, PlayState* play); +void func_8089E650(BgMizuMovebg* this, PlayState* play); s32 func_8089E108(Path* pathList, Vec3f* pos, s32 pathId, s32 pointId); const ActorInit Bg_Mizu_Movebg_InitVars = { @@ -63,14 +63,14 @@ static Vec3f D_8089EBAC = { 0.0f, 80.0f, 23.0f }; static u8 D_8089EE40; -s32 func_8089DC30(GlobalContext* globalCtx) { +s32 func_8089DC30(PlayState* play) { s32 result; - if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG)) { + if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG)) { result = 1; - } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG)) { + } else if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG)) { result = 2; - } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG)) { + } else if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG)) { result = 3; } else { result = 1; @@ -78,10 +78,10 @@ s32 func_8089DC30(GlobalContext* globalCtx) { return result; } -void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuMovebg_Init(Actor* thisx, PlayState* play) { s32 type; s32 waypointId; - WaterBox* waterBoxes = globalCtx->colCtx.colHeader->waterBoxes; + WaterBox* waterBoxes = play->colCtx.colHeader->waterBoxes; f32 temp; CollisionHeader* colHeader = NULL; Vec3f sp48; @@ -91,7 +91,7 @@ void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { ((BgMizuMovebg*)thisx)->dlist = D_8089EB50[MOVEBG_TYPE(thisx->params)]; DynaPolyActor_Init(&((BgMizuMovebg*)thisx)->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(D_8089EB70[MOVEBG_TYPE(thisx->params)], &colHeader); - ((BgMizuMovebg*)thisx)->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + ((BgMizuMovebg*)thisx)->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); type = MOVEBG_TYPE(thisx->params); switch (type) { @@ -123,13 +123,13 @@ void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { ((BgMizuMovebg*)thisx)->actionFunc = func_8089E318; break; case 3: - thisx->world.pos.y = ((BgMizuMovebg*)thisx)->homeY + D_8089EB40[func_8089DC30(globalCtx)]; + thisx->world.pos.y = ((BgMizuMovebg*)thisx)->homeY + D_8089EB40[func_8089DC30(play)]; ((BgMizuMovebg*)thisx)->actionFunc = func_8089E318; break; case 4: case 5: case 6: - if (Flags_GetSwitch(globalCtx, MOVEBG_FLAGS(thisx->params))) { + if (Flags_GetSwitch(play, MOVEBG_FLAGS(thisx->params))) { thisx->world.pos.y = ((BgMizuMovebg*)thisx)->homeY + 115.19999999999999; } else { thisx->world.pos.y = ((BgMizuMovebg*)thisx)->homeY; @@ -143,7 +143,7 @@ void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { ((BgMizuMovebg*)thisx)->scrollAlpha4 = 160; waypointId = MOVEBG_POINT_ID(thisx->params); ((BgMizuMovebg*)thisx)->waypointId = waypointId; - func_8089E108(globalCtx->setupPathList, &thisx->world.pos, MOVEBG_PATH_ID(thisx->params), waypointId); + func_8089E108(play->setupPathList, &thisx->world.pos, MOVEBG_PATH_ID(thisx->params), waypointId); ((BgMizuMovebg*)thisx)->actionFunc = func_8089E650; break; } @@ -157,20 +157,19 @@ void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(BINANG_TO_RAD(thisx->world.rot.y), MTXMODE_NEW); Matrix_MultVec3f(&D_8089EBA0, &sp48); - if (Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_OBJ_HSBLOCK, - thisx->world.pos.x + sp48.x, thisx->world.pos.y + sp48.y, - thisx->world.pos.z + sp48.z, thisx->world.rot.x, thisx->world.rot.y, - thisx->world.rot.z, 2) == NULL) { + if (Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_OBJ_HSBLOCK, thisx->world.pos.x + sp48.x, + thisx->world.pos.y + sp48.y, thisx->world.pos.z + sp48.z, thisx->world.rot.x, + thisx->world.rot.y, thisx->world.rot.z, 2) == NULL) { Actor_Kill(thisx); } break; } } -void BgMizuMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuMovebg_Destroy(Actor* thisx, PlayState* play) { BgMizuMovebg* this = (BgMizuMovebg*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); switch (MOVEBG_TYPE(thisx->params)) { case 3: case 4: @@ -202,8 +201,8 @@ s32 func_8089E108(Path* pathList, Vec3f* pos, s32 pathId, s32 pointId) { return 0; } -void func_8089E198(BgMizuMovebg* this, GlobalContext* globalCtx) { - f32 waterLevel = globalCtx->colCtx.colHeader->waterBoxes[2].ySurface; +void func_8089E198(BgMizuMovebg* this, PlayState* play) { + f32 waterLevel = play->colCtx.colHeader->waterBoxes[2].ySurface; if (waterLevel < WATER_TEMPLE_WATER_F1_Y) { this->scrollAlpha1 = 255; @@ -235,13 +234,13 @@ void func_8089E198(BgMizuMovebg* this, GlobalContext* globalCtx) { this->scrollAlpha4 = this->scrollAlpha3; } -void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx) { - WaterBox* waterBoxes = globalCtx->colCtx.colHeader->waterBoxes; +void func_8089E318(BgMizuMovebg* this, PlayState* play) { + WaterBox* waterBoxes = play->colCtx.colHeader->waterBoxes; f32 phi_f0; s32 type; Vec3f sp28; - func_8089E198(this, globalCtx); + func_8089E198(this, play); type = MOVEBG_TYPE(this->dyna.actor.params); switch (type) { @@ -263,7 +262,7 @@ void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx) { } break; case 3: - phi_f0 = this->homeY + D_8089EB40[func_8089DC30(globalCtx)]; + phi_f0 = this->homeY + D_8089EB40[func_8089DC30(play)]; if (!Math_StepToF(&this->dyna.actor.world.pos.y, phi_f0, 1.0f)) { if (!(D_8089EE40 & 2) && MOVEBG_SPEED(this->dyna.actor.params) != 0) { D_8089EE40 |= 2; @@ -281,7 +280,7 @@ void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx) { case 4: case 5: case 6: - if (Flags_GetSwitch(globalCtx, MOVEBG_FLAGS(this->dyna.actor.params))) { + if (Flags_GetSwitch(play, MOVEBG_FLAGS(this->dyna.actor.params))) { phi_f0 = this->homeY + 115.200005f; } else { phi_f0 = this->homeY; @@ -304,7 +303,7 @@ void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx) { case 4: case 5: case 6: - if (globalCtx->roomCtx.curRoom.num == this->dyna.actor.room) { + if (play->roomCtx.curRoom.num == this->dyna.actor.room) { Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.world.rot.y), MTXMODE_NEW); Matrix_MultVec3f(&D_8089EBAC, &sp28); this->dyna.actor.child->world.pos.x = this->dyna.actor.world.pos.x + sp28.x; @@ -316,7 +315,7 @@ void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx) { } } -void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx) { +void func_8089E650(BgMizuMovebg* this, PlayState* play) { Vec3f waypoint; f32 dist; f32 dx; @@ -324,7 +323,7 @@ void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx) { f32 dz; this->dyna.actor.speedXZ = MOVEBG_SPEED(this->dyna.actor.params) * 0.1f; - func_8089E108(globalCtx->setupPathList, &waypoint, MOVEBG_PATH_ID(this->dyna.actor.params), this->waypointId); + func_8089E108(play->setupPathList, &waypoint, MOVEBG_PATH_ID(this->dyna.actor.params), this->waypointId); dist = Actor_WorldDistXYZToPoint(&this->dyna.actor, &waypoint); if (dist < this->dyna.actor.speedXZ) { this->dyna.actor.speedXZ = dist; @@ -336,10 +335,9 @@ void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx) { dz = waypoint.z - this->dyna.actor.world.pos.z; if (fabsf(dx) < 2.0f && fabsf(dy) < 2.0f && fabsf(dz) < 2.0f) { this->waypointId++; - if (this->waypointId >= globalCtx->setupPathList[MOVEBG_PATH_ID(this->dyna.actor.params)].count) { + if (this->waypointId >= play->setupPathList[MOVEBG_PATH_ID(this->dyna.actor.params)].count) { this->waypointId = 0; - func_8089E108(globalCtx->setupPathList, &this->dyna.actor.world.pos, - MOVEBG_PATH_ID(this->dyna.actor.params), 0); + func_8089E108(play->setupPathList, &this->dyna.actor.world.pos, MOVEBG_PATH_ID(this->dyna.actor.params), 0); } } if (!(D_8089EE40 & 1) && MOVEBG_SPEED(this->dyna.actor.params) != 0) { @@ -351,46 +349,46 @@ void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx) { } } -void BgMizuMovebg_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuMovebg_Update(Actor* thisx, PlayState* play) { BgMizuMovebg* this = (BgMizuMovebg*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMizuMovebg_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void BgMizuMovebg_Draw(Actor* thisx, PlayState* play2) { BgMizuMovebg* this = (BgMizuMovebg*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; u32 frames; if (1) {} - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_movebg.c", 754); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mizu_movebg.c", 754); - frames = globalCtx->gameplayFrames; - func_80093D18(globalCtx->state.gfxCtx); + frames = play->gameplayFrames; + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, this->scrollAlpha1)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, this->scrollAlpha2)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, this->scrollAlpha3)); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, frames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, this->scrollAlpha4)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mizu_movebg.c", 788), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mizu_movebg.c", 788), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->dlist != NULL) { gSPDisplayList(POLY_OPA_DISP++, this->dlist); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_movebg.c", 795); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mizu_movebg.c", 795); } diff --git a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h index bf17eeac26..8b5218e4be 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h +++ b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h @@ -6,7 +6,7 @@ struct BgMizuMovebg; -typedef void (*BgMizuMovebgActionFunc)(struct BgMizuMovebg*, GlobalContext*); +typedef void (*BgMizuMovebgActionFunc)(struct BgMizuMovebg*, PlayState*); typedef struct BgMizuMovebg { /* 0x0000 */ DynaPolyActor dyna; 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 c8c5720fd6..1792b4e5ef 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 @@ -6,15 +6,15 @@ #define SIZE_PARAM (((u16)this->dyna.actor.params >> 0xC) & 0xF) #define TIMER_PARAM (((u16)this->dyna.actor.params >> 6) & 0x3F) -void BgMizuShutter_Init(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_Destroy(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_Update(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_Draw(BgMizuShutter* this, GlobalContext* globalCtx); +void BgMizuShutter_Init(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_Destroy(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_Update(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_Draw(BgMizuShutter* this, PlayState* play); -void BgMizuShutter_WaitForTimer(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_Move(BgMizuShutter* this, GlobalContext* globalCtx); -void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, GlobalContext* globalCtx); +void BgMizuShutter_WaitForTimer(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_Move(BgMizuShutter* this, PlayState* play); +void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, PlayState* play); const ActorInit Bg_Mizu_Shutter_InitVars = { ACTOR_BG_MIZU_SHUTTER, @@ -47,7 +47,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgMizuShutter_Init(BgMizuShutter* thisx, GlobalContext* globalCtx) { +void BgMizuShutter_Init(BgMizuShutter* thisx, PlayState* play) { s32 pad; BgMizuShutter* this = (BgMizuShutter*)thisx; s32 pad2; @@ -58,7 +58,7 @@ void BgMizuShutter_Init(BgMizuShutter* thisx, GlobalContext* globalCtx) { this->displayList = sDisplayLists[SIZE_PARAM]; DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(sCollisionHeaders[SIZE_PARAM], &sp30); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, 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; @@ -71,10 +71,10 @@ void BgMizuShutter_Init(BgMizuShutter* thisx, GlobalContext* globalCtx) { 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(globalCtx, (u16)this->dyna.actor.params & 0x3F); + Flags_UnsetSwitch(play, (u16)this->dyna.actor.params & 0x3F); this->dyna.actor.world.pos = this->closedPos; } - if (Flags_GetSwitch(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, (u16)this->dyna.actor.params & 0x3F)) { this->dyna.actor.world.pos = this->openPos; this->actionFunc = BgMizuShutter_WaitForTimer; } else { @@ -83,34 +83,34 @@ void BgMizuShutter_Init(BgMizuShutter* thisx, GlobalContext* globalCtx) { } } -void BgMizuShutter_Destroy(BgMizuShutter* thisx, GlobalContext* globalCtx) { +void BgMizuShutter_Destroy(BgMizuShutter* thisx, PlayState* play) { s32 pad; BgMizuShutter* this = (BgMizuShutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { +void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, PlayState* play) { + if (Flags_GetSwitch(play, (u16)this->dyna.actor.params & 0x3F)) { if (ABS(this->dyna.actor.world.rot.x) > 0x2C60) { - OnePointCutscene_Init(globalCtx, 4510, -99, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4510, -99, &this->dyna.actor, CAM_ID_MAIN); } else { - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); } this->actionFunc = BgMizuShutter_WaitForCutscene; this->timer = 30; } } -void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, GlobalContext* globalCtx) { +void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, PlayState* play) { if (this->timer-- == 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_OPEN); this->actionFunc = BgMizuShutter_Move; } } -void BgMizuShutter_Move(BgMizuShutter* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { +void BgMizuShutter_Move(BgMizuShutter* this, PlayState* play) { + if (Flags_GetSwitch(play, (u16)this->dyna.actor.params & 0x3F)) { 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); @@ -134,36 +134,36 @@ void BgMizuShutter_Move(BgMizuShutter* this, GlobalContext* globalCtx) { } } -void BgMizuShutter_WaitForTimer(BgMizuShutter* this, GlobalContext* globalCtx) { +void BgMizuShutter_WaitForTimer(BgMizuShutter* this, PlayState* play) { if (this->timerMax != 0x3F * 20) { this->timer--; func_8002F994(&this->dyna.actor, this->timer); if (this->timer == 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_CLOSE); - Flags_UnsetSwitch(globalCtx, (u16)this->dyna.actor.params & 0x3F); + Flags_UnsetSwitch(play, (u16)this->dyna.actor.params & 0x3F); this->actionFunc = BgMizuShutter_Move; } } } -void BgMizuShutter_Update(BgMizuShutter* thisx, GlobalContext* globalCtx) { +void BgMizuShutter_Update(BgMizuShutter* thisx, PlayState* play) { s32 pad; BgMizuShutter* this = (BgMizuShutter*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMizuShutter_Draw(BgMizuShutter* thisx, GlobalContext* globalCtx) { +void BgMizuShutter_Draw(BgMizuShutter* thisx, PlayState* play) { s32 pad; BgMizuShutter* this = (BgMizuShutter*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_shutter.c", 410); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mizu_shutter.c", 415), + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mizu_shutter.c", 410); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mizu_shutter.c", 415), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->displayList != NULL) { gSPDisplayList(POLY_OPA_DISP++, this->displayList); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_shutter.c", 422); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mizu_shutter.c", 422); } 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 1889da3006..af4d34035e 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 @@ -8,7 +8,7 @@ struct BgMizuShutter; -typedef void (*BgMizuShutterActionFunc)(struct BgMizuShutter*, GlobalContext*); +typedef void (*BgMizuShutterActionFunc)(struct BgMizuShutter*, PlayState*); typedef struct BgMizuShutter { /* 0x0000 */ DynaPolyActor dyna; 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 698eb5d600..9d405c6899 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 @@ -9,12 +9,12 @@ #define FLAGS 0 -void BgMizuUzu_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMizuUzu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMizuUzu_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMizuUzu_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMizuUzu_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); +void func_8089F788(BgMizuUzu* this, PlayState* play); const ActorInit Bg_Mizu_Uzu_InitVars = { ACTOR_BG_MIZU_UZU, @@ -34,7 +34,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgMizuUzu_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuUzu_Init(Actor* thisx, PlayState* play) { s32 pad; BgMizuUzu* this = (BgMizuUzu*)thisx; CollisionHeader* colHeader = NULL; @@ -43,33 +43,33 @@ void BgMizuUzu_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gObjectMizuObjectsUzuCol_0074EC, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->actionFunc = func_8089F788; } -void BgMizuUzu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuUzu_Destroy(Actor* thisx, PlayState* play) { BgMizuUzu* this = (BgMizuUzu*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx) { +void func_8089F788(BgMizuUzu* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - if (GET_PLAYER(globalCtx)->currentBoots == PLAYER_BOOTS_IRON) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (GET_PLAYER(play)->currentBoots == PLAYER_BOOTS_IRON) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } Audio_PlayActorSound2(thisx, NA_SE_EV_WATER_CONVECTION - SFX_FLAG); thisx->shape.rot.y += 0x1C0; } -void BgMizuUzu_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuUzu_Update(Actor* thisx, PlayState* play) { BgMizuUzu* this = (BgMizuUzu*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMizuUzu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuUzu_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h index 528a9386be..94e6b3c9d1 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h +++ b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h @@ -6,7 +6,7 @@ struct BgMizuUzu; -typedef void (*BgMizuUzuActionFunc)(struct BgMizuUzu*, GlobalContext*); +typedef void (*BgMizuUzuActionFunc)(struct BgMizuUzu*, PlayState*); typedef struct BgMizuUzu { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c index 05f6b82334..783dd2e5cc 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c @@ -9,13 +9,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMizuWater_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMizuWater_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMizuWater_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMizuWater_Init(Actor* thisx, PlayState* play); +void BgMizuWater_Destroy(Actor* thisx, PlayState* play); +void BgMizuWater_Update(Actor* thisx, PlayState* play); +void BgMizuWater_Draw(Actor* thisx, PlayState* play); -void BgMizuWater_WaitForAction(BgMizuWater* this, GlobalContext* globalCtx); -void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx); +void BgMizuWater_WaitForAction(BgMizuWater* this, PlayState* play); +void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, PlayState* play); typedef struct { s32 switchFlag; @@ -50,28 +50,28 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F(scale, 1, ICHAIN_STOP), }; -u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, GlobalContext* globalCtx) { +u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, PlayState* play) { u32 ret; if (bREG(0) != 0) { switch (bREG(1)) { case 0: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG); break; case 1: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG); break; case 2: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG); break; } bREG(0) = 0; } - if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F1_FLAG)) { + if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F1_FLAG)) { ret = 3; - } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F2_FLAG)) { + } else if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F2_FLAG)) { ret = 2; - } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F3_FLAG)) { + } else if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F3_FLAG)) { ret = 1; } else { ret = 0; @@ -88,13 +88,13 @@ void BgMizuWater_SetWaterBoxesHeight(WaterBox* waterBoxes, s16 height) { } } -void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuWater_Init(Actor* thisx, PlayState* play) { BgMizuWater* this = (BgMizuWater*)thisx; f32 initialActorY; WaterBox* waterBoxes; s32 waterLevelActionIndex; - waterBoxes = globalCtx->colCtx.colHeader->waterBoxes; + waterBoxes = play->colCtx.colHeader->waterBoxes; this->type = this->actor.params & 0xFF; this->switchFlag = (this->actor.params >> 8) & 0xFF; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -105,28 +105,28 @@ void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->type) { case 0: if (bREG(15) == 0) { - osSyncPrintf("<コンストラクト>%x %x %x\n", Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG), - Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG), - Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG)); + osSyncPrintf("<コンストラクト>%x %x %x\n", Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG), + Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG), + Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG)); } - waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(-1, globalCtx); + waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(-1, play); this->actor.world.pos.y = sWaterLevels[waterLevelActionIndex].yDiff + this->baseY; BgMizuWater_SetWaterBoxesHeight(waterBoxes, this->actor.world.pos.y); this->actor.params = sWaterLevels[waterLevelActionIndex].switchFlag; - Flags_UnsetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG); - Flags_UnsetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG); - Flags_UnsetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG); + Flags_UnsetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG); + Flags_UnsetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG); + Flags_UnsetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG); switch (this->actor.params) { case 0x1E: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG); break; case 0x1D: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG); break; case 0x1C: default: - Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG); + Flags_SetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG); break; } this->targetY = this->actor.world.pos.y; @@ -134,13 +134,13 @@ void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx) { case 1: break; case 2: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actor.world.pos.y = this->baseY + 85.0f; } waterBoxes[6].ySurface = this->actor.world.pos.y; break; case 3: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actor.world.pos.y = this->baseY + 110.0f; if (1) {} this->targetY = this->actor.world.pos.y; @@ -148,7 +148,7 @@ void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx) { waterBoxes[8].ySurface = this->actor.world.pos.y; break; case 4: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actor.world.pos.y = this->baseY + 160.0f; if (1) {} this->targetY = this->actor.world.pos.y; @@ -160,10 +160,10 @@ void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgMizuWater_WaitForAction; } -void BgMizuWater_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuWater_Destroy(Actor* thisx, PlayState* play) { } -void BgMizuWater_WaitForAction(BgMizuWater* this, GlobalContext* globalCtx) { +void BgMizuWater_WaitForAction(BgMizuWater* this, PlayState* play) { s32 pad; s32 waterLevelActionIndex; s16 prevSwitchFlag; @@ -171,36 +171,36 @@ void BgMizuWater_WaitForAction(BgMizuWater* this, GlobalContext* globalCtx) { switch (this->type) { case 0: prevSwitchFlag = this->actor.params; - waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(this->actor.params, globalCtx); + waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(this->actor.params, play); if (waterLevelActionIndex != 0) { if (prevSwitchFlag != sWaterLevels[waterLevelActionIndex].switchFlag) { - OnePointCutscene_Init(globalCtx, 3120, -100 - waterLevelActionIndex, NULL, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3120, -100 - waterLevelActionIndex, NULL, CAM_ID_MAIN); this->actor.params = sWaterLevels[waterLevelActionIndex].switchFlag; this->targetY = sWaterLevels[waterLevelActionIndex].yDiff + this->baseY; } } if ((prevSwitchFlag != this->actor.params) && (prevSwitchFlag != 0)) { - Flags_UnsetSwitch(globalCtx, prevSwitchFlag); + Flags_UnsetSwitch(play, prevSwitchFlag); } break; case 1: break; case 2: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 85.0f; } else { this->targetY = this->baseY; } break; case 3: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 110.0f; } else { this->targetY = this->baseY; } break; case 4: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 160.0f; } else { this->targetY = this->baseY; @@ -212,17 +212,17 @@ void BgMizuWater_WaitForAction(BgMizuWater* this, GlobalContext* globalCtx) { } } -void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx) { +void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, PlayState* play) { s32 pad; s16 prevSwitchFlag; s32 waterLevelActionIndex; WaterBox* waterBoxes; - waterBoxes = globalCtx->colCtx.colHeader->waterBoxes; + waterBoxes = play->colCtx.colHeader->waterBoxes; switch (this->type) { case 0: prevSwitchFlag = this->actor.params; - waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(this->actor.params, globalCtx); + waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(this->actor.params, play); if (waterLevelActionIndex != 0) { if (prevSwitchFlag != sWaterLevels[waterLevelActionIndex].switchFlag) { this->actor.params = sWaterLevels[waterLevelActionIndex].switchFlag; @@ -231,50 +231,50 @@ void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx) { } if ((prevSwitchFlag != this->actor.params) && (prevSwitchFlag != 0)) { - Flags_UnsetSwitch(globalCtx, prevSwitchFlag); + Flags_UnsetSwitch(play, prevSwitchFlag); } if (Math_StepToF(&this->actor.world.pos.y, this->targetY, 5.0f)) { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; this->actionFunc = BgMizuWater_WaitForAction; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } - BgMizuWater_SetWaterBoxesHeight(globalCtx->colCtx.colHeader->waterBoxes, this->actor.world.pos.y); + BgMizuWater_SetWaterBoxesHeight(play->colCtx.colHeader->waterBoxes, this->actor.world.pos.y); break; case 1: break; case 2: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 85.0f; } else { this->targetY = this->baseY; } if (Math_StepToF(&this->actor.world.pos.y, this->targetY, 1.0f)) { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; this->actionFunc = BgMizuWater_WaitForAction; } waterBoxes[6].ySurface = this->actor.world.pos.y; break; case 3: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 110.0f; } else { this->targetY = this->baseY; } if (Math_StepToF(&this->actor.world.pos.y, this->targetY, 1.0f)) { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; this->actionFunc = BgMizuWater_WaitForAction; } waterBoxes[8].ySurface = this->actor.world.pos.y; break; case 4: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->targetY = this->baseY + 160.0f; } else { this->targetY = this->baseY; } if (Math_StepToF(&this->actor.world.pos.y, this->targetY, 1.0f)) { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; this->actionFunc = BgMizuWater_WaitForAction; } waterBoxes[16].ySurface = this->actor.world.pos.y; @@ -290,7 +290,7 @@ void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx) { } } -void BgMizuWater_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuWater_Update(Actor* thisx, PlayState* play) { BgMizuWater* this = (BgMizuWater*)thisx; s32 posY; s32 unk0; @@ -298,9 +298,9 @@ void BgMizuWater_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; if (bREG(15) == 0) { - osSyncPrintf("%x %x %x\n", Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG), - Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG), - Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG)); + osSyncPrintf("%x %x %x\n", Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG), + Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG), + Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG)); } if (this->type == 0) { posY = this->actor.world.pos.y; @@ -318,25 +318,25 @@ void BgMizuWater_Update(Actor* thisx, GlobalContext* globalCtx) { unk1 = 255 - (s32)((posY - WATER_TEMPLE_WATER_F2_Y) / (WATER_TEMPLE_WATER_F3_Y - WATER_TEMPLE_WATER_F2_Y) * (255 - 160)); } - globalCtx->roomCtx.unk_74[1] = ((u8)unk0 << 8) | (unk1 & 0xFF); + play->roomCtx.unk_74[1] = ((u8)unk0 << 8) | (unk1 & 0xFF); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMizuWater_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMizuWater_Draw(Actor* thisx, PlayState* play) { BgMizuWater* this = (BgMizuWater*)thisx; s32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_water.c", 738); - gameplayFrames = globalCtx->gameplayFrames; - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mizu_water.c", 738); + gameplayFrames = play->gameplayFrames; + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x0C, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -gameplayFrames * 1, gameplayFrames * 1, 32, 32, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -gameplayFrames * 1, gameplayFrames * 1, 32, 32, 1, 0, -gameplayFrames * 1, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mizu_water.c", 749), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mizu_water.c", 749), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); @@ -345,5 +345,5 @@ void BgMizuWater_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gObjectMizuObjectsWaterDL_004B20); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_water.c", 756); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mizu_water.c", 756); } diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h index cb9d96bca6..21196022f8 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h +++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h @@ -6,7 +6,7 @@ struct BgMizuWater; -typedef void (*BgMizuWaterActionFunc)(struct BgMizuWater*, GlobalContext*); +typedef void (*BgMizuWaterActionFunc)(struct BgMizuWater*, PlayState*); typedef struct BgMizuWater { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c index 04d45c3129..d31d35a96b 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c @@ -16,13 +16,13 @@ #define FLAGS ACTOR_FLAG_4 -void BgMjin_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMjin_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMjin_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMjin_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMjin_Init(Actor* thisx, PlayState* play); +void BgMjin_Destroy(Actor* thisx, PlayState* play); +void BgMjin_Update(Actor* thisx, PlayState* play); +void BgMjin_Draw(Actor* thisx, PlayState* play); -void func_808A0850(BgMjin* this, GlobalContext* globalCtx); -void BgMjin_DoNothing(BgMjin* this, GlobalContext* globalCtx); +void func_808A0850(BgMjin* this, PlayState* play); +void BgMjin_DoNothing(BgMjin* this, PlayState* play); const ActorInit Bg_Mjin_InitVars = { ACTOR_BG_MJIN, @@ -52,12 +52,12 @@ void BgMjin_SetupAction(BgMjin* this, BgMjinActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgMjin_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMjin_Init(Actor* thisx, PlayState* play) { BgMjin* this = (BgMjin*)thisx; s8 objBankIndex; Actor_ProcessInitChain(thisx, sInitChain); - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, (thisx->params != 0 ? OBJECT_MJIN : OBJECT_MJIN_OKA)); + objBankIndex = Object_GetIndex(&play->objectCtx, (thisx->params != 0 ? OBJECT_MJIN : OBJECT_MJIN_OKA)); this->objBankIndex = objBankIndex; if (objBankIndex < 0) { Actor_Kill(thisx); @@ -66,50 +66,50 @@ void BgMjin_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMjin_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMjin_Destroy(Actor* thisx, PlayState* play) { BgMjin* this = (BgMjin*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808A0850(BgMjin* this, GlobalContext* globalCtx) { +void func_808A0850(BgMjin* this, PlayState* play) { CollisionHeader* colHeader; CollisionHeader* collision; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { colHeader = NULL; this->dyna.actor.flags &= ~ACTOR_FLAG_4; this->dyna.actor.objBankIndex = this->objBankIndex; - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); DynaPolyActor_Init(&this->dyna, 0); collision = this->dyna.actor.params != 0 ? &gWarpPadCol : &gOcarinaWarpPadCol; CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); BgMjin_SetupAction(this, BgMjin_DoNothing); this->dyna.actor.draw = BgMjin_Draw; } } -void BgMjin_DoNothing(BgMjin* this, GlobalContext* globalCtx) { +void BgMjin_DoNothing(BgMjin* this, PlayState* play) { } -void BgMjin_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMjin_Update(Actor* thisx, PlayState* play) { BgMjin* this = (BgMjin*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMjin_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMjin_Draw(Actor* thisx, PlayState* play) { BgMjin* this = (BgMjin*)thisx; Gfx* dlist; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mjin.c", 250); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mjin.c", 250); if (thisx->params != 0) { - s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIDs[thisx->params - 1]); + s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIDs[thisx->params - 1]); if (objBankIndex >= 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); } gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&D_06000000)); @@ -118,10 +118,10 @@ void BgMjin_Draw(Actor* thisx, GlobalContext* globalCtx) { dlist = gOcarinaWarpPadDL; } - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mjin.c", 285), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mjin.c", 285), G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dlist); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mjin.c", 288); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mjin.c", 288); } diff --git a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h index dd5964ed4f..415625574c 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h @@ -6,7 +6,7 @@ struct BgMjin; -typedef void (*BgMjinActionFunc)(struct BgMjin*, GlobalContext*); +typedef void (*BgMjinActionFunc)(struct BgMjin*, PlayState*); typedef struct BgMjin { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index 144aed1f69..147a25f6b0 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -9,23 +9,23 @@ #define FLAGS ACTOR_FLAG_4 -void BgMoriBigst_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriBigst_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriBigst_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriBigst_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriBigst_Init(Actor* thisx, PlayState* play); +void BgMoriBigst_Destroy(Actor* thisx, PlayState* play); +void BgMoriBigst_Update(Actor* thisx, PlayState* play); +void BgMoriBigst_Draw(Actor* thisx, PlayState* play); -void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupNoop(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_StalfosFight(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupFall(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_Fall(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupLanding(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_Landing(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx); -void BgMoriBigst_SetupDone(BgMoriBigst* this, GlobalContext* globalCtx); +void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupNoop(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_StalfosFight(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupFall(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_Fall(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupLanding(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_Landing(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, PlayState* play); +void BgMoriBigst_SetupDone(BgMoriBigst* this, PlayState* play); const ActorInit Bg_Mori_Bigst_InitVars = { ACTOR_BG_MORI_BIGST, @@ -49,14 +49,14 @@ void BgMoriBigst_SetupAction(BgMoriBigst* this, BgMoriBigstActionFunc actionFunc this->actionFunc = actionFunc; } -void BgMoriBigst_InitDynapoly(BgMoriBigst* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void BgMoriBigst_InitDynapoly(BgMoriBigst* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG login failed" @@ -65,18 +65,18 @@ void BgMoriBigst_InitDynapoly(BgMoriBigst* this, GlobalContext* globalCtx, Colli } } -void BgMoriBigst_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriBigst_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriBigst* this = (BgMoriBigst*)thisx; // "mori (bigST.keyceiling)" osSyncPrintf("mori (bigST.鍵型天井)(arg : %04x)(sw %d)(noE %d)(roomC %d)(playerPosY %f)\n", this->dyna.actor.params, - Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F), - Flags_GetTempClear(globalCtx, this->dyna.actor.room), Flags_GetClear(globalCtx, this->dyna.actor.room), - GET_PLAYER(globalCtx)->actor.world.pos.y); - BgMoriBigst_InitDynapoly(this, globalCtx, &gMoriBigstCol, DPM_UNK); + Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F), + Flags_GetTempClear(play, this->dyna.actor.room), Flags_GetClear(play, this->dyna.actor.room), + GET_PLAYER(play)->actor.world.pos.y); + BgMoriBigst_InitDynapoly(this, play, &gMoriBigstCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { // "【Big Stalfos key ceiling】 bank danger!" osSyncPrintf("【ビッグスタルフォス鍵型天井】 バンク危険!\n"); @@ -84,54 +84,54 @@ void BgMoriBigst_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->dyna.actor); return; } - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } else { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 270.0f; } Actor_SetFocus(&this->dyna.actor, 50.0f); - BgMoriBigst_SetupWaitForMoriTex(this, globalCtx); + BgMoriBigst_SetupWaitForMoriTex(this, play); } -void BgMoriBigst_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriBigst_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriBigst* this = (BgMoriBigst*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, PlayState* play) { BgMoriBigst_SetupAction(this, BgMoriBigst_WaitForMoriTex); } -void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { thisx->draw = BgMoriBigst_Draw; - if (Flags_GetClear(globalCtx, thisx->room) && (GET_PLAYER(globalCtx)->actor.world.pos.y > 700.0f)) { - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { - BgMoriBigst_SetupDone(this, globalCtx); + if (Flags_GetClear(play, thisx->room) && (GET_PLAYER(play)->actor.world.pos.y > 700.0f)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { + BgMoriBigst_SetupDone(this, play); } else { - BgMoriBigst_SetupStalfosFight(this, globalCtx); + BgMoriBigst_SetupStalfosFight(this, play); } } else { - BgMoriBigst_SetupNoop(this, globalCtx); + BgMoriBigst_SetupNoop(this, play); } } } -void BgMoriBigst_SetupNoop(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupNoop(BgMoriBigst* this, PlayState* play) { BgMoriBigst_SetupAction(this, NULL); } -void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, PlayState* play) { Actor* stalfos; BgMoriBigst_SetupAction(this, BgMoriBigst_StalfosFight); - Flags_UnsetClear(globalCtx, this->dyna.actor.room); - stalfos = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_TEST, 209.0f, 827.0f, - -3320.0f, 0, 0, 0, 1); + Flags_UnsetClear(play, this->dyna.actor.room); + stalfos = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_TEST, 209.0f, 827.0f, -3320.0f, 0, + 0, 0, 1); if (stalfos != NULL) { this->dyna.actor.child = NULL; this->dyna.actor.home.rot.z++; @@ -139,60 +139,60 @@ void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, GlobalContext* globalCtx) // "Second Stalfos failure" osSyncPrintf("Warning : 第2スタルフォス発生失敗\n"); } - Flags_SetClear(globalCtx, this->dyna.actor.room); + Flags_SetClear(play, this->dyna.actor.room); } -void BgMoriBigst_StalfosFight(BgMoriBigst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgMoriBigst_StalfosFight(BgMoriBigst* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->dyna.actor.home.rot.z == 0) && - ((this->dyna.actor.home.pos.y - 5.0f) <= GET_PLAYER(globalCtx)->actor.world.pos.y)) { - BgMoriBigst_SetupFall(this, globalCtx); - OnePointCutscene_Init(globalCtx, 3220, 72, &this->dyna.actor, CAM_ID_MAIN); + ((this->dyna.actor.home.pos.y - 5.0f) <= GET_PLAYER(play)->actor.world.pos.y)) { + BgMoriBigst_SetupFall(this, play); + OnePointCutscene_Init(play, 3220, 72, &this->dyna.actor, CAM_ID_MAIN); } } -void BgMoriBigst_SetupFall(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupFall(BgMoriBigst* this, PlayState* play) { BgMoriBigst_SetupAction(this, BgMoriBigst_Fall); } -void BgMoriBigst_Fall(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_Fall(BgMoriBigst* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; - BgMoriBigst_SetupLanding(this, globalCtx); + BgMoriBigst_SetupLanding(this, play); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - OnePointCutscene_Init(globalCtx, 1020, 8, &this->dyna.actor, CAM_ID_MAIN); - func_8002DF38(globalCtx, NULL, 0x3C); + OnePointCutscene_Init(play, 1020, 8, &this->dyna.actor, CAM_ID_MAIN); + func_8002DF38(play, NULL, 0x3C); } } -void BgMoriBigst_SetupLanding(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupLanding(BgMoriBigst* this, PlayState* play) { s32 pad; s32 quake; BgMoriBigst_SetupAction(this, BgMoriBigst_Landing); this->waitTimer = 18; - quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 25000); Quake_SetQuakeValues(quake, 5, 0, 0, 0); Quake_SetCountdown(quake, 16); } -void BgMoriBigst_Landing(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_Landing(BgMoriBigst* this, PlayState* play) { if (this->waitTimer <= 0) { - BgMoriBigst_SetupStalfosPairFight(this, globalCtx); + BgMoriBigst_SetupStalfosPairFight(this, play); } } -void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, PlayState* play) { Actor* stalfos1; Actor* stalfos2; BgMoriBigst_SetupAction(this, BgMoriBigst_StalfosPairFight); - Flags_UnsetClear(globalCtx, this->dyna.actor.room); - stalfos1 = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_TEST, 70.0f, 827.0f, - -3383.0f, 0, 0, 0, 5); + Flags_UnsetClear(play, this->dyna.actor.room); + stalfos1 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_TEST, 70.0f, 827.0f, -3383.0f, 0, + 0, 0, 5); if (stalfos1 != NULL) { this->dyna.actor.child = NULL; this->dyna.actor.home.rot.z++; @@ -200,8 +200,8 @@ void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, GlobalContext* globalC // "Warning: 3-1 Stalfos failure" osSyncPrintf("Warning : 第3-1スタルフォス発生失敗\n"); } - stalfos2 = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_TEST, 170.0f, 827.0f, - -3260.0f, 0, 0, 0, 5); + stalfos2 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_TEST, 170.0f, 827.0f, -3260.0f, 0, + 0, 0, 5); if (stalfos2 != NULL) { this->dyna.actor.child = NULL; this->dyna.actor.home.rot.z++; @@ -209,21 +209,21 @@ void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, GlobalContext* globalC // "Warning: 3-2 Stalfos failure" osSyncPrintf("Warning : 第3-2スタルフォス発生失敗\n"); } - Flags_SetClear(globalCtx, this->dyna.actor.room); + Flags_SetClear(play, this->dyna.actor.room); } -void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx) { - if ((this->dyna.actor.home.rot.z == 0) && !Player_InCsMode(globalCtx)) { - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); - BgMoriBigst_SetupDone(this, globalCtx); +void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, PlayState* play) { + if ((this->dyna.actor.home.rot.z == 0) && !Player_InCsMode(play)) { + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); + BgMoriBigst_SetupDone(this, play); } } -void BgMoriBigst_SetupDone(BgMoriBigst* this, GlobalContext* globalCtx) { +void BgMoriBigst_SetupDone(BgMoriBigst* this, PlayState* play) { BgMoriBigst_SetupAction(this, NULL); } -void BgMoriBigst_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriBigst_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriBigst* this = (BgMoriBigst*)thisx; @@ -232,25 +232,25 @@ void BgMoriBigst_Update(Actor* thisx, GlobalContext* globalCtx) { this->waitTimer--; } if (func_80043590(&this->dyna)) { - Environment_ChangeLightSetting(globalCtx, 6); + Environment_ChangeLightSetting(play, 6); } if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgMoriBigst_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriBigst_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriBigst* this = (BgMoriBigst*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_bigst.c", 541); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_bigst.c", 541); + func_80093D18(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_bigst.c", 548), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_bigst.c", 548), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMoriBigstDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_bigst.c", 553); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mori_bigst.c", 553); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h index 7f18e8b0c6..c2a97444e0 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h @@ -6,7 +6,7 @@ struct BgMoriBigst; -typedef void (*BgMoriBigstActionFunc)(struct BgMoriBigst*, GlobalContext*); +typedef void (*BgMoriBigstActionFunc)(struct BgMoriBigst*, PlayState*); typedef struct BgMoriBigst { /* 0x0000 */ DynaPolyActor dyna; 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 d58a015fb1..a4063a973e 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 @@ -3,19 +3,19 @@ #define FLAGS ACTOR_FLAG_4 -void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriElevator_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriElevator_Update(Actor* thisx, GlobalContext* globalCtx); +void BgMoriElevator_Init(Actor* thisx, PlayState* play); +void BgMoriElevator_Destroy(Actor* thisx, PlayState* play); +void BgMoriElevator_Update(Actor* thisx, PlayState* play); void BgMoriElevator_SetupWaitAfterInit(BgMoriElevator* this); -void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, GlobalContext* globalCtx); +void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, PlayState* play); void BgMoriElevator_SetupSetPosition(BgMoriElevator* this); -void BgMoriElevator_SetPosition(BgMoriElevator* this, GlobalContext* globalCtx); -void BgMoriElevator_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriElevator_SetPosition(BgMoriElevator* this, PlayState* play); +void BgMoriElevator_Draw(Actor* thisx, PlayState* play); void BgMoriElevator_StopMovement(BgMoriElevator* this); -void func_808A2008(BgMoriElevator* this, GlobalContext* globalCtx); -void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, GlobalContext* globalCtx); -void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, GlobalContext* globalCtx); +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; @@ -81,13 +81,13 @@ void func_808A18FC(BgMoriElevator* this, f32 distTo) { func_800F436C(&this->dyna.actor.projectedPos, NA_SE_EV_ELEVATOR_MOVE2 - SFX_FLAG, CLAMP(temp, 0.0f, 1.0f)); } -void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriElevator_Init(Actor* thisx, PlayState* play) { BgMoriElevator* this = (BgMoriElevator*)thisx; s32 pad; CollisionHeader* colHeader = NULL; this->unk_172 = sIsSpawned; - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { Actor_Kill(thisx); // "Forest Temple obj elevator Bank Danger!" @@ -102,7 +102,7 @@ void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gMoriElevatorCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); BgMoriElevator_SetupWaitAfterInit(this); break; case true: @@ -112,30 +112,30 @@ void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMoriElevator_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriElevator_Destroy(Actor* thisx, PlayState* play) { BgMoriElevator* this = (BgMoriElevator*)thisx; if (this->unk_172 == 0) { // "Forest Temple elevator DT" osSyncPrintf("森の神殿 elevator DT\n"); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); sIsSpawned = false; } } -s32 BgMoriElevator_IsPlayerRiding(BgMoriElevator* this, GlobalContext* globalCtx) { +s32 BgMoriElevator_IsPlayerRiding(BgMoriElevator* this, PlayState* play) { return ((this->dyna.unk_160 & 2) && !(this->unk_170 & 2) && - ((GET_PLAYER(globalCtx)->actor.world.pos.y - this->dyna.actor.world.pos.y) < 80.0f)); + ((GET_PLAYER(play)->actor.world.pos.y - this->dyna.actor.world.pos.y) < 80.0f)); } void BgMoriElevator_SetupWaitAfterInit(BgMoriElevator* this) { this->actionFunc = BgMoriElevator_WaitAfterInit; } -void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { - if (globalCtx->roomCtx.curRoom.num == 2) { +void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + if (play->roomCtx.curRoom.num == 2) { this->dyna.actor.world.pos.y = 73.0f; BgMoriElevator_SetupSetPosition(this); } else { @@ -153,7 +153,7 @@ void func_808A1C30(BgMoriElevator* this) { this->actionFunc = BgMoriElevator_MoveIntoGround; } -void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, GlobalContext* globalCtx) { +void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, PlayState* play) { f32 distToTarget; func_808A1800(&this->dyna.actor.velocity.y, 2.0f, 0.05f, 1.0f, 0.0f); @@ -166,13 +166,13 @@ void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, GlobalContext* globalCt } } -void func_808A1CF4(BgMoriElevator* this, GlobalContext* globalCtx) { +void func_808A1CF4(BgMoriElevator* this, PlayState* play) { this->actionFunc = BgMoriElevator_MoveAboveGround; - OnePointCutscene_Init(globalCtx, 3230, 70, &this->dyna.actor, CAM_ID_MAIN); - OnePointCutscene_Init(globalCtx, 1020, 15, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3230, 70, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 1020, 15, &this->dyna.actor, CAM_ID_MAIN); } -void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, GlobalContext* globalCtx) { +void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, PlayState* play) { f32 distToTarget; func_808A1800(&this->dyna.actor.velocity.y, 2.0f, 0.05f, 1.0f, 0.0f); @@ -189,34 +189,34 @@ void BgMoriElevator_SetupSetPosition(BgMoriElevator* this) { this->actionFunc = BgMoriElevator_SetPosition; } -void BgMoriElevator_SetPosition(BgMoriElevator* this, GlobalContext* globalCtx) { +void BgMoriElevator_SetPosition(BgMoriElevator* this, PlayState* play) { s32 pad; - if (BgMoriElevator_IsPlayerRiding(this, globalCtx)) { - if (globalCtx->roomCtx.curRoom.num == 2) { + if (BgMoriElevator_IsPlayerRiding(this, play)) { + if (play->roomCtx.curRoom.num == 2) { this->targetY = -779.0f; BgMoriElevator_StopMovement(this); - } else if (globalCtx->roomCtx.curRoom.num == 17) { + } else if (play->roomCtx.curRoom.num == 17) { this->targetY = 233.0f; BgMoriElevator_StopMovement(this); } else { // "Error:Forest Temple obj elevator Room setting is dangerous(%s %d)" osSyncPrintf("Error : 森の神殿 obj elevator 部屋設定が危険(%s %d)\n", "../z_bg_mori_elevator.c", 479); } - } else if ((globalCtx->roomCtx.curRoom.num == 2) && (this->dyna.actor.world.pos.y < -275.0f)) { + } else if ((play->roomCtx.curRoom.num == 2) && (this->dyna.actor.world.pos.y < -275.0f)) { this->targetY = 233.0f; BgMoriElevator_StopMovement(this); - } else if ((globalCtx->roomCtx.curRoom.num == 17) && (-275.0f < this->dyna.actor.world.pos.y)) { + } else if ((play->roomCtx.curRoom.num == 17) && (-275.0f < this->dyna.actor.world.pos.y)) { this->targetY = -779.0f; BgMoriElevator_StopMovement(this); - } else if ((globalCtx->roomCtx.curRoom.num == 2) && Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) && + } else if ((play->roomCtx.curRoom.num == 2) && Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) && (this->unk_16C == 0)) { this->targetY = 73.0f; func_808A1C30(this); - } else if ((globalCtx->roomCtx.curRoom.num == 2) && !Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) && + } else if ((play->roomCtx.curRoom.num == 2) && !Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) && (this->unk_16C != 0)) { this->targetY = 233.0f; - func_808A1CF4(this, globalCtx); + func_808A1CF4(this, play); } } @@ -225,7 +225,7 @@ void BgMoriElevator_StopMovement(BgMoriElevator* this) { this->dyna.actor.velocity.y = 0.0f; } -void func_808A2008(BgMoriElevator* this, GlobalContext* globalCtx) { +void func_808A2008(BgMoriElevator* this, PlayState* play) { f32 distTo; func_808A1800(&this->dyna.actor.velocity.y, 12.0f, 0.1f, 1.0f, 0.0f); @@ -239,25 +239,25 @@ void func_808A2008(BgMoriElevator* this, GlobalContext* globalCtx) { } } -void BgMoriElevator_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriElevator_Update(Actor* thisx, PlayState* play) { BgMoriElevator* this = (BgMoriElevator*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk_170 = this->dyna.unk_160; - this->unk_16C = Flags_GetSwitch(globalCtx, (thisx->params & 0x3F)); + this->unk_16C = Flags_GetSwitch(play, (thisx->params & 0x3F)); } -void BgMoriElevator_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriElevator_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriElevator* this = (BgMoriElevator*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_elevator.c", 575); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_elevator.c", 575); - func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_elevator.c", 580), + func_80093D18(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_elevator.c", 580), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMoriElevatorDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_elevator.c", 584); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mori_elevator.c", 584); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h index 6c202bb222..a981c71dd9 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h @@ -6,7 +6,7 @@ struct BgMoriElevator; -typedef void (*BgMoriElevatorActionFunc)(struct BgMoriElevator*, GlobalContext*); +typedef void (*BgMoriElevatorActionFunc)(struct BgMoriElevator*, PlayState*); typedef struct BgMoriElevator { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index 2353d0d28c..7b031d4a26 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c @@ -9,19 +9,19 @@ #define FLAGS 0 -void BgMoriHashigo_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashigo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashigo_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashigo_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriHashigo_Init(Actor* thisx, PlayState* play); +void BgMoriHashigo_Destroy(Actor* thisx, PlayState* play); +void BgMoriHashigo_Update(Actor* thisx, PlayState* play); +void BgMoriHashigo_Draw(Actor* thisx, PlayState* play); void BgMoriHashigo_SetupWaitForMoriTex(BgMoriHashigo* this); -void BgMoriHashigo_WaitForMoriTex(BgMoriHashigo* this, GlobalContext* globalCtx); +void BgMoriHashigo_WaitForMoriTex(BgMoriHashigo* this, PlayState* play); void BgMoriHashigo_SetupClasp(BgMoriHashigo* this); -void BgMoriHashigo_Clasp(BgMoriHashigo* this, GlobalContext* globalCtx); +void BgMoriHashigo_Clasp(BgMoriHashigo* this, PlayState* play); void BgMoriHashigo_SetupLadderWait(BgMoriHashigo* this); -void BgMoriHashigo_LadderWait(BgMoriHashigo* this, GlobalContext* globalCtx); +void BgMoriHashigo_LadderWait(BgMoriHashigo* this, PlayState* play); void BgMoriHashigo_SetupLadderFall(BgMoriHashigo* this); -void BgMoriHashigo_LadderFall(BgMoriHashigo* this, GlobalContext* globalCtx); +void BgMoriHashigo_LadderFall(BgMoriHashigo* this, PlayState* play); void BgMoriHashigo_SetupLadderRest(BgMoriHashigo* this); const ActorInit Bg_Mori_Hashigo_InitVars = { @@ -76,8 +76,7 @@ static InitChainEntry sInitChainLadder[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, GlobalContext* globalCtx, CollisionHeader* collision, - s32 moveFlag) { +void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader; s32 pad2; @@ -85,7 +84,7 @@ void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, GlobalContext* globalCtx, C colHeader = NULL; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG login failed" @@ -94,11 +93,11 @@ void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, GlobalContext* globalCtx, C } } -void BgMoriHashigo_InitCollider(BgMoriHashigo* this, GlobalContext* globalCtx) { +void BgMoriHashigo_InitCollider(BgMoriHashigo* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); this->collider.elements[0].dim.worldSphere.center.x = (s16)this->dyna.actor.world.pos.x; this->collider.elements[0].dim.worldSphere.center.y = (s16)this->dyna.actor.world.pos.y + 21; @@ -106,7 +105,7 @@ void BgMoriHashigo_InitCollider(BgMoriHashigo* this, GlobalContext* globalCtx) { this->collider.elements[0].dim.worldSphere.radius = 19; } -s32 BgMoriHashigo_SpawnLadder(BgMoriHashigo* this, GlobalContext* globalCtx) { +s32 BgMoriHashigo_SpawnLadder(BgMoriHashigo* this, PlayState* play) { f32 sn; f32 cs; Vec3f pos; @@ -119,9 +118,9 @@ s32 BgMoriHashigo_SpawnLadder(BgMoriHashigo* this, GlobalContext* globalCtx) { pos.y = -210.0f + this->dyna.actor.world.pos.y; pos.z = 6.0f * cs + this->dyna.actor.world.pos.z; - ladder = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_MORI_HASHIGO, pos.x, pos.y, - pos.z, this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, - this->dyna.actor.world.rot.z, 0); + ladder = + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_MORI_HASHIGO, pos.x, pos.y, pos.z, + this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, 0); if (ladder != NULL) { return true; } else { @@ -132,40 +131,40 @@ s32 BgMoriHashigo_SpawnLadder(BgMoriHashigo* this, GlobalContext* globalCtx) { } } -s32 BgMoriHashigo_InitClasp(BgMoriHashigo* this, GlobalContext* globalCtx) { +s32 BgMoriHashigo_InitClasp(BgMoriHashigo* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChainClasp); this->dyna.actor.flags |= ACTOR_FLAG_0; Actor_SetFocus(&this->dyna.actor, 55.0f); - BgMoriHashigo_InitCollider(this, globalCtx); - if ((this->dyna.actor.params == HASHIGO_CLASP) && !BgMoriHashigo_SpawnLadder(this, globalCtx)) { + BgMoriHashigo_InitCollider(this, play); + if ((this->dyna.actor.params == HASHIGO_CLASP) && !BgMoriHashigo_SpawnLadder(this, play)) { return false; } else { return true; } } -s32 BgMoriHashigo_InitLadder(BgMoriHashigo* this, GlobalContext* globalCtx) { - BgMoriHashigo_InitDynapoly(this, globalCtx, &gMoriHashigoCol, DPM_UNK); +s32 BgMoriHashigo_InitLadder(BgMoriHashigo* this, PlayState* play) { + BgMoriHashigo_InitDynapoly(this, play, &gMoriHashigoCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChainLadder); return true; } -void BgMoriHashigo_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashigo_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashigo* this = (BgMoriHashigo*)thisx; if (this->dyna.actor.params == HASHIGO_CLASP) { - if (!BgMoriHashigo_InitClasp(this, globalCtx)) { + if (!BgMoriHashigo_InitClasp(this, play)) { Actor_Kill(&this->dyna.actor); return; } } else if (this->dyna.actor.params == HASHIGO_LADDER) { - if (!BgMoriHashigo_InitLadder(this, globalCtx)) { + if (!BgMoriHashigo_InitLadder(this, play)) { Actor_Kill(&this->dyna.actor); return; } } - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { // "Bank danger!" osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params, @@ -178,15 +177,15 @@ void BgMoriHashigo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMoriHashigo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashigo_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashigo* this = (BgMoriHashigo*)thisx; if (this->dyna.actor.params == HASHIGO_LADDER) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } if (this->dyna.actor.params == HASHIGO_CLASP) { - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } } @@ -194,8 +193,8 @@ void BgMoriHashigo_SetupWaitForMoriTex(BgMoriHashigo* this) { this->actionFunc = BgMoriHashigo_WaitForMoriTex; } -void BgMoriHashigo_WaitForMoriTex(BgMoriHashigo* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { +void BgMoriHashigo_WaitForMoriTex(BgMoriHashigo* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { if (this->dyna.actor.params == HASHIGO_CLASP) { BgMoriHashigo_SetupClasp(this); } else if (this->dyna.actor.params == HASHIGO_LADDER) { @@ -209,13 +208,13 @@ void BgMoriHashigo_SetupClasp(BgMoriHashigo* this) { this->actionFunc = BgMoriHashigo_Clasp; } -void BgMoriHashigo_Clasp(BgMoriHashigo* this, GlobalContext* globalCtx) { +void BgMoriHashigo_Clasp(BgMoriHashigo* this, PlayState* play) { if (this->hitTimer <= 0) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; this->hitTimer = 10; } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } @@ -224,7 +223,7 @@ void BgMoriHashigo_SetupLadderWait(BgMoriHashigo* this) { this->actionFunc = BgMoriHashigo_LadderWait; } -void BgMoriHashigo_LadderWait(BgMoriHashigo* this, GlobalContext* globalCtx) { +void BgMoriHashigo_LadderWait(BgMoriHashigo* this, PlayState* play) { BgMoriHashigo* clasp = (BgMoriHashigo*)this->dyna.actor.parent; if (clasp->hitTimer > 0) { @@ -240,7 +239,7 @@ void BgMoriHashigo_SetupLadderFall(BgMoriHashigo* this) { this->dyna.actor.velocity.y = 2.0f; } -void BgMoriHashigo_LadderFall(BgMoriHashigo* this, GlobalContext* globalCtx) { +void BgMoriHashigo_LadderFall(BgMoriHashigo* this, PlayState* play) { static f32 bounceSpeed[3] = { 4.0f, 2.7f, 1.7f }; Actor* thisx = &this->dyna.actor; @@ -249,13 +248,13 @@ void BgMoriHashigo_LadderFall(BgMoriHashigo* this, GlobalContext* globalCtx) { if (this->bounceCounter >= ARRAY_COUNT(bounceSpeed)) { BgMoriHashigo_SetupLadderRest(this); } else { - Actor_UpdateBgCheckInfo(globalCtx, thisx, 0.0f, 0.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); thisx->velocity.y = bounceSpeed[this->bounceCounter]; this->bounceCounter++; } } else { - Actor_UpdateBgCheckInfo(globalCtx, thisx, 0.0f, 0.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } } @@ -267,7 +266,7 @@ void BgMoriHashigo_SetupLadderRest(BgMoriHashigo* this) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } -void BgMoriHashigo_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashigo_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashigo* this = (BgMoriHashigo*)thisx; @@ -275,20 +274,20 @@ void BgMoriHashigo_Update(Actor* thisx, GlobalContext* globalCtx) { this->hitTimer--; } if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgMoriHashigo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashigo_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashigo* this = (BgMoriHashigo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_hashigo.c", 516); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hashigo.c", 516); + func_80093D18(play->state.gfxCtx); if (1) {} - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hashigo.c", 521), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hashigo.c", 521), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); switch (this->dyna.actor.params) { @@ -299,5 +298,5 @@ void BgMoriHashigo_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gMoriHashigoLadderDL); break; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_hashigo.c", 531); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mori_hashigo.c", 531); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h index 55c07ca922..35281d5c7a 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h @@ -6,7 +6,7 @@ struct BgMoriHashigo; -typedef void (*BgMoriHashigoActionFunc)(struct BgMoriHashigo*, GlobalContext*); +typedef void (*BgMoriHashigoActionFunc)(struct BgMoriHashigo*, PlayState*); typedef struct BgMoriHashigo { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c index b33386009e..fce6533035 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c @@ -9,17 +9,17 @@ #define FLAGS ACTOR_FLAG_4 -void BgMoriHashira4_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashira4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashira4_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHashira4_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriHashira4_Init(Actor* thisx, PlayState* play); +void BgMoriHashira4_Destroy(Actor* thisx, PlayState* play); +void BgMoriHashira4_Update(Actor* thisx, PlayState* play); +void BgMoriHashira4_Draw(Actor* thisx, PlayState* play); void BgMoriHashira4_SetupWaitForMoriTex(BgMoriHashira4* this); -void BgMoriHashira4_WaitForMoriTex(BgMoriHashira4* this, GlobalContext* globalCtx); +void BgMoriHashira4_WaitForMoriTex(BgMoriHashira4* this, PlayState* play); void BgMoriHashira4_SetupPillarsRotate(BgMoriHashira4* this); -void BgMoriHashira4_PillarsRotate(BgMoriHashira4* this, GlobalContext* globalCtx); -void BgMoriHashira4_GateWait(BgMoriHashira4* this, GlobalContext* globalCtx); -void BgMoriHashira4_GateOpen(BgMoriHashira4* this, GlobalContext* globalCtx); +void BgMoriHashira4_PillarsRotate(BgMoriHashira4* this, PlayState* play); +void BgMoriHashira4_GateWait(BgMoriHashira4* this, PlayState* play); +void BgMoriHashira4_GateOpen(BgMoriHashira4* this, PlayState* play); const ActorInit Bg_Mori_Hashira4_InitVars = { ACTOR_BG_MORI_HASHIRA4, @@ -48,8 +48,7 @@ void BgMoriHashira4_SetupAction(BgMoriHashira4* this, BgMoriHashira4ActionFunc a this->actionFunc = actionFunc; } -void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, GlobalContext* globalCtx, CollisionHeader* collision, - s32 moveFlag) { +void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader; s32 pad2; @@ -57,7 +56,7 @@ void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, GlobalContext* globalCtx, colHeader = NULL; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG login failed" @@ -66,7 +65,7 @@ void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, GlobalContext* globalCtx, } } -void BgMoriHashira4_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashira4_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashira4* this = (BgMoriHashira4*)thisx; @@ -74,12 +73,12 @@ void BgMoriHashira4_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.params &= 0xFF; if (this->dyna.actor.params == 0) { - BgMoriHashira4_InitDynaPoly(this, globalCtx, &gMoriHashira1Col, DPM_UNK3); + BgMoriHashira4_InitDynaPoly(this, play, &gMoriHashira1Col, DPM_UNK3); } else { - BgMoriHashira4_InitDynaPoly(this, globalCtx, &gMoriHashira2Col, DPM_UNK); + BgMoriHashira4_InitDynaPoly(this, play, &gMoriHashira2Col, DPM_UNK); } Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { Actor_Kill(&this->dyna.actor); // "Bank danger!" @@ -87,7 +86,7 @@ void BgMoriHashira4_Init(Actor* thisx, GlobalContext* globalCtx) { "../z_bg_mori_hashira4.c", 196); return; } - if ((this->dyna.actor.params != 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->dyna.actor.params != 0) && Flags_GetSwitch(play, this->switchFlag)) { Actor_Kill(&this->dyna.actor); return; } @@ -98,19 +97,19 @@ void BgMoriHashira4_Init(Actor* thisx, GlobalContext* globalCtx) { sUnkTimer = 0; } -void BgMoriHashira4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashira4_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashira4* this = (BgMoriHashira4*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgMoriHashira4_SetupWaitForMoriTex(BgMoriHashira4* this) { BgMoriHashira4_SetupAction(this, BgMoriHashira4_WaitForMoriTex); } -void BgMoriHashira4_WaitForMoriTex(BgMoriHashira4* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { +void BgMoriHashira4_WaitForMoriTex(BgMoriHashira4* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { this->gateTimer = 0; if (this->dyna.actor.params == 0) { BgMoriHashira4_SetupPillarsRotate(this); @@ -125,50 +124,50 @@ void BgMoriHashira4_SetupPillarsRotate(BgMoriHashira4* this) { BgMoriHashira4_SetupAction(this, BgMoriHashira4_PillarsRotate); } -void BgMoriHashira4_PillarsRotate(BgMoriHashira4* this, GlobalContext* globalCtx) { +void BgMoriHashira4_PillarsRotate(BgMoriHashira4* this, PlayState* play) { this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y += 0x96; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_ROLL_STAND_2 - SFX_FLAG); } -void BgMoriHashira4_GateWait(BgMoriHashira4* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag) || (this->gateTimer != 0)) { +void BgMoriHashira4_GateWait(BgMoriHashira4* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag) || (this->gateTimer != 0)) { this->gateTimer++; if (this->gateTimer > 30) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_OPEN); BgMoriHashira4_SetupAction(this, BgMoriHashira4_GateOpen); - OnePointCutscene_Init(globalCtx, 6010, 20, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 6010, 20, &this->dyna.actor, CAM_ID_MAIN); sUnkTimer++; } } } -void BgMoriHashira4_GateOpen(BgMoriHashira4* this, GlobalContext* globalCtx) { +void BgMoriHashira4_GateOpen(BgMoriHashira4* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 120.0f, 10.0f)) { Actor_Kill(&this->dyna.actor); } } -void BgMoriHashira4_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashira4_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashira4* this = (BgMoriHashira4*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgMoriHashira4_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHashira4_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriHashira4* this = (BgMoriHashira4*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_hashira4.c", 339); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hashira4.c", 339); + func_80093D18(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hashira4.c", 344), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hashira4.c", 344), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDisplayLists[this->dyna.actor.params]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_hashira4.c", 348); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mori_hashira4.c", 348); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h index 447acdab96..797688bdb1 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h +++ b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h @@ -6,7 +6,7 @@ struct BgMoriHashira4; -typedef void (*BgMoriHashira4ActionFunc)(struct BgMoriHashira4*, GlobalContext*); +typedef void (*BgMoriHashira4ActionFunc)(struct BgMoriHashira4*, PlayState*); typedef struct BgMoriHashira4 { /* 0x0000 */ DynaPolyActor dyna; 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 fe830c20d8..a3b7fa042d 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 @@ -15,17 +15,17 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHineri_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHineri_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx); +void BgMoriHineri_Init(Actor* thisx, PlayState* play); +void BgMoriHineri_Destroy(Actor* thisx, PlayState* play); +void BgMoriHineri_Update(Actor* thisx, PlayState* play); +void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play); -void func_808A39FC(BgMoriHineri* this, GlobalContext* globalCtx); -void func_808A3E54(BgMoriHineri* this, GlobalContext* globalCtx); -void func_808A3C8C(BgMoriHineri* this, GlobalContext* globalCtx); -void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, GlobalContext* globalCtx); -void BgMoriHineri_DoNothing(BgMoriHineri* this, GlobalContext* globalCtx); -void func_808A3D58(BgMoriHineri* this, GlobalContext* globalCtx); +void func_808A39FC(BgMoriHineri* this, PlayState* play); +void func_808A3E54(BgMoriHineri* this, PlayState* play); +void func_808A3C8C(BgMoriHineri* this, PlayState* play); +void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, PlayState* play); +void BgMoriHineri_DoNothing(BgMoriHineri* this, PlayState* play); +void func_808A3D58(BgMoriHineri* this, PlayState* play); static s16 sSubCamId = CAM_ID_NONE; @@ -52,7 +52,7 @@ static Gfx* sDLists[] = { object_mori_hineri2a_DL_002B70, }; -void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHineri_Init(Actor* thisx, PlayState* play) { BgMoriHineri* this = (BgMoriHineri*)thisx; s8 moriHineriObjIdx; u32 switchFlagParam; @@ -68,10 +68,10 @@ void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx) { this->switchFlag = switchFlagParam; } else { this->switchFlag = ((this->dyna.actor.params >> 8) & 0x3F); - this->switchFlag = (Flags_GetSwitch(globalCtx, this->switchFlag)) ? 1 : 0; + this->switchFlag = (Flags_GetSwitch(play, this->switchFlag)) ? 1 : 0; } this->dyna.actor.params = ((this->dyna.actor.params & 0x8000) >> 0xE); - if (Flags_GetSwitch(globalCtx, switchFlagParam)) { + if (Flags_GetSwitch(play, switchFlagParam)) { if (this->dyna.actor.params == 0) { this->dyna.actor.params = 1; } else if (this->dyna.actor.params == 2) { @@ -80,21 +80,20 @@ void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx) { } this->boxObjIdx = -1; if (this->dyna.actor.params == 0) { - this->moriHineriObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI1); + this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1); if (t6 == 0) { - this->boxObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_BOX); + this->boxObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_BOX); } } else { if (this->dyna.actor.params == 1) { - moriHineriObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI1A); + moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1A); } else { - moriHineriObjIdx = (this->dyna.actor.params == 2) - ? Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI2) - : Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI2A); + moriHineriObjIdx = (this->dyna.actor.params == 2) ? Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2) + : Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2A); } this->moriHineriObjIdx = moriHineriObjIdx; } - this->moriTexObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (t6 != 0) { this->dyna.actor.params += 4; } @@ -105,28 +104,28 @@ void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMoriHineri_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHineri_Destroy(Actor* thisx, PlayState* play) { BgMoriHineri* this = (BgMoriHineri*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808A39FC(BgMoriHineri* this, GlobalContext* globalCtx) { +void func_808A39FC(BgMoriHineri* this, PlayState* play) { CollisionHeader* colHeader; - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriHineriObjIdx) && - Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIdx) && - ((this->boxObjIdx < 0) || Object_IsLoaded(&globalCtx->objectCtx, this->boxObjIdx))) { + if (Object_IsLoaded(&play->objectCtx, this->moriHineriObjIdx) && + Object_IsLoaded(&play->objectCtx, this->moriTexObjIdx) && + ((this->boxObjIdx < 0) || Object_IsLoaded(&play->objectCtx, this->boxObjIdx))) { this->dyna.actor.objBankIndex = this->moriHineriObjIdx; if (this->dyna.actor.params >= 4) { this->dyna.actor.params -= 4; if (this->dyna.actor.params == 0) { - this->moriHineriObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI1A); + this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1A); } else if (this->dyna.actor.params == 1) { - this->moriHineriObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI1); + this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1); } else { this->moriHineriObjIdx = (this->dyna.actor.params == 2) - ? Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI2A) - : Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_HINERI2); + ? Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2A) + : Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2); } if (this->moriHineriObjIdx < 0) { Actor_Kill(&this->dyna.actor); @@ -134,7 +133,7 @@ void func_808A39FC(BgMoriHineri* this, GlobalContext* globalCtx) { this->actionFunc = func_808A3D58; } } else { - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); colHeader = NULL; this->dyna.actor.draw = BgMoriHineri_DrawHallAndRoom; if (this->dyna.actor.params == 0) { @@ -150,56 +149,54 @@ void func_808A39FC(BgMoriHineri* this, GlobalContext* globalCtx) { this->actionFunc = func_808A3C8C; CollisionHeader_GetVirtual(&object_mori_hineri2a_Col_006078, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } } } -void BgMoriHineri_DoNothing(BgMoriHineri* this, GlobalContext* globalCtx) { +void BgMoriHineri_DoNothing(BgMoriHineri* this, PlayState* play) { } -void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOX, this->dyna.actor.world.pos.x + 147.0f, +void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOX, this->dyna.actor.world.pos.x + 147.0f, this->dyna.actor.world.pos.y + -245.0f, this->dyna.actor.world.pos.z + -453.0f, 0, 0x4000, 0, 0x27EE); this->actionFunc = BgMoriHineri_DoNothing; } -void func_808A3C8C(BgMoriHineri* this, GlobalContext* globalCtx) { +void func_808A3C8C(BgMoriHineri* this, PlayState* play) { f32 f0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f0 = 1100.0f - (player->actor.world.pos.z - this->dyna.actor.world.pos.z); this->dyna.actor.shape.rot.z = CLAMP(f0, 0.0f, 1000.0f) * 16.384f; - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON1); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON1); if (this->dyna.actor.params != 0) { this->dyna.actor.shape.rot.z = -this->dyna.actor.shape.rot.z; } } -void func_808A3D58(BgMoriHineri* this, GlobalContext* globalCtx) { +void func_808A3D58(BgMoriHineri* this, PlayState* play) { s16 mainCamChildId; - if ((Flags_GetSwitch(globalCtx, this->switchFlag) && - (this->dyna.actor.params == 0 || this->dyna.actor.params == 2)) || - (!Flags_GetSwitch(globalCtx, this->switchFlag) && - (this->dyna.actor.params == 1 || this->dyna.actor.params == 3))) { + if ((Flags_GetSwitch(play, this->switchFlag) && (this->dyna.actor.params == 0 || this->dyna.actor.params == 2)) || + (!Flags_GetSwitch(play, this->switchFlag) && (this->dyna.actor.params == 1 || this->dyna.actor.params == 3))) { this->dyna.actor.draw = BgMoriHineri_DrawHallAndRoom; this->actionFunc = func_808A3E54; - mainCamChildId = globalCtx->cameraPtrs[CAM_ID_MAIN]->childCamId; + mainCamChildId = play->cameraPtrs[CAM_ID_MAIN]->childCamId; if ((mainCamChildId != CAM_ID_MAIN) && - (globalCtx->cameraPtrs[mainCamChildId]->setting == CAM_SET_CS_TWISTED_HALLWAY)) { - OnePointCutscene_EndCutscene(globalCtx, mainCamChildId); + (play->cameraPtrs[mainCamChildId]->setting == CAM_SET_CS_TWISTED_HALLWAY)) { + OnePointCutscene_EndCutscene(play, mainCamChildId); } - OnePointCutscene_Init(globalCtx, 3260, 40, &this->dyna.actor, CAM_ID_MAIN); - sSubCamId = OnePointCutscene_Init(globalCtx, 3261, 40, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3260, 40, &this->dyna.actor, CAM_ID_MAIN); + sSubCamId = OnePointCutscene_Init(play, 3261, 40, &this->dyna.actor, CAM_ID_MAIN); } } -void func_808A3E54(BgMoriHineri* this, GlobalContext* globalCtx) { +void func_808A3E54(BgMoriHineri* this, PlayState* play) { s8 objBankIndex; - if (globalCtx->activeCamId == sSubCamId) { + if (play->activeCamId == sSubCamId) { if (sSubCamId != SUB_CAM_ID_DONE) { objBankIndex = this->dyna.actor.objBankIndex; this->dyna.actor.objBankIndex = this->moriHineriObjIdx; @@ -213,35 +210,34 @@ void func_808A3E54(BgMoriHineri* this, GlobalContext* globalCtx) { sSubCamId = CAM_ID_NONE; } } - if ((sSubCamId >= CAM_ID_SUB_FIRST) && - ((GET_ACTIVE_CAM(globalCtx)->eye.z - this->dyna.actor.world.pos.z) < 1100.0f)) { + if ((sSubCamId >= CAM_ID_SUB_FIRST) && ((GET_ACTIVE_CAM(play)->eye.z - this->dyna.actor.world.pos.z) < 1100.0f)) { func_8002F948(&this->dyna.actor, NA_SE_EV_FLOOR_ROLLING - SFX_FLAG); } } -void BgMoriHineri_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHineri_Update(Actor* thisx, PlayState* play) { BgMoriHineri* this = (BgMoriHineri*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) { BgMoriHineri* this = (BgMoriHineri*)thisx; s8 objIndex; MtxF mtx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 611); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hineri.c", 611); - func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIdx].segment); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 618), + func_80093D18(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIdx].segment); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hineri.c", 618), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDLists[this->dyna.actor.params]); if (this->boxObjIdx > 0) { Matrix_Get(&mtx); } if ((this->actionFunc == func_808A3C8C) && (this->dyna.actor.shape.rot.z != 0)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->dyna.actor.params == 0) { Matrix_Translate(-1761.0f, 1278.0f, -1821.0f, MTXMODE_NEW); } else { @@ -249,33 +245,33 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx) { } Matrix_RotateZYX(0, -0x8000, this->dyna.actor.shape.rot.z, MTXMODE_APPLY); Matrix_Translate(0.0f, -50.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 652), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hineri.c", 652), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDungeonDoorDL); } - if ((this->boxObjIdx > 0) && ((this->boxObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_BOX)) > 0) && - Object_IsLoaded(&globalCtx->objectCtx, this->boxObjIdx)) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->boxObjIdx].segment); + if ((this->boxObjIdx > 0) && ((this->boxObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_BOX)) > 0) && + Object_IsLoaded(&play->objectCtx, this->boxObjIdx)) { + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->boxObjIdx].segment); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); Matrix_Put(&mtx); Matrix_Translate(147.0f, -245.0f, -453.0f, MTXMODE_APPLY); Matrix_RotateY(M_PI / 2, MTXMODE_APPLY); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 689), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hineri.c", 689), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gTreasureChestBossKeyChestFrontDL); Matrix_Put(&mtx); Matrix_Translate(167.0f, -218.0f, -453.0f, MTXMODE_APPLY); - if (Flags_GetTreasure(globalCtx, 0xE)) { + if (Flags_GetTreasure(play, 0xE)) { Matrix_RotateZ(BINANG_TO_RAD(0x3500), MTXMODE_APPLY); } else { Matrix_RotateZ(M_PI, MTXMODE_APPLY); } Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 703), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hineri.c", 703), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gTreasureChestBossKeyChestSideAndTopDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 709); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mori_hineri.c", 709); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h index a8187138c6..e42c23a438 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h @@ -6,7 +6,7 @@ struct BgMoriHineri; -typedef void (*BgMoriHineriActionFunc)(struct BgMoriHineri*, GlobalContext*); +typedef void (*BgMoriHineriActionFunc)(struct BgMoriHineri*, PlayState*); typedef struct BgMoriHineri { /* 0x0000 */ DynaPolyActor dyna; 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 49a6abfc7e..f15baefbb9 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 @@ -9,15 +9,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriIdomizu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriIdomizu_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriIdomizu_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriIdomizu_Init(Actor* thisx, PlayState* play); +void BgMoriIdomizu_Destroy(Actor* thisx, PlayState* play); +void BgMoriIdomizu_Update(Actor* thisx, PlayState* play); +void BgMoriIdomizu_Draw(Actor* thisx, PlayState* play); void BgMoriIdomizu_SetupWaitForMoriTex(BgMoriIdomizu* this); -void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, GlobalContext* globalCtx); +void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, PlayState* play); void BgMoriIdomizu_SetupMain(BgMoriIdomizu* this); -void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx); +void BgMoriIdomizu_Main(BgMoriIdomizu* this, PlayState* play); static s16 sIsSpawned = false; @@ -37,15 +37,15 @@ void BgMoriIdomizu_SetupAction(BgMoriIdomizu* this, BgMoriIdomizuActionFunc acti this->actionFunc = actionFunc; } -void BgMoriIdomizu_SetWaterLevel(GlobalContext* globalCtx, s16 waterLevel) { - WaterBox* waterBox = globalCtx->colCtx.colHeader->waterBoxes; +void BgMoriIdomizu_SetWaterLevel(PlayState* play, s16 waterLevel) { + WaterBox* waterBox = play->colCtx.colHeader->waterBoxes; waterBox[2].ySurface = waterLevel; waterBox[3].ySurface = waterLevel; waterBox[4].ySurface = waterLevel; } -void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriIdomizu_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; @@ -58,15 +58,15 @@ void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.scale.z = 1.0f; this->actor.world.pos.x = 119.0f; this->actor.world.pos.z = -1820.0f; - this->prevSwitchFlagSet = Flags_GetSwitch(globalCtx, this->actor.params & 0x3F); + this->prevSwitchFlagSet = Flags_GetSwitch(play, this->actor.params & 0x3F); if (this->prevSwitchFlagSet != 0) { this->actor.world.pos.y = -282.0f; - BgMoriIdomizu_SetWaterLevel(globalCtx, -282); + BgMoriIdomizu_SetWaterLevel(play, -282); } else { this->actor.world.pos.y = 184.0f; - BgMoriIdomizu_SetWaterLevel(globalCtx, 184); + BgMoriIdomizu_SetWaterLevel(play, 184); } - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { Actor_Kill(&this->actor); // "Bank danger!" @@ -82,7 +82,7 @@ void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(森の神殿 井戸水)(arg_data 0x%04x)\n", this->actor.params); } -void BgMoriIdomizu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriIdomizu_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; @@ -95,8 +95,8 @@ void BgMoriIdomizu_SetupWaitForMoriTex(BgMoriIdomizu* this) { BgMoriIdomizu_SetupAction(this, BgMoriIdomizu_WaitForMoriTex); } -void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { +void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { BgMoriIdomizu_SetupMain(this); this->actor.draw = BgMoriIdomizu_Draw; } @@ -106,23 +106,23 @@ void BgMoriIdomizu_SetupMain(BgMoriIdomizu* this) { BgMoriIdomizu_SetupAction(this, BgMoriIdomizu_Main); } -void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx) { +void BgMoriIdomizu_Main(BgMoriIdomizu* this, PlayState* play) { s8 roomNum; Actor* thisx = &this->actor; s32 switchFlagSet; - roomNum = globalCtx->roomCtx.curRoom.num; - switchFlagSet = Flags_GetSwitch(globalCtx, thisx->params & 0x3F); + roomNum = play->roomCtx.curRoom.num; + switchFlagSet = Flags_GetSwitch(play, thisx->params & 0x3F); if (switchFlagSet) { this->targetWaterLevel = -282.0f; } else { this->targetWaterLevel = 184.0f; } if (switchFlagSet && !this->prevSwitchFlagSet) { - OnePointCutscene_Init(globalCtx, 3240, 70, thisx, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3240, 70, thisx, CAM_ID_MAIN); this->drainTimer = 90; } else if (!switchFlagSet && this->prevSwitchFlagSet) { - OnePointCutscene_Init(globalCtx, 3240, 70, thisx, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3240, 70, thisx, CAM_ID_MAIN); this->drainTimer = 90; thisx->world.pos.y = 0.0f; } @@ -130,7 +130,7 @@ void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx) { if ((roomNum == 7) || (roomNum == 8) || (roomNum == 9)) { if (this->drainTimer < 70) { Math_StepToF(&thisx->world.pos.y, this->targetWaterLevel, 3.5f); - BgMoriIdomizu_SetWaterLevel(globalCtx, thisx->world.pos.y); + BgMoriIdomizu_SetWaterLevel(play, thisx->world.pos.y); if (this->drainTimer > 0) { if (switchFlagSet) { func_800788CC(NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); @@ -141,43 +141,43 @@ void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx) { } } else { thisx->world.pos.y = this->targetWaterLevel; - BgMoriIdomizu_SetWaterLevel(globalCtx, thisx->world.pos.y); + BgMoriIdomizu_SetWaterLevel(play, thisx->world.pos.y); Actor_Kill(thisx); return; } this->prevSwitchFlagSet = switchFlagSet; } -void BgMoriIdomizu_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriIdomizu_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgMoriIdomizu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriIdomizu_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; - u32 gameplayFrames = globalCtx->gameplayFrames; + u32 gameplayFrames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_idomizu.c", 356); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_idomizu.c", 356); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_idomizu.c", 360), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_idomizu.c", 360), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_XLU_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0x7F - (gameplayFrames & 0x7F), gameplayFrames % 0x80, 0x20, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0x7F - (gameplayFrames & 0x7F), gameplayFrames % 0x80, 0x20, 0x20, 1, gameplayFrames & 0x7F, gameplayFrames % 0x80, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gMoriIdomizuWaterDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_idomizu.c", 382); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mori_idomizu.c", 382); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h index be90323379..d2e6f173a0 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h +++ b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h @@ -6,7 +6,7 @@ struct BgMoriIdomizu; -typedef void (*BgMoriIdomizuActionFunc)(struct BgMoriIdomizu*, GlobalContext*); +typedef void (*BgMoriIdomizuActionFunc)(struct BgMoriIdomizu*, PlayState*); typedef struct BgMoriIdomizu { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index fd748ff2c5..7ba74b404a 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgMoriKaitenkabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriKaitenkabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriKaitenkabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriKaitenkabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriKaitenkabe_Init(Actor* thisx, PlayState* play); +void BgMoriKaitenkabe_Destroy(Actor* thisx, PlayState* play); +void BgMoriKaitenkabe_Update(Actor* thisx, PlayState* play); +void BgMoriKaitenkabe_Draw(Actor* thisx, PlayState* play); -void BgMoriKaitenkabe_WaitForMoriTex(BgMoriKaitenkabe* this, GlobalContext* globalCtx); +void BgMoriKaitenkabe_WaitForMoriTex(BgMoriKaitenkabe* this, PlayState* play); void BgMoriKaitenkabe_SetupWait(BgMoriKaitenkabe* this); -void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, GlobalContext* globalCtx); +void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play); void BgMoriKaitenkabe_SetupRotate(BgMoriKaitenkabe* this); -void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, GlobalContext* globalCtx); +void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play); const ActorInit Bg_Mori_Kaitenkabe_InitVars = { ACTOR_BG_MORI_KAITENKABE, @@ -45,7 +45,7 @@ void BgMoriKaitenkabe_CrossProduct(Vec3f* dest, Vec3f* v1, Vec3f* v2) { dest->z = (v1->x * v2->y) - (v1->y * v2->x); } -void BgMoriKaitenkabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriKaitenkabe_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriKaitenkabe* this = (BgMoriKaitenkabe*)thisx; CollisionHeader* colHeader = NULL; @@ -55,8 +55,8 @@ void BgMoriKaitenkabe_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gMoriKaitenkabeCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { Actor_Kill(&this->dyna.actor); // "【Rotating wall】 Bank danger!" @@ -66,15 +66,15 @@ void BgMoriKaitenkabe_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgMoriKaitenkabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriKaitenkabe_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriKaitenkabe* this = (BgMoriKaitenkabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgMoriKaitenkabe_WaitForMoriTex(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { +void BgMoriKaitenkabe_WaitForMoriTex(BgMoriKaitenkabe* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { BgMoriKaitenkabe_SetupWait(this); this->dyna.actor.draw = BgMoriKaitenkabe_Draw; } @@ -85,17 +85,17 @@ void BgMoriKaitenkabe_SetupWait(BgMoriKaitenkabe* this) { this->timer = 0; } -void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { +void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play) { Vec3f push; Vec3f leverArm; Vec3f torque; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 > 0.001f) { this->timer++; - if ((this->timer > 28) && !Player_InCsMode(globalCtx)) { + if ((this->timer > 28) && !Player_InCsMode(play)) { BgMoriKaitenkabe_SetupRotate(this); - func_8002DF54(globalCtx, &this->dyna.actor, 8); + func_8002DF54(play, &this->dyna.actor, 8); Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.world.pos); push.x = Math_SinS(this->dyna.unk_158); push.y = 0.0f; @@ -121,15 +121,15 @@ void BgMoriKaitenkabe_SetupRotate(BgMoriKaitenkabe* this) { this->rotYdeg = 0.0f; } -void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->dyna.actor; s16 rotY; Math_StepToF(&this->rotSpeed, 0.6f, 0.02f); if (Math_StepToF(&this->rotYdeg, this->rotDirection * 45.0f, this->rotSpeed)) { BgMoriKaitenkabe_SetupWait(this); - func_8002DF54(globalCtx, thisx, 7); + func_8002DF54(play, thisx, 7); if (this->rotDirection > 0.0f) { thisx->home.rot.y += 0x2000; } else { @@ -149,26 +149,26 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&player->actor.world.pos, &this->lockedPlayerPos); } -void BgMoriKaitenkabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriKaitenkabe_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriKaitenkabe* this = (BgMoriKaitenkabe*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgMoriKaitenkabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriKaitenkabe_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriKaitenkabe* this = (BgMoriKaitenkabe*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 347); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 347); + func_80093D18(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 352), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 352), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMoriKaitenkabeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 356); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 356); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h index aa52d21a4c..05272c6f20 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h +++ b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h @@ -6,7 +6,7 @@ struct BgMoriKaitenkabe; -typedef void (*BgMoriKaitenkabeActionFunc)(struct BgMoriKaitenkabe*, GlobalContext*); +typedef void (*BgMoriKaitenkabeActionFunc)(struct BgMoriKaitenkabe*, PlayState*); typedef struct BgMoriKaitenkabe { /* 0x0000 */ DynaPolyActor dyna; 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 3814fe9ae8..d1749adf16 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 @@ -9,21 +9,21 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgMoriRakkatenjo_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMoriRakkatenjo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMoriRakkatenjo_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMoriRakkatenjo_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play); +void BgMoriRakkatenjo_Destroy(Actor* thisx, PlayState* play); +void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play); +void BgMoriRakkatenjo_Draw(Actor* thisx, PlayState* play); void BgMoriRakkatenjo_SetupWaitForMoriTex(BgMoriRakkatenjo* this); -void BgMoriRakkatenjo_WaitForMoriTex(BgMoriRakkatenjo* this, GlobalContext* globalCtx); +void BgMoriRakkatenjo_WaitForMoriTex(BgMoriRakkatenjo* this, PlayState* play); void BgMoriRakkatenjo_SetupWait(BgMoriRakkatenjo* this); -void BgMoriRakkatenjo_Wait(BgMoriRakkatenjo* this, GlobalContext* globalCtx); +void BgMoriRakkatenjo_Wait(BgMoriRakkatenjo* this, PlayState* play); void BgMoriRakkatenjo_SetupFall(BgMoriRakkatenjo* this); -void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, GlobalContext* globalCtx); +void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, PlayState* play); void BgMoriRakkatenjo_SetupRest(BgMoriRakkatenjo* this); -void BgMoriRakkatenjo_Rest(BgMoriRakkatenjo* this, GlobalContext* globalCtx); +void BgMoriRakkatenjo_Rest(BgMoriRakkatenjo* this, PlayState* play); void BgMoriRakkatenjo_SetupRise(BgMoriRakkatenjo* this); -void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, GlobalContext* globalCtx); +void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, PlayState* play); static s16 sCamSetting = CAM_SET_NONE; @@ -45,7 +45,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgMoriRakkatenjo_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx; CollisionHeader* colHeader = NULL; @@ -63,7 +63,7 @@ void BgMoriRakkatenjo_Init(Actor* thisx, GlobalContext* globalCtx) { // "The set Angle has changed. Let's fix the program." osSyncPrintf("Warning : セット Angle が変更されています。プログラムを修正しましょう。\n"); } - this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); + this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjIndex < 0) { // "Forest Temple obj Falling Ceiling Bank Danger!" osSyncPrintf("Error : 森の神殿 obj 落下天井 バンク危険!(%s %d)\n", "../z_bg_mori_rakkatenjo.c", 205); @@ -72,26 +72,26 @@ void BgMoriRakkatenjo_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_ProcessInitChain(&this->dyna.actor, sInitChain); CollisionHeader_GetVirtual(&gMoriRakkatenjoCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); BgMoriRakkatenjo_SetupWaitForMoriTex(this); sCamSetting = CAM_SET_NONE; } -void BgMoriRakkatenjo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -s32 BgMoriRakkatenjo_IsLinkUnder(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { - Vec3f* pos = &GET_PLAYER(globalCtx)->actor.world.pos; +s32 BgMoriRakkatenjo_IsLinkUnder(BgMoriRakkatenjo* this, PlayState* play) { + Vec3f* pos = &GET_PLAYER(play)->actor.world.pos; return (-3300.0f < pos->z) && (pos->z < -1840.0f) && (1791.0f < pos->x) && (pos->x < 2191.0f); } -s32 BgMoriRakkatenjo_IsLinkClose(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { - Vec3f* pos = &GET_PLAYER(globalCtx)->actor.world.pos; +s32 BgMoriRakkatenjo_IsLinkClose(BgMoriRakkatenjo* this, PlayState* play) { + Vec3f* pos = &GET_PLAYER(play)->actor.world.pos; return (-3360.0f < pos->z) && (pos->z < -1840.0f) && (1791.0f < pos->x) && (pos->x < 2191.0f); } @@ -100,8 +100,8 @@ void BgMoriRakkatenjo_SetupWaitForMoriTex(BgMoriRakkatenjo* this) { this->actionFunc = BgMoriRakkatenjo_WaitForMoriTex; } -void BgMoriRakkatenjo_WaitForMoriTex(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { +void BgMoriRakkatenjo_WaitForMoriTex(BgMoriRakkatenjo* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) { BgMoriRakkatenjo_SetupWait(this); this->dyna.actor.draw = BgMoriRakkatenjo_Draw; } @@ -113,9 +113,9 @@ void BgMoriRakkatenjo_SetupWait(BgMoriRakkatenjo* this) { this->actionFunc = BgMoriRakkatenjo_Wait; } -void BgMoriRakkatenjo_Wait(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Wait(BgMoriRakkatenjo* this, PlayState* play) { if (this->fallCount == 0) { - if (BgMoriRakkatenjo_IsLinkClose(this, globalCtx) || (this->timer < 20)) { + if (BgMoriRakkatenjo_IsLinkClose(this, play) || (this->timer < 20)) { if (this->timer <= 0) { BgMoriRakkatenjo_SetupFall(this); } @@ -123,7 +123,7 @@ void BgMoriRakkatenjo_Wait(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { this->timer = 21; } } else { - if (BgMoriRakkatenjo_IsLinkUnder(this, globalCtx) || (this->timer < 20)) { + if (BgMoriRakkatenjo_IsLinkUnder(this, play) || (this->timer < 20)) { if (this->timer <= 0) { BgMoriRakkatenjo_SetupFall(this); } @@ -142,7 +142,7 @@ void BgMoriRakkatenjo_SetupFall(BgMoriRakkatenjo* this) { this->dyna.actor.velocity.y = 0.0f; } -void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, PlayState* play) { static f32 bounceVel[] = { 4.0f, 1.5f, 0.4f, 0.1f }; s32 pad; Actor* thisx = &this->dyna.actor; @@ -162,7 +162,7 @@ void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { 403.0f - (thisx->world.pos.y - 403.0f) * bounceVel[this->bounceCount] / fabsf(thisx->velocity.y); thisx->velocity.y = bounceVel[this->bounceCount]; this->bounceCount++; - quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 50000); Quake_SetQuakeValues(quake, 5, 0, 0, 0); Quake_SetCountdown(quake, 5); @@ -176,7 +176,7 @@ void BgMoriRakkatenjo_SetupRest(BgMoriRakkatenjo* this) { this->timer = 20; } -void BgMoriRakkatenjo_Rest(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Rest(BgMoriRakkatenjo* this, PlayState* play) { if (this->timer <= 0) { BgMoriRakkatenjo_SetupRise(this); } @@ -187,7 +187,7 @@ void BgMoriRakkatenjo_SetupRise(BgMoriRakkatenjo* this) { this->dyna.actor.velocity.y = -0.1f; } -void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, PlayState* play) { Math_SmoothStepToF(&this->dyna.actor.velocity.y, 5.0f, 0.06f, 0.1f, 0.0f); this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; if (this->dyna.actor.world.pos.y >= 683.0f) { @@ -195,41 +195,41 @@ void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { } } -void BgMoriRakkatenjo_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play) { s32 pad; BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx; if (this->timer > 0) { this->timer--; } - this->actionFunc(this, globalCtx); - if (BgMoriRakkatenjo_IsLinkUnder(this, globalCtx)) { + this->actionFunc(this, play); + if (BgMoriRakkatenjo_IsLinkUnder(this, play)) { if (sCamSetting == CAM_SET_NONE) { osSyncPrintf("camera changed (mori rakka tenjyo) ... \n"); - sCamSetting = globalCtx->cameraPtrs[CAM_ID_MAIN]->setting; - Camera_SetCameraData(globalCtx->cameraPtrs[CAM_ID_MAIN], 1, &this->dyna.actor, NULL, 0, 0, 0); - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FOREST_BIRDS_EYE); + sCamSetting = play->cameraPtrs[CAM_ID_MAIN]->setting; + Camera_SetCameraData(play->cameraPtrs[CAM_ID_MAIN], 1, &this->dyna.actor, NULL, 0, 0, 0); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_FOREST_BIRDS_EYE); } } else if (sCamSetting != CAM_SET_NONE) { osSyncPrintf("camera changed (previous) ... \n"); - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON1); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON1); sCamSetting = CAM_SET_NONE; } } -void BgMoriRakkatenjo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMoriRakkatenjo_Draw(Actor* thisx, PlayState* play) { s32 pad; BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 497); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 497); + func_80093D18(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 502), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 502), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMoriRakkatenjoDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 506); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 506); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h index 305e48a0a3..b263892f08 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h @@ -6,7 +6,7 @@ struct BgMoriRakkatenjo; -typedef void (*BgMoriRakkatenjoActionFunction)(struct BgMoriRakkatenjo*, GlobalContext*); +typedef void (*BgMoriRakkatenjoActionFunction)(struct BgMoriRakkatenjo*, PlayState*); typedef struct BgMoriRakkatenjo { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index 21f80b33f8..bcd9feddcd 100644 --- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -9,24 +9,24 @@ #define FLAGS 0 -void BgPoEvent_Init(Actor* thisx, GlobalContext* globalCtx); -void BgPoEvent_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgPoEvent_Update(Actor* thisx, GlobalContext* globalCtx); -void BgPoEvent_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgPoEvent_Init(Actor* thisx, PlayState* play); +void BgPoEvent_Destroy(Actor* thisx, PlayState* play); +void BgPoEvent_Update(Actor* thisx, PlayState* play); +void BgPoEvent_Draw(Actor* thisx, PlayState* play); -void BgPoEvent_BlockWait(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockShake(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockReset(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_BlockSolved(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_AmyWait(BgPoEvent* this, GlobalContext* globalCtx); // Amy is the green Poe -void BgPoEvent_AmyPuzzle(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_PaintingEmpty(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_PaintingAppear(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_PaintingPresent(BgPoEvent* this, GlobalContext* globalCtx); -void BgPoEvent_PaintingBurn(BgPoEvent* this, GlobalContext* globalCtx); +void BgPoEvent_BlockWait(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockShake(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockFall(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockPush(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockReset(BgPoEvent* this, PlayState* play); +void BgPoEvent_BlockSolved(BgPoEvent* this, PlayState* play); +void BgPoEvent_AmyWait(BgPoEvent* this, PlayState* play); // Amy is the green Poe +void BgPoEvent_AmyPuzzle(BgPoEvent* this, PlayState* play); +void BgPoEvent_PaintingEmpty(BgPoEvent* this, PlayState* play); +void BgPoEvent_PaintingAppear(BgPoEvent* this, PlayState* play); +void BgPoEvent_PaintingPresent(BgPoEvent* this, PlayState* play); +void BgPoEvent_PaintingBurn(BgPoEvent* this, PlayState* play); const ActorInit Bg_Po_Event_InitVars = { ACTOR_BG_PO_EVENT, @@ -84,7 +84,7 @@ static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; static u8 sPuzzleState; -void BgPoEvent_InitPaintings(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_InitPaintings(BgPoEvent* this, PlayState* play) { static s16 paintingPosX[] = { -1302, -866, 1421, 985 }; static s16 paintingPosY[] = { 1107, 1091 }; static s16 paintingPosZ[] = { -3384, -3252 }; @@ -121,7 +121,7 @@ void BgPoEvent_InitPaintings(BgPoEvent* this, GlobalContext* globalCtx) { } if ((this->type != 4) && (this->index != 2)) { phi_t2 = (this->type == 2) ? this->index : this->index + 2; - newPainting = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_PO_EVENT, + newPainting = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_PO_EVENT, paintingPosX[phi_t2], paintingPosY[this->index], paintingPosZ[this->index], 0, this->dyna.actor.shape.rot.y + 0x8000, 0, ((this->index + 1) << 0xC) + (this->type << 8) + this->dyna.actor.params); @@ -148,7 +148,7 @@ void BgPoEvent_InitPaintings(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_InitBlocks(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_InitBlocks(BgPoEvent* this, PlayState* play) { static s16 blockPosX[] = { 2149, 1969, 1909 }; static s16 blockPosZ[] = { -1410, -1350, -1530 }; Actor* newBlock; @@ -157,9 +157,9 @@ void BgPoEvent_InitBlocks(BgPoEvent* this, GlobalContext* globalCtx) { this->dyna.actor.flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5; CollisionHeader_GetVirtual(&gPoSistersAmyBlockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if ((this->type == 0) && (this->index != 3)) { - newBlock = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_PO_EVENT, + newBlock = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_PO_EVENT, blockPosX[this->index], this->dyna.actor.world.pos.y, blockPosZ[this->index], 0, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z - 0x4000, ((this->index + 1) << 0xC) + (this->type << 8) + this->dyna.actor.params); @@ -182,7 +182,7 @@ void BgPoEvent_InitBlocks(BgPoEvent* this, GlobalContext* globalCtx) { } } this->dyna.actor.world.pos.y = 833.0f; - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &bgId, + this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &this->dyna.actor.world.pos); this->actionFunc = BgPoEvent_BlockWait; } @@ -191,7 +191,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgPoEvent_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgPoEvent_Init(Actor* thisx, PlayState* play) { s32 pad; BgPoEvent* this = (BgPoEvent*)thisx; @@ -201,42 +201,42 @@ void BgPoEvent_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params &= 0x3F; if (this->type >= 2) { - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, thisx, &sTrisInit, this->colliderItems); - if (Flags_GetSwitch(globalCtx, thisx->params)) { + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); + if (Flags_GetSwitch(play, thisx->params)) { Actor_Kill(thisx); } else { - BgPoEvent_InitPaintings(this, globalCtx); + BgPoEvent_InitPaintings(this, play); } } else { DynaPolyActor_Init(&this->dyna, DPM_UNK); - if (Flags_GetSwitch(globalCtx, thisx->params)) { + if (Flags_GetSwitch(play, thisx->params)) { Actor_Kill(thisx); } else { - BgPoEvent_InitBlocks(this, globalCtx); + BgPoEvent_InitBlocks(this, play); } } } -void BgPoEvent_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgPoEvent_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgPoEvent* this = (BgPoEvent*)thisx; if (this->type >= 2) { - Collider_DestroyTris(globalCtx, &this->collider); + Collider_DestroyTris(play, &this->collider); } else { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->type == 1) && (gSaveContext.timer1Value > 0)) { gSaveContext.timer1State = 0xA; } } } -void BgPoEvent_BlockWait(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_BlockWait(BgPoEvent* this, PlayState* play) { this->dyna.actor.world.pos.y = 833.0f; if (sPuzzleState == 0x3F) { if (this->type == 1) { - OnePointCutscene_Init(globalCtx, 3150, 65, NULL, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3150, 65, NULL, CAM_ID_MAIN); } this->timer = 45; this->actionFunc = BgPoEvent_BlockShake; @@ -253,7 +253,7 @@ void BgPoEvent_BlockWait(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_BlockShake(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_BlockShake(BgPoEvent* this, PlayState* play) { DECR(this->timer); if (this->timer < 15) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + 2.0f * ((this->timer % 3) - 1); @@ -303,7 +303,7 @@ void BgPoEvent_CheckBlock(BgPoEvent* this) { } } -void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_BlockFall(BgPoEvent* this, PlayState* play) { static s32 firstFall = 0; this->dyna.actor.velocity.y++; @@ -315,12 +315,12 @@ void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx) { BgPoEvent_CheckBlock(this); } else { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - func_80033E88(&this->dyna.actor, globalCtx, 5, 5); + func_80033E88(&this->dyna.actor, play, 5, 5); func_80088B34(this->timer); if (firstFall == 0) { firstFall = 1; } else { - func_8002DF54(globalCtx, &GET_PLAYER(globalCtx)->actor, 7); + func_8002DF54(play, &GET_PLAYER(play)->actor, 7); } } this->direction = 0; @@ -328,19 +328,18 @@ void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* amy; if (sPuzzleState == 0xF) { this->actionFunc = BgPoEvent_BlockSolved; if ((this->type == 0) && (this->index == 0)) { - amy = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, this->dyna.actor.world.pos.x + 30.0f, - this->dyna.actor.world.pos.y - 30.0f, this->dyna.actor.world.pos.z + 30.0f, 0, - this->dyna.actor.shape.rot.y, 0, this->dyna.actor.params + 0x300); + amy = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->dyna.actor.world.pos.x + 30.0f, + this->dyna.actor.world.pos.y - 30.0f, this->dyna.actor.world.pos.z + 30.0f, 0, + this->dyna.actor.shape.rot.y, 0, this->dyna.actor.params + 0x300); if (amy != NULL) { - OnePointCutscene_Init(globalCtx, 3170, 30, amy, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3170, 30, amy, CAM_ID_MAIN); } func_80078884(NA_SE_SY_CORRECT_CHIME); gSaveContext.timer1State = 0xA; @@ -351,17 +350,17 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx) { sPuzzleState = 0x10; sBlocksAtRest = 0; } - if ((sPuzzleState == 0x40) || ((sPuzzleState == 0x10) && !Player_InCsMode(globalCtx))) { + if ((sPuzzleState == 0x40) || ((sPuzzleState == 0x10) && !Player_InCsMode(play))) { this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z; this->actionFunc = BgPoEvent_BlockReset; if (sPuzzleState == 0x10) { sPuzzleState = 0x40; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_RISING); - func_8002DF54(globalCtx, &player->actor, 8); + func_8002DF54(play, &player->actor, 8); } } else if (this->dyna.unk_150 != 0.0f) { if (this->direction == 0) { - if (func_800435D8(globalCtx, &this->dyna, 0x1E, 0x32, -0x14) != 0) { + if (func_800435D8(play, &this->dyna, 0x1E, 0x32, -0x14) != 0) { sBlocksAtRest--; this->direction = (this->dyna.unk_150 >= 0.0f) ? 1.0f : -1.0f; this->actionFunc = BgPoEvent_BlockPush; @@ -380,11 +379,11 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_BlockPush(BgPoEvent* this, PlayState* play) { static f32 blockPushDist = 0.0f; f32 displacement; s32 blockStop; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->dyna.actor.speedXZ += 0.1f; this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f); @@ -394,7 +393,7 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.z; if (blockStop) { player->stateFlags2 &= ~PLAYER_STATE2_4; - if ((this->dyna.unk_150 > 0.0f) && (func_800435D8(globalCtx, &this->dyna, 0x1E, 0x32, -0x14) == 0)) { + if ((this->dyna.unk_150 > 0.0f) && (func_800435D8(play, &this->dyna, 0x1E, 0x32, -0x14) == 0)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } this->dyna.unk_150 = 0.0f; @@ -414,8 +413,8 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void BgPoEvent_BlockReset(BgPoEvent* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgPoEvent_BlockReset(BgPoEvent* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~PLAYER_STATE2_4; @@ -434,8 +433,8 @@ void BgPoEvent_BlockReset(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_BlockSolved(BgPoEvent* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgPoEvent_BlockSolved(BgPoEvent* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~PLAYER_STATE2_4; @@ -446,7 +445,7 @@ void BgPoEvent_BlockSolved(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_AmyWait(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_AmyWait(BgPoEvent* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { sPuzzleState |= 0x20; this->timer = 5; @@ -456,14 +455,14 @@ void BgPoEvent_AmyWait(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_AmyPuzzle(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_AmyPuzzle(BgPoEvent* this, PlayState* play) { Vec3f pos; if (sPuzzleState == 0xF) { pos.x = this->dyna.actor.world.pos.x - 5.0f; pos.y = Rand_CenteredFloat(120.0f) + this->dyna.actor.world.pos.y; pos.z = Rand_CenteredFloat(120.0f) + this->dyna.actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &sZeroVec, &sZeroVec, 170, 0, 200, 255, 100, 170, 0, 255, 0, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &sZeroVec, &sZeroVec, 170, 0, 200, 255, 100, 170, 0, 255, 0, 1, 9, true); } else if (sPuzzleState == 0x20) { Actor_Kill(&this->dyna.actor); } else { @@ -488,14 +487,14 @@ s32 BgPoEvent_NextPainting(BgPoEvent* this) { return true; } -void BgPoEvent_PaintingEmpty(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_PaintingEmpty(BgPoEvent* this, PlayState* play) { if (sPuzzleState == this->index) { this->timer = 255; this->actionFunc = BgPoEvent_PaintingAppear; } } -void BgPoEvent_PaintingAppear(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_PaintingAppear(BgPoEvent* this, PlayState* play) { this->timer -= 20; if (this->timer <= 0) { this->timer = 1000; @@ -503,7 +502,7 @@ void BgPoEvent_PaintingAppear(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_PaintingVanish(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_PaintingVanish(BgPoEvent* this, PlayState* play) { this->timer += 20; if (this->timer >= 255) { BgPoEvent_NextPainting(this); @@ -511,16 +510,16 @@ void BgPoEvent_PaintingVanish(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_PaintingPresent(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_PaintingPresent(BgPoEvent* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); DECR(this->timer); if (((this->timer == 0) || ((thisx->xzDistToPlayer < 150.0f) && (thisx->yDistToPlayer < 50.0f)) || (func_8002DD78(player) && (thisx->xzDistToPlayer < 320.0f) && ((this->index != 2) ? (thisx->yDistToPlayer < 100.0f) : (thisx->yDistToPlayer < 0.0f)) && - Player_IsFacingActor(thisx, 0x2000, globalCtx))) && + Player_IsFacingActor(thisx, 0x2000, play))) && ((thisx->parent != NULL) || (thisx->child != NULL))) { /*The third condition in the || is checking if 1) Link is holding a ranged weapon @@ -533,15 +532,14 @@ void BgPoEvent_PaintingPresent(BgPoEvent* this, GlobalContext* globalCtx) { this->actionFunc = BgPoEvent_PaintingVanish; } else if (this->collider.base.acFlags & AC_HIT) { if (!BgPoEvent_NextPainting(this)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, thisx->world.pos.x, - thisx->world.pos.y - 40.0f, thisx->world.pos.z, 0, thisx->shape.rot.y, 0, - thisx->params + ((this->type - 1) << 8)); - OnePointCutscene_Init(globalCtx, 3160, 80, thisx, CAM_ID_MAIN); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, thisx->world.pos.x, thisx->world.pos.y - 40.0f, + thisx->world.pos.z, 0, thisx->shape.rot.y, 0, thisx->params + ((this->type - 1) << 8)); + OnePointCutscene_Init(play, 3160, 80, thisx, CAM_ID_MAIN); func_80078884(NA_SE_SY_CORRECT_CHIME); } else { Audio_PlayActorSound2(thisx, NA_SE_EN_PO_LAUGH2); - OnePointCutscene_Init(globalCtx, 3160, 35, thisx, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3160, 35, thisx, CAM_ID_MAIN); } if (thisx->parent != NULL) { thisx->parent->child = NULL; @@ -556,7 +554,7 @@ void BgPoEvent_PaintingPresent(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_PaintingBurn(BgPoEvent* this, GlobalContext* globalCtx) { +void BgPoEvent_PaintingBurn(BgPoEvent* this, PlayState* play) { Vec3f sp54; this->timer--; @@ -565,10 +563,9 @@ void BgPoEvent_PaintingBurn(BgPoEvent* this, GlobalContext* globalCtx) { sp54.z = Rand_CenteredFloat(50.0f) + this->dyna.actor.world.pos.z; if (this->timer >= 0) { if (this->type == 2) { - EffectSsDeadDb_Spawn(globalCtx, &sp54, &sZeroVec, &sZeroVec, 100, 0, 255, 255, 150, 170, 255, 0, 0, 1, 9, - true); + EffectSsDeadDb_Spawn(play, &sp54, &sZeroVec, &sZeroVec, 100, 0, 255, 255, 150, 170, 255, 0, 0, 1, 9, true); } else { - EffectSsDeadDb_Spawn(globalCtx, &sp54, &sZeroVec, &sZeroVec, 100, 0, 200, 255, 255, 170, 50, 100, 255, 1, 9, + EffectSsDeadDb_Spawn(play, &sp54, &sZeroVec, &sZeroVec, 100, 0, 200, 255, 255, 170, 50, 100, 255, 1, 9, true); } } @@ -580,17 +577,17 @@ void BgPoEvent_PaintingBurn(BgPoEvent* this, GlobalContext* globalCtx) { } } -void BgPoEvent_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgPoEvent_Update(Actor* thisx, PlayState* play) { s32 pad; BgPoEvent* this = (BgPoEvent*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actionFunc == BgPoEvent_AmyWait) || (this->actionFunc == BgPoEvent_PaintingPresent)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgPoEvent_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgPoEvent_Draw(Actor* thisx, PlayState* play) { static Gfx* displayLists[] = { gPoSistersAmyBlockDL, gPoSistersAmyBethBlockDL, gPoSistersJoellePaintingDL, gPoSistersBethPaintingDL, gPoSistersAmyPaintingDL, @@ -603,8 +600,8 @@ void BgPoEvent_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 sp48; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_po_event.c", 1481); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_po_event.c", 1481); + func_80093D18(play->state.gfxCtx); if ((this->type == 3) || (this->type == 2)) { if (this->actionFunc == BgPoEvent_PaintingEmpty) { alpha = 255; @@ -615,10 +612,10 @@ void BgPoEvent_Draw(Actor* thisx, GlobalContext* globalCtx) { } gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, alpha); } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_po_event.c", 1501), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_po_event.c", 1501), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, displayLists[this->type]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_po_event.c", 1508); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_po_event.c", 1508); if ((this->type == 0) || (this->type == 1)) { sp48 = (833.0f - this->dyna.actor.world.pos.y) * 0.0025f; @@ -628,7 +625,7 @@ void BgPoEvent_Draw(Actor* thisx, GlobalContext* globalCtx) { sp58.z = this->dyna.actor.world.pos.z; sp4C.y = 1.0f; sp4C.x = sp4C.z = (sp48 * 0.3f) + 0.4f; - func_80033C30(&sp58, &sp4C, (u8)(155.0f + sp48 * 100.0f), globalCtx); + func_80033C30(&sp58, &sp4C, (u8)(155.0f + sp48 * 100.0f), play); } } } diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h index 3023774f94..412c187227 100644 --- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h +++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h @@ -6,7 +6,7 @@ struct BgPoEvent; -typedef void (*BgPoEventActionFunc)(struct BgPoEvent*, GlobalContext*); +typedef void (*BgPoEventActionFunc)(struct BgPoEvent*, PlayState*); typedef struct BgPoEvent { /* 0x0000 */ DynaPolyActor dyna; 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 a39eb4b196..213719b021 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,10 +19,10 @@ typedef enum { #define POE_TORCH_FLAG 0x1C -void BgPoSyokudai_Init(Actor* thisx, GlobalContext* globalCtx); -void BgPoSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgPoSyokudai_Update(Actor* thisx, GlobalContext* globalCtx); -void BgPoSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx); +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 = { { @@ -74,7 +74,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgPoSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgPoSyokudai_Init(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; s32 pad; @@ -85,78 +85,76 @@ void BgPoSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->colChkInfo.mass = MASS_IMMOVABLE; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + 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(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + 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(globalCtx, POE_TORCH_FLAG + POE_FLAME_GREEN) && - Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_BLUE) && - Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_RED) && !Flags_GetSwitch(globalCtx, thisx->params)) { + 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(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, 119.0f, 225.0f, -1566.0f, 0, 0, 0, - thisx->params); - globalCtx->envCtx.lightSettingOverride = 4; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, 119.0f, 225.0f, -1566.0f, 0, 0, 0, thisx->params); + play->envCtx.lightSettingOverride = 4; - } else if (!Flags_GetSwitch(globalCtx, POE_TORCH_FLAG + POE_FLAME_PURPLE) && !Flags_GetSwitch(globalCtx, 0x1B)) { + } else if (!Flags_GetSwitch(play, POE_TORCH_FLAG + POE_FLAME_PURPLE) && !Flags_GetSwitch(play, 0x1B)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, 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); + 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(globalCtx, thisx->params)) { - if (globalCtx->envCtx.lightSettingOverride == LIGHT_SETTING_OVERRIDE_NONE) { - globalCtx->envCtx.lightSettingOverride = 4; + } 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); } -void BgPoSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgPoSyokudai_Destroy(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyCylinder(globalCtx, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); - if (globalCtx->envCtx.lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE) { - globalCtx->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; + if (play->envCtx.lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE) { + play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; } } -void BgPoSyokudai_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgPoSyokudai_Update(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; s32 pad; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + if (Flags_GetSwitch(play, this->actor.params)) { func_8002F974(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } this->flameTextureScroll++; } -void BgPoSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgPoSyokudai_Draw(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; f32 lightBrightness; u8 red; u8 green; u8 blue; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_po_syokudai.c", 315); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_po_syokudai.c", 315); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_po_syokudai.c", 319), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_po_syokudai.c", 319), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoldenTorchDL); - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { Color_RGBA8* primColor = &sPrimColors[this->flameColor]; Color_RGBA8* envColor = &sEnvColors[this->flameColor]; @@ -168,23 +166,23 @@ void BgPoSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { Lights_PointSetColorAndRadius(&this->lightInfo, red, green, blue, 200); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - (this->flameTextureScroll * -20) & 0x1FF, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 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); Matrix_Translate(0.0f, 52.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateY( - BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - 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); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_po_syokudai.c", 368), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_po_syokudai.c", 368), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_po_syokudai.c", 373); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_po_syokudai.c", 373); } 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 23dd282ba5..fb19700810 100644 --- a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c +++ b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c @@ -9,12 +9,12 @@ #define FLAGS 0 -void BgPushbox_Init(Actor* thisx, GlobalContext* globalCtx); -void BgPushbox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgPushbox_Update(Actor* thisx, GlobalContext* globalCtx); -void BgPushbox_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgPushbox_Init(Actor* thisx, PlayState* play); +void BgPushbox_Destroy(Actor* thisx, PlayState* play); +void BgPushbox_Update(Actor* thisx, PlayState* play); +void BgPushbox_Draw(Actor* thisx, PlayState* play); -void BgPushbox_UpdateImpl(BgPushbox* this, GlobalContext* globalCtx); +void BgPushbox_UpdateImpl(BgPushbox* this, PlayState* play); const ActorInit Bg_Pushbox_InitVars = { ACTOR_BG_PUSHBOX, @@ -37,7 +37,7 @@ void BgPushbox_SetupAction(BgPushbox* this, BgPushboxActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgPushbox_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgPushbox_Init(Actor* thisx, PlayState* play) { s32 pad; BgPushbox* this = (BgPushbox*)thisx; CollisionHeader* colHeader = NULL; @@ -46,18 +46,18 @@ void BgPushbox_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gBlockSmallCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, 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); BgPushbox_SetupAction(this, BgPushbox_UpdateImpl); } -void BgPushbox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgPushbox_Destroy(Actor* thisx, PlayState* play) { BgPushbox* this = (BgPushbox*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgPushbox_UpdateImpl(BgPushbox* this, GlobalContext* globalCtx) { +void BgPushbox_UpdateImpl(BgPushbox* this, PlayState* play) { this->dyna.actor.speedXZ += this->dyna.unk_150 * 0.2f; this->dyna.actor.speedXZ = (this->dyna.actor.speedXZ < -1.0f) ? -1.0f @@ -65,27 +65,27 @@ void BgPushbox_UpdateImpl(BgPushbox* this, GlobalContext* globalCtx) { Math_StepToF(&this->dyna.actor.speedXZ, 0.0f, 0.2f); this->dyna.actor.world.rot.y = this->dyna.unk_158; Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 20.0f, 40.0f, 40.0f, + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 40.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } -void BgPushbox_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgPushbox_Update(Actor* thisx, PlayState* play) { BgPushbox* this = (BgPushbox*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_8002DF90(&this->dyna); } -void BgPushbox_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgPushbox_Draw(Actor* thisx, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 263); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_pushbox.c", 263); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 269), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_pushbox.c", 269), G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gBlockSmallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 272); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_pushbox.c", 272); } diff --git a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h index 31b8aac83b..577ebaabb6 100644 --- a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h +++ b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h @@ -6,7 +6,7 @@ struct BgPushbox; -typedef void (*BgPushboxActionFunc)(struct BgPushbox*, GlobalContext*); +typedef void (*BgPushboxActionFunc)(struct BgPushbox*, PlayState*); typedef struct BgPushbox { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index 8e7754adce..30d9757852 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -14,17 +14,17 @@ typedef enum { /* 1 */ WINDMILL_DAMPE_STONE_DOOR } WindmillSetpiecesMode; -void BgRelayObjects_Init(Actor* thisx, GlobalContext* globalCtx); -void BgRelayObjects_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgRelayObjects_Update(Actor* thisx, GlobalContext* globalCtx); -void BgRelayObjects_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgRelayObjects_Init(Actor* thisx, PlayState* play); +void BgRelayObjects_Destroy(Actor* thisx, PlayState* play); +void BgRelayObjects_Update(Actor* thisx, PlayState* play); +void BgRelayObjects_Draw(Actor* thisx, PlayState* play); -void func_808A90F4(BgRelayObjects* this, GlobalContext* globalCtx); -void func_808A91AC(BgRelayObjects* this, GlobalContext* globalCtx); -void func_808A9234(BgRelayObjects* this, GlobalContext* globalCtx); -void BgRelayObjects_DoNothing(BgRelayObjects* this, GlobalContext* globalCtx); -void func_808A932C(BgRelayObjects* this, GlobalContext* globalCtx); -void func_808A939C(BgRelayObjects* this, GlobalContext* globalCtx); +void func_808A90F4(BgRelayObjects* this, PlayState* play); +void func_808A91AC(BgRelayObjects* this, PlayState* play); +void func_808A9234(BgRelayObjects* this, PlayState* play); +void BgRelayObjects_DoNothing(BgRelayObjects* this, PlayState* play); +void func_808A932C(BgRelayObjects* this, PlayState* play); +void func_808A939C(BgRelayObjects* this, PlayState* play); const ActorInit Bg_Relay_Objects_InitVars = { ACTOR_BG_RELAY_OBJECTS, @@ -43,7 +43,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgRelayObjects_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgRelayObjects_Init(Actor* thisx, PlayState* play) { static u32 D_808A9508 = 0; BgRelayObjects* this = (BgRelayObjects*)thisx; s32 pad; @@ -87,7 +87,7 @@ void BgRelayObjects_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgRelayObjects_DoNothing; } } else if (this->unk_169 != 5) { - Flags_UnsetSwitch(globalCtx, this->switchFlag); + Flags_UnsetSwitch(play, this->switchFlag); if (D_808A9508 & (1 << this->unk_169)) { Actor_Kill(thisx); } else { @@ -95,26 +95,26 @@ void BgRelayObjects_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808A90F4; } } else { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); this->actionFunc = func_808A91AC; thisx->world.pos.y += 120.0f; D_808A9508 |= 1; } } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } -void BgRelayObjects_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgRelayObjects_Destroy(Actor* thisx, PlayState* play) { BgRelayObjects* this = (BgRelayObjects*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->dyna.actor.params == WINDMILL_ROTATING_GEAR) && (gSaveContext.cutsceneIndex < 0xFFF0)) { CLEAR_EVENTCHKINF(EVENTCHKINF_65); } } -void func_808A90F4(BgRelayObjects* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +void func_808A90F4(BgRelayObjects* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { if (this->timer != 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); if (INV_CONTENT(ITEM_HOOKSHOT) != ITEM_NONE) { @@ -129,57 +129,57 @@ void func_808A90F4(BgRelayObjects* this, GlobalContext* globalCtx) { } } -void func_808A91AC(BgRelayObjects* this, GlobalContext* globalCtx) { +void func_808A91AC(BgRelayObjects* this, PlayState* play) { if (this->unk_169 != 5) { if (this->timer != 0) { this->timer--; } func_8002F994(&this->dyna.actor, this->timer); } - if ((this->timer == 0) || (this->unk_169 == globalCtx->roomCtx.curRoom.num)) { + if ((this->timer == 0) || (this->unk_169 == play->roomCtx.curRoom.num)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_CLOSE); this->actionFunc = func_808A9234; } } -void func_808A9234(BgRelayObjects* this, GlobalContext* globalCtx) { +void func_808A9234(BgRelayObjects* this, PlayState* play) { this->dyna.actor.velocity.y += this->dyna.actor.gravity; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 180, 20, 100); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - if (this->unk_169 != globalCtx->roomCtx.curRoom.num) { + if (this->unk_169 != play->roomCtx.curRoom.num) { func_800788CC(NA_SE_EN_PO_LAUGH); this->timer = 5; this->actionFunc = func_808A932C; return; } - Flags_UnsetSwitch(globalCtx, this->switchFlag); + Flags_UnsetSwitch(play, this->switchFlag); this->dyna.actor.flags &= ~ACTOR_FLAG_4; - if (globalCtx->roomCtx.curRoom.num == 4) { + if (play->roomCtx.curRoom.num == 4) { gSaveContext.timer1State = 0xF; } this->actionFunc = BgRelayObjects_DoNothing; } } -void BgRelayObjects_DoNothing(BgRelayObjects* this, GlobalContext* globalCtx) { +void BgRelayObjects_DoNothing(BgRelayObjects* this, PlayState* play) { } -void func_808A932C(BgRelayObjects* this, GlobalContext* globalCtx) { +void func_808A932C(BgRelayObjects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { func_80078884(NA_SE_OC_ABYSS); - Play_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); this->actionFunc = BgRelayObjects_DoNothing; } } } -void func_808A939C(BgRelayObjects* this, GlobalContext* globalCtx) { - if (Flags_GetEnv(globalCtx, 5)) { +void func_808A939C(BgRelayObjects* this, PlayState* play) { + if (Flags_GetEnv(play, 5)) { SET_EVENTCHKINF(EVENTCHKINF_65); } if (GET_EVENTCHKINF(EVENTCHKINF_65)) { @@ -192,18 +192,18 @@ void func_808A939C(BgRelayObjects* this, GlobalContext* globalCtx) { ((this->dyna.actor.world.rot.y - 0x80) * (1.0f / 0x380)) + 1.0f); } -void BgRelayObjects_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgRelayObjects_Update(Actor* thisx, PlayState* play) { BgRelayObjects* this = (BgRelayObjects*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgRelayObjects_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgRelayObjects_Draw(Actor* thisx, PlayState* play) { BgRelayObjects* this = (BgRelayObjects*)thisx; if (this->dyna.actor.params == WINDMILL_ROTATING_GEAR) { - Gfx_DrawDListOpa(globalCtx, gWindmillRotatingPlatformDL); + Gfx_DrawDListOpa(play, gWindmillRotatingPlatformDL); } else { - Gfx_DrawDListOpa(globalCtx, gDampeRaceDoorDL); + Gfx_DrawDListOpa(play, gDampeRaceDoorDL); } } diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h index fa39ad76cd..802d840649 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h @@ -6,7 +6,7 @@ struct BgRelayObjects; -typedef void (*BgRelayObjectsActionFunc)(struct BgRelayObjects*, GlobalContext*); +typedef void (*BgRelayObjectsActionFunc)(struct BgRelayObjects*, PlayState*); typedef struct BgRelayObjects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c index f4e0fc19b2..4884a3d04e 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgSpot00Break_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Break_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Break_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Break_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot00Break_Init(Actor* thisx, PlayState* play); +void BgSpot00Break_Destroy(Actor* thisx, PlayState* play); +void BgSpot00Break_Update(Actor* thisx, PlayState* play); +void BgSpot00Break_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Spot00_Break_InitVars = { ACTOR_BG_SPOT00_BREAK, @@ -33,7 +33,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgSpot00Break_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Break_Init(Actor* thisx, PlayState* play) { BgSpot00Break* this = (BgSpot00Break*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -47,28 +47,28 @@ void BgSpot00Break_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gBrokenDrawbridgeCol, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (!LINK_IS_ADULT) { Actor_Kill(&this->dyna.actor); } } -void BgSpot00Break_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Break_Destroy(Actor* thisx, PlayState* play) { BgSpot00Break* this = (BgSpot00Break*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgSpot00Break_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Break_Update(Actor* thisx, PlayState* play) { } -void BgSpot00Break_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Break_Draw(Actor* thisx, PlayState* play) { BgSpot00Break* this = (BgSpot00Break*)thisx; if (this->dyna.actor.params == 1) { - Gfx_DrawDListOpa(globalCtx, gBarbedWireFenceDL); + Gfx_DrawDListOpa(play, gBarbedWireFenceDL); } else { - Gfx_DrawDListOpa(globalCtx, gBrokenDrawbridgeDL); + Gfx_DrawDListOpa(play, gBrokenDrawbridgeDL); } } 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 84079a62f0..4bf32ca72f 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 @@ -16,14 +16,14 @@ typedef enum { /* 1 */ DT_CHAIN_2 } DrawbridgeType; -void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Hanebasi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Hanebasi_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot00Hanebasi_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot00Hanebasi_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); -void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, GlobalContext* globalCtx); -void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, GlobalContext* globalCtx); +void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play); +void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, PlayState* play); +void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, PlayState* play); const ActorInit Bg_Spot00_Hanebasi_InitVars = { ACTOR_BG_SPOT00_HANEBASI, @@ -46,7 +46,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_Init(Actor* thisx, PlayState* play) { BgSpot00Hanebasi* this = (BgSpot00Hanebasi*)thisx; s32 pad; Vec3f chainPos; @@ -61,7 +61,7 @@ void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gHyruleFieldCastleDrawbridgeChainsCol, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.actor.params == DT_DRAWBRIDGE) { if (LINK_IS_ADULT && (gSaveContext.sceneSetupIndex < 4)) { @@ -93,7 +93,7 @@ void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) { chainPos.z = (-158.0f * Math_SinS(this->dyna.actor.shape.rot.y)) + (Math_CosS(this->dyna.actor.shape.rot.y) * chainPos.z); - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_SPOT00_HANEBASI, + if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_SPOT00_HANEBASI, this->dyna.actor.world.pos.x + chainPos.x, this->dyna.actor.world.pos.y + chainPos.y, this->dyna.actor.world.pos.z + chainPos.z, ((this->dyna.actor.shape.rot.x == 0) ? 0 : 0xF020), this->dyna.actor.shape.rot.y, 0, @@ -104,7 +104,7 @@ void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgSpot00Hanebasi_DrawbridgeWait; this->destAngle = 40; } else if (this->dyna.actor.params == DT_CHAIN_1) { - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_SPOT00_HANEBASI, + if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_SPOT00_HANEBASI, this->dyna.actor.world.pos.x - (Math_CosS(this->dyna.actor.shape.rot.y) * 316.0f), this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z + (Math_SinS(this->dyna.actor.shape.rot.y) * 316.0f), @@ -119,30 +119,30 @@ void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->dyna.actor.params >= DT_CHAIN_1) { - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointGlowSetInfo(&this->lightInfo, ((this->dyna.actor.params == DT_CHAIN_1) ? 260.0f : -260.0f), 168, 690, 255, 255, 0, 0); } } -void BgSpot00Hanebasi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_Destroy(Actor* thisx, PlayState* play) { BgSpot00Hanebasi* this = (BgSpot00Hanebasi*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if (this->dyna.actor.params >= DT_CHAIN_1) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } } -void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play) { BgSpot00Hanebasi* child = (BgSpot00Hanebasi*)this->dyna.actor.child; if ((gSaveContext.sceneSetupIndex >= 4) || !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) || !CHECK_QUEST_ITEM(QUEST_GORON_RUBY) || !CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) || GET_EVENTCHKINF(EVENTCHKINF_80)) { if (this->dyna.actor.shape.rot.x != 0) { - if (Flags_GetEnv(globalCtx, 0) || ((gSaveContext.sceneSetupIndex < 4) && IS_DAY)) { + if (Flags_GetEnv(play, 0) || ((gSaveContext.sceneSetupIndex < 4) && IS_DAY)) { this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; this->destAngle = 0; child->destAngle = 0; @@ -159,10 +159,10 @@ void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, GlobalContext* glob } } -void BgSpot00Hanebasi_DoNothing(BgSpot00Hanebasi* this, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_DoNothing(BgSpot00Hanebasi* this, PlayState* play) { } -void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, PlayState* play) { BgSpot00Hanebasi* child; Actor* childsChild; s16 angle = 80; @@ -194,7 +194,7 @@ void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, GlobalContex } } -void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, PlayState* play) { u8 lightColor = (u8)(Rand_ZeroOne() * 127.0f) + 128; // intensity of the red and green channels Lights_PointGlowSetInfo(&this->lightInfo, (this->dyna.actor.params == DT_CHAIN_1) ? 260.0f : -260.0f, @@ -202,31 +202,31 @@ void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, GlobalContext* g sTorchFlameScale * 37500.0f); } -void BgSpot00Hanebasi_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { BgSpot00Hanebasi* this = (BgSpot00Hanebasi*)thisx; s32 pad; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->dyna.actor.params == DT_DRAWBRIDGE) { - if (globalCtx->sceneNum == SCENE_SPOT00) { + if (play->sceneNum == SCENE_SPOT00) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) && !GET_EVENTCHKINF(EVENTCHKINF_80) && LINK_IS_CHILD) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((player->actor.world.pos.x > -450.0f) && (player->actor.world.pos.x < 450.0f) && (player->actor.world.pos.z > 1080.0f) && (player->actor.world.pos.z < 1700.0f) && - (!(Play_InCsMode(globalCtx)))) { + (!(Play_InCsMode(play)))) { SET_EVENTCHKINF(EVENTCHKINF_80); Flags_SetEventChkInf(EVENTCHKINF_82); this->actionFunc = BgSpot00Hanebasi_DoNothing; - func_8002DF54(globalCtx, &player->actor, 8); - globalCtx->nextEntranceIndex = ENTR_SPOT00_0; + func_8002DF54(play, &player->actor, 8); + play->nextEntranceIndex = ENTR_SPOT00_0; gSaveContext.nextCutsceneIndex = 0xFFF1; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; } else if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 3000.0f, 0x7530)) { - globalCtx->envCtx.stormRequest = STORM_REQUEST_START; + play->envCtx.stormRequest = STORM_REQUEST_START; } } } @@ -254,14 +254,14 @@ void BgSpot00Hanebasi_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgSpot00Hanebasi_DrawTorches(Actor* thisx, PlayState* play2) { + PlayState* play = play2; f32 angle; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 633); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 633); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (gSaveContext.sceneSetupIndex >= 4) { sTorchFlameScale = 0.008f; @@ -269,36 +269,36 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { sTorchFlameScale = ((thisx->shape.rot.x * -1) - 0x2000) * (1.0f / 1024000.0f); } - angle = BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000)); + angle = BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000)); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); for (i = 0; i < 2; i++) { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - ((globalCtx->gameplayFrames + i) * -20) & 0x1FF, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, + ((play->gameplayFrames + i) * -20) & 0x1FF, 32, 128)); Matrix_Translate((i == 0) ? 260.0f : -260.0f, 128.0f, 690.0f, MTXMODE_NEW); Matrix_RotateY(angle, MTXMODE_APPLY); Matrix_Scale(sTorchFlameScale, sTorchFlameScale, sTorchFlameScale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 674), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 674), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 681); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 681); } -void BgSpot00Hanebasi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot00Hanebasi_Draw(Actor* thisx, PlayState* play) { Vec3f basePos = { 158.0f, 10.0f, 400.0f }; Vec3f newPos; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 698); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 698); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 702), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 702), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (thisx->params == DT_DRAWBRIDGE) { @@ -317,7 +317,7 @@ void BgSpot00Hanebasi_Draw(Actor* thisx, GlobalContext* globalCtx) { if (gSaveContext.sceneSetupIndex != 12) { if ((gSaveContext.sceneSetupIndex >= 4) || (!LINK_IS_ADULT && (thisx->shape.rot.x < -0x2000))) { - BgSpot00Hanebasi_DrawTorches(thisx, globalCtx); + BgSpot00Hanebasi_DrawTorches(thisx, play); } else { sTorchFlameScale = 0.0f; } @@ -326,5 +326,5 @@ void BgSpot00Hanebasi_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gHyruleFieldCastleDrawbridgeChainsDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 733); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot00_hanebasi.c", 733); } diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h index 71d41f9ad2..fc6427ae82 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h @@ -6,7 +6,7 @@ struct BgSpot00Hanebasi; -typedef void (*BgSpot00HanebasiActionFunc)(struct BgSpot00Hanebasi*, GlobalContext*); +typedef void (*BgSpot00HanebasiActionFunc)(struct BgSpot00Hanebasi*, PlayState*); typedef struct BgSpot00Hanebasi { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c index 6a66687769..549c36b211 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c @@ -9,12 +9,12 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot01Fusya_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Fusya_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Fusya_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Fusya_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot01Fusya_Init(Actor* thisx, PlayState* play); +void BgSpot01Fusya_Destroy(Actor* thisx, PlayState* play); +void BgSpot01Fusya_Update(Actor* thisx, PlayState* play); +void BgSpot01Fusya_Draw(Actor* thisx, PlayState* play); -void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx); +void func_808AAA50(BgSpot01Fusya* this, PlayState* play); const ActorInit Bg_Spot01_Fusya_InitVars = { ACTOR_BG_SPOT01_FUSYA, @@ -39,7 +39,7 @@ void BgSpot01Fusya_SetupAction(BgSpot01Fusya* this, BgSpot01FusyaActionFunc acti this->actionFunc = actionFunc; } -void BgSpot01Fusya_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Fusya_Init(Actor* thisx, PlayState* play) { BgSpot01Fusya* this = (BgSpot01Fusya*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -52,10 +52,10 @@ void BgSpot01Fusya_Init(Actor* thisx, GlobalContext* globalCtx) { BgSpot01Fusya_SetupAction(this, func_808AAA50); } -void BgSpot01Fusya_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Fusya_Destroy(Actor* thisx, PlayState* play) { } -void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx) { +void func_808AAA50(BgSpot01Fusya* this, PlayState* play) { f32 temp; Actor* thisx = &this->actor; @@ -68,20 +68,20 @@ void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_154, this->unk_158, this->unk_15C, 100.0f); } -void BgSpot01Fusya_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Fusya_Update(Actor* thisx, PlayState* play) { BgSpot01Fusya* this = (BgSpot01Fusya*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot01Fusya_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_fusya.c", 210); +void BgSpot01Fusya_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot01_fusya.c", 210); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot01_fusya.c", 214), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot01_fusya.c", 214), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gKakarikoWindmillSailsDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_fusya.c", 219); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot01_fusya.c", 219); } diff --git a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h index ba0ece2727..1e7a831316 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h @@ -6,7 +6,7 @@ struct BgSpot01Fusya; -typedef void (*BgSpot01FusyaActionFunc)(struct BgSpot01Fusya*, GlobalContext*); +typedef void (*BgSpot01FusyaActionFunc)(struct BgSpot01Fusya*, PlayState*); typedef struct BgSpot01Fusya { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c index 690565c0b9..982de6de13 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c @@ -10,16 +10,16 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot01Idohashira_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idohashira_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idohashira_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idohashira_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot01Idohashira_Init(Actor* thisx, PlayState* play); +void BgSpot01Idohashira_Destroy(Actor* thisx, PlayState* play); +void BgSpot01Idohashira_Update(Actor* thisx, PlayState* play); +void BgSpot01Idohashira_Draw(Actor* thisx, PlayState* play); -void func_808AB504(BgSpot01Idohashira* this, GlobalContext* globalCtx); -void func_808AB510(BgSpot01Idohashira* this, GlobalContext* globalCtx); -void func_808AB530(BgSpot01Idohashira* this, GlobalContext* globalCtx); -void func_808AB570(BgSpot01Idohashira* this, GlobalContext* globalCtx); -void func_808AB700(BgSpot01Idohashira* this, GlobalContext* globalCtx); +void func_808AB504(BgSpot01Idohashira* this, PlayState* play); +void func_808AB510(BgSpot01Idohashira* this, PlayState* play); +void func_808AB530(BgSpot01Idohashira* this, PlayState* play); +void func_808AB570(BgSpot01Idohashira* this, PlayState* play); +void func_808AB700(BgSpot01Idohashira* this, PlayState* play); static BgSpot01IdohashiraActionFunc sActionFuncs[] = { func_808AB504, @@ -52,11 +52,11 @@ void BgSpot01Idohashira_PlayBreakSfx1(BgSpot01Idohashira* this) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_BOX_BREAK); } -void BgSpot01Idohashira_PlayBreakSfx2(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 60, NA_SE_EV_WOODBOX_BREAK); +void BgSpot01Idohashira_PlayBreakSfx2(BgSpot01Idohashira* this, PlayState* play) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 60, NA_SE_EV_WOODBOX_BREAK); } -void func_808AAD3C(GlobalContext* globalCtx, Vec3f* vec, u32 arg2) { +void func_808AAD3C(PlayState* play, Vec3f* vec, u32 arg2) { EffectSparkInit effect; s32 sp24; @@ -102,20 +102,20 @@ void func_808AAD3C(GlobalContext* globalCtx, Vec3f* vec, u32 arg2) { effect.timer = 0; effect.duration = 32; - Effect_Add(globalCtx, &sp24, EFFECT_SPARK, 0, 1, &effect); + Effect_Add(play, &sp24, EFFECT_SPARK, 0, 1, &effect); } -void func_808AAE6C(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +void func_808AAE6C(BgSpot01Idohashira* this, PlayState* play) { s32 pad; Vec3f sp30 = this->dyna.actor.world.pos; sp30.y += kREG(15); - func_80033480(globalCtx, &sp30, kREG(11) + 350.0f, kREG(12) + 5, kREG(13) + 0x7D0, kREG(14) + 0x320, 0); - func_808AAD3C(globalCtx, &sp30, 5); - BgSpot01Idohashira_PlayBreakSfx2(this, globalCtx); + func_80033480(play, &sp30, kREG(11) + 350.0f, kREG(12) + 5, kREG(13) + 0x7D0, kREG(14) + 0x320, 0); + func_808AAD3C(play, &sp30, 5); + BgSpot01Idohashira_PlayBreakSfx2(this, play); } -void func_808AAF34(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +void func_808AAF34(BgSpot01Idohashira* this, PlayState* play) { s32 pad[2]; Vec3f dest; Vec3f src; @@ -125,38 +125,38 @@ void func_808AAF34(BgSpot01Idohashira* this, GlobalContext* globalCtx) { src.y = kREG(21) + 200.0f; src.z = 0.0f; Matrix_MultVec3f(&src, &dest); - func_80033480(globalCtx, &dest, kREG(16) + 80.0f, kREG(17) + 10, kREG(18) + 1000, kREG(19), 0); - func_808AAD3C(globalCtx, &dest, 3); + func_80033480(play, &dest, kREG(16) + 80.0f, kREG(17) + 10, kREG(18) + 1000, kREG(19), 0); + func_808AAD3C(play, &dest, 3); src.x = -(kREG(20) + 1300.0f); src.y = kREG(21) + 200.0f; src.z = 0.0f; Matrix_MultVec3f(&src, &dest); - func_80033480(globalCtx, &dest, kREG(16) + 80.0f, kREG(17) + 10, kREG(18) + 1000, kREG(19), 0); - func_808AAD3C(globalCtx, &dest, 3); + func_80033480(play, &dest, kREG(16) + 80.0f, kREG(17) + 10, kREG(18) + 1000, kREG(19), 0); + func_808AAD3C(play, &dest, 3); this->unk_170 = 0; BgSpot01Idohashira_PlayBreakSfx1(this); } } -void BgSpot01Idohashira_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idohashira_Destroy(Actor* thisx, PlayState* play) { BgSpot01Idohashira* this = (BgSpot01Idohashira*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -s32 BgSpot01Idohashira_NotInCsMode(GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +s32 BgSpot01Idohashira_NotInCsMode(PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { return true; } return false; } -CsCmdActorAction* BgSpot01Idohashira_GetNpcAction(GlobalContext* globalCtx, s32 actionIdx) { +CsCmdActorAction* BgSpot01Idohashira_GetNpcAction(PlayState* play, s32 actionIdx) { s32 pad[2]; CsCmdActorAction* npcAction = NULL; - if (!BgSpot01Idohashira_NotInCsMode(globalCtx)) { - npcAction = globalCtx->csCtx.npcActions[actionIdx]; + if (!BgSpot01Idohashira_NotInCsMode(play)) { + npcAction = play->csCtx.npcActions[actionIdx]; } return npcAction; } @@ -184,7 +184,7 @@ f32 func_808AB1DC(f32 arg0, f32 arg1, u16 arg2, u16 arg3, u16 arg4) { return 0.0f; } -s32 func_808AB29C(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +s32 func_808AB29C(BgSpot01Idohashira* this, PlayState* play) { CsCmdActorAction* npcAction; Vec3f* thisPos; f32 endX; @@ -195,9 +195,9 @@ s32 func_808AB29C(BgSpot01Idohashira* this, GlobalContext* globalCtx) { f32 tempY; f32 tempZ; - npcAction = BgSpot01Idohashira_GetNpcAction(globalCtx, 2); + npcAction = BgSpot01Idohashira_GetNpcAction(play, 2); if (npcAction != NULL) { - temp_f0 = Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames); + temp_f0 = Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames); initPos = this->dyna.actor.home.pos; endX = npcAction->endPos.x; tempY = ((kREG(10) + 1100.0f) / 10.0f) + npcAction->endPos.y; @@ -205,8 +205,7 @@ s32 func_808AB29C(BgSpot01Idohashira* this, GlobalContext* globalCtx) { thisPos = &this->dyna.actor.world.pos; thisPos->x = ((endX - initPos.x) * temp_f0) + initPos.x; thisPos->y = - func_808AB1DC(initPos.y, tempY, npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames) + - initPos.y; + func_808AB1DC(initPos.y, tempY, npcAction->endFrame, npcAction->startFrame, play->csCtx.frames) + initPos.y; thisPos->z = ((endZ - initPos.z) * temp_f0) + initPos.z; if (temp_f0 >= 1.0f) { @@ -223,20 +222,20 @@ void func_808AB3E8(BgSpot01Idohashira* this) { this->drawConfig = 0; } -void func_808AB3F8(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +void func_808AB3F8(BgSpot01Idohashira* this, PlayState* play) { this->action = 2; this->drawConfig = 0; this->unk_170 = 1; } -void func_808AB414(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - func_808AAE6C(this, globalCtx); +void func_808AB414(BgSpot01Idohashira* this, PlayState* play) { + func_808AAE6C(this, play); this->action = 3; this->drawConfig = 0; } -void func_808AB444(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = BgSpot01Idohashira_GetNpcAction(globalCtx, 2); +void func_808AB444(BgSpot01Idohashira* this, PlayState* play) { + CsCmdActorAction* npcAction = BgSpot01Idohashira_GetNpcAction(play, 2); u32 action; u32 currentNpcAction; @@ -249,7 +248,7 @@ void func_808AB444(BgSpot01Idohashira* this, GlobalContext* globalCtx) { func_808AB3E8(this); break; case 2: - func_808AB3F8(this, globalCtx); + func_808AB3F8(this, play); break; case 3: Actor_Kill(&this->dyna.actor); @@ -262,35 +261,35 @@ void func_808AB444(BgSpot01Idohashira* this, GlobalContext* globalCtx) { } } -void func_808AB504(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +void func_808AB504(BgSpot01Idohashira* this, PlayState* play) { } -void func_808AB510(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - func_808AB444(this, globalCtx); +void func_808AB510(BgSpot01Idohashira* this, PlayState* play) { + func_808AB444(this, play); } -void func_808AB530(BgSpot01Idohashira* this, GlobalContext* globalCtx) { +void func_808AB530(BgSpot01Idohashira* this, PlayState* play) { func_808AB18C(this); - if (func_808AB29C(this, globalCtx)) { - func_808AB414(this, globalCtx); + if (func_808AB29C(this, play)) { + func_808AB414(this, play); } } -void func_808AB570(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - func_808AB444(this, globalCtx); +void func_808AB570(BgSpot01Idohashira* this, PlayState* play) { + func_808AB444(this, play); } -void BgSpot01Idohashira_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idohashira_Update(Actor* thisx, PlayState* play) { BgSpot01Idohashira* this = (BgSpot01Idohashira*)thisx; if (this->action < 0 || this->action >= 4 || sActionFuncs[this->action] == NULL) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void BgSpot01Idohashira_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idohashira_Init(Actor* thisx, PlayState* play) { s32 pad[2]; BgSpot01Idohashira* this = (BgSpot01Idohashira*)thisx; CollisionHeader* colHeader; @@ -299,7 +298,7 @@ void BgSpot01Idohashira_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_UNK); colHeader = NULL; CollisionHeader_GetVirtual(&gKakarikoWellArchCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (gSaveContext.sceneSetupIndex < 4) { if (GET_EVENTCHKINF(EVENTCHKINF_54) && LINK_IS_ADULT) { @@ -317,8 +316,8 @@ void BgSpot01Idohashira_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void func_808AB700(BgSpot01Idohashira* this, GlobalContext* globalCtx) { - GraphicsContext* localGfxCtx = globalCtx->state.gfxCtx; +void func_808AB700(BgSpot01Idohashira* this, PlayState* play) { + GraphicsContext* localGfxCtx = play->state.gfxCtx; OPEN_DISPS(localGfxCtx, "../z_bg_spot01_idohashira.c", 689); @@ -326,18 +325,18 @@ void func_808AB700(BgSpot01Idohashira* this, GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(localGfxCtx, "../z_bg_spot01_idohashira.c", 699), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_808AAF34(this, globalCtx); + func_808AAF34(this, play); gSPDisplayList(POLY_OPA_DISP++, gKakarikoWellArchDL); CLOSE_DISPS(localGfxCtx, "../z_bg_spot01_idohashira.c", 708); } -void BgSpot01Idohashira_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idohashira_Draw(Actor* thisx, PlayState* play) { BgSpot01Idohashira* this = (BgSpot01Idohashira*)thisx; if (this->drawConfig < 0 || this->drawConfig > 0 || sDrawFuncs[this->drawConfig] == NULL) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h index f3779352f0..216008321a 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h @@ -6,8 +6,8 @@ struct BgSpot01Idohashira; -typedef void (*BgSpot01IdohashiraActionFunc)(struct BgSpot01Idohashira*, GlobalContext*); -typedef void (*BgSpot01IdohashiraDrawFunc)(struct BgSpot01Idohashira*, GlobalContext*); +typedef void (*BgSpot01IdohashiraActionFunc)(struct BgSpot01Idohashira*, PlayState*); +typedef void (*BgSpot01IdohashiraDrawFunc)(struct BgSpot01Idohashira*, PlayState*); typedef struct BgSpot01Idohashira { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c index ec60a4f41a..91d026b2d0 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c @@ -9,12 +9,12 @@ #define FLAGS ACTOR_FLAG_5 -void BgSpot01Idomizu_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idomizu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idomizu_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idomizu_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot01Idomizu_Init(Actor* thisx, PlayState* play); +void BgSpot01Idomizu_Destroy(Actor* thisx, PlayState* play); +void BgSpot01Idomizu_Update(Actor* thisx, PlayState* play); +void BgSpot01Idomizu_Draw(Actor* thisx, PlayState* play); -void func_808ABB84(BgSpot01Idomizu* this, GlobalContext* globalCtx); +void func_808ABB84(BgSpot01Idomizu* this, PlayState* play); const ActorInit Bg_Spot01_Idomizu_InitVars = { ACTOR_BG_SPOT01_IDOMIZU, @@ -32,7 +32,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgSpot01Idomizu_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idomizu_Init(Actor* thisx, PlayState* play) { BgSpot01Idomizu* this = (BgSpot01Idomizu*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -45,14 +45,14 @@ void BgSpot01Idomizu_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.y = this->waterHeight; } -void BgSpot01Idomizu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idomizu_Destroy(Actor* thisx, PlayState* play) { } -void func_808ABB84(BgSpot01Idomizu* this, GlobalContext* globalCtx) { +void func_808ABB84(BgSpot01Idomizu* this, PlayState* play) { if (GET_EVENTCHKINF(EVENTCHKINF_67)) { this->waterHeight = -550.0f; } - globalCtx->colCtx.colHeader->waterBoxes[0].ySurface = this->actor.world.pos.y; + play->colCtx.colHeader->waterBoxes[0].ySurface = this->actor.world.pos.y; if (this->waterHeight < this->actor.world.pos.y) { Audio_PlaySoundGeneral(NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -60,28 +60,28 @@ void func_808ABB84(BgSpot01Idomizu* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.world.pos.y, this->waterHeight, 1.0f, 2.0f); } -void BgSpot01Idomizu_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idomizu_Update(Actor* thisx, PlayState* play) { BgSpot01Idomizu* this = (BgSpot01Idomizu*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot01Idomizu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idomizu_Draw(Actor* thisx, PlayState* play) { u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 228); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot01_idomizu.c", 228); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 232), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot01_idomizu.c", 232), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - frames = globalCtx->state.frames; + frames = play->state.frames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - frames % 128, frames & 0x7F, 32, 32, 1, frames % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - frames % 128, frames & 0x7F, 32, 32, 1, frames % 128, frames & 0x7F, 32, 32)); gSPDisplayList(POLY_XLU_DISP++, gKakarikoWellWaterDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 244); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot01_idomizu.c", 244); } diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h index 35087146e1..3c5929714a 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h @@ -6,7 +6,7 @@ struct BgSpot01Idomizu; -typedef void (*BgSpot01IdomizuActionFunc)(struct BgSpot01Idomizu*, GlobalContext*); +typedef void (*BgSpot01IdomizuActionFunc)(struct BgSpot01Idomizu*, PlayState*); typedef struct BgSpot01Idomizu { /* 0x0000 */ Actor actor; 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 53d5362913..d82ae261f4 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 @@ -9,12 +9,12 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot01Idosoko_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idosoko_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idosoko_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Idosoko_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot01Idosoko_Init(Actor* thisx, PlayState* play); +void BgSpot01Idosoko_Destroy(Actor* thisx, PlayState* play); +void BgSpot01Idosoko_Update(Actor* thisx, PlayState* play); +void BgSpot01Idosoko_Draw(Actor* thisx, PlayState* play); -void func_808ABF54(BgSpot01Idosoko* this, GlobalContext* globalCtx); +void func_808ABF54(BgSpot01Idosoko* this, PlayState* play); const ActorInit Bg_Spot01_Idosoko_InitVars = { ACTOR_BG_SPOT01_IDOSOKO, @@ -36,7 +36,7 @@ void BgSpot01Idosoko_SetupAction(BgSpot01Idosoko* this, BgSpot01IdosokoActionFun this->actionFunc = actionFunc; } -void BgSpot01Idosoko_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idosoko_Init(Actor* thisx, PlayState* play) { s32 pad; BgSpot01Idosoko* this = (BgSpot01Idosoko*)thisx; CollisionHeader* colHeader = NULL; @@ -45,7 +45,7 @@ void BgSpot01Idosoko_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_PLAYER); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); CollisionHeader_GetVirtual(&gKakarikoBOTWStoneCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (!LINK_IS_ADULT) { Actor_Kill(&this->dyna.actor); } else { @@ -53,29 +53,29 @@ void BgSpot01Idosoko_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot01Idosoko_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idosoko_Destroy(Actor* thisx, PlayState* play) { BgSpot01Idosoko* this = (BgSpot01Idosoko*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808ABF54(BgSpot01Idosoko* this, GlobalContext* globalCtx) { +void func_808ABF54(BgSpot01Idosoko* this, PlayState* play) { } -void BgSpot01Idosoko_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Idosoko_Update(Actor* thisx, PlayState* play) { BgSpot01Idosoko* this = (BgSpot01Idosoko*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot01Idosoko_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_idosoko.c", 162); +void BgSpot01Idosoko_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot01_idosoko.c", 162); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot01_idosoko.c", 166), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot01_idosoko.c", 166), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gKakarikoBOTWStoneDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_idosoko.c", 171); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot01_idosoko.c", 171); } diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h index 9356c2a976..c17b0a43ed 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h @@ -6,7 +6,7 @@ struct BgSpot01Idosoko; -typedef void (*BgSpot01IdosokoActionFunc)(struct BgSpot01Idosoko*, GlobalContext*); +typedef void (*BgSpot01IdosokoActionFunc)(struct BgSpot01Idosoko*, PlayState*); typedef struct BgSpot01Idosoko { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c index 765a12505e..f536501b8b 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c @@ -10,13 +10,13 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Objects2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot01Objects2_Update(Actor* thisx, GlobalContext* globalCtx); +void BgSpot01Objects2_Init(Actor* thisx, PlayState* play); +void BgSpot01Objects2_Destroy(Actor* thisx, PlayState* play); +void BgSpot01Objects2_Update(Actor* thisx, PlayState* play); -void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx); -void func_808AC474(BgSpot01Objects2* this, GlobalContext* globalCtx); -void func_808AC4A4(Actor* thisx, GlobalContext* globalCtx); +void func_808AC2BC(BgSpot01Objects2* this, PlayState* play); +void func_808AC474(BgSpot01Objects2* this, PlayState* play); +void func_808AC4A4(Actor* thisx, PlayState* play); const ActorInit Bg_Spot01_Objects2_InitVars = { ACTOR_BG_SPOT01_OBJECTS2, @@ -42,7 +42,7 @@ static Gfx* D_808AC510[] = { gKakarikoConstructionSiteDL, gKakarikoShootingGalleryDL, }; -void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Objects2_Init(Actor* thisx, PlayState* play) { BgSpot01Objects2* this = (BgSpot01Objects2*)thisx; switch (this->dyna.actor.params & 7) { @@ -59,7 +59,7 @@ void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->objectId >= 0) { - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, this->objectId); + this->objBankIndex = Object_GetIndex(&play->objectCtx, this->objectId); if (this->objBankIndex < 0) { // "There was no bank setting." osSyncPrintf("-----------------------------バンク設定ありませんでした."); @@ -73,7 +73,7 @@ void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); } -void BgSpot01Objects2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Objects2_Destroy(Actor* thisx, PlayState* play) { } s32 func_808AC22C(Path* pathList, Vec3f* pos, s32 path, s32 waypoint) { @@ -85,16 +85,16 @@ s32 func_808AC22C(Path* pathList, Vec3f* pos, s32 path, s32 waypoint) { return 0; } -void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx) { +void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) { CollisionHeader* colHeader = NULL; Actor* thisx = &this->dyna.actor; s32 pad; Vec3f position; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { // "---- Successful bank switching!!" osSyncPrintf("-----バンク切り換え成功!!\n"); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex].segment); this->dyna.actor.objBankIndex = this->objBankIndex; DynaPolyActor_Init(&this->dyna, DPM_PLAYER); @@ -102,16 +102,16 @@ void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx) { switch (this->dyna.actor.params & 7) { case 4: // Shooting gallery CollisionHeader_GetVirtual(&gKakarikoShootingGalleryCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); break; case 3: // Shooting Gallery, spawns Carpenter Sabooro during the day CollisionHeader_GetVirtual(&object_spot01_matoyab_col, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); if (IS_DAY) { - func_808AC22C(globalCtx->setupPathList, &position, ((s32)thisx->params >> 8) & 0xFF, 0); - Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_DAIKU_KAKARIKO, position.x, - position.y, position.z, thisx->world.rot.x, thisx->world.rot.y, - thisx->world.rot.z, ((((s32)thisx->params >> 8) & 0xFF) << 8) + 1); + func_808AC22C(play->setupPathList, &position, ((s32)thisx->params >> 8) & 0xFF, 0); + Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_DAIKU_KAKARIKO, position.x, position.y, + position.z, thisx->world.rot.x, thisx->world.rot.y, thisx->world.rot.z, + ((((s32)thisx->params >> 8) & 0xFF) << 8) + 1); } break; case 0: // Potion Shop Poster @@ -125,15 +125,15 @@ void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx) { } } -void func_808AC474(BgSpot01Objects2* this, GlobalContext* globalCtx) { +void func_808AC474(BgSpot01Objects2* this, PlayState* play) { } -void BgSpot01Objects2_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot01Objects2_Update(Actor* thisx, PlayState* play) { BgSpot01Objects2* this = (BgSpot01Objects2*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void func_808AC4A4(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, D_808AC510[thisx->params & 7]); +void func_808AC4A4(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, D_808AC510[thisx->params & 7]); } diff --git a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h index 0ee7d814ef..1da5f4f3f3 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h @@ -6,7 +6,7 @@ struct BgSpot01Objects2; -typedef void (*BgSpot01Objects2ActionFunc)(struct BgSpot01Objects2*, GlobalContext*); +typedef void (*BgSpot01Objects2ActionFunc)(struct BgSpot01Objects2*, PlayState*); typedef struct BgSpot01Objects2 { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c index dd1cfba254..2dfca265fa 100644 --- a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c @@ -9,20 +9,20 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot02Objects_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot02Objects_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot02Objects_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_808ACCB8(Actor* thisx, GlobalContext* globalCtx); -void func_808AD450(Actor* thisx, GlobalContext* globalCtx); +void BgSpot02Objects_Init(Actor* thisx, PlayState* play); +void BgSpot02Objects_Destroy(Actor* thisx, PlayState* play); +void BgSpot02Objects_Update(Actor* thisx, PlayState* play); +void BgSpot02Objects_Draw(Actor* thisx, PlayState* play); +void func_808ACCB8(Actor* thisx, PlayState* play); +void func_808AD450(Actor* thisx, PlayState* play); -void func_808AC8FC(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808AC908(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808ACA08(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808ACAFC(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808ACB58(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808ACC34(BgSpot02Objects* this, GlobalContext* globalCtx); -void func_808AD3D4(BgSpot02Objects* this, GlobalContext* globalCtx); +void func_808AC8FC(BgSpot02Objects* this, PlayState* play); +void func_808AC908(BgSpot02Objects* this, PlayState* play); +void func_808ACA08(BgSpot02Objects* this, PlayState* play); +void func_808ACAFC(BgSpot02Objects* this, PlayState* play); +void func_808ACB58(BgSpot02Objects* this, PlayState* play); +void func_808ACC34(BgSpot02Objects* this, PlayState* play); +void func_808AD3D4(BgSpot02Objects* this, PlayState* play); static void* D_808AD850[] = { object_spot02_objects_Tex_0096B0, object_spot02_objects_Tex_00A2B0, object_spot02_objects_Tex_00AEB0, @@ -47,7 +47,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot02Objects_Init(Actor* thisx, PlayState* play) { s32 pad; BgSpot02Objects* this = (BgSpot02Objects*)thisx; CollisionHeader* colHeader = NULL; @@ -63,7 +63,7 @@ void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); if (thisx->params == 0) { - if (Flags_GetSwitch(globalCtx, this->unk_16B)) { + if (Flags_GetSwitch(play, this->unk_16B)) { this->actionFunc = func_808AC8FC; thisx->world.pos.y += 255.0f; } else { @@ -76,7 +76,7 @@ void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_spot02_objects_Col_0128D8, &colHeader); thisx->flags |= ACTOR_FLAG_22; } else { - if (globalCtx->sceneNum == SCENE_SPOT02) { + if (play->sceneNum == SCENE_SPOT02) { this->actionFunc = func_808AC908; } else { this->actionFunc = func_808AC8FC; @@ -85,9 +85,9 @@ void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_spot02_objects_Col_0133EC, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - if ((GET_EVENTCHKINF(EVENTCHKINF_1D) && (globalCtx->sceneNum == SCENE_SPOT02) && (thisx->params == 2)) || + if ((GET_EVENTCHKINF(EVENTCHKINF_1D) && (play->sceneNum == SCENE_SPOT02) && (thisx->params == 2)) || (LINK_IS_ADULT && (thisx->params == 1))) { Actor_Kill(thisx); } @@ -95,7 +95,7 @@ void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { case 3: this->unk_16A = 0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_ITEMACTION); this->actionFunc = func_808ACC34; thisx->draw = func_808ACCB8; @@ -107,42 +107,42 @@ void BgSpot02Objects_Init(Actor* thisx, GlobalContext* globalCtx) { case 4: this->timer = -12; this->unk_170 = 0xFFFF; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_ITEMACTION); this->actionFunc = func_808AD3D4; thisx->draw = func_808AD450; break; } } -void BgSpot02Objects_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot02Objects_Destroy(Actor* thisx, PlayState* play) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808AC8FC(BgSpot02Objects* this, GlobalContext* globalCtx) { +void func_808AC8FC(BgSpot02Objects* this, PlayState* play) { } -void func_808AC908(BgSpot02Objects* this, GlobalContext* globalCtx) { +void func_808AC908(BgSpot02Objects* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f pos; - if (globalCtx->csCtx.state != 0) { - if (globalCtx->csCtx.npcActions[3] != NULL && globalCtx->csCtx.npcActions[3]->action == 2) { + if (play->csCtx.state != 0) { + if (play->csCtx.npcActions[3] != NULL && play->csCtx.npcActions[3]->action == 2) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_GRAVE_EXPLOSION); SET_EVENTCHKINF(EVENTCHKINF_1D); this->timer = 25; pos.x = (Math_SinS(this->dyna.actor.shape.rot.y) * 50.0f) + this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 30.0f; pos.z = (Math_CosS(this->dyna.actor.shape.rot.y) * 50.0f) + this->dyna.actor.world.pos.z; - EffectSsBomb2_SpawnLayered(globalCtx, &pos, &zeroVec, &zeroVec, 70, 30); + EffectSsBomb2_SpawnLayered(play, &pos, &zeroVec, &zeroVec, 70, 30); this->actionFunc = func_808ACA08; } } } -void func_808ACA08(BgSpot02Objects* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808ACA08(BgSpot02Objects* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->timer != 0) { this->timer--; @@ -150,13 +150,13 @@ void func_808ACA08(BgSpot02Objects* this, GlobalContext* globalCtx) { if (this->timer == 20) { this->dyna.actor.draw = NULL; - EffectSsHahen_SpawnBurst(globalCtx, &this->dyna.actor.world.pos, 30.0f, 0, 25, 5, 40, OBJECT_SPOT02_OBJECTS, 20, + EffectSsHahen_SpawnBurst(play, &this->dyna.actor.world.pos, 30.0f, 0, 25, 5, 40, OBJECT_SPOT02_OBJECTS, 20, object_spot02_objects_DL_012D30); } else if (this->timer == 0) { Actor_Kill(&this->dyna.actor); } - if (globalCtx->csCtx.frames == 402) { + if (play->csCtx.frames == 402) { if (!LINK_IS_ADULT) { func_8002F7DC(&player->actor, NA_SE_VO_LI_DEMO_DAMAGE_KID); } else { @@ -165,15 +165,15 @@ void func_808ACA08(BgSpot02Objects* this, GlobalContext* globalCtx) { } } -void func_808ACAFC(BgSpot02Objects* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->unk_16B)) { +void func_808ACAFC(BgSpot02Objects* this, PlayState* play) { + if (Flags_GetSwitch(play, this->unk_16B)) { Actor_SetFocus(&this->dyna.actor, 60.0f); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = func_808ACB58; } } -void func_808ACB58(BgSpot02Objects* this, GlobalContext* globalCtx) { +void func_808ACB58(BgSpot02Objects* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 255.0f, 1.0f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); this->actionFunc = func_808AC8FC; @@ -182,25 +182,24 @@ void func_808ACB58(BgSpot02Objects* this, GlobalContext* globalCtx) { } } -void BgSpot02Objects_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot02Objects_Update(Actor* thisx, PlayState* play) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot02Objects_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot02Objects_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { object_spot02_objects_DL_012A50, object_spot02_objects_DL_0127C0, object_spot02_objects_DL_0130B0, }; - Gfx_DrawDListOpa(globalCtx, dLists[thisx->params]); + Gfx_DrawDListOpa(play, dLists[thisx->params]); } -void func_808ACC34(BgSpot02Objects* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[0] != NULL && - globalCtx->csCtx.npcActions[0]->action == 2) { +void func_808ACC34(BgSpot02Objects* this, PlayState* play) { + if (play->csCtx.state != 0 && play->csCtx.npcActions[0] != NULL && play->csCtx.npcActions[0]->action == 2) { this->unk_16A++; if (this->unk_16A >= 12) { @@ -208,12 +207,12 @@ void func_808ACC34(BgSpot02Objects* this, GlobalContext* globalCtx) { } } - if (globalCtx->csCtx.frames == 245 || globalCtx->csCtx.frames == 351) { + if (play->csCtx.frames == 245 || play->csCtx.frames == 351) { func_800788CC(NA_SE_EV_LIGHTNING); } } -void func_808ACCB8(Actor* thisx, GlobalContext* globalCtx) { +void func_808ACCB8(Actor* thisx, PlayState* play) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; f32 rate; s32 pad; @@ -224,10 +223,9 @@ void func_808ACCB8(Actor* thisx, GlobalContext* globalCtx) { u8 greenEnv; u8 blueEnv; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot02_objects.c", 600); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot02_objects.c", 600); - if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[0] != NULL && - globalCtx->csCtx.npcActions[0]->action == 2) { + if (play->csCtx.state != 0 && play->csCtx.npcActions[0] != NULL && play->csCtx.npcActions[0]->action == 2) { if (this->unk_16A < 5) { rate = (this->unk_16A / 5.0f); redPrim = greenPrim = bluePrim = 255; @@ -244,18 +242,18 @@ void func_808ACCB8(Actor* thisx, GlobalContext* globalCtx) { blueEnv = 100.0f + (100.0f * rate); } - Matrix_Translate(globalCtx->csCtx.npcActions[0]->startPos.x, globalCtx->csCtx.npcActions[0]->startPos.y, - globalCtx->csCtx.npcActions[0]->startPos.z, MTXMODE_NEW); - Matrix_RotateX(BINANG_TO_RAD(globalCtx->csCtx.npcActions[0]->urot.x), MTXMODE_APPLY); - Matrix_RotateY(BINANG_TO_RAD(globalCtx->csCtx.npcActions[0]->urot.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD(globalCtx->csCtx.npcActions[0]->urot.z), MTXMODE_APPLY); + Matrix_Translate(play->csCtx.npcActions[0]->startPos.x, play->csCtx.npcActions[0]->startPos.y, + play->csCtx.npcActions[0]->startPos.z, MTXMODE_NEW); + Matrix_RotateX(BINANG_TO_RAD(play->csCtx.npcActions[0]->urot.x), MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD(play->csCtx.npcActions[0]->urot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD(play->csCtx.npcActions[0]->urot.z), MTXMODE_APPLY); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, redPrim, greenPrim, bluePrim, 255); gDPSetEnvColor(POLY_XLU_DISP++, redEnv, greenEnv, blueEnv, 255); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot02_objects.c", 679), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot02_objects.c", 679), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_808AD850[this->unk_16A])); gDPPipeSync(POLY_XLU_DISP++); @@ -263,12 +261,11 @@ void func_808ACCB8(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot02_objects.c", 692); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot02_objects.c", 692); } -void func_808AD3D4(BgSpot02Objects* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[2] != NULL && - globalCtx->csCtx.npcActions[2]->action == 2) { +void func_808AD3D4(BgSpot02Objects* this, PlayState* play) { + if (play->csCtx.state != 0 && play->csCtx.npcActions[2] != NULL && play->csCtx.npcActions[2]->action == 2) { if (this->timer == 2) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_IT_EXPLOSION_ICE); } @@ -281,15 +278,15 @@ void func_808AD3D4(BgSpot02Objects* this, GlobalContext* globalCtx) { } } -void func_808AD450(Actor* thisx, GlobalContext* globalCtx) { +void func_808AD450(Actor* thisx, PlayState* play) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; s32 pad; f32 lerp; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot02_objects.c", 736); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot02_objects.c", 736); - if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[2] != NULL) { - u16 temp_v1 = CAM_BINANG_TO_DEG(globalCtx->csCtx.npcActions[2]->urot.z); + if (play->csCtx.state != 0 && play->csCtx.npcActions[2] != NULL) { + u16 temp_v1 = CAM_BINANG_TO_DEG(play->csCtx.npcActions[2]->urot.z); if (this->unk_170 != temp_v1) { if (this->unk_170 == 0xFFFF) { @@ -301,25 +298,25 @@ void func_808AD450(Actor* thisx, GlobalContext* globalCtx) { } } - lerp = Environment_LerpWeight(globalCtx->csCtx.npcActions[2]->endFrame, - globalCtx->csCtx.npcActions[2]->startFrame, globalCtx->csCtx.frames); + lerp = Environment_LerpWeight(play->csCtx.npcActions[2]->endFrame, play->csCtx.npcActions[2]->startFrame, + play->csCtx.frames); // should be able to remove & 0xFFFF with some other change - if ((globalCtx->csCtx.npcActions[2]->action & 0xFFFF) == 2) { - Matrix_Translate(globalCtx->csCtx.npcActions[2]->startPos.x, globalCtx->csCtx.npcActions[2]->startPos.y, - globalCtx->csCtx.npcActions[2]->startPos.z, MTXMODE_NEW); - Matrix_RotateX(BINANG_TO_RAD(globalCtx->csCtx.npcActions[2]->urot.x), MTXMODE_APPLY); - Matrix_RotateY(BINANG_TO_RAD(globalCtx->csCtx.npcActions[2]->urot.y), MTXMODE_APPLY); + if ((play->csCtx.npcActions[2]->action & 0xFFFF) == 2) { + Matrix_Translate(play->csCtx.npcActions[2]->startPos.x, play->csCtx.npcActions[2]->startPos.y, + play->csCtx.npcActions[2]->startPos.z, MTXMODE_NEW); + Matrix_RotateX(BINANG_TO_RAD(play->csCtx.npcActions[2]->urot.x), MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD(play->csCtx.npcActions[2]->urot.y), MTXMODE_APPLY); Matrix_Scale(0.9f, 0.9f, (((this->unk_170 - this->unk_172) * lerp) + this->unk_172) * 0.1f, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, 128); gDPSetEnvColor(POLY_XLU_DISP++, 150, 120, 0, 128); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot02_objects.c", 795), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot02_objects.c", 795), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 2 * this->timer, -3 * this->timer, 32, 64, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 2 * this->timer, -3 * this->timer, 32, 64, 1, 4 * this->timer, -6 * this->timer, 32, 64)); gDPPipeSync(POLY_XLU_DISP++); gSPDisplayList(POLY_XLU_DISP++, object_spot02_objects_DL_0013F0); @@ -327,5 +324,5 @@ void func_808AD450(Actor* thisx, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot02_objects.c", 818); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot02_objects.c", 818); } diff --git a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h index 89bbf7d5e9..873fe15a52 100644 --- a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h +++ b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h @@ -6,7 +6,7 @@ struct BgSpot02Objects; -typedef void (*BgSpot02ObjectsActionFunc)(struct BgSpot02Objects*, GlobalContext*); +typedef void (*BgSpot02ObjectsActionFunc)(struct BgSpot02Objects*, PlayState*); typedef struct BgSpot02Objects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c index ffa5c4b1ab..835a1f56e6 100644 --- a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c +++ b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot03Taki_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot03Taki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot03Taki_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot03Taki_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot03Taki_Init(Actor* thisx, PlayState* play); +void BgSpot03Taki_Destroy(Actor* thisx, PlayState* play); +void BgSpot03Taki_Update(Actor* thisx, PlayState* play); +void BgSpot03Taki_Draw(Actor* thisx, PlayState* play); -void func_808ADEF0(BgSpot03Taki* this, GlobalContext* globalCtx); +void func_808ADEF0(BgSpot03Taki* this, PlayState* play); const ActorInit Bg_Spot03_Taki_InitVars = { ACTOR_BG_SPOT03_TAKI, @@ -42,7 +42,7 @@ void BgSpot03Taki_ApplyOpeningAlpha(BgSpot03Taki* this, s32 bufferIndex) { } } -void BgSpot03Taki_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot03Taki_Init(Actor* thisx, PlayState* play) { BgSpot03Taki* this = (BgSpot03Taki*)thisx; s16 pad; CollisionHeader* colHeader = NULL; @@ -50,7 +50,7 @@ void BgSpot03Taki_Init(Actor* thisx, GlobalContext* globalCtx) { this->switchFlag = (this->dyna.actor.params & 0x3F); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&object_spot03_object_Col_000C98, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->bufferIndex = 0; this->openingAlpha = 255.0f; @@ -59,18 +59,18 @@ void BgSpot03Taki_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808ADEF0; } -void BgSpot03Taki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot03Taki_Destroy(Actor* thisx, PlayState* play) { BgSpot03Taki* this = (BgSpot03Taki*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808ADEF0(BgSpot03Taki* this, GlobalContext* globalCtx) { +void func_808ADEF0(BgSpot03Taki* this, PlayState* play) { if (this->state == WATERFALL_CLOSED) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->state = WATERFALL_OPENING_ANIMATED; this->timer = 40; - OnePointCutscene_Init(globalCtx, 4100, -99, NULL, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4100, -99, NULL, CAM_ID_MAIN); } } else if (this->state == WATERFALL_OPENING_IDLE) { this->timer--; @@ -81,7 +81,7 @@ void func_808ADEF0(BgSpot03Taki* this, GlobalContext* globalCtx) { if (this->openingAlpha > 0) { this->openingAlpha -= 5; if (this->openingAlpha <= 0.0f) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->timer = 400; this->state = WATERFALL_OPENED; this->openingAlpha = 0; @@ -96,10 +96,10 @@ void func_808ADEF0(BgSpot03Taki* this, GlobalContext* globalCtx) { if (this->openingAlpha < 255.0f) { this->openingAlpha += 5.0f; if (this->openingAlpha >= 255.0f) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); this->state = WATERFALL_CLOSED; this->openingAlpha = 255.0f; - Flags_UnsetSwitch(globalCtx, this->switchFlag); + Flags_UnsetSwitch(play, this->switchFlag); } } } @@ -107,29 +107,29 @@ void func_808ADEF0(BgSpot03Taki* this, GlobalContext* globalCtx) { BgSpot03Taki_ApplyOpeningAlpha(this, this->bufferIndex); } -void BgSpot03Taki_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot03Taki_Update(Actor* thisx, PlayState* play) { BgSpot03Taki* this = (BgSpot03Taki*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot03Taki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot03Taki_Draw(Actor* thisx, PlayState* play) { BgSpot03Taki* this = (BgSpot03Taki*)thisx; s32 pad; u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot03_taki.c", 321); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot03_taki.c", 321); - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot03_taki.c", 325), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot03_taki.c", 325), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment( POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames * 5, 64, 64, 1, 0, gameplayFrames * 5, 64, 64)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames * 5, 64, 64, 1, 0, gameplayFrames * 5, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, object_spot03_object_DL_000B20); @@ -142,12 +142,12 @@ void BgSpot03Taki_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, object_spot03_object_DL_000BC0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, gameplayFrames * 3, 64, 64, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames * 1, gameplayFrames * 3, 64, 64, 1, -gameplayFrames, gameplayFrames * 3, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, object_spot03_object_DL_001580); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot03_taki.c", 358); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot03_taki.c", 358); this->bufferIndex = this->bufferIndex == 0; 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 405ad96968..3055fb7f87 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 @@ -14,7 +14,7 @@ typedef enum { struct BgSpot03Taki; -typedef void (*BgSpot03TakiActionFunc)(struct BgSpot03Taki*, GlobalContext*); +typedef void (*BgSpot03TakiActionFunc)(struct BgSpot03Taki*, PlayState*); typedef struct BgSpot03Taki { /* 0x0000 */ DynaPolyActor dyna; 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 294ff1e2db..b0ceadc4aa 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 @@ -9,13 +9,13 @@ #define FLAGS 0 -void BgSpot05Soko_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot05Soko_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot05Soko_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot05Soko_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_808AE5A8(BgSpot05Soko* this, GlobalContext* globalCtx); -void func_808AE5B4(BgSpot05Soko* this, GlobalContext* globalCtx); -void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx); +void BgSpot05Soko_Init(Actor* thisx, PlayState* play); +void BgSpot05Soko_Destroy(Actor* thisx, PlayState* play); +void BgSpot05Soko_Update(Actor* thisx, PlayState* play); +void BgSpot05Soko_Draw(Actor* thisx, PlayState* play); +void func_808AE5A8(BgSpot05Soko* this, PlayState* play); +void func_808AE5B4(BgSpot05Soko* this, PlayState* play); +void func_808AE630(BgSpot05Soko* this, PlayState* play); const ActorInit Bg_Spot05_Soko_InitVars = { ACTOR_BG_SPOT05_SOKO, @@ -38,7 +38,7 @@ static Gfx* sDLists[] = { object_spot05_objects_DL_001190, }; -void BgSpot05Soko_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot05Soko_Init(Actor* thisx, PlayState* play) { s32 pad1; BgSpot05Soko* this = (BgSpot05Soko*)thisx; CollisionHeader* colHeader = NULL; @@ -57,36 +57,36 @@ void BgSpot05Soko_Init(Actor* thisx, GlobalContext* globalCtx) { } } else { CollisionHeader_GetVirtual(&object_spot05_objects_Col_0012C0, &colHeader); - if (Flags_GetSwitch(globalCtx, this->switchFlag) != 0) { + if (Flags_GetSwitch(play, this->switchFlag) != 0) { Actor_Kill(thisx); } else { this->actionFunc = func_808AE5B4; thisx->flags |= ACTOR_FLAG_4; } } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } -void BgSpot05Soko_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot05Soko_Destroy(Actor* thisx, PlayState* play) { BgSpot05Soko* this = (BgSpot05Soko*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808AE5A8(BgSpot05Soko* this, GlobalContext* globalCtx) { +void func_808AE5A8(BgSpot05Soko* this, PlayState* play) { } -void func_808AE5B4(BgSpot05Soko* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_METALDOOR_CLOSE); +void func_808AE5B4(BgSpot05Soko* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_METALDOOR_CLOSE); Actor_SetFocus(&this->dyna.actor, 50.0f); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = func_808AE630; this->dyna.actor.speedXZ = 0.5f; } } -void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx) { +void func_808AE630(BgSpot05Soko* this, PlayState* play) { this->dyna.actor.speedXZ *= 1.5f; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 120.0f, this->dyna.actor.speedXZ) != 0) { @@ -94,12 +94,12 @@ void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx) { } } -void BgSpot05Soko_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot05Soko_Update(Actor* thisx, PlayState* play) { BgSpot05Soko* this = (BgSpot05Soko*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot05Soko_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]); +void BgSpot05Soko_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sDLists[thisx->params]); } diff --git a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h index 1dc53b792d..849e5b2263 100644 --- a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h +++ b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h @@ -6,7 +6,7 @@ struct BgSpot05Soko; -typedef void (*BgSpot05SokoActionFunc)(struct BgSpot05Soko*, GlobalContext*); +typedef void (*BgSpot05SokoActionFunc)(struct BgSpot05Soko*, PlayState*); typedef struct BgSpot05Soko { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index fee1894720..0263786e65 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -29,20 +29,20 @@ typedef enum { #define WATER_LEVEL_LOWERED (WATER_LEVEL_RAISED - 680) #define WATER_LEVEL_RIVER_LOWERED (WATER_LEVEL_RIVER_RAISED - 80) -void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot06Objects_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot06Objects_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot06Objects_Draw(Actor* thisx, GlobalContext* globalCtx); -void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_GateWaitToOpen(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_GateOpen(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_DoNothing(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_LockWait(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_LockPullOutward(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_LockFloat(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_WaterPlaneCutsceneWait(BgSpot06Objects* this, GlobalContext* globalCtx); -void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, GlobalContext* globalCtx); +void BgSpot06Objects_Init(Actor* thisx, PlayState* play); +void BgSpot06Objects_Destroy(Actor* thisx, PlayState* play); +void BgSpot06Objects_Update(Actor* thisx, PlayState* play); +void BgSpot06Objects_Draw(Actor* thisx, PlayState* play); +void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_GateWaitToOpen(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_GateOpen(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_DoNothing(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_LockWait(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_LockPullOutward(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_LockFloat(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_WaterPlaneCutsceneWait(BgSpot06Objects* this, PlayState* play); +void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, PlayState* play); const ActorInit Bg_Spot06_Objects_InitVars = { ACTOR_BG_SPOT06_OBJECTS, @@ -91,7 +91,7 @@ static InitChainEntry sInitChainWaterPlane[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot06Objects_Init(Actor* thisx, PlayState* play) { BgSpot06Objects* this = (BgSpot06Objects*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -106,9 +106,9 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gLakeHyliaWaterTempleGateCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - if (LINK_IS_ADULT && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (LINK_IS_ADULT && Flags_GetSwitch(play, this->switchFlag)) { thisx->world.pos.y = thisx->home.pos.y + 120.0f; this->actionFunc = BgSpot06Objects_DoNothing; @@ -119,10 +119,10 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { break; case LHO_WATER_TEMPLE_ENTRANCE_LOCK: Actor_ProcessInitChain(thisx, sInitChain); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, thisx, &sJntSphInit, this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, this->colliderItem); - if (LINK_IS_ADULT && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (LINK_IS_ADULT && Flags_GetSwitch(play, this->switchFlag)) { if (!GET_EVENTCHKINF(EVENTCHKINF_69)) { thisx->home.pos.y = thisx->world.pos.y = WATER_LEVEL_LOWERED; } else { @@ -152,11 +152,11 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { if (LINK_IS_ADULT && !GET_EVENTCHKINF(EVENTCHKINF_69)) { if (gSaveContext.sceneSetupIndex < 4) { this->lakeHyliaWaterLevel = -681.0f; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = + play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_LOWERED; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].zMin -= 50; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = WATER_LEVEL_LOWERED; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = WATER_LEVEL_LOWERED; + play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].zMin -= 50; + play->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = WATER_LEVEL_LOWERED; + play->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = WATER_LEVEL_LOWERED; this->actionFunc = BgSpot06Objects_DoNothing; } else { thisx->world.pos.y = this->lakeHyliaWaterLevel = -681.0f; @@ -172,7 +172,7 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gLakeHyliaZoraShortcutIceblockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->actionFunc = BgSpot06Objects_DoNothing; if (!LINK_IS_ADULT) { @@ -182,16 +182,16 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot06Objects_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot06Objects_Destroy(Actor* thisx, PlayState* play) { BgSpot06Objects* this = (BgSpot06Objects*)thisx; switch (this->dyna.actor.params) { case LHO_WATER_TEMPLE_ENTRACE_GATE: case LHO_ICE_BLOCK: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); break; case LHO_WATER_TEMPLE_ENTRANCE_LOCK: - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); break; case LHO_WATER_PLANE: break; @@ -201,32 +201,32 @@ void BgSpot06Objects_Destroy(Actor* thisx, GlobalContext* globalCtx) { /** * Water Temple entrance gate effect functions */ -void BgSpot06Objects_GateSpawnBubbles(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_GateSpawnBubbles(BgSpot06Objects* this, PlayState* play) { Vec3f sp34; f32 tmp; - if ((globalCtx->gameplayFrames % 3) == 0) { + if ((play->gameplayFrames % 3) == 0) { tmp = Rand_CenteredFloat(160.0f); sp34.x = (Math_SinS(this->dyna.actor.shape.rot.y + 0x4000) * tmp) + this->dyna.actor.world.pos.x; sp34.y = this->dyna.actor.world.pos.y; sp34.z = (Math_CosS(this->dyna.actor.shape.rot.y + 0x4000) * tmp) + this->dyna.actor.world.pos.z; - EffectSsBubble_Spawn(globalCtx, &sp34, 50.0f, 70.0f, 10.0f, (Rand_ZeroOne() * 0.05f) + 0.175f); + EffectSsBubble_Spawn(play, &sp34, 50.0f, 70.0f, 10.0f, (Rand_ZeroOne() * 0.05f) + 0.175f); } } /** * This is where the gate waits for the switch to be set by the fish shaped lock. */ -void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, PlayState* play) { s32 i; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->timer = 100; this->dyna.actor.world.pos.y += 3.0f; this->actionFunc = BgSpot06Objects_GateWaitToOpen; for (i = 0; i < 15; i++) { - BgSpot06Objects_GateSpawnBubbles(this, globalCtx); + BgSpot06Objects_GateSpawnBubbles(this, play); } } } @@ -234,7 +234,7 @@ void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, GlobalContext* glo /** * This is where the gate waits a few frames before rising after the switch is set. */ -void BgSpot06Objects_GateWaitToOpen(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_GateWaitToOpen(BgSpot06Objects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -247,8 +247,8 @@ void BgSpot06Objects_GateWaitToOpen(BgSpot06Objects* this, GlobalContext* global /** * This is where the gate finally rises upward. */ -void BgSpot06Objects_GateOpen(BgSpot06Objects* this, GlobalContext* globalCtx) { - BgSpot06Objects_GateSpawnBubbles(this, globalCtx); +void BgSpot06Objects_GateOpen(BgSpot06Objects* this, PlayState* play) { + BgSpot06Objects_GateSpawnBubbles(this, play); if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 120.0f, 0.6f)) { this->actionFunc = BgSpot06Objects_DoNothing; @@ -259,29 +259,28 @@ void BgSpot06Objects_GateOpen(BgSpot06Objects* this, GlobalContext* globalCtx) { } } -void BgSpot06Objects_DoNothing(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_DoNothing(BgSpot06Objects* this, PlayState* play) { } /** * Fish shaped lock effect functions */ -void BgSpot06Objects_LockSpawnWaterRipples(BgSpot06Objects* this, GlobalContext* globalCtx, s32 flag) { - if (flag || !(globalCtx->gameplayFrames % 7)) { - EffectSsGRipple_Spawn(globalCtx, &this->dyna.actor.home.pos, 300, 700, 0); +void BgSpot06Objects_LockSpawnWaterRipples(BgSpot06Objects* this, PlayState* play, s32 flag) { + if (flag || !(play->gameplayFrames % 7)) { + EffectSsGRipple_Spawn(play, &this->dyna.actor.home.pos, 300, 700, 0); } } -void BgSpot06Objects_LockSpawnBubbles(BgSpot06Objects* this, GlobalContext* globalCtx, s32 flag) { - if (!(globalCtx->gameplayFrames % 7) || flag) { - EffectSsBubble_Spawn(globalCtx, &this->dyna.actor.world.pos, 0.0f, 40.0f, 30.0f, - (Rand_ZeroOne() * 0.05f) + 0.175f); +void BgSpot06Objects_LockSpawnBubbles(BgSpot06Objects* this, PlayState* play, s32 flag) { + if (!(play->gameplayFrames % 7) || flag) { + EffectSsBubble_Spawn(play, &this->dyna.actor.world.pos, 0.0f, 40.0f, 30.0f, (Rand_ZeroOne() * 0.05f) + 0.175f); } } /** * This is where the fish shaped lock waits to be pulled out by the hookshot. Once it does it will spawn bubbles. */ -void BgSpot06Objects_LockWait(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_LockWait(BgSpot06Objects* this, PlayState* play) { s32 pad; s32 i; s32 pad2; @@ -298,7 +297,7 @@ void BgSpot06Objects_LockWait(BgSpot06Objects* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.z += (3.0f * cos); for (i = 0; i < 20; i++) { - BgSpot06Objects_LockSpawnBubbles(this, globalCtx, 1); + BgSpot06Objects_LockSpawnBubbles(this, play, 1); } effectPos.x = this->dyna.actor.world.pos.x + (5.0f * sin); @@ -306,32 +305,32 @@ void BgSpot06Objects_LockWait(BgSpot06Objects* this, GlobalContext* globalCtx) { effectPos.z = this->dyna.actor.world.pos.z + (5.0f * cos); for (i = 0; i < 3; i++) { - EffectSsBubble_Spawn(globalCtx, &effectPos, 0.0f, 20.0f, 20.0f, (Rand_ZeroOne() * 0.1f) + 0.7f); + EffectSsBubble_Spawn(play, &effectPos, 0.0f, 20.0f, 20.0f, (Rand_ZeroOne() * 0.1f) + 0.7f); } - EffectSsGSplash_Spawn(globalCtx, &this->dyna.actor.world.pos, NULL, NULL, 1, 700); + EffectSsGSplash_Spawn(play, &this->dyna.actor.world.pos, NULL, NULL, 1, 700); this->collider.elements->dim.worldSphere.radius = 45; this->actionFunc = BgSpot06Objects_LockPullOutward; Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - Flags_SetSwitch(globalCtx, this->switchFlag); - OnePointCutscene_Init(globalCtx, 4120, 170, &this->dyna.actor, CAM_ID_MAIN); + Flags_SetSwitch(play, this->switchFlag); + OnePointCutscene_Init(play, 4120, 170, &this->dyna.actor, CAM_ID_MAIN); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } /** * Once the fish shaped lock is pulled out from the Hookshot it will move outward. */ -void BgSpot06Objects_LockPullOutward(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_LockPullOutward(BgSpot06Objects* this, PlayState* play) { if (this->timer != 0) { this->timer--; } this->dyna.actor.world.pos.x += (0.3f * Math_SinS(this->dyna.actor.world.rot.y)); this->dyna.actor.world.pos.z += (0.3f * Math_CosS(this->dyna.actor.world.rot.y)); - BgSpot06Objects_LockSpawnBubbles(this, globalCtx, 0); + BgSpot06Objects_LockSpawnBubbles(this, play, 0); if (this->timer == 0) { this->dyna.actor.velocity.y = 0.5f; @@ -345,7 +344,7 @@ void BgSpot06Objects_LockPullOutward(BgSpot06Objects* this, GlobalContext* globa * After being pulled all the way out the fish shaped lock will rise to the surface, creating bubbles in the water as it * does so. */ -void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, PlayState* play) { f32 cos; f32 pad; @@ -356,7 +355,7 @@ void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* glo this->dyna.actor.world.pos.x += (cos * Math_SinS(this->dyna.actor.shape.rot.y)); this->dyna.actor.world.pos.z += (cos * Math_CosS(this->dyna.actor.shape.rot.y)); this->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y - 1.3f; - BgSpot06Objects_LockSpawnWaterRipples(this, globalCtx, 0); + BgSpot06Objects_LockSpawnWaterRipples(this, play, 0); if (Math_ScaledStepToS(&this->dyna.actor.shape.rot.x, 0, 0x260) != 0) { this->dyna.actor.home.pos.x = @@ -372,17 +371,17 @@ void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* glo } else { if (this->dyna.actor.world.pos.y >= -1973.0f) { this->dyna.actor.velocity.y = 0.0f; - BgSpot06Objects_LockSpawnWaterRipples(this, globalCtx, 1); - EffectSsGSplash_Spawn(globalCtx, &this->dyna.actor.home.pos, NULL, NULL, 1, 700); + BgSpot06Objects_LockSpawnWaterRipples(this, play, 1); + EffectSsGSplash_Spawn(play, &this->dyna.actor.home.pos, NULL, NULL, 1, 700); } else if (this->dyna.actor.shape.rot.x == -0x4000) { this->dyna.actor.velocity.y += 0.02f; this->dyna.actor.world.pos.x = Rand_CenteredFloat(1.0f) + this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.z = Rand_CenteredFloat(1.0f) + this->dyna.actor.home.pos.z; this->dyna.actor.velocity.y = (this->dyna.actor.velocity.y > 10.0f) ? (10.0f) : (this->dyna.actor.velocity.y); - BgSpot06Objects_LockSpawnBubbles(this, globalCtx, 0); + BgSpot06Objects_LockSpawnBubbles(this, play, 0); } else { - BgSpot06Objects_LockSpawnBubbles(this, globalCtx, 0); + BgSpot06Objects_LockSpawnBubbles(this, play, 0); if (Math_ScaledStepToS(&this->dyna.actor.shape.rot.x, -0x4000, 0x30)) { this->dyna.actor.home.pos.x = this->dyna.actor.world.pos.x; @@ -397,8 +396,8 @@ void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* glo * Once the fish shaped lock finishes rising to the surface it will float and create ripples in the water every few * frames. */ -void BgSpot06Objects_LockFloat(BgSpot06Objects* this, GlobalContext* globalCtx) { - BgSpot06Objects_LockSpawnWaterRipples(this, globalCtx, 0); +void BgSpot06Objects_LockFloat(BgSpot06Objects* this, PlayState* play) { + BgSpot06Objects_LockSpawnWaterRipples(this, play, 0); if (this->timer != 0) { this->timer--; @@ -411,38 +410,38 @@ void BgSpot06Objects_LockFloat(BgSpot06Objects* this, GlobalContext* globalCtx) } } -void BgSpot06Objects_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot06Objects_Update(Actor* thisx, PlayState* play) { BgSpot06Objects* this = (BgSpot06Objects*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (thisx->params == LHO_WATER_TEMPLE_ENTRANCE_LOCK) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } /** * Draw the Lake Hylia water plane, and scroll its texture */ -void BgSpot06Objects_DrawLakeHyliaWater(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_DrawLakeHyliaWater(BgSpot06Objects* this, PlayState* play) { s32 pad; s32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot06_objects.c", 844); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot06_objects.c", 844); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot06_objects.c", 850), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot06_objects.c", 850), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gameplayFrames = globalCtx->state.frames; + gameplayFrames = play->state.frames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -gameplayFrames, gameplayFrames, 32, 32, 1, gameplayFrames, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -gameplayFrames, gameplayFrames, 32, 32, 1, gameplayFrames, gameplayFrames, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -gameplayFrames, gameplayFrames * 6, 32, 32, 1, - gameplayFrames, gameplayFrames * 6, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -gameplayFrames, gameplayFrames * 6, 32, 32, 1, gameplayFrames, + gameplayFrames * 6, 32, 32)); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); @@ -452,28 +451,28 @@ void BgSpot06Objects_DrawLakeHyliaWater(BgSpot06Objects* this, GlobalContext* gl gSPDisplayList(POLY_XLU_DISP++, gLakeHyliaHighWaterDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot06_objects.c", 879); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot06_objects.c", 879); } -void BgSpot06Objects_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot06Objects_Draw(Actor* thisx, PlayState* play) { BgSpot06Objects* this = (BgSpot06Objects*)thisx; switch (this->dyna.actor.params) { case LHO_WATER_TEMPLE_ENTRACE_GATE: - Gfx_DrawDListOpa(globalCtx, gLakeHyliaWaterTempleGateDL); + Gfx_DrawDListOpa(play, gLakeHyliaWaterTempleGateDL); break; case LHO_WATER_TEMPLE_ENTRANCE_LOCK: - Gfx_DrawDListOpa(globalCtx, gLakeHyliaWaterTempleKeyDL); + Gfx_DrawDListOpa(play, gLakeHyliaWaterTempleKeyDL); if (this->actionFunc == BgSpot06Objects_LockSwimToSurface) { Collider_UpdateSpheres(1, &this->collider); } break; case LHO_WATER_PLANE: - BgSpot06Objects_DrawLakeHyliaWater(this, globalCtx); + BgSpot06Objects_DrawLakeHyliaWater(this, play); break; case LHO_ICE_BLOCK: - Gfx_DrawDListOpa(globalCtx, gLakeHyliaZoraShortcutIceblockDL); + Gfx_DrawDListOpa(play, gLakeHyliaZoraShortcutIceblockDL); break; } } @@ -482,7 +481,7 @@ void BgSpot06Objects_Draw(Actor* thisx, GlobalContext* globalCtx) { * This is where the Lake Hylia water plane waits for the cutscene to set the water risen flag after the Water Temple is * cleared. */ -void BgSpot06Objects_WaterPlaneCutsceneWait(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_WaterPlaneCutsceneWait(BgSpot06Objects* this, PlayState* play) { if (GET_EVENTCHKINF(EVENTCHKINF_69)) { this->actionFunc = BgSpot06Objects_WaterPlaneCutsceneRise; } @@ -491,7 +490,7 @@ void BgSpot06Objects_WaterPlaneCutsceneWait(BgSpot06Objects* this, GlobalContext /** * This is where the Lake Hylia water plane rises in the cutscene after the Water Temple is cleared. */ -void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, GlobalContext* globalCtx) { +void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, PlayState* play) { s32 pad; this->dyna.actor.world.pos.y = this->lakeHyliaWaterLevel + WATER_LEVEL_RAISED; @@ -501,9 +500,9 @@ void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, GlobalContext this->actionFunc = BgSpot06Objects_DoNothing; } else { Math_SmoothStepToF(&this->lakeHyliaWaterLevel, 1.0f, 0.1f, 1.0f, 0.001f); - globalCtx->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_LOWERED; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = this->dyna.actor.world.pos.y; - globalCtx->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = this->dyna.actor.world.pos.y; + play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_LOWERED; + play->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = this->dyna.actor.world.pos.y; + play->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = this->dyna.actor.world.pos.y; } func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h index 2deb727b05..08fdf1e9af 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h @@ -6,7 +6,7 @@ struct BgSpot06Objects; -typedef void (*BgSpot06ObjectsActionFunc)(struct BgSpot06Objects*, GlobalContext*); +typedef void (*BgSpot06ObjectsActionFunc)(struct BgSpot06Objects*, PlayState*); typedef struct BgSpot06Objects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c index 4ea35eb538..f538e02974 100644 --- a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c +++ b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot07Taki_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot07Taki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot07Taki_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot07Taki_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot07Taki_Init(Actor* thisx, PlayState* play); +void BgSpot07Taki_Destroy(Actor* thisx, PlayState* play); +void BgSpot07Taki_Update(Actor* thisx, PlayState* play); +void BgSpot07Taki_Draw(Actor* thisx, PlayState* play); -void BgSpot07Taki_DoNothing(BgSpot07Taki* this, GlobalContext* globalCtx); +void BgSpot07Taki_DoNothing(BgSpot07Taki* this, PlayState* play); const ActorInit Bg_Spot07_Taki_InitVars = { ACTOR_BG_SPOT07_TAKI, @@ -32,7 +32,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgSpot07Taki_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot07Taki_Init(Actor* thisx, PlayState* play) { BgSpot07Taki* this = (BgSpot07Taki*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -45,35 +45,35 @@ void BgSpot07Taki_Init(Actor* thisx, GlobalContext* globalCtx) { } else { CollisionHeader_GetVirtual(&object_spot07_object_Col_0038FC, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } this->actionFunc = BgSpot07Taki_DoNothing; } -void BgSpot07Taki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot07Taki_Destroy(Actor* thisx, PlayState* play) { BgSpot07Taki* this = (BgSpot07Taki*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgSpot07Taki_DoNothing(BgSpot07Taki* this, GlobalContext* globalCtx) { +void BgSpot07Taki_DoNothing(BgSpot07Taki* this, PlayState* play) { } -void BgSpot07Taki_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot07Taki_Update(Actor* thisx, PlayState* play) { BgSpot07Taki* this = (BgSpot07Taki*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot07Taki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot07Taki_Draw(Actor* thisx, PlayState* play) { BgSpot07Taki* this = (BgSpot07Taki*)thisx; u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot07_taki.c", 169); - frames = globalCtx->gameplayFrames; + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot07_taki.c", 169); + frames = play->gameplayFrames; if (LINK_IS_ADULT) { - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot07_taki.c", 177), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot07_taki.c", 177), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->dyna.actor.params == 0) { gSPDisplayList(POLY_OPA_DISP++, object_spot07_object_DL_001CF0); @@ -81,31 +81,31 @@ void BgSpot07Taki_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, object_spot07_object_DL_003210); } } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot07_taki.c", 191), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot07_taki.c", 191), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, ((frames * -1) & 0x7F), ((frames * 1) & 0x7F), 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, ((frames * -1) & 0x7F), ((frames * 1) & 0x7F), 32, 32, 1, ((frames * 1) & 0x7F), ((frames * 1) & 0x7F), 32, 32)); if (!LINK_IS_ADULT) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); if (this->dyna.actor.params == 0) { gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, ((frames * -1) & 0x7F), ((frames * -3) & 0xFF), 64, - 64, 1, ((frames * 1) & 0x7F), ((frames * -3) & 0xFF), 64, 64)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, ((frames * -1) & 0x7F), ((frames * -3) & 0xFF), 64, 64, + 1, ((frames * 1) & 0x7F), ((frames * -3) & 0xFF), 64, 64)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 0, ((frames * 3) & 0x1FF), 32, 128, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 0, ((frames * 3) & 0x1FF), 32, 128, 1, frames * 0, ((frames * 3) & 0x1FF), 32, 128)); gSPDisplayList(POLY_XLU_DISP++, object_spot07_object_DL_000460); } else { gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 0, ((frames * -1) & 0x7F), 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 0, ((frames * -1) & 0x7F), 32, 32, 1, frames * 0, ((frames * -1) & 0x7F), 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 0, ((frames * 3) & 0x1FF), 32, 128, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 0, ((frames * 3) & 0x1FF), 32, 128, 1, frames * 0, ((frames * 3) & 0x1FF), 32, 128)); gSPDisplayList(POLY_XLU_DISP++, object_spot07_object_DL_000BE0); } @@ -114,5 +114,5 @@ void BgSpot07Taki_Draw(Actor* thisx, GlobalContext* globalCtx) { } else { gSPDisplayList(POLY_XLU_DISP++, object_spot07_object_DL_0032D8); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot07_taki.c", 272); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot07_taki.c", 272); } diff --git a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h index c033c68fb6..dcf6ef8edc 100644 --- a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h +++ b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h @@ -6,7 +6,7 @@ struct BgSpot07Taki; -typedef void (*BgSpot07TakiActionFunc)(struct BgSpot07Taki*, GlobalContext*); +typedef void (*BgSpot07TakiActionFunc)(struct BgSpot07Taki*, PlayState*); typedef struct BgSpot07Taki { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c index b0b3efad3b..018e455235 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c @@ -11,13 +11,13 @@ #define FLAGS ACTOR_FLAG_22 -void BgSpot08Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot08Bakudankabe_Init(Actor* thisx, PlayState* play); +void BgSpot08Bakudankabe_Destroy(Actor* thisx, PlayState* play); +void BgSpot08Bakudankabe_Update(Actor* thisx, PlayState* play); +void BgSpot08Bakudankabe_Draw(Actor* thisx, PlayState* play); -void func_808B02D0(BgSpot08Bakudankabe* this, GlobalContext* globalCtx); -void func_808B0324(BgSpot08Bakudankabe* this, GlobalContext* globalCtx); +void func_808B02D0(BgSpot08Bakudankabe* this, PlayState* play); +void func_808B0324(BgSpot08Bakudankabe* this, PlayState* play); const ActorInit Bg_Spot08_Bakudankabe_InitVars = { ACTOR_BG_SPOT08_BAKUDANKABE, @@ -93,14 +93,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void func_808B02D0(BgSpot08Bakudankabe* this, GlobalContext* globalCtx) { +void func_808B02D0(BgSpot08Bakudankabe* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); } -void func_808B0324(BgSpot08Bakudankabe* this, GlobalContext* globalCtx) { +void func_808B0324(BgSpot08Bakudankabe* this, PlayState* play) { s32 pad[2]; s32 i; Vec3f burstDepthY; @@ -144,60 +144,60 @@ void func_808B0324(BgSpot08Bakudankabe* this, GlobalContext* globalCtx) { rotationSpeed = 33; } - EffectSsKakera_Spawn(globalCtx, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, - 4, 0, scale, 1, 3, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, gFieldKakeraDL); + EffectSsKakera_Spawn(play, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, 4, + 0, scale, 1, 3, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, gFieldKakeraDL); } for (i = 0; i < ARRAY_COUNT(D_808B08AC); i++) { burstDepthY.x = this->dyna.actor.world.pos.x + D_808B08AC[i].z * sinY + D_808B08AC[i].x * cosY; burstDepthY.y = this->dyna.actor.world.pos.y + D_808B08AC[i].y; burstDepthY.z = this->dyna.actor.world.pos.z + D_808B08AC[i].z * cosY - (D_808B08AC[i].x * sinY); - func_80033480(globalCtx, &burstDepthY, 120.0f, 4, 0x78, 0xA0, 1); + func_80033480(play, &burstDepthY, 120.0f, 4, 0x78, 0xA0, 1); } } -void BgSpot08Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Bakudankabe_Init(Actor* thisx, PlayState* play) { BgSpot08Bakudankabe* this = (BgSpot08Bakudankabe*)thisx; s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) { + if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { Actor_Kill(&this->dyna.actor); return; } - func_808B02D0(this, globalCtx); + func_808B02D0(this, play); CollisionHeader_GetVirtual(&gZorasFountainBombableWallCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); } -void BgSpot08Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Bakudankabe_Destroy(Actor* thisx, PlayState* play) { BgSpot08Bakudankabe* this = (BgSpot08Bakudankabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->collider); } -void BgSpot08Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Bakudankabe_Update(Actor* thisx, PlayState* play) { BgSpot08Bakudankabe* this = (BgSpot08Bakudankabe*)thisx; if (this->collider.base.acFlags & AC_HIT) { - func_808B0324(this, globalCtx); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params & 0x3F)); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + func_808B0324(this, play); + Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); func_80078884(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->dyna.actor); } else if (this->dyna.actor.xzDistToPlayer < 800.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgSpot08Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Bakudankabe_Draw(Actor* thisx, PlayState* play) { BgSpot08Bakudankabe* this = (BgSpot08Bakudankabe*)thisx; Collider_UpdateSpheres(0, &this->collider); Collider_UpdateSpheres(1, &this->collider); Collider_UpdateSpheres(2, &this->collider); - Gfx_DrawDListOpa(globalCtx, gZorasFountainBombableWallDL); + Gfx_DrawDListOpa(play, gZorasFountainBombableWallDL); } 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 de8552d341..3e923a2dd3 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 @@ -9,17 +9,17 @@ #define FLAGS 0 -void BgSpot08Iceblock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Iceblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Iceblock_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot08Iceblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); +void BgSpot08Iceblock_FloatNonrotating(BgSpot08Iceblock* this, PlayState* play); void BgSpot08Iceblock_SetupFloatRotating(BgSpot08Iceblock* this); -void BgSpot08Iceblock_FloatRotating(BgSpot08Iceblock* this, GlobalContext* globalCtx); +void BgSpot08Iceblock_FloatRotating(BgSpot08Iceblock* this, PlayState* play); void BgSpot08Iceblock_SetupFloatOrbitingTwins(BgSpot08Iceblock* this); -void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, GlobalContext* globalCtx); +void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, PlayState* play); void BgSpot08Iceblock_SetupNoAction(BgSpot08Iceblock* this); const ActorInit Bg_Spot08_Iceblock_InitVars = { @@ -38,15 +38,14 @@ void BgSpot08Iceblock_SetupAction(BgSpot08Iceblock* this, BgSpot08IceblockAction this->actionFunc = actionFunc; } -void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, GlobalContext* globalCtx, CollisionHeader* collision, - s32 flags) { +void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning: move BG registration failed" osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot08_iceblock.c", 0xD9, @@ -158,7 +157,7 @@ static f32 sRollCoss[] = { * 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, GlobalContext* globalCtx) { +void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, PlayState* play) { f32 deviationFromVertSq; f32 stabilityCorrection; Vec3f surfaceNormalHorizontal; @@ -172,7 +171,7 @@ void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, GlobalContext* globalCtx) { s32 rollDataIndex; MtxF mtx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); switch (this->dyna.actor.params & 0xFF) { case 0x11: // Medium nonrotating @@ -251,7 +250,7 @@ void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, GlobalContext* globalCtx) { Matrix_MtxFToYXZRotS(&mtx, &this->dyna.actor.shape.rot, 0); } -void BgSpot08Iceblock_SpawnTwinFloe(BgSpot08Iceblock* this, GlobalContext* globalCtx) { +void BgSpot08Iceblock_SpawnTwinFloe(BgSpot08Iceblock* this, PlayState* play) { s32 pad[2]; f32 sin; f32 cos; @@ -260,7 +259,7 @@ void BgSpot08Iceblock_SpawnTwinFloe(BgSpot08Iceblock* this, GlobalContext* globa cos = Math_CosS(this->dyna.actor.home.rot.y) * 100.0f; if (!(this->dyna.actor.params & 0x100)) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_SPOT08_ICEBLOCK, + 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); @@ -280,7 +279,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 2200, ICHAIN_STOP), }; -void BgSpot08Iceblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) { BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; CollisionHeader* colHeader; @@ -300,10 +299,10 @@ void BgSpot08Iceblock_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->dyna.actor.params & 0xF) { case 2: case 3: - BgSpot08Iceblock_InitDynaPoly(this, globalCtx, colHeader, DPM_UNK3); + BgSpot08Iceblock_InitDynaPoly(this, play, colHeader, DPM_UNK3); break; default: - BgSpot08Iceblock_InitDynaPoly(this, globalCtx, colHeader, DPM_UNK); + BgSpot08Iceblock_InitDynaPoly(this, play, colHeader, DPM_UNK); break; } @@ -340,7 +339,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, GlobalContext* globalCtx) { BgSpot08Iceblock_SetupFloatRotating(this); break; case 3: - BgSpot08Iceblock_SpawnTwinFloe(this, globalCtx); + BgSpot08Iceblock_SpawnTwinFloe(this, play); break; case 4: BgSpot08Iceblock_SetupNoAction(this); @@ -348,42 +347,42 @@ void BgSpot08Iceblock_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot08Iceblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Iceblock_Destroy(Actor* thisx, PlayState* play) { BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgSpot08Iceblock_SetupFloatNonrotating(BgSpot08Iceblock* this) { BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_FloatNonrotating); } -void BgSpot08Iceblock_FloatNonrotating(BgSpot08Iceblock* this, GlobalContext* globalCtx) { +void BgSpot08Iceblock_FloatNonrotating(BgSpot08Iceblock* this, PlayState* play) { BgSpot08Iceblock_Bobbing(this); BgSpot08Iceblock_SinkUnderPlayer(this); BgSpot08Iceblock_SetWaterline(this); this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y; - BgSpot08Iceblock_Roll(this, globalCtx); + BgSpot08Iceblock_Roll(this, play); } void BgSpot08Iceblock_SetupFloatRotating(BgSpot08Iceblock* this) { BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_FloatRotating); } -void BgSpot08Iceblock_FloatRotating(BgSpot08Iceblock* this, GlobalContext* globalCtx) { +void BgSpot08Iceblock_FloatRotating(BgSpot08Iceblock* this, PlayState* play) { BgSpot08Iceblock_Bobbing(this); BgSpot08Iceblock_SinkUnderPlayer(this); BgSpot08Iceblock_SetWaterline(this); this->dyna.actor.world.rot.y = this->dyna.actor.world.rot.y + 0x190; this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; - BgSpot08Iceblock_Roll(this, globalCtx); + BgSpot08Iceblock_Roll(this, play); } void BgSpot08Iceblock_SetupFloatOrbitingTwins(BgSpot08Iceblock* this) { BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_FloatOrbitingTwins); } -void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, GlobalContext* globalCtx) { +void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, PlayState* play) { f32 cos; f32 sin; @@ -407,14 +406,14 @@ void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, GlobalContext* } this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y; - BgSpot08Iceblock_Roll(this, globalCtx); + BgSpot08Iceblock_Roll(this, play); } void BgSpot08Iceblock_SetupNoAction(BgSpot08Iceblock* this) { BgSpot08Iceblock_SetupAction(this, NULL); } -void BgSpot08Iceblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Iceblock_Update(Actor* thisx, PlayState* play) { BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; if (Rand_ZeroOne() < 0.05f) { @@ -425,11 +424,11 @@ void BgSpot08Iceblock_Update(Actor* thisx, GlobalContext* globalCtx) { this->bobPhaseSlow += this->bobIncrSlow; this->bobPhaseFast += this->bobIncrFast; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgSpot08Iceblock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot08Iceblock_Draw(Actor* thisx, PlayState* play) { Gfx* dList; BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; @@ -442,5 +441,5 @@ void BgSpot08Iceblock_Draw(Actor* thisx, GlobalContext* globalCtx) { break; } - Gfx_DrawDListOpa(globalCtx, dList); + Gfx_DrawDListOpa(play, dList); } 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 2fc0b2a722..a59e3a3561 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,7 +6,7 @@ struct BgSpot08Iceblock; -typedef void (*BgSpot08IceblockActionFunc)(struct BgSpot08Iceblock*, GlobalContext*); +typedef void (*BgSpot08IceblockActionFunc)(struct BgSpot08Iceblock*, PlayState*); typedef struct BgSpot08Iceblock { /* 0x0000 */ DynaPolyActor dyna; 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 5c3f1a1ca0..080b6d3361 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 @@ -9,14 +9,14 @@ #define FLAGS 0 -void BgSpot09Obj_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot09Obj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot09Obj_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot09Obj_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot09Obj_Init(Actor* thisx, PlayState* play); +void BgSpot09Obj_Destroy(Actor* thisx, PlayState* play); +void BgSpot09Obj_Update(Actor* thisx, PlayState* play); +void BgSpot09Obj_Draw(Actor* thisx, PlayState* play); -s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx); -s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx); -s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx); +s32 func_808B1AE0(BgSpot09Obj* this, PlayState* play); +s32 func_808B1BA0(BgSpot09Obj* this, PlayState* play); +s32 func_808B1BEC(BgSpot09Obj* this, PlayState* play); const ActorInit Bg_Spot09_Obj_InitVars = { ACTOR_BG_SPOT09_OBJ, @@ -34,7 +34,7 @@ static CollisionHeader* D_808B1F90[] = { NULL, &gValleyObjects1Col, &gValleyObjects2Col, &gValleyObjects3Col, &gValleyObjects4Col, }; -static s32 (*D_808B1FA4[])(BgSpot09Obj* this, GlobalContext* globalCtx) = { +static s32 (*D_808B1FA4[])(BgSpot09Obj* this, PlayState* play) = { func_808B1BEC, func_808B1AE0, func_808B1BA0, @@ -56,7 +56,7 @@ static Gfx* sDLists[] = { gValleyBridgeSidesDL, gValleyBrokenBridgeDL, gValleyBridgeChildDL, gCarpentersTentDL, gValleyRepairedBridgeDL, }; -s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1AE0(BgSpot09Obj* this, PlayState* play) { s32 carpentersRescued; if (gSaveContext.sceneSetupIndex >= 4) { @@ -83,7 +83,7 @@ s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { return 0; } -s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1BA0(BgSpot09Obj* this, PlayState* play) { if (this->dyna.actor.params == 3) { Actor_SetScale(&this->dyna.actor, 0.1f); } else { @@ -92,7 +92,7 @@ s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx) { return 1; } -s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1BEC(BgSpot09Obj* this, PlayState* play) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2[2]; @@ -100,41 +100,41 @@ s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx) { if (D_808B1F90[this->dyna.actor.params] != NULL) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(D_808B1F90[this->dyna.actor.params], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } return true; } -s32 func_808B1C70(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1C70(BgSpot09Obj* this, PlayState* play) { s32 i; for (i = 0; i < ARRAY_COUNT(D_808B1FA4); i++) { - if (!D_808B1FA4[i](this, globalCtx)) { + if (!D_808B1FA4[i](this, play)) { return false; } } return true; } -s32 func_808B1CEC(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1CEC(BgSpot09Obj* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain1); return true; } -s32 func_808B1D18(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1D18(BgSpot09Obj* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain2); return true; } -s32 func_808B1D44(BgSpot09Obj* this, GlobalContext* globalCtx) { +s32 func_808B1D44(BgSpot09Obj* this, PlayState* play) { if (this->dyna.actor.params == 3) { - return func_808B1D18(this, globalCtx); + return func_808B1D18(this, play); } else { - return func_808B1CEC(this, globalCtx); + return func_808B1CEC(this, play); } } -void BgSpot09Obj_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot09Obj_Init(Actor* thisx, PlayState* play) { BgSpot09Obj* this = (BgSpot09Obj*)thisx; osSyncPrintf("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", this->dyna.actor.params, @@ -145,37 +145,37 @@ void BgSpot09Obj_Init(Actor* thisx, GlobalContext* globalCtx) { "../z_bg_spot09_obj.c", 322, this->dyna.actor.params); } - if (!func_808B1C70(this, globalCtx)) { + if (!func_808B1C70(this, play)) { Actor_Kill(&this->dyna.actor); - } else if (!func_808B1D44(this, globalCtx)) { + } else if (!func_808B1D44(this, play)) { Actor_Kill(&this->dyna.actor); } } -void BgSpot09Obj_Destroy(Actor* thisx, GlobalContext* globalCtx) { - DynaCollisionContext* dynaColCtx = &globalCtx->colCtx.dyna; +void BgSpot09Obj_Destroy(Actor* thisx, PlayState* play) { + DynaCollisionContext* dynaColCtx = &play->colCtx.dyna; BgSpot09Obj* this = (BgSpot09Obj*)thisx; if (this->dyna.actor.params != 0) { - DynaPoly_DeleteBgActor(globalCtx, dynaColCtx, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, dynaColCtx, this->dyna.bgId); } } -void BgSpot09Obj_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot09Obj_Update(Actor* thisx, PlayState* play) { } -void BgSpot09Obj_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]); +void BgSpot09Obj_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sDLists[thisx->params]); if (thisx->params == 3) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 388); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot09_obj.c", 388); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 391), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot09_obj.c", 391), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCarpentersTentEntranceDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 396); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot09_obj.c", 396); } } diff --git a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c index d1c057737d..cf4ca5f010 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c @@ -11,10 +11,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot11Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot11Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot11Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot11Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot11Bakudankabe_Init(Actor* thisx, PlayState* play); +void BgSpot11Bakudankabe_Destroy(Actor* thisx, PlayState* play); +void BgSpot11Bakudankabe_Update(Actor* thisx, PlayState* play); +void BgSpot11Bakudankabe_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Spot11_Bakudankabe_InitVars = { ACTOR_BG_SPOT11_BAKUDANKABE, @@ -51,17 +51,17 @@ static ColliderCylinderInit sCylinderInit = { static Vec3f D_808B272C = { 2259.0f, 108.0f, -1550.0f }; static Vec3f D_808B2738 = { 2259.0f, 108.0f, -1550.0f }; -void func_808B2180(BgSpot11Bakudankabe* this, GlobalContext* globalCtx) { +void func_808B2180(BgSpot11Bakudankabe* this, PlayState* play) { s32 pad; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); this->collider.dim.pos.x += (s16)this->dyna.actor.world.pos.x; this->collider.dim.pos.y += (s16)this->dyna.actor.world.pos.y; this->collider.dim.pos.z += (s16)this->dyna.actor.world.pos.z; } -void func_808B2218(BgSpot11Bakudankabe* this, GlobalContext* globalCtx) { +void func_808B2218(BgSpot11Bakudankabe* this, PlayState* play) { Actor* thisx = &this->dyna.actor; Vec3f burstDepthY; Vec3f burstDepthX; @@ -96,57 +96,57 @@ void func_808B2218(BgSpot11Bakudankabe* this, GlobalContext* globalCtx) { } else { rotationSpeed = 33; } - EffectSsKakera_Spawn(globalCtx, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, - 4, 0, scale, 1, 3, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, gFieldKakeraDL); + EffectSsKakera_Spawn(play, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, 4, + 0, scale, 1, 3, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, gFieldKakeraDL); } Math_Vec3f_Sum(&thisx->world.pos, &D_808B272C, &burstDepthY); - func_80033480(globalCtx, &burstDepthY, 70, 4, 110, 160, 1); + func_80033480(play, &burstDepthY, 70, 4, 110, 160, 1); burstDepthY.y += 40; - func_80033480(globalCtx, &burstDepthY, 70, 5, 110, 160, 1); + func_80033480(play, &burstDepthY, 70, 5, 110, 160, 1); burstDepthY.y += 40; - func_80033480(globalCtx, &burstDepthY, 70, 4, 110, 160, 1); + func_80033480(play, &burstDepthY, 70, 4, 110, 160, 1); } -void BgSpot11Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Bakudankabe_Init(Actor* thisx, PlayState* play) { BgSpot11Bakudankabe* this = (BgSpot11Bakudankabe*)thisx; s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) { + if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { Actor_Kill(&this->dyna.actor); return; } - func_808B2180(this, globalCtx); + func_808B2180(this, play); CollisionHeader_GetVirtual(&gDesertColossusBombableWallCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_SetScale(&this->dyna.actor, 1.0f); osSyncPrintf("(spot11 爆弾壁)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgSpot11Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Bakudankabe_Destroy(Actor* thisx, PlayState* play) { BgSpot11Bakudankabe* this = (BgSpot11Bakudankabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); } -void BgSpot11Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Bakudankabe_Update(Actor* thisx, PlayState* play) { BgSpot11Bakudankabe* this = (BgSpot11Bakudankabe*)thisx; if (this->collider.base.acFlags & AC_HIT) { - func_808B2218(this, globalCtx); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params & 0x3F)); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &D_808B2738, 40, NA_SE_EV_WALL_BROKEN); + func_808B2218(this, play); + Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); + SoundSource_PlaySfxAtFixedWorldPos(play, &D_808B2738, 40, NA_SE_EV_WALL_BROKEN); func_80078884(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->dyna.actor); return; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void BgSpot11Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Bakudankabe_Draw(Actor* thisx, PlayState* play) { BgSpot11Bakudankabe* this = (BgSpot11Bakudankabe*)thisx; - Gfx_DrawDListOpa(globalCtx, gDesertColossusBombableWallDL); + Gfx_DrawDListOpa(play, gDesertColossusBombableWallDL); } diff --git a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c index c903125849..8f96638776 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c @@ -10,15 +10,15 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot11Oasis_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot11Oasis_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot11Oasis_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot11Oasis_Init(Actor* thisx, PlayState* play); +void BgSpot11Oasis_Update(Actor* thisx, PlayState* play); +void BgSpot11Oasis_Draw(Actor* thisx, PlayState* play); void func_808B2970(BgSpot11Oasis* this); -void func_808B2980(BgSpot11Oasis* this, GlobalContext* globalCtx); +void func_808B2980(BgSpot11Oasis* this, PlayState* play); void func_808B29E0(BgSpot11Oasis* this); -void func_808B29F0(BgSpot11Oasis* this, GlobalContext* globalCtx); +void func_808B29F0(BgSpot11Oasis* this, PlayState* play); void func_808B2AA8(BgSpot11Oasis* this); -void func_808B2AB8(BgSpot11Oasis* this, GlobalContext* globalCtx); +void func_808B2AB8(BgSpot11Oasis* this, PlayState* play); const ActorInit Bg_Spot11_Oasis_InitVars = { ACTOR_BG_SPOT11_OASIS, @@ -48,14 +48,14 @@ static Vec3f D_808B2E34[] = { { -75.0f, -90.0f, 90.0f }, { 30.0f, -100.0f, 40.0f }, }; -void func_808B27F0(GlobalContext* globalCtx, s16 waterSurface) { - WaterBox* waterBox = &globalCtx->colCtx.colHeader->waterBoxes[0]; +void func_808B27F0(PlayState* play, s16 waterSurface) { + WaterBox* waterBox = &play->colCtx.colHeader->waterBoxes[0]; waterBox->ySurface = waterSurface; } -s32 func_808B280C(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_808B280C(PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp58; Vec3f sp4C; Vec3f sp40; @@ -80,22 +80,22 @@ s32 func_808B280C(GlobalContext* globalCtx) { return 0; } -void BgSpot11Oasis_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Oasis_Init(Actor* thisx, PlayState* play) { BgSpot11Oasis* this = (BgSpot11Oasis*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); func_808B2970(this); this->actor.world.pos.y = -100.0f; - func_808B27F0(globalCtx, -100); + func_808B27F0(play, -100); } void func_808B2970(BgSpot11Oasis* this) { this->actionFunc = func_808B2980; } -void func_808B2980(BgSpot11Oasis* this, GlobalContext* globalCtx) { - if (Flags_GetEnv(globalCtx, 5) && func_808B280C(globalCtx)) { - OnePointCutscene_Init(globalCtx, 4150, -99, &this->actor, CAM_ID_MAIN); +void func_808B2980(BgSpot11Oasis* this, PlayState* play) { + if (Flags_GetEnv(play, 5) && func_808B280C(play)) { + OnePointCutscene_Init(play, 4150, -99, &this->actor, CAM_ID_MAIN); func_808B29E0(this); } } @@ -104,40 +104,40 @@ void func_808B29E0(BgSpot11Oasis* this) { this->actionFunc = func_808B29F0; } -void func_808B29F0(BgSpot11Oasis* this, GlobalContext* globalCtx) { +void func_808B29F0(BgSpot11Oasis* this, PlayState* play) { if (Math_StepToF(&this->actor.world.pos.y, 0.0f, 0.7f)) { func_808B2AA8(this); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, - this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, FAIRY_SPAWNER); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, + this->actor.world.pos.z, 0, 0, 0, FAIRY_SPAWNER); func_80078884(NA_SE_SY_CORRECT_CHIME); } - func_808B27F0(globalCtx, this->actor.world.pos.y); + func_808B27F0(play, this->actor.world.pos.y); } void func_808B2AA8(BgSpot11Oasis* this) { this->actionFunc = func_808B2AB8; } -void func_808B2AB8(BgSpot11Oasis* this, GlobalContext* globalCtx) { +void func_808B2AB8(BgSpot11Oasis* this, PlayState* play) { } -void BgSpot11Oasis_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot11Oasis_Update(Actor* thisx, PlayState* play) { BgSpot11Oasis* this = (BgSpot11Oasis*)thisx; s32 pad; u32 gameplayFrames; Vec3f sp30; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc == func_808B2980) { this->actor.draw = NULL; return; } this->actor.draw = BgSpot11Oasis_Draw; if (this->unk_150 && (this->actor.projectedPos.z < 400.0f) && (this->actor.projectedPos.z > -40.0f)) { - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; if (gameplayFrames & 4) { Math_Vec3f_Sum(&this->actor.world.pos, &D_808B2E34[this->unk_151], &sp30); - EffectSsBubble_Spawn(globalCtx, &sp30, 0.0f, 15.0f, 50.0f, (Rand_ZeroOne() * 0.12f) + 0.02f); + EffectSsBubble_Spawn(play, &sp30, 0.0f, 15.0f, 50.0f, (Rand_ZeroOne() * 0.12f) + 0.02f); if (Rand_ZeroOne() < 0.3f) { this->unk_151 = Rand_ZeroOne() * 4.9f; } @@ -147,16 +147,16 @@ void BgSpot11Oasis_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot11Oasis_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 gameplayFrames = globalCtx->gameplayFrames; +void BgSpot11Oasis_Draw(Actor* thisx, PlayState* play) { + u32 gameplayFrames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot11_oasis.c", 327); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot11_oasis.c", 331), + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot11_oasis.c", 327); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot11_oasis.c", 331), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, - 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, 32, 32, + 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPDisplayList(POLY_XLU_DISP++, gDesertColossusOasisDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot11_oasis.c", 346); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot11_oasis.c", 346); } diff --git a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h index a1e18e87ab..cae716a00a 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h +++ b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h @@ -6,7 +6,7 @@ struct BgSpot11Oasis; -typedef void (*BgSpot11OasisActionFunc)(struct BgSpot11Oasis*, GlobalContext*); +typedef void (*BgSpot11OasisActionFunc)(struct BgSpot11Oasis*, PlayState*); typedef struct BgSpot11Oasis { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index 1aa6128c0c..99d669ffac 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 @@ -9,19 +9,19 @@ #define FLAGS 0 -void BgSpot12Gate_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Gate_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Gate_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Gate_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot12Gate_Init(Actor* thisx, PlayState* play); +void BgSpot12Gate_Destroy(Actor* thisx, PlayState* play); +void BgSpot12Gate_Update(Actor* thisx, PlayState* play); +void BgSpot12Gate_Draw(Actor* thisx, PlayState* play); void func_808B30C0(BgSpot12Gate* this); -void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx); +void func_808B30D8(BgSpot12Gate* this, PlayState* play); void func_808B3134(BgSpot12Gate* this); -void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx); +void func_808B314C(BgSpot12Gate* this, PlayState* play); void func_808B317C(BgSpot12Gate* this); -void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx); +void func_808B318C(BgSpot12Gate* this, PlayState* play); void func_808B3274(BgSpot12Gate* this); -void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx); +void func_808B3298(BgSpot12Gate* this, PlayState* play); const ActorInit Bg_Spot12_Gate_InitVars = { ACTOR_BG_SPOT12_GATE, @@ -42,37 +42,37 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1200, ICHAIN_STOP), }; -void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flags) { +void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_gate.c", 145, this->dyna.actor.id, this->dyna.actor.params); } } -void BgSpot12Gate_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Gate_Init(Actor* thisx, PlayState* play) { BgSpot12Gate* this = (BgSpot12Gate*)thisx; - BgSpot12Gate_InitDynaPoly(this, globalCtx, &gGerudoFortressWastelandGateCol, DPM_UNK); + BgSpot12Gate_InitDynaPoly(this, play, &gGerudoFortressWastelandGateCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { func_808B3274(this); } else { func_808B30C0(this); } } -void BgSpot12Gate_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Gate_Destroy(Actor* thisx, PlayState* play) { BgSpot12Gate* this = (BgSpot12Gate*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_808B30C0(BgSpot12Gate* this) { @@ -80,10 +80,10 @@ void func_808B30C0(BgSpot12Gate* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } -void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { +void func_808B30D8(BgSpot12Gate* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { func_808B3134(this); - OnePointCutscene_Init(globalCtx, 4160, -99, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4160, -99, &this->dyna.actor, CAM_ID_MAIN); } } @@ -92,7 +92,7 @@ void func_808B3134(BgSpot12Gate* this) { this->unk_168 = 40; } -void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx) { +void func_808B314C(BgSpot12Gate* this, PlayState* play) { if (this->unk_168 <= 0) { func_808B317C(this); } @@ -102,7 +102,7 @@ void func_808B317C(BgSpot12Gate* this) { this->actionFunc = func_808B318C; } -void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) { +void func_808B318C(BgSpot12Gate* this, PlayState* play) { s32 pad; s32 var; @@ -110,7 +110,7 @@ void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, this->dyna.actor.velocity.y)) { func_808B3274(this); - var = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + var = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(var, -0x3CB0); Quake_SetQuakeValues(var, 3, 0, 0, 0); Quake_SetCountdown(var, 0xC); @@ -125,18 +125,18 @@ void func_808B3274(BgSpot12Gate* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 200.0f; } -void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx) { +void func_808B3298(BgSpot12Gate* this, PlayState* play) { } -void BgSpot12Gate_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Gate_Update(Actor* thisx, PlayState* play) { BgSpot12Gate* this = (BgSpot12Gate*)thisx; if (this->unk_168 > 0) { this->unk_168--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot12Gate_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gGerudoFortressWastelandGateDL); +void BgSpot12Gate_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gGerudoFortressWastelandGateDL); } diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h index 361873d25d..2e9989fc21 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h @@ -6,7 +6,7 @@ struct BgSpot12Gate; -typedef void (*BgSpot12GateActionFunc)(struct BgSpot12Gate*, GlobalContext*); +typedef void (*BgSpot12GateActionFunc)(struct BgSpot12Gate*, PlayState*); typedef struct BgSpot12Gate { /* 0x0000 */ DynaPolyActor dyna; 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 5d1f79087c..e47aa300f9 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 @@ -9,17 +9,17 @@ #define FLAGS 0 -void BgSpot12Saku_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Saku_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Saku_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot12Saku_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot12Saku_Init(Actor* thisx, PlayState* play); +void BgSpot12Saku_Destroy(Actor* thisx, PlayState* play); +void BgSpot12Saku_Update(Actor* thisx, PlayState* play); +void BgSpot12Saku_Draw(Actor* thisx, PlayState* play); void func_808B3550(BgSpot12Saku* this); -void func_808B357C(BgSpot12Saku* this, GlobalContext* globalCtx); +void func_808B357C(BgSpot12Saku* this, PlayState* play); void func_808B35E4(BgSpot12Saku* this); -void func_808B3604(BgSpot12Saku* this, GlobalContext* globalCtx); +void func_808B3604(BgSpot12Saku* this, PlayState* play); void func_808B3714(BgSpot12Saku* this); -void func_808B37AC(BgSpot12Saku* this, GlobalContext* globalCtx); +void func_808B37AC(BgSpot12Saku* this, PlayState* play); const ActorInit Bg_Spot12_Saku_InitVars = { ACTOR_BG_SPOT12_SAKU, @@ -40,36 +40,36 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void func_808B3420(BgSpot12Saku* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flags) { +void func_808B3420(BgSpot12Saku* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_saku.c", 140, this->dyna.actor.id, this->dyna.actor.params); } } -void BgSpot12Saku_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Saku_Init(Actor* thisx, PlayState* play) { BgSpot12Saku* this = (BgSpot12Saku*)thisx; - func_808B3420(this, globalCtx, &gGerudoFortressGTGShutterCol, DPM_UNK); + func_808B3420(this, play, &gGerudoFortressGTGShutterCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { func_808B3714(this); } else { func_808B3550(this); } } -void BgSpot12Saku_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Saku_Destroy(Actor* thisx, PlayState* play) { BgSpot12Saku* this = (BgSpot12Saku*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_808B3550(BgSpot12Saku* this) { @@ -79,11 +79,11 @@ void func_808B3550(BgSpot12Saku* this) { this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; } -void func_808B357C(BgSpot12Saku* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { +void func_808B357C(BgSpot12Saku* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { func_808B35E4(this); this->timer = 20; - OnePointCutscene_Init(globalCtx, 4170, -99, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4170, -99, &this->dyna.actor, CAM_ID_MAIN); } } @@ -93,7 +93,7 @@ void func_808B35E4(BgSpot12Saku* this) { } } -void func_808B3604(BgSpot12Saku* this, GlobalContext* globalCtx) { +void func_808B3604(BgSpot12Saku* this, PlayState* play) { f32 temp_ret = Math_SmoothStepToF(&this->dyna.actor.scale.x, 0.001f / 0.14f, 0.16f, 0.0022f, 0.001f); f32 temp_f18 = ((0.1f - this->dyna.actor.scale.x) * 840.0f); @@ -118,18 +118,18 @@ void func_808B3714(BgSpot12Saku* this) { this->dyna.actor.home.pos.z - (Math_CosS(this->dyna.actor.shape.rot.y + 0x4000) * 78.0f); } -void func_808B37AC(BgSpot12Saku* this, GlobalContext* globalCtx) { +void func_808B37AC(BgSpot12Saku* this, PlayState* play) { } -void BgSpot12Saku_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot12Saku_Update(Actor* thisx, PlayState* play) { BgSpot12Saku* this = (BgSpot12Saku*)thisx; if (this->timer > 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot12Saku_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gGerudoFortressGTGShutterDL); +void BgSpot12Saku_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gGerudoFortressGTGShutterDL); } 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 b8c8ef7390..d96967300c 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 @@ -6,7 +6,7 @@ struct BgSpot12Saku; -typedef void (*BgSpot12SakuActionFunc)(struct BgSpot12Saku*, GlobalContext*); +typedef void (*BgSpot12SakuActionFunc)(struct BgSpot12Saku*, PlayState*); typedef struct BgSpot12Saku { /* 0x0000 */ DynaPolyActor dyna; 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 a976985237..a45cce6e30 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 @@ -9,19 +9,19 @@ #define FLAGS 0 -void BgSpot15Rrbox_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Rrbox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Rrbox_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Rrbox_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot15Rrbox_Init(Actor* thisx, PlayState* play); +void BgSpot15Rrbox_Destroy(Actor* thisx, PlayState* play); +void BgSpot15Rrbox_Update(Actor* thisx, PlayState* play); +void BgSpot15Rrbox_Draw(Actor* thisx, PlayState* play); -void func_808B4084(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B40AC(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B4380(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B43D0(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B44B8(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B4178(BgSpot15Rrbox* this, GlobalContext* globalCtx); -void func_808B44CC(BgSpot15Rrbox* this, GlobalContext* globalCtx); +void func_808B4084(BgSpot15Rrbox* this, PlayState* play); +void func_808B40AC(BgSpot15Rrbox* this, PlayState* play); +void func_808B4194(BgSpot15Rrbox* this, PlayState* play); +void func_808B4380(BgSpot15Rrbox* this, PlayState* play); +void func_808B43D0(BgSpot15Rrbox* this, PlayState* play); +void func_808B44B8(BgSpot15Rrbox* this, PlayState* play); +void func_808B4178(BgSpot15Rrbox* this, PlayState* play); +void func_808B44CC(BgSpot15Rrbox* this, PlayState* play); static s16 D_808B4590 = 0; @@ -54,7 +54,7 @@ static Vec3f D_808B45DC[] = { { 29.99f, 0.01f, 29.99f }, { 0.0f, 0.01f, 0.0f }, }; -void func_808B3960(BgSpot15Rrbox* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flags) { +void func_808B3960(BgSpot15Rrbox* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; u32 pad2; @@ -62,7 +62,7 @@ void func_808B3960(BgSpot15Rrbox* this, GlobalContext* globalCtx, CollisionHeade DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot15_rrbox.c", 171, @@ -80,8 +80,8 @@ void func_808B3A34(BgSpot15Rrbox* this) { this->bgId = BG_ACTOR_MAX; } -s32 func_808B3A40(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->bgId); +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, @@ -91,13 +91,13 @@ s32 func_808B3A40(BgSpot15Rrbox* this, GlobalContext* globalCtx) { return false; } -s32 func_808B3AAC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +s32 func_808B3AAC(BgSpot15Rrbox* this, PlayState* play) { s16 rotY; Actor* actor = &this->dyna.actor; - if (globalCtx->sceneNum == SCENE_SOUKO) { + if (play->sceneNum == SCENE_SOUKO) { return true; - } else if (func_808B3A40(this, globalCtx)) { + } else if (func_808B3A40(this, play)) { return false; } @@ -117,30 +117,30 @@ s32 func_808B3AAC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { return true; } -void BgSpot15Rrbox_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Rrbox_Init(Actor* thisx, PlayState* play) { BgSpot15Rrbox* this = (BgSpot15Rrbox*)thisx; - func_808B3960(this, globalCtx, &gLonLonMilkCrateCol, DPM_UNK); + func_808B3960(this, play, &gLonLonMilkCrateCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); func_808B3A34(this); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) { - func_808B44B8(this, globalCtx); + if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { + func_808B44B8(this, play); this->dyna.actor.world.pos = D_808B45C4[D_808B4590]; D_808B4590++; } else { - func_808B4084(this, globalCtx); + func_808B4084(this, play); } osSyncPrintf("(spot15 ロンロン木箱)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void BgSpot15Rrbox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Rrbox_Destroy(Actor* thisx, PlayState* play) { BgSpot15Rrbox* this = (BgSpot15Rrbox*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); D_808B4590 = 0; } -s32 func_808B3CA0(BgSpot15Rrbox* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_808B3CA0(BgSpot15Rrbox* this, PlayState* play, s32 arg2) { f32 chkDist = 0.0f; Vec3f actorPosition; Vec3f actorScale; @@ -157,8 +157,8 @@ s32 func_808B3CA0(BgSpot15Rrbox* this, GlobalContext* globalCtx, s32 arg2) { actorPosition.y += this->dyna.actor.prevPos.y; actorPosition.z += this->dyna.actor.world.pos.z; - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor6(&globalCtx->colCtx, &this->dyna.actor.floorPoly, - &this->bgId, &this->dyna.actor, &actorPosition, chkDist); + this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor6(&play->colCtx, &this->dyna.actor.floorPoly, &this->bgId, + &this->dyna.actor, &actorPosition, chkDist); if ((this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) >= -0.001f) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; @@ -167,7 +167,7 @@ s32 func_808B3CA0(BgSpot15Rrbox* this, GlobalContext* globalCtx, s32 arg2) { return false; } -f32 func_808B3DDC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +f32 func_808B3DDC(BgSpot15Rrbox* this, PlayState* play) { s32 i; Vec3f position; Vec3f scale; @@ -188,7 +188,7 @@ f32 func_808B3DDC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { position.y += actor->prevPos.y; position.z += actor->world.pos.z; - yIntersect = BgCheck_EntityRaycastFloor6(&globalCtx->colCtx, &actor->floorPoly, &bgId, actor, &position, 0); + yIntersect = BgCheck_EntityRaycastFloor6(&play->colCtx, &actor->floorPoly, &bgId, actor, &position, 0); if (returnValue < yIntersect) { returnValue = yIntersect; @@ -198,31 +198,31 @@ f32 func_808B3DDC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { return returnValue; } -s32 func_808B3F58(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - if (func_808B3CA0(this, globalCtx, 0)) { +s32 func_808B3F58(BgSpot15Rrbox* this, PlayState* play) { + if (func_808B3CA0(this, play, 0)) { return true; } - if (func_808B3CA0(this, globalCtx, 1)) { + if (func_808B3CA0(this, play, 1)) { return true; } - if (func_808B3CA0(this, globalCtx, 2)) { + if (func_808B3CA0(this, play, 2)) { return true; } - if (func_808B3CA0(this, globalCtx, 3)) { + if (func_808B3CA0(this, play, 3)) { return true; } - if (func_808B3CA0(this, globalCtx, 4)) { + if (func_808B3CA0(this, play, 4)) { return true; } return false; } -s32 func_808B4010(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - return !func_800435D8(globalCtx, &this->dyna, this->dyna.actor.scale.x * 290.0f, +s32 func_808B4010(BgSpot15Rrbox* this, PlayState* play) { + return !func_800435D8(play, &this->dyna, this->dyna.actor.scale.x * 290.0f, this->dyna.actor.scale.x * 290.0f + 20.0f, 1.0f); } -void func_808B4084(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B4084(BgSpot15Rrbox* this, PlayState* play) { this->actionFunc = func_808B40AC; this->dyna.actor.gravity = 0.0f; this->dyna.actor.velocity.x = 0.0f; @@ -230,13 +230,13 @@ void func_808B4084(BgSpot15Rrbox* this, GlobalContext* globalCtx) { this->dyna.actor.velocity.z = 0.0f; } -void func_808B40AC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808B40AC(BgSpot15Rrbox* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_168 <= 0 && fabsf(this->dyna.unk_150) > 0.001f) { - if (func_808B3AAC(this, globalCtx) && !func_808B4010(this, globalCtx)) { + if (func_808B3AAC(this, play) && !func_808B4010(this, play)) { this->unk_17C = this->dyna.unk_150; - func_808B4178(this, globalCtx); + func_808B4178(this, play); } else { player->stateFlags2 &= ~PLAYER_STATE2_4; this->dyna.unk_150 = 0.0f; @@ -247,14 +247,14 @@ void func_808B40AC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { } } -void func_808B4178(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B4178(BgSpot15Rrbox* this, PlayState* play) { this->actionFunc = func_808B4194; this->dyna.actor.gravity = 0.0f; } -void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B4194(BgSpot15Rrbox* this, PlayState* play) { f32 sign; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 tempUnk178; s32 approxFResult; Actor* actor = &this->dyna.actor; @@ -271,20 +271,20 @@ void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) { actor->world.pos.x = actor->home.pos.x + (tempUnk178 * this->unk_16C); actor->world.pos.z = actor->home.pos.z + (tempUnk178 * this->unk_170); - if (!func_808B3F58(this, globalCtx)) { + if (!func_808B3F58(this, play)) { actor->home.pos.x = actor->world.pos.x; actor->home.pos.z = actor->world.pos.z; player->stateFlags2 &= ~PLAYER_STATE2_4; this->dyna.unk_150 = 0.0f; this->unk_178 = 0.0f; this->unk_174 = 0.0f; - func_808B4380(this, globalCtx); + func_808B4380(this, play); } else if (approxFResult) { - player = GET_PLAYER(globalCtx); - if (func_808B4010(this, globalCtx)) { + player = GET_PLAYER(play); + if (func_808B4010(this, play)) { Audio_PlayActorSound2(actor, NA_SE_EV_WOOD_BOUND); } - if (func_808B3A40(this, globalCtx)) { + if (func_808B3A40(this, play)) { func_80078884(NA_SE_SY_CORRECT_CHIME); } actor->home.pos.x = actor->world.pos.x; @@ -294,23 +294,23 @@ void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) { this->unk_178 = 0.0f; this->unk_174 = 0.0f; this->unk_168 = 10; - func_808B4084(this, globalCtx); + func_808B4084(this, play); } Audio_PlayActorSound2(actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void func_808B4380(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B4380(BgSpot15Rrbox* this, PlayState* play) { this->dyna.actor.velocity.x = 0.0f; this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.velocity.z = 0.0f; this->dyna.actor.gravity = -1.0f; - this->dyna.actor.floorHeight = func_808B3DDC(this, globalCtx); + this->dyna.actor.floorHeight = func_808B3DDC(this, play); this->actionFunc = func_808B43D0; } -void func_808B43D0(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B43D0(BgSpot15Rrbox* this, PlayState* play) { f32 floorHeight; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* actor = &this->dyna.actor; if (fabsf(this->dyna.unk_150) > 0.001f) { @@ -334,23 +334,23 @@ void func_808B43D0(BgSpot15Rrbox* this, GlobalContext* globalCtx) { if ((floorHeight - actor->world.pos.y) >= -0.001f) { actor->world.pos.y = floorHeight; - func_808B4084(this, globalCtx); + func_808B4084(this, play); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WOOD_BOUND); } } -void func_808B44B8(BgSpot15Rrbox* this, GlobalContext* globalCtx) { +void func_808B44B8(BgSpot15Rrbox* this, PlayState* play) { this->actionFunc = func_808B44CC; } -void func_808B44CC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808B44CC(BgSpot15Rrbox* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->stateFlags2 &= ~PLAYER_STATE2_4; this->dyna.unk_150 = 0.0f; } -void BgSpot15Rrbox_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Rrbox_Update(Actor* thisx, PlayState* play) { BgSpot15Rrbox* this = (BgSpot15Rrbox*)thisx; if (this->unk_168 > 0) { @@ -359,9 +359,9 @@ void BgSpot15Rrbox_Update(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.rot.y = this->dyna.unk_158; this->unk_16C = Math_SinS(this->dyna.actor.world.rot.y); this->unk_170 = Math_CosS(this->dyna.actor.world.rot.y); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot15Rrbox_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gLonLonMilkCrateDL); +void BgSpot15Rrbox_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gLonLonMilkCrateDL); } diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h index 5764b5ab4a..745c65629f 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h +++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h @@ -6,7 +6,7 @@ struct BgSpot15Rrbox; -typedef void (*BgSpot15RrboxActionFunc)(struct BgSpot15Rrbox*, GlobalContext*); +typedef void (*BgSpot15RrboxActionFunc)(struct BgSpot15Rrbox*, PlayState*); typedef struct BgSpot15Rrbox { /* 0x0000 */ DynaPolyActor dyna; 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 e91a83887b..78f4804370 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 @@ -9,14 +9,14 @@ #define FLAGS 0 -void BgSpot15Saku_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Saku_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Saku_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot15Saku_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot15Saku_Init(Actor* thisx, PlayState* play); +void BgSpot15Saku_Destroy(Actor* thisx, PlayState* play); +void BgSpot15Saku_Update(Actor* thisx, PlayState* play); +void BgSpot15Saku_Draw(Actor* thisx, PlayState* play); -void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx); -void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx); -void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx); +void func_808B4930(BgSpot15Saku* this, PlayState* play); +void func_808B4978(BgSpot15Saku* this, PlayState* play); +void func_808B4A04(BgSpot15Saku* this, PlayState* play); const ActorInit Bg_Spot15_Saku_InitVars = { ACTOR_BG_SPOT15_SAKU, @@ -30,7 +30,7 @@ const ActorInit Bg_Spot15_Saku_InitVars = { (ActorFunc)BgSpot15Saku_Draw, }; -void BgSpot15Saku_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Saku_Init(Actor* thisx, PlayState* play) { s32 pad; BgSpot15Saku* this = (BgSpot15Saku*)thisx; s32 pad2; @@ -38,7 +38,7 @@ void BgSpot15Saku_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gLonLonCorralFenceCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, 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; @@ -51,20 +51,20 @@ void BgSpot15Saku_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808B4930; } -void BgSpot15Saku_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Saku_Destroy(Actor* thisx, PlayState* play) { BgSpot15Saku* this = (BgSpot15Saku*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx) { +void func_808B4930(BgSpot15Saku* this, PlayState* play) { if (this->unk_168 && !GET_INFTABLE(INFTABLE_71)) { this->timer = 2; this->actionFunc = func_808B4978; } } -void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) { +void func_808B4978(BgSpot15Saku* this, PlayState* play) { if (this->timer == 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); this->dyna.actor.world.pos.z -= 2.0f; @@ -76,31 +76,31 @@ void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) { } } -void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) { +void func_808B4A04(BgSpot15Saku* this, PlayState* play) { if (this->timer == 0) { this->unk_168 = 0; this->actionFunc = func_808B4930; } } -void BgSpot15Saku_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot15Saku_Update(Actor* thisx, PlayState* play) { BgSpot15Saku* this = (BgSpot15Saku*)thisx; if (this->timer != 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot15Saku_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot15_saku.c", 259); +void BgSpot15Saku_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot15_saku.c", 259); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot15_saku.c", 263), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot15_saku.c", 263), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gLonLonCorralFenceDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot15_saku.c", 268); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot15_saku.c", 268); } 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 d722b80e94..f7ac8d09ca 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 @@ -6,7 +6,7 @@ struct BgSpot15Saku; -typedef void (*BgSpot15SakuActionFunc)(struct BgSpot15Saku*, GlobalContext*); +typedef void (*BgSpot15SakuActionFunc)(struct BgSpot15Saku*, PlayState*); typedef struct BgSpot15Saku { /* 0x0000 */ DynaPolyActor dyna; 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 01bd967f67..de01d9532b 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 @@ -6,16 +6,16 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot16Bombstone_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Bombstone_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Bombstone_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Bombstone_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play); +void BgSpot16Bombstone_Destroy(Actor* thisx, PlayState* play); +void BgSpot16Bombstone_Update(Actor* thisx, PlayState* play); +void BgSpot16Bombstone_Draw(Actor* thisx, PlayState* play); -void func_808B5A94(BgSpot16Bombstone* this, GlobalContext* globalCtx); -void func_808B5B04(BgSpot16Bombstone* this, GlobalContext* globalCtx); -void func_808B5B6C(BgSpot16Bombstone* this, GlobalContext* globalCtx); +void func_808B5A94(BgSpot16Bombstone* this, PlayState* play); +void func_808B5B04(BgSpot16Bombstone* this, PlayState* play); +void func_808B5B6C(BgSpot16Bombstone* this, PlayState* play); void func_808B5B58(BgSpot16Bombstone* this); -void func_808B5950(BgSpot16Bombstone* this, GlobalContext* globalCtx); +void func_808B5950(BgSpot16Bombstone* this, PlayState* play); void func_808B5934(BgSpot16Bombstone* this); void func_808B5AF0(BgSpot16Bombstone* this); void func_808B5A78(BgSpot16Bombstone* this); @@ -148,37 +148,37 @@ void func_808B4C30(BgSpot16Bombstone* this) { this->actor.params = this->actor.params & 0xFF; } -void func_808B4C4C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B4C4C(BgSpot16Bombstone* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->colliderJntSph); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderElements); this->colliderJntSph.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; this->colliderJntSph.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + 50.0f; this->colliderJntSph.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; this->colliderJntSph.elements[0].dim.worldSphere.radius = 120; } -void func_808B4D04(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B4D04(BgSpot16Bombstone* this, PlayState* play) { s32 pad; - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); this->colliderCylinder.dim.pos.x += (s16)this->actor.world.pos.x; this->colliderCylinder.dim.pos.y += (s16)this->actor.world.pos.y; this->colliderCylinder.dim.pos.z += (s16)this->actor.world.pos.z; } -s32 func_808B4D9C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +s32 func_808B4D9C(BgSpot16Bombstone* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf("Spot16 obj 爆弾石 破壊済み\n"); return false; } Actor_ProcessInitChain(&this->actor, sInitChainBoulder); Actor_SetScale(&this->actor, 0.4f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - func_808B4C4C(this, globalCtx); - func_808B4D04(this, globalCtx); + func_808B4C4C(this, play); + func_808B4D04(this, play); this->sinRotation = Math_SinS(this->actor.shape.rot.y); this->cosRotation = Math_CosS(this->actor.shape.rot.y); this->dList = gDodongosCavernRock3DL; @@ -187,7 +187,7 @@ s32 func_808B4D9C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { return true; } -s32 func_808B4E58(BgSpot16Bombstone* this, GlobalContext* globalctx) { +s32 func_808B4E58(BgSpot16Bombstone* this, PlayState* play) { Actor* actor = &this->actor; f32 scaleFactor = 1.0f / 600.0f; f32 sinCosPosFactor = 50.0f; @@ -218,7 +218,7 @@ s32 func_808B4E58(BgSpot16Bombstone* this, GlobalContext* globalctx) { actor->shape.rot.z = D_808B5DD8[actor->params][9]; this->dList = object_bombiwa_DL_0009E0; - this->bombiwaBankIndex = Object_GetIndex(&globalctx->objectCtx, OBJECT_BOMBIWA); + this->bombiwaBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_BOMBIWA); if (this->bombiwaBankIndex < 0) { osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", actor->params, "../z_bg_spot16_bombstone.c", @@ -230,7 +230,7 @@ s32 func_808B4E58(BgSpot16Bombstone* this, GlobalContext* globalctx) { return true; } -void BgSpot16Bombstone_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play) { BgSpot16Bombstone* this = (BgSpot16Bombstone*)thisx; s16 shouldLive; @@ -239,7 +239,7 @@ void BgSpot16Bombstone_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params) { case 0xFF: // The boulder is intact - shouldLive = func_808B4D9C(this, globalCtx); + shouldLive = func_808B4D9C(this, play); break; case 0: case 1: @@ -248,7 +248,7 @@ void BgSpot16Bombstone_Init(Actor* thisx, GlobalContext* globalCtx) { case 4: case 5: // The boulder is debris - shouldLive = func_808B4E58(this, globalCtx); + shouldLive = func_808B4E58(this, play); break; default: osSyncPrintf("Error : arg_data おかしいな(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot16_bombstone.c", 668, @@ -264,17 +264,17 @@ void BgSpot16Bombstone_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("Spot16 obj 爆弾石 (scaleX %f)(arg_data 0x%04x)\n", this->actor.scale.x, this->actor.params); } -void BgSpot16Bombstone_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Bombstone_Destroy(Actor* thisx, PlayState* play) { BgSpot16Bombstone* this = (BgSpot16Bombstone*)thisx; if (this->actor.params == 0xFF) { // Boulder is intact so remove its collider - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); + Collider_DestroyJntSph(play, &this->colliderJntSph); + Collider_DestroyCylinder(play, &this->colliderCylinder); } } -void BgSpot16Bombstone_SpawnDust(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void BgSpot16Bombstone_SpawnDust(BgSpot16Bombstone* this, PlayState* play) { f32 scaleX1 = this->actor.scale.x * 150; s16 scaleX2 = this->actor.scale.x * 250; Vec3f world; @@ -283,10 +283,10 @@ void BgSpot16Bombstone_SpawnDust(BgSpot16Bombstone* this, GlobalContext* globalC world.y = this->actor.world.pos.y + 50.0f; world.z = this->actor.world.pos.z; - func_80033480(globalCtx, &world, scaleX1, 2, scaleX2, 0xA0, 1); + func_80033480(play, &world, scaleX1, 2, scaleX2, 0xA0, 1); } -void func_808B5240(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B5240(BgSpot16Bombstone* this, PlayState* play) { f32 tempUnk6; f32 tempUnk2; s16 index; @@ -309,14 +309,14 @@ void func_808B5240(BgSpot16Bombstone* this, GlobalContext* globalCtx) { position.y = D_808B5EB0[index][2] + actorPosition->y; position.z = ((this->cosRotation * tempUnk6) - (tempUnk2 * this->sinRotation)) + actorPosition->z; - func_800287AC(globalCtx, &position, &sVelocity, &sAcceleration, D_808B5EB0[index][4], D_808B5EB0[index][5], + func_800287AC(play, &position, &sVelocity, &sAcceleration, D_808B5EB0[index][4], D_808B5EB0[index][5], D_808B5EB0[index][6]); this->unk_158 += 1; } } -void BgSpot16Bombstone_SpawnFragments(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void BgSpot16Bombstone_SpawnFragments(BgSpot16Bombstone* this, PlayState* play) { f32 velocityYMultiplier = 1.3f; Vec3f pos; Vec3f velocity; @@ -324,8 +324,8 @@ void BgSpot16Bombstone_SpawnFragments(BgSpot16Bombstone* this, GlobalContext* gl s16 scale; if (this->actor.params == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_SPOT16_BOMBSTONE, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 5); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_SPOT16_BOMBSTONE, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 5); index = 3; } else { index = 0; @@ -343,28 +343,28 @@ void BgSpot16Bombstone_SpawnFragments(BgSpot16Bombstone* this, GlobalContext* gl scale = D_808B6074[index] * this->actor.scale.x * 3; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, -420, 0x31, 0xF, 0xF, 0, scale, 2, - 0x40, 160, KAKERA_COLOR_NONE, OBJECT_BOMBIWA, object_bombiwa_DL_0009E0); + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -420, 0x31, 0xF, 0xF, 0, scale, 2, 0x40, + 160, KAKERA_COLOR_NONE, OBJECT_BOMBIWA, object_bombiwa_DL_0009E0); index += 1; } while (index != ARRAY_COUNT(D_808B6074)); } } -void func_808B561C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B561C(BgSpot16Bombstone* this, PlayState* play) { s32 index; PosRot* world; world = &this->actor.world; for (index = 0; index < ARRAY_COUNT(D_808B6088); index++) { - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_SPOT16_BOMBSTONE, world->pos.x, world->pos.y, - world->pos.z, 0, 0, 0, D_808B6088[index]) == NULL) { + if (Actor_Spawn(&play->actorCtx, play, ACTOR_BG_SPOT16_BOMBSTONE, world->pos.x, world->pos.y, world->pos.z, 0, + 0, 0, D_808B6088[index]) == NULL) { break; } } } -void func_808B56BC(BgSpot16Bombstone* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808B56BC(BgSpot16Bombstone* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 sinValue; s16 adjustedYawDiff; s32 yawDiff; @@ -391,9 +391,9 @@ void func_808B56BC(BgSpot16Bombstone* this, GlobalContext* globalCtx) { } } -void func_808B57E0(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B57E0(BgSpot16Bombstone* this, PlayState* play) { Actor* playerHeldActor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnBombf* currentBomb; if (sTimer > 0) { @@ -410,7 +410,7 @@ void func_808B57E0(BgSpot16Bombstone* this, GlobalContext* globalCtx) { currentBomb = sPlayerBomb; if (currentBomb->timer > 0) { sTimer = currentBomb->timer + 20; - OnePointCutscene_Init(globalCtx, 4180, sTimer, NULL, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4180, sTimer, NULL, CAM_ID_MAIN); } } } else if (player->stateFlags1 & PLAYER_STATE1_11) { @@ -427,33 +427,33 @@ void func_808B5934(BgSpot16Bombstone* this) { this->actionFunc = func_808B5950; } -void func_808B5950(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B5950(BgSpot16Bombstone* this, PlayState* play) { s32 pad; - func_808B56BC(this, globalCtx); - func_808B57E0(this, globalCtx); + func_808B56BC(this, play); + func_808B57E0(this, play); - if (globalCtx) {} + if (play) {} if (this->colliderCylinder.base.acFlags & AC_HIT) { this->colliderCylinder.base.acFlags &= ~AC_HIT; - func_808B561C(this, globalCtx); + func_808B561C(this, play); - OnePointCutscene_Init(globalCtx, 4180, 50, NULL, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4180, 50, NULL, CAM_ID_MAIN); - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); SET_EVENTCHKINF(EVENTCHKINF_23); func_808B5A78(this); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } if (mREG(64) == 1) { - func_808B561C(this, globalCtx); + func_808B561C(this, play); mREG(64) = -10; } else if (mREG(64) < 0) { mREG(64)++; @@ -467,9 +467,9 @@ void func_808B5A78(BgSpot16Bombstone* this) { this->actionFunc = func_808B5A94; } -void func_808B5A94(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B5A94(BgSpot16Bombstone* this, PlayState* play) { - func_808B5240(this, globalCtx); + func_808B5240(this, play); if (this->unk_154 == 56) { func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -485,8 +485,8 @@ void func_808B5AF0(BgSpot16Bombstone* this) { this->actor.draw = NULL; } -void func_808B5B04(BgSpot16Bombstone* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->bombiwaBankIndex)) { +void func_808B5B04(BgSpot16Bombstone* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->bombiwaBankIndex)) { func_808B5B58(this); this->actor.draw = BgSpot16Bombstone_Draw; } @@ -497,7 +497,7 @@ void func_808B5B58(BgSpot16Bombstone* this) { this->actionFunc = func_808B5B6C; } -void func_808B5B6C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { +void func_808B5B6C(BgSpot16Bombstone* this, PlayState* play) { Actor* actor = &this->actor; Actor_MoveForward(actor); @@ -511,34 +511,34 @@ void func_808B5B6C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { if ((actor->bgCheckFlags & BGCHECKFLAG_WALL) || ((actor->bgCheckFlags & BGCHECKFLAG_GROUND) && actor->velocity.y < 0.0f)) { - BgSpot16Bombstone_SpawnFragments(this, globalCtx); - BgSpot16Bombstone_SpawnDust(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &actor->world.pos, 20, NA_SE_EV_ROCK_BROKEN); + BgSpot16Bombstone_SpawnFragments(this, play); + BgSpot16Bombstone_SpawnDust(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &actor->world.pos, 20, NA_SE_EV_ROCK_BROKEN); Actor_Kill(actor); return; } - Actor_UpdateBgCheckInfo(globalCtx, actor, 17.5f, 35.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, actor, 17.5f, 35.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } -void BgSpot16Bombstone_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Bombstone_Update(Actor* thisx, PlayState* play) { BgSpot16Bombstone* this = (BgSpot16Bombstone*)thisx; this->unk_154++; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgSpot16Bombstone_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Bombstone_Draw(Actor* thisx, PlayState* play) { BgSpot16Bombstone* this = (BgSpot16Bombstone*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot16_bombstone.c", 1253); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot16_bombstone.c", 1253); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot16_bombstone.c", 1257), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot16_bombstone.c", 1257), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params == 0xFF) { @@ -546,9 +546,9 @@ void BgSpot16Bombstone_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, this->dList); } else { // The boulder is debris - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->bombiwaBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->bombiwaBankIndex].segment); gSPDisplayList(POLY_OPA_DISP++, this->dList); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot16_bombstone.c", 1274); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot16_bombstone.c", 1274); } diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h index 924a0b1f7a..499b01031a 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h @@ -6,7 +6,7 @@ struct BgSpot16Bombstone; -typedef void (*BgSpot16BombstoneActionFunc)(struct BgSpot16Bombstone*, GlobalContext*); +typedef void (*BgSpot16BombstoneActionFunc)(struct BgSpot16Bombstone*, PlayState*); typedef struct BgSpot16Bombstone { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c b/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c index 682b648a16..31bdd161f5 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c @@ -10,13 +10,13 @@ #define FLAGS 0 -void BgSpot16Doughnut_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Doughnut_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Doughnut_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Doughnut_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot16Doughnut_Init(Actor* thisx, PlayState* play); +void BgSpot16Doughnut_Destroy(Actor* thisx, PlayState* play); +void BgSpot16Doughnut_Update(Actor* thisx, PlayState* play); +void BgSpot16Doughnut_Draw(Actor* thisx, PlayState* play); -void BgSpot16Doughnut_UpdateExpanding(Actor* thisx, GlobalContext* globalCtx); -void BgSpot16Doughnut_DrawExpanding(Actor* thisx, GlobalContext* globalCtx); +void BgSpot16Doughnut_UpdateExpanding(Actor* thisx, PlayState* play); +void BgSpot16Doughnut_DrawExpanding(Actor* thisx, PlayState* play); const ActorInit Bg_Spot16_Doughnut_InitVars = { ACTOR_BG_SPOT16_DOUGHNUT, @@ -40,7 +40,7 @@ static s16 sScales[] = { 0, 0, 70, 210, 300, }; -void BgSpot16Doughnut_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_Init(Actor* thisx, PlayState* play) { BgSpot16Doughnut* this = (BgSpot16Doughnut*)thisx; s32 params; @@ -56,7 +56,7 @@ void BgSpot16Doughnut_Init(Actor* thisx, GlobalContext* globalCtx) { } else { // Scales this actor for scenes where it is featured in the background, // Death Mountain itself falls into the default case. - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT01: Actor_SetScale(&this->actor, 0.04f); break; @@ -79,10 +79,10 @@ void BgSpot16Doughnut_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot16Doughnut_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_Destroy(Actor* thisx, PlayState* play) { } -void BgSpot16Doughnut_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_Update(Actor* thisx, PlayState* play) { BgSpot16Doughnut* this = (BgSpot16Doughnut*)thisx; if (!(this->fireFlag & 1)) { @@ -92,8 +92,8 @@ void BgSpot16Doughnut_Update(Actor* thisx, GlobalContext* globalCtx) { } else { this->envColorAlpha = 255; } - } else if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[2] != NULL && - globalCtx->csCtx.npcActions[2]->action == 2) { + } else if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[2] != NULL && + play->csCtx.npcActions[2]->action == 2) { if (this->envColorAlpha >= 6) { this->envColorAlpha -= 5; } else { @@ -104,7 +104,7 @@ void BgSpot16Doughnut_Update(Actor* thisx, GlobalContext* globalCtx) { } // Update function for outwardly expanding and dissipating -void BgSpot16Doughnut_UpdateExpanding(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_UpdateExpanding(Actor* thisx, PlayState* play) { BgSpot16Doughnut* this = (BgSpot16Doughnut*)thisx; if (this->envColorAlpha >= 6) { @@ -116,23 +116,22 @@ void BgSpot16Doughnut_UpdateExpanding(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.scale.x + 0.0019999998f); } -void BgSpot16Doughnut_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_Draw(Actor* thisx, PlayState* play) { BgSpot16Doughnut* this = (BgSpot16Doughnut*)thisx; - u32 scroll = globalCtx->gameplayFrames & 0xFFFF; + u32 scroll = play->gameplayFrames & 0xFFFF; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 210); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot16_doughnut.c", 210); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (1) {} - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 213), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot16_doughnut.c", 213), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->fireFlag & 1) { - gSPSegment( - POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * (-1), 0, 16, 32, 1, scroll, scroll * (-2), 16, 32)); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * (-1), 0, 16, 32, 1, scroll, scroll * (-2), 16, 32)); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, this->envColorAlpha); gSPDisplayList(POLY_XLU_DISP++, gDeathMountainCloudCircleFieryDL); } else { @@ -141,22 +140,22 @@ void BgSpot16Doughnut_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gDeathMountainCloudCircleNormalDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 238); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot16_doughnut.c", 238); } // Draw function for outwardly expanding and dissipating -void BgSpot16Doughnut_DrawExpanding(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot16Doughnut_DrawExpanding(Actor* thisx, PlayState* play) { BgSpot16Doughnut* this = (BgSpot16Doughnut*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 245); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot16_doughnut.c", 245); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 248), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot16_doughnut.c", 248), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->envColorAlpha); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gSPDisplayList(POLY_XLU_DISP++, gDeathMountainCloudCircleNormalDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 256); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot16_doughnut.c", 256); } diff --git a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c index 660c65841a..bdeb2ea046 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c @@ -11,10 +11,10 @@ #define FLAGS 0 -void BgSpot17Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot17Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot17Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot17Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot17Bakudankabe_Init(Actor* thisx, PlayState* play); +void BgSpot17Bakudankabe_Destroy(Actor* thisx, PlayState* play); +void BgSpot17Bakudankabe_Update(Actor* thisx, PlayState* play); +void BgSpot17Bakudankabe_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Spot17_Bakudankabe_InitVars = { ACTOR_BG_SPOT17_BAKUDANKABE, @@ -35,7 +35,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void func_808B6BC0(BgSpot17Bakudankabe* this, GlobalContext* globalCtx) { +void func_808B6BC0(BgSpot17Bakudankabe* this, PlayState* play) { s32 pad[2]; s32 i; Vec3f burstDepthY; @@ -79,59 +79,59 @@ void func_808B6BC0(BgSpot17Bakudankabe* this, GlobalContext* globalCtx) { } else { rotationSpeed = 33; } - EffectSsKakera_Spawn(globalCtx, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, - 4, 0, scale, 1, 3, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, gFieldKakeraDL); + EffectSsKakera_Spawn(play, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, 4, + 0, scale, 1, 3, 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, gFieldKakeraDL); } Math_Vec3f_Copy(&burstDepthY, &this->dyna.actor.world.pos); - func_80033480(globalCtx, &burstDepthY, 60.0f, 4, 110, 160, 1); + func_80033480(play, &burstDepthY, 60.0f, 4, 110, 160, 1); burstDepthY.y += 40.0f; - func_80033480(globalCtx, &burstDepthY, 60.0f, 4, 120, 160, 1); + func_80033480(play, &burstDepthY, 60.0f, 4, 120, 160, 1); burstDepthY.y += 40.0f; - func_80033480(globalCtx, &burstDepthY, 60.0f, 4, 110, 160, 1); + func_80033480(play, &burstDepthY, 60.0f, 4, 110, 160, 1); } -void BgSpot17Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Bakudankabe_Init(Actor* thisx, PlayState* play) { BgSpot17Bakudankabe* this = (BgSpot17Bakudankabe*)thisx; s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) { + if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { Actor_Kill(&this->dyna.actor); return; } CollisionHeader_GetVirtual(&gCraterBombableWallCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); } -void BgSpot17Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Bakudankabe_Destroy(Actor* thisx, PlayState* play) { BgSpot17Bakudankabe* this = (BgSpot17Bakudankabe*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgSpot17Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Bakudankabe_Update(Actor* thisx, PlayState* play) { BgSpot17Bakudankabe* this = (BgSpot17Bakudankabe*)thisx; - if (this->dyna.actor.xzDistToPlayer < 650.0f && func_80033684(globalCtx, &this->dyna.actor) != NULL) { - func_808B6BC0(this, globalCtx); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params & 0x3F)); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + if (this->dyna.actor.xzDistToPlayer < 650.0f && func_80033684(play, &this->dyna.actor) != NULL) { + func_808B6BC0(this, play); + Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); func_80078884(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->dyna.actor); } } -void BgSpot17Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Bakudankabe_Draw(Actor* thisx, PlayState* play) { s32 pad; - s8 r = coss(globalCtx->gameplayFrames * 1500) >> 8; - s8 g = coss(globalCtx->gameplayFrames * 1500) >> 8; + s8 r = coss(play->gameplayFrames * 1500) >> 8; + s8 g = coss(play->gameplayFrames * 1500) >> 8; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 269); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 269); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 273), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 273), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); r = (r >> 1) + 0xC0; @@ -141,15 +141,15 @@ void BgSpot17Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gCraterBombableWallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 283); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 283); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 286); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 286); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 290), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 290), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCraterBombableWallCracksDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 295); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 295); } diff --git a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c index 0a0ab50d2a..b932c26cee 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c +++ b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c @@ -9,11 +9,11 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot17Funen_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot17Funen_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot17Funen_Update(Actor* thisx, GlobalContext* globalCtx); -void func_808B746C(Actor* thisx, GlobalContext* globalCtx); -void func_808B7478(Actor* thisx, GlobalContext* globalCtx); +void BgSpot17Funen_Init(Actor* thisx, PlayState* play); +void BgSpot17Funen_Destroy(Actor* thisx, PlayState* play); +void BgSpot17Funen_Update(Actor* thisx, PlayState* play); +void func_808B746C(Actor* thisx, PlayState* play); +void func_808B7478(Actor* thisx, PlayState* play); const ActorInit Bg_Spot17_Funen_InitVars = { ACTOR_BG_SPOT17_FUNEN, @@ -31,44 +31,43 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgSpot17Funen_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Funen_Init(Actor* thisx, PlayState* play) { BgSpot17Funen* this = (BgSpot17Funen*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); osSyncPrintf("spot17 obj. 噴煙 (arg_data 0x%04x)\n", this->actor.params); } -void BgSpot17Funen_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Funen_Destroy(Actor* thisx, PlayState* play) { } -void BgSpot17Funen_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot17Funen_Update(Actor* thisx, PlayState* play) { BgSpot17Funen* this = (BgSpot17Funen*)thisx; this->actor.draw = func_808B7478; this->actor.update = func_808B746C; } -void func_808B746C(Actor* thisx, GlobalContext* globalCtx) { +void func_808B746C(Actor* thisx, PlayState* play) { } -void func_808B7478(Actor* thisx, GlobalContext* globalCtx) { +void func_808B7478(Actor* thisx, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 153); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot17_funen.c", 153); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - thisx->shape.rot.y + 0x8000) * - 9.58738019108e-05f, + func_80093D84(play->state.gfxCtx); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - thisx->shape.rot.y + 0x8000) * 9.58738019108e-05f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 161), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_spot17_funen.c", 161), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (0 - globalCtx->gameplayFrames) & 0x7F, 0x20, 0x20, 1, 0, - (0 - globalCtx->gameplayFrames) & 0x7F, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (0 - play->gameplayFrames) & 0x7F, 0x20, 0x20, 1, 0, + (0 - play->gameplayFrames) & 0x7F, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gCraterSmokeConeDL); if (1) {} - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 176); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot17_funen.c", 176); } 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 f14ab0dd16..e353ee4734 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 @@ -4,23 +4,23 @@ #define FLAGS ACTOR_FLAG_4 -void BgSpot18Basket_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Basket_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Basket_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Basket_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot18Basket_Init(Actor* thisx, PlayState* play); +void BgSpot18Basket_Destroy(Actor* thisx, PlayState* play); +void BgSpot18Basket_Update(Actor* thisx, PlayState* play); +void BgSpot18Basket_Draw(Actor* thisx, PlayState* play); -void func_808B7BCC(BgSpot18Basket* this, GlobalContext* globalCtx); +void func_808B7BCC(BgSpot18Basket* this, PlayState* play); void func_808B7AEC(BgSpot18Basket* this); void func_808B7B58(BgSpot18Basket* this); void func_808B7BB0(BgSpot18Basket* this); void func_808B7D38(BgSpot18Basket* this); void func_808B7F74(BgSpot18Basket* this); void func_808B818C(BgSpot18Basket* this); -void func_808B7AFC(BgSpot18Basket* this, GlobalContext* globalCtx); -void func_808B7B6C(BgSpot18Basket* this, GlobalContext* globalCtx); -void func_808B7D50(BgSpot18Basket* this, GlobalContext* globalCtx); -void func_808B7FC0(BgSpot18Basket* this, GlobalContext* globalCtx); -void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx); +void func_808B7AFC(BgSpot18Basket* this, PlayState* play); +void func_808B7B6C(BgSpot18Basket* this, PlayState* play); +void func_808B7D50(BgSpot18Basket* this, PlayState* play); +void func_808B7FC0(BgSpot18Basket* this, PlayState* play); +void func_808B81A0(BgSpot18Basket* this, PlayState* play); const ActorInit Bg_Spot18_Basket_InitVars = { ACTOR_BG_SPOT18_BASKET, @@ -74,15 +74,15 @@ static ColliderJntSphInit sJntSphInit = { static s16 D_808B85C8[] = { 0x8000, 0x2AAA, 0xD555, 0x0000 }; -void func_808B7710(Actor* thisx, GlobalContext* globalCtx) { +void func_808B7710(Actor* thisx, PlayState* play) { BgSpot18Basket* this = (BgSpot18Basket*)thisx; - Collider_InitJntSph(globalCtx, &this->colliderJntSph); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->dyna.actor, &sJntSphInit, this->ColliderJntSphElements); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->dyna.actor, &sJntSphInit, this->ColliderJntSphElements); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; } -void func_808B7770(BgSpot18Basket* this, GlobalContext* globalCtx, f32 arg2) { +void func_808B7770(BgSpot18Basket* this, PlayState* play, f32 arg2) { static s16 D_808B85D0 = 0; Vec3f acceleration; Vec3f velocity; @@ -94,7 +94,7 @@ void func_808B7770(BgSpot18Basket* this, GlobalContext* globalCtx, f32 arg2) { s32 count; for (i = 0, count = 2; i != count; i++) { - if (globalCtx) {} + if (play) {} if (!(arg2 < Rand_ZeroOne())) { D_808B85D0 += 0x7530; @@ -115,7 +115,7 @@ void func_808B7770(BgSpot18Basket* this, GlobalContext* globalCtx, f32 arg2) { acceleration.y = 0.5f; acceleration.z = 0.0f; - func_800286CC(globalCtx, &position, &velocity, &acceleration, ((Rand_ZeroOne() * 16) + 80), + func_800286CC(play, &position, &velocity, &acceleration, ((Rand_ZeroOne() * 16) + 80), ((Rand_ZeroOne() * 30) + 80)); } } @@ -128,32 +128,31 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgSpot18Basket_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Basket_Init(Actor* thisx, PlayState* play) { s32 pad; BgSpot18Basket* this = (BgSpot18Basket*)thisx; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK3); - func_808B7710(&this->dyna.actor, globalCtx); + func_808B7710(&this->dyna.actor, play); CollisionHeader_GetVirtual(&gGoronCityVaseCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->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; - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { func_808B7BB0(this); return; } func_808B7AEC(this); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, 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, &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); if (this->dyna.actor.child == NULL) { osSyncPrintf(VT_FGCOL(RED)); @@ -163,20 +162,20 @@ void BgSpot18Basket_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot18Basket_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Basket_Destroy(Actor* thisx, PlayState* play) { BgSpot18Basket* this = (BgSpot18Basket*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyJntSph(play, &this->colliderJntSph); } void func_808B7AEC(BgSpot18Basket* this) { this->actionFunc = func_808B7AFC; } -void func_808B7AFC(BgSpot18Basket* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { - OnePointCutscene_Init(globalCtx, 4220, 80, &this->dyna.actor, CAM_ID_MAIN); +void func_808B7AFC(BgSpot18Basket* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + OnePointCutscene_Init(play, 4220, 80, &this->dyna.actor, CAM_ID_MAIN); func_808B7B58(this); } } @@ -186,7 +185,7 @@ void func_808B7B58(BgSpot18Basket* this) { this->unk_216 = 0; } -void func_808B7B6C(BgSpot18Basket* this, GlobalContext* globalCtx) { +void func_808B7B6C(BgSpot18Basket* this, PlayState* play) { if (this->unk_216 > 20) { func_808B7BB0(this); this->dyna.actor.child->parent = NULL; @@ -199,7 +198,7 @@ void func_808B7BB0(BgSpot18Basket* this) { this->unk_210 = this->unk_20C = 0; } -void func_808B7BCC(BgSpot18Basket* this, GlobalContext* globalCtx) { +void func_808B7BCC(BgSpot18Basket* this, PlayState* play) { f32 positionDiff; Actor* colliderBaseAc; @@ -224,9 +223,9 @@ void func_808B7BCC(BgSpot18Basket* this, GlobalContext* globalCtx) { if (positionDiff > 120.0f && positionDiff < 200.0f) { if (Math3D_Dist2DSq(colliderBaseAc->world.pos.z, this->colliderJntSph.base.ac->world.pos.x, this->dyna.actor.world.pos.z, this->dyna.actor.world.pos.x) < SQ(32.0f)) { - OnePointCutscene_Init(globalCtx, 4210, 240, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4210, 240, &this->dyna.actor, CAM_ID_MAIN); func_808B7D38(this); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } } } @@ -240,7 +239,7 @@ void func_808B7D38(BgSpot18Basket* this) { this->unk_214 = 0; } -void func_808B7D50(BgSpot18Basket* this, GlobalContext* globalCtx) { +void func_808B7D50(BgSpot18Basket* this, PlayState* play) { f32 tempValue2; f32 tempValue; @@ -277,9 +276,9 @@ void func_808B7D50(BgSpot18Basket* this, GlobalContext* globalCtx) { } if (this->unk_216 < 80) { - func_808B7770(this, globalCtx, 1.0f); + func_808B7770(this, play, 1.0f); } else { - func_808B7770(this, globalCtx, 0.8f); + func_808B7770(this, play, 0.8f); } tempValue2 = (this->unk_210 - 500) * 0.0006f; @@ -306,7 +305,7 @@ void func_808B7F74(BgSpot18Basket* this) { this->unk_216 = 0; } -void func_808B7FC0(BgSpot18Basket* this, GlobalContext* globalCtx) { +void func_808B7FC0(BgSpot18Basket* this, PlayState* play) { s32 pad; s32 tempUnk214; f32 tempUnk210; @@ -334,14 +333,14 @@ void func_808B7FC0(BgSpot18Basket* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.y = arrayValue; func_808B818C(this); - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } } if (this->unk_216 < 30) { - func_808B7770(this, globalCtx, 0.5f); + func_808B7770(this, play, 0.5f); } else { - func_808B7770(this, globalCtx, 0.3f); + func_808B7770(this, play, 0.3f); } tempUnk210 = (this->unk_210 - 500) * 0.0006f; @@ -358,7 +357,7 @@ void func_808B818C(BgSpot18Basket* this) { static s16 D_808B85E4[] = { -0x0FA0, 0x0320, 0x0FA0 }; -void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) { +void func_808B81A0(BgSpot18Basket* this, PlayState* play) { s32 i; Actor* actor = &this->dyna.actor; Vec3f tempVector; @@ -371,7 +370,7 @@ void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) { if (this->unk_218 == 0) { for (i = 0; i < ARRAY_COUNT(D_808B85E4); i++) { - collectible = Item_DropCollectible(globalCtx, &tempVector, ITEM00_BOMBS_A); + collectible = Item_DropCollectible(play, &tempVector, ITEM00_BOMBS_A); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[i]; @@ -379,22 +378,22 @@ void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) { } } else if (this->unk_218 == 1) { for (i = 0; i < ARRAY_COUNT(D_808B85E4); i++) { - collectible = Item_DropCollectible(globalCtx, &tempVector, ITEM00_RUPEE_GREEN); + collectible = Item_DropCollectible(play, &tempVector, ITEM00_RUPEE_GREEN); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[i]; } } } else if (this->unk_218 == 2) { - if ((this->unk_21A != 0) || Flags_GetCollectible(globalCtx, (actor->params & 0x3F))) { - collectible = Item_DropCollectible(globalCtx, &tempVector, ITEM00_RUPEE_PURPLE); + if ((this->unk_21A != 0) || Flags_GetCollectible(play, (actor->params & 0x3F))) { + collectible = Item_DropCollectible(play, &tempVector, ITEM00_RUPEE_PURPLE); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[1]; } } else { collectible = - Item_DropCollectible(globalCtx, &tempVector, ((actor->params & 0x3F) << 8) | ITEM00_HEART_PIECE); + Item_DropCollectible(play, &tempVector, ((actor->params & 0x3F) << 8) | ITEM00_HEART_PIECE); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[1]; @@ -402,13 +401,13 @@ void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) { } } - collectible = Item_DropCollectible(globalCtx, &tempVector, ITEM00_RUPEE_RED); + collectible = Item_DropCollectible(play, &tempVector, ITEM00_RUPEE_RED); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[0]; } - collectible = Item_DropCollectible(globalCtx, &tempVector, ITEM00_RUPEE_BLUE); + collectible = Item_DropCollectible(play, &tempVector, ITEM00_RUPEE_BLUE); if (collectible != NULL) { collectible->actor.velocity.y = 11.0f; collectible->actor.world.rot.y = D_808B85E4[2]; @@ -425,28 +424,28 @@ void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) { } } -void BgSpot18Basket_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Basket_Update(Actor* thisx, PlayState* play) { s32 pad; BgSpot18Basket* this = (BgSpot18Basket*)thisx; s32 bgId; this->unk_216++; - this->actionFunc(this, globalCtx); - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &bgId, + this->actionFunc(this, play); + this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &this->dyna.actor.world.pos); if (this->actionFunc != func_808B7AFC) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); if (this->actionFunc != func_808B7B6C) { this->colliderJntSph.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } } } -void BgSpot18Basket_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Basket_Draw(Actor* thisx, PlayState* play) { BgSpot18Basket* this = (BgSpot18Basket*)thisx; Collider_UpdateSpheres(0, &this->colliderJntSph); Collider_UpdateSpheres(1, &this->colliderJntSph); - Gfx_DrawDListOpa(globalCtx, gGoronCityVaseDL); + Gfx_DrawDListOpa(play, gGoronCityVaseDL); } diff --git a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h index 74aaa72b98..21f4bc4f23 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h +++ b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h @@ -6,7 +6,7 @@ struct BgSpot18Basket; -typedef void (*BgSpot18BasketActionFunc)(struct BgSpot18Basket*, GlobalContext*); +typedef void (*BgSpot18BasketActionFunc)(struct BgSpot18Basket*, PlayState*); typedef struct BgSpot18Basket { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c index 5ce59491d9..4ed0daa938 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgSpot18Futa_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Futa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Futa_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Futa_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot18Futa_Init(Actor* thisx, PlayState* play); +void BgSpot18Futa_Destroy(Actor* thisx, PlayState* play); +void BgSpot18Futa_Update(Actor* thisx, PlayState* play); +void BgSpot18Futa_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Spot18_Futa_InitVars = { ACTOR_BG_SPOT18_FUTA, @@ -33,24 +33,24 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void BgSpot18Futa_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Futa_Init(Actor* thisx, PlayState* play) { BgSpot18Futa* this = (BgSpot18Futa*)thisx; s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gGoronCityVaseLidCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); } -void BgSpot18Futa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Futa_Destroy(Actor* thisx, PlayState* play) { BgSpot18Futa* this = (BgSpot18Futa*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgSpot18Futa_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Futa_Update(Actor* thisx, PlayState* play) { BgSpot18Futa* this = (BgSpot18Futa*)thisx; s32 iVar1; @@ -66,6 +66,6 @@ void BgSpot18Futa_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void BgSpot18Futa_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gGoronCityVaseLidDL); +void BgSpot18Futa_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gGoronCityVaseLidDL); } 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 f916eb017b..1dd32d05aa 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 @@ -10,25 +10,25 @@ #define FLAGS 0 -void BgSpot18Obj_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Obj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Obj_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Obj_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot18Obj_Init(Actor* thisx, PlayState* play); +void BgSpot18Obj_Destroy(Actor* thisx, PlayState* play); +void BgSpot18Obj_Update(Actor* thisx, PlayState* play); +void BgSpot18Obj_Draw(Actor* thisx, PlayState* play); -s32 func_808B8910(BgSpot18Obj* this, GlobalContext* globalCtx); -s32 func_808B8A5C(BgSpot18Obj* this, GlobalContext* globalCtx); -s32 func_808B8A98(BgSpot18Obj* this, GlobalContext* globalCtx); -s32 func_808B8B08(BgSpot18Obj* this, GlobalContext* globalCtx); -s32 func_808B8BB4(BgSpot18Obj* this, GlobalContext* globalCtx); -s32 func_808B8C90(BgSpot18Obj* this, GlobalContext* globalCtx); +s32 func_808B8910(BgSpot18Obj* this, PlayState* play); +s32 func_808B8A5C(BgSpot18Obj* this, PlayState* play); +s32 func_808B8A98(BgSpot18Obj* this, PlayState* play); +s32 func_808B8B08(BgSpot18Obj* this, PlayState* play); +s32 func_808B8BB4(BgSpot18Obj* this, PlayState* play); +s32 func_808B8C90(BgSpot18Obj* this, PlayState* play); void func_808B8DC0(BgSpot18Obj* this); -void func_808B8DD0(BgSpot18Obj* this, GlobalContext* globalCtx); +void func_808B8DD0(BgSpot18Obj* this, PlayState* play); void func_808B8E64(BgSpot18Obj* this); -void func_808B8E7C(BgSpot18Obj* this, GlobalContext* globalCtx); +void func_808B8E7C(BgSpot18Obj* this, PlayState* play); void func_808B8EE0(BgSpot18Obj* this); -void func_808B8F08(BgSpot18Obj* this, GlobalContext* globalCtx); +void func_808B8F08(BgSpot18Obj* this, PlayState* play); void func_808B9030(BgSpot18Obj* this); -void func_808B9040(BgSpot18Obj* this, GlobalContext* globalCtx); +void func_808B9040(BgSpot18Obj* this, PlayState* play); const ActorInit Bg_Spot18_Obj_InitVars = { ACTOR_BG_SPOT18_OBJ, @@ -88,7 +88,7 @@ static Gfx(*sDlists[]) = { gGoronCityStatueSpearDL, }; -s32 func_808B8910(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8910(BgSpot18Obj* this, PlayState* play) { s32 age; if (LINK_AGE_IN_YEARS == YEARS_ADULT) { @@ -119,43 +119,43 @@ s32 func_808B8910(BgSpot18Obj* this, GlobalContext* globalCtx) { return 0; } -s32 func_808B8A5C(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8A5C(BgSpot18Obj* this, PlayState* play) { Actor_SetScale(&this->dyna.actor, D_808B90F4[this->dyna.actor.params & 0xF]); return 1; } -s32 func_808B8A98(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8A98(BgSpot18Obj* this, PlayState* play) { s32 pad[2]; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(D_808B90FC[this->dyna.actor.params & 0xF], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); return 1; } -s32 func_808B8B08(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8B08(BgSpot18Obj* this, PlayState* play) { this->dyna.actor.flags |= D_808B9104[this->dyna.actor.params & 0xF]; return 1; } -s32 func_808B8B38(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8B38(BgSpot18Obj* this, PlayState* play) { s32 i; for (i = 0; i < ARRAY_COUNT(D_808B910C); i++) { - if (D_808B910C[i](this, globalCtx) == 0) { + if (D_808B910C[i](this, play) == 0) { return 0; } } return 1; } -s32 func_808B8BB4(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8BB4(BgSpot18Obj* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain1); if (LINK_AGE_IN_YEARS == YEARS_CHILD) { func_808B9030(this); - } else if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + } else if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { func_808B9030(this); this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.z; @@ -165,51 +165,51 @@ s32 func_808B8BB4(BgSpot18Obj* this, GlobalContext* globalCtx) { return 1; } -s32 func_808B8C90(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8C90(BgSpot18Obj* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain2); func_808B8DC0(this); return 1; } -s32 func_808B8CC8(BgSpot18Obj* this, GlobalContext* globalCtx) { +s32 func_808B8CC8(BgSpot18Obj* this, PlayState* play) { if ((D_808B913C[this->dyna.actor.params & 0xF] != NULL) && - (!D_808B913C[this->dyna.actor.params & 0xF](this, globalCtx))) { + (!D_808B913C[this->dyna.actor.params & 0xF](this, play))) { return 0; } return 1; } -void BgSpot18Obj_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Obj_Init(Actor* thisx, PlayState* play) { BgSpot18Obj* this = (BgSpot18Obj*)thisx; osSyncPrintf("Spot18 Object [arg_data : 0x%04x]\n", this->dyna.actor.params); - if (!func_808B8B38(this, globalCtx)) { + if (!func_808B8B38(this, play)) { Actor_Kill(&this->dyna.actor); - } else if (!func_808B8CC8(this, globalCtx)) { + } else if (!func_808B8CC8(this, play)) { Actor_Kill(&this->dyna.actor); } } -void BgSpot18Obj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Obj_Destroy(Actor* thisx, PlayState* play) { BgSpot18Obj* this = (BgSpot18Obj*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_808B8DC0(BgSpot18Obj* this) { this->actionFunc = func_808B8DD0; } -void func_808B8DD0(BgSpot18Obj* this, GlobalContext* globalCtx) { +void func_808B8DD0(BgSpot18Obj* this, PlayState* play) { } -void func_808B8DDC(BgSpot18Obj* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 20.0f, 46.0f, 0.0f, +void func_808B8DDC(BgSpot18Obj* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 46.0f, 0.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } -void func_808B8E20(BgSpot18Obj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808B8E20(BgSpot18Obj* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (fabsf(this->dyna.unk_150) > 0.001f) { this->dyna.unk_150 = 0.0f; @@ -222,7 +222,7 @@ void func_808B8E64(BgSpot18Obj* this) { this->actionFunc = func_808B8E7C; } -void func_808B8E7C(BgSpot18Obj* this, GlobalContext* globalCtx) { +void func_808B8E7C(BgSpot18Obj* this, PlayState* play) { if (this->dyna.unk_150 < -0.001f) { if (this->unk_168 <= 0) { func_808B8EE0(this); @@ -230,7 +230,7 @@ void func_808B8E7C(BgSpot18Obj* this, GlobalContext* globalCtx) { } else { this->unk_168 = 20; } - func_808B8E20(this, globalCtx); + func_808B8E20(this, play); } void func_808B8EE0(BgSpot18Obj* this) { @@ -242,13 +242,13 @@ void func_808B8EE0(BgSpot18Obj* this) { this->dyna.actor.velocity.x = 0.0f; } -void func_808B8F08(BgSpot18Obj* this, GlobalContext* globalCtx) { +void func_808B8F08(BgSpot18Obj* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Math_StepToF(&this->dyna.actor.speedXZ, 1.2f, 0.1f); Actor_MoveForward(&this->dyna.actor); - func_808B8DDC(this, globalCtx); + func_808B8DDC(this, play); if (Math3D_Dist2DSq(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.z) >= SQ(80.0f)) { @@ -257,7 +257,7 @@ void func_808B8F08(BgSpot18Obj* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.z; this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~PLAYER_STATE2_4; - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); func_80078884(NA_SE_SY_CORRECT_CHIME); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } else { @@ -269,19 +269,19 @@ void func_808B9030(BgSpot18Obj* this) { this->actionFunc = func_808B9040; } -void func_808B9040(BgSpot18Obj* this, GlobalContext* globalCtx) { - func_808B8E20(this, globalCtx); +void func_808B9040(BgSpot18Obj* this, PlayState* play) { + func_808B8E20(this, play); } -void BgSpot18Obj_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Obj_Update(Actor* thisx, PlayState* play) { BgSpot18Obj* this = (BgSpot18Obj*)thisx; if (this->unk_168 > 0) { this->unk_168 -= 1; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot18Obj_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sDlists[thisx->params & 0xF]); +void BgSpot18Obj_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sDlists[thisx->params & 0xF]); } diff --git a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h index ee257022e4..5e000f646d 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h +++ b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h @@ -6,8 +6,8 @@ struct BgSpot18Obj; -typedef void (*BgSpot18ObjActionFunc)(struct BgSpot18Obj*, GlobalContext*); -typedef s32 (*BgSpot18ObjInitFunc)(struct BgSpot18Obj*, GlobalContext*); +typedef void (*BgSpot18ObjActionFunc)(struct BgSpot18Obj*, PlayState*); +typedef s32 (*BgSpot18ObjInitFunc)(struct BgSpot18Obj*, PlayState*); typedef struct BgSpot18Obj { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c index a72472e8e3..962d0a8716 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c @@ -9,16 +9,16 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSpot18Shutter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Shutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Shutter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpot18Shutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpot18Shutter_Init(Actor* thisx, PlayState* play); +void BgSpot18Shutter_Destroy(Actor* thisx, PlayState* play); +void BgSpot18Shutter_Update(Actor* thisx, PlayState* play); +void BgSpot18Shutter_Draw(Actor* thisx, PlayState* play); -void func_808B95AC(BgSpot18Shutter* this, GlobalContext* globalCtx); -void func_808B95B8(BgSpot18Shutter* this, GlobalContext* globalCtx); -void func_808B9618(BgSpot18Shutter* this, GlobalContext* globalCtx); -void func_808B9698(BgSpot18Shutter* this, GlobalContext* globalCtx); -void func_808B971C(BgSpot18Shutter* this, GlobalContext* globalCtx); +void func_808B95AC(BgSpot18Shutter* this, PlayState* play); +void func_808B95B8(BgSpot18Shutter* this, PlayState* play); +void func_808B9618(BgSpot18Shutter* this, PlayState* play); +void func_808B9698(BgSpot18Shutter* this, PlayState* play); +void func_808B971C(BgSpot18Shutter* this, PlayState* play); const ActorInit Bg_Spot18_Shutter_InitVars = { ACTOR_BG_SPOT18_SHUTTER, @@ -36,7 +36,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgSpot18Shutter_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Shutter_Init(Actor* thisx, PlayState* play) { s32 pad; BgSpot18Shutter* this = (BgSpot18Shutter*)thisx; s32 param = (this->dyna.actor.params >> 8) & 1; @@ -54,7 +54,7 @@ void BgSpot18Shutter_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808B9618; } } else { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { this->actionFunc = func_808B95AC; this->dyna.actor.world.pos.y += 180.0f; } else { @@ -72,39 +72,39 @@ void BgSpot18Shutter_Init(Actor* thisx, GlobalContext* globalCtx) { } CollisionHeader_GetVirtual(&gGoronCityDoorCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgSpot18Shutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Shutter_Destroy(Actor* thisx, PlayState* play) { BgSpot18Shutter* this = (BgSpot18Shutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808B95AC(BgSpot18Shutter* this, GlobalContext* globalCtx) { +void func_808B95AC(BgSpot18Shutter* this, PlayState* play) { } -void func_808B95B8(BgSpot18Shutter* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { +void func_808B95B8(BgSpot18Shutter* this, PlayState* play) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { Actor_SetFocus(&this->dyna.actor, 70.0f); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = func_808B9698; } } -void func_808B9618(BgSpot18Shutter* this, GlobalContext* globalCtx) { +void func_808B9618(BgSpot18Shutter* this, PlayState* play) { if (GET_INFTABLE(INFTABLE_109)) { Actor_SetFocus(&this->dyna.actor, 70.0f); if (((this->dyna.actor.params >> 8) & 1) == 0) { this->actionFunc = func_808B9698; } else { this->actionFunc = func_808B971C; - OnePointCutscene_Init(globalCtx, 4221, 140, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4221, 140, &this->dyna.actor, CAM_ID_MAIN); } } } -void func_808B9698(BgSpot18Shutter* this, GlobalContext* globalCtx) { +void func_808B9698(BgSpot18Shutter* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 180.0f, 1.44f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); this->actionFunc = func_808B95AC; @@ -113,7 +113,7 @@ void func_808B9698(BgSpot18Shutter* this, GlobalContext* globalCtx) { } } -void func_808B971C(BgSpot18Shutter* this, GlobalContext* globalCtx) { +void func_808B971C(BgSpot18Shutter* this, PlayState* play) { f32 sin = Math_SinS(this->dyna.actor.world.rot.y); f32 cos = Math_CosS(this->dyna.actor.world.rot.y); s32 flag = true; @@ -129,12 +129,12 @@ void func_808B971C(BgSpot18Shutter* this, GlobalContext* globalCtx) { } } -void BgSpot18Shutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpot18Shutter_Update(Actor* thisx, PlayState* play) { BgSpot18Shutter* this = (BgSpot18Shutter*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpot18Shutter_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gGoronCityDoorDL); +void BgSpot18Shutter_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gGoronCityDoorDL); } diff --git a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h index b24857b976..161fa9bc97 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h +++ b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h @@ -6,7 +6,7 @@ struct BgSpot18Shutter; -typedef void (*BgSpot18ShutterActionFunc)(struct BgSpot18Shutter*, GlobalContext*); +typedef void (*BgSpot18ShutterActionFunc)(struct BgSpot18Shutter*, PlayState*); typedef struct BgSpot18Shutter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c index a23499eba6..141fb331eb 100644 --- a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c +++ b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgSstFloor_Init(BgSstFloor* this, GlobalContext* globalCtx); -void BgSstFloor_Destroy(BgSstFloor* this, GlobalContext* globalCtx); -void BgSstFloor_Update(BgSstFloor* this, GlobalContext* globalCtx); -void BgSstFloor_Draw(BgSstFloor* this, GlobalContext* globalCtx); +void BgSstFloor_Init(BgSstFloor* this, PlayState* play); +void BgSstFloor_Destroy(BgSstFloor* this, PlayState* play); +void BgSstFloor_Update(BgSstFloor* this, PlayState* play); +void BgSstFloor_Draw(BgSstFloor* this, PlayState* play); static s32 sUnkValues[] = { 0, 0, 0 }; // Unused, probably a zero vector @@ -32,7 +32,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale.x, 100, ICHAIN_STOP), }; -void BgSstFloor_Init(BgSstFloor* thisx, GlobalContext* globalCtx) { +void BgSstFloor_Init(BgSstFloor* thisx, PlayState* play) { s32 pad; BgSstFloor* this = (BgSstFloor*)thisx; CollisionHeader* colHeader = NULL; @@ -40,20 +40,20 @@ void BgSstFloor_Init(BgSstFloor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gBongoDrumCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgSstFloor_Destroy(BgSstFloor* thisx, GlobalContext* globalCtx) { +void BgSstFloor_Destroy(BgSstFloor* thisx, PlayState* play) { s32 pad; BgSstFloor* this = (BgSstFloor*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { +void BgSstFloor_Update(BgSstFloor* thisx, PlayState* play) { s32 pad; BgSstFloor* this = (BgSstFloor*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); CollisionHeader* colHeader = SEGMENTED_TO_VIRTUAL(&gBongoDrumCol); colHeader->vtxList = SEGMENTED_TO_VIRTUAL(colHeader->vtxList); @@ -61,9 +61,9 @@ void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { if (1) {} if (func_80043590(&this->dyna) && (this->dyna.actor.yDistToPlayer < 1000.0f)) { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BOSS_BONGO); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_BOSS_BONGO); } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } if (func_8004356C(&this->dyna) && (player->fallDistance > 1000.0f)) { @@ -72,7 +72,7 @@ void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { } if (this->dyna.actor.params == BONGOFLOOR_HIT) { - Actor* item00 = globalCtx->actorCtx.actorLists[ACTORCAT_MISC].head; + Actor* item00 = play->actorCtx.actorLists[ACTORCAT_MISC].head; f32 distFromRim; f32 xzDist; @@ -117,20 +117,20 @@ void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { this->drumPhase--; } if (1) {} - func_8003EE6C(globalCtx, &globalCtx->colCtx.dyna); + func_8003EE6C(play, &play->colCtx.dyna); } -void BgSstFloor_Draw(BgSstFloor* thisx, GlobalContext* globalCtx) { +void BgSstFloor_Draw(BgSstFloor* thisx, PlayState* play) { BgSstFloor* this = (BgSstFloor*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_sst_floor.c", 277); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_sst_floor.c", 277); + func_80093D18(play->state.gfxCtx); Matrix_Scale(1.0f, this->drumHeight * -0.0025f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_sst_floor.c", 283), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_sst_floor.c", 283), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBongoDrumDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_sst_floor.c", 287); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_sst_floor.c", 287); } 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 267095c983..36b0b18c95 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 @@ -9,17 +9,17 @@ #define FLAGS ACTOR_FLAG_5 -void BgTokiHikari_Init(Actor* thisx, GlobalContext* globalCtx); -void BgTokiHikari_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgTokiHikari_Update(Actor* thisx, GlobalContext* globalCtx); -void BgTokiHikari_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgTokiHikari_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); -void func_808BA018(BgTokiHikari* this, GlobalContext* globalCtx); -void func_808BA204(BgTokiHikari* this, GlobalContext* globalCtx); -void func_808BA22C(BgTokiHikari* this, GlobalContext* globalCtx); -void func_808BA274(BgTokiHikari* this, GlobalContext* globalCtx); -void func_808BA2CC(BgTokiHikari* this, GlobalContext* globalCtx); +void BgTokiHikari_DoNothing(BgTokiHikari* this, PlayState* play); +void func_808BA018(BgTokiHikari* this, PlayState* play); +void func_808BA204(BgTokiHikari* this, PlayState* play); +void func_808BA22C(BgTokiHikari* this, PlayState* play); +void func_808BA274(BgTokiHikari* this, PlayState* play); +void func_808BA2CC(BgTokiHikari* this, PlayState* play); const ActorInit Bg_Toki_Hikari_InitVars = { ACTOR_BG_TOKI_HIKARI, @@ -37,7 +37,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgTokiHikari_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiHikari_Init(Actor* thisx, PlayState* play) { BgTokiHikari* this = (BgTokiHikari*)thisx; switch (this->actor.params) { @@ -56,65 +56,63 @@ void BgTokiHikari_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgTokiHikari_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiHikari_Destroy(Actor* thisx, PlayState* play) { } -void BgTokiHikari_DoNothing(BgTokiHikari* this, GlobalContext* globalCtx) { +void BgTokiHikari_DoNothing(BgTokiHikari* this, PlayState* play) { } -void BgTokiHikari_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiHikari_Update(Actor* thisx, PlayState* play) { BgTokiHikari* this = (BgTokiHikari*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgTokiHikari_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiHikari_Draw(Actor* thisx, PlayState* play) { BgTokiHikari* this = (BgTokiHikari*)thisx; switch (this->actor.params) { case 0: - func_808BA018(this, globalCtx); + func_808BA018(this, play); break; case 1: - func_808BA2CC(this, globalCtx); + func_808BA2CC(this, play); break; } } -void func_808BA018(BgTokiHikari* this, GlobalContext* globalCtx) { +void func_808BA018(BgTokiHikari* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_toki_hikari.c", 246); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_toki_hikari.c", 252), + OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 246); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_toki_hikari.c", 252), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (LINK_IS_ADULT) { gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_008190); } else { gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_007E20); - func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 128, 64, 32)); + func_80093D84(play->state.gfxCtx); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, 64, 32)); - gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 128, 64, 32)); + gSPSegment(POLY_XLU_DISP++, 9, Gfx_TexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, 64, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_toki_hikari.c", 278), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_toki_hikari.c", 278), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_007EE0); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_toki_hikari.c", 284); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 284); } -void func_808BA204(BgTokiHikari* this, GlobalContext* globalCtx) { - if (globalCtx->roomCtx.unk_74[1] != 0) { +void func_808BA204(BgTokiHikari* this, PlayState* play) { + if (play->roomCtx.unk_74[1] != 0) { this->actionFunc = func_808BA22C; } } -void func_808BA22C(BgTokiHikari* this, GlobalContext* globalCtx) { +void func_808BA22C(BgTokiHikari* this, PlayState* play) { if (this->unk_14C < 1.0f) { this->unk_14C += 0.05f; } else { @@ -123,7 +121,7 @@ void func_808BA22C(BgTokiHikari* this, GlobalContext* globalCtx) { } } -void func_808BA274(BgTokiHikari* this, GlobalContext* globalCtx) { +void func_808BA274(BgTokiHikari* this, PlayState* play) { if (this->unk_14C > 0.2f) { this->unk_14C -= 0.025f; } else { @@ -132,14 +130,14 @@ void func_808BA274(BgTokiHikari* this, GlobalContext* globalCtx) { } } -void func_808BA2CC(BgTokiHikari* this, GlobalContext* globalCtx) { +void func_808BA2CC(BgTokiHikari* this, PlayState* play) { s32 pad[2]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_toki_hikari.c", 350); + 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); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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, @@ -147,12 +145,12 @@ void func_808BA2CC(BgTokiHikari* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk_14C * 155.0f) + 100, (u8)(255.0f * this->unk_14C), 0, 128); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_toki_hikari.c", 382), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_toki_hikari.c", 382), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -2 * (globalCtx->gameplayFrames & 0x7F), 0, 0x20, 0x40, 1, - (globalCtx->gameplayFrames & 0x7F) * 4, 0, 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -2 * (play->gameplayFrames & 0x7F), 0, 0x20, 0x40, 1, + (play->gameplayFrames & 0x7F) * 4, 0, 0x20, 0x40)); gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_000880); Matrix_Pop(); @@ -163,7 +161,7 @@ void func_808BA2CC(BgTokiHikari* this, GlobalContext* globalCtx) { 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)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_toki_hikari.c", 415), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_toki_hikari.c", 415), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_0009C0); @@ -175,10 +173,10 @@ void func_808BA2CC(BgTokiHikari* this, GlobalContext* globalCtx) { 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)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_toki_hikari.c", 437), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_toki_hikari.c", 437), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &object_toki_objects_DL_0009C0[10]); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_toki_hikari.c", 443); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 443); } 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 ee2c3e33f2..b4c62dba99 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,7 +6,7 @@ struct BgTokiHikari; -typedef void (*BgTokiHikariActionFunc)(struct BgTokiHikari*, GlobalContext*); +typedef void (*BgTokiHikariActionFunc)(struct BgTokiHikari*, PlayState*); typedef struct BgTokiHikari { /* 0x0000 */ Actor actor; 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 c4e692e751..6c7271fa15 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 @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void BgTokiSwd_Init(Actor* thisx, GlobalContext* globalCtx); -void BgTokiSwd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgTokiSwd_Update(Actor* thisx, GlobalContext* globalCtx); -void BgTokiSwd_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgTokiSwd_Init(Actor* thisx, PlayState* play); +void BgTokiSwd_Destroy(Actor* thisx, PlayState* play); +void BgTokiSwd_Update(Actor* thisx, PlayState* play); +void BgTokiSwd_Draw(Actor* thisx, PlayState* play); -void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx); -void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx); -void func_808BB128(BgTokiSwd* this, GlobalContext* globalCtx); +void func_808BAF40(BgTokiSwd* this, PlayState* play); +void func_808BB0AC(BgTokiSwd* this, PlayState* play); +void func_808BB128(BgTokiSwd* this, PlayState* play); extern CutsceneData D_808BB2F0[]; extern CutsceneData D_808BB7A0[]; @@ -64,7 +64,7 @@ void BgTokiSwd_SetupAction(BgTokiSwd* this, BgTokiSwdActionFunc actionFunc) { this->actionFunc = actionFunc; } -void BgTokiSwd_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiSwd_Init(Actor* thisx, PlayState* play) { s32 pad; BgTokiSwd* this = (BgTokiSwd*)thisx; @@ -77,35 +77,35 @@ void BgTokiSwd_Init(Actor* thisx, GlobalContext* globalCtx) { } if (gSaveContext.sceneSetupIndex == 5) { - globalCtx->roomCtx.unk_74[0] = 0xFF; + play->roomCtx.unk_74[0] = 0xFF; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + 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); } -void BgTokiSwd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiSwd_Destroy(Actor* thisx, PlayState* play) { BgTokiSwd* this = (BgTokiSwd*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx) { +void func_808BAF40(BgTokiSwd* this, PlayState* play) { if (!GET_EVENTCHKINF(EVENTCHKINF_4F) && (gSaveContext.sceneSetupIndex < 4) && - Actor_IsFacingAndNearPlayer(&this->actor, 800.0f, 0x7530) && !Play_InCsMode(globalCtx)) { + Actor_IsFacingAndNearPlayer(&this->actor, 800.0f, 0x7530) && !Play_InCsMode(play)) { SET_EVENTCHKINF(EVENTCHKINF_4F); - globalCtx->csCtx.segment = D_808BBD90; + play->csCtx.segment = D_808BBD90; gSaveContext.cutsceneTrigger = 1; } if (!LINK_IS_ADULT || GET_EVENTCHKINF(EVENTCHKINF_55)) { - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { if (!LINK_IS_ADULT) { - Item_Give(globalCtx, ITEM_SWORD_MASTER); - globalCtx->csCtx.segment = D_808BB2F0; + Item_Give(play, ITEM_SWORD_MASTER); + play->csCtx.segment = D_808BB2F0; } else { - globalCtx->csCtx.segment = D_808BB7A0; + play->csCtx.segment = D_808BB7A0; } Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_MASTER_SWORD); @@ -114,24 +114,24 @@ void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx) { BgTokiSwd_SetupAction(this, func_808BB0AC); } else { if (Actor_IsFacingPlayer(&this->actor, 0x2000)) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } } } if (gSaveContext.sceneSetupIndex == 5) { - if (globalCtx->roomCtx.unk_74[0] > 0) { - globalCtx->roomCtx.unk_74[0]--; + if (play->roomCtx.unk_74[0] > 0) { + play->roomCtx.unk_74[0]--; } else { - globalCtx->roomCtx.unk_74[0] = 0; + play->roomCtx.unk_74[0] = 0; } } } -void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx) { +void func_808BB0AC(BgTokiSwd* this, PlayState* play) { Player* player; // if sword has a parent it has been pulled/placed from the pedestal - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { if (!LINK_IS_ADULT) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_SWORD_PUTAWAY_STN); this->actor.draw = NULL; // sword has been pulled, dont draw sword @@ -140,40 +140,39 @@ void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx) { } BgTokiSwd_SetupAction(this, func_808BB128); } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); player->interactRangeActor = &this->actor; } } -void func_808BB128(BgTokiSwd* this, GlobalContext* globalCtx) { - if (Flags_GetEnv(globalCtx, 1) && (globalCtx->roomCtx.unk_74[0] < 0xFF)) { - globalCtx->roomCtx.unk_74[0] += 5; +void func_808BB128(BgTokiSwd* this, PlayState* play) { + if (Flags_GetEnv(play, 1) && (play->roomCtx.unk_74[0] < 0xFF)) { + play->roomCtx.unk_74[0] += 5; } } -void BgTokiSwd_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgTokiSwd_Update(Actor* thisx, PlayState* play) { BgTokiSwd* this = (BgTokiSwd*)thisx; - this->actionFunc(this, globalCtx); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + this->actionFunc(this, play); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void BgTokiSwd_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgTokiSwd_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgTokiSwd* this = (BgTokiSwd*)thisx; s32 pad[3]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_toki_swd.c", 727); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_swd.c", 727); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); - gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, -(globalCtx->gameplayFrames % 0x80), 32, 32)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_toki_swd.c", 742), + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, -(play->gameplayFrames % 0x80), 32, 32)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_toki_swd.c", 742), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_001BD0); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_toki_swd.c", 776); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_toki_swd.c", 776); } diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h index 1891110e72..0a16201e60 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h @@ -6,7 +6,7 @@ struct BgTokiSwd; -typedef void (*BgTokiSwdActionFunc)(struct BgTokiSwd*, GlobalContext*); +typedef void (*BgTokiSwdActionFunc)(struct BgTokiSwd*, PlayState*); typedef struct BgTokiSwd { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c index af5eded051..32ebdfb169 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -10,19 +10,19 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgTreemouth_Init(Actor* thisx, GlobalContext* globalCtx); -void BgTreemouth_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgTreemouth_Update(Actor* thisx, GlobalContext* globalCtx); -void BgTreemouth_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgTreemouth_Init(Actor* thisx, PlayState* play); +void BgTreemouth_Destroy(Actor* thisx, PlayState* play); +void BgTreemouth_Update(Actor* thisx, PlayState* play); +void BgTreemouth_Draw(Actor* thisx, PlayState* play); -void func_808BC65C(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BC6F8(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BC80C(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BC864(BgTreemouth* this, GlobalContext* globalCtx); -void BgTreemouth_DoNothing(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BC8B8(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BC9EC(BgTreemouth* this, GlobalContext* globalCtx); -void func_808BCAF0(BgTreemouth* this, GlobalContext* globalCtx); +void func_808BC65C(BgTreemouth* this, PlayState* play); +void func_808BC6F8(BgTreemouth* this, PlayState* play); +void func_808BC80C(BgTreemouth* this, PlayState* play); +void func_808BC864(BgTreemouth* this, PlayState* play); +void BgTreemouth_DoNothing(BgTreemouth* this, PlayState* play); +void func_808BC8B8(BgTreemouth* this, PlayState* play); +void func_808BC9EC(BgTreemouth* this, PlayState* play); +void func_808BCAF0(BgTreemouth* this, PlayState* play); extern CutsceneData D_808BCE20[]; extern CutsceneData D_808BD2A0[]; @@ -58,7 +58,7 @@ void BgTreemouth_SetupAction(BgTreemouth* this, BgTreemouthActionFunc actionFunc this->actionFunc = actionFunc; } -void BgTreemouth_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgTreemouth_Init(Actor* thisx, PlayState* play) { s32 pad; BgTreemouth* this = (BgTreemouth*)thisx; CollisionHeader* colHeader = NULL; @@ -66,7 +66,7 @@ void BgTreemouth_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gDekuTreeMouthCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); Actor_SetFocus(thisx, 50.0f); @@ -83,17 +83,17 @@ void BgTreemouth_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->textId = 0x905; } -void BgTreemouth_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgTreemouth_Destroy(Actor* thisx, PlayState* play) { BgTreemouth* this = (BgTreemouth*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808BC65C(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BC65C(BgTreemouth* this, PlayState* play) { CsCmdActorAction* npcAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - npcAction = globalCtx->csCtx.npcActions[0]; + if (play->csCtx.state != CS_STATE_IDLE) { + npcAction = play->csCtx.npcActions[0]; if (npcAction != NULL) { if (npcAction->action == 2) { BgTreemouth_SetupAction(this, func_808BC80C); @@ -106,7 +106,7 @@ void func_808BC65C(BgTreemouth* this, GlobalContext* globalCtx) { } } -void func_808BC6F8(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BC6F8(BgTreemouth* this, PlayState* play) { Vec3f sp34; if (this->unk_168 < 1.0f) { @@ -115,30 +115,29 @@ void func_808BC6F8(BgTreemouth* this, GlobalContext* globalCtx) { this->unk_168 = 1.0f; } - if ((gSaveContext.sceneSetupIndex == 6) && (globalCtx->csCtx.frames >= 0x2BD) && - (globalCtx->state.frames % 8 == 0)) { + if ((gSaveContext.sceneSetupIndex == 6) && (play->csCtx.frames >= 0x2BD) && (play->state.frames % 8 == 0)) { sp34.x = (Rand_ZeroOne() * 1158.0f) + 3407.0f; sp34.y = 970.0f; sp34.z = (Rand_ZeroOne() * 2026.0f) + -2163.0f; - EffectSsHahen_SpawnBurst(globalCtx, &sp34, 0.8f, 0, 50, 30, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &sp34, 0.8f, 0, 50, 30, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); } } -void func_808BC80C(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BC80C(BgTreemouth* this, PlayState* play) { this->unk_168 += 0.05f; if (this->unk_168 >= 0.8f) { BgTreemouth_SetupAction(this, func_808BC864); } } -void func_808BC864(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BC864(BgTreemouth* this, PlayState* play) { this->unk_168 -= 0.03f; if (this->unk_168 <= 0.0f) { BgTreemouth_SetupAction(this, func_808BC65C); } } -void func_808BC8B8(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BC8B8(BgTreemouth* this, PlayState* play) { if (!Flags_GetEventChkInf(EVENTCHKINF_05) || LINK_IS_ADULT) { if (!LINK_IS_ADULT) { if (Flags_GetEventChkInf(EVENTCHKINF_0C)) { @@ -146,14 +145,14 @@ void func_808BC8B8(BgTreemouth* this, GlobalContext* globalCtx) { this->dyna.actor.flags |= ACTOR_FLAG_0; if (this->dyna.actor.isTargeted) { this->dyna.actor.flags &= ~ACTOR_FLAG_0; - globalCtx->csCtx.segment = D_808BD2A0; + play->csCtx.segment = D_808BD2A0; gSaveContext.cutsceneTrigger = 1; BgTreemouth_SetupAction(this, func_808BC9EC); } } } else if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 1658.0f, 0x4E20)) { Flags_SetEventChkInf(EVENTCHKINF_0C); - globalCtx->csCtx.segment = D_808BCE20; + play->csCtx.segment = D_808BCE20; gSaveContext.cutsceneTrigger = 1; BgTreemouth_SetupAction(this, func_808BC9EC); } @@ -163,42 +162,42 @@ void func_808BC8B8(BgTreemouth* this, GlobalContext* globalCtx) { } } -void func_808BC9EC(BgTreemouth* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808BC9EC(BgTreemouth* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->csCtx.state == CS_STATE_UNSKIPPABLE_INIT) { + if (play->csCtx.state == CS_STATE_UNSKIPPABLE_INIT) { if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 350.0f, 0x7530)) { player->actor.world.pos.x = 3827.0f; player->actor.world.pos.y = -161.0f; player->actor.world.pos.z = -1142.0f; } - globalCtx->csCtx.frames = 0; - globalCtx->csCtx.unk_18 = 0xFFFF; + play->csCtx.frames = 0; + play->csCtx.unk_18 = 0xFFFF; D_8015FCC0 = 0xFFFF; D_8015FCC2 = 0xFFFF; D_8015FCC4 = 0xFFFF; - globalCtx->csCtx.unk_1A = 0; - globalCtx->csCtx.unk_1B = 0; - globalCtx->csCtx.state = CS_STATE_SKIPPABLE_EXEC; + play->csCtx.unk_1A = 0; + play->csCtx.unk_1B = 0; + play->csCtx.state = CS_STATE_SKIPPABLE_EXEC; - if (globalCtx->msgCtx.choiceIndex == 0) { - globalCtx->csCtx.segment = D_808BD520; + if (play->msgCtx.choiceIndex == 0) { + play->csCtx.segment = D_808BD520; Flags_SetEventChkInf(EVENTCHKINF_05); BgTreemouth_SetupAction(this, func_808BCAF0); } else { - globalCtx->csCtx.segment = D_808BD790; - globalCtx->csCtx.frames = 0; + play->csCtx.segment = D_808BD790; + play->csCtx.frames = 0; BgTreemouth_SetupAction(this, func_808BC8B8); } } } -void func_808BCAF0(BgTreemouth* this, GlobalContext* globalCtx) { +void func_808BCAF0(BgTreemouth* this, PlayState* play) { CsCmdActorAction* npcAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - npcAction = globalCtx->csCtx.npcActions[0]; + if (play->csCtx.state != CS_STATE_IDLE) { + npcAction = play->csCtx.npcActions[0]; if (npcAction != NULL) { if (npcAction->action == 2) { BgTreemouth_SetupAction(this, func_808BC80C); @@ -211,27 +210,27 @@ void func_808BCAF0(BgTreemouth* this, GlobalContext* globalCtx) { } } -void BgTreemouth_DoNothing(BgTreemouth* this, GlobalContext* globalCtx) { +void BgTreemouth_DoNothing(BgTreemouth* this, PlayState* play) { } -void BgTreemouth_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgTreemouth_Update(Actor* thisx, PlayState* play) { BgTreemouth* this = (BgTreemouth*)thisx; f32 unk_168; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); unk_168 = this->unk_168; thisx->world.pos.x = (unk_168 * -160.0f) + 4029.0f; thisx->world.pos.y = (unk_168 * -399.0f) + 136.0f; thisx->world.pos.z = (unk_168 * 92.0f) + -1255.0f; } -void BgTreemouth_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgTreemouth_Draw(Actor* thisx, PlayState* play) { s32 pad; u16 alpha = 500; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_treemouth.c", 893); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_treemouth.c", 893); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if ((gSaveContext.sceneSetupIndex < 4) || LINK_IS_ADULT) { if (GET_EVENTCHKINF(EVENTCHKINF_07)) { @@ -241,13 +240,13 @@ void BgTreemouth_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (gSaveContext.sceneSetupIndex == 6) { - alpha = (globalCtx->roomCtx.unk_74[0] + 0x1F4); + alpha = (play->roomCtx.unk_74[0] + 0x1F4); } gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, alpha * 0.1f); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_treemouth.c", 932), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_treemouth.c", 932), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuTreeMouthDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_treemouth.c", 937); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_treemouth.c", 937); } diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h index 7c704067ee..dc5a5f545f 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h @@ -6,7 +6,7 @@ struct BgTreemouth; -typedef void (*BgTreemouthActionFunc)(struct BgTreemouth*, GlobalContext*); +typedef void (*BgTreemouthActionFunc)(struct BgTreemouth*, PlayState*); typedef struct BgTreemouth { /* 0x0000 */ DynaPolyActor dyna; 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 2afd2db9be..39ffd018c5 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void BgUmaJump_Init(Actor* thisx, GlobalContext* globalCtx); -void BgUmaJump_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgUmaJump_Update(Actor* thisx, GlobalContext* globalCtx); -void BgUmaJump_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgUmaJump_Init(Actor* thisx, PlayState* play); +void BgUmaJump_Destroy(Actor* thisx, PlayState* play); +void BgUmaJump_Update(Actor* thisx, PlayState* play); +void BgUmaJump_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Umajump_InitVars = { ACTOR_BG_UMAJUMP, @@ -30,7 +30,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgUmaJump_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgUmaJump_Init(Actor* thisx, PlayState* play) { s32 pad; BgUmaJump* this = (BgUmaJump*)thisx; CollisionHeader* colHeader = NULL; @@ -38,7 +38,7 @@ void BgUmaJump_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gJumpableHorseFenceCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.actor.params == 1) { if (!Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) { @@ -49,15 +49,15 @@ void BgUmaJump_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgUmaJump_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgUmaJump_Destroy(Actor* thisx, PlayState* play) { BgUmaJump* this = (BgUmaJump*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgUmaJump_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgUmaJump_Update(Actor* thisx, PlayState* play) { } -void BgUmaJump_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gJumpableHorseFenceDL); +void BgUmaJump_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gJumpableHorseFenceDL); } diff --git a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c index 6024da5c35..5e4cb4fd5d 100644 --- a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c +++ b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c @@ -10,10 +10,10 @@ #define FLAGS 0 -void BgVbSima_Init(Actor* thisx, GlobalContext* globalCtx); -void BgVbSima_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgVbSima_Update(Actor* thisx, GlobalContext* globalCtx); -void BgVbSima_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgVbSima_Init(Actor* thisx, PlayState* play); +void BgVbSima_Destroy(Actor* thisx, PlayState* play); +void BgVbSima_Update(Actor* thisx, PlayState* play); +void BgVbSima_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Vb_Sima_InitVars = { ACTOR_BG_VB_SIMA, @@ -31,7 +31,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgVbSima_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgVbSima_Init(Actor* thisx, PlayState* play) { s32 pad; BgVbSima* this = (BgVbSima*)thisx; CollisionHeader* colHeader = NULL; @@ -39,14 +39,14 @@ void BgVbSima_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&gVolvagiaPlatformCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void BgVbSima_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgVbSima_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgVbSima* this = (BgVbSima*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgVbSima_SpawnEmber(BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale) { @@ -66,7 +66,7 @@ void BgVbSima_SpawnEmber(BossFdEffect* effect, Vec3f* position, Vec3f* velocity, } } -void BgVbSima_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgVbSima_Update(Actor* thisx, PlayState* play) { static Color_RGBA8 colorYellow = { 255, 255, 0, 255 }; static Color_RGBA8 colorRed = { 255, 10, 0, 255 }; s32 pad; @@ -75,7 +75,7 @@ void BgVbSima_Update(Actor* thisx, GlobalContext* globalCtx) { f32 minus1 = -1.0f; this->shakeTimer++; - if (!Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + if (!Flags_GetClear(play, play->roomCtx.curRoom.num)) { s32 signal = bossFd->platformSignal; if (signal == VBSIMA_COLLAPSE) { @@ -124,7 +124,7 @@ void BgVbSima_Update(Actor* thisx, GlobalContext* globalCtx) { splashPos.y = -80.0f; splashPos.z = this->dyna.actor.world.pos.z + edgeZ; - func_8002836C(globalCtx, &splashPos, &splashVel, &splashAcc, &colorYellow, &colorRed, + func_8002836C(play, &splashPos, &splashVel, &splashAcc, &colorYellow, &colorRed, (s16)Rand_ZeroFloat(100.0f) + 500, 10, 20); for (i2 = 0; i2 < 3; i2++) { @@ -148,11 +148,11 @@ void BgVbSima_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void BgVbSima_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_vb_sima.c", 285); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_vb_sima.c", 291), +void BgVbSima_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_bg_vb_sima.c", 285); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_vb_sima.c", 291), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gVolvagiaPlatformDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_vb_sima.c", 296); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_vb_sima.c", 296); } 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 7001ec6357..87d87ee108 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 @@ -9,17 +9,17 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BgYdanHasi_Init(Actor* thisx, GlobalContext* globalCtx); -void BgYdanHasi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgYdanHasi_Update(Actor* thisx, GlobalContext* globalCtx); -void BgYdanHasi_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgYdanHasi_Init(Actor* thisx, PlayState* play); +void BgYdanHasi_Destroy(Actor* thisx, PlayState* play); +void BgYdanHasi_Update(Actor* thisx, PlayState* play); +void BgYdanHasi_Draw(Actor* thisx, PlayState* play); -void BgYdanHasi_InitWater(BgYdanHasi* this, GlobalContext* globalCtx); -void BgYdanHasi_UpdateFloatingBlock(BgYdanHasi* this, GlobalContext* globalCtx); -void BgYdanHasi_SetupThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx); -void BgYdanHasi_MoveWater(BgYdanHasi* this, GlobalContext* globalCtx); -void BgYdanHasi_DecWaterTimer(BgYdanHasi* this, GlobalContext* globalCtx); -void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx); +void BgYdanHasi_InitWater(BgYdanHasi* this, PlayState* play); +void BgYdanHasi_UpdateFloatingBlock(BgYdanHasi* this, PlayState* play); +void BgYdanHasi_SetupThreeBlocks(BgYdanHasi* this, PlayState* play); +void BgYdanHasi_MoveWater(BgYdanHasi* this, PlayState* play); +void BgYdanHasi_DecWaterTimer(BgYdanHasi* this, PlayState* play); +void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, PlayState* play); const ActorInit Bg_Ydan_Hasi_InitVars = { ACTOR_BG_YDAN_HASI, @@ -37,7 +37,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgYdanHasi_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanHasi_Init(Actor* thisx, PlayState* play) { s32 pad; BgYdanHasi* this = (BgYdanHasi*)thisx; CollisionHeader* colHeader = NULL; @@ -46,7 +46,7 @@ void BgYdanHasi_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); this->type = ((thisx->params >> 8) & 0x3F); thisx->params = thisx->params & 0xFF; - waterBox = &globalCtx->colCtx.colHeader->waterBoxes[1]; + waterBox = &play->colCtx.colHeader->waterBoxes[1]; DynaPolyActor_Init(&this->dyna, DPM_PLAYER); if (thisx->params == HASI_WATER) { // Water the moving platform floats on in B1. Never runs in Master Quest @@ -67,27 +67,27 @@ void BgYdanHasi_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgYdanHasi_SetupThreeBlocks; Actor_SetFocus(&this->dyna.actor, 40.0f); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } this->timer = 0; } -void BgYdanHasi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanHasi_Destroy(Actor* thisx, PlayState* play) { BgYdanHasi* this = (BgYdanHasi*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgYdanHasi_UpdateFloatingBlock(BgYdanHasi* this, GlobalContext* globalCtx) { +void BgYdanHasi_UpdateFloatingBlock(BgYdanHasi* this, PlayState* play) { WaterBox* waterBox; f32 framesAfterMath; - framesAfterMath = sinf((globalCtx->gameplayFrames & 0xFF) * (M_PI / 128)) * 165.0f; + framesAfterMath = sinf((play->gameplayFrames & 0xFF) * (M_PI / 128)) * 165.0f; this->dyna.actor.world.pos.x = ((Math_SinS(this->dyna.actor.world.rot.y) * framesAfterMath) + this->dyna.actor.home.pos.x); this->dyna.actor.world.pos.z = ((Math_CosS(this->dyna.actor.world.rot.y) * framesAfterMath) + this->dyna.actor.home.pos.z); - waterBox = &globalCtx->colCtx.colHeader->waterBoxes[1]; + waterBox = &play->colCtx.colHeader->waterBoxes[1]; this->dyna.actor.world.pos.y = waterBox->ySurface + 20.0f; if (this->timer != 0) { this->timer--; @@ -98,19 +98,19 @@ void BgYdanHasi_UpdateFloatingBlock(BgYdanHasi* this, GlobalContext* globalCtx) this->dyna.actor.world.pos.y += 2.0f * sinf(this->timer * (M_PI / 25)); } -void BgYdanHasi_InitWater(BgYdanHasi* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->type)) { +void BgYdanHasi_InitWater(BgYdanHasi* this, PlayState* play) { + if (Flags_GetSwitch(play, this->type)) { this->timer = 600; this->actionFunc = BgYdanHasi_MoveWater; } } -void BgYdanHasi_MoveWater(BgYdanHasi* this, GlobalContext* globalCtx) { +void BgYdanHasi_MoveWater(BgYdanHasi* this, PlayState* play) { WaterBox* waterBox; if (this->timer == 0) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f) != 0) { - Flags_UnsetSwitch(globalCtx, this->type); + Flags_UnsetSwitch(play, this->type); this->actionFunc = BgYdanHasi_InitWater; } func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); @@ -120,11 +120,11 @@ void BgYdanHasi_MoveWater(BgYdanHasi* this, GlobalContext* globalCtx) { } func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); } - waterBox = &globalCtx->colCtx.colHeader->waterBoxes[1]; + waterBox = &play->colCtx.colHeader->waterBoxes[1]; waterBox->ySurface = this->dyna.actor.world.pos.y; } -void BgYdanHasi_DecWaterTimer(BgYdanHasi* this, GlobalContext* globalCtx) { +void BgYdanHasi_DecWaterTimer(BgYdanHasi* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -134,22 +134,22 @@ void BgYdanHasi_DecWaterTimer(BgYdanHasi* this, GlobalContext* globalCtx) { } } -void BgYdanHasi_SetupThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->type)) { +void BgYdanHasi_SetupThreeBlocks(BgYdanHasi* this, PlayState* play) { + if (Flags_GetSwitch(play, this->type)) { this->timer = 260; this->dyna.actor.draw = BgYdanHasi_Draw; this->actionFunc = BgYdanHasi_UpdateThreeBlocks; - OnePointCutscene_Init(globalCtx, 3040, 30, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3040, 30, &this->dyna.actor, CAM_ID_MAIN); } } -void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx) { +void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 3.0f) != 0) { - Flags_UnsetSwitch(globalCtx, this->type); + Flags_UnsetSwitch(play, this->type); this->dyna.actor.draw = NULL; this->actionFunc = BgYdanHasi_SetupThreeBlocks; } else { @@ -163,30 +163,29 @@ void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx) { } } -void BgYdanHasi_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanHasi_Update(Actor* thisx, PlayState* play) { BgYdanHasi* this = (BgYdanHasi*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgYdanHasi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanHasi_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gDTSlidingPlatformDL, gDTWaterPlaneDL, gDTRisingPlatformsDL }; BgYdanHasi* this = (BgYdanHasi*)thisx; if (this->dyna.actor.params == HASI_WATER_BLOCK || this->dyna.actor.params == HASI_THREE_BLOCKS) { - Gfx_DrawDListOpa(globalCtx, dLists[this->dyna.actor.params]); + Gfx_DrawDListOpa(play, dLists[this->dyna.actor.params]); } else { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 577); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_ydan_hasi.c", 577); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -globalCtx->gameplayFrames % 128, - globalCtx->gameplayFrames % 128, 0x20, 0x20, 1, globalCtx->gameplayFrames % 128, - globalCtx->gameplayFrames % 128, 0x20, 0x20)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 592), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -play->gameplayFrames % 128, play->gameplayFrames % 128, + 0x20, 0x20, 1, play->gameplayFrames % 128, play->gameplayFrames % 128, 0x20, 0x20)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_ydan_hasi.c", 592), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDTWaterPlaneDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 597); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_ydan_hasi.c", 597); } } diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h index 4ffe1fad42..63105ab48c 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h @@ -6,7 +6,7 @@ struct BgYdanHasi; -typedef void (*BgYdanHasiActionFunc)(struct BgYdanHasi*, GlobalContext*); +typedef void (*BgYdanHasiActionFunc)(struct BgYdanHasi*, PlayState*); typedef struct BgYdanHasi { /* 0x0000 */ DynaPolyActor dyna; 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 c81a3486e0..05345a5703 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 @@ -9,16 +9,16 @@ #define FLAGS 0 -void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx); -void BgYdanMaruta_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgYdanMaruta_Update(Actor* thisx, GlobalContext* globalCtx); -void BgYdanMaruta_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgYdanMaruta_Init(Actor* thisx, PlayState* play); +void BgYdanMaruta_Destroy(Actor* thisx, PlayState* play); +void BgYdanMaruta_Update(Actor* thisx, PlayState* play); +void BgYdanMaruta_Draw(Actor* thisx, PlayState* play); -void func_808BEFF4(BgYdanMaruta* this, GlobalContext* globalCtx); -void BgYdanMaruta_DoNothing(BgYdanMaruta* this, GlobalContext* globalCtx); -void func_808BF078(BgYdanMaruta* this, GlobalContext* globalCtx); -void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx); -void func_808BF1EC(BgYdanMaruta* this, GlobalContext* globalCtx); +void func_808BEFF4(BgYdanMaruta* this, PlayState* play); +void BgYdanMaruta_DoNothing(BgYdanMaruta* this, PlayState* play); +void func_808BF078(BgYdanMaruta* this, PlayState* play); +void func_808BF108(BgYdanMaruta* this, PlayState* play); +void func_808BF1EC(BgYdanMaruta* this, PlayState* play); const ActorInit Bg_Ydan_Maruta_InitVars = { ACTOR_BG_YDAN_MARUTA, @@ -74,7 +74,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanMaruta_Init(Actor* thisx, PlayState* play) { s32 pad; BgYdanMaruta* this = (BgYdanMaruta*)thisx; Vec3f sp4C[3]; @@ -85,8 +85,8 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { ColliderTrisElementInit* triInit; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInit, this->elements); + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->elements); this->switchFlag = this->dyna.actor.params & 0xFFFF; thisx->params = (thisx->params >> 8) & 0xFF; // thisx is required to match here @@ -98,9 +98,9 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { triInit = &sTrisElementsInit[1]; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gDTFallingLadderCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); thisx->home.pos.y += -280.0f; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { thisx->world.pos.y = thisx->home.pos.y; this->actionFunc = BgYdanMaruta_DoNothing; } else { @@ -126,37 +126,37 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetTrisVertices(&this->collider, 1, &sp4C[0], &sp4C[2], &sp4C[1]); } -void BgYdanMaruta_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanMaruta_Destroy(Actor* thisx, PlayState* play) { BgYdanMaruta* this = (BgYdanMaruta*)thisx; - Collider_DestroyTris(globalCtx, &this->collider); + Collider_DestroyTris(play, &this->collider); if (this->dyna.actor.params == 1) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void func_808BEFF4(BgYdanMaruta* this, GlobalContext* globalCtx) { +void func_808BEFF4(BgYdanMaruta* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { - func_8002F71C(globalCtx, &this->dyna.actor, 7.0f, this->dyna.actor.shape.rot.y, 6.0f); + func_8002F71C(play, &this->dyna.actor, 7.0f, this->dyna.actor.shape.rot.y, 6.0f); } this->dyna.actor.shape.rot.x += 0x360; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); func_8002F974(&this->dyna.actor, NA_SE_EV_TOGE_STICK_ROLLING - SFX_FLAG); } -void func_808BF078(BgYdanMaruta* this, GlobalContext* globalCtx) { +void func_808BF078(BgYdanMaruta* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->unk_16A = 20; - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); func_80078884(NA_SE_SY_CORRECT_CHIME); this->actionFunc = func_808BF108; - OnePointCutscene_Init(globalCtx, 3010, 50, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3010, 50, &this->dyna.actor, CAM_ID_MAIN); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx) { +void func_808BF108(BgYdanMaruta* this, PlayState* play) { s16 temp; if (this->unk_16A != 0) { @@ -181,7 +181,7 @@ void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG); } -void func_808BF1EC(BgYdanMaruta* this, GlobalContext* globalCtx) { +void func_808BF1EC(BgYdanMaruta* this, PlayState* play) { this->dyna.actor.velocity.y += 1.0f; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_LADDER_DOUND); @@ -189,21 +189,21 @@ void func_808BF1EC(BgYdanMaruta* this, GlobalContext* globalCtx) { } } -void BgYdanMaruta_DoNothing(BgYdanMaruta* this, GlobalContext* globalCtx) { +void BgYdanMaruta_DoNothing(BgYdanMaruta* this, PlayState* play) { } -void BgYdanMaruta_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanMaruta_Update(Actor* thisx, PlayState* play) { BgYdanMaruta* this = (BgYdanMaruta*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgYdanMaruta_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanMaruta_Draw(Actor* thisx, PlayState* play) { BgYdanMaruta* this = (BgYdanMaruta*)thisx; if (this->dyna.actor.params == 0) { - Gfx_DrawDListOpa(globalCtx, gDTRollingSpikeTrapDL); + Gfx_DrawDListOpa(play, gDTRollingSpikeTrapDL); } else { - Gfx_DrawDListOpa(globalCtx, gDTFallingLadderDL); + Gfx_DrawDListOpa(play, gDTFallingLadderDL); } } diff --git a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h index 48aeb5df8e..72b753b83e 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h +++ b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h @@ -6,7 +6,7 @@ struct BgYdanMaruta; -typedef void (*BgYdanMarutaActionFunc)(struct BgYdanMaruta*, GlobalContext*); +typedef void (*BgYdanMarutaActionFunc)(struct BgYdanMaruta*, PlayState*); typedef struct BgYdanMaruta { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index d95e0167c2..f72ab66ff9 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -9,15 +9,15 @@ #define FLAGS 0 -void BgYdanSp_Init(Actor* thisx, GlobalContext* globalCtx); -void BgYdanSp_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgYdanSp_Update(Actor* thisx, GlobalContext* globalCtx); -void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgYdanSp_Init(Actor* thisx, PlayState* play); +void BgYdanSp_Destroy(Actor* thisx, PlayState* play); +void BgYdanSp_Update(Actor* thisx, PlayState* play); +void BgYdanSp_Draw(Actor* thisx, PlayState* play); -void BgYdanSp_BurnFloorWeb(BgYdanSp* this, GlobalContext* globalCtx); -void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx); -void BgYdanSp_BurnWallWeb(BgYdanSp* this, GlobalContext* globalCtx); -void BgYdanSp_WallWebIdle(BgYdanSp* this, GlobalContext* globalCtx); +void BgYdanSp_BurnFloorWeb(BgYdanSp* this, PlayState* play); +void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play); +void BgYdanSp_BurnWallWeb(BgYdanSp* this, PlayState* play); +void BgYdanSp_WallWebIdle(BgYdanSp* this, PlayState* play); typedef enum { /* 0 */ WEB_FLOOR, @@ -78,7 +78,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgYdanSp_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanSp_Init(Actor* thisx, PlayState* play) { BgYdanSp* this = (BgYdanSp*)thisx; ColliderTrisElementInit* ti0 = &sTrisItemsInit[0]; Vec3f tri[3]; @@ -95,8 +95,8 @@ void BgYdanSp_Init(Actor* thisx, GlobalContext* globalCtx) { this->burnSwitchFlag = (thisx->params >> 6) & 0x3F; this->dyna.actor.params = (thisx->params >> 0xC) & 0xF; DynaPolyActor_Init(&this->dyna, DPM_PLAYER); - Collider_InitTris(globalCtx, &this->trisCollider); - Collider_SetTris(globalCtx, &this->trisCollider, &this->dyna.actor, &sTrisInit, this->trisColliderItems); + Collider_InitTris(play, &this->trisCollider); + Collider_SetTris(play, &this->trisCollider, &this->dyna.actor, &sTrisInit, this->trisColliderItems); if (this->dyna.actor.params == WEB_FLOOR) { CollisionHeader_GetVirtual(&gDTWebFloorCol, &colHeader); this->actionFunc = BgYdanSp_FloorWebIdle; @@ -136,17 +136,17 @@ void BgYdanSp_Init(Actor* thisx, GlobalContext* globalCtx) { tri[1].z = this->dyna.actor.world.pos.z - (sinsY * ti1->dim.vtx[0].x) + (ti1->dim.vtx[2].y * cossY * nSinsX); Collider_SetTrisVertices(&this->trisCollider, 1, &tri[0], &tri[2], &tri[1]); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->timer = 0; - if (Flags_GetSwitch(globalCtx, this->isDestroyedSwitchFlag)) { + if (Flags_GetSwitch(play, this->isDestroyedSwitchFlag)) { Actor_Kill(&this->dyna.actor); } } -void BgYdanSp_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanSp_Destroy(Actor* thisx, PlayState* play) { BgYdanSp* this = (BgYdanSp*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyTris(globalCtx, &this->trisCollider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyTris(play, &this->trisCollider); } void BgYdanSp_UpdateFloorWebCollision(BgYdanSp* this) { @@ -166,11 +166,11 @@ void BgYdanSp_UpdateFloorWebCollision(BgYdanSp* this) { colHeader->vtxList[0].y = newY; } -void BgYdanSp_BurnWeb(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_BurnWeb(BgYdanSp* this, PlayState* play) { this->timer = 30; this = this; func_80078884(NA_SE_SY_CORRECT_CHIME); - Flags_SetSwitch(globalCtx, this->isDestroyedSwitchFlag); + Flags_SetSwitch(play, this->isDestroyedSwitchFlag); if (this->dyna.actor.params == WEB_FLOOR) { this->actionFunc = BgYdanSp_BurnFloorWeb; } else { @@ -178,7 +178,7 @@ void BgYdanSp_BurnWeb(BgYdanSp* this, GlobalContext* globalCtx) { } } -void BgYdanSp_BurnFloorWeb(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_BurnFloorWeb(BgYdanSp* this, PlayState* play) { static Vec3f accel = { 0 }; Vec3f velocity; Vec3f pos2; @@ -219,14 +219,14 @@ void BgYdanSp_BurnFloorWeb(BgYdanSp* this, GlobalContext* globalCtx) { velocity.x = (7.0f * sins) * distXZ; velocity.y = 0.0f; velocity.z = (7.0f * coss) * distXZ; - EffectSsDeadDb_Spawn(globalCtx, &this->dyna.actor.home.pos, &velocity, &accel, 60, 6, 255, 255, 150, 170, - 255, 0, 0, 1, 0xE, 1); + EffectSsDeadDb_Spawn(play, &this->dyna.actor.home.pos, &velocity, &accel, 60, 6, 255, 255, 150, 170, 255, 0, + 0, 1, 0xE, 1); rot2 += 0x2AAA; } } } -void BgYdanSp_FloorWebBroken(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_FloorWebBroken(BgYdanSp* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -236,7 +236,7 @@ void BgYdanSp_FloorWebBroken(BgYdanSp* this, GlobalContext* globalCtx) { } } -void BgYdanSp_FloorWebBreaking(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_FloorWebBreaking(BgYdanSp* this, PlayState* play) { static Color_RGBA8 primColor = { 250, 250, 250, 255 }; static Color_RGBA8 envColor = { 180, 180, 180, 255 }; static Vec3f zeroVec = { 0 }; @@ -250,17 +250,17 @@ void BgYdanSp_FloorWebBreaking(BgYdanSp* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y = (sinf((f32)this->timer * (M_PI / 20)) * this->unk_16C) + this->dyna.actor.home.pos.y; if (this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y > 190.0f) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->timer = 40; func_80078884(NA_SE_SY_CORRECT_CHIME); - Flags_SetSwitch(globalCtx, this->isDestroyedSwitchFlag); + Flags_SetSwitch(play, this->isDestroyedSwitchFlag); this->actionFunc = BgYdanSp_FloorWebBroken; pos.y = this->dyna.actor.world.pos.y - 60.0f; rot = 0; for (i = 0; i < 6; i++) { pos.x = Math_SinS(rot) * 60.0f + this->dyna.actor.world.pos.x; pos.z = Math_CosS(rot) * 60.0f + this->dyna.actor.world.pos.z; - func_8002829C(globalCtx, &pos, &zeroVec, &zeroVec, &primColor, &envColor, 1000, 10); + func_8002829C(play, &pos, &zeroVec, &zeroVec, &primColor, &envColor, 1000, 10); rot += 0x2AAA; } @@ -268,24 +268,24 @@ void BgYdanSp_FloorWebBreaking(BgYdanSp* this, GlobalContext* globalCtx) { BgYdanSp_UpdateFloorWebCollision(this); } -void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play) { Player* player; Vec3f webPos; f32 sqrtFallDistance; f32 unk; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); webPos.x = this->dyna.actor.world.pos.x; webPos.y = this->dyna.actor.world.pos.y - 50.0f; webPos.z = this->dyna.actor.world.pos.z; - if (Player_IsBurningStickInRange(globalCtx, &webPos, 70.0f, 50.0f) != 0) { + if (Player_IsBurningStickInRange(play, &webPos, 70.0f, 50.0f) != 0) { this->dyna.actor.home.pos.x = player->meleeWeaponInfo[0].tip.x; this->dyna.actor.home.pos.z = player->meleeWeaponInfo[0].tip.z; - BgYdanSp_BurnWeb(this, globalCtx); + BgYdanSp_BurnWeb(this, play); return; } if ((this->trisCollider.base.acFlags & 2) != 0) { - BgYdanSp_BurnWeb(this, globalCtx); + BgYdanSp_BurnWeb(this, play); return; } if (func_8004356C(&this->dyna)) { @@ -335,10 +335,10 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { } } BgYdanSp_UpdateFloorWebCollision(this); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->trisCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->trisCollider.base); } -void BgYdanSp_BurnWallWeb(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_BurnWallWeb(BgYdanSp* this, PlayState* play) { static Vec3f accel = { 0 }; Vec3f velocity; Vec3f spC8; @@ -384,47 +384,47 @@ void BgYdanSp_BurnWallWeb(BgYdanSp* this, GlobalContext* globalCtx) { velocity.x = 6.5f * coss2 * distXYZ; velocity.y = 6.5f * coss * distXYZ; velocity.z = -6.5f * sins * distXYZ; - EffectSsDeadDb_Spawn(globalCtx, &this->dyna.actor.home.pos, &velocity, &accel, 80, 6, 255, 255, 150, 170, - 255, 0, 0, 1, 0xE, 1); + EffectSsDeadDb_Spawn(play, &this->dyna.actor.home.pos, &velocity, &accel, 80, 6, 255, 255, 150, 170, 255, 0, + 0, 1, 0xE, 1); rot2 += 0x2AAA; } } } -void BgYdanSp_WallWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { +void BgYdanSp_WallWebIdle(BgYdanSp* this, PlayState* play) { Player* player; Vec3f sp30; - player = GET_PLAYER(globalCtx); - if (Flags_GetSwitch(globalCtx, this->burnSwitchFlag) || (this->trisCollider.base.acFlags & 2)) { + player = GET_PLAYER(play); + if (Flags_GetSwitch(play, this->burnSwitchFlag) || (this->trisCollider.base.acFlags & 2)) { this->dyna.actor.home.pos.y = this->dyna.actor.world.pos.y + 80.0f; - BgYdanSp_BurnWeb(this, globalCtx); + BgYdanSp_BurnWeb(this, play); } else if (player->heldItemActionParam == PLAYER_AP_STICK && player->unk_860 != 0) { func_8002DBD0(&this->dyna.actor, &sp30, &player->meleeWeaponInfo[0].tip); if (fabsf(sp30.x) < 100.0f && sp30.z < 1.0f && sp30.y < 200.0f) { - OnePointCutscene_Init(globalCtx, 3020, 40, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3020, 40, &this->dyna.actor, CAM_ID_MAIN); Math_Vec3f_Copy(&this->dyna.actor.home.pos, &player->meleeWeaponInfo[0].tip); - BgYdanSp_BurnWeb(this, globalCtx); + BgYdanSp_BurnWeb(this, play); } } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->trisCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->trisCollider.base); } -void BgYdanSp_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanSp_Update(Actor* thisx, PlayState* play) { BgYdanSp* this = (BgYdanSp*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgYdanSp_Draw(Actor* thisx, PlayState* play) { BgYdanSp* this = (BgYdanSp*)thisx; s32 i; MtxF mtxF; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 781); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_ydan_sp.c", 781); + func_80093D84(play->state.gfxCtx); if (thisx->params == WEB_WALL) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 787), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_ydan_sp.c", 787), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDTWebWallDL); } else if (this->actionFunc == BgYdanSp_FloorWebBroken) { @@ -432,7 +432,7 @@ void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->timer == 40) { Matrix_Translate(0.0f, (thisx->home.pos.y - thisx->world.pos.y) * 10.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(1.0f, ((thisx->home.pos.y - thisx->world.pos.y) + 10.0f) * 0.1f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 808), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_ydan_sp.c", 808), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDTWebFloorDL); } @@ -441,17 +441,17 @@ void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZYX(-0x5A0, i * 0x2000, 0, MTXMODE_APPLY); Matrix_Translate(0.0f, 700.0f, -900.0f, MTXMODE_APPLY); Matrix_Scale(3.5f, 5.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 830), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_ydan_sp.c", 830), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDTUnknownWebDL); } } else { Matrix_Translate(0.0f, (thisx->home.pos.y - thisx->world.pos.y) * 10.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(1.0f, ((thisx->home.pos.y - thisx->world.pos.y) + 10.0f) * 0.1f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 849), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_ydan_sp.c", 849), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDTWebFloorDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 856); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_ydan_sp.c", 856); } diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h index 9d0a000a0a..e134ac6f2c 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h @@ -6,7 +6,7 @@ struct BgYdanSp; -typedef void (*BgYdanSpActionFunc)(struct BgYdanSp*, GlobalContext*); +typedef void (*BgYdanSpActionFunc)(struct BgYdanSp*, PlayState*); typedef struct BgYdanSp { /* 0x0000 */ DynaPolyActor dyna; 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 ffaf055479..ed1e3aa71c 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -10,17 +10,17 @@ #define FLAGS ACTOR_FLAG_4 -void BgZg_Init(Actor* thisx, GlobalContext* globalCtx); -void BgZg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgZg_Update(Actor* thisx, GlobalContext* globalCtx); -void BgZg_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgZg_Init(Actor* thisx, PlayState* play); +void BgZg_Destroy(Actor* thisx, PlayState* play); +void BgZg_Update(Actor* thisx, PlayState* play); +void BgZg_Draw(Actor* thisx, PlayState* play); void func_808C0C50(BgZg* this); -s32 func_808C0C98(BgZg* this, GlobalContext* globalCtx); +s32 func_808C0C98(BgZg* this, PlayState* play); s32 func_808C0CC8(BgZg* this); -void func_808C0CD4(BgZg* this, GlobalContext* globalCtx); -void func_808C0D08(BgZg* this, GlobalContext* globalCtx); -void func_808C0EEC(BgZg* this, GlobalContext* globalCtx); +void func_808C0CD4(BgZg* this, PlayState* play); +void func_808C0D08(BgZg* this, PlayState* play); +void func_808C0EEC(BgZg* this, PlayState* play); static BgZgActionFunc sActionFuncs[] = { func_808C0CD4, @@ -47,10 +47,10 @@ const ActorInit Bg_Zg_InitVars = { (ActorFunc)BgZg_Draw, }; -void BgZg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgZg_Destroy(Actor* thisx, PlayState* play) { BgZg* this = (BgZg*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_808C0C50(BgZg* this) { @@ -58,10 +58,10 @@ void func_808C0C50(BgZg* this) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } -s32 func_808C0C98(BgZg* this, GlobalContext* globalCtx) { +s32 func_808C0C98(BgZg* this, PlayState* play) { s32 flag = (this->dyna.actor.params >> 8) & 0xFF; - return Flags_GetSwitch(globalCtx, flag); + return Flags_GetSwitch(play, flag); } s32 func_808C0CC8(BgZg* this) { @@ -70,21 +70,21 @@ s32 func_808C0CC8(BgZg* this) { return flag; } -void func_808C0CD4(BgZg* this, GlobalContext* globalCtx) { - if (func_808C0C98(this, globalCtx) != 0) { +void func_808C0CD4(BgZg* this, PlayState* play) { + if (func_808C0C98(this, play) != 0) { this->action = 1; func_808C0C50(this); } } -void func_808C0D08(BgZg* this, GlobalContext* globalCtx) { +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); } } -void BgZg_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgZg_Update(Actor* thisx, PlayState* play) { BgZg* this = (BgZg*)thisx; s32 action = this->action; @@ -92,11 +92,11 @@ void BgZg_Update(Actor* thisx, GlobalContext* globalCtx) { // "Main Mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sActionFuncs[action](this, globalCtx); + sActionFuncs[action](this, play); } } -void BgZg_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgZg_Init(Actor* thisx, PlayState* play) { s32 pad[2]; BgZg* this = (BgZg*)thisx; CollisionHeader* colHeader; @@ -105,7 +105,7 @@ void BgZg_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, DPM_UNK); colHeader = NULL; CollisionHeader_GetVirtual(&gTowerCollapseBarsCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if ((func_808C0CC8(this) == 8) || (func_808C0CC8(this) == 9)) { this->dyna.actor.scale.x = this->dyna.actor.scale.x * 1.3f; this->dyna.actor.scale.z = this->dyna.actor.scale.z * 1.3f; @@ -114,13 +114,13 @@ void BgZg_Init(Actor* thisx, GlobalContext* globalCtx) { this->action = 0; this->drawConfig = 0; - if (func_808C0C98(this, globalCtx)) { + if (func_808C0C98(this, play)) { Actor_Kill(&this->dyna.actor); } } -void func_808C0EEC(BgZg* this, GlobalContext* globalCtx) { - GraphicsContext* localGfxCtx = globalCtx->state.gfxCtx; +void func_808C0EEC(BgZg* this, PlayState* play) { + GraphicsContext* localGfxCtx = play->state.gfxCtx; OPEN_DISPS(localGfxCtx, "../z_bg_zg.c", 311); @@ -132,7 +132,7 @@ void func_808C0EEC(BgZg* this, GlobalContext* globalCtx) { CLOSE_DISPS(localGfxCtx, "../z_bg_zg.c", 320); } -void BgZg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgZg_Draw(Actor* thisx, PlayState* play) { BgZg* this = (BgZg*)thisx; s32 drawConfig = this->drawConfig; @@ -140,6 +140,6 @@ void BgZg_Draw(Actor* thisx, GlobalContext* globalCtx) { // "Drawing mode is wrong !!!!!!!!!!!!!!!!!!!!!!!!!" osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sDrawFuncs[drawConfig](this, globalCtx); + sDrawFuncs[drawConfig](this, play); } } diff --git a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h index 63cf24ea5c..a5355defd5 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h @@ -6,8 +6,8 @@ struct BgZg; -typedef void (*BgZgActionFunc)(struct BgZg*, GlobalContext*); -typedef void (*BgZgDrawFunc)(struct BgZg*, GlobalContext*); +typedef void (*BgZgActionFunc)(struct BgZg*, PlayState*); +typedef void (*BgZgDrawFunc)(struct BgZg*, PlayState*); typedef struct BgZg { /* 0x0000 */ DynaPolyActor dyna; 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 9fceefb581..b350badaaf 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -5,33 +5,33 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BossDodongo_Init(Actor* thisx, GlobalContext* globalCtx); -void BossDodongo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx); -void BossDodongo_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossDodongo_Init(Actor* thisx, PlayState* play); +void BossDodongo_Destroy(Actor* thisx, PlayState* play); +void BossDodongo_Update(Actor* thisx, PlayState* play); +void BossDodongo_Draw(Actor* thisx, PlayState* play); -void BossDodongo_SetupIntroCutscene(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_Inhale(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_BlowFire(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_SpawnFire(BossDodongo* this, GlobalContext* globalCtx, s16 arg2); -void BossDodongo_Explode(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_LayDown(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_Vulnerable(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_GetUp(BossDodongo* this, GlobalContext* globalCtx); +void BossDodongo_SetupIntroCutscene(BossDodongo* this, PlayState* play); +void BossDodongo_IntroCutscene(BossDodongo* this, PlayState* play); +void BossDodongo_Walk(BossDodongo* this, PlayState* play); +void BossDodongo_Inhale(BossDodongo* this, PlayState* play); +void BossDodongo_BlowFire(BossDodongo* this, PlayState* play); +void BossDodongo_Roll(BossDodongo* this, PlayState* play); +void BossDodongo_SpawnFire(BossDodongo* this, PlayState* play, s16 arg2); +void BossDodongo_Explode(BossDodongo* this, PlayState* play); +void BossDodongo_LayDown(BossDodongo* this, PlayState* play); +void BossDodongo_Vulnerable(BossDodongo* this, PlayState* play); +void BossDodongo_GetUp(BossDodongo* this, PlayState* play); void BossDodongo_SetupWalk(BossDodongo* this); -void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx); +void BossDodongo_DeathCutscene(BossDodongo* this, PlayState* play); void BossDodongo_SetupDeathCutscene(BossDodongo* this); -void BossDodongo_Damaged(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_UpdateDamage(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_PlayerPosCheck(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_PlayerYawCheck(BossDodongo* this, GlobalContext* globalCtx); -f32 func_808C4F6C(BossDodongo* this, GlobalContext* globalCtx); -f32 func_808C50A8(BossDodongo* this, GlobalContext* globalCtx); -void BossDodongo_DrawEffects(GlobalContext* globalCtx); -void BossDodongo_UpdateEffects(GlobalContext* globalCtx); +void BossDodongo_Damaged(BossDodongo* this, PlayState* play); +void BossDodongo_UpdateDamage(BossDodongo* this, PlayState* play); +void BossDodongo_PlayerPosCheck(BossDodongo* this, PlayState* play); +void BossDodongo_PlayerYawCheck(BossDodongo* this, PlayState* play); +f32 func_808C4F6C(BossDodongo* this, PlayState* play); +f32 func_808C50A8(BossDodongo* this, PlayState* play); +void BossDodongo_DrawEffects(PlayState* play); +void BossDodongo_UpdateEffects(PlayState* play); const ActorInit Boss_Dodongo_InitVars = { ACTOR_EN_DODONGO, @@ -130,9 +130,9 @@ void func_808C1554(void* arg0, void* floorTex, s32 arg2, f32 arg3) { } } -void func_808C17C8(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, s16 countLimit) { +void func_808C17C8(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, s16 countLimit) { s16 i; - BossDodongoEffect* eff = (BossDodongoEffect*)globalCtx->specialEffects; + BossDodongoEffect* eff = (BossDodongoEffect*)play->specialEffects; for (i = 0; i < countLimit; i++, eff++) { if (eff->unk_24 == 0) { @@ -148,11 +148,11 @@ void func_808C17C8(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* ar } } -s32 BossDodongo_AteExplosive(BossDodongo* this, GlobalContext* globalCtx) { +s32 BossDodongo_AteExplosive(BossDodongo* this, PlayState* play) { f32 dx; f32 dy; f32 dz; - Actor* currentExplosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + Actor* currentExplosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; Actor* thisx = &this->actor; while (currentExplosive != NULL) { @@ -176,40 +176,40 @@ s32 BossDodongo_AteExplosive(BossDodongo* this, GlobalContext* globalCtx) { return false; } -void BossDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossDodongo_Init(Actor* thisx, PlayState* play) { BossDodongo* this = (BossDodongo*)thisx; s16 i; u16* temp_s1_3; u16* temp_s2; u32 temp_v0; - globalCtx->specialEffects = this->effects; + play->specialEffects = this->effects; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 9200.0f, ActorShadow_DrawCircle, 250.0f); Actor_SetScale(&this->actor, 0.01f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_kingdodongo_Skel_01B310, &object_kingdodongo_Anim_00F0D8, NULL, - NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &object_kingdodongo_Skel_01B310, &object_kingdodongo_Anim_00F0D8, NULL, NULL, + 0); Animation_PlayLoop(&this->skelAnime, &object_kingdodongo_Anim_00F0D8); this->unk_1F8 = 1.0f; - BossDodongo_SetupIntroCutscene(this, globalCtx); + BossDodongo_SetupIntroCutscene(this, play); this->health = 12; this->colorFilterMin = 995.0f; this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->colorFilterMax = 1000.0f; this->unk_224 = 2.0f; this->unk_228 = 9200.0f; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->items); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->items); - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { // KD is dead + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { // KD is dead temp_s1_3 = SEGMENTED_TO_VIRTUAL(gDodongosCavernBossLavaFloorTex); temp_s2 = SEGMENTED_TO_VIRTUAL(sLavaFloorRockTex); Actor_Kill(&this->actor); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, -890.0f, -1523.76f, - -3304.0f, 0, 0, 0, WARP_DUNGEON_CHILD); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_BREAKWALL, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, 0x6000); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, -690.0f, -1523.76f, -3304.0f, 0, 0, 0, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, + WARP_DUNGEON_CHILD); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_BREAKWALL, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, 0x6000); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, -690.0f, -1523.76f, -3304.0f, 0, 0, 0, 0); for (i = 0; i < 2048; i++) { temp_v0 = i; @@ -220,14 +220,14 @@ void BossDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; } -void BossDodongo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossDodongo_Destroy(Actor* thisx, PlayState* play) { BossDodongo* this = (BossDodongo*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyJntSph(play, &this->collider); } -void BossDodongo_SetupIntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_SetupIntroCutscene(BossDodongo* this, PlayState* play) { s16 frames = Animation_GetLastFrame(&object_kingdodongo_Anim_00F0D8); Animation_Change(&this->skelAnime, &object_kingdodongo_Anim_00F0D8, 1.0f, 0.0f, frames, ANIMMODE_LOOP, -10.0f); @@ -236,15 +236,15 @@ void BossDodongo_SetupIntroCutscene(BossDodongo* this, GlobalContext* globalCtx) this->unk_1BC = 1; } -void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_IntroCutscene(BossDodongo* this, PlayState* play) { f32 phi_f0; Camera* mainCam; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f subCamEye; Vec3f subCamAt; Vec3f subCamUp; - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); if (this->unk_196 != 0) { this->unk_196--; @@ -268,12 +268,12 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { } break; case 1: - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - Play_ClearAllSubCameras(globalCtx); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + Play_ClearAllSubCameras(play); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->csState = 2; this->unk_196 = 0x3C; this->unk_198 = 160; @@ -296,11 +296,11 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { } if (this->unk_198 == 110) { - func_8002DF54(globalCtx, &this->actor, 9); + func_8002DF54(play, &this->actor, 9); } if (this->unk_198 == 5) { - func_8002DF54(globalCtx, &this->actor, 12); + func_8002DF54(play, &this->actor, 12); } if (this->unk_198 < 6) { @@ -315,7 +315,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { this->unk_1BC = 2; } - BossDodongo_Walk(this, globalCtx); + BossDodongo_Walk(this, play); if (this->unk_196 == 1) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); @@ -354,7 +354,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { } break; case 3: - BossDodongo_Walk(this, globalCtx); + BossDodongo_Walk(this, play); Math_SmoothStepToF(&this->unk_20C, sinf(this->unk_19E * 0.05f) * 0.1f, 1.0f, 0.01f, 0.0f); Math_SmoothStepToF(&this->subCamEye.x, this->vec.x + 90.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); Math_SmoothStepToF(&this->subCamEye.y, this->vec.y + 50.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); @@ -402,7 +402,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { if (this->unk_198 == 0x5A) { if (!GET_EVENTCHKINF(EVENTCHKINF_71)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(&object_kingdodongo_Blob_017410), 0xA0, 0xB4, 0x80, 0x28); } @@ -413,10 +413,10 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); BossDodongo_SetupWalk(this); this->unk_1DA = 50; this->unk_1BC = 0; @@ -445,7 +445,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { subCamUp.y = 1.0f; subCamUp.z = this->unk_20C; - Play_CameraSetAtEyeUp(globalCtx, this->subCamId, &subCamAt, &subCamEye, &subCamUp); + Play_CameraSetAtEyeUp(play, this->subCamId, &subCamAt, &subCamEye, &subCamUp); } } @@ -507,7 +507,7 @@ void BossDodongo_SetupInhale(BossDodongo* this) { this->unk_1E2 = 1; } -void BossDodongo_Damaged(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_Damaged(BossDodongo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToF(&this->unk_1F8, 1.0f, 0.5f, 0.02f, 0.001f); Math_SmoothStepToF(&this->unk_208, 0.05f, 1.0f, 0.005f, 0.0f); @@ -517,7 +517,7 @@ void BossDodongo_Damaged(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_Explode(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_Explode(BossDodongo* this, PlayState* play) { static Color_RGBA8 dustPrimColor = { 255, 255, 0, 255 }; static Color_RGBA8 dustEnvColor = { 255, 10, 0, 255 }; s16 pad; @@ -543,7 +543,7 @@ void BossDodongo_Explode(BossDodongo* this, GlobalContext* globalCtx) { dustPos.y = this->actor.world.pos.y + 90.0f + (dustVel.y * 3.0f); dustPos.z = this->actor.world.pos.z + (dustVel.z * 3.0f); - func_8002836C(globalCtx, &dustPos, &dustVel, &dustAcell, &dustPrimColor, &dustEnvColor, 500, 10, 10); + func_8002836C(play, &dustPos, &dustVel, &dustAcell, &dustPrimColor, &dustEnvColor, 500, 10, 10); } Animation_Change(&this->skelAnime, &object_kingdodongo_Anim_004E0C, 1.0f, 0.0f, @@ -551,7 +551,7 @@ void BossDodongo_Explode(BossDodongo* this, GlobalContext* globalCtx) { this->actionFunc = BossDodongo_LayDown; Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_DAMAGE); - func_80033E88(&this->actor, globalCtx, 4, 10); + func_80033E88(&this->actor, play, 4, 10); this->health -= 2; // make sure not to die from the bomb explosion @@ -561,7 +561,7 @@ void BossDodongo_Explode(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_LayDown(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_LayDown(BossDodongo* this, PlayState* play) { this->unk_1BE = 10; Math_SmoothStepToF(&this->unk_1F8, 1.3f, 1.0f, 0.1f, 0.001f); SkelAnime_Update(&this->skelAnime); @@ -574,7 +574,7 @@ void BossDodongo_LayDown(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_Vulnerable(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_Vulnerable(BossDodongo* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_DOWN - SFX_FLAG); this->unk_1BE = 10; Math_SmoothStepToF(&this->unk_1F8, 1.0f, 0.5f, 0.02f, 0.001f); @@ -588,7 +588,7 @@ void BossDodongo_Vulnerable(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_GetUp(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_GetUp(BossDodongo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, Animation_GetLastFrame(&object_kingdodongo_Anim_009D10))) { @@ -596,7 +596,7 @@ void BossDodongo_GetUp(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_BlowFire(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_BlowFire(BossDodongo* this, PlayState* play) { s32 pad; Vec3f unusedZeroVec1 = { 0.0f, 0.0f, 0.0f }; Vec3f unusedZeroVec2 = { 0.0f, 0.0f, 0.0f }; @@ -612,7 +612,7 @@ void BossDodongo_BlowFire(BossDodongo* this, GlobalContext* globalCtx) { } if ((this->skelAnime.curFrame > 17.0f) && (this->skelAnime.curFrame < 35.0f)) { - BossDodongo_SpawnFire(this, globalCtx, this->unk_1AE); + BossDodongo_SpawnFire(this, play, this->unk_1AE); this->unk_1AE++; Math_SmoothStepToF(&this->unk_244, 0.0f, 1.0f, 8.0f, 0.0f); } @@ -622,7 +622,7 @@ void BossDodongo_BlowFire(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_Inhale(BossDodongo* this, GlobalContext* GlobalContext) { +void BossDodongo_Inhale(BossDodongo* this, PlayState* play) { this->unk_1E2 = 1; if (this->unk_1AC > 20) { @@ -637,7 +637,7 @@ void BossDodongo_Inhale(BossDodongo* this, GlobalContext* GlobalContext) { } else { this->unk_1AC++; - if ((this->unk_1AC > 20) && (this->unk_1AC < 82) && BossDodongo_AteExplosive(this, GlobalContext)) { + if ((this->unk_1AC > 20) && (this->unk_1AC < 82) && BossDodongo_AteExplosive(this, play)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_DRINK); BossDodongo_SetupExplode(this); } @@ -651,7 +651,7 @@ static Vec3f sCornerPositions[] = { { -390.0f, 0.0f, -3804.0f }, }; -void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_Walk(BossDodongo* this, PlayState* play) { Vec3f* sp4C; f32 sp48; f32 sp44; @@ -664,9 +664,9 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { } else if (this->unk_1BC != 2) { if (((s32)this->skelAnime.curFrame == 1) || ((s32)this->skelAnime.curFrame == 31)) { if ((s32)this->skelAnime.curFrame == 1) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_410, 25.0f, 10, 8.0f, 500, 10, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk_410, 25.0f, 10, 8.0f, 500, 10, false); } else { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_404, 25.0f, 10, 8.0f, 500, 10, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk_404, 25.0f, 10, 8.0f, 500, 10, false); } if (this->unk_1BC != 0) { @@ -676,7 +676,7 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { } if (this->subCamId == SUB_CAM_ID_DONE) { - func_80033E88(&this->actor, globalCtx, 4, 10); + func_80033E88(&this->actor, play, 4, 10); } else { this->unk_1B6 = 10; func_800A9F6C(0.0f, 180, 20, 100); @@ -716,7 +716,7 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { if ((this->unk_1DA == 0) && (this->unk_1BC == 0)) { if ((this->actor.xzDistToPlayer < 500.0f) && (this->unk_1A4 != 0) && !this->playerPosInRange) { BossDodongo_SetupInhale(this); - BossDodongo_SpawnFire(this, globalCtx, -1); + BossDodongo_SpawnFire(this, play, -1); } if (!this->playerPosInRange && !this->playerYawInRange) { @@ -725,7 +725,7 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_Roll(BossDodongo* this, PlayState* play) { Vec3f* sp5C; Vec3f sp50; f32 sp4C; @@ -757,12 +757,11 @@ void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG); if ((this->unk_19E & 7) == 0) { - Camera_AddQuake(&globalCtx->mainCamera, 2, 1, 8); + Camera_AddQuake(&play->mainCamera, 2, 1, 8); } if (!(this->unk_19E & 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, - false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, false); } } } @@ -787,12 +786,12 @@ void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) { this->unk_228 = 9200.0f; this->actor.velocity.y = 20.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_COLI); - Camera_AddQuake(&globalCtx->mainCamera, 2, 6, 8); + Camera_AddQuake(&play->mainCamera, 2, 6, 8); sp50.x = this->actor.world.pos.x; sp50.y = this->actor.world.pos.y + 60.0f; sp50.z = this->actor.world.pos.z; - func_80033480(globalCtx, &sp50, 250.0f, 40, 800, 10, 0); - func_80033E88(&this->actor, globalCtx, 6, 15); + func_80033480(play, &sp50, 250.0f, 40, 800, 10, 0); + func_80033E88(&this->actor, play, 6, 15); } else { this->actor.velocity.y = 15.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_COLI2); @@ -812,13 +811,13 @@ void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossDodongo_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossDodongo* this = (BossDodongo*)thisx; f32 temp_f0; s16 i; - Player* player = GET_PLAYER(globalCtx); - Player* player2 = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); + Player* player2 = GET_PLAYER(play); s32 pad; this->unk_1E2 = 0; @@ -844,7 +843,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1C8--; } - temp_f0 = func_808C4F6C(this, globalCtx); + temp_f0 = func_808C4F6C(this, play); if (temp_f0 > 0.0f) { this->unk_1A4 = temp_f0; @@ -852,7 +851,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1A4 = 0; } - temp_f0 = func_808C50A8(this, globalCtx); + temp_f0 = func_808C50A8(this, play); if (temp_f0 > 0.0f) { this->unk_1A6 = temp_f0; @@ -860,17 +859,17 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1A6 = 0; } - BossDodongo_PlayerYawCheck(this, globalCtx); - BossDodongo_PlayerPosCheck(this, globalCtx); + BossDodongo_PlayerYawCheck(this, play); + BossDodongo_PlayerPosCheck(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); thisx->shape.rot.y = thisx->world.rot.y; Math_SmoothStepToF(&thisx->shape.yOffset, this->unk_228, 1.0f, 100.0f, 0.0f); Actor_MoveForward(thisx); - BossDodongo_UpdateDamage(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 10.0f, 10.0f, 20.0f, UPDBGCHECKINFO_FLAG_2); + BossDodongo_UpdateDamage(this, play); + Actor_UpdateBgCheckInfo(play, thisx, 10.0f, 10.0f, 20.0f, UPDBGCHECKINFO_FLAG_2); Math_SmoothStepToF(&this->unk_208, 0, 1, 0.001f, 0.0); Math_SmoothStepToF(&this->unk_20C, 0, 1, 0.001f, 0.0); @@ -891,11 +890,11 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { Math_SmoothStepToF(&this->unk_240, 0.0f, 1, 10.0f, 0.0); } - if ((globalCtx->envCtx.adjLight1Color[2] == 0) && (globalCtx->envCtx.adjAmbientColor[2] == 0)) { - globalCtx->envCtx.adjLight1Color[0] = (u8)this->unk_240; - globalCtx->envCtx.adjLight1Color[1] = (u8)(this->unk_240 * 0.1f); - globalCtx->envCtx.adjAmbientColor[0] = (u8)this->unk_240; - globalCtx->envCtx.adjAmbientColor[1] = (u8)(this->unk_240 * 0.1f); + if ((play->envCtx.adjLight1Color[2] == 0) && (play->envCtx.adjAmbientColor[2] == 0)) { + play->envCtx.adjLight1Color[0] = (u8)this->unk_240; + play->envCtx.adjLight1Color[1] = (u8)(this->unk_240 * 0.1f); + play->envCtx.adjAmbientColor[0] = (u8)this->unk_240; + play->envCtx.adjAmbientColor[1] = (u8)(this->unk_240 * 0.1f); } } @@ -913,10 +912,10 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { Math_SmoothStepToF(&this->colorFilterMin, 900.0f, 1, 10.0f, 0.0); Math_SmoothStepToF(&this->colorFilterMax, 1099.0f, 1, 10.0f, 0.0); } else { - Math_SmoothStepToF(&this->colorFilterR, globalCtx->lightCtx.fogColor[0], 1, 5.0f, 0.0); - Math_SmoothStepToF(&this->colorFilterG, globalCtx->lightCtx.fogColor[1], 1.0f, 5.0f, 0.0); - Math_SmoothStepToF(&this->colorFilterB, globalCtx->lightCtx.fogColor[2], 1.0f, 5.0f, 0.0); - Math_SmoothStepToF(&this->colorFilterMin, globalCtx->lightCtx.fogNear, 1.0, 5.0f, 0.0); + Math_SmoothStepToF(&this->colorFilterR, play->lightCtx.fogColor[0], 1, 5.0f, 0.0); + Math_SmoothStepToF(&this->colorFilterG, play->lightCtx.fogColor[1], 1.0f, 5.0f, 0.0); + Math_SmoothStepToF(&this->colorFilterB, play->lightCtx.fogColor[2], 1.0f, 5.0f, 0.0); + Math_SmoothStepToF(&this->colorFilterMin, play->lightCtx.fogNear, 1.0, 5.0f, 0.0); Math_SmoothStepToF(&this->colorFilterMax, 1000.0f, 1, 5.0f, 0.0); } @@ -933,7 +932,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { } else if (this->unk_224 > 1.7f) { phi_s0_3 = 3; sp90 = 1; - if (globalCtx) {} + if (play) {} magma2DrawMode = 0; } else if (this->unk_224 > 1.4f) { phi_s0_3 = 7; @@ -966,7 +965,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { sp84.x = (sinf(temp_f10) * temp_f12) + (-890.0f); sp84.y = -1523.76f; sp84.z = (cosf(temp_f10) * temp_f12) + (-3304.0f); - EffectSsGMagma2_Spawn(globalCtx, &sp84, &magmaPrimColor[magma2DrawMode], &magmaEnvColor[magma2DrawMode], + EffectSsGMagma2_Spawn(play, &sp84, &magmaPrimColor[magma2DrawMode], &magmaEnvColor[magma2DrawMode], 10 - (magma2DrawMode * 5), magma2DrawMode, magmaScale + 100); } @@ -980,7 +979,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { sp54.x = sinf(sp4C) * sp50 + (-890.0f); sp54.y = -1523.76f; sp54.z = cosf(sp4C) * sp50 + (-3304.0f); - EffectSsGMagma_Spawn(globalCtx, &sp54); + EffectSsGMagma_Spawn(play, &sp54); for (i = 0; i < 4; i++) { sp60.y = 0.4f; sp60.x = Rand_CenteredFloat(0.5f); @@ -990,8 +989,7 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { sp54.x = sinf(sp4C) * sp50 + (-890.0f); sp54.y = -1513.76f; sp54.z = cosf(sp4C) * sp50 + (-3304.0f); - func_808C17C8(globalCtx, &sp54, &sp6C, &sp60, ((s16)Rand_ZeroFloat(2.0f)) + 6, - BOSS_DODONGO_EFFECT_COUNT); + func_808C17C8(play, &sp54, &sp6C, &sp60, ((s16)Rand_ZeroFloat(2.0f)) + 6, BOSS_DODONGO_EFFECT_COUNT); } } @@ -1014,13 +1012,13 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->unk_1BC == 0) { if (this->actionFunc != BossDodongo_DeathCutscene) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actionFunc == BossDodongo_Roll) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } @@ -1043,11 +1041,10 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { } Math_SmoothStepToF(&this->unk_244, 0.0f, 1.0f, 2.0f, 0.0f); - BossDodongo_UpdateEffects(globalCtx); + BossDodongo_UpdateEffects(play); } -s32 BossDodongo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossDodongo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { f32 mtxScaleY; f32 mtxScaleZ; BossDodongo* this = (BossDodongo*)thisx; @@ -1061,7 +1058,7 @@ block_1: Matrix_TranslateRotateZYX(pos, rot); if (*dList != NULL) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_dodongo.c", 3787); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_dodongo.c", 3787); mtxScaleZ = 1.0f; mtxScaleY = 1.0f; @@ -1083,18 +1080,18 @@ block_1: Matrix_RotateX(-(this->unk_25C[limbIndex] * 0.115f), MTXMODE_APPLY); } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_dodongo.c", 3822), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_dodongo.c", 3822), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_dodongo.c", 3826); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_dodongo.c", 3826); } { s32 pad; } // Required to match return 1; } -void BossDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossDodongo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_808CA450 = { 5000.0f, -2500.0f, 0.0f }; static Vec3f D_808CA45C = { 0.0f, 0.0f, 0.0f }; static Vec3f D_808CA468 = { 11500.0f, -3000.0f, 0.0f }; @@ -1116,12 +1113,12 @@ void BossDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi Collider_UpdateSpheres(limbIndex, &this->collider); } -void BossDodongo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossDodongo_Draw(Actor* thisx, PlayState* play) { BossDodongo* this = (BossDodongo*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_dodongo.c", 3922); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_dodongo.c", 3922); + func_80093D18(play->state.gfxCtx); if ((this->unk_1C0 >= 2) && (this->unk_1C0 & 1)) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 255, 255, 0, 900, 1099); @@ -1133,24 +1130,24 @@ void BossDodongo_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZ(this->unk_23C, MTXMODE_APPLY); Matrix_RotateX((this->unk_1C4 / 32768.0f) * 3.14159f, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, BossDodongo_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, BossDodongo_OverrideLimbDraw, BossDodongo_PostLimbDraw, this); - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_dodongo.c", 3981); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_dodongo.c", 3981); - BossDodongo_DrawEffects(globalCtx); + BossDodongo_DrawEffects(play); } -f32 func_808C4F6C(BossDodongo* this, GlobalContext* globalCtx) { +f32 func_808C4F6C(BossDodongo* this, PlayState* play) { f32 xDiff; f32 zDiff; f32 sp2C; s32 pad; f32 temp_f2; f32 rotation; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); xDiff = player->actor.world.pos.x - this->actor.world.pos.x; zDiff = player->actor.world.pos.z - this->actor.world.pos.z; @@ -1166,14 +1163,14 @@ f32 func_808C4F6C(BossDodongo* this, GlobalContext* globalCtx) { return -1.0f; } -f32 func_808C50A8(BossDodongo* this, GlobalContext* globalCtx) { +f32 func_808C50A8(BossDodongo* this, PlayState* play) { f32 xDiff; f32 zDiff; f32 sp2C; s32 pad; f32 temp_f2; f32 rotation; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); xDiff = player->actor.world.pos.x - this->actor.world.pos.x; zDiff = player->actor.world.pos.z - this->actor.world.pos.z; @@ -1190,8 +1187,8 @@ f32 func_808C50A8(BossDodongo* this, GlobalContext* globalCtx) { return -1.0f; } -void BossDodongo_PlayerYawCheck(BossDodongo* this, GlobalContext* globalCtx) { - s16 yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; +void BossDodongo_PlayerYawCheck(BossDodongo* this, PlayState* play) { + s16 yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if ((yawDiff < 0x38E3) && (-0x38E3 < yawDiff)) { this->playerYawInRange = true; @@ -1200,7 +1197,7 @@ void BossDodongo_PlayerYawCheck(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_PlayerPosCheck(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_PlayerPosCheck(BossDodongo* this, PlayState* play) { Vec3f* temp_v1; s16 i; @@ -1217,12 +1214,12 @@ void BossDodongo_PlayerPosCheck(BossDodongo* this, GlobalContext* globalCtx) { } } -void BossDodongo_SpawnFire(BossDodongo* this, GlobalContext* globalCtx, s16 params) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BDFIRE, this->vec.x, this->vec.y - 20.0f, +void BossDodongo_SpawnFire(BossDodongo* this, PlayState* play, s16 params) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BDFIRE, this->vec.x, this->vec.y - 20.0f, this->vec.z, 0, this->actor.shape.rot.y, 0, params); } -void BossDodongo_UpdateDamage(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_UpdateDamage(BossDodongo* this, PlayState* play) { s32 pad; ColliderInfo* item1; u8 swordDamage; @@ -1232,7 +1229,7 @@ void BossDodongo_UpdateDamage(BossDodongo* this, GlobalContext* globalCtx) { if ((this->health <= 0) && (this->actionFunc != BossDodongo_DeathCutscene)) { BossDodongo_SetupDeathCutscene(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); return; } @@ -1285,7 +1282,7 @@ void BossDodongo_SetupDeathCutscene(BossDodongo* this) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); } -void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { +void BossDodongo_DeathCutscene(BossDodongo* this, PlayState* play) { Vec3f* cornerPos; Vec3f sp198; Vec3f sp184; @@ -1295,19 +1292,19 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { s16 i; Vec3f effectPos; Camera* mainCam; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); switch (this->csState) { case 0: this->csState = 5; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_UNK3); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); this->subCamEye.x = mainCam->eye.x; this->subCamEye.y = mainCam->eye.y; this->subCamEye.z = mainCam->eye.z; @@ -1333,8 +1330,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &object_kingdodongo_Anim_003CF8, 1.0f, 0.0f, Animation_GetLastFrame(&object_kingdodongo_Anim_003CF8), ANIMMODE_ONCE, -1.0f); this->csState = 6; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_BREAKWALL, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, - 0x6000); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_BREAKWALL, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, 0x6000); } break; case 6: @@ -1394,10 +1390,10 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.world.pos.z, cornerPos->z + sp184.z, 1.0f, this->unk_1E4, 0.0f); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG); if ((this->unk_19E & 7) == 0) { - Camera_AddQuake(&globalCtx->mainCamera, 2, 1, 8); + Camera_AddQuake(&play->mainCamera, 2, 1, 8); } if (!(this->unk_19E & 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, false); } tempSin = cornerPos->x - this->actor.world.pos.x; @@ -1426,7 +1422,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { dustPos.x = this->actor.world.pos.x; dustPos.y = this->actor.world.pos.y + 60.0f; dustPos.z = this->actor.world.pos.z; - func_80033480(globalCtx, &dustPos, 250.0f, 0x28, 0x320, 0xA, 0); + func_80033480(play, &dustPos, 250.0f, 0x28, 0x320, 0xA, 0); } } break; @@ -1508,13 +1504,13 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { effectPos.x = Rand_CenteredFloat(120.0f) + this->actor.focus.pos.x; effectPos.y = Rand_ZeroFloat(50.0f) + this->actor.world.pos.y; effectPos.z = Rand_CenteredFloat(120.0f) + this->actor.focus.pos.z; - func_8002836C(globalCtx, &effectPos, &dustVel, &dustAcell, &dustPrimColor, &dustEnvColor, 0x1F4, - 0xA, 0xA); + func_8002836C(play, &effectPos, &dustVel, &dustAcell, &dustPrimColor, &dustEnvColor, 0x1F4, 0xA, + 0xA); effectPos.x = Rand_CenteredFloat(120.0f) + this->actor.focus.pos.x; effectPos.y = -1498.76f; effectPos.z = Rand_CenteredFloat(120.0f) + this->actor.focus.pos.z; colorIndex = (Rand_ZeroOne() * 1.9f); - EffectSsGMagma2_Spawn(globalCtx, &effectPos, &magmaPrimColor2[colorIndex], + EffectSsGMagma2_Spawn(play, &effectPos, &magmaPrimColor2[colorIndex], &magmaEnvColor2[colorIndex], 10 - (colorIndex * 5), colorIndex, (s16)(Rand_ZeroOne() * 100.0f) + 100); } @@ -1522,7 +1518,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG); if (!(this->unk_19E & 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10, false); } } @@ -1598,27 +1594,27 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { if (this->unk_1DA == 820) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, Math_SinS(this->actor.shape.rot.y) * -50.0f + this->actor.world.pos.x, this->actor.world.pos.y, Math_CosS(this->actor.shape.rot.y) * -50.0f + this->actor.world.pos.z, 0, 0, 0, 0); } if (this->unk_1DA == 600) { - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->unk_1BC = 0; this->subCamId = SUB_CAM_ID_DONE; this->csState = 100; - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, -890.0f, -1523.76f, - -3304.0f, 0, 0, 0, WARP_DUNGEON_CHILD); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, -890.0f, -1523.76f, -3304.0f, + 0, 0, 0, WARP_DUNGEON_CHILD); this->skelAnime.playSpeed = 0.0f; - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); } case 100: if ((this->unk_1DA < 0x2C6) && (Rand_ZeroOne() < 0.5f)) { @@ -1629,18 +1625,17 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { sp68.x = Rand_CenteredFloat(60.0f) + this->actor.focus.pos.x; sp68.y = (Rand_ZeroOne() * 50.0f) + -1498.76f; sp68.z = Rand_CenteredFloat(60.0f) + this->actor.focus.pos.z; - EffectSsGMagma2_Spawn(globalCtx, &sp68, &D_808CA568, &D_808CA56C, 5, 1, - (s16)(Rand_ZeroOne() * 50.0f) + 50); + EffectSsGMagma2_Spawn(play, &sp68, &D_808CA568, &D_808CA56C, 5, 1, (s16)(Rand_ZeroOne() * 50.0f) + 50); } break; } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } -void BossDodongo_UpdateEffects(GlobalContext* globalCtx) { - BossDodongoEffect* eff = (BossDodongoEffect*)globalCtx->specialEffects; +void BossDodongo_UpdateEffects(PlayState* play) { + BossDodongoEffect* eff = (BossDodongoEffect*)play->specialEffects; Color_RGB8 effectColors[] = { { 255, 128, 0 }, { 255, 0, 0 }, { 255, 255, 0 }, { 255, 0, 0 } }; s16 colorIndex; s16 i; @@ -1669,19 +1664,19 @@ void BossDodongo_UpdateEffects(GlobalContext* globalCtx) { } } -void BossDodongo_DrawEffects(GlobalContext* globalCtx) { +void BossDodongo_DrawEffects(PlayState* play) { MtxF* unkMtx; s16 i; u8 materialFlag = 0; BossDodongoEffect* eff; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; - eff = (BossDodongoEffect*)globalCtx->specialEffects; + eff = (BossDodongoEffect*)play->specialEffects; OPEN_DISPS(gfxCtx, "../z_boss_dodongo.c", 5228); - func_80093D84(globalCtx->state.gfxCtx); - unkMtx = &globalCtx->billboardMtxF; + func_80093D84(play->state.gfxCtx); + unkMtx = &play->billboardMtxF; for (i = 0; i < BOSS_DODONGO_EFFECT_COUNT; i++, eff++) { if (eff->unk_24 == 1) { diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h index c2d68d738e..13ccf61d8f 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h @@ -6,7 +6,7 @@ struct BossDodongo; -typedef void (*BossDodongoActionFunc)(struct BossDodongo*, GlobalContext*); +typedef void (*BossDodongoActionFunc)(struct BossDodongo*, PlayState*); #define BOSS_DODONGO_EFFECT_COUNT 80 diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 526ee8ae60..be18f1894b 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -33,16 +33,16 @@ typedef enum { /* 2 */ EYE_CLOSED } BossFdEyeState; -void BossFd_Init(Actor* thisx, GlobalContext* globalCtx); -void BossFd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossFd_Update(Actor* thisx, GlobalContext* globalCtx); -void BossFd_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossFd_Init(Actor* thisx, PlayState* play); +void BossFd_Destroy(Actor* thisx, PlayState* play); +void BossFd_Update(Actor* thisx, PlayState* play); +void BossFd_Draw(Actor* thisx, PlayState* play); -void BossFd_SetupFly(BossFd* this, GlobalContext* globalCtx); -void BossFd_Fly(BossFd* this, GlobalContext* globalCtx); -void BossFd_Wait(BossFd* this, GlobalContext* globalCtx); -void BossFd_UpdateEffects(BossFd* this, GlobalContext* globalCtx); -void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this); +void BossFd_SetupFly(BossFd* this, PlayState* play); +void BossFd_Fly(BossFd* this, PlayState* play); +void BossFd_Wait(BossFd* this, PlayState* play); +void BossFd_UpdateEffects(BossFd* this, PlayState* play); +void BossFd_DrawBody(PlayState* play, BossFd* this); const ActorInit Boss_Fd_InitVars = { ACTOR_BOSS_FD, @@ -149,7 +149,7 @@ void BossFd_SetCameraSpeed(BossFd* this, f32 velFactor) { this->subCamAtVel.z = fabsf(this->subCamAt.z - this->subCamAtNext.z) * velFactor; } -void BossFd_UpdateCamera(BossFd* this, GlobalContext* globalCtx) { +void BossFd_UpdateCamera(BossFd* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { Math_ApproachF(&this->subCamEye.x, this->subCamEyeNext.x, this->subCamEyeMaxVelFrac.x, this->subCamEyeVel.x * this->subCamVelFactor); @@ -165,27 +165,24 @@ void BossFd_UpdateCamera(BossFd* this, GlobalContext* globalCtx) { this->subCamAtVel.z * this->subCamVelFactor); Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, this->subCamAccel); this->subCamAt.y += this->subCamAtYOffset; - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); Math_ApproachZeroF(&this->subCamAtYOffset, 1.0f, 0.1f); } } -void BossFd_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossFd_Init(Actor* thisx, PlayState* play) { s32 pad; BossFd* this = (BossFd*)thisx; s16 i; - Flags_SetSwitch(globalCtx, 0x14); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BG_VB_SIMA, 680.0f, -100.0f, 0.0f, 0, 0, 0, - 100); + Flags_SetSwitch(play, 0x14); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BG_VB_SIMA, 680.0f, -100.0f, 0.0f, 0, 0, 0, 100); Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); Actor_SetScale(&this->actor, 0.05f); - SkelAnime_Init(globalCtx, &this->skelAnimeHead, &gVolvagiaHeadSkel, &gVolvagiaHeadEmergeAnim, NULL, NULL, 0); - SkelAnime_Init(globalCtx, &this->skelAnimeRightArm, &gVolvagiaRightArmSkel, &gVolvagiaRightArmEmergeAnim, NULL, - NULL, 0); - SkelAnime_Init(globalCtx, &this->skelAnimeLeftArm, &gVolvagiaLeftArmSkel, &gVolvagiaLeftArmEmergeAnim, NULL, NULL, - 0); + SkelAnime_Init(play, &this->skelAnimeHead, &gVolvagiaHeadSkel, &gVolvagiaHeadEmergeAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnimeRightArm, &gVolvagiaRightArmSkel, &gVolvagiaRightArmEmergeAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnimeLeftArm, &gVolvagiaLeftArmSkel, &gVolvagiaLeftArmEmergeAnim, NULL, NULL, 0); this->introState = BFD_CS_WAIT; if (this->introState == BFD_CS_NONE) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_FIRE_BOSS); @@ -193,8 +190,8 @@ void BossFd_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.x = this->actor.world.pos.z = 0.0f; this->actor.world.pos.y = -200.0f; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->elements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->elements); for (i = 0; i < 100; i++) { this->bodySegsPos[i].x = this->actor.world.pos.x; @@ -212,35 +209,35 @@ void BossFd_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->introState == BFD_CS_NONE) { this->actionFunc = BossFd_Wait; } else { - BossFd_SetupFly(this, globalCtx); + BossFd_SetupFly(this, play); } - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, 100.0f, 0.0f, 0, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, 100.0f, 0.0f, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 0.0f, 100.0f, 200.0f, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, 100.0f, 200.0f, 0, 0, 0, 0); } else { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_FD2, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_FD2, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, this->introState); } } -void BossFd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossFd_Destroy(Actor* thisx, PlayState* play) { s32 pad; BossFd* this = (BossFd*)thisx; - SkelAnime_Free(&this->skelAnimeHead, globalCtx); - SkelAnime_Free(&this->skelAnimeRightArm, globalCtx); - SkelAnime_Free(&this->skelAnimeLeftArm, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnimeHead, play); + SkelAnime_Free(&this->skelAnimeRightArm, play); + SkelAnime_Free(&this->skelAnimeLeftArm, play); + Collider_DestroyJntSph(play, &this->collider); } s32 BossFd_IsFacingLink(BossFd* this) { return ABS((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y)) < 0x2000; } -void BossFd_SetupFly(BossFd* this, GlobalContext* globalCtx) { +void BossFd_SetupFly(BossFd* this, PlayState* play) { Animation_PlayOnce(&this->skelAnimeHead, &gVolvagiaHeadEmergeAnim); Animation_PlayOnce(&this->skelAnimeRightArm, &gVolvagiaRightArmEmergeAnim); Animation_PlayOnce(&this->skelAnimeLeftArm, &gVolvagiaLeftArmEmergeAnim); @@ -259,7 +256,7 @@ static Vec3f sCeilingTargets[] = { { 0.0f, 900.0f, 243.0f }, { -243.0f, 900.0f, 100.0f }, { -243.0, 900.0f, -100.0f }, }; -void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { +void BossFd_Fly(BossFd* this, PlayState* play) { u8 sp1CF = false; u8 temp_rand; s16 i1; @@ -268,7 +265,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { f32 dx; f32 dy; f32 dz; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 angleToTarget; f32 pitchToTarget; Vec3f* holePosition1; @@ -299,8 +296,8 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { // Boss Intro Cutscene if (this->introState != BFD_CS_NONE) { - Player* player2 = GET_PLAYER(globalCtx); - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Player* player2 = GET_PLAYER(play); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); switch (this->introState) { case BFD_CS_WAIT: @@ -314,11 +311,11 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { (fabsf(player2->actor.world.pos.x - 340.0f) < 60.0f)) { this->introState = BFD_CS_START; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); player2->actor.world.pos.x = 380.0f; player2->actor.world.pos.y = 100.0f; player2->actor.world.pos.z = 0.0f; @@ -392,7 +389,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamShake, 2.0f, 1.0f, 0.8 * 0.01f); } if (this->timers[0] == 40) { - func_8002DF54(globalCtx, &this->actor, 0x13); + func_8002DF54(play, &this->actor, 0x13); } if (this->timers[0] == 0) { this->introState = BFD_CS_LOOK_GROUND; @@ -421,7 +418,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { this->timers[0] = 170; this->subCamVelFactor = 0.0f; this->subCamAccel = 0.0f; - func_8002DF54(globalCtx, &this->actor, 0x14); + func_8002DF54(play, &this->actor, 0x14); } break; case BFD_CS_COLLAPSE: @@ -472,7 +469,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { if (this->timers[3] == 190) { this->subCamAtMaxVelFrac.x = this->subCamAtMaxVelFrac.y = this->subCamAtMaxVelFrac.z = 0.05f; this->platformSignal = VBSIMA_KILL; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); } if (this->actor.world.pos.y > 120.0f) { this->subCamAtNext = this->actor.world.pos; @@ -493,7 +490,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_FIRE_BOSS); } if ((this->timers[3] == 130) && !GET_EVENTCHKINF(EVENTCHKINF_73)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gVolvagiaBossTitleCardTex), 0xA0, 0xB4, 0x80, 0x28); } if (this->timers[3] <= 100) { @@ -537,18 +534,18 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); // BFD_CS_NONE / BOSSFD_FLY_MAIN / SUB_CAM_ID_DONE this->introState = this->introFlyState = this->subCamId = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->actionFunc = BossFd_Wait; this->handoffSignal = FD2_SIGNAL_GROUND; SET_EVENTCHKINF(EVENTCHKINF_73); } break; } - BossFd_UpdateCamera(this, globalCtx); + BossFd_UpdateCamera(this, play); } else { this->fwork[BFD_FLY_SPEED] = 5.0f; } @@ -632,7 +629,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { this->holePosition.x = this->targetPosition.x; this->holePosition.z = this->targetPosition.z; - func_80033E1C(globalCtx, 1, 0x50, 0x5000); + func_80033E1C(play, 1, 0x50, 0x5000); if (this->introState != BFD_CS_NONE) { this->timers[0] = 50; } else { @@ -668,7 +665,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { this->work[BFD_CEILING_TARGET] = 0; } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_1); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_1); if (this->timers[1] == 0) { osSyncPrintf("BGCHECKKKKKKKKKKKKKKKKKKKKKKK\n"); if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { @@ -677,7 +674,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_EV_EXPLOSION, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_80033E1C(globalCtx, 3, 0xA, 0x7530); + func_80033E1C(play, 3, 0xA, 0x7530); this->work[BFD_ROCK_TIMER] = 300; } } else { @@ -769,7 +766,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { s16 sp150; if (this->fogMode == 0) { - globalCtx->envCtx.lightBlend = 0; + play->envCtx.lightBlend = 0; } this->fogMode = 0xA; @@ -789,7 +786,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { sp164.y = 0.03f; - EffectSsKFire_Spawn(globalCtx, &sp188, &sp17C, &sp164, (s16)Rand_ZeroFloat(20.0f) + 40, 0x64); + EffectSsKFire_Spawn(play, &sp188, &sp17C, &sp164, (s16)Rand_ZeroFloat(20.0f) + 40, 0x64); for (i2 = 0; i2 < 15; i2++) { sp170.x = Rand_CenteredFloat(20.0f); @@ -852,7 +849,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_EN_VALVAISA_LAND2, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_8002DF54(globalCtx, &this->actor, 5); + func_8002DF54(play, &this->actor, 5); for (i1 = 0; i1 < 15; i1++) { Vec3f sp144 = { 0.0f, 0.0f, 0.0f }; Vec3f sp138 = { 0.0f, 0.0f, 0.0f }; @@ -901,7 +898,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { sp108.y = 0.03f; - EffectSsKFire_Spawn(globalCtx, &sp120, &sp114, &sp108, (s16)Rand_ZeroFloat(15.0f) + 30, 0); + EffectSsKFire_Spawn(play, &sp120, &sp114, &sp108, (s16)Rand_ZeroFloat(15.0f) + 30, 0); } if (this->timers[0] < 20) { Math_ApproachZeroF(&this->actor.scale.x, 1.0f, 0.0025f); @@ -912,8 +909,8 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { this->actor.world.pos.y -= 1000.0f; } if (this->timers[0] == 7) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 0); } break; case BOSSFD_WAIT_INTRO: @@ -984,14 +981,14 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { if (this->work[BFD_ACTION_STATE] < BOSSFD_SKULL_FALL) { if ((this->actor.prevPos.y < 90.0f) && (90.0f <= this->actor.world.pos.y)) { this->timers[4] = 80; - func_80033E1C(globalCtx, 1, 80, 0x5000); + func_80033E1C(play, 1, 80, 0x5000); this->work[BFD_ROAR_TIMER] = 40; this->work[BFD_MANE_EMBERS_TIMER] = 30; this->work[BFD_SPLASH_TIMER] = 10; } if ((this->actor.prevPos.y > 90.0f) && (90.0f >= this->actor.world.pos.y)) { this->timers[4] = 80; - func_80033E1C(globalCtx, 1, 80, 0x5000); + func_80033E1C(play, 1, 80, 0x5000); this->work[BFD_MANE_EMBERS_TIMER] = 30; this->work[BFD_SPLASH_TIMER] = 10; } @@ -1030,12 +1027,12 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { } } -void BossFd_Wait(BossFd* this, GlobalContext* globalCtx) { +void BossFd_Wait(BossFd* this, PlayState* play) { if (this->handoffSignal == FD2_SIGNAL_FLY) { // Set by BossFd2 u8 temp_rand; this->handoffSignal = FD2_SIGNAL_NONE; - BossFd_SetupFly(this, globalCtx); + BossFd_SetupFly(this, play); do { temp_rand = Rand_ZeroFloat(8.9f); } while (temp_rand == this->holeIndex); @@ -1052,7 +1049,7 @@ void BossFd_Wait(BossFd* this, GlobalContext* globalCtx) { } if (this->handoffSignal == FD2_SIGNAL_DEATH) { this->handoffSignal = FD2_SIGNAL_NONE; - BossFd_SetupFly(this, globalCtx); + BossFd_SetupFly(this, play); this->holeIndex = 1; this->targetPosition.x = sHoleLocations[1].x; this->targetPosition.y = sHoleLocations[1].y - 200.0f; @@ -1065,7 +1062,7 @@ void BossFd_Wait(BossFd* this, GlobalContext* globalCtx) { static Vec3f sFireAudioVec = { 0.0f, 0.0f, 50.0f }; -void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { +void BossFd_Effects(BossFd* this, PlayState* play) { static Color_RGBA8 colorYellow = { 255, 255, 0, 255 }; static Color_RGBA8 colorRed = { 255, 10, 0, 255 }; s16 breathOpacity = 0; @@ -1081,36 +1078,36 @@ void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { if (1) {} // Needed for match if (this->fogMode == 0) { - globalCtx->envCtx.lightSettingOverride = 0; - globalCtx->envCtx.lightBlend = 0.5f + 0.5f * Math_SinS(this->work[BFD_VAR_TIMER] * 0x500); - globalCtx->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; - globalCtx->envCtx.lightSetting = 1; - globalCtx->envCtx.prevLightSetting = 0; + play->envCtx.lightSettingOverride = 0; + play->envCtx.lightBlend = 0.5f + 0.5f * Math_SinS(this->work[BFD_VAR_TIMER] * 0x500); + play->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; + play->envCtx.lightSetting = 1; + play->envCtx.prevLightSetting = 0; } else if (this->fogMode == 3) { - globalCtx->envCtx.lightSettingOverride = 0; - globalCtx->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; - globalCtx->envCtx.lightSetting = 2; - globalCtx->envCtx.prevLightSetting = 0; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.05f); + play->envCtx.lightSettingOverride = 0; + play->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; + play->envCtx.lightSetting = 2; + play->envCtx.prevLightSetting = 0; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.05f); } else if (this->fogMode == 2) { this->fogMode--; - globalCtx->envCtx.lightSettingOverride = 0; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 0.55f + 0.05f * Math_SinS(this->work[BFD_VAR_TIMER] * 0x3E00), - 1.0f, 0.15f); - globalCtx->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; - globalCtx->envCtx.lightSetting = 3; - globalCtx->envCtx.prevLightSetting = 0; + play->envCtx.lightSettingOverride = 0; + Math_ApproachF(&play->envCtx.lightBlend, 0.55f + 0.05f * Math_SinS(this->work[BFD_VAR_TIMER] * 0x3E00), 1.0f, + 0.15f); + play->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; + play->envCtx.lightSetting = 3; + play->envCtx.prevLightSetting = 0; } else if (this->fogMode == 10) { this->fogMode = 1; - globalCtx->envCtx.lightSettingOverride = 0; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 0.21f + 0.07f * Math_SinS(this->work[BFD_VAR_TIMER] * 0xC00), - 1.0f, 0.05f); - globalCtx->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; - globalCtx->envCtx.lightSetting = 3; - globalCtx->envCtx.prevLightSetting = 0; + play->envCtx.lightSettingOverride = 0; + Math_ApproachF(&play->envCtx.lightBlend, 0.21f + 0.07f * Math_SinS(this->work[BFD_VAR_TIMER] * 0xC00), 1.0f, + 0.05f); + play->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; + play->envCtx.lightSetting = 3; + play->envCtx.prevLightSetting = 0; } else if (this->fogMode == 1) { - Math_ApproachF(&globalCtx->envCtx.lightBlend, 0.0f, 1.0f, 0.03f); - if (globalCtx->envCtx.lightBlend <= 0.01f) { + Math_ApproachF(&play->envCtx.lightBlend, 0.0f, 1.0f, 0.03f); + if (play->envCtx.lightBlend <= 0.01f) { this->fogMode = 0; } } @@ -1164,7 +1161,7 @@ void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.health == 0) || ((this->introState == BFD_CS_EMERGE) && (this->actor.world.rot.x > 0x3000))) { if ((u8)this->fogMode == 0) { - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; } this->fogMode = 2; } @@ -1182,7 +1179,7 @@ void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { spawnPos1.y = 100.0f; spawnPos1.z = temp_z + this->holePosition.z; - func_8002836C(globalCtx, &spawnPos1, &spawnVel1, &spawnAccel1, &colorYellow, &colorRed, + func_8002836C(play, &spawnPos1, &spawnVel1, &spawnAccel1, &colorYellow, &colorRed, (s16)Rand_ZeroFloat(150.0f) + 800, 10, (s16)Rand_ZeroFloat(5.0f) + 17); } } else { @@ -1200,7 +1197,7 @@ void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { spawnPos1.y = 100.0f; spawnPos1.z = temp_z + this->holePosition.z; - func_8002836C(globalCtx, &spawnPos1, &spawnVel1, &spawnAccel1, &colorYellow, &colorRed, 500, 10, 20); + func_8002836C(play, &spawnPos1, &spawnVel1, &spawnAccel1, &colorYellow, &colorRed, 500, 10, 20); } } @@ -1282,7 +1279,7 @@ void BossFd_Effects(BossFd* this, GlobalContext* globalCtx) { } } -void BossFd_CollisionCheck(BossFd* this, GlobalContext* globalCtx) { +void BossFd_CollisionCheck(BossFd* this, PlayState* play) { ColliderJntSphElement* headCollider = &this->collider.elements[0]; ColliderInfo* hurtbox; @@ -1303,7 +1300,7 @@ void BossFd_CollisionCheck(BossFd* this, GlobalContext* globalCtx) { } } -void BossFd_Update(Actor* thisx, GlobalContext* globalCtx) { +void BossFd_Update(Actor* thisx, PlayState* play) { s32 pad; BossFd* this = (BossFd*)thisx; f32 headGlow; @@ -1314,7 +1311,7 @@ void BossFd_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("FD MOVE START \n"); this->work[BFD_VAR_TIMER]++; this->work[BFD_MOVE_TIMER]++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->timers); i++) { if (this->timers[i] != 0) { @@ -1332,13 +1329,13 @@ void BossFd_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->work[BFD_ACTION_STATE] < BOSSFD_DEATH_START) { if (this->work[BFD_INVINC_TIMER] == 0) { - BossFd_CollisionCheck(this, globalCtx); + BossFd_CollisionCheck(this, play); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - BossFd_Effects(this, globalCtx); + BossFd_Effects(this, play); this->fwork[BFD_TEX1_SCROLL_X] += 4.0f; this->fwork[BFD_TEX1_SCROLL_Y] = 120.0f; this->fwork[BFD_TEX2_SCROLL_X] += 3.0f; @@ -1364,7 +1361,7 @@ void BossFd_Update(Actor* thisx, GlobalContext* globalCtx) { this->work[BFD_ROCK_TIMER]--; if ((this->work[BFD_ROCK_TIMER] % 16) == 0) { EnVbBall* bossFdRock = (EnVbBall*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_VB_BALL, this->actor.world.pos.x, 1000.0f, + &play->actorCtx, &this->actor, play, ACTOR_EN_VB_BALL, this->actor.world.pos.x, 1000.0f, this->actor.world.pos.z, 0, 0, (s16)Rand_ZeroFloat(50.0f) + 130, 100); if (bossFdRock != NULL) { @@ -1427,13 +1424,13 @@ void BossFd_Update(Actor* thisx, GlobalContext* globalCtx) { } } osSyncPrintf("FD MOVE END 1\n"); - BossFd_UpdateEffects(this, globalCtx); + BossFd_UpdateEffects(this, play); osSyncPrintf("FD MOVE END 2\n"); } -void BossFd_UpdateEffects(BossFd* this, GlobalContext* globalCtx) { +void BossFd_UpdateEffects(BossFd* this, PlayState* play) { BossFdEffect* effect = this->effects; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Color_RGB8 colors[4] = { { 255, 128, 0 }, { 255, 0, 0 }, { 255, 255, 0 }, { 255, 0, 0 } }; Vec3f diff; s16 i1; @@ -1480,7 +1477,7 @@ void BossFd_UpdateEffects(BossFd* this, GlobalContext* globalCtx) { diff.z = player->actor.world.pos.z - effect->pos.z; if ((this->timers[3] == 0) && (sqrtf(SQ(diff.x) + SQ(diff.y) + SQ(diff.z)) < 20.0f)) { this->timers[3] = 50; - func_8002F6D4(globalCtx, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30); + func_8002F6D4(play, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30); if (player->isBurning == false) { for (i2 = 0; i2 < PLAYER_BODYPART_MAX; i2++) { player->flameTimers[i2] = Rand_S16Offset(0, 200); @@ -1514,12 +1511,12 @@ void BossFd_UpdateEffects(BossFd* this, GlobalContext* globalCtx) { } } -void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { +void BossFd_DrawEffects(BossFdEffect* effect, PlayState* play) { static void* dustTex[] = { gDust1Tex, gDust1Tex, gDust2Tex, gDust3Tex, gDust4Tex, gDust5Tex, gDust6Tex, gDust7Tex, gDust8Tex, }; u8 materialFlag = 0; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; BossFdEffect* firstEffect = effect; @@ -1528,14 +1525,14 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { for (i = 0; i < BOSSFD_EFFECT_COUNT; i++, effect++) { if (effect->type == BFD_FX_EMBER) { if (materialFlag == 0) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gVolvagiaEmberMaterialDL); materialFlag++; } gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, effect->color.r, effect->color.g, effect->color.b, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_fd.c", 4046), @@ -1549,7 +1546,7 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { for (i = 0; i < BOSSFD_EFFECT_COUNT; i++, effect++) { if (effect->type == BFD_FX_DEBRIS) { if (materialFlag == 0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gVolvagiaDebrisMaterialDL); materialFlag++; } @@ -1579,7 +1576,7 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_fd.c", 4104), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1602,7 +1599,7 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_fd.c", 4154), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1616,7 +1613,7 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { for (i = 0; i < BOSSFD_EFFECT_COUNT; i++, effect++) { if (effect->type == BFD_FX_SKULL_PIECE) { if (materialFlag == 0) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gVolvagiaSkullPieceMaterialDL); materialFlag++; } @@ -1635,30 +1632,29 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_boss_fd.c", 4198); } -void BossFd_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossFd_Draw(Actor* thisx, PlayState* play) { s32 pad; BossFd* this = (BossFd*)thisx; osSyncPrintf("FD DRAW START\n"); if (this->actionFunc != BossFd_Wait) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd.c", 4217); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_fd.c", 4217); + func_80093D18(play->state.gfxCtx); if (this->work[BFD_DAMAGE_FLASH_TIMER] & 2) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 255, 255, 0, 900, 1099); } - BossFd_DrawBody(globalCtx, this); - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd.c", 4243); + BossFd_DrawBody(play, this); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_fd.c", 4243); } osSyncPrintf("FD DRAW END\n"); - BossFd_DrawEffects(this->effects, globalCtx); + BossFd_DrawEffects(this->effects, play); osSyncPrintf("FD DRAW END2\n"); } -s32 BossFd_OverrideRightArmDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossFd_OverrideRightArmDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossFd* this = (BossFd*)thisx; switch (limbIndex) { @@ -1680,8 +1676,7 @@ s32 BossFd_OverrideRightArmDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -s32 BossFd_OverrideLeftArmDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossFd_OverrideLeftArmDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossFd* this = (BossFd*)thisx; switch (limbIndex) { @@ -1706,7 +1701,7 @@ s32 BossFd_OverrideLeftArmDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL static s16 sBodyIndex[] = { 0, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5 }; static s16 sManeIndex[] = { 0, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10 }; // Unused -void BossFd_DrawMane(GlobalContext* globalCtx, BossFd* this, Vec3f* manePos, Vec3f* maneRot, f32* maneScale, u8 mode) { +void BossFd_DrawMane(PlayState* play, BossFd* this, Vec3f* manePos, Vec3f* maneRot, f32* maneScale, u8 mode) { f32 sp140[] = { 0.0f, 10.0f, 17.0f, 20.0f, 19.5f, 18.0f, 17.0f, 15.0f, 15.0f, 15.0f }; f32 sp118[] = { 0.0f, 10.0f, 17.0f, 20.0f, 21.0f, 21.0f, 21.0f, 21.0f, 21.0f, 21.0f }; f32 spF0[] = { 0.4636457f, 0.3366129f, 0.14879614f, 0.04995025f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; @@ -1722,7 +1717,7 @@ void BossFd_DrawMane(GlobalContext* globalCtx, BossFd* this, Vec3f* manePos, Vec f32 phi_f20; f32 phi_f22; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd.c", 4419); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_fd.c", 4419); maneLength = this->skinSegments; maneLength = CLAMP_MAX(maneLength, 10); @@ -1763,15 +1758,15 @@ void BossFd_DrawMane(GlobalContext* globalCtx, BossFd* this, Vec3f* manePos, Vec Matrix_Scale(maneScale[maneIndex] * (0.01f - (i * 0.0008f)), maneScale[maneIndex] * (0.01f - (i * 0.0008f)), 0.01f, MTXMODE_APPLY); Matrix_RotateX(-M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_fd.c", 4480), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_fd.c", 4480), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gVolvagiaManeModelDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd.c", 4483); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_fd.c", 4483); } -s32 BossFd_OverrideHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 BossFd_OverrideHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossFd* this = (BossFd*)thisx; switch (limbIndex) { @@ -1798,7 +1793,7 @@ s32 BossFd_OverrideHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void BossFd_PostHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossFd_PostHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f targetMod = { 4500.0f, 0.0f, 0.0f }; static Vec3f headMod = { 4000.0f, 0.0f, 0.0f }; BossFd* this = (BossFd*)thisx; @@ -1822,18 +1817,18 @@ static Gfx* sBodyDLists[] = { gVolvagiaBodySeg16DL, gVolvagiaBodySeg17DL, gVolvagiaBodySeg18DL, }; -void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { +void BossFd_DrawBody(PlayState* play, BossFd* this) { s16 segIndex; s16 i; f32 temp_float; - Mtx* tempMat = Graph_Alloc(globalCtx->state.gfxCtx, 18 * sizeof(Mtx)); + Mtx* tempMat = Graph_Alloc(play->state.gfxCtx, 18 * sizeof(Mtx)); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd.c", 4589); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_fd.c", 4589); if (this->skinSegments != 0) { gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeState])); } gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->fwork[BFD_TEX1_SCROLL_X], + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->fwork[BFD_TEX1_SCROLL_X], (s16)this->fwork[BFD_TEX1_SCROLL_Y], 0x20, 0x20, 1, (s16)this->fwork[BFD_TEX2_SCROLL_X], (s16)this->fwork[BFD_TEX2_SCROLL_Y], 0x20, 0x20)); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); @@ -1848,7 +1843,7 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { Matrix_RotateX(-this->bodySegsRot[segIndex].x, MTXMODE_APPLY); Matrix_Translate(-13.0f, -5.0f, 13.0f, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x * 0.1f, this->actor.scale.y * 0.1f, this->actor.scale.z * 0.1f, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnimeRightArm.skeleton, this->skelAnimeRightArm.jointTable, + SkelAnime_DrawOpa(play, this->skelAnimeRightArm.skeleton, this->skelAnimeRightArm.jointTable, BossFd_OverrideRightArmDraw, NULL, this); Matrix_Pop(); osSyncPrintf("RH\n"); @@ -1860,7 +1855,7 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { Matrix_RotateX(-this->bodySegsRot[segIndex].x, MTXMODE_APPLY); Matrix_Translate(13.0f, -5.0f, 13.0f, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x * 0.1f, this->actor.scale.y * 0.1f, this->actor.scale.z * 0.1f, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnimeLeftArm.skeleton, this->skelAnimeLeftArm.jointTable, + SkelAnime_DrawOpa(play, this->skelAnimeLeftArm.skeleton, this->skelAnimeLeftArm.jointTable, BossFd_OverrideLeftArmDraw, NULL, this); Matrix_Pop(); osSyncPrintf("BD\n"); @@ -1906,7 +1901,7 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { temp_float = 0.1f * sp84; } Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_fd.c", 4768), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_fd.c", 4768), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gVolvagiaRibsDL); @@ -1917,9 +1912,8 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { Matrix_MultVec3f(&spF0, &spE4); Matrix_Get(&spFC); Matrix_MtxFToYXZRotS(&spFC, &spDC, 0); - bones = - (EnVbBall*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_VB_BALL, - spE4.x, spE4.y, spE4.z, spDC.x, spDC.y, spDC.z, i + 200); + bones = (EnVbBall*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_VB_BALL, spE4.x, + spE4.y, spE4.z, spDC.x, spDC.y, spDC.z, i + 200); bones->actor.scale.x = this->actor.scale.x * temp_float; bones->actor.scale.y = this->actor.scale.y * spD4; @@ -1953,34 +1947,34 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { Matrix_Pop(); osSyncPrintf("BHCE\n"); Matrix_Scale(this->actor.scale.x * 0.1f, this->actor.scale.y * 0.1f, this->actor.scale.z * 0.1f, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnimeHead.skeleton, this->skelAnimeHead.jointTable, BossFd_OverrideHeadDraw, + SkelAnime_DrawOpa(play, this->skelAnimeHead.skeleton, this->skelAnimeHead.jointTable, BossFd_OverrideHeadDraw, BossFd_PostHeadDraw, &this->actor); osSyncPrintf("SK\n"); { Vec3f spB0 = { 0.0f, 1700.0f, 7000.0f }; Vec3f spA4 = { -1000.0f, 700.0f, 7000.0f }; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gVolvagiaManeMaterialDL); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, this->fwork[BFD_MANE_COLOR_CENTER], 0, 255); Matrix_Push(); Matrix_MultVec3f(&spB0, &this->centerMane.head); - BossFd_DrawMane(globalCtx, this, this->centerMane.pos, this->fireManeRot, this->centerMane.scale, MANE_CENTER); + BossFd_DrawMane(play, this, this->centerMane.pos, this->fireManeRot, this->centerMane.scale, MANE_CENTER); Matrix_Pop(); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, this->fwork[BFD_MANE_COLOR_RIGHT], 0, 255); Matrix_Push(); Matrix_MultVec3f(&spA4, &this->rightMane.head); - BossFd_DrawMane(globalCtx, this, this->rightMane.pos, this->fireManeRot, this->rightMane.scale, MANE_RIGHT); + BossFd_DrawMane(play, this, this->rightMane.pos, this->fireManeRot, this->rightMane.scale, MANE_RIGHT); Matrix_Pop(); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, this->fwork[BFD_MANE_COLOR_LEFT], 0, 255); Matrix_Push(); spA4.x *= -1.0f; Matrix_MultVec3f(&spA4, &this->leftMane.head); - BossFd_DrawMane(globalCtx, this, this->leftMane.pos, this->fireManeRot, this->leftMane.scale, MANE_LEFT); + BossFd_DrawMane(play, this, this->leftMane.pos, this->fireManeRot, this->leftMane.scale, MANE_LEFT); Matrix_Pop(); } Matrix_Pop(); osSyncPrintf("END\n"); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd.c", 4987); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_fd.c", 4987); } diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h index 8f1a16b79a..d855c6c93b 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h @@ -6,7 +6,7 @@ struct BossFd; -typedef void (*BossFdActionFunc)(struct BossFd*, GlobalContext*); +typedef void (*BossFdActionFunc)(struct BossFd*, PlayState*); typedef enum { /* -1 */ BOSSFD_WAIT_INTRO = -1, diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 224e89fc3c..9fe91c411c 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -27,24 +27,24 @@ typedef enum { /* 2 */ EYE_CLOSED } BossFd2EyeState; -void BossFd2_Init(Actor* thisx, GlobalContext* globalCtx); -void BossFd2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossFd2_Update(Actor* thisx, GlobalContext* globalCtx); -void BossFd2_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossFd2_Init(Actor* thisx, PlayState* play); +void BossFd2_Destroy(Actor* thisx, PlayState* play); +void BossFd2_Update(Actor* thisx, PlayState* play); +void BossFd2_Draw(Actor* thisx, PlayState* play); -void BossFd2_SetupEmerge(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Emerge(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_SetupIdle(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Idle(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Burrow(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_SetupBreatheFire(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_BreatheFire(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_SetupClawSwipe(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_ClawSwipe(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Vulnerable(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Damaged(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx); -void BossFd2_Wait(BossFd2* this, GlobalContext* globalCtx); +void BossFd2_SetupEmerge(BossFd2* this, PlayState* play); +void BossFd2_Emerge(BossFd2* this, PlayState* play); +void BossFd2_SetupIdle(BossFd2* this, PlayState* play); +void BossFd2_Idle(BossFd2* this, PlayState* play); +void BossFd2_Burrow(BossFd2* this, PlayState* play); +void BossFd2_SetupBreatheFire(BossFd2* this, PlayState* play); +void BossFd2_BreatheFire(BossFd2* this, PlayState* play); +void BossFd2_SetupClawSwipe(BossFd2* this, PlayState* play); +void BossFd2_ClawSwipe(BossFd2* this, PlayState* play); +void BossFd2_Vulnerable(BossFd2* this, PlayState* play); +void BossFd2_Damaged(BossFd2* this, PlayState* play); +void BossFd2_Death(BossFd2* this, PlayState* play); +void BossFd2_Wait(BossFd2* this, PlayState* play); const ActorInit Boss_Fd2_InitVars = { ACTOR_BOSS_FD2, @@ -73,8 +73,8 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void BossFd2_SpawnDebris(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, - Vec3f* acceleration, f32 scale) { +void BossFd2_SpawnDebris(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, + f32 scale) { s16 i; for (i = 0; i < 180; i++, effect++) { @@ -91,7 +91,7 @@ void BossFd2_SpawnDebris(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* } } -void BossFd2_SpawnFireBreath(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, +void BossFd2_SpawnFireBreath(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, s16 alpha, s16 kbAngle) { s16 i; @@ -116,8 +116,8 @@ void BossFd2_SpawnFireBreath(GlobalContext* globalCtx, BossFdEffect* effect, Vec } } -void BossFd2_SpawnEmber(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, - Vec3f* acceleration, f32 scale) { +void BossFd2_SpawnEmber(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, + f32 scale) { s16 i; for (i = 0; i < 180; i++, effect++) { @@ -134,7 +134,7 @@ void BossFd2_SpawnEmber(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* p } } -void BossFd2_SpawnSkullPiece(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, +void BossFd2_SpawnSkullPiece(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale) { s16 i; @@ -168,7 +168,7 @@ void BossFd2_SpawnDust(BossFdEffect* effect, Vec3f* position, Vec3f* velocity, V } } -void BossFd2_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossFd2_Init(Actor* thisx, PlayState* play) { s32 pad; BossFd2* this = (BossFd2*)thisx; @@ -176,25 +176,25 @@ void BossFd2_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.0069999993f); this->actor.world.pos.y = -850.0f; ActorShape_Init(&this->actor.shape, -580.0f / this->actor.scale.y, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gHoleVolvagiaSkel, &gHoleVolvagiaIdleAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gHoleVolvagiaSkel, &gHoleVolvagiaIdleAnim, NULL, NULL, 0); if (this->actor.params == BFD_CS_NONE) { - BossFd2_SetupEmerge(this, globalCtx); + BossFd2_SetupEmerge(this, play); } else { this->actionFunc = BossFd2_Wait; } - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->elements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->elements); } -void BossFd2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossFd2_Destroy(Actor* thisx, PlayState* play) { s32 pad; BossFd2* this = (BossFd2*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyJntSph(play, &this->collider); } -void BossFd2_SetupEmerge(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupEmerge(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; s16 temp_rand; s8 health; @@ -223,10 +223,10 @@ void BossFd2_SetupEmerge(BossFd2* this, GlobalContext* globalCtx) { } } -void BossFd2_Emerge(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Emerge(BossFd2* this, PlayState* play) { s8 health; BossFd* bossFd = (BossFd*)this->actor.parent; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 i; s16 holeTime; @@ -243,7 +243,7 @@ void BossFd2_Emerge(BossFd2* this, GlobalContext* globalCtx) { bossFd->faceExposed = 0; bossFd->holePosition.x = this->actor.world.pos.x; bossFd->holePosition.z = this->actor.world.pos.z; - func_80033E1C(globalCtx, 1, 0x32, 0x5000); + func_80033E1C(play, 1, 0x32, 0x5000); this->work[FD2_ACTION_STATE] = 1; this->work[FD2_HOLE_COUNTER]++; this->actor.world.pos.y = -200.0f; @@ -294,18 +294,18 @@ void BossFd2_Emerge(BossFd2* this, GlobalContext* globalCtx) { case 2: Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x7D0); if ((this->timers[0] == 1) && (this->actor.xzDistToPlayer < 120.0f)) { - func_8002F6D4(globalCtx, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 2.0f, 0x20); + func_8002F6D4(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 2.0f, 0x20); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } if (Animation_OnFrame(&this->skelAnime, this->fwork[FD2_END_FRAME])) { - BossFd2_SetupIdle(this, globalCtx); + BossFd2_SetupIdle(this, play); } break; } osSyncPrintf("UP 2\n"); } -void BossFd2_SetupIdle(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupIdle(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; s8 health; s16 idleTime; @@ -328,7 +328,7 @@ void BossFd2_SetupIdle(BossFd2* this, GlobalContext* globalCtx) { this->timers[0] = idleTime; } -void BossFd2_Idle(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Idle(BossFd2* this, PlayState* play) { s16 prevToLink; SkelAnime_Update(&this->skelAnime); @@ -345,14 +345,14 @@ void BossFd2_Idle(BossFd2* this, GlobalContext* globalCtx) { } if (this->timers[0] == 0) { if (this->actor.xzDistToPlayer < 200.0f) { - BossFd2_SetupClawSwipe(this, globalCtx); + BossFd2_SetupClawSwipe(this, play); } else { - BossFd2_SetupBreatheFire(this, globalCtx); + BossFd2_SetupBreatheFire(this, play); } } } -void BossFd2_SetupBurrow(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupBurrow(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; Animation_MorphToPlayOnce(&this->skelAnime, &gHoleVolvagiaBurrowAnim, -5.0f); @@ -362,7 +362,7 @@ void BossFd2_SetupBurrow(BossFd2* this, GlobalContext* globalCtx) { this->work[FD2_ACTION_STATE] = 0; } -void BossFd2_Burrow(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Burrow(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; if (this->work[FD2_ACTION_STATE] == 0) { @@ -379,13 +379,13 @@ void BossFd2_Burrow(BossFd2* this, GlobalContext* globalCtx) { this->actionFunc = BossFd2_Wait; bossFd->handoffSignal = FD2_SIGNAL_FLY; } else { - BossFd2_SetupEmerge(this, globalCtx); + BossFd2_SetupEmerge(this, play); } } } } -void BossFd2_SetupBreatheFire(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupBreatheFire(BossFd2* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gHoleVolvagiaBreatheFireAnim, -5.0f); this->actionFunc = BossFd2_BreatheFire; this->fwork[FD2_END_FRAME] = Animation_GetLastFrame(&gHoleVolvagiaBreatheFireAnim); @@ -394,24 +394,24 @@ void BossFd2_SetupBreatheFire(BossFd2* this, GlobalContext* globalCtx) { static Vec3f sUnkVec = { 0.0f, 0.0f, 50.0f }; // Unused? BossFd uses a similar array for its fire breath sfx. -void BossFd2_BreatheFire(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_BreatheFire(BossFd2* this, PlayState* play) { s16 i; Vec3f toLink; s16 angleX; s16 angleY; s16 breathOpacity = 0; BossFd* bossFd = (BossFd*)this->actor.parent; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 tempX; f32 tempY; SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, this->fwork[FD2_END_FRAME])) { - BossFd2_SetupBurrow(this, globalCtx); + BossFd2_SetupBurrow(this, play); } if ((25.0f <= this->skelAnime.curFrame) && (this->skelAnime.curFrame < 70.0f)) { if (this->skelAnime.curFrame == 25.0f) { - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; } Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_FIRE - SFX_FLAG); if (this->skelAnime.curFrame > 50) { @@ -462,16 +462,16 @@ void BossFd2_BreatheFire(BossFd2* this, GlobalContext* globalCtx) { Matrix_MultVec3f(&spawnSpeed, &spawnVel); breathScale = 300.0f + 50.0f * Math_SinS(this->work[FD2_VAR_TIMER] * 0x2000); - BossFd2_SpawnFireBreath(globalCtx, bossFd->effects, &spawnPos, &spawnVel, &spawnAccel, breathScale, - breathOpacity, this->actor.shape.rot.y + this->headRot.y); + BossFd2_SpawnFireBreath(play, bossFd->effects, &spawnPos, &spawnVel, &spawnAccel, breathScale, breathOpacity, + this->actor.shape.rot.y + this->headRot.y); spawnPos.x += spawnVel.x * 0.5f; spawnPos.y += spawnVel.y * 0.5f; spawnPos.z += spawnVel.z * 0.5f; breathScale = 300.0f + 50.0f * Math_SinS(this->work[FD2_VAR_TIMER] * 0x2000); - BossFd2_SpawnFireBreath(globalCtx, bossFd->effects, &spawnPos, &spawnVel, &spawnAccel, breathScale, - breathOpacity, this->actor.shape.rot.y + this->headRot.y); + BossFd2_SpawnFireBreath(play, bossFd->effects, &spawnPos, &spawnVel, &spawnAccel, breathScale, breathOpacity, + this->actor.shape.rot.y + this->headRot.y); spawnSpeed.x = 0.0f; spawnSpeed.y = 17.0f; @@ -488,37 +488,37 @@ void BossFd2_BreatheFire(BossFd2* this, GlobalContext* globalCtx) { spawnAccel.y = (spawnVel.y * -10.0f) / 100.0f; spawnAccel.z = (spawnVel.z * -10.0f) / 100.0f; - BossFd2_SpawnEmber(globalCtx, bossFd->effects, &this->headPos, &spawnVel, &spawnAccel, + BossFd2_SpawnEmber(play, bossFd->effects, &this->headPos, &spawnVel, &spawnAccel, (s16)Rand_ZeroFloat(2.0f) + 8); } } } -void BossFd2_SetupClawSwipe(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupClawSwipe(BossFd2* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gHoleVolvagiaClawSwipeAnim, -5.0f); this->actionFunc = BossFd2_ClawSwipe; this->fwork[FD2_END_FRAME] = Animation_GetLastFrame(&gHoleVolvagiaClawSwipeAnim); } -void BossFd2_ClawSwipe(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_ClawSwipe(BossFd2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 5.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_ROAR); Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_SW_NAIL); } if (Animation_OnFrame(&this->skelAnime, this->fwork[FD2_END_FRAME])) { - BossFd2_SetupBurrow(this, globalCtx); + BossFd2_SetupBurrow(this, play); } } -void BossFd2_SetupVulnerable(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupVulnerable(BossFd2* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gHoleVolvagiaKnockoutAnim); this->fwork[FD2_END_FRAME] = Animation_GetLastFrame(&gHoleVolvagiaKnockoutAnim); this->actionFunc = BossFd2_Vulnerable; this->work[FD2_ACTION_STATE] = 0; } -void BossFd2_Vulnerable(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Vulnerable(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; s16 i; @@ -562,20 +562,20 @@ void BossFd2_Vulnerable(BossFd2* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_KNOCKOUT); } if (this->timers[0] == 0) { - BossFd2_SetupBurrow(this, globalCtx); + BossFd2_SetupBurrow(this, play); } break; } } -void BossFd2_SetupDamaged(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupDamaged(BossFd2* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gHoleVolvagiaHitAnim); this->fwork[FD2_END_FRAME] = Animation_GetLastFrame(&gHoleVolvagiaHitAnim); this->actionFunc = BossFd2_Damaged; this->work[FD2_ACTION_STATE] = 0; } -void BossFd2_Damaged(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Damaged(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; SkelAnime_Update(&this->skelAnime); @@ -606,7 +606,7 @@ void BossFd2_Damaged(BossFd2* this, GlobalContext* globalCtx) { } } -void BossFd2_SetupDeath(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_SetupDeath(BossFd2* this, PlayState* play) { this->fwork[FD2_END_FRAME] = Animation_GetLastFrame(&gHoleVolvagiaDamagedAnim); Animation_Change(&this->skelAnime, &gHoleVolvagiaDamagedAnim, 1.0f, 0.0f, this->fwork[FD2_END_FRAME], ANIMMODE_ONCE_INTERP, -3.0f); @@ -615,7 +615,7 @@ void BossFd2_SetupDeath(BossFd2* this, GlobalContext* globalCtx) { this->deathState = DEATH_START; } -void BossFd2_UpdateCamera(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_UpdateCamera(BossFd2* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { Math_ApproachF(&this->subCamEye.x, this->subCamEyeNext.x, this->subCamEyeMaxVelFrac.x, this->subCamEyeVel.x * this->subCamVelFactor); @@ -631,17 +631,17 @@ void BossFd2_UpdateCamera(BossFd2* this, GlobalContext* globalCtx) { this->subCamAtVel.z * this->subCamVelFactor); Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, this->subCamAccel); this->subCamAt.y += this->subCamAtYOffset; - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); Math_ApproachF(&this->subCamAtYOffset, 0.0f, 1.0f, 0.1f); } } -void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Death(BossFd2* this, PlayState* play) { f32 retreatSpeed; Vec3f sp70; Vec3f sp64; BossFd* bossFd = (BossFd*)this->actor.parent; - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); f32 pad3; f32 pad2; f32 pad1; @@ -652,11 +652,11 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { switch (this->deathState) { case DEATH_START: this->deathState = DEATH_RETREAT; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->subCamEye = mainCam->eye; this->subCamAt = mainCam->at; this->subCamEyeVel.x = 100.0f; @@ -746,7 +746,7 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { this->work[FD2_ACTION_STATE]++; this->subCamVelFactor = 0.0f; this->subCamAccel = 0.02f; - func_8002DF54(globalCtx, &bossFd->actor, 1); + func_8002DF54(play, &bossFd->actor, 1); } } if ((bossFd->work[BFD_ACTION_STATE] == BOSSFD_BONES_FALL) && (bossFd->timers[0] == 5)) { @@ -777,39 +777,39 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, 100.0f, 0.0f, - 0, 0, 0, WARP_DUNGEON_ADULT); - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, 100.0f, 0.0f, 0, 0, 0, + WARP_DUNGEON_ADULT); + Flags_SetClear(play, play->roomCtx.curRoom.num); } break; case DEATH_FINISH: break; } - BossFd2_UpdateCamera(this, globalCtx); + BossFd2_UpdateCamera(this, play); } -void BossFd2_Wait(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_Wait(BossFd2* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; if (bossFd->handoffSignal == FD2_SIGNAL_GROUND) { bossFd->handoffSignal = FD2_SIGNAL_NONE; - BossFd2_SetupEmerge(this, globalCtx); + BossFd2_SetupEmerge(this, play); this->timers[0] = 20; this->work[FD2_HOLE_COUNTER] = 0; } } -void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_CollisionCheck(BossFd2* this, PlayState* play) { s16 i; ColliderInfo* hurtbox; BossFd* bossFd = (BossFd*)this->actor.parent; if (this->actionFunc == BossFd2_ClawSwipe) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); for (i = 0; i < ARRAY_COUNT(this->elements); i++) { if (this->collider.elements[i].info.toucherFlags & TOUCH_HIT) { @@ -837,7 +837,7 @@ void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { bossFd->actor.colChkInfo.health = 1; } bossFd->faceExposed = true; - BossFd2_SetupVulnerable(this, globalCtx); + BossFd2_SetupVulnerable(this, play); this->work[FD2_INVINC_TIMER] = 30; this->work[FD2_DAMAGE_FLASH_TIMER] = 5; Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_MAHI1); @@ -854,7 +854,7 @@ void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { debrisPos.y = this->actor.focus.pos.y; debrisPos.z = this->actor.focus.pos.z; - BossFd2_SpawnDebris(globalCtx, bossFd->effects, &debrisPos, &debrisVel, &debrisAccel, + BossFd2_SpawnDebris(play, bossFd->effects, &debrisPos, &debrisVel, &debrisAccel, (s16)Rand_ZeroFloat(10.0) + 10); } } @@ -880,14 +880,14 @@ void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { if ((s8)bossFd->actor.colChkInfo.health <= 0) { bossFd->actor.colChkInfo.health = 0; - BossFd2_SetupDeath(this, globalCtx); + BossFd2_SetupDeath(this, play); this->work[FD2_DAMAGE_FLASH_TIMER] = 10; this->work[FD2_INVINC_TIMER] = 30000; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else if (damage) { - BossFd2_SetupDamaged(this, globalCtx); + BossFd2_SetupDamaged(this, play); this->work[FD2_DAMAGE_FLASH_TIMER] = 10; this->work[FD2_INVINC_TIMER] = 100; Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_DAMAGE1); @@ -906,7 +906,7 @@ void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { piecePos.y = this->actor.focus.pos.y; piecePos.z = this->actor.focus.pos.z; - BossFd2_SpawnSkullPiece(globalCtx, bossFd->effects, &piecePos, &pieceVel, &pieceAccel, + BossFd2_SpawnSkullPiece(play, bossFd->effects, &piecePos, &pieceVel, &pieceAccel, (s16)Rand_ZeroFloat(6.0f) + 10); } } @@ -914,7 +914,7 @@ void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { } } -void BossFd2_UpdateFace(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_UpdateFace(BossFd2* this, PlayState* play) { f32 maxOpen; f32 openRate; s16 eyeStates[5] = { EYE_OPEN, EYE_HALF, EYE_CLOSED, EYE_CLOSED, EYE_HALF }; @@ -950,8 +950,8 @@ void BossFd2_UpdateFace(BossFd2* this, GlobalContext* globalCtx) { } } -void BossFd2_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossFd2_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossFd2* this = (BossFd2*)thisx; s16 i; @@ -961,7 +961,7 @@ void BossFd2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->work[FD2_VAR_TIMER]++; this->work[FD2_UNK_TIMER]++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->timers); i++) { if (this->timers[i] != 0) { @@ -977,16 +977,16 @@ void BossFd2_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->deathState == DEATH_START) { if (this->work[FD2_INVINC_TIMER] == 0) { - BossFd2_CollisionCheck(this, globalCtx); + BossFd2_CollisionCheck(this, play); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (!this->disableAT) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } - BossFd2_UpdateFace(this, globalCtx); + BossFd2_UpdateFace(this, play); this->fwork[FD2_TEX1_SCROLL_X] += 4.0f; this->fwork[FD2_TEX1_SCROLL_Y] = 120.0f; this->fwork[FD2_TEX2_SCROLL_X] += 3.0f; @@ -998,8 +998,7 @@ void BossFd2_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 BossFd2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossFd2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossFd2* this = (BossFd2*)thisx; BossFd* bossFd = (BossFd*)this->actor.parent; @@ -1021,15 +1020,15 @@ s32 BossFd2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } if ((limbIndex == 32) || (limbIndex == 35) || (limbIndex == 36)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd2.c", 2165); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_fd2.c", 2165); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, (s8)bossFd->fwork[BFD_HEAD_TEX2_ALPHA]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd2.c", 2172); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_fd2.c", 2172); } else { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd2.c", 2174); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_fd2.c", 2174); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, (s8)bossFd->fwork[BFD_BODY_TEX2_ALPHA]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd2.c", 2181); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_fd2.c", 2181); } if ((0 < limbIndex) && (limbIndex < 16)) { *dList = NULL; @@ -1037,7 +1036,7 @@ s32 BossFd2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void BossFd2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossFd2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f targetMod = { 4500.0f, 0.0f, 0.0f }; static Vec3f headMod = { 4000.0f, 0.0f, 0.0f }; static Vec3f centerManeMod = { 4000.0f, -2900.0, 2000.0f }; @@ -1055,8 +1054,7 @@ void BossFd2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Collider_UpdateSpheres(limbIndex, &this->collider); } -void BossFd2_UpdateMane(BossFd2* this, GlobalContext* globalCtx, Vec3f* head, Vec3f* pos, Vec3f* rot, Vec3f* pull, - f32* scale) { +void BossFd2_UpdateMane(BossFd2* this, PlayState* play, Vec3f* head, Vec3f* pos, Vec3f* rot, Vec3f* pull, f32* scale) { f32 sp138[10] = { 0.0f, 100.0f, 50.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; f32 sp110[10] = { 0.0f, 5.0f, -10.0f, 500.0f, 500.0f, 500.0f, 500.0f, 500.0f, 500.0f, 500.0f }; f32 spE8[10] = { 0.4f, 0.6f, 0.8f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; @@ -1070,7 +1068,7 @@ void BossFd2_UpdateMane(BossFd2* this, GlobalContext* globalCtx, Vec3f* head, Ve Vec3f spB0; f32 xyScale; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd2.c", 2389); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_fd2.c", 2389); Matrix_Push(); gDPPipeSync(POLY_OPA_DISP++); @@ -1146,20 +1144,20 @@ void BossFd2_UpdateMane(BossFd2* this, GlobalContext* globalCtx, Vec3f* head, Ve xyScale = (0.01f - (i * 0.0009f)) * spE8[i] * scale[i]; Matrix_Scale(xyScale, xyScale, 0.01f * spE8[i], MTXMODE_APPLY); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_fd2.c", 2498), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_fd2.c", 2498), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gHoleVolvagiaManeModelDL); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd2.c", 2503); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_fd2.c", 2503); } -void BossFd2_DrawMane(BossFd2* this, GlobalContext* globalCtx) { +void BossFd2_DrawMane(BossFd2* this, PlayState* play) { s32 pad; BossFd* bossFd = (BossFd*)this->actor.parent; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd2.c", 2515); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_fd2.c", 2515); if (1) {} for (i = 0; i < 10; i++) { this->centerMane.scale[i] = 1.5f + 0.3f * Math_SinS(5596.0f * this->work[FD2_VAR_TIMER] + i * 0x3200); @@ -1167,51 +1165,51 @@ void BossFd2_DrawMane(BossFd2* this, GlobalContext* globalCtx) { this->leftMane.scale[i] = 1.5f + 0.3f * Math_CosS(5696.0f * this->work[FD2_VAR_TIMER] + i * 0x3200); } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gHoleVolvagiaManeMaterialDL); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, bossFd->fwork[BFD_MANE_COLOR_CENTER], 0, 255); - BossFd2_UpdateMane(this, globalCtx, &this->centerMane.head, this->centerMane.pos, this->centerMane.rot, + BossFd2_UpdateMane(this, play, &this->centerMane.head, this->centerMane.pos, this->centerMane.rot, this->centerMane.pull, this->centerMane.scale); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, bossFd->fwork[BFD_MANE_COLOR_RIGHT], 0, 255); - BossFd2_UpdateMane(this, globalCtx, &this->rightMane.head, this->rightMane.pos, this->rightMane.rot, + BossFd2_UpdateMane(this, play, &this->rightMane.head, this->rightMane.pos, this->rightMane.rot, this->rightMane.pull, this->rightMane.scale); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, bossFd->fwork[BFD_MANE_COLOR_LEFT], 0, 255); - BossFd2_UpdateMane(this, globalCtx, &this->leftMane.head, this->leftMane.pos, this->leftMane.rot, - this->leftMane.pull, this->leftMane.scale); + BossFd2_UpdateMane(this, play, &this->leftMane.head, this->leftMane.pos, this->leftMane.rot, this->leftMane.pull, + this->leftMane.scale); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd2.c", 2601); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_fd2.c", 2601); } -void BossFd2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossFd2_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gHoleVolvagiaEyeOpenTex, gHoleVolvagiaEyeHalfTex, gHoleVolvagiaEyeClosedTex }; s32 pad; BossFd2* this = (BossFd2*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd2.c", 2617); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_fd2.c", 2617); osSyncPrintf("FD2 draw start \n"); if (this->actionFunc != BossFd2_Wait) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->work[FD2_DAMAGE_FLASH_TIMER] & 2) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 255, 255, 0, 900, 1099); } gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeState])); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->fwork[FD2_TEX1_SCROLL_X], + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->fwork[FD2_TEX1_SCROLL_X], (s16)this->fwork[FD2_TEX1_SCROLL_Y], 0x20, 0x20, 1, (s16)this->fwork[FD2_TEX2_SCROLL_X], (s16)this->fwork[FD2_TEX2_SCROLL_Y], 0x20, 0x20)); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 128); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, BossFd2_OverrideLimbDraw, BossFd2_PostLimbDraw, &this->actor); - BossFd2_DrawMane(this, globalCtx); - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + BossFd2_OverrideLimbDraw, BossFd2_PostLimbDraw, &this->actor); + BossFd2_DrawMane(this, play); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_fd2.c", 2688); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_fd2.c", 2688); } diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h index 0fe2d445e3..f7d4b795fc 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h @@ -6,7 +6,7 @@ struct BossFd2; -typedef void (*BossFd2ActionFunc)(struct BossFd2*, GlobalContext*); +typedef void (*BossFd2ActionFunc)(struct BossFd2*, PlayState*); typedef enum { /* 0 */ FD2_SIGNAL_NONE, 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 388512b686..3bb392125f 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -11,39 +11,39 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx); -void BossGanon_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx); -void BossGanon_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx); // update -void func_808E2544(Actor* thisx, GlobalContext* globalCtx); // update -void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx); -void func_808E229C(Actor* thisx, GlobalContext* globalCtx); // draw -void func_808E324C(Actor* thisx, GlobalContext* globalCtx); // draw -void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossGanon_Init(Actor* thisx, PlayState* play); +void BossGanon_Destroy(Actor* thisx, PlayState* play); +void BossGanon_Update(Actor* thisx, PlayState* play); +void BossGanon_Draw(Actor* thisx, PlayState* play); +void func_808E1EB4(Actor* thisx, PlayState* play); // update +void func_808E2544(Actor* thisx, PlayState* play); // update +void BossGanon_LightBall_Update(Actor* thisx, PlayState* play); +void func_808E229C(Actor* thisx, PlayState* play); // draw +void func_808E324C(Actor* thisx, PlayState* play); // draw +void BossGanon_LightBall_Draw(Actor* thisx, PlayState* play); -void BossGanon_SetupIntroCutscene(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_SetupTowerCutscene(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_Wait(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_ChargeLightBall(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_PlayTennis(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_Block(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_HitByLightBall(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_Damaged(BossGanon* this, GlobalContext* globalCtx); +void BossGanon_SetupIntroCutscene(BossGanon* this, PlayState* play); +void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play); +void BossGanon_IntroCutscene(BossGanon* this, PlayState* play); +void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play); +void BossGanon_Wait(BossGanon* this, PlayState* play); +void BossGanon_ChargeLightBall(BossGanon* this, PlayState* play); +void BossGanon_PlayTennis(BossGanon* this, PlayState* play); +void BossGanon_PoundFloor(BossGanon* this, PlayState* play); +void BossGanon_ChargeBigMagic(BossGanon* this, PlayState* play); +void BossGanon_Block(BossGanon* this, PlayState* play); +void BossGanon_HitByLightBall(BossGanon* this, PlayState* play); +void BossGanon_Vulnerable(BossGanon* this, PlayState* play); +void BossGanon_Damaged(BossGanon* this, PlayState* play); -void BossGanon_SetupWait(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_SetupChargeLightBall(BossGanon* this, GlobalContext* globalCtx); -void BossGanon_SetupPlayTennis(BossGanon* this, GlobalContext* globalCtx); +void BossGanon_SetupWait(BossGanon* this, PlayState* play); +void BossGanon_SetupChargeLightBall(BossGanon* this, PlayState* play); +void BossGanon_SetupPlayTennis(BossGanon* this, PlayState* play); -void BossGanon_DrawEffects(GlobalContext* globalCtx); -void BossGanon_UpdateEffects(GlobalContext* globalCtx); +void BossGanon_DrawEffects(PlayState* play); +void BossGanon_UpdateEffects(PlayState* play); -s32 BossGanon_CheckFallingPlatforms(BossGanon* this, GlobalContext* globalCtx, Vec3f* checkPos); +s32 BossGanon_CheckFallingPlatforms(BossGanon* this, PlayState* play, Vec3f* checkPos); const ActorInit Boss_Ganon_InitVars = { ACTOR_BOSS_GANON, @@ -132,10 +132,10 @@ typedef struct { GanondorfEffect sEffects[BOSSGANON_EFFECT_COUNT]; -void BossGanonEff_SpawnWindowShard(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, f32 scale) { +void BossGanonEff_SpawnWindowShard(PlayState* play, Vec3f* pos, Vec3f* velocity, f32 scale) { static Color_RGB8 shardColors[] = { { 255, 175, 85 }, { 155, 205, 155 }, { 155, 125, 55 } }; s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; Color_RGB8* color; for (i = 0; i < 200; i++, eff++) { @@ -158,10 +158,9 @@ void BossGanonEff_SpawnWindowShard(GlobalContext* globalCtx, Vec3f* pos, Vec3f* } } -void BossGanonEff_SpawnSparkle(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, - s16 arg6) { +void BossGanonEff_SpawnSparkle(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 arg6) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -178,10 +177,10 @@ void BossGanonEff_SpawnSparkle(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velo } } -void BossGanonEff_SpawnLightRay(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, - f32 arg5, s16 arg6) { +void BossGanonEff_SpawnLightRay(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, f32 arg5, + s16 arg6) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -202,9 +201,9 @@ void BossGanonEff_SpawnLightRay(GlobalContext* globalCtx, Vec3f* pos, Vec3f* vel } } -void BossGanonEff_SpawnShock(GlobalContext* globalCtx, f32 scale, s16 shockType) { +void BossGanonEff_SpawnShock(PlayState* play, f32 scale, s16 shockType) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 75; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -221,9 +220,9 @@ void BossGanonEff_SpawnShock(GlobalContext* globalCtx, f32 scale, s16 shockType) } } -void BossGanonEff_SpawnLightning(GlobalContext* globalCtx, f32 scale, f32 arg2, f32 arg3) { +void BossGanonEff_SpawnLightning(PlayState* play, f32 scale, f32 arg2, f32 arg3) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -240,9 +239,9 @@ void BossGanonEff_SpawnLightning(GlobalContext* globalCtx, f32 scale, f32 arg2, } } -void BossGanonEff_SpawnDustDark(GlobalContext* globalCtx, Vec3f* pos, f32 scale, f32 arg3) { +void BossGanonEff_SpawnDustDark(PlayState* play, Vec3f* pos, f32 scale, f32 arg3) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -260,8 +259,8 @@ void BossGanonEff_SpawnDustDark(GlobalContext* globalCtx, Vec3f* pos, f32 scale, } } -void BossGanonEff_SpawnDustLight(GlobalContext* globalCtx, Vec3f* pos, f32 scale, f32 arg3, s16 bufIndex) { - GanondorfEffect* effArr = globalCtx->specialEffects; +void BossGanonEff_SpawnDustLight(PlayState* play, Vec3f* pos, f32 scale, f32 arg3, s16 bufIndex) { + GanondorfEffect* effArr = play->specialEffects; effArr[bufIndex].type = GDF_EFF_IMPACT_DUST_LIGHT; effArr[bufIndex].pos = *pos; @@ -274,9 +273,9 @@ void BossGanonEff_SpawnDustLight(GlobalContext* globalCtx, Vec3f* pos, f32 scale effArr[bufIndex].unk_2E = effArr[bufIndex].timer = effArr[bufIndex].alpha = 0; } -void BossGanonEff_SpawnShockwave(GlobalContext* globalCtx, Vec3f* pos, f32 scale, f32 arg3) { +void BossGanonEff_SpawnShockwave(PlayState* play, Vec3f* pos, f32 scale, f32 arg3) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -295,9 +294,9 @@ void BossGanonEff_SpawnShockwave(GlobalContext* globalCtx, Vec3f* pos, f32 scale } } -void BossGanonEff_SpawnBlackDot(GlobalContext* globalCtx, Vec3f* pos, f32 scale) { +void BossGanonEff_SpawnBlackDot(PlayState* play, Vec3f* pos, f32 scale) { s16 i; - GanondorfEffect* eff = globalCtx->specialEffects; + GanondorfEffect* eff = play->specialEffects; for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { @@ -321,9 +320,9 @@ void BossGanon_SetColliderPos(Vec3f* pos, ColliderCylinder* collider) { collider->dim.pos.z = pos->z; } -void BossGanon_SetAnimationObject(BossGanon* this, GlobalContext* globalCtx, s32 objectId) { - this->animBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectId); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animBankIndex].segment); +void BossGanon_SetAnimationObject(BossGanon* this, PlayState* play, s32 objectId) { + this->animBankIndex = Object_GetIndex(&play->objectCtx, objectId); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); } static InitChainEntry sInitChain[] = { @@ -333,19 +332,19 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx2) { +void BossGanon_Init(Actor* thisx, PlayState* play2) { s16 i; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; BossGanon* this = (BossGanon*)thisx; s32 cond; f32 xDistFromPlayer; f32 yDistFromPlayer; f32 zDistFromPlayer; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (thisx->params < 0x64) { - Flags_SetSwitch(globalCtx, 0x14); - globalCtx->specialEffects = sEffects; + Flags_SetSwitch(play, 0x14); + play->specialEffects = sEffects; for (i = 0; i < BOSSGANON_EFFECT_COUNT; i++) { sEffects[i].type = GDF_EFF_NONE; @@ -356,31 +355,31 @@ void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0, NULL, 0); Actor_SetScale(thisx, 0.01f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDorfSkel, NULL, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sDorfCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gDorfSkel, NULL, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sDorfCylinderInit); if (thisx->params != 1) { - BossGanon_SetupIntroCutscene(this, globalCtx); + BossGanon_SetupIntroCutscene(this, play); this->organAlpha = 255; } else { - cond = Flags_GetSwitch(globalCtx, 0x37) && - ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)); + cond = Flags_GetSwitch(play, 0x37) && + ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)); if (!cond) { - BossGanon_SetupTowerCutscene(this, globalCtx); + BossGanon_SetupTowerCutscene(this, play); } else { Actor_Kill(thisx); return; } - BossGanon_SetupTowerCutscene(this, globalCtx); + BossGanon_SetupTowerCutscene(this, play); } - sCape = (EnGanonMant*)Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_GANON_MANT, 0.0f, - 0.0f, 0.0f, 0, 0, 0, 1); - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BOSS); + sCape = (EnGanonMant*)Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_GANON_MANT, 0.0f, 0.0f, 0.0f, 0, + 0, 0, 1); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_BOSS); } else { thisx->flags &= ~ACTOR_FLAG_0; this->fwork[GDF_FWORK_1] = 255.0f; @@ -406,8 +405,8 @@ void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx2) { } this->timers[1] = 3; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sLightBallCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sLightBallCylinderInit); } else if (thisx->params >= 0xFA) { // big magic light ball charge thisx->update = func_808E2544; @@ -454,38 +453,38 @@ void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx2) { } this->timers[1] = 3; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sLightBallCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sLightBallCylinderInit); } } } -void BossGanon_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon_Destroy(Actor* thisx, PlayState* play) { BossGanon* this = (BossGanon*)thisx; if ((this->actor.params < 0xC8) || (this->actor.params >= 0x104)) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } if (this->actor.params < 0x64) { - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } } -void BossGanon_SetupIntroCutscene(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupIntroCutscene(BossGanon* this, PlayState* play) { s32 pad; - s32 animBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON_ANIME2); + s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2); if (animBankIndex < 0) { Actor_Kill(&this->actor); return; } - if (Object_IsLoaded(&globalCtx->objectCtx, animBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, animBankIndex)) { this->actionFunc = BossGanon_IntroCutscene; this->unk_198 = 1; this->animBankIndex = animBankIndex; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment); Animation_MorphToLoop(&this->skelAnime, &object_ganon_anime2_Anim_005FFC, 0.0f); } else { this->actionFunc = BossGanon_SetupIntroCutscene; @@ -525,15 +524,15 @@ void BossGanon_SetIntroCsCamera(BossGanon* this, u8 camPosIndex) { this->csCamAt.z = camPos->at.z; } -void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { u8 moveCam = false; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; f32 sin; f32 cos; Camera* mainCam; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); sCape->backPush = -2.0f; sCape->backSwayMagnitude = 0.25f; @@ -557,11 +556,11 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->actor.shape.yOffset = -7000.0f; this->actor.shape.rot.y = 0; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->csCamIndex = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->csCamIndex, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->csCamIndex = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->csCamIndex, CAM_STAT_ACTIVE); this->csCamFov = 60.0f; if (GET_EVENTCHKINF(EVENTCHKINF_78)) { @@ -581,12 +580,11 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->useOpenHand = true; BossGanon_SetIntroCsCamera(this, 0); this->csState = 1; - sZelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 0.0f, - 220.0f, -150.0f, 0, 0, 0, 0x2000); + sZelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 0.0f, 220.0f, + -150.0f, 0, 0, 0, 0x2000); } - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_GANON_ORGAN, 0.0f, 0.0f, 0.0f, 0, - 0, 0, 1); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_GANON_ORGAN, 0.0f, 0.0f, 0.0f, 0, 0, 0, 1); sCape->minY = 57.0f; // fallthrough case 1: @@ -601,7 +599,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { BossGanon_SetIntroCsCamera(this, 1); if (this->csTimer == 10) { - func_8002DF54(globalCtx, &this->actor, 5); + func_8002DF54(play, &this->actor, 5); } if (this->csTimer == 13) { @@ -624,7 +622,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { // fallthrough case 3: this->envLightMode = 0; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; this->csCamAt.y = (sinf(this->unk_704) * 300.0f) + this->csCamEye.y; this->csCamAt.z = (cosf(this->unk_704) * -300.0f) + this->csCamEye.z; Math_ApproachF(&this->unk_704, 0.25f, 0.05f, this->csCamAtMaxStep.y); @@ -634,7 +632,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { break; } - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); this->csState = 4; BossGanon_SetIntroCsCamera(this, 2); this->csTimer = 0; @@ -662,11 +660,11 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->envLightMode = 5; if (this->csTimer < 50) { - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; } if (this->csTimer == 10) { - func_8002DF54(globalCtx, &this->actor, 0x4B); + func_8002DF54(play, &this->actor, 0x4B); } if (this->csTimer == 70) { @@ -693,7 +691,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->fwork[GDF_TRIFORCE_PRIM_B] = 255.0f; this->fwork[GDF_TRIFORCE_ENV_G] = 100.0f; func_80078884(NA_SE_EV_TRIFORCE_MARK); - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; // fallthrough case 7: this->envLightMode = 6; @@ -708,7 +706,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { } if (this->csTimer == 30) { - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; } BossGanon_SetIntroCsCamera(this, 4); @@ -732,7 +730,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->csState = 9; this->csTimer = 0; - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); sZelda->unk_3C8 = 0; this->triforceType = GDF_TRIFORCE_ZELDA; this->fwork[GDF_TRIFORCE_SCALE] = 10.0f; @@ -740,7 +738,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->fwork[GDF_TRIFORCE_PRIM_B] = 255.0f; this->fwork[GDF_TRIFORCE_ENV_G] = 100.0f; func_80078884(NA_SE_EV_TRIFORCE_MARK); - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; // fallthrough case 9: this->envLightMode = 7; @@ -760,7 +758,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { } if (this->csTimer == 32) { - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; } if (this->csTimer == 50) { @@ -786,7 +784,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { player->actor.world.pos.z = 20.0f; if (this->csTimer == 20) { - func_8002DF54(globalCtx, &this->actor, 0x17); + func_8002DF54(play, &this->actor, 0x17); Interface_ChangeAlpha(11); // show hearts only } @@ -820,10 +818,10 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { } if (this->csTimer == 80) { - Message_StartTextbox(globalCtx, 0x70C8, NULL); + Message_StartTextbox(play, 0x70C8, NULL); } - if ((this->csTimer > 180) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 180) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 15; this->csTimer = 0; this->useOpenHand = false; @@ -832,14 +830,14 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { case 15: // side view of all 3 of them this->envLightMode = 0; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; BossGanon_SetIntroCsCamera(this, 10); if (this->csTimer == 30) { - Message_StartTextbox(globalCtx, 0x70C9, NULL); + Message_StartTextbox(play, 0x70C9, NULL); } - if ((this->csTimer > 100) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 16; this->csTimer = 0; BossGanon_SetIntroCsCamera(this, 11); @@ -859,12 +857,12 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&object_ganon_anime2_Anim_004304); } } else if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - Message_StartTextbox(globalCtx, 0x70CA, NULL); + Message_StartTextbox(play, 0x70CA, NULL); Animation_MorphToLoop(&this->skelAnime, &object_ganon_anime2_Anim_0089F8, -5.0f); this->fwork[GDF_FWORK_1] = 1000.0f; } - if ((this->csTimer > 100) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 17; this->csTimer = 0; } @@ -896,7 +894,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->csTimer = 0; this->csCamFov = 60.0f; BossGanon_SetIntroCsCamera(this, 12); - Message_StartTextbox(globalCtx, 0x70CB, NULL); + Message_StartTextbox(play, 0x70CB, NULL); } } break; @@ -912,20 +910,20 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->fwork[GDF_FWORK_1] = 1000.0f; } - if ((this->csTimer <= 50) || (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE)) { + if ((this->csTimer <= 50) || (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) { break; } this->csState = 19; this->csTimer = 0; - Message_StartTextbox(globalCtx, 0x70CC, NULL); + Message_StartTextbox(play, 0x70CC, NULL); Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime2_Anim_007268, -5.0f); this->triforceType = GDF_TRIFORCE_DORF; this->fwork[GDF_TRIFORCE_SCALE] = 10.0f; this->fwork[GDF_TRIFORCE_PRIM_A] = 0.0f; this->fwork[GDF_TRIFORCE_PRIM_B] = 255.0f; this->fwork[GDF_TRIFORCE_ENV_G] = 100.0f; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; // fallthrough case 19: // show triforce this->envLightMode = 8; @@ -934,7 +932,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->envLightMode = 9; if (this->csTimer == 60) { - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; } } @@ -958,7 +956,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { Animation_MorphToLoop(&this->skelAnime, &object_ganon_anime2_Anim_007A64, -5.0f); } - if ((this->csTimer > 80) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 80) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 20; this->csTimer = 0; @@ -1001,12 +999,12 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { } if (this->csTimer > 20) { - BossGanonEff_SpawnShock(globalCtx, 700.0f, GDF_SHOCK_PLAYER_PURPLE); - BossGanonEff_SpawnShock(globalCtx, 700.0f, GDF_SHOCK_PLAYER_PURPLE); + BossGanonEff_SpawnShock(play, 700.0f, GDF_SHOCK_PLAYER_PURPLE); + BossGanonEff_SpawnShock(play, 700.0f, GDF_SHOCK_PLAYER_PURPLE); } if (this->csTimer == 30) { - func_8002DF54(globalCtx, &this->actor, 0x4A); + func_8002DF54(play, &this->actor, 0x4A); } if (this->csTimer <= 50) { @@ -1022,8 +1020,8 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { case 21: // purple vortex this->envLightMode = 11; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_DARKWAVE_M - SFX_FLAG); - BossGanonEff_SpawnShock(globalCtx, 700.0f, GDF_SHOCK_PLAYER_PURPLE); - BossGanonEff_SpawnShock(globalCtx, 700.0f, GDF_SHOCK_PLAYER_PURPLE); + BossGanonEff_SpawnShock(play, 700.0f, GDF_SHOCK_PLAYER_PURPLE); + BossGanonEff_SpawnShock(play, 700.0f, GDF_SHOCK_PLAYER_PURPLE); skip_sound_and_fx: this->csCamEye.x = -30.0f; @@ -1035,10 +1033,10 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->csCamAt.z = 0.0f; if (this->csTimer == 13) { - Message_StartTextbox(globalCtx, 0x70CD, NULL); + Message_StartTextbox(play, 0x70CD, NULL); } - if ((this->csTimer <= 120) || (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE)) { + if ((this->csTimer <= 120) || (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) { break; } @@ -1069,7 +1067,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { Math_ApproachF(&this->csCamAt.x, this->unk_1FC.x - 10.0f, 0.1f, 5.0f); if (this->csTimer == 20) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfGetUp3Anim, 0.0f); SkelAnime_Update(&this->skelAnime); this->actor.shape.yOffset = 0.0f; @@ -1081,11 +1079,11 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { if (this->csTimer == 50) { gSegments[6] = VIRTUAL_TO_PHYSICAL( - globalCtx->objectCtx.status[Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON)].segment); + play->objectCtx.status[Object_GetIndex(&play->objectCtx, OBJECT_GANON)].segment); if (!GET_EVENTCHKINF(EVENTCHKINF_78)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, - SEGMENTED_TO_VIRTUAL(gDorfTitleCardTex), 160, 180, 128, 40); + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gDorfTitleCardTex), 160, + 180, 128, 40); } SET_EVENTCHKINF(EVENTCHKINF_78); @@ -1122,15 +1120,15 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { } if (this->csTimer == 120) { - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->csCamEye; mainCam->eyeNext = this->csCamEye; mainCam->at = this->csCamAt; - func_800C08AC(globalCtx, this->csCamIndex, 0); + func_800C08AC(play, this->csCamIndex, 0); this->csState = this->csCamIndex = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - BossGanon_SetupWait(this, globalCtx); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + BossGanon_SetupWait(this, play); } if (sZelda != NULL) { @@ -1157,34 +1155,34 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { this->csCamAtMaxStep.z * this->csCamMaxStepScale); } - Play_CameraSetAtEye(globalCtx, this->csCamIndex, &this->csCamAt, &this->csCamEye); - Play_CameraSetFov(globalCtx, this->csCamIndex, this->csCamFov); + Play_CameraSetAtEye(play, this->csCamIndex, &this->csCamAt, &this->csCamEye); + Play_CameraSetFov(play, this->csCamIndex, this->csCamFov); } } -void BossGanon_SetupDeathCutscene(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupDeathCutscene(BossGanon* this, PlayState* play) { s32 pad; - s32 animBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON_ANIME2); + s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2); - if (Object_IsLoaded(&globalCtx->objectCtx, animBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, animBankIndex)) { this->actionFunc = BossGanon_DeathAndTowerCutscene; this->csTimer = this->csState = 0; this->unk_198 = 1; this->animBankIndex = animBankIndex; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment); Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime2_Anim_00EA00, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&object_ganon_anime2_Anim_00EA00); this->unk_508 = 0.0f; } } -void BossGanon_SetupTowerCutscene(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play) { s32 pad; - s32 animBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON_ANIME2); + s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2); - if (Object_IsLoaded(&globalCtx->objectCtx, animBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, animBankIndex)) { this->animBankIndex = animBankIndex; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment); Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime2_Anim_00EA00, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&object_ganon_anime2_Anim_00EA00); this->actionFunc = BossGanon_DeathAndTowerCutscene; @@ -1212,12 +1210,12 @@ void BossGanon_ShatterWindows(u8 windowShatterState) { } } -void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { static Color_RGBA8 bloodPrimColor = { 0, 120, 0, 255 }; static Color_RGBA8 bloodEnvColor = { 0, 120, 0, 255 }; s16 i; u8 moveCam = false; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 pad; Vec3f sp98; Vec3f sp8C; @@ -1226,18 +1224,18 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) Camera* mainCam; Vec3f sp64; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); this->csTimer++; SkelAnime_Update(&this->skelAnime); switch (this->csState) { case 0: - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->csCamIndex = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->csCamIndex, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->csCamIndex = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->csCamIndex, CAM_STAT_ACTIVE); this->actor.world.pos.x = 0.0f; this->actor.world.pos.y = 70.0f; @@ -1260,11 +1258,11 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->envLightMode = 13; if (this->csTimer < 30) { - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; } if (this->csTimer >= 2) { - globalCtx->envCtx.fillScreen = false; + play->envCtx.fillScreen = false; } this->csCamEye.x = -50.0f; @@ -1296,7 +1294,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) if (this->csTimer >= 30) { this->csState = 3; this->csTimer = 0; - Message_StartTextbox(globalCtx, 0x70CE, NULL); + Message_StartTextbox(play, 0x70CE, NULL); this->fwork[GDF_FWORK_1] = 1000.0f; } @@ -1321,7 +1319,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.z = this->unk_1FC.z; if ((this->fwork[GDF_FWORK_1] > 100.0f) && (this->csTimer > 100) && - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime2_Anim_00B668, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&object_ganon_anime2_Anim_00B668); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_TOKETU); @@ -1340,7 +1338,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) sp80.y = this->unk_208.y - 10.0f; sp80.z = this->unk_208.z; - func_8002836C(globalCtx, &sp80, &sp98, &sp8C, &bloodPrimColor, &bloodEnvColor, + func_8002836C(play, &sp80, &sp98, &sp8C, &bloodPrimColor, &bloodEnvColor, (s16)Rand_ZeroFloat(50.0f) + 50, 0, 17); } } @@ -1357,7 +1355,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->envLightMode = 14; if (this->csTimer == 30) { - Message_StartTextbox(globalCtx, 0x70CF, NULL); + Message_StartTextbox(play, 0x70CF, NULL); this->csState = 5; this->csTimer = 0; } @@ -1366,7 +1364,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) case 5: this->envLightMode = 14; - if ((this->csTimer > 70) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 70) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 6; this->csTimer = 0; Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime2_Anim_010298, 0.0f); @@ -1408,13 +1406,13 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->envLightMode = 15; this->unk_508 = 0.0f; this->fwork[GDF_FWORK_1] = 1000.0f; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; } break; case 7: if (this->csTimer < 10) { - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; } if (this->csTimer == 30) { @@ -1469,7 +1467,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_BODY_SPARK - SFX_FLAG); if (this->csTimer == 2) { - func_8002DF54(globalCtx, &this->actor, 0x39); + func_8002DF54(play, &this->actor, 0x39); } if (this->csTimer > 50) { @@ -1497,24 +1495,24 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) } if (this->csTimer == 180) { - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->nextEntranceIndex = ENTR_GANON_FINAL_0; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE_FAST; + play->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_GANON_FINAL_0; + play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; } break; case 100: - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->csCamIndex = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->csCamIndex, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->csCamIndex = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->csCamIndex, CAM_STAT_ACTIVE); Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime2_Anim_00ADDC, 0.0f); this->fwork[1] = Animation_GetLastFrame(&object_ganon_anime2_Anim_00EA00); this->csState = 101; this->skelAnime.playSpeed = 0.0f; - sZelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 0.0f, - 6000.0f, 0.0f, 0, 0, 0, 0x2000); + sZelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 0.0f, 6000.0f, 0.0f, + 0, 0, 0, 0x2000); player->actor.world.pos.x = -472.0f; player->actor.world.pos.y = 4102.0f; @@ -1543,7 +1541,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) sCape->tearTimer = 20; this->whiteFillAlpha = 255.0f; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; // fallthrough case 101: player->actor.world.pos.y = 4102.0f; @@ -1572,7 +1570,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) if (this->csTimer == 190) { sp74 = this->actor.world.pos; sp74.y = 4102.0f; - BossGanonEff_SpawnDustDark(globalCtx, &sp74, 0.2f, 0.7f); + BossGanonEff_SpawnDustDark(play, &sp74, 0.2f, 0.7f); } if (this->csTimer == 230) { @@ -1594,11 +1592,11 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.z = -135.0f; if (this->csTimer == 5) { - func_8002DF54(globalCtx, &this->actor, 0x4C); + func_8002DF54(play, &this->actor, 0x4C); } if (this->csTimer == 70) { - func_8002DF54(globalCtx, &this->actor, 0x4D); + func_8002DF54(play, &this->actor, 0x4D); } if (this->csTimer == 90) { @@ -1641,7 +1639,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.z = sZelda->actor.world.pos.z; if (this->csTimer >= 10) { - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.05f); + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.05f); } if (this->csTimer == 10) { @@ -1668,10 +1666,10 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.z = sZelda->actor.world.pos.z - 25.0f; if (this->csTimer == 10) { - Message_StartTextbox(globalCtx, 0x70D0, NULL); + Message_StartTextbox(play, 0x70D0, NULL); } - if ((this->csTimer > 100) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 1055; this->csTimer = 0; } @@ -1683,7 +1681,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) if (this->csTimer == 20) { sZelda->unk_3C8 = 5; - func_8002DF54(globalCtx, &this->actor, 0x39); + func_8002DF54(play, &this->actor, 0x39); } if (this->csTimer == 40) { @@ -1743,14 +1741,14 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) } if (this->csTimer == 90) { - Message_StartTextbox(globalCtx, 0x70D1, NULL); + Message_StartTextbox(play, 0x70D1, NULL); } - if ((this->csTimer > 150) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 150) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->csState = 107; this->csTimer = 0; - Message_StartTextbox(globalCtx, 0x70D2, NULL); - func_8002DF54(globalCtx, &this->actor, 0x39); + Message_StartTextbox(play, 0x70D2, NULL); + func_8002DF54(play, &this->actor, 0x39); } break; @@ -1766,7 +1764,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.y = (sZelda->actor.world.pos.y + 40.0f + 5.0f) - 20.0f; this->csCamAt.z = (sZelda->actor.world.pos.z - 25.0f) + 80.0f; - if ((this->csTimer > 50) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->csTimer > 50) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { sZelda->unk_3C8 = 7; this->csState = 108; this->csTimer = 0; @@ -1782,18 +1780,18 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.z = (sZelda->actor.world.pos.z - 25.0f) + 80.0f; if (this->csTimer > 50) { - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->csCamEye; mainCam->eyeNext = this->csCamEye; mainCam->at = this->csCamAt; - func_800C08AC(globalCtx, this->csCamIndex, 0); + func_800C08AC(play, this->csCamIndex, 0); this->csState = 109; this->csCamIndex = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - Flags_SetSwitch(globalCtx, 0x37); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + Flags_SetSwitch(play, 0x37); } break; @@ -1824,11 +1822,11 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) sp64 = this->csCamAt; sp64.y += this->unk_70C; - Play_CameraSetAtEye(globalCtx, this->csCamIndex, &sp64, &this->csCamEye); + Play_CameraSetAtEye(play, this->csCamIndex, &sp64, &this->csCamEye); } } -void BossGanon_SetupPoundFloor(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupPoundFloor(BossGanon* this, PlayState* play) { this->unk_1C2 = 0; this->timers[0] = 40; this->actionFunc = BossGanon_PoundFloor; @@ -1837,7 +1835,7 @@ void BossGanon_SetupPoundFloor(BossGanon* this, GlobalContext* globalCtx) { this->fwork[GDF_CENTER_POS] = 100.0f; } -void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_PoundFloor(BossGanon* this, PlayState* play) { s16 i; f32 heightTarget; f32 targetPosX; @@ -1898,7 +1896,7 @@ void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) { this->actor.world.pos.y = 60.0f; this->unk_1C2 = 2; this->timers[0] = 10; - func_80033E88(&this->actor, globalCtx, 0xA, 0x14); // rumble + func_80033E88(&this->actor, play, 0xA, 0x14); // rumble this->unk_19C = 35; this->unk_19E = 0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_HIT_GND_IMP); @@ -1910,8 +1908,8 @@ void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) { sp6C.x = Rand_CenteredFloat(25.0f); sp6C.y = Rand_ZeroFloat(17.0f); sp6C.z = Rand_CenteredFloat(25.0f); - BossGanonEff_SpawnLightRay(globalCtx, &sp60, &sp6C, &sZeroVec, Rand_ZeroFloat(300.0f) + 500.0f, - 13.0f, 0x1E); + BossGanonEff_SpawnLightRay(play, &sp60, &sp6C, &sZeroVec, Rand_ZeroFloat(300.0f) + 500.0f, 13.0f, + 0x1E); } } break; @@ -1947,7 +1945,7 @@ void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.velocity.y, 20.0f, 1.0f, 1.0f); if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - BossGanon_SetupWait(this, globalCtx); + BossGanon_SetupWait(this, play); } break; } @@ -1955,17 +1953,17 @@ void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) { if ((this->unk_19C == 35) || (this->unk_19C == 30) || (this->unk_19C == 25)) { sp54 = this->actor.world.pos; sp54.y = 0.0f; - BossGanonEff_SpawnDustLight(globalCtx, &sp54, 0, 3.0f, this->unk_19C - 25); + BossGanonEff_SpawnDustLight(play, &sp54, 0, 3.0f, this->unk_19C - 25); } if (this->unk_19C == 35) { sp48 = this->actor.world.pos; sp48.y = 0.0f; - BossGanonEff_SpawnShockwave(globalCtx, &sp48, 0, 3.0f); + BossGanonEff_SpawnShockwave(play, &sp48, 0, 3.0f); } } -void BossGanon_SetupChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupChargeBigMagic(BossGanon* this, PlayState* play) { this->unk_1C2 = 0; this->timers[0] = 30; this->actor.velocity.x = 0.0f; @@ -1976,7 +1974,7 @@ void BossGanon_SetupChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { this->actionFunc = BossGanon_ChargeBigMagic; } -void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_ChargeBigMagic(BossGanon* this, PlayState* play) { s32 pad; f32 targetPosX; f32 targetPosZ; @@ -2108,7 +2106,7 @@ void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { sp80.y = this->unk_278.y + sp68.y; sp80.z = this->unk_278.z + sp68.z; - BossGanonEff_SpawnBlackDot(globalCtx, &sp80, 20.0f); + BossGanonEff_SpawnBlackDot(play, &sp80, 20.0f); } break; @@ -2149,7 +2147,7 @@ void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 5.0f)) { for (i = 0; i < 5; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANON, this->unk_1FC.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANON, this->unk_1FC.x, this->unk_1FC.y, this->unk_1FC.z, 0, this->actor.yawTowardsPlayer, 0, 0x104 + i); } @@ -2173,14 +2171,14 @@ void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) { this->envLightMode = 2; if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - BossGanon_SetupWait(this, globalCtx); + BossGanon_SetupWait(this, play); } break; } } -void BossGanon_SetupWait(BossGanon* this, GlobalContext* globalCtx) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); +void BossGanon_SetupWait(BossGanon* this, PlayState* play) { + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); Animation_MorphToLoop(&this->skelAnime, &gDorfFloatAnim, -10.0f); this->actionFunc = BossGanon_Wait; this->fwork[GDF_FWORK_0] = 0.0f; @@ -2189,11 +2187,11 @@ void BossGanon_SetupWait(BossGanon* this, GlobalContext* globalCtx) { sCape->minY = 2.0f; } -void BossGanon_Wait(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_Wait(BossGanon* this, PlayState* play) { f32 sin; s32 pad; f32 cos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->legSwayEnabled = true; @@ -2207,20 +2205,20 @@ void BossGanon_Wait(BossGanon* this, GlobalContext* globalCtx) { if ((this->unk_1C2 == 0) && !(player->actor.world.pos.y < 0.0f)) { if (!(player->stateFlags1 & PLAYER_STATE1_13) && (fabsf(player->actor.world.pos.x) < 110.0f) && (fabsf(player->actor.world.pos.z) < 110.0f)) { - BossGanon_SetupPoundFloor(this, globalCtx); + BossGanon_SetupPoundFloor(this, play); } else if ((this->timers[0] == 0) && !(player->stateFlags1 & PLAYER_STATE1_13)) { this->timers[0] = (s16)Rand_ZeroFloat(30.0f) + 30; if ((s8)this->actor.colChkInfo.health >= 20) { - BossGanon_SetupChargeLightBall(this, globalCtx); + BossGanon_SetupChargeLightBall(this, play); } else if (Rand_ZeroOne() >= 0.5f) { if ((Rand_ZeroOne() >= 0.5f) || (this->actor.xzDistToPlayer > 350.0f)) { - BossGanon_SetupChargeBigMagic(this, globalCtx); + BossGanon_SetupChargeBigMagic(this, play); } else { - BossGanon_SetupPoundFloor(this, globalCtx); + BossGanon_SetupPoundFloor(this, play); } } else { - BossGanon_SetupChargeLightBall(this, globalCtx); + BossGanon_SetupChargeLightBall(this, play); } } } @@ -2244,15 +2242,15 @@ void BossGanon_Wait(BossGanon* this, GlobalContext* globalCtx) { func_80078914(&this->actor.projectedPos, NA_SE_EN_FANTOM_FLOAT - SFX_FLAG); } -void BossGanon_SetupChargeLightBall(BossGanon* this, GlobalContext* globalCtx) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); +void BossGanon_SetupChargeLightBall(BossGanon* this, PlayState* play) { + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfChargeLightBallAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfChargeLightBallAnim, -3.0f); this->actionFunc = BossGanon_ChargeLightBall; this->timers[0] = 25; } -void BossGanon_ChargeLightBall(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_ChargeLightBall(BossGanon* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); sCape->backPush = -3.0f; @@ -2275,7 +2273,7 @@ void BossGanon_ChargeLightBall(BossGanon* this, GlobalContext* globalCtx) { Math_ApproachF(&this->handLightBallScale, 10.0f, 0.5f, 1.25f); if (this->timers[0] == 0) { - BossGanon_SetupPlayTennis(this, globalCtx); + BossGanon_SetupPlayTennis(this, play); } } @@ -2291,14 +2289,14 @@ void BossGanon_ChargeLightBall(BossGanon* this, GlobalContext* globalCtx) { this->actor.world.pos.y += this->actor.velocity.y; } -void BossGanon_SetupPlayTennis(BossGanon* this, GlobalContext* globalCtx) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); +void BossGanon_SetupPlayTennis(BossGanon* this, PlayState* play) { + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfThrowAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfThrowAnim, 0.0f); this->actionFunc = BossGanon_PlayTennis; } -void BossGanon_PlayTennis(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_PlayTennis(BossGanon* this, PlayState* play) { static AnimationHeader* volleyAnims[] = { &gDorfVolleyLeftAnim, &gDorfVolleyRightAnim }; static s16 capeRightArmDurations[] = { 26, 20 }; s16 rand; @@ -2329,7 +2327,7 @@ void BossGanon_PlayTennis(BossGanon* this, GlobalContext* globalCtx) { this->unk_25C = 1; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_THROW); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_THROW_MASIC); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANON, this->unk_260.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANON, this->unk_260.x, this->unk_260.y, this->unk_260.z, 0, 0, 0, 0x64); } break; @@ -2358,9 +2356,9 @@ void BossGanon_PlayTennis(BossGanon* this, GlobalContext* globalCtx) { this->actor.world.pos.y += this->actor.velocity.y; } -void BossGanon_SetupBlock(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupBlock(BossGanon* this, PlayState* play) { if ((this->actionFunc != BossGanon_Block) || (this->unk_1C2 != 0)) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfBlockAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfBlockAnim, 0.0f); this->actionFunc = BossGanon_Block; @@ -2372,7 +2370,7 @@ void BossGanon_SetupBlock(BossGanon* this, GlobalContext* globalCtx) { this->handLightBallScale = 0.0f; } -void BossGanon_Block(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_Block(BossGanon* this, PlayState* play) { this->collider.base.colType = 9; SkelAnime_Update(&this->skelAnime); sCape->backPush = -9.0f; @@ -2393,7 +2391,7 @@ void BossGanon_Block(BossGanon* this, GlobalContext* globalCtx) { sCape->sideSwayMagnitude = -13.0f; if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - BossGanon_SetupWait(this, globalCtx); + BossGanon_SetupWait(this, play); } } @@ -2406,10 +2404,10 @@ void BossGanon_Block(BossGanon* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->actor.velocity.z, 1.0f, 0.5f); } -void BossGanon_SetupHitByLightBall(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupHitByLightBall(BossGanon* this, PlayState* play) { s16 i; - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfBigMagicHitAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfBigMagicHitAnim, 0); this->timers[0] = 70; @@ -2428,14 +2426,14 @@ void BossGanon_SetupHitByLightBall(BossGanon* this, GlobalContext* globalCtx) { this->unk_508 = 6.0f; } -void BossGanon_HitByLightBall(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_HitByLightBall(BossGanon* this, PlayState* play) { s16 i; Vec3f sp50; SkelAnime_Update(&this->skelAnime); if (this->unk_1C2 == 0) { - BossGanonEff_SpawnShock(globalCtx, 1500.0f, GDF_SHOCK_DORF_YELLOW); + BossGanonEff_SpawnShock(play, 1500.0f, GDF_SHOCK_DORF_YELLOW); if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfLightArrowWaitAnim); @@ -2443,7 +2441,7 @@ void BossGanon_HitByLightBall(BossGanon* this, GlobalContext* globalCtx) { this->unk_1C2 = 1; } } else if (this->unk_1C2 == 1) { - BossGanonEff_SpawnShock(globalCtx, 1000.0f, GDF_SHOCK_DORF_YELLOW); + BossGanonEff_SpawnShock(play, 1000.0f, GDF_SHOCK_DORF_YELLOW); if (this->timers[0] == 0) { this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfGetUp3Anim); @@ -2462,14 +2460,14 @@ void BossGanon_HitByLightBall(BossGanon* this, GlobalContext* globalCtx) { sp50.y = Rand_CenteredFloat(25.0f); sp50.z = Rand_CenteredFloat(25.0f); - BossGanonEff_SpawnSparkle(globalCtx, &this->unk_1FC, &sp50, &sZeroVec, Rand_ZeroFloat(200.0f) + 500.0f, + BossGanonEff_SpawnSparkle(play, &this->unk_1FC, &sp50, &sZeroVec, Rand_ZeroFloat(200.0f) + 500.0f, 0x14); } Audio_PlayActorSound2(&this->actor, NA_SE_PL_WALK_WATER2); } if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - BossGanon_SetupWait(this, globalCtx); + BossGanon_SetupWait(this, play); } } @@ -2477,11 +2475,11 @@ void BossGanon_HitByLightBall(BossGanon* this, GlobalContext* globalCtx) { this->actor.world.pos.y += this->actor.velocity.y; } -void BossGanon_SetupVulnerable(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_SetupVulnerable(BossGanon* this, PlayState* play) { s16 i; if (this->actionFunc != BossGanon_Vulnerable) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfLightArrowHitAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfLightArrowHitAnim, 0.0f); sCape->attachRightArmTimer = sCape->attachLeftArmTimer = 0; @@ -2498,8 +2496,8 @@ void BossGanon_SetupVulnerable(BossGanon* this, GlobalContext* globalCtx) { sCape->minDist = 20.0f; for (i = 0; i < 10; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANON, this->unk_1FC.x, - this->unk_1FC.y, this->unk_1FC.z, Rand_CenteredFloat(0x8000), + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANON, this->unk_1FC.x, this->unk_1FC.y, + this->unk_1FC.z, Rand_CenteredFloat(0x8000), (s16)Rand_CenteredFloat(0x8000) + this->actor.yawTowardsPlayer, 0, 0xC8 + i); } @@ -2511,7 +2509,7 @@ void BossGanon_SetupVulnerable(BossGanon* this, GlobalContext* globalCtx) { } } -void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_Vulnerable(BossGanon* this, PlayState* play) { s16 i; Vec3f sp40; @@ -2603,7 +2601,7 @@ void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx) { break; case 5: - BossGanonEff_SpawnShock(globalCtx, 1000.0f, GDF_SHOCK_DORF_YELLOW); + BossGanonEff_SpawnShock(play, 1000.0f, GDF_SHOCK_DORF_YELLOW); if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { this->unk_1C2 = 6; @@ -2643,8 +2641,8 @@ void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx) { sp40.x = Rand_CenteredFloat(25.0f); sp40.y = Rand_CenteredFloat(25.0f); sp40.z = Rand_CenteredFloat(25.0f); - BossGanonEff_SpawnSparkle(globalCtx, &this->unk_1FC, &sp40, &sZeroVec, - Rand_ZeroFloat(200.0f) + 500.0f, 0x14); + BossGanonEff_SpawnSparkle(play, &this->unk_1FC, &sp40, &sZeroVec, Rand_ZeroFloat(200.0f) + 500.0f, + 0x14); } Audio_PlayActorSound2(&this->actor, NA_SE_PL_WALK_WATER2); @@ -2652,20 +2650,20 @@ void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { - BossGanon_SetupWait(this, globalCtx); + BossGanon_SetupWait(this, play); } break; } } -void BossGanon_SetupDamaged(BossGanon* this, GlobalContext* globalCtx) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); +void BossGanon_SetupDamaged(BossGanon* this, PlayState* play) { + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfDamageAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfDamageAnim, 0.0f); this->actionFunc = BossGanon_Damaged; } -void BossGanon_Damaged(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_Damaged(BossGanon* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_0; SkelAnime_Update(&this->skelAnime); @@ -2683,7 +2681,7 @@ void BossGanon_Damaged(BossGanon* this, GlobalContext* globalCtx) { } } -void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_UpdateDamage(BossGanon* this, PlayState* play) { s16 i; s16 j; ColliderInfo* acHitInfo; @@ -2695,7 +2693,7 @@ void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) { if ((this->actionFunc == BossGanon_HitByLightBall) || (this->actionFunc == BossGanon_ChargeBigMagic)) { if (acHitInfo->toucher.dmgFlags & 0x2000) { - BossGanon_SetupVulnerable(this, globalCtx); + BossGanon_SetupVulnerable(this, play); this->timers[2] = 0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_DAMAGE1); this->unk_1A6 = 15; @@ -2711,8 +2709,8 @@ void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) { sp50.x = Rand_CenteredFloat(20.0f); sp50.y = Rand_CenteredFloat(20.0f); sp50.z = Rand_CenteredFloat(20.0f); - BossGanonEff_SpawnSparkle(globalCtx, &this->unk_1FC, &sp50, &sZeroVec, - Rand_ZeroFloat(200.0f) + 500.0f, 0x1E); + BossGanonEff_SpawnSparkle(play, &this->unk_1FC, &sp50, &sZeroVec, Rand_ZeroFloat(200.0f) + 500.0f, + 0x1E); } damage = flags = CollisionCheck_GetSwordDamage(acHitInfo->toucher.dmgFlags); @@ -2735,7 +2733,7 @@ void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) { } if ((s8)this->actor.colChkInfo.health <= 0) { - BossGanon_SetupDeathCutscene(this, globalCtx); + BossGanon_SetupDeathCutscene(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_DEAD); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_DD_THUNDER); func_80078914(&sZeroVec, NA_SE_EN_LAST_DAMAGE); @@ -2744,7 +2742,7 @@ void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) { } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_DAMAGE2); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_CUTBODY); - BossGanon_SetupDamaged(this, globalCtx); + BossGanon_SetupDamaged(this, play); this->unk_1A6 = 15; sCape->tearTimer = 1; } @@ -2766,13 +2764,13 @@ static f32 D_808E4D44[] = { 1.0f, 3.0f, 0.0f, 7.0f, 13.0f, 4.0f, 6.0f, 11.0f, 5.0f, 2.0f, 8.0f, 14.0f, 10.0f, 12.0f, 9.0f, }; -void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { +void BossGanon_Update(Actor* thisx, PlayState* play2) { BossGanon* this = (BossGanon*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 legRotX; f32 legRotY; f32 legRotZ; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 i; f32 sin; f32 cos; @@ -2794,9 +2792,9 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { f32 zOffset; if ((this->actionFunc != BossGanon_IntroCutscene) && (this->actionFunc != BossGanon_DeathAndTowerCutscene)) { - BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); + BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); } else { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment); } if (this->windowShatterState != GDF_WINDOW_SHATTER_OFF) { @@ -2820,7 +2818,7 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { shardVel.x = Rand_ZeroFloat(1.0f); } - BossGanonEff_SpawnWindowShard(globalCtx, &shardPos, &shardVel, Rand_ZeroFloat(0.075f) + 0.08f); + BossGanonEff_SpawnWindowShard(play, &shardPos, &shardVel, Rand_ZeroFloat(0.075f) + 0.08f); } } @@ -2834,11 +2832,11 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { // block players attack if hes shooting something if ((this->actionFunc == BossGanon_Wait) || (this->actionFunc == BossGanon_Block)) { if (player->unk_A73 != 0) { - BossGanon_SetupBlock(this, globalCtx); + BossGanon_SetupBlock(this, play); } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->timers); i++) { if (this->timers[i] != 0) { @@ -2867,16 +2865,16 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { } if (this->csState == 0) { - BossGanon_UpdateDamage(this, globalCtx); + BossGanon_UpdateDamage(this, play); BossGanon_SetColliderPos(&this->unk_1FC, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->unk_2D4 == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if ((this->actionFunc != BossGanon_HitByLightBall) && (this->actionFunc != BossGanon_Vulnerable) && (this->actionFunc != BossGanon_Damaged)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } @@ -2920,7 +2918,7 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { // player hit, spawn shock and play sound if (this->unk_2E8 != 0) { func_80078914(&player->actor.projectedPos, NA_SE_PL_SPARK - SFX_FLAG); - BossGanonEff_SpawnShock(globalCtx, 700.0f, GDF_SHOCK_PLAYER_YELLOW); + BossGanonEff_SpawnShock(play, 700.0f, GDF_SHOCK_PLAYER_YELLOW); } } @@ -2928,18 +2926,18 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_19F = 0; spE8 = this->actor.world.pos; spE8.y = 0.0f; - BossGanonEff_SpawnDustDark(globalCtx, &spE8, 0.2, 0.7f); - BossGanonEff_SpawnDustDark(globalCtx, &spE8, 0.3f, 0.8f); + BossGanonEff_SpawnDustDark(play, &spE8, 0.2, 0.7f); + BossGanonEff_SpawnDustDark(play, &spE8, 0.3f, 0.8f); } if (this->unk_26C != 0) { this->unk_26C--; if (this->unk_26C == 0) { - BossGanonEff_SpawnLightning(globalCtx, 1.0f, 0.0f, 0.0f); + BossGanonEff_SpawnLightning(play, 1.0f, 0.0f, 0.0f); } - BossGanonEff_SpawnLightning(globalCtx, 1.0f, D_808E4D44[this->unk_26C] * (M_PI / 5) + this->unk_270, + BossGanonEff_SpawnLightning(play, 1.0f, D_808E4D44[this->unk_26C] * (M_PI / 5) + this->unk_270, Rand_CenteredFloat(M_PI / 5) + (M_PI / 2)); } @@ -2952,7 +2950,7 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { for (i2 = 0; i2 < 4; i2++) { for (j = 0, platformCheckPos.z = -180.0f; j < 4; j++) { - BossGanon_CheckFallingPlatforms(this, globalCtx, &platformCheckPos); + BossGanon_CheckFallingPlatforms(this, play, &platformCheckPos); platformCheckPos.z += 120.0f; } @@ -2966,12 +2964,12 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { Matrix_RotateY(Rand_ZeroFloat(6.2831855f), MTXMODE_NEW); Matrix_MultVec3f(&spD8, &platformCheckPos); - this->unk_19E += BossGanon_CheckFallingPlatforms(this, globalCtx, &platformCheckPos); + this->unk_19E += BossGanon_CheckFallingPlatforms(this, play, &platformCheckPos); } } // see if a bomb exploded near a group of platforms and if they should fall - explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (explosive != NULL) { if (explosive->params != BOMB_EXPLOSION) { @@ -2989,16 +2987,16 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { platCheckPosBomb.y = explosive->world.pos.y; platCheckPosBomb.z = explosive->world.pos.z + spB0.z; - BossGanon_CheckFallingPlatforms(this, globalCtx, &platCheckPosBomb); + BossGanon_CheckFallingPlatforms(this, play, &platCheckPosBomb); } explosive = explosive->next; } } - BossGanon_UpdateEffects(globalCtx); + BossGanon_UpdateEffects(play); - prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + prop = play->actorCtx.actorLists[ACTORCAT_PROP].head; // if a platform is lit up, change the room lighting while (prop != NULL) { @@ -3016,107 +3014,106 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - globalCtx->envCtx.lightSettingOverride = 0; - globalCtx->envCtx.prevLightSetting = 0; - globalCtx->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; + play->envCtx.lightSettingOverride = 0; + play->envCtx.prevLightSetting = 0; + play->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; switch (this->envLightMode) { case -1: break; case 0: - Math_ApproachF(&globalCtx->envCtx.lightBlend, 0.0f, 1.0f, 0.02f); + Math_ApproachF(&play->envCtx.lightBlend, 0.0f, 1.0f, 0.02f); break; case 1: - globalCtx->envCtx.lightSetting = 1; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.1f); + play->envCtx.lightSetting = 1; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.1f); break; case 2: - globalCtx->envCtx.lightSetting = 1; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.02f); + play->envCtx.lightSetting = 1; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.02f); break; case 3: - globalCtx->envCtx.lightSetting = 3; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightSetting = 3; + play->envCtx.lightBlend = 1.0f; break; case 35: - globalCtx->envCtx.lightSetting = 0; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightSetting = 0; + play->envCtx.lightBlend = 1.0f; break; case 4: - globalCtx->envCtx.lightSetting = 4; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightSetting = 4; + play->envCtx.lightBlend = 1.0f; break; case 5: - globalCtx->envCtx.prevLightSetting = 5; - globalCtx->envCtx.lightSetting = 3; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.075f); + play->envCtx.prevLightSetting = 5; + play->envCtx.lightSetting = 3; + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.075f); break; case 6: - globalCtx->envCtx.prevLightSetting = 5; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.prevLightSetting = 5; + play->envCtx.lightBlend = 0.0f; break; case 65: - globalCtx->envCtx.prevLightSetting = 3; - globalCtx->envCtx.lightSetting = 6; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.05f); + play->envCtx.prevLightSetting = 3; + play->envCtx.lightSetting = 6; + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.05f); break; case 7: - globalCtx->envCtx.prevLightSetting = 7; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.prevLightSetting = 7; + play->envCtx.lightBlend = 0.0f; break; case 75: - globalCtx->envCtx.prevLightSetting = 4; - globalCtx->envCtx.lightSetting = 8; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.05f); + play->envCtx.prevLightSetting = 4; + play->envCtx.lightSetting = 8; + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.05f); break; case 8: - globalCtx->envCtx.prevLightSetting = 3; - globalCtx->envCtx.lightSetting = 9; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.05f); + play->envCtx.prevLightSetting = 3; + play->envCtx.lightSetting = 9; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.05f); break; case 9: - globalCtx->envCtx.prevLightSetting = 3; - globalCtx->envCtx.lightSetting = 10; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.05f); + play->envCtx.prevLightSetting = 3; + play->envCtx.lightSetting = 10; + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.05f); break; case 10: - globalCtx->envCtx.prevLightSetting = 3; - globalCtx->envCtx.lightSetting = 11; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.05f); + play->envCtx.prevLightSetting = 3; + play->envCtx.lightSetting = 11; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.05f); this->unk_1A4 = 0; break; case 11: - globalCtx->envCtx.prevLightSetting = 12; - globalCtx->envCtx.lightSetting = 11; - Math_ApproachF(&globalCtx->envCtx.lightBlend, (Math_CosS(this->unk_1A4 * 0x1800) * 0.5f) + 0.5f, 1.0f, - 1.0f); + play->envCtx.prevLightSetting = 12; + play->envCtx.lightSetting = 11; + Math_ApproachF(&play->envCtx.lightBlend, (Math_CosS(this->unk_1A4 * 0x1800) * 0.5f) + 0.5f, 1.0f, 1.0f); break; case 12: - globalCtx->envCtx.prevLightSetting = 12; - globalCtx->envCtx.lightSetting = 3; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.05f); + play->envCtx.prevLightSetting = 12; + play->envCtx.lightSetting = 3; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.05f); break; case 13: - globalCtx->envCtx.lightSetting = 13; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.025f); + play->envCtx.lightSetting = 13; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.025f); break; case 14: - globalCtx->envCtx.lightSetting = 14; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightSetting = 14; + play->envCtx.lightBlend = 1.0f; break; case 15: - globalCtx->envCtx.prevLightSetting = 14; - globalCtx->envCtx.lightSetting = 15; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.01f); + play->envCtx.prevLightSetting = 14; + play->envCtx.lightSetting = 15; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.01f); break; case 16: - globalCtx->envCtx.prevLightSetting = 16; - globalCtx->envCtx.lightSetting = 15; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.05f); + play->envCtx.prevLightSetting = 16; + play->envCtx.lightSetting = 15; + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.05f); break; case 20: - globalCtx->envCtx.prevLightSetting = 2; - globalCtx->envCtx.lightSetting = 1; + play->envCtx.prevLightSetting = 2; + play->envCtx.lightSetting = 1; break; default: break; @@ -3125,20 +3122,18 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { this->envLightMode = 0; if (this->whiteFillAlpha != 0) { - globalCtx->envCtx.screenFillColor[3] = (s8)(u8)this->whiteFillAlpha; - globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = - globalCtx->envCtx.screenFillColor[2] = 255; - globalCtx->envCtx.fillScreen = true; + play->envCtx.screenFillColor[3] = (s8)(u8)this->whiteFillAlpha; + play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = play->envCtx.screenFillColor[2] = 255; + play->envCtx.fillScreen = true; } else if (this->screenFlashTimer != 0) { - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = - globalCtx->envCtx.screenFillColor[2] = 255; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = play->envCtx.screenFillColor[2] = 255; - globalCtx->envCtx.screenFillColor[3] = ((this->screenFlashTimer % 2) != 0) ? 100 : 0; + play->envCtx.screenFillColor[3] = ((this->screenFlashTimer % 2) != 0) ? 100 : 0; this->screenFlashTimer--; } else { - globalCtx->envCtx.fillScreen = globalCtx->envCtx.screenFillColor[3] = 0; + play->envCtx.fillScreen = play->envCtx.screenFillColor[3] = 0; } if (this->lensFlareTimer != 0) { @@ -3186,14 +3181,13 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) { zOffset = (cosf(i * 1.2566371f) * 600.0f); // 5 or 6 light balls that go into the charge. not the same as the ones that he throws - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANON, this->unk_1FC.x + xOffset, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANON, this->unk_1FC.x + xOffset, this->unk_1FC.y, this->unk_1FC.z + zOffset, 0, (s16)(i * 13107.2f) + 0x6000, 0, 0xFA + i); this->unk_274 = 0; } } -s32 BossGanon_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossGanon_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossGanon* this = (BossGanon*)thisx; switch (limbIndex) { @@ -3242,7 +3236,7 @@ s32 BossGanon_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return 0; } -void BossGanon_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossGanon_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static s8 bodyPartLimbMap[] = { -1, -1, 1, -1, 3, 4, 5, -1, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, 2, 12, 13, 14, 9, 10, 11, -1, -1, -1, -1, }; @@ -3266,14 +3260,14 @@ void BossGanon_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } else if (limbIndex == 19) { Matrix_MultVec3f(&D_808E4DB8, &this->actor.focus.pos); } else if (limbIndex == 11) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 7191); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7191); Matrix_MultVec3f(&D_808E4DB8, &this->unk_208); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 7196), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon.c", 7196), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_ganon_DL_00BE90)); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 7198); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7198); } else if (limbIndex == 6) { Matrix_MultVec3f(&D_808E4DC4, &this->unk_238); } else if (limbIndex == 10) { @@ -3341,26 +3335,26 @@ f32 BossGanon_RandZeroOne(void) { return fabsf(randFloat); } -void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawShock(BossGanon* this, PlayState* play) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 7350); if ((this->unk_2E8 != 0) || (this->unk_2E6 != 0)) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gDorfLightBallMaterialDL); if (this->unk_2E8 != 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); for (i = 0; i < PLAYER_BODYPART_MAX; i++) { Matrix_Translate(player->bodyPartsPos[i].x, player->bodyPartsPos[i].y, player->bodyPartsPos[i].z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_49C[i], this->unk_49C[i], this->unk_49C[i], MTXMODE_APPLY); Matrix_RotateZ(Rand_CenteredFloat(M_PI), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 7384), @@ -3370,7 +3364,7 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { } else { for (i = 1; i < 15; i++) { Matrix_Translate(this->unk_2EC[i].x, this->unk_2EC[i].y, this->unk_2EC[i].z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_49C[i], this->unk_49C[i], this->unk_49C[i], MTXMODE_APPLY); if (!this->shockGlow) { @@ -3381,9 +3375,9 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->shockGlow) { - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - (this->unk_1A2 + i) * -15, 32, 64)); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (this->unk_1A2 + i) * -15, 32, 64)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 255, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128); gSPDisplayList(POLY_XLU_DISP++, gDorfShockGlowDL); @@ -3397,15 +3391,15 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_boss_ganon.c", 7465); } -void BossGanon_DrawHandLightBall(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawHandLightBall(BossGanon* this, PlayState* play) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 alpha; OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 7476); if (this->handLightBallScale > 0.0f) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); if ((this->unk_1A2 % 2) != 0) { @@ -3417,7 +3411,7 @@ void BossGanon_DrawHandLightBall(BossGanon* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gDorfLightBallMaterialDL); Matrix_Translate(this->unk_260.x, this->unk_260.y, this->unk_260.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->handLightBallScale, this->handLightBallScale, this->handLightBallScale, MTXMODE_APPLY); Matrix_RotateZ(this->unk_258, 1); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 7510), @@ -3429,7 +3423,7 @@ void BossGanon_DrawHandLightBall(BossGanon* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 155, alpha); Matrix_Translate(this->unk_260.x, 0.0f, this->unk_260.z, MTXMODE_NEW); Matrix_Scale(this->handLightBallScale * 0.75f, 1.0f, this->handLightBallScale * 0.75f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 7531), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon.c", 7531), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDorfLightCoreDL); @@ -3437,25 +3431,25 @@ void BossGanon_DrawHandLightBall(BossGanon* this, GlobalContext* globalCtx) { } } -void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawBigMagicCharge(BossGanon* this, PlayState* play) { s32 pad; f32 yRot; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 7548); if (this->unk_284 > 0.0f) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); // light flecks gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s8)this->unk_290); gDPSetEnvColor(POLY_XLU_DISP++, 200, 255, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk_1A2 * -2, 0, 0x40, 0x40, 1, 0, - this->unk_1A2 * 0xA, 0x40, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->unk_1A2 * -2, 0, 0x40, 0x40, 1, 0, this->unk_1A2 * 0xA, + 0x40, 0x40)); Matrix_Translate(this->unk_278.x, this->unk_278.y, this->unk_278.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_28C, this->unk_28C, this->unk_28C, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 7588), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -3463,20 +3457,19 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { // background circle texture Matrix_Translate(this->unk_278.x, this->unk_278.y, this->unk_278.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_284, this->unk_284, this->unk_284, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 7601), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 100, (s8)this->unk_288); - gSPSegment( - POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, this->unk_1A2 * -4, 0x20, 0x20)); + gSPSegment(POLY_XLU_DISP++, 0x09, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, this->unk_1A2 * -4, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gDorfBigMagicBGCircleDL); // yellow background dot gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 150, 170, 0, (s8)this->unk_288); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, this->unk_1A2 * 2, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, this->unk_1A2 * 2, this->unk_1A2 * -0x14, 0x40, 0x40)); gSPDisplayList(POLY_XLU_DISP++, gDorfDotDL); @@ -3487,7 +3480,7 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { // light ball geometry Matrix_Translate(this->unk_278.x, this->unk_278.y, this->unk_278.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_2D0, this->unk_2D0, this->unk_2D0, MTXMODE_APPLY); Matrix_RotateZ((this->unk_1A2 * 10.0f) / 1000.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 7673), @@ -3522,11 +3515,11 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { } } -void BossGanon_DrawTriforce(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawTriforce(BossGanon* this, PlayState* play) { s32 pad; if (this->fwork[GDF_TRIFORCE_PRIM_A] > 0.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 7732); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7732); Matrix_Push(); @@ -3536,7 +3529,7 @@ void BossGanon_DrawTriforce(BossGanon* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, (u8)this->fwork[GDF_TRIFORCE_ENV_G], 0, 128); if (this->triforceType == GDF_TRIFORCE_PLAYER) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->triforcePos = player->bodyPartsPos[PLAYER_BODYPART_L_HAND]; @@ -3560,31 +3553,31 @@ void BossGanon_DrawTriforce(BossGanon* this, GlobalContext* globalCtx) { Matrix_RotateX(1.1f, 1); Matrix_RotateZ(-0.99999994f, MTXMODE_APPLY); } else { - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); } Matrix_Scale(this->fwork[GDF_TRIFORCE_SCALE], this->fwork[GDF_TRIFORCE_SCALE], 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 7779), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon.c", 7779), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gDorfTriforceDL)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 7782); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7782); } } -void BossGanon_DrawDarkVortex(BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawDarkVortex(BossGanon* this, PlayState* play) { s32 pad; if (this->fwork[GDF_VORTEX_ALPHA] > 0.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 7792); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7792); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk_1A2 * -8, 0, 0x20, 0x40, 1, - this->unk_1A2 * -4, this->unk_1A2 * -8, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->unk_1A2 * -8, 0, 0x20, 0x40, 1, this->unk_1A2 * -4, + this->unk_1A2 * -8, 0x20, 0x20)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 0, 200, (s8)this->fwork[GDF_VORTEX_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 130, 0, 0, 128); @@ -3599,13 +3592,13 @@ void BossGanon_DrawDarkVortex(BossGanon* this, GlobalContext* globalCtx) { Matrix_Scale(this->fwork[GDF_VORTEX_SCALE], this->fwork[GDF_VORTEX_SCALE], this->fwork[GDF_VORTEX_SCALE], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 7841), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon.c", 7841), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gDorfVortexDL)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 7844); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7844); } } @@ -3694,7 +3687,7 @@ void func_808E0254(BossGanon* this, u8* tex, f32 arg2) { } } -void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, PlayState* play) { s16 addY; s16 baseX; s16 baseY; @@ -3754,14 +3747,14 @@ void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, GlobalContext* globalC } } -void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, GlobalContext* globalCtx) { +void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, PlayState* play) { s32 pad; f32 zOffset; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 8372); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 50); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); @@ -3773,7 +3766,7 @@ void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, GlobalContext* glob } Matrix_Scale(0.95000005f, 1.0f, 0.95000005f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 8396), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon.c", 8396), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDorfShadowSetupDL); gDPLoadTextureBlock(POLY_OPA_DISP++, tex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP, @@ -3783,17 +3776,17 @@ void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, GlobalContext* glob CLOSE_DISPS(gfxCtx, "../z_boss_ganon.c", 8426); } -void BossGanon_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon_Draw(Actor* thisx, PlayState* play) { s32 i; BossGanon* this = (BossGanon*)thisx; void* shadowTex; - shadowTex = Graph_Alloc(globalCtx->state.gfxCtx, 64 * 64); + shadowTex = Graph_Alloc(play->state.gfxCtx, 64 * 64); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 9138); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 9138); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if ((this->unk_1A6 & 2) != 0) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 50, 0, 0, 900, 1099); @@ -3801,16 +3794,16 @@ void BossGanon_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gDorfEyeTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossGanon_OverrideLimbDraw, BossGanon_PostLimbDraw, &this->actor); this->unk_2EC[0].x = this->unk_2EC[1].x; this->unk_2EC[0].y = this->unk_2EC[1].y + 30.0f; this->unk_2EC[0].z = this->unk_2EC[1].z; - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); - BossGanon_DrawEffects(globalCtx); + BossGanon_DrawEffects(play); sCape->actor.world.pos = this->actor.world.pos; @@ -3820,20 +3813,20 @@ void BossGanon_Draw(Actor* thisx, GlobalContext* globalCtx) { sCape->rightShoulderPos = this->unk_22C; sCape->leftShoulderPos = this->unk_238; - BossGanon_DrawShock(this, globalCtx); - BossGanon_DrawHandLightBall(this, globalCtx); - BossGanon_DrawBigMagicCharge(this, globalCtx); - BossGanon_DrawTriforce(this, globalCtx); - BossGanon_DrawDarkVortex(this, globalCtx); + BossGanon_DrawShock(this, play); + BossGanon_DrawHandLightBall(this, play); + BossGanon_DrawBigMagicCharge(this, play); + BossGanon_DrawTriforce(this, play); + BossGanon_DrawDarkVortex(this, play); - BossGanon_GenShadowTexture(shadowTex, this, globalCtx); - BossGanon_DrawShadowTexture(shadowTex, this, globalCtx); + BossGanon_GenShadowTexture(shadowTex, this, play); + BossGanon_DrawShadowTexture(shadowTex, this, play); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 9393); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 9393); } -s32 BossGanon_CheckFallingPlatforms(BossGanon* this, GlobalContext* globalCtx, Vec3f* checkPos) { - Actor* prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; +s32 BossGanon_CheckFallingPlatforms(BossGanon* this, PlayState* play, Vec3f* checkPos) { + Actor* prop = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (prop != NULL) { if (((BossGanon*)prop == this) || (prop->id != ACTOR_BG_GANON_OTYUKA)) { @@ -3858,7 +3851,7 @@ s32 BossGanon_CheckFallingPlatforms(BossGanon* this, GlobalContext* globalCtx, V return 0; } -void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { +void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) { u8 hitWithBottle; s16 i; s16 spBA = 0; @@ -3866,7 +3859,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { Vec3f spA0; Vec3f sp94; BossGanon* this = (BossGanon*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 xDistFromLink; f32 yDistFromLink; f32 zDistFromLink; @@ -3874,7 +3867,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { f32 xDistFromGanondorf; f32 yDistFromGanondorf; f32 zDistFromGanondorf; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; BossGanon* ganondorf = (BossGanon*)this->actor.parent; s32 pad1; @@ -3987,8 +3980,8 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { if (sqrtf(SQ(xDistFromLink) + SQ(yDistFromLink) + SQ(zDistFromLink)) <= 25.0f) { spBA = 5; - func_8002F6D4(globalCtx, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x30); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, + func_8002F6D4(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x30); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_HIT_THUNDER); ganondorf->timers[2] = 20; @@ -4031,9 +4024,8 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { case 4: if (sqrtf(SQ(xDistFromGanondorf) + SQ(yDistFromGanondorf) + SQ(zDistFromGanondorf)) < 30.0f) { spBA = 3; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_GANON_DAMAGE1); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, - NA_SE_EN_GANON_HIT_THUNDER); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_DAMAGE1); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_HIT_THUNDER); } break; @@ -4048,7 +4040,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { Collider_UpdateCylinder(&this->actor, &this->collider); if (this->timers[1] == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } for (i = 0; i < 2; i++) { @@ -4061,11 +4053,11 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { sp94.y = Rand_CenteredFloat(30.0f) + this->actor.world.pos.y; sp94.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; - BossGanonEff_SpawnSparkle(globalCtx, &sp94, &spAC, &spA0, Rand_ZeroFloat(500.0f) + 700.0f, 0x1E); + BossGanonEff_SpawnSparkle(play, &sp94, &spAC, &spA0, Rand_ZeroFloat(500.0f) + 700.0f, 0x1E); } if (this->actor.world.pos.y < 10.0f) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2); } if ((fabsf(this->actor.world.pos.x) > 465.0f) || (this->actor.world.pos.y > 500.0f) || @@ -4089,7 +4081,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { sp54 = 15.0f; phi_f20 = 30.0f; sp4E = 70; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EN_GANON_HIT_THUNDER); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EN_GANON_HIT_THUNDER); } for (i = 0; i < sp4E; i++) { @@ -4103,20 +4095,20 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { spAC.z = Rand_CenteredFloat(phi_f20); } - BossGanonEff_SpawnLightRay(globalCtx, &this->actor.world.pos, &spAC, &sZeroVec, sp58, sp54, 0x1E); + BossGanonEff_SpawnLightRay(play, &this->actor.world.pos, &spAC, &sZeroVec, sp58, sp54, 0x1E); } if (spBA != 1) { this->unk_1A8 = 1; if (spBA == 0) { - BossGanon_CheckFallingPlatforms(this, globalCtx, &this->actor.world.pos); + BossGanon_CheckFallingPlatforms(this, play, &this->actor.world.pos); } if (spBA == 3) { - BossGanon_SetupHitByLightBall(ganondorf, globalCtx); + BossGanon_SetupHitByLightBall(ganondorf, play); } else if (ganondorf->actionFunc == BossGanon_PlayTennis) { - BossGanon_SetupWait(ganondorf, globalCtx); + BossGanon_SetupWait(ganondorf, play); if (spBA == 5) { ganondorf->timers[0] = 125; @@ -4127,15 +4119,15 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon_LightBall_Draw(Actor* thisx, PlayState* play) { BossGanon* this = (BossGanon*)thisx; s16 i; f32 alpha; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 9849); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 9849); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); alpha = ((this->unk_1A2 % 2) != 0) ? this->fwork[GDF_FWORK_1] * 0.4f : this->fwork[GDF_FWORK_1] * 0.35f; @@ -4143,7 +4135,7 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->actor.scale.x * 0.75f, 1.0f, this->actor.scale.z * 0.75f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 9875), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon.c", 9875), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDorfLightCoreDL); @@ -4159,27 +4151,27 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); Matrix_RotateY(i * (M_PI / 8), MTXMODE_APPLY); Matrix_RotateZ(this->fwork[GDF_FWORK_0], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 9899), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon.c", 9899), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDorfSquareDL); Matrix_Pop(); } } else if (this->unk_1A8 == 0) { - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ((this->actor.shape.rot.z / 32768.0f) * 3.1416f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 9907), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon.c", 9907), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDorfSquareDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 9911); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 9911); } -void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx2) { +void func_808E1EB4(Actor* thisx, PlayState* play2) { s16 i; BossGanon* this = (BossGanon*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; BossGanon* dorf = (BossGanon*)this->actor.parent; f32 xDiff; f32 yDiff; @@ -4248,8 +4240,8 @@ void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx2) { accel.y = vel.y * -0.03f; accel.z = vel.z * -0.03f; - BossGanonEff_SpawnLightRay(globalCtx, &dorf->unk_1FC, &vel, &accel, - Rand_ZeroFloat(500.0f) + 1000.0f, 15.0f, 0x14); + BossGanonEff_SpawnLightRay(play, &dorf->unk_1FC, &vel, &accel, Rand_ZeroFloat(500.0f) + 1000.0f, + 15.0f, 0x14); } for (i = 1; i < 15; i++) { @@ -4263,7 +4255,7 @@ void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx2) { dorf->lensFlareMode = 1; dorf->unk_508 = 10.0f; - Actor_SpawnAsChild(&globalCtx->actorCtx, &dorf->actor, globalCtx, ACTOR_BOSS_GANON, dorf->unk_1FC.x, + Actor_SpawnAsChild(&play->actorCtx, &dorf->actor, play, ACTOR_BOSS_GANON, dorf->unk_1FC.x, dorf->unk_1FC.y, dorf->unk_1FC.z, 0, 0, 0, 0x12C); } @@ -4274,14 +4266,14 @@ void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx2) { } } -void func_808E229C(Actor* thisx, GlobalContext* globalCtx2) { +void func_808E229C(Actor* thisx, PlayState* play2) { BossGanon* this = (BossGanon*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s16 i; s32 temp; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 10081); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 10081); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gDorfLightBallMaterialDL); @@ -4291,17 +4283,17 @@ void func_808E229C(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Translate(this->unk_2EC[temp].x, this->unk_2EC[temp].y, this->unk_2EC[temp].z, MTXMODE_NEW); Matrix_Scale(this->actor.scale.x * (1.0f - (i * 0.07000001f)), this->actor.scale.y * (1.0f - (i * 0.07000001f)), this->actor.scale.z * (1.0f - (i * 0.07000001f)), MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ(((2.0f * (i * M_PI)) / 10.0f) + BINANG_TO_RAD_ALT(this->actor.shape.rot.z), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 10109), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon.c", 10109), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDorfSquareDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 10113); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 10113); } -void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { +void func_808E2544(Actor* thisx, PlayState* play) { u8 numEffects = 0; s16 xRot; f32 xDiff; @@ -4315,7 +4307,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { BossGanon* this = (BossGanon*)thisx; BossGanon* dorf = (BossGanon*)this->actor.parent; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); ColliderInfo* acHitInfo; Vec3f sp60; @@ -4430,7 +4422,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { this->collider.base.acFlags &= ~2; - if (!(acHitInfo->toucher.dmgFlags & 0x100000) || Player_HasMirrorShieldEquipped(globalCtx)) { + if (!(acHitInfo->toucher.dmgFlags & 0x100000) || Player_HasMirrorShieldEquipped(play)) { func_800AA000(this->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64); this->unk_1C2 = 0xC; this->actor.speedXZ = -30.0f; @@ -4454,7 +4446,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider); if (this->timers[1] == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } xDiff = player->actor.world.pos.x - this->actor.world.pos.x; @@ -4466,9 +4458,8 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; if (dorf->timers[2] == 0) { - func_8002F6D4(globalCtx, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x50); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, - NA_SE_EN_GANON_HIT_THUNDER); + func_8002F6D4(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x50); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_HIT_THUNDER); dorf->timers[2] = 20; for (i = 0; i < ARRAY_COUNT(this->unk_4E4); i++) { @@ -4511,7 +4502,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { zDiff = dorf->unk_1FC.z - this->actor.world.pos.z; if (sqrtf(SQ(xDiff) + SQ(zDiff) + SQ(yDiff)) < 45.0f) { - BossGanon_SetupHitByLightBall(dorf, globalCtx); + BossGanon_SetupHitByLightBall(dorf, play); this->timers[0] = 150; numEffects = 40; this->unk_1C2 = 1; @@ -4529,22 +4520,22 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) { this->unk_1C2 = 1; this->actor.speedXZ = 0.0f; numEffects = 10; - BossGanon_CheckFallingPlatforms(this, globalCtx, &this->actor.world.pos); - Actor_SpawnAsChild(&globalCtx->actorCtx, &dorf->actor, globalCtx, ACTOR_BOSS_GANON, this->actor.world.pos.x, + BossGanon_CheckFallingPlatforms(this, play, &this->actor.world.pos); + Actor_SpawnAsChild(&play->actorCtx, &dorf->actor, play, ACTOR_BOSS_GANON, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x190); } } if (numEffects) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EN_FANTOM_THUNDER); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EN_FANTOM_THUNDER); for (i = 0; i < numEffects; i++) { sp60.x = Rand_CenteredFloat(30.0f); sp60.y = Rand_CenteredFloat(30.0f); sp60.z = Rand_CenteredFloat(30.0); - BossGanonEff_SpawnLightRay(globalCtx, &this->actor.world.pos, &sp60, &sZeroVec, - Rand_ZeroFloat(200.0f) + 500.0f, 15.0f, 0x1E); + BossGanonEff_SpawnLightRay(play, &this->actor.world.pos, &sp60, &sZeroVec, Rand_ZeroFloat(200.0f) + 500.0f, + 15.0f, 0x1E); } } } @@ -4555,17 +4546,17 @@ static Gfx* sBigMagicLightStreakDLists[] = { gDorfLightStreak4DL, gDorfLightStreak3DL, gDorfLightStreak2DL, gDorfLightStreak1DL, }; -void func_808E324C(Actor* thisx, GlobalContext* globalCtx) { +void func_808E324C(Actor* thisx, PlayState* play) { BossGanon* this = (BossGanon*)thisx; Mtx* mtx; s16 i; s32 temp; - mtx = Graph_Alloc(globalCtx->state.gfxCtx, 12 * sizeof(Mtx)); + mtx = Graph_Alloc(play->state.gfxCtx, 12 * sizeof(Mtx)); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 10489); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 10489); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, (s8)this->fwork[GDF_FWORK_1]); gDPSetEnvColor(POLY_XLU_DISP++, 150, 255, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x0D, mtx); @@ -4584,21 +4575,21 @@ void func_808E324C(Actor* thisx, GlobalContext* globalCtx) { }; Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(10.0f, 10.0f, 10.0f, MTXMODE_APPLY); Matrix_RotateZ(Rand_CenteredFloat(M_PI), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 10534), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon.c", 10534), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDorfLightBallMaterialDL); gSPDisplayList(POLY_XLU_DISP++, gDorfSquareDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 10541); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 10541); } -void BossGanon_UpdateEffects(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - GanondorfEffect* eff = globalCtx->specialEffects; +void BossGanon_UpdateEffects(PlayState* play) { + Player* player = GET_PLAYER(play); + GanondorfEffect* eff = play->specialEffects; s16 i; s32 pad; f32 xDiff; @@ -4709,7 +4700,7 @@ void BossGanon_UpdateEffects(GlobalContext* globalCtx) { } } else if (eff->type == GDF_EFF_LIGHTNING) { if (eff->unk_3C == 0.0f) { - eff->unk_44 = BINANG_TO_RAD_ALT(Camera_GetInputDirYaw(Play_GetCamera(globalCtx, CAM_ID_MAIN))); + eff->unk_44 = BINANG_TO_RAD_ALT(Camera_GetInputDirYaw(Play_GetCamera(play, CAM_ID_MAIN))); } else { eff->unk_44 = M_PI / 2; } @@ -4786,8 +4777,7 @@ void BossGanon_UpdateEffects(GlobalContext* globalCtx) { if (((eff->scale * 150.0f) < distToPlayer) && (distToPlayer < (eff->scale * 300.0f))) { eff->timer = 150; - func_8002F6D4(globalCtx, &sGanondorf->actor, 7.0f, sGanondorf->actor.yawTowardsPlayer, 0.0f, - 0x20); + func_8002F6D4(play, &sGanondorf->actor, 7.0f, sGanondorf->actor.yawTowardsPlayer, 0.0f, 0x20); } } } @@ -4812,16 +4802,16 @@ static u8 sLightningEnvColors[] = { 100, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -void BossGanon_DrawEffects(GlobalContext* globalCtx) { +void BossGanon_DrawEffects(PlayState* play) { u8 materialFlag = 0; s16 i; s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - GanondorfEffect* eff = globalCtx->specialEffects; + GraphicsContext* gfxCtx = play->state.gfxCtx; + GanondorfEffect* eff = play->specialEffects; GanondorfEffect* effFirst = eff; OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 10865); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < 200; i++, eff++) { if (eff->type == GDF_EFF_WINDOW_SHARD) { @@ -4858,7 +4848,7 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { } gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, eff->alpha); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(eff->unk_3C, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 10932), @@ -4947,7 +4937,7 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, eff->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 100, 70, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, eff->timer * 4, 0, 32, 64, 1, eff->timer * 2, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, eff->timer * 4, 0, 32, 64, 1, eff->timer * 2, eff->timer * -20, 32, 32)); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); Matrix_Scale(eff->scale, eff->unk_40 * eff->scale, eff->scale, MTXMODE_APPLY); @@ -4965,7 +4955,7 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, eff->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 200, 100, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, eff->timer * 4, 0, 32, 64, 1, eff->timer * 2, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, eff->timer * 4, 0, 32, 64, 1, eff->timer * 2, eff->timer * -20, 32, 32)); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); Matrix_Scale(eff->scale, eff->unk_40 * eff->scale, eff->scale, MTXMODE_APPLY); @@ -4983,8 +4973,8 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, eff->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 150, 255, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (eff->timer * 100), 0, 64, 32, 1, - (eff->timer * 100), 0, 64, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (eff->timer * 100), 0, 64, 32, 1, (eff->timer * 100), 0, + 64, 32)); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); Matrix_Scale((eff->scale * 200.0f) / 1500.0f, (eff->unk_40 * 200.0f) / 1500.0f, (eff->scale * 200.0f) / 1500.0f, MTXMODE_APPLY); @@ -5001,11 +4991,11 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 150, 170, 0, eff->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); - gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, eff->timer * 2, eff->timer * -20, - 64, 64)); + gSPSegment( + POLY_XLU_DISP++, 0x0A, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, eff->timer * 2, eff->timer * -20, 64, 64)); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 11250), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h index ac92413973..4884942f63 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h @@ -6,7 +6,7 @@ struct BossGanon; -typedef void (*BossGanonActionFunc)(struct BossGanon*, GlobalContext*); +typedef void (*BossGanonActionFunc)(struct BossGanon*, PlayState*); typedef enum { /* 0 */ GDF_FWORK_0, 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 de3dac083b..3a43448ce8 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -8,28 +8,28 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void BossGanon2_Init(Actor* thisx, GlobalContext* globalCtx); -void BossGanon2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx); -void BossGanon2_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossGanon2_Init(Actor* thisx, PlayState* play); +void BossGanon2_Destroy(Actor* thisx, PlayState* play); +void BossGanon2_Update(Actor* thisx, PlayState* play); +void BossGanon2_Draw(Actor* thisx, PlayState* play); -void func_808FD5C4(BossGanon2* this, GlobalContext* globalCtx); -void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx); -void func_808FFDB0(BossGanon2* this, GlobalContext* globalCtx); -void func_808FFEBC(BossGanon2* this, GlobalContext* globalCtx); -void func_808FFFE0(BossGanon2* this, GlobalContext* globalCtx); -void func_80900104(BossGanon2* this, GlobalContext* globalCtx); -void func_8090026C(BossGanon2* this, GlobalContext* globalCtx); -void func_809002CC(BossGanon2* this, GlobalContext* globalCtx); -void func_80900344(BossGanon2* this, GlobalContext* globalCtx); -void func_80900580(BossGanon2* this, GlobalContext* globalCtx); -void func_80900650(BossGanon2* this, GlobalContext* globalCtx); -void func_80900890(BossGanon2* this, GlobalContext* globalCtx); -void func_8090120C(BossGanon2* this, GlobalContext* globalCtx); -void BossGanon2_UpdateEffects(BossGanon2* this, GlobalContext* globalCtx); -void BossGanon2_DrawEffects(GlobalContext* globalCtx); -void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, GlobalContext* globalCtx); -void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, GlobalContext* globalCtx); +void func_808FD5C4(BossGanon2* this, PlayState* play); +void func_808FD5F4(BossGanon2* this, PlayState* play); +void func_808FFDB0(BossGanon2* this, PlayState* play); +void func_808FFEBC(BossGanon2* this, PlayState* play); +void func_808FFFE0(BossGanon2* this, PlayState* play); +void func_80900104(BossGanon2* this, PlayState* play); +void func_8090026C(BossGanon2* this, PlayState* play); +void func_809002CC(BossGanon2* this, PlayState* play); +void func_80900344(BossGanon2* this, PlayState* play); +void func_80900580(BossGanon2* this, PlayState* play); +void func_80900650(BossGanon2* this, PlayState* play); +void func_80900890(BossGanon2* this, PlayState* play); +void func_8090120C(BossGanon2* this, PlayState* play); +void BossGanon2_UpdateEffects(BossGanon2* this, PlayState* play); +void BossGanon2_DrawEffects(PlayState* play); +void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, PlayState* play); +void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, PlayState* play); const ActorInit Boss_Ganon2_InitVars = { ACTOR_BOSS_GANON2, @@ -75,24 +75,24 @@ void func_808FD080(s32 idx, ColliderJntSph* collider, Vec3f* arg2) { collider->elements[idx].dim.modelSphere.radius * collider->elements[idx].dim.scale; } -void BossGanon2_SetObjectSegment(BossGanon2* this, GlobalContext* globalCtx, s32 objectId, u8 setRSPSegment) { +void BossGanon2_SetObjectSegment(BossGanon2* this, PlayState* play, s32 objectId, u8 setRSPSegment) { s32 pad; - s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, objectId); + s32 objectIdx = Object_GetIndex(&play->objectCtx, objectId); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objectIdx].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIdx].segment); if (setRSPSegment) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 790); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 790); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objectIdx].segment); - gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[objectIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIdx].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[objectIdx].segment); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 799); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 799); } } -void func_808FD210(GlobalContext* globalCtx, Vec3f* arg1) { - BossGanon2Effect* effects = globalCtx->specialEffects; +void func_808FD210(PlayState* play, Vec3f* arg1) { + BossGanon2Effect* effects = play->specialEffects; effects[0].type = 1; effects[0].position = *arg1; @@ -106,8 +106,8 @@ void func_808FD210(GlobalContext* globalCtx, Vec3f* arg1) { effects[0].accel.z = 0.0f; } -void func_808FD27C(GlobalContext* globalCtx, Vec3f* position, Vec3f* velocity, f32 scale) { - BossGanon2Effect* effect = globalCtx->specialEffects; +void func_808FD27C(PlayState* play, Vec3f* position, Vec3f* velocity, f32 scale) { + BossGanon2Effect* effect = play->specialEffects; s16 i; for (i = 0; i < BOSS_GANON2_EFFECT_COUNT; i++, effect++) { @@ -127,12 +127,12 @@ void func_808FD27C(GlobalContext* globalCtx, Vec3f* position, Vec3f* velocity, f } } -void BossGanon2_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon2_Init(Actor* thisx, PlayState* play) { BossGanon2* this = (BossGanon2*)thisx; s32 pad; s16 i; - globalCtx->specialEffects = sEffects; + play->specialEffects = sEffects; for (i = 0; i < BOSS_GANON2_EFFECT_COUNT; i++) { sEffects[i].type = 0; @@ -140,45 +140,45 @@ void BossGanon2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.health = 30; - Collider_InitJntSph(globalCtx, &this->unk_424); - Collider_SetJntSph(globalCtx, &this->unk_424, &this->actor, &sJntSphInit1, this->unk_464); - Collider_InitJntSph(globalCtx, &this->unk_444); - Collider_SetJntSph(globalCtx, &this->unk_444, &this->actor, &sJntSphInit2, this->unk_864); - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON, false); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDorfSkel, NULL, NULL, NULL, 0); - func_808FD5C4(this, globalCtx); + Collider_InitJntSph(play, &this->unk_424); + Collider_SetJntSph(play, &this->unk_424, &this->actor, &sJntSphInit1, this->unk_464); + Collider_InitJntSph(play, &this->unk_444); + Collider_SetJntSph(play, &this->unk_444, &this->actor, &sJntSphInit2, this->unk_864); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON, false); + SkelAnime_InitFlex(play, &this->skelAnime, &gDorfSkel, NULL, NULL, NULL, 0); + func_808FD5C4(this, play); this->actor.naviEnemyId = NAVI_ENEMY_GANON; this->actor.gravity = 0.0f; } -void BossGanon2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon2_Destroy(Actor* thisx, PlayState* play) { BossGanon2* this = (BossGanon2*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->unk_424); - Collider_DestroyJntSph(globalCtx, &this->unk_444); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyJntSph(play, &this->unk_424); + Collider_DestroyJntSph(play, &this->unk_444); } -void func_808FD4D4(BossGanon2* this, GlobalContext* globalCtx, s16 arg2, s16 arg3) { +void func_808FD4D4(BossGanon2* this, PlayState* play, s16 arg2, s16 arg3) { if ((arg2 == 0) || (arg2 == 1)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_1D0, 25.0f, arg3, 8.0f, 500, 10, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk_1D0, 25.0f, arg3, 8.0f, 500, 10, true); } if ((arg2 == 0) || (arg2 == 2)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->unk_1DC, 25.0f, arg3, 8.0f, 500, 10, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk_1DC, 25.0f, arg3, 8.0f, 500, 10, true); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_WALK); - func_80033E88(&this->actor, globalCtx, 2, 0xA); + func_80033E88(&this->actor, play, 2, 0xA); } -void func_808FD5C4(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FD5C4(BossGanon2* this, PlayState* play) { this->actionFunc = func_808FD5F4; this->actor.flags &= ~ACTOR_FLAG_0; this->actor.world.pos.y = -3000.0f; } -void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FD5F4(BossGanon2* this, PlayState* play) { s16 pad; u8 sp8D; Player* player; @@ -187,21 +187,21 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { s32 pad2; sp8D = false; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->unk_398++; switch (this->unk_39C) { case 0: - objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON_ANIME3); - if (Object_IsLoaded(&globalCtx->objectCtx, objectIdx)) { - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME3); + if (Object_IsLoaded(&play->objectCtx, objectIdx)) { + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->unk_39C = 1; - sZelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 970.0f, - 1086.0f, -200.0f, 0, 0, 0, 1); + sZelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 970.0f, 1086.0f, + -200.0f, 0, 0, 0, 1); sZelda->unk_3C8 = 0; sZelda->actor.world.pos.x = 970.0f; sZelda->actor.world.pos.y = 1086.0f; @@ -219,7 +219,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { player->actor.world.pos.z = -186.0f; player->actor.shape.rot.y = -0x5000; Animation_MorphToLoop(&this->skelAnime, &object_ganon_anime3_Anim_002168, 0.0f); - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; // fake, tricks the compiler into allocating more stack if (zero) { this->subCamEye.x *= 2.0; @@ -229,7 +229,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { } case 1: if (this->unk_398 < 70) { - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; } this->unk_339 = 3; Math_ApproachF(&this->subCamEye.x, 1500.0f, 0.1f, this->unk_410.x * 1500.0f); @@ -239,13 +239,13 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->subCamAt.y = 1086.0f; this->subCamAt.z = -200.0f; if (this->unk_398 == 150) { - Message_StartTextbox(globalCtx, 0x70D3, NULL); + Message_StartTextbox(play, 0x70D3, NULL); } - if (this->unk_398 > 250 && Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { + if (this->unk_398 > 250 && Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { this->unk_39C = 2; this->unk_398 = 0; this->unk_410.x = 0.0f; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; } else { break; } @@ -260,15 +260,15 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { player->actor.shape.rot.y = -0x5000; sZelda->actor.shape.rot.y = -0x5000; if (this->unk_398 == 60) { - Message_StartTextbox(globalCtx, 0x70D4, NULL); + Message_StartTextbox(play, 0x70D4, NULL); } if (this->unk_398 == 40) { sZelda->unk_3C8 = 1; - func_8002DF54(globalCtx, &this->actor, 0x4E); + func_8002DF54(play, &this->actor, 0x4E); } if (this->unk_398 == 85) { sZelda->unk_3C8 = 2; - func_8002DF54(globalCtx, &this->actor, 0x4F); + func_8002DF54(play, &this->actor, 0x4F); } this->subCamEye.x = 930.0f; this->subCamEye.y = 1129.0f; @@ -282,7 +282,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { } else { this->subCamAt.y = player->actor.world.pos.y + 47.0f + 7.0f; } - if ((this->unk_398 > 170) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->unk_398 > 170) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->unk_39C = 3; this->unk_398 = 0; this->unk_410.x = 0.0f; @@ -297,14 +297,14 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { } if (this->unk_398 == 20) { sZelda->unk_3C8 = 3; - func_8002DF54(globalCtx, &this->actor, 0x50); + func_8002DF54(play, &this->actor, 0x50); } if (this->unk_398 == 55) { this->unk_39C = 4; this->unk_398 = 0; this->unk_410.x = 0.0f; sZelda->unk_3C8 = 4; - func_8002DF54(globalCtx, &this->actor, 0x50); + func_8002DF54(play, &this->actor, 0x50); } break; case 4: @@ -313,15 +313,15 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamEye.z, -20.0f, 0.1f, this->unk_410.x * 170.0f); Math_ApproachF(&this->unk_410.x, 0.04f, 1.0f, 0.0005f); if (this->unk_398 == 100) { - Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); camera->eye = this->subCamEye; camera->eyeNext = this->subCamEye; camera->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->unk_39C = 5; this->unk_398 = 0; } @@ -329,13 +329,13 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { case 5: this->unk_339 = 4; if (this->actor.xzDistToPlayer < 500.0f) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->unk_39C = 10; this->unk_398 = 0; - func_80064520(globalCtx, &globalCtx->csCtx); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); } else { break; } @@ -360,14 +360,14 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_339 = 5; if (this->unk_398 == 20) { this->unk_33C = 0.0f; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; } } else { this->unk_339 = 4; } if (this->unk_398 == 30) { sZelda->unk_3C8 = 5; - func_8002DF54(globalCtx, &this->actor, 0x51); + func_8002DF54(play, &this->actor, 0x51); } if (this->unk_398 == 50) { this->unk_398 = 0; @@ -398,7 +398,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { func_80078884(NA_SE_EV_STONE_BOUND); } if (this->unk_398 == 30) { - func_8002DF54(globalCtx, &this->actor, 0x52); + func_8002DF54(play, &this->actor, 0x52); } if (this->unk_398 == 50) { this->unk_398 = 0; @@ -414,8 +414,8 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->subCamEye.z = -200.0f; this->subCamAt.x = this->subCamAt.z = -200.0f; this->subCamAt.y = this->actor.world.pos.y + 70.0f; - globalCtx->envCtx.lightBlend = 0.0f; - globalCtx->envCtx.prevLightSetting = globalCtx->envCtx.lightSetting = 0; + play->envCtx.lightBlend = 0.0f; + play->envCtx.prevLightSetting = play->envCtx.lightSetting = 0; this->unk_339 = 0; } else { break; @@ -463,7 +463,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->subCamAt.y = player->actor.world.pos.y; this->subCamAt.z = player->actor.world.pos.z - 200.0f; if (this->unk_398 == 20) { - func_8002DF54(globalCtx, &this->actor, 0x1E); + func_8002DF54(play, &this->actor, 0x1E); } if (this->unk_398 == 60) { this->subCamEye.x = (this->actor.world.pos.x + 200.0f) - 154.0f; @@ -476,12 +476,12 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->subCamAt.z = this->actor.world.pos.z + 5.0f; this->subCamAt.x = this->actor.world.pos.x; } - if ((globalCtx->gameplayFrames % 32) == 0) { + if ((play->gameplayFrames % 32) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_BREATH); } break; case 15: - if (((globalCtx->gameplayFrames % 32) == 0) && (this->unk_398 < 100)) { + if (((play->gameplayFrames % 32) == 0) && (this->unk_398 < 100)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_BREATH); } SkelAnime_Update(&this->skelAnime); @@ -506,7 +506,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime3_Anim_003754, 0.0f); this->unk_194 = Animation_GetLastFrame(&object_ganon_anime3_Anim_003754); this->unk_339 = 55; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_CASBREAK); } else { break; @@ -539,7 +539,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { sp8D = true; } if (this->unk_398 >= 60) { - Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); camera->eye = this->subCamEye; camera->eyeNext = this->subCamEye; @@ -547,11 +547,11 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_39C = 17; this->unk_398 = 0; this->unk_337 = 2; - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON2, false); - SkelAnime_Free(&this->skelAnime, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ganon2_Skel_025970, NULL, NULL, NULL, 0); - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON_ANIME3, false); - func_8002DF54(globalCtx, &this->actor, 0x54); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON2, false); + SkelAnime_Free(&this->skelAnime, play); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ganon2_Skel_025970, NULL, NULL, NULL, 0); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON_ANIME3, false); + func_8002DF54(play, &this->actor, 0x54); this->unk_314 = 3; } // fake, tricks the compiler into using stack the way we need it to @@ -607,7 +607,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->actor.world.pos.x += 250; this->actor.world.pos.y = 1886.0f; this->unk_394 = 0.0f; - func_8002DF54(globalCtx, &this->actor, 0x53); + func_8002DF54(play, &this->actor, 0x53); this->unk_30C = 5.0f; this->unk_228 = 1.0f; } @@ -635,14 +635,14 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_420 = 10.0f; this->actor.velocity.y = 0.0f; Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime3_Anim_010380, 0.0f); - func_808FD4D4(this, globalCtx, 0, 3); + func_808FD4D4(this, play, 0, 3); func_800A9F6C(0.0f, 0xC8, 0x14, 0x14); } break; case 21: this->unk_339 = 6; SkelAnime_Update(&this->skelAnime); - this->unk_41C = Math_CosS(globalCtx->gameplayFrames * 0x8000) * this->unk_420; + this->unk_41C = Math_CosS(play->gameplayFrames * 0x8000) * this->unk_420; Math_ApproachZeroF(&this->unk_420, 1.0f, 0.75f); if (this->unk_398 == 30) { this->unk_39C = 22; @@ -665,9 +665,9 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_336 = 2; } if (this->unk_398 == 80) { - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON2, false); - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, - SEGMENTED_TO_VIRTUAL(object_ganon2_Tex_021A90), 160, 180, 128, 40); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON2, false); + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(object_ganon2_Tex_021A90), + 160, 180, 128, 40); } this->subCamEye.x = ((this->actor.world.pos.x + 500.0f) - 350.0f) + 100.0f; this->subCamEye.y = this->actor.world.pos.y; @@ -691,7 +691,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { if (this->unk_398 == 215) { this->unk_39C = 23; this->unk_224 = 0.0f; - func_8002DF54(globalCtx, &this->actor, 0x55); + func_8002DF54(play, &this->actor, 0x55); } break; case 23: @@ -711,25 +711,25 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 == 228) { func_80078884(NA_SE_IT_SHIELD_REFLECT_SW); - func_8002DF54(globalCtx, &this->actor, 0x56); + func_8002DF54(play, &this->actor, 0x56); func_800A9F6C(0.0f, 0xFF, 0xA, 0x32); } if (this->unk_398 >= 229) { - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = - globalCtx->envCtx.screenFillColor[2] = 255; - globalCtx->envCtx.screenFillColor[3] = 100; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = play->envCtx.screenFillColor[2] = + 255; + play->envCtx.screenFillColor[3] = 100; if (this->unk_398 == 234) { Vec3f sp68; - globalCtx->envCtx.fillScreen = false; + play->envCtx.fillScreen = false; this->unk_39C = 24; this->unk_398 = 0; sp68 = player->actor.world.pos; sp68.y += 60.0f; - func_808FD210(globalCtx, &sp68); - globalCtx->envCtx.lightBlend = 0.0f; - globalCtx->envCtx.prevLightSetting = 0; + func_808FD210(play, &sp68); + play->envCtx.lightBlend = 0.0f; + play->envCtx.prevLightSetting = 0; this->unk_339 = 0; } } @@ -737,7 +737,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { case 24: SkelAnime_Update(&this->skelAnime); if (1) { - BossGanon2Effect* effects = globalCtx->specialEffects; + BossGanon2Effect* effects = play->specialEffects; this->subCamAt = effects[0].position; this->subCamEye.x = effects[0].position.x + 70.0f; @@ -748,7 +748,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { func_80078884(NA_SE_IT_SWORD_SWING); } if (this->unk_398 == 25) { - func_8002DF54(globalCtx, &this->actor, 0x57); + func_8002DF54(play, &this->actor, 0x57); this->unk_39C = 25; this->unk_398 = 0; } @@ -762,7 +762,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->subCamAt.y = ((player->actor.world.pos.y + 10.0f + 60.0f) - 20.0f) - 3.0f; this->subCamAt.z = (player->actor.world.pos.z - 40.0f) - 10.0f; if (this->unk_398 == 10) { - BossGanon2Effect* effects = globalCtx->specialEffects; + BossGanon2Effect* effects = play->specialEffects; effects[0].unk_2E = 1; effects[0].position.x = sZelda->actor.world.pos.x + 50.0f + 10.0f; @@ -795,7 +795,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { case 27: this->subCamUp.z = 0.0f; if (this->unk_398 == 4) { - func_8002DF54(globalCtx, &this->actor, 0x58); + func_8002DF54(play, &this->actor, 0x58); } this->subCamEye.x = player->actor.world.pos.x - 20.0f; this->subCamEye.y = player->actor.world.pos.y + 50.0f; @@ -804,7 +804,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->subCamAt.y = player->actor.world.pos.y + 50.0f; this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 == 26) { - D_8090EB30 = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + D_8090EB30 = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (D_8090EB30 != NULL) { if (D_8090EB30->id == ACTOR_EN_ELF) { this->subCamEye.x = D_8090EB30->world.pos.x - 30.0f; @@ -823,7 +823,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { break; case 28: if (this->unk_398 == 5) { - Message_StartTextbox(globalCtx, 0x70D6, NULL); + Message_StartTextbox(play, 0x70D6, NULL); } if (D_8090EB30 != NULL) { this->subCamEye.x = D_8090EB30->world.pos.x - 20.0f; @@ -832,7 +832,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamAt.x, D_8090EB30->world.pos.x, 0.2f, 50.0f); Math_ApproachF(&this->subCamAt.y, D_8090EB30->world.pos.y, 0.2f, 50.0f); Math_ApproachF(&this->subCamAt.z, D_8090EB30->world.pos.z, 0.2f, 50.0f); - if ((this->unk_398 > 40) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->unk_398 > 40) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->unk_39C = 29; this->unk_398 = 0; Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime3_Anim_0147E0, 0.0f); @@ -860,18 +860,18 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_ROAR); } if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { - Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); camera->eye = this->subCamEye; camera->eyeNext = this->subCamEye; camera->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->unk_39C = 0; this->unk_337 = 1; - func_808FFDB0(this, globalCtx); + func_808FFDB0(this, play); this->unk_1A2[1] = 50; this->actor.flags |= ACTOR_FLAG_0; sZelda->unk_3C8 = 7; @@ -889,13 +889,13 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { osSyncPrintf(NULL, 0, 0); } this->subCamAt.y += this->unk_41C; - Play_CameraSetAtEyeUp(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); + Play_CameraSetAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); } } -void func_808FF898(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FF898(BossGanon2* this, PlayState* play) { if ((this->unk_312 != 0) && (this->subCamId == SUB_CAM_ID_DONE)) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + Actor* actor = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (actor != NULL) { if (actor->id == ACTOR_DEMO_GJ) { @@ -935,8 +935,8 @@ void func_808FF898(BossGanon2* this, GlobalContext* globalCtx) { } } -s32 func_808FFA24(BossGanon2* this, GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; +s32 func_808FFA24(BossGanon2* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (actor != NULL) { if (actor->id == ACTOR_DEMO_GJ) { @@ -958,7 +958,7 @@ s32 func_808FFA24(BossGanon2* this, GlobalContext* globalCtx) { return false; } -void func_808FFAC8(BossGanon2* this, GlobalContext* globalCtx, u8 arg2) { +void func_808FFAC8(BossGanon2* this, PlayState* play, u8 arg2) { s16 temp_v1; s16 phi_a1; @@ -985,7 +985,7 @@ void func_808FFAC8(BossGanon2* this, GlobalContext* globalCtx, u8 arg2) { Math_ApproachS(&this->unk_31C, temp_v1, 5, 0x7D0); } -void func_808FFBBC(BossGanon2* this, GlobalContext* globalCtx, u8 arg2) { +void func_808FFBBC(BossGanon2* this, PlayState* play, u8 arg2) { if (arg2 != 0 || this->unk_313) { f32 phi_f0; f32 phi_f2; @@ -1016,25 +1016,25 @@ void func_808FFC84(BossGanon2* this) { } } -void func_808FFCFC(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FFCFC(BossGanon2* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f && ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x2800) { this->unk_311 = false; - func_80900580(this, globalCtx); + func_80900580(this, play); Audio_StopSfxById(NA_SE_EN_MGANON_UNARI); - } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && func_808FFA24(this, globalCtx)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && func_808FFA24(this, play)) { this->unk_311 = false; - func_80900580(this, globalCtx); + func_80900580(this, play); Audio_StopSfxById(NA_SE_EN_MGANON_UNARI); } } -void func_808FFDB0(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FFDB0(BossGanon2* this, PlayState* play) { s32 sp28; - s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GANON2); + s32 objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GANON2); - if (Object_IsLoaded(&globalCtx->objectCtx, objectIdx)) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objectIdx].segment); + if (Object_IsLoaded(&play->objectCtx, objectIdx)) { + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIdx].segment); Animation_MorphToLoop(&this->skelAnime, &object_ganon2_Anim_00FFE4, -10.0f); this->actionFunc = func_808FFEBC; @@ -1053,7 +1053,7 @@ void func_808FFDB0(BossGanon2* this, GlobalContext* globalCtx) { } } -void func_808FFEBC(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FFEBC(BossGanon2* this, PlayState* play) { if (this->unk_390 == 0) { this->unk_390 = (s16)Rand_ZeroFloat(50.0f) + 30; Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_UNARI); @@ -1063,29 +1063,29 @@ void func_808FFEBC(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); if (this->unk_1A2[0] == 0) { - func_809002CC(this, globalCtx); + func_809002CC(this, play); } else if (this->unk_1A2[1] == 0) { - func_808FFCFC(this, globalCtx); + func_808FFCFC(this, play); } - func_808FFAC8(this, globalCtx, 0); - func_808FFBBC(this, globalCtx, 0); + func_808FFAC8(this, play, 0); + func_808FFBBC(this, play, 0); } -void func_808FFF90(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FFF90(BossGanon2* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &object_ganon2_Anim_00FFE4, -10.0f); this->actionFunc = func_808FFFE0; this->unk_1A2[0] = 40; } -void func_808FFFE0(BossGanon2* this, GlobalContext* globalCtx) { +void func_808FFFE0(BossGanon2* this, PlayState* play) { s16 target; SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); if (this->unk_1A2[0] == 0) { - func_809002CC(this, globalCtx); + func_809002CC(this, play); } if (this->unk_1A2[0] < 30 && this->unk_1A2[0] >= 10) { @@ -1097,14 +1097,14 @@ void func_808FFFE0(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachS(&this->unk_31A, target, 2, 0x4000); } -void func_809000A0(BossGanon2* this, GlobalContext* globalCtx) { +void func_809000A0(BossGanon2* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &object_ganon2_Anim_026510, -2.0f); this->unk_194 = Animation_GetLastFrame(&object_ganon2_Anim_026510); this->unk_1AC = 0; this->actionFunc = func_80900104; } -void func_80900104(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900104(BossGanon2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); @@ -1125,28 +1125,28 @@ void func_80900104(BossGanon2* this, GlobalContext* globalCtx) { break; case 2: if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { - func_809002CC(this, globalCtx); + func_809002CC(this, play); } break; } } -void func_80900210(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900210(BossGanon2* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon2_Anim_00DFF0, -3.0f); this->unk_194 = Animation_GetLastFrame(&object_ganon2_Anim_00DFF0); this->actionFunc = func_8090026C; } -void func_8090026C(BossGanon2* this, GlobalContext* globalCtx) { +void func_8090026C(BossGanon2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { - func_809002CC(this, globalCtx); + func_809002CC(this, play); } } -void func_809002CC(BossGanon2* this, GlobalContext* globalCtx) { +void func_809002CC(BossGanon2* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &object_ganon2_Anim_00E8EC, -10.0f); this->actionFunc = func_80900344; this->unk_338 = 0; @@ -1154,7 +1154,7 @@ void func_809002CC(BossGanon2* this, GlobalContext* globalCtx) { this->unk_390 = (s16)Rand_ZeroFloat(50.0f) + 50; } -void func_80900344(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900344(BossGanon2* this, PlayState* play) { f32 phi_f0; if (this->unk_390 == 0) { @@ -1166,9 +1166,9 @@ void func_80900344(BossGanon2* this, GlobalContext* globalCtx) { if (this->unk_338 != 0) { if (Animation_OnFrame(&this->skelAnime, 13.0f)) { - func_808FD4D4(this, globalCtx, 1, 3); + func_808FD4D4(this, play, 1, 3); } else if (Animation_OnFrame(&this->skelAnime, 28.0f)) { - func_808FD4D4(this, globalCtx, 2, 3); + func_808FD4D4(this, play, 2, 3); } if (this->actor.xzDistToPlayer < 200.0f) { this->unk_338 = 0; @@ -1195,16 +1195,16 @@ void func_80900344(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.speedXZ, phi_f0, 0.5f, 1.0f); if (this->unk_1A2[0] == 0) { - func_808FFDB0(this, globalCtx); + func_808FFDB0(this, play); } else { - func_808FFCFC(this, globalCtx); + func_808FFCFC(this, play); } - func_808FFAC8(this, globalCtx, 1); - func_808FFBBC(this, globalCtx, 1); + func_808FFAC8(this, play, 1); + func_808FFBBC(this, play, 1); } -void func_80900580(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900580(BossGanon2* this, PlayState* play) { if (this->unk_311 == 0) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon2_Anim_00ADD0, -5.0f); this->unk_194 = Animation_GetLastFrame(&object_ganon2_Anim_00ADD0); @@ -1218,7 +1218,7 @@ void func_80900580(BossGanon2* this, GlobalContext* globalCtx) { this->actionFunc = func_80900650; } -void func_80900650(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900650(BossGanon2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, this->unk_198)) { @@ -1242,22 +1242,22 @@ void func_80900650(BossGanon2* this, GlobalContext* globalCtx) { this->unk_311 = 1 - this->unk_311; if ((this->unk_311 == 1) && (this->actor.xzDistToPlayer < 250.0f) && this->unk_313) { - func_80900580(this, globalCtx); + func_80900580(this, play); } else { - func_808FFDB0(this, globalCtx); + func_808FFDB0(this, play); } } - func_808FFAC8(this, globalCtx, 0); + func_808FFAC8(this, play, 0); if ((this->unk_334 == 0) && (this->unk_311 == 0)) { this->unk_320 = 0.0f; } else { - func_808FFBBC(this, globalCtx, 0); + func_808FFBBC(this, play, 0); } } -void func_80900818(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900818(BossGanon2* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon2_Anim_02A848, -5.0f); this->unk_194 = Animation_GetLastFrame(&object_ganon2_Anim_02A848); this->actionFunc = func_80900890; @@ -1267,7 +1267,7 @@ void func_80900818(BossGanon2* this, GlobalContext* globalCtx) { this->unk_336 = 0; } -void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { +void func_80900890(BossGanon2* this, PlayState* play) { Vec3f sp5C; Vec3f sp50; Camera* mainCam1; @@ -1278,25 +1278,25 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { f32 temp_f12; f32 temp_f2; - mainCam1 = Play_GetCamera(globalCtx, CAM_ID_MAIN); - player = GET_PLAYER(globalCtx); + mainCam1 = Play_GetCamera(play, CAM_ID_MAIN); + player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); this->unk_398++; this->unk_339 = 20; switch (this->unk_39C) { case 0: - func_80064520(globalCtx, &globalCtx->csCtx); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, &this->actor, 8); + func_80064520(play, &play->csCtx); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 8); this->unk_39C = 1; this->subCamEye = mainCam1->eye; this->subCamAt = mainCam1->at; this->unk_1A2[0] = 300; this->unk_1A2[1] = 100; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; case 1: if (this->unk_1A2[1] == 50) { func_80078884(NA_SE_EN_MGANON_WALK); @@ -1326,30 +1326,30 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { this->subCamAt.y = sZelda->actor.world.pos.y + 30.0f; this->subCamAt.z = sZelda->actor.world.pos.z - 10.0f; Math_ApproachZeroF(&this->unk_324, 1.0f, 5.0f); - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 1.0f / 51); + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 1.0f / 51); if (this->unk_1A2[1] == 80) { - Message_StartTextbox(globalCtx, 0x70D7, NULL); + Message_StartTextbox(play, 0x70D7, NULL); } - if ((this->unk_1A2[1] < 30) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { - mainCam2 = Play_GetCamera(globalCtx, CAM_ID_MAIN); + if ((this->unk_1A2[1] < 30) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { + mainCam2 = Play_GetCamera(play, CAM_ID_MAIN); mainCam2->eye = this->subCamEye; mainCam2->eyeNext = this->subCamEye; mainCam2->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->unk_39C = 3; } break; case 10: - func_80064520(globalCtx, &globalCtx->csCtx); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->unk_39C = 11; this->unk_334 = 1; - func_8002DF54(globalCtx, &this->actor, 0x60); + func_8002DF54(play, &this->actor, 0x60); this->unk_398 = 0; case 11: player->actor.world.pos.x = sZelda->actor.world.pos.x + 50.0f + 10.0f; @@ -1362,21 +1362,21 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { this->subCamAt.y = (player->actor.world.pos.y + 60.0f) - 25.0f; this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 == 80) { - mainCam3 = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam3 = Play_GetCamera(play, CAM_ID_MAIN); mainCam3->eye = this->subCamEye; mainCam3->eyeNext = this->subCamEye; mainCam3->at = this->subCamAt; this->unk_39C = 3; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); } break; } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } switch (this->unk_1AC) { @@ -1387,7 +1387,7 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { } break; case 1: - if ((globalCtx->gameplayFrames % 32) == 0) { + if ((play->gameplayFrames % 32) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_BREATH); } @@ -1406,9 +1406,9 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { break; case 2: Math_ApproachF(&this->unk_324, 255.0f, 1.0f, 10.0f); - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 2.0f / 51.0f); + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 2.0f / 51.0f); if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { - func_808FFDB0(this, globalCtx); + func_808FFDB0(this, play); if (this->unk_334 == 0) { this->actor.colChkInfo.health = 25; } @@ -1420,7 +1420,7 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); } -void func_80901020(BossGanon2* this, GlobalContext* globalCtx) { +void func_80901020(BossGanon2* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon2_Anim_02A848, -5.0f); this->unk_194 = Animation_GetLastFrame(&object_ganon2_Anim_02A848); this->actionFunc = func_8090120C; @@ -1430,7 +1430,7 @@ void func_80901020(BossGanon2* this, GlobalContext* globalCtx) { this->unk_314 = 4; } -void func_8090109C(BossGanon2* this, GlobalContext* globalCtx) { +void func_8090109C(BossGanon2* this, PlayState* play) { u8 i; for (i = 0; i < 70; i++) { @@ -1447,12 +1447,11 @@ void func_8090109C(BossGanon2* this, GlobalContext* globalCtx) { pos.x = this->unk_1B8.x; pos.y = this->unk_1B8.y; pos.z = this->unk_1B8.z; - func_8002836C(globalCtx, &pos, &velocity, &accel, &sPrimColor, &sEnvColor, (s16)Rand_ZeroFloat(50.0f) + 50, 0, - 17); + func_8002836C(play, &pos, &velocity, &accel, &sPrimColor, &sEnvColor, (s16)Rand_ZeroFloat(50.0f) + 50, 0, 17); } } -void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { +void func_8090120C(BossGanon2* this, PlayState* play) { Player* player; f32 temp_f14; f32 temp_f12; @@ -1461,7 +1460,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { f32 phi_f0; s32 phi_a1; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->unk_398++; SkelAnime_Update(&this->skelAnime); @@ -1471,11 +1470,11 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { switch (this->unk_39C) { case 0: - func_80064520(globalCtx, &globalCtx->csCtx); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, &this->actor, 8); + func_80064520(play, &play->csCtx); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 8); this->unk_39C = 1; this->unk_398 = 0; sZelda->unk_3C8 = 9; @@ -1485,14 +1484,14 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_324 = 0.0f; this->actor.speedXZ = 0.0f; this->unk_31A = this->unk_31C; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; case 1: if (this->unk_398 < 90) { this->unk_339 = 20; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.1f); + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.1f); } else if (this->unk_398 >= 90) { this->unk_339 = 21; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.08f); + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.08f); } if (this->unk_398 == 50) { func_80078884(NA_SE_EN_MGANON_WALK); @@ -1511,7 +1510,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = 3.0f; } if (this->unk_398 == 120) { - func_8002DF54(globalCtx, &this->actor, 0x63); + func_8002DF54(play, &this->actor, 0x63); } this->actor.world.rot.y = 0x4000; this->actor.world.pos.x = this->actor.world.pos.z = 0.0f; @@ -1534,7 +1533,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { break; case 2: this->unk_339 = 22; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.1f); + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.1f); func_80078884(NA_SE_EV_TIMETRIP_LIGHT - SFX_FLAG); this->subCamEye.x = 250; this->subCamEye.y = 1150.0f; @@ -1557,9 +1556,9 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->subCamAt.y = sZelda->actor.world.pos.y + 40.0f; this->subCamAt.z = sZelda->actor.world.pos.z; if (this->unk_398 == 10) { - Message_StartTextbox(globalCtx, 0x70D8, NULL); + Message_StartTextbox(play, 0x70D8, NULL); } - if ((this->unk_398 > 80) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { + if ((this->unk_398 > 80) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->unk_39C = 4; this->unk_398 = 0; } @@ -1571,7 +1570,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { sZelda->unk_3C8 = 10; } this->unk_339 = 23; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.05f); + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.05f); } else { this->unk_339 = 22; } @@ -1579,7 +1578,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_39C = 5; this->unk_398 = 40; this->skelAnime.playSpeed = 1.0f; - func_8002DF54(globalCtx, &this->actor, 0x64); + func_8002DF54(play, &this->actor, 0x64); } break; case 5: @@ -1593,10 +1592,10 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->unk_38C, 1.0f, 8.0f); } if (this->unk_398 == 70) { - func_8002DF54(globalCtx, &this->actor, 0x65); + func_8002DF54(play, &this->actor, 0x65); } if (this->unk_398 == 150) { - func_8002DF54(globalCtx, &this->actor, 0x66); + func_8002DF54(play, &this->actor, 0x66); } this->unk_30C = 10.0f; player->actor.world.pos.x = 250.0f; @@ -1608,14 +1607,14 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->subCamAt.y = player->actor.world.pos.y + 40.0f; this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 == 166) { - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->unk_39C = 6; } break; @@ -1626,21 +1625,21 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { temp_a0_2 = Math_Atan2S(temp_f12, temp_f14) - player->actor.shape.rot.y; if ((ABS(temp_a0_2) < 0x2000) && (sqrtf(SQ(temp_f14) + SQ(temp_f12)) < 70.0f) && (player->meleeWeaponState != 0) && (player->heldItemActionParam == PLAYER_AP_SWORD_MASTER)) { - func_80064520(globalCtx, &globalCtx->csCtx); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->unk_39C = 7; this->unk_398 = 0; Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon2_Anim_003B1C, 0.0f); this->unk_194 = Animation_GetLastFrame(&object_ganon2_Anim_003B1C); - globalCtx->startPlayerCutscene(globalCtx, &this->actor, 0x61); + play->startPlayerCutscene(play, &this->actor, 0x61); } else { break; } case 7: this->unk_339 = 23; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.2f); + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.2f); player->actor.world.pos.x = 250.0f; player->actor.shape.rot.y = -0x4000; player->actor.world.pos.z = 30.0f; @@ -1651,10 +1650,10 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { if ((this->unk_398 == 22) || (this->unk_398 == 35) || (this->unk_398 == 72) || (this->unk_398 == 45)) { func_80078884(NA_SE_EN_MGANON_DAMAGE); func_80078884(NA_SE_IT_SHIELD_BOUND); - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; } if ((this->unk_398 == 22) || (this->unk_398 == 35) || (this->unk_398 == 72) || (this->unk_398 == 45)) { - func_8090109C(this, globalCtx); + func_8090109C(this, play); } if ((this->unk_398 >= 34) && (this->unk_398 < 40)) { this->subCamEye.x = 269.0f; @@ -1700,7 +1699,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { if (this->unk_398 == 55) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon2_Anim_007288, 0.0f); this->unk_194 = Animation_GetLastFrame(&object_ganon2_Anim_007288); - func_8002DF54(globalCtx, &this->actor, 0x62); + func_8002DF54(play, &this->actor, 0x62); this->unk_39C = 8; this->unk_398 = 1000; } @@ -1712,15 +1711,15 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { if (this->unk_398 >= 1000) { if (this->unk_398 < 1040) { this->unk_339 = 23; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.2f); + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.2f); } } if (this->unk_398 == 1040) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_DEAD2); this->unk_336 = 2; this->unk_339 = 0; - globalCtx->envCtx.prevLightSetting = 0; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.prevLightSetting = 0; + play->envCtx.lightBlend = 0.0f; } if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon2_Anim_008EB8, 0.0f); @@ -1740,9 +1739,9 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_39C = 9; this->unk_398 = 0; sZelda->unk_3C8 = 11; - Message_StartTextbox(globalCtx, 0x70D9, NULL); + Message_StartTextbox(play, 0x70D9, NULL); this->unk_336 = 0; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; } break; case 9: @@ -1765,7 +1764,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamEye.y, 1130.0f, 0.05f, this->unk_410.x * 0.25f); Math_ApproachF(&this->subCamEye.z, -260.0f, 0.05f, this->unk_410.x * 1.25f); if ((this->unk_398 >= 40) && (this->unk_398 <= 110)) { - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.02f); + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.02f); Math_ApproachF(&this->unk_384, 10.0f, 0.1f, 0.2f); Audio_PlayActorSound2(&sZelda->actor, NA_SE_EV_GOD_LIGHTBALL_2 - SFX_FLAG); } else { @@ -1792,16 +1791,16 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { break; } case 20: - globalCtx->nextEntranceIndex = ENTR_KENJYANOMA_0; + play->nextEntranceIndex = ENTR_KENJYANOMA_0; gSaveContext.nextCutsceneIndex = 0xFFF2; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; - globalCtx->linkAgeOnLoad = LINK_AGE_CHILD; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; + play->linkAgeOnLoad = LINK_AGE_CHILD; break; } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEyeUp(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); + Play_CameraSetAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); } switch (this->unk_1AC) { @@ -1812,14 +1811,14 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { } break; case 1: - if ((this->unk_39C < 7) && ((globalCtx->gameplayFrames % 32) == 0)) { + if ((this->unk_39C < 7) && ((play->gameplayFrames % 32) == 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_BREATH); } break; } } -void func_80902348(BossGanon2* this, GlobalContext* globalCtx) { +void func_80902348(BossGanon2* this, PlayState* play) { Player* player; f32 temp_f2; f32 temp_f12; @@ -1840,7 +1839,7 @@ void func_80902348(BossGanon2* this, GlobalContext* globalCtx) { phi_v0_2 = 0; } - func_8002F6D4(globalCtx, &this->actor, 15.0f, this->actor.yawTowardsPlayer + phi_v0_2, 2.0f, 0); + func_8002F6D4(play, &this->actor, 15.0f, this->actor.yawTowardsPlayer + phi_v0_2, 2.0f, 0); sZelda->unk_3C8 = 8; this->unk_316 = 10; break; @@ -1849,7 +1848,7 @@ void func_80902348(BossGanon2* this, GlobalContext* globalCtx) { } if (this->unk_324 > 0.0f) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); temp_f2 = -200.0f - player->actor.world.pos.x; temp_f12 = -200.0f - player->actor.world.pos.z; @@ -1859,13 +1858,13 @@ void func_80902348(BossGanon2* this, GlobalContext* globalCtx) { } player->isBurning = true; - func_8002F6D4(globalCtx, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10); + func_8002F6D4(play, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10); sZelda->unk_3C8 = 8; } } } -void func_80902524(BossGanon2* this, GlobalContext* globalCtx) { +void func_80902524(BossGanon2* this, PlayState* play) { s8 temp_v0_4; ColliderInfo* acHitInfo; s16 i; @@ -1885,7 +1884,7 @@ void func_80902524(BossGanon2* this, GlobalContext* globalCtx) { this->unk_424.elements[0].info.bumperFlags &= ~2; acHitInfo = this->unk_424.elements[0].info.acHitInfo; if ((acHitInfo->toucher.dmgFlags & 0x2000) && (this->actionFunc != func_80900890)) { - func_809000A0(this, globalCtx); + func_809000A0(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_HIT_THUNDER); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_DAMAGE); Audio_StopSfxById(NA_SE_EN_MGANON_UNARI); @@ -1897,16 +1896,16 @@ void func_80902524(BossGanon2* this, GlobalContext* globalCtx) { this->actor.colChkInfo.health -= 2; temp_v0_4 = this->actor.colChkInfo.health; if (temp_v0_4 < 0x15 && this->unk_334 == 0) { - func_80900818(this, globalCtx); + func_80900818(this, play); } else { if (temp_v0_4 <= 0) { - func_80901020(this, globalCtx); + func_80901020(this, play); } else { - func_80900210(this, globalCtx); + func_80900210(this, play); } } } else if (this->actionFunc != func_80900890) { - func_808FFF90(this, globalCtx); + func_808FFF90(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_IT_HOOKSHOT_REFLECT); } } @@ -1931,20 +1930,20 @@ void func_80902524(BossGanon2* this, GlobalContext* globalCtx) { this->actor.colChkInfo.health -= phi_v1_2; temp_v0_4 = this->actor.colChkInfo.health; if ((temp_v0_4 < 0x15) && (this->unk_334 == 0)) { - func_80900818(this, globalCtx); + func_80900818(this, play); } else if ((temp_v0_4 <= 0) && (phi_v1_2 >= 2)) { - func_80901020(this, globalCtx); + func_80901020(this, play); } else { if (temp_v0_4 <= 0) { this->actor.colChkInfo.health = 1; } - func_80900210(this, globalCtx); + func_80900210(this, play); } } } } -void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { +void BossGanon2_Update(Actor* thisx, PlayState* play) { BossGanon2* this = (BossGanon2*)thisx; s32 pad; s16 i; @@ -1956,16 +1955,16 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { f32 sp44; if ((this->unk_337 == 0) || (this->unk_337 == 2)) { - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON_ANIME3, false); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON_ANIME3, false); } else { - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON2, false); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON2, false); Math_ApproachZeroF(&this->unk_30C, 1.0f, 0.5f); } func_808FFC84(this); this->unk_312 = 0; this->unk_19C++; Actor_SetScale(&this->actor, 0.01f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->unk_1A2); i++) { if (this->unk_1A2[i] != 0) { this->unk_1A2[i]--; @@ -1986,11 +1985,11 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); this->actor.shape.rot = this->actor.world.rot; if (this->unk_335 != 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 60.0f, 60.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 60.0f, 60.0f, 100.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.velocity.y < -5.0f) { - func_80033E88(&this->actor, globalCtx, 5, 20); + func_80033E88(&this->actor, play, 5, 20); func_80078884(NA_SE_IT_BOMB_EXPLOSION); } this->actor.velocity.y = 0.0f; @@ -2049,16 +2048,16 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_352[i] = Math_SinS(((s16)this->unk_36C + (i * (s16)this->unk_370.y))) * phi_f2 * this->unk_370.z; } - func_808FF898(this, globalCtx); - func_80902348(this, globalCtx); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->unk_424.base); + func_808FF898(this, play); + func_80902348(this, play); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_424.base); if (this->actionFunc != func_8090120C) { - func_80902524(this, globalCtx); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_424.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->unk_444.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_444.base); + func_80902524(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_424.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_444.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_444.base); if (this->subCamId == SUB_CAM_ID_DONE) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->unk_444.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk_444.base); } } if ((this->unk_332 == 0) && (this->unk_336 != 0)) { @@ -2068,9 +2067,9 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_332 = (s16)Rand_ZeroFloat(60.0f) + 0xA; } this->unk_339 = 0; - globalCtx->envCtx.prevLightSetting = 0; - globalCtx->envCtx.lightSetting = (s8)Rand_ZeroFloat(1.9f) + 1; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.prevLightSetting = 0; + play->envCtx.lightSetting = (s8)Rand_ZeroFloat(1.9f) + 1; + play->envCtx.lightBlend = 1.0f; D_8090EB20.y = 0.0f; D_8090EB20.x = D_8090EB20.y; D_8090EB20.z = D_8090EB20.x; @@ -2085,75 +2084,73 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { } else if (this->unk_332 != 0) { this->unk_332--; } - if ((globalCtx->envCtx.lightBlend > 0.0f) && (this->unk_336 != 0)) { - globalCtx->envCtx.customSkyboxFilter = 1; - globalCtx->envCtx.skyboxFilterColor[0] = 255; - globalCtx->envCtx.skyboxFilterColor[1] = 255; - globalCtx->envCtx.skyboxFilterColor[2] = 255; - globalCtx->envCtx.skyboxFilterColor[3] = (s16)(globalCtx->envCtx.lightBlend * 200.0f); + if ((play->envCtx.lightBlend > 0.0f) && (this->unk_336 != 0)) { + play->envCtx.customSkyboxFilter = 1; + play->envCtx.skyboxFilterColor[0] = 255; + play->envCtx.skyboxFilterColor[1] = 255; + play->envCtx.skyboxFilterColor[2] = 255; + play->envCtx.skyboxFilterColor[3] = (s16)(play->envCtx.lightBlend * 200.0f); } else { - globalCtx->envCtx.customSkyboxFilter = 0; + play->envCtx.customSkyboxFilter = 0; } - globalCtx->envCtx.lightSettingOverride = 0; - globalCtx->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; + play->envCtx.lightSettingOverride = 0; + play->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; switch (this->unk_339) { case 0: - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.1f); + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.1f); break; case 3: - globalCtx->envCtx.prevLightSetting = 3; - globalCtx->envCtx.lightSetting = 4; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.0125f); + play->envCtx.prevLightSetting = 3; + play->envCtx.lightSetting = 4; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.0125f); break; case 4: - globalCtx->envCtx.prevLightSetting = 5; - globalCtx->envCtx.lightSetting = 6; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.0125f); + play->envCtx.prevLightSetting = 5; + play->envCtx.lightSetting = 6; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.0125f); break; case 5: - globalCtx->envCtx.prevLightSetting = 6; - globalCtx->envCtx.lightSetting = 7; + play->envCtx.prevLightSetting = 6; + play->envCtx.lightSetting = 7; Math_ApproachF(&this->unk_33C, 0.69f, 1.0f, 0.05f); - globalCtx->envCtx.lightBlend = - (Math_SinS(globalCtx->gameplayFrames * 0x5000) * 0.15f) + (0.15f + this->unk_33C); + play->envCtx.lightBlend = (Math_SinS(play->gameplayFrames * 0x5000) * 0.15f) + (0.15f + this->unk_33C); break; case 55: - globalCtx->envCtx.prevLightSetting = 2; - globalCtx->envCtx.lightSetting = 0; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.05f); + play->envCtx.prevLightSetting = 2; + play->envCtx.lightSetting = 0; + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.05f); break; case 6: - globalCtx->envCtx.prevLightSetting = 2; - globalCtx->envCtx.lightSetting = 8; + play->envCtx.prevLightSetting = 2; + play->envCtx.lightSetting = 8; Math_ApproachF(&this->unk_33C, 0.69f, 1.0f, 0.05f); - globalCtx->envCtx.lightBlend = - (Math_SinS(globalCtx->gameplayFrames * 0x7000) * 0.15f) + (0.15f + this->unk_33C); + play->envCtx.lightBlend = (Math_SinS(play->gameplayFrames * 0x7000) * 0.15f) + (0.15f + this->unk_33C); break; case 7: - globalCtx->envCtx.prevLightSetting = 0; - globalCtx->envCtx.lightSetting = 8; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.02f); + play->envCtx.prevLightSetting = 0; + play->envCtx.lightSetting = 8; + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.02f); break; case 20: - globalCtx->envCtx.prevLightSetting = 0; - globalCtx->envCtx.lightSetting = 9; + play->envCtx.prevLightSetting = 0; + play->envCtx.lightSetting = 9; break; case 21: - globalCtx->envCtx.prevLightSetting = 10; - globalCtx->envCtx.lightSetting = 9; + play->envCtx.prevLightSetting = 10; + play->envCtx.lightSetting = 9; break; case 22: - globalCtx->envCtx.prevLightSetting = 10; - globalCtx->envCtx.lightSetting = 11; + play->envCtx.prevLightSetting = 10; + play->envCtx.lightSetting = 11; break; case 23: - globalCtx->envCtx.prevLightSetting = 9; - globalCtx->envCtx.lightSetting = 11; + play->envCtx.prevLightSetting = 9; + play->envCtx.lightSetting = 11; break; case 24: - globalCtx->envCtx.prevLightSetting = 0; - globalCtx->envCtx.lightSetting = 12; + play->envCtx.prevLightSetting = 0; + play->envCtx.lightSetting = 12; break; case -1: break; @@ -2175,11 +2172,11 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { sp4C.y = Rand_ZeroFloat(15.0f) + 15.0f; sp58.x += sp4C.x * 10.0f * 0.1f; sp58.z += sp4C.z * 10.0f * 0.1f; - func_808FD27C(globalCtx, &sp58, &sp4C, Rand_ZeroFloat(0.3f) + 0.2f); + func_808FD27C(play, &sp58, &sp4C, Rand_ZeroFloat(0.3f) + 0.2f); } } this->unk_388 += 0.15f; - BossGanon2_UpdateEffects(this, globalCtx); + BossGanon2_UpdateEffects(this, play); } void func_809034E4(Vec3f* arg0, Vec3f* arg1) { @@ -2377,8 +2374,8 @@ void func_809034E4(Vec3f* arg0, Vec3f* arg1) { } } -void func_80903F38(BossGanon2* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5083); +void func_80903F38(BossGanon2* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5083); if (this->unk_312 != 0) { func_809034E4(&this->unk_200, &this->unk_20C); @@ -2386,52 +2383,51 @@ void func_80903F38(BossGanon2* this, GlobalContext* globalCtx) { } if (D_80910638 >= 4) { - gSPSegment( - POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, globalCtx->gameplayFrames * 18, 0, 32, 32)); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, play->gameplayFrames * 18, 0, 32, 32)); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, D_80907080); Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_NEW); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5117), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5117), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00BB80); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5122); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5122); } -void func_80904108(BossGanon2* this, GlobalContext* globalCtx) { +void func_80904108(BossGanon2* this, PlayState* play) { s32 pad; if (this->unk_324 > 0.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5131); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5131); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s32)globalCtx->gameplayFrames, 0, 32, 64, 1, - -globalCtx->gameplayFrames * 2, -globalCtx->gameplayFrames * 8, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s32)play->gameplayFrames, 0, 32, 64, 1, + -play->gameplayFrames * 2, -play->gameplayFrames * 8, 32, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 200, 0, (s8)this->unk_324); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); Matrix_Translate(-200.0f, 1086.0f, -200.0f, MTXMODE_NEW); Matrix_Scale(0.098000005f, 0.1f, 0.098000005f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5183), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5183), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00E1C0)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5186); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5186); } } -void func_80904340(BossGanon2* this, GlobalContext* globalCtx) { +void func_80904340(BossGanon2* this, PlayState* play) { s16 i; f32 rand; f32 angle; f32 sin; f32 cos; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5196); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5196); Matrix_Push(); if ((this->unk_330 != 0) || (this->unk_328 != 0)) { @@ -2465,45 +2461,44 @@ void func_80904340(BossGanon2* this, GlobalContext* globalCtx) { Matrix_RotateY(M_PI, MTXMODE_APPLY); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5250), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5250), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00D798)); } } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5255); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5255); } -void func_8090464C(BossGanon2* this, GlobalContext* globalCtx) { +void func_8090464C(BossGanon2* this, PlayState* play) { s32 pad; if (this->unk_1B4 > 0.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5264); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5264); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s16)this->unk_1B4); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 128); Matrix_Translate(this->unk_1B8.x, this->unk_1B8.y, this->unk_1B8.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ(-0.2f, MTXMODE_APPLY); Matrix_Scale(0.6f, 0.6f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5290), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5290), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00CCD8)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5293); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5293); } } -s32 BossGanon2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossGanon2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 pad; BossGanon2* this = (BossGanon2*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5355); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5355); if (limbIndex == 15) { rot->y += this->unk_31A; @@ -2525,17 +2520,17 @@ s32 BossGanon2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d *dList = NULL; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5431); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5431); return 0; } -void BossGanon2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossGanon2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { s8 pad; s8 temp_v0; BossGanon2* this = (BossGanon2*)thisx; Vec3f sp4C; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5459); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5459); D_80907120.z = 17000.0f; D_8090712C.z = 3000.0f; @@ -2567,14 +2562,14 @@ void BossGanon2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis if ((limbIndex == 7) || (limbIndex == 13)) { Matrix_Push(); Matrix_Scale(this->unk_224, this->unk_224, this->unk_224, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5522), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5522), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); } else if ((limbIndex == 33) || (limbIndex == 34)) { Matrix_Push(); Matrix_Scale(this->unk_228, this->unk_228, this->unk_228, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5533), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5533), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); @@ -2594,17 +2589,17 @@ void BossGanon2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5566); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5566); } -void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { +void func_80904D88(BossGanon2* this, PlayState* play) { s32 pad; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5575); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5575); if (this->unk_30C > 0.0f) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->unk_380 > 0.0f) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 0); @@ -2616,56 +2611,56 @@ void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { for (i = 0; i < 15; i++) { Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_30C, this->unk_30C, this->unk_30C, MTXMODE_APPLY); Matrix_RotateZ(Rand_CenteredFloat(M_PI), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5618), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5618), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B378); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5622); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5622); } -void func_80904FC8(BossGanon2* this, GlobalContext* globalCtx) { +void func_80904FC8(BossGanon2* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5632); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5632); if (this->unk_384 > 0.0f) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 200); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 0); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B308); Matrix_Translate(sZelda->actor.world.pos.x, sZelda->actor.world.pos.y + 80.0f, sZelda->actor.world.pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_384, this->unk_384, this->unk_384, MTXMODE_APPLY); Matrix_RotateZ(this->unk_388, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5661), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5661), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00B378)); Matrix_RotateZ(this->unk_388 * -2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5664), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5664), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00B378)); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5667); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5667); } -void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { +void func_8090523C(BossGanon2* this, PlayState* play) { Player* player; f32 phi_f20; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5675); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5675); if (this->unk_38C > 0.0f) { s8 i; - player = GET_PLAYER(globalCtx); - func_80093D84(globalCtx->state.gfxCtx); + player = GET_PLAYER(play); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)this->unk_38C); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, 0); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B308); @@ -2680,19 +2675,19 @@ void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { phi_f20 = 1.0f - ((i - 7) * 0.2333333f); // 7 / 30 } - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(200.0f * phi_f20, 200.0f * phi_f20, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(Rand_ZeroFloat(2.0f * M_PI), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5721), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5721), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00B378)); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5725); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5725); } -void BossGanon2_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossGanon2_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { s8 temp_v1 = D_80907144[limbIndex]; BossGanon2* this = (BossGanon2*)thisx; @@ -2700,28 +2695,28 @@ void BossGanon2_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi Matrix_MultVec3f(&D_80906D60, &this->unk_234[temp_v1]); } if (limbIndex == 11) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5749); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5749); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5752), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5752), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_ganon_DL_00BE90)); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5754); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5754); } else if (limbIndex == 10) { Matrix_MultVec3f(&D_80907164, &this->unk_1B8); } } -void func_80905674(BossGanon2* this, GlobalContext* globalCtx) { +void func_80905674(BossGanon2* this, PlayState* play) { s32 pad; if (this->unk_380 > 0.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5772); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5772); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk_19C * -8, 0, 32, 64, 1, this->unk_19C * -4, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->unk_19C * -8, 0, 32, 64, 1, this->unk_19C * -4, this->unk_19C * -8, 32, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s16)this->unk_37C); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 128); @@ -2730,36 +2725,36 @@ void func_80905674(BossGanon2* this, GlobalContext* globalCtx) { Matrix_RotateY(-M_PI / 4.0f, MTXMODE_APPLY); Matrix_Scale(0.040000003f, 0.040000003f, this->unk_380, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5814), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5814), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00EC40)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5817); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5817); } } -void BossGanon2_Draw(Actor* thisx, GlobalContext* globalCtx) { - void* shadowTexture = Graph_Alloc(globalCtx->state.gfxCtx, 4096); +void BossGanon2_Draw(Actor* thisx, PlayState* play) { + void* shadowTexture = Graph_Alloc(play->state.gfxCtx, 4096); BossGanon2* this = (BossGanon2*)thisx; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5840); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5840); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); switch (this->unk_337) { case 0: - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON, true); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON, true); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(object_ganon_Tex_00A8E0)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(object_ganon_Tex_00A8E0)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, BossGanon2_PostLimbDraw2, this); break; case 1: case 2: - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON2, true); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON2, true); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->unk_310])); func_808FD080(0, &this->unk_444, &D_8090717C); func_808FD080(1, &this->unk_444, &D_8090717C); @@ -2770,28 +2765,28 @@ void BossGanon2_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, -4000.0f, 4000.0f, MTXMODE_APPLY); Matrix_RotateX(this->unk_394, MTXMODE_APPLY); Matrix_Translate(0.0f, 4000.0f, -4000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5910), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 5910), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossGanon2_OverrideLimbDraw, BossGanon2_PostLimbDraw, this); - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); - BossGanon2_GenShadowTexture(shadowTexture, this, globalCtx); - BossGanon2_DrawShadowTexture(shadowTexture, this, globalCtx); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + BossGanon2_GenShadowTexture(shadowTexture, this, play); + BossGanon2_DrawShadowTexture(shadowTexture, this, play); break; } - BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON2, true); - func_80904340(this, globalCtx); - func_80904108(this, globalCtx); - func_80904D88(this, globalCtx); - func_8090464C(this, globalCtx); - func_80905674(this, globalCtx); - func_80904FC8(this, globalCtx); - func_8090523C(this, globalCtx); + BossGanon2_SetObjectSegment(this, play, OBJECT_GANON2, true); + func_80904340(this, play); + func_80904108(this, play); + func_80904D88(this, play); + func_8090464C(this, play); + func_80905674(this, play); + func_80904FC8(this, play); + func_8090523C(this, play); if ((this->unk_312 != 0) || (D_80907080 != 0)) { - func_80903F38(this, globalCtx); + func_80903F38(this, play); if (this->unk_312 == 0) { s32 pad; @@ -2811,15 +2806,15 @@ void BossGanon2_Draw(Actor* thisx, GlobalContext* globalCtx) { D_80910638 = 0; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5983); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5983); - BossGanon2_DrawEffects(globalCtx); + BossGanon2_DrawEffects(play); } -void BossGanon2_UpdateEffects(BossGanon2* this, GlobalContext* globalCtx) { +void BossGanon2_UpdateEffects(BossGanon2* this, PlayState* play) { s32 pad[5]; - Player* player = GET_PLAYER(globalCtx); - BossGanon2Effect* effect = globalCtx->specialEffects; + Player* player = GET_PLAYER(play); + BossGanon2Effect* effect = play->specialEffects; Vec3f sp78; s16 i; @@ -2845,7 +2840,7 @@ void BossGanon2_UpdateEffects(BossGanon2* this, GlobalContext* globalCtx) { sp78 = effect->position; sp78.y = 1086.0f; func_80078884(NA_SE_IT_SHIELD_REFLECT_SW); - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &sp78); + CollisionCheck_SpawnShieldParticlesMetal(play, &sp78); } effect->velocity.y = 0.0f; } @@ -2878,18 +2873,18 @@ void BossGanon2_UpdateEffects(BossGanon2* this, GlobalContext* globalCtx) { } } -void BossGanon2_DrawEffects(GlobalContext* globalCtx) { +void BossGanon2_DrawEffects(PlayState* play) { s16 alpha; u8 objectFlag = 0; BossGanon2Effect* effect; s16 i; BossGanon2Effect* effects; - effects = effect = globalCtx->specialEffects; + effects = effect = play->specialEffects; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 6086); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 6086); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); for (i = 0; i < 1; i++) { if (effect->type == 1) { @@ -2897,22 +2892,22 @@ void BossGanon2_DrawEffects(GlobalContext* globalCtx) { f32 temp_f0; f32 angle; - func_80093D84(globalCtx->state.gfxCtx); - spA0.x = globalCtx->envCtx.dirLight1.params.dir.x; - spA0.y = globalCtx->envCtx.dirLight1.params.dir.y; - spA0.z = globalCtx->envCtx.dirLight1.params.dir.z; - func_8002EABC(&effect->position, &globalCtx->view.eye, &spA0, globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + spA0.x = play->envCtx.dirLight1.params.dir.x; + spA0.y = play->envCtx.dirLight1.params.dir.y; + spA0.z = play->envCtx.dirLight1.params.dir.z; + func_8002EABC(&effect->position, &play->view.eye, &spA0, play->state.gfxCtx); Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY); Matrix_RotateY(effect->unk_38.z, MTXMODE_APPLY); Matrix_RotateX(effect->unk_38.y, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 6116), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 6116), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, 0 - (globalCtx->gameplayFrames & 0x7F), 32, 32)); + Gfx_TexScroll(play->state.gfxCtx, 0, 0 - (play->gameplayFrames & 0x7F), 32, 32)); gSPDisplayList(POLY_OPA_DISP++, ovl_Boss_Ganon2_DL_0103A8); - if ((globalCtx->envCtx.lightSetting == 1) || (globalCtx->envCtx.lightSetting == 2)) { - alpha = (s16)(globalCtx->envCtx.lightBlend * 150.0f) + 50; + if ((play->envCtx.lightSetting == 1) || (play->envCtx.lightSetting == 2)) { + alpha = (s16)(play->envCtx.lightBlend * 150.0f) + 50; angle = M_PI / 5.0f; } else { alpha = 100; @@ -2923,7 +2918,7 @@ void BossGanon2_DrawEffects(GlobalContext* globalCtx) { Matrix_Translate(effect->position.x + temp_f0, 1086.0f, (effect->position.z - 1.0f) + temp_f0, MTXMODE_NEW); Matrix_RotateY(angle, MTXMODE_APPLY); Matrix_Scale(1.0f, 0.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 6155), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 6155), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00F188); } @@ -2934,7 +2929,7 @@ void BossGanon2_DrawEffects(GlobalContext* globalCtx) { for (i = 0; i < BOSS_GANON2_EFFECT_COUNT; i++, effect++) { if (effect->type == 2) { if (objectFlag == 0) { - BossGanon2_SetObjectSegment(NULL, globalCtx, OBJECT_GEFF, true); + BossGanon2_SetObjectSegment(NULL, play, OBJECT_GEFF, true); objectFlag++; } Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); @@ -2942,13 +2937,13 @@ void BossGanon2_DrawEffects(GlobalContext* globalCtx) { Matrix_RotateY(effect->unk_38.z, MTXMODE_APPLY); Matrix_RotateX(effect->unk_38.y, MTXMODE_APPLY); Matrix_RotateZ(effect->unk_38.x, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 6179), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 6179), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGanonRubbleDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 6185); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 6185); } void func_80906538(BossGanon2* this, u8* shadowTexture, f32 arg2) { @@ -3028,7 +3023,7 @@ void func_80906538(BossGanon2* this, u8* shadowTexture, f32 arg2) { } } -void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, GlobalContext* globalCtx) { +void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, PlayState* play) { s16 i; u32* p = shadowTexture; @@ -3043,17 +3038,17 @@ void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, GlobalCo } } -void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, GlobalContext* globalCtx) { +void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, PlayState* play) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 alpha; OPEN_DISPS(gfxCtx, "../z_boss_ganon2.c", 6430); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - if ((globalCtx->envCtx.lightSetting == 1) || (globalCtx->envCtx.lightSetting == 2)) { - alpha = (s16)(globalCtx->envCtx.lightBlend * 180.0f) + 30; + if ((play->envCtx.lightSetting == 1) || (play->envCtx.lightSetting == 2)) { + alpha = (s16)(play->envCtx.lightBlend * 180.0f) + 30; } else { alpha = 120; } @@ -3062,7 +3057,7 @@ void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, GlobalC gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z - 20.0f, MTXMODE_NEW); Matrix_Scale(1.65f, 1.0f, 1.65f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 6457), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon2.c", 6457), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, ovl_Boss_Ganon2_DL_00B3D0); gDPLoadTextureBlock(POLY_OPA_DISP++, shadowTexture, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP, diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h index 389cdecc2f..90b30ab998 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h @@ -6,7 +6,7 @@ struct BossGanon2; -typedef void (*BossGanon2ActionFunc)(struct BossGanon2*, GlobalContext*); +typedef void (*BossGanon2ActionFunc)(struct BossGanon2*, PlayState*); typedef struct BossGanon2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index c7047466e9..c0bfb99dd9 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -47,27 +47,27 @@ typedef enum { /* 2 */ DEATH_HUNCHED } BossGanondrofDeathAction; -void BossGanondrof_Init(Actor* thisx, GlobalContext* globalCtx); -void BossGanondrof_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx); -void BossGanondrof_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossGanondrof_Init(Actor* thisx, PlayState* play); +void BossGanondrof_Destroy(Actor* thisx, PlayState* play); +void BossGanondrof_Update(Actor* thisx, PlayState* play); +void BossGanondrof_Draw(Actor* thisx, PlayState* play); -void BossGanondrof_SetupIntro(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Intro(BossGanondrof* this, GlobalContext* globalCtx); +void BossGanondrof_SetupIntro(BossGanondrof* this, PlayState* play); +void BossGanondrof_Intro(BossGanondrof* this, PlayState* play); void BossGanondrof_SetupPaintings(BossGanondrof* this); -void BossGanondrof_Paintings(BossGanondrof* this, GlobalContext* globalCtx); +void BossGanondrof_Paintings(BossGanondrof* this, PlayState* play); void BossGanondrof_SetupNeutral(BossGanondrof* this, f32 arg1); -void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_SetupThrow(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Throw(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_SetupBlock(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Block(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_SetupReturn(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Return(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_SetupCharge(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Stunned(BossGanondrof* this, GlobalContext* globalCtx); -void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx); +void BossGanondrof_Neutral(BossGanondrof* this, PlayState* play); +void BossGanondrof_SetupThrow(BossGanondrof* this, PlayState* play); +void BossGanondrof_Throw(BossGanondrof* this, PlayState* play); +void BossGanondrof_SetupBlock(BossGanondrof* this, PlayState* play); +void BossGanondrof_Block(BossGanondrof* this, PlayState* play); +void BossGanondrof_SetupReturn(BossGanondrof* this, PlayState* play); +void BossGanondrof_Return(BossGanondrof* this, PlayState* play); +void BossGanondrof_SetupCharge(BossGanondrof* this, PlayState* play); +void BossGanondrof_Charge(BossGanondrof* this, PlayState* play); +void BossGanondrof_Stunned(BossGanondrof* this, PlayState* play); +void BossGanondrof_Death(BossGanondrof* this, PlayState* play); const ActorInit Boss_Ganondrof_InitVars = { ACTOR_BOSS_GANONDROF, @@ -273,64 +273,64 @@ void BossGanondrof_SetColliderPos(Vec3f* pos, ColliderCylinder* collider) { collider->dim.pos.z = pos->z; } -void BossGanondrof_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossGanondrof_Init(Actor* thisx, PlayState* play) { s32 pad; BossGanondrof* this = (BossGanondrof*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); Actor_SetScale(&this->actor, 0.01f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gPhantomGanonSkel, &gPhantomGanonRideAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gPhantomGanonSkel, &gPhantomGanonRideAnim, NULL, NULL, 0); if (this->actor.params < GND_FAKE_BOSS) { this->actor.params = GND_REAL_BOSS; this->actor.colChkInfo.health = 30; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 255, 255); - BossGanondrof_SetupIntro(this, globalCtx); + BossGanondrof_SetupIntro(this, play); } else { BossGanondrof_SetupPaintings(this); } - Collider_InitCylinder(globalCtx, &this->colliderBody); - Collider_InitCylinder(globalCtx, &this->colliderSpear); - Collider_SetCylinder(globalCtx, &this->colliderBody, &this->actor, &sCylinderInitBody); - Collider_SetCylinder(globalCtx, &this->colliderSpear, &this->actor, &sCylinderInitSpear); + Collider_InitCylinder(play, &this->colliderBody); + Collider_InitCylinder(play, &this->colliderSpear); + Collider_SetCylinder(play, &this->colliderBody, &this->actor, &sCylinderInitBody); + Collider_SetCylinder(play, &this->colliderSpear, &this->actor, &sCylinderInitSpear); this->actor.flags &= ~ACTOR_FLAG_0; - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y, + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y, GND_BOSSROOM_CENTER_Z, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 200.0f + GND_BOSSROOM_CENTER_X, - GND_BOSSROOM_CENTER_Y, GND_BOSSROOM_CENTER_Z, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 200.0f + GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y, + GND_BOSSROOM_CENTER_Z, 0, 0, 0, 0); } else { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, this->actor.params); } } -void BossGanondrof_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossGanondrof_Destroy(Actor* thisx, PlayState* play) { s32 pad; BossGanondrof* this = (BossGanondrof*)thisx; osSyncPrintf("DT1\n"); - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->colliderBody); - Collider_DestroyCylinder(globalCtx, &this->colliderSpear); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->colliderBody); + Collider_DestroyCylinder(play, &this->colliderSpear); if (this->actor.params == GND_REAL_BOSS) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } osSyncPrintf("DT2\n"); } -void BossGanondrof_SetupIntro(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupIntro(BossGanondrof* this, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &gPhantomGanonRidePoseAnim); this->actionFunc = BossGanondrof_Intro; this->work[GND_MASK_OFF] = true; } -void BossGanondrof_Intro(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Intro(BossGanondrof* this, PlayState* play) { s16 i; s32 pad; EnfHG* horse = (EnfHG*)this->actor.child; @@ -350,7 +350,7 @@ void BossGanondrof_Intro(BossGanondrof* this, GlobalContext* globalCtx) { pos.y = this->bodyPartsPos[14].y + Rand_ZeroFloat(-5.0f); pos.z = this->bodyPartsPos[14].z + Rand_CenteredFloat(10.0f) + 5.0f; accel.y = 0.03f; - EffectSsKFire_Spawn(globalCtx, &pos, &vel, &accel, (s16)Rand_ZeroFloat(10.0f) + 5, 0); + EffectSsKFire_Spawn(play, &pos, &vel, &accel, (s16)Rand_ZeroFloat(10.0f) + 5, 0); } if (this->timers[1] == 20) { @@ -380,8 +380,8 @@ void BossGanondrof_Intro(BossGanondrof* this, GlobalContext* globalCtx) { Animation_MorphToPlayOnce(&this->skelAnime, &gPhantomGanonRideSpearRaiseAnim, -7.0f); horseTemp = (EnfHG*)this->actor.child; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->spearTip.x, - this->spearTip.y, this->spearTip.z, 50, FHGFIRE_LIGHT_GREEN, 0, FHGFIRE_SPEAR_LIGHT); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->spearTip.x, this->spearTip.y, + this->spearTip.z, 50, FHGFIRE_LIGHT_GREEN, 0, FHGFIRE_SPEAR_LIGHT); this->actor.child = &horseTemp->actor; } @@ -427,7 +427,7 @@ void BossGanondrof_SetupPaintings(BossGanondrof* this) { this->actionFunc = BossGanondrof_Paintings; } -void BossGanondrof_Paintings(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Paintings(BossGanondrof* this, PlayState* play) { EnfHG* horse = (EnfHG*)this->actor.child; osSyncPrintf("RUN 1\n"); @@ -440,8 +440,8 @@ void BossGanondrof_Paintings(BossGanondrof* this, GlobalContext* globalCtx) { Animation_MorphToPlayOnce(&this->skelAnime, &gPhantomGanonRideSpearRaiseAnim, -2.0f); this->actor.flags |= ACTOR_FLAG_0; horseTemp = (EnfHG*)this->actor.child; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->spearTip.x, - this->spearTip.y, this->spearTip.z, 30, FHGFIRE_LIGHT_GREEN, 0, FHGFIRE_SPEAR_LIGHT); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->spearTip.x, this->spearTip.y, + this->spearTip.z, 30, FHGFIRE_LIGHT_GREEN, 0, FHGFIRE_SPEAR_LIGHT); this->actor.child = &horseTemp->actor; } else if (horse->bossGndSignal == FHG_LIGHTNING) { Animation_MorphToPlayOnce(&this->skelAnime, &gPhantomGanonRideSpearStrikeAnim, -2.0f); @@ -481,11 +481,11 @@ void BossGanondrof_SetupNeutral(BossGanondrof* this, f32 arg1) { this->timers[0] = (s16)(Rand_ZeroOne() * 64.0f) + 30; } -void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Neutral(BossGanondrof* this, PlayState* play) { f32 targetX; f32 targetY; f32 targetZ; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* playerx = &player->actor; Actor* thisx = &this->actor; f32 rand01; @@ -499,7 +499,7 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { rand01 = Rand_ZeroOne(); if (thisx->colChkInfo.health < 5) { if (rand01 < 0.25f) { - BossGanondrof_SetupThrow(this, globalCtx); + BossGanondrof_SetupThrow(this, play); } else if (rand01 >= 0.8f) { this->flyMode = GND_FLY_CHARGE; this->timers[0] = 60; @@ -512,7 +512,7 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(thisx, NA_SE_EN_FANTOM_LAUGH); } } else if ((rand01 < 0.5f) || (this->work[GND_THROW_COUNT] < 5)) { - BossGanondrof_SetupThrow(this, globalCtx); + BossGanondrof_SetupThrow(this, play); } else { this->flyMode = GND_FLY_VOLLEY; this->timers[0] = 60; @@ -547,7 +547,7 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { if (this->timers[0] == 0) { this->flyMode = GND_FLY_RETURN; this->returnSuccess = false; - BossGanondrof_SetupThrow(this, globalCtx); + BossGanondrof_SetupThrow(this, play); this->timers[0] = 80; } break; @@ -560,7 +560,7 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { targetZ += Math_CosS(this->work[GND_VARIANCE_TIMER] * 0x700) * 50.0f; if (this->returnSuccess) { this->returnSuccess = false; - BossGanondrof_SetupReturn(this, globalCtx); + BossGanondrof_SetupReturn(this, play); this->timers[0] = 80; } @@ -576,7 +576,7 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { targetX += Math_SinS(this->work[GND_VARIANCE_TIMER] * 0x500) * 100.0f; targetZ += Math_CosS(this->work[GND_VARIANCE_TIMER] * 0x700) * 100.0f; if (this->timers[0] == 0) { - BossGanondrof_SetupCharge(this, globalCtx); + BossGanondrof_SetupCharge(this, play); } break; } @@ -604,19 +604,19 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { pos.y = Rand_CenteredFloat(20.0f) + this->spearTip.y; pos.z = Rand_CenteredFloat(20.0f) + this->spearTip.z; accel.y = -0.08f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &pos, &vel, &accel, (s16)(Rand_ZeroOne() * 80.0f) + 150, + EffectSsFhgFlash_SpawnLightBall(play, &pos, &vel, &accel, (s16)(Rand_ZeroOne() * 80.0f) + 150, FHGFLASH_LIGHTBALL_GREEN); } } if (player->unk_A73 != 0) { - BossGanondrof_SetupBlock(this, globalCtx); + BossGanondrof_SetupBlock(this, play); } Audio_PlayActorSound2(thisx, NA_SE_EN_FANTOM_FLOAT - SFX_FLAG); } -void BossGanondrof_SetupThrow(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupThrow(BossGanondrof* this, PlayState* play) { EnfHG* horseTemp; s16 lightTime; @@ -634,14 +634,14 @@ void BossGanondrof_SetupThrow(BossGanondrof* this, GlobalContext* globalCtx) { } horseTemp = (EnfHG*)this->actor.child; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->spearTip.x, - this->spearTip.y, this->spearTip.z, lightTime, FHGFIRE_LIGHT_GREEN, 0, FHGFIRE_SPEAR_LIGHT); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->spearTip.x, this->spearTip.y, + this->spearTip.z, lightTime, FHGFIRE_LIGHT_GREEN, 0, FHGFIRE_SPEAR_LIGHT); this->actor.child = &horseTemp->actor; this->work[GND_THROW_COUNT]++; Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_STICK); } -void BossGanondrof_Throw(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Throw(BossGanondrof* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); osSyncPrintf("this->fwork[GND_END_FRAME] = %d\n", (s16)this->fwork[GND_END_FRAME]); osSyncPrintf("this->work[GND_SHOT_FRAME] = %d\n", this->work[GND_THROW_FRAME]); @@ -668,8 +668,8 @@ void BossGanondrof_Throw(BossGanondrof* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, this->work[GND_THROW_FRAME])) { EnfHG* horseTemp = (EnfHG*)this->actor.child; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->spearTip.x, - this->spearTip.y, this->spearTip.z, this->work[GND_ACTION_STATE], 0, 0, FHGFIRE_ENERGY_BALL); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->spearTip.x, this->spearTip.y, + this->spearTip.z, this->work[GND_ACTION_STATE], 0, 0, FHGFIRE_ENERGY_BALL); this->actor.child = &horseTemp->actor; } @@ -681,7 +681,7 @@ void BossGanondrof_Throw(BossGanondrof* this, GlobalContext* globalCtx) { this->actor.world.pos.y += 2.0f * Math_SinS(this->work[GND_VARIANCE_TIMER] * 1500); } -void BossGanondrof_SetupReturn(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupReturn(BossGanondrof* this, PlayState* play) { static AnimationHeader* returnAnim[] = { &gPhantomGanonReturn1Anim, &gPhantomGanonReturn2Anim }; s16 rand = Rand_ZeroOne() * 1.99f; @@ -690,7 +690,7 @@ void BossGanondrof_SetupReturn(BossGanondrof* this, GlobalContext* globalCtx) { this->actionFunc = BossGanondrof_Return; } -void BossGanondrof_Return(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Return(BossGanondrof* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 5.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_VOICE); @@ -709,12 +709,12 @@ void BossGanondrof_Return(BossGanondrof* this, GlobalContext* globalCtx) { this->actor.world.pos.y += 2.0f * Math_SinS(this->work[GND_VARIANCE_TIMER] * 1500); if (this->returnSuccess) { this->returnSuccess = false; - BossGanondrof_SetupReturn(this, globalCtx); + BossGanondrof_SetupReturn(this, play); this->timers[0] = 80; } } -void BossGanondrof_SetupStunned(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupStunned(BossGanondrof* this, PlayState* play) { if (this->actionFunc != BossGanondrof_Stunned) { this->fwork[GND_END_FRAME] = Animation_GetLastFrame(&gPhantomGanonAirDamageAnim); Animation_MorphToLoop(&this->skelAnime, &gPhantomGanonAirDamageAnim, 0.0f); @@ -731,7 +731,7 @@ void BossGanondrof_SetupStunned(BossGanondrof* this, GlobalContext* globalCtx) { this->actor.velocity.z = 0.0f; } -void BossGanondrof_Stunned(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Stunned(BossGanondrof* this, PlayState* play) { osSyncPrintf("DAMAGE .................................\n"); SkelAnime_Update(&this->skelAnime); this->actor.gravity = -0.2f; @@ -764,7 +764,7 @@ void BossGanondrof_Stunned(BossGanondrof* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } -void BossGanondrof_SetupBlock(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupBlock(BossGanondrof* this, PlayState* play) { this->fwork[GND_END_FRAME] = Animation_GetLastFrame(&gPhantomGanonBlockAnim); Animation_MorphToLoop(&this->skelAnime, &gPhantomGanonBlockAnim, -3.0f); this->actionFunc = BossGanondrof_Block; @@ -772,7 +772,7 @@ void BossGanondrof_SetupBlock(BossGanondrof* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_STICK); } -void BossGanondrof_Block(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Block(BossGanondrof* this, PlayState* play) { this->colliderBody.base.colType = COLTYPE_METAL; SkelAnime_Update(&this->skelAnime); this->actor.world.pos.x += this->actor.velocity.x; @@ -787,7 +787,7 @@ void BossGanondrof_Block(BossGanondrof* this, GlobalContext* globalCtx) { } } -void BossGanondrof_SetupCharge(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupCharge(BossGanondrof* this, PlayState* play) { this->fwork[GND_END_FRAME] = Animation_GetLastFrame(&gPhantomGanonChargeWindupAnim); Animation_MorphToLoop(&this->skelAnime, &gPhantomGanonChargeWindupAnim, -3.0f); this->actionFunc = BossGanondrof_Charge; @@ -795,8 +795,8 @@ void BossGanondrof_SetupCharge(BossGanondrof* this, GlobalContext* globalCtx) { this->work[GND_ACTION_STATE] = CHARGE_WINDUP; } -void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossGanondrof_Charge(BossGanondrof* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* playerx = &player->actor; Actor* thisx = &this->actor; f32 dxCenter = thisx->world.pos.x - GND_BOSSROOM_CENTER_X; @@ -909,7 +909,7 @@ void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) { accel.x = (offset.x * -50.0f) / 1000.0f; accel.y = (offset.y * -50.0f) / 1000.0f; accel.z = (offset.z * -50.0f) / 1000.0f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &pos, &vel, &accel, 150, i % 7); + EffectSsFhgFlash_SpawnLightBall(play, &pos, &vel, &accel, 150, i % 7); this->work[GND_EFFECT_ANGLE] += 0x1A5C; } } @@ -917,13 +917,13 @@ void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) { if (!(this->work[GND_VARIANCE_TIMER] & 7)) { EnfHG* horse = (EnfHG*)thisx->child; - Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_FHG_FIRE, this->spearTip.x, - this->spearTip.y, this->spearTip.z, 8, FHGFIRE_LIGHT_BLUE, 0, FHGFIRE_SPEAR_LIGHT); + Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_FHG_FIRE, this->spearTip.x, this->spearTip.y, + this->spearTip.z, 8, FHGFIRE_LIGHT_BLUE, 0, FHGFIRE_SPEAR_LIGHT); thisx->child = &horse->actor; } } -void BossGanondrof_SetupDeath(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_SetupDeath(BossGanondrof* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gPhantomGanonDeathBlowAnim); this->fwork[GND_END_FRAME] = Animation_GetLastFrame(&gPhantomGanonDeathBlowAnim); this->actionFunc = BossGanondrof_Death; @@ -935,14 +935,14 @@ void BossGanondrof_SetupDeath(BossGanondrof* this, GlobalContext* globalCtx) { this->shockTimer = 50; } -void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_Death(BossGanondrof* this, PlayState* play) { u8 holdCamera = false; u8 bodyDecayLevel = 0; f32 camX; f32 camZ; f32 pad; - Player* player = GET_PLAYER(globalCtx); - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Player* player = GET_PLAYER(play); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); osSyncPrintf("PYP %f\n", player->actor.floorHeight); SkelAnime_Update(&this->skelAnime); @@ -954,12 +954,12 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { switch (this->deathState) { case DEATH_START: - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); osSyncPrintf("7\n"); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); osSyncPrintf("8\n"); this->deathState = DEATH_THROES; player->actor.speedXZ = 0.0f; @@ -1028,11 +1028,11 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { if (this->timers[1] == 1) { EnfHG* horseTemp = (EnfHG*)this->actor.child; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, - GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y + 3.0f, GND_BOSSROOM_CENTER_Z, 0x4000, - 0, 0, FHGFIRE_WARP_DEATH); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, GND_BOSSROOM_CENTER_X, + GND_BOSSROOM_CENTER_Y + 3.0f, GND_BOSSROOM_CENTER_Z, 0x4000, 0, 0, + FHGFIRE_WARP_DEATH); this->actor.child = &horseTemp->actor; - Message_StartTextbox(globalCtx, 0x108E, NULL); + Message_StartTextbox(play, 0x108E, NULL); } this->actor.shape.rot.y -= 0xC8; @@ -1099,8 +1099,8 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { bodyDecayLevel = 10; if (this->timers[0] == 150) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, GND_BOSSROOM_CENTER_X, - GND_BOSSROOM_CENTER_Y, GND_BOSSROOM_CENTER_Z, 0, 0, 0, WARP_DUNGEON_ADULT); + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y, + GND_BOSSROOM_CENTER_Z, 0, 0, 0, WARP_DUNGEON_ADULT); } Math_ApproachZeroF(&this->subCamEye.y, 0.05f, 1.0f); // GND_BOSSROOM_CENTER_Y + 33.0f @@ -1112,17 +1112,17 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, GND_BOSSROOM_CENTER_X, - GND_BOSSROOM_CENTER_Y, GND_BOSSROOM_CENTER_Z + 200.0f, 0, 0, 0, 0); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y, + GND_BOSSROOM_CENTER_Z + 200.0f, 0, 0, 0, 0); this->actor.child = &horse->actor; this->killActor = true; horse->killActor = true; - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); - Flags_SetSwitch(globalCtx, 0x22); + Flags_SetClear(play, play->roomCtx.curRoom.num); + Flags_SetSwitch(play, 0x22); } break; } @@ -1139,14 +1139,14 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { vel.z = this->actor.world.pos.z - this->actor.prevPos.z; if (bodyDecayLevel < 10) { if (this->work[GND_DEATH_ENV_TIMER] == 0) { - if (globalCtx->envCtx.lightSettingOverride == 0) { - globalCtx->envCtx.lightSettingOverride = 3; + if (play->envCtx.lightSettingOverride == 0) { + play->envCtx.lightSettingOverride = 3; this->work[GND_DEATH_ENV_TIMER] = (s16)Rand_ZeroFloat(5.0f) + 4.0f; - globalCtx->envCtx.lightBlendRateOverride = 40; + play->envCtx.lightBlendRateOverride = 40; } else { - globalCtx->envCtx.lightSettingOverride = 0; + play->envCtx.lightSettingOverride = 0; this->work[GND_DEATH_ENV_TIMER] = (s16)Rand_ZeroFloat(2.0f) + 2.0f; - globalCtx->envCtx.lightBlendRateOverride = 20; + play->envCtx.lightBlendRateOverride = 20; } } else { this->work[GND_DEATH_ENV_TIMER]--; @@ -1170,16 +1170,15 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { accelHahen.z = (GND_BOSSROOM_CENTER_Z - pos.z) * 0.001f; } - EffectSsKFire_Spawn(globalCtx, &pos, &vel, &accelKFire, (s16)Rand_ZeroFloat(20.0f) + 15, - bodyDecayLevel); + EffectSsKFire_Spawn(play, &pos, &vel, &accelKFire, (s16)Rand_ZeroFloat(20.0f) + 15, bodyDecayLevel); if ((Rand_ZeroOne() < 0.5f) || (bodyDecayLevel == 3)) { - EffectSsHahen_Spawn(globalCtx, &pos, &vel, &accelHahen, 0, (s16)Rand_ZeroFloat(4.0f) + 7, + EffectSsHahen_Spawn(play, &pos, &vel, &accelHahen, 0, (s16)Rand_ZeroFloat(4.0f) + 7, HAHEN_OBJECT_DEFAULT, 10, NULL); } } } else { - globalCtx->envCtx.lightSettingOverride = 0; - globalCtx->envCtx.lightBlendRateOverride = 20; + play->envCtx.lightSettingOverride = 0; + play->envCtx.lightBlendRateOverride = 20; } this->work[GND_BODY_DECAY_FLAG] = true; @@ -1215,11 +1214,11 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, this->subCamAccel); } - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } -void BossGanondrof_CollisionCheck(BossGanondrof* this, GlobalContext* globalCtx) { +void BossGanondrof_CollisionCheck(BossGanondrof* this, PlayState* play) { s32 acHit; EnfHG* horse = (EnfHG*)this->actor.child; ColliderInfo* hurtbox; @@ -1255,12 +1254,12 @@ void BossGanondrof_CollisionCheck(BossGanondrof* this, GlobalContext* globalCtx) } if ((s8)this->actor.colChkInfo.health <= 0) { - BossGanondrof_SetupDeath(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + BossGanondrof_SetupDeath(this, play); + Enemy_StartFinishingBlow(play, &this->actor); return; } } - BossGanondrof_SetupStunned(this, globalCtx); + BossGanondrof_SetupStunned(this, play); if (this->returnCount >= 2) { this->timers[0] = 120; } @@ -1281,7 +1280,7 @@ void BossGanondrof_CollisionCheck(BossGanondrof* this, GlobalContext* globalCtx) } } -void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx) { +void BossGanondrof_Update(Actor* thisx, PlayState* play) { f32 cs; f32 sn; f32 legRotTargetY; @@ -1304,7 +1303,7 @@ void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx) { horse = (EnfHG*)this->actor.child; osSyncPrintf("MOVE START EEEEEEEEEEEEEEEEEEEEEE%d\n", this->actor.params); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->timers); i++) { if (this->timers[i]) { @@ -1319,24 +1318,24 @@ void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionFunc != BossGanondrof_Death) { - BossGanondrof_CollisionCheck(this, globalCtx); + BossGanondrof_CollisionCheck(this, play); } osSyncPrintf("MOVE END\n"); BossGanondrof_SetColliderPos(&this->targetPos, &this->colliderBody); BossGanondrof_SetColliderPos(&this->spearTip, &this->colliderSpear); if ((this->flyMode == GND_FLY_PAINTING) && !horse->bossGndInPainting) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } if ((this->actionFunc == BossGanondrof_Stunned) && (this->timers[0] > 1)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); } else if (this->actionFunc == BossGanondrof_Block) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } else if (this->actionFunc == BossGanondrof_Charge) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSpear.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSpear.base); } this->actor.focus.pos = this->targetPos; @@ -1362,7 +1361,7 @@ void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("F 1\n"); for (j = 0; j < 7; j++) { osSyncPrintf("F 15\n"); - EffectSsFhgFlash_SpawnShock(globalCtx, &this->actor, &this->actor.world.pos, 45, FHGFLASH_SHOCK_PG); + EffectSsFhgFlash_SpawnShock(play, &this->actor, &this->actor.world.pos, 45, FHGFLASH_SHOCK_PG); } osSyncPrintf("F 2\n"); } @@ -1373,8 +1372,7 @@ void BossGanondrof_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 BossGanondrof_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossGanondrof_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossGanondrof* this = (BossGanondrof*)thisx; switch (limbIndex) { @@ -1443,7 +1441,7 @@ s32 BossGanondrof_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx* return 0; } -void BossGanondrof_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossGanondrof_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; static Vec3f spearVec = { 0.0f, 0.0f, 6000.0f }; @@ -1480,12 +1478,12 @@ Gfx* BossGanondrof_EmptyDList(GraphicsContext* gfxCtx) { return dList; } -void BossGanondrof_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossGanondrof_Draw(Actor* thisx, PlayState* play) { s32 pad; BossGanondrof* this = (BossGanondrof*)thisx; EnfHG* horse; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganondrof.c", 3716); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganondrof.c", 3716); osSyncPrintf("MOVE P = %x\n", this->actor.update); osSyncPrintf("STOP TIMER = %d ==============\n", this->actor.freezeTimer); horse = (EnfHG*)this->actor.child; @@ -1494,7 +1492,7 @@ void BossGanondrof_Draw(Actor* thisx, GlobalContext* globalCtx) { } osSyncPrintf("YP %f\n", this->actor.world.pos.y); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->work[GND_INVINC_TIMER] & 4) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 50, 0, 0, 900, 1099); } else { @@ -1508,15 +1506,15 @@ void BossGanondrof_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, (s16)this->fwork[GND_EYE_BRIGHTNESS], (s16)this->fwork[GND_EYE_BRIGHTNESS], (s16)this->fwork[GND_EYE_BRIGHTNESS], (s16)this->fwork[GND_EYE_ALPHA]); if (this->work[GND_BODY_DECAY_FLAG]) { - gSPSegment(POLY_OPA_DISP++, 0x08, BossGanondrof_GetClearPixelDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, BossGanondrof_GetClearPixelDList(play->state.gfxCtx)); } else { - gSPSegment(POLY_OPA_DISP++, 0x08, BossGanondrof_EmptyDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, BossGanondrof_EmptyDList(play->state.gfxCtx)); } - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, BossGanondrof_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, BossGanondrof_OverrideLimbDraw, BossGanondrof_PostLimbDraw, this); osSyncPrintf("DRAW 22\n"); - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganondrof.c", 3814); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganondrof.c", 3814); osSyncPrintf("DRAW END %d\n", this->actor.params); } diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h index 4afed3718a..e334123a98 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h @@ -6,7 +6,7 @@ struct BossGanondrof; -typedef void (*BossGanondrofActionFunc)(struct BossGanondrof*, GlobalContext*); +typedef void (*BossGanondrofActionFunc)(struct BossGanondrof*, PlayState*); #define GND_REAL_BOSS 1 #define GND_FAKE_BOSS 10 diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index c590635334..199c4c7d2a 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -23,31 +23,31 @@ typedef enum { VISUALSTATE_HIT // main: greenish cyan, alternates with red; eye: greenish cyan } GohmaVisualState; -void BossGoma_Init(Actor* thisx, GlobalContext* globalCtx); -void BossGoma_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossGoma_Update(Actor* thisx, GlobalContext* globalCtx); -void BossGoma_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossGoma_Init(Actor* thisx, PlayState* play); +void BossGoma_Destroy(Actor* thisx, PlayState* play); +void BossGoma_Update(Actor* thisx, PlayState* play); +void BossGoma_Draw(Actor* thisx, PlayState* play); -void BossGoma_SetupEncounter(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorAttackPosture(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorPrepareAttack(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorAttack(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorDamaged(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorLandStruckDown(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorLand(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorStunned(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FallJump(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FallStruckDown(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_CeilingSpawnGohmas(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_CeilingPrepareSpawnGohmas(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorIdle(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_CeilingIdle(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_WallClimb(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_CeilingMoveToCenter(BossGoma* this, GlobalContext* globalCtx); -void BossGoma_SpawnChildGohma(BossGoma* this, GlobalContext* globalCtx, s16 i); +void BossGoma_SetupEncounter(BossGoma* this, PlayState* play); +void BossGoma_Encounter(BossGoma* this, PlayState* play); +void BossGoma_Defeated(BossGoma* this, PlayState* play); +void BossGoma_FloorAttackPosture(BossGoma* this, PlayState* play); +void BossGoma_FloorPrepareAttack(BossGoma* this, PlayState* play); +void BossGoma_FloorAttack(BossGoma* this, PlayState* play); +void BossGoma_FloorDamaged(BossGoma* this, PlayState* play); +void BossGoma_FloorLandStruckDown(BossGoma* this, PlayState* play); +void BossGoma_FloorLand(BossGoma* this, PlayState* play); +void BossGoma_FloorStunned(BossGoma* this, PlayState* play); +void BossGoma_FallJump(BossGoma* this, PlayState* play); +void BossGoma_FallStruckDown(BossGoma* this, PlayState* play); +void BossGoma_CeilingSpawnGohmas(BossGoma* this, PlayState* play); +void BossGoma_CeilingPrepareSpawnGohmas(BossGoma* this, PlayState* play); +void BossGoma_FloorIdle(BossGoma* this, PlayState* play); +void BossGoma_CeilingIdle(BossGoma* this, PlayState* play); +void BossGoma_FloorMain(BossGoma* this, PlayState* play); +void BossGoma_WallClimb(BossGoma* this, PlayState* play); +void BossGoma_CeilingMoveToCenter(BossGoma* this, PlayState* play); +void BossGoma_SpawnChildGohma(BossGoma* this, PlayState* play, s16 i); const ActorInit Boss_Goma_InitVars = { ACTOR_BOSS_GOMA, @@ -336,13 +336,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; -void BossGoma_Init(Actor* thisx, GlobalContext* globalCtx) { +void BossGoma_Init(Actor* thisx, PlayState* play) { s32 pad; BossGoma* this = (BossGoma*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 4000.0f, ActorShadow_DrawCircle, 150.0f); - SkelAnime_Init(globalCtx, &this->skelanime, &gGohmaSkel, &gGohmaIdleCrouchedAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelanime, &gGohmaSkel, &gGohmaIdleCrouchedAnim, NULL, NULL, 0); Animation_PlayLoop(&this->skelanime, &gGohmaIdleCrouchedAnim); this->actor.shape.rot.x = -0x8000; // upside-down this->eyeIrisScaleX = 1.0f; @@ -351,29 +351,29 @@ void BossGoma_Init(Actor* thisx, GlobalContext* globalCtx) { this->unusedInitZ = this->actor.world.pos.z; this->actor.world.pos.y = -300.0f; // ceiling this->actor.gravity = 0.0f; - BossGoma_SetupEncounter(this, globalCtx); + BossGoma_SetupEncounter(this, play); this->actor.colChkInfo.health = 10; this->actor.colChkInfo.mass = MASS_IMMOVABLE; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderItems); - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, -640.0f, 0.0f, 0, 0, - 0, WARP_DUNGEON_CHILD); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 141.0f, -640.0f, -84.0f, 0, 0, 0, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, -640.0f, 0.0f, 0, 0, 0, + WARP_DUNGEON_CHILD); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 141.0f, -640.0f, -84.0f, 0, 0, 0, 0); } } -void BossGoma_PlayEffectsAndSfx(BossGoma* this, GlobalContext* globalCtx, s16 arg2, s16 amountMinus1) { +void BossGoma_PlayEffectsAndSfx(BossGoma* this, PlayState* play, s16 arg2, s16 amountMinus1) { if (arg2 == 0 || arg2 == 1 || arg2 == 3) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightHandBackLimbWorldPos, 25.0f, amountMinus1, 8.0f, - 500, 10, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightHandBackLimbWorldPos, 25.0f, amountMinus1, 8.0f, 500, + 10, true); } if (arg2 == 0 || arg2 == 2 || arg2 == 3) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftHandBackLimbWorldPos, 25.0f, amountMinus1, 8.0f, - 500, 10, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftHandBackLimbWorldPos, 25.0f, amountMinus1, 8.0f, 500, + 10, true); } if (arg2 == 0) { @@ -383,17 +383,17 @@ void BossGoma_PlayEffectsAndSfx(BossGoma* this, GlobalContext* globalCtx, s16 ar } } -void BossGoma_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossGoma_Destroy(Actor* thisx, PlayState* play) { BossGoma* this = (BossGoma*)thisx; - SkelAnime_Free(&this->skelanime, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->collider); + SkelAnime_Free(&this->skelanime, play); + Collider_DestroyJntSph(play, &this->collider); } /** * When Gohma is hit and its health drops to 0 */ -void BossGoma_SetupDefeated(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_SetupDefeated(BossGoma* this, PlayState* play) { Animation_Change(&this->skelanime, &gGohmaDeathAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGohmaDeathAnim), ANIMMODE_ONCE, -2.0f); this->actionFunc = BossGoma_Defeated; @@ -412,15 +412,15 @@ void BossGoma_SetupDefeated(BossGoma* this, GlobalContext* globalCtx) { /** * Initial action setup, with Gohma waiting on the ceiling for the fight to start. */ -void BossGoma_SetupEncounter(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_SetupEncounter(BossGoma* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gGohmaWalkAnim); Animation_Change(&this->skelanime, &gGohmaWalkAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP, -15.0f); this->actionFunc = BossGoma_Encounter; this->actionState = 0; this->disableGameplayLogic = true; - globalCtx->envCtx.lightSettingOverride = 4; - globalCtx->envCtx.lightBlendRateOverride = 255; + play->envCtx.lightSettingOverride = 4; + play->envCtx.lightBlendRateOverride = 255; } /** @@ -580,7 +580,7 @@ void BossGoma_SetupFloorDamaged(BossGoma* this) { this->actionFunc = BossGoma_FloorDamaged; } -void BossGoma_UpdateCeilingMovement(BossGoma* this, GlobalContext* globalCtx, f32 dz, f32 targetSpeedXZ, +void BossGoma_UpdateCeilingMovement(BossGoma* this, PlayState* play, f32 dz, f32 targetSpeedXZ, s16 rotateTowardsCenter) { static Vec3f velInit = { 0.0f, 0.0f, 0.0f }; static Vec3f accelInit = { 0.0f, -0.5f, 0.0f }; @@ -613,24 +613,24 @@ void BossGoma_UpdateCeilingMovement(BossGoma* this, GlobalContext* globalCtx, f3 pos.x = Rand_CenteredFloat(70.0f) + basePos->x; pos.y = Rand_ZeroFloat(30.0f) + basePos->y; pos.z = Rand_CenteredFloat(70.0f) + basePos->z; - EffectSsHahen_Spawn(globalCtx, &pos, &vel, &accel, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, -1, 10, NULL); + EffectSsHahen_Spawn(play, &pos, &vel, &accel, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, -1, 10, NULL); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_HIGH); } } -void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_SetupEncounterState4(BossGoma* this, PlayState* play) { Player* player; - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->actionState = 4; this->actor.flags |= ACTOR_FLAG_0; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_UNK3); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); Animation_Change(&this->skelanime, &gGohmaEyeRollAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGohmaEyeRollAnim), ANIMMODE_ONCE, 0.0f); this->currentAnimFrameCount = Animation_GetLastFrame(&gGohmaEyeRollAnim); @@ -644,7 +644,7 @@ void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { player->actor.world.pos.z = 300.0f; player->actor.world.rot.y = player->actor.shape.rot.y = -0x705C; - this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) + 0x8000; + this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) + 0x8000; // room entrance, closer to room center this->subCamEye.x = 90.0f; @@ -667,9 +667,9 @@ void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { * * Skips the door and look-at-Gohma puzzle if the player already reached the boss card part before */ -void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_Encounter(BossGoma* this, PlayState* play) { Camera* mainCam; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad[2]; Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); @@ -680,22 +680,22 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { if (fabsf(player->actor.world.pos.x - 150.0f) < 60.0f && fabsf(player->actor.world.pos.z - 350.0f) < 60.0f) { if (GET_EVENTCHKINF(EVENTCHKINF_70)) { - BossGoma_SetupEncounterState4(this, globalCtx); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_SHUTTER, 164.72f, - -480.0f, 397.68002f, 0, -0x705C, 0, 0x180); + BossGoma_SetupEncounterState4(this, play); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_SHUTTER, 164.72f, -480.0f, + 397.68002f, 0, -0x705C, 0, 0x180); } else { - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); this->actionState = 1; } } break; case 1: // player entered the room - func_80064520(globalCtx, &globalCtx->csCtx); - this->subCamId = Play_CreateSubCamera(globalCtx); + func_80064520(play, &play->csCtx); + this->subCamId = Play_CreateSubCamera(play); osSyncPrintf("MAKE CAMERA !!! 1 !!!!!!!!!!!!!!!!!!!!!!!!!!\n"); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->actionState = 2; // ceiling center this->actor.world.pos.x = -150.0f; @@ -742,31 +742,31 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { this->subCamAt.z = player->actor.world.pos.z; } - Play_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, CAM_ID_MAIN, &this->subCamAt, &this->subCamEye); if (this->frameCount == 176) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_SHUTTER, 164.72f, -480.0f, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_SHUTTER, 164.72f, -480.0f, 397.68002f, 0, -0x705C, 0, SHUTTER_GOHMA_BLOCK << 6); } if (this->frameCount == 176) { - globalCtx->envCtx.lightSettingOverride = 3; - globalCtx->envCtx.lightBlendRateOverride = LIGHT_BLENDRATE_OVERRIDE_NONE; + play->envCtx.lightSettingOverride = 3; + play->envCtx.lightBlendRateOverride = LIGHT_BLENDRATE_OVERRIDE_NONE; } if (this->frameCount == 190) { - func_8002DF54(globalCtx, &this->actor, 2); + func_8002DF54(play, &this->actor, 2); } if (this->frameCount >= 228) { - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->actionState = 3; } break; @@ -777,16 +777,15 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { this->lookedAtFrames++; Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); Math_ApproachS(&this->actor.world.rot.y, - Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) + 0x8000, 2, - 0xBB8); + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) + 0x8000, 2, 0xBB8); this->eyeLidBottomRotX = this->eyeLidTopRotX = this->eyeIrisRotX = this->eyeIrisRotY = 0; } else { this->lookedAtFrames = 0; - BossGoma_UpdateCeilingMovement(this, globalCtx, 0.0f, -5.0f, true); + BossGoma_UpdateCeilingMovement(this, play, 0.0f, -5.0f, true); } if (this->lookedAtFrames > 15) { - BossGoma_SetupEncounterState4(this, globalCtx); + BossGoma_SetupEncounterState4(this, play); } break; @@ -805,7 +804,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamAt.z, this->actor.world.pos.z, 0.2f, 100.0f); if (this->framesUntilNextAction == 30) { - globalCtx->envCtx.lightSettingOverride = 4; + play->envCtx.lightSettingOverride = 4; } if (this->framesUntilNextAction < 20) { @@ -846,7 +845,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 2.0f); } else { - BossGoma_UpdateCeilingMovement(this, globalCtx, 0.0f, -7.5f, false); + BossGoma_UpdateCeilingMovement(this, play, 0.0f, -7.5f, false); } if (this->framesUntilNextAction == 0) { @@ -878,8 +877,8 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { this->subCamAt.z = this->actor.world.pos.z; SkelAnime_Update(&this->skelanime); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); - Math_ApproachS(&this->actor.world.rot.y, - Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, 0x7D0); + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), + 2, 0x7D0); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actionState = 130; @@ -887,7 +886,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Animation_Change(&this->skelanime, &gGohmaInitialLandingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGohmaInitialLandingAnim), ANIMMODE_ONCE, -2.0f); this->currentAnimFrameCount = Animation_GetLastFrame(&gGohmaInitialLandingAnim); - BossGoma_PlayEffectsAndSfx(this, globalCtx, 0, 5); + BossGoma_PlayEffectsAndSfx(this, play, 0, 5); this->framesUntilNextAction = 15; func_800A9F6C(0.0f, 0xC8, 0x14, 0x14); } @@ -901,8 +900,8 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamEye.z, this->actor.world.pos.z + 45.0f + 40.0f, 0.1f, this->subCamFollowSpeed * 30.0f); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); - Math_ApproachS(&this->actor.world.rot.y, - Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, 0x7D0); + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), + 2, 0x7D0); SkelAnime_Update(&this->skelanime); this->subCamAt.x = this->actor.world.pos.x; this->subCamAt.z = this->actor.world.pos.z; @@ -919,8 +918,8 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_CRY1); if (!GET_EVENTCHKINF(EVENTCHKINF_70)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, - SEGMENTED_TO_VIRTUAL(gGohmaTitleCardTex), 0xA0, 0xB4, 0x80, 0x28); + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gGohmaTitleCardTex), + 0xA0, 0xB4, 0x80, 0x28); } Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); @@ -942,7 +941,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { if (this->framesUntilNextAction == 0) { this->framesUntilNextAction = 30; this->actionState = 150; - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_UNK3); } break; @@ -953,23 +952,23 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->subCamEye.z, this->actor.world.pos.z + 220.0f, 0.2f, 100.0f, 0.1f); if (this->framesUntilNextAction == 0) { - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; BossGoma_SetupFloorMain(this); this->disableGameplayLogic = false; this->patienceTimer = 200; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); } break; } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } @@ -977,7 +976,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { * Handles the "Gohma defeated" cutscene and effects * Spawns the heart container and blue warp actors */ -void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_Defeated(BossGoma* this, PlayState* play) { static Vec3f roomCenter = { -150.0f, 0.0f, -350.0f }; f32 dx; f32 dz; @@ -990,7 +989,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { Vec3f accel2 = { 0.0f, -0.5f, 0.0f }; Vec3f pos; Camera* mainCam; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f childPos; s16 i; @@ -998,7 +997,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); if (Animation_OnFrame(&this->skelanime, 107.0f)) { - BossGoma_PlayEffectsAndSfx(this, globalCtx, 0, 8); + BossGoma_PlayEffectsAndSfx(this, play, 0, 8); func_800A9F6C(0.0f, 0x96, 0x14, 0x14); } @@ -1015,7 +1014,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { if (this->framesUntilNextAction < 1200 && this->framesUntilNextAction > 1100 && this->framesUntilNextAction % 8 == 0) { - EffectSsSibuki_SpawnBurst(globalCtx, &this->actor.focus.pos); + EffectSsSibuki_SpawnBurst(play, &this->actor.focus.pos); } if (this->framesUntilNextAction < 1080 && this->actionState < 3) { @@ -1032,7 +1031,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->defeatedLimbPositions[j].x; pos.y = Rand_CenteredFloat(10.0f) + this->defeatedLimbPositions[j].y; pos.z = Rand_CenteredFloat(20.0f) + this->defeatedLimbPositions[j].z; - func_8002836C(globalCtx, &pos, &vel1, &accel1, &color1, &color2, 500, 10, 10); + func_8002836C(play, &pos, &vel1, &accel1, &color1, &color2, 500, 10, 10); } } @@ -1043,8 +1042,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->defeatedLimbPositions[j].x; pos.y = Rand_CenteredFloat(10.0f) + this->defeatedLimbPositions[j].y; pos.z = Rand_CenteredFloat(20.0f) + this->defeatedLimbPositions[j].z; - EffectSsHahen_Spawn(globalCtx, &pos, &vel2, &accel2, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, -1, 10, - NULL); + EffectSsHahen_Spawn(play, &pos, &vel2, &accel2, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, -1, 10, NULL); } } } @@ -1052,12 +1050,12 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { switch (this->actionState) { case 0: this->actionState = 1; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 1); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 1); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_UNK3); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); this->subCamEye.x = mainCam->eye.x; this->subCamEye.y = mainCam->eye.y; this->subCamEye.z = mainCam->eye.z; @@ -1113,17 +1111,17 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { if (this->timer == 0) { this->actionState = 2; - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_UNK3); this->timer = 70; this->decayingProgress = 0; this->subCamFollowSpeed = 0.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 0); } break; case 2: - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); Math_SmoothStepToF(&this->subCamEye.x, mainCam->eye.x, 0.2f, this->subCamFollowSpeed * 50.0f, 0.1f); Math_SmoothStepToF(&this->subCamEye.y, mainCam->eye.y, 0.2f, this->subCamFollowSpeed * 50.0f, 0.1f); Math_SmoothStepToF(&this->subCamEye.z, mainCam->eye.z, 0.2f, this->subCamFollowSpeed * 50.0f, 0.1f); @@ -1149,9 +1147,9 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { } } - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, childPos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, childPos.x, this->actor.world.pos.y, childPos.z, 0, 0, 0, WARP_DUNGEON_CHILD); - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); } for (i = 0; i < 4; i++) { @@ -1174,14 +1172,14 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { if (this->timer == 0) { if (Math_SmoothStepToF(&this->actor.scale.y, 0, 1.0f, 0.00075f, 0.0f) <= 0.001f) { - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); Actor_Kill(&this->actor); } @@ -1191,75 +1189,75 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } if (this->blinkTimer != 0) { this->blinkTimer--; - globalCtx->envCtx.adjAmbientColor[0] += 40; - globalCtx->envCtx.adjAmbientColor[1] += 40; - globalCtx->envCtx.adjAmbientColor[2] += 80; - globalCtx->envCtx.adjFogColor[0] += 10; - globalCtx->envCtx.adjFogColor[1] += 10; - globalCtx->envCtx.adjFogColor[2] += 20; + play->envCtx.adjAmbientColor[0] += 40; + play->envCtx.adjAmbientColor[1] += 40; + play->envCtx.adjAmbientColor[2] += 80; + play->envCtx.adjFogColor[0] += 10; + play->envCtx.adjFogColor[1] += 10; + play->envCtx.adjFogColor[2] += 20; } else { - globalCtx->envCtx.adjAmbientColor[0] -= 20; - globalCtx->envCtx.adjAmbientColor[1] -= 20; - globalCtx->envCtx.adjAmbientColor[2] -= 40; - globalCtx->envCtx.adjFogColor[0] -= 5; - globalCtx->envCtx.adjFogColor[1] -= 5; - globalCtx->envCtx.adjFogColor[2] -= 10; + play->envCtx.adjAmbientColor[0] -= 20; + play->envCtx.adjAmbientColor[1] -= 20; + play->envCtx.adjAmbientColor[2] -= 40; + play->envCtx.adjFogColor[0] -= 5; + play->envCtx.adjFogColor[1] -= 5; + play->envCtx.adjFogColor[2] -= 10; } - if (globalCtx->envCtx.adjAmbientColor[0] > 200) { - globalCtx->envCtx.adjAmbientColor[0] = 200; + if (play->envCtx.adjAmbientColor[0] > 200) { + play->envCtx.adjAmbientColor[0] = 200; } - if (globalCtx->envCtx.adjAmbientColor[1] > 200) { - globalCtx->envCtx.adjAmbientColor[1] = 200; + if (play->envCtx.adjAmbientColor[1] > 200) { + play->envCtx.adjAmbientColor[1] = 200; } - if (globalCtx->envCtx.adjAmbientColor[2] > 200) { - globalCtx->envCtx.adjAmbientColor[2] = 200; + if (play->envCtx.adjAmbientColor[2] > 200) { + play->envCtx.adjAmbientColor[2] = 200; } - if (globalCtx->envCtx.adjFogColor[0] > 70) { - globalCtx->envCtx.adjFogColor[0] = 70; + if (play->envCtx.adjFogColor[0] > 70) { + play->envCtx.adjFogColor[0] = 70; } - if (globalCtx->envCtx.adjFogColor[1] > 70) { - globalCtx->envCtx.adjFogColor[1] = 70; + if (play->envCtx.adjFogColor[1] > 70) { + play->envCtx.adjFogColor[1] = 70; } - if (globalCtx->envCtx.adjFogColor[2] > 140) { - globalCtx->envCtx.adjFogColor[2] = 140; + if (play->envCtx.adjFogColor[2] > 140) { + play->envCtx.adjFogColor[2] = 140; } - if (globalCtx->envCtx.adjAmbientColor[0] < 0) { - globalCtx->envCtx.adjAmbientColor[0] = 0; + if (play->envCtx.adjAmbientColor[0] < 0) { + play->envCtx.adjAmbientColor[0] = 0; } - if (globalCtx->envCtx.adjAmbientColor[1] < 0) { - globalCtx->envCtx.adjAmbientColor[1] = 0; + if (play->envCtx.adjAmbientColor[1] < 0) { + play->envCtx.adjAmbientColor[1] = 0; } - if (globalCtx->envCtx.adjAmbientColor[2] < 0) { - globalCtx->envCtx.adjAmbientColor[2] = 0; + if (play->envCtx.adjAmbientColor[2] < 0) { + play->envCtx.adjAmbientColor[2] = 0; } - if (globalCtx->envCtx.adjFogColor[0] < 0) { - globalCtx->envCtx.adjFogColor[0] = 0; + if (play->envCtx.adjFogColor[0] < 0) { + play->envCtx.adjFogColor[0] = 0; } - if (globalCtx->envCtx.adjFogColor[1] < 0) { - globalCtx->envCtx.adjFogColor[1] = 0; + if (play->envCtx.adjFogColor[1] < 0) { + play->envCtx.adjFogColor[1] = 0; } - if (globalCtx->envCtx.adjFogColor[2] < 0) { - globalCtx->envCtx.adjFogColor[2] = 0; + if (play->envCtx.adjFogColor[2] < 0) { + play->envCtx.adjFogColor[2] = 0; } } /** * If the player backs off, cancel the attack, or attack. */ -void BossGoma_FloorAttackPosture(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorAttackPosture(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); if (this->skelanime.curFrame >= (19.0f + 1.0f / 3.0f) && this->skelanime.curFrame <= 30.0f) { - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), - 3, 0xBB8); + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), 3, + 0xBB8); } if (Animation_OnFrame(&this->skelanime, Animation_GetLastFrame(&gGohmaPrepareAttackAnim))) { @@ -1277,7 +1275,7 @@ void BossGoma_FloorAttackPosture(BossGoma* this, GlobalContext* globalCtx) { /** * Only lasts 1 frame. Plays a sound. */ -void BossGoma_FloorPrepareAttack(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorPrepareAttack(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->framesUntilNextAction == 0) { @@ -1292,7 +1290,7 @@ void BossGoma_FloorPrepareAttack(BossGoma* this, GlobalContext* globalCtx) { /** * Gohma attacks, then the action eventually goes back to BossGoma_FloorMain */ -void BossGoma_FloorAttack(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorAttack(BossGoma* this, PlayState* play) { s16 i; this->actor.flags |= ACTOR_FLAG_24; @@ -1308,8 +1306,8 @@ void BossGoma_FloorAttack(BossGoma* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelanime, 10.0f)) { - BossGoma_PlayEffectsAndSfx(this, globalCtx, 3, 5); - func_80033E88(&this->actor, globalCtx, 5, 15); + BossGoma_PlayEffectsAndSfx(this, play, 3, 5); + func_80033E88(&this->actor, play, 5, 15); } if (Animation_OnFrame(&this->skelanime, Animation_GetLastFrame(&gGohmaAttackAnim))) { @@ -1349,7 +1347,7 @@ void BossGoma_FloorAttack(BossGoma* this, GlobalContext* globalCtx) { /** * Plays the animation to its end, then goes back to BossGoma_FloorStunned */ -void BossGoma_FloorDamaged(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorDamaged(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Animation_OnFrame(&this->skelanime, Animation_GetLastFrame(&gGohmaDamageAnim))) { @@ -1367,7 +1365,7 @@ void BossGoma_FloorDamaged(BossGoma* this, GlobalContext* globalCtx) { * Sets patience to 0 * Gohma is then stunned (BossGoma_FloorStunned) */ -void BossGoma_FloorLandStruckDown(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorLandStruckDown(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Animation_OnFrame(&this->skelanime, this->currentAnimFrameCount)) { @@ -1377,14 +1375,14 @@ void BossGoma_FloorLandStruckDown(BossGoma* this, GlobalContext* globalCtx) { this->framesUntilNextAction = 150; } - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, true); } /** * Gohma is back on the floor after the player has killed its children Gohmas. * Plays an animation then goes to usual floor behavior, with refilled patience. */ -void BossGoma_FloorLand(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorLand(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Animation_OnFrame(&this->skelanime, this->currentAnimFrameCount)) { @@ -1396,14 +1394,14 @@ void BossGoma_FloorLand(BossGoma* this, GlobalContext* globalCtx) { /** * Gohma is stunned and vulnerable. It can only be damaged during this action. */ -void BossGoma_FloorStunned(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorStunned(BossGoma* this, PlayState* play) { if (this->sfxFaintTimer <= 90) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_FAINT - 0x800); } SkelAnime_Update(&this->skelanime); if (this->timer == 1) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 55.0f, 4, 8.0f, 500, 10, true); } Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); @@ -1424,34 +1422,34 @@ void BossGoma_FloorStunned(BossGoma* this, GlobalContext* globalCtx) { /** * Gohma goes back to the floor after the player killed the three gohmas it spawned */ -void BossGoma_FallJump(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FallJump(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), 2, 0x7D0); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { BossGoma_SetupFloorLand(this); this->actor.velocity.y = 0.0f; - BossGoma_PlayEffectsAndSfx(this, globalCtx, 0, 8); - func_80033E88(&this->actor, globalCtx, 5, 0xF); + BossGoma_PlayEffectsAndSfx(this, play, 0, 8); + func_80033E88(&this->actor, play, 5, 0xF); } } /** * Gohma falls to the floor after the player hit it */ -void BossGoma_FallStruckDown(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FallStruckDown(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 3, + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), 3, 0x7D0); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { BossGoma_SetupFloorLandStruckDown(this); this->actor.velocity.y = 0.0f; - BossGoma_PlayEffectsAndSfx(this, globalCtx, 0, 8); - func_80033E88(&this->actor, globalCtx, 0xA, 0xF); + BossGoma_PlayEffectsAndSfx(this, play, 0, 8); + func_80033E88(&this->actor, play, 0xA, 0xF); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_DAM1); } } @@ -1459,7 +1457,7 @@ void BossGoma_FallStruckDown(BossGoma* this, GlobalContext* globalCtx) { /** * Spawn three gohmas, one after the other. Cannot be interrupted */ -void BossGoma_CeilingSpawnGohmas(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_CeilingSpawnGohmas(BossGoma* this, PlayState* play) { s16 i; SkelAnime_Update(&this->skelanime); @@ -1493,7 +1491,7 @@ void BossGoma_CeilingSpawnGohmas(BossGoma* this, GlobalContext* globalCtx) { if (this->tailLimbsScaleTimers[0] == 2) { for (i = 0; i < ARRAY_COUNT(this->childrenGohmaState); i++) { if (this->childrenGohmaState[i] == 0) { - BossGoma_SpawnChildGohma(this, globalCtx, i); + BossGoma_SpawnChildGohma(this, play, i); break; } } @@ -1514,7 +1512,7 @@ void BossGoma_CeilingSpawnGohmas(BossGoma* this, GlobalContext* globalCtx) { * Prepare to spawn children gohmas, red eye for 70 frames * During this time, the player can interrupt by hitting Gohma and make it fall from the ceiling */ -void BossGoma_CeilingPrepareSpawnGohmas(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_CeilingPrepareSpawnGohmas(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->framesUntilNextAction == 0) { @@ -1528,7 +1526,7 @@ void BossGoma_CeilingPrepareSpawnGohmas(BossGoma* this, GlobalContext* globalCtx /** * On the floor, not doing anything special. */ -void BossGoma_FloorIdle(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorIdle(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); @@ -1543,7 +1541,7 @@ void BossGoma_FloorIdle(BossGoma* this, GlobalContext* globalCtx) { * Eventually spawns children gohmas, jumping down to the floor when they are killed, or staying on the ceiling as long * as any is still alive. */ -void BossGoma_CeilingIdle(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_CeilingIdle(BossGoma* this, PlayState* play) { s16 i; SkelAnime_Update(&this->skelanime); @@ -1578,7 +1576,7 @@ void BossGoma_CeilingIdle(BossGoma* this, GlobalContext* globalCtx) { * Gohma climbs any wall it collides with * Uses the "walk cautiously" animation */ -void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_FloorMain(BossGoma* this, PlayState* play) { s16 rot; SkelAnime_Update(&this->skelanime); @@ -1594,9 +1592,9 @@ void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelanime, 15.0f)) { - BossGoma_PlayEffectsAndSfx(this, globalCtx, 1, 3); + BossGoma_PlayEffectsAndSfx(this, play, 1, 3); } else if (Animation_OnFrame(&this->skelanime, 30.0f)) { - BossGoma_PlayEffectsAndSfx(this, globalCtx, 2, 3); + BossGoma_PlayEffectsAndSfx(this, play, 2, 3); } if (this->frameCount % 64 == 0) { @@ -1604,7 +1602,7 @@ void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx) { } if (!this->doNotMoveThisFrame) { - rot = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + rot = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); if (this->patienceTimer != 0) { this->patienceTimer--; @@ -1650,7 +1648,7 @@ void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx) { /** * Gohma moves up until it reaches the ceiling */ -void BossGoma_WallClimb(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_WallClimb(BossGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->frameCount % 8 == 0) { @@ -1672,11 +1670,11 @@ void BossGoma_WallClimb(BossGoma* this, GlobalContext* globalCtx) { /** * Goes to BossGoma_CeilingIdle after enough time and after being close enough to the center of the ceiling. */ -void BossGoma_CeilingMoveToCenter(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_CeilingMoveToCenter(BossGoma* this, PlayState* play) { s16 angle; s16 absDiff; - BossGoma_UpdateCeilingMovement(this, globalCtx, 0.0f, -5.0f, true); + BossGoma_UpdateCeilingMovement(this, play, 0.0f, -5.0f, true); if (this->frameCount % 64 == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_CRY2); @@ -1713,12 +1711,12 @@ void BossGoma_CeilingMoveToCenter(BossGoma* this, GlobalContext* globalCtx) { * - look at the player (iris rotation) * - iris scale, when menacing or damaged */ -void BossGoma_UpdateEye(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_UpdateEye(BossGoma* this, PlayState* play) { s16 targetEyeIrisRotX; s16 targetEyeIrisRotY; if (!this->disableGameplayLogic) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->eyeState == EYESTATE_IRIS_FOLLOW_BONUS_IFRAMES) { // player + 0xA73 seems to be related to "throwing something" @@ -1749,9 +1747,9 @@ void BossGoma_UpdateEye(BossGoma* this, GlobalContext* globalCtx) { if (this->eyeState != EYESTATE_IRIS_NO_FOLLOW_NO_IFRAMES) { targetEyeIrisRotY = - Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.y; + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.shape.rot.y; targetEyeIrisRotX = - Actor_WorldPitchTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.x; + Actor_WorldPitchTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.shape.rot.x; if (this->actor.shape.rot.x > 0x4000 || this->actor.shape.rot.x < -0x4000) { targetEyeIrisRotY = -(s16)(targetEyeIrisRotY + 0x8000); @@ -1803,7 +1801,7 @@ void BossGoma_UpdateTailLimbsScale(BossGoma* this) { } } -void BossGoma_UpdateHit(BossGoma* this, GlobalContext* globalCtx) { +void BossGoma_UpdateHit(BossGoma* this, PlayState* play) { if (this->invincibilityFrames != 0) { this->invincibilityFrames--; } else { @@ -1825,10 +1823,10 @@ void BossGoma_UpdateHit(BossGoma* this, GlobalContext* globalCtx) { if ((s8)this->actor.colChkInfo.health > 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_DAM1); BossGoma_SetupFloorDamaged(this); - EffectSsSibuki_SpawnBurst(globalCtx, &this->actor.focus.pos); + EffectSsSibuki_SpawnBurst(play, &this->actor.focus.pos); } else { - BossGoma_SetupDefeated(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + BossGoma_SetupDefeated(this, play); + Enemy_StartFinishingBlow(play, &this->actor); } this->invincibilityFrames = 10; @@ -1847,7 +1845,7 @@ void BossGoma_UpdateHit(BossGoma* this, GlobalContext* globalCtx) { } this->timer = 4; - func_80033E88(&this->actor, globalCtx, 4, 0xC); + func_80033E88(&this->actor, play, 4, 0xC); } } } @@ -1895,7 +1893,7 @@ void BossGoma_UpdateEyeEnvColor(BossGoma* this) { Math_ApproachF(&this->eyeEnvColor[2], targetEyeEnvColors[this->visualState][2], 0.5f, 20.0f); } -void BossGoma_Update(Actor* thisx, GlobalContext* globalCtx) { +void BossGoma_Update(Actor* thisx, PlayState* play) { BossGoma* this = (BossGoma*)thisx; s32 pad; @@ -1917,7 +1915,7 @@ void BossGoma_Update(Actor* thisx, GlobalContext* globalCtx) { if (1) {} this->eyeState = EYESTATE_IRIS_FOLLOW_BONUS_IFRAMES; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.shape.rot.y = this->actor.world.rot.y; if (!this->doNotMoveThisFrame) { @@ -1927,35 +1925,33 @@ void BossGoma_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.world.pos.y < -400.0f) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 30.0f, 80.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 80.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 30.0f, 80.0f, UPDBGCHECKINFO_FLAG_0); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 30.0f, 80.0f, UPDBGCHECKINFO_FLAG_0); } - BossGoma_UpdateEye(this, globalCtx); + BossGoma_UpdateEye(this, play); BossGoma_UpdateMainEnvColor(this); BossGoma_UpdateEyeEnvColor(this); BossGoma_UpdateTailLimbsScale(this); if (!this->disableGameplayLogic) { - BossGoma_UpdateHit(this, globalCtx); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + BossGoma_UpdateHit(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actionFunc != BossGoma_FloorStunned && this->actionFunc != BossGoma_FloorDamaged && (this->actionFunc != BossGoma_FloorMain || this->timer == 0)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } -s32 BossGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossGoma_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossGoma* this = (BossGoma*)thisx; s32 doNotDrawLimb = false; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_goma.c", 4685); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_goma.c", 4685); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, (s16)this->mainEnvColor[0], (s16)this->mainEnvColor[1], (s16)this->mainEnvColor[2], @@ -2006,7 +2002,7 @@ s32 BossGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi if (*dList != NULL) { Matrix_Push(); Matrix_Scale(this->eyeIrisScaleX, this->eyeIrisScaleY, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_goma.c", 4815), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_goma.c", 4815), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); @@ -2027,7 +2023,7 @@ s32 BossGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi Matrix_Scale(this->tailLimbsScale[limbIndex - BOSSGOMA_LIMB_TAIL4], this->tailLimbsScale[limbIndex - BOSSGOMA_LIMB_TAIL4], this->tailLimbsScale[limbIndex - BOSSGOMA_LIMB_TAIL4], MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_goma.c", 4836), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_goma.c", 4836), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); @@ -2037,12 +2033,12 @@ s32 BossGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi break; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_goma.c", 4858); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_goma.c", 4858); return doNotDrawLimb; } -void BossGoma_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossGoma_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f tailZero = { 0.0f, 0.0f, 0.0f }; static Vec3f clawBackLocalPos = { 0.0f, 0.0f, 0.0f }; static Vec3f focusEyeLocalPos = { 0.0f, 300.0f, 2650.0f }; // in the center of the surface of the lens @@ -2080,8 +2076,8 @@ void BossGoma_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Matrix_Get(&mtx); Matrix_MtxFToYXZRotS(&mtx, &childRot, 0); // These are the pieces of Gohma as it falls apart. It appears to use the same actor as the baby gohmas. - babyGohma = (EnGoma*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_GOMA, - childPos.x, childPos.y, childPos.z, childRot.x, childRot.y, childRot.z, + babyGohma = (EnGoma*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_GOMA, childPos.x, + childPos.y, childPos.z, childRot.x, childRot.y, childRot.z, sDeadLimbLifetime[limbIndex] + 100); if (babyGohma != NULL) { babyGohma->bossLimbDL = *dList; @@ -2117,28 +2113,28 @@ Gfx* BossGoma_NoBackfaceCullingDlist(GraphicsContext* gfxCtx) { return dList; } -void BossGoma_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BossGoma_Draw(Actor* thisx, PlayState* play) { BossGoma* this = (BossGoma*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_goma.c", 4991); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_goma.c", 4991); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(0.0f, -4000.0f, 0.0f, MTXMODE_APPLY); if (this->noBackfaceCulling) { - gSPSegment(POLY_OPA_DISP++, 0x08, BossGoma_NoBackfaceCullingDlist(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, BossGoma_NoBackfaceCullingDlist(play->state.gfxCtx)); } else { - gSPSegment(POLY_OPA_DISP++, 0x08, BossGoma_EmptyDlist(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, BossGoma_EmptyDlist(play->state.gfxCtx)); } - SkelAnime_DrawOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, BossGoma_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, BossGoma_OverrideLimbDraw, BossGoma_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_goma.c", 5012); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_goma.c", 5012); } -void BossGoma_SpawnChildGohma(BossGoma* this, GlobalContext* globalCtx, s16 i) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_GOMA, this->lastTailLimbWorldPos.x, +void BossGoma_SpawnChildGohma(BossGoma* this, PlayState* play, s16 i) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_GOMA, this->lastTailLimbWorldPos.x, this->lastTailLimbWorldPos.y - 50.0f, this->lastTailLimbWorldPos.z, 0, i * (0x10000 / 3), 0, i); this->childrenGohmaState[i] = 1; diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h index 14159e0750..399fa722b1 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h @@ -6,7 +6,7 @@ struct BossGoma; -typedef void (*BossGomaActionFunc)(struct BossGoma*, GlobalContext*); +typedef void (*BossGomaActionFunc)(struct BossGoma*, PlayState*); typedef enum { /* 0 */ BOSSGOMA_LIMB_NONE, diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 3fbbfd8878..8abc5cecad 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -12,7 +12,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -#define MO_WATER_LEVEL(globalCtx) globalCtx->colCtx.colHeader->waterBoxes[0].ySurface +#define MO_WATER_LEVEL(play) play->colCtx.colHeader->waterBoxes[0].ySurface #define HAS_LINK(tent) \ ((tent != NULL) && \ @@ -44,18 +44,18 @@ typedef struct { #define MO_FX_STRETCH 1 #define MO_FX_MAX_SCALE 1 -void BossMo_Init(Actor* thisx, GlobalContext* globalCtx); -void BossMo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossMo_UpdateCore(Actor* thisx, GlobalContext* globalCtx); -void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx); -void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx); -void BossMo_DrawTent(Actor* thisx, GlobalContext* globalCtx); +void BossMo_Init(Actor* thisx, PlayState* play); +void BossMo_Destroy(Actor* thisx, PlayState* play); +void BossMo_UpdateCore(Actor* thisx, PlayState* play); +void BossMo_UpdateTent(Actor* thisx, PlayState* play); +void BossMo_DrawCore(Actor* thisx, PlayState* play); +void BossMo_DrawTent(Actor* thisx, PlayState* play); -void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx); -void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx); +void BossMo_UpdateEffects(BossMo* this, PlayState* play); +void BossMo_DrawEffects(BossMoEffect* effect, PlayState* play); -void BossMo_SetupTentacle(BossMo* this, GlobalContext* globalCtx); -void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx); +void BossMo_SetupTentacle(BossMo* this, PlayState* play); +void BossMo_Tentacle(BossMo* this, PlayState* play); void BossMo_Unknown(void); @@ -324,39 +324,39 @@ static f32 sDropletWidth[41] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }; // These are sqrt(9^2 - (i/2 - 9)^2), a sphere of radius 9. -void BossMo_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossMo_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossMo* this = (BossMo*)thisx; u16 i; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); if (this->actor.params != BOSSMO_TENTACLE) { - Flags_SetSwitch(globalCtx, 0x14); + Flags_SetSwitch(play, 0x14); sMorphaCore = this; - MO_WATER_LEVEL(globalCtx) = this->waterLevel = MO_WATER_LEVEL(globalCtx); - globalCtx->roomCtx.unk_74[0] = 0xA0; - globalCtx->specialEffects = sEffects; + MO_WATER_LEVEL(play) = this->waterLevel = MO_WATER_LEVEL(play); + play->roomCtx.unk_74[0] = 0xA0; + play->specialEffects = sEffects; for (i = 0; i < BOSS_MO_EFFECT_COUNT; i++) { sEffects[i].type = MO_FX_NONE; } this->actor.world.pos.x = 200.0f; - this->actor.world.pos.y = MO_WATER_LEVEL(globalCtx) + 50.0f; + this->actor.world.pos.y = MO_WATER_LEVEL(play) + 50.0f; this->fwork[MO_TENT_SWING_SIZE_X] = 5.0f; this->drawActor = true; this->actor.colChkInfo.health = 20; this->actor.colChkInfo.mass = 0; this->actor.params = 0; Actor_SetScale(&this->actor, 0.01f); - Collider_InitCylinder(globalCtx, &this->coreCollider); - Collider_SetCylinder(globalCtx, &this->coreCollider, &this->actor, &sCylinderInit); - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + Collider_InitCylinder(play, &this->coreCollider); + Collider_SetCylinder(play, &this->coreCollider, &this->actor, &sCylinderInit); + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, -280.0f, 0.0f, 0, - 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, -200.0f, -280.0f, 0.0f, 0, 0, 0, 0); - globalCtx->roomCtx.unk_74[0] = 0xFF; - MO_WATER_LEVEL(globalCtx) = -500; + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, -280.0f, 0.0f, 0, 0, 0, + WARP_DUNGEON_ADULT); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, -200.0f, -280.0f, 0.0f, 0, 0, 0, 0); + play->roomCtx.unk_74[0] = 0xFF; + MO_WATER_LEVEL(play) = -500; return; } if (GET_EVENTCHKINF(EVENTCHKINF_74)) { @@ -369,48 +369,48 @@ void BossMo_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.world.pos.x = 1000.0f; this->timers[0] = 60; } - sMorphaTent1 = (BossMo*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_MO, - this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, BOSSMO_TENTACLE); + sMorphaTent1 = + (BossMo*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_MO, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOSSMO_TENTACLE); this->actor.draw = BossMo_DrawCore; this->actor.update = BossMo_UpdateCore; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_BOSS); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS); } else { Actor_SetScale(&this->actor, 0.01f); - BossMo_SetupTentacle(this, globalCtx); + BossMo_SetupTentacle(this, play); this->actor.colChkInfo.mass = 0xFF; - MO_WATER_LEVEL(globalCtx) = -50; + MO_WATER_LEVEL(play) = -50; this->waterTexAlpha = 90.0f; - this->actor.world.pos.y = MO_WATER_LEVEL(globalCtx); + this->actor.world.pos.y = MO_WATER_LEVEL(play); this->actor.prevPos = this->targetPos = this->actor.world.pos; - Collider_InitJntSph(globalCtx, &this->tentCollider); - Collider_SetJntSph(globalCtx, &this->tentCollider, &this->actor, &sJntSphInit, this->tentElements); + Collider_InitJntSph(play, &this->tentCollider); + Collider_SetJntSph(play, &this->tentCollider, &this->actor, &sJntSphInit, this->tentElements); this->tentMaxAngle = 1.0f; } } -void BossMo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossMo_Destroy(Actor* thisx, PlayState* play) { s32 pad; BossMo* this = (BossMo*)thisx; if (this->actor.params >= BOSSMO_TENTACLE) { - Collider_DestroyJntSph(globalCtx, &this->tentCollider); + Collider_DestroyJntSph(play, &this->tentCollider); } else { - Collider_DestroyCylinder(globalCtx, &this->coreCollider); + Collider_DestroyCylinder(play, &this->coreCollider); } } -void BossMo_SetupTentacle(BossMo* this, GlobalContext* globalCtx) { +void BossMo_SetupTentacle(BossMo* this, PlayState* play) { this->actionFunc = BossMo_Tentacle; this->work[MO_TENT_ACTION_STATE] = MO_TENT_WAIT; this->timers[0] = 50 + (s16)Rand_ZeroFloat(20.0f); } -void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { +void BossMo_Tentacle(BossMo* this, PlayState* play) { s16 tentXrot; s16 sp1B4 = 0; s32 buttons; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 indS0; s16 indS1; Camera* mainCam1; @@ -454,7 +454,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Vec3f spC8; if (this->work[MO_TENT_ACTION_STATE] <= MO_TENT_DEATH_3) { - this->actor.world.pos.y = MO_WATER_LEVEL(globalCtx); + this->actor.world.pos.y = MO_WATER_LEVEL(play); } if ((this->work[MO_TENT_ACTION_STATE] == MO_TENT_READY) || (this->work[MO_TENT_ACTION_STATE] >= MO_TENT_DEATH_START) || @@ -589,8 +589,8 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { ripplePos = this->actor.world.pos; ripplePos.x += sinf(randAngle) * randFloat; ripplePos.z += cosf(randAngle) * randFloat; - ripplePos.y = MO_WATER_LEVEL(globalCtx); - BossMo_SpawnRipple(globalCtx->specialEffects, &ripplePos, 40.0f, 110.0f, 80, 290, MO_FX_SMALL_RIPPLE); + ripplePos.y = MO_WATER_LEVEL(play); + BossMo_SpawnRipple(play->specialEffects, &ripplePos, 40.0f, 110.0f, 80, 290, MO_FX_SMALL_RIPPLE); } break; case MO_TENT_READY: @@ -686,7 +686,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { this->fwork[MO_TENT_SWING_SIZE_Z] = 0; this->timers[0] = 30; if ((fabsf(player->actor.world.pos.x - this->actor.world.pos.x) > 300.0f) || - (player->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) || HAS_LINK(otherTent) || + (player->actor.world.pos.y < MO_WATER_LEVEL(play)) || HAS_LINK(otherTent) || (fabsf(player->actor.world.pos.z - this->actor.world.pos.z) > 300.0f)) { this->work[MO_TENT_ACTION_STATE] = MO_TENT_RETREAT; @@ -728,7 +728,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { } if (this->work[MO_TENT_ACTION_STATE] == MO_TENT_CURL) { if ((this->timers[0] >= 5) && (this->linkHitTimer != 0) && (player->actor.parent == NULL)) { - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; this->work[MO_TENT_ACTION_STATE] = MO_TENT_GRAB; func_80078914(&this->tentTipPos, NA_SE_EN_MOFER_CATCH); @@ -767,7 +767,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Math_ApproachS(&player->actor.shape.rot.y, this->grabPosRot.rot.y, 2, 0x7D0); Math_ApproachS(&player->actor.shape.rot.z, this->grabPosRot.rot.z, 2, 0x7D0); if (this->timers[0] == 0) { - mainCam1 = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam1 = Play_GetCamera(play, CAM_ID_MAIN); this->work[MO_TENT_ACTION_STATE] = MO_TENT_SHAKE; this->tentMaxAngle = .001f; this->fwork[MO_TENT_SWING_RATE_X] = this->fwork[MO_TENT_SWING_RATE_Z] = @@ -776,10 +776,10 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { this->mashCounter = 0; this->sfxTimer = 30; Audio_ResetIncreasingTranspose(); - func_80064520(globalCtx, &globalCtx->csCtx); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->subCamEye = mainCam1->eye; this->subCamAt = mainCam1->at; this->subCamYaw = Math_FAtan2F(this->subCamEye.x - this->actor.world.pos.x, @@ -796,11 +796,11 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Interface_ChangeAlpha(0xB); } if ((this->timers[0] % 8) == 0) { - globalCtx->damagePlayer(globalCtx, -1); + play->damagePlayer(play, -1); } Math_ApproachF(&this->waterLevelMod, -5.0f, 0.1f, 0.4f); sp1B4 = this->tentRot[15].x; - buttons = globalCtx->state.input[0].press.button; + buttons = play->state.input[0].press.button; if (CHECK_BTN_ALL(buttons, BTN_A) || CHECK_BTN_ALL(buttons, BTN_B)) { this->mashCounter++; } @@ -839,7 +839,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { player->actor.parent = NULL; player->csMode = 0; if (this->timers[0] == 0) { - func_8002F6D4(globalCtx, &this->actor, 20.0f, this->actor.shape.rot.y + 0x8000, 10.0f, 0); + func_8002F6D4(play, &this->actor, 20.0f, this->actor.shape.rot.y + 0x8000, 10.0f, 0); } } this->timers[0] = 75; @@ -859,7 +859,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamAt.x, player->actor.world.pos.x, 0.5f, 50.0f); Math_ApproachF(&this->subCamAt.y, player->actor.world.pos.y, 0.5f, 50.0f); Math_ApproachF(&this->subCamAt.z, player->actor.world.pos.z, 0.5f, 50.0f); - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } break; case MO_TENT_CUT: @@ -876,7 +876,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { sp120.x += Rand_CenteredFloat(30.0f); sp120.y += Rand_CenteredFloat(30.0f); sp120.z += Rand_CenteredFloat(30.0f); - BossMo_SpawnStillDroplet(globalCtx->specialEffects, &sp120, Rand_ZeroFloat(0.1f) + .2f); + BossMo_SpawnStillDroplet(play->specialEffects, &sp120, Rand_ZeroFloat(0.1f) + .2f); } this->meltIndex++; } @@ -895,15 +895,15 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamAt.x, player->actor.world.pos.x, 0.5f, 50.0f); Math_ApproachF(&this->subCamAt.y, player->actor.world.pos.y, 0.5f, 50.0f); Math_ApproachF(&this->subCamAt.z, player->actor.world.pos.z, 0.5f, 50.0f); - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); if (player->actor.world.pos.y <= 42.0f) { - mainCam2 = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam2 = Play_GetCamera(play, CAM_ID_MAIN); mainCam2->eye = this->subCamEye; mainCam2->eyeNext = this->subCamEye; mainCam2->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); + func_80064534(play, &play->csCtx); } } for (indS1 = 0; indS1 < 41; indS1++) { @@ -946,7 +946,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { } if ((this == sMorphaTent1) && (sMorphaCore->hitCount >= 3) && (sMorphaTent2 == NULL)) { sMorphaTent2 = - (BossMo*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_MO, this->actor.world.pos.x, + (BossMo*)Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_MO, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOSSMO_TENTACLE); sMorphaTent2->tentSpawnPos = this->tentSpawnPos; @@ -1096,16 +1096,15 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { spD4.y = -280.0f; } spD4.z += spE0.z * 3.0f; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &spD4, &spE0, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &spD4, &spE0, ((300 - indS1) * .0015f) + 0.13f); } - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, - this->actor.world.pos.x, -280.0f, this->actor.world.pos.z, 0, 0, 0, - WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.world.pos.x + 200.0f, - -280.0f, this->actor.world.pos.z, 0, 0, 0, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, this->actor.world.pos.x, + -280.0f, this->actor.world.pos.z, 0, 0, 0, WARP_DUNGEON_ADULT); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x + 200.0f, -280.0f, + this->actor.world.pos.z, 0, 0, 0, 0); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); } } break; @@ -1134,11 +1133,11 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { temp = (this->actor.scale.x * 100.0f) * 20.0f; pos.x = this->tentPos[indS1].x + Rand_CenteredFloat(temp); pos.z = this->tentPos[indS1].z + Rand_CenteredFloat(temp); - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &pos, &velocity, scale); + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &pos, &velocity, scale); } } -void BossMo_TentCollisionCheck(BossMo* this, GlobalContext* globalCtx) { +void BossMo_TentCollisionCheck(BossMo* this, PlayState* play) { s16 i1; for (i1 = 0; i1 < ARRAY_COUNT(this->tentElements); i1++) { @@ -1173,7 +1172,7 @@ void BossMo_TentCollisionCheck(BossMo* this, GlobalContext* globalCtx) { pos = this->tentPos[2 * i1]; pos.x += velocity.x * 3.0f; pos.z += velocity.z * 3.0f; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &pos, &velocity, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &pos, &velocity, Rand_ZeroFloat(0.08f) + 0.13f); } break; @@ -1185,7 +1184,7 @@ void BossMo_TentCollisionCheck(BossMo* this, GlobalContext* globalCtx) { } } -void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { +void BossMo_IntroCs(BossMo* this, PlayState* play) { static Vec3f cutsceneTargets[6] = { { -360.0f, -190.0f, 0.0f }, { 250.0f, -190.0f, 0.0f }, { 300.0f, -120.0f, -278.0f }, { 180.0f, -80.0f, -340.0f }, { 180.0f, 0.0f, -340.0f }, { 180.0f, 60.0f, -230.0f }, @@ -1200,8 +1199,8 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { f32 sp80; f32 sp7C; f32 sp78; - Player* player = GET_PLAYER(globalCtx); - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Player* player = GET_PLAYER(play); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); Vec3f bubblePos; Vec3f bubblePos2; Camera* mainCam2; @@ -1215,7 +1214,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { switch (this->csState) { case MO_INTRO_WAIT: if (this->timers[0] == 1) { - Message_StartTextbox(globalCtx, 0x403F, NULL); + Message_StartTextbox(play, 0x403F, NULL); } if (((fabsf(player->actor.world.pos.z - 180.0f) < 40.0f) && (fabsf(player->actor.world.pos.x - 180.0f) < 40.0f)) || @@ -1226,11 +1225,11 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { ((fabsf(player->actor.world.pos.z - -180.0f) < 40.0f) && (fabsf(player->actor.world.pos.x - -180.0f) < 40.0f))) { // checks if Link is on one of the four platforms - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->actor.speedXZ = 0.0f; this->csState = MO_INTRO_START; this->timers[2] = 50; @@ -1239,7 +1238,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { sMorphaTent1->work[MO_TENT_ACTION_STATE] = MO_TENT_READY; sMorphaTent1->timers[0] = 30000; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x3200FF); - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } else { break; } @@ -1261,7 +1260,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { bubblePos.x = (this->subCamEye.x + 20.0f) + 10.0f; bubblePos.y = -250.0f; bubblePos.z = this->subCamEye.z; - EffectSsBubble_Spawn(globalCtx, &bubblePos, 0.0f, 10.0f, 50.0f, Rand_ZeroFloat(0.05f) + 0.13f); + EffectSsBubble_Spawn(play, &bubblePos, 0.0f, 10.0f, 50.0f, Rand_ZeroFloat(0.05f) + 0.13f); } if (this->timers[2] == 40) { func_80078914(&sAudioZeroVec, NA_SE_EN_MOFER_BUBLE_DEMO); @@ -1303,7 +1302,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { bubblePos2.x = (this->subCamEye.x + 20.0f) + 10.0f; bubblePos2.y = -250.0f; bubblePos2.z = this->subCamEye.z; - EffectSsBubble_Spawn(globalCtx, &bubblePos2, 0.0f, 10.0f, 50.0f, Rand_ZeroFloat(0.05f) + 0.13f); + EffectSsBubble_Spawn(play, &bubblePos2, 0.0f, 10.0f, 50.0f, Rand_ZeroFloat(0.05f) + 0.13f); } sp7C = (f32)0x1000; sp78 = 0.1f; @@ -1335,11 +1334,11 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.speedXZ, sp80, 1.0f, sp78); Math_ApproachF(&this->subCamYawRate, sp7C, 1.0f, 128.0f); if (this->work[MO_TENT_MOVE_TIMER] == 525) { - func_8002DF54(globalCtx, &this->actor, 2); + func_8002DF54(play, &this->actor, 2); } if (this->work[MO_TENT_MOVE_TIMER] > 540) { this->csState = MO_INTRO_REVEAL; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); sMorphaTent1->drawActor = true; player->actor.world.pos.x = 180.0f; player->actor.world.pos.z = -210.0f; @@ -1422,8 +1421,8 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } if (this->timers[2] == 130) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, - SEGMENTED_TO_VIRTUAL(gMorphaTitleCardTex), 0xA0, 0xB4, 0x80, 0x28); + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gMorphaTitleCardTex), 0xA0, + 0xB4, 0x80, 0x28); SET_EVENTCHKINF(EVENTCHKINF_74); } break; @@ -1440,15 +1439,15 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { sMorphaTent1->timers[0] = 50; } if (this->timers[2] == 20) { - mainCam2 = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam2 = Play_GetCamera(play, CAM_ID_MAIN); mainCam2->eye = this->subCamEye; mainCam2->eyeNext = this->subCamEye; mainCam2->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); // MO_BATTLE / SUB_CAM_ID_DONE this->csState = this->subCamId = 0; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); } break; } @@ -1483,11 +1482,11 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { this->subCamUp.x = this->subCamUp.z = sinf(this->work[MO_TENT_VAR_TIMER] * 0.03f) * this->subCamYawShake * (-2.0f); this->subCamUp.y = 1.0f; - Play_CameraSetAtEyeUp(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); + Play_CameraSetAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - Play_CameraSetFov(globalCtx, this->subCamId, this->subCamFov); + Play_CameraSetFov(play, this->subCamId, this->subCamFov); } if ((this->csState > MO_INTRO_START) && (this->work[MO_TENT_MOVE_TIMER] > 540)) { @@ -1497,7 +1496,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { } } -void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { +void BossMo_DeathCs(BossMo* this, PlayState* play) { s16 i; s16 one; f32 dx; @@ -1506,17 +1505,17 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { f32 sp7C; Vec3f sp70; Vec3f sp64; - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); Vec3f velocity; Vec3f pos; switch (this->csState) { case MO_DEATH_START: - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->csState = MO_DEATH_MO_CORE_BURST; this->subCamEye = mainCam->eye; this->timers[0] = 90; @@ -1558,13 +1557,13 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { pos.x += 2.0f * velocity.x; pos.y += 2.0f * velocity.y; pos.z += 2.0f * velocity.z; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &pos, &velocity, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &pos, &velocity, Rand_ZeroFloat(0.08f) + 0.13f); } this->drawActor = false; this->actor.flags &= ~ACTOR_FLAG_0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_MOFER_CORE_JUMP); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 70, NA_SE_EN_MOFER_LASTVOICE); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 70, NA_SE_EN_MOFER_LASTVOICE); } if (this->timers[0] == 0) { this->csState = MO_DEATH_DRAIN_WATER_1; @@ -1678,10 +1677,10 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); sMorphaTent1->actor.world.pos.y = -1000.0f; } } else { @@ -1703,9 +1702,9 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { } } if (sMorphaCore->waterLevel < -200.0f) { - globalCtx->roomCtx.unk_74[0]++; - if (globalCtx->roomCtx.unk_74[0] >= 0xFF) { - globalCtx->roomCtx.unk_74[0] = 0xFF; + play->roomCtx.unk_74[0]++; + if (play->roomCtx.unk_74[0] >= 0xFF) { + play->roomCtx.unk_74[0] = 0xFF; } } if (sMorphaCore->waterLevel < -250.0f) { @@ -1727,13 +1726,13 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { this->subCamAtVel.y * this->subCamVelFactor); Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, this->subCamAccel); } - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } -void BossMo_CoreCollisionCheck(BossMo* this, GlobalContext* globalCtx) { +void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { s16 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("Core_Damage_check START\n"); @@ -1774,7 +1773,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, GlobalContext* globalCtx) { if (((sMorphaTent1->subCamId == SUB_CAM_ID_DONE) && (sMorphaTent2 == NULL)) || ((sMorphaTent1->subCamId == SUB_CAM_ID_DONE) && (sMorphaTent2 != NULL) && (sMorphaTent2->subCamId == SUB_CAM_ID_DONE))) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); this->csState = MO_DEATH_START; sMorphaTent1->drawActor = false; @@ -1823,7 +1822,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, GlobalContext* globalCtx) { pos = this->actor.world.pos; pos.x += (velocity.x * 3.0f); pos.z += (velocity.z * 3.0f); - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &pos, &velocity, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &pos, &velocity, Rand_ZeroFloat(0.08f) + 0.13f); } } @@ -1833,13 +1832,13 @@ void BossMo_CoreCollisionCheck(BossMo* this, GlobalContext* globalCtx) { osSyncPrintf(VT_RST); } -void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { +void BossMo_Core(BossMo* this, PlayState* play) { static f32 coreBulge[11] = { 0.1f, 0.15f, 0.2f, 0.3f, 0.4f, 0.43f, 0.4f, 0.3f, 0.2f, 0.15f, 0.1f, }; u8 nearLand; - s16 i; // not on stack - Player* player = GET_PLAYER(globalCtx); // not on stack + s16 i; // not on stack + Player* player = GET_PLAYER(play); // not on stack f32 spDC; f32 spD8; f32 spD4; @@ -1873,17 +1872,17 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->baseAlpha, 255.0f, 1.0f, 10.0f); if ((this->csState != MO_BATTLE) && (this->csState < MO_DEATH_START)) { - BossMo_IntroCs(this, globalCtx); + BossMo_IntroCs(this, play); if (this->work[MO_TENT_ACTION_STATE] == MO_CORE_INTRO_WAIT) { this->actor.flags &= ~ACTOR_FLAG_0; return; } } else if (this->csState >= MO_DEATH_START) { - BossMo_DeathCs(this, globalCtx); + BossMo_DeathCs(this, play); return; } if ((this->work[MO_TENT_ACTION_STATE] < MO_CORE_ATTACK) && (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_MOVE) && - (this->actor.world.pos.y > MO_WATER_LEVEL(globalCtx))) { + (this->actor.world.pos.y > MO_WATER_LEVEL(play))) { if (this->actor.velocity.y > 0.0f) { xScaleTarget = 0.005f; yScaleTarget = 0.015f; @@ -1899,7 +1898,7 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.scale.y, yScaleTarget, 0.2f, 0.001f); this->work[MO_CORE_DRAW_SHADOW] = BossMo_NearLand(&this->actor.world.pos, 15.0f); nearLand = BossMo_NearLand(&this->actor.world.pos, 0.0f); - if ((player->actor.world.pos.y < (MO_WATER_LEVEL(globalCtx) - 50.0f)) && + if ((player->actor.world.pos.y < (MO_WATER_LEVEL(play) - 50.0f)) && ((this->work[MO_TENT_ACTION_STATE] == MO_CORE_MOVE) || (this->work[MO_TENT_ACTION_STATE] == MO_CORE_MAKE_TENT))) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_UNDERWATER; @@ -1912,7 +1911,7 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { if ((this->timers[0] == 0) && ((sMorphaTent1->work[MO_TENT_ACTION_STATE] == MO_TENT_WAIT) || (sMorphaTent1->work[MO_TENT_ACTION_STATE] == MO_TENT_READY)) && - (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx))) { + (this->actor.world.pos.y < MO_WATER_LEVEL(play))) { this->actor.speedXZ = 0.0f; this->work[MO_TENT_ACTION_STATE] = MO_CORE_MAKE_TENT; if (sMorphaTent1->work[MO_TENT_ACTION_STATE] == MO_TENT_WAIT) { @@ -1941,7 +1940,7 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { } break; case MO_CORE_UNDERWATER: - if (player->actor.world.pos.y >= MO_WATER_LEVEL(globalCtx)) { + if (player->actor.world.pos.y >= MO_WATER_LEVEL(play)) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_MOVE; this->actor.speedXZ = 0.0f; } @@ -1952,7 +1951,7 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_MOVE; this->timers[0] = 30; } - if (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) { + if (this->actor.world.pos.y < MO_WATER_LEVEL(play)) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_MAKE_TENT; this->timers[0] = 50; this->actor.speedXZ = 0.0f; @@ -2047,14 +2046,14 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { (this->work[MO_TENT_ACTION_STATE] == MO_CORE_STUNNED)) { this->actor.world.pos.y += this->actor.velocity.y; this->actor.velocity.y -= 1.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 20.0f, 100.0f, UPDBGCHECKINFO_FLAG_0); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 20.0f, 100.0f, UPDBGCHECKINFO_FLAG_0); effectVelocity.x = effectVelocity.y = effectVelocity.z = 0.0f; for (i = 0; i < 1; i++) { effectPos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; effectPos.y = Rand_CenteredFloat(20.0f) + this->actor.world.pos.y; effectPos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &effectPos, - &effectVelocity, Rand_ZeroFloat(0.02f) + 0.05f); + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &effectPos, &effectVelocity, + Rand_ZeroFloat(0.02f) + 0.05f); }; if (nearLand) { @@ -2075,24 +2074,24 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { effectPos = this->actor.world.pos; effectPos.x += effectVelocity.x; effectPos.z += effectVelocity.z; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &effectPos, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &effectPos, &effectVelocity, Rand_ZeroFloat(0.08f) + 0.13f); } effectVelocity.x = effectVelocity.y = effectVelocity.z = 0.0f; effectPos = this->actor.world.pos; effectPos.y = 0.0f; - BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)globalCtx->specialEffects, &effectPos, + BossMo_SpawnDroplet(MO_FX_DROPLET, (BossMoEffect*)play->specialEffects, &effectPos, &effectVelocity, 0.4f); } } - } else if (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) { + } else if (this->actor.world.pos.y < MO_WATER_LEVEL(play)) { this->actor.velocity.y = BossMo_NearLand(&this->actor.world.pos, 40.0f) ? 15.0f : 6.0f; - if ((this->actor.world.pos.y + 15.0f) >= MO_WATER_LEVEL(globalCtx)) { + if ((this->actor.world.pos.y + 15.0f) >= MO_WATER_LEVEL(play)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MOFER_CORE_JUMP); } } } else if (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_MOVE) { - if (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) { + if (this->actor.world.pos.y < MO_WATER_LEVEL(play)) { if (this->work[MO_TENT_ACTION_STATE] == MO_CORE_MAKE_TENT) { this->targetPos.x = sMorphaTent1->targetPos.x; this->targetPos.y = sMorphaTent1->actor.world.pos.y - 40.0f; @@ -2148,11 +2147,11 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { temp = (this->actor.world.pos.y < -200.0f) ? UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 : UPDBGCHECKINFO_FLAG_0; this->actor.world.pos.y -= 20.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 20.0f, 100.0f, temp); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 20.0f, 100.0f, temp); this->actor.world.pos.y += 20.0f; } } - if ((this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) && (MO_WATER_LEVEL(globalCtx) <= this->actor.prevPos.y)) { + if ((this->actor.world.pos.y < MO_WATER_LEVEL(play)) && (MO_WATER_LEVEL(play) <= this->actor.prevPos.y)) { if (this->actor.velocity.y < -5.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MOFER_CORE_JUMP); } else { @@ -2173,19 +2172,19 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { effectPos = this->actor.world.pos; effectPos.x += effectVelocity.x * 3.0f; - effectPos.y = MO_WATER_LEVEL(globalCtx); + effectPos.y = MO_WATER_LEVEL(play); effectPos.z += effectVelocity.z * 3.0f; - BossMo_SpawnDroplet(MO_FX_SPLASH, (BossMoEffect*)globalCtx->specialEffects, &effectPos, &effectVelocity, + BossMo_SpawnDroplet(MO_FX_SPLASH, (BossMoEffect*)play->specialEffects, &effectPos, &effectVelocity, Rand_ZeroFloat(0.075f) + 0.15f); } effectPos = this->actor.world.pos; - effectPos.y = MO_WATER_LEVEL(globalCtx); - BossMo_SpawnRipple(globalCtx->specialEffects, &effectPos, 100.0f, 800.0f, 100, 290, MO_FX_SMALL_RIPPLE); - BossMo_SpawnRipple(globalCtx->specialEffects, &effectPos, 50.0f, 600.0f, 70, 290, MO_FX_SMALL_RIPPLE); - BossMo_SpawnRipple(globalCtx->specialEffects, &effectPos, 0, 400.0f, 50, 290, MO_FX_SMALL_RIPPLE); + effectPos.y = MO_WATER_LEVEL(play); + BossMo_SpawnRipple(play->specialEffects, &effectPos, 100.0f, 800.0f, 100, 290, MO_FX_SMALL_RIPPLE); + BossMo_SpawnRipple(play->specialEffects, &effectPos, 50.0f, 600.0f, 70, 290, MO_FX_SMALL_RIPPLE); + BossMo_SpawnRipple(play->specialEffects, &effectPos, 0, 400.0f, 50, 290, MO_FX_SMALL_RIPPLE); } } - if ((this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) || (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_ATTACK)) { + if ((this->actor.world.pos.y < MO_WATER_LEVEL(play)) || (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_ATTACK)) { for (i = 0; i < 3; i++) { effectAccel.x = effectAccel.z = 0.0f; effectVelocity.x = effectVelocity.y = effectVelocity.z = 0.0f; @@ -2199,24 +2198,24 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { effectPos.x = Rand_CenteredFloat(sp58) + this->actor.world.pos.x; effectPos.y = Rand_CenteredFloat(sp58) + this->actor.world.pos.y; effectPos.z = Rand_CenteredFloat(sp58) + this->actor.world.pos.z; - BossMo_SpawnBubble(globalCtx->specialEffects, &effectPos, &effectVelocity, &effectAccel, + BossMo_SpawnBubble(play->specialEffects, &effectPos, &effectVelocity, &effectAccel, Rand_ZeroFloat(0.05f) + 0.1f, NULL); } } - BossMo_CoreCollisionCheck(this, globalCtx); + BossMo_CoreCollisionCheck(this, play); } -void BossMo_UpdateCore(Actor* thisx, GlobalContext* globalCtx) { +void BossMo_UpdateCore(Actor* thisx, PlayState* play) { s32 pad; BossMo* this = (BossMo*)thisx; s16 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); osSyncPrintf("CORE mode = <%d>\n", this->work[MO_TENT_ACTION_STATE]); if (sMorphaTent2 == NULL) { - MO_WATER_LEVEL(globalCtx) = sMorphaTent1->waterLevelMod + (s16)this->waterLevel; + MO_WATER_LEVEL(play) = sMorphaTent1->waterLevelMod + (s16)this->waterLevel; } else { - MO_WATER_LEVEL(globalCtx) = sMorphaTent2->waterLevelMod + ((s16)this->waterLevel + sMorphaTent1->waterLevelMod); + MO_WATER_LEVEL(play) = sMorphaTent2->waterLevelMod + ((s16)this->waterLevel + sMorphaTent1->waterLevelMod); } this->actor.flags |= ACTOR_FLAG_9; this->actor.focus.pos = this->actor.world.pos; @@ -2236,28 +2235,27 @@ void BossMo_UpdateCore(Actor* thisx, GlobalContext* globalCtx) { } } - BossMo_Core(this, globalCtx); + BossMo_Core(this, play); Collider_UpdateCylinder(&this->actor, &this->coreCollider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->coreCollider.base); - if ((this->work[MO_TENT_ACTION_STATE] != MO_CORE_STUNNED) || - (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx))) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->coreCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->coreCollider.base); + if ((this->work[MO_TENT_ACTION_STATE] != MO_CORE_STUNNED) || (this->actor.world.pos.y < MO_WATER_LEVEL(play))) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->coreCollider.base); } else { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->coreCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->coreCollider.base); } - BossMo_UpdateEffects(this, globalCtx); + BossMo_UpdateEffects(this, play); if (player->actor.parent != NULL) { this->actor.flags &= ~ACTOR_FLAG_0; } BossMo_Unknown(); } -void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { +void BossMo_UpdateTent(Actor* thisx, PlayState* play) { s16 i; s16 index; s32 pad; BossMo* this = (BossMo*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 phi_f0; if ((this == sMorphaTent2) && (this->tent2KillTimer != 0)) { @@ -2271,7 +2269,7 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { return; } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->tentPos[40], &this->tentTipPos, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->tentPos[40], &this->tentTipPos, &this->actor.projectedW); osSyncPrintf("MO : Move mode = <%d>\n", this->work[MO_TENT_ACTION_STATE]); Math_ApproachS(&player->actor.shape.rot.x, 0, 5, 0x3E8); @@ -2315,7 +2313,7 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { Math_ApproachF(&this->tentRippleSize, 0.0f, 0.1f, 0.005f); Math_ApproachF(&this->tentPulse, 0.2f, 0.5f, 0.01f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < ARRAY_COUNT(this->timers); i++) { if (this->timers[i] != 0) { this->timers[i]--; @@ -2340,8 +2338,8 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { pos = this->tentPos[38]; } } - BossMo_SpawnRipple(globalCtx->specialEffects, &pos, rippleScale, rippleScale * 3.0f, this->baseAlpha * 0.6666f, - 300, MO_FX_BIG_RIPPLE); + BossMo_SpawnRipple(play->specialEffects, &pos, rippleScale, rippleScale * 3.0f, this->baseAlpha * 0.6666f, 300, + MO_FX_BIG_RIPPLE); } if (this->baseBubblesTimer != 0) { Vec3f sp88; @@ -2366,9 +2364,9 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { } } bubblePos.x = this->tentPos[i].x + sp7C.x; - bubblePos.y = (MO_WATER_LEVEL(globalCtx) - 40.0f) + Rand_ZeroFloat(20.0f); + bubblePos.y = (MO_WATER_LEVEL(play) - 40.0f) + Rand_ZeroFloat(20.0f); bubblePos.z = this->tentPos[i].z + sp7C.z; - BossMo_SpawnBubble(globalCtx->specialEffects, &bubblePos, &zeroVec, &zeroVec, Rand_ZeroFloat(0.05f) + 0.2f, + BossMo_SpawnBubble(play->specialEffects, &bubblePos, &zeroVec, &zeroVec, Rand_ZeroFloat(0.05f) + 0.2f, &this->tentPos[i]); } @@ -2383,18 +2381,18 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { } if (this->drawActor) { - BossMo_TentCollisionCheck(this, globalCtx); + BossMo_TentCollisionCheck(this, play); if ((this->work[MO_TENT_INVINC_TIMER] == 0) && (this->work[MO_TENT_ACTION_STATE] != MO_TENT_GRAB) && (this->work[MO_TENT_ACTION_STATE] != MO_TENT_SHAKE)) { BossMo* otherTent = (BossMo*)this->otherTent; if (!HAS_LINK(otherTent) && (this->cutIndex == 0)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->tentCollider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->tentCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->tentCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->tentCollider.base); } } if (this->cutIndex == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->tentCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->tentCollider.base); } } this->work[MO_TENT_BASE_TEX1_X]++; @@ -2430,21 +2428,21 @@ static Gfx* sTentDLists[41] = { gMorphaTentaclePart40DL, }; -void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { +void BossMo_DrawTentacle(BossMo* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s16 i; s16 notCut; s16 index; - Mtx* matrix = Graph_Alloc(globalCtx->state.gfxCtx, 41 * sizeof(Mtx)); + Mtx* matrix = Graph_Alloc(play->state.gfxCtx, 41 * sizeof(Mtx)); f32 phi_f20; f32 phi_f22; Vec3f sp110; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6366); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 6366); - sp110.x = globalCtx->envCtx.dirLight1.params.dir.x; - sp110.y = globalCtx->envCtx.dirLight1.params.dir.y; - sp110.z = globalCtx->envCtx.dirLight1.params.dir.z; + sp110.x = play->envCtx.dirLight1.params.dir.x; + sp110.y = play->envCtx.dirLight1.params.dir.y; + sp110.z = play->envCtx.dirLight1.params.dir.z; Matrix_Push(); @@ -2495,7 +2493,7 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, matrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (i == 0) { - func_8002EB44(&this->tentPos[i], &globalCtx->view.eye, &sp110, globalCtx->state.gfxCtx); + func_8002EB44(&this->tentPos[i], &play->view.eye, &sp110, play->state.gfxCtx); } if (i == 0) { @@ -2520,10 +2518,10 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { Matrix_Translate(((BossMo_RandZeroOne() - 0.5f) * 10.0f) * this->tentScale[i - 2].x, ((BossMo_RandZeroOne() - 0.5f) * 3.0f) + phi_f20, ((BossMo_RandZeroOne() - 0.5f) * 10.0f) * this->tentScale[i - 2].z, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(phi_f22, phi_f22, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6511), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_mo.c", 6511), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gMorphaBubbleDL); @@ -2559,21 +2557,21 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6571); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 6571); } -void BossMo_DrawWater(BossMo* this, GlobalContext* globalCtx) { +void BossMo_DrawWater(BossMo* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6582); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 6582); if (1) {} Matrix_Push(); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_Translate(0.0f, MO_WATER_LEVEL(globalCtx), 0.0f, MTXMODE_NEW); + func_80093D84(play->state.gfxCtx); + Matrix_Translate(0.0f, MO_WATER_LEVEL(play), 0.0f, MTXMODE_NEW); gSPSegment(POLY_XLU_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->waterTex1x, (s16)this->waterTex1y, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->waterTex1x, (s16)this->waterTex1y, 32, 32, 1, (s16)this->waterTex2x, (s16)this->waterTex2y, 32, 32)); gDPPipeSync(POLY_XLU_DISP++); @@ -2583,43 +2581,43 @@ void BossMo_DrawWater(BossMo* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 80); Matrix_Scale(0.5f, 1.0f, 0.5f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6675), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_mo.c", 6675), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gMorphaWaterDL); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6680); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 6680); } -void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { +void BossMo_DrawCore(Actor* thisx, PlayState* play) { s32 pad; BossMo* this = (BossMo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6688); - if (this->actor.world.pos.y > MO_WATER_LEVEL(globalCtx)) { - BossMo_DrawWater(this, globalCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 6688); + if (this->actor.world.pos.y > MO_WATER_LEVEL(play)) { + BossMo_DrawWater(this, play); } if (this->drawActor) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, sMorphaTent1->work[MO_TENT_VAR_TIMER] * 3, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, sMorphaTent1->work[MO_TENT_VAR_TIMER] * 3, sMorphaTent1->work[MO_TENT_VAR_TIMER] * 3, 32, 32, 1, sMorphaTent1->work[MO_TENT_VAR_TIMER] * -3, sMorphaTent1->work[MO_TENT_VAR_TIMER] * -3, 32, 32)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, sMorphaTent1->work[MO_TENT_VAR_TIMER] * 5, 0, 32, 32, 1, - 0, sMorphaTent1->work[MO_TENT_VAR_TIMER] * -10, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, sMorphaTent1->work[MO_TENT_VAR_TIMER] * 5, 0, 32, 32, 1, 0, + sMorphaTent1->work[MO_TENT_VAR_TIMER] * -10, 32, 32)); Matrix_RotateX(this->work[MO_TENT_MOVE_TIMER] * 0.5f, MTXMODE_APPLY); Matrix_RotateZ(this->work[MO_TENT_MOVE_TIMER] * 0.8f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6735), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_mo.c", 6735), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, (s8)this->baseAlpha); - func_8002ED80(&this->actor, globalCtx, 0); + func_8002ED80(&this->actor, play, 0); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gMorphaCoreMembraneDL)); @@ -2634,11 +2632,11 @@ void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gMorphaCoreNucleusDL)); if ((this->work[MO_CORE_DRAW_SHADOW] && (this->actor.world.pos.y >= 0.0f)) || - (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx))) { + (this->actor.world.pos.y < MO_WATER_LEVEL(play))) { f32 groundLevel; s16 shadowAlpha; - if (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) { + if (this->actor.world.pos.y < MO_WATER_LEVEL(play)) { groundLevel = -280.0f; shadowAlpha = 100; } else { @@ -2646,21 +2644,21 @@ void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { shadowAlpha = 160; } - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, shadowAlpha); Matrix_Translate(this->actor.world.pos.x, groundLevel, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(0.23f, 1.0f, 0.23f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6820), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_mo.c", 6820), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gCircleShadowDL)); } } - if (this->actor.world.pos.y < MO_WATER_LEVEL(globalCtx)) { - BossMo_DrawWater(this, globalCtx); + if (this->actor.world.pos.y < MO_WATER_LEVEL(play)) { + BossMo_DrawWater(this, play); } if ((this->subCamId != SUB_CAM_ID_DONE) && (this->csState < MO_INTRO_REVEAL)) { @@ -2673,15 +2671,14 @@ void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { Vec3f sp6C; Vec3f sp60; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0xFF, 200, 255, 255, (s8)this->fwork[MO_CORE_INTRO_WATER_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, (s8)this->fwork[MO_CORE_INTRO_WATER_ALPHA]); gSPSegment(POLY_XLU_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)sMorphaTent1->waterTex1x, - (s16)sMorphaTent1->waterTex1y, 32, 32, 1, (s16)sMorphaTent1->waterTex2x, - (s16)sMorphaTent1->waterTex2y, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)sMorphaTent1->waterTex1x, (s16)sMorphaTent1->waterTex1y, + 32, 32, 1, (s16)sMorphaTent1->waterTex2x, (s16)sMorphaTent1->waterTex2y, 32, 32)); sp8C = this->subCamAt.x - this->subCamEye.x; sp88 = this->subCamAt.y - this->subCamEye.y; @@ -2710,45 +2707,44 @@ void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); Matrix_Scale(0.05f, 1.0f, 0.05f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6941), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_mo.c", 6941), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gMorphaWaterDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6945); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 6945); - BossMo_DrawEffects(globalCtx->specialEffects, globalCtx); + BossMo_DrawEffects(play->specialEffects, play); } -void BossMo_DrawTent(Actor* thisx, GlobalContext* globalCtx) { +void BossMo_DrawTent(Actor* thisx, PlayState* play) { s32 pad; BossMo* this = (BossMo*)thisx; u16 scroll; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6958); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 6958); if (1) {} - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, (s8)(this->baseAlpha * 1.5f)); gDPSetEnvColor(POLY_OPA_DISP++, 150, 150, 150, 0); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->work[MO_TENT_BASE_TEX1_X], - this->work[MO_TENT_BASE_TEX1_Y], 32, 32, 1, this->work[MO_TENT_BASE_TEX2_X], - this->work[MO_TENT_BASE_TEX2_Y], 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->work[MO_TENT_BASE_TEX1_X], this->work[MO_TENT_BASE_TEX1_Y], + 32, 32, 1, this->work[MO_TENT_BASE_TEX2_X], this->work[MO_TENT_BASE_TEX2_Y], 32, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0xFF, 200, 255, 255, (s8)((this->baseAlpha * 12.0f) / 10.0f)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, (s8)this->baseAlpha); scroll = (s16)(Math_SinS(this->work[MO_TENT_VAR_TIMER] * 0xB00) * 30.0f) + 350; gSPTexture(POLY_XLU_DISP++, scroll, scroll, 0, G_TX_RENDERTILE, G_ON); if (this->drawActor) { - BossMo_DrawTentacle(this, globalCtx); + BossMo_DrawTentacle(this, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_mo.c", 7023); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 7023); } -void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { - BossMoEffect* effect = globalCtx->specialEffects; +void BossMo_UpdateEffects(BossMo* this, PlayState* play) { + BossMoEffect* effect = play->specialEffects; s16 i; Vec3f* targetPos; f32 dx; @@ -2771,7 +2767,7 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { } if (effect->type <= MO_FX_BIG_RIPPLE) { if (this->csState >= MO_DEATH_START) { - effect->pos.y = MO_WATER_LEVEL(globalCtx); + effect->pos.y = MO_WATER_LEVEL(play); } Math_ApproachF(&effect->scale, effect->fwork[MO_FX_MAX_SIZE], 0.2f, effect->fwork[MO_FX_SPREAD_RATE]); if (effect->rippleMode == 0) { @@ -2789,7 +2785,7 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { } } else if (effect->type == MO_FX_BUBBLE) { if (effect->targetPos == NULL) { - if ((effect->accel.y > 0.0f) && (effect->pos.y >= MO_WATER_LEVEL(globalCtx))) { + if ((effect->accel.y > 0.0f) && (effect->pos.y >= MO_WATER_LEVEL(play))) { effect->type = MO_FX_NONE; } else { if (effect->vel.y > 2.0f) { @@ -2816,7 +2812,7 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { if (effect->timer > 20) { effect->alpha -= 30; effect->accel.y = 1.5f; - if ((effect->alpha <= 0) || (effect->pos.y >= MO_WATER_LEVEL(globalCtx))) { + if ((effect->alpha <= 0) || (effect->pos.y >= MO_WATER_LEVEL(play))) { effect->alpha = 0; effect->type = MO_FX_NONE; } @@ -2850,8 +2846,8 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { if (effect->type == MO_FX_SPLASH) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; - BossMo_SpawnDroplet(MO_FX_SPLASH_TRAIL, (BossMoEffect*)globalCtx->specialEffects, - &effect->pos, &velocity, effect->scale); + BossMo_SpawnDroplet(MO_FX_SPLASH_TRAIL, (BossMoEffect*)play->specialEffects, &effect->pos, + &velocity, effect->scale); } if (effect->vel.y < -20.0f) { effect->vel.y = -20.0f; @@ -2880,15 +2876,15 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { effect->type = MO_FX_WET_SPOT; effect->alpha = 150; effect->fwork[MO_FX_STRETCH] = (effect->scale * 15.0f) * 0.15f; - } else if (effect->pos.y <= MO_WATER_LEVEL(globalCtx)) { + } else if (effect->pos.y <= MO_WATER_LEVEL(play)) { Vec3f pos = effect->pos; - pos.y = MO_WATER_LEVEL(globalCtx); + pos.y = MO_WATER_LEVEL(play); if (effect->type == MO_FX_SPLASH) { - BossMo_SpawnRipple(globalCtx->specialEffects, &pos, 60.0f, 160.0f, 80, 290, + BossMo_SpawnRipple(play->specialEffects, &pos, 60.0f, 160.0f, 80, 290, MO_FX_SMALL_RIPPLE); } else { - BossMo_SpawnRipple(globalCtx->specialEffects, &pos, 40.0f, 110.0f, 80, 290, + BossMo_SpawnRipple(play->specialEffects, &pos, 40.0f, 110.0f, 80, 290, MO_FX_SMALL_RIPPLE); } effect->type = MO_FX_NONE; @@ -2900,11 +2896,11 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) { } } -void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { +void BossMo_DrawEffects(BossMoEffect* effect, PlayState* play) { u8 materialFlag = 0; s16 i; s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; BossMoEffect* effectHead = effect; OPEN_DISPS(gfxCtx, "../z_boss_mo.c", 7264); @@ -2936,7 +2932,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { for (i = 0; i < BOSS_MO_EFFECT_COUNT; i++, effect++) { if (effect->type == MO_FX_SMALL_RIPPLE) { if (materialFlag == 0) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 255, 0); @@ -2973,7 +2969,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { 255, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale / effect->fwork[MO_FX_STRETCH], effect->fwork[MO_FX_STRETCH] * effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_mo.c", 7373), @@ -3014,7 +3010,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { for (i = 0; i < BOSS_MO_EFFECT_COUNT; i++, effect++) { if (effect->type == MO_FX_BUBBLE) { if (materialFlag == 0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 150, 150, 150, 0); @@ -3024,7 +3020,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_mo.c", 7476), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h index fd3edcabd0..310af26fcc 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h @@ -6,7 +6,7 @@ struct BossMo; -typedef void (*BossMoActionFunc)(struct BossMo*, GlobalContext*); +typedef void (*BossMoActionFunc)(struct BossMo*, PlayState*); typedef enum { /* 0 */ MO_TENT_ACTION_STATE, 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 ad0aca12cf..3111b84a3a 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -46,138 +46,138 @@ typedef enum { /* 3 */ BONGO_SHADOW } BossSstEffectMode; -void BossSst_Init(Actor* thisx, GlobalContext* globalCtx); -void BossSst_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossSst_UpdateHand(Actor* thisx, GlobalContext* globalCtx); -void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx); -void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx); -void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx); -void BossSst_UpdateEffects(Actor* thisx, GlobalContext* globalCtx); -void BossSst_DrawEffects(Actor* thisx, GlobalContext* globalCtx); +void BossSst_Init(Actor* thisx, PlayState* play); +void BossSst_Destroy(Actor* thisx, PlayState* play); +void BossSst_UpdateHand(Actor* thisx, PlayState* play); +void BossSst_UpdateHead(Actor* thisx, PlayState* play); +void BossSst_DrawHand(Actor* thisx, PlayState* play); +void BossSst_DrawHead(Actor* thisx, PlayState* play); +void BossSst_UpdateEffects(Actor* thisx, PlayState* play); +void BossSst_DrawEffects(Actor* thisx, PlayState* play); void BossSst_HeadSfx(BossSst* this, u16 sfxId); void BossSst_HeadSetupLurk(BossSst* this); -void BossSst_HeadLurk(BossSst* this, GlobalContext* globalCtx); -void BossSst_HeadSetupIntro(BossSst* this, GlobalContext* globalCtx); -void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadLurk(BossSst* this, PlayState* play); +void BossSst_HeadSetupIntro(BossSst* this, PlayState* play); +void BossSst_HeadIntro(BossSst* this, PlayState* play); void BossSst_HeadSetupNeutral(BossSst* this); -void BossSst_HeadNeutral(BossSst* this, GlobalContext* globalCtx); -void BossSst_HeadWait(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadNeutral(BossSst* this, PlayState* play); +void BossSst_HeadWait(BossSst* this, PlayState* play); void BossSst_HeadSetupDamagedHand(BossSst* this, s32 bothHands); -void BossSst_HeadDamagedHand(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadDamagedHand(BossSst* this, PlayState* play); void BossSst_HeadSetupReadyCharge(BossSst* this); -void BossSst_HeadReadyCharge(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadReadyCharge(BossSst* this, PlayState* play); void BossSst_HeadSetupCharge(BossSst* this); -void BossSst_HeadCharge(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadCharge(BossSst* this, PlayState* play); void BossSst_HeadSetupEndCharge(BossSst* this); -void BossSst_HeadEndCharge(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadEndCharge(BossSst* this, PlayState* play); void BossSst_HeadSetupFrozenHand(BossSst* this); -void BossSst_HeadFrozenHand(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadFrozenHand(BossSst* this, PlayState* play); void BossSst_HeadSetupUnfreezeHand(BossSst* this); -void BossSst_HeadUnfreezeHand(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadUnfreezeHand(BossSst* this, PlayState* play); -void BossSst_HeadStunned(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadStunned(BossSst* this, PlayState* play); void BossSst_HeadSetupVulnerable(BossSst* this); -void BossSst_HeadVulnerable(BossSst* this, GlobalContext* globalCtx); -void BossSst_HeadDamage(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadVulnerable(BossSst* this, PlayState* play); +void BossSst_HeadDamage(BossSst* this, PlayState* play); void BossSst_HeadSetupRecover(BossSst* this); -void BossSst_HeadRecover(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadRecover(BossSst* this, PlayState* play); -void BossSst_HeadDeath(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadDeath(BossSst* this, PlayState* play); void BossSst_HeadSetupThrash(BossSst* this); -void BossSst_HeadThrash(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadThrash(BossSst* this, PlayState* play); void BossSst_HeadSetupDarken(BossSst* this); -void BossSst_HeadDarken(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadDarken(BossSst* this, PlayState* play); void BossSst_HeadSetupFall(BossSst* this); -void BossSst_HeadFall(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadFall(BossSst* this, PlayState* play); void BossSst_HeadSetupMelt(BossSst* this); -void BossSst_HeadMelt(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadMelt(BossSst* this, PlayState* play); void BossSst_HeadSetupFinish(BossSst* this); -void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx); +void BossSst_HeadFinish(BossSst* this, PlayState* play); -void BossSst_HandGrabPlayer(BossSst* this, GlobalContext* globalCtx); -void BossSst_HandReleasePlayer(BossSst* this, GlobalContext* globalCtx, s32 dropPlayer); +void BossSst_HandGrabPlayer(BossSst* this, PlayState* play); +void BossSst_HandReleasePlayer(BossSst* this, PlayState* play, s32 dropPlayer); void BossSst_HandSelectAttack(BossSst* this); void BossSst_HandSetDamage(BossSst* this, s32 damage); void BossSst_HandSetInvulnerable(BossSst* this, s32 isInv); void BossSst_HandSetupWait(BossSst* this); -void BossSst_HandWait(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandWait(BossSst* this, PlayState* play); void BossSst_HandSetupDownbeat(BossSst* this); -void BossSst_HandDownbeat(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandDownbeat(BossSst* this, PlayState* play); void BossSst_HandSetupOffbeat(BossSst* this); -void BossSst_HandOffbeat(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandOffbeat(BossSst* this, PlayState* play); void BossSst_HandSetupDownbeatEnd(BossSst* this); -void BossSst_HandDownbeatEnd(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandDownbeatEnd(BossSst* this, PlayState* play); void BossSst_HandSetupOffbeatEnd(BossSst* this); -void BossSst_HandOffbeatEnd(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandOffbeatEnd(BossSst* this, PlayState* play); -void BossSst_HandReadySlam(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadySlam(BossSst* this, PlayState* play); void BossSst_HandSetupSlam(BossSst* this); -void BossSst_HandSlam(BossSst* this, GlobalContext* globalCtx); -void BossSst_HandEndSlam(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandSlam(BossSst* this, PlayState* play); +void BossSst_HandEndSlam(BossSst* this, PlayState* play); -void BossSst_HandReadySweep(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadySweep(BossSst* this, PlayState* play); void BossSst_HandSetupSweep(BossSst* this); -void BossSst_HandSweep(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandSweep(BossSst* this, PlayState* play); -void BossSst_HandReadyPunch(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyPunch(BossSst* this, PlayState* play); void BossSst_HandSetupPunch(BossSst* this); -void BossSst_HandPunch(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandPunch(BossSst* this, PlayState* play); -void BossSst_HandReadyClap(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyClap(BossSst* this, PlayState* play); void BossSst_HandSetupClap(BossSst* this); -void BossSst_HandClap(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandClap(BossSst* this, PlayState* play); void BossSst_HandSetupEndClap(BossSst* this); -void BossSst_HandEndClap(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandEndClap(BossSst* this, PlayState* play); -void BossSst_HandReadyGrab(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyGrab(BossSst* this, PlayState* play); void BossSst_HandSetupGrab(BossSst* this); -void BossSst_HandGrab(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandGrab(BossSst* this, PlayState* play); void BossSst_HandSetupCrush(BossSst* this); -void BossSst_HandCrush(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandCrush(BossSst* this, PlayState* play); void BossSst_HandSetupEndCrush(BossSst* this); -void BossSst_HandEndCrush(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandEndCrush(BossSst* this, PlayState* play); void BossSst_HandSetupSwing(BossSst* this); -void BossSst_HandSwing(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandSwing(BossSst* this, PlayState* play); void BossSst_HandSetupRetreat(BossSst* this); -void BossSst_HandRetreat(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandRetreat(BossSst* this, PlayState* play); void BossSst_HandSetupReel(BossSst* this); -void BossSst_HandReel(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReel(BossSst* this, PlayState* play); void BossSst_HandSetupReadyShake(BossSst* this); -void BossSst_HandReadyShake(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyShake(BossSst* this, PlayState* play); void BossSst_HandSetupShake(BossSst* this); -void BossSst_HandShake(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandShake(BossSst* this, PlayState* play); void BossSst_HandSetupReadyCharge(BossSst* this); -void BossSst_HandReadyCharge(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyCharge(BossSst* this, PlayState* play); void BossSst_HandSetupFrozen(BossSst* this); -void BossSst_HandFrozen(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandFrozen(BossSst* this, PlayState* play); void BossSst_HandSetupReadyBreakIce(BossSst* this); -void BossSst_HandReadyBreakIce(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandReadyBreakIce(BossSst* this, PlayState* play); void BossSst_HandSetupBreakIce(BossSst* this); -void BossSst_HandBreakIce(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandBreakIce(BossSst* this, PlayState* play); -void BossSst_HandStunned(BossSst* this, GlobalContext* globalCtx); -void BossSst_HandDamage(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandStunned(BossSst* this, PlayState* play); +void BossSst_HandDamage(BossSst* this, PlayState* play); void BossSst_HandSetupRecover(BossSst* this); -void BossSst_HandRecover(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandRecover(BossSst* this, PlayState* play); void BossSst_HandSetupThrash(BossSst* this); -void BossSst_HandThrash(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandThrash(BossSst* this, PlayState* play); void BossSst_HandSetupDarken(BossSst* this); -void BossSst_HandDarken(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandDarken(BossSst* this, PlayState* play); void BossSst_HandSetupFall(BossSst* this); -void BossSst_HandFall(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandFall(BossSst* this, PlayState* play); void BossSst_HandSetupMelt(BossSst* this); -void BossSst_HandMelt(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandMelt(BossSst* this, PlayState* play); void BossSst_HandSetupFinish(BossSst* this); -void BossSst_HandFinish(BossSst* this, GlobalContext* globalCtx); +void BossSst_HandFinish(BossSst* this, PlayState* play); void BossSst_SpawnHeadShadow(BossSst* this); void BossSst_SpawnHandShadow(BossSst* this); @@ -263,44 +263,42 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 20, ICHAIN_STOP), }; -void BossSst_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossSst_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossSst* this = (BossSst*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, &this->colliderCyl); - Collider_InitJntSph(globalCtx, &this->colliderJntSph); + Collider_InitCylinder(play, &this->colliderCyl); + Collider_InitJntSph(play, &this->colliderJntSph); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - Flags_SetSwitch(globalCtx, 0x14); + Flags_SetSwitch(play, 0x14); if (this->actor.params == BONGO_HEAD) { - sFloor = (BgSstFloor*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_SST_FLOOR, sRoomCenter.x, - sRoomCenter.y, sRoomCenter.z, 0, 0, 0, BONGOFLOOR_REST); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBongoHeadSkel, &gBongoHeadEyeOpenIdleAnim, this->jointTable, + sFloor = (BgSstFloor*)Actor_Spawn(&play->actorCtx, play, ACTOR_BG_SST_FLOOR, sRoomCenter.x, sRoomCenter.y, + sRoomCenter.z, 0, 0, 0, BONGOFLOOR_REST); + SkelAnime_InitFlex(play, &this->skelAnime, &gBongoHeadSkel, &gBongoHeadEyeOpenIdleAnim, this->jointTable, this->morphTable, 45); ActorShape_Init(&this->actor.shape, 70000.0f, ActorShadow_DrawCircle, 95.0f); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInitHead, this->colliderItems); - Collider_SetCylinder(globalCtx, &this->colliderCyl, &this->actor, &sCylinderInitHead); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInitHead, this->colliderItems); + Collider_SetCylinder(play, &this->colliderCyl, &this->actor, &sCylinderInitHead); sHead = this; this->actor.world.pos.x = ROOM_CENTER_X + 50.0f; this->actor.world.pos.y = ROOM_CENTER_Y + 0.0f; this->actor.world.pos.z = ROOM_CENTER_Z - 650.0f; this->actor.home.pos = this->actor.world.pos; this->actor.shape.rot.y = 0; - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, ROOM_CENTER_X, ROOM_CENTER_Y, - ROOM_CENTER_Z + 400.0f, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, ROOM_CENTER_X, ROOM_CENTER_Y, - ROOM_CENTER_Z - 200.0f, 0, 0, 0, 0); + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, ROOM_CENTER_X, ROOM_CENTER_Y, ROOM_CENTER_Z + 400.0f, + 0, 0, 0, WARP_DUNGEON_ADULT); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, ROOM_CENTER_X, ROOM_CENTER_Y, ROOM_CENTER_Z - 200.0f, + 0, 0, 0, 0); Actor_Kill(&this->actor); } else { - sHands[LEFT] = - (BossSst*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_SST, this->actor.world.pos.x + 200.0f, - this->actor.world.pos.y, this->actor.world.pos.z + 400.0f, 0, - this->actor.shape.rot.y, 0, BONGO_LEFT_HAND); - sHands[RIGHT] = (BossSst*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_SST, - this->actor.world.pos.x + (-200.0f), this->actor.world.pos.y, - this->actor.world.pos.z + 400.0f, 0, this->actor.shape.rot.y, 0, - BONGO_RIGHT_HAND); + sHands[LEFT] = (BossSst*)Actor_Spawn( + &play->actorCtx, play, ACTOR_BOSS_SST, this->actor.world.pos.x + 200.0f, this->actor.world.pos.y, + this->actor.world.pos.z + 400.0f, 0, this->actor.shape.rot.y, 0, BONGO_LEFT_HAND); + sHands[RIGHT] = (BossSst*)Actor_Spawn( + &play->actorCtx, play, ACTOR_BOSS_SST, this->actor.world.pos.x + (-200.0f), this->actor.world.pos.y, + this->actor.world.pos.z + 400.0f, 0, this->actor.shape.rot.y, 0, BONGO_RIGHT_HAND); sHands[LEFT]->actor.child = &sHands[RIGHT]->actor; sHands[RIGHT]->actor.child = &sHands[LEFT]->actor; @@ -310,19 +308,19 @@ void BossSst_Init(Actor* thisx, GlobalContext* globalCtx2) { this->radius = -650.0f; this->actor.targetArrowOffset = 4000.0f; BossSst_HeadSetupLurk(this); - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_BOSS); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS); } } else { - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInitHand, this->colliderItems); - Collider_SetCylinder(globalCtx, &this->colliderCyl, &this->actor, &sCylinderInitHand); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInitHand, this->colliderItems); + Collider_SetCylinder(play, &this->colliderCyl, &this->actor, &sCylinderInitHand); if (this->actor.params == BONGO_LEFT_HAND) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBongoLeftHandSkel, &gBongoLeftHandIdleAnim, - this->jointTable, this->morphTable, 27); + SkelAnime_InitFlex(play, &this->skelAnime, &gBongoLeftHandSkel, &gBongoLeftHandIdleAnim, this->jointTable, + this->morphTable, 27); this->vParity = -1; this->colliderJntSph.elements[0].dim.modelSphere.center.z *= -1; } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBongoRightHandSkel, &gBongoRightHandIdleAnim, - this->jointTable, this->morphTable, 27); + SkelAnime_InitFlex(play, &this->skelAnime, &gBongoRightHandSkel, &gBongoRightHandIdleAnim, this->jointTable, + this->morphTable, 27); this->vParity = 1; } @@ -334,12 +332,12 @@ void BossSst_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void BossSst_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_Destroy(Actor* thisx, PlayState* play) { s32 pad; BossSst* this = (BossSst*)thisx; - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); - Collider_DestroyCylinder(globalCtx, &this->colliderCyl); + Collider_DestroyJntSph(play, &this->colliderJntSph); + Collider_DestroyCylinder(play, &this->colliderCyl); Audio_StopSfxByPos(&this->center); } @@ -351,14 +349,14 @@ void BossSst_HeadSetupLurk(BossSst* this) { this->actionFunc = BossSst_HeadLurk; } -void BossSst_HeadLurk(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadLurk(BossSst* this, PlayState* play) { if (this->actor.yDistToPlayer < 1000.0f) { - BossSst_HeadSetupIntro(this, globalCtx); + BossSst_HeadSetupIntro(this, play); } } -void BossSst_HeadSetupIntro(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->timer = 611; this->ready = false; @@ -372,23 +370,23 @@ void BossSst_HeadSetupIntro(BossSst* this, GlobalContext* globalCtx) { player->fallStartHeight = 0; player->stateFlags1 |= PLAYER_STATE1_5; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - sSubCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + sSubCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); Math_Vec3f_Copy(&sSubCamAt, &player->actor.world.pos); if (GET_EVENTCHKINF(EVENTCHKINF_77)) { sSubCamEye.z = ROOM_CENTER_Z - 100.0f; } - Play_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); + Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); this->actionFunc = BossSst_HeadIntro; } -void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HeadIntro(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 tempo; s32 introStateTimer; s32 revealStateTimer; @@ -405,15 +403,15 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { sHands[RIGHT]->actor.flags |= ACTOR_FLAG_0; sHands[LEFT]->actor.flags |= ACTOR_FLAG_0; player->stateFlags1 &= ~PLAYER_STATE1_5; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); sSubCamAt.y += 30.0f; sSubCamAt.z += 300.0f; - Play_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); - Play_CopyCamera(globalCtx, CAM_ID_MAIN, sSubCamId); - Play_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); - Play_ClearCamera(globalCtx, sSubCamId); + Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); + Play_CopyCamera(play, CAM_ID_MAIN, sSubCamId); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Play_ClearCamera(play, sSubCamId); SET_EVENTCHKINF(EVENTCHKINF_77); BossSst_HeadSetupNeutral(this); this->colliderJntSph.base.ocFlags1 |= OC1_ON; @@ -594,8 +592,8 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { sSubCamEye.z -= 350.0f * 0.01f; } else if (revealStateTimer == 85) { if (!GET_EVENTCHKINF(EVENTCHKINF_77)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, - SEGMENTED_TO_VIRTUAL(gBongoTitleCardTex), 160, 180, 128, 40); + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gBongoTitleCardTex), + 160, 180, 128, 40); } Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); Animation_MorphToPlayOnce(&this->skelAnime, &gBongoHeadEyeCloseAnim, -5.0f); @@ -612,7 +610,7 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { } if (this->actionFunc != BossSst_HeadNeutral) { - Play_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); + Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); } } @@ -623,7 +621,7 @@ void BossSst_HeadSetupWait(BossSst* this) { this->actionFunc = BossSst_HeadWait; } -void BossSst_HeadWait(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadWait(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((HAND_STATE(sHands[LEFT]) == HAND_WAIT) && (HAND_STATE(sHands[RIGHT]) == HAND_WAIT)) { BossSst_HeadSetupNeutral(this); @@ -636,7 +634,7 @@ void BossSst_HeadSetupNeutral(BossSst* this) { this->actionFunc = BossSst_HeadNeutral; } -void BossSst_HeadNeutral(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadNeutral(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (!this->ready && ((HAND_STATE(sHands[LEFT]) == HAND_BEAT) || (HAND_STATE(sHands[LEFT]) == HAND_WAIT)) && ((HAND_STATE(sHands[RIGHT]) == HAND_BEAT) || (HAND_STATE(sHands[RIGHT]) == HAND_WAIT))) { @@ -650,8 +648,8 @@ void BossSst_HeadNeutral(BossSst* this, GlobalContext* globalCtx) { } if (this->timer == 0) { - if ((GET_PLAYER(globalCtx)->actor.world.pos.y > -50.0f) && - !(GET_PLAYER(globalCtx)->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_13 | PLAYER_STATE1_14))) { + if ((GET_PLAYER(play)->actor.world.pos.y > -50.0f) && + !(GET_PLAYER(play)->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_13 | PLAYER_STATE1_14))) { sHands[Rand_ZeroOne() <= 0.5f]->ready = true; BossSst_HeadSetupWait(this); } else { @@ -659,7 +657,7 @@ void BossSst_HeadNeutral(BossSst* this, GlobalContext* globalCtx) { } } else { Math_ApproachS(&this->actor.shape.rot.y, - Actor_WorldYawTowardPoint(&GET_PLAYER(globalCtx)->actor, &sRoomCenter) + 0x8000, 4, 0x400); + Actor_WorldYawTowardPoint(&GET_PLAYER(play)->actor, &sRoomCenter) + 0x8000, 4, 0x400); if ((this->timer == 28) || (this->timer == 84)) { BossSst_HeadSfx(this, NA_SE_EN_SHADEST_PRAY); } @@ -675,7 +673,7 @@ void BossSst_HeadSetupDamagedHand(BossSst* this, s32 bothHands) { this->actionFunc = BossSst_HeadDamagedHand; } -void BossSst_HeadDamagedHand(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadDamagedHand(BossSst* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if ((HAND_STATE(sHands[LEFT]) == HAND_DAMAGED) && (HAND_STATE(sHands[RIGHT]) == HAND_DAMAGED)) { BossSst_HeadSetupReadyCharge(this); @@ -696,7 +694,7 @@ void BossSst_HeadSetupReadyCharge(BossSst* this) { this->actionFunc = BossSst_HeadReadyCharge; } -void BossSst_HeadReadyCharge(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadReadyCharge(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (sHands[LEFT]->ready && (sHands[LEFT]->actionFunc == BossSst_HandReadyCharge) && sHands[RIGHT]->ready && (sHands[RIGHT]->actionFunc == BossSst_HandReadyCharge)) { @@ -718,7 +716,7 @@ void BossSst_HeadSetupCharge(BossSst* this) { this->actionFunc = BossSst_HeadCharge; } -void BossSst_HeadCharge(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadCharge(BossSst* this, PlayState* play) { f32 chargeDist; s32 animFinish = SkelAnime_Update(&this->skelAnime); @@ -759,8 +757,8 @@ void BossSst_HeadCharge(BossSst* this, GlobalContext* globalCtx) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); sHands[LEFT]->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); sHands[RIGHT]->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - func_8002F71C(globalCtx, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F71C(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); } } @@ -773,7 +771,7 @@ void BossSst_HeadSetupEndCharge(BossSst* this) { this->actionFunc = BossSst_HeadEndCharge; } -void BossSst_HeadEndCharge(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadEndCharge(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_SmoothStepToS(&this->actor.shape.rot.y, this->targetYaw, 4, 0x800, 0x100) == 0) { BossSst_HandSetupRetreat(sHands[LEFT]); @@ -789,7 +787,7 @@ void BossSst_HeadSetupFrozenHand(BossSst* this) { this->actionFunc = BossSst_HeadFrozenHand; } -void BossSst_HeadFrozenHand(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadFrozenHand(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->ready) { BossSst_HeadSetupUnfreezeHand(this); @@ -802,7 +800,7 @@ void BossSst_HeadSetupUnfreezeHand(BossSst* this) { this->actionFunc = BossSst_HeadUnfreezeHand; } -void BossSst_HeadUnfreezeHand(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadUnfreezeHand(BossSst* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { BossSst_HeadSetupWait(this); } @@ -819,7 +817,7 @@ void BossSst_HeadSetupStunned(BossSst* this) { this->actionFunc = BossSst_HeadStunned; } -void BossSst_HeadStunned(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadStunned(BossSst* this, PlayState* play) { f32 bounce; s32 animFinish; f32 currentFrame; @@ -876,7 +874,7 @@ void BossSst_HeadSetupVulnerable(BossSst* this) { this->actionFunc = BossSst_HeadVulnerable; } -void BossSst_HeadVulnerable(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadVulnerable(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&sHandOffsets[LEFT].z, 600.0f, 20.0f); Math_StepToF(&sHandOffsets[RIGHT].z, 600.0f, 20.0f); @@ -908,7 +906,7 @@ void BossSst_HeadSetupDamage(BossSst* this) { this->actionFunc = BossSst_HeadDamage; } -void BossSst_HeadDamage(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadDamage(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -929,7 +927,7 @@ void BossSst_HeadSetupRecover(BossSst* this) { this->actionFunc = BossSst_HeadRecover; } -void BossSst_HeadRecover(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadRecover(BossSst* this, PlayState* play) { s32 animFinish; f32 currentFrame; f32 diff; @@ -974,7 +972,7 @@ void BossSst_SetCameraTargets(f32 subCamVelFactor, s32 targetIndex) { sSubCamEyeVel.z = (subCamEyeNext->z - sSubCamEye.z) * subCamVelFactor; } -void BossSst_UpdateDeathCamera(BossSst* this, GlobalContext* globalCtx) { +void BossSst_UpdateDeathCamera(BossSst* this, PlayState* play) { Vec3f subCamAt; Vec3f subCamEye; f32 sn; @@ -995,11 +993,11 @@ void BossSst_UpdateDeathCamera(BossSst* this, GlobalContext* globalCtx) { subCamEye.x = this->actor.world.pos.x + (sSubCamEye.z * sn) + (sSubCamEye.x * cs); subCamEye.y = this->actor.home.pos.y - 140.0f + sSubCamEye.y; subCamEye.z = this->actor.world.pos.z + (sSubCamEye.z * cs) - (sSubCamEye.x * sn); - Play_CameraSetAtEye(globalCtx, sSubCamId, &subCamAt, &subCamEye); + Play_CameraSetAtEye(play, sSubCamId, &subCamAt, &subCamEye); } -void BossSst_HeadSetupDeath(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HeadSetupDeath(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); Animation_MorphToLoop(&this->skelAnime, &gBongoHeadEyeOpenIdleAnim, -5.0f); BossSst_HeadSfx(this, NA_SE_EN_SHADEST_DEAD); @@ -1012,17 +1010,17 @@ void BossSst_HeadSetupDeath(BossSst* this, GlobalContext* globalCtx) { sHands[LEFT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON; sHands[RIGHT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); - sSubCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); - Play_CopyCamera(globalCtx, sSubCamId, CAM_ID_MAIN); - func_8002DF54(globalCtx, &player->actor, 8); - func_80064520(globalCtx, &globalCtx->csCtx); - Math_Vec3f_Copy(&sSubCamEye, &GET_ACTIVE_CAM(globalCtx)->eye); + sSubCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); + Play_CopyCamera(play, sSubCamId, CAM_ID_MAIN); + func_8002DF54(play, &player->actor, 8); + func_80064520(play, &play->csCtx); + Math_Vec3f_Copy(&sSubCamEye, &GET_ACTIVE_CAM(play)->eye); this->actionFunc = BossSst_HeadDeath; } -void BossSst_HeadDeath(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadDeath(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -1034,25 +1032,25 @@ void BossSst_HeadDeath(BossSst* this, GlobalContext* globalCtx) { BossSst_HandSetupThrash(sHands[RIGHT]); BossSst_HeadSetupThrash(this); } else if (this->timer > 48) { - Play_CameraSetAtEye(globalCtx, sSubCamId, &this->actor.focus.pos, &sSubCamEye); + Play_CameraSetAtEye(play, sSubCamId, &this->actor.focus.pos, &sSubCamEye); Math_StepToF(&this->radius, -350.0f, 10.0f); } else if (this->timer == 48) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->actor.world.pos.x = sRoomCenter.x + (400.0f * Math_SinS(this->actor.shape.rot.y)) + (Math_CosS(this->actor.shape.rot.y) * -120.0f); player->actor.world.pos.z = sRoomCenter.z + (400.0f * Math_CosS(this->actor.shape.rot.y)) - (Math_SinS(this->actor.shape.rot.y) * -120.0f); player->actor.shape.rot.y = Actor_WorldYawTowardPoint(&player->actor, &sRoomCenter); - func_8002DBD0(&this->actor, &sSubCamEye, &GET_ACTIVE_CAM(globalCtx)->eye); - func_8002DBD0(&this->actor, &sSubCamAt, &GET_ACTIVE_CAM(globalCtx)->at); + func_8002DBD0(&this->actor, &sSubCamEye, &GET_ACTIVE_CAM(play)->eye); + func_8002DBD0(&this->actor, &sSubCamAt, &GET_ACTIVE_CAM(play)->at); this->radius = -350.0f; this->actor.world.pos.x = sRoomCenter.x - (Math_SinS(this->actor.shape.rot.y) * 350.0f); this->actor.world.pos.z = sRoomCenter.z - (Math_CosS(this->actor.shape.rot.y) * 350.0f); BossSst_SetCameraTargets(1.0 / 48, 0); - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } else { - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } } @@ -1064,7 +1062,7 @@ void BossSst_HeadSetupThrash(BossSst* this) { this->actionFunc = BossSst_HeadThrash; } -void BossSst_HeadThrash(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadThrash(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -1073,7 +1071,7 @@ void BossSst_HeadThrash(BossSst* this, GlobalContext* globalCtx) { if ((this->timer == 0) && (this->actor.shape.rot.y == this->targetYaw)) { BossSst_HeadSetupDarken(this); } else if (this->timer >= 80) { - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } } @@ -1083,7 +1081,7 @@ void BossSst_HeadSetupDarken(BossSst* this) { this->actionFunc = BossSst_HeadDarken; } -void BossSst_HeadDarken(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadDarken(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -1093,7 +1091,7 @@ void BossSst_HeadDarken(BossSst* this, GlobalContext* globalCtx) { if (this->timer == 80) { sBodyStatic = true; } - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); sBodyColor.r = sBodyColor.g = sBodyColor.b = (this->timer * 3) - 240; if (this->timer == 80) { BossSst_SetCameraTargets(1.0 / 80, 3); @@ -1101,7 +1099,7 @@ void BossSst_HeadDarken(BossSst* this, GlobalContext* globalCtx) { } else { sBodyColor.b = (80 - this->timer) / 1.0f; sBodyColor.r = sBodyColor.g = sStaticColor.r = sStaticColor.g = sStaticColor.b = (80 - this->timer) / 8.0f; - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); if (this->timer == 0) { BossSst_HeadSetupFall(this); } @@ -1119,14 +1117,14 @@ void BossSst_HeadSetupFall(BossSst* this) { this->actionFunc = BossSst_HeadFall; } -void BossSst_HeadFall(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadFall(BossSst* this, PlayState* play) { this->actor.speedXZ *= 1.5f; if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 230.0f, this->actor.speedXZ)) { BossSst_HeadSetupMelt(this); } if (sSubCamAt.y > 200.0f) { - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } } @@ -1137,7 +1135,7 @@ void BossSst_HeadSetupMelt(BossSst* this) { this->actionFunc = BossSst_HeadMelt; } -void BossSst_HeadMelt(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadMelt(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -1149,7 +1147,7 @@ void BossSst_HeadMelt(BossSst* this, GlobalContext* globalCtx) { if (this->timer == 0) { BossSst_HeadSetupFinish(this); } else if (this->timer >= 20.0f) { - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } } @@ -1161,7 +1159,7 @@ void BossSst_HeadSetupFinish(BossSst* this) { this->actionFunc = BossSst_HeadFinish; } -void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadFinish(BossSst* this, PlayState* play) { static Color_RGBA8 colorIndigo = { 80, 80, 150, 255 }; static Color_RGBA8 colorDarkIndigo = { 40, 40, 80, 255 }; static Color_RGBA8 colorUnused[2] = { @@ -1174,22 +1172,22 @@ void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx) { this->timer--; if (this->effectMode == BONGO_NULL) { if (this->timer < -170) { - BossSst_UpdateDeathCamera(this, globalCtx); - Play_CopyCamera(globalCtx, CAM_ID_MAIN, sSubCamId); - Play_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); - Play_ClearCamera(globalCtx, sSubCamId); - func_8002DF54(globalCtx, &GET_PLAYER(globalCtx)->actor, 7); - func_80064534(globalCtx, &globalCtx->csCtx); + BossSst_UpdateDeathCamera(this, play); + Play_CopyCamera(play, CAM_ID_MAIN, sSubCamId); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Play_ClearCamera(play, sSubCamId); + func_8002DF54(play, &GET_PLAYER(play)->actor, 7); + func_80064534(play, &play->csCtx); Actor_Kill(&this->actor); Actor_Kill(&sHands[LEFT]->actor); Actor_Kill(&sHands[RIGHT]->actor); - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); } } else if (this->effects[0].alpha == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, ROOM_CENTER_X, ROOM_CENTER_Y, ROOM_CENTER_Z, 0, - 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, ROOM_CENTER_X, ROOM_CENTER_Y, ROOM_CENTER_Z, 0, 0, 0, + WARP_DUNGEON_ADULT); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, (Math_SinS(this->actor.shape.rot.y) * 200.0f) + ROOM_CENTER_X, ROOM_CENTER_Y, Math_CosS(this->actor.shape.rot.y) * 200.0f + ROOM_CENTER_Z, 0, 0, 0, 0); BossSst_SetCameraTargets(1.0f, 7); @@ -1200,7 +1198,7 @@ void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx) { this->effects[2].status = -1; } else if (this->timer > 0) { this->effects[0].status += 5; - BossSst_UpdateDeathCamera(this, globalCtx); + BossSst_UpdateDeathCamera(this, play); } colorIndigo.a = this->effects[0].alpha; @@ -1210,7 +1208,7 @@ void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx) { spawnPos.x = sRoomCenter.x + 0.0f + Rand_CenteredFloat(800.0f); spawnPos.y = sRoomCenter.y + (-28.0f) + (Rand_ZeroOne() * 5.0f); spawnPos.z = sRoomCenter.z + 0.0f + Rand_CenteredFloat(800.0f); - EffectSsGSplash_Spawn(globalCtx, &spawnPos, &colorIndigo, &colorDarkIndigo, 0, 0x3E8); + EffectSsGSplash_Spawn(play, &spawnPos, &colorIndigo, &colorDarkIndigo, 0, 0x3E8); } } @@ -1223,13 +1221,13 @@ void BossSst_HandSetupWait(BossSst* this) { this->actionFunc = BossSst_HandWait; } -void BossSst_HandWait(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandWait(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight, 20.0f); Math_StepToF(&this->actor.world.pos.x, this->actor.home.pos.x, 1.0f); Math_StepToF(&this->actor.world.pos.z, this->actor.home.pos.z, 1.0f); if (HAND_STATE(OTHER_HAND(this)) == HAND_DAMAGED) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->timer != 0) { this->timer--; @@ -1256,7 +1254,7 @@ void BossSst_HandSetupDownbeat(BossSst* this) { this->actionFunc = BossSst_HandDownbeat; } -void BossSst_HandDownbeat(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandDownbeat(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (HAND_STATE(OTHER_HAND(this)) == HAND_DAMAGED) { BossSst_HandSetupWait(this); @@ -1296,7 +1294,7 @@ void BossSst_HandSetupDownbeatEnd(BossSst* this) { this->actionFunc = BossSst_HandDownbeatEnd; } -void BossSst_HandDownbeatEnd(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandDownbeatEnd(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (HAND_STATE(OTHER_HAND(this)) == HAND_DAMAGED) { BossSst_HandSetupWait(this); @@ -1319,7 +1317,7 @@ void BossSst_HandSetupOffbeat(BossSst* this) { this->actionFunc = BossSst_HandOffbeat; } -void BossSst_HandOffbeat(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandOffbeat(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (HAND_STATE(OTHER_HAND(this)) == HAND_DAMAGED) { BossSst_HandSetupWait(this); @@ -1348,7 +1346,7 @@ void BossSst_HandSetupOffbeatEnd(BossSst* this) { this->actionFunc = BossSst_HandOffbeatEnd; } -void BossSst_HandOffbeatEnd(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandOffbeatEnd(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (HAND_STATE(OTHER_HAND(this)) == HAND_DAMAGED) { BossSst_HandSetupWait(this); @@ -1377,7 +1375,7 @@ void BossSst_HandSetupEndSlam(BossSst* this) { this->actionFunc = BossSst_HandEndSlam; } -void BossSst_HandEndSlam(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandEndSlam(BossSst* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { BossSst_HandSetupRetreat(this); } @@ -1395,7 +1393,7 @@ void BossSst_HandSetupRetreat(BossSst* this) { this->actor.speedXZ = 3.0f; } -void BossSst_HandRetreat(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandRetreat(BossSst* this, PlayState* play) { f32 diff; s32 inPosition; @@ -1435,7 +1433,7 @@ void BossSst_HandSetupReadySlam(BossSst* this) { this->actionFunc = BossSst_HandReadySlam; } -void BossSst_HandReadySlam(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadySlam(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { if (this->timer != 0) { @@ -1446,7 +1444,7 @@ void BossSst_HandReadySlam(BossSst* this, GlobalContext* globalCtx) { BossSst_HandSetupSlam(this); } } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (Math_StepToF(&this->actor.world.pos.y, ROOM_CENTER_Y + 300.0f, 30.0f) && (this->actor.xzDistToPlayer < 140.0f)) { @@ -1469,7 +1467,7 @@ void BossSst_HandSetupSlam(BossSst* this) { this->actionFunc = BossSst_HandSlam; } -void BossSst_HandSlam(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandSlam(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToS(&this->handZPosMod, -0xDAC, 0x1F4); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x1000); @@ -1504,13 +1502,13 @@ void BossSst_HandSlam(BossSst* this, GlobalContext* globalCtx) { } if (this->colliderJntSph.base.atFlags & AT_HIT) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->actor.world.pos.x = (Math_SinS(this->actor.yawTowardsPlayer) * 100.0f) + this->actor.world.pos.x; player->actor.world.pos.z = (Math_CosS(this->actor.yawTowardsPlayer) * 100.0f) + this->actor.world.pos.z; this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); } Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x200); @@ -1526,7 +1524,7 @@ void BossSst_HandSetupReadySweep(BossSst* this) { this->actionFunc = BossSst_HandReadySweep; } -void BossSst_HandReadySweep(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadySweep(BossSst* this, PlayState* play) { s32 inPosition; SkelAnime_Update(&this->skelAnime); @@ -1555,8 +1553,8 @@ void BossSst_HandSetupSweep(BossSst* this) { this->actionFunc = BossSst_HandSweep; } -void BossSst_HandSweep(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandSweep(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 newTargetYaw; SkelAnime_Update(&this->skelAnime); @@ -1569,7 +1567,7 @@ void BossSst_HandSweep(BossSst* this, GlobalContext* globalCtx) { } else if (this->colliderJntSph.base.atFlags & AT_HIT) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); this->ready = true; - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.shape.rot.y - (this->vParity * 0x3800), 0.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.shape.rot.y - (this->vParity * 0x3800), 0.0f); func_8002F7DC(&player->actor, NA_SE_PL_BODY_HIT); newTargetYaw = this->actor.shape.rot.y - (this->vParity * 0x1400); if (((s16)(newTargetYaw - this->targetYaw) * this->vParity) > 0) { @@ -1595,7 +1593,7 @@ void BossSst_HandSetupReadyPunch(BossSst* this) { this->actionFunc = BossSst_HandReadyPunch; } -void BossSst_HandReadyPunch(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyPunch(BossSst* this, PlayState* play) { s32 inPosition = Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x400); if (SkelAnime_Update(&this->skelAnime) && inPosition) { @@ -1612,7 +1610,7 @@ void BossSst_HandSetupPunch(BossSst* this) { this->actionFunc = BossSst_HandPunch; } -void BossSst_HandPunch(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandPunch(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.world.pos.y, ROOM_CENTER_Y + 80.0f, 20.0f); if (Math_ScaledStepToS(&this->actor.shape.rot.z, this->targetRoll, 0x400)) { @@ -1627,8 +1625,8 @@ void BossSst_HandPunch(BossSst* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { BossSst_HandSetupRetreat(this); } else if (this->colliderJntSph.base.atFlags & AT_HIT) { - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); - func_8002F71C(globalCtx, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); + func_8002F71C(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); BossSst_HandSetupRetreat(this); } @@ -1652,7 +1650,7 @@ void BossSst_HandSetupReadyClap(BossSst* this) { this->actionFunc = BossSst_HandReadyClap; } -void BossSst_HandReadyClap(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyClap(BossSst* this, PlayState* play) { if (this->timer != 0) { if (this->timer != 0) { this->timer--; @@ -1689,9 +1687,9 @@ void BossSst_HandSetupClap(BossSst* this) { this->actionFunc = BossSst_HandClap; } -void BossSst_HandClap(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandClap(BossSst* this, PlayState* play) { static s32 dropFlag = false; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -1701,19 +1699,19 @@ void BossSst_HandClap(BossSst* this, GlobalContext* globalCtx) { if (this->timer == 0) { if (dropFlag) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, + Item_DropCollectible(play, &this->actor.world.pos, (Rand_ZeroOne() < 0.5f) ? ITEM00_ARROWS_SMALL : ITEM00_MAGIC_SMALL); dropFlag = false; } - BossSst_HandReleasePlayer(this, globalCtx, true); + BossSst_HandReleasePlayer(this, play, true); BossSst_HandSetupEndClap(this); } } else { if (this->colliderJntSph.base.atFlags & AT_HIT) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); OTHER_HAND(this)->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - BossSst_HandGrabPlayer(this, globalCtx); + BossSst_HandGrabPlayer(this, play); } if (this->ready) { @@ -1753,7 +1751,7 @@ void BossSst_HandSetupEndClap(BossSst* this) { this->actionFunc = BossSst_HandEndClap; } -void BossSst_HandEndClap(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandEndClap(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.z, 0, 0x200); if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 0x100)) { @@ -1771,7 +1769,7 @@ void BossSst_HandSetupReadyGrab(BossSst* this) { this->actionFunc = BossSst_HandReadyGrab; } -void BossSst_HandReadyGrab(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyGrab(BossSst* this, PlayState* play) { s32 inPosition; SkelAnime_Update(&this->skelAnime); @@ -1793,8 +1791,8 @@ void BossSst_HandSetupGrab(BossSst* this) { this->actionFunc = BossSst_HandGrab; } -void BossSst_HandGrab(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandGrab(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->timer != 0) { this->timer--; @@ -1815,7 +1813,7 @@ void BossSst_HandGrab(BossSst* this, GlobalContext* globalCtx) { BossSst_HandSetupSwing(this); } } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, + Item_DropCollectible(play, &this->actor.world.pos, (Rand_ZeroOne() < 0.5f) ? ITEM00_ARROWS_SMALL : ITEM00_MAGIC_SMALL); BossSst_HandSetupRetreat(this); } @@ -1829,7 +1827,7 @@ void BossSst_HandGrab(BossSst* this, GlobalContext* globalCtx) { if (this->colliderJntSph.base.atFlags & AT_HIT) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); Audio_PlayActorSound2(&this->actor, NA_SE_EN_SHADEST_CATCH); - BossSst_HandGrabPlayer(this, globalCtx); + BossSst_HandGrabPlayer(this, play); this->timer = CLAMP_MAX(this->timer, 5); } @@ -1848,8 +1846,8 @@ void BossSst_HandSetupCrush(BossSst* this) { this->actionFunc = BossSst_HandCrush; } -void BossSst_HandCrush(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandCrush(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -1857,7 +1855,7 @@ void BossSst_HandCrush(BossSst* this, GlobalContext* globalCtx) { } if (!(player->stateFlags2 & PLAYER_STATE2_7)) { - BossSst_HandReleasePlayer(this, globalCtx, true); + BossSst_HandReleasePlayer(this, play, true); BossSst_HandSetupEndCrush(this); } else { player->actor.world.pos = this->actor.world.pos; @@ -1869,7 +1867,7 @@ void BossSst_HandCrush(BossSst* this, GlobalContext* globalCtx) { func_8002F7DC(&player->actor, NA_SE_VO_LI_DAMAGE_S); } - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } if (Animation_OnFrame(&this->skelAnime, 0.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_SHADEST_CATCH); @@ -1882,7 +1880,7 @@ void BossSst_HandSetupEndCrush(BossSst* this) { this->actionFunc = BossSst_HandEndCrush; } -void BossSst_HandEndCrush(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandEndCrush(BossSst* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { BossSst_HandSetupRetreat(this); } @@ -1897,8 +1895,8 @@ void BossSst_HandSetupSwing(BossSst* this) { this->actionFunc = BossSst_HandSwing; } -void BossSst_HandSwing(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandSwing(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 offXZ; if (Math_ScaledStepToS(&this->actor.shape.rot.x, this->amplitude, this->timer * 0xE4 + 0x1C8)) { @@ -1943,10 +1941,10 @@ void BossSst_HandSwing(BossSst* this, GlobalContext* globalCtx) { if ((this->timer == 4) && (this->amplitude == 0) && SkelAnime_Update(&this->skelAnime) && (player->stateFlags2 & PLAYER_STATE2_7)) { - BossSst_HandReleasePlayer(this, globalCtx, false); + BossSst_HandReleasePlayer(this, play, false); player->actor.world.pos.x += 70.0f * Math_SinS(this->actor.shape.rot.y); player->actor.world.pos.z += 70.0f * Math_CosS(this->actor.shape.rot.y); - func_8002F71C(globalCtx, &this->actor, 15.0f, this->actor.shape.rot.y, 2.0f); + func_8002F71C(play, &this->actor, 15.0f, this->actor.shape.rot.y, 2.0f); func_8002F7DC(&player->actor, NA_SE_PL_BODY_HIT); } @@ -1962,7 +1960,7 @@ void BossSst_HandSetupReel(BossSst* this) { this->actionFunc = BossSst_HandReel; } -void BossSst_HandReel(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReel(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -1995,7 +1993,7 @@ void BossSst_HandSetupReadyShake(BossSst* this) { this->actionFunc = BossSst_HandReadyShake; } -void BossSst_HandReadyShake(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyShake(BossSst* this, PlayState* play) { f32 diff; s32 inPosition; @@ -2020,7 +2018,7 @@ void BossSst_HandSetupShake(BossSst* this) { this->actionFunc = BossSst_HandShake; } -void BossSst_HandShake(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandShake(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -2052,7 +2050,7 @@ void BossSst_HandSetupReadyCharge(BossSst* this) { this->actionFunc = BossSst_HandReadyCharge; } -void BossSst_HandReadyCharge(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyCharge(BossSst* this, PlayState* play) { if (!this->ready) { this->ready = SkelAnime_Update(&this->skelAnime); this->ready &= Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x800); @@ -2068,8 +2066,8 @@ void BossSst_HandReadyCharge(BossSst* this, GlobalContext* globalCtx) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); OTHER_HAND(this)->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); sHead->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - func_8002F71C(globalCtx, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F71C(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); } } @@ -2086,7 +2084,7 @@ void BossSst_HandSetupStunned(BossSst* hand) { hand->actionFunc = BossSst_HandStunned; } -void BossSst_HandStunned(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandStunned(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->actor.world.pos.z, (Math_CosS(sHead->actor.shape.rot.y) * 200.0f) + this->actor.home.pos.z, 0.5f, 25.0f); @@ -2114,7 +2112,7 @@ void BossSst_HandSetupDamage(BossSst* hand) { hand->actionFunc = BossSst_HandDamage; } -void BossSst_HandDamage(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandDamage(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -2152,7 +2150,7 @@ void BossSst_HandSetupThrash(BossSst* this) { this->actionFunc = BossSst_HandThrash; } -void BossSst_HandThrash(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandThrash(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -2190,7 +2188,7 @@ void BossSst_HandSetupDarken(BossSst* this) { this->actionFunc = BossSst_HandDarken; } -void BossSst_HandDarken(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandDarken(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x800, this->handAngSpeed); Math_StepToF(&this->actor.world.pos.y, ROOM_CENTER_Y + 90.0f, 5.0f); @@ -2204,7 +2202,7 @@ void BossSst_HandSetupFall(BossSst* this) { this->actionFunc = BossSst_HandFall; } -void BossSst_HandFall(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandFall(BossSst* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x400); this->actor.world.pos.y = sHead->actor.world.pos.y + 230.0f; @@ -2220,7 +2218,7 @@ void BossSst_HandSetupMelt(BossSst* this) { this->actionFunc = BossSst_HandMelt; } -void BossSst_HandMelt(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandMelt(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -2241,7 +2239,7 @@ void BossSst_HandSetupFinish(BossSst* this) { this->actionFunc = BossSst_HandFinish; } -void BossSst_HandFinish(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandFinish(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -2257,7 +2255,7 @@ void BossSst_HandSetupRecover(BossSst* this) { this->actionFunc = BossSst_HandRecover; } -void BossSst_HandRecover(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandRecover(BossSst* this, PlayState* play) { Math_SmoothStepToF(&this->actor.world.pos.y, ROOM_CENTER_Y + 250.0f, 0.5f, 70.0f, 5.0f); if (SkelAnime_Update(&this->skelAnime)) { if (!this->ready) { @@ -2287,7 +2285,7 @@ void BossSst_HandSetupFrozen(BossSst* this) { this->actionFunc = BossSst_HandFrozen; } -void BossSst_HandFrozen(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandFrozen(BossSst* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -2334,7 +2332,7 @@ void BossSst_HandSetupReadyBreakIce(BossSst* this) { this->actionFunc = BossSst_HandReadyBreakIce; } -void BossSst_HandReadyBreakIce(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandReadyBreakIce(BossSst* this, PlayState* play) { s32 inPosition; inPosition = Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 0x400); @@ -2356,7 +2354,7 @@ void BossSst_HandSetupBreakIce(BossSst* this) { this->actor.speedXZ = 0.5f; } -void BossSst_HandBreakIce(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandBreakIce(BossSst* this, PlayState* play) { if ((this->timer % 2) != 0) { this->actor.speedXZ *= 1.5f; this->actor.speedXZ = CLAMP_MAX(this->actor.speedXZ, 60.0f); @@ -2394,10 +2392,10 @@ void BossSst_HandBreakIce(BossSst* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_SHADEST_HAND_FLY - SFX_FLAG); } -void BossSst_HandGrabPlayer(BossSst* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandGrabPlayer(BossSst* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; if (player->actor.colChkInfo.health > 0) { this->colliderJntSph.base.ocFlags1 &= ~OC1_ON; @@ -2408,8 +2406,8 @@ void BossSst_HandGrabPlayer(BossSst* this, GlobalContext* globalCtx) { } } -void BossSst_HandReleasePlayer(BossSst* this, GlobalContext* globalCtx, s32 dropPlayer) { - Player* player = GET_PLAYER(globalCtx); +void BossSst_HandReleasePlayer(BossSst* this, PlayState* play, s32 dropPlayer) { + Player* player = GET_PLAYER(play); if (player->actor.parent == &this->actor) { player->actor.parent = NULL; @@ -2417,7 +2415,7 @@ void BossSst_HandReleasePlayer(BossSst* this, GlobalContext* globalCtx, s32 drop this->colliderJntSph.base.ocFlags1 |= OC1_ON; OTHER_HAND(this)->colliderJntSph.base.ocFlags1 |= OC1_ON; if (dropPlayer) { - func_8002F71C(globalCtx, &this->actor, 0.0f, this->actor.shape.rot.y, 0.0f); + func_8002F71C(play, &this->actor, 0.0f, this->actor.shape.rot.y, 0.0f); } } } @@ -2506,7 +2504,7 @@ void BossSst_HeadSfx(BossSst* this, u16 sfxId) { func_80078914(&this->center, sfxId); } -void BossSst_HandCollisionCheck(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HandCollisionCheck(BossSst* this, PlayState* play) { if ((this->colliderJntSph.base.acFlags & AC_HIT) && (this->colliderJntSph.base.colType != COLTYPE_HARD)) { s32 bothHands = true; @@ -2515,9 +2513,9 @@ void BossSst_HandCollisionCheck(BossSst* this, GlobalContext* globalCtx) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); this->colliderJntSph.base.acFlags &= ~AC_ON; this->colliderJntSph.base.ocFlags1 &= ~OC1_NO_PUSH; - BossSst_HandReleasePlayer(this, globalCtx, true); + BossSst_HandReleasePlayer(this, play, true); if (HAND_STATE(OTHER_HAND(this)) == HAND_CLAP) { - BossSst_HandReleasePlayer(OTHER_HAND(this), globalCtx, true); + BossSst_HandReleasePlayer(OTHER_HAND(this), play, true); BossSst_HandSetupRetreat(OTHER_HAND(this)); } @@ -2532,21 +2530,21 @@ void BossSst_HandCollisionCheck(BossSst* this, GlobalContext* globalCtx) { } BossSst_HeadSetupDamagedHand(sHead, bothHands); - Item_DropCollectible(globalCtx, &this->actor.world.pos, + Item_DropCollectible(play, &this->actor.world.pos, (Rand_ZeroOne() < 0.5f) ? ITEM00_ARROWS_SMALL : ITEM00_MAGIC_SMALL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_SHADEST_DAMAGE_HAND); } } } -void BossSst_HeadCollisionCheck(BossSst* this, GlobalContext* globalCtx) { +void BossSst_HeadCollisionCheck(BossSst* this, PlayState* play) { if (this->colliderCyl.base.acFlags & AC_HIT) { this->colliderCyl.base.acFlags &= ~AC_HIT; if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (this->actionFunc == BossSst_HeadVulnerable) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); - BossSst_HeadSetupDeath(this, globalCtx); + Enemy_StartFinishingBlow(play, &this->actor); + BossSst_HeadSetupDeath(this, play); } else { BossSst_HeadSetupDamage(this); } @@ -2568,7 +2566,7 @@ void BossSst_HeadCollisionCheck(BossSst* this, GlobalContext* globalCtx) { } } -void BossSst_UpdateHand(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_UpdateHand(Actor* thisx, PlayState* play) { s32 pad; BossSst* this = (BossSst*)thisx; BossSstHandTrail* trail; @@ -2583,26 +2581,25 @@ void BossSst_UpdateHand(Actor* thisx, GlobalContext* globalCtx) { } } - BossSst_HandCollisionCheck(this, globalCtx); - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 130.0f, 0.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + BossSst_HandCollisionCheck(this, play); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 130.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); Actor_SetFocus(&this->actor, 0.0f); if (this->colliderJntSph.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); } if ((sHead->actionFunc != BossSst_HeadLurk) && (sHead->actionFunc != BossSst_HeadIntro) && (this->colliderJntSph.base.acFlags & AC_ON)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } if (this->colliderJntSph.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } if (this->colliderCyl.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderCyl.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCyl.base); } if ((HAND_STATE(this) != HAND_DEATH) && (HAND_STATE(this) != HAND_WAIT) && (HAND_STATE(this) != HAND_BEAT) && @@ -2621,10 +2618,10 @@ void BossSst_UpdateHand(Actor* thisx, GlobalContext* globalCtx) { trail->yRotMod = this->handYRotMod; this->trailIndex = (this->trailIndex + 1) % 7; - BossSst_UpdateEffects(&this->actor, globalCtx); + BossSst_UpdateEffects(&this->actor, play); } -void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_UpdateHead(Actor* thisx, PlayState* play) { s32 pad; BossSst* this = (BossSst*)thisx; @@ -2634,10 +2631,10 @@ void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) { sHandYawOffsets[LEFT] = sHands[LEFT]->actor.shape.rot.y - thisx->shape.rot.y; sHandYawOffsets[RIGHT] = sHands[RIGHT]->actor.shape.rot.y - thisx->shape.rot.y; - BossSst_HeadCollisionCheck(this, globalCtx); - this->actionFunc(this, globalCtx); + BossSst_HeadCollisionCheck(this, play); + this->actionFunc(this, play); if (this->vVanish) { - if (!globalCtx->actorCtx.lensActive || (thisx->colorFilterTimer != 0)) { + if (!play->actorCtx.lensActive || (thisx->colorFilterTimer != 0)) { this->actor.flags &= ~ACTOR_FLAG_7; } else { this->actor.flags |= ACTOR_FLAG_7; @@ -2645,18 +2642,18 @@ void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) { } if (this->colliderJntSph.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); } if ((this->actionFunc != BossSst_HeadLurk) && (this->actionFunc != BossSst_HeadIntro)) { if (this->colliderCyl.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCyl.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCyl.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } if (this->colliderJntSph.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } BossSst_MoveAround(this); @@ -2673,11 +2670,10 @@ void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) { BossSst_HeadSfx(this, NA_SE_EN_SHADEST_MOVE - SFX_FLAG); } - BossSst_UpdateEffects(&this->actor, globalCtx); + BossSst_UpdateEffects(&this->actor, play); } -s32 BossSst_OverrideHandDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossSst_OverrideHandDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossSst* this = (BossSst*)thisx; if (limbIndex == 1) { @@ -2687,14 +2683,14 @@ s32 BossSst_OverrideHandDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void BossSst_PostHandDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossSst_PostHandDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { BossSst* this = (BossSst*)thisx; Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); } -s32 BossSst_OverrideHandTrailDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* data, Gfx** gfx) { +s32 BossSst_OverrideHandTrailDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data, + Gfx** gfx) { BossSstHandTrail* trail = (BossSstHandTrail*)data; if (limbIndex == 1) { @@ -2704,12 +2700,12 @@ s32 BossSst_OverrideHandTrailDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_DrawHand(Actor* thisx, PlayState* play) { BossSst* this = (BossSst*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_sst.c", 6563); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_sst.c", 6563); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x80, sBodyColor.r, sBodyColor.g, sBodyColor.b, 255); @@ -2720,7 +2716,7 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, sBodyStaticDList); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossSst_OverrideHandDraw, BossSst_PostHandDraw, this); if (this->trailCount >= 2) { BossSstHandTrail* trail; @@ -2730,7 +2726,7 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { s32 end; s32 pad; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); end = this->trailCount >> 1; idx = (this->trailIndex + 4) % 7; @@ -2747,7 +2743,7 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, ((3 - i) * 10) + 20, 0, ((3 - i) * 20) + 50, ((3 - i) * 30) + 70); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossSst_OverrideHandTrailDraw, NULL, trail, POLY_XLU_DISP); } @@ -2757,12 +2753,12 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_sst.c", 6654); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_sst.c", 6654); - BossSst_DrawEffects(&this->actor, globalCtx); + BossSst_DrawEffects(&this->actor, play); } -s32 BossSst_OverrideHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 BossSst_OverrideHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { BossSst* this = (BossSst*)thisx; s32 shakeAmp; @@ -2838,7 +2834,7 @@ s32 BossSst_OverrideHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void BossSst_PostHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void BossSst_PostHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; static Vec3f headVec = { 1000.0f, 0.0f, 0.0f }; BossSst* this = (BossSst*)thisx; @@ -2855,14 +2851,14 @@ void BossSst_PostHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); } -void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_DrawHead(Actor* thisx, PlayState* play) { s32 pad; BossSst* this = (BossSst*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_sst.c", 6810); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_sst.c", 6810); if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x80, sBodyColor.r, sBodyColor.g, sBodyColor.b, 255); if (!sBodyStatic) { gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); @@ -2871,7 +2867,7 @@ void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, sBodyStaticDList); } } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 255, 255, 255, 255); gSPSegment(POLY_XLU_DISP++, 0x08, &D_80116280[2]); } @@ -2889,13 +2885,13 @@ void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx) { } if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, BossSst_OverrideHeadDraw, BossSst_PostHeadDraw, - this, POLY_OPA_DISP); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + BossSst_OverrideHeadDraw, BossSst_PostHeadDraw, this, POLY_OPA_DISP); } else { - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, BossSst_OverrideHeadDraw, BossSst_PostHeadDraw, - this, POLY_XLU_DISP); + POLY_XLU_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + BossSst_OverrideHeadDraw, BossSst_PostHeadDraw, this, POLY_XLU_DISP); } if ((this->actionFunc == BossSst_HeadIntro) && (113 >= this->timer) && (this->timer > 20)) { @@ -2903,7 +2899,7 @@ void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx) { Vec3f vanishMaskPos; Vec3f vanishMaskOffset; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 0, 0, 18, 255); yOffset = 113 * 8 - this->timer * 8; @@ -2914,20 +2910,20 @@ void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx) { vanishMaskPos.y = 450.0f; } - Matrix_MultVec3fExt(&vanishMaskPos, &vanishMaskOffset, &globalCtx->billboardMtxF); + Matrix_MultVec3fExt(&vanishMaskPos, &vanishMaskOffset, &play->billboardMtxF); Matrix_Translate(this->actor.world.pos.x + vanishMaskOffset.x, this->actor.world.pos.y + vanishMaskOffset.y, this->actor.world.pos.z + vanishMaskOffset.z, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_sst.c", 6934), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_sst.c", 6934), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sIntroVanishDList); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_sst.c", 6941); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_sst.c", 6941); - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->actor.focus.pos, &this->center); - BossSst_DrawEffects(&this->actor, globalCtx); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->actor.focus.pos, &this->center); + BossSst_DrawEffects(&this->actor, play); } void BossSst_SpawnHeadShadow(BossSst* this) { @@ -3086,7 +3082,7 @@ void BossSst_IceShatter(BossSst* this) { } } -void BossSst_UpdateEffects(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_UpdateEffects(Actor* thisx, PlayState* play) { BossSst* this = (BossSst*)thisx; BossSstEffect* effect; s32 i; @@ -3130,7 +3126,7 @@ void BossSst_UpdateEffects(Actor* thisx, GlobalContext* globalCtx) { effect = &this->effects[0]; if (this->actor.params == BONGO_HEAD) { - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->actor.focus.pos, &this->center); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->actor.focus.pos, &this->center); BossSst_HeadSfx(this, NA_SE_EN_SHADEST_LAST - SFX_FLAG); } while (effect->status != -1) { @@ -3147,27 +3143,27 @@ void BossSst_UpdateEffects(Actor* thisx, GlobalContext* globalCtx) { } } -void BossSst_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { +void BossSst_DrawEffects(Actor* thisx, PlayState* play) { s32 pad; BossSst* this = (BossSst*)thisx; s32 i; BossSstEffect* effect; if (this->effectMode != BONGO_NULL) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_sst.c", 7302); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_sst.c", 7302); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->effectMode == BONGO_ICE) { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, globalCtx->gameplayFrames % 256, 0x20, 0x10, 1, - 0, (globalCtx->gameplayFrames * 2) % 256, 0x40, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames % 256, 0x20, 0x10, 1, 0, + (play->gameplayFrames * 2) % 256, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, this->effects[0].alpha); gSPDisplayList(POLY_XLU_DISP++, gBongoIceCrystalDL); for (i = 0; i < 18; i++) { effect = &this->effects[i]; if (effect->move) { - func_8003435C(&effect->pos, globalCtx); + func_8003435C(&effect->pos, play); if (this->effects[0].status != 0) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); } else { @@ -3179,7 +3175,7 @@ void BossSst_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZYX(effect->rot.x, effect->rot.y, effect->rot.z, MTXMODE_APPLY); Matrix_Scale(effect->scale * 0.001f, effect->scale * 0.001f, effect->scale * 0.001f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_sst.c", 7350), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_sst.c", 7350), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBongoIceShardDL); } @@ -3189,8 +3185,8 @@ void BossSst_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 128, 0, 0x20, 0x40, 1, - 0, (globalCtx->gameplayFrames * -15) % 256, 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, 0, 0x20, 0x40, 1, 0, + (play->gameplayFrames * -15) % 256, 0x20, 0x40)); for (i = 0; i < 3; i++, scaleY -= 0.001f) { effect = &this->effects[i]; @@ -3202,7 +3198,7 @@ void BossSst_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 30, 0, 30, effect->alpha * effect->move); gDPSetEnvColor(POLY_XLU_DISP++, 30, 0, 30, 0); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_sst.c", 7396), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_sst.c", 7396), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFireCircleDL); } @@ -3216,13 +3212,13 @@ void BossSst_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale * 0.001f, 1.0f, effect->scale * 0.001f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_sst.c", 7423), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_sst.c", 7423), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sShadowDList); effect++; } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_sst.c", 7433); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_sst.c", 7433); } } diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h index 1d7ab7d85a..0524abaab2 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h @@ -6,7 +6,7 @@ struct BossSst; -typedef void (*BossSstActionFunc)(struct BossSst*, GlobalContext*); +typedef void (*BossSstActionFunc)(struct BossSst*, PlayState*); #define BOSS_SST_EFFECT_COUNT 18 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 ee2ac858f3..fc63e2613e 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -60,61 +60,61 @@ typedef struct { /* 0x0044 */ Actor* target; } BossTwEffect; -void BossTw_Init(Actor* thisx, GlobalContext* globalCtx); -void BossTw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossTw_Update(Actor* thisx, GlobalContext* globalCtx); -void BossTw_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossTw_Init(Actor* thisx, PlayState* play); +void BossTw_Destroy(Actor* thisx, PlayState* play); +void BossTw_Update(Actor* thisx, PlayState* play); +void BossTw_Draw(Actor* thisx, PlayState* play); -void BossTw_TwinrovaDamage(BossTw* this, GlobalContext* globalCtx, u8 arg2); -void BossTw_TwinrovaSetupFly(BossTw* this, GlobalContext* globalCtx); -void BossTw_DrawEffects(GlobalContext* globalCtx); -void BossTw_TwinrovaLaugh(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaFly(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaGetUp(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupGetUp(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupLaugh(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaDoneBlastShoot(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupDoneBlastShoot(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupShootBlast(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupChargeBlast(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaArriveAtTarget(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_CSWait(BossTw* this, GlobalContext* globalCtx); -void BossTw_DeathCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupMergeCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_MergeCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_Spin(BossTw* this, GlobalContext* globalCtx); -void BossTw_Laugh(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupLaugh(BossTw* this, GlobalContext* globalCtx); -void BossTw_FinishBeamShoot(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupFinishBeamShoot(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupHitByBeam(BossTw* this, GlobalContext* globalCtx); -void BossTw_HitByBeam(BossTw* this, GlobalContext* globalCtx); -void BossTw_Wait(BossTw* this, GlobalContext* globalCtx); -void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx); -void BossTw_FlyTo(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupShootBeam(BossTw* this, GlobalContext* globalCtx); -void BossTw_TurnToPlayer(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx); -void BossTw_TwinrovaDraw(Actor* thisx, GlobalContext* globalCtx); -void BossTw_SetupWait(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupIntroCS(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupFlyTo(BossTw* this, GlobalContext* globalCtx); -void BossTw_SetupCSWait(BossTw* this, GlobalContext* globalCtx); -void BossTw_BlastUpdate(Actor* thisx, GlobalContext* globalCtx); -void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx); -void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx); -void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx); -void BossTw_DeathBall(BossTw* this, GlobalContext* globalCtx); -void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx); -void BossTw_TwinrovaStun(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSpin(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaShootBlast(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaChargeBlast(BossTw* this, GlobalContext* globalCtx); -void BossTw_TwinrovaSetupSpin(BossTw* this, GlobalContext* globalCtx); -void BossTw_UpdateEffects(GlobalContext* globalCtx); +void BossTw_TwinrovaDamage(BossTw* this, PlayState* play, u8 arg2); +void BossTw_TwinrovaSetupFly(BossTw* this, PlayState* play); +void BossTw_DrawEffects(PlayState* play); +void BossTw_TwinrovaLaugh(BossTw* this, PlayState* play); +void BossTw_TwinrovaFly(BossTw* this, PlayState* play); +void BossTw_TwinrovaGetUp(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupGetUp(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupLaugh(BossTw* this, PlayState* play); +void BossTw_TwinrovaDoneBlastShoot(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupDoneBlastShoot(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupShootBlast(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupChargeBlast(BossTw* this, PlayState* play); +void BossTw_TwinrovaArriveAtTarget(BossTw* this, PlayState* play); +void BossTw_TwinrovaDeathCS(BossTw* this, PlayState* play); +void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play); +void BossTw_CSWait(BossTw* this, PlayState* play); +void BossTw_DeathCS(BossTw* this, PlayState* play); +void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupMergeCS(BossTw* this, PlayState* play); +void BossTw_MergeCS(BossTw* this, PlayState* play); +void BossTw_Spin(BossTw* this, PlayState* play); +void BossTw_Laugh(BossTw* this, PlayState* play); +void BossTw_SetupLaugh(BossTw* this, PlayState* play); +void BossTw_FinishBeamShoot(BossTw* this, PlayState* play); +void BossTw_SetupFinishBeamShoot(BossTw* this, PlayState* play); +void BossTw_SetupHitByBeam(BossTw* this, PlayState* play); +void BossTw_HitByBeam(BossTw* this, PlayState* play); +void BossTw_Wait(BossTw* this, PlayState* play); +void BossTw_ShootBeam(BossTw* this, PlayState* play); +void BossTw_FlyTo(BossTw* this, PlayState* play); +void BossTw_SetupShootBeam(BossTw* this, PlayState* play); +void BossTw_TurnToPlayer(BossTw* this, PlayState* play); +void BossTw_TwinrovaUpdate(Actor* thisx, PlayState* play); +void BossTw_TwinrovaDraw(Actor* thisx, PlayState* play); +void BossTw_SetupWait(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupIntroCS(BossTw* this, PlayState* play); +void BossTw_SetupFlyTo(BossTw* this, PlayState* play); +void BossTw_SetupCSWait(BossTw* this, PlayState* play); +void BossTw_BlastUpdate(Actor* thisx, PlayState* play); +void BossTw_BlastDraw(Actor* thisx, PlayState* play); +void BossTw_BlastFire(BossTw* this, PlayState* play); +void BossTw_BlastIce(BossTw* this, PlayState* play); +void BossTw_DeathBall(BossTw* this, PlayState* play); +void BossTw_DrawDeathBall(Actor* thisx, PlayState* play); +void BossTw_TwinrovaStun(BossTw* this, PlayState* play); +void BossTw_TwinrovaSpin(BossTw* this, PlayState* play); +void BossTw_TwinrovaShootBlast(BossTw* this, PlayState* play); +void BossTw_TwinrovaChargeBlast(BossTw* this, PlayState* play); +void BossTw_TwinrovaSetupSpin(BossTw* this, PlayState* play); +void BossTw_UpdateEffects(PlayState* play); const ActorInit Boss_Tw_InitVars = { ACTOR_BOSS_TW, @@ -233,12 +233,12 @@ static s16 D_8094C87C; static u8 D_8094C87E; static BossTwEffect sEffects[BOSS_TW_EFFECT_COUNT]; -void BossTw_AddDotEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, - s16 args, s16 countLimit) { +void BossTw_AddDotEffect(PlayState* play, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, s16 args, + s16 countLimit) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < countLimit; i++, eff++) { + for (i = 0, eff = play->specialEffects; i < countLimit; i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_DOT; eff->pos = *initalPos; @@ -253,12 +253,12 @@ void BossTw_AddDotEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* init } } -void BossTw_AddDmgCloud(GlobalContext* globalCtx, s16 type, Vec3f* initialPos, Vec3f* initalSpeed, Vec3f* accel, - f32 scale, s16 alpha, s16 args, s16 countLimit) { +void BossTw_AddDmgCloud(PlayState* play, s16 type, Vec3f* initialPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, + s16 alpha, s16 args, s16 countLimit) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < countLimit; i++, eff++) { + for (i = 0, eff = play->specialEffects; i < countLimit; i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = type; eff->pos = *initialPos; @@ -273,12 +273,12 @@ void BossTw_AddDmgCloud(GlobalContext* globalCtx, s16 type, Vec3f* initialPos, V } } -void BossTw_AddRingEffect(GlobalContext* globalCtx, Vec3f* initalPos, f32 scale, f32 arg3, s16 alpha, s16 args, - s16 arg6, s16 countLimit) { +void BossTw_AddRingEffect(PlayState* play, Vec3f* initalPos, f32 scale, f32 arg3, s16 alpha, s16 args, s16 arg6, + s16 countLimit) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < countLimit; i++, eff++) { + for (i = 0, eff = play->specialEffects; i < countLimit; i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_RING; eff->pos = *initalPos; @@ -296,11 +296,11 @@ void BossTw_AddRingEffect(GlobalContext* globalCtx, Vec3f* initalPos, f32 scale, } } -void BossTw_AddPlayerFreezeEffect(GlobalContext* globalCtx, Actor* target) { +void BossTw_AddPlayerFreezeEffect(PlayState* play, Actor* target) { BossTwEffect* eff; s16 i; - for (eff = globalCtx->specialEffects, i = 0; i < BOSS_TW_EFFECT_COUNT; i++, eff++) { + for (eff = play->specialEffects, i = 0; i < BOSS_TW_EFFECT_COUNT; i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_PLYR_FRZ; eff->curSpeed = sZeroVector; @@ -320,12 +320,11 @@ void BossTw_AddPlayerFreezeEffect(GlobalContext* globalCtx, Actor* target) { } } -void BossTw_AddFlameEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, - s16 args) { +void BossTw_AddFlameEffect(PlayState* play, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, s16 args) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < BOSS_TW_EFFECT_COUNT; i++, eff++) { + for (i = 0, eff = play->specialEffects; i < BOSS_TW_EFFECT_COUNT; i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_FLAME; eff->pos = *initalPos; @@ -341,11 +340,11 @@ void BossTw_AddFlameEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* in } } -void BossTw_AddMergeFlameEffect(GlobalContext* globalCtx, Vec3f* initialPos, f32 scale, f32 dist, s16 args) { +void BossTw_AddMergeFlameEffect(PlayState* play, Vec3f* initialPos, f32 scale, f32 dist, s16 args) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < BOSS_TW_EFFECT_COUNT; i++, eff++) { + for (i = 0, eff = play->specialEffects; i < BOSS_TW_EFFECT_COUNT; i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_MERGEFLAME; eff->pos = *initialPos; @@ -363,12 +362,12 @@ void BossTw_AddMergeFlameEffect(GlobalContext* globalCtx, Vec3f* initialPos, f32 } } -void BossTw_AddShieldBlastEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, - f32 scale, f32 arg5, s16 alpha, s16 args) { +void BossTw_AddShieldBlastEffect(PlayState* play, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, + f32 arg5, s16 alpha, s16 args) { s16 i; BossTwEffect* eff; - for (i = 0, eff = globalCtx->specialEffects; i < BOSS_TW_EFFECT_COUNT; i++, eff++) { + for (i = 0, eff = play->specialEffects; i < BOSS_TW_EFFECT_COUNT; i++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_SHLD_BLST; eff->pos = *initalPos; @@ -385,17 +384,17 @@ void BossTw_AddShieldBlastEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec } } -void BossTw_AddShieldDeflectEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2) { +void BossTw_AddShieldDeflectEffect(PlayState* play, f32 arg1, s16 arg2) { s16 i; s16 j; BossTwEffect* eff; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); sShieldHitPos = player->bodyPartsPos[PLAYER_BODYPART_R_HAND]; sShieldHitYaw = player->actor.shape.rot.y; for (i = 0; i < 8; i++) { - for (eff = globalCtx->specialEffects, j = 0; j < BOSS_TW_EFFECT_COUNT; j++, eff++) { + for (eff = play->specialEffects, j = 0; j < BOSS_TW_EFFECT_COUNT; j++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_SHLD_DEFL; eff->pos = sShieldHitPos; @@ -415,17 +414,17 @@ void BossTw_AddShieldDeflectEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2) } } -void BossTw_AddShieldHitEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2) { +void BossTw_AddShieldHitEffect(PlayState* play, f32 arg1, s16 arg2) { s16 i; s16 j; BossTwEffect* eff; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); sShieldHitPos = player->bodyPartsPos[PLAYER_BODYPART_R_HAND]; sShieldHitYaw = player->actor.shape.rot.y; for (i = 0; i < 8; i++) { - for (eff = globalCtx->specialEffects, j = 0; j < BOSS_TW_EFFECT_COUNT; j++, eff++) { + for (eff = play->specialEffects, j = 0; j < BOSS_TW_EFFECT_COUNT; j++, eff++) { if (eff->type == TWEFF_NONE) { eff->type = TWEFF_SHLD_HIT; eff->pos = sShieldHitPos; @@ -445,8 +444,8 @@ void BossTw_AddShieldHitEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2) { } } -void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossTw_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossTw* this = (BossTw*)thisx; s16 i; @@ -460,8 +459,8 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.draw = BossTw_BlastDraw; this->actor.flags &= ~ACTOR_FLAG_0; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitBlasts); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitBlasts); if (this->actor.params == TW_FIRE_BLAST || this->actor.params == TW_FIRE_BLAST_GROUND) { this->actionFunc = BossTw_BlastFire; @@ -487,14 +486,14 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetScale(&this->actor, 2.5 * 0.01f); this->actor.colChkInfo.mass = 255; this->actor.colChkInfo.health = 0; - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); if (!sTwInitalized) { sTwInitalized = true; - globalCtx->envCtx.lightSettingOverride = 1; - globalCtx->envCtx.prevLightSetting = 1; - globalCtx->envCtx.lightSetting = 1; - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightSettingOverride = 1; + play->envCtx.prevLightSetting = 1; + play->envCtx.lightSetting = 1; + play->envCtx.lightBlend = 0.0f; D_8094C874 = D_8094C876 = D_8094C878 = D_8094C87A = D_8094C87C = D_8094C87E = D_8094C870 = D_8094C86F = D_8094C872 = sBeamDivertTimer = sEnvType = sGroundBlastType = sFreezeState = sTwinrovaBlastType = @@ -502,7 +501,7 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { D_8094C858 = D_8094C854 = 0.0f; sFixedBlastType = Rand_ZeroFloat(1.99f); - globalCtx->specialEffects = sEffects; + play->specialEffects = sEffects; for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) { sEffects[i].type = TWEFF_NONE; @@ -510,55 +509,55 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { } if (this->actor.params == TW_KOTAKE) { - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitKoumeKotake); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitKoumeKotake); this->actor.naviEnemyId = NAVI_ENEMY_TWINROVA_KOTAKE; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tw_Skel_0070E0, &object_tw_Anim_006F28, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tw_Skel_0070E0, &object_tw_Anim_006F28, NULL, NULL, 0); if (GET_EVENTCHKINF(EVENTCHKINF_75)) { // began twinrova battle - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); this->actor.world.pos.x = -600.0f; this->actor.world.pos.y = 400.0f; this->actor.world.pos.z = 0.0f; Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } else { - BossTw_SetupCSWait(this, globalCtx); + BossTw_SetupCSWait(this, play); } Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_006F28, -3.0f); this->visible = true; } else if (this->actor.params == TW_KOUME) { - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitKoumeKotake); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitKoumeKotake); this->actor.naviEnemyId = NAVI_ENEMY_TWINROVA_KOUME; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tw_Skel_01F888, &object_tw_Anim_006F28, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tw_Skel_01F888, &object_tw_Anim_006F28, NULL, NULL, 0); if (GET_EVENTCHKINF(EVENTCHKINF_75)) { // began twinrova battle - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); this->actor.world.pos.x = 600.0f; this->actor.world.pos.y = 400.0f; this->actor.world.pos.z = 0.0f; } else { - BossTw_SetupCSWait(this, globalCtx); + BossTw_SetupCSWait(this, play); } Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_006F28, -3.0f); this->visible = true; } else { // Twinrova - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitTwinrova); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitTwinrova); this->actor.naviEnemyId = NAVI_ENEMY_TWINROVA; this->actor.colChkInfo.health = 24; this->actor.update = BossTw_TwinrovaUpdate; this->actor.draw = BossTw_TwinrovaDraw; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tw_Skel_032020, &object_tw_Anim_0244B4, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tw_Skel_032020, &object_tw_Anim_0244B4, NULL, NULL, 0); Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_0244B4, -3.0f); if (GET_EVENTCHKINF(EVENTCHKINF_75)) { // began twinrova battle - BossTw_SetupWait(this, globalCtx); + BossTw_SetupWait(this, play); } else { - BossTw_TwinrovaSetupIntroCS(this, globalCtx); + BossTw_TwinrovaSetupIntroCS(this, play); this->actor.world.pos.x = 0.0f; this->actor.world.pos.y = 1000.0f; this->actor.world.pos.z = 0.0f; @@ -567,37 +566,37 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.params = TW_TWINROVA; sTwinrovaPtr = this; - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { // twinrova has been defeated. Actor_Kill(&this->actor); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 600.0f, 230.0f, 0.0f, 0, - 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, -600.0f, 230.0f, 0.0f, 0, 0, 0, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 600.0f, 230.0f, 0.0f, 0, 0, 0, + WARP_DUNGEON_ADULT); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, -600.0f, 230.0f, 0.0f, 0, 0, 0, 0); } else { - sKotakePtr = (BossTw*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, - this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, TW_KOTAKE); - sKoumePtr = (BossTw*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, - this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, TW_KOUME); + sKotakePtr = + (BossTw*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, TW_KOTAKE); + sKoumePtr = + (BossTw*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, TW_KOUME); sKotakePtr->actor.parent = &sKoumePtr->actor; sKoumePtr->actor.parent = &sKotakePtr->actor; } } - this->fogR = globalCtx->lightCtx.fogColor[0]; - this->fogG = globalCtx->lightCtx.fogColor[1]; - this->fogB = globalCtx->lightCtx.fogColor[2]; - this->fogNear = globalCtx->lightCtx.fogNear; + this->fogR = play->lightCtx.fogColor[0]; + this->fogG = play->lightCtx.fogColor[1]; + this->fogB = play->lightCtx.fogColor[2]; + this->fogNear = play->lightCtx.fogNear; this->fogFar = 1000.0f; } -void BossTw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossTw_Destroy(Actor* thisx, PlayState* play) { BossTw* this = (BossTw*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); if (thisx->params < TW_FIRE_BLAST) { - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } if (thisx->params == TW_TWINROVA) { @@ -605,7 +604,7 @@ void BossTw_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void BossTw_SetupTurnToPlayer(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupTurnToPlayer(BossTw* this, PlayState* play) { BossTw* otherTw = (BossTw*)this->actor.parent; this->actionFunc = BossTw_TurnToPlayer; @@ -619,7 +618,7 @@ void BossTw_SetupTurnToPlayer(BossTw* this, GlobalContext* globalCtx) { this->rotateSpeed = 0.0f; } -void BossTw_TurnToPlayer(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TurnToPlayer(BossTw* this, PlayState* play) { BossTw* otherTw = (BossTw*)this->actor.parent; SkelAnime_Update(&this->skelAnime); @@ -632,15 +631,15 @@ void BossTw_TurnToPlayer(BossTw* this, GlobalContext* globalCtx) { if (this->timers[0] == 0) { if ((otherTw->actionFunc != BossTw_ShootBeam) && this->work[CAN_SHOOT]) { this->work[CAN_SHOOT] = false; - BossTw_SetupShootBeam(this, globalCtx); + BossTw_SetupShootBeam(this, play); this->actor.speedXZ = 0.0f; } else { - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); } } } -void BossTw_SetupFlyTo(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupFlyTo(BossTw* this, PlayState* play) { static Vec3f sPillarPositions[] = { { 600.0f, 400.0f, 0.0f }, { 0.0f, 400.0f, 600.0f }, { -600.0f, 400.0f, 0.0f }, { 0.0f, 400.0f, -600.0f } }; @@ -673,7 +672,7 @@ void BossTw_SetupFlyTo(BossTw* this, GlobalContext* globalCtx) { } } -void BossTw_FlyTo(BossTw* this, GlobalContext* globalCtx) { +void BossTw_FlyTo(BossTw* this, PlayState* play) { f32 xDiff; f32 yDiff; f32 zDiff; @@ -703,12 +702,12 @@ void BossTw_FlyTo(BossTw* this, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); if ((this->timers[0] == 0) || (xzDist < 70.0f)) { - BossTw_SetupTurnToPlayer(this, globalCtx); + BossTw_SetupTurnToPlayer(this, play); } } -void BossTw_SetupShootBeam(BossTw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossTw_SetupShootBeam(BossTw* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actionFunc = BossTw_ShootBeam; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_007688, -5.0f); @@ -729,7 +728,7 @@ void BossTw_SetupShootBeam(BossTw* this, GlobalContext* globalCtx) { this->updateRate2 = 0.0f; } -void BossTw_SpawnGroundBlast(BossTw* this, GlobalContext* globalCtx, s16 blastType) { +void BossTw_SpawnGroundBlast(BossTw* this, PlayState* play, s16 blastType) { BossTw* groundBlast; s16 i; Vec3f pos; @@ -744,14 +743,14 @@ void BossTw_SpawnGroundBlast(BossTw* this, GlobalContext* globalCtx, s16 blastTy accel.x = Rand_CenteredFloat(0.25f); accel.z = Rand_CenteredFloat(0.25f); pos = this->groundBlastPos; - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, blastType, 75); + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, blastType, 75); } if (blastType == 1) { sGroundBlastType = 1; - groundBlast = (BossTw*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, - this->groundBlastPos.x, this->groundBlastPos.y, - this->groundBlastPos.z, 0, 0, 0, TW_FIRE_BLAST_GROUND); + groundBlast = + (BossTw*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->groundBlastPos.x, + this->groundBlastPos.y, this->groundBlastPos.z, 0, 0, 0, TW_FIRE_BLAST_GROUND); if (groundBlast != NULL) { if (sTwinrovaPtr->actionFunc == BossTw_Wait) { groundBlast->timers[0] = 100; @@ -766,9 +765,9 @@ void BossTw_SpawnGroundBlast(BossTw* this, GlobalContext* globalCtx, s16 blastTy } } else { sGroundBlastType = 2; - groundBlast = (BossTw*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, - this->groundBlastPos.x, this->groundBlastPos.y, - this->groundBlastPos.z, 0, 0, 0, TW_ICE_BLAST_GROUND); + groundBlast = + (BossTw*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->groundBlastPos.x, + this->groundBlastPos.y, this->groundBlastPos.z, 0, 0, 0, TW_ICE_BLAST_GROUND); if (groundBlast != NULL) { if (sTwinrovaPtr->actionFunc == BossTw_Wait) { groundBlast->timers[0] = 100; @@ -787,10 +786,10 @@ void BossTw_SpawnGroundBlast(BossTw* this, GlobalContext* globalCtx, s16 blastTy } } -s32 BossTw_BeamHitPlayerCheck(BossTw* this, GlobalContext* globalCtx) { +s32 BossTw_BeamHitPlayerCheck(BossTw* this, PlayState* play) { Vec3f offset; Vec3f beamDistFromPlayer; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 i; offset.x = player->actor.world.pos.x - this->beamOrigin.x; @@ -806,7 +805,7 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, GlobalContext* globalCtx) { if (sTwinrovaPtr->timers[2] == 0) { sTwinrovaPtr->timers[2] = 150; this->beamDist = sqrtf(SQ(offset.x) + SQ(offset.y) + SQ(offset.z)); - func_8002F6D4(globalCtx, &this->actor, 3.0f, this->actor.shape.rot.y, 0.0f, 0x20); + func_8002F6D4(play, &this->actor, 3.0f, this->actor.shape.rot.y, 0.0f, 0x20); if (this->actor.params == 0) { if (sFreezeState == 0) { @@ -833,10 +832,10 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, GlobalContext* globalCtx) { * returns 1 if the beam will be reflected, * and returns 2 if the beam will be diverted backwards */ -s32 BossTw_CheckBeamReflection(BossTw* this, GlobalContext* globalCtx) { +s32 BossTw_CheckBeamReflection(BossTw* this, PlayState* play) { Vec3f offset; Vec3f vec; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->stateFlags1 & PLAYER_STATE1_22 && (s16)(player->actor.shape.rot.y - this->actor.shape.rot.y + 0x8000) < 0x2000 && @@ -866,7 +865,7 @@ s32 BossTw_CheckBeamReflection(BossTw* this, GlobalContext* globalCtx) { // and the distance from the beams origin to 10 units in front of link is less than the beams // current distance (the distance of the beam is equal to or longer than the distance to 10 units // in front of link) - if (Player_HasMirrorShieldEquipped(globalCtx)) { + if (Player_HasMirrorShieldEquipped(play)) { // player has mirror shield equipped this->beamDist = sqrtf(SQ(offset.x) + SQ(offset.y) + SQ(offset.z)); return 1; @@ -879,8 +878,8 @@ s32 BossTw_CheckBeamReflection(BossTw* this, GlobalContext* globalCtx) { if (sBeamDivertTimer == 0) { // beam hit the shield, normal shield equipped, // divert the beam backwards from link's Y rotation - BossTw_AddShieldDeflectEffect(globalCtx, 10.0f, this->actor.params); - globalCtx->envCtx.lightBlend = 1.0f; + BossTw_AddShieldDeflectEffect(play, 10.0f, this->actor.params); + play->envCtx.lightBlend = 1.0f; this->timers[0] = 10; func_80078884(NA_SE_IT_SHIELD_REFLECT_MG2); } @@ -961,7 +960,7 @@ f32 BossTw_GetFloorY(Vec3f* pos) { return -100.0f; } -void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { +void BossTw_ShootBeam(BossTw* this, PlayState* play) { s16 i; f32 xDiff; f32 yDiff; @@ -969,9 +968,9 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { f32 floorY; Vec3f sp130; Vec3s sp128; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); BossTw* otherTw = (BossTw*)this->actor.parent; - Input* input = &globalCtx->state.input[0]; + Input* input = &play->state.input[0]; Math_ApproachF(&this->actor.world.pos.y, 400.0f, 0.05f, this->actor.speedXZ); Math_ApproachF(&this->actor.speedXZ, 5.0f, 1.0f, 0.25f); @@ -1001,8 +1000,8 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { if (this->timers[1] < 50) { if (this->timers[1] < 10) { if (this->timers[1] == 9) { - globalCtx->envCtx.lightBlend = 0.5f; - globalCtx->envCtx.lightSetting = 3 - this->actor.params; + play->envCtx.lightBlend = 0.5f; + play->envCtx.lightSetting = 3 - this->actor.params; Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_MASIC_SET); } @@ -1027,7 +1026,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.0f; accel.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, + BossTw_AddFlameEffect(play, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, this->actor.params); } } @@ -1092,7 +1091,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { break; case 0: if (this->timers[0] != 0) { - s32 beamReflection = BossTw_CheckBeamReflection(this, globalCtx); + s32 beamReflection = BossTw_CheckBeamReflection(this, play); if (beamReflection == 1) { Vec3f pos; @@ -1104,7 +1103,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { velocity.y = Rand_CenteredFloat(15.0f); velocity.z = Rand_CenteredFloat(15.0f); pos = player->bodyPartsPos[PLAYER_BODYPART_R_HAND]; - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 5, + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 5, this->actor.params, 150); } @@ -1118,10 +1117,10 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { this->groundBlastPos.x = 0.0f; this->groundBlastPos.y = 0.0f; this->groundBlastPos.z = 0.0f; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; func_800AA000(0.0f, 0x64, 5, 4); } else if (beamReflection == 0) { - BossTw_BeamHitPlayerCheck(this, globalCtx); + BossTw_BeamHitPlayerCheck(this, play); if (this->csState1 == 0) { Math_ApproachF(&this->beamDist, 2.0f * sqrtf(SQ(xDiff) + SQ(yDiff) + SQ(zDiff)), 1.0f, @@ -1130,8 +1129,8 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { } } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->beamReflectionOrigin, - &this->unk_54C, &this->actor.projectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->beamReflectionOrigin, &this->unk_54C, + &this->actor.projectedW); if (this->actor.params == 1) { Audio_PlaySoundGeneral(NA_SE_EN_TWINROBA_SHOOT_FIRE - SFX_FLAG, &this->unk_54C, 4, @@ -1146,7 +1145,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { case 1: if (CHECK_BTN_ALL(input->cur.button, BTN_R)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->beamDist = sqrtf(SQ(xDiff) + SQ(yDiff) + SQ(zDiff)); Math_ApproachF(&this->beamReflectionDist, 2000.0f, 1.0f, 40.0f); @@ -1154,7 +1153,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->targetPos.y, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].y, 1.0f, 400.0f); Math_ApproachF(&this->targetPos.z, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].z, 1.0f, 400.0f); if ((this->work[CS_TIMER_1] % 4) == 0) { - BossTw_AddRingEffect(globalCtx, &player->bodyPartsPos[PLAYER_BODYPART_R_HAND], 0.5f, 3.0f, 0xFF, + BossTw_AddRingEffect(play, &player->bodyPartsPos[PLAYER_BODYPART_R_HAND], 0.5f, 3.0f, 0xFF, this->actor.params, 1, BOSS_TW_EFFECT_COUNT); } } else { @@ -1162,7 +1161,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { this->beamReflectionDist = 0.0f; } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->unk_530, &this->unk_558, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->unk_530, &this->unk_558, &this->actor.projectedW); if (this->actor.params == 1) { @@ -1191,7 +1190,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->beamScale, 0.0f, 1.0f, 0.0005f); if (this->beamScale == 0.0f) { - BossTw_SetupFinishBeamShoot(this, globalCtx); + BossTw_SetupFinishBeamShoot(this, play); this->beamReflectionDist = 0.0f; this->beamDist = 0.0f; } @@ -1215,7 +1214,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { this->csState1 = 1; this->groundBlastPos.x = this->beamReflectionOrigin.x; this->groundBlastPos.z = this->beamReflectionOrigin.z; - BossTw_SpawnGroundBlast(this, globalCtx, this->actor.params); + BossTw_SpawnGroundBlast(this, play, this->actor.params); this->timers[0] = 20; } } @@ -1258,7 +1257,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { this->csState1 = 1; this->groundBlastPos.x = spBC.x; this->groundBlastPos.z = spBC.z; - BossTw_SpawnGroundBlast(this, globalCtx, this->actor.params); + BossTw_SpawnGroundBlast(this, play, this->actor.params); this->timers[0] = 20; } else { for (i = 0; i < 5; i++) { @@ -1273,12 +1272,12 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { accel.y = 0.0f; accel.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &this->unk_530, &velocity, &accel, + BossTw_AddFlameEffect(play, &this->unk_530, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, this->actor.params); } this->beamReflectionDist = sp130.z; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 0.8f, 1.0f, 0.2f); + Math_ApproachF(&play->envCtx.lightBlend, 0.8f, 1.0f, 0.2f); } break; } @@ -1292,8 +1291,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { } if (BossTw_BeamReflHitCheck(this, &this->actor.world.pos) && (this->work[CS_TIMER_1] % 4) == 0) { - BossTw_AddRingEffect(globalCtx, &this->unk_530, 0.5f, 3.0f, 255, this->actor.params, 1, - BOSS_TW_EFFECT_COUNT); + BossTw_AddRingEffect(play, &this->unk_530, 0.5f, 3.0f, 255, this->actor.params, 1, BOSS_TW_EFFECT_COUNT); } if (BossTw_BeamReflHitCheck(this, &otherTw->actor.world.pos) && otherTw->actionFunc != BossTw_HitByBeam) { @@ -1314,40 +1312,39 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { accel.y = 0.0f; accel.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, - this->actor.params); + BossTw_AddFlameEffect(play, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, this->actor.params); } - BossTw_SetupHitByBeam(otherTw, globalCtx); + BossTw_SetupHitByBeam(otherTw, play); Audio_PlayActorSound2(&otherTw->actor, NA_SE_EN_TWINROBA_DAMAGE_VOICE); - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; otherTw->actor.colChkInfo.health++; } } } -void BossTw_SetupFinishBeamShoot(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupFinishBeamShoot(BossTw* this, PlayState* play) { this->actionFunc = BossTw_FinishBeamShoot; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_004548, 0.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_004548); } -void BossTw_FinishBeamShoot(BossTw* this, GlobalContext* globalCtx) { +void BossTw_FinishBeamShoot(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->scepterAlpha, 0.0f, 1.0f, 10.0f); if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { if (sTwinrovaPtr->timers[2] == 0) { - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); } else { - BossTw_SetupLaugh(this, globalCtx); + BossTw_SetupLaugh(this, play); } this->scepterAlpha = 0.0f; } } -void BossTw_SetupHitByBeam(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupHitByBeam(BossTw* this, PlayState* play) { this->actionFunc = BossTw_HitByBeam; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_00578C, 0.0f); this->timers[0] = 53; @@ -1358,7 +1355,7 @@ void BossTw_SetupHitByBeam(BossTw* this, GlobalContext* globalCtx) { } } -void BossTw_HitByBeam(BossTw* this, GlobalContext* globalCtx) { +void BossTw_HitByBeam(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->work[CS_TIMER_1] % 4) == 0) { @@ -1378,8 +1375,8 @@ void BossTw_HitByBeam(BossTw* this, GlobalContext* globalCtx) { accel.y = 0.1f; accel.z = 0.0f; - BossTw_AddDmgCloud(globalCtx, this->actor.params + 2, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 15.0f, 0, - 0, 150); + BossTw_AddDmgCloud(play, this->actor.params + 2, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 15.0f, 0, 0, + 150); } if (this->actor.params == 1) { @@ -1395,7 +1392,7 @@ void BossTw_HitByBeam(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.speedXZ, 5.0f, 1.0f, 1.0f); this->actor.world.pos.y -= 50.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2); this->actor.world.pos.y += 50.0f; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { @@ -1408,18 +1405,18 @@ void BossTw_HitByBeam(BossTw* this, GlobalContext* globalCtx) { } if ((this->timers[0] == 0) && Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); } } -void BossTw_SetupLaugh(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupLaugh(BossTw* this, PlayState* play) { this->actionFunc = BossTw_Laugh; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_0088C8, 0.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_0088C8); this->actor.speedXZ = 0.0f; } -void BossTw_Laugh(BossTw* this, GlobalContext* globalCtx) { +void BossTw_Laugh(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 10.0f)) { @@ -1431,11 +1428,11 @@ void BossTw_Laugh(BossTw* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); } } -void BossTw_SetupSpin(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupSpin(BossTw* this, PlayState* play) { this->actionFunc = BossTw_Spin; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_007CA8, -3.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_007CA8); @@ -1444,7 +1441,7 @@ void BossTw_SetupSpin(BossTw* this, GlobalContext* globalCtx) { this->timers[0] = 20; } -void BossTw_Spin(BossTw* this, GlobalContext* globalCtx) { +void BossTw_Spin(BossTw* this, PlayState* play) { if (this->timers[0] != 0) { this->collider.base.colType = COLTYPE_METAL; this->actor.shape.rot.y -= 0x3000; @@ -1457,61 +1454,61 @@ void BossTw_Spin(BossTw* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2000); if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { - BossTw_SetupFlyTo(this, globalCtx); + BossTw_SetupFlyTo(this, play); } } } -void BossTw_SetupMergeCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupMergeCS(BossTw* this, PlayState* play) { this->actionFunc = BossTw_MergeCS; this->rotateSpeed = 0.0f; this->actor.speedXZ = 0.0f; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_006F28, -10.0f); } -void BossTw_MergeCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_MergeCS(BossTw* this, PlayState* play) { Math_ApproachF(&this->scepterAlpha, 0.0f, 1.0f, 10.0f); SkelAnime_Update(&this->skelAnime); } -void BossTw_SetupWait(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupWait(BossTw* this, PlayState* play) { this->actionFunc = BossTw_Wait; this->visible = false; this->actor.world.pos.y = -2000.0f; this->actor.flags &= ~ACTOR_FLAG_0; } -void BossTw_Wait(BossTw* this, GlobalContext* globalCtx) { +void BossTw_Wait(BossTw* this, PlayState* play) { if ((this->actor.params == TW_TWINROVA) && (sKoumePtr->actionFunc == BossTw_FlyTo) && (sKotakePtr->actionFunc == BossTw_FlyTo) && ((sKoumePtr->actor.colChkInfo.health + sKotakePtr->actor.colChkInfo.health) >= 4)) { - BossTw_TwinrovaSetupMergeCS(this, globalCtx); - BossTw_SetupMergeCS(sKotakePtr, globalCtx); - BossTw_SetupMergeCS(sKoumePtr, globalCtx); + BossTw_TwinrovaSetupMergeCS(this, play); + BossTw_SetupMergeCS(sKotakePtr, play); + BossTw_SetupMergeCS(sKoumePtr, play); } } -void BossTw_TwinrovaSetupMergeCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupMergeCS(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaMergeCS; this->csState2 = 0; this->csState1 = 0; } -void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play) { s16 i; Vec3f spB0; Vec3f spA4; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); switch (this->csState2) { case 0: this->csState2 = 1; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 0x39); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 0x39); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->subCamDist = 800.0f; this->subCamYaw = M_PI; sKoumePtr->actor.world.rot.x = 0; @@ -1526,11 +1523,11 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { // fallthrough case 1: if (this->work[CS_TIMER_2] == 20) { - Message_StartTextbox(globalCtx, 0x6059, NULL); + Message_StartTextbox(play, 0x6059, NULL); } if (this->work[CS_TIMER_2] == 80) { - Message_StartTextbox(globalCtx, 0x605A, NULL); + Message_StartTextbox(play, 0x605A, NULL); } this->subCamAt.x = 0.0f; @@ -1570,9 +1567,9 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { if (this->subCamId != SUB_CAM_ID_DONE) { if (this->unk_5F9 == 0) { - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } else { - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt2, &this->subCamEye2); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt2, &this->subCamEye2); } } @@ -1614,7 +1611,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { pos.x = 3000.0f; pos.y = 400.0f + yOffset; pos.z = 0.0f; - BossTw_AddMergeFlameEffect(globalCtx, &pos, Rand_ZeroFloat(5.0f) + 10.0f, + BossTw_AddMergeFlameEffect(play, &pos, Rand_ZeroFloat(5.0f) + 10.0f, sqrtf(SQ(xScale) - SQ(yOffset)), Rand_ZeroFloat(1.99f)); } @@ -1634,7 +1631,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { pos.y += velocity.y; pos.z += velocity.z; accel.z = accel.y = accel.x = 0.0f; - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, + BossTw_AddFlameEffect(play, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, velocity.x < 0.0f); } @@ -1642,13 +1639,13 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { this->visible = true; this->actor.flags |= ACTOR_FLAG_0; this->actor.shape.rot.y = 0; - BossTw_SetupWait(sKotakePtr, globalCtx); - BossTw_SetupWait(sKoumePtr, globalCtx); + BossTw_SetupWait(sKotakePtr, play); + BossTw_SetupWait(sKoumePtr, play); Actor_SetScale(&this->actor, 0.0f); Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_038E2C, 0.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_038E2C); this->timers[0] = 50; - func_8002DF54(globalCtx, &this->actor, 2); + func_8002DF54(play, &this->actor, 2); Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_TRANSFORM); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } @@ -1664,8 +1661,8 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { } sEnvType = -1; - globalCtx->envCtx.lightSetting = 4; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1, 1, 0.1f); + play->envCtx.lightSetting = 4; + Math_ApproachF(&play->envCtx.lightBlend, 1, 1, 0.1f); // fallthrough case 2: SkelAnime_Update(&this->skelAnime); @@ -1691,7 +1688,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { } if (this->timers[3] == 19) { - func_8002DF54(globalCtx, &this->actor, 5); + func_8002DF54(play, &this->actor, 5); } if (this->timers[3] == 16) { @@ -1711,36 +1708,36 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { } if (this->timers[2] == 4) { sEnvType = 0; - globalCtx->envCtx.prevLightSetting = 5; + play->envCtx.prevLightSetting = 5; } if (this->timers[2] == 1) { - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; this->csState2 = this->subCamId; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->work[TW_PLLR_IDX] = 0; this->targetPos = sTwinrovaPillarPos[0]; - BossTw_TwinrovaSetupFly(this, globalCtx); + BossTw_TwinrovaSetupFly(this, play); } break; } } -void BossTw_SetupDeathCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupDeathCS(BossTw* this, PlayState* play) { this->actionFunc = BossTw_DeathCS; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_0004A4, -3.0f); this->unk_5F8 = 0; this->work[CS_TIMER_2] = Rand_ZeroFloat(20.0f); } -void BossTw_DeathCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_DeathCS(BossTw* this, PlayState* play) { if (this->timers[0] == 0) { SkelAnime_Update(&this->skelAnime); } @@ -1757,7 +1754,7 @@ void BossTw_DeathCS(BossTw* this, GlobalContext* globalCtx) { } } -void BossTw_SetupCSWait(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SetupCSWait(BossTw* this, PlayState* play) { this->actionFunc = BossTw_CSWait; this->visible = false; this->actor.world.pos.y = -2000.0f; @@ -1767,22 +1764,22 @@ void BossTw_SetupCSWait(BossTw* this, GlobalContext* globalCtx) { /** * Do nothing while waiting for the inital cutscene to start */ -void BossTw_CSWait(BossTw* this, GlobalContext* globalCtx) { +void BossTw_CSWait(BossTw* this, PlayState* play) { } -void BossTw_TwinrovaSetupIntroCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupIntroCS(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaIntroCS; this->visible = false; this->actor.world.pos.y = -2000.0f; this->actor.flags &= ~ACTOR_FLAG_0; } -void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play) { u8 updateCam = false; s16 i; Vec3f sp90; Vec3f sp84; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->csSfxTimer > 220 && this->csSfxTimer < 630) { func_80078884(NA_SE_EN_TWINROBA_UNARI - SFX_FLAG); @@ -1803,11 +1800,11 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { if (SQ(player->actor.world.pos.x) + SQ(player->actor.world.pos.z) < SQ(150.0f)) { player->actor.world.pos.x = player->actor.world.pos.z = .0f; this->csState2 = 1; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 0x39); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 0x39); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->subCamEye.x = 0.0f; this->subCamEye.y = 350; this->subCamEye.z = 200; @@ -1840,14 +1837,14 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { updateCam = true; if (this->work[CS_TIMER_1] == 30) { - Message_StartTextbox(globalCtx, 0x6048, NULL); + Message_StartTextbox(play, 0x6048, NULL); } Math_ApproachF(&this->subCamUpdateRate, 0.01f, 1.0f, 0.0001f); if (this->work[CS_TIMER_1] > 100) { - globalCtx->envCtx.lightSetting = 0; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.03f); + play->envCtx.lightSetting = 0; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.03f); } if (this->work[CS_TIMER_1] == 180) { @@ -1918,7 +1915,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamUpdateRate, 1.0f, 1.0f, 0.02f); if (this->work[CS_TIMER_1] == 30) { - Message_StartTextbox(globalCtx, 0x6049, NULL); + Message_StartTextbox(play, 0x6049, NULL); } if (this->work[CS_TIMER_1] > 80) { @@ -1957,11 +1954,11 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { if (this->work[CS_TIMER_1] >= 30) { if (this->work[CS_TIMER_1] < 45) { - globalCtx->envCtx.prevLightSetting = 0; - globalCtx->envCtx.lightSetting = 2; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.prevLightSetting = 0; + play->envCtx.lightSetting = 2; + play->envCtx.lightBlend = 1.0f; } else { - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.1f); + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.1f); } if (this->work[CS_TIMER_1] == 30) { @@ -1975,12 +1972,11 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { velocity.x = Rand_CenteredFloat(20.0f); velocity.y = Rand_CenteredFloat(20.0f); velocity.z = Rand_CenteredFloat(20.0f); - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &sZeroVector, Rand_ZeroFloat(10.0f) + 25.0f, - 1); + BossTw_AddFlameEffect(play, &pos, &velocity, &sZeroVector, Rand_ZeroFloat(10.0f) + 25.0f, 1); } Audio_PlayActorSound2(&sKoumePtr->actor, NA_SE_EN_TWINROBA_TRANSFORM); - globalCtx->envCtx.lightBlend = 0; + play->envCtx.lightBlend = 0; } if (this->work[CS_TIMER_1] >= 35) { @@ -2082,7 +2078,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamUpdateRate, 1.0f, 1.0f, 0.02f); if (this->work[CS_TIMER_1] == 30) { - Message_StartTextbox(globalCtx, 0x604A, NULL); + Message_StartTextbox(play, 0x604A, NULL); } if (this->work[CS_TIMER_1] > 80) { @@ -2121,10 +2117,10 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { if (this->work[CS_TIMER_1] >= 30) { if (this->work[CS_TIMER_1] < 45) { - globalCtx->envCtx.lightSetting = 3; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightSetting = 3; + play->envCtx.lightBlend = 1.0f; } else { - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.1f); + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.1f); } if (this->work[CS_TIMER_1] == 30) { @@ -2137,12 +2133,11 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { velocity.x = Rand_CenteredFloat(20.0f); velocity.y = Rand_CenteredFloat(20.0f); velocity.z = Rand_CenteredFloat(20.0f); - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &sZeroVector, Rand_ZeroFloat(10.f) + 25.0f, - 0); + BossTw_AddFlameEffect(play, &pos, &velocity, &sZeroVector, Rand_ZeroFloat(10.f) + 25.0f, 0); } Audio_PlayActorSound2(&sKotakePtr->actor, NA_SE_EN_TWINROBA_TRANSFORM); - globalCtx->envCtx.lightBlend = 0.0f; + play->envCtx.lightBlend = 0.0f; } if (this->work[CS_TIMER_1] >= 35) { @@ -2212,8 +2207,8 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { case 20: if (this->work[CS_TIMER_1] > 20 && this->work[CS_TIMER_1] < 120) { - globalCtx->envCtx.lightSetting = 1; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.015f); + play->envCtx.lightSetting = 1; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.015f); } if (this->work[CS_TIMER_1] == 90) { @@ -2222,11 +2217,11 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { if (this->work[CS_TIMER_1] == 120) { sEnvType = 0; - globalCtx->envCtx.prevLightSetting = 1; - globalCtx->envCtx.lightSetting = 1; - globalCtx->envCtx.lightBlend = 0.0f; - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, - SEGMENTED_TO_VIRTUAL(object_tw_Blob_02E170), 0xA0, 0xB4, 0x80, 0x28); + play->envCtx.prevLightSetting = 1; + play->envCtx.lightSetting = 1; + play->envCtx.lightBlend = 0.0f; + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(object_tw_Blob_02E170), + 0xA0, 0xB4, 0x80, 0x28); SET_EVENTCHKINF(EVENTCHKINF_75); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } @@ -2280,17 +2275,17 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { } if (this->work[CS_TIMER_1] == 260) { - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; this->csState2 = this->subCamId; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); - BossTw_SetupWait(this, globalCtx); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); + BossTw_SetupWait(this, play); } break; } @@ -2311,11 +2306,11 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { this->subCamAtVel.z * this->subCamUpdateRate); } - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } -void BossTw_DeathBall(BossTw* this, GlobalContext* globalCtx) { +void BossTw_DeathBall(BossTw* this, PlayState* play) { f32 xDiff; f32 yDiff; f32 zDiff; @@ -2378,7 +2373,7 @@ void BossTw_DeathBall(BossTw* this, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); } -void BossTw_TwinrovaSetupDeathCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupDeathCS(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaDeathCS; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_024374, -3.0f); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -2386,13 +2381,13 @@ void BossTw_TwinrovaSetupDeathCS(BossTw* this, GlobalContext* globalCtx) { this->csState2 = this->csState1 = 0; this->work[CS_TIMER_1] = this->work[CS_TIMER_2] = 0; this->work[INVINC_TIMER] = 10000; - BossTw_SetupDeathCS(sKoumePtr, globalCtx); - BossTw_SetupDeathCS(sKotakePtr, globalCtx); + BossTw_SetupDeathCS(sKoumePtr, play); + BossTw_SetupDeathCS(sKotakePtr, play); sKotakePtr->timers[0] = 8; this->workf[UNK_F19] = 1.0f; } -void BossTw_DeathCSMsgSfx(BossTw* this, GlobalContext* globalCtx) { +void BossTw_DeathCSMsgSfx(BossTw* this, PlayState* play) { s32 pad; s32 pad2; s32 pad3; @@ -2540,7 +2535,7 @@ void BossTw_DeathCSMsgSfx(BossTw* this, GlobalContext* globalCtx) { } if (msgId2 != 0) { - Message_StartTextbox(globalCtx, msgId2, NULL); + Message_StartTextbox(play, msgId2, NULL); if (sp35) { D_8094C876 = 10; @@ -2550,7 +2545,7 @@ void BossTw_DeathCSMsgSfx(BossTw* this, GlobalContext* globalCtx) { } if (msgId1 != 0) { - Message_StartTextbox(globalCtx, msgId1, NULL); + Message_StartTextbox(play, msgId1, NULL); } switch (kotakeAnim) { @@ -2614,11 +2609,11 @@ void BossTw_DeathCSMsgSfx(BossTw* this, GlobalContext* globalCtx) { } } -void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaDeathCS(BossTw* this, PlayState* play) { s16 i; Vec3f spD0; - Player* player = GET_PLAYER(globalCtx); - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Player* player = GET_PLAYER(play); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); SkelAnime_Update(&this->skelAnime); this->work[UNK_S8] += 20; @@ -2642,13 +2637,13 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { if (this->work[CS_TIMER_1] >= 55) { if (this->work[CS_TIMER_1] == 55) { - globalCtx->envCtx.lightBlend = 0; + play->envCtx.lightBlend = 0; } sEnvType = -1; - globalCtx->envCtx.prevLightSetting = 5; - globalCtx->envCtx.lightSetting = 0; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.015f); + play->envCtx.prevLightSetting = 5; + play->envCtx.lightSetting = 0; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.015f); Math_ApproachF(&this->actor.scale.x, 0.00024999998f, 0.1f, 0.00005f); this->actor.shape.rot.y += (s16)this->actor.speedXZ; this->workf[UNK_F13] += this->actor.speedXZ; @@ -2670,18 +2665,16 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { spBC.x += spB0.x; spBC.y += spB0.y; spBC.z += spB0.z; - BossTw_AddFlameEffect(globalCtx, &spBC, &spB0, &spA4, Rand_ZeroFloat(2.0f) + 5, + BossTw_AddFlameEffect(play, &spBC, &spB0, &spA4, Rand_ZeroFloat(2.0f) + 5, Rand_ZeroFloat(1.99f)); } this->csState1 = 1; this->visible = false; this->actor.scale.x = 0.0f; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, - 0, TW_DEATHBALL_KOUME); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, - 0, TW_DEATHBALL_KOTAKE); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, TW_DEATHBALL_KOUME); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, TW_DEATHBALL_KOTAKE); this->actor.flags &= ~ACTOR_FLAG_0; } } @@ -2694,11 +2687,11 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { switch (this->csState2) { case 0: this->csState2 = 1; - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->subCamEye = mainCam->eye; this->subCamAt = mainCam->at; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); @@ -2734,7 +2727,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { sKoumePtr->actor.world.pos.z = sKotakePtr->actor.world.pos.z; sKoumePtr->work[YAW_TGT] = sKotakePtr->work[YAW_TGT] = sKoumePtr->actor.shape.rot.x = sKotakePtr->actor.shape.rot.x = sKoumePtr->actor.shape.rot.y = sKotakePtr->actor.shape.rot.y = 0; - func_8002DF54(globalCtx, &sKoumePtr->actor, 1); + func_8002DF54(play, &sKoumePtr->actor, 1); sKoumePtr->actor.flags |= ACTOR_FLAG_0; } break; @@ -2753,7 +2746,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { pos.x += velocity.x * 2.0f; pos.y += velocity.y * 2.0f; pos.z += velocity.z * 2.0f; - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &accel, Rand_ZeroFloat(2.0f) + 5, 1); + BossTw_AddFlameEffect(play, &pos, &velocity, &accel, Rand_ZeroFloat(2.0f) + 5, 1); // fake code needed to match, tricks the compiler into allocating more stack if (1) {} @@ -2768,7 +2761,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { pos.x += velocity.x * 2.0f; pos.y += velocity.y * 2.0f; pos.z += velocity.z * 2.0f; - BossTw_AddFlameEffect(globalCtx, &pos, &velocity, &accel, Rand_ZeroFloat(2.0f) + 5, 0); + BossTw_AddFlameEffect(play, &pos, &velocity, &accel, Rand_ZeroFloat(2.0f) + 5, 0); } Actor_SetScale(&sKoumePtr->actor, 0.0f); @@ -2783,15 +2776,15 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { } break; case 3: - BossTw_DeathCSMsgSfx(this, globalCtx); + BossTw_DeathCSMsgSfx(this, play); if (this->work[CS_TIMER_2] < 150) { - globalCtx->envCtx.prevLightSetting = 1; - globalCtx->envCtx.lightSetting = 0; - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.1f); + play->envCtx.prevLightSetting = 1; + play->envCtx.lightSetting = 0; + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.1f); } else { - globalCtx->envCtx.prevLightSetting = 1; - globalCtx->envCtx.lightSetting = 6; - Math_ApproachF(&globalCtx->envCtx.lightBlend, (Math_SinS(this->work[CS_TIMER_2] * 4096) / 4.0f) + 0.75f, + play->envCtx.prevLightSetting = 1; + play->envCtx.lightSetting = 6; + Math_ApproachF(&play->envCtx.lightBlend, (Math_SinS(this->work[CS_TIMER_2] * 4096) / 4.0f) + 0.75f, 1.0f, 0.1f); } @@ -2815,24 +2808,24 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { Actor_SetScale(&sKoumePtr->actor, sKoumePtr->actor.scale.x); Actor_SetScale(&sKotakePtr->actor, sKoumePtr->actor.scale.x); if (this->work[CS_TIMER_2] >= 1020) { - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->csState2 = 4; this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 600.0f, 230.0f, - 0.0f, 0, 0, 0, WARP_DUNGEON_ADULT); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, -600.0f, 230.f, 0.0f, 0, 0, 0, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 600.0f, 230.0f, 0.0f, 0, 0, 0, + WARP_DUNGEON_ADULT); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, -600.0f, 230.f, 0.0f, 0, 0, 0, 0); this->actor.world.pos.y = -2000.0f; this->workf[UNK_F18] = 0.0f; sKoumePtr->visible = sKotakePtr->visible = false; if (&this->subCamEye) {} // fixes regalloc, may be fake - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); } break; case 4: @@ -2842,7 +2835,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { if (this->subCamId != SUB_CAM_ID_DONE) { if (1) {} - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } @@ -2854,17 +2847,17 @@ static s16 D_8094A90C[] = { 0, 1, 2, 2, 2, 2, 2, 2, 1, }; -void BossTw_Update(Actor* thisx, GlobalContext* globalCtx) { +void BossTw_Update(Actor* thisx, PlayState* play) { BossTw* this = (BossTw*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 i; s32 pad; this->collider.base.colType = COLTYPE_HIT3; - Math_ApproachF(&this->fogR, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->fogG, globalCtx->lightCtx.fogColor[1], 1.0f, 10.0f); - Math_ApproachF(&this->fogB, globalCtx->lightCtx.fogColor[2], 1.0f, 10.0f); - Math_ApproachF(&this->fogNear, globalCtx->lightCtx.fogNear, 1.0f, 10.0f); + Math_ApproachF(&this->fogR, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->fogG, play->lightCtx.fogColor[1], 1.0f, 10.0f); + Math_ApproachF(&this->fogB, play->lightCtx.fogColor[2], 1.0f, 10.0f); + Math_ApproachF(&this->fogNear, play->lightCtx.fogNear, 1.0f, 10.0f); Math_ApproachF(&this->fogFar, 1000.0f, 1.0f, 10.0f); this->work[CS_TIMER_1]++; this->work[CS_TIMER_2]++; @@ -2897,11 +2890,11 @@ void BossTw_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc == BossTw_TurnToPlayer) { if ((s16)(player->actor.shape.rot.y - this->actor.yawTowardsPlayer + 0x8000) < 0x1000 && (s16)(player->actor.shape.rot.y - this->actor.yawTowardsPlayer + 0x8000) > -0x1000 && player->unk_A73) { - BossTw_SetupSpin(this, globalCtx); + BossTw_SetupSpin(this, play); } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != BossTw_Wait) { this->collider.dim.radius = 45; @@ -2919,8 +2912,8 @@ void BossTw_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actor.params == 0) { @@ -2958,7 +2951,7 @@ void BossTw_Update(Actor* thisx, GlobalContext* globalCtx) { accel.y = 0.4f; accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, this->actor.params, 37); } } @@ -2971,27 +2964,27 @@ void BossTw_Update(Actor* thisx, GlobalContext* globalCtx) { accel.y = 0.4f; accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, - this->actor.params, 37); + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, this->actor.params, + 37); } } } } -void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { +void BossTw_TwinrovaUpdate(Actor* thisx, PlayState* play2) { s16 i; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; BossTw* this = (BossTw*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->actor.flags &= ~ACTOR_FLAG_10; this->unk_5F8 = 0; this->collider.base.colType = COLTYPE_HIT3; - Math_ApproachF(&this->fogR, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->fogG, globalCtx->lightCtx.fogColor[1], 1.0f, 10.0f); - Math_ApproachF(&this->fogB, globalCtx->lightCtx.fogColor[2], 1.0f, 10.0f); - Math_ApproachF(&this->fogNear, globalCtx->lightCtx.fogNear, 1.0f, 10.0f); + Math_ApproachF(&this->fogR, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->fogG, play->lightCtx.fogColor[1], 1.0f, 10.0f); + Math_ApproachF(&this->fogB, play->lightCtx.fogColor[2], 1.0f, 10.0f); + Math_ApproachF(&this->fogNear, play->lightCtx.fogNear, 1.0f, 10.0f); Math_ApproachF(&this->fogFar, 1000.0f, 1.0f, 10.0f); this->work[CS_TIMER_1]++; @@ -3011,13 +3004,13 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { this->work[FOG_TIMER]--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != BossTw_TwinrovaShootBlast && this->actionFunc != BossTw_TwinrovaChargeBlast && this->visible && this->unk_5F8 == 0 && (s16)(player->actor.shape.rot.y - this->actor.yawTowardsPlayer + 0x8000) < 0x1000 && (s16)(player->actor.shape.rot.y - this->actor.yawTowardsPlayer + 0x8000) > -0x1000 && player->unk_A73 != 0) { - BossTw_TwinrovaSetupSpin(this, globalCtx); + BossTw_TwinrovaSetupSpin(this, play); } this->eyeTexIdx = D_8094A900[this->work[BLINK_IDX]]; @@ -3072,7 +3065,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { pos.z += Rand_CenteredFloat(30.0f); accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 7, 0, 75); + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 7, 0, 75); } for (i = 0; i < 2; i++) { @@ -3082,7 +3075,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { pos.z += Rand_CenteredFloat(30.0f); accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 7, 1, 75); + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 7, 1, 75); } } @@ -3101,7 +3094,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { if (this->twinrovaStun != 0) { this->twinrovaStun = 0; this->work[FOG_TIMER] = 10; - BossTw_TwinrovaDamage(this, globalCtx, 0); + BossTw_TwinrovaDamage(this, play, 0); Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_YOUNG_DAMAGE); } else if (this->collider.base.acFlags & AC_HIT) { ColliderInfo* info = this->collider.info.acHitInfo; @@ -3129,52 +3122,52 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { damage = 0; } - BossTw_TwinrovaDamage(this, globalCtx, damage); + BossTw_TwinrovaDamage(this, play, damage); } } } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); osSyncPrintf("OooooooooooooooooooooooooooooooooCC\n"); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - globalCtx->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; + play->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; switch (sEnvType) { case 0: - Math_ApproachZeroF(&globalCtx->envCtx.lightBlend, 1.0f, 0.02f); + Math_ApproachZeroF(&play->envCtx.lightBlend, 1.0f, 0.02f); break; case 1: - globalCtx->envCtx.lightSetting = 3; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 0.5f, 1.0f, 0.05f); + play->envCtx.lightSetting = 3; + Math_ApproachF(&play->envCtx.lightBlend, 0.5f, 1.0f, 0.05f); break; case 2: - globalCtx->envCtx.lightSetting = 2; - Math_ApproachF(&globalCtx->envCtx.lightBlend, (Math_SinS(this->work[CS_TIMER_1] * 0x3000) * 0.03f) + 0.5f, - 1.0f, 0.05f); + play->envCtx.lightSetting = 2; + Math_ApproachF(&play->envCtx.lightBlend, (Math_SinS(this->work[CS_TIMER_1] * 0x3000) * 0.03f) + 0.5f, 1.0f, + 0.05f); break; case 3: - globalCtx->envCtx.lightSetting = 3; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.1f); + play->envCtx.lightSetting = 3; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.1f); break; case 4: - globalCtx->envCtx.lightSetting = 2; - Math_ApproachF(&globalCtx->envCtx.lightBlend, (Math_SinS(this->work[CS_TIMER_1] * 0x3E00) * 0.05f) + 0.95f, - 1.0f, 0.1f); + play->envCtx.lightSetting = 2; + Math_ApproachF(&play->envCtx.lightBlend, (Math_SinS(this->work[CS_TIMER_1] * 0x3E00) * 0.05f) + 0.95f, 1.0f, + 0.1f); break; case 5: - globalCtx->envCtx.lightSetting = 0; - Math_ApproachF(&globalCtx->envCtx.lightBlend, 1.0f, 1.0f, 0.05f); + play->envCtx.lightSetting = 0; + Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.05f); break; case -1: break; } - BossTw_UpdateEffects(globalCtx); + BossTw_UpdateEffects(play); if (sFreezeState == 1) { sFreezeState = 2; - BossTw_AddPlayerFreezeEffect(globalCtx, NULL); + BossTw_AddPlayerFreezeEffect(play, NULL); func_80078914(&player->actor.projectedPos, NA_SE_VO_LI_FREEZE); func_80078914(&player->actor.projectedPos, NA_SE_PL_FREEZE); @@ -3188,7 +3181,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 BossTw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 BossTw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossTw* this = (BossTw*)thisx; if (limbIndex == 21) { @@ -3216,7 +3209,7 @@ s32 BossTw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void BossTw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossTw_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_8094A944 = { 0.0f, 0.0f, 0.0f }; static Vec3f D_8094A950 = { 0.0f, 2000.0f, -2000.0f }; static Vec3f D_8094A95C[] = { @@ -3225,7 +3218,7 @@ void BossTw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V }; BossTw* this = (BossTw*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6168); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6168); switch (limbIndex) { case 21: @@ -3233,7 +3226,7 @@ void BossTw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V Matrix_MultVec3f(&D_8094A950, &this->crownPos); if (this->unk_5F8 != 0) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6190), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6190), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); if (this->actor.params == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_013AE8)); @@ -3250,7 +3243,7 @@ void BossTw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V Matrix_MultVec3f(&D_8094A95C[4], &this->scepterFlamePos[4]); if (this->scepterAlpha > 0.0f) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6221), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6221), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); if (this->actor.params == 0) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 225, 255, (s16)this->scepterAlpha); @@ -3267,19 +3260,19 @@ void BossTw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V break; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6236); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6236); } -void func_80941BC0(BossTw* this, GlobalContext* globalCtx) { +void func_80941BC0(BossTw* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6341); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6341); Matrix_Push(); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(this->groundBlastPos2.x, this->groundBlastPos2.y, this->groundBlastPos2.z, MTXMODE_NEW); Matrix_Scale(this->workf[UNK_F12], this->workf[UNK_F12], this->workf[UNK_F12], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6358), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6358), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)this->workf[UNK_F11]); gDPSetEnvColor(POLY_XLU_DISP++, 0, 40, 30, 80); @@ -3287,18 +3280,18 @@ void func_80941BC0(BossTw* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 215, 215, 215, (s16)this->workf[UNK_F11] * this->workf[UNK_F14]); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, (u32)this->workf[UNK_F16] & 0x3F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, (u32)this->workf[UNK_F16] & 0x3F, (this->work[CS_TIMER_2] * 4) & 0x3F, 0x10, 0x10)); Matrix_Push(); Matrix_RotateY(this->workf[UNK_F15], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6423), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6423), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01C1C0)); Matrix_Pop(); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6427), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6427), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPSegment(POLY_XLU_DISP++, 0xD, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->work[CS_TIMER_2] & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->work[CS_TIMER_2] & 0x7F, (this->work[CS_TIMER_2] * 8) & 0xFF, 0x20, 0x40, 1, (-this->work[CS_TIMER_2] * 2) & 0x3F, 0, 0x10, 0x10)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (s16)this->workf[UNK_F9]); @@ -3311,34 +3304,34 @@ void func_80941BC0(BossTw* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A790)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6461); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6461); } -void func_80942180(BossTw* this, GlobalContext* globalCtx) { +void func_80942180(BossTw* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6468); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6468); Matrix_Push(); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(this->groundBlastPos2.x, this->groundBlastPos2.y, this->groundBlastPos2.z, MTXMODE_NEW); Matrix_Scale(this->workf[KM_GD_CRTR_SCL], this->workf[KM_GD_CRTR_SCL], this->workf[KM_GD_CRTR_SCL], MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (-this->work[CS_TIMER_1]) & 0x7F, 0, 0x20, 0x20, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (-this->work[CS_TIMER_1]) & 0x7F, 0, 0x20, 0x20, 1, (this->work[CS_TIMER_1] * 2) & 0x7F, 0, 0x20, 0x20)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6497), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6497), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 40, 00, (s16)this->workf[KM_GRND_CRTR_A]); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 255, 245, 255, 128); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_019D40)); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6514), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6514), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->work[CS_TIMER_1] & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->work[CS_TIMER_1] & 0x7F, (-this->work[CS_TIMER_1] * 6) & 0xFF, 0x20, 0x40, 1, (this->work[CS_TIMER_1] * 2) & 0x7F, (-this->work[CS_TIMER_1] * 6) & 0xFF, 0x20, 0x40)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 80, 0, 0, (s16)this->workf[KM_GD_SMOKE_A]); @@ -3347,36 +3340,36 @@ void func_80942180(BossTw* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_018FC0)); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (-this->work[CS_TIMER_1] * 3) & 0x7F, 0, 0x20, 0x20, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (-this->work[CS_TIMER_1] * 3) & 0x7F, 0, 0x20, 0x20, 1, 0, (-this->work[CS_TIMER_1] * 10) & 0xFF, 0x20, 0x40)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 50, 0, (s16)(this->workf[KM_GD_FLM_A] * 0.7f)); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 200, 235, 240, 128); Matrix_Scale(this->workf[KM_GD_FLM_SCL], this->workf[KM_GD_FLM_SCL], this->workf[KM_GD_FLM_SCL], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6575), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6575), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_019938)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6579); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6579); } -void func_809426F0(BossTw* this, GlobalContext* globalCtx) { +void func_809426F0(BossTw* this, PlayState* play) { s32 pad; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6587); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6587); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (u8)(-this->work[CS_TIMER_2] * 15), 0x20, 0x40, 1, 0, 0, - 0x40, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (u8)(-this->work[CS_TIMER_2] * 15), 0x20, 0x40, 1, 0, 0, 0x40, + 0x40)); Matrix_Push(); Matrix_Translate(0.0f, 0.0f, 5000.0f, MTXMODE_APPLY); Matrix_Scale(this->spawnPortalScale / 2000.0f, this->spawnPortalScale / 2000.0f, this->spawnPortalScale / 2000.0f, MTXMODE_APPLY); Matrix_RotateZ(this->portalRotation, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6614), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6614), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); if (this->actor.params == 0) { @@ -3403,29 +3396,29 @@ void func_809426F0(BossTw* this, GlobalContext* globalCtx) { Matrix_RotateZ(((i * M_PI) * 2.0f * 0.125f) + this->flameRotation, MTXMODE_APPLY); Matrix_Translate(0.0f, this->spawnPortalScale * 1.5f, 0.0f, MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, ((this->work[CS_TIMER_2] * 3) + (i * 10)) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, ((this->work[CS_TIMER_2] * 3) + (i * 10)) & 0x7F, (u8)((-this->work[CS_TIMER_2] * 15) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Scale(0.4f, 0.4f, 0.4f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6751), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6751), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6756); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6756); } -void func_80942C70(Actor* thisx, GlobalContext* globalCtx) { +void func_80942C70(Actor* thisx, PlayState* play) { BossTw* this = (BossTw*)thisx; s16 alpha; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6765); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6765); if (this->beamDist != 0.0f) { Matrix_Push(); gSPSegment(POLY_XLU_DISP++, 0xC, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (u8)(this->work[CS_TIMER_1] * -0xF), 0x20, 0x40)); + Gfx_TexScroll(play->state.gfxCtx, 0, (u8)(this->work[CS_TIMER_1] * -0xF), 0x20, 0x40)); alpha = this->beamScale * 100.0f * 255.0f; if (this->actor.params == 1) { @@ -3441,7 +3434,7 @@ void func_80942C70(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX(this->beamPitch, MTXMODE_APPLY); Matrix_RotateZ(this->beamRoll, MTXMODE_APPLY); Matrix_Scale(this->beamScale, this->beamScale, (this->beamDist * 0.01f * 98.0f) / 20000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6846), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6846), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01DDF0)); @@ -3453,7 +3446,7 @@ void func_80942C70(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZ(this->beamRoll, MTXMODE_APPLY); Matrix_Scale(this->beamScale, this->beamScale, (this->beamReflectionDist * 0.01f * 100.0f) / 20000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6870), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6870), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01DDF0)); } @@ -3461,32 +3454,32 @@ void func_80942C70(Actor* thisx, GlobalContext* globalCtx) { Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6878); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6878); } -void func_80943028(Actor* thisx, GlobalContext* globalCtx) { +void func_80943028(Actor* thisx, PlayState* play) { BossTw* this = (BossTw*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6885); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6885); Matrix_Push(); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + 57.0f, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->workf[UNK_F17], this->workf[UNK_F17], this->workf[UNK_F17], MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6908), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6908), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01F608)); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 200); Matrix_Translate(this->actor.world.pos.x, 240.0f, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale((this->actor.scale.x * 4000.0f) / 100.0f, 1.0f, (this->actor.scale.x * 4000.0f) / 100.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6926), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6926), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gCircleShadowDL)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6933); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6933); } static void* sEyeTextures[] = { @@ -3495,37 +3488,37 @@ static void* sEyeTextures[] = { object_tw_Tex_00B638, }; -void BossTw_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void BossTw_Draw(Actor* thisx, PlayState* play2) { static Vec3f D_8094A9A4 = { 0.0f, 200.0f, 2000.0f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; BossTw* this = (BossTw*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6947); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6947); if (this->visible) { gSPSegment(POLY_OPA_DISP++, 10, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIdx])); gSPSegment(POLY_XLU_DISP++, 10, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIdx])); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->workf[OUTR_CRWN_TX_X1] & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->workf[OUTR_CRWN_TX_X1] & 0x7F, (s16)this->workf[OUTR_CRWN_TX_Y1] & 0x7F, 0x20, 0x20, 1, (s16)this->workf[OUTR_CRWN_TX_X2] & 0x7F, (s16)this->workf[OUTR_CRWN_TX_Y2] & 0xFF, 0x20, 0x40)); if (this->actor.params == TW_KOTAKE) { gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TexScroll(globalCtx->state.gfxCtx, (s16)this->workf[INNR_CRWN_TX_X1] & 0x7F, + Gfx_TexScroll(play->state.gfxCtx, (s16)this->workf[INNR_CRWN_TX_X1] & 0x7F, (s16)this->workf[INNR_CRWN_TX_Y1] & 0xFF, 0x20, 0x40)); } else { gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->workf[INNR_CRWN_TX_X1] & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->workf[INNR_CRWN_TX_X1] & 0x7F, (s16)this->workf[INNR_CRWN_TX_Y1] & 0x7F, 0x20, 0x20, 1, (s16)this->workf[INNR_CRWN_TX_X2] & 0x7F, (s16)this->workf[INNR_CRWN_TX_Y2] & 0xFF, 0x20, 0x40)); } - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->work[FOG_TIMER] & 2) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 50, 0, 0, 900, 1099); @@ -3535,10 +3528,10 @@ void BossTw_Draw(Actor* thisx, GlobalContext* globalCtx2) { } Matrix_Push(); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, BossTw_OverrideLimbDraw, BossTw_PostLimbDraw, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + BossTw_OverrideLimbDraw, BossTw_PostLimbDraw, this); Matrix_Pop(); - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); } if (this->actor.params == TW_KOTAKE) { @@ -3557,23 +3550,23 @@ void BossTw_Draw(Actor* thisx, GlobalContext* globalCtx2) { } } - func_80941BC0(this, globalCtx); + func_80941BC0(this, play); } } else { - func_80942180(this, globalCtx); + func_80942180(this, play); } if (this->visible) { if (this->actionFunc == BossTw_DeathCS) { - func_80943028(&this->actor, globalCtx); + func_80943028(&this->actor, play); } else { - func_809426F0(this, globalCtx); + func_809426F0(this, play); Matrix_MultVec3f(&D_8094A9A4, &this->beamOrigin); - func_80942C70(&this->actor, globalCtx); + func_80942C70(&this->actor, play); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7123); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7123); } void* D_8094A9B0[] = { @@ -3582,16 +3575,15 @@ void* D_8094A9B0[] = { object_tw_Tex_02A470, }; -s32 BossTw_TwinrovaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossTw_TwinrovaOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossTw* this = (BossTw*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7139); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7139); switch (limbIndex) { case 21: gSPSegment(POLY_OPA_DISP++, 0xC, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (s16)(f32)this->work[CS_TIMER_1], 8, 8)); + Gfx_TexScroll(play->state.gfxCtx, 0, (s16)(f32)this->work[CS_TIMER_1], 8, 8)); gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_8094A9B0[this->eyeTexIdx])); gSPSegment(POLY_OPA_DISP++, 9, SEGMENTED_TO_VIRTUAL(D_8094A9B0[this->leftEyeTexIdx])); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, this->work[UNK_S8]); @@ -3600,28 +3592,27 @@ s32 BossTw_TwinrovaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx case 41: *dList = NULL; gSPSegment(POLY_XLU_DISP++, 0xA, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, - -this->work[CS_TIMER_1] * 0xF, 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, -this->work[CS_TIMER_1] * 0xF, + 0x20, 0x40)); break; case 18: case 42: *dList = NULL; gSPSegment(POLY_XLU_DISP++, 0xB, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, - -this->work[CS_TIMER_1] * 0xA, 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, -this->work[CS_TIMER_1] * 0xA, + 0x20, 0x40)); break; case 16: case 32: *dList = NULL; gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, this->work[CS_TIMER_1], + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, this->work[CS_TIMER_1], -this->work[CS_TIMER_1] * 7, 0x20, 0x40)); break; case 15: case 31: *dList = NULL; - gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, this->work[CS_TIMER_1], 0x20, 0x40)); + gSPSegment(POLY_XLU_DISP++, 9, Gfx_TexScroll(play->state.gfxCtx, 0, this->work[CS_TIMER_1], 0x20, 0x40)); break; case 19: if (this->unk_5F8 != 0) { @@ -3640,12 +3631,12 @@ s32 BossTw_TwinrovaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx *dList = NULL; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7251); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7251); return false; } -void BossTw_TwinrovaPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossTw_TwinrovaPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_8094A9BC = { 0.0f, 0.0f, 0.0f }; static Vec3f D_8094A9C8 = { 0.0f, 2000.0f, -2000.0f }; static Vec3f D_8094A9D4 = { 13000.0f, 0.0f, 0.0f }; @@ -3653,7 +3644,7 @@ void BossTw_TwinrovaPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** BossTw* this = (BossTw*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7262); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7262); switch (limbIndex) { case 34: @@ -3676,23 +3667,23 @@ void BossTw_TwinrovaPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** case 42: Matrix_Push(); Matrix_Scale(this->workf[UNK_F12], this->workf[UNK_F12], this->workf[UNK_F12], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7295), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7295), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); Matrix_Pop(); gSPDisplayList(POLY_XLU_DISP++, *dList); break; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7301); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7301); } -void BossTw_ShieldChargeDraw(BossTw* this, GlobalContext* globalCtx) { +void BossTw_ShieldChargeDraw(BossTw* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_t0; s16 temp_a0; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7311); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7311); Matrix_Push(); @@ -3723,18 +3714,18 @@ void BossTw_ShieldChargeDraw(BossTw* this, GlobalContext* globalCtx) { temp_t0 = 1; } - if (Player_HasMirrorShieldEquipped(globalCtx)) { + if (Player_HasMirrorShieldEquipped(play)) { if (temp_t0 != 0) { Matrix_Mult(&player->shieldMf, MTXMODE_NEW); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7362), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7362), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); temp_a0 = (Math_SinS(this->work[CS_TIMER_1] * 2730 * temp_t0) * D_8094C854 * 0.5f) + (D_8094C854 * 0.5f); if (sShieldFireCharge != 0) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 245, 255, temp_a0); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E0E0)); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (this->work[CS_TIMER_1] * 2) * temp_t0, 0, 0x20, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (this->work[CS_TIMER_1] * 2) * temp_t0, 0, 0x20, 0x20, 1, (-this->work[CS_TIMER_1] * 2) * temp_t0, 0, 0x20, 0x20)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 20, 0, (s16)D_8094C854); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E020)); @@ -3742,8 +3733,8 @@ void BossTw_ShieldChargeDraw(BossTw* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 225, 255, 255, temp_a0); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E3A0)); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (-this->work[CS_TIMER_1] * 5) * temp_t0, - 0x20, 0x40, 1, (this->work[CS_TIMER_1] * 4) * temp_t0, 0, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (-this->work[CS_TIMER_1] * 5) * temp_t0, 0x20, + 0x40, 1, (this->work[CS_TIMER_1] * 4) * temp_t0, 0, 0x20, 0x20)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 175, 205, 195, (s16)D_8094C854); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E2C0)); } @@ -3761,13 +3752,13 @@ void BossTw_ShieldChargeDraw(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&D_8094C858, 0.0f, 1.0f, step); } - if (Player_HasMirrorShieldEquipped(globalCtx) && D_8094C858 > 0.0f) { + if (Player_HasMirrorShieldEquipped(play) && D_8094C858 > 0.0f) { f32 scale = D_8094C872 > 0 ? 1.3f : 1.0f; Matrix_Mult(&player->shieldMf, MTXMODE_NEW); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7486), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7486), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); if (sShieldFireCharge != 0) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 220, 20, (s16)D_8094C858); @@ -3778,87 +3769,87 @@ void BossTw_ShieldChargeDraw(BossTw* this, GlobalContext* globalCtx) { } gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->work[CS_TIMER_1] * D_8094C872, 0x20, 0x40, 1, - 0, this->work[CS_TIMER_1] * D_8094C872, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, this->work[CS_TIMER_1] * D_8094C872, 0x20, 0x40, 1, 0, + this->work[CS_TIMER_1] * D_8094C872, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E9F0)); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7531); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7531); } -void BossTw_SpawnPortalDraw(BossTw* this, GlobalContext* globalCtx) { +void BossTw_SpawnPortalDraw(BossTw* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7546); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7546); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment( POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -this->work[CS_TIMER_1] * 15, 0x20, 0x40, 1, 0, 0, 0x40, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, -this->work[CS_TIMER_1] * 15, 0x20, 0x40, 1, 0, 0, 0x40, 0x40)); Matrix_Push(); Matrix_Translate(0.0f, 232.0f, -600.0f, MTXMODE_NEW); Matrix_Scale(this->spawnPortalScale, this->spawnPortalScale, this->spawnPortalScale, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, (s16)this->spawnPortalAlpha); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7582), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7582), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01EC68)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 135, 175, 165, (s16)this->spawnPortalAlpha); Matrix_Translate(0.0f, 2.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7596), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7596), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01CEE0)); Matrix_Translate(0.0f, 232.0f, 600.0f, MTXMODE_NEW); Matrix_Scale(this->spawnPortalScale, this->spawnPortalScale, this->spawnPortalScale, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, (s16)this->spawnPortalAlpha); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7617), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7617), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01EC68)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, (s16)this->spawnPortalAlpha); Matrix_Translate(0.0f, 2.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7631), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7631), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01DBE8)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7635); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7635); } -void func_80944C50(BossTw* this, GlobalContext* globalCtx) { +void func_80944C50(BossTw* this, PlayState* play) { s32 pad; f32 scale; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7645); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7645); Matrix_Push(); Matrix_Translate(0.0f, 750.0f, 0.0f, MTXMODE_NEW); Matrix_Scale(0.35f, 0.35f, 0.35f, MTXMODE_APPLY); Matrix_Push(); Matrix_Scale(this->workf[UNK_F19], this->workf[UNK_F19], this->workf[UNK_F19], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7671), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7671), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01F390)); Matrix_Pop(); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -sKoumePtr->work[CS_TIMER_1] * 2, 0, 0x20, 0x20, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -sKoumePtr->work[CS_TIMER_1] * 2, 0, 0x20, 0x20, 1, -sKoumePtr->work[CS_TIMER_1] * 2, 0, 0x20, 0x40)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)this->workf[UNK_F18] / 2); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7694), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7694), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01F238)); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -sKoumePtr->work[CS_TIMER_1] * 5, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -sKoumePtr->work[CS_TIMER_1] * 5, -sKoumePtr->work[CS_TIMER_1] * 2, 0x20, 0x40, 1, 0, -sKoumePtr->work[CS_TIMER_1] * 2, 0x10, 0x10)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)(this->workf[UNK_F18] * 0.3f)); @@ -3867,61 +3858,60 @@ void func_80944C50(BossTw* this, GlobalContext* globalCtx) { scale = CLAMP_MAX(scale, 1.0f); Matrix_Scale(scale, 1.0f, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7728), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7728), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01EEB0)); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7732); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7732); } -void BossTw_TwinrovaDraw(Actor* thisx, GlobalContext* globalCtx2) { +void BossTw_TwinrovaDraw(Actor* thisx, PlayState* play2) { static Vec3f D_8094A9EC = { 0.0f, 200.0f, 2000.0f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; BossTw* this = (BossTw*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7748); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7748); if (this->visible) { - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); POLY_OPA_DISP = (this->work[FOG_TIMER] & 2) ? Gfx_SetFog2(POLY_OPA_DISP, 255, 50, 0, 0, 900, 1099) : Gfx_SetFog2(POLY_OPA_DISP, (u32)this->fogR, (u32)this->fogG, (u32)this->fogB, 0, this->fogNear, this->fogFar); Matrix_Push(); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, BossTw_TwinrovaOverrideLimbDraw, BossTw_TwinrovaPostLimbDraw, - thisx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + BossTw_TwinrovaOverrideLimbDraw, BossTw_TwinrovaPostLimbDraw, thisx); Matrix_Pop(); Matrix_MultVec3f(&D_8094A9EC, &this->beamOrigin); - POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP, globalCtx->lightCtx.fogColor[0], globalCtx->lightCtx.fogColor[1], - globalCtx->lightCtx.fogColor[2], 0, globalCtx->lightCtx.fogNear, 1000); + POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP, play->lightCtx.fogColor[0], play->lightCtx.fogColor[1], + play->lightCtx.fogColor[2], 0, play->lightCtx.fogNear, 1000); } - BossTw_DrawEffects(globalCtx); - BossTw_ShieldChargeDraw(this, globalCtx); + BossTw_DrawEffects(play); + BossTw_ShieldChargeDraw(this, play); if (this->spawnPortalAlpha > 0.0f) { - BossTw_SpawnPortalDraw(this, globalCtx); + BossTw_SpawnPortalDraw(this, play); } if (this->workf[UNK_F18] > 0.0f) { - func_80944C50(this, globalCtx); + func_80944C50(this, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 7804); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7804); } -void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { +void BossTw_BlastFire(BossTw* this, PlayState* play) { s16 i; f32 xDiff; f32 yDiff; f32 zDiff; f32 distXZ; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Player* player2 = player; switch (this->actor.params) { @@ -3969,7 +3959,7 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { if (this->timers[0] == 50) { D_8094C86F = 10; D_8094C872 = 7; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; } if (this->timers[0] <= 50) { @@ -3984,8 +3974,8 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { alpha = this->timers[0] * 10; alpha = CLAMP_MAX(alpha, 255); - BossTw_AddShieldBlastEffect(globalCtx, &player2->bodyPartsPos[PLAYER_BODYPART_R_HAND], - &velocity, &sZeroVector, 10.0f, 80.0f, alpha, 1); + BossTw_AddShieldBlastEffect(play, &player2->bodyPartsPos[PLAYER_BODYPART_R_HAND], &velocity, + &sZeroVector, 10.0f, 80.0f, alpha, 1); } if (this->timers[0] == 1) { @@ -4003,7 +3993,7 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { if (this->groundBlastPos.y != 35.0f) { this->groundBlastPos.x = this->actor.world.pos.x; this->groundBlastPos.z = this->actor.world.pos.z; - BossTw_SpawnGroundBlast(this, globalCtx, 1); + BossTw_SpawnGroundBlast(this, play, 1); } else { Vec3f velocity; Vec3f accel; @@ -4015,11 +4005,11 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.0f; accel.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &this->actor.world.pos, &velocity, &accel, + BossTw_AddFlameEffect(play, &this->actor.world.pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, this->blastType); } - globalCtx->envCtx.lightBlend = 0.5f; + play->envCtx.lightBlend = 0.5f; } this->csState1 = 2; @@ -4037,8 +4027,7 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { accel.y = 0.4f; accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, 1, - 75); + BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, 1, 75); } } break; @@ -4106,13 +4095,13 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { } } -void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { +void BossTw_BlastIce(BossTw* this, PlayState* play) { s16 i; f32 xDiff; f32 yDiff; f32 zDiff; f32 xzDist; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Player* player2 = player; switch (this->actor.params) { @@ -4159,7 +4148,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { if (this->timers[0] == 50) { D_8094C86F = 10; D_8094C872 = 7; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; } if (this->timers[0] <= 50) { @@ -4174,8 +4163,8 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { alpha = this->timers[0] * 10; alpha = CLAMP_MAX(alpha, 255); - BossTw_AddShieldBlastEffect(globalCtx, &player2->bodyPartsPos[PLAYER_BODYPART_R_HAND], - &velocity, &sZeroVector, 10.0f, 80.0f, alpha, 0); + BossTw_AddShieldBlastEffect(play, &player2->bodyPartsPos[PLAYER_BODYPART_R_HAND], &velocity, + &sZeroVector, 10.0f, 80.0f, alpha, 0); } if (this->timers[0] == 1) { @@ -4193,7 +4182,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { if (this->groundBlastPos.y != 35.0f) { this->groundBlastPos.x = this->actor.world.pos.x; this->groundBlastPos.z = this->actor.world.pos.z; - BossTw_SpawnGroundBlast(this, globalCtx, 0); + BossTw_SpawnGroundBlast(this, play, 0); } else { for (i = 0; i < 50; i++) { Vec3f velocity; @@ -4205,11 +4194,11 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.0f; accel.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &this->actor.world.pos, &velocity, &accel, + BossTw_AddFlameEffect(play, &this->actor.world.pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 25.0f, this->blastType); } - globalCtx->envCtx.lightBlend = 0.5f; + play->envCtx.lightBlend = 0.5f; } this->csState1 = 2; @@ -4227,8 +4216,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { accel.y = 0.4f; accel.x = Rand_CenteredFloat(0.5f); accel.z = Rand_CenteredFloat(0.5f); - BossTw_AddDotEffect(globalCtx, &pos, &velocity, &accel, ((s16)Rand_ZeroFloat(2.0f) + 8), 0, - 75); + BossTw_AddDotEffect(play, &pos, &velocity, &accel, ((s16)Rand_ZeroFloat(2.0f) + 8), 0, 75); } } break; @@ -4269,14 +4257,13 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.13f; accel.z = 0.0f; - BossTw_AddDmgCloud(globalCtx, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20.0f, 0, 0, 80); + BossTw_AddDmgCloud(play, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20.0f, 0, 0, 80); velocity.x = Rand_CenteredFloat(10.0f); velocity.z = Rand_CenteredFloat(10.0f); velocity.y = Rand_ZeroFloat(3.0f) + 3.0f; pos.x = sKotakePtr->groundBlastPos2.x + (velocity.x * 0.5f); pos.z = sKotakePtr->groundBlastPos2.z + (velocity.z * 0.5f); - BossTw_AddDmgCloud(globalCtx, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 15.0f, 255, 2, - 130); + BossTw_AddDmgCloud(play, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 15.0f, 255, 2, 130); } Math_ApproachF(&sKotakePtr->workf[UNK_F9], 80.0f, 1.0f, 3.0f); @@ -4309,8 +4296,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.13f; accel.z = 0.0f; - BossTw_AddDmgCloud(globalCtx, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20, 0, 0, - 80); + BossTw_AddDmgCloud(play, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20, 0, 0, 80); } } sp80 = 3.0f; @@ -4330,8 +4316,8 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { } } -s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 BossTw_BlastShieldCheck(BossTw* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 ret = false; ColliderInfo* info; @@ -4345,16 +4331,16 @@ s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) { if (info->toucher.dmgFlags & DMG_SHIELD) { this->work[INVINC_TIMER] = 7; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; func_800AA000(0.0f, 100, 5, 4); - if (Player_HasMirrorShieldEquipped(globalCtx)) { + if (Player_HasMirrorShieldEquipped(play)) { if (this->blastType == 1) { if (sShieldIceCharge != 0) { sShieldIceCharge = 0; - BossTw_AddShieldDeflectEffect(globalCtx, 10.0f, 1); + BossTw_AddShieldDeflectEffect(play, 10.0f, 1); } else { - BossTw_AddShieldHitEffect(globalCtx, 10.0f, 1); + BossTw_AddShieldHitEffect(play, 10.0f, 1); sShieldFireCharge++; D_8094C86F = (sShieldFireCharge * 2) + 8; D_8094C872 = -7; @@ -4363,9 +4349,9 @@ s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) { if (sShieldFireCharge != 0) { sShieldFireCharge = 0; if (1) {} - BossTw_AddShieldDeflectEffect(globalCtx, 10.0f, 0); + BossTw_AddShieldDeflectEffect(play, 10.0f, 0); } else { - BossTw_AddShieldHitEffect(globalCtx, 10.0f, 0); + BossTw_AddShieldHitEffect(play, 10.0f, 0); sShieldIceCharge++; D_8094C86F = (sShieldIceCharge * 2) + 8; D_8094C872 = -7; @@ -4385,7 +4371,7 @@ s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) { sEnvType = 0; } } else { - BossTw_AddShieldDeflectEffect(globalCtx, 10.0f, this->blastType); + BossTw_AddShieldDeflectEffect(play, 10.0f, this->blastType); this->csState1 = 2; this->timers[0] = 20; sEnvType = 0; @@ -4402,7 +4388,7 @@ s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) { return ret; } -void BossTw_BlastUpdate(Actor* thisx, GlobalContext* globalCtx) { +void BossTw_BlastUpdate(Actor* thisx, PlayState* play) { BossTw* this = (BossTw*)thisx; ColliderCylinder* collider; s16 i; @@ -4417,7 +4403,7 @@ void BossTw_BlastUpdate(Actor* thisx, GlobalContext* globalCtx) { this->blastTailPos[this->work[TAIL_IDX]] = this->actor.world.pos; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); for (i = 0; i < 5; i++) { if (this->timers[i] != 0) { @@ -4437,24 +4423,24 @@ void BossTw_BlastUpdate(Actor* thisx, GlobalContext* globalCtx) { collider = &this->collider; Collider_UpdateCylinder(&this->actor, collider); - if (this->blastActive && this->work[INVINC_TIMER] == 0 && !BossTw_BlastShieldCheck(this, globalCtx)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &collider->base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base); + if (this->blastActive && this->work[INVINC_TIMER] == 0 && !BossTw_BlastShieldCheck(this, play)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &collider->base); + CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base); } this->blastActive = false; } -void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossTw_BlastDraw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossTw* this = (BossTw*)thisx; f32 scaleFactor; s16 tailIdx; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 8818); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 8818); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); switch (this->actor.params) { case TW_FIRE_BLAST: @@ -4462,17 +4448,17 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128); for (i = 9; i >= 0; i--) { gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll( - globalCtx->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 10)) & 0x7F, - ((-this->work[CS_TIMER_1] * 15) + (i * 50)) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 10)) & 0x7F, + ((-this->work[CS_TIMER_1] * 15) + (i * 50)) & 0xFF, 0x20, 0x40, 1, 0, 0, + 0x20, 0x20)); tailIdx = ((this->work[TAIL_IDX] - i) + 30) % 30; Matrix_Translate(this->blastTailPos[tailIdx].x, this->blastTailPos[tailIdx].y, this->blastTailPos[tailIdx].z, MTXMODE_NEW); scaleFactor = 1.0f - (i * 0.09f); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 8865), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 8865), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); } @@ -4486,17 +4472,17 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998)); for (i = 9; i >= 0; i--) { gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll( - globalCtx->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 0xA)) & 0x7F, - (u8)((-this->work[CS_TIMER_1] * 0xF) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 0xA)) & 0x7F, + (u8)((-this->work[CS_TIMER_1] * 0xF) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, + 0x20)); tailIdx = ((this->work[TAIL_IDX] - i) + 30) % 30; Matrix_Translate(this->blastTailPos[tailIdx].x, this->blastTailPos[tailIdx].y, this->blastTailPos[tailIdx].z, MTXMODE_NEW); scaleFactor = 1.0f - (i * 0.09f); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 9004), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 9004), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); } @@ -4506,19 +4492,19 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { break; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 9013); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 9013); } -void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossTw_DrawDeathBall(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossTw* this = (BossTw*)thisx; f32 scaleFactor; s16 tailIdx; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 9028); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 9028); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->actor.params == TW_DEATHBALL_KOUME) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, (s8)this->workf[TAIL_ALPHA]); @@ -4526,7 +4512,7 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { for (i = 9; i >= 0; i--) { gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, (u8)((-this->work[CS_TIMER_1] * 0xF) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); tailIdx = ((this->work[TAIL_IDX] - i) + 30) % 30; @@ -4535,8 +4521,8 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { scaleFactor = (1.0f - (i * 0.09f)); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 9071), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 9071), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); } @@ -4546,7 +4532,7 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { for (i = 9; i >= 0; i--) { gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, (u8)((-this->work[CS_TIMER_1] * 0xF) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); tailIdx = ((this->work[TAIL_IDX] - i) + 30) % 30; @@ -4555,24 +4541,24 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { scaleFactor = (1.0f - (i * 0.09f)); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 9107), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 9107), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 9111); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 9111); } -void BossTw_UpdateEffects(GlobalContext* globalCtx) { +void BossTw_UpdateEffects(PlayState* play) { static Color_RGB8 sDotColors[] = { { 255, 128, 0 }, { 255, 0, 0 }, { 255, 255, 0 }, { 255, 0, 0 }, { 100, 100, 100 }, { 255, 255, 255 }, { 150, 150, 150 }, { 255, 255, 255 }, }; Vec3f sp11C; - BossTwEffect* eff = globalCtx->specialEffects; - Player* player = GET_PLAYER(globalCtx); + BossTwEffect* eff = play->specialEffects; + Player* player = GET_PLAYER(play); u8 sp113 = 0; s16 i; s16 j; @@ -4678,12 +4664,12 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { spDC.x = 0.0f; spDC.y = 0.0f; spDC.z = 0.0f; - BossTw_AddFlameEffect(globalCtx, &spF4, &spE8, &spDC, Rand_ZeroFloat(10.0f) + 25.0f, + BossTw_AddFlameEffect(play, &spF4, &spE8, &spDC, Rand_ZeroFloat(10.0f) + 25.0f, eff->work[EFF_ARGS]); } sTwinrovaPtr->twinrovaStun = 1; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightBlend = 1.0f; eff->type = TWEFF_NONE; } } @@ -4740,7 +4726,7 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { if (sTwinrovaPtr->groundBlastPos.y != 35.0f) { sTwinrovaPtr->groundBlastPos.x = eff->pos.x; sTwinrovaPtr->groundBlastPos.z = eff->pos.z; - BossTw_SpawnGroundBlast(sTwinrovaPtr, globalCtx, eff->work[EFF_ARGS]); + BossTw_SpawnGroundBlast(sTwinrovaPtr, play, eff->work[EFF_ARGS]); } } } @@ -4752,7 +4738,7 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { } } - BossTw_AddFlameEffect(globalCtx, &eff->pos, &sZeroVector, &sZeroVector, 10, eff->work[EFF_ARGS]); + BossTw_AddFlameEffect(play, &eff->pos, &sZeroVector, &sZeroVector, 10, eff->work[EFF_ARGS]); } else if (eff->type == TWEFF_SHLD_HIT) { eff->work[EFF_UNKS1]++; sp11C.x = 0.0f; @@ -4780,7 +4766,7 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { } } - BossTw_AddFlameEffect(globalCtx, &eff->pos, &sZeroVector, &sZeroVector, 10, eff->work[EFF_ARGS]); + BossTw_AddFlameEffect(play, &eff->pos, &sZeroVector, &sZeroVector, 10, eff->work[EFF_ARGS]); } else if (eff->type == 4) { if (eff->work[EFF_UNKS1] == 0) { Math_ApproachF(&eff->workf[EFF_SCALE], eff->workf[EFF_DIST], 0.05f, 1.0f); @@ -4839,8 +4825,8 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { eff->frame = 100; } - if (!(globalCtx->gameplayFrames & 1)) { - globalCtx->damagePlayer(globalCtx, -1); + if (!(play->gameplayFrames & 1)) { + play->damagePlayer(play, -1); } } else { Math_ApproachF(&eff->workf[EFF_SCALE], 0.042f, 1.0f, 0.002f); @@ -4869,8 +4855,8 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { spA8.y = 0.1f; spA8.z = 0.0f; - BossTw_AddDmgCloud(globalCtx, 3, &spC0, &spB4, &spA8, phi_f22 + Rand_ZeroFloat(phi_f22 * 0.5f), - 0, 0, 150); + BossTw_AddDmgCloud(play, 3, &spC0, &spB4, &spA8, phi_f22 + Rand_ZeroFloat(phi_f22 * 0.5f), 0, 0, + 150); } } } @@ -4905,22 +4891,22 @@ f32 BossTw_RandZeroOne(void) { return fabsf(rand); } -void BossTw_DrawEffects(GlobalContext* globalCtx) { +void BossTw_DrawEffects(PlayState* play) { u8 materialFlag = 0; s16 i; s16 j; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 phi_s4; - BossTwEffect* currentEffect = globalCtx->specialEffects; + BossTwEffect* currentEffect = play->specialEffects; BossTwEffect* effectHead; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; effectHead = currentEffect; OPEN_DISPS(gfxCtx, "../z_boss_tw.c", 9592); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) { if (currentEffect->type == 1) { @@ -4932,7 +4918,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, currentEffect->color.r, currentEffect->color.g, currentEffect->color.b, currentEffect->alpha); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9617), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4954,10 +4940,10 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, currentEffect->alpha); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, (currentEffect->frame * 15) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9660), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4979,10 +4965,10 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, currentEffect->alpha); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, (currentEffect->frame * 15) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9709), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -5002,7 +4988,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { } gSPSegment(POLY_XLU_DISP++, 0xD, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, currentEffect->frame & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, currentEffect->frame & 0x7F, (currentEffect->frame * 8) & 0xFF, 0x20, 0x40, 1, (currentEffect->frame * -2) & 0x7F, 0, 0x10, 0x10)); @@ -5016,7 +5002,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { } Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); if (currentEffect->work[EFF_UNKS1] == 0) { Matrix_Translate(0.0f, 0.0f, 60.0f, MTXMODE_APPLY); @@ -5049,7 +5035,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AA50)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, 255); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); materialFlag++; BossTw_InitRand(1, 0x71AC, 0x263A); } @@ -5098,10 +5084,10 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { } gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, (-currentEffect->frame * 15) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9911), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -5119,7 +5105,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_boss_tw.c", 9920); } -void BossTw_TwinrovaSetupArriveAtTarget(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupArriveAtTarget(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaArriveAtTarget; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -3.0f); this->work[CS_TIMER_1] = Rand_ZeroFloat(100.0f); @@ -5127,7 +5113,7 @@ void BossTw_TwinrovaSetupArriveAtTarget(BossTw* this, GlobalContext* globalCtx) this->rotateSpeed = 0.0f; } -void BossTw_TwinrovaArriveAtTarget(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaArriveAtTarget(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.1f, fabsf(this->actor.velocity.x) * 1.5f); Math_ApproachF(&this->actor.world.pos.y, this->targetPos.y, 0.1f, fabsf(this->actor.velocity.y) * 1.5f); @@ -5135,21 +5121,21 @@ void BossTw_TwinrovaArriveAtTarget(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.1f, fabsf(this->actor.velocity.z) * 1.5f); if (this->timers[1] == 1) { - BossTw_TwinrovaSetupChargeBlast(this, globalCtx); + BossTw_TwinrovaSetupChargeBlast(this, play); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->rotateSpeed); Math_ApproachF(&this->rotateSpeed, 4096.0f, 1.0f, 350.0f); } -void BossTw_TwinrovaSetupChargeBlast(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupChargeBlast(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaChargeBlast; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_036FBC, -5.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_036FBC); this->csState1 = 0; } -void BossTw_TwinrovaChargeBlast(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaChargeBlast(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.03f, fabsf(this->actor.velocity.x) * 1.5f); @@ -5169,11 +5155,11 @@ void BossTw_TwinrovaChargeBlast(BossTw* this, GlobalContext* globalCtx) { sTwinrovaBlastType = sFixedBlastType; } - BossTw_TwinrovaSetupShootBlast(this, globalCtx); + BossTw_TwinrovaSetupShootBlast(this, play); } } -void BossTw_TwinrovaSetupShootBlast(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupShootBlast(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaShootBlast; if (sTwinrovaBlastType == 0) { @@ -5185,7 +5171,7 @@ void BossTw_TwinrovaSetupShootBlast(BossTw* this, GlobalContext* globalCtx) { this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_023750); } -void BossTw_TwinrovaShootBlast(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaShootBlast(BossTw* this, PlayState* play) { BossTw* twMagic; Vec3f* magicSpawnPos; s32 magicParams; @@ -5207,9 +5193,8 @@ void BossTw_TwinrovaShootBlast(BossTw* this, GlobalContext* globalCtx) { magicSpawnPos = &this->leftScepterPos; } - twMagic = - (BossTw*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_TW, magicSpawnPos->x, - magicSpawnPos->y, magicSpawnPos->z, 0, 0, 0, magicParams); + twMagic = (BossTw*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_TW, magicSpawnPos->x, + magicSpawnPos->y, magicSpawnPos->z, 0, 0, 0, magicParams); if (twMagic != NULL) { twMagic->blastType = magicParams == TW_ICE_BLAST ? 0 : 1; @@ -5225,33 +5210,33 @@ void BossTw_TwinrovaShootBlast(BossTw* this, GlobalContext* globalCtx) { velocity.x = Rand_CenteredFloat(30.0f); velocity.y = Rand_CenteredFloat(30.0f); velocity.z = Rand_CenteredFloat(30.0f); - BossTw_AddDotEffect(globalCtx, magicSpawnPos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 11, + BossTw_AddDotEffect(play, magicSpawnPos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 11, twMagic->blastType, 75); } } } if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { - BossTw_TwinrovaSetupDoneBlastShoot(this, globalCtx); + BossTw_TwinrovaSetupDoneBlastShoot(this, play); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000); } -void BossTw_TwinrovaSetupDoneBlastShoot(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupDoneBlastShoot(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaDoneBlastShoot; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -10.0f); this->timers[1] = 60; } -void BossTw_TwinrovaDoneBlastShoot(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaDoneBlastShoot(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timers[1] == 0 && D_8094C870 == 0) { if (sTwinrovaPtr->timers[2] == 0) { - BossTw_TwinrovaSetupFly(this, globalCtx); + BossTw_TwinrovaSetupFly(this, play); } else { - BossTw_TwinrovaSetupLaugh(this, globalCtx); + BossTw_TwinrovaSetupLaugh(this, play); } } @@ -5259,7 +5244,7 @@ void BossTw_TwinrovaDoneBlastShoot(BossTw* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000); } -void BossTw_TwinrovaDamage(BossTw* this, GlobalContext* globalCtx, u8 damage) { +void BossTw_TwinrovaDamage(BossTw* this, PlayState* play, u8 damage) { if (this->actionFunc != BossTw_TwinrovaStun) { Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_0338F0, -15.0f); this->timers[0] = 150; @@ -5278,8 +5263,8 @@ void BossTw_TwinrovaDamage(BossTw* this, GlobalContext* globalCtx, u8 damage) { } if ((s8)this->actor.colChkInfo.health <= 0) { - BossTw_TwinrovaSetupDeathCS(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + BossTw_TwinrovaSetupDeathCS(this, play); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_YOUNG_DEAD); return; } @@ -5291,7 +5276,7 @@ void BossTw_TwinrovaDamage(BossTw* this, GlobalContext* globalCtx, u8 damage) { this->actionFunc = BossTw_TwinrovaStun; } -void BossTw_TwinrovaStun(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaStun(BossTw* this, PlayState* play) { s16 cloudType; this->unk_5F8 = 1; @@ -5312,7 +5297,7 @@ void BossTw_TwinrovaStun(BossTw* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.1f; accel.z = 0.0f; - BossTw_AddDmgCloud(globalCtx, cloudType, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 10.0f, 0, 0, 150); + BossTw_AddDmgCloud(play, cloudType, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 10.0f, 0, 0, 150); } SkelAnime_Update(&this->skelAnime); @@ -5326,7 +5311,7 @@ void BossTw_TwinrovaStun(BossTw* this, GlobalContext* globalCtx) { this->actor.world.pos.y += this->actor.velocity.y; Math_ApproachF(&this->actor.velocity.y, -5.0f, 1.0f, 0.5f); this->actor.world.pos.y -= 30.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2); this->actor.world.pos.y += 30.0f; if (this->csState1 == 0) { @@ -5345,18 +5330,18 @@ void BossTw_TwinrovaStun(BossTw* this, GlobalContext* globalCtx) { } if (this->timers[0] == 0) { - BossTw_TwinrovaSetupGetUp(this, globalCtx); + BossTw_TwinrovaSetupGetUp(this, play); } } -void BossTw_TwinrovaSetupGetUp(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupGetUp(BossTw* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_035988, 0.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_035988); this->actionFunc = BossTw_TwinrovaGetUp; this->timers[0] = 50; } -void BossTw_TwinrovaGetUp(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaGetUp(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->actor.world.pos.y, this->targetPos.y, 0.05f, 5.0f); @@ -5366,16 +5351,16 @@ void BossTw_TwinrovaGetUp(BossTw* this, GlobalContext* globalCtx) { } if (this->timers[0] == 0) { - BossTw_TwinrovaSetupFly(this, globalCtx); + BossTw_TwinrovaSetupFly(this, play); } } -void BossTw_TwinrovaSetupFly(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupFly(BossTw* this, PlayState* play) { f32 xDiff; f32 zDiff; f32 yDiff; f32 xzDist; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); do { this->work[TW_PLLR_IDX] += (s16)(((s16)Rand_ZeroFloat(2.99f)) + 1); @@ -5399,7 +5384,7 @@ void BossTw_TwinrovaSetupFly(BossTw* this, GlobalContext* globalCtx) { Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -10.0f); } -void BossTw_TwinrovaFly(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaFly(BossTw* this, PlayState* play) { f32 xDiff; f32 yDiff; f32 zDiff; @@ -5426,18 +5411,18 @@ void BossTw_TwinrovaFly(BossTw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.1f, fabsf(this->actor.velocity.z) * 1.5f); if (xzDist < 200.0f) { - BossTw_TwinrovaSetupArriveAtTarget(this, globalCtx); + BossTw_TwinrovaSetupArriveAtTarget(this, play); } } -void BossTw_TwinrovaSetupSpin(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupSpin(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaSpin; Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, 0.0f); this->timers[0] = 20; this->actor.speedXZ = 0.0f; } -void BossTw_TwinrovaSpin(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSpin(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timers[0] != 0) { this->collider.base.colType = COLTYPE_METAL; @@ -5447,18 +5432,18 @@ void BossTw_TwinrovaSpin(BossTw* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_ROLL); } } else { - BossTw_TwinrovaSetupFly(this, globalCtx); + BossTw_TwinrovaSetupFly(this, play); } } -void BossTw_TwinrovaSetupLaugh(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaSetupLaugh(BossTw* this, PlayState* play) { this->actionFunc = BossTw_TwinrovaLaugh; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_03A2D0, 0.0f); this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_03A2D0); this->actor.speedXZ = 0.0f; } -void BossTw_TwinrovaLaugh(BossTw* this, GlobalContext* globalCtx) { +void BossTw_TwinrovaLaugh(BossTw* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 10.0f)) { @@ -5466,6 +5451,6 @@ void BossTw_TwinrovaLaugh(BossTw* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) { - BossTw_TwinrovaSetupFly(this, globalCtx); + BossTw_TwinrovaSetupFly(this, play); } } diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h index 81329abff8..ebffaaeafa 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h @@ -6,7 +6,7 @@ struct BossTw; -typedef void (*BossTwActionFunc)(struct BossTw* this, GlobalContext* globalCtx); +typedef void (*BossTwActionFunc)(struct BossTw* this, PlayState* play); typedef enum { /* 0 */ CS_TIMER_1, diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 4a37d5cefd..e512738a07 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -113,82 +113,80 @@ typedef enum { /* 24 */ DEATH_FINISH } BossVaCutscene; -void BossVa_Init(Actor* thisx, GlobalContext* globalCtx); -void BossVa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossVa_Update(Actor* thisx, GlobalContext* globalCtx); -void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossVa_Init(Actor* thisx, PlayState* play); +void BossVa_Destroy(Actor* thisx, PlayState* play); +void BossVa_Update(Actor* thisx, PlayState* play); +void BossVa_Draw(Actor* thisx, PlayState* play); -void BossVa_UpdateEffects(GlobalContext* globalCtx); -void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx); -void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale); +void BossVa_UpdateEffects(PlayState* play); +void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play); +void BossVa_DrawDoor(PlayState* play, s16 scale); void BossVa_SetupIntro(BossVa* this); void BossVa_SetupBodyPhase1(BossVa* this); -void BossVa_SetupBodyPhase2(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupBodyPhase2(BossVa* this, PlayState* play); void BossVa_SetupBodyPhase3(BossVa* this); -void BossVa_SetupBodyPhase4(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupBodyDeath(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupBodyPhase4(BossVa* this, PlayState* play); +void BossVa_SetupBodyDeath(BossVa* this, PlayState* play); -void BossVa_SetupSupportIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupSupportAttached(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupSupportCut(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupSupportIntro(BossVa* this, PlayState* play); +void BossVa_SetupSupportAttached(BossVa* this, PlayState* play); +void BossVa_SetupSupportCut(BossVa* this, PlayState* play); -void BossVa_SetupZapperIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupZapperAttack(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupZapperEnraged(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupZapperDamaged(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupZapperHold(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupZapperIntro(BossVa* this, PlayState* play); +void BossVa_SetupZapperAttack(BossVa* this, PlayState* play); +void BossVa_SetupZapperEnraged(BossVa* this, PlayState* play); +void BossVa_SetupZapperDamaged(BossVa* this, PlayState* play); +void BossVa_SetupZapperHold(BossVa* this, PlayState* play); -void BossVa_SetupStump(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupStump(BossVa* this, PlayState* play); -void BossVa_SetupDoor(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupDoor(BossVa* this, PlayState* play); -void BossVa_SetupBariIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupBariPhase2Attack(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupBariPhase3Attack(BossVa* this, GlobalContext* globalCtx); -void BossVa_SetupBariPhase3Stunned(BossVa* this, GlobalContext* globalCtx); +void BossVa_SetupBariIntro(BossVa* this, PlayState* play); +void BossVa_SetupBariPhase2Attack(BossVa* this, PlayState* play); +void BossVa_SetupBariPhase3Attack(BossVa* this, PlayState* play); +void BossVa_SetupBariPhase3Stunned(BossVa* this, PlayState* play); void BossVa_SetupBariDeath(BossVa* this); -void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx); -void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx); -void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx); -void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx); -void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx); +void BossVa_BodyIntro(BossVa* this, PlayState* play); +void BossVa_BodyPhase1(BossVa* this, PlayState* play); +void BossVa_BodyPhase2(BossVa* this, PlayState* play); +void BossVa_BodyPhase3(BossVa* this, PlayState* play); +void BossVa_BodyPhase4(BossVa* this, PlayState* play); +void BossVa_BodyDeath(BossVa* this, PlayState* play); -void BossVa_SupportIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_SupportAttached(BossVa* this, GlobalContext* globalCtx); -void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx); +void BossVa_SupportIntro(BossVa* this, PlayState* play); +void BossVa_SupportAttached(BossVa* this, PlayState* play); +void BossVa_SupportCut(BossVa* this, PlayState* play); -void BossVa_ZapperIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx); -void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx); -void BossVa_ZapperDamaged(BossVa* this, GlobalContext* globalCtx); -void BossVa_ZapperHold(BossVa* this, GlobalContext* globalCtx); -void BossVa_ZapperDeath(BossVa* this, GlobalContext* globalCtx); +void BossVa_ZapperIntro(BossVa* this, PlayState* play); +void BossVa_ZapperAttack(BossVa* this, PlayState* play); +void BossVa_ZapperEnraged(BossVa* this, PlayState* play); +void BossVa_ZapperDamaged(BossVa* this, PlayState* play); +void BossVa_ZapperHold(BossVa* this, PlayState* play); +void BossVa_ZapperDeath(BossVa* this, PlayState* play); -void BossVa_Stump(BossVa* this, GlobalContext* globalCtx); +void BossVa_Stump(BossVa* this, PlayState* play); -void BossVa_Door(BossVa* this, GlobalContext* globalCtx); +void BossVa_Door(BossVa* this, PlayState* play); -void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx); -void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx); -void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx); -void BossVa_BariPhase3Stunned(BossVa* this, GlobalContext* globalCtx); -void BossVa_BariDeath(BossVa* this, GlobalContext* globalCtx); +void BossVa_BariIntro(BossVa* this, PlayState* play); +void BossVa_BariPhase3Attack(BossVa* this, PlayState* play); +void BossVa_BariPhase2Attack(BossVa* this, PlayState* play); +void BossVa_BariPhase3Stunned(BossVa* this, PlayState* play); +void BossVa_BariDeath(BossVa* this, PlayState* play); -void BossVa_SpawnBloodSplatter(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale); -void BossVa_SpawnGore(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale); -void BossVa_SpawnSpark(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode); -void BossVa_SpawnZapperCharge(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* pos, Vec3s* rot, - s16 scale, u8 mode); -void BossVa_SpawnTumor(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode); -void BossVa_SpawnSparkBall(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, - u8 mode); -void BossVa_SpawnBloodDroplets(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 scale, s16 phase, - s16 yaw); -void BossVa_Tumor(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, - f32 range, u8 fixed); +void BossVa_SpawnBloodSplatter(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale); +void BossVa_SpawnGore(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale); +void BossVa_SpawnSpark(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode); +void BossVa_SpawnZapperCharge(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* pos, Vec3s* rot, s16 scale, + u8 mode); +void BossVa_SpawnTumor(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode); +void BossVa_SpawnSparkBall(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode); +void BossVa_SpawnBloodDroplets(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 scale, s16 phase, s16 yaw); +void BossVa_Tumor(PlayState* play, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, f32 range, + u8 fixed); const ActorInit Boss_Va_InitVars = { ACTOR_BOSS_VA, @@ -433,7 +431,7 @@ void BossVa_AttachToBody(BossVa* this) { this->actor.shape.yOffset = GET_BODY(this)->actor.shape.yOffset; } -void BossVa_BloodDroplets(GlobalContext* globalCtx, Vec3f* pos, s16 phase, s16 yaw) { +void BossVa_BloodDroplets(PlayState* play, Vec3f* pos, s16 phase, s16 yaw) { s32 i; Vec3f spawnPos; @@ -441,11 +439,11 @@ void BossVa_BloodDroplets(GlobalContext* globalCtx, Vec3f* pos, s16 phase, s16 y spawnPos.x = Rand_CenteredFloat(10.0f) + pos->x; spawnPos.y = pos->y - (Rand_ZeroOne() * 15.0f); spawnPos.z = Rand_CenteredFloat(10.0f) + pos->z; - BossVa_SpawnBloodDroplets(globalCtx, sEffects, &spawnPos, 65, phase, yaw); + BossVa_SpawnBloodDroplets(play, sEffects, &spawnPos, 65, phase, yaw); } } -void BossVa_BloodSplatter(GlobalContext* globalCtx, BossVaEffect* src, s16 yaw, s16 scale, s32 count) { +void BossVa_BloodSplatter(PlayState* play, BossVaEffect* src, s16 yaw, s16 scale, s32 count) { s32 i; Vec3f pos; @@ -453,11 +451,11 @@ void BossVa_BloodSplatter(GlobalContext* globalCtx, BossVaEffect* src, s16 yaw, pos.x = Rand_CenteredFloat(10.0f) + src->pos.x; pos.y = src->pos.y - (Rand_ZeroOne() * 15.0f); pos.z = Rand_CenteredFloat(10.0f) + src->pos.z; - BossVa_SpawnBloodSplatter(globalCtx, sEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale); + BossVa_SpawnBloodSplatter(play, sEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale); } } -void BossVa_Gore(GlobalContext* globalCtx, BossVaEffect* src, s16 yaw, s16 scale) { +void BossVa_Gore(PlayState* play, BossVaEffect* src, s16 yaw, s16 scale) { s32 i; Vec3f pos; @@ -465,12 +463,12 @@ void BossVa_Gore(GlobalContext* globalCtx, BossVaEffect* src, s16 yaw, s16 scale pos.x = Rand_CenteredFloat(10.0f) + src->pos.x; pos.y = Rand_CenteredFloat(10.0f) + src->pos.y; pos.z = Rand_CenteredFloat(10.0f) + src->pos.z; - BossVa_SpawnGore(globalCtx, sEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale); + BossVa_SpawnGore(play, sEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale); } } -void BossVa_Spark(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, - f32 range, u8 fixed) { +void BossVa_Spark(PlayState* play, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, f32 range, + u8 fixed) { s32 i; s16 index; Vec3f offset; @@ -484,12 +482,12 @@ void BossVa_Spark(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale, offset.x = Rand_CenteredFloat(xzSpread) + this->effectPos[index].x - this->actor.world.pos.x; offset.y = Rand_CenteredFloat(ySpread) + this->effectPos[index].y - this->actor.world.pos.y; offset.z = Rand_CenteredFloat(xzSpread) + this->effectPos[index].z - this->actor.world.pos.z; - BossVa_SpawnSpark(globalCtx, sEffects, this, &offset, scale, mode); + BossVa_SpawnSpark(play, sEffects, this, &offset, scale, mode); } } -void BossVa_Tumor(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, - f32 range, u8 fixed) { +void BossVa_Tumor(PlayState* play, BossVa* this, s32 count, s16 scale, f32 xzSpread, f32 ySpread, u8 mode, f32 range, + u8 fixed) { s16 index; s32 i; Vec3f offset; @@ -504,42 +502,42 @@ void BossVa_Tumor(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale, offset.x = Rand_CenteredFloat(xzSpread) + this->effectPos[index].x - this->actor.world.pos.x; offset.y = Rand_CenteredFloat(ySpread) + this->effectPos[index].y - this->actor.world.pos.y; offset.z = Rand_CenteredFloat(xzSpread) + this->effectPos[index].z - this->actor.world.pos.z; - BossVa_SpawnTumor(globalCtx, sEffects, this, &offset, scale, mode); + BossVa_SpawnTumor(play, sEffects, this, &offset, scale, mode); } } -void BossVa_SetSparkEnv(GlobalContext* globalCtx) { - globalCtx->envCtx.adjAmbientColor[0] = 0xA; - globalCtx->envCtx.adjAmbientColor[1] = 0xA; - globalCtx->envCtx.adjAmbientColor[2] = 0xA; - globalCtx->envCtx.adjLight1Color[0] = 0x73; - globalCtx->envCtx.adjLight1Color[1] = 0x41; - globalCtx->envCtx.adjLight1Color[2] = 0x64; - globalCtx->envCtx.adjFogColor[0] = 0x78; - globalCtx->envCtx.adjFogColor[1] = 0x78; - globalCtx->envCtx.adjFogColor[2] = 0x46; +void BossVa_SetSparkEnv(PlayState* play) { + play->envCtx.adjAmbientColor[0] = 0xA; + play->envCtx.adjAmbientColor[1] = 0xA; + play->envCtx.adjAmbientColor[2] = 0xA; + play->envCtx.adjLight1Color[0] = 0x73; + play->envCtx.adjLight1Color[1] = 0x41; + play->envCtx.adjLight1Color[2] = 0x64; + play->envCtx.adjFogColor[0] = 0x78; + play->envCtx.adjFogColor[1] = 0x78; + play->envCtx.adjFogColor[2] = 0x46; } -void BossVa_SetDeathEnv(GlobalContext* globalCtx) { - globalCtx->envCtx.adjFogColor[0] = 0xDC; - globalCtx->envCtx.adjFogColor[1] = 0xDC; - globalCtx->envCtx.adjFogColor[2] = 0x96; - globalCtx->envCtx.adjFogNear = -0x3E8; - globalCtx->envCtx.adjFogFar = -0x384; - globalCtx->envCtx.adjAmbientColor[0] = 0xC8; - globalCtx->envCtx.adjAmbientColor[1] = 0xC8; - globalCtx->envCtx.adjAmbientColor[2] = 0xC8; - globalCtx->envCtx.adjLight1Color[0] = 0xD7; - globalCtx->envCtx.adjLight1Color[1] = 0xA5; - globalCtx->envCtx.adjLight1Color[2] = 0xC8; - globalCtx->envCtx.screenFillColor[0] = 0xDC; - globalCtx->envCtx.screenFillColor[1] = 0xDC; - globalCtx->envCtx.screenFillColor[2] = 0x96; - globalCtx->envCtx.screenFillColor[3] = 0x64; +void BossVa_SetDeathEnv(PlayState* play) { + play->envCtx.adjFogColor[0] = 0xDC; + play->envCtx.adjFogColor[1] = 0xDC; + play->envCtx.adjFogColor[2] = 0x96; + play->envCtx.adjFogNear = -0x3E8; + play->envCtx.adjFogFar = -0x384; + play->envCtx.adjAmbientColor[0] = 0xC8; + play->envCtx.adjAmbientColor[1] = 0xC8; + play->envCtx.adjAmbientColor[2] = 0xC8; + play->envCtx.adjLight1Color[0] = 0xD7; + play->envCtx.adjLight1Color[1] = 0xA5; + play->envCtx.adjLight1Color[2] = 0xC8; + play->envCtx.screenFillColor[0] = 0xDC; + play->envCtx.screenFillColor[1] = 0xDC; + play->envCtx.screenFillColor[2] = 0x96; + play->envCtx.screenFillColor[3] = 0x64; } -EnBoom* BossVa_FindBoomerang(GlobalContext* globalCtx) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_MISC].head; +EnBoom* BossVa_FindBoomerang(PlayState* play) { + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_MISC].head; while (actorIt != NULL) { if (actorIt->id != ACTOR_EN_BOOM) { @@ -551,7 +549,7 @@ EnBoom* BossVa_FindBoomerang(GlobalContext* globalCtx) { return NULL; } -void BossVa_KillBari(BossVa* this, GlobalContext* globalCtx) { +void BossVa_KillBari(BossVa* this, PlayState* play) { s32 i; s16 scale; Vec3f pos; @@ -566,9 +564,9 @@ void BossVa_KillBari(BossVa* this, GlobalContext* globalCtx) { velocity.y = Rand_ZeroOne() + 1.0f; scale = Rand_S16Offset(80, 100); if (Rand_ZeroOne() < 0.7f) { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &pos, &velocity, &accel, scale, 25, 2, 1); + EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, scale, 25, 2, 1); } else { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &pos, &velocity, &accel, scale, 25, 0, 1); + EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, scale, 25, 0, 1); } } @@ -576,8 +574,8 @@ void BossVa_KillBari(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupBariDeath(this); } -void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossVa_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossVa* this = (BossVa*)thisx; s32 i; s16 warpId; @@ -588,29 +586,28 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { switch (this->actor.params) { case BOSSVA_BODY: - SkelAnime_Init(globalCtx, &this->skelAnime, &gBarinadeBodySkel, &gBarinadeBodyAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gBarinadeBodySkel, &gBarinadeBodyAnim, NULL, NULL, 0); this->actor.flags |= ACTOR_FLAG_24; break; case BOSSVA_SUPPORT_1: case BOSSVA_SUPPORT_2: case BOSSVA_SUPPORT_3: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBarinadeSupportSkel, &gBarinadeSupportAttachedAnim, NULL, - NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gBarinadeSupportSkel, &gBarinadeSupportAttachedAnim, NULL, NULL, + 0); break; case BOSSVA_ZAPPER_1: case BOSSVA_ZAPPER_2: case BOSSVA_ZAPPER_3: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBarinadeZapperSkel, &gBarinadeZapperIdleAnim, NULL, NULL, - 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gBarinadeZapperSkel, &gBarinadeZapperIdleAnim, NULL, NULL, 0); break; case BOSSVA_STUMP_1: case BOSSVA_STUMP_2: case BOSSVA_STUMP_3: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBarinadeStumpSkel, &gBarinadeStumpAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gBarinadeStumpSkel, &gBarinadeStumpAnim, NULL, NULL, 0); break; default: this->actor.flags |= ACTOR_FLAG_24; - SkelAnime_Init(globalCtx, &this->skelAnime, &gBarinadeBariSkel, &gBarinadeBariAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gBarinadeBariSkel, &gBarinadeBariAnim, NULL, NULL, 0); this->actor.shape.yOffset = 400.0f; break; case BOSSVA_DOOR: @@ -623,17 +620,17 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { switch (this->actor.params) { case BOSSVA_BODY: - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, 0.0f, 80.0f, 400.0f, 0, 0, - 0, BOSSVA_DOOR); - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, 0.0f, 80.0f, 400.0f, 0, 0, 0, + BOSSVA_DOOR); + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { warpId = ACTOR_EN_RU1; if (GET_EVENTCHKINF(EVENTCHKINF_37)) { warpId = ACTOR_DOOR_WARP1; } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, warpId, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, warpId, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); //! params could be WARP_DUNGEON_CHILD however this can also spawn Ru1 - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.world.pos.x + 160.0f, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x + 160.0f, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); sDoorState = 100; Actor_Kill(&this->actor); @@ -643,27 +640,27 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { if (GET_EVENTCHKINF(EVENTCHKINF_76)) { sCsState = INTRO_CALL_BARI; sDoorState = 100; - func_8002DF54(globalCtx, &this->actor, 1); - globalCtx->envCtx.screenFillColor[0] = 0xDC; - globalCtx->envCtx.screenFillColor[1] = 0xDC; - globalCtx->envCtx.screenFillColor[2] = 0xBE; - globalCtx->envCtx.screenFillColor[3] = 0xD2; - func_80064520(globalCtx, &globalCtx->csCtx); - sSubCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 1); + play->envCtx.screenFillColor[0] = 0xDC; + play->envCtx.screenFillColor[1] = 0xDC; + play->envCtx.screenFillColor[2] = 0xBE; + play->envCtx.screenFillColor[3] = 0xD2; + func_80064520(play, &play->csCtx); + sSubCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); sSubCamEyeNext.x = sSubCamEye.x = 140.0f; sSubCamEyeNext.y = sSubCamEye.y = 205.0f; sSubCamEyeNext.z = sSubCamEye.z = -20.0f; sSubCamAtNext.x = sSubCamAt.x = 10.0f; sSubCamAtNext.y = sSubCamAt.y = 50.0f; sSubCamAtNext.z = sSubCamAt.z = -220.0f; - Play_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); + Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); this->timer = 20; for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_UPPER_1; i--) { Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, + &play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, sInitPosOffsets[i].x + this->actor.world.pos.x, sInitPosOffsets[i].y + this->actor.world.pos.y, sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, @@ -678,12 +675,12 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { } this->zapHeadPos.x = 1.0f; - Collider_InitCylinder(globalCtx, &this->colliderBody); - Collider_SetCylinder(globalCtx, &this->colliderBody, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliderBody); + Collider_SetCylinder(play, &this->colliderBody, &this->actor, &sCylinderInit); for (i = BOSSVA_ZAPPER_3; i >= BOSSVA_SUPPORT_1; i--) { Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, + &play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, sInitPosOffsets[i].x + this->actor.world.pos.x, sInitPosOffsets[i].y + this->actor.world.pos.y, sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, sInitRot[i].y + this->actor.world.rot.y, sInitRot[i].z + this->actor.world.rot.z, i); @@ -700,58 +697,58 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { case BOSSVA_SUPPORT_1: case BOSSVA_SUPPORT_2: case BOSSVA_SUPPORT_3: - Collider_InitJntSph(globalCtx, &this->colliderSph); - Collider_SetJntSph(globalCtx, &this->colliderSph, &this->actor, &sJntSphInitSupport, this->elements); + Collider_InitJntSph(play, &this->colliderSph); + Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInitSupport, this->elements); if (sCsState < BOSSVA_BATTLE) { - BossVa_SetupSupportIntro(this, globalCtx); + BossVa_SetupSupportIntro(this, play); } else { - BossVa_SetupSupportAttached(this, globalCtx); + BossVa_SetupSupportAttached(this, play); } this->onCeiling++; break; case BOSSVA_ZAPPER_1: case BOSSVA_ZAPPER_2: case BOSSVA_ZAPPER_3: - Collider_InitQuad(globalCtx, &this->colliderLightning); - Collider_SetQuad(globalCtx, &this->colliderLightning, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->colliderLightning); + Collider_SetQuad(play, &this->colliderLightning, &this->actor, &sQuadInit); if (sCsState < BOSSVA_BATTLE) { - BossVa_SetupZapperIntro(this, globalCtx); + BossVa_SetupZapperIntro(this, play); } else { - BossVa_SetupZapperAttack(this, globalCtx); + BossVa_SetupZapperAttack(this, play); } break; case BOSSVA_STUMP_1: case BOSSVA_STUMP_2: case BOSSVA_STUMP_3: - BossVa_SetupStump(this, globalCtx); + BossVa_SetupStump(this, play); break; case BOSSVA_DOOR: - BossVa_SetupDoor(this, globalCtx); + BossVa_SetupDoor(this, play); break; default: - Collider_InitJntSph(globalCtx, &this->colliderSph); - Collider_SetJntSph(globalCtx, &this->colliderSph, &this->actor, &sJntSphInitBari, this->elements); - Collider_InitQuad(globalCtx, &this->colliderLightning); - Collider_SetQuad(globalCtx, &this->colliderLightning, &this->actor, &sQuadInit); + Collider_InitJntSph(play, &this->colliderSph); + Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInitBari, this->elements); + Collider_InitQuad(play, &this->colliderLightning); + Collider_SetQuad(play, &this->colliderLightning, &this->actor, &sQuadInit); this->unk_1D8.x = 1.0f; this->unk_1D8.y = 1.0f; if (sCsState < BOSSVA_BATTLE) { - BossVa_SetupBariIntro(this, globalCtx); + BossVa_SetupBariIntro(this, play); } else if (sFightPhase >= PHASE_3) { - BossVa_SetupBariPhase3Attack(this, globalCtx); + BossVa_SetupBariPhase3Attack(this, play); } else { - BossVa_SetupBariPhase2Attack(this, globalCtx); + BossVa_SetupBariPhase2Attack(this, play); } break; } } -void BossVa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BossVa_Destroy(Actor* thisx, PlayState* play) { BossVa* this = (BossVa*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyJntSph(globalCtx, &this->colliderSph); - Collider_DestroyCylinder(globalCtx, &this->colliderBody); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyJntSph(play, &this->colliderSph); + Collider_DestroyCylinder(play, &this->colliderBody); } void BossVa_SetupIntro(BossVa* this) { @@ -763,9 +760,9 @@ void BossVa_SetupIntro(BossVa* this) { BossVa_SetupAction(this, BossVa_BodyIntro); } -void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BodyIntro(BossVa* this, PlayState* play) { s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->unk_1AC += 0xC31; this->unk_1A0 = (Math_CosS(this->unk_1AC) * 0.1f) + 1.0f; @@ -780,21 +777,21 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { } break; case INTRO_START: - globalCtx->envCtx.screenFillColor[0] = 0xDC; - globalCtx->envCtx.screenFillColor[1] = 0xDC; - globalCtx->envCtx.screenFillColor[2] = 0xBE; - globalCtx->envCtx.screenFillColor[3] = 0xD2; - func_8002DF54(globalCtx, &this->actor, 8); + play->envCtx.screenFillColor[0] = 0xDC; + play->envCtx.screenFillColor[1] = 0xDC; + play->envCtx.screenFillColor[2] = 0xBE; + play->envCtx.screenFillColor[3] = 0xD2; + func_8002DF54(play, &this->actor, 8); player->actor.world.rot.y = player->actor.shape.rot.y = 0x7FFF; sCsState++; break; case INTRO_LOOK_DOOR: - func_80064520(globalCtx, &globalCtx->csCtx); + func_80064520(play, &play->csCtx); if (sSubCamId == SUB_CAM_ID_DONE) { - sSubCamId = Play_CreateSubCamera(globalCtx); + sSubCamId = Play_CreateSubCamera(play); } - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); sSubCamEyeNext.x = sSubCamEye.x = 13.0f; sSubCamEyeNext.y = sSubCamEye.y = 124.0f; @@ -812,7 +809,7 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { case INTRO_CLOSE_DOOR: this->timer--; if (this->timer == 0) { - func_8002DF54(globalCtx, &this->actor, 2); + func_8002DF54(play, &this->actor, 2); sCsState++; this->timer = 30; } @@ -827,16 +824,16 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { } break; case INTRO_CRACKLE: - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); sCsState++; break; case INTRO_SPAWN_BARI: - func_80064520(globalCtx, &globalCtx->csCtx); + func_80064520(play, &play->csCtx); if (sSubCamId == SUB_CAM_ID_DONE) { - sSubCamId = Play_CreateSubCamera(globalCtx); + sSubCamId = Play_CreateSubCamera(play); } - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); sSubCamEyeNext.x = sSubCamEye.x = 13.0f; sSubCamEyeNext.y = sSubCamEye.y = 124.0f; @@ -850,10 +847,10 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_UPPER_1; i--) { Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, - sInitPosOffsets[i].x + this->actor.world.pos.x, sInitPosOffsets[i].y + this->actor.world.pos.y, - sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, - sInitRot[i].y + this->actor.world.rot.y, sInitRot[i].z + this->actor.world.rot.z, i); + &play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, sInitPosOffsets[i].x + this->actor.world.pos.x, + sInitPosOffsets[i].y + this->actor.world.pos.y, sInitPosOffsets[i].z + this->actor.world.pos.z, + sInitRot[i].x + this->actor.world.rot.x, sInitRot[i].y + this->actor.world.rot.y, + sInitRot[i].z + this->actor.world.rot.z, i); } this->timer = 90; @@ -939,12 +936,12 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { if (sBodyBari[i - 1]) { if (sBodyBari[i - 1] == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_STICK); - BossVa_SetSparkEnv(globalCtx); + BossVa_SetSparkEnv(play); if (this->onCeiling == 0) { this->onCeiling = 2; // Not used by body } } else if (sBodyBari[i - 1] == 2) { - BossVa_Spark(globalCtx, this, 6, 140, 50.0f, 30.0f, SPARK_BARI, i, true); + BossVa_Spark(play, this, 6, 140, 50.0f, 30.0f, SPARK_BARI, i, true); } if (sBodyBari[i - 1] <= 2) { @@ -957,8 +954,8 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x; sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac; if (this->timer >= 45000) { - globalCtx->envCtx.lightSettingOverride = 1; - func_8002DF54(globalCtx, &this->actor, 8); + play->envCtx.lightSettingOverride = 1; + func_8002DF54(play, &this->actor, 8); } else if (this->timer >= 35000) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } @@ -976,8 +973,8 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { sSubCamAtNext.z = -200.0f; if (!GET_EVENTCHKINF(EVENTCHKINF_76)) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, - SEGMENTED_TO_VIRTUAL(gBarinadeTitleCardTex), 0xA0, 0xB4, 0x80, 0x28); + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gBarinadeTitleCardTex), + 0xA0, 0xB4, 0x80, 0x28); } if (Rand_ZeroOne() < 0.1f) { @@ -993,7 +990,7 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { } break; case INTRO_TITLE: - BossVa_Spark(globalCtx, this, 3, 140, 50.0f, 30.0f, SPARK_BARI, 10.0f, false); + BossVa_Spark(play, this, 3, 140, 50.0f, 30.0f, SPARK_BARI, 10.0f, false); this->timer--; if (this->timer == 0) { sCsState++; @@ -1001,7 +998,7 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { } break; case INTRO_BRIGHTEN: - BossVa_Spark(globalCtx, this, 3, 140, 50.0f, 30.0f, SPARK_BARI, 10.0f, false); + BossVa_Spark(play, this, 3, 140, 50.0f, 30.0f, SPARK_BARI, 10.0f, false); this->timer--; if (this->timer == 0) { sCsState++; @@ -1011,11 +1008,11 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { case INTRO_FINISH: this->timer--; if (this->timer == 0) { - Play_ClearCamera(globalCtx, sSubCamId); + Play_ClearCamera(play, sSubCamId); sSubCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 7); sCsState++; SET_EVENTCHKINF(EVENTCHKINF_76); player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; @@ -1028,8 +1025,8 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { if (sCsState >= INTRO_BODY_SOUND) { func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, 1.0f); - if ((sCsState >= INTRO_CALL_BARI) && ((globalCtx->gameplayFrames % 4) == 0)) { - BossVa_Spark(globalCtx, this, 1, 100, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); + if ((sCsState >= INTRO_CALL_BARI) && ((play->gameplayFrames % 4) == 0)) { + BossVa_Spark(play, this, 1, 100, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); } } @@ -1042,7 +1039,7 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&sSubCamAt.x, sSubCamAtNext.x, 0.3f, sSubCamAtMaxVelFrac.x, 0.075f); Math_SmoothStepToF(&sSubCamAt.y, sSubCamAtNext.y, 0.3f, sSubCamAtMaxVelFrac.y, 0.075f); Math_SmoothStepToF(&sSubCamAt.z, sSubCamAtNext.z, 0.3f, sSubCamAtMaxVelFrac.z, 0.075f); - Play_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); + Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); } } @@ -1057,8 +1054,8 @@ void BossVa_SetupBodyPhase1(BossVa* this) { BossVa_SetupAction(this, BossVa_BodyPhase1); } -void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_BodyPhase1(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_1B0 += 0xCE4; this->bodyGlow = (s16)(Math_SinS(this->unk_1B0) * 50.0f) + 150; @@ -1072,7 +1069,7 @@ void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx) { if (this->colliderBody.base.atFlags & AT_HIT) { this->colliderBody.base.atFlags &= ~AT_HIT; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); } } @@ -1083,7 +1080,7 @@ void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skelAnime) && (sFightPhase >= PHASE_2)) { - BossVa_SetupBodyPhase2(this, globalCtx); + BossVa_SetupBodyPhase2(this, play); } Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x, 1, 0xC8, 0); @@ -1091,8 +1088,8 @@ void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx) { this->unk_1AC += 0xC31; this->unk_1A0 = (Math_CosS(this->unk_1AC) * 0.1f) + 1.0f; this->unk_1A4 = (Math_SinS(this->unk_1AC) * 0.05f) + 1.0f; - if ((globalCtx->gameplayFrames % 4) == 0) { - BossVa_Spark(globalCtx, this, 1, 100, 50.0f, 10.0f, SPARK_BARI, 10.0f, false); + if ((play->gameplayFrames % 4) == 0) { + BossVa_Spark(play, this, 1, 100, 50.0f, 10.0f, SPARK_BARI, 10.0f, false); } if (Rand_ZeroOne() < 0.1f) { @@ -1100,17 +1097,17 @@ void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, 1.0f); } -void BossVa_SetupBodyPhase2(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBodyPhase2(BossVa* this, PlayState* play) { s32 i; sFightPhase++; for (i = BOSSVA_BARI_UPPER_5; i >= BOSSVA_BARI_UPPER_1; i--) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, sInitPosOffsets[i].x + this->actor.world.pos.x, sInitPosOffsets[i].y + this->actor.world.pos.y, sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, @@ -1122,8 +1119,8 @@ void BossVa_SetupBodyPhase2(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_BodyPhase2); } -void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_BodyPhase2(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp48; if (this->actor.colorFilterTimer == 0) { @@ -1163,7 +1160,7 @@ void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx) { sPhase2Timer = (sPhase2Timer + 0x18) & 0xFFF0; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } } @@ -1173,7 +1170,7 @@ void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx) { sp48.y += 310.0f + (this->actor.shape.yOffset * this->actor.scale.y); sp48.x += -10.0f; sp48.z += 220.0f; - BossVa_SpawnSparkBall(globalCtx, sEffects, this, &sp48, 4, 0); + BossVa_SpawnSparkBall(play, sEffects, this, &sp48, 4, 0); } if (Rand_ZeroOne() < 0.1f) { @@ -1198,21 +1195,21 @@ void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx) { this->unk_1AC += 0xC31; this->unk_1A0 = (Math_CosS(this->unk_1AC) * 0.1f) + 1.0f; this->unk_1A4 = (Math_SinS(this->unk_1AC) * 0.05f) + 1.0f; - if ((globalCtx->gameplayFrames % 4) == 0) { - BossVa_Spark(globalCtx, this, 1, 100, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); + if ((play->gameplayFrames % 4) == 0) { + BossVa_Spark(play, this, 1, 100, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); } this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 45.0f; Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); if (this->actor.colorFilterTimer == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); } if ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, @@ -1226,9 +1223,9 @@ void BossVa_SetupBodyPhase3(BossVa* this) { BossVa_SetupAction(this, BossVa_BodyPhase3); } -void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BodyPhase3(BossVa* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; s16 sp62; @@ -1238,7 +1235,7 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { if (this->colliderBody.base.atFlags & AT_HIT) { this->colliderBody.base.atFlags &= ~AT_HIT; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); this->actor.world.rot.y += (s16)Rand_CenteredFloat(0x2EE0) + 0x8000; Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } @@ -1276,7 +1273,7 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.y, sp62, 1, 0x3E8, 0); } else if (player->invincibilityTimer != 0) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 1, 0x12C, 0); - } else if ((globalCtx->gameplayFrames & 0x80) == 0) { + } else if ((play->gameplayFrames & 0x80) == 0) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x12C, 0); } else { Math_SmoothStepToS(&this->actor.world.rot.y, sp62, 1, 0x258, 0); @@ -1288,7 +1285,7 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if (SkelAnime_Update(&this->skelAnime) && (sFightPhase >= PHASE_4)) { - BossVa_SetupBodyPhase4(this, globalCtx); + BossVa_SetupBodyPhase4(this, play); } this->actor.shape.rot.y += this->vaBodySpinRate; @@ -1300,7 +1297,7 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { if ((this->actor.shape.yOffset >= -500.0f) && (sFightPhase == PHASE_3)) { for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_LOWER_1; i--) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_VA, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, sInitPosOffsets[i].x + this->actor.world.pos.x, sInitPosOffsets[i].y + this->actor.world.pos.y, sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, @@ -1312,8 +1309,8 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { this->unk_1AC += 0xC31; this->unk_1A0 = (Math_CosS(this->unk_1AC) * 0.1f) + 1.0f; this->unk_1A4 = (Math_SinS(this->unk_1AC) * 0.05f) + 1.0f; - if ((globalCtx->gameplayFrames % 4) == 0) { - BossVa_Spark(globalCtx, this, 1, 0x64, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); + if ((play->gameplayFrames % 4) == 0) { + BossVa_Spark(play, this, 1, 0x64, 50.0f, 10.0f, SPARK_BODY, 10.0f, false); } this->actor.focus.pos = this->actor.world.pos; @@ -1323,17 +1320,17 @@ void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); if (this->timer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, (this->vaBodySpinRate * 0.00025f) + 1.0f); } -void BossVa_SetupBodyPhase4(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBodyPhase4(BossVa* this, PlayState* play) { this->unk_1AC = 0; this->actor.flags |= ACTOR_FLAG_0; this->vaBodySpinRate = this->unk_1AC; @@ -1349,8 +1346,8 @@ void BossVa_SetupBodyPhase4(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_BodyPhase4); } -void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_BodyPhase4(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 tmpf1; EnBoom* boomerang; @@ -1359,7 +1356,7 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { if (this->colliderBody.base.atFlags & AT_HIT) { this->colliderBody.base.atFlags &= ~AT_HIT; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); this->actor.world.rot.y += (s16)Rand_CenteredFloat(0x2EE0) + 0x8000; Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } @@ -1384,8 +1381,8 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { sFightPhase++; sPhase4HP += 3; if (sFightPhase >= PHASE_DEATH) { - BossVa_SetupBodyDeath(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + BossVa_SetupBodyDeath(this, play); + Enemy_StartFinishingBlow(play, &this->actor); return; } this->actor.speedXZ = -10.0f; @@ -1438,8 +1435,8 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { if ((player->stateFlags1 & PLAYER_STATE1_26) && (this->timer < -60)) { this->timer = -59; } - if ((globalCtx->gameplayFrames % 4) == 0) { - BossVa_Spark(globalCtx, this, 2, 0x64, 220.0f, 5.0f, SPARK_BODY, 12.0f, true); + if ((play->gameplayFrames % 4) == 0) { + BossVa_Spark(play, this, 2, 0x64, 220.0f, 5.0f, SPARK_BODY, 12.0f, true); } if (this->timer < -30) { if (this->actor.speedXZ > 0.0f) { @@ -1479,7 +1476,7 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { 1, 0x5DC, 0); } else if (player->invincibilityTimer != 0) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 1, 0x12C, 0); - } else if ((globalCtx->gameplayFrames & 0x80) == 0) { + } else if ((play->gameplayFrames & 0x80) == 0) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, (s16)((sFightPhase - PHASE_4 + 1) * 100.0f) + 0x64, 0); } @@ -1488,19 +1485,19 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 60.0f; - if (((globalCtx->gameplayFrames % 2) == 0) && (this->timer == 0)) { - BossVa_Spark(globalCtx, this, 2, 125, 40.0f, 10.0f, SPARK_BODY, 10.0f, false); - BossVa_Spark(globalCtx, this, 1, 100, 15.0f, 10.0f, SPARK_BARI, 11.0f, true); + if (((play->gameplayFrames % 2) == 0) && (this->timer == 0)) { + BossVa_Spark(play, this, 2, 125, 40.0f, 10.0f, SPARK_BODY, 10.0f, false); + BossVa_Spark(play, this, 1, 100, 15.0f, 10.0f, SPARK_BARI, 11.0f, true); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 70.0f, 0.0f, UPDBGCHECKINFO_FLAG_0); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 70.0f, 0.0f, UPDBGCHECKINFO_FLAG_0); Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); if (this->invincibilityTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } if ((this->vaBodySpinRate > 0x3E8) || (this->actor.shape.yOffset < -1200.0f)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); } func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, (this->vaBodySpinRate * 0.00025f) + 1.0f); @@ -1512,7 +1509,7 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupBodyDeath(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBodyDeath(BossVa* this, PlayState* play) { func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, 1.0f); this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); @@ -1520,24 +1517,24 @@ void BossVa_SetupBodyDeath(BossVa* this, GlobalContext* globalCtx) { sCsState = DEATH_START; this->actor.speedXZ = 0.0f; this->unk_1A8 = 0.0f; - Flags_SetClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetClear(play, play->roomCtx.curRoom.num); BossVa_SetupAction(this, BossVa_BodyDeath); } -void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BodyDeath(BossVa* this, PlayState* play) { s32 i; - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); s32 sp7C; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 tmp16; switch (sCsState) { case DEATH_START: - func_8002DF54(globalCtx, &this->actor, 1); - func_80064520(globalCtx, &globalCtx->csCtx); - sSubCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 1); + func_80064520(play, &play->csCtx); + sSubCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); sSubCamAtNext.x = this->actor.world.pos.x; sSubCamAtNext.y = this->actor.world.pos.y; @@ -1554,10 +1551,9 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { this->unk_1AC = Math_Vec3f_Yaw(&sSubCamEye, &sSubCamAtNext) - 0x100; this->unk_1B0 = 15; - globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = - globalCtx->envCtx.screenFillColor[2] = 0xFF; - globalCtx->envCtx.screenFillColor[3] = 0; - globalCtx->envCtx.fillScreen = true; + play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = play->envCtx.screenFillColor[2] = 0xFF; + play->envCtx.screenFillColor[3] = 0; + play->envCtx.fillScreen = true; sCsState++; case DEATH_BODY_TUMORS: this->unk_1AC += 0x100; @@ -1568,12 +1564,12 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { sSubCamEyeMaxVelFrac.y = sSubCamEyeMaxVelFrac.x * 0.5f; sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac; tmp16 = Rand_CenteredFloat(0.5f) + ((sSubCamEyeMaxVelFrac.x * 0.5f) + 0.6f); - if (((globalCtx->gameplayFrames % 4) == 0) && (this->unk_1B0 != 0)) { + if (((play->gameplayFrames % 4) == 0) && (this->unk_1B0 != 0)) { for (i = 6; i > 1; i--) { - BossVa_Tumor(globalCtx, this, 1, tmp16, 0.0f, 0.0f, TUMOR_BODY, i, true); + BossVa_Tumor(play, this, 1, tmp16, 0.0f, 0.0f, TUMOR_BODY, i, true); } - BossVa_Tumor(globalCtx, this, 1, tmp16, 0.0f, 0.0f, TUMOR_BODY, 11.0f, true); + BossVa_Tumor(play, this, 1, tmp16, 0.0f, 0.0f, TUMOR_BODY, 11.0f, true); this->unk_1B0--; } @@ -1592,11 +1588,10 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { this->isDead++; this->timer = 30; sCsState++; - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_BALINADE_DEAD, 1, 1, - 0x28); + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_BALINADE_DEAD, 1, 1, 0x28); this->onCeiling = 2; // Not used by body - BossVa_SetDeathEnv(globalCtx); - func_8002DF54(globalCtx, &this->actor, 8); + BossVa_SetDeathEnv(play); + func_8002DF54(play, &this->actor, 8); } break; case DEATH_CORE_BURST: @@ -1628,20 +1623,20 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { this->timer--; if (this->timer == 0) { - Play_ClearCamera(globalCtx, sSubCamId); + Play_ClearCamera(play, sSubCamId); sSubCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); + func_80064534(play, &play->csCtx); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); mainCam->eyeNext = mainCam->eye = sSubCamEye; mainCam->at = sSubCamAt; - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); sCsState++; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 0); for (i = 2, sp7C = 2; i > 0; i--) { if (Math_Vec3f_DistXYZ(&sWarpPos[i], &player->actor.world.pos) < @@ -1650,12 +1645,12 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { } } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_RU1, sWarpPos[sp7C].x, sWarpPos[sp7C].y, - sWarpPos[sp7C].z, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_RU1, sWarpPos[sp7C].x, sWarpPos[sp7C].y, sWarpPos[sp7C].z, + 0, 0, 0, 0); } case DEATH_FINISH: Rand_CenteredFloat(0.5f); - globalCtx->envCtx.fillScreen = false; + play->envCtx.fillScreen = false; break; } @@ -1666,7 +1661,7 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&sSubCamAt.x, sSubCamAtNext.x, 0.3f, sSubCamAtMaxVelFrac.x, 0.15f); Math_SmoothStepToF(&sSubCamAt.y, sSubCamAtNext.y, 0.3f, sSubCamAtMaxVelFrac.y, 0.15f); Math_SmoothStepToF(&sSubCamAt.z, sSubCamAtNext.z, 0.3f, sSubCamAtMaxVelFrac.z, 0.15f); - Play_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); + Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); } SkelAnime_Update(&this->skelAnime); @@ -1674,8 +1669,8 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->vaBodySpinRate, 0, 1, 0xC8, 0); Math_SmoothStepToS(&this->vaCamRotMod, 0, 1, 0xC8, 0); Math_SmoothStepToS(&this->bodyGlow, 200, 1, 10, 0); - if (globalCtx->envCtx.screenFillColor[3] != 0) { - globalCtx->envCtx.screenFillColor[3] -= 50; + if (play->envCtx.screenFillColor[3] != 0) { + play->envCtx.screenFillColor[3] -= 50; } Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); @@ -1686,21 +1681,21 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { this->unk_1A4 = (Math_SinS(this->unk_1AC) * 0.05f) + 1.0f; } -void BossVa_SetupSupportIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupSupportIntro(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeSupportAttachedAnim, 0.0f, 0.0f, Animation_GetLastFrame(&gBarinadeSupportAttachedAnim), ANIMMODE_LOOP_INTERP, 0.0f); this->timer = 0; BossVa_SetupAction(this, BossVa_SupportIntro); } -void BossVa_SupportIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SupportIntro(BossVa* this, PlayState* play) { BossVa_AttachToBody(this); if (sCsState == BOSSVA_BATTLE) { - BossVa_SetupSupportAttached(this, globalCtx); + BossVa_SetupSupportAttached(this, play); } else if (sCsState >= INTRO_REVERSE_CAMERA) { this->timer++; if ((this->timer % 2) == 0) { - BossVa_Spark(globalCtx, this, 2, 90, 5.0f, 0.0f, SPARK_BODY, ((this->timer & 0x20) >> 5) + 1, true); + BossVa_Spark(play, this, 2, 90, 5.0f, 0.0f, SPARK_BODY, ((this->timer & 0x20) >> 5) + 1, true); } SkelAnime_Update(&this->skelAnime); @@ -1711,14 +1706,14 @@ void BossVa_SupportIntro(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupSupportAttached(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupSupportAttached(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeSupportAttachedAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBarinadeSupportAttachedAnim), ANIMMODE_LOOP, 0.0f); this->timer = this->actor.params * 10; BossVa_SetupAction(this, BossVa_SupportAttached); } -void BossVa_SupportAttached(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SupportAttached(BossVa* this, PlayState* play) { this->timer++; if (sBodyState & 0x7F) { Actor_SetColorFilter(&this->actor, 0, 255, 0, 12); @@ -1742,32 +1737,32 @@ void BossVa_SupportAttached(BossVa* this, GlobalContext* globalCtx) { } if (this->colliderSph.base.acFlags & AC_HIT) { - BossVa_SetupSupportCut(this, globalCtx); + BossVa_SetupSupportCut(this, play); } else { if (this->actor.colorFilterTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); } if ((this->timer % 2) == 0) { - BossVa_Spark(globalCtx, this, 1, 100, 5.0f, 0.0f, SPARK_BODY, ((this->timer & 0x20) >> 5) + 1, true); + BossVa_Spark(play, this, 1, 100, 5.0f, 0.0f, SPARK_BODY, ((this->timer & 0x20) >> 5) + 1, true); } } } -void BossVa_SetupSupportCut(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupSupportCut(BossVa* this, PlayState* play) { s32 stumpParams = this->actor.params + BOSSVA_STUMP_1; sBodyState++; sFightPhase++; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_VA, this->armTip.x, this->armTip.y + 20.0f, this->armTip.z, - 0, this->actor.shape.rot.y, 0, stumpParams); - Camera_AddQuake(&globalCtx->mainCamera, 2, 11, 8); + Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_VA, this->armTip.x, this->armTip.y + 20.0f, this->armTip.z, 0, + this->actor.shape.rot.y, 0, stumpParams); + Camera_AddQuake(&play->mainCamera, 2, 11, 8); this->burst = false; this->timer2 = 0; BossVa_SetupAction(this, BossVa_SupportCut); } -void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SupportCut(BossVa* this, PlayState* play) { BossVa* vaBody = GET_BODY(this); f32 lastFrame; @@ -1777,9 +1772,8 @@ void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx) { lastFrame = Animation_GetLastFrame(&gBarinadeSupportCutAnim); this->onCeiling = false; this->timer = (s32)(Rand_ZeroOne() * 10.0f) + 5; - SkelAnime_Free(&this->skelAnime, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBarinadeCutSupportSkel, &gBarinadeSupportCutAnim, NULL, NULL, - 0); + SkelAnime_Free(&this->skelAnime, play); + SkelAnime_InitFlex(play, &this->skelAnime, &gBarinadeCutSupportSkel, &gBarinadeSupportCutAnim, NULL, NULL, 0); Animation_Change(&this->skelAnime, &gBarinadeSupportCutAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, 0.0f); sBodyState = 0; GET_BODY(this)->actor.shape.yOffset -= 60.0f; @@ -1809,7 +1803,7 @@ void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx) { if ((this->timer == 0) && (sCsState < DEATH_START)) { this->timer = (s32)(Rand_ZeroOne() * 10.0f) + 10; - BossVa_BloodDroplets(globalCtx, &this->armTip, this->headRot.x, this->actor.shape.rot.y); + BossVa_BloodDroplets(play, &this->armTip, this->headRot.x, this->actor.shape.rot.y); } if (sCsState >= DEATH_START) { @@ -1829,8 +1823,8 @@ void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx) { case DEATH_CORE_DEAD: case DEATH_CORE_BURST: if (!this->burst) { - if ((globalCtx->gameplayFrames % 2) != 0) { - BossVa_Tumor(globalCtx, this, 1, (s16)Rand_CenteredFloat(5.0f) + 6, 7.0f, 5.0f, TUMOR_ARM, + if ((play->gameplayFrames % 2) != 0) { + BossVa_Tumor(play, this, 1, (s16)Rand_CenteredFloat(5.0f) + 6, 7.0f, 5.0f, TUMOR_ARM, (this->timer2 >> 3) + 1, true); } @@ -1855,14 +1849,14 @@ void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx) { this->timer--; } -void BossVa_SetupStump(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupStump(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeStumpAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBarinadeStumpAnim), ANIMMODE_ONCE, 0.0f); this->actor.flags &= ~ACTOR_FLAG_0; BossVa_SetupAction(this, BossVa_Stump); } -void BossVa_Stump(BossVa* this, GlobalContext* globalCtx) { +void BossVa_Stump(BossVa* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && (Rand_ZeroOne() < 0.3f)) { this->skelAnime.curFrame -= Rand_ZeroOne() * 3.0f; } @@ -1872,7 +1866,7 @@ void BossVa_Stump(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupZapperIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperIntro(BossVa* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gBarinadeZapperIdleAnim); Animation_Change(&this->skelAnime, &gBarinadeZapperIdleAnim, 1.0f, lastFrame - 1.0f, lastFrame, @@ -1881,7 +1875,7 @@ void BossVa_SetupZapperIntro(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_ZapperIntro); } -void BossVa_ZapperIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_ZapperIntro(BossVa* this, PlayState* play) { BossVa_AttachToBody(this); switch (sCsState) { @@ -1891,7 +1885,7 @@ void BossVa_ZapperIntro(BossVa* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); break; case BOSSVA_BATTLE: - BossVa_SetupZapperAttack(this, globalCtx); + BossVa_SetupZapperAttack(this, play); break; } @@ -1899,7 +1893,7 @@ void BossVa_ZapperIntro(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_1F0, this->skelAnime.jointTable[7].z, 1, 0x2EE, 0); } -void BossVa_SetupZapperAttack(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperAttack(BossVa* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gBarinadeZapperIdleAnim); Animation_Change(&this->skelAnime, &gBarinadeZapperIdleAnim, 1.0f, lastFrame - 1.0f, lastFrame, @@ -1908,8 +1902,8 @@ void BossVa_SetupZapperAttack(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_ZapperAttack); } -void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_ZapperAttack(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnBoom* boomerang; Actor* boomTarget; s16 yaw; @@ -1936,7 +1930,7 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { s16 sp54; f32 sp50; - boomerang = BossVa_FindBoomerang(globalCtx); + boomerang = BossVa_FindBoomerang(play); if ((boomerang == NULL) || (boomerang->moveTo == NULL) || (boomerang->moveTo == &player->actor)) { sp7C = player->actor.world.pos; @@ -1987,17 +1981,17 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); BossVa_AttachToBody(this); if (sFightPhase >= PHASE_4) { - BossVa_SetupZapperEnraged(this, globalCtx); + BossVa_SetupZapperEnraged(this, play); return; } if (sBodyState & 0x7F) { - BossVa_SetupZapperDamaged(this, globalCtx); + BossVa_SetupZapperDamaged(this, play); return; } if ((sFightPhase < PHASE_4) && (GET_BODY(this)->actor.speedXZ != 0.0f)) { - BossVa_SetupZapperHold(this, globalCtx); + BossVa_SetupZapperHold(this, play); return; } @@ -2058,7 +2052,7 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { if (this->colliderLightning.base.atFlags & AT_HIT) { if (this->timer2 > 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_HIT_RINK); - BossVa_SetSparkEnv(globalCtx); + BossVa_SetSparkEnv(play); this->timer2 = -1; GET_BODY(this)->onCeiling = 6; // not used by body } @@ -2067,7 +2061,7 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { } if ((this->timer2 < 0) && (player->stateFlags1 & PLAYER_STATE1_26)) { - BossVa_Spark(globalCtx, this, 1, 30, 0.0f, 0.0f, SPARK_LINK, 0.0f, true); + BossVa_Spark(play, this, 1, 30, 0.0f, 0.0f, SPARK_LINK, 0.0f, true); } } @@ -2085,20 +2079,20 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { if (this->timer2 == 32) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_THUNDER); } - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 5.0f, true); - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 6.0f, true); - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 7.0f, true); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 5.0f, true); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 6.0f, true); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 7.0f, true); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderLightning.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderLightning.base); } else { - BossVa_Spark(globalCtx, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 3) + 1, true); + BossVa_Spark(play, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 3) + 1, true); if (this->timer2 == 30) { - BossVa_SetSparkEnv(globalCtx); + BossVa_SetSparkEnv(play); } if (this->timer2 == 20) { Vec3f sp44 = this->zapHeadPos; - BossVa_SpawnZapperCharge(globalCtx, sEffects, this, &sp44, &this->headRot, 100, 0); + BossVa_SpawnZapperCharge(play, sEffects, this, &sp44, &this->headRot, 100, 0); } } @@ -2109,7 +2103,7 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupZapperDamaged(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperDamaged(BossVa* this, PlayState* play) { if (Rand_ZeroOne() > 0.5f) { Animation_Change(&this->skelAnime, &gBarinadeZapperDamage1Anim, 0.5f, 0.0f, Animation_GetLastFrame(&gBarinadeZapperDamage1Anim), ANIMMODE_ONCE_INTERP, 4.0f); @@ -2123,7 +2117,7 @@ void BossVa_SetupZapperDamaged(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_ZapperDamaged); } -void BossVa_ZapperDamaged(BossVa* this, GlobalContext* globalCtx) { +void BossVa_ZapperDamaged(BossVa* this, PlayState* play) { BossVa_AttachToBody(this); Math_SmoothStepToS(&this->unk_1E6, 0, 1, 0xFA0, 0); Math_SmoothStepToS(&this->unk_1E4, 0, 1, 0xFA0, 0); @@ -2133,14 +2127,14 @@ void BossVa_ZapperDamaged(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_1F0, this->skelAnime.jointTable[7].z, 1, 0x2EE, 0); if (SkelAnime_Update(&this->skelAnime)) { if (sFightPhase >= PHASE_4) { - BossVa_SetupZapperEnraged(this, globalCtx); + BossVa_SetupZapperEnraged(this, play); } else { - BossVa_SetupZapperAttack(this, globalCtx); + BossVa_SetupZapperAttack(this, play); } } } -void BossVa_SetupZapperDeath(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperDeath(BossVa* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gBarinadeZapperIdleAnim); Animation_Change(&this->skelAnime, &gBarinadeZapperIdleAnim, Rand_ZeroOne() + 0.25f, Rand_ZeroOne() * 3.0f, @@ -2151,13 +2145,13 @@ void BossVa_SetupZapperDeath(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_ZapperDeath); } -void BossVa_ZapperDeath(BossVa* this, GlobalContext* globalCtx) { +void BossVa_ZapperDeath(BossVa* this, PlayState* play) { f32 sp3C = 55.0f; f32 tmpf1; f32 tmpf2; BossVa_AttachToBody(this); - if (((globalCtx->gameplayFrames % 32) == 0) && (sCsState <= DEATH_BODY_TUMORS)) { + if (((play->gameplayFrames % 32) == 0) && (sCsState <= DEATH_BODY_TUMORS)) { this->unk_1E8 = Rand_CenteredFloat(0x4000); this->unk_1EE = Rand_CenteredFloat(0x4000); this->unk_1F4 = (s16)Rand_CenteredFloat(0x4000) + this->actor.shape.rot.y - this->actor.shape.rot.x; @@ -2184,21 +2178,21 @@ void BossVa_ZapperDeath(BossVa* this, GlobalContext* globalCtx) { if ((this->timer2 % 2) == 0 && (this->timer2 >= 0)) { if (this->timer2 < 8) { - BossVa_Tumor(globalCtx, this, 1, (s16)Rand_CenteredFloat(5.0f) + 0xD, 0.0f, 0.0f, TUMOR_ARM, + BossVa_Tumor(play, this, 1, (s16)Rand_CenteredFloat(5.0f) + 0xD, 0.0f, 0.0f, TUMOR_ARM, 0.6f, true); } else { - BossVa_Tumor(globalCtx, this, 1, (s16)Rand_CenteredFloat(5.0f) + 6, 0.0f, 7.0f, TUMOR_ARM, + BossVa_Tumor(play, this, 1, (s16)Rand_CenteredFloat(5.0f) + 6, 0.0f, 7.0f, TUMOR_ARM, (this->timer2 >> 3) + 1, true); } - BossVa_Spark(globalCtx, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 3) + 1, true); + BossVa_Spark(play, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 3) + 1, true); } this->timer2++; if (this->timer2 >= 32) { this->burst++; this->isDead = true; - BossVa_SetDeathEnv(globalCtx); + BossVa_SetDeathEnv(play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_BREAK2); } } else { @@ -2229,7 +2223,7 @@ void BossVa_ZapperDeath(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupZapperEnraged(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperEnraged(BossVa* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gBarinadeZapperIdleAnim); Animation_Change(&this->skelAnime, &gBarinadeZapperIdleAnim, 1.0f, lastFrame - 1.0f, lastFrame, @@ -2238,8 +2232,8 @@ void BossVa_SetupZapperEnraged(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_ZapperEnraged); } -void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_ZapperEnraged(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 tmp16; s16 sp6C; @@ -2253,12 +2247,12 @@ void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); BossVa_AttachToBody(this); if (sFightPhase >= PHASE_DEATH) { - BossVa_SetupZapperDeath(this, globalCtx); + BossVa_SetupZapperDeath(this, play); return; } if (sBodyState & 0x7E) { - BossVa_SetupZapperDamaged(this, globalCtx); + BossVa_SetupZapperDamaged(this, play); return; } @@ -2316,7 +2310,7 @@ void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { if (this->colliderLightning.base.atFlags & AT_HIT) { if (this->timer2 > 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_HIT_RINK); - BossVa_SetSparkEnv(globalCtx); + BossVa_SetSparkEnv(play); this->timer2 = -1; GET_BODY(this)->onCeiling = 6; // not used by body } @@ -2325,7 +2319,7 @@ void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { } if ((this->timer2 < 0) && (player->stateFlags1 & PLAYER_STATE1_26)) { - BossVa_Spark(globalCtx, this, 1, 30, 0.0f, 0, SPARK_LINK, 0.0f, true); + BossVa_Spark(play, this, 1, 30, 0.0f, 0, SPARK_LINK, 0.0f, true); } } @@ -2344,20 +2338,20 @@ void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_THUNDER); } - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 5.0f, true); - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 6.0f, true); - BossVa_Spark(globalCtx, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 7.0f, true); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 5.0f, true); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 6.0f, true); + BossVa_Spark(play, this, 2, 110, 15.0f, 15.0f, SPARK_BLAST, 7.0f, true); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderLightning.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderLightning.base); } else { - BossVa_Spark(globalCtx, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 1) + 1, true); + BossVa_Spark(play, this, 2, 50, 15.0f, 0.0f, SPARK_BODY, (this->timer2 >> 1) + 1, true); if (this->timer2 == 14) { - BossVa_SetSparkEnv(globalCtx); + BossVa_SetSparkEnv(play); } if (this->timer2 == 4) { Vec3f sp48 = this->zapHeadPos; - BossVa_SpawnZapperCharge(globalCtx, sEffects, this, &sp48, &this->headRot, 100, 0); + BossVa_SpawnZapperCharge(play, sEffects, this, &sp48, &this->headRot, 100, 0); } } @@ -2368,14 +2362,14 @@ void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupZapperHold(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupZapperHold(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeZapperDamage2Anim, 0.0f, 0.0f, Animation_GetLastFrame(&gBarinadeZapperDamage2Anim), ANIMMODE_ONCE_INTERP, -6.0f); this->burst = false; BossVa_SetupAction(this, BossVa_ZapperHold); } -void BossVa_ZapperHold(BossVa* this, GlobalContext* globalCtx) { +void BossVa_ZapperHold(BossVa* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); BossVa_AttachToBody(this); Math_SmoothStepToS(&this->unk_1E6, 0, 1, 0x1770, 0); @@ -2385,11 +2379,11 @@ void BossVa_ZapperHold(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_1F2, this->actor.shape.rot.y - 0x4000, 1, 0x2710, 0); Math_SmoothStepToS(&this->unk_1F0, this->skelAnime.jointTable[7].z - 0x1388, 1, 0x1770, 0); if (GET_BODY(this)->actor.speedXZ == 0.0f) { - BossVa_SetupZapperAttack(this, globalCtx); + BossVa_SetupZapperAttack(this, play); } } -void BossVa_SetupBariIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBariIntro(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeBariAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBarinadeBariAnim), ANIMMODE_LOOP, 0.0f); this->unk_1A0 = 60.0f; @@ -2405,7 +2399,7 @@ void BossVa_SetupBariIntro(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_BariIntro); } -void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BariIntro(BossVa* this, PlayState* play) { Vec3f sp54 = this->actor.home.pos; f32 sp50 = 40.0f; s16 sp4E; @@ -2420,7 +2414,7 @@ void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx) { switch (sCsState) { case INTRO_LOOK_BARI: if (this->actor.params == BOSSVA_BARI_UPPER_1) { - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); if (Math_SmoothStepToF(&this->actor.world.pos.y, 60.0f, 0.3f, 1.0f, 0.15f) == 0.0f) { this->timer--; if (this->timer == 0) { @@ -2490,7 +2484,7 @@ void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx) { func_80035844(&GET_BODY(this)->actor.world.pos, &this->actor.world.pos, &this->actor.world.rot, false); this->unk_1A0 = Math_Vec3f_DistXYZ(&GET_BODY(this)->actor.world.pos, &this->actor.world.pos); if (sp50 > 30.0f) { - BossVa_Spark(globalCtx, this, 1, 80, 15.0f, 0.0f, SPARK_BARI, 1.0f, true); + BossVa_Spark(play, this, 1, 80, 15.0f, 0.0f, SPARK_BARI, 1.0f, true); } } break; @@ -2506,8 +2500,8 @@ void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx) { break; } - if (((globalCtx->gameplayFrames % 4) == 0) && (sCsState < INTRO_ATTACH_BARI)) { - BossVa_Spark(globalCtx, this, 1, 70, 25.0f, 20.0f, SPARK_BARI, 2.0f, true); + if (((play->gameplayFrames % 4) == 0) && (sCsState < INTRO_ATTACH_BARI)) { + BossVa_Spark(play, this, 1, 70, 25.0f, 20.0f, SPARK_BARI, 2.0f, true); } if (Rand_ZeroOne() < 0.1f) { @@ -2515,7 +2509,7 @@ void BossVa_BariIntro(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupBariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBariPhase3Attack(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeBariAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBarinadeBariAnim), ANIMMODE_LOOP, 0.0f); this->timer2 = 0x80; @@ -2526,8 +2520,8 @@ void BossVa_SetupBariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_BariPhase3Attack); } -void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_BariPhase3Attack(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnBoom* boomerang; Vec3f sp54 = GET_BODY(this)->unk_1D8; s16 sp52; @@ -2536,7 +2530,7 @@ void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { this->unk_1A4 += Rand_ZeroOne() * 0.5f; sp52 = this->timer2 & 0x1FF; - if ((globalCtx->gameplayFrames % 128) == 0) { + if ((play->gameplayFrames % 128) == 0) { this->vaBariUnused.x = (s16)(Rand_ZeroOne() * 100.0f) + 100; } @@ -2544,7 +2538,7 @@ void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { this->vaBariUnused.y += this->vaBariUnused.z; if ((this->colliderLightning.base.atFlags & AT_HIT) || (this->colliderSph.base.atFlags & AT_HIT)) { if ((this->colliderLightning.base.at == &player->actor) || (this->colliderSph.base.at == &player->actor)) { - func_8002F71C(globalCtx, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); this->colliderSph.base.at = NULL; this->colliderLightning.base.at = NULL; @@ -2579,16 +2573,16 @@ void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { } if (sp52 >= 128) { - BossVa_Spark(globalCtx, this, 1, 75, 15.0f, 7.0f, SPARK_TETHER, 1.0f, true); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + BossVa_Spark(play, this, 1, 75, 15.0f, 7.0f, SPARK_TETHER, 1.0f, true); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); sPhase3StopMoving = false; } else { sPhase3StopMoving = true; } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); - if ((globalCtx->gameplayFrames % 4) == 0) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderLightning.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); + if ((play->gameplayFrames % 4) == 0) { Math_SmoothStepToS(&this->unk_1F0, 0x78, 1, 0xA, 0); } @@ -2598,11 +2592,11 @@ void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { this->actor.world.rot.y += this->unk_1AC; if (sBodyState & 0x7F) { - BossVa_SetupBariPhase3Stunned(this, globalCtx); + BossVa_SetupBariPhase3Stunned(this, play); } } -void BossVa_SetupBariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBariPhase2Attack(BossVa* this, PlayState* play) { Animation_Change(&this->skelAnime, &gBarinadeBariAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBarinadeBariAnim), ANIMMODE_LOOP, 0.0f); this->timer2 = 0x40; @@ -2613,8 +2607,8 @@ void BossVa_SetupBariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_BariPhase2Attack); } -void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_BariPhase2Attack(BossVa* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnBoom* boomerang; Vec3f sp54 = GET_BODY(this)->unk_1D8; s16 sp52; @@ -2624,7 +2618,7 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { this->unk_1A4 += Rand_ZeroOne() * 0.5f; sp52 = this->timer2 & 0x1FF; - if ((globalCtx->gameplayFrames % 128) == 0) { + if ((play->gameplayFrames % 128) == 0) { this->vaBariUnused.x = (s16)(Rand_ZeroOne() * 100.0f) + 100; } @@ -2633,13 +2627,13 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { this->vaBariUnused.y += this->vaBariUnused.z; if (sKillBari != 0) { sKillBari--; - BossVa_KillBari(this, globalCtx); + BossVa_KillBari(this, play); return; } if ((this->colliderLightning.base.atFlags & AT_HIT) || (this->colliderSph.base.atFlags & AT_HIT)) { if ((this->colliderLightning.base.at == &player->actor) || (this->colliderSph.base.at == &player->actor)) { - func_8002F71C(globalCtx, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); this->colliderSph.base.at = NULL; this->colliderLightning.base.at = NULL; @@ -2651,14 +2645,14 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.world.pos.y, 4.0f, 1.0f, 2.0f, 0.0f); this->actor.world.rot.x = Math_Vec3f_Pitch(&sp54, &this->actor.world.pos); - if ((globalCtx->gameplayFrames % 8) == 0) { + if ((play->gameplayFrames % 8) == 0) { Math_SmoothStepToS(&this->unk_1F0, 0x28, 1, 0xA, 0); - BossVa_Spark(globalCtx, this, 1, this->unk_1F0, 25.0f, 20.0f, 2, 2.0f, true); + BossVa_Spark(play, this, 1, this->unk_1F0, 25.0f, 20.0f, 2, 2.0f, true); } if (!(sPhase2Timer & 0x100) && (GET_BODY(this)->actor.colorFilterTimer == 0)) { sp4C = 200.0f; - BossVa_Spark(globalCtx, this, 1, 125, 15.0f, 7.0f, SPARK_TETHER, 1.0f, true); + BossVa_Spark(play, this, 1, 125, 15.0f, 7.0f, SPARK_TETHER, 1.0f, true); this->actor.flags &= ~ACTOR_FLAG_0; if (this->actor.params & 1) { sp4C = -200.0f; @@ -2679,8 +2673,8 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { } } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderLightning.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderLightning.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); } else { this->actor.flags |= ACTOR_FLAG_0; Math_SmoothStepToS(&this->unk_1AC, sp50 + 150, 1, 0x3C, 0); @@ -2695,13 +2689,13 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { this->actor.world.pos.y += Math_SinF(this->unk_1A4) * 4.0f; if (this->colliderSph.base.acFlags & AC_HIT) { - BossVa_KillBari(this, globalCtx); + BossVa_KillBari(this, play); } } Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x5DC, 0); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); - if ((globalCtx->gameplayFrames % 4) == 0) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); + if ((play->gameplayFrames % 4) == 0) { Math_SmoothStepToS(&this->unk_1F0, 0x78, 1, 0xA, 0); } @@ -2721,30 +2715,30 @@ void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_SetupBariPhase3Stunned(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupBariPhase3Stunned(BossVa* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_0; this->timer = GET_BODY(this)->timer; Actor_SetColorFilter(&this->actor, 0, 255, 0x2000, this->timer); BossVa_SetupAction(this, BossVa_BariPhase3Stunned); } -void BossVa_BariPhase3Stunned(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BariPhase3Stunned(BossVa* this, PlayState* play) { s32 sp44_pad; Vec3f sp40 = GET_BODY(this)->unk_1D8; this->actor.world.rot.x = Math_Vec3f_Pitch(&GET_BODY(this)->actor.world.pos, &this->actor.world.pos); if (this->colliderSph.base.acFlags & AC_HIT) { - BossVa_KillBari(this, globalCtx); + BossVa_KillBari(this, play); return; } this->unk_1A4 += Rand_ZeroOne() * 0.5f; Math_SmoothStepToF(&this->actor.world.pos.y, 4.0f, 1.0f, 2.0f, 0.0f); this->actor.world.pos.y += Math_SinF(this->unk_1A4) * 3.0f; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); - if ((globalCtx->gameplayFrames % 4) == 0) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); + if ((play->gameplayFrames % 4) == 0) { Math_SmoothStepToS(&this->unk_1F0, 0x28, 1, 0xA, 0); - BossVa_Spark(globalCtx, this, 1, this->unk_1F0, 25.0f, 20.0f, SPARK_BARI, 2.0f, true); + BossVa_Spark(play, this, 1, this->unk_1F0, 25.0f, 20.0f, SPARK_BARI, 2.0f, true); } this->timer--; @@ -2753,7 +2747,7 @@ void BossVa_BariPhase3Stunned(BossVa* this, GlobalContext* globalCtx) { if (this->timer == 0) { this->timer2 = 0; } else { - BossVa_Spark(globalCtx, this, 1, 85, 15.0f, 0.0f, SPARK_TETHER, 1.0f, true); + BossVa_Spark(play, this, 1, 85, 15.0f, 0.0f, SPARK_TETHER, 1.0f, true); if (this->timer2 >= 0x10) { this->actor.flags &= ~ACTOR_FLAG_0; this->timer2 = 0x80; @@ -2771,14 +2765,14 @@ void BossVa_SetupBariDeath(BossVa* this) { BossVa_SetupAction(this, BossVa_BariDeath); } -void BossVa_BariDeath(BossVa* this, GlobalContext* globalCtx) { +void BossVa_BariDeath(BossVa* this, PlayState* play) { this->timer--; if (this->timer == 0) { Actor_Kill(&this->actor); } } -void BossVa_SetupDoor(BossVa* this, GlobalContext* globalCtx) { +void BossVa_SetupDoor(BossVa* this, PlayState* play) { if (sCsState >= INTRO_SPAWN_BARI) { sDoorState = 100; } @@ -2786,7 +2780,7 @@ void BossVa_SetupDoor(BossVa* this, GlobalContext* globalCtx) { BossVa_SetupAction(this, BossVa_Door); } -void BossVa_Door(BossVa* this, GlobalContext* globalCtx) { +void BossVa_Door(BossVa* this, PlayState* play) { if (sDoorState == 29) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_BUYODOOR_CLOSE); } @@ -2800,13 +2794,13 @@ void BossVa_Door(BossVa* this, GlobalContext* globalCtx) { } } -void BossVa_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BossVa_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BossVa* this = (BossVa*)thisx; EnBoom* boomerang; s32 i; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); switch (this->actor.params) { case BOSSVA_BODY: @@ -2818,25 +2812,25 @@ void BossVa_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - BossVa_UpdateEffects(globalCtx); + BossVa_UpdateEffects(play); for (i = 2; i >= 0; i--) { - if ((globalCtx->envCtx.adjAmbientColor[i] - 1) > 0) { - globalCtx->envCtx.adjAmbientColor[i] -= 1; + if ((play->envCtx.adjAmbientColor[i] - 1) > 0) { + play->envCtx.adjAmbientColor[i] -= 1; } else { - globalCtx->envCtx.adjAmbientColor[i] = 0; + play->envCtx.adjAmbientColor[i] = 0; } - if ((globalCtx->envCtx.adjLight1Color[i] - 10) > 0) { - globalCtx->envCtx.adjLight1Color[i] -= 10; + if ((play->envCtx.adjLight1Color[i] - 10) > 0) { + play->envCtx.adjLight1Color[i] -= 10; } else { - globalCtx->envCtx.adjLight1Color[i] = 0; + play->envCtx.adjLight1Color[i] = 0; } - if ((globalCtx->envCtx.adjFogColor[i] - 10) > 0) { - globalCtx->envCtx.adjFogColor[i] -= 10; + if ((play->envCtx.adjFogColor[i] - 10) > 0) { + play->envCtx.adjFogColor[i] -= 10; } else { - globalCtx->envCtx.adjFogColor[i] = 0; + play->envCtx.adjFogColor[i] = 0; } } @@ -2864,18 +2858,17 @@ void BossVa_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 BossVa_BodyOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossVa_BodyOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_va.c", 4156); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_va.c", 4156); if (limbIndex == 20) { gDPPipeSync(POLY_OPA_DISP++); - gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0, - (globalCtx->gameplayFrames * -2) % 64, 16, 16)); + gSPSegment( + POLY_OPA_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0, (play->gameplayFrames * -2) % 64, 16, 16)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->bodyGlow); Matrix_RotateX(-M_PI / 2, MTXMODE_APPLY); } else if ((limbIndex >= 10) && (limbIndex < 20)) { @@ -2889,16 +2882,16 @@ s32 BossVa_BodyOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d rot->x -= 0xCCC; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_va.c", 4183); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_va.c", 4183); return false; } -void BossVa_BodyPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossVa_BodyPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; Vec3f sp78 = { 0.0f, 0.0f, 0.0f }; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_va.c", 4192); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_va.c", 4192); if (limbIndex == 6) { if (sFightPhase < PHASE_3) { @@ -2909,11 +2902,11 @@ void BossVa_BodyPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis Matrix_MultVec3f(&sp78, &this->unk_1D8); } else if ((limbIndex >= 10) && (limbIndex < 20) && (sBodyBari[limbIndex - 10] != 0)) { if (((limbIndex >= 16) || (limbIndex == 10)) && (sFightPhase <= PHASE_3)) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_va.c", 4208), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_va.c", 4208), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_008BB8); } else if ((limbIndex >= 11) && (sFightPhase <= PHASE_2)) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_va.c", 4212), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_va.c", 4212), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_008BB8); } @@ -2926,13 +2919,13 @@ void BossVa_BodyPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis Matrix_MultVec3f(&sp78, &this->effectPos[limbIndex - 10]); } else if (limbIndex == 25) { gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (globalCtx->gameplayFrames * 10) % 128, 16, 32, 1, 0, - (globalCtx->gameplayFrames * 5) % 128, 16, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_va.c", 4232), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (play->gameplayFrames * 10) % 128, 16, 32, 1, 0, + (play->gameplayFrames * 5) % 128, 16, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_va.c", 4232), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_008D70); } else if ((*dList != NULL) && (limbIndex >= 29) && (limbIndex < 56)) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_va.c", 4236), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_va.c", 4236), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, *dList); } else if ((limbIndex == 24) && (sCsState < DEATH_START)) { @@ -2961,11 +2954,10 @@ void BossVa_BodyPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis Matrix_MultVec3f(&sp78, &this->unk_274); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_va.c", 4264); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_va.c", 4264); } -s32 BossVa_SupportOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossVa_SupportOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; if (!this->onCeiling && (limbIndex == 4)) { @@ -2974,7 +2966,7 @@ s32 BossVa_SupportOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx* return false; } -void BossVa_SupportPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossVa_SupportPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; Vec3f sp20 = { 0.0f, 0.0f, 0.0f }; s32 pad; @@ -3018,8 +3010,7 @@ void BossVa_SupportPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d } } -s32 BossVa_ZapperOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossVa_ZapperOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; MtxF zapperMtx; @@ -3048,7 +3039,7 @@ s32 BossVa_ZapperOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void BossVa_ZapperPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossVa_ZapperPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; Vec3f sp70 = { 0.0f, 0.0f, 0.0f }; Vec3f sp64 = { 15.0f, 0.0f, 0.0f }; @@ -3131,8 +3122,7 @@ void BossVa_ZapperPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL } } -s32 BossVa_BariOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 BossVa_BariOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; switch (limbIndex) { @@ -3149,29 +3139,29 @@ s32 BossVa_BariOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void BossVa_BariPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void BossVa_BariPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { BossVa* this = (BossVa*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_va.c", 4494); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_va.c", 4494); if (limbIndex == 2) { gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (globalCtx->gameplayFrames * 10) % 32, 16, 32, 1, 0, - (globalCtx->gameplayFrames * -5) % 32, 16, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_va.c", 4508), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (play->gameplayFrames * 10) % 32, 16, 32, 1, 0, + (play->gameplayFrames * -5) % 32, 16, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_va.c", 4508), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_000FA0); } else if ((limbIndex == 3) || (limbIndex == 4)) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_va.c", 4512), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_va.c", 4512), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, *dList); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_va.c", 4517); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_va.c", 4517); } -void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { - s16* paramsPtr; // This stack slot is almost certainly actually globalCtx2, but can't make it match +void BossVa_Draw(Actor* thisx, PlayState* play) { + s16* paramsPtr; // This stack slot is almost certainly actually play2, but can't make it match BossVa* this = (BossVa*)thisx; Vec3f spBC; Vec3f spB0 = { 0.0f, 45.0f, 0.0f }; @@ -3182,36 +3172,36 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { Vec3f sp74 = { -15.0f, 40.0f, 0.0f }; Color_RGBA8 unused = { 250, 250, 230, 200 }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_va.c", 4542); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_va.c", 4542); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); paramsPtr = &this->actor.params; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); switch (this->actor.params) { case BOSSVA_BODY: - if (globalCtx->envCtx.adjFogNear != 0) { - globalCtx->envCtx.adjFogNear += 0x15E; - if (globalCtx->envCtx.adjFogNear > 0) { - globalCtx->envCtx.adjFogNear = 0; + if (play->envCtx.adjFogNear != 0) { + play->envCtx.adjFogNear += 0x15E; + if (play->envCtx.adjFogNear > 0) { + play->envCtx.adjFogNear = 0; } } - if (globalCtx->envCtx.adjFogFar != 0) { - globalCtx->envCtx.adjFogFar += 0x15E; - if (globalCtx->envCtx.adjFogFar > 0) { - globalCtx->envCtx.adjFogFar = 0; + if (play->envCtx.adjFogFar != 0) { + play->envCtx.adjFogFar += 0x15E; + if (play->envCtx.adjFogFar > 0) { + play->envCtx.adjFogFar = 0; } } if (!this->isDead) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0, - (globalCtx->gameplayFrames * -10) % 16, 16, 16)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0, (play->gameplayFrames * -10) % 16, + 16, 16)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (globalCtx->gameplayFrames * -10) % 32, 16, - 0x20, 1, 0, (globalCtx->gameplayFrames * -5) % 32, 16, 32)); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (play->gameplayFrames * -10) % 32, 16, 0x20, 1, 0, + (play->gameplayFrames * -5) % 32, 16, 32)); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, BossVa_BodyOverrideLimbDraw, BossVa_BodyPostLimbDraw, this); } break; @@ -3219,7 +3209,7 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { case BOSSVA_SUPPORT_2: case BOSSVA_SUPPORT_3: if (!this->isDead) { - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossVa_SupportOverrideLimbDraw, BossVa_SupportPostLimbDraw, this); } @@ -3228,7 +3218,7 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { case BOSSVA_ZAPPER_2: case BOSSVA_ZAPPER_3: if (!this->isDead) { - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossVa_ZapperOverrideLimbDraw, BossVa_ZapperPostLimbDraw, this); } @@ -3236,12 +3226,12 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { case BOSSVA_STUMP_1: case BOSSVA_STUMP_2: case BOSSVA_STUMP_3: - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, NULL); break; default: if (!this->isDead) { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, BossVa_BariOverrideLimbDraw, BossVa_BariPostLimbDraw, this); Collider_UpdateSpheres(0, &this->colliderSph); if (sCsState < BOSSVA_BATTLE) { @@ -3267,13 +3257,13 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { spBC = this->actor.world.pos; spBC.y += 9.0f; if (this->actor.colorFilterTimer != 0) { - func_80026A6C(globalCtx); + func_80026A6C(play); } - func_80033C30(&spBC, &spA4, 0xFF, globalCtx); + func_80033C30(&spBC, &spA4, 0xFF, play); if (this->actor.colorFilterTimer != 0) { Color_RGBA8 blue = { 0, 0, 255, 255 }; - func_80026860(globalCtx, &blue, this->actor.colorFilterTimer, this->actor.colorFilterParams & 0xFF); + func_80026860(play, &blue, this->actor.colorFilterTimer, this->actor.colorFilterParams & 0xFF); } } break; @@ -3282,19 +3272,19 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (*paramsPtr == BOSSVA_BODY) { - BossVa_DrawEffects(sEffects, globalCtx); + BossVa_DrawEffects(sEffects, play); } else if (*paramsPtr == BOSSVA_DOOR) { - BossVa_DrawDoor(globalCtx, sDoorState); + BossVa_DrawDoor(play, sDoorState); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_va.c", 4673); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_va.c", 4673); } static s32 sUnkValue = 0x009B0000; // Unreferenced? Possibly a color -void BossVa_UpdateEffects(GlobalContext* globalCtx) { +void BossVa_UpdateEffects(PlayState* play) { BossVaEffect* effect = sEffects; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 spB6; s16 i; f32 floorY; @@ -3404,7 +3394,7 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { if (effect->mode < BLOOD_SPOT) { sp94 = effect->pos; sp94.y -= effect->velocity.y + 4.0f; - floorY = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp90, &sp94); + floorY = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp90, &sp94); if ((sp90 != NULL) && (effect->pos.y <= floorY)) { effect->mode = BLOOD_SPOT; effect->pos.y = floorY + 1.0f; @@ -3438,7 +3428,7 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { sp80 = effect->pos; sp80.y -= effect->velocity.y + 4.0f; effect->rot.x += 0x1770; - floorY = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp7C, &sp80); + floorY = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp7C, &sp80); if ((sp7C != NULL) && (effect->pos.y <= floorY)) { effect->mode = GORE_FLOOR; effect->timer = 30; @@ -3460,7 +3450,7 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { } else { Math_SmoothStepToF(&effect->scaleMod, 0.075f, 1.0f, 0.005f, 0.0f); Math_SmoothStepToF(&effect->vaGorePulseRate, 0.0f, 0.6f, 0.005f, 0.0013f); - if ((globalCtx->gameplayFrames % 4) == 0) { + if ((play->gameplayFrames % 4) == 0) { Math_SmoothStepToS(&effect->primColor[0], 95, 1, 1, 0); } } @@ -3482,8 +3472,8 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { if (effect->timer == 0) { yaw = Math_Vec3f_Yaw(&refActor->actor.world.pos, &effect->pos); effect->type = VA_NONE; - BossVa_BloodSplatter(globalCtx, effect, yaw, effect->scale * 4500.0f, 1); - BossVa_Gore(globalCtx, effect, yaw, effect->scale * 1.2f); + BossVa_BloodSplatter(play, effect, yaw, effect->scale * 4500.0f, 1); + BossVa_Gore(play, effect, yaw, effect->scale * 1.2f); } break; case TUMOR_BODY: @@ -3491,8 +3481,8 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { if (refActor->burst) { effect->type = VA_NONE; yaw = Math_Vec3f_Yaw(&refActor->actor.world.pos, &effect->pos); - BossVa_BloodSplatter(globalCtx, effect, yaw, effect->scale * 4500.0f, 1); - BossVa_Gore(globalCtx, effect, yaw, effect->scale * 1.2f); + BossVa_BloodSplatter(play, effect, yaw, effect->scale * 4500.0f, 1); + BossVa_Gore(play, effect, yaw, effect->scale * 1.2f); } break; } @@ -3502,23 +3492,23 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) { } } -void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { +void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play) { static void* sSparkBallTex[] = { gBarinadeSparkBall1Tex, gBarinadeSparkBall2Tex, gBarinadeSparkBall3Tex, gBarinadeSparkBall4Tex, gBarinadeSparkBall5Tex, gBarinadeSparkBall6Tex, gBarinadeSparkBall7Tex, gBarinadeSparkBall8Tex, }; s16 i; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 materialFlag = 0; BossVaEffect* effectHead = effect; - Camera* subCam = Play_GetCamera(globalCtx, sSubCamId); + Camera* subCam = Play_GetCamera(play, sSubCamId); OPEN_DISPS(gfxCtx, "../z_boss_va.c", 4953); for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) { if (effect->type == VA_LARGE_SPARK) { if (materialFlag == 0) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 130, 130, 30, 0); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_0156A0); materialFlag++; @@ -3526,7 +3516,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 230, 230, 230, effect->primColor[3]); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ((effect->rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); Matrix_Scale(effect->scale * 0.0185f, effect->scale * 0.0185f, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_va.c", 4976), @@ -3539,12 +3529,12 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) { if (effect->type == VA_SPARK_BALL) { if (materialFlag == 0) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_011738); materialFlag++; } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); Matrix_RotateZ((effect->rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); @@ -3565,7 +3555,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) { if (effect->type == VA_BLOOD) { if (materialFlag == 0) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_009430); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gEffBubble1Tex)); materialFlag++; @@ -3579,7 +3569,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { if (effect->mode == BLOOD_SPOT) { Matrix_RotateX(M_PI / 2, MTXMODE_APPLY); } else { - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); } Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); @@ -3597,7 +3587,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { BossVa* parent = effect->parent; if (materialFlag == 0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, effect->envColor[3]); gSPDisplayList(POLY_OPA_DISP++, gBarinadeDL_0128B8); materialFlag++; @@ -3619,7 +3609,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) { if (effect->type == VA_GORE) { if (materialFlag == 0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gBarinadeDL_012BA0); materialFlag++; } @@ -3650,7 +3640,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) { if (effect->type == VA_ZAP_CHARGE) { if (materialFlag == 0) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_0135B0); materialFlag++; } @@ -3673,7 +3663,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) { if (effect->type == VA_BLAST_SPARK) { if (materialFlag == 0) { - func_80093C14(globalCtx->state.gfxCtx); + func_80093C14(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 130, 130, 30, 0); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_0156A0); materialFlag++; @@ -3681,7 +3671,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 230, 230, 230, effect->primColor[3]); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ((effect->rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); Matrix_Scale(effect->scale * 0.02f, effect->scale * 0.02f, 1.0f, MTXMODE_APPLY); @@ -3695,7 +3685,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) { if (effect->type == VA_SMALL_SPARK) { if (materialFlag == 0) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 100, 0); gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_008F08); materialFlag++; @@ -3716,9 +3706,8 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_boss_va.c", 5215); } -void BossVa_SpawnSpark(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, - u8 mode) { - Player* player = GET_PLAYER(globalCtx); +void BossVa_SpawnSpark(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode) { + Player* player = GET_PLAYER(play); s16 index; Vec3f pos = { 0.0f, -1000.0f, 0.0f }; Vec3f tempVec; @@ -3776,8 +3765,7 @@ void BossVa_SpawnSpark(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* t } } -void BossVa_SpawnSparkBall(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, - u8 mode) { +void BossVa_SpawnSparkBall(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode) { Vec3f pos = { 0.0f, -1000.0f, 0.0f }; s16 i; @@ -3807,8 +3795,7 @@ void BossVa_SpawnSparkBall(GlobalContext* globalCtx, BossVaEffect* effect, BossV } } -void BossVa_SpawnBloodDroplets(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 scale, s16 phase, - s16 yaw) { +void BossVa_SpawnBloodDroplets(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 scale, s16 phase, s16 yaw) { s32 i; Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -3838,7 +3825,7 @@ void BossVa_SpawnBloodDroplets(GlobalContext* globalCtx, BossVaEffect* effect, V } } -void BossVa_SpawnBloodSplatter(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale) { +void BossVa_SpawnBloodSplatter(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale) { s32 i; f32 xzVel; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -3873,8 +3860,7 @@ void BossVa_SpawnBloodSplatter(GlobalContext* globalCtx, BossVaEffect* effect, V } } -void BossVa_SpawnTumor(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, - u8 mode) { +void BossVa_SpawnTumor(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode) { Vec3f pos = { 0.0f, -1000.0f, 0.0f }; s16 i; @@ -3907,7 +3893,7 @@ void BossVa_SpawnTumor(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* t } } -void BossVa_SpawnGore(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale) { +void BossVa_SpawnGore(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 yaw, s16 scale) { s32 i; f32 xzVel; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -3950,8 +3936,8 @@ void BossVa_SpawnGore(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos } } -void BossVa_SpawnZapperCharge(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* pos, Vec3s* rot, - s16 scale, u8 mode) { +void BossVa_SpawnZapperCharge(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3f* pos, Vec3s* rot, s16 scale, + u8 mode) { Vec3f unused = { 0.0f, -1000.0f, 0.0f }; s16 i; @@ -3974,7 +3960,7 @@ void BossVa_SpawnZapperCharge(GlobalContext* globalCtx, BossVaEffect* effect, Bo } } -void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { +void BossVa_DrawDoor(PlayState* play, s16 scale) { static Gfx* doorPieceDispList[] = { gBarinadeDoorPiece1DL, gBarinadeDoorPiece2DL, gBarinadeDoorPiece3DL, gBarinadeDoorPiece4DL, gBarinadeDoorPiece5DL, gBarinadeDoorPiece6DL, gBarinadeDoorPiece7DL, gBarinadeDoorPiece8DL, @@ -3985,7 +3971,7 @@ void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { f32 segAngle = 0.0f; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_va.c", 5600); + OPEN_DISPS(play->state.gfxCtx, "../z_boss_va.c", 5600); Matrix_Translate(0.0f, 80.0f, 400.0f, MTXMODE_NEW); Matrix_RotateY(M_PI, MTXMODE_APPLY); @@ -4005,10 +3991,10 @@ void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { Matrix_RotateZ(segAngle, MTXMODE_APPLY); Matrix_Translate(0.0f, doorPieceLength[i] * yScale, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_va.c", 5621), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_va.c", 5621), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, doorPieceDispList[i]); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_va.c", 5629); + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_va.c", 5629); } diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.h b/src/overlays/actors/ovl_Boss_Va/z_boss_va.h index 5d5b1b4338..3b5a1ab826 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.h +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.h @@ -6,7 +6,7 @@ struct BossVa; -typedef void (*BossVaActionFunc)(struct BossVa*, GlobalContext*); +typedef void (*BossVaActionFunc)(struct BossVa*, PlayState*); typedef struct BossVa { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index f5391ad915..e7aae3f943 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -13,29 +13,29 @@ #define FLAGS ACTOR_FLAG_4 -void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx); -void Demo6K_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Demo6K_Update(Actor* thisx, GlobalContext* globalCtx); +void Demo6K_Init(Actor* thisx, PlayState* play); +void Demo6K_Destroy(Actor* thisx, PlayState* play); +void Demo6K_Update(Actor* thisx, PlayState* play); -void func_80966DB0(Demo6K* this, GlobalContext* globalCtx); -void func_80966E04(Demo6K* this, GlobalContext* globalCtx); -void func_80966E98(Demo6K* this, GlobalContext* globalCtx); -void func_80966F84(Demo6K* this, GlobalContext* globalCtx); -void func_8096712C(Demo6K* this, GlobalContext* globalCtx); -void func_80967410(Demo6K* this, GlobalContext* globalCtx); -void func_809674E0(Demo6K* this, GlobalContext* globalCtx); -void func_8096784C(Demo6K* this, GlobalContext* globalCtx); +void func_80966DB0(Demo6K* this, PlayState* play); +void func_80966E04(Demo6K* this, PlayState* play); +void func_80966E98(Demo6K* this, PlayState* play); +void func_80966F84(Demo6K* this, PlayState* play); +void func_8096712C(Demo6K* this, PlayState* play); +void func_80967410(Demo6K* this, PlayState* play); +void func_809674E0(Demo6K* this, PlayState* play); +void func_8096784C(Demo6K* this, PlayState* play); void func_80967A04(Demo6K* this, s32 i); -void func_80967AD0(Demo6K* this, GlobalContext* globalCtx); -void func_80967DBC(Demo6K* this, GlobalContext* globalCtx); -void func_80967F10(Demo6K* this, GlobalContext* globalCtx); -void func_80967FFC(Actor* thisx, GlobalContext* globalCtx); -void func_80968298(Actor* thisx, GlobalContext* globalCtx); -void func_8096865C(Actor* thisx, GlobalContext* globalCtx); -void func_809688C4(Actor* thisx, GlobalContext* globalCtx); -void func_80968B70(Actor* thisx, GlobalContext* globalCtx); -void func_80968FB0(Actor* thisx, GlobalContext* globalCtx); -void func_809691BC(Demo6K* this, GlobalContext* globalCtx, s32 params); +void func_80967AD0(Demo6K* this, PlayState* play); +void func_80967DBC(Demo6K* this, PlayState* play); +void func_80967F10(Demo6K* this, PlayState* play); +void func_80967FFC(Actor* thisx, PlayState* play); +void func_80968298(Actor* thisx, PlayState* play); +void func_8096865C(Actor* thisx, PlayState* play); +void func_809688C4(Actor* thisx, PlayState* play); +void func_80968B70(Actor* thisx, PlayState* play); +void func_80968FB0(Actor* thisx, PlayState* play); +void func_809691BC(Demo6K* this, PlayState* play, s32 params); const ActorInit Demo_6K_InitVars = { ACTOR_DEMO_6K, @@ -65,7 +65,7 @@ void Demo6K_SetupAction(Demo6K* this, Demo6KActionFunc actionFunc) { this->actionFunc = actionFunc; } -void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx) { +void Demo6K_Init(Actor* thisx, PlayState* play) { Demo6K* this = (Demo6K*)thisx; s32 pad; s32 params = this->actor.params; @@ -75,7 +75,7 @@ void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("no = %d\n", params); if (sObjectIds[params] != OBJECT_GAMEPLAY_KEEP) { - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[params]); + objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[params]); } else { objBankIndex = 0; } @@ -148,7 +148,7 @@ void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.0f); this->initActionFunc = func_80967F10; this->drawFunc = func_80968B70; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION); break; case 13: Actor_SetScale(&this->actor, 0.14f); @@ -188,52 +188,52 @@ void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx) { Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 255, 100); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); } -void Demo6K_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void Demo6K_Destroy(Actor* thisx, PlayState* play) { Demo6K* this = (Demo6K*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void func_80966DB0(Demo6K* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { +void func_80966DB0(Demo6K* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.objBankIndex = this->objBankIndex; this->actor.draw = this->drawFunc; this->actionFunc = this->initActionFunc; } } -void func_80966E04(Demo6K* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames > 214) { +void func_80966E04(Demo6K* this, PlayState* play) { + if (play->csCtx.frames > 214) { func_8002F948(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } - if (globalCtx->csCtx.frames > 264) { + if (play->csCtx.frames > 264) { func_8002F948(&this->actor, NA_SE_EV_GOD_LIGHTBALL_2 - SFX_FLAG); } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[6] != NULL) && - (globalCtx->csCtx.npcActions[6]->action == 2)) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[6] != NULL) && + (play->csCtx.npcActions[6]->action == 2)) { Demo6K_SetupAction(this, func_80966E98); } } -void func_80966E98(Demo6K* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames < 353) { +void func_80966E98(Demo6K* this, PlayState* play) { + if (play->csCtx.frames < 353) { func_8002F948(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); func_8002F948(&this->actor, NA_SE_EV_GOD_LIGHTBALL_2 - SFX_FLAG); } - if (globalCtx->csCtx.frames == 342) { + if (play->csCtx.frames == 342) { func_800F3F3C(2); } if (this->timer1 == 39) { func_800788CC(NA_SE_EV_CONSENTRATION); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, - this->actor.world.pos.y + 10.0f, this->actor.world.pos.z, 0, 0, 0, 2); + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_6K, this->actor.world.pos.x, this->actor.world.pos.y + 10.0f, + this->actor.world.pos.z, 0, 0, 0, 2); } if (this->timer1 == 64) { @@ -243,7 +243,7 @@ void func_80966E98(Demo6K* this, GlobalContext* globalCtx) { this->timer1++; } -void func_80966F84(Demo6K* this, GlobalContext* globalCtx) { +void func_80966F84(Demo6K* this, PlayState* play) { if (this->timer1 < 5) { this->unk_168 = D_8096930C[this->timer1 & 3]; } else if (this->timer1 < 15) { @@ -253,7 +253,7 @@ void func_80966F84(Demo6K* this, GlobalContext* globalCtx) { this->unk_168 = 1.0f; } else { if (this->timer1 == 15) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EFF_DUST, this->actor.world.pos.x, + 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, 0, 0, EFF_DUST_TYPE_1); } Math_StepToF(&this->unk_16C, 1.0f, 0.02f); @@ -263,7 +263,7 @@ void func_80966F84(Demo6K* this, GlobalContext* globalCtx) { this->timer1++; } -void func_809670AC(Demo6K* this, GlobalContext* globalCtx) { +void func_809670AC(Demo6K* this, PlayState* play) { this->timer2++; if (this->timer1 < 10) { @@ -276,9 +276,9 @@ void func_809670AC(Demo6K* this, GlobalContext* globalCtx) { } } -void func_8096712C(Demo6K* this, GlobalContext* globalCtx) { +void func_8096712C(Demo6K* this, PlayState* play) { static u16 D_8096932C[] = { 275, 275, 275, 275, 275, 275 }; - u32 frames = globalCtx->state.frames; + u32 frames = play->state.frames; if (this->actor.scale.x < 0.1f) { this->actor.scale.x += 0.0017f; @@ -288,8 +288,8 @@ void func_8096712C(Demo6K* this, GlobalContext* globalCtx) { this->actor.scale.x = 0.1f; } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[6] != NULL) && - (globalCtx->csCtx.npcActions[6]->action == 2)) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[6] != NULL) && + (play->csCtx.npcActions[6]->action == 2)) { Demo6K_SetupAction(this, func_809670AC); this->timer1 = 0; this->actor.scale.x = 0.1f; @@ -299,12 +299,12 @@ void func_8096712C(Demo6K* this, GlobalContext* globalCtx) { this->timer2++; - if ((globalCtx->sceneNum == SCENE_GANONTIKA) && (globalCtx->csCtx.frames < D_8096932C[this->actor.params - 3])) { + if ((play->sceneNum == SCENE_GANONTIKA) && (play->csCtx.frames < D_8096932C[this->actor.params - 3])) { func_8002F974(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } } -void func_80967244(Demo6K* this, GlobalContext* globalCtx) { +void func_80967244(Demo6K* this, PlayState* play) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; @@ -331,30 +331,30 @@ void func_80967244(Demo6K* this, GlobalContext* globalCtx) { envColor.g = sEnvColors[this->unk_293].g; envColor.b = sEnvColors[this->unk_293].b; - if (globalCtx->sceneNum == SCENE_TOKINOMA) { + if (play->sceneNum == SCENE_TOKINOMA) { scale = 6000; - } else if (globalCtx->csCtx.frames < 419) { + } else if (play->csCtx.frames < 419) { scale = 6000; } else { scale = 18000; } - EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, scale, 20); + EffectSsKiraKira_SpawnFocused(play, &pos, &velocity, &accel, &primColor, &envColor, scale, 20); } -void func_80967410(Demo6K* this, GlobalContext* globalCtx) { +void func_80967410(Demo6K* this, PlayState* play) { s32 params = this->actor.params - 14; this->timer2++; Actor_SetScale(&this->actor, 0.2f); - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[params] != NULL)) { - func_809691BC(this, globalCtx, params); + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[params] != NULL)) { + func_809691BC(this, play, params); - if (globalCtx->csCtx.npcActions[params]->action == 3) { + if (play->csCtx.npcActions[params]->action == 3) { this->flags &= ~1; - func_80967244(this, globalCtx); + func_80967244(this, play); } else { this->flags |= 1; } @@ -363,8 +363,8 @@ void func_80967410(Demo6K* this, GlobalContext* globalCtx) { } } -void func_809674E0(Demo6K* this, GlobalContext* globalCtx) { - u32 frames = globalCtx->state.frames; +void func_809674E0(Demo6K* this, PlayState* play) { + u32 frames = play->state.frames; if (this->actor.scale.x < 0.05f) { this->actor.scale.x += 0.005f; @@ -396,7 +396,7 @@ void func_809674E0(Demo6K* this, GlobalContext* globalCtx) { sEnvColors[this->unk_293].b, this->actor.scale.x * 4000.0f); } -void func_809676A4(Demo6K* this, GlobalContext* globalCtx) { +void func_809676A4(Demo6K* this, PlayState* play) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; @@ -416,12 +416,12 @@ void func_809676A4(Demo6K* this, GlobalContext* globalCtx) { accel.y = 0.0f; - EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 500, 20); + EffectSsKiraKira_SpawnFocused(play, &pos, &velocity, &accel, &primColor, &envColor, 500, 20); } } -void func_8096784C(Demo6K* this, GlobalContext* globalCtx) { - u32 frames = globalCtx->state.frames; +void func_8096784C(Demo6K* this, PlayState* play) { + u32 frames = play->state.frames; this->timer2++; @@ -438,7 +438,7 @@ void func_8096784C(Demo6K* this, GlobalContext* globalCtx) { this->actor.scale.x -= 0.0015f; - func_809676A4(this, globalCtx); + func_809676A4(this, play); } else if (frames & 1) { this->actor.scale.x = 0.033f; } else { @@ -459,16 +459,16 @@ void func_80967A04(Demo6K* this, s32 i) { this->unk_234[i] = Rand_ZeroFloat(0.02f) + 0.01f; } -void func_80967AD0(Demo6K* this, GlobalContext* globalCtx) { +void func_80967AD0(Demo6K* this, PlayState* play) { s32 i; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[1] != NULL)) { - if (globalCtx->csCtx.npcActions[1]->action == 2) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[1] != NULL)) { + if (play->csCtx.npcActions[1]->action == 2) { this->unk_170++; func_8002F948(&this->actor, NA_SE_EV_RAINBOW_SHOWER - SFX_FLAG); } - func_809691BC(this, globalCtx, 1); + func_809691BC(this, play, 1); } for (i = 0; (i < (s32)this->unk_170) && (i < 16); i++) { @@ -481,7 +481,7 @@ void func_80967AD0(Demo6K* this, GlobalContext* globalCtx) { this->timer1++; } -void func_80967BF8(Player* player, GlobalContext* globalCtx) { +void func_80967BF8(Player* player, PlayState* play) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; @@ -500,12 +500,12 @@ void func_80967BF8(Player* player, GlobalContext* globalCtx) { accel.y = 0.0f; - EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 1000, + EffectSsKiraKira_SpawnFocused(play, &pos, &velocity, &accel, &primColor, &envColor, 1000, (s32)Rand_ZeroFloat(60.0f) + 60); } } -void func_80967DBC(Demo6K* this, GlobalContext* globalCtx) { +void func_80967DBC(Demo6K* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_ATTACK_DEMO - SFX_FLAG); this->timer2++; @@ -518,9 +518,9 @@ void func_80967DBC(Demo6K* this, GlobalContext* globalCtx) { } if (this->timer2 > 104) { - func_80967BF8(GET_PLAYER(globalCtx), globalCtx); + func_80967BF8(GET_PLAYER(play), play); Actor_Kill(&this->actor); - Audio_PlayActorSound2(&GET_PLAYER(globalCtx)->actor, NA_SE_EN_FANTOM_HIT_THUNDER); + Audio_PlayActorSound2(&GET_PLAYER(play)->actor, NA_SE_EN_FANTOM_HIT_THUNDER); } else if (this->timer2 > 94) { Actor_SetScale(&this->actor, this->actor.scale.x + 0.03f); @@ -535,9 +535,9 @@ void func_80967DBC(Demo6K* this, GlobalContext* globalCtx) { } } -void func_80967F10(Demo6K* this, GlobalContext* globalCtx) { +void func_80967F10(Demo6K* this, PlayState* play) { if (this->timer2 == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_6K, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 13); } @@ -550,23 +550,23 @@ void func_80967F10(Demo6K* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.05f - (this->timer2 * 0.00075f)); } -void Demo6K_Update(Actor* thisx, GlobalContext* globalCtx) { +void Demo6K_Update(Actor* thisx, PlayState* play) { Demo6K* this = (Demo6K*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { +void func_80967FFC(Actor* thisx, PlayState* play) { Demo6K* this = (Demo6K*)thisx; s32 pad; u16 timer1 = this->timer1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1070); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1070); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_RotateX(-M_PI / 2, MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0x7FFF - ((timer1 * 8) & 0x7FFF), 16, 512, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0x7FFF - ((timer1 * 8) & 0x7FFF), 16, 512, 1, 0, 0x7FFF - ((timer1 * 8) & 0x7FFF), 16, 32)); { @@ -582,7 +582,7 @@ void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 6; i++) { Matrix_RotateZ(M_PI / 3, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1115), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_6k.c", 1115), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, colors[i][0].r, colors[i][0].g, colors[i][0].b, 255); @@ -594,10 +594,10 @@ void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { if ((s16)i) {} } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1127); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1127); } -void func_80968298(Actor* thisx, GlobalContext* globalCtx) { +void func_80968298(Actor* thisx, PlayState* play) { static u8 skipIndices[] = { 6, 7, 11, 16, 20, 24, 28, 33, 35, 41, 45, 50, 57, 58, 62, 255 }; Demo6K* this = (Demo6K*)thisx; s32 pad; @@ -608,7 +608,7 @@ void func_80968298(Actor* thisx, GlobalContext* globalCtx) { s32 i2; u8 alpha; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1145); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1145); alpha = (s32)(this->unk_170 * 255.0f); POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP); @@ -616,7 +616,7 @@ void func_80968298(Actor* thisx, GlobalContext* globalCtx) { gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE); gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); gDPFillRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); alpha = (s32)(this->unk_16C * 255.0f); for (i2 = 0, i = 0; i < 63; i++) { @@ -628,31 +628,31 @@ void func_80968298(Actor* thisx, GlobalContext* globalCtx) { } Matrix_RotateX(-M_PI / 2, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1170), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_6k.c", 1170), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 210, 210, 210, 255); gDPSetEnvColor(POLY_XLU_DISP++, 100, 100, 100, 255); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (0xFFF - (timer1 * 6)) & 0xFFF, (timer1 * 12) & 0xFFF, 128, - 64, 1, (0xFFF - (timer1 * 6)) & 0xFFF, (timer1 * 12) & 0xFFF, 64, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (0xFFF - (timer1 * 6)) & 0xFFF, (timer1 * 12) & 0xFFF, 128, 64, + 1, (0xFFF - (timer1 * 6)) & 0xFFF, (timer1 * 12) & 0xFFF, 64, 32)); gSPDisplayList(POLY_XLU_DISP++, object_demo_6k_DL_0039D0); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1189), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_6k.c", 1189), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 50, 50, 50, 255); gSPDisplayList(POLY_XLU_DISP++, object_demo_6k_DL_001040); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1198); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1198); } -void func_8096865C(Actor* thisx, GlobalContext* globalCtx) { +void func_8096865C(Actor* thisx, PlayState* play) { Demo6K* this = (Demo6K*)thisx; s32 pad; Gfx* displayList; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1208); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1208); if (!(this->flags & 1)) { if (this->actor.params > 8) { @@ -661,39 +661,39 @@ void func_8096865C(Actor* thisx, GlobalContext* globalCtx) { displayList = gEffFlash2DL; } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, sEnvColors[this->unk_293].r, sEnvColors[this->unk_293].g, sEnvColors[this->unk_293].b, 255); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_Push(); Matrix_RotateZ(DEG_TO_RAD(this->timer2 * 6), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1230), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_6k.c", 1230), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, displayList); Matrix_Pop(); Matrix_RotateZ(DEG_TO_RAD(-(f32)(this->timer2 * 6)), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1236), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_6k.c", 1236), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, displayList); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1242); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1242); } -void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { +void func_809688C4(Actor* thisx, PlayState* play2) { Demo6K* this = (Demo6K*)thisx; - GlobalContext* globalCtx = globalCtx2; - u32 frames = globalCtx->state.frames; + PlayState* play = play2; + u32 frames = play->state.frames; s32 i; - if ((i = (globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[1] != NULL)) && - (globalCtx->csCtx.npcActions[1]->action != 1)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1277); + if ((i = (play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[1] != NULL)) && + (play->csCtx.npcActions[1]->action != 1)) { + OPEN_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1277); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, 255); - Matrix_RotateY(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000)), MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000)), MTXMODE_APPLY); for (i = 0; i < 16; i++) { gDPPipeSync(POLY_XLU_DISP++); @@ -704,8 +704,8 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(this->unk_234[i] * D_8096931C[(frames + i) & 3], this->unk_234[i] * D_8096931C[(frames + i) & 3], this->unk_234[i] * D_8096931C[(frames + i) & 3], MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1297), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_6k.c", 1297), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); Matrix_Pop(); @@ -713,11 +713,11 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1305); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1305); } } -void func_80968B70(Actor* thisx, GlobalContext* globalCtx) { +void func_80968B70(Actor* thisx, PlayState* play) { s32 pad; Demo6K* this = (Demo6K*)thisx; u32 timer2 = this->timer2; @@ -726,15 +726,15 @@ void func_80968B70(Actor* thisx, GlobalContext* globalCtx) { if (1) {} - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1316); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1316); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_80093D84(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1322), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_6k.c", 1322), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0xFF - ((timer2 * 2) & 0xFF), 0, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0xFF - ((timer2 * 2) & 0xFF), 0, 32, 32, 1, 0xFF - ((timer2 * 2) & 0xFF), (timer2 * 15) & 0x3FF, 16, 64)); if (this->timer2 < 40) { @@ -763,26 +763,26 @@ void func_80968B70(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, envColor[0], envColor[1], envColor[2], 128); gSPDisplayList(POLY_XLU_DISP++, object_gnd_magic_DL_001190); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1368); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1368); } -void func_80968FB0(Actor* thisx, GlobalContext* globalCtx) { +void func_80968FB0(Actor* thisx, PlayState* play) { static u8 D_809693CC[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1 }; Demo6K* this = (Demo6K*)thisx; - Gfx* displayList = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Gfx)); - u16 frames = globalCtx->gameplayFrames; + Gfx* displayList = Graph_Alloc(play->state.gfxCtx, 4 * sizeof(Gfx)); + u16 frames = play->gameplayFrames; f32 scaleFactor; s32 pad; if (1) {} - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1386); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1386); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); scaleFactor = ((s16)D_809693CC[(frames * 4) & 0xF] * 0.01f) + 1.0f; Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1394), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_6k.c", 1394), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, displayList); gDPPipeSync(displayList++); @@ -792,14 +792,14 @@ void func_80968FB0(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 255); gSPDisplayList(POLY_XLU_DISP++, gGlowCircleSmallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1411); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1411); } -void func_809691BC(Demo6K* this, GlobalContext* globalCtx, s32 params) { +void func_809691BC(Demo6K* this, PlayState* play, s32 params) { Vec3f startPos; Vec3f endPos; f32 temp; - CsCmdActorAction* csAction = globalCtx->csCtx.npcActions[params]; + CsCmdActorAction* csAction = play->csCtx.npcActions[params]; startPos.x = csAction->startPos.x; startPos.y = csAction->startPos.y; @@ -809,7 +809,7 @@ void func_809691BC(Demo6K* this, GlobalContext* globalCtx, s32 params) { endPos.y = csAction->endPos.y; endPos.z = csAction->endPos.z; - temp = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, globalCtx->csCtx.frames); + temp = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, play->csCtx.frames); this->actor.world.pos.x = (((endPos.x - startPos.x) * temp) + startPos.x); this->actor.world.pos.y = (((endPos.y - startPos.y) * temp) + startPos.y); diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h index f144bb9f86..5d6a5367a0 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h @@ -6,7 +6,7 @@ struct Demo6K; -typedef void (*Demo6KActionFunc)(struct Demo6K*, GlobalContext*); +typedef void (*Demo6KActionFunc)(struct Demo6K*, PlayState*); typedef struct Demo6K { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c index bbd51e027a..1dc5011405 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -6,13 +6,13 @@ #define FLAGS ACTOR_FLAG_4 -typedef void (*DemoDuActionFunc)(DemoDu*, GlobalContext*); -typedef void (*DemoDuDrawFunc)(Actor*, GlobalContext*); +typedef void (*DemoDuActionFunc)(DemoDu*, PlayState*); +typedef void (*DemoDuDrawFunc)(Actor*, PlayState*); -void DemoDu_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoDu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoDu_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoDu_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoDu_Init(Actor* thisx, PlayState* play); +void DemoDu_Destroy(Actor* thisx, PlayState* play); +void DemoDu_Update(Actor* thisx, PlayState* play); +void DemoDu_Draw(Actor* thisx, PlayState* play); static s32 sUnused = 0; @@ -38,10 +38,10 @@ static void* sMouthTextures[] = { gDaruniaMouthSeriousTex, gDaruniaMouthGrinning #define CS_CHAMBERAFTERGANON_SUBSCENE(x) (21 + (x)) // DEMO_DU_CS_CHAMBER_AFTER_GANON #define CS_CREDITS_SUBSCENE(x) (24 + (x)) // DEMO_DU_CS_CREDITS -void DemoDu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoDu_Destroy(Actor* thisx, PlayState* play) { DemoDu* this = (DemoDu*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } void DemoDu_UpdateEyes(DemoDu* this) { @@ -77,10 +77,10 @@ void DemoDu_CsAfterGanon_Reset(DemoDu* this) { this->unk_1A4 = 0.0f; } -void DemoDu_CsAfterGanon_CheckIfShouldReset(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsAfterGanon_CheckIfShouldReset(DemoDu* this, PlayState* play) { static s32 D_8096CE94 = false; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (D_8096CE94) { if (this->actor.params == DEMO_DU_CS_CHAMBER_AFTER_GANON) { DemoDu_CsAfterGanon_Reset(this); @@ -97,20 +97,19 @@ s32 DemoDu_UpdateSkelAnime(DemoDu* this) { return SkelAnime_Update(&this->skelAnime); } -void DemoDu_UpdateBgCheckInfo(DemoDu* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); +void DemoDu_UpdateBgCheckInfo(DemoDu* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } -CsCmdActorAction* DemoDu_GetNpcAction(GlobalContext* globalCtx, s32 idx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[idx]; +CsCmdActorAction* DemoDu_GetNpcAction(PlayState* play, s32 idx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[idx]; } return NULL; } -s32 DemoDu_IsNpcDoingThisAction(DemoDu* this, GlobalContext* globalCtx, u16 action, s32 idx) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(globalCtx, idx); +s32 DemoDu_IsNpcDoingThisAction(DemoDu* this, PlayState* play, u16 action, s32 idx) { + CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, idx); if ((npcAction != NULL) && (npcAction->action == action)) { return true; @@ -118,8 +117,8 @@ s32 DemoDu_IsNpcDoingThisAction(DemoDu* this, GlobalContext* globalCtx, u16 acti return false; } -s32 DemoDu_IsNpcNotDoingThisAction(DemoDu* this, GlobalContext* globalCtx, u16 action, s32 idx) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(globalCtx, idx); +s32 DemoDu_IsNpcNotDoingThisAction(DemoDu* this, PlayState* play, u16 action, s32 idx) { + CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, idx); if ((npcAction != NULL) && (npcAction->action != action)) { return true; @@ -127,8 +126,8 @@ s32 DemoDu_IsNpcNotDoingThisAction(DemoDu* this, GlobalContext* globalCtx, u16 a return false; } -void DemoDu_MoveToNpcPos(DemoDu* this, GlobalContext* globalCtx, s32 idx) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(globalCtx, idx); +void DemoDu_MoveToNpcPos(DemoDu* this, PlayState* play, s32 idx) { + CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, idx); s32 pad; if (npcAction != NULL) { @@ -158,63 +157,62 @@ void func_80969DDC(DemoDu* this, AnimationHeader* animation, u8 mode, f32 morphF Animation_Change(&this->skelAnime, animation, playSpeed, startFrame, endFrame, mode, morphFrames); } -void DemoDu_InitCs_FireMedallion(DemoDu* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDaruniaSkel, &gDaruniaIdleAnim, NULL, NULL, 0); +void DemoDu_InitCs_FireMedallion(DemoDu* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gDaruniaSkel, &gDaruniaIdleAnim, NULL, NULL, 0); this->actor.shape.yOffset = -10000.0f; DemoDu_SetEyeTexIndex(this, 1); DemoDu_SetMouthTexIndex(this, 3); } // A.k.a Warp portal -void DemoDu_CsFireMedallion_SpawnDoorWarp(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsFireMedallion_SpawnDoorWarp(DemoDu* this, PlayState* play) { f32 posX = this->actor.world.pos.x; f32 posY = this->actor.world.pos.y; f32 posZ = this->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, - WARP_SAGES); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_SAGES); } // Gives the Fire Medallion to Link. -void func_80969F38(DemoDu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80969F38(DemoDu* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 80.0f; f32 posZ = player->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, DEMO_EFFECT_MEDAL_FIRE); - Item_Give(globalCtx, ITEM_MEDALLION_FIRE); + Item_Give(play, ITEM_MEDALLION_FIRE); } -void func_80969FB4(DemoDu* this, GlobalContext* globalCtx) { +void func_80969FB4(DemoDu* this, PlayState* play) { this->actor.shape.yOffset += 250.0f / 3.0f; } // Gives the Fire Medallion to Link too. -void DemoDu_CsFireMedallion_AdvanceTo01(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsFireMedallion_AdvanceTo01(DemoDu* this, PlayState* play) { s32 pad[2]; if ((gSaveContext.chamberCutsceneNum == 1) && (gSaveContext.sceneSetupIndex < 4)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->updateIndex = CS_FIREMEDALLION_SUBSCENE(1); - globalCtx->csCtx.segment = D_8096C1A4; + play->csCtx.segment = D_8096C1A4; gSaveContext.cutsceneTrigger = 2; - Item_Give(globalCtx, ITEM_MEDALLION_FIRE); + Item_Give(play, ITEM_MEDALLION_FIRE); player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; } } -void DemoDu_CsFireMedallion_AdvanceTo02(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsFireMedallion_AdvanceTo02(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 1)) { this->updateIndex = CS_FIREMEDALLION_SUBSCENE(2); this->drawIndex = 1; - DemoDu_CsFireMedallion_SpawnDoorWarp(this, globalCtx); + DemoDu_CsFireMedallion_SpawnDoorWarp(this, play); } } } @@ -226,9 +224,9 @@ void DemoDu_CsFireMedallion_AdvanceTo03(DemoDu* this) { } } -void DemoDu_CsFireMedallion_AdvanceTo04(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsFireMedallion_AdvanceTo04(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 2)) { Animation_Change(&this->skelAnime, &gDaruniaItemGiveAnim, 1.0f, 0.0f, @@ -246,58 +244,58 @@ void DemoDu_CsFireMedallion_AdvanceTo05(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsFireMedallion_AdvanceTo06(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[6]; +void DemoDu_CsFireMedallion_AdvanceTo06(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[6]; if ((npcAction != NULL) && (npcAction->action == 2)) { this->updateIndex = CS_FIREMEDALLION_SUBSCENE(6); - func_80969F38(this, globalCtx); + func_80969F38(this, play); } } } -void DemoDu_UpdateCs_FM_00(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsFireMedallion_AdvanceTo01(this, globalCtx); +void DemoDu_UpdateCs_FM_00(DemoDu* this, PlayState* play) { + DemoDu_CsFireMedallion_AdvanceTo01(this, play); } -void DemoDu_UpdateCs_FM_01(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsFireMedallion_AdvanceTo02(this, globalCtx); +void DemoDu_UpdateCs_FM_01(DemoDu* this, PlayState* play) { + DemoDu_CsFireMedallion_AdvanceTo02(this, play); } -void DemoDu_UpdateCs_FM_02(DemoDu* this, GlobalContext* globalCtx) { - func_80969FB4(this, globalCtx); +void DemoDu_UpdateCs_FM_02(DemoDu* this, PlayState* play) { + func_80969FB4(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_CsFireMedallion_AdvanceTo03(this); } -void DemoDu_UpdateCs_FM_03(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_FM_03(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsFireMedallion_AdvanceTo04(this, globalCtx); + DemoDu_CsFireMedallion_AdvanceTo04(this, play); } -void DemoDu_UpdateCs_FM_04(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_FM_04(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); DemoDu_CsFireMedallion_AdvanceTo05(this, animFinished); } -void DemoDu_UpdateCs_FM_05(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_FM_05(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsFireMedallion_AdvanceTo06(this, globalCtx); + DemoDu_CsFireMedallion_AdvanceTo06(this, play); } -void DemoDu_UpdateCs_FM_06(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_FM_06(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); } -void DemoDu_InitCs_GoronsRuby(DemoDu* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDaruniaSkel, NULL, NULL, NULL, 0); +void DemoDu_InitCs_GoronsRuby(DemoDu* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gDaruniaSkel, NULL, NULL, NULL, 0); this->updateIndex = CS_GORONSRUBY_SUBSCENE(0); } @@ -309,15 +307,15 @@ void DemoDu_CsPlaySfx_GoronLanding(DemoDu* this) { // Cutscene: Darunia gives Link the Goron's Ruby. // Sfx played when Darunia is falling at the start of the cutscene. -void DemoDu_CsPlaySfx_DaruniaFalling(GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 160) { +void DemoDu_CsPlaySfx_DaruniaFalling(PlayState* play) { + if (play->csCtx.frames == 160) { func_800788CC(NA_SE_EV_OBJECT_FALL); } } // Cutscene: Darunia gives Link the Goron's Ruby. -void DemoDu_CsPlaySfx_DaruniaHitsLink(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DemoDu_CsPlaySfx_DaruniaHitsLink(PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; func_80078914(&player->actor.projectedPos, NA_SE_EN_DARUNIA_HIT_LINK); @@ -332,9 +330,9 @@ void DemoDu_CsPlaySfx_HitBreast(DemoDu* this) { // Cutscene: Darunia gives Link the Goron's Ruby. // Sfx played when Link is escaping from the gorons at the end of the scene. -void DemoDu_CsPlaySfx_LinkEscapeFromGorons(GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 1400) { - Player* player = GET_PLAYER(globalCtx); +void DemoDu_CsPlaySfx_LinkEscapeFromGorons(PlayState* play) { + if (play->csCtx.frames == 1400) { + Player* player = GET_PLAYER(play); Audio_PlaySoundGeneral(NA_SE_VO_LI_FALL_L_KID, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -343,17 +341,17 @@ void DemoDu_CsPlaySfx_LinkEscapeFromGorons(GlobalContext* globalCtx) { // Cutscene: Darunia gives Link the Goron's Ruby. // Sfx played when Link is surprised by Darunia falling from the sky. -void DemoDu_CsPlaySfx_LinkSurprised(GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 174) { - Player* player = GET_PLAYER(globalCtx); +void DemoDu_CsPlaySfx_LinkSurprised(PlayState* play) { + if (play->csCtx.frames == 174) { + Player* player = GET_PLAYER(play); Audio_PlaySoundGeneral(NA_SE_VO_LI_SURPRISE_KID, &player->actor.projectedPos, 4U, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } -void DemoDu_CsGoronsRuby_UpdateFaceTextures(DemoDu* this, GlobalContext* globalCtx) { - u16* frames = &globalCtx->csCtx.frames; +void DemoDu_CsGoronsRuby_UpdateFaceTextures(DemoDu* this, PlayState* play) { + u16* frames = &play->csCtx.frames; if (*frames < 260) { DemoDu_UpdateEyes(this); @@ -376,16 +374,16 @@ void DemoDu_CsGoronsRuby_UpdateFaceTextures(DemoDu* this, GlobalContext* globalC } } -void func_8096A630(DemoDu* this, GlobalContext* globalCtx) { +void func_8096A630(DemoDu* this, PlayState* play) { s32 pad; Vec3f pos = this->actor.world.pos; pos.y += kREG(5); - func_80033480(globalCtx, &pos, kREG(1) + 100.0f, kREG(2) + 10, kREG(3) + 300, kREG(4), 0); + func_80033480(play, &pos, kREG(1) + 100.0f, kREG(2) + 10, kREG(3) + 300, kREG(4), 0); DemoDu_CsPlaySfx_GoronLanding(this); } -void DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(DemoDu* this, PlayState* play) { static Vec3f dustPosOffsets[] = { { 11.0f, -11.0f, -6.0f }, { 0.0f, 14.0f, -13.0f }, { 14.0f, -2.0f, -10.0f }, { 10.0f, -6.0f, -8.0f }, { 8.0f, 6.0f, 8.0f }, { 13.0f, 8.0f, -10.0f }, { -14.0f, 1.0f, -14.0f }, { 5.0f, 12.0f, -9.0f }, @@ -395,7 +393,7 @@ void DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(DemoDu* this, GlobalContext* g if (Animation_OnFrame(&this->skelAnime, 31.0f) || Animation_OnFrame(&this->skelAnime, 41.0f)) { s32 pad[2]; s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* pos = &player->bodyPartsPos[PLAYER_BODYPART_L_FOREARM]; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.3f, 0.0f }; @@ -426,17 +424,17 @@ void DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(DemoDu* this, GlobalContext* g envColor.g += colorDelta; envColor.b += colorDelta; - func_8002829C(globalCtx, &position, &velocity, &accel, &primColor, &envColor, - Rand_ZeroOne() * 40.0f + 200.0f, 0); + func_8002829C(play, &position, &velocity, &accel, &primColor, &envColor, Rand_ZeroOne() * 40.0f + 200.0f, + 0); } - DemoDu_CsPlaySfx_DaruniaHitsLink(globalCtx); + DemoDu_CsPlaySfx_DaruniaHitsLink(play); } } -void DemoDu_CsGoronsRuby_DaruniaFalling(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsGoronsRuby_DaruniaFalling(DemoDu* this, PlayState* play) { s32 pad; - CutsceneContext* csCtx = &globalCtx->csCtx; + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != CS_STATE_IDLE) { CsCmdActorAction* npcAction = csCtx->npcActions[2]; @@ -462,40 +460,40 @@ void DemoDu_CsGoronsRuby_DaruniaFalling(DemoDu* this, GlobalContext* globalCtx) } } -void DemoDu_CsGoronsRuby_AdvanceTo01(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsGoronsRuby_AdvanceTo01(DemoDu* this, PlayState* play) { this->updateIndex = CS_GORONSRUBY_SUBSCENE(1); } -void DemoDu_CsGoronsRuby_AdvanceTo02(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo02(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 1)) { Animation_Change(&this->skelAnime, &gDaruniaStandUpAfterFallingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gDaruniaStandUpAfterFallingAnim), 2, 0.0f); this->updateIndex = CS_GORONSRUBY_SUBSCENE(2); this->drawIndex = 1; - DemoDu_CsGoronsRuby_DaruniaFalling(this, globalCtx); + DemoDu_CsGoronsRuby_DaruniaFalling(this, play); } } } -void DemoDu_CsGoronsRuby_AdvanceTo03(DemoDu* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void DemoDu_CsGoronsRuby_AdvanceTo03(DemoDu* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != CS_STATE_IDLE) { CsCmdActorAction* npcAction = csCtx->npcActions[2]; if ((npcAction != NULL) && (csCtx->frames >= npcAction->endFrame)) { this->updateIndex = CS_GORONSRUBY_SUBSCENE(3); - func_8096A630(this, globalCtx); + func_8096A630(this, play); } } } -void DemoDu_CsGoronsRuby_AdvanceTo04(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo04(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 2)) { this->updateIndex = CS_GORONSRUBY_SUBSCENE(4); @@ -511,9 +509,9 @@ void DemoDu_CsGoronsRuby_AdvanceTo05(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsGoronsRuby_AdvanceTo06(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo06(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 3)) { Animation_Change(&this->skelAnime, &gDaruniaHitBreastAnim, 1.0f, 0.0f, @@ -531,9 +529,9 @@ void DemoDu_CsGoronsRuby_AdvanceTo07(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsGoronsRuby_AdvanceTo08(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo08(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 4)) { Animation_Change(&this->skelAnime, &gDaruniaHitLinkAnim, 1.0f, 0.0f, @@ -559,9 +557,9 @@ void DemoDu_CsGoronsRuby_AdvanceTo10(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsGoronsRuby_AdvanceTo11(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo11(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 5)) { Animation_Change(&this->skelAnime, &gDaruniaItemGiveAnim, 1.0f, 0.0f, @@ -579,9 +577,9 @@ void DemoDu_CsGoronsRuby_AdvanceTo12(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsGoronsRuby_AdvanceTo13(DemoDu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[2]; +void DemoDu_CsGoronsRuby_AdvanceTo13(DemoDu* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 6)) { Animation_Change(&this->skelAnime, &gDaruniaIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gDaruniaIdleAnim), @@ -591,119 +589,119 @@ void DemoDu_CsGoronsRuby_AdvanceTo13(DemoDu* this, GlobalContext* globalCtx) { } } -void DemoDu_UpdateCs_GR_00(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsPlaySfx_DaruniaFalling(globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo01(this, globalCtx); +void DemoDu_UpdateCs_GR_00(DemoDu* this, PlayState* play) { + DemoDu_CsPlaySfx_DaruniaFalling(play); + DemoDu_CsGoronsRuby_AdvanceTo01(this, play); } -void DemoDu_UpdateCs_GR_01(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsPlaySfx_DaruniaFalling(globalCtx); - DemoDu_CsPlaySfx_LinkSurprised(globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo02(this, globalCtx); +void DemoDu_UpdateCs_GR_01(DemoDu* this, PlayState* play) { + DemoDu_CsPlaySfx_DaruniaFalling(play); + DemoDu_CsPlaySfx_LinkSurprised(play); + DemoDu_CsGoronsRuby_AdvanceTo02(this, play); } -void DemoDu_UpdateCs_GR_02(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsGoronsRuby_DaruniaFalling(this, globalCtx); - DemoDu_UpdateBgCheckInfo(this, globalCtx); - DemoDu_CsPlaySfx_DaruniaFalling(globalCtx); - DemoDu_CsPlaySfx_LinkSurprised(globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo03(this, globalCtx); +void DemoDu_UpdateCs_GR_02(DemoDu* this, PlayState* play) { + DemoDu_CsGoronsRuby_DaruniaFalling(this, play); + DemoDu_UpdateBgCheckInfo(this, play); + DemoDu_CsPlaySfx_DaruniaFalling(play); + DemoDu_CsPlaySfx_LinkSurprised(play); + DemoDu_CsGoronsRuby_AdvanceTo03(this, play); } -void DemoDu_UpdateCs_GR_03(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); - DemoDu_CsPlaySfx_LinkSurprised(globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo04(this, globalCtx); +void DemoDu_UpdateCs_GR_03(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); + DemoDu_CsPlaySfx_LinkSurprised(play); + DemoDu_CsGoronsRuby_AdvanceTo04(this, play); } -void DemoDu_UpdateCs_GR_04(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_GR_04(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); DemoDu_CsGoronsRuby_AdvanceTo05(this, animFinished); } -void DemoDu_UpdateCs_GR_05(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_GR_05(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo06(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsGoronsRuby_AdvanceTo06(this, play); } -void DemoDu_UpdateCs_GR_06(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_GR_06(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); DemoDu_CsPlaySfx_HitBreast(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); DemoDu_CsGoronsRuby_AdvanceTo07(this, animFinished); } -void DemoDu_UpdateCs_GR_07(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_GR_07(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo08(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsGoronsRuby_AdvanceTo08(this, play); } -void DemoDu_UpdateCs_GR_08(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_GR_08(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(this, play); DemoDu_CsGoronsRuby_AdvanceTo09(this, animFinished); } -void DemoDu_UpdateCs_GR_09(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_GR_09(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); DemoDu_CsPlaySfx_HitBreast(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); DemoDu_CsGoronsRuby_AdvanceTo10(this, animFinished); } -void DemoDu_UpdateCs_GR_10(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_GR_10(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo11(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsGoronsRuby_AdvanceTo11(this, play); } -void DemoDu_UpdateCs_GR_11(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_GR_11(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); DemoDu_CsGoronsRuby_AdvanceTo12(this, animFinished); } -void DemoDu_UpdateCs_GR_12(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_GR_12(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsGoronsRuby_AdvanceTo13(this, globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsGoronsRuby_AdvanceTo13(this, play); } -void DemoDu_UpdateCs_GR_13(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_GR_13(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); - DemoDu_CsGoronsRuby_UpdateFaceTextures(this, globalCtx); - DemoDu_CsPlaySfx_LinkEscapeFromGorons(globalCtx); + DemoDu_CsGoronsRuby_UpdateFaceTextures(this, play); + DemoDu_CsPlaySfx_LinkEscapeFromGorons(play); } -void DemoDu_InitCs_AfterGanon(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_InitCs_AfterGanon(DemoDu* this, PlayState* play) { s32 pad[3]; f32 lastFrame = Animation_GetLastFrame(&gDaruniaSageFormationAnim); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDaruniaSkel, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gDaruniaSkel, NULL, NULL, NULL, 0); Animation_Change(&this->skelAnime, &gDaruniaSageFormationAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, 0.0f); this->updateIndex = CS_CHAMBERAFTERGANON_SUBSCENE(0); this->actor.shape.shadowAlpha = 0; @@ -713,13 +711,13 @@ void DemoDu_CsPlaySfx_WhiteOut() { func_800788CC(NA_SE_SY_WHITE_OUT_T); } -void DemoDu_CsAfterGanon_SpawnDemo6K(DemoDu* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void DemoDu_CsAfterGanon_SpawnDemo6K(DemoDu* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, kREG(16) + 22.0f + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 3); } -void DemoDu_CsAfterGanon_AdvanceTo01(DemoDu* this, GlobalContext* globalCtx) { - if (DemoDu_IsNpcDoingThisAction(this, globalCtx, 4, 2)) { +void DemoDu_CsAfterGanon_AdvanceTo01(DemoDu* this, PlayState* play) { + if (DemoDu_IsNpcDoingThisAction(this, play, 4, 2)) { this->updateIndex = CS_CHAMBERAFTERGANON_SUBSCENE(1); this->drawIndex = 2; this->shadowAlpha = 0; @@ -729,11 +727,11 @@ void DemoDu_CsAfterGanon_AdvanceTo01(DemoDu* this, GlobalContext* globalCtx) { } } -void DemoDu_CsAfterGanon_AdvanceTo02(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_CsAfterGanon_AdvanceTo02(DemoDu* this, PlayState* play) { f32* unk_1A4 = &this->unk_1A4; s32 shadowAlpha = 255; - if (DemoDu_IsNpcDoingThisAction(this, globalCtx, 4, 2)) { + if (DemoDu_IsNpcDoingThisAction(this, play, 4, 2)) { *unk_1A4 += 1.0f; if (*unk_1A4 >= kREG(5) + 10.0f) { this->updateIndex = CS_CHAMBERAFTERGANON_SUBSCENE(2); @@ -759,44 +757,44 @@ void DemoDu_CsAfterGanon_AdvanceTo02(DemoDu* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = shadowAlpha; } -void DemoDu_CsAfterGanon_BackTo01(DemoDu* this, GlobalContext* globalCtx) { - if (DemoDu_IsNpcNotDoingThisAction(this, globalCtx, 4, 2)) { +void DemoDu_CsAfterGanon_BackTo01(DemoDu* this, PlayState* play) { + if (DemoDu_IsNpcNotDoingThisAction(this, play, 4, 2)) { this->updateIndex = CS_CHAMBERAFTERGANON_SUBSCENE(1); this->drawIndex = 2; this->unk_1A4 = kREG(5) + 10.0f; this->shadowAlpha = 255; if (!this->demo6KSpawned) { - DemoDu_CsAfterGanon_SpawnDemo6K(this, globalCtx); + DemoDu_CsAfterGanon_SpawnDemo6K(this, play); this->demo6KSpawned = 1; } this->actor.shape.shadowAlpha = 255; } } -void DemoDu_UpdateCs_AG_00(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsAfterGanon_AdvanceTo01(this, globalCtx); - DemoDu_CsAfterGanon_CheckIfShouldReset(this, globalCtx); +void DemoDu_UpdateCs_AG_00(DemoDu* this, PlayState* play) { + DemoDu_CsAfterGanon_AdvanceTo01(this, play); + DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); } -void DemoDu_UpdateCs_AG_01(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_AG_01(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); - DemoDu_CsAfterGanon_AdvanceTo02(this, globalCtx); - DemoDu_CsAfterGanon_CheckIfShouldReset(this, globalCtx); + DemoDu_CsAfterGanon_AdvanceTo02(this, play); + DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); } -void DemoDu_UpdateCs_AG_02(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_AG_02(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); - DemoDu_CsAfterGanon_BackTo01(this, globalCtx); - DemoDu_CsAfterGanon_CheckIfShouldReset(this, globalCtx); + DemoDu_CsAfterGanon_BackTo01(this, play); + DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); } // Similar to DemoDu_Draw_01, but this uses POLY_XLU_DISP. Also uses this->shadowAlpha for setting the env color. -void DemoDu_Draw_02(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DemoDu_Draw_02(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DemoDu* this = (DemoDu*)thisx; s16 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = sEyeTextures[eyeTexIndex]; @@ -805,9 +803,9 @@ void DemoDu_Draw_02(Actor* thisx, GlobalContext* globalCtx2) { void* mouthTexture = sMouthTextures[mouthTexIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_du_inKenjyanomaDemo02.c", 275); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_du_inKenjyanomaDemo02.c", 275); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTexture)); @@ -817,14 +815,14 @@ void DemoDu_Draw_02(Actor* thisx, GlobalContext* globalCtx2) { gSPSegment(POLY_XLU_DISP++, 0x0C, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, - 0, 0, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, 0, 0, + POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_du_inKenjyanomaDemo02.c", 304); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_du_inKenjyanomaDemo02.c", 304); } -void DemoDu_InitCs_Credits(DemoDu* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDaruniaSkel, &gDaruniaCreditsIdleAnim, NULL, NULL, 0); +void DemoDu_InitCs_Credits(DemoDu* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gDaruniaSkel, &gDaruniaCreditsIdleAnim, NULL, NULL, 0); this->updateIndex = CS_CREDITS_SUBSCENE(0); this->drawIndex = 0; this->actor.shape.shadowAlpha = 0; @@ -850,8 +848,8 @@ void DemoDu_CsCredits_UpdateShadowAlpha(DemoDu* this) { } } -void DemoDu_CsCredits_AdvanceTo01(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_MoveToNpcPos(this, globalCtx, 2); +void DemoDu_CsCredits_AdvanceTo01(DemoDu* this, PlayState* play) { + DemoDu_MoveToNpcPos(this, play, 2); this->updateIndex = CS_CREDITS_SUBSCENE(1); this->drawIndex = 2; } @@ -880,8 +878,8 @@ void DemoDu_CsCredits_BackTo02(DemoDu* this, s32 animFinished) { } } -void DemoDu_CsCredits_HandleSubscenesByNpcAction(DemoDu* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(globalCtx, 2); +void DemoDu_CsCredits_HandleSubscenesByNpcAction(DemoDu* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, 2); if (npcAction != NULL) { s32 action = npcAction->action; @@ -890,7 +888,7 @@ void DemoDu_CsCredits_HandleSubscenesByNpcAction(DemoDu* this, GlobalContext* gl if (action != lastAction) { switch (action) { case 9: - DemoDu_CsCredits_AdvanceTo01(this, globalCtx); + DemoDu_CsCredits_AdvanceTo01(this, play); break; case 10: DemoDu_CsCredits_AdvanceTo03(this); @@ -908,36 +906,36 @@ void DemoDu_CsCredits_HandleSubscenesByNpcAction(DemoDu* this, GlobalContext* gl } } -void DemoDu_UpdateCs_CR_00(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_CsCredits_HandleSubscenesByNpcAction(this, globalCtx); +void DemoDu_UpdateCs_CR_00(DemoDu* this, PlayState* play) { + DemoDu_CsCredits_HandleSubscenesByNpcAction(this, play); } -void DemoDu_UpdateCs_CR_01(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_CR_01(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); DemoDu_CsCredits_UpdateShadowAlpha(this); DemoDu_CsCredits_AdvanceTo02(this); } -void DemoDu_UpdateCs_CR_02(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_CR_02(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); - DemoDu_CsCredits_HandleSubscenesByNpcAction(this, globalCtx); + DemoDu_CsCredits_HandleSubscenesByNpcAction(this, play); } -void DemoDu_UpdateCs_CR_03(DemoDu* this, GlobalContext* globalCtx) { - DemoDu_UpdateBgCheckInfo(this, globalCtx); +void DemoDu_UpdateCs_CR_03(DemoDu* this, PlayState* play) { + DemoDu_UpdateBgCheckInfo(this, play); DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); - DemoDu_CsCredits_HandleSubscenesByNpcAction(this, globalCtx); + DemoDu_CsCredits_HandleSubscenesByNpcAction(this, play); } -void DemoDu_UpdateCs_CR_04(DemoDu* this, GlobalContext* globalCtx) { +void DemoDu_UpdateCs_CR_04(DemoDu* this, PlayState* play) { s32 animFinished; - DemoDu_UpdateBgCheckInfo(this, globalCtx); + DemoDu_UpdateBgCheckInfo(this, play); animFinished = DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); DemoDu_CsCredits_BackTo02(this, animFinished); @@ -952,7 +950,7 @@ static DemoDuActionFunc sUpdateFuncs[] = { DemoDu_UpdateCs_CR_01, DemoDu_UpdateCs_CR_02, DemoDu_UpdateCs_CR_03, DemoDu_UpdateCs_CR_04, }; -void DemoDu_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoDu_Update(Actor* thisx, PlayState* play) { DemoDu* this = (DemoDu*)thisx; if (this->updateIndex < 0 || this->updateIndex >= 29 || sUpdateFuncs[this->updateIndex] == NULL) { @@ -960,38 +958,38 @@ void DemoDu_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sUpdateFuncs[this->updateIndex](this, globalCtx); + sUpdateFuncs[this->updateIndex](this, play); } -void DemoDu_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoDu_Init(Actor* thisx, PlayState* play) { DemoDu* this = (DemoDu*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); switch (this->actor.params) { case DEMO_DU_CS_GORONS_RUBY: - DemoDu_InitCs_GoronsRuby(this, globalCtx); + DemoDu_InitCs_GoronsRuby(this, play); break; case DEMO_DU_CS_CHAMBER_AFTER_GANON: - DemoDu_InitCs_AfterGanon(this, globalCtx); + DemoDu_InitCs_AfterGanon(this, play); break; case DEMO_DU_CS_CREDITS: - DemoDu_InitCs_Credits(this, globalCtx); + DemoDu_InitCs_Credits(this, play); break; default: - DemoDu_InitCs_FireMedallion(this, globalCtx); + DemoDu_InitCs_FireMedallion(this, play); break; } } -void DemoDu_Draw_NoDraw(Actor* thisx, GlobalContext* globalCtx2) { +void DemoDu_Draw_NoDraw(Actor* thisx, PlayState* play2) { } // Similar to DemoDu_Draw_02, but this uses POLY_OPA_DISP. Sets the env color to 255. -void DemoDu_Draw_01(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DemoDu_Draw_01(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DemoDu* this = (DemoDu*)thisx; s16 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = sEyeTextures[eyeTexIndex]; @@ -1000,9 +998,9 @@ void DemoDu_Draw_01(Actor* thisx, GlobalContext* globalCtx2) { void* mouthTexture = sMouthTextures[mouthTexIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_du.c", 615); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_du.c", 615); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTexture)); @@ -1012,10 +1010,9 @@ void DemoDu_Draw_01(Actor* thisx, GlobalContext* globalCtx2) { gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, - this); + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_du.c", 638); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_du.c", 638); } static DemoDuDrawFunc sDrawFuncs[] = { @@ -1024,7 +1021,7 @@ static DemoDuDrawFunc sDrawFuncs[] = { DemoDu_Draw_02, }; -void DemoDu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoDu_Draw(Actor* thisx, PlayState* play) { DemoDu* this = (DemoDu*)thisx; if (this->drawIndex < 0 || this->drawIndex >= 3 || sDrawFuncs[this->drawIndex] == NULL) { @@ -1032,7 +1029,7 @@ void DemoDu_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawIndex](thisx, globalCtx); + sDrawFuncs[this->drawIndex](thisx, play); } const ActorInit Demo_Du_InitVars = { 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 0ee1d6c5b6..81a1064db6 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -39,10 +39,10 @@ #define FLAGS ACTOR_FLAG_4 -void DemoEc_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoEc_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoEc_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoEc_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoEc_Init(Actor* thisx, PlayState* play); +void DemoEc_Destroy(Actor* thisx, PlayState* play); +void DemoEc_Update(Actor* thisx, PlayState* play); +void DemoEc_Draw(Actor* thisx, PlayState* play); typedef enum { /* 00 */ EC_UPDATE_COMMON, @@ -148,13 +148,13 @@ static s16 sAnimationObjects[] = { OBJECT_EC, OBJECT_EC, OBJECT_EC, OBJECT_EC, OBJECT_EC, OBJECT_EC, OBJECT_GM, OBJECT_MA2, }; -void DemoEc_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoEc_Destroy(Actor* thisx, PlayState* play) { DemoEc* this = (DemoEc*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } -void DemoEc_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoEc_Init(Actor* thisx, PlayState* play) { DemoEc* this = (DemoEc*)thisx; if ((this->actor.params < 0) || (this->actor.params > 34)) { @@ -170,26 +170,26 @@ s32 DemoEc_UpdateSkelAnime(DemoEc* this) { return SkelAnime_Update(&this->skelAnime); } -void DemoEc_UpdateBgFlags(DemoEc* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 25.0f, 30.0f, +void DemoEc_UpdateBgFlags(DemoEc* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 25.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); } -void func_8096D594(DemoEc* this, GlobalContext* globalCtx) { +void func_8096D594(DemoEc* this, PlayState* play) { this->skelAnime.moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_8096D5D4(DemoEc* this, GlobalContext* globalCtx) { +void func_8096D5D4(DemoEc* this, PlayState* play) { this->skelAnime.baseTransl = this->skelAnime.jointTable[0]; this->skelAnime.prevTransl = this->skelAnime.jointTable[0]; this->skelAnime.moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_8096D64C(DemoEc* this, GlobalContext* globalCtx) { +void func_8096D64C(DemoEc* this, PlayState* play) { this->skelAnime.moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void DemoEc_UpdateEyes(DemoEc* this) { @@ -212,8 +212,8 @@ void DemoEc_SetEyeTexIndex(DemoEc* this, s16 texIndex) { this->eyeTexIndex = texIndex; } -void DemoEc_InitSkelAnime(DemoEc* this, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeader) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, SEGMENTED_TO_VIRTUAL(skeletonHeader), NULL, NULL, NULL, 0); +void DemoEc_InitSkelAnime(DemoEc* this, PlayState* play, FlexSkeletonHeader* skeletonHeader) { + SkelAnime_InitFlex(play, &this->skelAnime, SEGMENTED_TO_VIRTUAL(skeletonHeader), NULL, NULL, NULL, 0); } void DemoEc_ChangeAnimation(DemoEc* this, AnimationHeader* animation, u8 mode, f32 morphFrames, s32 reverse) { @@ -249,9 +249,9 @@ Gfx* DemoEc_AllocColorDList(GraphicsContext* gfxCtx, u8* color) { return dList; } -void DemoEc_DrawSkeleton(DemoEc* this, GlobalContext* globalCtx, void* eyeTexture, void* arg3, - OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void DemoEc_DrawSkeleton(DemoEc* this, PlayState* play, void* eyeTexture, void* arg3, OverrideLimbDraw overrideLimbDraw, + PostLimbDraw postLimbDraw) { + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; s32 pad; @@ -270,15 +270,15 @@ void DemoEc_DrawSkeleton(DemoEc* this, GlobalContext* globalCtx, void* eyeTextur gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, overrideLimbDraw, postLimbDraw, &this->actor, POLY_OPA_DISP); CLOSE_DISPS(gfxCtx, "../z_demo_ec.c", 595); } -void DemoEc_DrawSkeletonCustomColor(DemoEc* this, GlobalContext* globalCtx, Gfx* arg2, Gfx* arg3, u8* color1, - u8* color2, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw) { +void DemoEc_DrawSkeletonCustomColor(DemoEc* this, PlayState* play, Gfx* arg2, Gfx* arg3, u8* color1, u8* color2, + OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; OPEN_DISPS(gfxCtx, "../z_demo_ec.c", 609); @@ -306,42 +306,42 @@ void DemoEc_DrawSkeletonCustomColor(DemoEc* this, GlobalContext* globalCtx, Gfx* gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, overrideLimbDraw, postLimbDraw, &this->actor, POLY_OPA_DISP); CLOSE_DISPS(gfxCtx, "../z_demo_ec.c", 646); } -void DemoEc_UseDrawObject(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UseDrawObject(DemoEc* this, PlayState* play) { s32 pad[2]; s32 drawObjBankIndex = this->drawObjBankIndex; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_ec.c", 662); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[drawObjBankIndex].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[drawObjBankIndex].segment); - if (!globalCtx) {} + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[drawObjBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[drawObjBankIndex].segment); + if (!play) {} CLOSE_DISPS(gfxCtx, "../z_demo_ec.c", 670); } -void DemoEc_UseAnimationObject(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UseAnimationObject(DemoEc* this, PlayState* play) { s32 animObjBankIndex = this->animObjBankIndex; - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[animObjBankIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[animObjBankIndex].segment); } -CsCmdActorAction* DemoEc_GetNpcAction(GlobalContext* globalCtx, s32 actionIndex) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[actionIndex]; +CsCmdActorAction* DemoEc_GetNpcAction(PlayState* play, s32 actionIndex) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[actionIndex]; } else { return NULL; } } -void DemoEc_SetNpcActionPosRot(DemoEc* this, GlobalContext* globalCtx, s32 actionIndex) { - CsCmdActorAction* npcAction = DemoEc_GetNpcAction(globalCtx, actionIndex); +void DemoEc_SetNpcActionPosRot(DemoEc* this, PlayState* play, s32 actionIndex) { + CsCmdActorAction* npcAction = DemoEc_GetNpcAction(play, actionIndex); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -352,142 +352,142 @@ void DemoEc_SetNpcActionPosRot(DemoEc* this, GlobalContext* globalCtx, s32 actio } } -void DemoEc_InitIngo(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gIngoSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitIngo(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gIngoSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcIngoAnim, 0, 0.0f, false); - func_8096D64C(this, globalCtx); + func_8096D64C(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_INGO; this->drawConfig = EC_DRAW_INGO; } -void DemoEc_UpdateIngo(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateIngo(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawIngo(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, gIngoEyeClosed2Tex, gIngoRedTex, 0, 0); +void DemoEc_DrawIngo(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, gIngoEyeClosed2Tex, gIngoRedTex, 0, 0); } -void DemoEc_InitTalon(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gTalonSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitTalon(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gTalonSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcTalonAnim, 0, 0.0f, false); - func_8096D64C(this, globalCtx); + func_8096D64C(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_TALON; this->drawConfig = EC_DRAW_TALON; } -void DemoEc_UpdateTalon(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateTalon(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawTalon(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, gTalonEyeClosed2Tex, gTalonRedTex, NULL, NULL); +void DemoEc_DrawTalon(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, gTalonEyeClosed2Tex, gTalonRedTex, NULL, NULL); } -void DemoEc_InitWindmillMan(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gWindmillManSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitWindmillMan(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gWindmillManSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcWindmillManAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_WINDMILL_MAN; this->drawConfig = EC_DRAW_WINDMILL_MAN; } -void DemoEc_UpdateWindmillMan(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateWindmillMan(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawWindmillMan(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, gWindmillManEyeClosedTex, gWindmillManMouthAngryTex, NULL, NULL); +void DemoEc_DrawWindmillMan(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, gWindmillManEyeClosedTex, gWindmillManMouthAngryTex, NULL, NULL); } -void DemoEc_InitKokiriBoy(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gKm1Skel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitKokiriBoy(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gKm1Skel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcKokiriAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_KOKIRI_BOY; this->drawConfig = EC_DRAW_KOKIRI_BOY; } -void DemoEc_InitDancingKokiriBoy(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gKm1Skel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitDancingKokiriBoy(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gKm1Skel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcDancingKokiriAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_DANCING_KOKIRI_BOY; this->drawConfig = EC_DRAW_KOKIRI_BOY; } -void DemoEc_UpdateKokiriBoy(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateKokiriBoy(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_UpdateDancingKokiriBoy(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UpdateKokiriBoy(this, globalCtx); +void DemoEc_UpdateDancingKokiriBoy(DemoEc* this, PlayState* play) { + DemoEc_UpdateKokiriBoy(this, play); } -void DemoEc_DrawKokiriBoy(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawKokiriBoy(DemoEc* this, PlayState* play) { static u8 color1[] = { 0, 130, 70, 255 }; static u8 color2[] = { 110, 170, 20, 255 }; - DemoEc_DrawSkeletonCustomColor(this, globalCtx, NULL, NULL, color1, color2, NULL, NULL); + DemoEc_DrawSkeletonCustomColor(this, play, NULL, NULL, color1, color2, NULL, NULL); } -void DemoEc_InitKokiriGirl(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gKw1Skel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitKokiriGirl(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gKw1Skel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcKokiriAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_KOKIRI_GIRL; this->drawConfig = EC_DRAW_KOKIRI_GIRL; } -void DemoEc_InitDancingKokiriGirl(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gKw1Skel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitDancingKokiriGirl(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gKw1Skel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcDancingKokiriAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_DANCING_KOKIRI_GIRL; this->drawConfig = EC_DRAW_KOKIRI_GIRL; } -void DemoEc_UpdateKokiriGirl(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateKokiriGirl(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_UpdateDancingKokiriGirl(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UpdateKokiriGirl(this, globalCtx); +void DemoEc_UpdateDancingKokiriGirl(DemoEc* this, PlayState* play) { + DemoEc_UpdateKokiriGirl(this, play); } -void DemoEc_DrawKokiriGirl(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawKokiriGirl(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gKw1EyeOpenTex, gKw1EyeHalfTex, @@ -498,27 +498,27 @@ void DemoEc_DrawKokiriGirl(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeletonCustomColor(this, globalCtx, eyeTexture, NULL, color1, color2, NULL, NULL); + DemoEc_DrawSkeletonCustomColor(this, play, eyeTexture, NULL, color1, color2, NULL, NULL); } -void DemoEc_InitOldMan(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_bji_Skel_0000F0); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitOldMan(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_bji_Skel_0000F0); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcOldManAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_OLD_MAN; this->drawConfig = EC_DRAW_OLD_MAN; } -void DemoEc_UpdateOldMan(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateOldMan(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawOldMan(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawOldMan(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { object_bji_Tex_0005FC, object_bji_Tex_0009FC, @@ -529,28 +529,28 @@ void DemoEc_DrawOldMan(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeletonCustomColor(this, globalCtx, eyeTexture, NULL, color1, color2, NULL, NULL); + DemoEc_DrawSkeletonCustomColor(this, play, eyeTexture, NULL, color1, color2, NULL, NULL); } -void DemoEc_InitBeardedMan(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_ahg_Skel_0000F0); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitBeardedMan(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_ahg_Skel_0000F0); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcOldManAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_BEARDED_MAN; this->drawConfig = EC_DRAW_BEARDED_MAN; } -void DemoEc_UpdateBeardedMan(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateBeardedMan(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawBeardedMan(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawBeardedMan(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { object_ahg_Tex_00057C, object_ahg_Tex_00067C, @@ -561,28 +561,28 @@ void DemoEc_DrawBeardedMan(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeletonCustomColor(this, globalCtx, eyeTexture, NULL, color1, color2, NULL, NULL); + DemoEc_DrawSkeletonCustomColor(this, play, eyeTexture, NULL, color1, color2, NULL, NULL); } -void DemoEc_InitWoman(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_bob_Skel_0000F0); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitWoman(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_bob_Skel_0000F0); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcOldManAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_WOMAN; this->drawConfig = EC_DRAW_WOMAN; } -void DemoEc_UpdateWoman(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateWoman(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawWoman(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawWoman(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { object_bob_Tex_0007C8, object_bob_Tex_000FC8, @@ -591,70 +591,70 @@ void DemoEc_DrawWoman(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitOldWoman(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_bba_Skel_0000F0); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitOldWoman(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_bba_Skel_0000F0); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcOldManAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_OLD_WOMAN; this->drawConfig = EC_DRAW_OLD_WOMAN; } -void DemoEc_UpdateOldWoman(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateOldWoman(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawOldWoman(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, &object_bba_Tex_0004C8, NULL, NULL, NULL); +void DemoEc_DrawOldWoman(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, &object_bba_Tex_0004C8, NULL, NULL, NULL); } -void DemoEc_InitBossCarpenter(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_toryo_Skel_007150); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitBossCarpenter(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_toryo_Skel_007150); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcCarpenterAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_BOSS_CARPENTER; this->drawConfig = EC_DRAW_BOSS_CARPENTER; } -void DemoEc_UpdateBossCarpenter(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateBossCarpenter(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawBossCarpenter(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, NULL, NULL, NULL, NULL); +void DemoEc_DrawBossCarpenter(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, NULL, NULL, NULL, NULL); } -void DemoEc_InitCarpenter(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_daiku_Skel_007958); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitCarpenter(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_daiku_Skel_007958); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcCarpenterAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_CARPENTER; this->drawConfig = EC_DRAW_CARPENTER; } -void DemoEc_UpdateCarpenter(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateCarpenter(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -s32 DemoEc_CarpenterOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx, Gfx** gfx) { +s32 DemoEc_CarpenterOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, + Gfx** gfx) { DemoEc* this = (DemoEc*)thisx; if (limbIndex == 1) { @@ -694,8 +694,7 @@ Gfx* DemoEc_GetCarpenterPostLimbDList(DemoEc* this) { } } -void DemoEc_CarpenterPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, - Gfx** gfx) { +void DemoEc_CarpenterPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { DemoEc* this = (DemoEc*)thisx; Gfx* postLimbDList; @@ -705,26 +704,26 @@ void DemoEc_CarpenterPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** } } -void DemoEc_DrawCarpenter(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, NULL, 0, DemoEc_CarpenterOverrideLimbDraw, DemoEc_CarpenterPostLimbDraw); +void DemoEc_DrawCarpenter(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, NULL, 0, DemoEc_CarpenterOverrideLimbDraw, DemoEc_CarpenterPostLimbDraw); } -void DemoEc_InitGerudo(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gGerudoWhiteSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitGerudo(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gGerudoWhiteSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcGerudoAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_GERUDO; this->drawConfig = EC_DRAW_GERUDO; } -void DemoEc_UpdateGerudo(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateGerudo(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } Gfx* DemoEc_GetGerudoPostLimbDList(DemoEc* this) { @@ -741,8 +740,7 @@ Gfx* DemoEc_GetGerudoPostLimbDList(DemoEc* this) { } } -void DemoEc_GerudoPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, - Gfx** gfx) { +void DemoEc_GerudoPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { DemoEc* this = (DemoEc*)thisx; Gfx* postLimbDList; @@ -752,7 +750,7 @@ void DemoEc_GerudoPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL } } -void DemoEc_DrawGerudo(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawGerudo(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gGerudoWhiteEyeOpenTex, gGerudoWhiteEyeHalfTex, @@ -761,41 +759,41 @@ void DemoEc_DrawGerudo(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, DemoEc_GerudoPostLimbDraw); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, DemoEc_GerudoPostLimbDraw); } -void DemoEc_InitDancingZora(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gZoraSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitDancingZora(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gZoraSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcDancingZoraAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_DANCING_ZORA; this->drawConfig = EC_DRAW_DANCING_ZORA; } -void DemoEc_UpdateDancingZora(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateDancingZora(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawDancingZora(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawDancingZora(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitKingZora(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gKzSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitKingZora(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gKzSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcKingZoraAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_KING_ZORA; this->drawConfig = EC_DRAW_KING_ZORA; @@ -812,8 +810,8 @@ void func_8096F1D4(DemoEc* this) { } } -void func_8096F224(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseAnimationObject(this, globalCtx); +void func_8096F224(DemoEc* this, PlayState* play) { + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcAnim_006930, 2, -8.0f, false); this->updateMode = EC_UPDATE_17; } @@ -825,70 +823,70 @@ void func_8096F26C(DemoEc* this, s32 arg1) { } } -void func_8096F2B0(DemoEc* this, GlobalContext* globalCtx, s32 arg2) { +void func_8096F2B0(DemoEc* this, PlayState* play, s32 arg2) { CsCmdActorAction* npcAction; s32 sp18; - npcAction = DemoEc_GetNpcAction(globalCtx, arg2); + npcAction = DemoEc_GetNpcAction(play, arg2); if (npcAction != NULL) { sp18 = npcAction->action; if (sp18 != this->npcAction) { if (this->npcAction) {} if (sp18 == 2) { - func_8096F224(this, globalCtx); + func_8096F224(this, play); } this->npcAction = sp18; } } } -void DemoEc_UpdateKingZora(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateKingZora(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_SetNpcActionPosRot(this, globalCtx, 6); - DemoEc_UpdateBgFlags(this, globalCtx); - func_8096F2B0(this, globalCtx, 6); + func_8096D594(this, play); + DemoEc_SetNpcActionPosRot(this, play, 6); + DemoEc_UpdateBgFlags(this, play); + func_8096F2B0(this, play, 6); } -void func_8096F378(DemoEc* this, GlobalContext* globalCtx) { +void func_8096F378(DemoEc* this, PlayState* play) { s32 animDone = DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); func_8096F1D4(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); func_8096F26C(this, animDone); } -void func_8096F3D4(DemoEc* this, GlobalContext* globalCtx) { +void func_8096F3D4(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawKingZora(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawKingZora(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gKzEyeOpenTex, gKzEyeHalfTex, gKzEyeClosedTex, gKzEyeOpen2Tex }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitMido(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gMidoSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitMido(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gMidoSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcMidoAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_MIDO; this->drawConfig = EC_DRAW_MIDO; DemoEc_SetEyeTexIndex(this, 3); } -void func_8096F4FC(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseAnimationObject(this, globalCtx); +void func_8096F4FC(DemoEc* this, PlayState* play) { + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcAnim_008D1C, 2, -8.0f, false); this->updateMode = EC_UPDATE_20; } @@ -899,41 +897,41 @@ void func_8096F544(DemoEc* this, s32 changeAnim) { } } -void func_8096F578(DemoEc* this, GlobalContext* globalCtx, s32 arg2) { +void func_8096F578(DemoEc* this, PlayState* play, s32 arg2) { CsCmdActorAction* npcAction; s32 sp18; - npcAction = DemoEc_GetNpcAction(globalCtx, arg2); + npcAction = DemoEc_GetNpcAction(play, arg2); if (npcAction != NULL) { sp18 = npcAction->action; if (sp18 != this->npcAction) { if (this->npcAction) {} if (sp18 == 2) { - func_8096F4FC(this, globalCtx); + func_8096F4FC(this, play); } this->npcAction = sp18; } } } -void DemoEc_UpdateMido(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateMido(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_SetNpcActionPosRot(this, globalCtx, 7); - DemoEc_UpdateBgFlags(this, globalCtx); - func_8096F578(this, globalCtx, 7); + func_8096D594(this, play); + DemoEc_SetNpcActionPosRot(this, play, 7); + DemoEc_UpdateBgFlags(this, play); + func_8096F578(this, play, 7); } -void func_8096F640(DemoEc* this, GlobalContext* globalCtx) { +void func_8096F640(DemoEc* this, PlayState* play) { s32 animDone = DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); func_8096F544(this, animDone); } -void DemoEc_DrawMido(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawMido(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gMidoEyeOpenTex, gMidoEyeHalfTex, @@ -943,15 +941,15 @@ void DemoEc_DrawMido(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitCucco(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_InitCucco(DemoEc* this, PlayState* play) { AnimationHeader* animation; - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gCuccoSkel); - DemoEc_UseAnimationObject(this, globalCtx); + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gCuccoSkel); + DemoEc_UseAnimationObject(this, play); if (this->actor.params == 22) { animation = &gDemoEcJumpingCuccoAnim; @@ -962,41 +960,41 @@ void DemoEc_InitCucco(DemoEc* this, GlobalContext* globalCtx) { } DemoEc_ChangeAnimation(this, animation, 0, 0.0f, false); - func_8096D64C(this, globalCtx); + func_8096D64C(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_CUCCO; this->drawConfig = EC_DRAW_CUCCO; } -void DemoEc_UpdateCucco(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateCucco(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawCucco(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, NULL, NULL, NULL, NULL); +void DemoEc_DrawCucco(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, NULL, NULL, NULL, NULL); } -void DemoEc_InitCuccoLady(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gCuccoLadySkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitCuccoLady(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gCuccoLadySkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcCuccoLadyAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_CUCCO_LADY; this->drawConfig = EC_DRAW_CUCCO_LADY; } -void DemoEc_UpdateCuccoLady(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateCuccoLady(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawCuccoLady(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawCuccoLady(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gCuccoLadyEyeOpenTex, gCuccoLadyEyeHalfTex, @@ -1005,28 +1003,28 @@ void DemoEc_DrawCuccoLady(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitPotionShopOwner(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_ds2_Skel_004258); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitPotionShopOwner(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_ds2_Skel_004258); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcPotionShopOwnerAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_POTION_SHOP_OWNER; this->drawConfig = EC_DRAW_POTION_SHOP_OWNER; } -void DemoEc_UpdatePotionShopOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdatePotionShopOwner(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawPotionShopOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawPotionShopOwner(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gPotionShopkeeperEyeOpenTex, gPotionShopkeeperEyeHalfTex, @@ -1035,50 +1033,49 @@ void DemoEc_DrawPotionShopOwner(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitMaskShopOwner(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_os_Skel_004658); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitMaskShopOwner(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_os_Skel_004658); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcPotionShopOwnerAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_MASK_SHOP_OWNER; this->drawConfig = EC_DRAW_MASK_SHOP_OWNER; } -void DemoEc_UpdateMaskShopOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateMaskShopOwner(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); - DemoEc_UpdateBgFlags(this, globalCtx); + func_8096D594(this, play); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawMaskShopOwner(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, gOsEyeClosedTex, NULL, NULL, NULL); +void DemoEc_DrawMaskShopOwner(DemoEc* this, PlayState* play) { + DemoEc_DrawSkeleton(this, play, gOsEyeClosedTex, NULL, NULL, NULL); } -void DemoEc_InitFishingOwner(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gFishingOwnerSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitFishingOwner(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gFishingOwnerSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcPotionShopOwnerAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_FISHING_MAN; this->drawConfig = EC_DRAW_FISHING_MAN; } -void DemoEc_UpdateFishingOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateFishingOwner(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_FishingOwnerPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, - Gfx** gfx) { +void DemoEc_FishingOwnerPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { DemoEc* this = (DemoEc*)thisx; if ((limbIndex == 8) && !(HIGH_SCORE(HS_FISHING) & 0x1000)) { @@ -1086,7 +1083,7 @@ void DemoEc_FishingOwnerPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gf } } -void DemoEc_DrawFishingOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawFishingOwner(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gFishingOwnerEyeOpenTex, gFishingOwnerEyeHalfTex, @@ -1095,45 +1092,45 @@ void DemoEc_DrawFishingOwner(DemoEc* this, GlobalContext* globalCtx) { s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, DemoEc_FishingOwnerPostLimbDraw); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, DemoEc_FishingOwnerPostLimbDraw); } -void DemoEc_InitBombchuShopOwner(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &object_rs_Skel_004868); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitBombchuShopOwner(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &object_rs_Skel_004868); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcPotionShopOwnerAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_BOMBCHU_SHOP_OWNER; this->drawConfig = EC_DRAW_BOMBCHU_SHOP_OWNER; } -void DempEc_UpdateBombchuShopOwner(DemoEc* this, GlobalContext* globalCtx) { +void DempEc_UpdateBombchuShopOwner(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawBombchuShopOwner(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawBombchuShopOwner(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gBombchuShopkeeperEyeOpenTex, gBombchuShopkeeperEyeHalfTex, gBombchuShopkeeperEyeClosedTex }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, NULL, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, NULL, NULL, NULL); } -void DemoEc_InitGorons(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_InitGorons(DemoEc* this, PlayState* play) { s32 pad[2]; AnimationHeader* animation; f32 goronScale; Vec3f* scale = &this->actor.scale; - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gGoronSkel); - DemoEc_UseAnimationObject(this, globalCtx); + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gGoronSkel); + DemoEc_UseAnimationObject(this, play); if (this->actor.params == 30) { animation = &gDemoEcGoronAnim; @@ -1155,51 +1152,51 @@ void DemoEc_InitGorons(DemoEc* this, GlobalContext* globalCtx) { scale->y *= goronScale; scale->z *= goronScale; - func_8096D64C(this, globalCtx); + func_8096D64C(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_GORON; this->drawConfig = EC_DRAW_GORON; } -void DemoEc_UpdateGorons(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateGorons(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawGorons(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawGorons(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gGoronCsEyeOpenTex, gGoronCsEyeHalfTex, gGoronCsEyeClosedTex }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, gGoronCsMouthNeutralTex, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, gGoronCsMouthNeutralTex, NULL, NULL); } -void DemoEc_InitMalon(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_UseDrawObject(this, globalCtx); - DemoEc_InitSkelAnime(this, globalCtx, &gMalonAdultSkel); - DemoEc_UseAnimationObject(this, globalCtx); +void DemoEc_InitMalon(DemoEc* this, PlayState* play) { + DemoEc_UseDrawObject(this, play); + DemoEc_InitSkelAnime(this, play, &gMalonAdultSkel); + DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gMalonAdultSingAnim, 0, 0.0f, false); - func_8096D5D4(this, globalCtx); + func_8096D5D4(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->updateMode = EC_UPDATE_MALON; this->drawConfig = EC_DRAW_MALON; } -void DemoEc_UpdateMalon(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_UpdateMalon(DemoEc* this, PlayState* play) { DemoEc_UpdateSkelAnime(this); - func_8096D594(this, globalCtx); + func_8096D594(this, play); DemoEc_UpdateEyes(this); - DemoEc_UpdateBgFlags(this, globalCtx); + DemoEc_UpdateBgFlags(this, play); } -void DemoEc_DrawMalon(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawMalon(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { gMalonAdultEyeOpenTex, gMalonAdultEyeHalfTex, gMalonAdultEyeClosedTex }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; - DemoEc_DrawSkeleton(this, globalCtx, eyeTexture, gMalonAdultMouthHappyTex, NULL, NULL); + DemoEc_DrawSkeleton(this, play, eyeTexture, gMalonAdultMouthHappyTex, NULL, NULL); } static DemoEcInitFunc sInitFuncs[] = { @@ -1240,7 +1237,7 @@ static DemoEcInitFunc sInitFuncs[] = { /* 34 */ DemoEc_InitMalon, }; -void DemoEc_InitNpc(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_InitNpc(DemoEc* this, PlayState* play) { s16 type = this->actor.params; if (sInitFuncs[type] == NULL) { @@ -1250,10 +1247,10 @@ void DemoEc_InitNpc(DemoEc* this, GlobalContext* globalCtx) { return; } - sInitFuncs[type](this, globalCtx); + sInitFuncs[type](this, play); } -void DemoEc_InitCommon(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_InitCommon(DemoEc* this, PlayState* play) { s32 pad; s16 primary; s32 type; @@ -1265,8 +1262,8 @@ void DemoEc_InitCommon(DemoEc* this, GlobalContext* globalCtx) { type = this->actor.params; primary = sDrawObjects[type]; sp28 = sAnimationObjects[type]; - primaryBankIndex = Object_GetIndex(&globalCtx->objectCtx, primary); - secondaryBankIndex = Object_GetIndex(&globalCtx->objectCtx, sp28); + primaryBankIndex = Object_GetIndex(&play->objectCtx, primary); + secondaryBankIndex = Object_GetIndex(&play->objectCtx, sp28); if ((secondaryBankIndex < 0) || (primaryBankIndex < 0)) { // "Demo_Ec_main_bank: Bank unreadable arg_data = %d!" @@ -1275,13 +1272,12 @@ void DemoEc_InitCommon(DemoEc* this, GlobalContext* globalCtx) { return; } - if (Object_IsLoaded(&globalCtx->objectCtx, primaryBankIndex) && - Object_IsLoaded(&globalCtx->objectCtx, secondaryBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, primaryBankIndex) && Object_IsLoaded(&play->objectCtx, secondaryBankIndex)) { this->drawObjBankIndex = primaryBankIndex; this->animObjBankIndex = secondaryBankIndex; - DemoEc_InitNpc(this, globalCtx); + DemoEc_InitNpc(this, play); } } @@ -1317,7 +1313,7 @@ static DemoEcUpdateFunc sUpdateFuncs[] = { DemoEc_UpdateMalon, }; -void DemoEc_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoEc_Update(Actor* thisx, PlayState* play) { DemoEc* this = (DemoEc*)thisx; s32 updateMode = this->updateMode; @@ -1326,13 +1322,13 @@ void DemoEc_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { if (updateMode != EC_UPDATE_COMMON) { - DemoEc_UseAnimationObject(this, globalCtx); + DemoEc_UseAnimationObject(this, play); } - sUpdateFuncs[updateMode](this, globalCtx); + sUpdateFuncs[updateMode](this, play); } } -void DemoEc_DrawCommon(DemoEc* this, GlobalContext* globalCtx) { +void DemoEc_DrawCommon(DemoEc* this, PlayState* play) { } static DemoEcDrawFunc sDrawFuncs[] = { @@ -1350,7 +1346,7 @@ static DemoEcDrawFunc sDrawFuncs[] = { DemoEc_DrawGorons, DemoEc_DrawMalon, }; -void DemoEc_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoEc_Draw(Actor* thisx, PlayState* play) { DemoEc* this = (DemoEc*)thisx; s32 drawConfig = this->drawConfig; @@ -1359,9 +1355,9 @@ void DemoEc_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { if (drawConfig != EC_DRAW_COMMON) { - DemoEc_UseDrawObject(this, globalCtx); + DemoEc_UseDrawObject(this, play); } - sDrawFuncs[drawConfig](this, globalCtx); + sDrawFuncs[drawConfig](this, play); } } diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h index 4ba2e29538..e39e0addc2 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h @@ -6,9 +6,9 @@ struct DemoEc; -typedef void (*DemoEcInitFunc)(struct DemoEc*, GlobalContext*); -typedef void (*DemoEcUpdateFunc)(struct DemoEc*, GlobalContext*); -typedef void (*DemoEcDrawFunc)(struct DemoEc*, GlobalContext*); +typedef void (*DemoEcInitFunc)(struct DemoEc*, PlayState*); +typedef void (*DemoEcUpdateFunc)(struct DemoEc*, PlayState*); +typedef void (*DemoEcDrawFunc)(struct DemoEc*, PlayState*); typedef struct DemoEc { /* 0x0000 */ Actor actor; 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 159c5c1ad0..55a3bd52d6 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -12,55 +12,55 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_Update(Actor* thisx, GlobalContext* globalCtx); +void DemoEffect_Init(Actor* thisx, PlayState* play); +void DemoEffect_Destroy(Actor* thisx, PlayState* play); +void DemoEffect_Update(Actor* thisx, PlayState* play); -void DemoEffect_DrawCrystalLight(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawFireBall(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawBlueOrb(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawLgtShower(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawGodLgt(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawLightRing(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawTriforceSpot(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawGetItem(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawLightEffect(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawTimeWarp(Actor* thisx, GlobalContext* globalCtx); -void DemoEffect_DrawJewel(Actor* thisx, GlobalContext* globalCtx); +void DemoEffect_DrawCrystalLight(Actor* thisx, PlayState* play); +void DemoEffect_DrawFireBall(Actor* thisx, PlayState* play); +void DemoEffect_DrawBlueOrb(Actor* thisx, PlayState* play); +void DemoEffect_DrawLgtShower(Actor* thisx, PlayState* play); +void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play); +void DemoEffect_DrawLightRing(Actor* thisx, PlayState* play); +void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play); +void DemoEffect_DrawGetItem(Actor* thisx, PlayState* play); +void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play); +void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play); +void DemoEffect_DrawJewel(Actor* thisx, PlayState* play); -void DemoEffect_Wait(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_InitTimeWarp(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_InitCreationFireball(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_InitJewel(GlobalContext* globalCtx, DemoEffect* this); +void DemoEffect_Wait(DemoEffect* this, PlayState* play); +void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play); +void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, PlayState* play); +void DemoEffect_InitCreationFireball(DemoEffect* this, PlayState* play); +void DemoEffect_InitJewel(PlayState* play, DemoEffect* this); void DemoEffect_InitJewelColor(DemoEffect* this); -void DemoEffect_UpdateCrystalLight(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdatePositionToParent(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateBlueOrbGrow(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateBlueOrbShrink(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateLgtShower(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateGodLgtDin(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateLightRingExpanding(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateTriforceSpot(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateGetItem(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateLightRingShrinking(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateLightRingTriforce(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateLightEffect(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateJewelAdult(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateDust(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateCreationFireball(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateTimeWarpReturnFromChamberOfSages(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateTimeWarpPullMasterSword(DemoEffect* this, GlobalContext* globalCtx); -void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalCtx); +void DemoEffect_UpdateCrystalLight(DemoEffect* this, PlayState* play); +void DemoEffect_UpdatePositionToParent(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateBlueOrbGrow(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateBlueOrbShrink(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateLgtShower(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateGodLgtDin(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateLightRingExpanding(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateTriforceSpot(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateGetItem(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateLightRingShrinking(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateLightRingTriforce(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateJewelChild(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateJewelAdult(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateDust(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateCreationFireball(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateTimeWarpReturnFromChamberOfSages(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateTimeWarpPullMasterSword(DemoEffect* this, PlayState* play); +void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, PlayState* play); -s32 DemoEffect_CheckCsAction(DemoEffect* this, GlobalContext* globalCtx, s32 csActionCompareId); -void DemoEffect_InitPositionFromCsAction(DemoEffect* this, GlobalContext* globalCtx, s32 csActionIndex); -void DemoEffect_MoveToCsEndpoint(DemoEffect* this, GlobalContext* globalCtx, s32 csActionId, s32 shouldUpdateFacing); -void DemoEffect_MoveGetItem(DemoEffect* this, GlobalContext* globalCtx, s32 csActionId, f32 speed); +s32 DemoEffect_CheckCsAction(DemoEffect* this, PlayState* play, s32 csActionCompareId); +void DemoEffect_InitPositionFromCsAction(DemoEffect* this, PlayState* play, s32 csActionIndex); +void DemoEffect_MoveToCsEndpoint(DemoEffect* this, PlayState* play, s32 csActionId, s32 shouldUpdateFacing); +void DemoEffect_MoveGetItem(DemoEffect* this, PlayState* play, s32 csActionId, f32 speed); const ActorInit Demo_Effect_InitVars = { ACTOR_DEMO_EFFECT, @@ -125,10 +125,9 @@ void DemoEffect_SetupUpdate(DemoEffect* this, DemoEffectFunc updateFunc) { /** * Gives a number on the range of 0.0f - 1.0f representing current cutscene action completion percentage. */ -f32 DemoEffect_InterpolateCsFrames(GlobalContext* globalCtx, s32 csActionId) { - f32 interpolated = - Environment_LerpWeight(globalCtx->csCtx.npcActions[csActionId]->endFrame, - globalCtx->csCtx.npcActions[csActionId]->startFrame, globalCtx->csCtx.frames); +f32 DemoEffect_InterpolateCsFrames(PlayState* play, s32 csActionId) { + f32 interpolated = Environment_LerpWeight(play->csCtx.npcActions[csActionId]->endFrame, + play->csCtx.npcActions[csActionId]->startFrame, play->csCtx.frames); if (interpolated > 1.0f) { interpolated = 1.0f; } @@ -138,14 +137,14 @@ f32 DemoEffect_InterpolateCsFrames(GlobalContext* globalCtx, s32 csActionId) { /** * Initializes information for Jewel/Spritual Stone actors. */ -void DemoEffect_InitJewel(GlobalContext* globalCtx, DemoEffect* this) { +void DemoEffect_InitJewel(PlayState* play, DemoEffect* this) { this->initDrawFunc = DemoEffect_DrawJewel; if (!LINK_IS_ADULT) { this->initUpdateFunc = DemoEffect_UpdateJewelChild; } else { this->initUpdateFunc = DemoEffect_UpdateJewelAdult; } - if (globalCtx->sceneNum == SCENE_TOKINOMA) { + if (play->sceneNum == SCENE_TOKINOMA) { Actor_SetScale(&this->actor, 0.35f); } else { Actor_SetScale(&this->actor, 0.10f); @@ -174,8 +173,8 @@ void DemoEffect_InitGetItem(DemoEffect* this) { /** * Main Actor Init function */ -void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DemoEffect_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DemoEffect* this = (DemoEffect*)thisx; s32 effectType; s32 lightEffect; @@ -190,7 +189,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { objectIndex = sEffectTypeObjects[effectType] == OBJECT_GAMEPLAY_KEEP ? 0 - : Object_GetIndex(&globalCtx->objectCtx, sEffectTypeObjects[effectType]); + : Object_GetIndex(&play->objectCtx, sEffectTypeObjects[effectType]); osSyncPrintf(VT_FGCOL(CYAN) " bank_ID = %d\n" VT_RST, objectIndex); @@ -404,16 +403,16 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetScale(&this->actor, 0.020f); - crystalLight = (DemoEffect*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_CRYSTAL_LIGHT); + crystalLight = (DemoEffect*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, + this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_CRYSTAL_LIGHT); if (crystalLight != NULL) { Actor_SetScale(&crystalLight->actor, 0.6f); } lightRing = (DemoEffect*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &crystalLight->actor, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + &play->actorCtx, &crystalLight->actor, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_LIGHTRING_TRIFORCE); if (lightRing != NULL) { @@ -474,7 +473,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { this->jewelHolderDisplayList = gGiKokiriEmeraldSettingDL; this->jewel.type = DEMO_EFFECT_JEWEL_KOKIRI; this->jewel.isPositionInit = 0; - DemoEffect_InitJewel(globalCtx, this); + DemoEffect_InitJewel(play, this); break; case DEMO_EFFECT_JEWEL_GORON: @@ -482,7 +481,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { this->jewelHolderDisplayList = gGiGoronRubySettingDL; this->jewel.type = DEMO_EFFECT_JEWEL_GORON; this->jewel.isPositionInit = 0; - DemoEffect_InitJewel(globalCtx, this); + DemoEffect_InitJewel(play, this); break; case DEMO_EFFECT_JEWEL_ZORA: @@ -490,9 +489,9 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { this->jewelHolderDisplayList = gGiZoraSapphireSettingDL; this->jewel.type = DEMO_EFFECT_JEWEL_ZORA; this->jewel.isPositionInit = 0; - DemoEffect_InitJewel(globalCtx, this); - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTOR_EN_DOOR); - if ((globalCtx->sceneNum == SCENE_BDAN) && GET_INFTABLE(INFTABLE_145)) { + DemoEffect_InitJewel(play, this); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTOR_EN_DOOR); + if ((play->sceneNum == SCENE_BDAN) && GET_INFTABLE(INFTABLE_145)) { Actor_Kill(&this->actor); return; } @@ -517,13 +516,13 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) { /** * Main Actor Destroy function */ -void DemoEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_Destroy(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; s32 effectType = (this->actor.params & 0x00FF); if (effectType == DEMO_EFFECT_TIMEWARP_MASTERSWORD || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) { - SkelCurve_Destroy(globalCtx, &this->skelCurve); + SkelCurve_Destroy(play, &this->skelCurve); } } @@ -533,8 +532,8 @@ void DemoEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { * They are copied to actor.draw and updateFunc. * initUpdateFunc/initDrawFunc are set during initialization and are NOT executed. */ -void DemoEffect_Wait(DemoEffect* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->initObjectBankIndex)) { +void DemoEffect_Wait(DemoEffect* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->initObjectBankIndex)) { this->actor.objBankIndex = this->initObjectBankIndex; this->actor.draw = this->initDrawFunc; this->updateFunc = this->initUpdateFunc; @@ -546,7 +545,7 @@ void DemoEffect_Wait(DemoEffect* this, GlobalContext* globalCtx) { /** * Copies the current Actor's position to the parent Actor's position. */ -void DemoEffect_UpdatePositionToParent(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdatePositionToParent(DemoEffect* this, PlayState* play) { if (this->actor.parent != NULL) { // Struct copy affects regalloc this->actor.world.pos.x = this->actor.parent->world.pos.x; @@ -561,22 +560,22 @@ void DemoEffect_UpdatePositionToParent(DemoEffect* this, GlobalContext* globalCt * The Crystal Light's position is set to the parent Actor (Triforce) each frame. * If the Crystal Light has no parent Actor, then it will raise into the sky. */ -void DemoEffect_UpdateCrystalLight(DemoEffect* this, GlobalContext* globalCtx) { - DemoEffect_UpdatePositionToParent(this, globalCtx); +void DemoEffect_UpdateCrystalLight(DemoEffect* this, PlayState* play) { + DemoEffect_UpdatePositionToParent(this, play); this->actor.world.pos.y += 14.0f; } /** * Spawns sparkle effects for Medals */ -void DemoEffect_MedalSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 isSmallSpawner) { +void DemoEffect_MedalSparkle(DemoEffect* this, PlayState* play, s32 isSmallSpawner) { Vec3f velocity; Vec3f accel; Vec3f pos; Color_RGBA8 primColor; Color_RGBA8 envColor; - if (isSmallSpawner != 1 || (globalCtx->gameplayFrames & 1) == 0) { + if (isSmallSpawner != 1 || (play->gameplayFrames & 1) == 0) { primColor.r = 255; primColor.g = 255; primColor.b = 255; @@ -603,7 +602,7 @@ void DemoEffect_MedalSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 isS pos.y = Rand_CenteredFloat(10.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(10.0f) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 1000, 16); + EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, 1000, 16); } } @@ -612,14 +611,14 @@ void DemoEffect_MedalSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 isS * Medals and Light Arrows. * It spawns Medal Sparkle Effects and scales/moves the Actor based on the current Cutscene Action */ -void DemoEffect_UpdateGetItem(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateGetItem(DemoEffect* this, PlayState* play) { Actor* thisx = &this->actor; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { if (this->getItem.isPositionInit) { - DemoEffect_MoveGetItem(this, globalCtx, this->csActionId, 0.1f); + DemoEffect_MoveGetItem(this, play, this->csActionId, 0.1f); } else { - DemoEffect_InitPositionFromCsAction(this, globalCtx, this->csActionId); + DemoEffect_InitPositionFromCsAction(this, play, this->csActionId); this->getItem.isPositionInit = 1; } @@ -632,16 +631,16 @@ void DemoEffect_UpdateGetItem(DemoEffect* this, GlobalContext* globalCtx) { Actor_SetScale(thisx, 0.20f); if (gSaveContext.entranceIndex == ENTR_TOKINOMA_0) { - switch (globalCtx->csCtx.npcActions[this->csActionId]->action) { + switch (play->csCtx.npcActions[this->csActionId]->action) { case 2: - DemoEffect_MedalSparkle(this, globalCtx, 0); + DemoEffect_MedalSparkle(this, play, 0); break; case 3: - DemoEffect_MedalSparkle(this, globalCtx, 1); + DemoEffect_MedalSparkle(this, play, 1); break; } } - switch (globalCtx->csCtx.npcActions[this->csActionId]->action) { + switch (play->csCtx.npcActions[this->csActionId]->action) { case 2: if (gSaveContext.entranceIndex == ENTR_TOKINOMA_0) { Audio_PlayActorSound2(thisx, NA_SE_EV_MEDAL_APPEAR_L - SFX_FLAG); @@ -679,16 +678,16 @@ void DemoEffect_UpdateGetItem(DemoEffect* this, GlobalContext* globalCtx) { * 2) Returns from the Chamber of Sages for the first time * 3) Timeblock is cleared with the Song of Time (Large and Small have different versions of Timewarp) */ -void DemoEffect_InitTimeWarp(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { s32 effectType = (this->actor.params & 0x00FF); - if (!SkelCurve_Init(globalCtx, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)) { + if (!SkelCurve_Init(play, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)) { 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_Update(globalCtx, &this->skelCurve); + SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_InitTimeWarpTimeblock; if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE) { @@ -699,12 +698,12 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, GlobalContext* globalCtx) { } else if (gSaveContext.sceneSetupIndex == 5 || gSaveContext.sceneSetupIndex == 4 || (gSaveContext.entranceIndex == ENTR_TOKINOMA_4 && !GET_EVENTCHKINF(EVENTCHKINF_C9))) { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 59.0f, 0.0f); - SkelCurve_Update(globalCtx, &this->skelCurve); + SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_UpdateTimeWarpReturnFromChamberOfSages; osSyncPrintf(VT_FGCOL(CYAN) " 縮むバージョン \n" VT_RST); } else { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 1.0f, 1.0f); - SkelCurve_Update(globalCtx, &this->skelCurve); + SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_UpdateTimeWarpPullMasterSword; osSyncPrintf(VT_FGCOL(CYAN) " 通常 バージョン \n" VT_RST); } @@ -714,14 +713,14 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, GlobalContext* globalCtx) { * Update function for the Timewarp Actor that is used when Link pulls the Mastersword * It changes the Background Music and updates its SkelCurve animation. */ -void DemoEffect_UpdateTimeWarpPullMasterSword(DemoEffect* this, GlobalContext* globalCtx) { - if (Flags_GetEnv(globalCtx, 1)) { +void DemoEffect_UpdateTimeWarpPullMasterSword(DemoEffect* this, PlayState* play) { + if (Flags_GetEnv(play, 1)) { if (!(this->effectFlags & 0x2)) { func_800F3F3C(0); this->effectFlags |= 0x2; } - if (SkelCurve_Update(globalCtx, &this->skelCurve)) { + if (SkelCurve_Update(play, &this->skelCurve)) { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 60.0f, 59.0f, 0.0f); } } @@ -754,7 +753,7 @@ void DemoEffect_TimewarpShrink(f32 size) { * Update function for the Timewarp Actor that is used when Link returns from the Chamber of Sages for the first time. * It shrinks the timewarp vertices and scales the Actor. */ -void DemoEffect_UpdateTimeWarpReturnFromChamberOfSages(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateTimeWarpReturnFromChamberOfSages(DemoEffect* this, PlayState* play) { f32 shrinkProgress; this->timeWarp.shrinkTimer++; @@ -782,7 +781,7 @@ void DemoEffect_UpdateTimeWarpReturnFromChamberOfSages(DemoEffect* this, GlobalC * Update function for the Timewarp Actor that is used when a Timeblock is cleared. * It shrinks the timewarp vertices and scales the Actor. */ -void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, PlayState* play) { f32 shrinkProgress; f32 scale; @@ -811,10 +810,10 @@ void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalC * Initializes information for the Timewarp Actor used for the Timeblock clear effect. * This is an Update Func that is only ran for one frame. */ -void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, PlayState* play) { func_8002F948(&this->actor, NA_SE_EV_TIMETRIP_LIGHT - SFX_FLAG); - if (SkelCurve_Update(globalCtx, &this->skelCurve)) { + if (SkelCurve_Update(play, &this->skelCurve)) { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 60.0f, 59.0f, 0.0f); this->updateFunc = DemoEffect_UpdateTimeWarpTimeblock; this->timeWarp.shrinkTimer = 0; @@ -825,13 +824,13 @@ void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, GlobalContext* globalCtx * Update function for the Triforce Actor. * It rotates and updates the alpha of the Triforce and child actors. */ -void DemoEffect_UpdateTriforceSpot(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateTriforceSpot(DemoEffect* this, PlayState* play) { this->triforceSpot.rotation += 0x03E8; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 0); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 0); - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 2) { + if (play->csCtx.npcActions[this->csActionId]->action == 2) { if (this->primXluColor[0] < 140) { this->primXluColor[0]++; } @@ -853,7 +852,7 @@ void DemoEffect_UpdateTriforceSpot(DemoEffect* this, GlobalContext* globalCtx) { } if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0 && gSaveContext.sceneSetupIndex == 6 && - globalCtx->csCtx.frames == 143) { + play->csCtx.frames == 143) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_RING_EXPLOSION); } } @@ -863,7 +862,7 @@ void DemoEffect_UpdateTriforceSpot(DemoEffect* this, GlobalContext* globalCtx) { * Update function for the LightRing actor that shrinks. * This is used in the creation cutscene when Din leaves a fireball that explodes into Death Mountain. */ -void DemoEffect_UpdateLightRingShrinking(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateLightRingShrinking(DemoEffect* this, PlayState* play) { if (this->lightRing.timer < this->lightRing.timerIncrement) { Actor_Kill(&this->actor); this->lightRing.timer = 0; @@ -889,8 +888,8 @@ void DemoEffect_UpdateLightRingShrinking(DemoEffect* this, GlobalContext* global * These are spawned by Nayru. * These are also used by Din in the creation cutscene when she leaves a fireball that explodes into Death Mountain. */ -void DemoEffect_UpdateLightRingExpanding(DemoEffect* this, GlobalContext* globalCtx) { - DemoEffect_UpdatePositionToParent(this, globalCtx); +void DemoEffect_UpdateLightRingExpanding(DemoEffect* this, PlayState* play) { + DemoEffect_UpdatePositionToParent(this, play); this->lightRing.timer += this->lightRing.timerIncrement; if (this->lightRing.timer >= 225) { @@ -908,17 +907,16 @@ void DemoEffect_UpdateLightRingExpanding(DemoEffect* this, GlobalContext* global * This version spawns a blue orb when the cutscene action state is set to 2. * Once the Blue Orb Actor is spawned the Update Function is changed to the regular Light Ring Expanding Update Func. */ -void DemoEffect_UpdateLightRingTriforce(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateLightRingTriforce(DemoEffect* this, PlayState* play) { DemoEffect* blueOrb; - DemoEffect_UpdatePositionToParent(this, globalCtx); + DemoEffect_UpdatePositionToParent(this, play); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[this->csActionId] != NULL && - globalCtx->csCtx.npcActions[this->csActionId]->action == 2) { - blueOrb = (DemoEffect*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, - this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_BLUE_ORB); + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[this->csActionId] != NULL && play->csCtx.npcActions[this->csActionId]->action == 2) { + blueOrb = (DemoEffect*)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, + DEMO_EFFECT_BLUE_ORB); if (blueOrb != NULL) { Actor_SetScale(&blueOrb->actor, 0.0f); @@ -936,7 +934,7 @@ void DemoEffect_UpdateLightRingTriforce(DemoEffect* this, GlobalContext* globalC * It moves based on gravity and decrements a timer until zero. Once the timer is zero it will spawn other Actors: * A Blue Orb Actor, and a Light Ring Expanding Actor, and a Light Ring Shrinking Actor. */ -void DemoEffect_UpdateCreationFireball(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateCreationFireball(DemoEffect* this, PlayState* play) { DemoEffect* effect; Actor_MoveForward(&this->actor); @@ -947,20 +945,20 @@ void DemoEffect_UpdateCreationFireball(DemoEffect* this, GlobalContext* globalCt return; } - effect = (DemoEffect*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + effect = (DemoEffect*)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, DEMO_EFFECT_BLUE_ORB); if (effect != NULL) { Actor_SetScale(&effect->actor, 0.0f); } - effect = (DemoEffect*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + effect = (DemoEffect*)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, DEMO_EFFECT_LIGHTRING_EXPANDING); if (effect != NULL) { Actor_SetScale(&effect->actor, 0.1f); } - effect = (DemoEffect*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + effect = (DemoEffect*)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, DEMO_EFFECT_LIGHTRING_SHRINKING); if (effect != NULL) { @@ -976,7 +974,7 @@ void DemoEffect_UpdateCreationFireball(DemoEffect* this, GlobalContext* globalCt * This is a special version that is used in the creation cutscene. * It is an Update Function only executed for one frame. The Update Function is then changed to UpdateCreationFireball. */ -void DemoEffect_InitCreationFireball(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_InitCreationFireball(DemoEffect* this, PlayState* play) { Actor* parent = this->actor.parent; this->actor.world.rot.y = parent->shape.rot.y; @@ -994,7 +992,7 @@ void DemoEffect_InitCreationFireball(DemoEffect* this, GlobalContext* globalCtx) * It's spawned in the middle of the expanding Light Ring. * The Blue Orb Actor shrinks after it grows to max size. */ -void DemoEffect_UpdateBlueOrbShrink(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateBlueOrbShrink(DemoEffect* this, PlayState* play) { this->blueOrb.alpha = this->blueOrb.scale * 16; this->blueOrb.scale--; Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); @@ -1010,7 +1008,7 @@ void DemoEffect_UpdateBlueOrbShrink(DemoEffect* this, GlobalContext* globalCtx) * It's spawned in the middle of the expanding Light Ring. * When the scale timer value reaches 0 the Blue Orb's Update Function changes to UpdateBlueOrbShrink. */ -void DemoEffect_UpdateBlueOrbGrow(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateBlueOrbGrow(DemoEffect* this, PlayState* play) { if (this->actor.parent != NULL) { // s32 cast necessary to match codegen. Without the explicit cast to u32 the compiler generates complex cast of // u8 to float @@ -1033,15 +1031,15 @@ void DemoEffect_UpdateBlueOrbGrow(DemoEffect* this, GlobalContext* globalCtx) { * The Light Effect has various use cases. * This function updates the position and scale of the actor based on the current cutscene command. */ -void DemoEffect_UpdateLightEffect(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { u16 action; s32 isLargeSize; isLargeSize = ((this->actor.params & 0x0F00) >> 8); - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 0); - switch (globalCtx->csCtx.npcActions[this->csActionId]->action) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 0); + switch (play->csCtx.npcActions[this->csActionId]->action) { case 2: if (this->light.rotation < 240) { if (!isLargeSize) { @@ -1069,27 +1067,26 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, GlobalContext* globalCtx) { break; } - if (globalCtx->sceneNum == SCENE_SPOT04 && gSaveContext.sceneSetupIndex == 6 && - globalCtx->csCtx.frames == 197) { + if (play->sceneNum == SCENE_SPOT04 && gSaveContext.sceneSetupIndex == 6 && play->csCtx.frames == 197) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WHITE_OUT); } - if (globalCtx->sceneNum == SCENE_SPOT16 && gSaveContext.sceneSetupIndex == 5) { - if (!DemoEffect_CheckCsAction(this, globalCtx, 1)) { + if (play->sceneNum == SCENE_SPOT16 && gSaveContext.sceneSetupIndex == 5) { + if (!DemoEffect_CheckCsAction(this, play, 1)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } - if (globalCtx->csCtx.frames == 640) { + if (play->csCtx.frames == 640) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WHITE_OUT); } if (0) {} } - if (globalCtx->sceneNum == SCENE_SPOT08 && gSaveContext.sceneSetupIndex == 4) { - if (!DemoEffect_CheckCsAction(this, globalCtx, 1)) { + if (play->sceneNum == SCENE_SPOT08 && gSaveContext.sceneSetupIndex == 4) { + if (!DemoEffect_CheckCsAction(this, play, 1)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } - if (globalCtx->csCtx.frames == 648) { + if (play->csCtx.frames == 648) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WHITE_OUT); } @@ -1097,16 +1094,16 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, GlobalContext* globalCtx) { if (0) {} } - if (globalCtx->sceneNum == SCENE_TOKINOMA && gSaveContext.sceneSetupIndex == 14) { + if (play->sceneNum == SCENE_TOKINOMA && gSaveContext.sceneSetupIndex == 14) { if (1) {} - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 2) { + if (play->csCtx.npcActions[this->csActionId]->action == 2) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } } - if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI || globalCtx->sceneNum == SCENE_YOUSEI_IZUMI_YOKO) { - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 2) { + if (play->sceneNum == SCENE_DAIYOUSEI_IZUMI || play->sceneNum == SCENE_YOUSEI_IZUMI_YOKO) { + if (play->csCtx.npcActions[this->csActionId]->action == 2) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } } @@ -1118,7 +1115,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, GlobalContext* globalCtx) { * The Lgt Shower Actor is the green light effect spawned by Farore in the Kokiri Forst creation cutscene. * This function updates the scale and alpha of the Actor. */ -void DemoEffect_UpdateLgtShower(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateLgtShower(DemoEffect* this, PlayState* play) { if (this->lgtShower.alpha > 3) { this->lgtShower.alpha -= 3; this->actor.scale.x *= 1.05f; @@ -1136,14 +1133,14 @@ void DemoEffect_UpdateLgtShower(DemoEffect* this, GlobalContext* globalCtx) { * This function also spawns a Fireball Actor and sets its update function to the special InitCreationFireball. * The spawned Fireball Actor is also scaled to be smaller than regular by this function. */ -void DemoEffect_UpdateGodLgtDin(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateGodLgtDin(DemoEffect* this, PlayState* play) { DemoEffect* fireBall; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 1); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 1); - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 3) { - fireBall = (DemoEffect*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, + if (play->csCtx.npcActions[this->csActionId]->action == 3) { + fireBall = (DemoEffect*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_FIRE_BALL); @@ -1156,22 +1153,22 @@ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, GlobalContext* globalCtx) { if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0) { switch (gSaveContext.sceneSetupIndex) { case 4: - if (globalCtx->csCtx.frames == 288) { + if (play->csCtx.frames == 288) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } - if (globalCtx->csCtx.frames == 635) { + if (play->csCtx.frames == 635) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } break; case 6: - if (globalCtx->csCtx.frames == 55) { + if (play->csCtx.frames == 55) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; case 11: - if (globalCtx->csCtx.frames == 350) { + if (play->csCtx.frames == 350) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; @@ -1186,21 +1183,21 @@ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, GlobalContext* globalCtx) { * This function moves God Lgt Nayure based on the current cutscene command. * This function also spawns expanding light rings around Nayru in the creation cutscene */ -void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) { DemoEffect* lightRing; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 1); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 1); - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 3) { + if (play->csCtx.npcActions[this->csActionId]->action == 3) { if (this->godLgt.lightRingSpawnTimer != 0) { this->godLgt.lightRingSpawnTimer--; } else { this->godLgt.lightRingSpawnTimer = this->godLgt.lightRingSpawnDelay; - lightRing = (DemoEffect*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x + 0x4000, - this->actor.world.rot.y, this->actor.world.rot.z, DEMO_EFFECT_LIGHTRING_EXPANDING); + lightRing = (DemoEffect*)Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x + 0x4000, this->actor.world.rot.y, + this->actor.world.rot.z, DEMO_EFFECT_LIGHTRING_EXPANDING); if (lightRing != NULL) { Actor_SetScale(&lightRing->actor, 1.0f); @@ -1211,19 +1208,19 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, GlobalContext* globalCtx) { if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0) { switch (gSaveContext.sceneSetupIndex) { case 4: - if (globalCtx->csCtx.frames == 298) { + if (play->csCtx.frames == 298) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } break; case 6: - if (globalCtx->csCtx.frames == 105) { + if (play->csCtx.frames == 105) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; case 11: - if (globalCtx->csCtx.frames == 360) { + if (play->csCtx.frames == 360) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; @@ -1231,10 +1228,10 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, GlobalContext* globalCtx) { } if (gSaveContext.entranceIndex == ENTR_SPOT16_0 && gSaveContext.sceneSetupIndex == 4) { - if (globalCtx->csCtx.frames == 72) { + if (play->csCtx.frames == 72) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } - if (globalCtx->csCtx.frames == 80) { + if (play->csCtx.frames == 80) { func_800F3F3C(4); } } @@ -1247,16 +1244,16 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, GlobalContext* globalCtx) { * This function moves God Lgt Farore based on the current cutscene command. * This function also spawns an Lgt Shower Actor during the Kokiri creation cutscene. */ -void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, PlayState* play) { DemoEffect* lgtShower; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 1); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL) { + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 1); - if (globalCtx->csCtx.npcActions[this->csActionId]->action == 3) { - lgtShower = (DemoEffect*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, - this->actor.world.pos.y - 150.0f, this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_LGT_SHOWER); + if (play->csCtx.npcActions[this->csActionId]->action == 3) { + lgtShower = (DemoEffect*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, + this->actor.world.pos.x, this->actor.world.pos.y - 150.0f, + this->actor.world.pos.z, 0, 0, 0, DEMO_EFFECT_LGT_SHOWER); if (lgtShower != NULL) { lgtShower->actor.scale.x = 0.23f; @@ -1271,19 +1268,19 @@ void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, GlobalContext* globalCtx) { if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0) { switch (gSaveContext.sceneSetupIndex) { case 4: - if (globalCtx->csCtx.frames == 315) { + if (play->csCtx.frames == 315) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } break; case 6: - if (globalCtx->csCtx.frames == 80) { + if (play->csCtx.frames == 80) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; case 11: - if (globalCtx->csCtx.frames == 370) { + if (play->csCtx.frames == 370) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; @@ -1436,7 +1433,7 @@ void DemoEffect_MoveJewelSpherical(f32 degrees, f32 frameDivisor, Vec3f startPos * This is used by the Jewel Actor during the Door of Time activation cutscene. * This is run when the Jewels merge from Link and begin orbiting him. */ -void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, PlayState* play) { Vec3f startPos; Vec3f endPos; f32 frameDivisor; @@ -1445,14 +1442,14 @@ void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, GlobalContext* glo s32 csActionId; csActionId = this->csActionId; - startPos.x = globalCtx->csCtx.npcActions[csActionId]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[csActionId]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[csActionId]->startPos.z; - endPos.x = globalCtx->csCtx.npcActions[csActionId]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[csActionId]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[csActionId]->endPos.z; + startPos.x = play->csCtx.npcActions[csActionId]->startPos.x; + startPos.y = play->csCtx.npcActions[csActionId]->startPos.y; + startPos.z = play->csCtx.npcActions[csActionId]->startPos.z; + endPos.x = play->csCtx.npcActions[csActionId]->endPos.x; + endPos.y = play->csCtx.npcActions[csActionId]->endPos.y; + endPos.z = play->csCtx.npcActions[csActionId]->endPos.z; - frameDivisor = DemoEffect_InterpolateCsFrames(globalCtx, csActionId); + frameDivisor = DemoEffect_InterpolateCsFrames(play, csActionId); switch (this->jewel.type) { case DEMO_EFFECT_JEWEL_KOKIRI: @@ -1485,7 +1482,7 @@ void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, GlobalContext* glo /** * Spawns Sparkle Effects for the Jewel Actor. */ -void DemoEffect_JewelSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 spawnerCount) { +void DemoEffect_JewelSparkle(DemoEffect* this, PlayState* play, s32 spawnerCount) { Vec3f velocity; Vec3f accel; Color_RGBA8 primColor; @@ -1513,8 +1510,8 @@ void DemoEffect_JewelSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 spa velocity.x = (Rand_ZeroOne() - 0.5f) * 1.5f; velocity.z = (Rand_ZeroOne() - 0.5f) * 1.5f; - EffectSsKiraKira_SpawnDispersed(globalCtx, &this->actor.world.pos, &velocity, &accel, &primColor, &envColor, - 3000, 16); + EffectSsKiraKira_SpawnDispersed(play, &this->actor.world.pos, &velocity, &accel, &primColor, &envColor, 3000, + 16); } } @@ -1522,8 +1519,8 @@ void DemoEffect_JewelSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 spa * Plays Jewel sound effects. * The sSfxJewelId global variable is used to ensure only one Jewel Actor is playing SFX when all are spawned. */ -void DemoEffect_PlayJewelSfx(DemoEffect* this, GlobalContext* globalCtx) { - if (!DemoEffect_CheckCsAction(this, globalCtx, 1)) { +void DemoEffect_PlayJewelSfx(DemoEffect* this, PlayState* play) { + if (!DemoEffect_CheckCsAction(this, play, 1)) { if (this->actor.params == sSfxJewelId[0]) { func_8002F974(&this->actor, NA_SE_EV_SPIRIT_STONE - SFX_FLAG); } else if (sSfxJewelId[0] == 0) { @@ -1540,10 +1537,10 @@ void DemoEffect_PlayJewelSfx(DemoEffect* this, GlobalContext* globalCtx) { * If a value of less than 1.0f were passed to SetJewelColor, then it would appear to drain the Jewel's color. * This can be seen in preprelease screenshots. */ -void DemoEffect_UpdateJewelAdult(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateJewelAdult(DemoEffect* this, PlayState* play) { this->jewel.timer++; this->actor.shape.rot.y += 0x0400; - DemoEffect_PlayJewelSfx(this, globalCtx); + DemoEffect_PlayJewelSfx(this, play); DemoEffect_SetJewelColor(this, 1.0f); } @@ -1552,32 +1549,32 @@ void DemoEffect_UpdateJewelAdult(DemoEffect* this, GlobalContext* globalCtx) { * This rotates the Jewel and updates a timer that is used to scroll Jewel textures. * This also updates the Jewel's position based on different cutscenes. */ -void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateJewelChild(DemoEffect* this, PlayState* play) { s32 hasCmdAction; Actor* thisx = &this->actor; this->jewel.timer++; - if (globalCtx->csCtx.state && globalCtx->csCtx.npcActions[this->csActionId]) { - switch (globalCtx->csCtx.npcActions[this->csActionId]->action) { + if (play->csCtx.state && play->csCtx.npcActions[this->csActionId]) { + switch (play->csCtx.npcActions[this->csActionId]->action) { case 3: if (GET_EVENTCHKINF(EVENTCHKINF_4B)) { SET_EVENTCHKINF(EVENTCHKINF_4B); } - DemoEffect_MoveJewelActivateDoorOfTime(this, globalCtx); - if ((globalCtx->gameplayFrames & 1) == 0) { - DemoEffect_JewelSparkle(this, globalCtx, 1); + DemoEffect_MoveJewelActivateDoorOfTime(this, play); + if ((play->gameplayFrames & 1) == 0) { + DemoEffect_JewelSparkle(this, play, 1); } break; case 4: if (this->jewel.isPositionInit) { - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 0); + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 0); DemoEffect_MoveJewelSplit(&thisx->world, this); - if ((globalCtx->gameplayFrames & 1) == 0) { - DemoEffect_JewelSparkle(this, globalCtx, 1); + if ((play->gameplayFrames & 1) == 0) { + DemoEffect_JewelSparkle(this, play, 1); } } else { - DemoEffect_InitPositionFromCsAction(this, globalCtx, this->csActionId); + DemoEffect_InitPositionFromCsAction(this, play, this->csActionId); DemoEffect_MoveJewelSplit(&thisx->world, this); this->jewel.isPositionInit = 1; } @@ -1586,7 +1583,7 @@ void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx) { Actor_Kill(thisx); return; default: - DemoEffect_MoveToCsEndpoint(this, globalCtx, this->csActionId, 0); + DemoEffect_MoveToCsEndpoint(this, play, this->csActionId, 0); if (gSaveContext.entranceIndex == ENTR_TOKINOMA_0) { DemoEffect_MoveJewelSplit(&thisx->world, this); } @@ -1596,7 +1593,7 @@ void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx) { if (gSaveContext.entranceIndex == ENTR_TOKINOMA_0) { if (!GET_EVENTCHKINF(EVENTCHKINF_4B)) { - hasCmdAction = globalCtx->csCtx.state && globalCtx->csCtx.npcActions[this->csActionId]; + hasCmdAction = play->csCtx.state && play->csCtx.npcActions[this->csActionId]; if (!hasCmdAction) { this->effectFlags |= 0x1; return; @@ -1605,7 +1602,7 @@ void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx) { } thisx->shape.rot.y += 0x0400; - DemoEffect_PlayJewelSfx(this, globalCtx); + DemoEffect_PlayJewelSfx(this, play); this->effectFlags &= ~1; } @@ -1614,13 +1611,13 @@ void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx) { * This is the dust that is spawned in the Temple of Time during the Light Arrows cutscene. * This spawns the dust particles and increments a timer */ -void DemoEffect_UpdateDust(DemoEffect* this, GlobalContext* globalCtx) { +void DemoEffect_UpdateDust(DemoEffect* this, PlayState* play) { Vec3f pos; Vec3f velocity; Vec3f accel; - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL && - globalCtx->csCtx.npcActions[this->csActionId]->action == 2) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL && + play->csCtx.npcActions[this->csActionId]->action == 2) { pos = this->actor.world.pos; pos.y += 600.0f; @@ -1635,7 +1632,7 @@ void DemoEffect_UpdateDust(DemoEffect* this, GlobalContext* globalCtx) { accel.x = 0.0f; accel.y = 0.2f; - func_8002873C(globalCtx, &pos, &velocity, &accel, 300, 0, 30); + func_8002873C(play, &pos, &velocity, &accel, 300, 0, 30); this->dust.timer++; } @@ -1644,17 +1641,17 @@ void DemoEffect_UpdateDust(DemoEffect* this, GlobalContext* globalCtx) { /** * This is the main Actor Update Function. */ -void DemoEffect_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_Update(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); } /** * Check if the current cutscene action matches the passed in cutscene action ID. */ -s32 DemoEffect_CheckCsAction(DemoEffect* this, GlobalContext* globalCtx, s32 csActionCompareId) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->csActionId] != NULL && - globalCtx->csCtx.npcActions[this->csActionId]->action == csActionCompareId) { +s32 DemoEffect_CheckCsAction(DemoEffect* this, PlayState* play, s32 csActionCompareId) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->csActionId] != NULL && + play->csCtx.npcActions[this->csActionId]->action == csActionCompareId) { return 1; } @@ -1664,35 +1661,35 @@ s32 DemoEffect_CheckCsAction(DemoEffect* this, GlobalContext* globalCtx, s32 csA /** * Draw function for the Jewel Actor. */ -void DemoEffect_DrawJewel(Actor* thisx, GlobalContext* globalCtx2) { +void DemoEffect_DrawJewel(Actor* thisx, PlayState* play2) { DemoEffect* this = (DemoEffect*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; u32 frames = this->jewel.timer; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2543); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2543); - if (!DemoEffect_CheckCsAction(this, globalCtx, 1)) { + if (!DemoEffect_CheckCsAction(this, play, 1)) { if (1) {} if (!(this->effectFlags & 0x1)) { switch (this->jewel.type) { case DEMO_EFFECT_JEWEL_KOKIRI: gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 4) % 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 4) % 256, (256 - ((frames * 2) % 256)) - 1, 64, 64, 1, (frames * 2) % 256, (256 - (frames % 256)) - 1, 16, 16)); break; case DEMO_EFFECT_JEWEL_GORON: gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 4) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 4) % 128, (256 - ((frames * 2) % 256)) - 1, 32, 64, 1, (frames * 2) % 256, (256 - (frames % 256)) - 1, 16, 8)); break; case DEMO_EFFECT_JEWEL_ZORA: gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 4) % 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 4) % 256, (256 - ((frames * 2) % 256)) - 1, 32, 32, 1, (frames * 2) % 256, (256 - (frames % 256)) - 1, 16, 16)); break; @@ -1700,19 +1697,19 @@ void DemoEffect_DrawJewel(Actor* thisx, GlobalContext* globalCtx2) { if (!frames) {} - gSPSegment(POLY_OPA_DISP++, 8, Gfx_TexScroll(globalCtx->state.gfxCtx, (u8)frames, (u8)frames, 16, 16)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2597), + gSPSegment(POLY_OPA_DISP++, 8, Gfx_TexScroll(play->state.gfxCtx, (u8)frames, (u8)frames, 16, 16)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2597), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2599), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2599), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); - func_8002ED80(&this->actor, globalCtx, 0); + func_80093D84(play->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, this->primXluColor[0], this->primXluColor[1], this->primXluColor[2], 255); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); gSPDisplayList(POLY_XLU_DISP++, this->jewelDisplayList); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); gDPSetPrimColor(POLY_OPA_DISP++, 0, 128, this->primOpaColor[0], this->primOpaColor[1], this->primOpaColor[2], 255); gDPSetEnvColor(POLY_OPA_DISP++, this->envOpaColor[0], this->envOpaColor[1], this->envOpaColor[2], 255); @@ -1720,18 +1717,18 @@ void DemoEffect_DrawJewel(Actor* thisx, GlobalContext* globalCtx2) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2620); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2620); } /** * Draw function for the Crystal Light Actor. */ -void DemoEffect_DrawCrystalLight(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawCrystalLight(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; DemoEffect* parent = (DemoEffect*)this->actor.parent; - u32 frames = globalCtx->gameplayFrames & 0xFFFF; + u32 frames = play->gameplayFrames & 0xFFFF; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2634); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2634); if (parent != NULL) { gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 170, parent->triforceSpot.crystalLightOpacity); @@ -1739,16 +1736,16 @@ void DemoEffect_DrawCrystalLight(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 170, 255); } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 2) % 512, 512 - (frames % 512) - 1, 128, 128, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 2) % 512, 512 - (frames % 512) - 1, 128, 128, 1, 512 - ((frames * 2) % 512) - 1, 0, 64, 64)); Matrix_Push(); Matrix_RotateY(0.0f, MTXMODE_APPLY); Matrix_RotateX(DEG_TO_RAD(11), MTXMODE_APPLY); Matrix_Translate(0.0f, 150.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2661), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2661), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCrystalLightDL); Matrix_Pop(); @@ -1756,7 +1753,7 @@ void DemoEffect_DrawCrystalLight(Actor* thisx, GlobalContext* globalCtx) { 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); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2672), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2672), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCrystalLightDL); Matrix_Pop(); @@ -1764,49 +1761,48 @@ void DemoEffect_DrawCrystalLight(Actor* thisx, GlobalContext* globalCtx) { 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); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2683), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2683), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCrystalLightDL); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2688); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2688); } /** * Draw function for the Fire Ball Actor. */ -void DemoEffect_DrawFireBall(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawFireBall(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2701); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2701); gDPSetPrimColor(POLY_XLU_DISP++, 64, 64, 255, 200, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 255); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2709), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2709), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPMatrix(POLY_XLU_DISP++, globalCtx->billboardMtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); - gSPSegment( - POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 128 - ((frames * 20) % 128) - 1, 32, 32)); + gSPMatrix(POLY_XLU_DISP++, play->billboardMtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); + gSPSegment(POLY_XLU_DISP++, 8, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 128 - ((frames * 20) % 128) - 1, 32, 32)); gSPDisplayList(POLY_XLU_DISP++, gCreationFireBallDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2723); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2723); } /** * Draw function for the God Lgt Actors. * This draws either Din, Nayru, or Farore based on the colors set in the DemoEffect struct. */ -void DemoEffect_DrawGodLgt(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; s32 pad; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2737); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2737); - if (!DemoEffect_CheckCsAction(this, globalCtx, 2)) { + if (!DemoEffect_CheckCsAction(this, play, 2)) { if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0) { if (gSaveContext.sceneSetupIndex == 4) { - if (globalCtx->csCtx.frames <= 680) { + if (play->csCtx.frames <= 680) { func_80078914(&this->actor.projectedPos, NA_SE_EV_GOD_FLYING - SFX_FLAG); } } else { @@ -1817,21 +1813,21 @@ void DemoEffect_DrawGodLgt(Actor* thisx, GlobalContext* globalCtx) { } gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 4) % 512, 0, 128, 64, 1, (frames * 2) % 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 4) % 512, 0, 128, 64, 1, (frames * 2) % 256, 512 - ((frames * 70) % 512) - 1, 64, 32)); gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 96, 1, (frames * 10) % 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 16, 96, 1, (frames * 10) % 256, 256 - ((frames * 30) % 512) - 1, 8, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, this->primXluColor[0], this->primXluColor[1], this->primXluColor[2], 255); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Push(); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2801), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2801), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGoldenGoddessAuraDL); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); Matrix_Pop(); this->godLgt.rotation++; @@ -1844,141 +1840,141 @@ void DemoEffect_DrawGodLgt(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, -140.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2824), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2824), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoldenGoddessBodyDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2829); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2829); } /** * Draw function for the Light Effect Actor. */ -void DemoEffect_DrawLightEffect(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; u8* alpha; Gfx* disp; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2842); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2842); - if (!DemoEffect_CheckCsAction(this, globalCtx, 1)) { + if (!DemoEffect_CheckCsAction(this, play, 1)) { if (this->light.flicker == 0) { this->light.flicker = 1; } else { disp = (u32)gEffFlash1DL; // necessary to match, should be able to remove after fake matches are fixed alpha = &this->light.alpha; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, this->primXluColor[0], this->primXluColor[1], this->primXluColor[2], *alpha); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); Matrix_Scale(((this->light.scaleFlag & 1) * 0.05f) + 1.0f, ((this->light.scaleFlag & 1) * 0.05f) + 1.0f, ((this->light.scaleFlag & 1) * 0.05f) + 1.0f, MTXMODE_APPLY); Matrix_Push(); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(this->light.rotation), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2866), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2866), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); if (disp) {}; gSPDisplayList(POLY_XLU_DISP++, disp); Matrix_Pop(); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(-(f32)this->light.rotation), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2874), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2874), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, disp); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2881); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2881); } /** * Draw function for the Blue Orb Actor. */ -void DemoEffect_DrawBlueOrb(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawBlueOrb(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2892); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2892); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 188, 255, 255, this->blueOrb.alpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 255); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_80093D84(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD(this->blueOrb.rotation), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2901), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2901), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); this->blueOrb.rotation += 0x01F4; gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2907); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2907); } /** * Draw function for the Lgt Shower Actor. */ -void DemoEffect_DrawLgtShower(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawLgtShower(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; s32 pad; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2921); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2921); gDPSetPrimColor(POLY_XLU_DISP++, 64, 64, 255, 255, 160, this->lgtShower.alpha); gDPSetEnvColor(POLY_XLU_DISP++, 50, 200, 0, 255); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2927), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2927), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 5) % 1024, 0, 256, 64, 1, (frames * 10) % 128, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 5) % 1024, 0, 256, 64, 1, (frames * 10) % 128, 512 - ((frames * 50) % 512), 32, 16)); gSPDisplayList(POLY_XLU_DISP++, gEnliveningLightDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2942); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2942); } /** * Draw function for the Light Ring Actor. */ -void DemoEffect_DrawLightRing(Actor* thisx, GlobalContext* globalCtx2) { +void DemoEffect_DrawLightRing(Actor* thisx, PlayState* play2) { DemoEffect* this = (DemoEffect*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; u32 frames = this->lightRing.timer; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2956); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2956); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 170, 255, 255, this->lightRing.alpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 255); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2963), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2963), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 5) % 64, 512 - ((frames * 2) % 512) - 1, 16, 128, - 1, 0, 0, 8, 1024)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 5) % 64, 512 - ((frames * 2) % 512) - 1, 16, 128, 1, 0, + 0, 8, 1024)); gSPDisplayList(POLY_XLU_DISP++, gGoldenGoddessLightRingDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2978); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2978); } /** * Draw function for the Triforce Spot Actor. */ -void DemoEffect_DrawTriforceSpot(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; s32 pad; Vtx* vertices = SEGMENTED_TO_VIRTUAL(gTriforceVtx); - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2994); - if (gSaveContext.entranceIndex != ENTR_NAKANIWA_0 || globalCtx->csCtx.frames < 885) { - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2994); + if (gSaveContext.entranceIndex != ENTR_NAKANIWA_0 || play->csCtx.frames < 885) { + func_80093D84(play->state.gfxCtx); if (this->triforceSpot.lightColumnOpacity > 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_AURORA - SFX_FLAG); Matrix_Push(); Matrix_Scale(1.0f, 2.4f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 3011), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 3011), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 256 - ((frames * 4) % 256) - 1, 64, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 256 - ((frames * 4) % 256) - 1, 64, 64, 1, 0, 256 - ((frames * 2) % 256) - 1, 64, 32)); vertices[86].n.a = vertices[87].n.a = vertices[88].n.a = vertices[89].n.a = vertices[92].n.a = vertices[93].n.a = vertices[94].n.a = vertices[95].n.a = (s8)this->triforceSpot.lightColumnOpacity; @@ -1990,72 +1986,70 @@ void DemoEffect_DrawTriforceSpot(Actor* thisx, GlobalContext* globalCtx) { if (this->triforceSpot.triforceSpotOpacity != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_TRIFORCE - SFX_FLAG); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 3042), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 3042), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->triforceSpot.triforceSpotOpacity < 250) { - func_8002ED80(&this->actor, globalCtx, 0); - func_80093D84(globalCtx->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); + func_80093D84(play->state.gfxCtx); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2); Matrix_RotateY(BINANG_TO_RAD(this->triforceSpot.rotation), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 3053), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 3053), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 16, 1, 0, 0, 16, 8)); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 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); } else { - func_8002EBCC(&this->actor, globalCtx, 0); - func_80093D18(globalCtx->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); + func_80093D18(play->state.gfxCtx); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_PASS, G_RM_AA_ZB_OPA_SURF2); Matrix_RotateY(BINANG_TO_RAD(this->triforceSpot.rotation), MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 3085), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 3085), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_OPA_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 16, 1, 0, 0, 16, 8)); + gSPSegment(POLY_OPA_DISP++, 8, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 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); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 3112); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 3112); } /** * Draw function for the Get Item Actors. * This is either Medals or Light Arrows based on the drawId. */ -void DemoEffect_DrawGetItem(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawGetItem(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; - if (!DemoEffect_CheckCsAction(this, globalCtx, 1) && !DemoEffect_CheckCsAction(this, globalCtx, 4)) { + if (!DemoEffect_CheckCsAction(this, play, 1) && !DemoEffect_CheckCsAction(this, play, 4)) { if (!this->getItem.isLoaded) { this->getItem.isLoaded = 1; return; } - func_8002EBCC(thisx, globalCtx, 0); - func_8002ED80(thisx, globalCtx, 0); - GetItem_Draw(globalCtx, this->getItem.drawId); + func_8002EBCC(thisx, play, 0); + func_8002ED80(thisx, play, 0); + GetItem_Draw(play, this->getItem.drawId); } } /** * Callback for the SkelCurve system to draw the animated limbs. */ -s32 DemoEffect_OverrideLimbDrawTimeWarp(GlobalContext* globalCtx, SkelCurve* skelCurve, s32 limbIndex, void* thisx) { +s32 DemoEffect_OverrideLimbDrawTimeWarp(PlayState* play, SkelCurve* skelCurve, s32 limbIndex, void* thisx) { s32 pad; DemoEffect* this = (DemoEffect*)thisx; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 3154); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 3154); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, 170, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 6) % 1024, 256 - ((frames * 16) % 256) - 1, 256, - 64, 1, (frames * 4) % 512, 128 - ((frames * 12) % 128) - 1, 128, 32)); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 3172); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 6) % 1024, 256 - ((frames * 16) % 256) - 1, 256, 64, 1, + (frames * 4) % 512, 128 - ((frames * 12) % 128) - 1, 128, 32)); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 3172); if (limbIndex == 0) { s16* transform = skelCurve->jointTable[0]; @@ -2070,19 +2064,18 @@ s32 DemoEffect_OverrideLimbDrawTimeWarp(GlobalContext* globalCtx, SkelCurve* ske /** * Draw function for the Time Warp Actors. */ -void DemoEffect_DrawTimeWarp(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 effectType = (this->actor.params & 0x00FF); if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL || - Flags_GetEnv(globalCtx, 1) || gSaveContext.sceneSetupIndex >= 4 || - gSaveContext.entranceIndex == ENTR_TOKINOMA_4) { + Flags_GetEnv(play, 1) || gSaveContext.sceneSetupIndex >= 4 || gSaveContext.entranceIndex == ENTR_TOKINOMA_4) { OPEN_DISPS(gfxCtx, "../z_demo_effect.c", 3201); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 25); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - SkelCurve_Draw(&this->actor, globalCtx, &this->skelCurve, DemoEffect_OverrideLimbDrawTimeWarp, NULL, 1, + SkelCurve_Draw(&this->actor, play, &this->skelCurve, DemoEffect_OverrideLimbDrawTimeWarp, NULL, 1, &this->actor); CLOSE_DISPS(gfxCtx, "../z_demo_effect.c", 3216); @@ -2107,19 +2100,19 @@ void DemoEffect_FaceToCsEndpoint(DemoEffect* this, Vec3f startPos, Vec3f endPos) * Will only update the Actor's facing/rotation if the shouldUpdateFacing argument is true. * The speed is based on the current progress in the cutscene action. */ -void DemoEffect_MoveToCsEndpoint(DemoEffect* this, GlobalContext* globalCtx, s32 csActionId, s32 shouldUpdateFacing) { +void DemoEffect_MoveToCsEndpoint(DemoEffect* this, PlayState* play, s32 csActionId, s32 shouldUpdateFacing) { Vec3f startPos; Vec3f endPos; f32 speed; - startPos.x = globalCtx->csCtx.npcActions[csActionId]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[csActionId]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[csActionId]->startPos.z; - endPos.x = globalCtx->csCtx.npcActions[csActionId]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[csActionId]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[csActionId]->endPos.z; + startPos.x = play->csCtx.npcActions[csActionId]->startPos.x; + startPos.y = play->csCtx.npcActions[csActionId]->startPos.y; + startPos.z = play->csCtx.npcActions[csActionId]->startPos.z; + endPos.x = play->csCtx.npcActions[csActionId]->endPos.x; + endPos.y = play->csCtx.npcActions[csActionId]->endPos.y; + endPos.z = play->csCtx.npcActions[csActionId]->endPos.z; - speed = DemoEffect_InterpolateCsFrames(globalCtx, csActionId); + speed = DemoEffect_InterpolateCsFrames(play, csActionId); this->actor.world.pos.x = ((endPos.x - startPos.x) * speed) + startPos.x; this->actor.world.pos.y = ((endPos.y - startPos.y) * speed) + startPos.y; @@ -2133,21 +2126,21 @@ void DemoEffect_MoveToCsEndpoint(DemoEffect* this, GlobalContext* globalCtx, s32 /** * Moves a GetItem actor towards the current cutscene action's endpoint. */ -void DemoEffect_MoveGetItem(DemoEffect* this, GlobalContext* globalCtx, s32 csActionId, f32 speed) { +void DemoEffect_MoveGetItem(DemoEffect* this, PlayState* play, s32 csActionId, f32 speed) { Vec3f endPos; - endPos.x = globalCtx->csCtx.npcActions[csActionId]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[csActionId]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[csActionId]->endPos.z; + endPos.x = play->csCtx.npcActions[csActionId]->endPos.x; + endPos.y = play->csCtx.npcActions[csActionId]->endPos.y; + endPos.z = play->csCtx.npcActions[csActionId]->endPos.z; DemoEffect_MoveTowardTarget(endPos, this, speed); } /** * Initializes the Actor's position to the current cutscene action's start point. */ -void DemoEffect_InitPositionFromCsAction(DemoEffect* this, GlobalContext* globalCtx, s32 csActionIndex) { - f32 x = globalCtx->csCtx.npcActions[csActionIndex]->startPos.x; - f32 y = globalCtx->csCtx.npcActions[csActionIndex]->startPos.y; - f32 z = globalCtx->csCtx.npcActions[csActionIndex]->startPos.z; +void DemoEffect_InitPositionFromCsAction(DemoEffect* this, PlayState* play, s32 csActionIndex) { + f32 x = play->csCtx.npcActions[csActionIndex]->startPos.x; + f32 y = play->csCtx.npcActions[csActionIndex]->startPos.y; + f32 z = play->csCtx.npcActions[csActionIndex]->startPos.z; this->actor.world.pos.x = x; this->actor.world.pos.y = y; 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 42f1cd1307..14e00067c7 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h @@ -6,7 +6,7 @@ struct DemoEffect; -typedef void (*DemoEffectFunc)(struct DemoEffect*, GlobalContext*); +typedef void (*DemoEffectFunc)(struct DemoEffect*, PlayState*); typedef struct { /* 0x00 */ u8 timer; 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 95cecfc0bd..3779da75a0 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -21,15 +21,15 @@ typedef enum { /* 0x01 */ EXT_DRAW_VORTEX } DemoExtDrawMode; -void DemoExt_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoExt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoExt_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoExt_Draw(Actor* thisx, GlobalContext* globalCtx); +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 DemoExt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_Destroy(Actor* thisx, PlayState* play) { } -void DemoExt_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_Init(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; this->scrollIncr[0] = 25; @@ -50,9 +50,9 @@ void DemoExt_PlayVortexSFX(DemoExt* this) { } } -CsCmdActorAction* DemoExt_GetNpcAction(GlobalContext* globalCtx, s32 npcActionIndex) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[npcActionIndex]; +CsCmdActorAction* DemoExt_GetNpcAction(PlayState* play, s32 npcActionIndex) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[npcActionIndex]; } return NULL; } @@ -62,8 +62,8 @@ void DemoExt_SetupWait(DemoExt* this) { this->drawMode = EXT_DRAW_NOTHING; } -void DemoExt_SetupMaintainVortex(DemoExt* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoExt_GetNpcAction(globalCtx, 5); +void DemoExt_SetupMaintainVortex(DemoExt* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoExt_GetNpcAction(play, 5); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -87,8 +87,8 @@ void DemoExt_FinishClosing(DemoExt* this) { } } -void DemoExt_CheckCsMode(DemoExt* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = DemoExt_GetNpcAction(globalCtx, 5); +void DemoExt_CheckCsMode(DemoExt* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = DemoExt_GetNpcAction(play, 5); s32 csAction; s32 previousCsAction; @@ -102,7 +102,7 @@ void DemoExt_CheckCsMode(DemoExt* this, GlobalContext* globalCtx) { DemoExt_SetupWait(this); break; case 2: - DemoExt_SetupMaintainVortex(this, globalCtx); + DemoExt_SetupMaintainVortex(this, play); break; case 3: DemoExt_SetupDispellVortex(this); @@ -144,17 +144,17 @@ void DemoExt_SetColorsAndScales(DemoExt* this) { scale->z = (kREG(21) + 400.0f) * shrinkFactor; } -void DemoExt_Wait(DemoExt* this, GlobalContext* globalCtx) { - DemoExt_CheckCsMode(this, globalCtx); +void DemoExt_Wait(DemoExt* this, PlayState* play) { + DemoExt_CheckCsMode(this, play); } -void DemoExt_MaintainVortex(DemoExt* this, GlobalContext* globalCtx) { +void DemoExt_MaintainVortex(DemoExt* this, PlayState* play) { DemoExt_PlayVortexSFX(this); DemoExt_SetScrollAndRotation(this); - DemoExt_CheckCsMode(this, globalCtx); + DemoExt_CheckCsMode(this, play); } -void DemoExt_DispellVortex(DemoExt* this, GlobalContext* globalCtx) { +void DemoExt_DispellVortex(DemoExt* this, PlayState* play) { DemoExt_PlayVortexSFX(this); DemoExt_SetScrollAndRotation(this); DemoExt_SetColorsAndScales(this); @@ -167,21 +167,21 @@ static DemoExtActionFunc sActionFuncs[] = { DemoExt_DispellVortex, }; -void DemoExt_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_Update(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; if ((this->action < EXT_WAIT) || (this->action > EXT_DISPELL) || sActionFuncs[this->action] == NULL) { // "Main mode is abnormal!" osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } } -void DemoExt_DrawNothing(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_DrawNothing(Actor* thisx, PlayState* play) { } -void DemoExt_DrawVortex(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_DrawVortex(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; Mtx* mtx; GraphicsContext* gfxCtx; @@ -189,7 +189,7 @@ void DemoExt_DrawVortex(Actor* thisx, GlobalContext* globalCtx) { Vec3f* scale; scale = &this->scale; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; mtx = Graph_Alloc(gfxCtx, sizeof(Mtx)); OPEN_DISPS(gfxCtx, "../z_demo_ext.c", 460); @@ -221,7 +221,7 @@ static DemoExtDrawFunc sDrawFuncs[] = { DemoExt_DrawVortex, }; -void DemoExt_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoExt_Draw(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; if ((this->drawMode < EXT_DRAW_NOTHING) || (this->drawMode > EXT_DRAW_VORTEX) || @@ -229,7 +229,7 @@ void DemoExt_Draw(Actor* thisx, GlobalContext* globalCtx) { // "Draw mode is abnormal!" osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sDrawFuncs[this->drawMode](thisx, globalCtx); + sDrawFuncs[this->drawMode](thisx, play); } } 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 9a446b7c01..2805c474f6 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h @@ -6,8 +6,8 @@ struct DemoExt; -typedef void (*DemoExtActionFunc)(struct DemoExt*, GlobalContext*); -typedef void (*DemoExtDrawFunc)(Actor*, GlobalContext*); +typedef void (*DemoExtActionFunc)(struct DemoExt*, PlayState*); +typedef void (*DemoExtDrawFunc)(Actor*, PlayState*); typedef struct DemoExt { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index fe5ac77a7b..e8d066a40e 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -10,18 +10,18 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoGeff_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoGeff_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoGeff_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoGeff_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoGeff_Init(Actor* thisx, PlayState* play); +void DemoGeff_Destroy(Actor* thisx, PlayState* play); +void DemoGeff_Update(Actor* thisx, PlayState* play); +void DemoGeff_Draw(Actor* thisx, PlayState* play); -void func_80978030(DemoGeff* this, GlobalContext* globalCtx); +void func_80978030(DemoGeff* this, PlayState* play); -void func_809783D4(DemoGeff* this, GlobalContext* globalCtx); -void func_80978308(DemoGeff* this, GlobalContext* globalCtx); +void func_809783D4(DemoGeff* this, PlayState* play); +void func_80978308(DemoGeff* this, PlayState* play); -void func_809784D4(DemoGeff* this, GlobalContext* globalCtx); -void func_80978344(DemoGeff* this, GlobalContext* globalCtx); +void func_809784D4(DemoGeff* this, PlayState* play); +void func_80978344(DemoGeff* this, PlayState* play); static s16 sObjectIDs[] = { OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, @@ -54,10 +54,10 @@ const ActorInit Demo_Geff_InitVars = { (ActorFunc)DemoGeff_Draw, }; -void DemoGeff_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoGeff_Destroy(Actor* thisx, PlayState* play) { } -void DemoGeff_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoGeff_Init(Actor* thisx, PlayState* play) { DemoGeff* this = (DemoGeff*)thisx; if (this->actor.params < 0 || this->actor.params >= 9) { @@ -69,8 +69,8 @@ void DemoGeff_Init(Actor* thisx, GlobalContext* globalCtx) { this->drawConfig = 0; } -void func_80977EA8(GlobalContext* globalCtx, Gfx* dlist) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80977EA8(PlayState* play, Gfx* dlist) { + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_geff.c", 181); @@ -84,23 +84,23 @@ void func_80977EA8(GlobalContext* globalCtx, Gfx* dlist) { CLOSE_DISPS(gfxCtx, "../z_demo_geff.c", 188); } -void func_80977F80(DemoGeff* this, GlobalContext* globalCtx) { +void func_80977F80(DemoGeff* this, PlayState* play) { s32 pad[2]; s32 objBankIndex = this->objBankIndex; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_geff.c", 204); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); // Necessary to match - if (!globalCtx) {} + if (!play) {} CLOSE_DISPS(gfxCtx, "../z_demo_geff.c", 212); } -void func_80978030(DemoGeff* this, GlobalContext* globalCtx) { +void func_80978030(DemoGeff* this, PlayState* play) { Vec3f* thisScale = &this->actor.scale; this->action = 1; @@ -129,12 +129,12 @@ void func_80978030(DemoGeff* this, GlobalContext* globalCtx) { } } -void func_809781FC(DemoGeff* this, GlobalContext* globalCtx) { +void func_809781FC(DemoGeff* this, PlayState* play) { s32 targetParams = 2; Actor* propIt; if (this->demoGt == NULL) { - propIt = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + propIt = play->actorCtx.actorLists[ACTORCAT_PROP].head; if ((this->actor.params != 0) && (this->actor.params != 1) && (this->actor.params != 2)) { targetParams = 2; } else { @@ -152,7 +152,7 @@ void func_809781FC(DemoGeff* this, GlobalContext* globalCtx) { } } -void func_809782A0(DemoGeff* this, GlobalContext* globalCtx) { +void func_809782A0(DemoGeff* this, PlayState* play) { DemoGt* demoGt = this->demoGt; s16 params = this->actor.params; @@ -163,17 +163,17 @@ void func_809782A0(DemoGeff* this, GlobalContext* globalCtx) { } } -void func_80978308(DemoGeff* this, GlobalContext* globalCtx) { - func_809781FC(this, globalCtx); - func_809782A0(this, globalCtx); - func_80978030(this, globalCtx); +void func_80978308(DemoGeff* this, PlayState* play) { + func_809781FC(this, play); + func_809782A0(this, play); + func_80978030(this, play); } -void func_80978344(DemoGeff* this, GlobalContext* globalCtx) { - func_80977EA8(globalCtx, gGanonRubbleDL); +void func_80978344(DemoGeff* this, PlayState* play) { + func_80977EA8(play, gGanonRubbleDL); } -void func_80978370(DemoGeff* this, GlobalContext* globalCtx) { +void func_80978370(DemoGeff* this, PlayState* play) { s16 params = this->actor.params; DemoGeffInitFunc initFunc = sInitFuncs[params]; if (initFunc == NULL) { @@ -181,11 +181,11 @@ void func_80978370(DemoGeff* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); return; } - initFunc(this, globalCtx); + initFunc(this, play); } -void func_809783D4(DemoGeff* this, GlobalContext* globalCtx) { - ObjectContext* objCtx = &globalCtx->objectCtx; +void func_809783D4(DemoGeff* this, PlayState* play) { + ObjectContext* objCtx = &play->objectCtx; Actor* thisx = &this->actor; s32 params = thisx->params; s16 objectId = sObjectIDs[params]; @@ -199,24 +199,24 @@ void func_809783D4(DemoGeff* this, GlobalContext* globalCtx) { } if (Object_IsLoaded(objCtx, objBankIndex)) { this->objBankIndex = objBankIndex; - func_80978370(this, globalCtx); + func_80978370(this, play); } } -void DemoGeff_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoGeff_Update(Actor* thisx, PlayState* play) { DemoGeff* this = (DemoGeff*)thisx; if (this->action < 0 || this->action >= 2 || sActionFuncs[this->action] == NULL) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void func_809784D4(DemoGeff* this, GlobalContext* globalCtx) { +void func_809784D4(DemoGeff* this, PlayState* play) { } -void DemoGeff_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoGeff_Draw(Actor* thisx, PlayState* play) { DemoGeff* this = (DemoGeff*)thisx; s32 drawConfig = this->drawConfig; @@ -225,7 +225,7 @@ void DemoGeff_Draw(Actor* thisx, GlobalContext* globalCtx) { return; } if (drawConfig != 0) { - func_80977F80(this, globalCtx); + func_80977F80(this, play); } - sDrawFuncs[drawConfig](this, globalCtx); + sDrawFuncs[drawConfig](this, play); } diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h index a16705a83e..a21eb64a23 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h @@ -8,9 +8,9 @@ struct DemoGeff; -typedef void (*DemoGeffInitFunc)(struct DemoGeff*, GlobalContext*); -typedef void (*DemoGeffActionFunc)(struct DemoGeff*, GlobalContext*); -typedef void (*DemoGeffDrawFunc)(struct DemoGeff*, GlobalContext*); +typedef void (*DemoGeffInitFunc)(struct DemoGeff*, PlayState*); +typedef void (*DemoGeffActionFunc)(struct DemoGeff*, PlayState*); +typedef void (*DemoGeffDrawFunc)(struct DemoGeff*, PlayState*); typedef struct DemoGeff { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 4bb86910f9..dc64a323dc 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -10,10 +10,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoGj_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoGj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoGj_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoGj_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoGj_Init(Actor* thisx, PlayState* play); +void DemoGj_Destroy(Actor* thisx, PlayState* play); +void DemoGj_Update(Actor* thisx, PlayState* play); +void DemoGj_Draw(Actor* thisx, PlayState* play); static ColliderCylinderInitType1 sCylinderInit1 = { { @@ -72,8 +72,8 @@ static ColliderCylinderInitType1 sCylinderInit3 = { { 25, 200, 0, { 0, 0, 0 } }, }; -typedef void (*DemoGjUpdateFunc)(DemoGj*, GlobalContext*); -typedef void (*DemoGjDrawFunc)(DemoGj*, GlobalContext*); +typedef void (*DemoGjUpdateFunc)(DemoGj*, PlayState*); +typedef void (*DemoGjDrawFunc)(DemoGj*, PlayState*); // bits 11-15 s32 DemoGj_GetCollectibleType(DemoGj* this) { @@ -96,51 +96,51 @@ s32 DemoGj_GetType(DemoGj* this) { return params & 0xFF; } -void DemoGj_InitCylinder(DemoGj* this, GlobalContext* globalCtx, ColliderCylinder* cylinder, +void DemoGj_InitCylinder(DemoGj* this, PlayState* play, ColliderCylinder* cylinder, ColliderCylinderInitType1* cylinderInit) { - Collider_InitCylinder(globalCtx, cylinder); - Collider_SetCylinderType1(globalCtx, cylinder, &this->dyna.actor, cylinderInit); + Collider_InitCylinder(play, cylinder); + Collider_SetCylinderType1(play, cylinder, &this->dyna.actor, cylinderInit); } -s32 DemoGj_HitByExplosion(DemoGj* this, GlobalContext* globalCtx, ColliderCylinder* cylinder) { - if (Actor_GetCollidedExplosive(globalCtx, &cylinder->base) != NULL) { +s32 DemoGj_HitByExplosion(DemoGj* this, PlayState* play, ColliderCylinder* cylinder) { + if (Actor_GetCollidedExplosive(play, &cylinder->base) != NULL) { return true; } return false; } -void DemoGj_DestroyCylinder(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DestroyCylinder(DemoGj* this, PlayState* play) { switch (DemoGj_GetType(this)) { case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1: - Collider_DestroyCylinder(globalCtx, &this->cylinders[0]); - Collider_DestroyCylinder(globalCtx, &this->cylinders[1]); - Collider_DestroyCylinder(globalCtx, &this->cylinders[2]); + Collider_DestroyCylinder(play, &this->cylinders[0]); + Collider_DestroyCylinder(play, &this->cylinders[1]); + Collider_DestroyCylinder(play, &this->cylinders[2]); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_2: - Collider_DestroyCylinder(globalCtx, &this->cylinders[0]); - Collider_DestroyCylinder(globalCtx, &this->cylinders[1]); - Collider_DestroyCylinder(globalCtx, &this->cylinders[2]); + Collider_DestroyCylinder(play, &this->cylinders[0]); + Collider_DestroyCylinder(play, &this->cylinders[1]); + Collider_DestroyCylinder(play, &this->cylinders[2]); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_TALL: - Collider_DestroyCylinder(globalCtx, &this->cylinders[0]); + Collider_DestroyCylinder(play, &this->cylinders[0]); break; } } -void DemoGj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoGj_Destroy(Actor* thisx, PlayState* play) { DemoGj* this = (DemoGj*)thisx; - DemoGj_DestroyCylinder(this, globalCtx); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DemoGj_DestroyCylinder(this, play); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void DemoGj_PlayExplosionSfx(DemoGj* this, GlobalContext* globalCtx) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 50, NA_SE_EV_GRAVE_EXPLOSION); +void DemoGj_PlayExplosionSfx(DemoGj* this, PlayState* play) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 50, NA_SE_EV_GRAVE_EXPLOSION); } -void DemoGj_SpawnSmoke(GlobalContext* globalCtx, Vec3f* pos, f32 arg2) { +void DemoGj_SpawnSmoke(PlayState* play, Vec3f* pos, f32 arg2) { static Vec3f velocity = { 0.0f, 6.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 0, 0, 0, 0 }; @@ -148,21 +148,21 @@ void DemoGj_SpawnSmoke(GlobalContext* globalCtx, Vec3f* pos, f32 arg2) { f32 temp = arg2 * 0.2f; if (1) {} - func_800283D4(globalCtx, pos, &velocity, &accel, &primColor, &envColor, temp * Rand_ZeroOne() + arg2, 15, 90); + func_800283D4(play, pos, &velocity, &accel, &primColor, &envColor, temp * Rand_ZeroOne() + arg2, 15, 90); } -void DemoGj_DropCollectible(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DropCollectible(DemoGj* this, PlayState* play) { Vec3f* pos = &this->dyna.actor.world.pos; s16 collectible = DemoGj_GetCollectibleType(this); s32 amount = DemoGj_GetCollectibleAmount(this); s32 i; for (i = 0; i < amount; i++) { - Item_DropCollectible(globalCtx, pos, collectible); + Item_DropCollectible(play, pos, collectible); } } -void DemoGj_Explode(DemoGj* this, GlobalContext* globalCtx, Vec3f* initialPos, Vec3f* direction) { +void DemoGj_Explode(DemoGj* this, PlayState* play, Vec3f* initialPos, Vec3f* direction) { Vec3f explosionPos; Vec3f velocity; s32 phi_s0; @@ -192,14 +192,14 @@ void DemoGj_Explode(DemoGj* this, GlobalContext* globalCtx, Vec3f* initialPos, V phi_s0 = 0x21; } - EffectSsKakera_Spawn(globalCtx, &explosionPos, &velocity, initialPos, -200, phi_s0, 10, 10, 0, + EffectSsKakera_Spawn(play, &explosionPos, &velocity, initialPos, -200, phi_s0, 10, 10, 0, Rand_ZeroOne() * 20.0f + 20.0f, 20, 300, (s32)(Rand_ZeroOne() * 30.0f) + 30, -1, OBJECT_GEFF, &gGanonsCastleRubbleAroundArenaDL[28]); theta += 0x2AAA; } - DemoGj_PlayExplosionSfx(this, globalCtx); + DemoGj_PlayExplosionSfx(this, play); } s32 DemoGj_IsSceneInvalid(void) { @@ -209,11 +209,11 @@ s32 DemoGj_IsSceneInvalid(void) { return true; } -s32 DemoGj_FindGanon(DemoGj* this, GlobalContext* globalCtx) { +s32 DemoGj_FindGanon(DemoGj* this, PlayState* play) { Actor* actor; if (this->ganon == NULL) { - actor = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].head; + actor = play->actorCtx.actorLists[ACTORCAT_BOSS].head; while (actor != NULL) { if (actor->id == ACTOR_BOSS_GANON2) { @@ -237,7 +237,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void DemoGj_InitCommon(DemoGj* this, GlobalContext* globalCtx, CollisionHeader* header) { +void DemoGj_InitCommon(DemoGj* this, PlayState* play, CollisionHeader* header) { s32 pad[3]; CollisionHeader* newHeader; @@ -246,26 +246,25 @@ void DemoGj_InitCommon(DemoGj* this, GlobalContext* globalCtx, CollisionHeader* DynaPolyActor_Init(&this->dyna, DPM_UNK); newHeader = NULL; CollisionHeader_GetVirtual(header, &newHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, newHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, newHeader); } } // TODO: find a better name -s32 DemoGj_InitSetIndices(DemoGj* this, GlobalContext* globalCtx, s32 updateMode, s32 drawConfig, - CollisionHeader* header) { +s32 DemoGj_InitSetIndices(DemoGj* this, PlayState* play, s32 updateMode, s32 drawConfig, CollisionHeader* header) { if (!DemoGj_IsSceneInvalid()) { this->updateMode = updateMode; this->drawConfig = drawConfig; - DemoGj_InitCommon(this, globalCtx, header); + DemoGj_InitCommon(this, play, header); return true; } Actor_Kill(&this->dyna.actor); return false; } -void DemoGj_DrawCommon(DemoGj* this, GlobalContext* globalCtx, Gfx* displayList) { +void DemoGj_DrawCommon(DemoGj* this, PlayState* play, Gfx* displayList) { if (kREG(0) == 0) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_gj.c", 1163); @@ -281,7 +280,7 @@ void DemoGj_DrawCommon(DemoGj* this, GlobalContext* globalCtx, Gfx* displayList) } } -void DemoGj_DrawRotated(DemoGj* this, GlobalContext* globalCtx, Gfx* displayList) { +void DemoGj_DrawRotated(DemoGj* this, PlayState* play, Gfx* displayList) { s32 pad; GraphicsContext* gfxCtx; s16 x = this->rotationVec.x; @@ -290,7 +289,7 @@ void DemoGj_DrawRotated(DemoGj* this, GlobalContext* globalCtx, Gfx* displayList s32 pad2; Mtx* matrix; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; matrix = Graph_Alloc(gfxCtx, sizeof(Mtx)); OPEN_DISPS(gfxCtx, "../z_demo_gj.c", 1187); @@ -309,7 +308,7 @@ void DemoGj_DrawRotated(DemoGj* this, GlobalContext* globalCtx, Gfx* displayList CLOSE_DISPS(gfxCtx, "../z_demo_gj.c", 1201); } -void DemoGj_SetupRotation(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SetupRotation(DemoGj* this, PlayState* play) { f32 yPosition = this->dyna.actor.world.pos.y; f32* yVelocity = &this->dyna.actor.velocity.y; f32* speedXZ = &this->dyna.actor.speedXZ; @@ -444,16 +443,16 @@ s32 func_809797E4(DemoGj* this, u8 arg1) { return false; } -s32 DemoGj_IsGanondorfRisingFromRubble(DemoGj* this, GlobalContext* globalCtx) { +s32 DemoGj_IsGanondorfRisingFromRubble(DemoGj* this, PlayState* play) { return func_809797E4(this, 1); } // Ganondorf has stopped rising into the air and is just floating. Just before he transforms. -s32 DemoGj_IsGanondorfFloatingInAir(DemoGj* this, GlobalContext* globalCtx) { +s32 DemoGj_IsGanondorfFloatingInAir(DemoGj* this, PlayState* play) { return func_809797E4(this, 2); } -void DemoGj_SetupMovement(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SetupMovement(DemoGj* this, PlayState* play) { Actor* actor = &this->dyna.actor; Player* player; Vec3f* pos = &actor->world.pos; @@ -545,7 +544,7 @@ void DemoGj_SetupMovement(DemoGj* this, GlobalContext* globalCtx) { } if (xDistance == 0.0f && zDistance == 0.0f) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); xDistance = player->actor.world.pos.x - pos->x; zDistance = player->actor.world.pos.z - pos->z; @@ -564,425 +563,425 @@ void DemoGj_CheckIfTransformedIntoGanon(DemoGj* this) { } } -void DemoGj_InitRubblePile1(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndices(this, globalCtx, 1, 2, &gGanonsCastleRubble2Col); +void DemoGj_InitRubblePile1(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndices(this, play, 1, 2, &gGanonsCastleRubble2Col); } -void func_8097A000(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A000(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(18)); this->rotationVec.y += (s16)(kREG(19) + 1000); this->rotationVec.z += (s16)(kREG(20) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void DemoGj_SpawnSmokePreBattle1(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SpawnSmokePreBattle1(DemoGj* this, PlayState* play) { static Vec3f pos = { -371.0f, 1188.0f, -303.0f }; u32 gameplayFrames; if (!this->isTransformedIntoGanon) { - gameplayFrames = globalCtx->gameplayFrames % 3; + gameplayFrames = play->gameplayFrames % 3; if (1) {} if (gameplayFrames == 0) { - if (!globalCtx->gameplayFrames) {} - DemoGj_SpawnSmoke(globalCtx, &pos, 300.0f); + if (!play->gameplayFrames) {} + DemoGj_SpawnSmoke(play, &pos, 300.0f); } DemoGj_CheckIfTransformedIntoGanon(this); } } -void func_8097A0E4(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097A0E4(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 8; this->drawConfig = 9; } } -void func_8097A130(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097A130(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097A160 -void DemoGj_Update01(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097A0E4(this, globalCtx); +void DemoGj_Update01(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097A0E4(this, play); } // func_8097A190 -void DemoGj_Update08(DemoGj* this, GlobalContext* globalCtx) { - func_8097A000(this, globalCtx); - func_8097A130(this, globalCtx); +void DemoGj_Update08(DemoGj* this, PlayState* play) { + func_8097A000(this, play); + func_8097A130(this, play); } -void DemoGj_DrawRubble2(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble2DL); +void DemoGj_DrawRubble2(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble2DL); } -void DemoGj_DrawRotatedRubble2(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble2DL); +void DemoGj_DrawRotatedRubble2(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble2DL); } -void DemoGj_InitRubblePile2(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndices(this, globalCtx, 2, 3, &gGanonsCastleRubble3Col); +void DemoGj_InitRubblePile2(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndices(this, play, 2, 3, &gGanonsCastleRubble3Col); } -void func_8097A238(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A238(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(31)); this->rotationVec.y += (s16)(kREG(32) + 1000); this->rotationVec.z += (s16)(kREG(33) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void DemoGj_SpawnSmokePreBattle2(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SpawnSmokePreBattle2(DemoGj* this, PlayState* play) { static Vec3f pos = { -119.0f, 1056.0f, -147.0f }; u32 gameplayFrames; if (!this->isTransformedIntoGanon) { - gameplayFrames = globalCtx->gameplayFrames % 3; + gameplayFrames = play->gameplayFrames % 3; if (1) {} if (gameplayFrames == 1) { - if (!globalCtx->gameplayFrames) {} - DemoGj_SpawnSmoke(globalCtx, &pos, 300.0f); + if (!play->gameplayFrames) {} + DemoGj_SpawnSmoke(play, &pos, 300.0f); } DemoGj_CheckIfTransformedIntoGanon(this); } } -void func_8097A320(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097A320(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 9; this->drawConfig = 10; } } -void func_8097A36C(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097A36C(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097A39C -void DemoGj_Update02(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097A320(this, globalCtx); +void DemoGj_Update02(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097A320(this, play); } // func_8097A3CC -void DemoGj_Update09(DemoGj* this, GlobalContext* globalCtx) { - func_8097A238(this, globalCtx); - func_8097A36C(this, globalCtx); +void DemoGj_Update09(DemoGj* this, PlayState* play) { + func_8097A238(this, play); + func_8097A36C(this, play); } -void DemoGj_DrawRubble3(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble3DL); +void DemoGj_DrawRubble3(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble3DL); } -void DemoGj_DrawRotatedRubble3(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble3DL); +void DemoGj_DrawRotatedRubble3(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble3DL); } -void DemoGj_InitRubblePile3(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndices(this, globalCtx, 3, 4, &gGanonsCastleRubble4Col); +void DemoGj_InitRubblePile3(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndices(this, play, 3, 4, &gGanonsCastleRubble4Col); } -void func_8097A474(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A474(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(44)); this->rotationVec.y += (s16)(kREG(45) + 1000); this->rotationVec.z += (s16)(kREG(46) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void func_8097A4F0(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097A4F0(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 10; this->drawConfig = 11; } } -void func_8097A53C(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097A53C(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097A56C -void DemoGj_Update03(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097A4F0(this, globalCtx); +void DemoGj_Update03(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097A4F0(this, play); } // func_8097A59C -void DemoGj_Update10(DemoGj* this, GlobalContext* globalCtx) { - func_8097A474(this, globalCtx); - func_8097A53C(this, globalCtx); +void DemoGj_Update10(DemoGj* this, PlayState* play) { + func_8097A474(this, play); + func_8097A53C(this, play); } -void DemoGj_DrawRubble4(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble4DL); +void DemoGj_DrawRubble4(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble4DL); } -void DemoGj_DrawRotatedRubble4(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble4DL); +void DemoGj_DrawRotatedRubble4(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble4DL); } -void DemoGj_InitRubblePile4(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndices(this, globalCtx, 4, 5, &gGanonsCastleRubble5Col); +void DemoGj_InitRubblePile4(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndices(this, play, 4, 5, &gGanonsCastleRubble5Col); } -void func_8097A644(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A644(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(57)); this->rotationVec.y += (s16)(kREG(58) + 1000); this->rotationVec.z += (s16)(kREG(59) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void func_8097A6C0(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097A6C0(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 11; this->drawConfig = 12; } } -void func_8097A70C(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097A70C(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097A73C -void DemoGj_Update04(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097A6C0(this, globalCtx); +void DemoGj_Update04(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097A6C0(this, play); } // func_8097A76C -void DemoGj_Update11(DemoGj* this, GlobalContext* globalCtx) { - func_8097A644(this, globalCtx); - func_8097A70C(this, globalCtx); +void DemoGj_Update11(DemoGj* this, PlayState* play) { + func_8097A644(this, play); + func_8097A70C(this, play); } -void DemoGj_DrawRubble5(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble5DL); +void DemoGj_DrawRubble5(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble5DL); } -void DemoGj_DrawRotatedRubble5(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble5DL); +void DemoGj_DrawRotatedRubble5(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble5DL); } -void DemoGj_InitRubblePile5(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndices(this, globalCtx, 5, 6, &gGanonsCastleRubble6Col); +void DemoGj_InitRubblePile5(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndices(this, play, 5, 6, &gGanonsCastleRubble6Col); } -void func_8097A814(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A814(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(70)); this->rotationVec.y += (s16)(kREG(71) + 1000); this->rotationVec.z += (s16)(kREG(72) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void func_8097A890(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097A890(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 12; this->drawConfig = 13; } } -void func_8097A8DC(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097A8DC(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097A90C -void DemoGj_Update05(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097A890(this, globalCtx); +void DemoGj_Update05(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097A890(this, play); } // func_8097A93C -void DemoGj_Update12(DemoGj* this, GlobalContext* globalCtx) { - func_8097A814(this, globalCtx); - func_8097A8DC(this, globalCtx); +void DemoGj_Update12(DemoGj* this, PlayState* play) { + func_8097A814(this, play); + func_8097A8DC(this, play); } -void DemoGj_DrawRubble6(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble6DL); +void DemoGj_DrawRubble6(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble6DL); } -void DemoGj_DrawRotatedRubble6(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble6DL); +void DemoGj_DrawRotatedRubble6(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble6DL); } -void DemoGj_InitRubblePile6(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndices(this, globalCtx, 6, 7, &gGanonsCastleRubble7Col); +void DemoGj_InitRubblePile6(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndices(this, play, 6, 7, &gGanonsCastleRubble7Col); } -void func_8097A9E4(DemoGj* this, GlobalContext* globalCtx) { +void func_8097A9E4(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(83)); this->rotationVec.y += (s16)(kREG(84) + 1000); this->rotationVec.z += (s16)(kREG(85) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void func_8097AA60(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097AA60(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 13; this->drawConfig = 14; } } -void func_8097AAAC(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097AAAC(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097AADC -void DemoGj_Update06(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097AA60(this, globalCtx); +void DemoGj_Update06(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097AA60(this, play); } // func_8097AB0C -void DemoGj_Update13(DemoGj* this, GlobalContext* globalCtx) { - func_8097A9E4(this, globalCtx); - func_8097AAAC(this, globalCtx); +void DemoGj_Update13(DemoGj* this, PlayState* play) { + func_8097A9E4(this, play); + func_8097AAAC(this, play); } -void DemoGj_DrawRubble7(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble7DL); +void DemoGj_DrawRubble7(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble7DL); } -void DemoGj_DrawRotatedRubble7(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubble7DL); +void DemoGj_DrawRotatedRubble7(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubble7DL); } -void DemoGj_InitRubblePile7(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndices(this, globalCtx, 7, 8, &gGanonsCastleRubbleTallCol); +void DemoGj_InitRubblePile7(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndices(this, play, 7, 8, &gGanonsCastleRubbleTallCol); } -void func_8097ABB4(DemoGj* this, GlobalContext* globalCtx) { +void func_8097ABB4(DemoGj* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); this->rotationVec.x += (s16)(kREG(15)); this->rotationVec.y += (s16)(kREG(14) + 1000); this->rotationVec.z += (s16)(kREG(13) + 3000); - DemoGj_SetupRotation(this, globalCtx); + DemoGj_SetupRotation(this, play); } -void DemoGj_SpawnSmokePreBattle3(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SpawnSmokePreBattle3(DemoGj* this, PlayState* play) { static Vec3f pos = { -6.0f, 1053.0f, -473.0f }; u32 gameplayFrames; if (!this->isTransformedIntoGanon) { - gameplayFrames = globalCtx->gameplayFrames % 3; + gameplayFrames = play->gameplayFrames % 3; if (1) {} if (gameplayFrames == 2) { - if (!globalCtx->gameplayFrames) {} - DemoGj_SpawnSmoke(globalCtx, &pos, 300.0f); + if (!play->gameplayFrames) {} + DemoGj_SpawnSmoke(play, &pos, 300.0f); } DemoGj_CheckIfTransformedIntoGanon(this); } } -void func_8097AC9C(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfRisingFromRubble(this, globalCtx)) { - DemoGj_SetupMovement(this, globalCtx); +void func_8097AC9C(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfRisingFromRubble(this, play)) { + DemoGj_SetupMovement(this, play); this->updateMode = 14; this->drawConfig = 15; } } -void func_8097ACE8(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097ACE8(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Actor_Kill(&this->dyna.actor); } } // func_8097AD18 -void DemoGj_Update07(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097AC9C(this, globalCtx); +void DemoGj_Update07(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097AC9C(this, play); } // func_8097AD48 -void DemoGj_Update14(DemoGj* this, GlobalContext* globalCtx) { - func_8097ABB4(this, globalCtx); - func_8097ACE8(this, globalCtx); +void DemoGj_Update14(DemoGj* this, PlayState* play) { + func_8097ABB4(this, play); + func_8097ACE8(this, play); } -void DemoGj_DrawRubbleTall(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubbleTallDL); +void DemoGj_DrawRubbleTall(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubbleTallDL); } -void DemoGj_DrawRotatedRubbleTall(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawRotated(this, globalCtx, gGanonsCastleRubbleTallDL); +void DemoGj_DrawRotatedRubbleTall(DemoGj* this, PlayState* play) { + DemoGj_DrawRotated(this, play, gGanonsCastleRubbleTallDL); } -void DemoGj_InitRubbleAroundArena(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndices(this, globalCtx, 0, 1, &gGanonsCastleRubbleAroundArenaCol); +void DemoGj_InitRubbleAroundArena(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndices(this, play, 0, 1, &gGanonsCastleRubbleAroundArenaCol); } // func_8097ADF0 -void DemoGj_UpdateRubbleAroundArena(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - DemoGj_SpawnSmokePreBattle1(this, globalCtx); - DemoGj_SpawnSmokePreBattle2(this, globalCtx); - DemoGj_SpawnSmokePreBattle3(this, globalCtx); +void DemoGj_UpdateRubbleAroundArena(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + DemoGj_SpawnSmokePreBattle1(this, play); + DemoGj_SpawnSmokePreBattle2(this, play); + DemoGj_SpawnSmokePreBattle3(this, play); } -void DemoGj_DrawRubbleAroundArena(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubbleAroundArenaDL); +void DemoGj_DrawRubbleAroundArena(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubbleAroundArenaDL); } // Inits the three cylinders with `sCylinderInit1` -void DemoGj_InitDestructableRubble1(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndices(this, globalCtx, 15, 0, NULL); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[0], &sCylinderInit1); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[1], &sCylinderInit1); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[2], &sCylinderInit1); +void DemoGj_InitDestructableRubble1(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndices(this, play, 15, 0, NULL); + DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit1); + DemoGj_InitCylinder(this, play, &this->cylinders[1], &sCylinderInit1); + DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit1); } -void DemoGj_DoNothing1(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DoNothing1(DemoGj* this, PlayState* play) { } /* * Moves the ColliderCylinder's relative to the actor's position. * Used by DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1 */ -void func_8097AEE8(DemoGj* this, GlobalContext* globalCtx) { +void func_8097AEE8(DemoGj* this, PlayState* play) { ColliderCylinder* cylinder0 = &this->cylinders[0]; ColliderCylinder* cylinder1 = &this->cylinders[1]; ColliderCylinder* cylinder2 = &this->cylinders[2]; @@ -1005,33 +1004,33 @@ void func_8097AEE8(DemoGj* this, GlobalContext* globalCtx) { cylinder2->dim.pos.y = actorPos->y; } -void DemoGj_SetCylindersAsAC(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SetCylindersAsAC(DemoGj* this, PlayState* play) { s32 pad[2]; Collider* cylinder0 = &this->cylinders[0].base; Collider* cylinder1 = &this->cylinders[1].base; Collider* cylinder2 = &this->cylinders[2].base; s32 pad2[3]; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder0); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder1); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder2); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder0); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder1); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder2); } -void DemoGj_DirectedExplosion(DemoGj* this, GlobalContext* globalCtx, Vec3f* direction) { +void DemoGj_DirectedExplosion(DemoGj* this, PlayState* play, Vec3f* direction) { Vec3f pos; pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y; pos.z = this->dyna.actor.world.pos.z; - DemoGj_Explode(this, globalCtx, &pos, direction); + DemoGj_Explode(this, play, &pos, direction); } -void func_8097B128(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097B128(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Vec3f* scale = &this->dyna.actor.scale; - DemoGj_InitCommon(this, globalCtx, &gGanonsCastleRubble2Col); + DemoGj_InitCommon(this, play, &gGanonsCastleRubble2Col); this->updateMode = 18; this->drawConfig = 16; scale->x *= 0.8f; @@ -1040,14 +1039,14 @@ void func_8097B128(DemoGj* this, GlobalContext* globalCtx) { } } -s32 DemoGj_HasCylinderAnyExploded(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[0])) { +s32 DemoGj_HasCylinderAnyExploded(DemoGj* this, PlayState* play) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[0])) { return true; } - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[1])) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[1])) { return true; } - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[2])) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[2])) { return true; } return false; @@ -1058,61 +1057,61 @@ s32 DemoGj_HasCylinderAnyExploded(DemoGj* this, GlobalContext* globalCtx) { * Kills the actor if ganon->unk_314==4 (Ganon killed), this rubble was hit by an explosion or killFlag==true * Used by DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1 */ -void func_8097B22C(DemoGj* this, GlobalContext* globalCtx) { +void func_8097B22C(DemoGj* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (func_809797E4(this, 4)) { Actor_Kill(thisx); - } else if (DemoGj_HasCylinderAnyExploded(this, globalCtx)) { + } else if (DemoGj_HasCylinderAnyExploded(this, play)) { Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedExplosion(this, globalCtx, &vec1); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedExplosion(this, play, &vec1); Actor_Kill(thisx); } else if (this->killFlag) { Vec3f vec2 = this->unk_26C; vec2.y = 0.0f; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedExplosion(this, globalCtx, &vec2); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedExplosion(this, play, &vec2); Actor_Kill(thisx); } - func_8097AEE8(this, globalCtx); - DemoGj_SetCylindersAsAC(this, globalCtx); + func_8097AEE8(this, play); + DemoGj_SetCylindersAsAC(this, play); } // func_8097B340 -void DemoGj_Update15(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097B128(this, globalCtx); +void DemoGj_Update15(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097B128(this, play); } // func_8097B370 -void DemoGj_Update18(DemoGj* this, GlobalContext* globalCtx) { - func_8097B22C(this, globalCtx); - DemoGj_DoNothing1(this, globalCtx); +void DemoGj_Update18(DemoGj* this, PlayState* play) { + func_8097B22C(this, play); + DemoGj_DoNothing1(this, play); } -void DemoGj_DrawDestructableRubble1(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble2DL); +void DemoGj_DrawDestructableRubble1(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble2DL); } // Inits the three cylinders with `sCylinderInit2` -void DemoGj_InitDestructableRubble2(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndices(this, globalCtx, 16, 0, NULL); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[0], &sCylinderInit2); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[1], &sCylinderInit2); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[2], &sCylinderInit2); +void DemoGj_InitDestructableRubble2(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndices(this, play, 16, 0, NULL); + DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit2); + DemoGj_InitCylinder(this, play, &this->cylinders[1], &sCylinderInit2); + DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit2); } -void DemoGj_DoNothing2(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DoNothing2(DemoGj* this, PlayState* play) { } // Moves the ColliderCylinder's relative to the actor's position. -void func_8097B450(DemoGj* this, GlobalContext* globalCtx) { +void func_8097B450(DemoGj* this, PlayState* play) { ColliderCylinder* cylinder0 = &this->cylinders[0]; ColliderCylinder* cylinder1 = &this->cylinders[1]; ColliderCylinder* cylinder2 = &this->cylinders[2]; @@ -1135,47 +1134,47 @@ void func_8097B450(DemoGj* this, GlobalContext* globalCtx) { cylinder2->dim.pos.y = actorPos->y; } -void DemoGj_SetCylindersAsAC2(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_SetCylindersAsAC2(DemoGj* this, PlayState* play) { s32 pad[2]; Collider* cylinder0 = &this->cylinders[0].base; Collider* cylinder1 = &this->cylinders[1].base; Collider* cylinder2 = &this->cylinders[2].base; s32 pad2[3]; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder0); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder1); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, cylinder2); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder0); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder1); + CollisionCheck_SetAC(play, &play->colChkCtx, cylinder2); } // Does the same as `DemoGj_HasCylinderAnyExploded` -s32 DemoGj_HasCylinderAnyExploded2(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[0])) { +s32 DemoGj_HasCylinderAnyExploded2(DemoGj* this, PlayState* play) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[0])) { return true; } - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[1])) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[1])) { return true; } - if (DemoGj_HitByExplosion(this, globalCtx, &this->cylinders[2])) { + if (DemoGj_HitByExplosion(this, play, &this->cylinders[2])) { return true; } return false; } -void DemoGj_DirectedExplosion2(DemoGj* this, GlobalContext* globalCtx, Vec3f* direction) { +void DemoGj_DirectedExplosion2(DemoGj* this, PlayState* play, Vec3f* direction) { Vec3f pos; pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y; pos.z = this->dyna.actor.world.pos.z; - DemoGj_Explode(this, globalCtx, &pos, direction); + DemoGj_Explode(this, play, &pos, direction); } -void func_8097B6C4(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097B6C4(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Vec3f* scale = &this->dyna.actor.scale; - DemoGj_InitCommon(this, globalCtx, &gGanonsCastleRubble3Col); + DemoGj_InitCommon(this, play, &gGanonsCastleRubble3Col); this->updateMode = 19; this->drawConfig = 17; scale->x *= 0.8f; @@ -1189,76 +1188,76 @@ void func_8097B6C4(DemoGj* this, GlobalContext* globalCtx) { * Kills the actor if ganon->unk_314==4 (Ganon killed), this rubble was hit by an explosion or killFlag==true * Used by DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_2 */ -void func_8097B750(DemoGj* this, GlobalContext* globalCtx) { +void func_8097B750(DemoGj* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (func_809797E4(this, 4)) { Actor_Kill(thisx); - } else if (DemoGj_HasCylinderAnyExploded2(this, globalCtx)) { + } else if (DemoGj_HasCylinderAnyExploded2(this, play)) { Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedExplosion2(this, globalCtx, &vec1); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedExplosion2(this, play, &vec1); Actor_Kill(thisx); } else if (this->killFlag) { Vec3f vec2 = this->unk_26C; vec2.y = 0.0f; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedExplosion2(this, globalCtx, &vec2); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedExplosion2(this, play, &vec2); Actor_Kill(thisx); } - func_8097B450(this, globalCtx); - DemoGj_SetCylindersAsAC2(this, globalCtx); + func_8097B450(this, play); + DemoGj_SetCylindersAsAC2(this, play); } // func_8097B864 -void DemoGj_Update16(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097B6C4(this, globalCtx); +void DemoGj_Update16(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097B6C4(this, play); } // func_8097B894 -void DemoGj_Update19(DemoGj* this, GlobalContext* globalCtx) { - func_8097B750(this, globalCtx); - DemoGj_DoNothing2(this, globalCtx); +void DemoGj_Update19(DemoGj* this, PlayState* play) { + func_8097B750(this, play); + DemoGj_DoNothing2(this, play); } -void DemoGj_DemoGj_InitDestructableRubble2(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubble3DL); +void DemoGj_DemoGj_InitDestructableRubble2(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubble3DL); } // Inits the first cylinder (only that one) with `sCylinderInit3` -void DemoGj_InitDestructableRubbleTall(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_InitSetIndices(this, globalCtx, 17, 0, NULL); - DemoGj_InitCylinder(this, globalCtx, &this->cylinders[0], &sCylinderInit3); +void DemoGj_InitDestructableRubbleTall(DemoGj* this, PlayState* play) { + DemoGj_InitSetIndices(this, play, 17, 0, NULL); + DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit3); } -void DemoGj_DoNothing3(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DoNothing3(DemoGj* this, PlayState* play) { } -void DemoGj_DirectedDoubleExplosion(DemoGj* this, GlobalContext* globalCtx, Vec3f* direction) { +void DemoGj_DirectedDoubleExplosion(DemoGj* this, PlayState* play, Vec3f* direction) { Vec3f pos; pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y; pos.z = this->dyna.actor.world.pos.z; - DemoGj_Explode(this, globalCtx, &pos, direction); + DemoGj_Explode(this, play, &pos, direction); pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 100.0f; pos.z = this->dyna.actor.world.pos.z; - DemoGj_Explode(this, globalCtx, &pos, direction); + DemoGj_Explode(this, play, &pos, direction); } -void func_8097B9BC(DemoGj* this, GlobalContext* globalCtx) { - if (DemoGj_IsGanondorfFloatingInAir(this, globalCtx)) { +void func_8097B9BC(DemoGj* this, PlayState* play) { + if (DemoGj_IsGanondorfFloatingInAir(this, play)) { Vec3f* scale = &this->dyna.actor.scale; - DemoGj_InitCommon(this, globalCtx, &gGanonsCastleRubbleTallCol); + DemoGj_InitCommon(this, play, &gGanonsCastleRubbleTallCol); this->updateMode = 20; this->drawConfig = 18; scale->x *= 0.8f; @@ -1272,48 +1271,48 @@ void func_8097B9BC(DemoGj* this, GlobalContext* globalCtx) { * Kills the actor if ganon->unk_314==4 (Ganon killed), this rubble was hit by an explosion or killFlag==true * Used by DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_TALL */ -void func_8097BA48(DemoGj* this, GlobalContext* globalCtx) { +void func_8097BA48(DemoGj* this, PlayState* play) { Actor* thisx = &this->dyna.actor; ColliderCylinder* cylinder = &this->cylinders[0]; s32 pad[2]; if (func_809797E4(this, 4)) { Actor_Kill(thisx); - } else if (DemoGj_HitByExplosion(this, globalCtx, cylinder)) { + } else if (DemoGj_HitByExplosion(this, play, cylinder)) { Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedDoubleExplosion(this, globalCtx, &vec1); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedDoubleExplosion(this, play, &vec1); Actor_Kill(thisx); } else if (this->killFlag) { Vec3f vec2 = this->unk_26C; vec2.y = 0.0f; - DemoGj_DropCollectible(this, globalCtx); - DemoGj_DirectedDoubleExplosion(this, globalCtx, &vec2); + DemoGj_DropCollectible(this, play); + DemoGj_DirectedDoubleExplosion(this, play, &vec2); Actor_Kill(thisx); } Collider_UpdateCylinder(thisx, cylinder); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &cylinder->base); + CollisionCheck_SetAC(play, &play->colChkCtx, &cylinder->base); } // func_8097BB78 -void DemoGj_Update17(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_FindGanon(this, globalCtx); - func_8097B9BC(this, globalCtx); +void DemoGj_Update17(DemoGj* this, PlayState* play) { + DemoGj_FindGanon(this, play); + func_8097B9BC(this, play); } // func_8097BBA8 -void DemoGj_Update20(DemoGj* this, GlobalContext* globalCtx) { - func_8097BA48(this, globalCtx); - DemoGj_DoNothing3(this, globalCtx); +void DemoGj_Update20(DemoGj* this, PlayState* play) { + func_8097BA48(this, play); + DemoGj_DoNothing3(this, play); } -void DemoGj_DemoGj_InitDestructableRubbleTall(DemoGj* this, GlobalContext* globalCtx) { - DemoGj_DrawCommon(this, globalCtx, gGanonsCastleRubbleTallDL); +void DemoGj_DemoGj_InitDestructableRubbleTall(DemoGj* this, PlayState* play) { + DemoGj_DrawCommon(this, play, gGanonsCastleRubbleTallDL); } static DemoGjUpdateFunc sUpdateFuncs[] = { @@ -1340,7 +1339,7 @@ static DemoGjUpdateFunc sUpdateFuncs[] = { DemoGj_Update20, }; -void DemoGj_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoGj_Update(Actor* thisx, PlayState* play) { DemoGj* this = (DemoGj*)thisx; if (this->updateMode < 0 || this->updateMode >= ARRAY_COUNT(sUpdateFuncs) || @@ -1350,66 +1349,65 @@ void DemoGj_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - sUpdateFuncs[this->updateMode](this, globalCtx); + sUpdateFuncs[this->updateMode](this, play); } -void DemoGj_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoGj_Init(Actor* thisx, PlayState* play) { DemoGj* this = (DemoGj*)thisx; switch (DemoGj_GetType(this)) { case DEMOGJ_TYPE_AROUNDARENA: - DemoGj_InitRubbleAroundArena(this, globalCtx); + DemoGj_InitRubbleAroundArena(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_1: - DemoGj_InitRubblePile1(this, globalCtx); + DemoGj_InitRubblePile1(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_2: - DemoGj_InitRubblePile2(this, globalCtx); + DemoGj_InitRubblePile2(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_3: - DemoGj_InitRubblePile3(this, globalCtx); + DemoGj_InitRubblePile3(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_4: - DemoGj_InitRubblePile4(this, globalCtx); + DemoGj_InitRubblePile4(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_5: - DemoGj_InitRubblePile5(this, globalCtx); + DemoGj_InitRubblePile5(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_6: - DemoGj_InitRubblePile6(this, globalCtx); + DemoGj_InitRubblePile6(this, play); break; case DEMOGJ_TYPE_RUBBLE_PILE_7: - DemoGj_InitRubblePile7(this, globalCtx); + DemoGj_InitRubblePile7(this, play); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1: - DemoGj_InitDestructableRubble1(this, globalCtx); + DemoGj_InitDestructableRubble1(this, play); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_2: - DemoGj_InitDestructableRubble2(this, globalCtx); + DemoGj_InitDestructableRubble2(this, play); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_TALL: - DemoGj_InitDestructableRubbleTall(this, globalCtx); + DemoGj_InitDestructableRubbleTall(this, play); break; default: // "Demo_Gj_Actor_ct There is no such argument!!!!!!!!!!!!!!!!!!!!!!" - osSyncPrintf(VT_FGCOL(RED) "Demo_Gj_Actor_ct そんな引数は無い!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST, globalCtx, - this); + osSyncPrintf(VT_FGCOL(RED) "Demo_Gj_Actor_ct そんな引数は無い!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST, play, this); Actor_Kill(&this->dyna.actor); } } -void DemoGj_DrawNothing(DemoGj* this, GlobalContext* globalCtx) { +void DemoGj_DrawNothing(DemoGj* this, PlayState* play) { } static DemoGjDrawFunc sDrawFuncs[] = { @@ -1434,7 +1432,7 @@ static DemoGjDrawFunc sDrawFuncs[] = { DemoGj_DemoGj_InitDestructableRubbleTall, }; -void DemoGj_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoGj_Draw(Actor* thisx, PlayState* play) { DemoGj* this = (DemoGj*)thisx; if (this->drawConfig < 0 || this->drawConfig >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawConfig] == NULL) { @@ -1443,7 +1441,7 @@ void DemoGj_Draw(Actor* thisx, GlobalContext* globalCtx) { return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } const ActorInit Demo_Gj_InitVars = { 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 aa9a7f123b..922e23bcdc 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -10,21 +10,21 @@ #define FLAGS ACTOR_FLAG_4 -void DemoGo_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoGo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoGo_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoGo_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoGo_Init(Actor* thisx, PlayState* play); +void DemoGo_Destroy(Actor* thisx, PlayState* play); +void DemoGo_Update(Actor* thisx, PlayState* play); +void DemoGo_Draw(Actor* thisx, PlayState* play); -void func_8097CE10(DemoGo* this, GlobalContext* globalCtx); -void func_8097CFDC(DemoGo* this, GlobalContext* globalCtx); -void func_8097CFFC(DemoGo* this, GlobalContext* globalCtx); -void func_8097D01C(DemoGo* this, GlobalContext* globalCtx); -void func_8097D058(DemoGo* this, GlobalContext* globalCtx); -void func_8097D088(DemoGo* this, GlobalContext* globalCtx); -void func_8097D0D0(DemoGo* this, GlobalContext* globalCtx); -void func_8097D130(DemoGo* this, GlobalContext* globalCtx); -void func_8097D290(DemoGo* this, GlobalContext* globalCtx); -void func_8097D29C(DemoGo* this, GlobalContext* globalCtx); +void func_8097CE10(DemoGo* this, PlayState* play); +void func_8097CFDC(DemoGo* this, PlayState* play); +void func_8097CFFC(DemoGo* this, PlayState* play); +void func_8097D01C(DemoGo* this, PlayState* play); +void func_8097D058(DemoGo* this, PlayState* play); +void func_8097D088(DemoGo* this, PlayState* play); +void func_8097D0D0(DemoGo* this, PlayState* play); +void func_8097D130(DemoGo* this, PlayState* play); +void func_8097D290(DemoGo* this, PlayState* play); +void func_8097D29C(DemoGo* this, PlayState* play); static void* sEyeTextures[] = { gGoronCsEyeOpenTex, gGoronCsEyeHalfTex, gGoronCsEyeClosedTex }; @@ -68,21 +68,21 @@ s32 func_8097C870(DemoGo* this) { return ret; } -void func_8097C8A8(DemoGo* this, GlobalContext* globalCtx) { +void func_8097C8A8(DemoGo* this, PlayState* play) { Actor* thisx = &this->actor; Vec3f sp20; f32 sp1C; if ((thisx->params == 0) || (thisx->params == 1)) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &thisx->world.pos, &sp20, &sp1C); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &sp20, 20, NA_SE_EV_OBJECT_FALL); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &thisx->world.pos, &sp20, &sp1C); + SoundSource_PlaySfxAtFixedWorldPos(play, &sp20, 20, NA_SE_EV_OBJECT_FALL); } } -void DemoGo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoGo_Destroy(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } void func_8097C930(DemoGo* this) { @@ -111,29 +111,28 @@ void func_8097C9DC(DemoGo* this) { } } -void func_8097CA30(DemoGo* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); +void func_8097CA30(DemoGo* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } -void func_8097CA78(DemoGo* this, GlobalContext* globalCtx) { +void func_8097CA78(DemoGo* this, PlayState* play) { s16 pad; Vec3f vec = this->actor.world.pos; - func_80033480(globalCtx, &vec, kREG(11) + 100.0f, kREG(12) + 0xA, kREG(13) + 0x12C, kREG(14), 0); + func_80033480(play, &vec, kREG(11) + 100.0f, kREG(12) + 0xA, kREG(13) + 0x12C, kREG(14), 0); func_8097C9B8(this); } -void func_8097CB0C(DemoGo* this, GlobalContext* globalCtx) { +void func_8097CB0C(DemoGo* this, PlayState* play) { Actor* thisx = &this->actor; PosRot* world = &thisx->world; - CutsceneContext* csCtx = &globalCtx->csCtx; + CutsceneContext* csCtx = &play->csCtx; CsCmdActorAction* npcAction; f32 temp_ret; s32 pad; Vec3f startPos; Vec3f endPos; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { npcAction = csCtx->npcActions[func_8097C870(this)]; if (npcAction != NULL) { temp_ret = Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, csCtx->frames); @@ -166,15 +165,15 @@ void func_8097CCC0(DemoGo* this) { Actor_MoveForward(&this->actor); } -void func_8097CCE0(DemoGo* this, GlobalContext* globalCtx) { +void func_8097CCE0(DemoGo* this, PlayState* play) { CsCmdActorAction* npcAction; Actor* thisx = &this->actor; s32 rotYDelta; s32 newRotY; s32 thisRotY; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - npcAction = globalCtx->csCtx.npcActions[func_8097C870(this)]; + if (play->csCtx.state != CS_STATE_IDLE) { + npcAction = play->csCtx.npcActions[func_8097C870(this)]; if (npcAction != NULL) { thisRotY = thisx->world.rot.y; rotYDelta = npcAction->rot.y - thisRotY; @@ -195,8 +194,8 @@ s32 DemoGo_UpdateSkelAnime(DemoGo* this) { return SkelAnime_Update(&this->skelAnime); } -s32 func_8097CDB0(DemoGo* this, GlobalContext* globalCtx, u16 npcAction) { - CutsceneContext* csCtx = &globalCtx->csCtx; +s32 func_8097CDB0(DemoGo* this, PlayState* play, u16 npcAction) { + CutsceneContext* csCtx = &play->csCtx; s32 actionIdx = func_8097C870(this); if ((csCtx->state != CS_STATE_IDLE) && (csCtx->npcActions[actionIdx] != NULL) && @@ -206,39 +205,39 @@ s32 func_8097CDB0(DemoGo* this, GlobalContext* globalCtx, u16 npcAction) { return 0; } -void func_8097CE10(DemoGo* this, GlobalContext* globalCtx) { +void func_8097CE10(DemoGo* this, PlayState* play) { this->action = 1; } -void func_8097CE20(DemoGo* this, GlobalContext* globalCtx) { - if (func_8097CDB0(this, globalCtx, 2)) { +void func_8097CE20(DemoGo* this, PlayState* play) { + if (func_8097CDB0(this, play, 2)) { this->action = 2; this->drawConfig = 1; - func_8097CB0C(this, globalCtx); - func_8097C8A8(this, globalCtx); + func_8097CB0C(this, play); + func_8097C8A8(this, play); } } -void func_8097CE78(DemoGo* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_8097CE78(DemoGo* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; CsCmdActorAction* npcAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { npcAction = csCtx->npcActions[func_8097C870(this)]; if (npcAction != NULL && csCtx->frames >= npcAction->endFrame) { - func_8097CA78(this, globalCtx); + func_8097CA78(this, play); this->action = 3; } } } -void func_8097CEEC(DemoGo* this, GlobalContext* globalCtx) { - if (func_8097CDB0(this, globalCtx, 3)) { +void func_8097CEEC(DemoGo* this, PlayState* play) { + if (func_8097CDB0(this, play, 3)) { this->action = 4; } } -void func_8097CF20(DemoGo* this, GlobalContext* globalCtx, s32 arg2) { +void func_8097CF20(DemoGo* this, PlayState* play, s32 arg2) { AnimationHeader* animation = &gGoronAnim_0029A8; if (arg2 != 0) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -255,100 +254,99 @@ void func_8097CF9C(DemoGo* this) { } } -void func_8097CFDC(DemoGo* this, GlobalContext* globalCtx) { - func_8097CE10(this, globalCtx); +void func_8097CFDC(DemoGo* this, PlayState* play) { + func_8097CE10(this, play); } -void func_8097CFFC(DemoGo* this, GlobalContext* globalCtx) { - func_8097CE20(this, globalCtx); +void func_8097CFFC(DemoGo* this, PlayState* play) { + func_8097CE20(this, play); } -void func_8097D01C(DemoGo* this, GlobalContext* globalCtx) { - func_8097CB0C(this, globalCtx); - func_8097CA30(this, globalCtx); - func_8097CE78(this, globalCtx); +void func_8097D01C(DemoGo* this, PlayState* play) { + func_8097CB0C(this, play); + func_8097CA30(this, play); + func_8097CE78(this, play); } -void func_8097D058(DemoGo* this, GlobalContext* globalCtx) { - func_8097CA30(this, globalCtx); - func_8097CEEC(this, globalCtx); +void func_8097D058(DemoGo* this, PlayState* play) { + func_8097CA30(this, play); + func_8097CEEC(this, play); } -void func_8097D088(DemoGo* this, GlobalContext* globalCtx) { +void func_8097D088(DemoGo* this, PlayState* play) { s32 something; - func_8097CA30(this, globalCtx); + func_8097CA30(this, play); something = DemoGo_UpdateSkelAnime(this); func_8097C930(this); - func_8097CF20(this, globalCtx, something); + func_8097CF20(this, play, something); } -void func_8097D0D0(DemoGo* this, GlobalContext* globalCtx) { - func_8097CCE0(this, globalCtx); +void func_8097D0D0(DemoGo* this, PlayState* play) { + func_8097CCE0(this, play); func_8097CCC0(this); - func_8097CA30(this, globalCtx); + func_8097CA30(this, play); DemoGo_UpdateSkelAnime(this); func_8097C930(this); func_8097C9DC(this); func_8097CF9C(this); } -void func_8097D130(DemoGo* this, GlobalContext* globalCtx) { - func_8097CCE0(this, globalCtx); +void func_8097D130(DemoGo* this, PlayState* play) { + func_8097CCE0(this, play); func_8097CC08(this); - func_8097CA30(this, globalCtx); + func_8097CA30(this, play); DemoGo_UpdateSkelAnime(this); func_8097C930(this); func_8097C9DC(this); } -void DemoGo_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoGo_Update(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; if (this->action < 0 || this->action >= 7 || D_8097D44C[this->action] == 0) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - D_8097D44C[this->action](this, globalCtx); + D_8097D44C[this->action](this, play); } -void DemoGo_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoGo_Init(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; AnimationHeader* animation = &gGoronAnim_004930; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); this->action = 0; } -void func_8097D290(DemoGo* this, GlobalContext* globalCtx) { +void func_8097D290(DemoGo* this, PlayState* play) { } -void func_8097D29C(DemoGo* this, GlobalContext* globalCtx) { +void func_8097D29C(DemoGo* this, PlayState* play) { s32 pad; s16 eyeTexIdx = this->unk_190; SkelAnime* skelAnime = &this->skelAnime; void* eyeTexture = sEyeTextures[eyeTexIdx]; void* mouthTexture = gGoronCsMouthSmileTex; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_go.c", 732); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_go.c", 732); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTexture)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, - this); + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_go.c", 746); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_go.c", 746); } -void DemoGo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoGo_Draw(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 2 || D_8097D468[this->drawConfig] == NULL) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - D_8097D468[this->drawConfig](this, globalCtx); + D_8097D468[this->drawConfig](this, play); } diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.h b/src/overlays/actors/ovl_Demo_Go/z_demo_go.h index 688a8a99c2..969fdd8e07 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.h +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.h @@ -6,8 +6,8 @@ struct DemoGo; -typedef void (*DemoGoActionFunc)(struct DemoGo*, GlobalContext*); -typedef void (*DemoGoDrawFunc)(struct DemoGo*, GlobalContext*); +typedef void (*DemoGoActionFunc)(struct DemoGo*, PlayState*); +typedef void (*DemoGoDrawFunc)(struct DemoGo*, PlayState*); typedef struct DemoGo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index c9eee965f3..14abf5bae4 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -6,16 +6,16 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoGt_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoGt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoGt_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoGt_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoGt_Init(Actor* thisx, PlayState* play); +void DemoGt_Destroy(Actor* thisx, PlayState* play); +void DemoGt_Update(Actor* thisx, PlayState* play); +void DemoGt_Draw(Actor* thisx, PlayState* play); -void DemoGt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoGt_Destroy(Actor* thisx, PlayState* play) { DemoGt* this = (DemoGt*)thisx; if ((this->dyna.actor.params == 1) || (this->dyna.actor.params == 2)) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -23,32 +23,31 @@ void DemoGt_PlayEarthquakeSfx() { func_800788CC(NA_SE_EV_EARTHQUAKE - SFX_FLAG); } -void DemoGt_PlayExplosion1Sfx(GlobalContext* globalCtx, Vec3f* pos) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, pos, 60, NA_SE_IT_BOMB_EXPLOSION); +void DemoGt_PlayExplosion1Sfx(PlayState* play, Vec3f* pos) { + SoundSource_PlaySfxAtFixedWorldPos(play, pos, 60, NA_SE_IT_BOMB_EXPLOSION); } -void DemoGt_PlayExplosion2Sfx(GlobalContext* globalCtx, Vec3f* pos) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, pos, 60, NA_SE_EV_GRAVE_EXPLOSION); +void DemoGt_PlayExplosion2Sfx(PlayState* play, Vec3f* pos) { + SoundSource_PlaySfxAtFixedWorldPos(play, pos, 60, NA_SE_EV_GRAVE_EXPLOSION); } -void DemoGt_Rumble(GlobalContext* globalCtx) { +void DemoGt_Rumble(PlayState* play) { func_800AA000(0.0f, 0x32, 0xA, 5); } -void DemoGt_SpawnDust(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 scaleStep, - s16 life) { +void DemoGt_SpawnDust(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 scaleStep, s16 life) { static Color_RGBA8 brownPrim = { 100, 80, 100, 0 }; static Color_RGBA8 redEnv = { 255, 110, 96, 0 }; - func_8002843C(globalCtx, pos, velocity, accel, &brownPrim, &redEnv, ((Rand_ZeroOne() * (scale * 0.2f)) + scale), + func_8002843C(play, pos, velocity, accel, &brownPrim, &redEnv, ((Rand_ZeroOne() * (scale * 0.2f)) + scale), scaleStep, life); } -void func_8097D7D8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velOffset, f32 scale, s32 arg4, s32 arg5, s16 life) { +void func_8097D7D8(PlayState* play, Vec3f* pos, Vec3f* velOffset, f32 scale, s32 arg4, s32 arg5, s16 life) { s32 pad; - if (!FrameAdvance_IsEnabled(globalCtx)) { - s32 frames = globalCtx->gameplayFrames; + if (!FrameAdvance_IsEnabled(play)) { + s32 frames = play->gameplayFrames; if (ABS(frames % arg4) == arg5) { s32 pad[2]; @@ -69,30 +68,29 @@ void func_8097D7D8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velOffset, f32 s accel.y *= scale; accel.z *= scale; - DemoGt_SpawnDust(globalCtx, pos, &velocity, &accel, (300.0f * scale), (15.0f * scale), life); + DemoGt_SpawnDust(play, pos, &velocity, &accel, (300.0f * scale), (15.0f * scale), life); } } } -Actor* DemoGt_SpawnCloudRing(GlobalContext* globalCtx, Vec3f* pos, s16 params) { - return Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_SPOT16_DOUGHNUT, pos->x, pos->y, pos->z, 0, 0, 0, - params); +Actor* DemoGt_SpawnCloudRing(PlayState* play, Vec3f* pos, s16 params) { + return Actor_Spawn(&play->actorCtx, play, ACTOR_BG_SPOT16_DOUGHNUT, pos->x, pos->y, pos->z, 0, 0, 0, params); } -void DemoGt_SpawnExplosionWithSound(GlobalContext* globalCtx, Vec3f* pos, f32 scale) { +void DemoGt_SpawnExplosionWithSound(PlayState* play, Vec3f* pos, f32 scale) { s32 pad; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; - EffectSsBomb2_SpawnLayered(globalCtx, pos, &velocity, &accel, (100.0f * scale), (15.0f * scale)); - DemoGt_PlayExplosion1Sfx(globalCtx, pos); + EffectSsBomb2_SpawnLayered(play, pos, &velocity, &accel, (100.0f * scale), (15.0f * scale)); + DemoGt_PlayExplosion1Sfx(play, pos); } -void DemoGt_SpawnExplosionNoSound(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale) { - EffectSsBomb2_SpawnLayered(globalCtx, pos, velocity, accel, (100.0f * scale), (25.0f * scale)); +void DemoGt_SpawnExplosionNoSound(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale) { + EffectSsBomb2_SpawnLayered(play, pos, velocity, accel, (100.0f * scale), (25.0f * scale)); } -void func_8097DAC8(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { +void func_8097DAC8(DemoGt* this, PlayState* play, Vec3f* spawnerPos) { Vec3f pos; Vec3f velocity; f32 temp_f0; @@ -126,14 +124,14 @@ void func_8097DAC8(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { phi_s0 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, spawnerPos, -247, phi_s0, 3, 0, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, spawnerPos, -247, phi_s0, 3, 0, 0, (s32)(Rand_ZeroOne() * 10.0f + 30.0f), 2, 300, (s32)(Rand_ZeroOne() * 0.0f) + 30, KAKERA_COLOR_NONE, OBJECT_GEFF, gGanonRubbleDL); angle += 0x1555; } } -void func_8097DD28(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { +void func_8097DD28(DemoGt* this, PlayState* play, Vec3f* spawnerPos) { Vec3f pos; Vec3f velocity; f32 temp_f0; @@ -167,7 +165,7 @@ void func_8097DD28(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { phi_s0 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, spawnerPos, -247, phi_s0, 3, 0, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, spawnerPos, -247, phi_s0, 3, 0, 0, (s32)((Rand_ZeroOne() * 10.0f) + 30.0f), 2, 300, (s32)(Rand_ZeroOne() * 0.0f) + 0x1E, KAKERA_COLOR_NONE, OBJECT_GEFF, gGanonRubbleDL); @@ -175,7 +173,7 @@ void func_8097DD28(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { } } -void func_8097DF70(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { +void func_8097DF70(DemoGt* this, PlayState* play, Vec3f* spawnerPos) { Vec3f pos; Vec3f velocity; f32 temp_f0; @@ -209,14 +207,14 @@ void func_8097DF70(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) { phi_s0 = 33; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, spawnerPos, -200, phi_s0, 10, 10, 0, - Rand_ZeroOne() * 30.0f + 30.0f, 2, 300, (s32)(Rand_ZeroOne() * 30.0f) + 30, - KAKERA_COLOR_NONE, OBJECT_GEFF, gGanonRubbleDL); + EffectSsKakera_Spawn(play, &pos, &velocity, spawnerPos, -200, phi_s0, 10, 10, 0, Rand_ZeroOne() * 30.0f + 30.0f, + 2, 300, (s32)(Rand_ZeroOne() * 30.0f) + 30, KAKERA_COLOR_NONE, OBJECT_GEFF, + gGanonRubbleDL); angle += 0x1555; } } -void func_8097E1D4(GlobalContext* globalCtx, Vec3f* arg1, s16 arg2) { +void func_8097E1D4(PlayState* play, Vec3f* arg1, s16 arg2) { Vec3f pos; Vec3f velocity; f32 temp_f0; @@ -250,7 +248,7 @@ void func_8097E1D4(GlobalContext* globalCtx, Vec3f* arg1, s16 arg2) { phi_s0 = 33; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, arg1, -247, phi_s0, 3, 0, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, arg1, -247, phi_s0, 3, 0, 0, (s32)((Rand_ZeroOne() * 10.0f) + 30.0f), 2, 300, (s32)(Rand_ZeroOne() * 0.0f) + 30, KAKERA_COLOR_NONE, OBJECT_GEFF, gGanonRubbleDL); @@ -258,8 +256,8 @@ void func_8097E1D4(GlobalContext* globalCtx, Vec3f* arg1, s16 arg2) { } } -void func_8097E454(GlobalContext* globalCtx, Vec3f* spawnerPos, Vec3f* velocity, Vec3f* accel, f32 arg4, f32 scale, - s32 arg6, s32 arg7, s16 life) { +void func_8097E454(PlayState* play, Vec3f* spawnerPos, Vec3f* velocity, Vec3f* accel, f32 arg4, f32 scale, s32 arg6, + s32 arg7, s16 life) { s32 pad2[3]; s16 increment; s32 frames; @@ -269,8 +267,8 @@ void func_8097E454(GlobalContext* globalCtx, Vec3f* spawnerPos, Vec3f* velocity, f32 dustScale = 300.0f * scale; Vec3f pos; - if ((!FrameAdvance_IsEnabled(globalCtx)) && (arg7 > 0) && (arg6 > 0)) { - frames = (ABS((s32)globalCtx->gameplayFrames) % arg7); + if ((!FrameAdvance_IsEnabled(play)) && (arg7 > 0) && (arg6 > 0)) { + frames = (ABS((s32)play->gameplayFrames) % arg7); phi_s0 = 0x10000 * frames / arg6; increment = 0x10000 / arg6; @@ -280,10 +278,10 @@ void func_8097E454(GlobalContext* globalCtx, Vec3f* spawnerPos, Vec3f* velocity, pos.y = spawnerPos->y; pos.z = (Math_CosS(phi_s0) * arg4) + spawnerPos->z; - DemoGt_SpawnDust(globalCtx, &pos, velocity, accel, dustScale, dustScaleStep, life); + DemoGt_SpawnDust(play, &pos, velocity, accel, dustScale, dustScaleStep, life); if (Rand_ZeroOne() <= 0.05f) { - func_8097E1D4(globalCtx, &pos, phi_s0); + func_8097E1D4(play, &pos, phi_s0); } phi_s0 += increment; @@ -291,27 +289,27 @@ void func_8097E454(GlobalContext* globalCtx, Vec3f* spawnerPos, Vec3f* velocity, } } -u8 func_8097E69C(GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +u8 func_8097E69C(PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { return true; } else { return false; } } -CsCmdActorAction* DemoGt_GetNpcAction(GlobalContext* globalCtx, u32 actionIdx) { +CsCmdActorAction* DemoGt_GetNpcAction(PlayState* play, u32 actionIdx) { s32 pad[2]; CsCmdActorAction* ret = NULL; - if (!func_8097E69C(globalCtx)) { - ret = globalCtx->csCtx.npcActions[actionIdx]; + if (!func_8097E69C(play)) { + ret = play->csCtx.npcActions[actionIdx]; } return ret; } -u8 func_8097E704(GlobalContext* globalCtx, u16 arg1, s32 arg2) { - CsCmdActorAction* action = DemoGt_GetNpcAction(globalCtx, arg2); +u8 func_8097E704(PlayState* play, u16 arg1, s32 arg2) { + CsCmdActorAction* action = DemoGt_GetNpcAction(play, arg2); if ((action != NULL) && (action->action == arg1)) { return true; @@ -320,8 +318,8 @@ u8 func_8097E704(GlobalContext* globalCtx, u16 arg1, s32 arg2) { } } -void func_8097E744(DemoGt* this, GlobalContext* globalCtx, u32 actionIdx) { - CsCmdActorAction* npcAction = DemoGt_GetNpcAction(globalCtx, actionIdx); +void func_8097E744(DemoGt* this, PlayState* play, u32 actionIdx) { + CsCmdActorAction* npcAction = DemoGt_GetNpcAction(play, actionIdx); Vec3f* pos = &this->dyna.actor.world.pos; f32 startX; f32 startY; @@ -333,7 +331,7 @@ void func_8097E744(DemoGt* this, GlobalContext* globalCtx, u32 actionIdx) { if (npcAction != NULL) { someFloat = - Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames, 8, 0); + Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames, 8, 0); startX = npcAction->startPos.x; startY = npcAction->startPos.y; startZ = npcAction->startPos.z; @@ -432,8 +430,8 @@ void func_8097E824(DemoGt* this, s32 arg1) { pos->z += tempf3; } -void func_8097ED64(DemoGt* this, GlobalContext* globalCtx, s32 actionIdx) { - func_8097E744(this, globalCtx, actionIdx); +void func_8097ED64(DemoGt* this, PlayState* play, s32 actionIdx) { + func_8097E744(this, play, actionIdx); func_8097E824(this, actionIdx); } @@ -451,7 +449,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void func_8097EDD8(DemoGt* this, GlobalContext* globalCtx, CollisionHeader* collision) { +void func_8097EDD8(DemoGt* this, PlayState* play, CollisionHeader* collision) { s32 pad[3]; CollisionHeader* colHeader; @@ -460,16 +458,16 @@ void func_8097EDD8(DemoGt* this, GlobalContext* globalCtx, CollisionHeader* coll DynaPolyActor_Init(&this->dyna, DPM_UNK); colHeader = NULL; CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } } -u8 func_8097EE44(DemoGt* this, GlobalContext* globalCtx, s32 updateMode, s32 drawConfig, CollisionHeader* colHeader) { +u8 func_8097EE44(DemoGt* this, PlayState* play, s32 updateMode, s32 drawConfig, CollisionHeader* colHeader) { if (func_8097ED94()) { this->updateMode = updateMode; this->drawConfig = drawConfig; - func_8097EDD8(this, globalCtx, colHeader); + func_8097EDD8(this, play, colHeader); return true; } else { Actor_Kill(&this->dyna.actor); @@ -477,27 +475,27 @@ u8 func_8097EE44(DemoGt* this, GlobalContext* globalCtx, s32 updateMode, s32 dra } } -void func_8097EEA8_Init0(DemoGt* this, GlobalContext* globalCtx) { +void func_8097EEA8_Init0(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 0, 1, NULL); + func_8097EE44(this, play, 0, 1, NULL); } -void func_8097EF00(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_8097EF00(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 527) { func_800F3F3C(13); } } -void func_8097EF34(DemoGt* this, GlobalContext* globalCtx) { +void func_8097EF34(DemoGt* this, PlayState* play) { } -void func_8097EF40(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_8097EF40(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; s32 pad1[3]; Vec3f dustPos; Vec3f velocity = { 0.0f, -16.0f, 0.0f }; @@ -510,43 +508,43 @@ void func_8097EF40(DemoGt* this, GlobalContext* globalCtx) { dustPos.y = pos->y + 679.0f; dustPos.z = pos->z + 82.0f; - DemoGt_SpawnDust(globalCtx, &dustPos, &velocity, &accel, 1700.0f, 15, 30); + DemoGt_SpawnDust(play, &dustPos, &velocity, &accel, 1700.0f, 15, 30); dustPos.x = pos->x + 256.0f; dustPos.y = pos->y + 679.0f; dustPos.z = pos->z - 60.0f; - DemoGt_SpawnDust(globalCtx, &dustPos, &velocity, &accel, 1700.0f, 15, 30); + DemoGt_SpawnDust(play, &dustPos, &velocity, &accel, 1700.0f, 15, 30); } } -void func_8097F0AC(DemoGt* this, GlobalContext* globalCtx) { +void func_8097F0AC(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f sp38; s16 pad1[3]; Vec3f sp24; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; s32 pad2; if ((frames == 140) || (kREG(1) == 19)) { sp38.x = this->dyna.actor.world.pos.x + 260.0f; sp38.y = this->dyna.actor.world.pos.y + 340.0f; sp38.z = this->dyna.actor.world.pos.z + 45.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &sp38, 2.0f); + DemoGt_SpawnExplosionWithSound(play, &sp38, 2.0f); } if (frames == 176) { sp24.x = this->dyna.actor.world.pos.x + 260.0f; sp24.y = this->dyna.actor.world.pos.y + 840.0f; sp24.z = this->dyna.actor.world.pos.z + 45.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &sp24, 2.0f); + DemoGt_SpawnExplosionWithSound(play, &sp24, 2.0f); } } -void func_8097F19C(DemoGt* this, GlobalContext* globalCtx) { - func_8097EF34(this, globalCtx); - func_8097EF40(this, globalCtx); - func_8097F0AC(this, globalCtx); +void func_8097F19C(DemoGt* this, PlayState* play) { + func_8097EF34(this, play); + func_8097EF40(this, play); + func_8097F0AC(this, play); } void func_8097F1D8(DemoGt* this) { @@ -560,13 +558,13 @@ void func_8097F1D8(DemoGt* this) { } } -void func_8097F280(DemoGt* this, GlobalContext* globalCtx) { +void func_8097F280(DemoGt* this, PlayState* play) { s32* unk178 = this->unk_178; s32* unk188 = this->unk_188; s32* unk198 = this->unk_198; f32 temp_f0; - if (globalCtx->csCtx.frames < 160) { + if (play->csCtx.frames < 160) { unk178[0] = 100; unk178[1] = 255; unk178[2] = 200; @@ -577,8 +575,8 @@ void func_8097F280(DemoGt* this, GlobalContext* globalCtx) { unk198[0]++; unk198[1]--; - } else if (globalCtx->csCtx.frames < 170) { - temp_f0 = Environment_LerpWeightAccelDecel(170, 160, globalCtx->csCtx.frames, 0, 0); + } else if (play->csCtx.frames < 170) { + temp_f0 = Environment_LerpWeightAccelDecel(170, 160, play->csCtx.frames, 0, 0); unk178[0] = (temp_f0 * -63.0f) + 163.0f; unk178[1] = (temp_f0 * -155.0f) + 255.0f; @@ -598,36 +596,36 @@ void func_8097F280(DemoGt* this, GlobalContext* globalCtx) { } } -void func_8097F3EC(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 1)) { +void func_8097F3EC(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 1)) { this->updateMode = 8; } } -void DemoGt_Update0(DemoGt* this, GlobalContext* globalCtx) { - func_8097F280(this, globalCtx); +void DemoGt_Update0(DemoGt* this, PlayState* play) { + func_8097F280(this, play); func_8097E824(this, 1); - func_8097F19C(this, globalCtx); - func_8097F3EC(this, globalCtx); + func_8097F19C(this, play); + func_8097F3EC(this, play); DemoGt_PlayEarthquakeSfx(); - DemoGt_Rumble(globalCtx); - func_8097EF00(this, globalCtx); + DemoGt_Rumble(play); + func_8097EF00(this, play); } -void DemoGt_Update8(DemoGt* this, GlobalContext* globalCtx) { - func_8097F280(this, globalCtx); +void DemoGt_Update8(DemoGt* this, PlayState* play) { + func_8097F280(this, play); func_8097F1D8(this); - func_8097ED64(this, globalCtx, 1); - func_8097F19C(this, globalCtx); + func_8097ED64(this, play, 1); + func_8097F19C(this, play); DemoGt_PlayEarthquakeSfx(); - DemoGt_Rumble(globalCtx); - func_8097EF00(this, globalCtx); + DemoGt_Rumble(play); + func_8097EF00(this, play); } -void DemoGt_Draw1(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw1(DemoGt* this, PlayState* play) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - u32 gameplayFrames = globalCtx->gameplayFrames; + GraphicsContext* gfxCtx = play->state.gfxCtx; + u32 gameplayFrames = play->gameplayFrames; s16 pad2[2]; s16 spC6; f32 spC0; @@ -691,22 +689,22 @@ void DemoGt_Draw1(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_demo_gt_part1.c", 557); } -void func_8097F904_Init1(DemoGt* this, GlobalContext* globalCtx) { +void func_8097F904_Init1(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 1, 2, &gTowerCollapseCsCollapsedStructureInnerCol); + func_8097EE44(this, play, 1, 2, &gTowerCollapseCsCollapsedStructureInnerCol); } -void func_8097F960(DemoGt* this, GlobalContext* globalCtx) { +void func_8097F960(DemoGt* this, PlayState* play) { } -void func_8097F96C(DemoGt* this, GlobalContext* globalCtx) { +void func_8097F96C(DemoGt* this, PlayState* play) { static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if (((frames > 1059) && (frames < 1062)) || kREG(1) == 17) { pos.x = this->dyna.actor.world.pos.x; @@ -714,7 +712,7 @@ void func_8097F96C(DemoGt* this, GlobalContext* globalCtx) { pos.z = this->dyna.actor.world.pos.z; if (cloudRing == NULL) { - cloudRing = DemoGt_SpawnCloudRing(globalCtx, &pos, 2); + cloudRing = DemoGt_SpawnCloudRing(play, &pos, 2); } else { actor = cloudRing; actor->world.pos.x = pos.x; @@ -724,10 +722,10 @@ void func_8097F96C(DemoGt* this, GlobalContext* globalCtx) { } } -void func_8097FA1C(DemoGt* this, GlobalContext* globalCtx) { +void func_8097FA1C(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { -12.0f, -17.0, 5.0 }; s32 pad1[3]; @@ -736,11 +734,11 @@ void func_8097FA1C(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = pos->x + 300.0f; dustPos.y = pos->y + 360.0f; dustPos.z = pos->z - 377.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 1, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 1, 35); } } -void func_8097FAFC(DemoGt* this, GlobalContext* globalCtx) { +void func_8097FAFC(DemoGt* this, PlayState* play) { static Vec3f velocity = { 0.0f, 1.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static f32 arg4 = 280.0f; @@ -749,7 +747,7 @@ void func_8097FAFC(DemoGt* this, GlobalContext* globalCtx) { static s32 arg7 = 1; static s16 life = 3; s32 pad[2]; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f pos; f32 new_var = -200.0; @@ -763,14 +761,14 @@ void func_8097FAFC(DemoGt* this, GlobalContext* globalCtx) { accel.y += new_var; } - func_8097E454(globalCtx, &pos, &velocity, &accel, arg4, scale, arg6, arg7, life); + func_8097E454(play, &pos, &velocity, &accel, arg4, scale, arg6, arg7, life); } } -void func_8097FC1C(DemoGt* this, GlobalContext* globalCtx) { +void func_8097FC1C(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; @@ -779,44 +777,44 @@ void func_8097FC1C(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = pos->x + 260.0f; dustPos.y = pos->y + 360.0f; dustPos.z = pos->z + 260.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 0, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 0, 35); } } -void func_8097FCE4(DemoGt* this, GlobalContext* globalCtx) { +void func_8097FCE4(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f vec; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if (frames == 0x1F7 || kREG(1) == 4) { vec.x = this->dyna.actor.world.pos.x + 300.0f; vec.y = this->dyna.actor.world.pos.y + 560.0f; vec.z = this->dyna.actor.world.pos.z - 377.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &vec, 2.0f); + DemoGt_SpawnExplosionWithSound(play, &vec, 2.0f); } } -void func_8097FD70(DemoGt* this, GlobalContext* globalCtx) { - func_8097F960(this, globalCtx); - func_8097F96C(this, globalCtx); - func_8097FA1C(this, globalCtx); - func_8097FAFC(this, globalCtx); - func_8097FC1C(this, globalCtx); - func_8097FCE4(this, globalCtx); +void func_8097FD70(DemoGt* this, PlayState* play) { + func_8097F960(this, play); + func_8097F96C(this, play); + func_8097FA1C(this, play); + func_8097FAFC(this, play); + func_8097FC1C(this, play); + func_8097FCE4(this, play); } -void func_8097FDDC(DemoGt* this, GlobalContext* globalCtx) { +void func_8097FDDC(DemoGt* this, PlayState* play) { s32* unk178 = this->unk_178; s32* unk198 = this->unk_198; - if (globalCtx->csCtx.frames < 610) { + if (play->csCtx.frames < 610) { unk178[0] = 163; unk178[1] = 193; unk178[2] = 193; unk198[0]++; unk198[1]--; - } else if (globalCtx->csCtx.frames < 620) { - f32 temp_f0 = Environment_LerpWeightAccelDecel(620, 610, globalCtx->csCtx.frames, 0, 0); + } else if (play->csCtx.frames < 620) { + f32 temp_f0 = Environment_LerpWeightAccelDecel(620, 610, play->csCtx.frames, 0, 0); unk178[0] = (temp_f0 * (-13.0f)) + 163.0f; unk178[1] = (temp_f0 * (-43.0f)) + 193.0f; @@ -828,27 +826,27 @@ void func_8097FDDC(DemoGt* this, GlobalContext* globalCtx) { } } -void func_8097FED8(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 2)) { +void func_8097FED8(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 2)) { this->updateMode = 9; } } -void DemoGt_Update1(DemoGt* this, GlobalContext* globalCtx) { - func_8097FDDC(this, globalCtx); +void DemoGt_Update1(DemoGt* this, PlayState* play) { + func_8097FDDC(this, play); func_8097E824(this, 2); - func_8097FD70(this, globalCtx); - func_8097FED8(this, globalCtx); + func_8097FD70(this, play); + func_8097FED8(this, play); } -void DemoGt_Update9(DemoGt* this, GlobalContext* globalCtx) { - func_8097FDDC(this, globalCtx); - func_8097ED64(this, globalCtx, 2); - func_8097FD70(this, globalCtx); +void DemoGt_Update9(DemoGt* this, PlayState* play) { + func_8097FDDC(this, play); + func_8097ED64(this, play, 2); + func_8097FD70(this, play); } -void DemoGt_Draw2(DemoGt* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void DemoGt_Draw2(DemoGt* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32* unk198; s32* unk178; s32 pad; @@ -869,32 +867,32 @@ void DemoGt_Draw2(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_demo_gt_part2.c", 489); } -void func_80980110_Init2(DemoGt* this, GlobalContext* globalCtx) { +void func_80980110_Init2(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 2, 3, &gTowerCollapseCsCollapsedStructureOuterCol); + func_8097EE44(this, play, 2, 3, &gTowerCollapseCsCollapsedStructureOuterCol); } -void func_8098016C(DemoGt* this, GlobalContext* globalCtx) { +void func_8098016C(DemoGt* this, PlayState* play) { } -void func_80980178(DemoGt* this, GlobalContext* globalCtx) { +void func_80980178(DemoGt* this, PlayState* play) { } -void func_80980184(DemoGt* this, GlobalContext* globalCtx) { +void func_80980184(DemoGt* this, PlayState* play) { static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; - if ((globalCtx->csCtx.frames > 1027) && (globalCtx->csCtx.frames < 1031)) { + if ((play->csCtx.frames > 1027) && (play->csCtx.frames < 1031)) { pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 247.0f; pos.z = this->dyna.actor.world.pos.z; if (cloudRing == NULL) { - cloudRing = DemoGt_SpawnCloudRing(globalCtx, &pos, 3); + cloudRing = DemoGt_SpawnCloudRing(play, &pos, 3); } else { actor = cloudRing; actor->world.pos.x = pos.x; @@ -904,19 +902,19 @@ void func_80980184(DemoGt* this, GlobalContext* globalCtx) { } } -void func_80980218(DemoGt* this, GlobalContext* globalCtx) { +void func_80980218(DemoGt* this, PlayState* play) { static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; - if ((globalCtx->csCtx.frames > 997) && (globalCtx->csCtx.frames < 1001)) { + if ((play->csCtx.frames > 997) && (play->csCtx.frames < 1001)) { pos.x = this->dyna.actor.home.pos.x; pos.y = this->dyna.actor.home.pos.y + 38.0f; pos.z = this->dyna.actor.home.pos.z; if (cloudRing == NULL) { - cloudRing = DemoGt_SpawnCloudRing(globalCtx, &pos, 4); + cloudRing = DemoGt_SpawnCloudRing(play, &pos, 4); } else { actor = cloudRing; actor->world.pos.x = pos.x; @@ -926,10 +924,10 @@ void func_80980218(DemoGt* this, GlobalContext* globalCtx) { } } -void func_809802AC(DemoGt* this, GlobalContext* globalCtx) { +void func_809802AC(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 0.0f, 0.0f, -10.0f }; s32 pad1[3]; @@ -938,14 +936,14 @@ void func_809802AC(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = pos->x - 100.0f; dustPos.y = pos->y + 1260.0f; dustPos.z = pos->z - 323.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 4.0f, 3, 0, 20); + func_8097D7D8(play, &dustPos, &velOffset, 4.0f, 3, 0, 20); } } -void func_8098036C(DemoGt* this, GlobalContext* globalCtx) { +void func_8098036C(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* world = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -3.0f, 0.0f }; s32 pad1[3]; @@ -954,14 +952,14 @@ void func_8098036C(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = world->x + 760.0f; dustPos.y = world->y - 40.0f; dustPos.z = world->z - 240.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 1, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 1, 35); } } -void func_80980430(DemoGt* this, GlobalContext* globalCtx) { +void func_80980430(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - s32 frames = globalCtx->csCtx.frames; + s32 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -3.0f, 0.0f }; s32 pad1[3]; @@ -970,14 +968,14 @@ void func_80980430(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = pos->x + 760.0f; dustPos.y = pos->y - 40.0f; dustPos.z = pos->z - 240.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 1, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 1, 35); } } -void func_80980504(DemoGt* this, GlobalContext* globalCtx) { +void func_80980504(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; @@ -986,14 +984,14 @@ void func_80980504(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = pos->x + 830.0f; dustPos.y = pos->y + 60.0f; dustPos.z = pos->z + 390.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 2, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 2, 35); } } -void func_809805D8(DemoGt* this, GlobalContext* globalCtx) { +void func_809805D8(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* homePos = &this->dyna.actor.home.pos; Vec3f velOffset = { 15.0f, -26.0, 0.0f }; s32 pad1[3]; @@ -1002,14 +1000,14 @@ void func_809805D8(DemoGt* this, GlobalContext* globalCtx) { dustPos.x = homePos->x + 550.0f; dustPos.y = homePos->y - 110.0f; dustPos.z = homePos->z + 50.0f; - func_8097D7D8(globalCtx, &dustPos, &velOffset, 6.0f, 6, 4, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 4, 35); } } -void func_809806B8(DemoGt* this, GlobalContext* globalContext) { +void func_809806B8(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalContext->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; @@ -1018,14 +1016,14 @@ void func_809806B8(DemoGt* this, GlobalContext* globalContext) { dustPos.x = pos->x + 460.0f; dustPos.y = pos->y + 60.0f; dustPos.z = pos->z + 760.0f; - func_8097D7D8(globalContext, &dustPos, &velOffset, 6.0f, 6, 3, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0f, 6, 3, 35); } } -void func_8098078C(DemoGt* this, GlobalContext* globalContext) { +void func_8098078C(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f dustPos; - u16 frames = globalContext->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; @@ -1034,39 +1032,39 @@ void func_8098078C(DemoGt* this, GlobalContext* globalContext) { dustPos.x = pos->x + 360.0f; dustPos.y = pos->y + 70.0f; dustPos.z = pos->z - 640.0f; - func_8097D7D8(globalContext, &dustPos, &velOffset, 6.0, 6, 0, 35); + func_8097D7D8(play, &dustPos, &velOffset, 6.0, 6, 0, 35); } } -void func_8098085C(DemoGt* this, GlobalContext* globalCtx) { +void func_8098085C(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f sp28; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; Vec3f* pos = &this->dyna.actor.world.pos; if ((frames == 58) || (kREG(1) == 1)) { sp28.x = pos->x + 900.0f; sp28.y = pos->y - 50.0f; sp28.z = pos->z + 93.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &sp28, 2.0f); + DemoGt_SpawnExplosionWithSound(play, &sp28, 2.0f); } else if (frames == 80) { sp28.x = pos->x + 810.0f; sp28.y = pos->y + 200.0f; sp28.z = pos->z - 37.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &sp28, 0.9f); + DemoGt_SpawnExplosionWithSound(play, &sp28, 0.9f); } else if (frames == 90) { sp28.x = pos->x - 220.0f; sp28.y = pos->y + 1350.0f; sp28.z = pos->z - 287.0f; - DemoGt_SpawnExplosionWithSound(globalCtx, &sp28, 2.0f); + DemoGt_SpawnExplosionWithSound(play, &sp28, 2.0f); } } -void func_809809C0(DemoGt* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_809809C0(DemoGt* this, PlayState* play2) { + PlayState* play = play2; DemoGt* this2 = this; - s32 gameplayFrames = globalCtx->gameplayFrames; - u16 frames = globalCtx->csCtx.frames; + s32 gameplayFrames = play->gameplayFrames; + u16 frames = play->csCtx.frames; Vec3f sp54; s16 pad[3]; @@ -1080,93 +1078,93 @@ void func_809809C0(DemoGt* this, GlobalContext* globalCtx2) { sp54.z = this2->dyna.actor.world.pos.z + 23.0f; if (ABS(gameplayFrames % 12) == 0) { - DemoGt_SpawnExplosionNoSound(globalCtx, &sp54, &sp40, &sp34, 2.0f); + DemoGt_SpawnExplosionNoSound(play, &sp54, &sp40, &sp34, 2.0f); } } } -void func_80980AD4(DemoGt* this, GlobalContext* globalCtx) { +void func_80980AD4(DemoGt* this, PlayState* play) { s32 pad[4]; Vec3f pos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if ((frames == 477) || (kREG(2) == 1)) { pos.x = this->dyna.actor.world.pos.x + 790.0f; pos.y = this->dyna.actor.world.pos.y + 60.0f; pos.z = this->dyna.actor.world.pos.z + 23.0f; - func_8097DAC8(this, globalCtx, &pos); - DemoGt_PlayExplosion2Sfx(globalCtx, &pos); + func_8097DAC8(this, play, &pos); + DemoGt_PlayExplosion2Sfx(play, &pos); } } -void func_80980B68(DemoGt* this, GlobalContext* globalCtx) { +void func_80980B68(DemoGt* this, PlayState* play) { s32 pad[4]; Vec3f pos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if ((frames == 317) || (kREG(3) == 1)) { pos.x = this->dyna.actor.world.pos.x + 980.0f; pos.y = this->dyna.actor.world.pos.y + 410.0f; pos.z = this->dyna.actor.world.pos.z - 177.0f; - func_8097DD28(this, globalCtx, &pos); - DemoGt_PlayExplosion2Sfx(globalCtx, &pos); + func_8097DD28(this, play, &pos); + DemoGt_PlayExplosion2Sfx(play, &pos); } } -void func_80980BFC(DemoGt* this, GlobalContext* globalCtx) { +void func_80980BFC(DemoGt* this, PlayState* play) { s32 pad[4]; Vec3f pos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if ((frames == 740) || (kREG(4) == 1)) { pos.x = this->dyna.actor.world.pos.x + 790.0f; pos.y = this->dyna.actor.world.pos.y + 60.0f; pos.z = this->dyna.actor.world.pos.z + 23.0f; - func_8097DF70(this, globalCtx, &pos); - DemoGt_PlayExplosion2Sfx(globalCtx, &pos); + func_8097DF70(this, play, &pos); + DemoGt_PlayExplosion2Sfx(play, &pos); } } -void func_80980C90(DemoGt* this, GlobalContext* globalCtx) { - func_8098016C(this, globalCtx); - func_80980178(this, globalCtx); - func_80980184(this, globalCtx); - func_80980218(this, globalCtx); - func_809802AC(this, globalCtx); - func_8098036C(this, globalCtx); - func_80980430(this, globalCtx); - func_80980504(this, globalCtx); - func_809805D8(this, globalCtx); - func_809806B8(this, globalCtx); - func_8098078C(this, globalCtx); - func_8098085C(this, globalCtx); - func_809809C0(this, globalCtx); - func_80980AD4(this, globalCtx); - func_80980B68(this, globalCtx); - func_80980BFC(this, globalCtx); +void func_80980C90(DemoGt* this, PlayState* play) { + func_8098016C(this, play); + func_80980178(this, play); + func_80980184(this, play); + func_80980218(this, play); + func_809802AC(this, play); + func_8098036C(this, play); + func_80980430(this, play); + func_80980504(this, play); + func_809805D8(this, play); + func_809806B8(this, play); + func_8098078C(this, play); + func_8098085C(this, play); + func_809809C0(this, play); + func_80980AD4(this, play); + func_80980B68(this, play); + func_80980BFC(this, play); } -void func_80980D74(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 3)) { +void func_80980D74(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 3)) { this->updateMode = 10; } } -void DemoGt_Update2(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update2(DemoGt* this, PlayState* play) { func_8097E824(this, 3); - func_80980C90(this, globalCtx); - func_80980D74(this, globalCtx); + func_80980C90(this, play); + func_80980D74(this, play); } -void DemoGt_Update10(DemoGt* this, GlobalContext* globalCtx) { - func_8097ED64(this, globalCtx, 3); - func_80980C90(this, globalCtx); +void DemoGt_Update10(DemoGt* this, PlayState* play) { + func_8097ED64(this, play, 3); + func_80980C90(this, play); } -void DemoGt_Draw3(DemoGt* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void DemoGt_Draw3(DemoGt* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_gt_part3.c", 1026); @@ -1179,27 +1177,27 @@ void DemoGt_Draw3(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_demo_gt_part3.c", 1032); } -void func_80980F00_Init5(DemoGt* this, GlobalContext* globalCtx) { +void func_80980F00_Init5(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 3, 4, NULL); + func_8097EE44(this, play, 3, 4, NULL); } -void func_80980F58(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_80980F58(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 244) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_TOWER_PARTS_BROKEN - SFX_FLAG); } } -void func_80980F8C(DemoGt* this, GlobalContext* globalCtx) { +void func_80980F8C(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f sp58; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if ((frames > 259) && (frames < 289)) { Vec3f velOfset = { 0.0f, -17.0f, 0.0f }; @@ -1210,30 +1208,30 @@ void func_80980F8C(DemoGt* this, GlobalContext* globalCtx) { sp58.z = -170.0f; Matrix_MultVec3f(&sp58, &dustPos); - func_8097D7D8(globalCtx, &dustPos, &velOfset, 3.0f, 5, 0, 30); + func_8097D7D8(play, &dustPos, &velOfset, 3.0f, 5, 0, 30); } } -void func_8098103C(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 4)) { +void func_8098103C(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 4)) { this->updateMode = 11; - } else if (func_8097E704(globalCtx, 3, 4)) { + } else if (func_8097E704(play, 3, 4)) { this->updateMode = 16; } } -void DemoGt_Update3(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update3(DemoGt* this, PlayState* play) { func_8097E824(this, 4); - func_80980F58(this, globalCtx); - func_8098103C(this, globalCtx); + func_80980F58(this, play); + func_8098103C(this, play); } -void DemoGt_Update11(DemoGt* this, GlobalContext* globalCtx) { - func_8097ED64(this, globalCtx, 4); - func_80980F58(this, globalCtx); +void DemoGt_Update11(DemoGt* this, PlayState* play) { + func_8097ED64(this, play, 4); + func_80980F58(this, play); } -void DemoGt_Update16(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update16(DemoGt* this, PlayState* play) { f32 temp = this->unk_172; this->unk_174 = (temp * ((kREG(64) * 0.001f) + 0.048f)) + (kREG(65) + 98.0f); @@ -1244,10 +1242,10 @@ void DemoGt_Update16(DemoGt* this, GlobalContext* globalCtx) { } } -void DemoGt_Draw4(DemoGt* this, GlobalContext* globalCtx2) { +void DemoGt_Draw4(DemoGt* this, PlayState* play2) { GraphicsContext* gfxCtx; - GlobalContext* globalCtx = globalCtx2; - u16 frames = globalCtx->csCtx.frames; + PlayState* play = play2; + u16 frames = play->csCtx.frames; s32 pad; s16 sp76; f32 sp70; @@ -1267,7 +1265,7 @@ void DemoGt_Draw4(DemoGt* this, GlobalContext* globalCtx2) { sp6C = kREG(61); sp68 = (s16)((s32)kREG(58)) + 0x4000; sp6A = kREG(58); - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; sp60 = Graph_Alloc(gfxCtx, sizeof(Mtx)); sp44 = 1.0f - Math_CosS(sp76); @@ -1287,8 +1285,8 @@ void DemoGt_Draw4(DemoGt* this, GlobalContext* globalCtx2) { Matrix_Translate(sp48.x, sp48.y, sp48.z, MTXMODE_APPLY); Matrix_ToMtx(sp60, "../z_demo_gt_part4_1.c", 232); - if (!FrameAdvance_IsEnabled(globalCtx)) { - func_80980F8C(this, globalCtx); + if (!FrameAdvance_IsEnabled(play)) { + func_80980F8C(this, play); } Matrix_Pop(); @@ -1302,27 +1300,27 @@ void DemoGt_Draw4(DemoGt* this, GlobalContext* globalCtx2) { } } -void func_809813CC_Init6(DemoGt* this, GlobalContext* globalCtx) { +void func_809813CC_Init6(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 4, 5, NULL); + func_8097EE44(this, play, 4, 5, NULL); } -void func_80981424(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_80981424(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 789) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_TOWER_PARTS_BROKEN - SFX_FLAG); } } -void func_80981458(DemoGt* this, GlobalContext* globalCtx) { +void func_80981458(DemoGt* this, PlayState* play) { s32 pad[3]; Vec3f sp58; Vec3f dustPos; - u16 frames = globalCtx->csCtx.frames; + u16 frames = play->csCtx.frames; if (((frames > 855) && (frames < 891)) || (kREG(1) == 13)) { Vec3f velOffset = { 0.0f, -30.0f, 0.0f }; @@ -1333,30 +1331,30 @@ void func_80981458(DemoGt* this, GlobalContext* globalCtx) { sp58.z = -1100.0f; Matrix_MultVec3f(&sp58, &dustPos); - func_8097D7D8(globalCtx, &dustPos, &velOffset, 7.1f, 5, 1, 30); + func_8097D7D8(play, &dustPos, &velOffset, 7.1f, 5, 1, 30); } } -void func_80981524(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 5)) { +void func_80981524(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 5)) { this->updateMode = 12; - } else if (func_8097E704(globalCtx, 3, 5)) { + } else if (func_8097E704(play, 3, 5)) { this->updateMode = 17; } } -void DemoGt_Update4(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update4(DemoGt* this, PlayState* play) { func_8097E824(this, 5); - func_80981424(this, globalCtx); - func_80981524(this, globalCtx); + func_80981424(this, play); + func_80981524(this, play); } -void DemoGt_Update12(DemoGt* this, GlobalContext* globalCtx) { - func_8097ED64(this, globalCtx, 5); - func_80981424(this, globalCtx); +void DemoGt_Update12(DemoGt* this, PlayState* play) { + func_8097ED64(this, play, 5); + func_80981424(this, play); } -void DemoGt_Update17(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update17(DemoGt* this, PlayState* play) { f32 temp = this->unk_172; this->unk_174 = temp * ((kREG(66) * 0.001f) + 0.048f) + (kREG(67) + 50.0f); @@ -1367,7 +1365,7 @@ void DemoGt_Update17(DemoGt* this, GlobalContext* globalCtx) { } } -void DemoGt_Draw5(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw5(DemoGt* this, PlayState* play) { GraphicsContext* gfxCtx; s32 pad; s16 sp76; @@ -1386,7 +1384,7 @@ void DemoGt_Draw5(DemoGt* this, GlobalContext* globalCtx) { sp6C = kREG(62); sp6A = kREG(59) - 0x4000; sp68 = (s16)(kREG(59) - 0x4000) + 0x4000; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; sp60 = Graph_Alloc(gfxCtx, sizeof(Mtx)); sp44 = 1 - Math_CosS(sp76); @@ -1406,8 +1404,8 @@ void DemoGt_Draw5(DemoGt* this, GlobalContext* globalCtx) { Matrix_Translate(sp48.x, sp48.y, sp48.z, MTXMODE_APPLY); Matrix_ToMtx(sp60, "../z_demo_gt_part4_2.c", 227); - if (!FrameAdvance_IsEnabled(globalCtx)) { - func_80981458(this, globalCtx); + if (!FrameAdvance_IsEnabled(play)) { + func_80981458(this, play); } Matrix_Pop(); @@ -1420,40 +1418,40 @@ void DemoGt_Draw5(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_demo_gt_part4_2.c", 241); } -void func_809818A4_Init7(DemoGt* this, GlobalContext* globalCtx) { +void func_809818A4_Init7(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 5, 6, NULL); + func_8097EE44(this, play, 5, 6, NULL); } -void func_809818FC(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_809818FC(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 845) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_TOWER_PARTS_BROKEN - SFX_FLAG); } } -void func_80981930(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 6)) { +void func_80981930(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 6)) { this->updateMode = 13; - } else if (func_8097E704(globalCtx, 3, 6)) { + } else if (func_8097E704(play, 3, 6)) { this->updateMode = 18; } } -void DemoGt_Update5(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update5(DemoGt* this, PlayState* play) { func_8097E824(this, 6); - func_809818FC(this, globalCtx); - func_80981930(this, globalCtx); + func_809818FC(this, play); + func_80981930(this, play); } -void DemoGt_Update13(DemoGt* this, GlobalContext* globalCtx) { - func_8097ED64(this, globalCtx, 6); - func_809818FC(this, globalCtx); +void DemoGt_Update13(DemoGt* this, PlayState* play) { + func_8097ED64(this, play, 6); + func_809818FC(this, play); } -void DemoGt_Update18(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update18(DemoGt* this, PlayState* play) { f32 temp = this->unk_172; this->unk_174 = (temp * ((kREG(68) * 0.001f) + 0.005f)) + (kREG(69) + 50.0f); @@ -1464,7 +1462,7 @@ void DemoGt_Update18(DemoGt* this, GlobalContext* globalCtx) { } } -void DemoGt_Draw6(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw6(DemoGt* this, PlayState* play) { DemoGt* this2 = this; s16 sp78 = this2->unk_172; f32 sp74; @@ -1482,7 +1480,7 @@ void DemoGt_Draw6(DemoGt* this, GlobalContext* globalCtx) { sp6E = kREG(60) + 0x4000; sp6C = kREG(60) + 0x4000; sp6C += 0x4000; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; sp64 = Graph_Alloc(gfxCtx, sizeof(Mtx)); sp48 = 1.0f - Math_CosS(sp78); @@ -1512,15 +1510,15 @@ void DemoGt_Draw6(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_demo_gt_part4_3.c", 307); } -void func_80981C94_Init23(DemoGt* this, GlobalContext* globalCtx) { +void func_80981C94_Init23(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 6, 7, NULL); + func_8097EE44(this, play, 6, 7, NULL); } -void func_80981CEC(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_80981CEC(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 183) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_TOWER_PARTS_BROKEN - SFX_FLAG); @@ -1538,27 +1536,27 @@ void func_80981D20(DemoGt* this) { } } -void func_80981DC8(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 7)) { +void func_80981DC8(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 7)) { this->updateMode = 0xE; } } -void DemoGt_Update6(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update6(DemoGt* this, PlayState* play) { func_8097E824(this, 7); - func_80981CEC(this, globalCtx); - func_80981DC8(this, globalCtx); + func_80981CEC(this, play); + func_80981DC8(this, play); } -void DemoGt_Update14(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update14(DemoGt* this, PlayState* play) { func_80981D20(this); - func_8097ED64(this, globalCtx, 7); - func_80981CEC(this, globalCtx); + func_8097ED64(this, play, 7); + func_80981CEC(this, play); } -void DemoGt_Draw7(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw7(DemoGt* this, PlayState* play) { DemoGt* this2 = this; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 sp6E; f32 sp68; f32 sp64; @@ -1603,15 +1601,15 @@ void DemoGt_Draw7(DemoGt* this, GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_demo_gt_part5.c", 160); } -void func_80982054_Init24(DemoGt* this, GlobalContext* globalCtx) { +void func_80982054_Init24(DemoGt* this, PlayState* play) { this->dyna.actor.scale.x *= 10.0f; this->dyna.actor.scale.y *= 10.0f; this->dyna.actor.scale.z *= 10.0f; - func_8097EE44(this, globalCtx, 7, 8, NULL); + func_8097EE44(this, play, 7, 8, NULL); } -void func_809820AC(DemoGt* this, GlobalContext* globalCtx) { - u16 frames = globalCtx->csCtx.frames; +void func_809820AC(DemoGt* this, PlayState* play) { + u16 frames = play->csCtx.frames; if (frames == 154) { func_80078914(&this->dyna.actor.projectedPos, NA_SE_EV_TOWER_PARTS_BROKEN - SFX_FLAG); @@ -1629,27 +1627,27 @@ void func_809820E0(DemoGt* this) { } } -void func_80982188(DemoGt* this, GlobalContext* globalCtx) { - if (func_8097E704(globalCtx, 2, 9) != 0) { +void func_80982188(DemoGt* this, PlayState* play) { + if (func_8097E704(play, 2, 9) != 0) { this->updateMode = 15; } } -void DemoGt_Update7(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update7(DemoGt* this, PlayState* play) { func_8097E824(this, 9); - func_809820AC(this, globalCtx); - func_80982188(this, globalCtx); + func_809820AC(this, play); + func_80982188(this, play); } -void DemoGt_Update15(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Update15(DemoGt* this, PlayState* play) { func_809820E0(this); - func_8097ED64(this, globalCtx, 9); - func_809820AC(this, globalCtx); + func_8097ED64(this, play, 9); + func_809820AC(this, play); } -void DemoGt_Draw8(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw8(DemoGt* this, PlayState* play) { DemoGt* this2 = this; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 sp6E; f32 sp68; f32 sp64; @@ -1701,7 +1699,7 @@ static DemoGtUpdateFunc sUpdateFuncs[] = { DemoGt_Update15, DemoGt_Update16, DemoGt_Update17, DemoGt_Update18, }; -void DemoGt_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoGt_Update(Actor* thisx, PlayState* play) { DemoGt* this = (DemoGt*)thisx; DemoGtUpdateFunc updateFunc; @@ -1711,36 +1709,36 @@ void DemoGt_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - updateFunc(this, globalCtx); + updateFunc(this, play); } -void DemoGt_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoGt_Init(Actor* thisx, PlayState* play) { DemoGt* this = (DemoGt*)thisx; switch (this->dyna.actor.params) { case 0: - func_8097EEA8_Init0(this, globalCtx); + func_8097EEA8_Init0(this, play); break; case 1: - func_8097F904_Init1(this, globalCtx); + func_8097F904_Init1(this, play); break; case 2: - func_80980110_Init2(this, globalCtx); + func_80980110_Init2(this, play); break; case 5: - func_80980F00_Init5(this, globalCtx); + func_80980F00_Init5(this, play); break; case 6: - func_809813CC_Init6(this, globalCtx); + func_809813CC_Init6(this, play); break; case 7: - func_809818A4_Init7(this, globalCtx); + func_809818A4_Init7(this, play); break; case 23: - func_80981C94_Init23(this, globalCtx); + func_80981C94_Init23(this, play); break; case 24: - func_80982054_Init24(this, globalCtx); + func_80982054_Init24(this, play); break; default: // "Demo_Gt_Actor_ct There is no such argument !" @@ -1749,7 +1747,7 @@ void DemoGt_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void DemoGt_Draw0(DemoGt* this, GlobalContext* globalCtx) { +void DemoGt_Draw0(DemoGt* this, PlayState* play) { } static DemoGtDrawFunc sDrawFuncs[] = { @@ -1757,7 +1755,7 @@ static DemoGtDrawFunc sDrawFuncs[] = { DemoGt_Draw5, DemoGt_Draw6, DemoGt_Draw7, DemoGt_Draw8, }; -void DemoGt_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoGt_Draw(Actor* thisx, PlayState* play) { DemoGt* this = (DemoGt*)thisx; DemoGtDrawFunc drawFunc; @@ -1767,7 +1765,7 @@ void DemoGt_Draw(Actor* thisx, GlobalContext* globalCtx) { return; } - drawFunc(this, globalCtx); + drawFunc(this, play); } const ActorInit Demo_Gt_InitVars = { diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h index 842e3ff463..83cae1cc18 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h @@ -6,8 +6,8 @@ struct DemoGt; -typedef void (*DemoGtUpdateFunc)(struct DemoGt*, GlobalContext*); -typedef void (*DemoGtDrawFunc)(struct DemoGt*, GlobalContext*); +typedef void (*DemoGtUpdateFunc)(struct DemoGt*, PlayState*); +typedef void (*DemoGtDrawFunc)(struct DemoGt*, PlayState*); typedef struct DemoGt { /* 0x0000 */ DynaPolyActor dyna; 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 578e8c6d86..15df75f4b3 100644 --- a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -4,46 +4,45 @@ #define FLAGS ACTOR_FLAG_4 -void DemoIk_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoIk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoIk_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoIk_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoIk_Init(Actor* thisx, PlayState* play); +void DemoIk_Destroy(Actor* thisx, PlayState* play); +void DemoIk_Update(Actor* thisx, PlayState* play); +void DemoIk_Draw(Actor* thisx, PlayState* play); -void DemoIk_Type1Init(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type2Init(DemoIk* this, GlobalContext* globalCtx); +void DemoIk_Type1Init(DemoIk* this, PlayState* play); +void DemoIk_Type2Init(DemoIk* this, PlayState* play); -void DemoIk_Type1Action0(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type1Action1(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type1Action2(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type2Action0(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type2Action1(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type2Action2(DemoIk* this, GlobalContext* globalCtx); +void DemoIk_Type1Action0(DemoIk* this, PlayState* play); +void DemoIk_Type1Action1(DemoIk* this, PlayState* play); +void DemoIk_Type1Action2(DemoIk* this, PlayState* play); +void DemoIk_Type2Action0(DemoIk* this, PlayState* play); +void DemoIk_Type2Action1(DemoIk* this, PlayState* play); +void DemoIk_Type2Action2(DemoIk* this, PlayState* play); -void DemoIk_DrawNothing(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type1Draw(DemoIk* this, GlobalContext* globalCtx); -void DemoIk_Type2Draw(DemoIk* this, GlobalContext* globalCtx); +void DemoIk_DrawNothing(DemoIk* this, PlayState* play); +void DemoIk_Type1Draw(DemoIk* this, PlayState* play); +void DemoIk_Type2Draw(DemoIk* this, PlayState* play); -void DemoIk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoIk_Destroy(Actor* thisx, PlayState* play) { } -void DemoIk_BgCheck(DemoIk* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); +void DemoIk_BgCheck(DemoIk* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } s32 DemoIk_UpdateSkelAnime(DemoIk* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* DemoIk_GetCue(GlobalContext* globalCtx, s32 index) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[index]; +CsCmdActorAction* DemoIk_GetCue(PlayState* play, s32 index) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[index]; } return NULL; } -s32 DemoIk_CheckCue(GlobalContext* globalCtx, u16 action, s32 index) { - CsCmdActorAction* cue = DemoIk_GetCue(globalCtx, index); +s32 DemoIk_CheckCue(PlayState* play, u16 action, s32 index) { + CsCmdActorAction* cue = DemoIk_GetCue(play, index); if ((cue != NULL) && (cue->action == action)) { return 1; @@ -51,9 +50,9 @@ s32 DemoIk_CheckCue(GlobalContext* globalCtx, u16 action, s32 index) { return 0; } -void DemoIk_SetMove(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_SetMove(DemoIk* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void DemoIk_EndMove(DemoIk* this) { @@ -110,7 +109,7 @@ void DemoIk_Type1PlaySound(DemoIk* this) { } } -void DemoIk_SpawnDeadDb(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_SpawnDeadDb(DemoIk* this, PlayState* play) { static Vec3f deadDbOffsets[] = { { -14.0f, 5.0f, 5.0f }, { -20.0f, 12.0f, 0.0f }, { -5.0f, 10.0f, -1.0f }, { -10.0f, 8.0f, 14.0f }, { -3.0f, 10.0f, 7.0f }, { -10.0f, 11.0f, 0.0f }, { 9.0f, 10.0f, -8.0f }, { 4.0f, 10.0f, 3.0f }, @@ -119,7 +118,7 @@ void DemoIk_SpawnDeadDb(DemoIk* this, GlobalContext* globalCtx) { s32 i; s32 index = DemoIk_GetIndexFromParams(this->actor.params); - if (DemoIk_CheckCue(globalCtx, 5, index)) { + if (DemoIk_CheckCue(play, 5, index)) { Vec3f pos; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 startIndex; @@ -139,13 +138,13 @@ void DemoIk_SpawnDeadDb(DemoIk* this, GlobalContext* globalCtx) { pos.x = deadDbOffsets[i].x + this->actor.world.pos.x; pos.y = deadDbOffsets[i].y + this->actor.world.pos.y; pos.z = deadDbOffsets[i].z + this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &zeroVec, &zeroVec, 10, 7, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &zeroVec, &zeroVec, 10, 7, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); } } } -void DemoIk_MoveToStartPos(DemoIk* this, GlobalContext* globalCtx, s32 index) { - CsCmdActorAction* cue = DemoIk_GetCue(globalCtx, index); +void DemoIk_MoveToStartPos(DemoIk* this, PlayState* play, s32 index) { + CsCmdActorAction* cue = DemoIk_GetCue(play, index); if (cue != NULL) { this->actor.world.pos.x = cue->startPos.x; @@ -155,7 +154,7 @@ void DemoIk_MoveToStartPos(DemoIk* this, GlobalContext* globalCtx, s32 index) { } } -void DemoIk_Type1Init(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type1Init(DemoIk* this, PlayState* play) { s32 pad[3]; SkeletonHeader* skeleton; AnimationHeader* animation; @@ -179,7 +178,7 @@ void DemoIk_Type1Init(DemoIk* this, GlobalContext* globalCtx) { // No break is required for matching } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, phi_f0); - SkelAnime_Init(globalCtx, &this->skelAnime, skeleton, NULL, this->jointTable, this->morphTable, 2); + SkelAnime_Init(play, &this->skelAnime, skeleton, NULL, this->jointTable, this->morphTable, 2); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); } @@ -189,9 +188,9 @@ void func_8098393C(DemoIk* this) { this->actor.shape.shadowAlpha = 0; } -void func_8098394C(DemoIk* this, GlobalContext* globalCtx) { +void func_8098394C(DemoIk* this, PlayState* play) { DemoIk_EndMove(this); - DemoIk_MoveToStartPos(this, globalCtx, DemoIk_GetIndexFromParams(this->actor.params)); + DemoIk_MoveToStartPos(this, play, DemoIk_GetIndexFromParams(this->actor.params)); this->actionMode = 1; this->drawMode = 1; this->actor.shape.shadowAlpha = 255; @@ -205,8 +204,8 @@ void func_809839AC(DemoIk* this) { this->skelAnime.curFrame = 0.0f; } -void func_809839D0(DemoIk* this, GlobalContext* globalCtx) { - CsCmdActorAction* cue = DemoIk_GetCue(globalCtx, DemoIk_GetIndexFromParams(this->actor.params)); +void func_809839D0(DemoIk* this, PlayState* play) { + CsCmdActorAction* cue = DemoIk_GetCue(play, DemoIk_GetIndexFromParams(this->actor.params)); if (cue != NULL) { s32 nextCsAction = cue->action; @@ -218,7 +217,7 @@ void func_809839D0(DemoIk* this, GlobalContext* globalCtx) { func_8098393C(this); break; case 2: - func_8098394C(this, globalCtx); + func_8098394C(this, play); break; case 3: func_809839AC(this); @@ -238,27 +237,27 @@ void func_809839D0(DemoIk* this, GlobalContext* globalCtx) { } } -void DemoIk_Type1Action0(DemoIk* this, GlobalContext* globalCtx) { - func_809839D0(this, globalCtx); +void DemoIk_Type1Action0(DemoIk* this, PlayState* play) { + func_809839D0(this, play); } -void DemoIk_Type1Action1(DemoIk* this, GlobalContext* globalCtx) { - DemoIk_BgCheck(this, globalCtx); - func_809839D0(this, globalCtx); +void DemoIk_Type1Action1(DemoIk* this, PlayState* play) { + DemoIk_BgCheck(this, play); + func_809839D0(this, play); } -void DemoIk_Type1Action2(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type1Action2(DemoIk* this, PlayState* play) { DemoIk_UpdateSkelAnime(this); DemoIk_Type1PlaySound(this); - DemoIk_SetMove(this, globalCtx); - DemoIk_BgCheck(this, globalCtx); - DemoIk_SpawnDeadDb(this, globalCtx); - func_809839D0(this, globalCtx); + DemoIk_SetMove(this, play); + DemoIk_BgCheck(this, play); + DemoIk_SpawnDeadDb(this, play); + func_809839D0(this, play); } -void DemoIk_Type1PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void DemoIk_Type1PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { DemoIk* this = (DemoIk*)thisx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_ik_inArmer.c", 385); if (limbIndex == 1) { @@ -278,23 +277,23 @@ void DemoIk_Type1PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi CLOSE_DISPS(gfxCtx, "../z_demo_ik_inArmer.c", 404); } -void DemoIk_Type1Draw(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type1Draw(DemoIk* this, PlayState* play) { s32 pad[2]; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; OPEN_DISPS(gfxCtx, "../z_demo_ik_inArmer.c", 422); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); func_80093D18(gfxCtx); func_80093D84(gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, DemoIk_SetColors(gfxCtx, 245, 225, 155, 30, 30, 0)); gSPSegment(POLY_OPA_DISP++, 0x09, DemoIk_SetColors(gfxCtx, 255, 40, 0, 40, 0, 0)); gSPSegment(POLY_OPA_DISP++, 0x0A, DemoIk_SetColors(gfxCtx, 255, 255, 255, 20, 40, 30)); - SkelAnime_DrawOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, NULL, DemoIk_Type1PostLimbDraw, this); + SkelAnime_DrawOpa(play, skelAnime->skeleton, skelAnime->jointTable, NULL, DemoIk_Type1PostLimbDraw, this); CLOSE_DISPS(gfxCtx, "../z_demo_ik_inArmer.c", 444); } -void DemoIk_Type2Init(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type2Init(DemoIk* this, PlayState* play) { s32 pad[2]; FlexSkeletonHeader* skeleton; AnimationHeader* animation; @@ -317,7 +316,7 @@ void DemoIk_Type2Init(DemoIk* this, GlobalContext* globalCtx) { animation = &object_ik_Anim_0008DC; } - SkelAnime_InitFlex(globalCtx, &this->skelAnime, skeleton, NULL, this->jointTable, this->morphTable, 2); + SkelAnime_InitFlex(play, &this->skelAnime, skeleton, NULL, this->jointTable, this->morphTable, 2); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); this->actionMode = 3; this->drawMode = 0; @@ -346,8 +345,8 @@ void func_80983FDC(DemoIk* this) { this->drawMode = 0; } -void func_80983FEC(DemoIk* this, GlobalContext* globalCtx) { - DemoIk_MoveToStartPos(this, globalCtx, 4); +void func_80983FEC(DemoIk* this, PlayState* play) { + DemoIk_MoveToStartPos(this, play, 4); this->actionMode = 4; this->drawMode = 2; this->skelAnime.curFrame = 0.0f; @@ -359,8 +358,8 @@ void func_8098402C(DemoIk* this) { this->skelAnime.curFrame = 0.0f; } -void func_80984048(DemoIk* this, GlobalContext* globalCtx) { - CsCmdActorAction* cue = DemoIk_GetCue(globalCtx, 4); +void func_80984048(DemoIk* this, PlayState* play) { + CsCmdActorAction* cue = DemoIk_GetCue(play, 4); if (cue != NULL) { s32 nextCsAction = cue->action; @@ -372,7 +371,7 @@ void func_80984048(DemoIk* this, GlobalContext* globalCtx) { func_80983FDC(this); break; case 5: - func_80983FEC(this, globalCtx); + func_80983FEC(this, play); break; case 6: func_8098402C(this); @@ -389,22 +388,21 @@ void func_80984048(DemoIk* this, GlobalContext* globalCtx) { } } -void DemoIk_Type2Action0(DemoIk* this, GlobalContext* globalCtx) { - func_80984048(this, globalCtx); +void DemoIk_Type2Action0(DemoIk* this, PlayState* play) { + func_80984048(this, play); } -void DemoIk_Type2Action1(DemoIk* this, GlobalContext* globalCtx) { - func_80984048(this, globalCtx); +void DemoIk_Type2Action1(DemoIk* this, PlayState* play) { + func_80984048(this, play); } -void DemoIk_Type2Action2(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type2Action2(DemoIk* this, PlayState* play) { DemoIk_UpdateSkelAnime(this); DemoIk_Type2PlaySound(this); - func_80984048(this, globalCtx); + func_80984048(this, play); } -s32 DemoIk_Type2OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 DemoIk_Type2OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { DemoIk* this = (DemoIk*)thisx; if ((limbIndex == 1) && (DemoIk_GetCurFrame(this) < 30.0f)) { @@ -413,9 +411,9 @@ s32 DemoIk_Type2OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void DemoIk_Type2PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void DemoIk_Type2PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { DemoIk* this = (DemoIk*)thisx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 frame = DemoIk_GetCurFrame(this); OPEN_DISPS(gfxCtx, "../z_demo_ik_inFace.c", 268); @@ -446,19 +444,19 @@ void DemoIk_Type2PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi CLOSE_DISPS(gfxCtx, "../z_demo_ik_inFace.c", 300); } -void DemoIk_Type2Draw(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_Type2Draw(DemoIk* this, PlayState* play) { s32 pad[2]; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; OPEN_DISPS(gfxCtx, "../z_demo_ik_inFace.c", 318); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); func_80093D18(gfxCtx); func_80093D84(gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, DemoIk_SetColors(gfxCtx, 245, 225, 155, 30, 30, 0)); gSPSegment(POLY_OPA_DISP++, 0x09, DemoIk_SetColors(gfxCtx, 255, 40, 0, 40, 0, 0)); gSPSegment(POLY_OPA_DISP++, 0x0A, DemoIk_SetColors(gfxCtx, 255, 255, 255, 20, 40, 30)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, DemoIk_Type2OverrideLimbDraw, DemoIk_Type2PostLimbDraw, this); CLOSE_DISPS(gfxCtx, "../z_demo_ik_inFace.c", 341); } @@ -468,7 +466,7 @@ static DemoIkActionFunc sActionFuncs[] = { DemoIk_Type2Action0, DemoIk_Type2Action1, DemoIk_Type2Action2, }; -void DemoIk_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoIk_Update(Actor* thisx, PlayState* play) { s32 pad; DemoIk* this = (DemoIk*)thisx; @@ -478,10 +476,10 @@ void DemoIk_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->actionMode](this, globalCtx); + sActionFuncs[this->actionMode](this, play); } -void DemoIk_DrawNothing(DemoIk* this, GlobalContext* globalCtx) { +void DemoIk_DrawNothing(DemoIk* this, PlayState* play) { } static DemoIkDrawFunc sDrawFuncs[] = { @@ -490,7 +488,7 @@ static DemoIkDrawFunc sDrawFuncs[] = { DemoIk_Type2Draw, }; -void DemoIk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoIk_Draw(Actor* thisx, PlayState* play) { s32 pad; DemoIk* this = (DemoIk*)thisx; @@ -499,7 +497,7 @@ void DemoIk_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawMode](this, globalCtx); + sDrawFuncs[this->drawMode](this, play); } const ActorInit Demo_Ik_InitVars = { @@ -514,13 +512,13 @@ const ActorInit Demo_Ik_InitVars = { (ActorFunc)DemoIk_Draw, }; -void DemoIk_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoIk_Init(Actor* thisx, PlayState* play) { s32 pad; DemoIk* this = (DemoIk*)thisx; if (this->actor.params == 0 || this->actor.params == 1 || this->actor.params == 2) { - DemoIk_Type1Init(this, globalCtx); + DemoIk_Type1Init(this, play); } else { - DemoIk_Type2Init(this, globalCtx); + DemoIk_Type2Init(this, play); } } diff --git a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h index 24fe5d0942..caae15f7b1 100644 --- a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h +++ b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h @@ -6,8 +6,8 @@ struct DemoIk; -typedef void (*DemoIkActionFunc)(struct DemoIk* this, GlobalContext* globalCtx); -typedef void (*DemoIkDrawFunc)(struct DemoIk* this, GlobalContext* globalCtx); +typedef void (*DemoIkActionFunc)(struct DemoIk* this, PlayState* play); +typedef void (*DemoIkDrawFunc)(struct DemoIk* this, PlayState* play); typedef struct DemoIk { /* 0x0000 */ Actor actor; 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 bf4f93a950..735aef2b8f 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -13,44 +13,44 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4) -void DemoIm_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoIm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoIm_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoIm_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_809856F8(DemoIm* this, GlobalContext* globalCtx); -void func_80985718(DemoIm* this, GlobalContext* globalCtx); -void func_80985738(DemoIm* this, GlobalContext* globalCtx); -void func_80985770(DemoIm* this, GlobalContext* globalCtx); -void func_809857B0(DemoIm* this, GlobalContext* globalCtx); -void func_809857F0(DemoIm* this, GlobalContext* globalCtx); -void func_80985830(DemoIm* this, GlobalContext* globalCtx); -void func_80985C10(DemoIm* this, GlobalContext* globalCtx); -void func_80985C40(DemoIm* this, GlobalContext* globalCtx); -void func_80985C94(DemoIm* this, GlobalContext* globalCtx); -void DemoIm_DrawTranslucent(DemoIm* this, GlobalContext* globalCtx); -void func_809863BC(DemoIm* this, GlobalContext* globalCtx); -void func_809863DC(DemoIm* this, GlobalContext* globalCtx); -void func_80986430(DemoIm* this, GlobalContext* globalCtx); -void func_80986494(DemoIm* this, GlobalContext* globalCtx); -void func_809864D4(DemoIm* this, GlobalContext* globalCtx); -void func_809868E8(DemoIm* this, GlobalContext* globalCtx); -void func_80986908(DemoIm* this, GlobalContext* globalCtx); -void func_80986948(DemoIm* this, GlobalContext* globalCtx); -void func_80986D40(DemoIm* this, GlobalContext* globalCtx); -void func_80986DC8(DemoIm* this, GlobalContext* globalCtx); -void func_80986E20(DemoIm* this, GlobalContext* globalCtx); -void func_80986E40(DemoIm* this, GlobalContext* globalCtx); -void func_80986EAC(DemoIm* this, GlobalContext* globalCtx); -void func_80986F08(DemoIm* this, GlobalContext* globalCtx); -void func_80986F28(DemoIm* this, GlobalContext* globalCtx); -void func_80986F88(DemoIm* this, GlobalContext* globalCtx); -void func_80986FA8(DemoIm* this, GlobalContext* globalCtx); -void func_80987288(DemoIm* this, GlobalContext* globalCtx); -void func_809872A8(DemoIm* this, GlobalContext* globalCtx); -void func_809872F0(DemoIm* this, GlobalContext* globalCtx); -void func_80987330(DemoIm* this, GlobalContext* globalCtx); -void DemoIm_DrawNothing(DemoIm* this, GlobalContext* globalCtx); -void DemoIm_DrawSolid(DemoIm* this, GlobalContext* globalCtx); +void DemoIm_Init(Actor* thisx, PlayState* play); +void DemoIm_Destroy(Actor* thisx, PlayState* play); +void DemoIm_Update(Actor* thisx, PlayState* play); +void DemoIm_Draw(Actor* thisx, PlayState* play); +void func_809856F8(DemoIm* this, PlayState* play); +void func_80985718(DemoIm* this, PlayState* play); +void func_80985738(DemoIm* this, PlayState* play); +void func_80985770(DemoIm* this, PlayState* play); +void func_809857B0(DemoIm* this, PlayState* play); +void func_809857F0(DemoIm* this, PlayState* play); +void func_80985830(DemoIm* this, PlayState* play); +void func_80985C10(DemoIm* this, PlayState* play); +void func_80985C40(DemoIm* this, PlayState* play); +void func_80985C94(DemoIm* this, PlayState* play); +void DemoIm_DrawTranslucent(DemoIm* this, PlayState* play); +void func_809863BC(DemoIm* this, PlayState* play); +void func_809863DC(DemoIm* this, PlayState* play); +void func_80986430(DemoIm* this, PlayState* play); +void func_80986494(DemoIm* this, PlayState* play); +void func_809864D4(DemoIm* this, PlayState* play); +void func_809868E8(DemoIm* this, PlayState* play); +void func_80986908(DemoIm* this, PlayState* play); +void func_80986948(DemoIm* this, PlayState* play); +void func_80986D40(DemoIm* this, PlayState* play); +void func_80986DC8(DemoIm* this, PlayState* play); +void func_80986E20(DemoIm* this, PlayState* play); +void func_80986E40(DemoIm* this, PlayState* play); +void func_80986EAC(DemoIm* this, PlayState* play); +void func_80986F08(DemoIm* this, PlayState* play); +void func_80986F28(DemoIm* this, PlayState* play); +void func_80986F88(DemoIm* this, PlayState* play); +void func_80986FA8(DemoIm* this, PlayState* play); +void func_80987288(DemoIm* this, PlayState* play); +void func_809872A8(DemoIm* this, PlayState* play); +void func_809872F0(DemoIm* this, PlayState* play); +void func_80987330(DemoIm* this, PlayState* play); +void DemoIm_DrawNothing(DemoIm* this, PlayState* play); +void DemoIm_DrawSolid(DemoIm* this, PlayState* play); static void* sEyeTextures[] = { gImpaEyeOpenTex, @@ -126,10 +126,10 @@ void func_80984C68(DemoIm* this) { this->unk_268 = 0.0f; } -void func_80984C8C(DemoIm* this, GlobalContext* globalCtx) { +void func_80984C8C(DemoIm* this, PlayState* play) { u32* something = &D_8098783C; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (*something != 0) { if (this->actor.params == 2) { func_80984C68(this); @@ -143,24 +143,24 @@ void func_80984C8C(DemoIm* this, GlobalContext* globalCtx) { } } -void DemoIm_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void DemoIm_InitCollider(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); } -void DemoIm_DestroyCollider(Actor* thisx, GlobalContext* globalCtx) { +void DemoIm_DestroyCollider(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void DemoIm_UpdateCollider(DemoIm* this, GlobalContext* globalCtx) { +void DemoIm_UpdateCollider(DemoIm* this, PlayState* play) { s32 pad[5]; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } void func_80984DB8(DemoIm* this) { @@ -175,8 +175,8 @@ void func_80984DB8(DemoIm* this) { Math_SmoothStepToS(&vec2->y, 0, 20, 6200, 100); } -void func_80984E58(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80984E58(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; s16 phi_a3; @@ -188,8 +188,8 @@ void func_80984E58(DemoIm* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, phi_a3); } -void func_80984F10(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80984F10(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_2D4.unk_18 = player->actor.world.pos; this->unk_2D4.unk_14 = kREG(16) + 12.0f; @@ -197,43 +197,42 @@ void func_80984F10(DemoIm* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, 2); } -void func_80984F94(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80984F94(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_2D4.unk_18 = player->actor.world.pos; this->unk_2D4.unk_14 = kREG(16) + 4.0f; func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, 4); } -void DemoIm_UpdateBgCheckInfo(DemoIm* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); +void DemoIm_UpdateBgCheckInfo(DemoIm* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } s32 DemoIm_UpdateSkelAnime(DemoIm* this) { return SkelAnime_Update(&this->skelAnime); } -s32 DemoIm_IsCsStateIdle(GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +s32 DemoIm_IsCsStateIdle(PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { return true; } else { return false; } } -CsCmdActorAction* DemoIm_GetNpcAction(GlobalContext* globalCtx, s32 actionIdx) { +CsCmdActorAction* DemoIm_GetNpcAction(PlayState* play, s32 actionIdx) { s32 pad[2]; CsCmdActorAction* ret = NULL; - if (!DemoIm_IsCsStateIdle(globalCtx)) { - ret = globalCtx->csCtx.npcActions[actionIdx]; + if (!DemoIm_IsCsStateIdle(play)) { + ret = play->csCtx.npcActions[actionIdx]; } return ret; } -s32 func_809850E8(DemoIm* this, GlobalContext* globalCtx, u16 action, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, actionIdx); +s32 func_809850E8(DemoIm* this, PlayState* play, u16 action, s32 actionIdx) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { if (npcAction->action == action) { @@ -243,8 +242,8 @@ s32 func_809850E8(DemoIm* this, GlobalContext* globalCtx, u16 action, s32 action return false; } -s32 func_80985134(DemoIm* this, GlobalContext* globalCtx, u16 action, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, actionIdx); +s32 func_80985134(DemoIm* this, PlayState* play, u16 action, s32 actionIdx) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { if (npcAction->action != action) { @@ -254,8 +253,8 @@ s32 func_80985134(DemoIm* this, GlobalContext* globalCtx, u16 action, s32 action return false; } -void func_80985180(DemoIm* this, GlobalContext* globalCtx, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, actionIdx); +void func_80985180(DemoIm* this, PlayState* play, s32 actionIdx) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -265,8 +264,8 @@ void func_80985180(DemoIm* this, GlobalContext* globalCtx, s32 actionIdx) { } } -void func_80985200(DemoIm* this, GlobalContext* globalCtx, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, actionIdx); +void func_80985200(DemoIm* this, PlayState* play, s32 actionIdx) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -295,57 +294,55 @@ void DemoIm_ChangeAnim(DemoIm* this, AnimationHeader* animHeaderSeg, u8 animMode Animation_Change(&this->skelAnime, animHeaderSeg, playbackSpeed, startFrame, endFrame, animMode, morphFrames); } -void func_80985310(DemoIm* this, GlobalContext* globalCtx) { +void func_80985310(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->actor.shape.yOffset = -10000.0f; } -void func_80985358(DemoIm* this, GlobalContext* globalCtx) { +void func_80985358(DemoIm* this, PlayState* play) { f32 posX = this->actor.world.pos.x; f32 posY = this->actor.world.pos.y; f32 posZ = this->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, - WARP_SAGES); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_SAGES); } -void func_809853B4(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809853B4(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 playerX = player->actor.world.pos.x; f32 playerY = player->actor.world.pos.y + 80.0f; f32 playerZ = player->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, playerX, playerY, playerZ, 0, - 0, 0, 0xD); - Item_Give(globalCtx, ITEM_MEDALLION_SHADOW); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, playerX, playerY, playerZ, 0, 0, 0, 0xD); + Item_Give(play, ITEM_MEDALLION_SHADOW); } -void func_80985430(DemoIm* this, GlobalContext* globalCtx) { +void func_80985430(DemoIm* this, PlayState* play) { this->actor.shape.yOffset += 250.0f / 3.0f; } -void func_8098544C(DemoIm* this, GlobalContext* globalCtx) { +void func_8098544C(DemoIm* this, PlayState* play) { s32 pad[2]; if ((gSaveContext.chamberCutsceneNum == 4) && (gSaveContext.sceneSetupIndex < 4)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->action = 1; - globalCtx->csCtx.segment = D_8098786C; + play->csCtx.segment = D_8098786C; gSaveContext.cutsceneTrigger = 2; - Item_Give(globalCtx, ITEM_MEDALLION_SHADOW); + Item_Give(play, ITEM_MEDALLION_SHADOW); player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; } } -void func_809854DC(DemoIm* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[5] != NULL) && - (globalCtx->csCtx.npcActions[5]->action == 2)) { +void func_809854DC(DemoIm* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[5] != NULL) && + (play->csCtx.npcActions[5]->action == 2)) { Animation_Change(&this->skelAnime, &gImpaIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaIdleAnim), ANIMMODE_LOOP, 0.0f); this->action = 2; this->drawConfig = 1; - func_80985358(this, globalCtx); + func_80985358(this, play); } } @@ -356,9 +353,9 @@ void func_8098557C(DemoIm* this) { } } -void func_809855A8(DemoIm* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[5] != NULL) && - (globalCtx->csCtx.npcActions[5]->action == 3)) { +void func_809855A8(DemoIm* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[5] != NULL) && + (play->csCtx.npcActions[5]->action == 3)) { Animation_Change(&this->skelAnime, &gImpaRaiseArmsAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaRaiseArmsAnim), ANIMMODE_ONCE, 4.0f); this->action = 4; @@ -373,59 +370,59 @@ void func_80985640(DemoIm* this, s32 arg1) { } } -void func_809856AC(DemoIm* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[6] != NULL) && - (globalCtx->csCtx.npcActions[6]->action == 2)) { +void func_809856AC(DemoIm* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[6] != NULL) && + (play->csCtx.npcActions[6]->action == 2)) { this->action = 6; - func_809853B4(this, globalCtx); + func_809853B4(this, play); } } -void func_809856F8(DemoIm* this, GlobalContext* globalCtx) { - func_8098544C(this, globalCtx); +void func_809856F8(DemoIm* this, PlayState* play) { + func_8098544C(this, play); } -void func_80985718(DemoIm* this, GlobalContext* globalCtx) { - func_809854DC(this, globalCtx); +void func_80985718(DemoIm* this, PlayState* play) { + func_809854DC(this, play); } -void func_80985738(DemoIm* this, GlobalContext* globalCtx) { - func_80985430(this, globalCtx); +void func_80985738(DemoIm* this, PlayState* play) { + func_80985430(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_8098557C(this); } -void func_80985770(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80985770(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_809855A8(this, globalCtx); + func_809855A8(this, play); } -void func_809857B0(DemoIm* this, GlobalContext* globalCtx) { +void func_809857B0(DemoIm* this, PlayState* play) { s32 sp1C; - DemoIm_UpdateBgCheckInfo(this, globalCtx); + DemoIm_UpdateBgCheckInfo(this, play); sp1C = DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_80985640(this, sp1C); } -void func_809857F0(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_809857F0(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_809856AC(this, globalCtx); + func_809856AC(this, play); } -void func_80985830(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80985830(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); } -void func_80985860(DemoIm* this, GlobalContext* globalCtx) { +void func_80985860(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->action = 7; this->actor.shape.shadowAlpha = 0; @@ -435,13 +432,13 @@ void func_809858A8(void) { func_800788CC(NA_SE_SY_WHITE_OUT_T); } -void DemoIm_SpawnLightBall(DemoIm* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void DemoIm_SpawnLightBall(DemoIm* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, (kREG(17) + 24.0f) + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 6); } -void func_80985948(DemoIm* this, GlobalContext* globalCtx) { - if (func_809850E8(this, globalCtx, 4, 5)) { +void func_80985948(DemoIm* this, PlayState* play) { + if (func_809850E8(this, play, 4, 5)) { Animation_Change(&this->skelAnime, &gImpaPrepareSealGanonAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaPrepareSealGanonAnim), ANIMMODE_ONCE, 0.0f); this->action = 8; @@ -453,11 +450,11 @@ void func_80985948(DemoIm* this, GlobalContext* globalCtx) { } } -void func_809859E0(DemoIm* this, GlobalContext* globalCtx) { +void func_809859E0(DemoIm* this, PlayState* play) { f32* unk_268 = &this->unk_268; s32 alpha = 255; - if (func_809850E8(this, globalCtx, 4, 5)) { + if (func_809850E8(this, play, 4, 5)) { *unk_268 += 1.0f; if (*unk_268 >= kREG(5) + 10.0f) { this->action = 9; @@ -480,8 +477,8 @@ void func_809859E0(DemoIm* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = this->alpha = (*unk_268 / (kREG(5) + 10.0f)) * 255.0f; } -void func_80985B34(DemoIm* this, GlobalContext* globalCtx) { - if (func_80985134(this, globalCtx, 4, 5)) { +void func_80985B34(DemoIm* this, PlayState* play) { + if (func_80985134(this, play, 4, 5)) { Animation_Change(&this->skelAnime, &gImpaSealGanonAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaSealGanonAnim), ANIMMODE_ONCE, -8.0f); this->action = 8; @@ -489,64 +486,64 @@ void func_80985B34(DemoIm* this, GlobalContext* globalCtx) { this->unk_268 = kREG(5) + 10.0f; this->alpha = 255; if (this->unk_270 == 0) { - DemoIm_SpawnLightBall(this, globalCtx); + DemoIm_SpawnLightBall(this, play); this->unk_270 = 1; } this->actor.shape.shadowAlpha = 0xFF; } } -void func_80985C10(DemoIm* this, GlobalContext* globalCtx) { - func_80985948(this, globalCtx); - func_80984C8C(this, globalCtx); +void func_80985C10(DemoIm* this, PlayState* play) { + func_80985948(this, play); + func_80984C8C(this, play); } -void func_80985C40(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80985C40(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_809859E0(this, globalCtx); - func_80984C8C(this, globalCtx); + func_809859E0(this, play); + func_80984C8C(this, play); } -void func_80985C94(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80985C94(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80985B34(this, globalCtx); - func_80984C8C(this, globalCtx); + func_80985B34(this, play); + func_80984C8C(this, play); } -void DemoIm_DrawTranslucent(DemoIm* this, GlobalContext* globalCtx) { +void DemoIm_DrawTranslucent(DemoIm* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* eyeTex = sEyeTextures[eyeIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_im_inKenjyanomaDemo02.c", 281); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_im_inKenjyanomaDemo02.c", 281); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, - NULL, NULL, NULL, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, + NULL, NULL, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_im_inKenjyanomaDemo02.c", 308); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_im_inKenjyanomaDemo02.c", 308); } -void func_80985E60(DemoIm* this, GlobalContext* globalCtx) { +void func_80985E60(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->action = 10; this->unk_280 = 1; } -void func_80985EAC(DemoIm* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.frames >= 80) && (globalCtx->csCtx.frames < 243)) { - func_80984F10(this, globalCtx); +void func_80985EAC(DemoIm* this, PlayState* play) { + if ((play->csCtx.frames >= 80) && (play->csCtx.frames < 243)) { + func_80984F10(this, play); } else { func_80984DB8(this); } @@ -563,10 +560,10 @@ void func_80985F54(DemoIm* this) { this->drawConfig = 0; } -void func_80985F64(DemoIm* this, GlobalContext* globalCtx) { +void func_80985F64(DemoIm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gImpaIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaIdleAnim), ANIMMODE_LOOP, 0.0f); - func_80985180(this, globalCtx, 5); + func_80985180(this, play, 5); this->action = 11; this->drawConfig = 1; } @@ -607,8 +604,8 @@ void func_80986148(DemoIm* this) { this->drawConfig = 1; } -void func_809861C4(DemoIm* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, 5); +void func_809861C4(DemoIm* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; @@ -632,16 +629,16 @@ void func_809861C4(DemoIm* this, GlobalContext* globalCtx) { } } -void func_8098629C(DemoIm* this, GlobalContext* globalCtx) { - if (DemoIm_IsCsStateIdle(globalCtx)) { +void func_8098629C(DemoIm* this, PlayState* play) { + if (DemoIm_IsCsStateIdle(play)) { this->action = 21; this->drawConfig = 1; this->unk_280 = 1; } } -void func_809862E0(DemoIm* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, 5); +void func_809862E0(DemoIm* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; @@ -653,7 +650,7 @@ void func_809862E0(DemoIm* this, GlobalContext* globalCtx) { func_80985F54(this); break; case 2: - func_80985F64(this, globalCtx); + func_80985F64(this, play); break; case 7: func_8098604C(this); @@ -672,62 +669,62 @@ void func_809862E0(DemoIm* this, GlobalContext* globalCtx) { } } -void func_809863BC(DemoIm* this, GlobalContext* globalCtx) { - func_809862E0(this, globalCtx); +void func_809863BC(DemoIm* this, PlayState* play) { + func_809862E0(this, play); } -void func_809863DC(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_809863DC(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); - func_80985EAC(this, globalCtx); + func_80985EAC(this, play); func_80984BE0(this); - func_809862E0(this, globalCtx); + func_809862E0(this, play); } -void func_80986430(DemoIm* this, GlobalContext* globalCtx) { +void func_80986430(DemoIm* this, PlayState* play) { s32 sp24; - DemoIm_UpdateBgCheckInfo(this, globalCtx); + DemoIm_UpdateBgCheckInfo(this, play); sp24 = DemoIm_UpdateSkelAnime(this); - func_80985EAC(this, globalCtx); + func_80985EAC(this, play); func_80984BE0(this); func_80985FE8(this, sp24); - func_809862E0(this, globalCtx); + func_809862E0(this, play); } -void func_80986494(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986494(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); func_80985EF4(this); func_80984BE0(this); - func_809861C4(this, globalCtx); + func_809861C4(this, play); } -void func_809864D4(DemoIm* this, GlobalContext* globalCtx) { +void func_809864D4(DemoIm* this, PlayState* play) { s32 sp24; - DemoIm_UpdateBgCheckInfo(this, globalCtx); + DemoIm_UpdateBgCheckInfo(this, play); sp24 = DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_809860DC(this, sp24); - func_8098629C(this, globalCtx); + func_8098629C(this, play); } -void func_8098652C(DemoIm* this, GlobalContext* globalCtx) { +void func_8098652C(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->action = 15; } -void func_80986570(DemoIm* this, GlobalContext* globalCtx) { +void func_80986570(DemoIm* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 7.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { u32 sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); Audio_PlaySoundGeneral(sfxId, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } -void func_809865F8(DemoIm* this, GlobalContext* globalCtx, s32 arg2) { +void func_809865F8(DemoIm* this, PlayState* play, s32 arg2) { s32 pad[2]; if (arg2 != 0) { @@ -741,7 +738,7 @@ void func_809865F8(DemoIm* this, GlobalContext* globalCtx, s32 arg2) { f32 spawnPosY = thisPos->y; f32 spawnPosZ = thisPos->z + (Math_CosS(shapeRotY) * 30.0f); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, spawnPosX, spawnPosY, spawnPosZ, 0xFA0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, spawnPosX, spawnPosY, spawnPosZ, 0xFA0, this->actor.shape.rot.y, 0, ARROW_CS_NUT); this->unk_27C = 1; } @@ -756,10 +753,10 @@ void func_80986700(DemoIm* this) { this->drawConfig = 0; } -void func_80986710(DemoIm* this, GlobalContext* globalCtx) { +void func_80986710(DemoIm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gImpaIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gImpaIdleAnim), ANIMMODE_LOOP, 0.0f); - func_80985180(this, globalCtx, 5); + func_80985180(this, play, 5); this->action = 16; this->drawConfig = 1; } @@ -771,8 +768,8 @@ void func_80986794(DemoIm* this) { this->drawConfig = 1; } -void func_8098680C(DemoIm* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, 5); +void func_8098680C(DemoIm* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; @@ -784,7 +781,7 @@ void func_8098680C(DemoIm* this, GlobalContext* globalCtx) { func_80986700(this); break; case 2: - func_80986710(this, globalCtx); + func_80986710(this, play); break; case 10: func_80986794(this); @@ -800,36 +797,36 @@ void func_8098680C(DemoIm* this, GlobalContext* globalCtx) { } } -void func_809868E8(DemoIm* this, GlobalContext* globalCtx) { - func_8098680C(this, globalCtx); +void func_809868E8(DemoIm* this, PlayState* play) { + func_8098680C(this, play); } -void func_80986908(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986908(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_8098680C(this, globalCtx); + func_8098680C(this, play); } -void func_80986948(DemoIm* this, GlobalContext* globalCtx) { +void func_80986948(DemoIm* this, PlayState* play) { s32 sp24; - DemoIm_UpdateBgCheckInfo(this, globalCtx); + DemoIm_UpdateBgCheckInfo(this, play); sp24 = DemoIm_UpdateSkelAnime(this); - func_80986570(this, globalCtx); + func_80986570(this, play); func_80984BE0(this); - func_809865F8(this, globalCtx, sp24); - func_8098680C(this, globalCtx); + func_809865F8(this, play, sp24); + func_8098680C(this, play); } -void func_809869B0(DemoIm* this, GlobalContext* globalCtx) { +void func_809869B0(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->action = 18; this->actor.shape.shadowAlpha = 0; } -s32 func_809869F8(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_809869F8(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 playerPosX = player->actor.world.pos.x; f32 thisPosX = this->actor.world.pos.x; @@ -840,42 +837,42 @@ s32 func_809869F8(DemoIm* this, GlobalContext* globalCtx) { } } -s32 func_80986A5C(DemoIm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80986A5C(DemoIm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 playerPosX = player->actor.world.pos.x; f32 thisPosX = this->actor.world.pos.x; - if ((thisPosX - (kREG(17) + 130.0f) < playerPosX) && (!Play_InCsMode(globalCtx))) { + if ((thisPosX - (kREG(17) + 130.0f) < playerPosX) && (!Play_InCsMode(play))) { return true; } else { return false; } } -s32 func_80986AD0(DemoIm* this, GlobalContext* globalCtx) { +s32 func_80986AD0(DemoIm* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - if (!Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (!Actor_ProcessTalkRequest(&this->actor, play)) { this->actor.textId = 0x708E; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else { return true; } return false; } -void func_80986B2C(GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { - Player* player = GET_PLAYER(globalCtx); +void func_80986B2C(PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { + Player* player = GET_PLAYER(play); - globalCtx->nextEntranceIndex = ENTR_SPOT00_0; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - func_8002DF54(globalCtx, &player->actor, 8); + play->nextEntranceIndex = ENTR_SPOT00_0; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); + play->transitionTrigger = TRANS_TRIGGER_START; + func_8002DF54(play, &player->actor, 8); } } -void func_80986BA0(DemoIm* this, GlobalContext* globalCtx) { - if (func_809869F8(this, globalCtx)) { +void func_80986BA0(DemoIm* this, PlayState* play) { + if (func_809869F8(this, play)) { this->action = 21; this->drawConfig = 1; this->unk_280 = 1; @@ -889,7 +886,7 @@ void func_80986BE4(DemoIm* this, s32 arg1) { } } -void func_80986BF8(DemoIm* this, GlobalContext* globalCtx) { +void func_80986BF8(DemoIm* this, PlayState* play) { if (GET_EVENTCHKINF(EVENTCHKINF_40)) { this->action = 24; this->drawConfig = 1; @@ -898,12 +895,12 @@ void func_80986BF8(DemoIm* this, GlobalContext* globalCtx) { } } -void func_80986C30(DemoIm* this, GlobalContext* globalCtx) { - if (func_80986A5C(this, globalCtx)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardLullabyCs); +void func_80986C30(DemoIm* this, PlayState* play) { + if (func_80986A5C(this, play)) { + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardLullabyCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_59); - Item_Give(globalCtx, ITEM_SONG_LULLABY); + Item_Give(play, ITEM_SONG_LULLABY); func_80985F54(this); } } @@ -917,14 +914,14 @@ void func_80986CC8(DemoIm* this) { } } -void func_80986CFC(DemoIm* this, GlobalContext* globalCtx) { - if (func_80986A5C(this, globalCtx)) { +void func_80986CFC(DemoIm* this, PlayState* play) { + if (func_80986A5C(this, play)) { SET_EVENTCHKINF(EVENTCHKINF_4C); this->action = 19; } } -void func_80986D40(DemoIm* this, GlobalContext* globalCtx) { +void func_80986D40(DemoIm* this, PlayState* play) { if (gSaveContext.sceneSetupIndex == 6) { this->action = 19; this->drawConfig = 1; @@ -937,64 +934,64 @@ void func_80986D40(DemoIm* this, GlobalContext* globalCtx) { } } -void func_80986DC8(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986DC8(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80984E58(this, globalCtx); + func_80984E58(this, play); this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); } -void func_80986E20(DemoIm* this, GlobalContext* globalCtx) { - func_80986BA0(this, globalCtx); +void func_80986E20(DemoIm* this, PlayState* play) { + func_80986BA0(this, play); } -void func_80986E40(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986E40(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80984E58(this, globalCtx); - DemoIm_UpdateCollider(this, globalCtx); - func_80986BE4(this, func_80986AD0(this, globalCtx)); + func_80984E58(this, play); + DemoIm_UpdateCollider(this, play); + func_80986BE4(this, func_80986AD0(this, play)); } -void func_80986EAC(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986EAC(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80984F94(this, globalCtx); - DemoIm_UpdateCollider(this, globalCtx); - func_80986B2C(globalCtx); + func_80984F94(this, play); + DemoIm_UpdateCollider(this, play); + func_80986B2C(play); } -void func_80986F08(DemoIm* this, GlobalContext* globalCtx) { - func_80986BF8(this, globalCtx); +void func_80986F08(DemoIm* this, PlayState* play) { + func_80986BF8(this, play); } -void func_80986F28(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986F28(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80984E58(this, globalCtx); - DemoIm_UpdateCollider(this, globalCtx); - func_80986C30(this, globalCtx); + func_80984E58(this, play); + DemoIm_UpdateCollider(this, play); + func_80986C30(this, play); } -void func_80986F88(DemoIm* this, GlobalContext* globalCtx) { +void func_80986F88(DemoIm* this, PlayState* play) { func_80986CC8(this); } -void func_80986FA8(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_80986FA8(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_80984E58(this, globalCtx); + func_80984E58(this, play); this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); - DemoIm_UpdateCollider(this, globalCtx); - func_80986CFC(this, globalCtx); + DemoIm_UpdateCollider(this, play); + func_80986CFC(this, play); } -void func_80987018(DemoIm* this, GlobalContext* globalCtx) { +void func_80987018(DemoIm* this, PlayState* play) { DemoIm_ChangeAnim(this, &gImpaIdleAnim, ANIMMODE_LOOP, 0.0f, false); this->action = 27; this->drawConfig = 0; @@ -1016,8 +1013,8 @@ void func_80987064(DemoIm* this) { } } -void func_809870F0(DemoIm* this, GlobalContext* globalCtx) { - func_80985200(this, globalCtx, 5); +void func_809870F0(DemoIm* this, PlayState* play) { + func_80985200(this, play, 5); this->action = 28; this->drawConfig = 2; } @@ -1040,8 +1037,8 @@ void func_809871B4(DemoIm* this, s32 arg1) { } } -void func_809871E8(DemoIm* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(globalCtx, 5); +void func_809871E8(DemoIm* this, PlayState* play) { + CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; @@ -1050,7 +1047,7 @@ void func_809871E8(DemoIm* this, GlobalContext* globalCtx) { if (action != unk_274) { switch (action) { case 12: - func_809870F0(this, globalCtx); + func_809870F0(this, play); break; case 13: func_80987174(this); @@ -1063,78 +1060,78 @@ void func_809871E8(DemoIm* this, GlobalContext* globalCtx) { } } -void func_80987288(DemoIm* this, GlobalContext* globalCtx) { - func_809871E8(this, globalCtx); +void func_80987288(DemoIm* this, PlayState* play) { + func_809871E8(this, play); } -void func_809872A8(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_809872A8(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_80987064(this); func_80987128(this); } -void func_809872F0(DemoIm* this, GlobalContext* globalCtx) { - DemoIm_UpdateBgCheckInfo(this, globalCtx); +void func_809872F0(DemoIm* this, PlayState* play) { + DemoIm_UpdateBgCheckInfo(this, play); DemoIm_UpdateSkelAnime(this); func_80984BE0(this); - func_809871E8(this, globalCtx); + func_809871E8(this, play); } -void func_80987330(DemoIm* this, GlobalContext* globalCtx) { +void func_80987330(DemoIm* this, PlayState* play) { s32 sp1C; - DemoIm_UpdateBgCheckInfo(this, globalCtx); + DemoIm_UpdateBgCheckInfo(this, play); sp1C = DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_809871B4(this, sp1C); } -void DemoIm_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoIm_Update(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; if ((this->action < 0) || (this->action >= 31) || (sActionFuncs[this->action] == NULL)) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void DemoIm_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoIm_Init(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - DemoIm_InitCollider(thisx, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gImpaSkel, NULL, this->jointTable, this->morphTable, 17); + DemoIm_InitCollider(thisx, play); + SkelAnime_InitFlex(play, &this->skelAnime, &gImpaSkel, NULL, this->jointTable, this->morphTable, 17); thisx->flags &= ~ACTOR_FLAG_0; switch (this->actor.params) { case 2: - func_80985860(this, globalCtx); + func_80985860(this, play); break; case 3: - func_80985E60(this, globalCtx); + func_80985E60(this, play); break; case 4: - func_8098652C(this, globalCtx); + func_8098652C(this, play); break; case 5: - func_809869B0(this, globalCtx); + func_809869B0(this, play); break; case 6: - func_80987018(this, globalCtx); + func_80987018(this, play); break; default: - func_80985310(this, globalCtx); + func_80985310(this, play); } } -void DemoIm_Destroy(Actor* thisx, GlobalContext* globalCtx) { - DemoIm_DestroyCollider(thisx, globalCtx); +void DemoIm_Destroy(Actor* thisx, PlayState* play) { + DemoIm_DestroyCollider(thisx, play); } -s32 DemoIm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 DemoIm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { DemoIm* this = (DemoIm*)thisx; s32* unk_2D0 = &this->unk_2D0; @@ -1161,7 +1158,7 @@ s32 DemoIm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void DemoIm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void DemoIm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { DemoIm* this = (DemoIm*)thisx; if (limbIndex == IMPA_LIMB_HEAD) { @@ -1178,36 +1175,36 @@ void DemoIm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void DemoIm_DrawNothing(DemoIm* this, GlobalContext* globalCtx) { +void DemoIm_DrawNothing(DemoIm* this, PlayState* play) { } -void DemoIm_DrawSolid(DemoIm* this, GlobalContext* globalCtx) { +void DemoIm_DrawSolid(DemoIm* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* eyeTexture = sEyeTextures[eyeIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_im.c", 904); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_im.c", 904); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTexture)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, DemoIm_OverrideLimbDraw, DemoIm_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_im.c", 925); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_im.c", 925); } -void DemoIm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoIm_Draw(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; if ((this->drawConfig < 0) || (this->drawConfig >= 3) || (sDrawFuncs[this->drawConfig] == NULL)) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.h b/src/overlays/actors/ovl_Demo_Im/z_demo_im.h index 12e898e27c..97192b39a0 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.h +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.h @@ -6,8 +6,8 @@ struct DemoIm; -typedef void (*DemoImActionFunc)(struct DemoIm*, GlobalContext*); -typedef void (*DemoImDrawFunc)(struct DemoIm*, GlobalContext*); +typedef void (*DemoImActionFunc)(struct DemoIm*, PlayState*); +typedef void (*DemoImDrawFunc)(struct DemoIm*, PlayState*); typedef enum { /* 0x00 */ IMPA_LIMB_NONE, diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 8702c513af..cca2510c23 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -6,26 +6,26 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoKankyo_Init(Actor* thisx, PlayState* play); +void DemoKankyo_Destroy(Actor* thisx, PlayState* play); +void DemoKankyo_Update(Actor* thisx, PlayState* play); +void DemoKankyo_Draw(Actor* thisx, PlayState* play); -void DemoKankyo_SetupType(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_UpdateClouds(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_UpdateRock(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_DoNothing2(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_UpdateDoorOfTime(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_DoNothing(DemoKankyo* this, GlobalContext* globalCtx); -void DemoKankyo_KillDoorOfTimeCollision(DemoKankyo* this, GlobalContext* globalCtx); +void DemoKankyo_SetupType(DemoKankyo* this, PlayState* play); +void DemoKankyo_UpdateClouds(DemoKankyo* this, PlayState* play); +void DemoKankyo_UpdateRock(DemoKankyo* this, PlayState* play); +void DemoKankyo_DoNothing2(DemoKankyo* this, PlayState* play); +void DemoKankyo_UpdateDoorOfTime(DemoKankyo* this, PlayState* play); +void DemoKankyo_DoNothing(DemoKankyo* this, PlayState* play); +void DemoKankyo_KillDoorOfTimeCollision(DemoKankyo* this, PlayState* play); -void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawRock(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawDoorOfTime(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawLightPlane(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx); -void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx); +void DemoKankyo_DrawRain(Actor* thisx, PlayState* play); +void DemoKankyo_DrawRock(Actor* thisx, PlayState* play); +void DemoKankyo_DrawClouds(Actor* thisx, PlayState* play); +void DemoKankyo_DrawDoorOfTime(Actor* thisx, PlayState* play); +void DemoKankyo_DrawLightPlane(Actor* thisx, PlayState* play); +void DemoKankyo_DrawWarpSparkles(Actor* thisx, PlayState* play); +void DemoKankyo_DrawSparkles(Actor* thisx, PlayState* play); // adult warp songs cutscenes extern CutsceneData gAdultWarpInCS[]; @@ -178,10 +178,10 @@ void DemoKankyo_SetupAction(DemoKankyo* this, DemoKankyoActionFunc actionFunc) { this->actionFunc = actionFunc; } -void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Init(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; s16 i; - s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjIds[this->actor.params]); + s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjIds[this->actor.params]); osSyncPrintf("bank_ID = %d\n", objBankIndex); if (objBankIndex < 0) { @@ -193,9 +193,9 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params) { case DEMOKANKYO_BLUE_RAIN: case DEMOKANKYO_BLUE_RAIN_2: - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_HIRAL_DEMO: - globalCtx->roomCtx.curRoom.segment = NULL; + play->roomCtx.curRoom.segment = NULL; D_8098CF80 = 10; sRainScale = 8; break; @@ -217,7 +217,7 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { case DEMOKANKYO_ROCK_3: case DEMOKANKYO_ROCK_4: case DEMOKANKYO_ROCK_5: - globalCtx->roomCtx.curRoom.segment = NULL; + play->roomCtx.curRoom.segment = NULL; this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = Rand_ZeroOne() * 0.5f + 0.5f; this->unk_150[0].unk_0.x = Rand_ZeroOne() * 3.0f + 1.0f; this->unk_150[0].unk_0.y = Rand_ZeroOne() * 3.0f + 1.0f; @@ -233,11 +233,10 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 1.0f; this->unk_150[0].unk_18 = 0.0f; if (!GET_EVENTCHKINF(EVENTCHKINF_4B)) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_TOKI, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, - 0x0000); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_TOKI, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x0000); } else { - globalCtx->roomCtx.unk_74[1] = 0xFF; + play->roomCtx.unk_74[1] = 0xFF; Actor_Kill(&this->actor); } break; @@ -247,7 +246,7 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { break; case DEMOKANKYO_WARP_OUT: case DEMOKANKYO_WARP_IN: - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION); this->actor.flags |= ACTOR_FLAG_25; this->actor.room = -1; this->warpTimer = 35; @@ -272,12 +271,12 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { DemoKankyo_SetupAction(this, DemoKankyo_SetupType); } -void DemoKankyo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Destroy(Actor* thisx, PlayState* play) { if (thisx) {} } -void DemoKankyo_SetupType(DemoKankyo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DemoKankyo_SetupType(DemoKankyo* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp; if (this->actor.objBankIndex == this->objBankIndex) { @@ -293,24 +292,24 @@ void DemoKankyo_SetupType(DemoKankyo* this, GlobalContext* globalCtx) { DemoKankyo_SetupAction(this, DemoKankyo_UpdateClouds); break; case DEMOKANKYO_DOOR_OF_TIME: - if (Flags_GetEnv(globalCtx, 2)) { + if (Flags_GetEnv(play, 2)) { DemoKankyo_SetupAction(this, DemoKankyo_UpdateDoorOfTime); } break; case DEMOKANKYO_WARP_OUT: - globalCtx->envCtx.screenFillColor[0] = 0xFF; - globalCtx->envCtx.screenFillColor[1] = 0xFF; - globalCtx->envCtx.screenFillColor[2] = 0xFF; - globalCtx->envCtx.fillScreen = false; + play->envCtx.screenFillColor[0] = 0xFF; + play->envCtx.screenFillColor[1] = 0xFF; + play->envCtx.screenFillColor[2] = 0xFF; + play->envCtx.fillScreen = false; if (this->warpTimer < 21 && this->warpTimer >= 15) { temp = (this->warpTimer - 15.0f) / 5.0f; - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[3] = 255 - 255 * temp; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[3] = 255 - 255 * temp; } if (this->warpTimer < 15 && this->warpTimer >= 4) { temp = (this->warpTimer - 4.0f) / 10.0f; - globalCtx->envCtx.fillScreen = true; - globalCtx->envCtx.screenFillColor[3] = 255 * temp; + play->envCtx.fillScreen = true; + play->envCtx.screenFillColor[3] = 255 * temp; } if (this->warpTimer == 15) { player->actor.draw = NULL; @@ -319,39 +318,39 @@ void DemoKankyo_SetupType(DemoKankyo* this, GlobalContext* globalCtx) { this->warpTimer--; } if (this->warpTimer == 1) { - if (globalCtx->sceneNum == SCENE_TOKINOMA) { + if (play->sceneNum == SCENE_TOKINOMA) { D_8098CF84 = 25; if (!LINK_IS_ADULT) { - globalCtx->csCtx.segment = gChildWarpInToTCS; + play->csCtx.segment = gChildWarpInToTCS; } else { - globalCtx->csCtx.segment = gAdultWarpInToTCS; + play->csCtx.segment = gAdultWarpInToTCS; } } else { D_8098CF84 = 32; if (!LINK_IS_ADULT) { - globalCtx->csCtx.segment = gChildWarpInCS; + play->csCtx.segment = gChildWarpInCS; } else { - globalCtx->csCtx.segment = gAdultWarpInCS; + play->csCtx.segment = gAdultWarpInCS; } } - if (func_800C0CB8(globalCtx) != 0) { + if (func_800C0CB8(play) != 0) { gSaveContext.cutsceneTrigger = 1; } DemoKankyo_SetupAction(this, DemoKankyo_DoNothing); } break; case DEMOKANKYO_WARP_IN: - if (globalCtx->sceneNum == SCENE_TOKINOMA) { + if (play->sceneNum == SCENE_TOKINOMA) { if (!LINK_IS_ADULT) { - globalCtx->csCtx.segment = gChildWarpOutToTCS; + play->csCtx.segment = gChildWarpOutToTCS; } else { - globalCtx->csCtx.segment = gAdultWarpOutToTCS; + play->csCtx.segment = gAdultWarpOutToTCS; } } else { if (!LINK_IS_ADULT) { - globalCtx->csCtx.segment = gChildWarpOutCS; + play->csCtx.segment = gChildWarpOutCS; } else { - globalCtx->csCtx.segment = gAdultWarpOutCS; + play->csCtx.segment = gAdultWarpOutCS; } } gSaveContext.cutsceneTrigger = 1; @@ -364,17 +363,17 @@ void DemoKankyo_SetupType(DemoKankyo* this, GlobalContext* globalCtx) { } } -void DemoKankyo_DoNothing(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKankyo_DoNothing(DemoKankyo* this, PlayState* play) { } -void DemoKankyo_DoNothing2(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKankyo_DoNothing2(DemoKankyo* this, PlayState* play) { DemoKankyo_SetupAction(this, DemoKankyo_DoNothing); } -void DemoKankyo_SetRockPos(DemoKankyo* this, GlobalContext* globalCtx, s32 params) { +void DemoKankyo_SetRockPos(DemoKankyo* this, PlayState* play, s32 params) { Vec3f startPos; Vec3f endPos; - CsCmdActorAction* csAction = globalCtx->csCtx.npcActions[params]; + CsCmdActorAction* csAction = play->csCtx.npcActions[params]; f32 temp_f0; startPos.x = csAction->startPos.x; @@ -383,22 +382,22 @@ void DemoKankyo_SetRockPos(DemoKankyo* this, GlobalContext* globalCtx, s32 param endPos.x = csAction->endPos.x; endPos.y = csAction->endPos.y; endPos.z = csAction->endPos.z; - temp_f0 = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, globalCtx->csCtx.frames); + temp_f0 = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, play->csCtx.frames); this->actor.world.pos.x = ((endPos.x - startPos.x) * temp_f0) + startPos.x; this->actor.world.pos.y = ((endPos.y - startPos.y) * temp_f0) + startPos.y; this->actor.world.pos.z = ((endPos.z - startPos.z) * temp_f0) + startPos.z; } -void DemoKankyo_UpdateRock(DemoKankyo* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[this->actor.params - 2] != NULL) { - DemoKankyo_SetRockPos(this, globalCtx, this->actor.params - 2); +void DemoKankyo_UpdateRock(DemoKankyo* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[this->actor.params - 2] != NULL) { + DemoKankyo_SetRockPos(this, play, this->actor.params - 2); } this->unk_150[0].unk_C.x += this->unk_150[0].unk_0.x; this->unk_150[0].unk_C.y += this->unk_150[0].unk_0.y; this->unk_150[0].unk_C.z += this->unk_150[0].unk_0.z; } -void DemoKankyo_UpdateClouds(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKankyo_UpdateClouds(DemoKankyo* this, PlayState* play) { u8 i; for (i = 0; i < 30; i++) { @@ -406,7 +405,7 @@ void DemoKankyo_UpdateClouds(DemoKankyo* this, GlobalContext* globalCtx) { } } -void DemoKankyo_UpdateDoorOfTime(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKankyo_UpdateDoorOfTime(DemoKankyo* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_STONE_STATUE_OPEN - SFX_FLAG); this->unk_150[0].unk_18 += 1.0f; if (this->unk_150[0].unk_18 >= 102.0f) { @@ -417,76 +416,76 @@ void DemoKankyo_UpdateDoorOfTime(DemoKankyo* this, GlobalContext* globalCtx) { } } -void DemoKankyo_KillDoorOfTimeCollision(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKankyo_KillDoorOfTimeCollision(DemoKankyo* this, PlayState* play) { Actor_Kill(this->actor.child); } -void DemoKankyo_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Update(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void DemoKankyo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Draw(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; if (this->actor.objBankIndex == this->objBankIndex) { switch (this->actor.params) { case DEMOKANKYO_BLUE_RAIN: case DEMOKANKYO_BLUE_RAIN_2: - if (globalCtx->sceneNum == SCENE_TOKINOMA) { - if (!Flags_GetEnv(globalCtx, 1)) { + if (play->sceneNum == SCENE_TOKINOMA) { + if (!Flags_GetEnv(play, 1)) { break; } else if (!Actor_IsFacingAndNearPlayer(&this->actor, 300.0f, 0x7530)) { break; } else { if (!LINK_IS_ADULT) { - if (globalCtx->csCtx.frames < 170 || globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.frames < 170 || play->csCtx.state == CS_STATE_IDLE) { break; } } else { - if (globalCtx->csCtx.frames < 120 || globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.frames < 120 || play->csCtx.state == CS_STATE_IDLE) { break; } } } } - DemoKankyo_DrawRain(thisx, globalCtx); + DemoKankyo_DrawRain(thisx, play); break; case DEMOKANKYO_ROCK_1: case DEMOKANKYO_ROCK_2: case DEMOKANKYO_ROCK_3: case DEMOKANKYO_ROCK_4: case DEMOKANKYO_ROCK_5: - DemoKankyo_DrawRock(thisx, globalCtx); + DemoKankyo_DrawRock(thisx, play); break; case DEMOKANKYO_CLOUDS: - DemoKankyo_DrawClouds(thisx, globalCtx); + DemoKankyo_DrawClouds(thisx, play); break; case DEMOKANKYO_DOOR_OF_TIME: - DemoKankyo_DrawDoorOfTime(thisx, globalCtx); + DemoKankyo_DrawDoorOfTime(thisx, play); break; case DEMOKANKYO_LIGHT_PLANE: - DemoKankyo_DrawLightPlane(thisx, globalCtx); + DemoKankyo_DrawLightPlane(thisx, play); break; case DEMOKANKYO_WARP_OUT: case DEMOKANKYO_WARP_IN: - DemoKankyo_DrawWarpSparkles(thisx, globalCtx); + DemoKankyo_DrawWarpSparkles(thisx, play); break; case DEMOKANKYO_SPARKLES: - DemoKankyo_DrawSparkles(thisx, globalCtx); + DemoKankyo_DrawSparkles(thisx, play); break; } } - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.objBankIndex = this->objBankIndex; } } // transform relating to blue rain -void func_80989B54(Actor* thisx, GlobalContext* globalCtx, s16 i) { +void func_80989B54(Actor* thisx, PlayState* play, s16 i) { DemoKankyo* this = (DemoKankyo*)thisx; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_HIRAL_DEMO: this->unk_150[i].unk_0.x = (Rand_ZeroOne() - 0.5f) * 500.0f; this->unk_150[i].unk_0.y = 500.0f; @@ -509,7 +508,7 @@ void func_80989B54(Actor* thisx, GlobalContext* globalCtx, s16 i) { this->unk_150[i].unk_18 = Rand_ZeroOne() * (D_8098CF80 * 4.0f) + D_8098CF80; } -void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawRain(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; f32 temp_f12_2; s16 i; @@ -522,25 +521,25 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { f32 translateZ; s16 j; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1186); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1186); for (i = 0; i < 30; i++) { s32 pad[2]; - dx = globalCtx->view.at.x - globalCtx->view.eye.x; - dy = globalCtx->view.at.y - globalCtx->view.eye.y; - dz = globalCtx->view.at.z - globalCtx->view.eye.z; + dx = play->view.at.x - play->view.eye.x; + dy = play->view.at.y - play->view.eye.y; + dz = play->view.at.z - play->view.eye.z; norm = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); - if (globalCtx->sceneNum != SCENE_TOKINOMA) { - this->unk_150[i].unk_C.x = globalCtx->view.eye.x + (dx / norm) * 350.0f; - this->unk_150[i].unk_C.y = globalCtx->view.eye.y + (dy / norm) * 80.0f; - this->unk_150[i].unk_C.z = globalCtx->view.eye.z + (dz / norm) * 350.0f; + if (play->sceneNum != SCENE_TOKINOMA) { + this->unk_150[i].unk_C.x = play->view.eye.x + (dx / norm) * 350.0f; + this->unk_150[i].unk_C.y = play->view.eye.y + (dy / norm) * 80.0f; + this->unk_150[i].unk_C.z = play->view.eye.z + (dz / norm) * 350.0f; } switch (this->unk_150[i].unk_22) { case 0: - func_80989B54(thisx, globalCtx, i); + func_80989B54(thisx, play, i); if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0) { this->unk_150[i].unk_0.y = Rand_ZeroOne() * 500.0f; } else { @@ -549,7 +548,7 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { this->unk_150[i].unk_22++; break; case 1: - temp_f12_2 = globalCtx->view.eye.y + (dy / norm) * 150.0f; + temp_f12_2 = play->view.eye.y + (dy / norm) * 150.0f; if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0) { this->unk_150[i].unk_0.y -= this->unk_150[i].unk_18; } else { @@ -570,7 +569,7 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { } break; case 2: - func_80989B54(thisx, globalCtx, i); + func_80989B54(thisx, play, i); this->unk_150[i].unk_22--; break; } @@ -598,7 +597,7 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { for (j = 0; j < 5; j++) { s32 pad1; - if (globalCtx->sceneNum != SCENE_TOKINOMA) { + if (play->sceneNum != SCENE_TOKINOMA) { if (this->unk_150[i].unk_0.x >= 0.0f) { translateX = -j * 1500.0f; } else { @@ -621,22 +620,22 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Translate(translateX, translateY, translateZ, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1344), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kankyo.c", 1344), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gSPDisplayList(POLY_XLU_DISP++, object_efc_star_field_DL_000080); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1358); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1358); } -void DemoKankyo_DrawRock(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawRock(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1376); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1376); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateX(DEG_TO_RAD(this->unk_150[0].unk_C.x), MTXMODE_APPLY); Matrix_RotateY(DEG_TO_RAD(this->unk_150[0].unk_C.y), MTXMODE_APPLY); @@ -644,14 +643,14 @@ void DemoKankyo_DrawRock(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 155, 55, 255); gDPSetEnvColor(POLY_OPA_DISP++, 155, 255, 55, 255); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1404), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kankyo.c", 1404), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_efc_star_field_DL_000DE0); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1409); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1409); } -void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawClouds(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; s16 i; s32 pad; @@ -659,15 +658,15 @@ void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { f32 dy; f32 dz; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1425); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1425); for (i = 0; i < 30; i++) { dx = -(Math_SinS(this->unk_150[i].unk_20 - 0x8000) * 120.0f) * (30.0f + (i / 30.0f) * 10.0f); dy = Math_CosS(this->unk_150[i].unk_20 - 0x8000) * 5.0f + 1200.0f; dz = (Math_CosS(this->unk_150[i].unk_20 - 0x8000) * 120.0f) * (30.0f + (i / 30.0f) * 10.0f); - Matrix_Translate(globalCtx->view.eye.x + dx, globalCtx->view.eye.y + dy + ((i - 12.0f) * 300.0f), - globalCtx->view.eye.z + dz, MTXMODE_NEW); + Matrix_Translate(play->view.eye.x + dx, play->view.eye.y + dy + ((i - 12.0f) * 300.0f), play->view.eye.z + dz, + MTXMODE_NEW); Matrix_Scale(125.0f, 60.0f, 125.0f, MTXMODE_APPLY); gDPPipeSync(POLY_XLU_DISP++); @@ -675,55 +674,54 @@ void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 255); gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); gDPSetColorDither(POLY_XLU_DISP++, G_AD_NOTPATTERN | G_CD_MAGICSQ); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1461), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kankyo.c", 1461), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gDust5Tex)); - func_80094C50(globalCtx->state.gfxCtx); + func_80094C50(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &D_01000000, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffDustDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1474); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1474); } -void DemoKankyo_DrawDoorOfTime(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawDoorOfTime(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1487); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1487); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(-this->unk_150[0].unk_18, 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1492), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kankyo.c", 1492), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_007440); Matrix_Translate(this->unk_150[0].unk_18 + this->unk_150[0].unk_18, 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1497), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kankyo.c", 1497), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_007578); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1501); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1501); } -void DemoKankyo_DrawLightPlane(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawLightPlane(Actor* thisx, PlayState* play) { DemoKankyo* this = (DemoKankyo*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1514); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1514); - if (globalCtx->csCtx.state == CS_STATE_IDLE || gSaveContext.sceneSetupIndex >= 4) { - func_80093D84(globalCtx->state.gfxCtx); + if (play->csCtx.state == CS_STATE_IDLE || gSaveContext.sceneSetupIndex >= 4) { + func_80093D84(play->state.gfxCtx); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames & 0x7F, 64, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1529), + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, play->state.frames & 0x7F, 64, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kankyo.c", 1529), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_008390); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1534); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1534); } void DemoKankyo_Vec3fCopy(Vec3f* src, Vec3f* dst) { @@ -754,7 +752,7 @@ void DemoKankyo_Vec3fAddPosRot(PosRot* posRot, Vec3f* vec, Vec3f* dst) { DemoKankyo_Vec3fAddVecSph(dst, &posRot->pos, &sph); } -void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawWarpSparkles(Actor* thisx, PlayState* play) { static f32 sWarpRoll; static f32 sWarpFoV; // the following 2 vars are unused @@ -766,7 +764,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { f32 temp_f22; DemoKankyo* this = (DemoKankyo*)thisx; Gfx* disp; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f camPos; f32 translateX; f32 translateY; @@ -774,7 +772,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { PosRot posRot; u8 linkAge = gSaveContext.linkAge; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 1824); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1824); if (this->sparkleCounter < 30) { this->sparkleCounter += 2; @@ -797,7 +795,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { &this->unk_150[i].unk_1C) != 0) { this->unk_150[i].unk_22++; } - if (globalCtx->sceneNum == SCENE_TOKINOMA && globalCtx->csCtx.frames == 25) { + if (play->sceneNum == SCENE_TOKINOMA && play->csCtx.frames == 25) { this->unk_150[i].unk_22++; } } else { @@ -808,7 +806,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { &this->unk_150[i].unk_1C) != 0) { this->unk_150[i].unk_22++; } - if (D_8098CF84 < globalCtx->csCtx.frames && this->actor.params == DEMOKANKYO_WARP_OUT) { + if (D_8098CF84 < play->csCtx.frames && this->actor.params == DEMOKANKYO_WARP_OUT) { this->unk_150[i].unk_22++; } } @@ -818,11 +816,11 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { case 2: if (this->actor.params == DEMOKANKYO_WARP_OUT) { if (i == 0) { - Environment_WarpSongLeave(globalCtx); + Environment_WarpSongLeave(play); this->unk_150[i].unk_22++; } - } else if (i + 1 == this->sparkleCounter && globalCtx->csCtx.state == CS_STATE_IDLE) { - func_80088AF0(globalCtx); + } else if (i + 1 == this->sparkleCounter && play->csCtx.state == CS_STATE_IDLE) { + func_80088AF0(play); Actor_Kill(&this->actor); } break; @@ -870,29 +868,29 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { this->unk_150[i].unk_18 * (0.018f * temp_f22), MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255); if (this->actor.params == DEMOKANKYO_WARP_OUT) { - gDPSetEnvColor(POLY_XLU_DISP++, sWarpSparkleEnvColors[globalCtx->msgCtx.lastPlayedSong].r, - sWarpSparkleEnvColors[globalCtx->msgCtx.lastPlayedSong].g, - sWarpSparkleEnvColors[globalCtx->msgCtx.lastPlayedSong].b, 255); + gDPSetEnvColor(POLY_XLU_DISP++, sWarpSparkleEnvColors[play->msgCtx.lastPlayedSong].r, + sWarpSparkleEnvColors[play->msgCtx.lastPlayedSong].g, + sWarpSparkleEnvColors[play->msgCtx.lastPlayedSong].b, 255); } else { s8 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data; gDPSetEnvColor(POLY_XLU_DISP++, sWarpSparkleEnvColors[respawnData].r, sWarpSparkleEnvColors[respawnData].g, sWarpSparkleEnvColors[respawnData].b, 255); } - func_80093D84(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_80093D84(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(this->unk_150[i].unk_24), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 2011), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kankyo.c", 2011), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, disp); this->unk_150[i].unk_24 += 0x190; } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 2019); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 2019); } -void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_DrawSparkles(Actor* thisx, PlayState* play) { static f32 sSparklesRoll; static f32 sSparklesFoV; // the following 3 vars are unused @@ -911,7 +909,7 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { s16 i; PosRot posRot; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 2434); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 2434); if (this->sparkleCounter < 20) { this->sparkleCounter++; @@ -938,7 +936,7 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { DemoKankyo_Vec3fAddPosRot(&posRot, &camPos, &D_8098CFB8); break; case 2: - if (i + 1 == this->sparkleCounter && globalCtx->csCtx.state == CS_STATE_IDLE) { + if (i + 1 == this->sparkleCounter && play->csCtx.state == CS_STATE_IDLE) { Actor_Kill(&this->actor); } break; @@ -981,15 +979,15 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, sSparkleEnvColors[3].r, sSparkleEnvColors[3].g, sSparkleEnvColors[3].b, 255); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_80093D84(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(this->unk_150[i].unk_24), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 2572), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kankyo.c", 2572), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); this->unk_150[i].unk_24 += 0x190; } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_kankyo.c", 2579); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 2579); } diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h index efc63ab73f..89ad474b35 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h @@ -6,7 +6,7 @@ struct DemoKankyo; -typedef void (*DemoKankyoActionFunc)(struct DemoKankyo*, GlobalContext*); +typedef void (*DemoKankyoActionFunc)(struct DemoKankyo*, PlayState*); typedef enum { /* 0x00 */ DEMOKANKYO_BLUE_RAIN, diff --git a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c index 265c846952..3ba4dea6ed 100644 --- a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c +++ b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c @@ -10,16 +10,16 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoKekkai_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoKekkai_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoKekkai_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoKekkai_DrawTowerBarrier(Actor* thisx, GlobalContext* globalCtx); +void DemoKekkai_Init(Actor* thisx, PlayState* play); +void DemoKekkai_Destroy(Actor* thisx, PlayState* play); +void DemoKekkai_Update(Actor* thisx, PlayState* play); +void DemoKekkai_DrawTowerBarrier(Actor* thisx, PlayState* play); -void DemoKekkai_TrialBarrierDispel(Actor* thisx, GlobalContext* globalCtx); -void DemoKekkai_TrialBarrierIdle(Actor* thisx, GlobalContext* globalCtx); -void DemoKekkai_DrawTrialBarrier(Actor* thisx, GlobalContext* globalCtx); +void DemoKekkai_TrialBarrierDispel(Actor* thisx, PlayState* play); +void DemoKekkai_TrialBarrierIdle(Actor* thisx, PlayState* play); +void DemoKekkai_DrawTrialBarrier(Actor* thisx, PlayState* play); -void DemoKekkai_TowerBarrier(DemoKekkai* this, GlobalContext* globalCtx); +void DemoKekkai_TowerBarrier(DemoKekkai* this, PlayState* play); const ActorInit Demo_Kekkai_InitVars = { ACTOR_DEMO_KEKKAI, @@ -73,7 +73,7 @@ s32 DemoKekkai_CheckEventFlag(s32 params) { return Flags_GetEventChkInf(eventFlags[params]); } -void DemoKekkai_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoKekkai_Init(Actor* thisx, PlayState* play) { s32 pad; DemoKekkai* this = (DemoKekkai*)thisx; @@ -81,10 +81,10 @@ void DemoKekkai_Init(Actor* thisx, GlobalContext* globalCtx) { this->energyAlpha = 1.0f; Actor_SetScale(thisx, 0.1f); thisx->colChkInfo.mass = MASS_IMMOVABLE; - Collider_InitCylinder(globalCtx, &this->collider1); - Collider_SetCylinder(globalCtx, &this->collider1, thisx, &sCylinderInit); - Collider_InitCylinder(globalCtx, &this->collider2); - Collider_SetCylinder(globalCtx, &this->collider2, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider1); + Collider_SetCylinder(play, &this->collider1, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider2); + Collider_SetCylinder(play, &this->collider2, thisx, &sCylinderInit); Collider_UpdateCylinder(thisx, &this->collider1); Collider_UpdateCylinder(thisx, &this->collider2); this->timer = 0; @@ -118,21 +118,21 @@ void DemoKekkai_Init(Actor* thisx, GlobalContext* globalCtx) { } if (DemoKekkai_CheckEventFlag(thisx->params)) { if (thisx->params == KEKKAI_TOWER) { - globalCtx->envCtx.lightSettingOverride = 1; + play->envCtx.lightSettingOverride = 1; } Actor_Kill(thisx); } } -void DemoKekkai_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoKekkai_Destroy(Actor* thisx, PlayState* play) { s32 pad; DemoKekkai* this = (DemoKekkai*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); } -void DemoKekkai_SpawnParticles(DemoKekkai* this, GlobalContext* globalCtx) { +void DemoKekkai_SpawnParticles(DemoKekkai* this, PlayState* play) { static Vec3f vel = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 lightYellow = { 255, 255, 170, 0 }; @@ -152,14 +152,14 @@ void DemoKekkai_SpawnParticles(DemoKekkai* this, GlobalContext* globalCtx) { pos.y = (vel.y * 20.0f) + this->actor.world.pos.y + 120.0f; pos.z = (vel.z * 7.0f) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &vel, &accel, &lightYellow, &darkRed, 3000, + EffectSsKiraKira_SpawnFocused(play, &pos, &vel, &accel, &lightYellow, &darkRed, 3000, (s32)Rand_ZeroFloat(40.0f) + 45); } } -void DemoKekkai_TowerBarrier(DemoKekkai* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[0] != NULL) && - (globalCtx->csCtx.npcActions[0]->action != 1) && (globalCtx->csCtx.npcActions[0]->action == 2)) { +void DemoKekkai_TowerBarrier(DemoKekkai* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[0] != NULL) && + (play->csCtx.npcActions[0]->action != 1) && (play->csCtx.npcActions[0]->action == 2)) { if (!(this->sfxFlag & 1)) { func_800F3F3C(0xC); this->sfxFlag |= 1; @@ -182,32 +182,32 @@ void DemoKekkai_TowerBarrier(DemoKekkai* this, GlobalContext* globalCtx) { } } -void DemoKekkai_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DemoKekkai_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DemoKekkai* this = (DemoKekkai*)thisx; if (this->energyAlpha > 0.99f) { if ((this->collider1.base.atFlags & AT_HIT) || (this->collider2.base.atFlags & AT_HIT)) { - func_8002F71C(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); + func_8002F71C(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); this->barrierScroll += this->barrierScrollRate; if (this->barrierScroll > 65536.0f) { this->barrierScroll -= 65536.0f; } } -void DemoKekkai_TrialBarrierDispel(Actor* thisx, GlobalContext* globalCtx) { +void DemoKekkai_TrialBarrierDispel(Actor* thisx, PlayState* play) { static u16 csFrames[] = { 0, 280, 280, 280, 280, 280, 280 }; s32 pad; DemoKekkai* this = (DemoKekkai*)thisx; - if (globalCtx->csCtx.frames == csFrames[this->actor.params]) { + if (play->csCtx.frames == csFrames[this->actor.params]) { func_800F3F3C(0xA); } if (this->energyAlpha >= 0.05f) { @@ -221,7 +221,7 @@ void DemoKekkai_TrialBarrierDispel(Actor* thisx, GlobalContext* globalCtx) { this->orbScale = 2.0f; } else if (this->timer == 50) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_RING_EXPLOSION); - DemoKekkai_SpawnParticles(this, globalCtx); + DemoKekkai_SpawnParticles(this, play); } else { this->orbScale = 0.0f; } @@ -241,31 +241,31 @@ static CutsceneData* sSageCutscenes[] = { gForestTrialSageCs, }; -void DemoKekkai_TrialBarrierIdle(Actor* thisx, GlobalContext* globalCtx) { +void DemoKekkai_TrialBarrierIdle(Actor* thisx, PlayState* play) { s32 pad; DemoKekkai* this = (DemoKekkai*)thisx; if (this->collider1.base.atFlags & AT_HIT) { - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 5.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 5.0f); } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); if (this->collider2.base.acFlags & AC_HIT) { func_80078884(NA_SE_SY_CORRECT_CHIME); // "I got it" LOG_STRING("当ったよ", "../z_demo_kekkai.c", 572); this->actor.update = DemoKekkai_TrialBarrierDispel; this->timer = 0; - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(sSageCutscenes[this->actor.params]); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(sSageCutscenes[this->actor.params]); gSaveContext.cutsceneTrigger = 1; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); func_8002F974(&this->actor, NA_SE_EV_TOWER_ENERGY - SFX_FLAG); } -void DemoKekkai_DrawTrialBarrier(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; - s32 frames = globalCtx->gameplayFrames & 0xFFFF; +void DemoKekkai_DrawTrialBarrier(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + s32 frames = play->gameplayFrames & 0xFFFF; u8 alphaIndex[102] = { 1, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -286,25 +286,25 @@ void DemoKekkai_DrawTrialBarrier(Actor* thisx, GlobalContext* globalCtx2) { energyVtx[i].v.cn[3] = alphas[alphaIndex[i]]; } colorIndex = (this->actor.params - 1) * 6; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 632); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 632); + func_80093D84(play->state.gfxCtx); Matrix_Push(); Matrix_Translate(0.0f, 1200.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(this->orbScale, this->orbScale, this->orbScale, MTXMODE_APPLY); Matrix_Translate(0.0f, -1200.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 639), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kekkai.c", 639), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 5, frames * -10, 0x20, 0x20, 1, frames * 5, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 5, frames * -10, 0x20, 0x20, 1, frames * 5, frames * -10, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierOrbDL); Matrix_Pop(); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 656), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kekkai.c", 656), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 50, 0, 100, 255); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, frames, frames, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, frames, frames, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierFloorDL); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, sEnergyColors[colorIndex + 0], sEnergyColors[colorIndex + 1], @@ -312,27 +312,27 @@ void DemoKekkai_DrawTrialBarrier(Actor* thisx, GlobalContext* globalCtx2) { gDPSetEnvColor(POLY_XLU_DISP++, sEnergyColors[colorIndex + 3], sEnergyColors[colorIndex + 4], sEnergyColors[colorIndex + 5], 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 5, frames * -10, 0x20, 0x20, 1, frames * 5, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 5, frames * -10, 0x20, 0x20, 1, frames * 5, frames * -10, 0x20, 0x40)); gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierEnergyDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 696); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 696); } } -void DemoKekkai_DrawTowerBarrier(Actor* thisx, GlobalContext* globalCtx) { +void DemoKekkai_DrawTowerBarrier(Actor* thisx, PlayState* play) { s32 pad; DemoKekkai* this = (DemoKekkai*)thisx; s32 scroll; scroll = (s32)this->barrierScroll & 0xFFFF; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 705); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 707), + OPEN_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 705); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kekkai.c", 707), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 255, 170, 255, 255); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 2, scroll * -4, 0x20, 0x40, 1, scroll * 2, - scroll * -4, 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 2, scroll * -4, 0x20, 0x40, 1, scroll * 2, scroll * -4, + 0x20, 0x40)); gSPDisplayList(POLY_XLU_DISP++, gTowerBarrierDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 722); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 722); } diff --git a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h index b8e85058d7..c6711097e4 100644 --- a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h +++ b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h @@ -6,7 +6,7 @@ struct DemoKekkai; -typedef void (*DemoKekkaiUpdateFunc)(struct DemoKekkai* this, GlobalContext* globalCtx); +typedef void (*DemoKekkaiUpdateFunc)(struct DemoKekkai* this, PlayState* play); typedef struct DemoKekkai { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index cb84208143..7936ba59e2 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -13,36 +13,36 @@ #define FLAGS ACTOR_FLAG_4 -void DemoSa_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoSa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoSa_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoSa_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoSa_Init(Actor* thisx, PlayState* play); +void DemoSa_Destroy(Actor* thisx, PlayState* play); +void DemoSa_Update(Actor* thisx, PlayState* play); +void DemoSa_Draw(Actor* thisx, PlayState* play); -void func_8098EBB8(DemoSa* this, GlobalContext* globalCtx); -void func_8098EBD8(DemoSa* this, GlobalContext* globalCtx); -void func_8098EBF8(DemoSa* this, GlobalContext* globalCtx); -void func_8098EC28(DemoSa* this, GlobalContext* globalCtx); -void func_8098EC60(DemoSa* this, GlobalContext* globalCtx); -void func_8098EC94(DemoSa* this, GlobalContext* globalCtx); -void func_8098ECCC(DemoSa* this, GlobalContext* globalCtx); -void func_8098F0E8(DemoSa* this, GlobalContext* globalCtx); -void func_8098F118(DemoSa* this, GlobalContext* globalCtx); -void func_8098F16C(DemoSa* this, GlobalContext* globalCtx); -void func_8098F3F0(DemoSa* this, GlobalContext* globalCtx); -void func_8098F714(DemoSa* this, GlobalContext* globalCtx); -void func_8098F734(DemoSa* this, GlobalContext* globalCtx); -void func_8098F77C(DemoSa* this, GlobalContext* globalCtx); -void func_8098F7BC(DemoSa* this, GlobalContext* globalCtx); -void func_8098F7FC(DemoSa* this, GlobalContext* globalCtx); -void func_8098FC44(DemoSa* this, GlobalContext* globalCtx); -void func_8098FC64(DemoSa* this, GlobalContext* globalCtx); -void func_8098FC9C(DemoSa* this, GlobalContext* globalCtx); -void func_8098FCD4(DemoSa* this, GlobalContext* globalCtx); -void func_8098FD0C(DemoSa* this, GlobalContext* globalCtx); +void func_8098EBB8(DemoSa* this, PlayState* play); +void func_8098EBD8(DemoSa* this, PlayState* play); +void func_8098EBF8(DemoSa* this, PlayState* play); +void func_8098EC28(DemoSa* this, PlayState* play); +void func_8098EC60(DemoSa* this, PlayState* play); +void func_8098EC94(DemoSa* this, PlayState* play); +void func_8098ECCC(DemoSa* this, PlayState* play); +void func_8098F0E8(DemoSa* this, PlayState* play); +void func_8098F118(DemoSa* this, PlayState* play); +void func_8098F16C(DemoSa* this, PlayState* play); +void func_8098F3F0(DemoSa* this, PlayState* play); +void func_8098F714(DemoSa* this, PlayState* play); +void func_8098F734(DemoSa* this, PlayState* play); +void func_8098F77C(DemoSa* this, PlayState* play); +void func_8098F7BC(DemoSa* this, PlayState* play); +void func_8098F7FC(DemoSa* this, PlayState* play); +void func_8098FC44(DemoSa* this, PlayState* play); +void func_8098FC64(DemoSa* this, PlayState* play); +void func_8098FC9C(DemoSa* this, PlayState* play); +void func_8098FCD4(DemoSa* this, PlayState* play); +void func_8098FD0C(DemoSa* this, PlayState* play); -void DemoSa_DrawNothing(DemoSa* this, GlobalContext* globalCtx); -void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx); -void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx); +void DemoSa_DrawNothing(DemoSa* this, PlayState* play); +void DemoSa_DrawOpa(DemoSa* this, PlayState* play); +void DemoSa_DrawXlu(DemoSa* this, PlayState* play); typedef enum { /* 0 */ SARIA_EYE_OPEN, @@ -97,10 +97,10 @@ const ActorInit Demo_Sa_InitVars = { (ActorFunc)DemoSa_Draw, }; -void DemoSa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoSa_Destroy(Actor* thisx, PlayState* play) { DemoSa* this = (DemoSa*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } void func_8098E480(DemoSa* this) { @@ -135,10 +135,10 @@ void func_8098E530(DemoSa* this) { this->unk_1A0 = 0.0f; } -void func_8098E554(DemoSa* this, GlobalContext* globalCtx) { +void func_8098E554(DemoSa* this, PlayState* play) { u32* something = &D_80990108; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (*something != 0) { if (this->actor.params == 2) { func_8098E530(this); @@ -150,24 +150,23 @@ void func_8098E554(DemoSa* this, GlobalContext* globalCtx) { } } -void func_8098E5C8(DemoSa* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); +void func_8098E5C8(DemoSa* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } s32 DemoSa_UpdateSkelAnime(DemoSa* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* DemoSa_GetNpcAction(GlobalContext* globalCtx, s32 idx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[idx]; +CsCmdActorAction* DemoSa_GetNpcAction(PlayState* play, s32 idx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[idx]; } return NULL; } -s32 func_8098E654(DemoSa* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(globalCtx, arg3); +s32 func_8098E654(DemoSa* this, PlayState* play, u16 arg2, s32 arg3) { + CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, arg3); if ((npcAction != NULL) && (npcAction->action == arg2)) { return 1; @@ -175,8 +174,8 @@ s32 func_8098E654(DemoSa* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { return 0; } -s32 func_8098E6A0(DemoSa* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(globalCtx, arg3); +s32 func_8098E6A0(DemoSa* this, PlayState* play, u16 arg2, s32 arg3) { + CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, arg3); if ((npcAction != NULL) && (npcAction->action != arg2)) { return 1; @@ -184,8 +183,8 @@ s32 func_8098E6A0(DemoSa* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { return 0; } -void func_8098E6EC(DemoSa* this, GlobalContext* globalCtx, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(globalCtx, actionIdx); +void func_8098E6EC(DemoSa* this, PlayState* play, s32 actionIdx) { + CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -215,61 +214,59 @@ void func_8098E76C(DemoSa* this, AnimationHeader* animHeaderSeg, u8 arg2, f32 mo Animation_Change(&this->skelAnime, animHeaderSeg, playbackSpeed, unk0, fc, arg2, morphFrames); } -void func_8098E7FC(DemoSa* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0); +void func_8098E7FC(DemoSa* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0); this->actor.shape.yOffset = -10000.0f; DemoSa_SetEyeIndex(this, SARIA_EYE_HALF); DemoSa_SetMouthIndex(this, SARIA_MOUTH_CLOSED2); } -void func_8098E86C(DemoSa* this, GlobalContext* globalCtx) { +void func_8098E86C(DemoSa* this, PlayState* play) { Vec3f* world = &this->actor.world.pos; f32 posX = world->x; f32 posY = world->y; f32 posZ = world->z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, - WARP_SAGES); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_SAGES); } -void func_8098E8C8(DemoSa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8098E8C8(DemoSa* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 80.0f; f32 posZ = player->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, - 0xB); - Item_Give(globalCtx, ITEM_MEDALLION_FOREST); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 0xB); + Item_Give(play, ITEM_MEDALLION_FOREST); } -void func_8098E944(DemoSa* this, GlobalContext* globalCtx) { +void func_8098E944(DemoSa* this, PlayState* play) { this->actor.shape.yOffset += (250.0f / 3.0f); } -void func_8098E960(DemoSa* this, GlobalContext* globalCtx) { +void func_8098E960(DemoSa* this, PlayState* play) { s32 pad[2]; Player* player; if ((gSaveContext.chamberCutsceneNum == 0) && (gSaveContext.sceneSetupIndex < 4)) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->action = 1; - globalCtx->csCtx.segment = D_8099010C; + play->csCtx.segment = D_8099010C; gSaveContext.cutsceneTrigger = 2; - Item_Give(globalCtx, ITEM_MEDALLION_FOREST); + Item_Give(play, ITEM_MEDALLION_FOREST); player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; } } -void func_8098E9EC(DemoSa* this, GlobalContext* globalCtx) { +void func_8098E9EC(DemoSa* this, PlayState* play) { CsCmdActorAction* npcAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - npcAction = globalCtx->csCtx.npcActions[4]; + if (play->csCtx.state != CS_STATE_IDLE) { + npcAction = play->csCtx.npcActions[4]; if ((npcAction != NULL) && (npcAction->action == 2)) { this->action = 2; this->drawConfig = 1; - func_8098E86C(this, globalCtx); + func_8098E86C(this, play); } } } @@ -281,11 +278,11 @@ void func_8098EA3C(DemoSa* this) { } } -void func_8098EA68(DemoSa* this, GlobalContext* globalCtx) { +void func_8098EA68(DemoSa* this, PlayState* play) { CsCmdActorAction* npcAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - npcAction = globalCtx->csCtx.npcActions[4]; + if (play->csCtx.state != CS_STATE_IDLE) { + npcAction = play->csCtx.npcActions[4]; if ((npcAction != NULL) && (npcAction->action == 3)) { Animation_Change(&this->skelAnime, &gSariaGiveForestMedallionAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSariaGiveForestMedallionAnim), ANIMMODE_ONCE, -4.0f); @@ -302,60 +299,60 @@ void func_8098EB00(DemoSa* this, s32 arg1) { } } -void func_8098EB6C(DemoSa* this, GlobalContext* globalCtx) { +void func_8098EB6C(DemoSa* this, PlayState* play) { CsCmdActorAction* npcAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - npcAction = globalCtx->csCtx.npcActions[6]; + if (play->csCtx.state != CS_STATE_IDLE) { + npcAction = play->csCtx.npcActions[6]; if ((npcAction != NULL) && (npcAction->action == 2)) { this->action = 6; - func_8098E8C8(this, globalCtx); + func_8098E8C8(this, play); } } } -void func_8098EBB8(DemoSa* this, GlobalContext* globalCtx) { - func_8098E960(this, globalCtx); +void func_8098EBB8(DemoSa* this, PlayState* play) { + func_8098E960(this, play); } -void func_8098EBD8(DemoSa* this, GlobalContext* globalCtx) { - func_8098E9EC(this, globalCtx); +void func_8098EBD8(DemoSa* this, PlayState* play) { + func_8098E9EC(this, play); } -void func_8098EBF8(DemoSa* this, GlobalContext* globalCtx) { - func_8098E944(this, globalCtx); +void func_8098EBF8(DemoSa* this, PlayState* play) { + func_8098E944(this, play); DemoSa_UpdateSkelAnime(this); func_8098EA3C(this); } -void func_8098EC28(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098EC28(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); - func_8098EA68(this, globalCtx); + func_8098EA68(this, play); } -void func_8098EC60(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098EC60(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); func_8098EB00(this, DemoSa_UpdateSkelAnime(this)); } -void func_8098EC94(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098EC94(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); - func_8098EB6C(this, globalCtx); + func_8098EB6C(this, play); } -void func_8098ECCC(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098ECCC(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); } -void func_8098ECF4(DemoSa* this, GlobalContext* globalCtx) { +void func_8098ECF4(DemoSa* this, PlayState* play) { s32 pad[2]; SkelAnime* skelAnime = &this->skelAnime; f32 frameCount = Animation_GetLastFrame(&gSariaSealGanonAnim); - SkelAnime_InitFlex(globalCtx, skelAnime, &gSariaSkel, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, skelAnime, &gSariaSkel, NULL, NULL, NULL, 0); Animation_Change(skelAnime, &gSariaSealGanonAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); this->action = 7; this->actor.shape.shadowAlpha = 0; @@ -376,13 +373,13 @@ void func_8098EE08(void) { func_800788CC(NA_SE_SY_WHITE_OUT_T); } -void func_8098EE28(DemoSa* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void func_8098EE28(DemoSa* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, (kREG(23) + 25.0f) + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 4); } -void func_8098EEA8(DemoSa* this, GlobalContext* globalCtx) { - if (func_8098E654(this, globalCtx, 4, 4)) { +void func_8098EEA8(DemoSa* this, PlayState* play) { + if (func_8098E654(this, play, 4, 4)) { this->action = 8; this->drawConfig = 2; this->alpha = 0; @@ -392,11 +389,11 @@ void func_8098EEA8(DemoSa* this, GlobalContext* globalCtx) { } } -void func_8098EEFC(DemoSa* this, GlobalContext* globalCtx) { +void func_8098EEFC(DemoSa* this, PlayState* play) { s32 alpha = 255; f32* unk_1A0 = &this->unk_1A0; - if (func_8098E654(this, globalCtx, 4, 4)) { + if (func_8098E654(this, play, 4, 4)) { *unk_1A0 += 1.0f; if ((kREG(5) + 10.0f) <= *unk_1A0) { this->action = 9; @@ -420,42 +417,42 @@ void func_8098EEFC(DemoSa* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = this->alpha = (*unk_1A0 / (kREG(5) + 10.0f)) * 255.0f; } -void func_8098F050(DemoSa* this, GlobalContext* globalCtx) { - if (func_8098E6A0(this, globalCtx, 4, 4)) { +void func_8098F050(DemoSa* this, PlayState* play) { + if (func_8098E6A0(this, play, 4, 4)) { this->action = 8; this->drawConfig = 2; this->unk_1A0 = kREG(5) + 10.0f; this->alpha = 255; if (this->unk_1A8 == 0) { - func_8098EE28(this, globalCtx); + func_8098EE28(this, play); this->unk_1A8 = 1; } this->actor.shape.shadowAlpha = 0xFF; } } -void func_8098F0E8(DemoSa* this, GlobalContext* globalCtx) { - func_8098EEA8(this, globalCtx); - func_8098E554(this, globalCtx); +void func_8098F0E8(DemoSa* this, PlayState* play) { + func_8098EEA8(this, play); + func_8098E554(this, play); } -void func_8098F118(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F118(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098E480(this); - func_8098EEFC(this, globalCtx); - func_8098E554(this, globalCtx); + func_8098EEFC(this, play); + func_8098E554(this, play); } -void func_8098F16C(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F16C(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098EDB0(this); - func_8098F050(this, globalCtx); - func_8098E554(this, globalCtx); + func_8098F050(this, play); + func_8098E554(this, play); } -void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx) { +void DemoSa_DrawXlu(DemoSa* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* sp78 = sEyeTextures[eyeIndex]; @@ -464,9 +461,9 @@ void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx) { void* sp6C = sMouthTextures[mouthIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa_inKenjyanomaDemo02.c", 296); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_sa_inKenjyanomaDemo02.c", 296); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sp78)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sp78)); @@ -474,26 +471,26 @@ void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, - NULL, NULL, NULL, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, + NULL, NULL, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa_inKenjyanomaDemo02.c", 325); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_sa_inKenjyanomaDemo02.c", 325); } -void func_8098F390(DemoSa* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0); +void func_8098F390(DemoSa* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0); this->action = 10; this->drawConfig = 1; } -void func_8098F3F0(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F3F0(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098E480(this); } -void func_8098F420(DemoSa* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaSitting3Anim, NULL, NULL, 0); +void func_8098F420(DemoSa* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gSariaSkel, &gSariaSitting3Anim, NULL, NULL, 0); this->action = 11; this->drawConfig = 0; this->actor.shape.shadowAlpha = 0; @@ -514,8 +511,8 @@ void func_8098F480(DemoSa* this) { } } -void func_8098F50C(DemoSa* this, GlobalContext* globalCtx) { - func_8098E6EC(this, globalCtx, 4); +void func_8098F50C(DemoSa* this, PlayState* play) { + func_8098E6EC(this, play, 4); this->action = 12; this->drawConfig = 2; } @@ -544,10 +541,10 @@ void func_8098F610(DemoSa* this, s32 arg1) { } } -void func_8098F654(DemoSa* this, GlobalContext* globalCtx) { +void func_8098F654(DemoSa* this, PlayState* play) { s32 unk_1AC; s32 action; - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(globalCtx, 4); + CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, 4); if (npcAction != NULL) { action = npcAction->action; @@ -555,7 +552,7 @@ void func_8098F654(DemoSa* this, GlobalContext* globalCtx) { if (action != unk_1AC) { switch (action) { case 7: - func_8098F50C(this, globalCtx); + func_8098F50C(this, play); break; case 8: func_8098F590(this); @@ -571,47 +568,47 @@ void func_8098F654(DemoSa* this, GlobalContext* globalCtx) { } } -void func_8098F714(DemoSa* this, GlobalContext* globalCtx) { - func_8098F654(this, globalCtx); +void func_8098F714(DemoSa* this, PlayState* play) { + func_8098F654(this, play); } -void func_8098F734(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F734(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098E480(this); func_8098F480(this); func_8098F544(this); } -void func_8098F77C(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F77C(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098E480(this); - func_8098F654(this, globalCtx); + func_8098F654(this, play); } -void func_8098F7BC(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098F7BC(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098E480(this); - func_8098F654(this, globalCtx); + func_8098F654(this, play); } -void func_8098F7FC(DemoSa* this, GlobalContext* globalCtx) { +void func_8098F7FC(DemoSa* this, PlayState* play) { s32 sp1C; - func_8098E5C8(this, globalCtx); + func_8098E5C8(this, play); sp1C = DemoSa_UpdateSkelAnime(this); func_8098E480(this); func_8098F610(this, sp1C); } -void func_8098F83C(DemoSa* this, GlobalContext* globalCtx) { +void func_8098F83C(DemoSa* this, PlayState* play) { Vec3f* thisPos = &this->actor.world.pos; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitOnBridgeAnim, NULL, NULL, 0); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, thisPos->x, thisPos->y, thisPos->z, - 0, 0, 0, FAIRY_KOKIRI); + SkelAnime_InitFlex(play, &this->skelAnime, &gSariaSkel, &gSariaWaitOnBridgeAnim, NULL, NULL, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELF, thisPos->x, thisPos->y, thisPos->z, 0, 0, 0, + FAIRY_KOKIRI); this->action = 16; this->drawConfig = 0; this->actor.shape.shadowAlpha = 0; @@ -640,9 +637,9 @@ void func_8098F984(DemoSa* this) { this->actor.shape.shadowAlpha = 0; } -void func_8098F998(DemoSa* this, GlobalContext* globalCtx) { +void func_8098F998(DemoSa* this, PlayState* play) { if (this->unk_1AC == 4) { - func_8098E6EC(this, globalCtx, 1); + func_8098E6EC(this, play, 1); this->action = 17; this->drawConfig = 2; this->unk_1B0 = 0; @@ -689,10 +686,10 @@ void func_8098FB34(DemoSa* this, s32 arg1) { } } -void func_8098FB68(DemoSa* this, GlobalContext* globalCtx) { +void func_8098FB68(DemoSa* this, PlayState* play) { s32 unk_1AC; s32 action; - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(globalCtx, 1); + CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, 1); if (npcAction != NULL) { action = npcAction->action; @@ -703,7 +700,7 @@ void func_8098FB68(DemoSa* this, GlobalContext* globalCtx) { func_8098F984(this); break; case 12: - func_8098F998(this, globalCtx); + func_8098F998(this, play); break; case 13: func_8098FA84(this); @@ -719,69 +716,69 @@ void func_8098FB68(DemoSa* this, GlobalContext* globalCtx) { } } -void func_8098FC44(DemoSa* this, GlobalContext* globalCtx) { - func_8098FB68(this, globalCtx); +void func_8098FC44(DemoSa* this, PlayState* play) { + func_8098FB68(this, play); } -void func_8098FC64(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098FC64(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); func_8098F8F8(this); func_8098FA2C(this); } -void func_8098FC9C(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098FC9C(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); - func_8098FB68(this, globalCtx); + func_8098FB68(this, play); } -void func_8098FCD4(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098FCD4(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); DemoSa_UpdateSkelAnime(this); - func_8098FB68(this, globalCtx); + func_8098FB68(this, play); } -void func_8098FD0C(DemoSa* this, GlobalContext* globalCtx) { - func_8098E5C8(this, globalCtx); +void func_8098FD0C(DemoSa* this, PlayState* play) { + func_8098E5C8(this, play); func_8098FB34(this, DemoSa_UpdateSkelAnime(this)); - func_8098FB68(this, globalCtx); + func_8098FB68(this, play); } -void DemoSa_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoSa_Update(Actor* thisx, PlayState* play) { DemoSa* this = (DemoSa*)thisx; if (this->action < 0 || this->action >= 21 || sActionFuncs[this->action] == NULL) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void DemoSa_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoSa_Init(Actor* thisx, PlayState* play) { DemoSa* this = (DemoSa*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); switch (this->actor.params) { case 2: - func_8098ECF4(this, globalCtx); + func_8098ECF4(this, play); break; case 3: - func_8098F390(this, globalCtx); + func_8098F390(this, play); break; case 4: - func_8098F420(this, globalCtx); + func_8098F420(this, play); break; case 5: - func_8098F83C(this, globalCtx); + func_8098F83C(this, play); break; default: - func_8098E7FC(this, globalCtx); + func_8098E7FC(this, play); } } -s32 DemoSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 DemoSa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { DemoSa* this = (DemoSa*)thisx; if ((limbIndex == 15) && (this->unk_1B0 != 0)) { @@ -790,10 +787,10 @@ s32 DemoSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void DemoSa_DrawNothing(DemoSa* this, GlobalContext* globalCtx) { +void DemoSa_DrawNothing(DemoSa* this, PlayState* play) { } -void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx) { +void DemoSa_DrawOpa(DemoSa* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* eyeTex = sEyeTextures[eyeIndex]; @@ -802,9 +799,9 @@ void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthIndex]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa.c", 602); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_sa.c", 602); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -812,18 +809,18 @@ void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, DemoSa_OverrideLimbDraw, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa.c", 626); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_sa.c", 626); } -void DemoSa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoSa_Draw(Actor* thisx, PlayState* play) { DemoSa* this = (DemoSa*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h index dd3fe27db6..7801aca27a 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h @@ -6,8 +6,8 @@ struct DemoSa; -typedef void (*DemoSaActionFunc)(struct DemoSa*, GlobalContext*); -typedef void (*DemoSaDrawFunc)(struct DemoSa*, GlobalContext*); +typedef void (*DemoSaActionFunc)(struct DemoSa*, PlayState*); +typedef void (*DemoSaDrawFunc)(struct DemoSa*, PlayState*); typedef struct DemoSa { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c index 531badac42..ed0238f267 100644 --- a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c +++ b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c @@ -8,12 +8,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void DemoShd_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoShd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoShd_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoShd_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoShd_Init(Actor* thisx, PlayState* play); +void DemoShd_Destroy(Actor* thisx, PlayState* play); +void DemoShd_Update(Actor* thisx, PlayState* play); +void DemoShd_Draw(Actor* thisx, PlayState* play); -void func_80991298(DemoShd* this, GlobalContext* globalCtx); +void func_80991298(DemoShd* this, PlayState* play); const ActorInit Demo_Shd_InitVars = { ACTOR_DEMO_SHD, @@ -33,7 +33,7 @@ void DemoShd_SetupAction(DemoShd* this, DemoShdActionFunc actionFunc) { this->actionFunc = actionFunc; } -void DemoShd_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Init(Actor* thisx, PlayState* play) { DemoShd* this = (DemoShd*)thisx; this->unk_14C = 0; @@ -43,22 +43,22 @@ void DemoShd_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.x = 0.0f; } -void DemoShd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Destroy(Actor* thisx, PlayState* play) { } -void func_80991298(DemoShd* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[0] != NULL) || - (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[1] != NULL)) { - if (globalCtx->csCtx.frames == 800) { +void func_80991298(DemoShd* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[0] != NULL) || + (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[1] != NULL)) { + if (play->csCtx.frames == 800) { func_800F3F3C(9); } - if (globalCtx->csCtx.frames == 1069) { + if (play->csCtx.frames == 1069) { func_800F3F3C(8); } } - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction0 = globalCtx->csCtx.npcActions[0]; + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction0 = play->csCtx.npcActions[0]; if (npcAction0 != NULL) { if (npcAction0->action == 2) { @@ -72,8 +72,8 @@ void func_80991298(DemoShd* this, GlobalContext* globalCtx) { } } - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction1 = globalCtx->csCtx.npcActions[1]; + if (play->csCtx.state != CS_STATE_IDLE) { + CsCmdActorAction* npcAction1 = play->csCtx.npcActions[1]; if (npcAction1 != NULL) { if (npcAction1->action == 2) { @@ -90,36 +90,36 @@ void func_80991298(DemoShd* this, GlobalContext* globalCtx) { this->unk_14E++; } -void DemoShd_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Update(Actor* thisx, PlayState* play) { DemoShd* this = (DemoShd*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void DemoShd_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Draw(Actor* thisx, PlayState* play) { DemoShd* this = (DemoShd*)thisx; s32 pad; u32 unk_14E = this->unk_14E; if (1) {} // Necessary to match, can be anywhere in the function - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_shd.c", 726); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_shd.c", 726); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_shd.c", 729), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_shd.c", 729), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_809932D0); if (this->unk_14C & 1) { - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0x3FF - ((unk_14E * 5) & 0x3FF), - 16, 256, 1, 0, 255 - ((unk_14E * 5) & 255), 32, 32)); + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0x3FF - ((unk_14E * 5) & 0x3FF), 16, + 256, 1, 0, 255 - ((unk_14E * 5) & 255), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, D_80993390); } else if (this->unk_14C & 2) { - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0x3FF - ((unk_14E * 5) & 0x3FF), - 16, 256, 1, 0, 255 - ((unk_14E * 5) & 255), 32, 32)); + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0x3FF - ((unk_14E * 5) & 0x3FF), 16, + 256, 1, 0, 255 - ((unk_14E * 5) & 255), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, D_809934B8); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_shd.c", 762); + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_shd.c", 762); } diff --git a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h index 563d8b31ee..fe9198f624 100644 --- a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h +++ b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h @@ -6,7 +6,7 @@ struct DemoShd; -typedef void (*DemoShdActionFunc)(struct DemoShd*, GlobalContext*); +typedef void (*DemoShdActionFunc)(struct DemoShd*, PlayState*); typedef struct DemoShd { /* 0x0000 */ Actor actor; 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 1695d594b6..a2a22ff908 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 @@ -4,15 +4,15 @@ #define FLAGS ACTOR_FLAG_4 -void DemoTreLgt_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoTreLgt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoTreLgt_Init(Actor* thisx, PlayState* play); +void DemoTreLgt_Destroy(Actor* thisx, PlayState* play); +void DemoTreLgt_Update(Actor* thisx, PlayState* play); +void DemoTreLgt_Draw(Actor* thisx, PlayState* play); -void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx); +void func_80993848(DemoTreLgt* this, PlayState* play); void func_80993754(DemoTreLgt* this); -void func_8099375C(DemoTreLgt* this, GlobalContext* globalCtx); -void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame); +void func_8099375C(DemoTreLgt* this, PlayState* play); +void func_809937B4(DemoTreLgt* this, PlayState* play, f32 currentFrame); typedef struct { /* 0x00 */ f32 startFrame; @@ -45,10 +45,10 @@ static DemoTreLgtActionFunc sActionFuncs[] = { func_80993848, }; -void DemoTreLgt_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoTreLgt_Init(Actor* thisx, PlayState* play) { DemoTreLgt* this = (DemoTreLgt*)thisx; - if (!SkelCurve_Init(globalCtx, &this->skelCurve, &gTreasureChestCurveSkel, sAnimations[0])) { + if (!SkelCurve_Init(play, &this->skelCurve, &gTreasureChestCurveSkel, sAnimations[0])) { // "Demo_Tre_Lgt_Actor_ct (); Construct failed" osSyncPrintf("Demo_Tre_Lgt_Actor_ct();コンストラクト失敗\n"); } @@ -61,25 +61,25 @@ void DemoTreLgt_Init(Actor* thisx, GlobalContext* globalCtx) { func_80993754(this); } -void DemoTreLgt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoTreLgt_Destroy(Actor* thisx, PlayState* play) { DemoTreLgt* this = (DemoTreLgt*)thisx; - SkelCurve_Destroy(globalCtx, &this->skelCurve); + SkelCurve_Destroy(play, &this->skelCurve); } void func_80993754(DemoTreLgt* this) { this->action = DEMO_TRE_LGT_ACTION_WAIT; } -void func_8099375C(DemoTreLgt* this, GlobalContext* globalCtx) { +void func_8099375C(DemoTreLgt* this, PlayState* play) { EnBox* treasureChest = (EnBox*)this->actor.parent; if ((treasureChest != NULL) && Animation_OnFrame(&treasureChest->skelanime, 10.0f)) { - func_809937B4(this, globalCtx, treasureChest->skelanime.curFrame); + func_809937B4(this, play, treasureChest->skelanime.curFrame); } } -void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame) { +void func_809937B4(DemoTreLgt* this, PlayState* play, f32 currentFrame) { SkelCurve* skelCurve = &this->skelCurve; s32 pad[2]; @@ -88,10 +88,10 @@ void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame) SkelCurve_SetAnim(skelCurve, sAnimations[gSaveContext.linkAge], 1.0f, sDemoTreLgtInfo[gSaveContext.linkAge].endFrame + sDemoTreLgtInfo[gSaveContext.linkAge].unk_08, currentFrame, 1.0f); - SkelCurve_Update(globalCtx, skelCurve); + SkelCurve_Update(play, skelCurve); } -void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) { +void func_80993848(DemoTreLgt* this, PlayState* play) { f32 currentFrame = this->skelCurve.curFrame; if (currentFrame < sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].endFrame) { @@ -120,25 +120,25 @@ void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_EV_TRE_BOX_FLASH, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - if (SkelCurve_Update(globalCtx, &this->skelCurve)) { + if (SkelCurve_Update(play, &this->skelCurve)) { Actor_Kill(&this->actor); } } -void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoTreLgt_Update(Actor* thisx, PlayState* play) { DemoTreLgt* this = (DemoTreLgt*)thisx; - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -s32 DemoTreLgt_OverrideLimbDraw(GlobalContext* globalCtx, SkelCurve* skelCurve, s32 limbIndex, void* thisx) { +s32 DemoTreLgt_OverrideLimbDraw(PlayState* play, SkelCurve* skelCurve, s32 limbIndex, void* thisx) { s32 pad; DemoTreLgt* this = (DemoTreLgt*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_tre_lgt.c", 423); + OPEN_DISPS(play->state.gfxCtx, "../z_demo_tre_lgt.c", 423); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * 2) % 256, 0, 64, 32, 1, - (globalCtx->state.frames * -2) % 256, 0, 64, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (play->state.frames * 2) % 256, 0, 64, 32, 1, + (play->state.frames * -2) % 256, 0, 64, 32)); if (limbIndex == 1) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->unk_170); @@ -146,7 +146,7 @@ s32 DemoTreLgt_OverrideLimbDraw(GlobalContext* globalCtx, SkelCurve* skelCurve, gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->unk_174); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_tre_lgt.c", 448); + 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 @@ -159,8 +159,8 @@ s32 DemoTreLgt_OverrideLimbDraw(GlobalContext* globalCtx, SkelCurve* skelCurve, #endif } -void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void DemoTreLgt_Draw(Actor* thisx, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; DemoTreLgt* this = (DemoTreLgt*)thisx; OPEN_DISPS(gfxCtx, "../z_demo_tre_lgt.c", 461); @@ -171,7 +171,7 @@ void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80093D84(gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 200, 255, 0, 0); - SkelCurve_Draw(&this->actor, globalCtx, &this->skelCurve, DemoTreLgt_OverrideLimbDraw, NULL, 1, &this->actor); + SkelCurve_Draw(&this->actor, play, &this->skelCurve, DemoTreLgt_OverrideLimbDraw, NULL, 1, &this->actor); 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 77de6b720d..bd8e2e4df8 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 @@ -6,7 +6,7 @@ struct DemoTreLgt; -typedef void (*DemoTreLgtActionFunc)(struct DemoTreLgt*, GlobalContext*); +typedef void (*DemoTreLgtActionFunc)(struct DemoTreLgt*, PlayState*); typedef struct DemoTreLgt { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index f872dcc84f..de9fbe7e73 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_25 -void DoorAna_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorAna_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorAna_Update(Actor* thisx, GlobalContext* globalCtx); -void DoorAna_Draw(Actor* thisx, GlobalContext* globalCtx); +void DoorAna_Init(Actor* thisx, PlayState* play); +void DoorAna_Destroy(Actor* thisx, PlayState* play); +void DoorAna_Update(Actor* thisx, PlayState* play); +void DoorAna_Draw(Actor* thisx, PlayState* play); -void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx); -void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx); -void DoorAna_GrabPlayer(DoorAna* this, GlobalContext* globalCtx); +void DoorAna_WaitClosed(DoorAna* this, PlayState* play); +void DoorAna_WaitOpen(DoorAna* this, PlayState* play); +void DoorAna_GrabPlayer(DoorAna* this, PlayState* play); const ActorInit Door_Ana_InitVars = { ACTOR_DOOR_ANA, @@ -60,7 +60,7 @@ void DoorAna_SetupAction(DoorAna* this, DoorAnaActionFunc actionFunc) { this->actionFunc = actionFunc; } -void DoorAna_Init(Actor* thisx, GlobalContext* globalCtx) { +void DoorAna_Init(Actor* thisx, PlayState* play) { DoorAna* this = (DoorAna*)thisx; this->actor.shape.rot.z = 0; @@ -69,8 +69,8 @@ void DoorAna_Init(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.params & 0x300) != 0) { // only allocate collider for grottos that need bombing/hammering open if ((this->actor.params & 0x200) != 0) { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } else { this->actor.flags |= ACTOR_FLAG_4; } @@ -82,22 +82,22 @@ void DoorAna_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 0; } -void DoorAna_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorAna_Destroy(Actor* thisx, PlayState* play) { DoorAna* this = (DoorAna*)thisx; // free collider if it has one if ((this->actor.params & 0x200) != 0) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } // update routine for grottos that are currently "hidden"/unopened -void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { +void DoorAna_WaitClosed(DoorAna* this, PlayState* play) { u32 openGrotto = false; if (!(this->actor.params & 0x200)) { // opening with song of storms - if (this->actor.xyzDistToPlayerSq < SQ(200.0f) && Flags_GetEnv(globalCtx, 5)) { + if (this->actor.xyzDistToPlayerSq < SQ(200.0f) && Flags_GetEnv(play, 5)) { openGrotto = true; this->actor.flags &= ~ACTOR_FLAG_4; } @@ -105,10 +105,10 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { // bombing/hammering open a grotto if (this->collider.base.acFlags & AC_HIT) { openGrotto = true; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } else { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } // open the grotto @@ -118,30 +118,30 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - func_8002F5F0(&this->actor, globalCtx); + func_8002F5F0(&this->actor, play); } // update routine for grottos that are open -void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { +void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { Player* player; s32 destinationIdx; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) { - if ((this->actor.targetMode != 0) && (globalCtx->transitionTrigger == TRANS_TRIGGER_OFF) && + if ((this->actor.targetMode != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (player->stateFlags1 & PLAYER_STATE1_31) && (player->unk_84F == 0)) { destinationIdx = ((this->actor.params >> 0xC) & 7) - 1; - Play_SetupRespawnPoint(globalCtx, RESPAWN_MODE_RETURN, 0x4FF); + Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, 0x4FF); gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.world.pos.y; gSaveContext.respawn[RESPAWN_MODE_RETURN].yaw = this->actor.home.rot.y; gSaveContext.respawn[RESPAWN_MODE_RETURN].data = this->actor.params & 0xFFFF; if (destinationIdx < 0) { destinationIdx = this->actor.home.rot.z + 1; } - globalCtx->nextEntranceIndex = sGrottoEntrances[destinationIdx]; + play->nextEntranceIndex = sGrottoEntrances[destinationIdx]; DoorAna_SetupAction(this, DoorAna_GrabPlayer); } else { - if (!Player_InCsMode(globalCtx) && !(player->stateFlags1 & (PLAYER_STATE1_23 | PLAYER_STATE1_27)) && + if (!Player_InCsMode(play) && !(player->stateFlags1 & (PLAYER_STATE1_23 | PLAYER_STATE1_27)) && this->actor.xzDistToPlayer <= 15.0f && -50.0f <= this->actor.yDistToPlayer && this->actor.yDistToPlayer <= 15.0f) { player->stateFlags1 |= PLAYER_STATE1_31; @@ -155,31 +155,31 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { } // update function for after the player has triggered the grotto -void DoorAna_GrabPlayer(DoorAna* this, GlobalContext* globalCtx) { +void DoorAna_GrabPlayer(DoorAna* this, PlayState* play) { Player* player; if (this->actor.yDistToPlayer <= 0.0f && 15.0f < this->actor.xzDistToPlayer) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); player->actor.world.pos.x = Math_SinS(this->actor.yawTowardsPlayer) * 15.0f + this->actor.world.pos.x; player->actor.world.pos.z = Math_CosS(this->actor.yawTowardsPlayer) * 15.0f + this->actor.world.pos.z; } } -void DoorAna_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorAna_Update(Actor* thisx, PlayState* play) { DoorAna* this = (DoorAna*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); // changes the grottos facing angle based on camera angle - this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000; + this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000; } -void DoorAna_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_door_ana.c", 440); +void DoorAna_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_door_ana.c", 440); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_ana.c", 446), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_door_ana.c", 446), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGrottoDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_door_ana.c", 449); + CLOSE_DISPS(play->state.gfxCtx, "../z_door_ana.c", 449); } diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.h b/src/overlays/actors/ovl_Door_Ana/z_door_ana.h index 3ad932b624..51c24b84af 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.h +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.h @@ -6,7 +6,7 @@ struct DoorAna; -typedef void (*DoorAnaActionFunc)(struct DoorAna*, GlobalContext*); +typedef void (*DoorAnaActionFunc)(struct DoorAna*, PlayState*); typedef struct DoorAna { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c index d55981fccb..4e3ec936c1 100644 --- a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c +++ b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c @@ -9,15 +9,15 @@ #define FLAGS 0 -void DoorGerudo_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorGerudo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorGerudo_Update(Actor* thisx, GlobalContext* globalCtx); -void DoorGerudo_Draw(Actor* thisx, GlobalContext* globalCtx); +void DoorGerudo_Init(Actor* thisx, PlayState* play); +void DoorGerudo_Destroy(Actor* thisx, PlayState* play); +void DoorGerudo_Update(Actor* thisx, PlayState* play); +void DoorGerudo_Draw(Actor* thisx, PlayState* play); -void func_8099485C(DoorGerudo* this, GlobalContext* globalCtx); -s32 func_80994750(DoorGerudo* this, GlobalContext* globalCtx); -void func_8099496C(DoorGerudo* this, GlobalContext* globalCtx); -void func_809949C8(DoorGerudo* this, GlobalContext* globalCtx); +void func_8099485C(DoorGerudo* this, PlayState* play); +s32 func_80994750(DoorGerudo* this, PlayState* play); +void func_8099496C(DoorGerudo* this, PlayState* play); +void func_809949C8(DoorGerudo* this, PlayState* play); const ActorInit Door_Gerudo_InitVars = { ACTOR_DOOR_GERUDO, @@ -35,16 +35,16 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F(scale, 1, ICHAIN_STOP), }; -void DoorGerudo_Init(Actor* thisx, GlobalContext* globalCtx) { +void DoorGerudo_Init(Actor* thisx, PlayState* play) { s32 pad; DoorGerudo* this = (DoorGerudo*)thisx; CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); CollisionHeader_GetVirtual(&gGerudoCellDoorCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + if (Flags_GetSwitch(play, thisx->params & 0x3F)) { this->actionFunc = func_8099485C; thisx->world.pos.y = thisx->home.pos.y + 200.0f; } else { @@ -53,14 +53,14 @@ void DoorGerudo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void DoorGerudo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorGerudo_Destroy(Actor* thisx, PlayState* play) { DoorGerudo* this = (DoorGerudo*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -f32 func_809946BC(GlobalContext* globalCtx, DoorGerudo* this, f32 arg2, f32 arg3, f32 arg4) { - Player* player = GET_PLAYER(globalCtx); +f32 func_809946BC(PlayState* play, DoorGerudo* this, f32 arg2, f32 arg3, f32 arg4) { + Player* player = GET_PLAYER(play); Vec3f playerPos; Vec3f sp1C; @@ -76,13 +76,13 @@ f32 func_809946BC(GlobalContext* globalCtx, DoorGerudo* this, f32 arg2, f32 arg3 } } -s32 func_80994750(DoorGerudo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80994750(DoorGerudo* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp_f0; s16 rotYDiff; - if (!Player_InCsMode(globalCtx)) { - temp_f0 = func_809946BC(globalCtx, this, 0.0f, 20.0f, 15.0f); + if (!Player_InCsMode(play)) { + temp_f0 = func_809946BC(play, this, 0.0f, 20.0f, 15.0f); if (fabsf(temp_f0) < 40.0f) { rotYDiff = player->actor.shape.rot.y - this->dyna.actor.shape.rot.y; if (temp_f0 > 0.0f) { @@ -96,21 +96,21 @@ s32 func_80994750(DoorGerudo* this, GlobalContext* globalCtx) { return 0; } -void func_8099485C(DoorGerudo* this, GlobalContext* globalCtx) { +void func_8099485C(DoorGerudo* this, PlayState* play) { if (this->unk_164 != 0) { this->actionFunc = func_8099496C; gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] -= 1; - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } else { - s32 direction = func_80994750(this, globalCtx); + s32 direction = func_80994750(this, play); if (direction != 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] <= 0) { player->naviTextId = -0x203; - } else if (!Flags_GetCollectible(globalCtx, (this->dyna.actor.params >> 8) & 0x1F)) { + } else if (!Flags_GetCollectible(play, (this->dyna.actor.params >> 8) & 0x1F)) { player->naviTextId = -0x225; } else { player->doorType = PLAYER_DOORTYPE_SLIDING; @@ -122,39 +122,39 @@ void func_8099485C(DoorGerudo* this, GlobalContext* globalCtx) { } } -void func_8099496C(DoorGerudo* this, GlobalContext* globalCtx) { +void func_8099496C(DoorGerudo* this, PlayState* play) { if (DECR(this->unk_166) == 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); this->actionFunc = func_809949C8; } } -void func_809949C8(DoorGerudo* this, GlobalContext* globalCtx) { +void func_809949C8(DoorGerudo* this, PlayState* play) { Math_StepToF(&this->dyna.actor.velocity.y, 15.0f, 3.0f); Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, this->dyna.actor.velocity.y); } -void DoorGerudo_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorGerudo_Update(Actor* thisx, PlayState* play) { DoorGerudo* this = (DoorGerudo*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void DoorGerudo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DoorGerudo_Draw(Actor* thisx, PlayState* play) { DoorGerudo* this = (DoorGerudo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_door_gerudo.c", 361); + OPEN_DISPS(play->state.gfxCtx, "../z_door_gerudo.c", 361); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_gerudo.c", 365), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_door_gerudo.c", 365), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGerudoCellDoorDL); if (this->unk_166 != 0) { Matrix_Scale(0.01f, 0.01f, 0.025f, MTXMODE_APPLY); - Actor_DrawDoorLock(globalCtx, this->unk_166, DOORLOCK_NORMAL); + Actor_DrawDoorLock(play, this->unk_166, DOORLOCK_NORMAL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_door_gerudo.c", 377); + CLOSE_DISPS(play->state.gfxCtx, "../z_door_gerudo.c", 377); } diff --git a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h index 3c6fac3947..fc545e0e0e 100644 --- a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h +++ b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h @@ -6,7 +6,7 @@ struct DoorGerudo; -typedef void (*DoorGerudoActionFunc)(struct DoorGerudo*, GlobalContext*); +typedef void (*DoorGerudoActionFunc)(struct DoorGerudo*, PlayState*); typedef struct DoorGerudo { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c index 9307674efb..10fa7af7e5 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -21,13 +21,13 @@ typedef enum { /* 4 */ DOOR_KILLER_RUBBLE_PIECE_4 } DoorKillerBehaviour; -void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorKiller_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorKiller_Update(Actor* thisx, GlobalContext* globalCtx); -void DoorKiller_Wait(DoorKiller* this, GlobalContext* globalCtx); -void DoorKiller_SetProperties(DoorKiller* this, GlobalContext* globalCtx); -void DoorKiller_DrawDoor(Actor* thisx, GlobalContext* globalCtx); -void DoorKiller_DrawRubble(Actor* thisx, GlobalContext* globalCtx); +void DoorKiller_Init(Actor* thisx, PlayState* play); +void DoorKiller_Destroy(Actor* thisx, PlayState* play); +void DoorKiller_Update(Actor* thisx, PlayState* play); +void DoorKiller_Wait(DoorKiller* this, PlayState* play); +void DoorKiller_SetProperties(DoorKiller* this, PlayState* play); +void DoorKiller_DrawDoor(Actor* thisx, PlayState* play); +void DoorKiller_DrawRubble(Actor* thisx, PlayState* play); const ActorInit Door_Killer_InitVars = { ACTOR_DOOR_KILLER, @@ -95,8 +95,8 @@ static DoorKillerTextureEntry sDoorTextures[4] = { { OBJECT_GAMEPLAY_KEEP, gWoodenDoorTex }, }; -void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DoorKiller_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; f32 randF; DoorKiller* this = (DoorKiller*)thisx; s32 bankIndex; @@ -105,7 +105,7 @@ void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { // Look in the object bank for one of the four objects containing door textures bankIndex = -1; for (i = 0; bankIndex < 0; i++) { - bankIndex = Object_GetIndex(&globalCtx->objectCtx, sDoorTextures[i].objectId); + bankIndex = Object_GetIndex(&play->objectCtx, sDoorTextures[i].objectId); this->textureEntryIndex = i; } osSyncPrintf("bank_ID = %d\n", bankIndex); @@ -124,19 +124,19 @@ void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { case DOOR_KILLER_DOOR: // `jointTable` is used for both the `jointTable` and `morphTable` args here. Because this actor doesn't // play any animations it does not cause problems, but it would need to be changed otherwise. - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_door_killer_Skel_001BC8, NULL, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_door_killer_Skel_001BC8, NULL, this->jointTable, this->jointTable, 9); this->actionFunc = DoorKiller_SetProperties; - DoorKiller_SetProperties(this, globalCtx); + DoorKiller_SetProperties(this, play); // manually set the overall rotation of the door this->jointTable[1].x = this->jointTable[1].z = 0x4000; // Set a cylinder collider to detect link attacks and larger sphere collider to detect explosions - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); - Collider_InitJntSph(globalCtx, &this->colliderJntSph); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphItems); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphItems); this->colliderJntSph.elements[0].dim.worldSphere.radius = 80; this->colliderJntSph.elements[0].dim.worldSphere.center.x = (s16)this->actor.world.pos.x; this->colliderJntSph.elements[0].dim.worldSphere.center.y = (s16)this->actor.world.pos.y + 50; @@ -144,7 +144,7 @@ void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { // If tied to a switch flag and that switch flag is already set, kill the actor. if ((((this->actor.params >> 8) & 0x3F) != 0x3F) && - Flags_GetSwitch(globalCtx, ((this->actor.params >> 8) & 0x3F))) { + Flags_GetSwitch(play, ((this->actor.params >> 8) & 0x3F))) { Actor_Kill(&this->actor); } break; @@ -153,7 +153,7 @@ void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { case DOOR_KILLER_RUBBLE_PIECE_3: case DOOR_KILLER_RUBBLE_PIECE_4: this->actionFunc = DoorKiller_SetProperties; - DoorKiller_SetProperties(this, globalCtx); + DoorKiller_SetProperties(this, play); this->actor.gravity = -0.6f; this->actor.minVelocityY = -6.0f; @@ -176,34 +176,34 @@ void DoorKiller_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void DoorKiller_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_Destroy(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; if ((thisx->params & 0xFF) == DOOR_KILLER_DOOR) { - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroyJntSph(play, &this->colliderJntSph); } } -void DoorKiller_SpawnRubble(Actor* thisx, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_KILLER, thisx->world.pos.x, thisx->world.pos.y + 9.0f, +void DoorKiller_SpawnRubble(Actor* thisx, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_KILLER, thisx->world.pos.x, thisx->world.pos.y + 9.0f, thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, thisx->shape.rot.z, DOOR_KILLER_RUBBLE_PIECE_1); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_KILLER, thisx->world.pos.x + 7.88f, - thisx->world.pos.y + 39.8f, thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, - thisx->shape.rot.z, DOOR_KILLER_RUBBLE_PIECE_2); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_KILLER, thisx->world.pos.x - 15.86f, - thisx->world.pos.y + 61.98f, thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, - thisx->shape.rot.z, DOOR_KILLER_RUBBLE_PIECE_3); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_KILLER, thisx->world.pos.x + 3.72f, - thisx->world.pos.y + 85.1f, thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, - thisx->shape.rot.z, DOOR_KILLER_RUBBLE_PIECE_4); + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_KILLER, thisx->world.pos.x + 7.88f, thisx->world.pos.y + 39.8f, + thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, thisx->shape.rot.z, + DOOR_KILLER_RUBBLE_PIECE_2); + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_KILLER, thisx->world.pos.x - 15.86f, thisx->world.pos.y + 61.98f, + thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, thisx->shape.rot.z, + DOOR_KILLER_RUBBLE_PIECE_3); + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_KILLER, thisx->world.pos.x + 3.72f, thisx->world.pos.y + 85.1f, + thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, thisx->shape.rot.z, + DOOR_KILLER_RUBBLE_PIECE_4); } /** * action function for the individual door pieces that spawn and fall down when the door is destroyed */ -void DoorKiller_FallAsRubble(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_FallAsRubble(DoorKiller* this, PlayState* play) { this->actor.velocity.y += this->actor.gravity; if (this->actor.velocity.y < this->actor.minVelocityY) { this->actor.velocity.y = this->actor.minVelocityY; @@ -225,7 +225,7 @@ void DoorKiller_FallAsRubble(DoorKiller* this, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); } -s32 DoorKiller_IsHit(Actor* thisx, GlobalContext* globalCtx) { +s32 DoorKiller_IsHit(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; if ((this->colliderCylinder.base.acFlags & 2) && (this->colliderCylinder.info.acHitInfo != NULL)) { return true; @@ -233,18 +233,18 @@ s32 DoorKiller_IsHit(Actor* thisx, GlobalContext* globalCtx) { return false; } -void DoorKiller_SetAC(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_SetAC(DoorKiller* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } -void DoorKiller_Die(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_Die(DoorKiller* this, PlayState* play) { s32 switchFlag = (this->actor.params >> 8) & 0x3F; // Can set a switch flag on death based on params if (switchFlag != 0x3F) { - Flags_SetSwitch(globalCtx, switchFlag); + Flags_SetSwitch(play, switchFlag); } Actor_Kill(&this->actor); } @@ -252,7 +252,7 @@ void DoorKiller_Die(DoorKiller* this, GlobalContext* globalCtx) { /** * After slamming on the floor, rise back upright */ -void DoorKiller_RiseBackUp(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_RiseBackUp(DoorKiller* this, PlayState* play) { s32 i; s16 rotation; @@ -261,7 +261,7 @@ void DoorKiller_RiseBackUp(DoorKiller* this, GlobalContext* globalCtx) { } else { this->actionFunc = DoorKiller_Wait; this->timer = 16; - DoorKiller_SetAC(this, globalCtx); + DoorKiller_SetAC(this, play); return; } @@ -293,7 +293,7 @@ void DoorKiller_RiseBackUp(DoorKiller* this, GlobalContext* globalCtx) { * After wobbling, fall over and slam onto the floor, damaging the player if they are in the way. Uses manual distance * check for damaging player, not AT system. */ -void DoorKiller_FallOver(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_FallOver(DoorKiller* this, PlayState* play) { s32 i; s16 rotation; @@ -342,17 +342,17 @@ void DoorKiller_FallOver(DoorKiller* this, GlobalContext* globalCtx) { pos.x += this->actor.world.pos.x; pos.y += this->actor.world.pos.y; pos.z += this->actor.world.pos.z; - func_8002865C(globalCtx, &pos, &velocity, &accel, 300, 30); + func_8002865C(play, &pos, &velocity, &accel, 300, 30); } } if (!(this->hasHitPlayerOrGround & 1)) { Vec3f playerPosRelToDoor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); func_8002DBD0(&this->actor, &playerPosRelToDoor, &player->actor.world.pos); if ((fabsf(playerPosRelToDoor.y) < 20.0f) && (fabsf(playerPosRelToDoor.x) < 20.0f) && (playerPosRelToDoor.z < 100.0f) && (playerPosRelToDoor.z > 0.0f)) { this->hasHitPlayerOrGround |= 1; - func_8002F6D4(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f, 16); + func_8002F6D4(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f, 16); Audio_PlayActorSound2(&this->actor, NA_SE_EN_KDOOR_HIT); func_8002F7DC(&player->actor, NA_SE_PL_BODY_HIT); } @@ -366,7 +366,7 @@ void DoorKiller_FallOver(DoorKiller* this, GlobalContext* globalCtx) { /** * Wobble around, signifying the door is about to fall over. Does not set AC and so cannot be destroyed during this. */ -void DoorKiller_Wobble(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_Wobble(DoorKiller* this, PlayState* play) { s16 rotation; s32 i; @@ -396,7 +396,7 @@ void DoorKiller_Wobble(DoorKiller* this, GlobalContext* globalCtx) { /** * Idle while the player attempts to open the door and then begin to wobble */ -void DoorKiller_WaitBeforeWobble(DoorKiller* this, GlobalContext* globalCtx) { +void DoorKiller_WaitBeforeWobble(DoorKiller* this, PlayState* play) { if (this->timer > 0) { this->timer--; } else { @@ -405,8 +405,8 @@ void DoorKiller_WaitBeforeWobble(DoorKiller* this, GlobalContext* globalCtx) { } } -void DoorKiller_Wait(DoorKiller* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorKiller_Wait(DoorKiller* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f playerPosRelToDoor; s16 angleToFacingPlayer; @@ -420,22 +420,22 @@ void DoorKiller_Wait(DoorKiller* this, GlobalContext* globalCtx) { return; } - if (DoorKiller_IsHit(&this->actor, globalCtx)) { + if (DoorKiller_IsHit(&this->actor, play)) { // AC cylinder: wobble if hit by most weapons, die if hit by explosives or hammer if ((this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0x1FFA6) != 0) { this->timer = 16; this->actionFunc = DoorKiller_Wobble; } else if ((this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0x48) != 0) { - DoorKiller_SpawnRubble(&this->actor, globalCtx); + DoorKiller_SpawnRubble(&this->actor, play); this->actionFunc = DoorKiller_Die; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_KDOOR_BREAK); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_KDOOR_BREAK); } - } else if (Actor_GetCollidedExplosive(globalCtx, &this->colliderJntSph.base) != NULL) { + } else if (Actor_GetCollidedExplosive(play, &this->colliderJntSph.base) != NULL) { // AC sphere: die if hit by explosive - DoorKiller_SpawnRubble(&this->actor, globalCtx); + DoorKiller_SpawnRubble(&this->actor, play); this->actionFunc = DoorKiller_Die; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_KDOOR_BREAK); - } else if (!Player_InCsMode(globalCtx) && (fabsf(playerPosRelToDoor.y) < 20.0f) && + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_KDOOR_BREAK); + } else if (!Player_InCsMode(play) && (fabsf(playerPosRelToDoor.y) < 20.0f) && (fabsf(playerPosRelToDoor.x) < 20.0f) && (playerPosRelToDoor.z < 50.0f) && (playerPosRelToDoor.z > 0.0f)) { // Set player properties to make the door openable if within range @@ -450,27 +450,27 @@ void DoorKiller_Wait(DoorKiller* this, GlobalContext* globalCtx) { } } - DoorKiller_SetAC(this, globalCtx); + DoorKiller_SetAC(this, play); } /** * Grabs the virtual address of the texture from the relevant door object */ -void DoorKiller_UpdateTexture(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_UpdateTexture(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->doorObjBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->doorObjBankIndex].segment); this->texture = SEGMENTED_TO_VIRTUAL(this->texture); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[thisx->objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[thisx->objBankIndex].segment); } /** * Gets the correct door texture, defines the appropriate draw fucntion and action function based on type behaviour * (door or rubble). */ -void DoorKiller_SetProperties(DoorKiller* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->doorObjBankIndex)) { - DoorKiller_UpdateTexture(&this->actor, globalCtx); +void DoorKiller_SetProperties(DoorKiller* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->doorObjBankIndex)) { + DoorKiller_UpdateTexture(&this->actor, play); switch (this->actor.params & 0xFF) { case DOOR_KILLER_DOOR: this->actionFunc = DoorKiller_Wait; @@ -487,38 +487,38 @@ void DoorKiller_SetProperties(DoorKiller* this, GlobalContext* globalCtx) { } } -void DoorKiller_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_Update(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void DoorKiller_SetTexture(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_SetTexture(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; void* doorTexture = this->texture; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_door_killer.c", 883); + OPEN_DISPS(play->state.gfxCtx, "../z_door_killer.c", 883); gSPSegment(POLY_OPA_DISP++, 0x08, doorTexture); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_door_killer.c", 885); + CLOSE_DISPS(play->state.gfxCtx, "../z_door_killer.c", 885); } -void DoorKiller_DrawDoor(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_DrawDoor(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - DoorKiller_SetTexture(&this->actor, globalCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, NULL); + func_800943C8(play->state.gfxCtx); + DoorKiller_SetTexture(&this->actor, play); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, NULL); } -void DoorKiller_DrawRubble(Actor* thisx, GlobalContext* globalCtx) { +void DoorKiller_DrawRubble(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { object_door_killer_DL_001250, object_door_killer_DL_001550, object_door_killer_DL_0017B8, object_door_killer_DL_001A58 }; s32 rubblePieceIndex = (thisx->params & 0xFF) - 1; DoorKiller* this = (DoorKiller*)thisx; if ((this->timer >= 20) || ((this->timer & 1) == 0)) { - DoorKiller_SetTexture(thisx, globalCtx); - Gfx_DrawDListOpa(globalCtx, dLists[rubblePieceIndex]); + DoorKiller_SetTexture(thisx, play); + Gfx_DrawDListOpa(play, dLists[rubblePieceIndex]); } } diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.h b/src/overlays/actors/ovl_Door_Killer/z_door_killer.h index 246552f13c..2fe74808b8 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.h +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.h @@ -16,7 +16,7 @@ typedef struct { struct DoorKiller; -typedef void (*DoorKillerActionFunc)(struct DoorKiller*, GlobalContext*); +typedef void (*DoorKillerActionFunc)(struct DoorKiller*, PlayState*); typedef struct DoorKiller { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 6fd5523c68..c98336d761 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -26,26 +26,26 @@ #define FLAGS ACTOR_FLAG_4 -void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorShutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorShutter_Update(Actor* thisx, GlobalContext* globalCtx); -void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void DoorShutter_Init(Actor* thisx, PlayState* play); +void DoorShutter_Destroy(Actor* thisx, PlayState* play); +void DoorShutter_Update(Actor* thisx, PlayState* play); +void DoorShutter_Draw(Actor* thisx, PlayState* play); -void func_8099803C(GlobalContext* globalCtx, s16 y, s16 countdown, s16 camId); -void DoorShutter_SetupType(DoorShutter* this, GlobalContext* globalCtx); -void func_80996A54(DoorShutter* this, GlobalContext* globalCtx); -void func_80996B00(DoorShutter* this, GlobalContext* globalCtx); -void func_80996B0C(DoorShutter* this, GlobalContext* globalCtx); -void func_80996EE8(DoorShutter* this, GlobalContext* globalCtx); -void func_80996F98(DoorShutter* this, GlobalContext* globalCtx); -void func_80997004(DoorShutter* this, GlobalContext* globalCtx); -void func_80997150(DoorShutter* this, GlobalContext* globalCtx); -void func_809973E8(DoorShutter* this, GlobalContext* globalCtx); -void func_80997528(DoorShutter* this, GlobalContext* globalCtx); -void func_80997568(DoorShutter* this, GlobalContext* globalCtx); -void func_809975C0(DoorShutter* this, GlobalContext* globalCtx); -void func_809976B8(DoorShutter* this, GlobalContext* globalCtx); -void func_80997744(DoorShutter* this, GlobalContext* globalCtx); +void func_8099803C(PlayState* play, s16 y, s16 countdown, s16 camId); +void DoorShutter_SetupType(DoorShutter* this, PlayState* play); +void func_80996A54(DoorShutter* this, PlayState* play); +void func_80996B00(DoorShutter* this, PlayState* play); +void func_80996B0C(DoorShutter* this, PlayState* play); +void func_80996EE8(DoorShutter* this, PlayState* play); +void func_80996F98(DoorShutter* this, PlayState* play); +void func_80997004(DoorShutter* this, PlayState* play); +void func_80997150(DoorShutter* this, PlayState* play); +void func_809973E8(DoorShutter* this, PlayState* play); +void func_80997528(DoorShutter* this, PlayState* play); +void func_80997568(DoorShutter* this, PlayState* play); +void func_809975C0(DoorShutter* this, PlayState* play); +void func_809976B8(DoorShutter* this, PlayState* play); +void func_80997744(DoorShutter* this, PlayState* play); const ActorInit Door_Shutter_InitVars = { ACTOR_DOOR_SHUTTER, @@ -173,8 +173,8 @@ void DoorShutter_SetupAction(DoorShutter* this, DoorShutterActionFunc actionFunc this->unk_16F = 0; } -s32 DoorShutter_SetupDoor(DoorShutter* this, GlobalContext* globalCtx) { - TransitionActorEntry* transitionEntry = &globalCtx->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA]; +s32 DoorShutter_SetupDoor(DoorShutter* this, PlayState* play) { + TransitionActorEntry* transitionEntry = &play->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA]; s8 frontRoom = transitionEntry->sides[0].room; s32 doorType = this->doorType; ShutterObjectInfo* temp_t0 = &sObjectInfo[this->unk_16B]; @@ -196,13 +196,13 @@ s32 DoorShutter_SetupDoor(DoorShutter* this, GlobalContext* globalCtx) { this->unk_16C = (doorType == SHUTTER) ? temp_t0->index1 : temp_t0->index2; if (doorType == SHUTTER_FRONT_CLEAR) { - if (!Flags_GetClear(globalCtx, this->dyna.actor.room)) { + if (!Flags_GetClear(play, this->dyna.actor.room)) { DoorShutter_SetupAction(this, func_80996A54); this->unk_170 = 1.0f; return true; } } else if (doorType == SHUTTER_FRONT_SWITCH || doorType == SHUTTER_FRONT_SWITCH_BACK_CLEAR) { - if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (!Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { DoorShutter_SetupAction(this, func_80996EE8); this->unk_170 = 1.0f; return true; @@ -217,9 +217,9 @@ s32 DoorShutter_SetupDoor(DoorShutter* this, GlobalContext* globalCtx) { return false; } -void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { +void DoorShutter_Init(Actor* thisx, PlayState* play2) { DoorShutter* this = (DoorShutter*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 phi_a3; s32 pad; s32 objectIndex; @@ -234,7 +234,7 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { ShutterSceneInfo* phi_v1; for (phi_v1 = &sSceneInfo[0], i = 0; i < ARRAY_COUNT(sSceneInfo) - 1; i++, phi_v1++) { - if (globalCtx->sceneNum == phi_v1->sceneNum) { + if (play->sceneNum == phi_v1->sceneNum) { break; } } @@ -243,7 +243,7 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { BossDoorInfo* phi_v1_2; for (phi_v1_2 = &D_80998288[0], i = 0; i < ARRAY_COUNT(D_80998288) - 1; i++, phi_v1_2++) { - if (globalCtx->sceneNum == phi_v1_2->dungeonScene || globalCtx->sceneNum == phi_v1_2->bossScene) { + if (play->sceneNum == phi_v1_2->dungeonScene || play->sceneNum == phi_v1_2->bossScene) { break; } } @@ -251,7 +251,7 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { } else { this->dyna.actor.room = -1; } - if (this->requiredObjBankIndex = objectIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectInfo[phi_a3].objectId), + if (this->requiredObjBankIndex = objectIndex = Object_GetIndex(&play->objectCtx, sObjectInfo[phi_a3].objectId), (s8)objectIndex < 0) { Actor_Kill(&this->dyna.actor); return; @@ -259,7 +259,7 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { DoorShutter_SetupAction(this, DoorShutter_SetupType); this->unk_16B = phi_a3; if (this->doorType == SHUTTER_KEY_LOCKED || this->doorType == SHUTTER_BOSS) { - if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (!Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { this->unk_16E = 10; } Actor_SetFocus(&this->dyna.actor, 60.0f); @@ -273,29 +273,29 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void DoorShutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorShutter_Destroy(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if (this->dyna.actor.room >= 0) { s32 transitionActorId = (u16)this->dyna.actor.params >> 0xA; - globalCtx->transiActorCtx.list[transitionActorId].id *= -1; + play->transiActorCtx.list[transitionActorId].id *= -1; } } -void DoorShutter_SetupType(DoorShutter* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { +void DoorShutter_SetupType(DoorShutter* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { this->dyna.actor.objBankIndex = this->requiredObjBankIndex; if (this->doorType == SHUTTER_PG_BARS || this->doorType == SHUTTER_GOHMA_BLOCK) { // Init dynapoly for shutters of the type that uses it CollisionHeader* colHeader = NULL; - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); this->unk_16C = sObjectInfo[this->unk_16B].index1; CollisionHeader_GetVirtual((this->doorType == SHUTTER_GOHMA_BLOCK) ? &gGohmaDoorCol : &gPhantomGanonBarsCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->doorType == SHUTTER_GOHMA_BLOCK) { this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.gravity = -2.0f; @@ -306,16 +306,16 @@ void DoorShutter_SetupType(DoorShutter* this, GlobalContext* globalCtx) { this->unk_164 = 7; } } else { - DoorShutter_SetupDoor(this, globalCtx); + DoorShutter_SetupDoor(this, play); } } } -f32 func_80996840(GlobalContext* globalCtx, DoorShutter* this, f32 arg2, f32 arg3, f32 arg4) { +f32 func_80996840(PlayState* play, DoorShutter* this, f32 arg2, f32 arg3, f32 arg4) { s32 pad; Vec3f sp28; Vec3f sp1C; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); sp28.x = player->actor.world.pos.x; sp28.y = player->actor.world.pos.y + arg2; @@ -328,12 +328,12 @@ f32 func_80996840(GlobalContext* globalCtx, DoorShutter* this, f32 arg2, f32 arg } } -s32 func_809968D4(DoorShutter* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_809968D4(DoorShutter* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { ShutterInfo* temp_v1 = &sShutterInfo[this->unk_16C]; - f32 temp_f2 = func_80996840(globalCtx, this, (this->unk_16C != 3) ? 0.0f : 80.0f, temp_v1->e, temp_v1->f); + f32 temp_f2 = func_80996840(play, this, (this->unk_16C != 3) ? 0.0f : 80.0f, temp_v1->e, temp_v1->f); if (fabsf(temp_f2) < 50.0f) { s16 phi_v0 = player->actor.shape.rot.y - this->dyna.actor.shape.rot.y; @@ -349,29 +349,29 @@ s32 func_809968D4(DoorShutter* this, GlobalContext* globalCtx) { return 0.0f; } -void func_80996A54(DoorShutter* this, GlobalContext* globalCtx) { - if (Flags_GetClear(globalCtx, this->dyna.actor.room) || Flags_GetTempClear(globalCtx, this->dyna.actor.room)) { - Flags_SetClear(globalCtx, this->dyna.actor.room); +void func_80996A54(DoorShutter* this, PlayState* play) { + if (Flags_GetClear(play, this->dyna.actor.room) || Flags_GetTempClear(play, this->dyna.actor.room)) { + Flags_SetClear(play, this->dyna.actor.room); DoorShutter_SetupAction(this, func_80997150); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); - OnePointCutscene_Attention(globalCtx, &GET_PLAYER(globalCtx)->actor); + OnePointCutscene_Attention(play, &this->dyna.actor); + OnePointCutscene_Attention(play, &GET_PLAYER(play)->actor); this->unk_16F = -100; - } else if (func_809968D4(this, globalCtx) != 0) { - Player* player = GET_PLAYER(globalCtx); + } else if (func_809968D4(this, play) != 0) { + Player* player = GET_PLAYER(play); player->naviTextId = -0x202; } } -void func_80996B00(DoorShutter* this, GlobalContext* globalCtx) { +void func_80996B00(DoorShutter* this, PlayState* play) { } -void func_80996B0C(DoorShutter* this, GlobalContext* globalCtx) { +void func_80996B0C(DoorShutter* this, PlayState* play) { if (this->unk_164 != 0) { DoorShutter_SetupAction(this, func_80997004); this->dyna.actor.velocity.y = 0.0f; if (this->unk_16E != 0) { - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); if (this->doorType != SHUTTER_BOSS) { gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); @@ -380,10 +380,10 @@ void func_80996B0C(DoorShutter* this, GlobalContext* globalCtx) { } } } else { - s32 doorDirection = func_809968D4(this, globalCtx); + s32 doorDirection = func_809968D4(this, play); if (doorDirection != 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->unk_16E != 0) { if (this->doorType == SHUTTER_BOSS) { @@ -404,28 +404,27 @@ void func_80996B0C(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_80996C60(DoorShutter* this, GlobalContext* globalCtx) { +void func_80996C60(DoorShutter* this, PlayState* play) { if (this->dyna.actor.category == ACTORCAT_DOOR) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 sp38 = this->unk_16C; s32 sp34 = 0xF; - if (DoorShutter_SetupDoor(this, globalCtx)) { + if (DoorShutter_SetupDoor(this, play)) { sp34 = 0x20; } DoorShutter_SetupAction(this, func_80997004); this->unk_16C = sp38; this->unk_170 = 0.0f; - Camera_ChangeDoorCam(globalCtx->cameraPtrs[CAM_ID_MAIN], &this->dyna.actor, player->unk_46A, 0.0f, 12, sp34, - 10); + Camera_ChangeDoorCam(play->cameraPtrs[CAM_ID_MAIN], &this->dyna.actor, player->unk_46A, 0.0f, 12, sp34, 10); } } -s32 func_80996D14(DoorShutter* this, GlobalContext* globalCtx) { +s32 func_80996D14(DoorShutter* this, PlayState* play) { if (this->unk_16C != 3) { if (this->dyna.actor.velocity.y == 0.0f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); - func_80996C60(this, globalCtx); + func_80996C60(this, play); } Math_StepToF(&this->dyna.actor.velocity.y, 15.0f, 3.0f); if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, @@ -435,7 +434,7 @@ s32 func_80996D14(DoorShutter* this, GlobalContext* globalCtx) { } else { if (this->unk_166 == 100) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYODOOR_OPEN); - func_80996C60(this, globalCtx); + func_80996C60(this, play); } if (Math_StepToS(&this->unk_166, 0, 10)) { return true; @@ -444,7 +443,7 @@ s32 func_80996D14(DoorShutter* this, GlobalContext* globalCtx) { return false; } -s32 func_80996E08(DoorShutter* this, GlobalContext* globalCtx, f32 arg2) { +s32 func_80996E08(DoorShutter* this, PlayState* play, f32 arg2) { if (this->unk_170 == 1.0f - arg2) { if (this->unk_16C != 3) { if (arg2 == 1.0f) { @@ -466,32 +465,32 @@ s32 func_80996E08(DoorShutter* this, GlobalContext* globalCtx, f32 arg2) { return false; } -void func_80996EE8(DoorShutter* this, GlobalContext* globalCtx) { - if (func_80996E08(this, globalCtx, 1.0f)) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { +void func_80996EE8(DoorShutter* this, PlayState* play) { + if (func_80996E08(this, play, 1.0f)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { DoorShutter_SetupAction(this, func_80997150); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->unk_16F = -100; - } else if (func_809968D4(this, globalCtx)) { - Player* player = GET_PLAYER(globalCtx); + } else if (func_809968D4(this, play)) { + Player* player = GET_PLAYER(play); // Jabu navi text for switch doors is different - player->naviTextId = (globalCtx->sceneNum == SCENE_BDAN) ? -0x20B : -0x202; + player->naviTextId = (play->sceneNum == SCENE_BDAN) ? -0x20B : -0x202; } } } -void func_80996F98(DoorShutter* this, GlobalContext* globalCtx) { - if (this->unk_164 == 0 && !Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { +void func_80996F98(DoorShutter* this, PlayState* play) { + if (this->unk_164 == 0 && !Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { DoorShutter_SetupAction(this, func_80996EE8); } else { - func_80996B0C(this, globalCtx); + func_80996B0C(this, play); } } -void func_80997004(DoorShutter* this, GlobalContext* globalCtx) { - if (DECR(this->unk_16E) == 0 && globalCtx->roomCtx.status == 0 && func_80996D14(this, globalCtx) != 0) { +void func_80997004(DoorShutter* this, PlayState* play) { + if (DECR(this->unk_16E) == 0 && play->roomCtx.status == 0 && func_80996D14(this, play) != 0) { if (((this->doorType == SHUTTER_BOSS) ? 20.0f : 50.0f) < this->dyna.actor.xzDistToPlayer) { - if (DoorShutter_SetupDoor(this, globalCtx)) { + if (DoorShutter_SetupDoor(this, play)) { this->dyna.actor.velocity.y = 30.0f; } if (this->unk_16C != 3) { @@ -500,7 +499,7 @@ void func_80997004(DoorShutter* this, GlobalContext* globalCtx) { } else { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYODOOR_CLOSE); if ((this->doorType == SHUTTER_FRONT_SWITCH || this->doorType == SHUTTER_FRONT_SWITCH_BACK_CLEAR) && - !Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + !Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSHUTTER_CLOSE); } DoorShutter_SetupAction(this, func_80997528); @@ -509,10 +508,10 @@ void func_80997004(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_80997150(DoorShutter* this, GlobalContext* globalCtx) { +void func_80997150(DoorShutter* this, PlayState* play) { if (this->unk_16F != 0) { if (this->unk_16F < 0) { - if (globalCtx->state.frames % 2 != 0) { + if (play->state.frames % 2 != 0) { this->unk_16F++; } if (this->dyna.actor.category == func_8005B198() || this->unk_16F == 0) { @@ -521,7 +520,7 @@ void func_80997150(DoorShutter* this, GlobalContext* globalCtx) { } else { this->unk_16F--; } - } else if (func_80996E08(this, globalCtx, 0.0f)) { + } else if (func_80996E08(this, play, 0.0f)) { if (!(this->doorType == SHUTTER || this->doorType == SHUTTER_FRONT_CLEAR)) { DoorShutter_SetupAction(this, func_80996F98); } else { @@ -531,8 +530,8 @@ void func_80997150(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_80997220(DoorShutter* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80997220(DoorShutter* this, PlayState* play) { + Player* player = GET_PLAYER(play); s8 room = this->dyna.actor.room; if (this->dyna.actor.room >= 0) { @@ -540,26 +539,26 @@ void func_80997220(DoorShutter* this, GlobalContext* globalCtx) { func_8002DBD0(&this->dyna.actor, &vec, &player->actor.world.pos); this->dyna.actor.room = - globalCtx->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA].sides[(vec.z < 0.0f) ? 0 : 1].room; + play->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA].sides[(vec.z < 0.0f) ? 0 : 1].room; if (room != this->dyna.actor.room) { - Room tempRoom = globalCtx->roomCtx.curRoom; + Room tempRoom = play->roomCtx.curRoom; - globalCtx->roomCtx.curRoom = globalCtx->roomCtx.prevRoom; - globalCtx->roomCtx.prevRoom = tempRoom; - globalCtx->roomCtx.unk_30 ^= 1; + play->roomCtx.curRoom = play->roomCtx.prevRoom; + play->roomCtx.prevRoom = tempRoom; + play->roomCtx.unk_30 ^= 1; } - func_80097534(globalCtx, &globalCtx->roomCtx); - Play_SetupRespawnPoint(globalCtx, RESPAWN_MODE_DOWN, 0x0EFF); + func_80097534(play, &play->roomCtx); + Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0x0EFF); } this->unk_164 = 0; this->dyna.actor.velocity.y = 0.0f; - if (DoorShutter_SetupDoor(this, globalCtx) && !(player->stateFlags1 & PLAYER_STATE1_11)) { + if (DoorShutter_SetupDoor(this, play) && !(player->stateFlags1 & PLAYER_STATE1_11)) { DoorShutter_SetupAction(this, func_80997568); - func_8002DF54(globalCtx, NULL, 2); + func_8002DF54(play, NULL, 2); } } -void func_809973E8(DoorShutter* this, GlobalContext* globalCtx) { +void func_809973E8(DoorShutter* this, PlayState* play) { s32 quakeId; if (this->dyna.actor.velocity.y < 20.0f) { @@ -568,35 +567,35 @@ void func_809973E8(DoorShutter* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { if (this->dyna.actor.velocity.y > 20.0f) { this->dyna.actor.floorHeight = this->dyna.actor.home.pos.y; - Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 45.0f, 10, 8.0f, 500, - 10, false); + Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 45.0f, 10, 8.0f, 500, 10, + false); } Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - quakeId = Quake_Add(Play_GetCamera(globalCtx, CAM_ID_MAIN), 3); + quakeId = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3); Quake_SetSpeed(quakeId, -32536); Quake_SetQuakeValues(quakeId, 2, 0, 0, 0); Quake_SetCountdown(quakeId, 10); func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64); - func_80997220(this, globalCtx); + func_80997220(this, play); } } -void func_80997528(DoorShutter* this, GlobalContext* globalCtx) { +void func_80997528(DoorShutter* this, PlayState* play) { if (Math_StepToS(&this->unk_166, 0x64, 0xA)) { - func_80997220(this, globalCtx); + func_80997220(this, play); } } -void func_80997568(DoorShutter* this, GlobalContext* globalCtx) { +void func_80997568(DoorShutter* this, PlayState* play) { if (this->unk_16F++ > 30) { - func_8002DF54(globalCtx, NULL, 7); - DoorShutter_SetupDoor(this, globalCtx); + func_8002DF54(play, NULL, 7); + DoorShutter_SetupDoor(this, play); } } -void func_809975C0(DoorShutter* this, GlobalContext* globalCtx) { +void func_809975C0(DoorShutter* this, PlayState* play) { Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { DoorShutter_SetupAction(this, func_809976B8); if (!GET_EVENTCHKINF(EVENTCHKINF_70)) { @@ -604,14 +603,14 @@ void func_809975C0(DoorShutter* this, GlobalContext* globalCtx) { this->unk_164 = 10; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - func_8099803C(globalCtx, 2, 10, parent->subCamId); - Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 70.0f, 20, 8.0f, 500, - 10, true); + func_8099803C(play, 2, 10, parent->subCamId); + Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 70.0f, 20, 8.0f, 500, 10, + true); } } } -void func_809976B8(DoorShutter* this, GlobalContext* globalCtx) { +void func_809976B8(DoorShutter* this, PlayState* play) { f32 mult; if (this->unk_164 != 0) { @@ -621,7 +620,7 @@ void func_809976B8(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_80997744(DoorShutter* this, GlobalContext* globalCtx) { +void func_80997744(DoorShutter* this, PlayState* play) { f32 phi_f0; osSyncPrintf("FHG SAKU START !!\n"); @@ -633,17 +632,17 @@ void func_80997744(DoorShutter* this, GlobalContext* globalCtx) { osSyncPrintf("FHG SAKU END !!\n"); } -void DoorShutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorShutter_Update(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28)) || (this->actionFunc == DoorShutter_SetupType)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -Gfx* func_80997838(GlobalContext* globalCtx, DoorShutter* this, Gfx* p) { +Gfx* func_80997838(PlayState* play, DoorShutter* this, Gfx* p) { MtxF mtx; f32 angle = 0.0f; f32 yScale = this->unk_166 * 0.01f; @@ -662,7 +661,7 @@ Gfx* func_80997838(GlobalContext* globalCtx, DoorShutter* this, Gfx* p) { if (this->unk_166 != 100) { Matrix_Scale(1.0f, yScale, 1.0f, MTXMODE_APPLY); } - gSPMatrix(p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_shutter.c", 1991), + gSPMatrix(p++, Matrix_NewMtx(play->state.gfxCtx, "../z_door_shutter.c", 1991), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(p++, sJabuDoorDLists[i]); angle -= M_PI / 4; @@ -671,14 +670,14 @@ Gfx* func_80997838(GlobalContext* globalCtx, DoorShutter* this, Gfx* p) { return p; } -s32 func_80997A34(DoorShutter* this, GlobalContext* globalCtx) { +s32 func_80997A34(DoorShutter* this, PlayState* play) { s32 phi_a1; s32 phi_a0; - if (Player_InCsMode(globalCtx)) { + if (Player_InCsMode(play)) { return true; } - phi_a0 = (s16)(Actor_WorldYawTowardPoint(&this->dyna.actor, &globalCtx->view.eye) - this->dyna.actor.shape.rot.y); + phi_a0 = (s16)(Actor_WorldYawTowardPoint(&this->dyna.actor, &play->view.eye) - this->dyna.actor.shape.rot.y); phi_a1 = (s16)(this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y); phi_a0 = ABS(phi_a0); phi_a1 = ABS(phi_a1); @@ -688,7 +687,7 @@ s32 func_80997A34(DoorShutter* this, GlobalContext* globalCtx) { return true; } -void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DoorShutter_Draw(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; //! @bug This actor is not fully initialized until the required object dependency is loaded. @@ -704,35 +703,34 @@ void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { //! the init vars for the actor, and only set draw after initialization is complete. if (this->dyna.actor.objBankIndex == this->requiredObjBankIndex && - (this->unk_16B == 0 || func_80997A34(this, globalCtx) != 0)) { + (this->unk_16B == 0 || func_80997A34(this, play) != 0)) { s32 pad[2]; ShutterInfo* sp70 = &sShutterInfo[this->unk_16C]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_door_shutter.c", 2048); + OPEN_DISPS(play->state.gfxCtx, "../z_door_shutter.c", 2048); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->unk_16C == 3) { - POLY_OPA_DISP = func_80997838(globalCtx, this, POLY_OPA_DISP); + POLY_OPA_DISP = func_80997838(play, this, POLY_OPA_DISP); if (this->unk_170 != 0.0f) { f32 sp58 = (this->unk_166 * 0.01f) * this->unk_170; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255.0f * sp58); Matrix_Translate(0, 0, sp70->translateZ, MTXMODE_APPLY); Matrix_Scale(sp58, sp58, sp58, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_shutter.c", 2069), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_door_shutter.c", 2069), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sp70->b); } } else { if (sp70->b != NULL) { - TransitionActorEntry* transitionEntry = - &globalCtx->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA]; + TransitionActorEntry* transitionEntry = &play->transiActorCtx.list[(u16)this->dyna.actor.params >> 0xA]; - if (globalCtx->roomCtx.prevRoom.num >= 0 || + if (play->roomCtx.prevRoom.num >= 0 || transitionEntry->sides[0].room == transitionEntry->sides[1].room) { - s32 yaw = Math_Vec3f_Yaw(&globalCtx->view.eye, &this->dyna.actor.world.pos); + s32 yaw = Math_Vec3f_Yaw(&play->view.eye, &this->dyna.actor.world.pos); if (ABS((s16)(this->dyna.actor.shape.rot.y - yaw)) < 0x4000) { Matrix_RotateY(M_PI, MTXMODE_APPLY); @@ -743,12 +741,12 @@ void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { } else if (this->doorType == SHUTTER_BOSS) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809982D4[this->unk_168])); } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_shutter.c", 2109), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_door_shutter.c", 2109), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sp70->a); if (this->unk_170 != 0.0f && sp70->b != NULL) { Matrix_Translate(0, sp70->c * (1.0f - this->unk_170), sp70->translateZ, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_shutter.c", 2119), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_door_shutter.c", 2119), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sp70->b); } @@ -756,18 +754,18 @@ void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_16E != 0) { Matrix_Scale(0.01f, 0.01f, 0.025f, MTXMODE_APPLY); - Actor_DrawDoorLock(globalCtx, this->unk_16E, + Actor_DrawDoorLock(play, this->unk_16E, (this->doorType == SHUTTER_BOSS) ? DOORLOCK_BOSS : ((this->unk_16C == 6) ? DOORLOCK_NORMAL_SPIRIT : DOORLOCK_NORMAL)); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_door_shutter.c", 2135); + CLOSE_DISPS(play->state.gfxCtx, "../z_door_shutter.c", 2135); } } -void func_8099803C(GlobalContext* globalCtx, s16 y, s16 countdown, s16 camId) { - s16 quakeId = Quake_Add(Play_GetCamera(globalCtx, camId), 3); +void func_8099803C(PlayState* play, s16 y, s16 countdown, s16 camId) { + s16 quakeId = Quake_Add(Play_GetCamera(play, camId), 3); func_800A9F6C(0.0f, 180, 20, 100); Quake_SetSpeed(quakeId, 20000); diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h index 1fe56dbc5e..90479fe498 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h @@ -41,7 +41,7 @@ typedef enum { struct DoorShutter; -typedef void (*DoorShutterActionFunc)(struct DoorShutter*, GlobalContext*); +typedef void (*DoorShutterActionFunc)(struct DoorShutter*, PlayState*); typedef struct DoorShutter { /* 0x0000 */ DynaPolyActor dyna; 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 6718d47449..2091d67396 100644 --- a/src/overlays/actors/ovl_Door_Toki/z_door_toki.c +++ b/src/overlays/actors/ovl_Door_Toki/z_door_toki.c @@ -9,9 +9,9 @@ #define FLAGS 0 -void DoorToki_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorToki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorToki_Update(Actor* thisx, GlobalContext* globalCtx); +void DoorToki_Init(Actor* thisx, PlayState* play); +void DoorToki_Destroy(Actor* thisx, PlayState* play); +void DoorToki_Update(Actor* thisx, PlayState* play); const ActorInit Door_Toki_InitVars = { ACTOR_DOOR_TOKI, @@ -29,7 +29,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void DoorToki_Init(Actor* thisx, GlobalContext* globalCtx) { +void DoorToki_Init(Actor* thisx, PlayState* play) { s32 pad; DoorToki* this = (DoorToki*)thisx; CollisionHeader* colHeader = NULL; @@ -37,21 +37,21 @@ void DoorToki_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gDoorTokiCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } -void DoorToki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorToki_Destroy(Actor* thisx, PlayState* play) { DoorToki* this = (DoorToki*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void DoorToki_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorToki_Update(Actor* thisx, PlayState* play) { DoorToki* this = (DoorToki*)thisx; if (GET_EVENTCHKINF(EVENTCHKINF_4B)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } } 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 72e7acec22..2b8a3a18d9 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -3,34 +3,34 @@ #define FLAGS 0 -void DoorWarp1_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorWarp1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorWarp1_Update(Actor* thisx, GlobalContext* globalCtx); -void DoorWarp1_Draw(Actor* thisx, GlobalContext* globalCtx); +void DoorWarp1_Init(Actor* thisx, PlayState* play); +void DoorWarp1_Destroy(Actor* thisx, PlayState* play); +void DoorWarp1_Update(Actor* thisx, PlayState* play); +void DoorWarp1_Draw(Actor* thisx, PlayState* play); -void DoorWarp1_WarpAppear(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_Destination(DoorWarp1* this, GlobalContext* globalCtx); -void func_8099B020(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_AwaitClearFlag(DoorWarp1* this, GlobalContext* globalCtx); -void func_8099A3A4(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_BlueCrystal(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_PurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx); -void func_80999214(DoorWarp1* this, GlobalContext* globalCtx); -void func_80999348(DoorWarp1* this, GlobalContext* globalCtx); -void func_809995D4(DoorWarp1* this, GlobalContext* globalCtx); -void func_809998A4(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_ChildWarpIdle(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_RutoWarpIdle(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_ChildWarpOut(DoorWarp1* this, GlobalContext* globalCtx); -void func_80999EE0(DoorWarp1* this, GlobalContext* globalCtx); -void func_80999FE4(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_RutoWarpOut(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_AdultWarpIdle(DoorWarp1* this, GlobalContext* globalCtx); -void func_8099A508(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_DoNothing(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_ChooseInitialAction(DoorWarp1* this, GlobalContext* globalCtx); -void DoorWarp1_FloatPlayer(DoorWarp1* this, GlobalContext* globalCtx); +void DoorWarp1_WarpAppear(DoorWarp1* this, PlayState* play); +void DoorWarp1_Destination(DoorWarp1* this, PlayState* play); +void func_8099B020(DoorWarp1* this, PlayState* play); +void DoorWarp1_AwaitClearFlag(DoorWarp1* this, PlayState* play); +void func_8099A3A4(DoorWarp1* this, PlayState* play); +void DoorWarp1_BlueCrystal(DoorWarp1* this, PlayState* play); +void DoorWarp1_PurpleCrystal(DoorWarp1* this, PlayState* play); +void func_80999214(DoorWarp1* this, PlayState* play); +void func_80999348(DoorWarp1* this, PlayState* play); +void func_809995D4(DoorWarp1* this, PlayState* play); +void func_809998A4(DoorWarp1* this, PlayState* play); +void DoorWarp1_ChildWarpIdle(DoorWarp1* this, PlayState* play); +void DoorWarp1_RutoWarpIdle(DoorWarp1* this, PlayState* play); +void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play); +void func_80999EE0(DoorWarp1* this, PlayState* play); +void func_80999FE4(DoorWarp1* this, PlayState* play); +void DoorWarp1_RutoWarpOut(DoorWarp1* this, PlayState* play); +void DoorWarp1_AdultWarpIdle(DoorWarp1* this, PlayState* play); +void func_8099A508(DoorWarp1* this, PlayState* play); +void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play); +void DoorWarp1_DoNothing(DoorWarp1* this, PlayState* play); +void DoorWarp1_ChooseInitialAction(DoorWarp1* this, PlayState* play); +void DoorWarp1_FloatPlayer(DoorWarp1* this, PlayState* play); const ActorInit Door_Warp1_InitVars = { ACTOR_DOOR_WARP1, @@ -57,9 +57,9 @@ void DoorWarp1_SetupAction(DoorWarp1* this, DoorWarp1ActionFunc actionFunc) { this->actionFunc = actionFunc; } -void DoorWarp1_Init(Actor* thisx, GlobalContext* globalCtx) { +void DoorWarp1_Init(Actor* thisx, PlayState* play) { DoorWarp1* this = (DoorWarp1*)thisx; - GlobalContext* globalCtx2 = globalCtx; + PlayState* play2 = play; this->unk_1B8 = 0; this->unk_1B4 = 0.0f; @@ -70,33 +70,32 @@ void DoorWarp1_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.params != WARP_YELLOW && this->actor.params != WARP_DESTINATION) { Lights_PointNoGlowSetInfo(&this->upperLightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); - this->upperLight = LightContext_InsertLight(globalCtx2, &globalCtx2->lightCtx, &this->upperLightInfo); + this->upperLight = LightContext_InsertLight(play2, &play2->lightCtx, &this->upperLightInfo); Lights_PointNoGlowSetInfo(&this->lowerLightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); - this->lowerLight = LightContext_InsertLight(globalCtx2, &globalCtx2->lightCtx, &this->lowerLightInfo); + this->lowerLight = LightContext_InsertLight(play2, &play2->lightCtx, &this->lowerLightInfo); } osSyncPrintf("\nBOSSWARP arg_data=[%d]", this->actor.params); - DoorWarp1_ChooseInitialAction(this, globalCtx2); + DoorWarp1_ChooseInitialAction(this, play2); } -void DoorWarp1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorWarp1_Destroy(Actor* thisx, PlayState* play) { u8 i; DoorWarp1* this = (DoorWarp1*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->upperLight); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lowerLight); + LightContext_RemoveLight(play, &play->lightCtx, this->upperLight); + LightContext_RemoveLight(play, &play->lightCtx, this->lowerLight); for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjAmbientColor[i] = globalCtx->envCtx.adjFogColor[i] = globalCtx->envCtx.adjLight1Color[i] = - 0; + play->envCtx.adjAmbientColor[i] = play->envCtx.adjFogColor[i] = play->envCtx.adjLight1Color[i] = 0; } //! @bug SkelAnime_Free is not called for crystal variants } -void DoorWarp1_SetupWarp(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_SetupWarp(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->scale = 0; this->unk_1AE = -140; @@ -166,7 +165,7 @@ void DoorWarp1_SetupWarp(DoorWarp1* this, GlobalContext* globalCtx) { gSaveContext.entranceIndex == ENTR_SPOT06_9 || gSaveContext.entranceIndex == ENTR_SPOT11_8 || gSaveContext.entranceIndex == ENTR_SPOT02_8) && gSaveContext.sceneSetupIndex < 4) || - (GET_PLAYER(globalCtx)->actor.params & 0xF00) != 0x200) { + (GET_PLAYER(play)->actor.params & 0xF00) != 0x200) { Actor_Kill(&this->actor); } if (Actor_WorldDistXZToActor(&player->actor, &this->actor) > 100.0f) { @@ -183,8 +182,8 @@ void DoorWarp1_SetupWarp(DoorWarp1* this, GlobalContext* globalCtx) { } } -void DoorWarp1_SetupAdultDungeonWarp(DoorWarp1* this, GlobalContext* globalCtx) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); +void DoorWarp1_SetupAdultDungeonWarp(DoorWarp1* this, PlayState* play) { + SkelAnime_Init(play, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); Animation_ChangeImpl(&this->skelAnime, &gWarpCrystalAnim, 1.0f, 1.0f, 1.0f, ANIMMODE_ONCE, 40.0f, 1); this->scale = 0; @@ -209,10 +208,10 @@ void DoorWarp1_SetupAdultDungeonWarp(DoorWarp1* this, GlobalContext* globalCtx) DoorWarp1_SetupAction(this, func_8099A3A4); } -void DoorWarp1_SetupBlueCrystal(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_SetupBlueCrystal(DoorWarp1* this, PlayState* play) { s16 i; - SkelAnime_Init(globalCtx, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); Animation_ChangeImpl(&this->skelAnime, &gWarpCrystalAnim, 0, Animation_GetLastFrame(&gWarpCrystalAnim), Animation_GetLastFrame(&gWarpCrystalAnim), ANIMMODE_ONCE, 0.0f, 1); @@ -231,18 +230,17 @@ void DoorWarp1_SetupBlueCrystal(DoorWarp1* this, GlobalContext* globalCtx) { this->actor.shape.yOffset = 800.0f; for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjAmbientColor[i] = globalCtx->envCtx.adjFogColor[i] = globalCtx->envCtx.adjLight1Color[i] = - -255; + play->envCtx.adjAmbientColor[i] = play->envCtx.adjFogColor[i] = play->envCtx.adjLight1Color[i] = -255; } - globalCtx->envCtx.adjFogNear = -500; + play->envCtx.adjFogNear = -500; this->warpTimer = 30; this->unk_1B8 = 4000; DoorWarp1_SetupAction(this, DoorWarp1_BlueCrystal); } -void DoorWarp1_SetupPurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); +void DoorWarp1_SetupPurpleCrystal(DoorWarp1* this, PlayState* play) { + SkelAnime_Init(play, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0); Animation_ChangeImpl(&this->skelAnime, &gWarpCrystalAnim, 0, Animation_GetLastFrame(&gWarpCrystalAnim), Animation_GetLastFrame(&gWarpCrystalAnim), ANIMMODE_ONCE, 0.0f, 1); @@ -272,8 +270,8 @@ void DoorWarp1_SetupPurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx) { DoorWarp1_SetupAction(this, DoorWarp1_PurpleCrystal); } -void DoorWarp1_SetPlayerPos(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_SetPlayerPos(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.velocity.y = 0.0f; player->actor.world.pos.x = this->actor.world.pos.x; @@ -281,16 +279,16 @@ void DoorWarp1_SetPlayerPos(DoorWarp1* this, GlobalContext* globalCtx) { player->actor.world.pos.z = this->actor.world.pos.z; } -void DoorWarp1_BlueCrystal(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_BlueCrystal(DoorWarp1* this, PlayState* play) { if (this->warpTimer != 0) { this->warpTimer--; } else { DoorWarp1_SetupAction(this, func_80999214); } - DoorWarp1_SetPlayerPos(this, globalCtx); + DoorWarp1_SetPlayerPos(this, play); } -void func_80999214(DoorWarp1* this, GlobalContext* globalCtx) { +void func_80999214(DoorWarp1* this, PlayState* play) { s32 temp_f4; f32 darkness; s16 i; @@ -301,23 +299,23 @@ void func_80999214(DoorWarp1* this, GlobalContext* globalCtx) { darkness = CLAMP_MIN(darkness, 0); for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjAmbientColor[i] = globalCtx->envCtx.adjFogColor[i] = globalCtx->envCtx.adjLight1Color[i] = + play->envCtx.adjAmbientColor[i] = play->envCtx.adjFogColor[i] = play->envCtx.adjLight1Color[i] = -255.0f * darkness; } - globalCtx->envCtx.adjFogNear = -500.0f * darkness; + play->envCtx.adjFogNear = -500.0f * darkness; this->warpTimer++; if (darkness <= 0) { DoorWarp1_SetupAction(this, func_80999348); } this->actor.shape.rot.y += 0x320; - DoorWarp1_SetPlayerPos(this, globalCtx); + DoorWarp1_SetPlayerPos(this, play); } -void func_80999348(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80999348(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); - DoorWarp1_SetPlayerPos(this, globalCtx); + DoorWarp1_SetPlayerPos(this, play); if (this->warpTimer == 0) { Math_SmoothStepToF(&this->crystalAlpha, 0.0f, 0.1f, 4.0f, 1.0f); @@ -333,13 +331,13 @@ void func_80999348(DoorWarp1* this, GlobalContext* globalCtx) { this->actor.shape.rot.y += 0x320; } -void DoorWarp1_FloatPlayer(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_FloatPlayer(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.gravity = -0.1f; } -void DoorWarp1_PurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_PurpleCrystal(DoorWarp1* this, PlayState* play) { if (this->warpTimer != 0) { this->warpTimer--; Math_SmoothStepToF(&this->actor.scale.x, 0.0499f, 0.2f, 0.05f, 0.001f); @@ -349,7 +347,7 @@ void DoorWarp1_PurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx) { } } -void DoorWarp1_ChooseInitialAction(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_ChooseInitialAction(DoorWarp1* this, PlayState* play) { switch (this->actor.params) { case WARP_DUNGEON_CHILD: case WARP_CLEAR_FLAG: @@ -361,29 +359,29 @@ void DoorWarp1_ChooseInitialAction(DoorWarp1* this, GlobalContext* globalCtx) { case WARP_ORANGE: case WARP_GREEN: case WARP_RED: - DoorWarp1_SetupWarp(this, globalCtx); + DoorWarp1_SetupWarp(this, play); break; case WARP_DUNGEON_ADULT: - DoorWarp1_SetupAdultDungeonWarp(this, globalCtx); + DoorWarp1_SetupAdultDungeonWarp(this, play); break; case WARP_BLUE_CRYSTAL: - DoorWarp1_SetupBlueCrystal(this, globalCtx); + DoorWarp1_SetupBlueCrystal(this, play); break; case WARP_PURPLE_CRYSTAL: - DoorWarp1_SetupPurpleCrystal(this, globalCtx); + DoorWarp1_SetupPurpleCrystal(this, play); break; } } -void DoorWarp1_AwaitClearFlag(DoorWarp1* this, GlobalContext* globalCtx) { - if (Flags_GetTempClear(globalCtx, this->actor.room)) { +void DoorWarp1_AwaitClearFlag(DoorWarp1* this, PlayState* play) { + if (Flags_GetTempClear(play, this->actor.room)) { this->warpTimer = 200; Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); DoorWarp1_SetupAction(this, func_809995D4); } } -void func_809995D4(DoorWarp1* this, GlobalContext* globalCtx) { +void func_809995D4(DoorWarp1* this, PlayState* play) { if (this->warpTimer == 0) { if (this->actor.xzDistToPlayer < 100.0f) { this->actor.world.pos.x = -98.0f; @@ -399,7 +397,7 @@ void func_809995D4(DoorWarp1* this, GlobalContext* globalCtx) { this->warpTimer--; } -void DoorWarp1_WarpAppear(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_WarpAppear(DoorWarp1* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); Math_SmoothStepToF(&this->lightRayAlpha, 255.0f, 0.4f, 10.0f, 0.01f); Math_SmoothStepToF(&this->warpAlpha, 255.0f, 0.4f, 10.0f, 0.01f); @@ -433,7 +431,7 @@ void DoorWarp1_WarpAppear(DoorWarp1* this, GlobalContext* globalCtx) { } } -void func_809998A4(DoorWarp1* this, GlobalContext* globalCtx) { +void func_809998A4(DoorWarp1* this, PlayState* play) { if (this->lightRayAlpha != 0.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); } @@ -441,8 +439,8 @@ void func_809998A4(DoorWarp1* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->warpAlpha, 0.0f, 0.1f, 2.0f, 0.01f); } -s32 DoorWarp1_PlayerInRange(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 DoorWarp1_PlayerInRange(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 ret = false; if (fabsf(this->actor.xzDistToPlayer) < 60.0f) { @@ -455,18 +453,18 @@ s32 DoorWarp1_PlayerInRange(DoorWarp1* this, GlobalContext* globalCtx) { return ret; } -void DoorWarp1_ChildWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_ChildWarpIdle(DoorWarp1* this, PlayState* play) { Player* player; Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); - if (DoorWarp1_PlayerInRange(this, globalCtx)) { - player = GET_PLAYER(globalCtx); + if (DoorWarp1_PlayerInRange(this, play)) { + player = GET_PLAYER(play); Audio_PlaySoundGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - OnePointCutscene_Init(globalCtx, 0x25E7, 999, &this->actor, CAM_ID_MAIN); - func_8002DF54(globalCtx, &this->actor, 10); + OnePointCutscene_Init(play, 0x25E7, 999, &this->actor, CAM_ID_MAIN); + func_8002DF54(play, &this->actor, 10); player->unk_450.x = this->actor.world.pos.x; player->unk_450.z = this->actor.world.pos.z; @@ -475,8 +473,8 @@ void DoorWarp1_ChildWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { } } -void DoorWarp1_ChildWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_1B2 >= 101) { if (player->actor.velocity.y < 10.0f) { @@ -492,37 +490,37 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { this->warpTimer++; if (sWarpTimerTarget < this->warpTimer && gSaveContext.nextCutsceneIndex == 0xFFEF) { - osSyncPrintf("\n\n\nじかんがきたからおーしまい fade_direction=[%d]", globalCtx->transitionTrigger, + osSyncPrintf("\n\n\nじかんがきたからおーしまい fade_direction=[%d]", play->transitionTrigger, TRANS_TRIGGER_START); - if (globalCtx->sceneNum == SCENE_DDAN_BOSS) { + if (play->sceneNum == SCENE_DDAN_BOSS) { if (!Flags_GetEventChkInf(EVENTCHKINF_25)) { Flags_SetEventChkInf(EVENTCHKINF_25); - Item_Give(globalCtx, ITEM_GORON_RUBY); - globalCtx->nextEntranceIndex = ENTR_SPOT16_0; + Item_Give(play, ITEM_GORON_RUBY); + play->nextEntranceIndex = ENTR_SPOT16_0; gSaveContext.nextCutsceneIndex = 0xFFF1; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT16_5; + play->nextEntranceIndex = ENTR_SPOT16_5; gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_YDAN_BOSS) { + } else if (play->sceneNum == SCENE_YDAN_BOSS) { if (!Flags_GetEventChkInf(EVENTCHKINF_07)) { Flags_SetEventChkInf(EVENTCHKINF_07); Flags_SetEventChkInf(EVENTCHKINF_09); - Item_Give(globalCtx, ITEM_KOKIRI_EMERALD); - globalCtx->nextEntranceIndex = ENTR_SPOT04_0; + Item_Give(play, ITEM_KOKIRI_EMERALD); + play->nextEntranceIndex = ENTR_SPOT04_0; gSaveContext.nextCutsceneIndex = 0xFFF1; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT04_11; + play->nextEntranceIndex = ENTR_SPOT04_11; gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_BDAN_BOSS) { - globalCtx->nextEntranceIndex = ENTR_SPOT08_0; + } else if (play->sceneNum == SCENE_BDAN_BOSS) { + play->nextEntranceIndex = ENTR_SPOT08_0; gSaveContext.nextCutsceneIndex = 0; } osSyncPrintf("\n\n\nおわりおわり"); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE_SLOW; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE_SLOW; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; } @@ -537,12 +535,12 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 0.5f, 2.0f, 0.1f); } -void DoorWarp1_RutoWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_RutoWarpIdle(DoorWarp1* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); - if (this->rutoWarpState != WARP_BLUE_RUTO_STATE_INITIAL && DoorWarp1_PlayerInRange(this, globalCtx)) { + if (this->rutoWarpState != WARP_BLUE_RUTO_STATE_INITIAL && DoorWarp1_PlayerInRange(this, play)) { this->rutoWarpState = WARP_BLUE_RUTO_STATE_ENTERED; - func_8002DF54(globalCtx, &this->actor, 10); + func_8002DF54(play, &this->actor, 10); this->unk_1B2 = 1; DoorWarp1_SetupAction(this, func_80999EE0); } @@ -550,16 +548,16 @@ void DoorWarp1_RutoWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { static s16 sRutoWarpSubCamId; -void func_80999EE0(DoorWarp1* this, GlobalContext* globalCtx) { +void func_80999EE0(DoorWarp1* this, PlayState* play) { Vec3f at; Vec3f eye; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->rutoWarpState == WARP_BLUE_RUTO_STATE_3) { - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - sRutoWarpSubCamId = Play_CreateSubCamera(globalCtx); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + sRutoWarpSubCamId = Play_CreateSubCamera(play); - Play_ChangeCameraStatus(globalCtx, sRutoWarpSubCamId, CAM_STAT_ACTIVE); + Play_ChangeCameraStatus(play, sRutoWarpSubCamId, CAM_STAT_ACTIVE); at.x = this->actor.world.pos.x; at.y = 49.0f; at.z = this->actor.world.pos.z; @@ -567,29 +565,29 @@ void func_80999EE0(DoorWarp1* this, GlobalContext* globalCtx) { eye.y = 43.0f; eye.z = player->actor.world.pos.z; - Play_CameraSetAtEye(globalCtx, sRutoWarpSubCamId, &at, &eye); - Play_CameraSetFov(globalCtx, sRutoWarpSubCamId, 90.0f); + Play_CameraSetAtEye(play, sRutoWarpSubCamId, &at, &eye); + Play_CameraSetFov(play, sRutoWarpSubCamId, 90.0f); this->rutoWarpState = WARP_BLUE_RUTO_STATE_TALKING; - Message_StartTextbox(globalCtx, 0x4022, NULL); + Message_StartTextbox(play, 0x4022, NULL); DoorWarp1_SetupAction(this, func_80999FE4); } } -void func_80999FE4(DoorWarp1* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { +void func_80999FE4(DoorWarp1* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { Audio_PlaySoundGeneral(NA_SE_EV_LINK_WARP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - OnePointCutscene_Init(globalCtx, 0x25E9, 999, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 0x25E9, 999, &this->actor, CAM_ID_MAIN); // Using `CAM_ID_NONE` here defaults to the active camera - Play_CopyCamera(globalCtx, CAM_ID_NONE, sRutoWarpSubCamId); - Play_ChangeCameraStatus(globalCtx, sRutoWarpSubCamId, CAM_STAT_WAIT); + Play_CopyCamera(play, CAM_ID_NONE, sRutoWarpSubCamId); + Play_ChangeCameraStatus(play, sRutoWarpSubCamId, CAM_STAT_WAIT); this->rutoWarpState = WARP_BLUE_RUTO_STATE_WARPING; DoorWarp1_SetupAction(this, DoorWarp1_RutoWarpOut); } } -void DoorWarp1_RutoWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_RutoWarpOut(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_1B2 >= 61) { if (player->actor.velocity.y < 10.f) { @@ -605,11 +603,11 @@ void DoorWarp1_RutoWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == 0xFFEF) { SET_EVENTCHKINF(EVENTCHKINF_37); - Item_Give(globalCtx, ITEM_ZORA_SAPPHIRE); - globalCtx->nextEntranceIndex = ENTR_SPOT08_0; + Item_Give(play, ITEM_ZORA_SAPPHIRE); + play->nextEntranceIndex = ENTR_SPOT08_0; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE_SLOW; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE_SLOW; } Math_StepToF(&this->unk_194, 2.0f, 0.01f); @@ -623,7 +621,7 @@ void DoorWarp1_RutoWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 0.5f, 2.0f, 0.1f); } -void func_8099A3A4(DoorWarp1* this, GlobalContext* globalCtx) { +void func_8099A3A4(DoorWarp1* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); Math_SmoothStepToF(&this->lightRayAlpha, 255.0f, 0.2f, 2.0f, 0.1f); Math_SmoothStepToF(&this->warpAlpha, 255.0f, 0.2f, 2.0f, 0.1f); @@ -641,16 +639,16 @@ void func_8099A3A4(DoorWarp1* this, GlobalContext* globalCtx) { } } -void DoorWarp1_AdultWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_AdultWarpIdle(DoorWarp1* this, PlayState* play) { Player* player; Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); - if (DoorWarp1_PlayerInRange(this, globalCtx)) { - player = GET_PLAYER(globalCtx); + if (DoorWarp1_PlayerInRange(this, play)) { + player = GET_PLAYER(play); - OnePointCutscene_Init(globalCtx, 0x25E8, 999, &this->actor, CAM_ID_MAIN); - func_8002DF54(globalCtx, &this->actor, 10); + OnePointCutscene_Init(play, 0x25E8, 999, &this->actor, CAM_ID_MAIN); + func_8002DF54(play, &this->actor, 10); player->unk_450.x = this->actor.world.pos.x; player->unk_450.z = this->actor.world.pos.z; this->unk_1B2 = 20; @@ -658,8 +656,8 @@ void DoorWarp1_AdultWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { } } -void func_8099A508(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8099A508(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_1B2 != 0) { this->unk_1B2--; @@ -674,8 +672,8 @@ void func_8099A508(DoorWarp1* this, GlobalContext* globalCtx) { DoorWarp1_SetupAction(this, DoorWarp1_AdultWarpOut); } -void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp_f0_2; if (this->unk_1B2 != 0) { @@ -704,96 +702,96 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { this->warpTimer++; if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == 0xFFEF) { - if (globalCtx->sceneNum == SCENE_MORIBOSSROOM) { + if (play->sceneNum == SCENE_MORIBOSSROOM) { if (!GET_EVENTCHKINF(EVENTCHKINF_48)) { SET_EVENTCHKINF(EVENTCHKINF_48); - Item_Give(globalCtx, ITEM_MEDALLION_FOREST); - globalCtx->nextEntranceIndex = ENTR_KENJYANOMA_0; + Item_Give(play, ITEM_MEDALLION_FOREST); + play->nextEntranceIndex = ENTR_KENJYANOMA_0; gSaveContext.nextCutsceneIndex = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; } else { if (!LINK_IS_ADULT) { - globalCtx->nextEntranceIndex = ENTR_SPOT05_2; + play->nextEntranceIndex = ENTR_SPOT05_2; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT05_3; + play->nextEntranceIndex = ENTR_SPOT05_3; } gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_FIRE_BS) { + } else if (play->sceneNum == SCENE_FIRE_BS) { if (!GET_EVENTCHKINF(EVENTCHKINF_49)) { SET_EVENTCHKINF(EVENTCHKINF_49); - Item_Give(globalCtx, ITEM_MEDALLION_FIRE); - globalCtx->nextEntranceIndex = ENTR_SPOT01_0; + Item_Give(play, ITEM_MEDALLION_FIRE); + play->nextEntranceIndex = ENTR_SPOT01_0; gSaveContext.nextCutsceneIndex = 0xFFF3; } else { if (!LINK_IS_ADULT) { - globalCtx->nextEntranceIndex = ENTR_SPOT17_4; + play->nextEntranceIndex = ENTR_SPOT17_4; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT17_5; + play->nextEntranceIndex = ENTR_SPOT17_5; } gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_MIZUSIN_BS) { + } else if (play->sceneNum == SCENE_MIZUSIN_BS) { if (!GET_EVENTCHKINF(EVENTCHKINF_4A)) { SET_EVENTCHKINF(EVENTCHKINF_4A); - Item_Give(globalCtx, ITEM_MEDALLION_WATER); - globalCtx->nextEntranceIndex = ENTR_KENJYANOMA_0; + Item_Give(play, ITEM_MEDALLION_WATER); + play->nextEntranceIndex = ENTR_KENJYANOMA_0; gSaveContext.nextCutsceneIndex = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_WATER; } else { if (!LINK_IS_ADULT) { - globalCtx->nextEntranceIndex = ENTR_SPOT06_8; + play->nextEntranceIndex = ENTR_SPOT06_8; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT06_9; + play->nextEntranceIndex = ENTR_SPOT06_9; } gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_JYASINBOSS) { + } else if (play->sceneNum == SCENE_JYASINBOSS) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { - Item_Give(globalCtx, ITEM_MEDALLION_SPIRIT); - globalCtx->nextEntranceIndex = ENTR_KENJYANOMA_0; + Item_Give(play, ITEM_MEDALLION_SPIRIT); + play->nextEntranceIndex = ENTR_KENJYANOMA_0; gSaveContext.nextCutsceneIndex = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_SPIRIT; } else { if (!LINK_IS_ADULT) { - globalCtx->nextEntranceIndex = ENTR_SPOT11_5; + play->nextEntranceIndex = ENTR_SPOT11_5; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT11_8; + play->nextEntranceIndex = ENTR_SPOT11_8; } gSaveContext.nextCutsceneIndex = 0; } - } else if (globalCtx->sceneNum == SCENE_HAKADAN_BS) { + } else if (play->sceneNum == SCENE_HAKADAN_BS) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) { - Item_Give(globalCtx, ITEM_MEDALLION_SHADOW); - globalCtx->nextEntranceIndex = ENTR_KENJYANOMA_0; + Item_Give(play, ITEM_MEDALLION_SHADOW); + play->nextEntranceIndex = ENTR_KENJYANOMA_0; gSaveContext.nextCutsceneIndex = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_SHADOW; } else { if (!LINK_IS_ADULT) { - globalCtx->nextEntranceIndex = ENTR_SPOT02_7; + play->nextEntranceIndex = ENTR_SPOT02_7; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT02_8; + play->nextEntranceIndex = ENTR_SPOT02_8; } gSaveContext.nextCutsceneIndex = 0; } } - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE_SLOW; } if (this->warpTimer >= 141) { f32 screenFillAlpha; - globalCtx->envCtx.fillScreen = true; + play->envCtx.fillScreen = true; screenFillAlpha = (f32)(this->warpTimer - 140) / 20.0f; if (screenFillAlpha > 1.0f) { screenFillAlpha = 1.0f; } - globalCtx->envCtx.screenFillColor[0] = 160; - globalCtx->envCtx.screenFillColor[1] = 160; - globalCtx->envCtx.screenFillColor[2] = 160; - globalCtx->envCtx.screenFillColor[3] = (u32)(255.0f * screenFillAlpha); + play->envCtx.screenFillColor[0] = 160; + play->envCtx.screenFillColor[1] = 160; + play->envCtx.screenFillColor[2] = 160; + play->envCtx.screenFillColor[3] = (u32)(255.0f * screenFillAlpha); osSyncPrintf("\nparcent=[%f]", screenFillAlpha); } @@ -819,18 +817,18 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx) { s16 i; for (i = 0; i < 3; i++) { - globalCtx->envCtx.adjAmbientColor[i] = globalCtx->envCtx.adjFogColor[i] = - globalCtx->envCtx.adjLight1Color[i] = -255.0f * temp_f0_2; + play->envCtx.adjAmbientColor[i] = play->envCtx.adjFogColor[i] = play->envCtx.adjLight1Color[i] = + -255.0f * temp_f0_2; } - globalCtx->envCtx.adjFogNear = -500.0f * temp_f0_2; - if (globalCtx->envCtx.adjFogNear < -300) { - globalCtx->roomCtx.curRoom.segment = NULL; + play->envCtx.adjFogNear = -500.0f * temp_f0_2; + if (play->envCtx.adjFogNear < -300) { + play->roomCtx.curRoom.segment = NULL; } } } -void DoorWarp1_Destination(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_Destination(DoorWarp1* this, PlayState* play) { f32 alphaFrac; this->warpTimer++; @@ -852,10 +850,10 @@ void DoorWarp1_Destination(DoorWarp1* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); } -void DoorWarp1_DoNothing(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_DoNothing(DoorWarp1* this, PlayState* play) { } -void func_8099B020(DoorWarp1* this, GlobalContext* globalCtx) { +void func_8099B020(DoorWarp1* this, PlayState* play) { Math_SmoothStepToF(&this->lightRayAlpha, 128.0f, 0.2f, 2.0f, 0.1f); Math_SmoothStepToF(&this->warpAlpha, 128.0f, 0.2f, 2.0f, 0.1f); @@ -866,68 +864,68 @@ void func_8099B020(DoorWarp1* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); } -void DoorWarp1_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorWarp1_Update(Actor* thisx, PlayState* play) { DoorWarp1* this = (DoorWarp1*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params != WARP_PURPLE_CRYSTAL) { Actor_SetScale(&this->actor, this->scale / 100.0f); } } -void DoorWarp1_DrawBlueCrystal(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_DrawBlueCrystal(DoorWarp1* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_door_warp1.c", 2078); + OPEN_DISPS(play->state.gfxCtx, "../z_door_warp1.c", 2078); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0xFF, 200, 255, 255, (u8)this->crystalAlpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, (u8)this->crystalAlpha); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, - &this->actor, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor, + POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_door_warp1.c", 2098); + CLOSE_DISPS(play->state.gfxCtx, "../z_door_warp1.c", 2098); SkelAnime_Update(&this->skelAnime); } -void DoorWarp1_DrawPurpleCrystal(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_DrawPurpleCrystal(DoorWarp1* this, PlayState* play) { s32 pad[2]; Vec3f eye; - eye.x = -(Math_SinS(globalCtx->state.frames * 200) * 120.0f) * 80.0f; - eye.y = (Math_CosS(globalCtx->state.frames * 200) * 120.0f) * 80.0f; - eye.z = (Math_CosS(globalCtx->state.frames * 200) * 120.0f) * 80.0f; + eye.x = -(Math_SinS(play->state.frames * 200) * 120.0f) * 80.0f; + eye.y = (Math_CosS(play->state.frames * 200) * 120.0f) * 80.0f; + eye.z = (Math_CosS(play->state.frames * 200) * 120.0f) * 80.0f; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_door_warp1.c", 2122); + OPEN_DISPS(play->state.gfxCtx, "../z_door_warp1.c", 2122); - func_80093D84(globalCtx->state.gfxCtx); - func_8002EB44(&this->actor.world.pos, &eye, &eye, globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + func_8002EB44(&this->actor.world.pos, &eye, &eye, play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)this->crystalAlpha); gDPSetEnvColor(POLY_XLU_DISP++, 150, 0, 100, (u8)this->crystalAlpha); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, - &this->actor, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor, + POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_door_warp1.c", 2152); + CLOSE_DISPS(play->state.gfxCtx, "../z_door_warp1.c", 2152); SkelAnime_Update(&this->skelAnime); } -void DoorWarp1_DrawWarp(DoorWarp1* this, GlobalContext* globalCtx) { +void DoorWarp1_DrawWarp(DoorWarp1* this, PlayState* play) { s32 pad; u32 pad1; - u32 spEC = globalCtx->state.frames * 10; + u32 spEC = play->state.frames * 10; f32 spE8 = (this->unk_194 >= 1.0f) ? 0.0f : 1.0f - this->unk_194; f32 spE4 = (this->unk_198 >= 1.0f) ? 0.0f : 1.0f - this->unk_198; f32 xzScale; f32 temp_f0; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_door_warp1.c", 2173); + OPEN_DISPS(play->state.gfxCtx, "../z_door_warp1.c", 2173); temp_f0 = 1.0f - (2.0f - this->unk_194) / 1.7f; if (this->actor.params != WARP_YELLOW && this->actor.params != WARP_DESTINATION && @@ -937,7 +935,7 @@ void DoorWarp1_DrawWarp(DoorWarp1* this, GlobalContext* globalCtx) { if (this->actor.params == WARP_DESTINATION) { this->unk_19C -= (s16)(temp_f0 * 2.0f); } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); switch (this->actor.params) { case WARP_YELLOW: @@ -965,18 +963,18 @@ void DoorWarp1_DrawWarp(DoorWarp1* this, GlobalContext* globalCtx) { gDPSetColorDither(POLY_XLU_DISP++, G_AD_NOTPATTERN | G_CD_MAGICSQ); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + 1.0f, this->actor.world.pos.z, MTXMODE_NEW); - gSPSegment(POLY_XLU_DISP++, 0x0A, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_warp1.c", 2247)); + gSPSegment(POLY_XLU_DISP++, 0x0A, Matrix_NewMtx(play->state.gfxCtx, "../z_door_warp1.c", 2247)); Matrix_Push(); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, spEC & 0xFF, -((s16)(this->unk_19C + this->unk_19C) & 511), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, spEC & 0xFF, -((s16)(this->unk_19C + this->unk_19C) & 511), 0x100, 0x100, 1, spEC & 0xFF, -((s16)(this->unk_19C + this->unk_19C) & 511), 0x100, 0x100)); Matrix_Translate(0.0f, this->unk_194 * 230.0f, 0.0f, MTXMODE_APPLY); xzScale = (((f32)this->unk_1AE * spE8) / 100.0f) + 1.0f; Matrix_Scale(xzScale, 1.0f, xzScale, MTXMODE_APPLY); - gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_warp1.c", 2267)); + gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(play->state.gfxCtx, "../z_door_warp1.c", 2267)); gSPDisplayList(POLY_XLU_DISP++, gWarpPortalDL); Matrix_Pop(); @@ -1006,28 +1004,28 @@ void DoorWarp1_DrawWarp(DoorWarp1* this, GlobalContext* globalCtx) { spEC *= 2; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, spEC & 0xFF, -((s16)this->unk_19C & 511), 0x100, 0x100, - 1, spEC & 0xFF, -((s16)this->unk_19C & 511), 0x100, 0x100)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, spEC & 0xFF, -((s16)this->unk_19C & 511), 0x100, 0x100, 1, + spEC & 0xFF, -((s16)this->unk_19C & 511), 0x100, 0x100)); Matrix_Translate(0.0f, this->unk_198 * 60.0f, 0.0f, MTXMODE_APPLY); xzScale = (((f32)this->unk_1B0 * spE4) / 100.0f) + 1.0f; Matrix_Scale(xzScale, 1.0f, xzScale, MTXMODE_APPLY); - gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_warp1.c", 2336)); + gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(play->state.gfxCtx, "../z_door_warp1.c", 2336)); gSPDisplayList(POLY_XLU_DISP++, gWarpPortalDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_door_warp1.c", 2340); + CLOSE_DISPS(play->state.gfxCtx, "../z_door_warp1.c", 2340); } -void DoorWarp1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DoorWarp1_Draw(Actor* thisx, PlayState* play) { DoorWarp1* this = (DoorWarp1*)thisx; switch (this->actor.params) { case WARP_DUNGEON_ADULT: - DoorWarp1_DrawBlueCrystal(this, globalCtx); - DoorWarp1_DrawWarp(this, globalCtx); + DoorWarp1_DrawBlueCrystal(this, play); + DoorWarp1_DrawWarp(this, play); break; case WARP_DUNGEON_CHILD: case WARP_CLEAR_FLAG: @@ -1039,13 +1037,13 @@ void DoorWarp1_Draw(Actor* thisx, GlobalContext* globalCtx) { case WARP_ORANGE: case WARP_GREEN: case WARP_RED: - DoorWarp1_DrawWarp(this, globalCtx); + DoorWarp1_DrawWarp(this, play); break; case WARP_BLUE_CRYSTAL: - DoorWarp1_DrawBlueCrystal(this, globalCtx); + DoorWarp1_DrawBlueCrystal(this, play); break; case WARP_PURPLE_CRYSTAL: - DoorWarp1_DrawPurpleCrystal(this, globalCtx); + DoorWarp1_DrawPurpleCrystal(this, play); break; } } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h index 4f335c81d3..09e00fbfd0 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h @@ -31,7 +31,7 @@ typedef enum { /* 5 */ WARP_BLUE_RUTO_STATE_WARPING // set by warp, after closing dialog } DoorWarp1RutoState; -typedef void (*DoorWarp1ActionFunc)(struct DoorWarp1*, GlobalContext*); +typedef void (*DoorWarp1ActionFunc)(struct DoorWarp1*, PlayState*); typedef struct DoorWarp1 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c index e11fe536e5..d0168efcce 100644 --- a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c +++ b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c @@ -3,14 +3,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EfcErupc_Init(Actor* thisx, GlobalContext* globalCtx); -void EfcErupc_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EfcErupc_Update(Actor* thisx, GlobalContext* globalCtx); -void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx); +void EfcErupc_Init(Actor* thisx, PlayState* play); +void EfcErupc_Destroy(Actor* thisx, PlayState* play); +void EfcErupc_Update(Actor* thisx, PlayState* play); +void EfcErupc_Draw(Actor* thisx, PlayState* play); -void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx); -void EfcErupc_DrawEffects(EfcErupcEffect* effect, GlobalContext* globalCtx); -void EfcErupc_UpdateEffects(EfcErupc* this, GlobalContext* globalCtx); +void EfcErupc_UpdateAction(EfcErupc* this, PlayState* play); +void EfcErupc_DrawEffects(EfcErupcEffect* effect, PlayState* play); +void EfcErupc_UpdateEffects(EfcErupc* this, PlayState* play); void EfcErupc_SpawnEffect(EfcErupcEffect* effect, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scaleFactor); void EfcErupc_InitEffects(EfcErupcEffect* effect); @@ -30,7 +30,7 @@ void EfcErupc_SetupAction(EfcErupc* this, EfcErupcActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EfcErupc_Init(Actor* thisx, GlobalContext* globalCtx) { +void EfcErupc_Init(Actor* thisx, PlayState* play) { EfcErupc* this = (EfcErupc*)thisx; EfcErupc_SetupAction(this, EfcErupc_UpdateAction); @@ -41,18 +41,18 @@ void EfcErupc_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_154 = -100; } -void EfcErupc_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EfcErupc_Destroy(Actor* thisx, PlayState* play) { } -void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx) { +void EfcErupc_UpdateAction(EfcErupc* this, PlayState* play) { Vec3f pos; Vec3f vel; Vec3f accel; s32 i; - if (globalCtx->csCtx.state != 0) { - if (globalCtx->csCtx.npcActions[1] != NULL) { - if (globalCtx->csCtx.npcActions[1]->action == 2) { + if (play->csCtx.state != 0) { + if (play->csCtx.npcActions[1] != NULL) { + if (play->csCtx.npcActions[1]->action == 2) { if (this->unk_150 == 30) { func_800788CC(NA_SE_IT_EARTHQUAKE); } @@ -73,9 +73,9 @@ void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx) { } } } - if (globalCtx->csCtx.state != 0) { - if (globalCtx->csCtx.npcActions[2] != NULL) { - switch (globalCtx->csCtx.npcActions[2]->action) { + if (play->csCtx.state != 0) { + if (play->csCtx.npcActions[2] != NULL) { + switch (play->csCtx.npcActions[2]->action) { case 2: if (this->unk_14E == 0) { func_800F3F3C(6); @@ -103,49 +103,49 @@ void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx) { } } -void EfcErupc_Update(Actor* thisx, GlobalContext* globalCtx) { +void EfcErupc_Update(Actor* thisx, PlayState* play) { EfcErupc* this = (EfcErupc*)thisx; - this->actionFunc(this, globalCtx); - EfcErupc_UpdateEffects(this, globalCtx); + this->actionFunc(this, play); + EfcErupc_UpdateEffects(this, play); } -void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EfcErupc_Draw(Actor* thisx, PlayState* play) { EfcErupc* this = (EfcErupc*)thisx; u16 csAction; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_efc_erupc.c", 282); + OPEN_DISPS(play->state.gfxCtx, "../z_efc_erupc.c", 282); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk_14C * 1, this->unk_14E * -4, 32, 64, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->unk_14C * 1, this->unk_14E * -4, 32, 64, 1, this->unk_14C * 4, this->unk_14E * -20, 64, 64)); gSPSegment( POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->unk_150 * -4, 16, 128, 1, 0, this->unk_150 * 12, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, this->unk_150 * -4, 16, 128, 1, 0, this->unk_150 * 12, 32, 32)); gSPSegment( POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->unk_150 * -4, 16, 128, 1, 0, this->unk_150 * 12, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, this->unk_150 * -4, 16, 128, 1, 0, this->unk_150 * 12, 32, 32)); Matrix_Push(); Matrix_Scale(0.8f, 0.8f, 0.8f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_efc_erupc.c", 321), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_efc_erupc.c", 321), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (globalCtx->csCtx.state != 0) { - if ((globalCtx->csCtx.npcActions[1] != 0) && (globalCtx->csCtx.npcActions[1]->action == 2)) { + if (play->csCtx.state != 0) { + if ((play->csCtx.npcActions[1] != 0) && (play->csCtx.npcActions[1]->action == 2)) { gSPDisplayList(POLY_XLU_DISP++, object_efc_erupc_DL_002570); } } Matrix_Pop(); Matrix_Scale(3.4f, 3.4f, 3.4f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_efc_erupc.c", 333), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_efc_erupc.c", 333), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (globalCtx->csCtx.state != 0) { - CsCmdActorAction* csActorAction = globalCtx->csCtx.npcActions[2]; + if (play->csCtx.state != 0) { + CsCmdActorAction* csActorAction = play->csCtx.npcActions[2]; if (csActorAction != 0) { csAction = csActorAction->action; if ((csAction == 2) || (csAction == 3)) { @@ -155,25 +155,25 @@ void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx) { } } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_efc_erupc.c", 356); - EfcErupc_DrawEffects(this->effects, globalCtx); + CLOSE_DISPS(play->state.gfxCtx, "../z_efc_erupc.c", 356); + EfcErupc_DrawEffects(this->effects, play); } -void EfcErupc_DrawEffects(EfcErupcEffect* effect, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EfcErupc_DrawEffects(EfcErupcEffect* effect, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; s32 pad; OPEN_DISPS(gfxCtx, "../z_efc_erupc.c", 368); for (i = 0; i < EFC_ERUPC_EFFECT_COUNT; i++, effect++) { if (effect->isActive) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, object_efc_erupc_DL_002760); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, effect->color.r, effect->color.g, effect->color.b, effect->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 150, 0, 0, 0); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_efc_erupc.c", 393), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -190,7 +190,7 @@ static Color_RGB8 D_8099D770[] = { { 255, 0, 0 }, }; -void EfcErupc_UpdateEffects(EfcErupc* this, GlobalContext* globalCtx) { +void EfcErupc_UpdateEffects(EfcErupc* this, PlayState* play) { s16 i; s16 index; Color_RGB8 effectColors[] = { diff --git a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h index b96914931e..4c9a1edaf6 100644 --- a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h +++ b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h @@ -6,7 +6,7 @@ struct EfcErupc; -typedef void (*EfcErupcActionFunc)(struct EfcErupc*, GlobalContext*); +typedef void (*EfcErupcActionFunc)(struct EfcErupc*, PlayState*); #define EFC_ERUPC_EFFECT_COUNT 100 diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index dad65b14b5..b5b94e03bd 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -9,18 +9,18 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EffDust_Init(Actor* thisx, GlobalContext* globalCtx); -void EffDust_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EffDust_Update(Actor* thisx, GlobalContext* globalCtx); -void EffDust_Draw(Actor* thisx, GlobalContext* globalCtx); +void EffDust_Init(Actor* thisx, PlayState* play); +void EffDust_Destroy(Actor* thisx, PlayState* play); +void EffDust_Update(Actor* thisx, PlayState* play); +void EffDust_Draw(Actor* thisx, PlayState* play); void EffDust_InitPosAndDistance(EffDust* this); -void EffDust_UpdateFunc_8099DB28(EffDust* this, GlobalContext* globalCtx); -void EffDust_UpdateFunc_8099DD74(EffDust* this, GlobalContext* globalCtx); -void EffDust_UpdateFunc_8099DFC0(EffDust* this, GlobalContext* globalCtx); -void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx); -void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx); +void EffDust_UpdateFunc_8099DB28(EffDust* this, PlayState* play); +void EffDust_UpdateFunc_8099DD74(EffDust* this, PlayState* play); +void EffDust_UpdateFunc_8099DFC0(EffDust* this, PlayState* play); +void EffDust_DrawFunc_8099E4F4(Actor* thisx, PlayState* play); +void EffDust_DrawFunc_8099E784(Actor* thisx, PlayState* play); const ActorInit Eff_Dust_InitVars = { ACTOR_EFF_DUST, @@ -59,7 +59,7 @@ void EffDust_InitPosAndDistance(EffDust* this) { this->index = 0; } -void EffDust_Init(Actor* thisx, GlobalContext* globalCtx) { +void EffDust_Init(Actor* thisx, PlayState* play) { EffDust* this = (EffDust*)thisx; EffDustType dustEffect = this->actor.params; @@ -109,10 +109,10 @@ void EffDust_Init(Actor* thisx, GlobalContext* globalCtx) { this->life = 10; } -void EffDust_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EffDust_Destroy(Actor* thisx, PlayState* play) { } -void EffDust_UpdateFunc_8099DB28(EffDust* this, GlobalContext* globalCtx) { +void EffDust_UpdateFunc_8099DB28(EffDust* this, PlayState* play) { s16 theta; s16 fi; f32* distanceTraveled = this->distanceTraveled; @@ -141,7 +141,7 @@ void EffDust_UpdateFunc_8099DB28(EffDust* this, GlobalContext* globalCtx) { } } -void EffDust_UpdateFunc_8099DD74(EffDust* this, GlobalContext* globalCtx) { +void EffDust_UpdateFunc_8099DD74(EffDust* this, PlayState* play) { s16 theta; s16 fi; f32* distanceTraveled = this->distanceTraveled; @@ -170,9 +170,9 @@ void EffDust_UpdateFunc_8099DD74(EffDust* this, GlobalContext* globalCtx) { } } -void EffDust_UpdateFunc_8099DFC0(EffDust* this, GlobalContext* globalCtx) { +void EffDust_UpdateFunc_8099DFC0(EffDust* this, PlayState* play) { s16 theta; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* parent = this->actor.parent; f32* distanceTraveled = this->distanceTraveled; s32 i; @@ -253,16 +253,16 @@ void EffDust_UpdateFunc_8099DFC0(EffDust* this, GlobalContext* globalCtx) { } } -void EffDust_Update(Actor* thisx, GlobalContext* globalCtx) { +void EffDust_Update(Actor* thisx, PlayState* play) { EffDust* this = (EffDust*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { +void EffDust_DrawFunc_8099E4F4(Actor* thisx, PlayState* play2) { EffDust* this = (EffDust*)thisx; - GlobalContext* globalCtx = globalCtx2; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + PlayState* play = play2; + GraphicsContext* gfxCtx = play->state.gfxCtx; Vec3f* initialPositions; f32* distanceTraveled; s32 i; @@ -290,7 +290,7 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { MTXMODE_NEW); Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_dust.c", 449), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -306,15 +306,15 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { CLOSE_DISPS(gfxCtx, "../z_eff_dust.c", 458); } -void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { +void EffDust_DrawFunc_8099E784(Actor* thisx, PlayState* play2) { EffDust* this = (EffDust*)thisx; - GlobalContext* globalCtx = globalCtx2; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + PlayState* play = play2; + GraphicsContext* gfxCtx = play->state.gfxCtx; f32* distanceTraveled; Vec3f* initialPositions; s32 i; f32 aux; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); OPEN_DISPS(gfxCtx, "../z_eff_dust.c", 472); @@ -351,7 +351,7 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_dust.c", 506), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -365,8 +365,8 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { CLOSE_DISPS(gfxCtx, "../z_eff_dust.c", 515); } -void EffDust_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EffDust_Draw(Actor* thisx, PlayState* play) { EffDust* this = (EffDust*)thisx; - this->drawFunc(thisx, globalCtx); + this->drawFunc(thisx, play); } diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h index a53866e555..d5eeaffed4 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h @@ -6,8 +6,8 @@ struct EffDust; -typedef void (*EffDustActionFunc)(struct EffDust*, GlobalContext*); -typedef void (*EffDustDrawFunc)(Actor*, GlobalContext*); +typedef void (*EffDustActionFunc)(struct EffDust*, PlayState*); +typedef void (*EffDustDrawFunc)(Actor*, PlayState*); typedef struct EffDust { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index cd130706d8..adb24be3a3 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -10,13 +10,13 @@ #define FLAGS ACTOR_FLAG_4 -void ElfMsg_Init(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg_Update(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg_Draw(Actor* thisx, GlobalContext* globalCtx); +void ElfMsg_Init(Actor* thisx, PlayState* play); +void ElfMsg_Destroy(Actor* thisx, PlayState* play); +void ElfMsg_Update(Actor* thisx, PlayState* play); +void ElfMsg_Draw(Actor* thisx, PlayState* play); -void ElfMsg_CallNaviCuboid(ElfMsg* this, GlobalContext* globalCtx); -void ElfMsg_CallNaviCylinder(ElfMsg* this, GlobalContext* globalCtx); +void ElfMsg_CallNaviCuboid(ElfMsg* this, PlayState* play); +void ElfMsg_CallNaviCylinder(ElfMsg* this, PlayState* play); const ActorInit Elf_Msg_InitVars = { ACTOR_ELF_MSG, @@ -43,32 +43,32 @@ void ElfMsg_SetupAction(ElfMsg* this, ElfMsgActionFunc actionFunc) { * Checks a scene flag - if flag is set, the actor is killed and function returns 1. Otherwise returns 0. * Can also set a switch flag from params while killing. */ -s32 ElfMsg_KillCheck(ElfMsg* this, GlobalContext* globalCtx) { +s32 ElfMsg_KillCheck(ElfMsg* this, PlayState* play) { if ((this->actor.world.rot.y > 0) && (this->actor.world.rot.y < 0x41) && - Flags_GetSwitch(globalCtx, this->actor.world.rot.y - 1)) { + Flags_GetSwitch(play, this->actor.world.rot.y - 1)) { LOG_STRING("共倒れ", "../z_elf_msg.c", 161); // "Mutual destruction" if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); } Actor_Kill(&this->actor); return 1; - } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(globalCtx, this->actor.room)) { + } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(play, this->actor.room)) { LOG_STRING("共倒れ", "../z_elf_msg.c", 172); // "Mutual destruction" if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); } Actor_Kill(&this->actor); return 1; } else if (((this->actor.params >> 8) & 0x3F) == 0x3F) { return 0; - } else if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { + } else if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { Actor_Kill(&this->actor); return 1; } return 0; } -void ElfMsg_Init(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg_Init(Actor* thisx, PlayState* play) { ElfMsg* this = (ElfMsg*)thisx; // "Conditions for Elf Tag disappearing" @@ -79,7 +79,7 @@ void ElfMsg_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(CYAN) "\nエルフ タグ 出現条件 %d" VT_RST "\n", thisx->shape.rot.y - 0x41); } - if (!ElfMsg_KillCheck(this, globalCtx)) { + if (!ElfMsg_KillCheck(this, play)) { Actor_ProcessInitChain(thisx, sInitChain); if (thisx->world.rot.x == 0) { thisx->scale.z = 0.4f; @@ -104,7 +104,7 @@ void ElfMsg_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ElfMsg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg_Destroy(Actor* thisx, PlayState* play) { } s32 ElfMsg_GetMessageId(ElfMsg* this) { @@ -116,8 +116,8 @@ s32 ElfMsg_GetMessageId(ElfMsg* this) { } } -void ElfMsg_CallNaviCuboid(ElfMsg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void ElfMsg_CallNaviCuboid(ElfMsg* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnElf* navi = (EnElf*)player->naviActor; if ((fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) && @@ -133,8 +133,8 @@ s32 ElfMsg_WithinXZDistance(Vec3f* pos1, Vec3f* pos2, f32 distance) { return (SQ(pos2->x - pos1->x) + SQ(pos2->z - pos1->z)) < SQ(distance); } -void ElfMsg_CallNaviCylinder(ElfMsg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void ElfMsg_CallNaviCylinder(ElfMsg* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnElf* navi = (EnElf*)player->naviActor; if (ElfMsg_WithinXZDistance(&player->actor.world.pos, &this->actor.world.pos, this->actor.scale.x * 100.0f) && @@ -145,41 +145,41 @@ void ElfMsg_CallNaviCylinder(ElfMsg* this, GlobalContext* globalCtx) { } } -void ElfMsg_Update(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg_Update(Actor* thisx, PlayState* play) { ElfMsg* this = (ElfMsg*)thisx; - if (!ElfMsg_KillCheck(this, globalCtx)) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (!ElfMsg_KillCheck(this, play)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); } Actor_Kill(&this->actor); return; } if ((this->actor.world.rot.y <= 0x41) || (this->actor.world.rot.y > 0x80) || - Flags_GetSwitch(globalCtx, this->actor.world.rot.y - 0x41)) { - this->actionFunc(this, globalCtx); + Flags_GetSwitch(play, this->actor.world.rot.y - 0x41)) { + this->actionFunc(this, play); } } } #include "overlays/ovl_Elf_Msg/ovl_Elf_Msg.c" -void ElfMsg_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_elf_msg.c", 436); +void ElfMsg_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_elf_msg.c", 436); if (R_NAVI_MSG_REGION_ALPHA == 0) { return; } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (thisx->params & 0x8000) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 100, 100, R_NAVI_MSG_REGION_ALPHA); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, R_NAVI_MSG_REGION_ALPHA); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_elf_msg.c", 448), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_elf_msg.c", 448), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_809AD278); @@ -189,5 +189,5 @@ void ElfMsg_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, sCylinderDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_elf_msg.c", 457); + CLOSE_DISPS(play->state.gfxCtx, "../z_elf_msg.c", 457); } diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h index 1e7fe65a6a..ba523060f1 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h @@ -6,7 +6,7 @@ struct ElfMsg; -typedef void (*ElfMsgActionFunc)(struct ElfMsg*, GlobalContext*); +typedef void (*ElfMsgActionFunc)(struct ElfMsg*, PlayState*); typedef struct ElfMsg { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c index 1d44f3970c..6d4f79ec49 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void ElfMsg2_Init(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg2_Update(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg2_Draw(Actor* thisx, GlobalContext* globalCtx); +void ElfMsg2_Init(Actor* thisx, PlayState* play); +void ElfMsg2_Destroy(Actor* thisx, PlayState* play); +void ElfMsg2_Update(Actor* thisx, PlayState* play); +void ElfMsg2_Draw(Actor* thisx, PlayState* play); s32 ElfMsg2_GetMessageId(ElfMsg2* this); -void ElfMsg2_WaitUntilActivated(ElfMsg2* this, GlobalContext* globalCtx); -void ElfMsg2_WaitForTextRead(ElfMsg2* this, GlobalContext* globalCtx); +void ElfMsg2_WaitUntilActivated(ElfMsg2* this, PlayState* play); +void ElfMsg2_WaitForTextRead(ElfMsg2* this, PlayState* play); const ActorInit Elf_Msg2_InitVars = { ACTOR_ELF_MSG2, @@ -43,25 +43,25 @@ void ElfMsg2_SetupAction(ElfMsg2* this, ElfMsg2ActionFunc actionFunc) { * Checks a scene flag - if flag is set, the actor is killed and function returns 1. Otherwise returns 0. * Can also set a switch flag from params while killing. */ -s32 ElfMsg2_KillCheck(ElfMsg2* this, GlobalContext* globalCtx) { +s32 ElfMsg2_KillCheck(ElfMsg2* this, PlayState* play) { if ((this->actor.world.rot.y > 0) && (this->actor.world.rot.y < 0x41) && - Flags_GetSwitch(globalCtx, this->actor.world.rot.y - 1)) { + Flags_GetSwitch(play, this->actor.world.rot.y - 1)) { LOG_STRING("共倒れ", "../z_elf_msg2.c", 171); // "Mutual destruction" if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(globalCtx, ((this->actor.params >> 8) & 0x3F)); + Flags_SetSwitch(play, ((this->actor.params >> 8) & 0x3F)); } Actor_Kill(&this->actor); return 1; - } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(globalCtx, this->actor.room)) { + } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(play, this->actor.room)) { LOG_STRING("共倒れ2", "../z_elf_msg2.c", 182); // "Mutual destruction 2" if (((this->actor.params >> 8) & 0x3F) != 0x3F) { - Flags_SetSwitch(globalCtx, ((this->actor.params >> 8) & 0x3F)); + Flags_SetSwitch(play, ((this->actor.params >> 8) & 0x3F)); } Actor_Kill(&this->actor); return 1; } else if (((this->actor.params >> 8) & 0x3F) == 0x3F) { return 0; - } else if (Flags_GetSwitch(globalCtx, ((this->actor.params >> 8) & 0x3F))) { + } else if (Flags_GetSwitch(play, ((this->actor.params >> 8) & 0x3F))) { LOG_STRING("共倒れ", "../z_elf_msg2.c", 192); // "Mutual destruction" Actor_Kill(&this->actor); return 1; @@ -69,11 +69,11 @@ s32 ElfMsg2_KillCheck(ElfMsg2* this, GlobalContext* globalCtx) { return 0; } -void ElfMsg2_Init(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg2_Init(Actor* thisx, PlayState* play) { ElfMsg2* this = (ElfMsg2*)thisx; osSyncPrintf(VT_FGCOL(CYAN) " Elf_Msg2_Actor_ct %04x\n\n" VT_RST, this->actor.params); - if (!ElfMsg2_KillCheck(this, globalCtx)) { + if (!ElfMsg2_KillCheck(this, play)) { if ((this->actor.world.rot.x > 0) && (this->actor.world.rot.x < 8)) { this->actor.targetMode = this->actor.world.rot.x - 1; } @@ -89,7 +89,7 @@ void ElfMsg2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ElfMsg2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg2_Destroy(Actor* thisx, PlayState* play) { } s32 ElfMsg2_GetMessageId(ElfMsg2* this) { @@ -100,15 +100,15 @@ s32 ElfMsg2_GetMessageId(ElfMsg2* this) { * Runs while Navi text is up. Kills the actor upon closing the text box unless rot.z == 1, can also set a switch flag * from params. */ -void ElfMsg2_WaitForTextClose(ElfMsg2* this, GlobalContext* globalCtx) { +void ElfMsg2_WaitForTextClose(ElfMsg2* this, PlayState* play) { s32 switchFlag; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.world.rot.z != 1) { Actor_Kill(&this->actor); switchFlag = (this->actor.params >> 8) & 0x3F; if (switchFlag != 0x3F) { - Flags_SetSwitch(globalCtx, switchFlag); + Flags_SetSwitch(play, switchFlag); } } else { ElfMsg2_SetupAction(this, ElfMsg2_WaitForTextRead); @@ -119,8 +119,8 @@ void ElfMsg2_WaitForTextClose(ElfMsg2* this, GlobalContext* globalCtx) { /** * Runs while Navi text is not up. */ -void ElfMsg2_WaitForTextRead(ElfMsg2* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void ElfMsg2_WaitForTextRead(ElfMsg2* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { ElfMsg2_SetupAction(this, ElfMsg2_WaitForTextClose); } } @@ -128,40 +128,40 @@ void ElfMsg2_WaitForTextRead(ElfMsg2* this, GlobalContext* globalCtx) { /** * Idles until a switch flag is set, at which point the actor becomes interactable */ -void ElfMsg2_WaitUntilActivated(ElfMsg2* this, GlobalContext* globalCtx) { +void ElfMsg2_WaitUntilActivated(ElfMsg2* this, PlayState* play) { // If (y >= 0x41) && (y <= 0x80), Idles until switch flag (actor.world.rot.y - 0x41) is set // If (y > 0x80), Idles forever (Bug?) if ((this->actor.world.rot.y >= 0x41) && (this->actor.world.rot.y <= 0x80) && - (Flags_GetSwitch(globalCtx, (this->actor.world.rot.y - 0x41)))) { + (Flags_GetSwitch(play, (this->actor.world.rot.y - 0x41)))) { ElfMsg2_SetupAction(this, ElfMsg2_WaitForTextRead); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_18; // Make actor targetable and Navi-checkable this->actor.textId = ElfMsg2_GetMessageId(this); } } -void ElfMsg2_Update(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg2_Update(Actor* thisx, PlayState* play) { ElfMsg2* this = (ElfMsg2*)thisx; - if (!ElfMsg2_KillCheck(this, globalCtx)) { - this->actionFunc(this, globalCtx); + if (!ElfMsg2_KillCheck(this, play)) { + this->actionFunc(this, play); } } #include "overlays/ovl_Elf_Msg2/ovl_Elf_Msg2.c" -void ElfMsg2_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_elf_msg2.c", 355); +void ElfMsg2_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_elf_msg2.c", 355); if (R_NAVI_MSG_REGION_ALPHA == 0) { return; } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 100, 255, R_NAVI_MSG_REGION_ALPHA); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_elf_msg2.c", 362), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_elf_msg2.c", 362), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_809ADC38); gSPDisplayList(POLY_XLU_DISP++, sCubeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_elf_msg2.c", 367); + CLOSE_DISPS(play->state.gfxCtx, "../z_elf_msg2.c", 367); } diff --git a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h index 741e72cbb6..802769f2b7 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h @@ -6,7 +6,7 @@ struct ElfMsg2; -typedef void (*ElfMsg2ActionFunc)(struct ElfMsg2*, GlobalContext*); +typedef void (*ElfMsg2ActionFunc)(struct ElfMsg2*, PlayState*); typedef struct ElfMsg2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index 839d2fa203..1bc0c22e21 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -10,23 +10,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_26) -void EnAm_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAm_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAm_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAm_Init(Actor* thisx, PlayState* play); +void EnAm_Destroy(Actor* thisx, PlayState* play); +void EnAm_Update(Actor* thisx, PlayState* play); +void EnAm_Draw(Actor* thisx, PlayState* play); void EnAm_SetupStatue(EnAm* this); void EnAm_SetupSleep(EnAm* this); -void EnAm_Statue(EnAm* this, GlobalContext* globalCtx); -void EnAm_Sleep(EnAm* this, GlobalContext* globalCtx); -void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx); -void EnAm_RotateToHome(EnAm* this, GlobalContext* globalCtx); -void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx); -void EnAm_RotateToInit(EnAm* this, GlobalContext* globalCtx); -void EnAm_Cooldown(EnAm* this, GlobalContext* globalCtx); -void EnAm_Ricochet(EnAm* this, GlobalContext* globalCtx); -void EnAm_Stunned(EnAm* this, GlobalContext* globalCtx); -void EnAm_RecoilFromDamage(EnAm* this, GlobalContext* globalCtx); +void EnAm_Statue(EnAm* this, PlayState* play); +void EnAm_Sleep(EnAm* this, PlayState* play); +void EnAm_Lunge(EnAm* this, PlayState* play); +void EnAm_RotateToHome(EnAm* this, PlayState* play); +void EnAm_MoveToHome(EnAm* this, PlayState* play); +void EnAm_RotateToInit(EnAm* this, PlayState* play); +void EnAm_Cooldown(EnAm* this, PlayState* play); +void EnAm_Ricochet(EnAm* this, PlayState* play); +void EnAm_Stunned(EnAm* this, PlayState* play); +void EnAm_RecoilFromDamage(EnAm* this, PlayState* play); typedef enum { /* 00 */ AM_BEHAVIOR_NONE, @@ -173,7 +173,7 @@ void EnAm_SetupAction(EnAm* this, EnAmActionFunc actionFunc) { * If it won't land on the ground, it will return true anyway if the floor the armos will be on * is no more than 20 units lower than the home position. This prevents the armos from going down steep slopes. */ -s32 EnAm_CanMove(EnAm* this, GlobalContext* globalCtx, f32 distance, s16 yaw) { +s32 EnAm_CanMove(EnAm* this, PlayState* play, f32 distance, s16 yaw) { s16 ret; s16 curBgCheckFlags; f32 sin; @@ -190,7 +190,7 @@ s32 EnAm_CanMove(EnAm* this, GlobalContext* globalCtx, f32 distance, s16 yaw) { this->dyna.actor.world.pos.x += sin; this->dyna.actor.world.pos.z += cos; - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); this->dyna.actor.world.pos = curPos; ret = this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND; @@ -203,34 +203,33 @@ s32 EnAm_CanMove(EnAm* this, GlobalContext* globalCtx, f32 distance, s16 yaw) { return ret; } -void EnAm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; s32 pad; EnAm* this = (EnAm*)thisx; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 48.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gArmosSkel, &gArmosRicochetAnim, this->jointTable, this->morphTable, - 14); + SkelAnime_Init(play, &this->skelAnime, &gArmosSkel, &gArmosRicochetAnim, this->jointTable, this->morphTable, 14); Actor_SetScale(&this->dyna.actor, 0.01f); DynaPolyActor_Init(&this->dyna, DPM_UNK); - Collider_InitCylinder(globalCtx, &this->hurtCollider); - Collider_InitCylinder(globalCtx, &this->blockCollider); - Collider_SetCylinder(globalCtx, &this->hurtCollider, &this->dyna.actor, &sHurtCylinderInit); + Collider_InitCylinder(play, &this->hurtCollider); + Collider_InitCylinder(play, &this->blockCollider); + Collider_SetCylinder(play, &this->hurtCollider, &this->dyna.actor, &sHurtCylinderInit); if (this->dyna.actor.params == ARMOS_STATUE) { this->dyna.actor.colChkInfo.health = 1; - Collider_SetCylinder(globalCtx, &this->blockCollider, &this->dyna.actor, &sHurtCylinderInit); + Collider_SetCylinder(play, &this->blockCollider, &this->dyna.actor, &sHurtCylinderInit); this->hurtCollider.base.ocFlags1 = (OC1_ON | OC1_NO_PUSH | OC1_TYPE_1 | OC1_TYPE_2); this->blockCollider.base.ocFlags1 = (OC1_ON | OC1_NO_PUSH | OC1_TYPE_PLAYER); CollisionHeader_GetVirtual(&gArmosCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, ACTORCAT_BG); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + Actor_ChangeCategory(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_BG); EnAm_SetupStatue(this); } else { - Collider_SetCylinder(globalCtx, &this->blockCollider, &this->dyna.actor, &sBlockCylinderInit); - Collider_InitQuad(globalCtx, &this->hitCollider); - Collider_SetQuad(globalCtx, &this->hitCollider, &this->dyna.actor, &sQuadInit); + Collider_SetCylinder(play, &this->blockCollider, &this->dyna.actor, &sBlockCylinderInit); + Collider_InitQuad(play, &this->hitCollider); + Collider_SetQuad(play, &this->hitCollider, &this->dyna.actor, &sQuadInit); this->dyna.actor.colChkInfo.health = 1; this->dyna.actor.colChkInfo.damageTable = &sDamageTable; EnAm_SetupSleep(this); @@ -240,17 +239,17 @@ void EnAm_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.colChkInfo.mass = MASS_HEAVY; } -void EnAm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnAm* this = (EnAm*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->hurtCollider); - Collider_DestroyCylinder(globalCtx, &this->blockCollider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->hurtCollider); + Collider_DestroyCylinder(play, &this->blockCollider); //! @bug Quad collider is not destroyed (though destroy doesnt really do anything anyway) } -void EnAm_SpawnEffects(EnAm* this, GlobalContext* globalCtx) { +void EnAm_SpawnEffects(EnAm* this, PlayState* play) { static Vec3f velocity = { 0.0f, -1.5f, 0.0f }; static Vec3f accel = { 0.0f, -0.2f, 0.0f }; s32 i; @@ -264,11 +263,11 @@ void EnAm_SpawnEffects(EnAm* this, GlobalContext* globalCtx) { pos.y = (this->dyna.actor.world.pos.y + 40.0f) + ((Rand_ZeroOne() - 0.5f) * 10.0f); pos.z = this->dyna.actor.world.pos.z + ((Rand_ZeroOne() - 0.5f) * 65.0f); - EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &velocity, &accel, &primColor, &envColor); + EffectSsKiraKira_SpawnSmall(play, &pos, &velocity, &accel, &primColor, &envColor); } Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 4.0f, 3, 8.0f, 300, 15, false); + Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 4.0f, 3, 8.0f, 300, 15, false); } void EnAm_SetupSleep(EnAm* this) { @@ -334,27 +333,27 @@ void EnAm_SetupRotateToHome(EnAm* this) { EnAm_SetupAction(this, EnAm_RotateToHome); } -void EnAm_SetupRecoilFromDamage(EnAm* this, GlobalContext* globalCtx) { +void EnAm_SetupRecoilFromDamage(EnAm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gArmosDamagedAnim, 1.0f, 4.0f, Animation_GetLastFrame(&gArmosDamagedAnim) - 6.0f, ANIMMODE_ONCE, 0.0f); this->behavior = AM_BEHAVIOR_DAMAGED; this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_DAMAGE); - if (EnAm_CanMove(this, globalCtx, -6.0f, this->dyna.actor.world.rot.y)) { + if (EnAm_CanMove(this, play, -6.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = -6.0f; } this->dyna.actor.colorFilterTimer = 0; - Enemy_StartFinishingBlow(globalCtx, &this->dyna.actor); + Enemy_StartFinishingBlow(play, &this->dyna.actor); EnAm_SetupAction(this, EnAm_RecoilFromDamage); } -void EnAm_SetupRicochet(EnAm* this, GlobalContext* globalCtx) { +void EnAm_SetupRicochet(EnAm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gArmosRicochetAnim, 1.0f, 0.0f, 8.0f, ANIMMODE_ONCE, 0.0f); this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer; - if (EnAm_CanMove(this, globalCtx, -6.0f, this->dyna.actor.world.rot.y)) { + if (EnAm_CanMove(this, play, -6.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = -6.0f; } @@ -365,12 +364,12 @@ void EnAm_SetupRicochet(EnAm* this, GlobalContext* globalCtx) { EnAm_SetupAction(this, EnAm_Ricochet); } -void EnAm_Sleep(EnAm* this, GlobalContext* globalCtx) { +void EnAm_Sleep(EnAm* this, PlayState* play) { f32 cos; s32 pad; f32 rand; f32 sin; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->unk_258 != 0) || ((this->hurtCollider.base.ocFlags1 & OC1_HIT) && (this->hurtCollider.base.oc == &player->actor)) || @@ -432,7 +431,7 @@ void EnAm_Sleep(EnAm* this, GlobalContext* globalCtx) { /** * Spin toward the direction of the home position to start moving back to it. */ -void EnAm_RotateToHome(EnAm* this, GlobalContext* globalCtx) { +void EnAm_RotateToHome(EnAm* this, PlayState* play) { s16 yawToHome = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos); if (this->skelAnime.curFrame == 8.0f) { @@ -442,7 +441,7 @@ void EnAm_RotateToHome(EnAm* this, GlobalContext* globalCtx) { if (!(this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->skelAnime.curFrame = 11; } else { - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); if (this->dyna.actor.world.rot.y == yawToHome) { this->unk_258 = 0; @@ -465,7 +464,7 @@ void EnAm_RotateToHome(EnAm* this, GlobalContext* globalCtx) { /** * After reaching the home position, spin back to the starting rotation. */ -void EnAm_RotateToInit(EnAm* this, GlobalContext* globalCtx) { +void EnAm_RotateToInit(EnAm* this, PlayState* play) { if (this->skelAnime.curFrame == 8.0f) { if ((this->dyna.actor.world.pos.x == this->dyna.actor.home.pos.x) && (this->dyna.actor.world.pos.z == this->dyna.actor.home.pos.z)) { @@ -478,7 +477,7 @@ void EnAm_RotateToInit(EnAm* this, GlobalContext* globalCtx) { this->skelAnime.curFrame = 11; } else { this->unk_258 = 1; - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); if (this->dyna.actor.home.rot.y == this->dyna.actor.world.rot.y) { this->unk_258 = 0; @@ -503,7 +502,7 @@ void EnAm_RotateToInit(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; } -void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx) { +void EnAm_MoveToHome(EnAm* this, PlayState* play) { s16 yawToHome = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos); if (this->skelAnime.curFrame == 8.0f) { @@ -522,7 +521,7 @@ void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.speedXZ = 0.0f; this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); if (Actor_WorldDistXYZToPoint(&this->dyna.actor, &this->dyna.actor.home.pos) < 80.0f) { EnAm_SetupRotateToInit(this); @@ -541,12 +540,12 @@ void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; } -void EnAm_RecoilFromDamage(EnAm* this, GlobalContext* globalCtx) { +void EnAm_RecoilFromDamage(EnAm* this, PlayState* play) { if (this->dyna.actor.speedXZ < 0.0f) { this->dyna.actor.speedXZ += 0.5f; } - if ((this->dyna.actor.velocity.y <= 0.0f) && !EnAm_CanMove(this, globalCtx, -8.0f, this->dyna.actor.world.rot.y)) { + if ((this->dyna.actor.velocity.y <= 0.0f) && !EnAm_CanMove(this, play, -8.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = 0.0f; } @@ -561,7 +560,7 @@ void EnAm_RecoilFromDamage(EnAm* this, GlobalContext* globalCtx) { * After doing 3 lunges, wait for 2 seconds before attacking again. * Turn toward the player before lunging again. */ -void EnAm_Cooldown(EnAm* this, GlobalContext* globalCtx) { +void EnAm_Cooldown(EnAm* this, PlayState* play) { s16 yawDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.world.rot.y; yawDiff = ABS(yawDiff); @@ -581,7 +580,7 @@ void EnAm_Cooldown(EnAm* this, GlobalContext* globalCtx) { } this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); } } @@ -600,12 +599,12 @@ void EnAm_Cooldown(EnAm* this, GlobalContext* globalCtx) { * Lunge toward the player in an attempt to deal damage. Hop 3 times. * Used for both normal attacks and the death sequence. */ -void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx) { +void EnAm_Lunge(EnAm* this, PlayState* play) { if (this->deathTimer < 52) { if (this->skelAnime.curFrame == 8.0f) { this->dyna.actor.velocity.y = 12.0f; - if (EnAm_CanMove(this, globalCtx, 80.0f, this->dyna.actor.world.rot.y)) { + if (EnAm_CanMove(this, play, 80.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = 6.0f; } else { this->dyna.actor.speedXZ = 0.0f; @@ -627,7 +626,7 @@ void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.speedXZ = 0.0f; this->unk_264 = 0; this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); if (((Actor_WorldDistXZToPoint(&this->dyna.actor, &this->dyna.actor.home.pos) > 240.0f) || (this->attackTimer == 0)) && @@ -662,8 +661,8 @@ void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx) { } } -void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnAm_Statue(EnAm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp158f = this->dyna.unk_158; s16 moveDir = 0; @@ -685,8 +684,8 @@ void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) { if ((this->dyna.unk_150 == 0.0f) || (this->unk_258 == 0) || !(this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) || - !func_800435D8(globalCtx, &this->dyna, 0x14, - (Math_SinS(this->unk_258) * (this->dyna.unk_150 * 0.5f)) + 40.0f, 0xA) || + !func_800435D8(play, &this->dyna, 0x14, (Math_SinS(this->unk_258) * (this->dyna.unk_150 * 0.5f)) + 40.0f, + 0xA) || ((this->hurtCollider.base.ocFlags1 & OC1_HIT) && (ABS(moveDir) <= 0x2000))) { this->unk_258 = 0; @@ -706,7 +705,7 @@ void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) { this->dyna.unk_150 = this->dyna.unk_154 = 0.0f; } -void EnAm_SetupStunned(EnAm* this, GlobalContext* globalCtx) { +void EnAm_SetupStunned(EnAm* this, PlayState* play) { // animation is set but SkelAnime_Update is not called in the action // likely copy pasted from EnAm_SetupRecoilFromDamage Animation_Change(&this->skelAnime, &gArmosDamagedAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gArmosDamagedAnim), @@ -714,7 +713,7 @@ void EnAm_SetupStunned(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer; - if (EnAm_CanMove(this, globalCtx, -6.0f, this->dyna.actor.world.rot.y)) { + if (EnAm_CanMove(this, play, -6.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = -6.0f; } @@ -729,14 +728,14 @@ void EnAm_SetupStunned(EnAm* this, GlobalContext* globalCtx) { EnAm_SetupAction(this, EnAm_Stunned); } -void EnAm_Stunned(EnAm* this, GlobalContext* globalCtx) { +void EnAm_Stunned(EnAm* this, PlayState* play) { Math_SmoothStepToS(&this->dyna.actor.shape.rot.y, this->dyna.actor.world.rot.y, 1, 0xFA0, 0); if (this->dyna.actor.speedXZ < 0.0f) { this->dyna.actor.speedXZ += 0.5f; } - if ((this->dyna.actor.velocity.y <= 0.0f) && !EnAm_CanMove(this, globalCtx, -9.0f, this->dyna.actor.world.rot.y)) { + if ((this->dyna.actor.velocity.y <= 0.0f) && !EnAm_CanMove(this, play, -9.0f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = 0.0f; } @@ -744,18 +743,18 @@ void EnAm_Stunned(EnAm* this, GlobalContext* globalCtx) { if (this->dyna.actor.colChkInfo.health != 0) { EnAm_SetupLunge(this); } else { - EnAm_SetupRecoilFromDamage(this, globalCtx); + EnAm_SetupRecoilFromDamage(this, play); } } } -void EnAm_Ricochet(EnAm* this, GlobalContext* globalCtx) { +void EnAm_Ricochet(EnAm* this, PlayState* play) { if (this->dyna.actor.speedXZ < 0.0f) { this->dyna.actor.speedXZ += 0.5f; } if ((this->dyna.actor.velocity.y <= 0.0f) && - !EnAm_CanMove(this, globalCtx, this->dyna.actor.speedXZ * 1.5f, this->dyna.actor.world.rot.y)) { + !EnAm_CanMove(this, play, this->dyna.actor.speedXZ * 1.5f, this->dyna.actor.world.rot.y)) { this->dyna.actor.speedXZ = 0.0f; } @@ -765,7 +764,7 @@ void EnAm_Ricochet(EnAm* this, GlobalContext* globalCtx) { } } -void EnAm_TransformSwordHitbox(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_TransformSwordHitbox(Actor* thisx, PlayState* play) { static Vec3f D_809B0074 = { 2500.0f, 7000.0f, 0.0f }; static Vec3f D_809B0080 = { -2500.0f, 0.0f, 0.0f }; static Vec3f D_809B008C = { 2500.0f, 7000.0f, 4000.0f }; @@ -781,7 +780,7 @@ void EnAm_TransformSwordHitbox(Actor* thisx, GlobalContext* globalCtx) { &this->hitCollider.dim.quad[2], &this->hitCollider.dim.quad[3]); } -void EnAm_UpdateDamage(EnAm* this, GlobalContext* globalCtx) { +void EnAm_UpdateDamage(EnAm* this, PlayState* play) { s32 pad; Vec3f sparkPos; @@ -791,7 +790,7 @@ void EnAm_UpdateDamage(EnAm* this, GlobalContext* globalCtx) { this->hurtCollider.base.acFlags &= ~AC_HIT; if (this->behavior >= AM_BEHAVIOR_5) { - EnAm_SetupRicochet(this, globalCtx); + EnAm_SetupRicochet(this, play); } } else if ((this->hurtCollider.base.acFlags & AC_HIT) && (this->behavior >= AM_BEHAVIOR_5)) { this->hurtCollider.base.acFlags &= ~AC_HIT; @@ -805,7 +804,7 @@ void EnAm_UpdateDamage(EnAm* this, GlobalContext* globalCtx) { (this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_STUN) || (this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_ICE)) { if (this->behavior != AM_BEHAVIOR_STUNNED) { - EnAm_SetupStunned(this, globalCtx); + EnAm_SetupStunned(this, play); if (this->dyna.actor.colChkInfo.damage != 0) { this->dyna.actor.colChkInfo.health = 0; @@ -813,22 +812,22 @@ void EnAm_UpdateDamage(EnAm* this, GlobalContext* globalCtx) { } else if (this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_STUN) { sparkPos = this->dyna.actor.world.pos; sparkPos.y += 50.0f; - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &sparkPos); + CollisionCheck_SpawnShieldParticlesMetal(play, &sparkPos); } } else if ((this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_KILL) || (this->behavior == AM_BEHAVIOR_STUNNED)) { this->dyna.actor.colChkInfo.health = 0; - EnAm_SetupRecoilFromDamage(this, globalCtx); + EnAm_SetupRecoilFromDamage(this, play); } else { - EnAm_SetupRicochet(this, globalCtx); + EnAm_SetupRicochet(this, play); } } } } } -void EnAm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Update(Actor* thisx, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 dustPrimColor = { 150, 150, 150, 255 }; static Color_RGBA8 dustEnvColor = { 100, 100, 100, 150 }; @@ -841,7 +840,7 @@ void EnAm_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad1; if (this->dyna.actor.params != ARMOS_STATUE) { - EnAm_UpdateDamage(this, globalCtx); + EnAm_UpdateDamage(this, play); } if (this->dyna.actor.colChkInfo.damageEffect != AM_DMGEFF_MAGIC_FIRE_LIGHT) { @@ -849,31 +848,31 @@ void EnAm_Update(Actor* thisx, GlobalContext* globalCtx) { this->attackTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->deathTimer != 0) { this->deathTimer--; if (this->deathTimer == 0) { - dustPosScale = globalCtx->gameplayFrames * 10; + dustPosScale = play->gameplayFrames * 10; - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); bomb = - (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->dyna.actor.world.pos.x, + (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 2, BOMB_BODY); if (bomb != NULL) { bomb->timer = 0; } Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_DEAD); - Item_DropCollectibleRandom(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 0xA0); + Item_DropCollectibleRandom(play, &this->dyna.actor, &this->dyna.actor.world.pos, 0xA0); for (i = 9; i >= 0; i--) { dustPos.x = (sinf(dustPosScale) * 7.0f) + this->dyna.actor.world.pos.x; dustPos.y = (Rand_CenteredFloat(10.0f) * 6.0f) + (this->dyna.actor.world.pos.y + 40.0f); dustPos.z = (cosf(dustPosScale) * 7.0f) + this->dyna.actor.world.pos.z; - func_8002836C(globalCtx, &dustPos, &zeroVec, &zeroVec, &dustPrimColor, &dustEnvColor, 200, 45, 12); + func_8002836C(play, &dustPos, &zeroVec, &zeroVec, &dustPrimColor, &dustEnvColor, 200, 45, 12); dustPosScale += 60.0f; } @@ -887,53 +886,53 @@ void EnAm_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 20.0f, 28.0f, 80.0f, + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 28.0f, 80.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } Collider_UpdateCylinder(&this->dyna.actor, &this->hurtCollider); Collider_UpdateCylinder(&this->dyna.actor, &this->blockCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->hurtCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->hurtCollider.base); if (this->dyna.actor.params != ARMOS_STATUE) { Actor_SetFocus(&this->dyna.actor, this->dyna.actor.scale.x * 4500.0f); if (this->dyna.actor.colorFilterTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->blockCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->blockCollider.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->hurtCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->hurtCollider.base); if ((this->behavior >= 4) && (this->unk_264 > 0)) { if (!(this->hitCollider.base.atFlags & AT_BOUNCED)) { if (this->hitCollider.base.atFlags & AT_HIT) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->hitCollider.base.at == &player->actor) { Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->hitCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->hitCollider.base); } else { this->hitCollider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); this->hitCollider.base.at = NULL; - EnAm_SetupRicochet(this, globalCtx); + EnAm_SetupRicochet(this, play); } } } else { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->blockCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->blockCollider.base); } } static Vec3f sUnused1 = { 1100.0f, -700.0f, 0.0f }; static Vec3f sUnused2 = { 0.0f, 0.0f, 0.0f }; -void EnAm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnAm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnAm* this = (EnAm*)thisx; if ((limbIndex == 1) && (this->unk_264 != 0)) { - EnAm_TransformSwordHitbox(&this->dyna.actor, globalCtx); + EnAm_TransformSwordHitbox(&this->dyna.actor, play); } } @@ -943,16 +942,16 @@ static Vec3f sIcePosOffsets[] = { { 10.0f, 20.0f, -10.0f }, { 0.0f, 40.0f, 20.0f }, { -10.0f, 20.0f, 10.0f }, { -10.0f, 20.0f, -10.0f }, }; -void EnAm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Draw(Actor* thisx, PlayState* play) { s32 pad; Vec3f sp68; EnAm* this = (EnAm*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_am.c", 1580); + OPEN_DISPS(play->state.gfxCtx, "../z_en_am.c", 1580); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->textureBlend); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnAm_PostLimbDraw, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnAm_PostLimbDraw, this); if (this->iceTimer != 0) { this->dyna.actor.colorFilterTimer++; @@ -968,10 +967,9 @@ void EnAm_Draw(Actor* thisx, GlobalContext* globalCtx) { sp68.y = this->dyna.actor.world.pos.y + sIcePosOffsets[index].y; sp68.z = this->dyna.actor.world.pos.z + sIcePosOffsets[index].z; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->dyna.actor, &sp68, 150, 150, 150, 250, 235, 245, 255, - 1.4f); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->dyna.actor, &sp68, 150, 150, 150, 250, 235, 245, 255, 1.4f); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_am.c", 1605); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_am.c", 1605); } diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.h b/src/overlays/actors/ovl_En_Am/z_en_am.h index 6cb4c40ecd..61e9042f9e 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.h +++ b/src/overlays/actors/ovl_En_Am/z_en_am.h @@ -6,7 +6,7 @@ struct EnAm; -typedef void (*EnAmActionFunc)(struct EnAm*, GlobalContext*); +typedef void (*EnAmActionFunc)(struct EnAm*, PlayState*); typedef struct EnAm { /* 0x0000 */ DynaPolyActor dyna; 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 97a3669837..24aa4759fc 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -9,22 +9,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnAni_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAni_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAni_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAni_Init(Actor* thisx, PlayState* play); +void EnAni_Destroy(Actor* thisx, PlayState* play); +void EnAni_Update(Actor* thisx, PlayState* play); +void EnAni_Draw(Actor* thisx, PlayState* play); -s32 EnAni_SetText(EnAni* this, GlobalContext* globalCtx, u16 textId); -void func_809B04F0(EnAni* this, GlobalContext* globalCtx); -void func_809B0524(EnAni* this, GlobalContext* globalCtx); -void func_809B0558(EnAni* this, GlobalContext* globalCtx); -void func_809B05F0(EnAni* this, GlobalContext* globalCtx); -void func_809B064C(EnAni* this, GlobalContext* globalCtx); -void func_809B07F8(EnAni* this, GlobalContext* globalCtx); -void func_809B0988(EnAni* this, GlobalContext* globalCtx); -void func_809B0994(EnAni* this, GlobalContext* globalCtx); -void func_809B0A28(EnAni* this, GlobalContext* globalCtx); -void func_809B0A6C(EnAni* this, GlobalContext* globalCtx); +s32 EnAni_SetText(EnAni* this, PlayState* play, u16 textId); +void func_809B04F0(EnAni* this, PlayState* play); +void func_809B0524(EnAni* this, PlayState* play); +void func_809B0558(EnAni* this, PlayState* play); +void func_809B05F0(EnAni* this, PlayState* play); +void func_809B064C(EnAni* this, PlayState* play); +void func_809B07F8(EnAni* this, PlayState* play); +void func_809B0988(EnAni* this, PlayState* play); +void func_809B0994(EnAni* this, PlayState* play); +void func_809B0A28(EnAni* this, PlayState* play); +void func_809B0A6C(EnAni* this, PlayState* play); const ActorInit En_Ani_InitVars = { ACTOR_EN_ANI, @@ -67,17 +67,17 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 850, ICHAIN_STOP), }; -void EnAni_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAni_Init(Actor* thisx, PlayState* play) { s32 pad; EnAni* this = (EnAni*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, -2800.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRoofManSkel, &gRoofManIdleAnim, this->jointTable, - this->morphTable, 0x10); + SkelAnime_InitFlex(play, &this->skelAnime, &gRoofManSkel, &gRoofManIdleAnim, this->jointTable, this->morphTable, + 0x10); Animation_PlayOnce(&this->skelAnime, &gRoofManIdleAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; if (!LINK_IS_ADULT) { EnAni_SetupAction(this, func_809B064C); @@ -90,33 +90,33 @@ void EnAni_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.velocity.y = -1.0f; } -void EnAni_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAni_Destroy(Actor* thisx, PlayState* play) { EnAni* this = (EnAni*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 EnAni_SetText(EnAni* this, GlobalContext* globalCtx, u16 textId) { +s32 EnAni_SetText(EnAni* this, PlayState* play, u16 textId) { this->actor.textId = textId; this->unk_2A8 |= 1; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); return 0; } -void func_809B04F0(EnAni* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_809B04F0(EnAni* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { EnAni_SetupAction(this, func_809B064C); } } -void func_809B0524(EnAni* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_809B0524(EnAni* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { EnAni_SetupAction(this, func_809B07F8); } } -void func_809B0558(EnAni* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809B0558(EnAni* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; if (!LINK_IS_ADULT) { EnAni_SetupAction(this, func_809B04F0); @@ -125,23 +125,23 @@ void func_809B0558(EnAni* this, GlobalContext* globalCtx) { } SET_ITEMGETINF(ITEMGETINF_15); } else { - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f); + func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 200.0f); } } -void func_809B05F0(EnAni* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_809B05F0(EnAni* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { EnAni_SetupAction(this, func_809B0558); } - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f); + func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 200.0f); } -void func_809B064C(EnAni* this, GlobalContext* globalCtx) { +void func_809B064C(EnAni* this, PlayState* play) { u16 textId; s16 yawDiff; u16 textId2; - textId2 = Text_GetFaceReaction(globalCtx, 0xA); + textId2 = Text_GetFaceReaction(play, 0xA); textId = textId2 & 0xFFFF; if (!textId) {} @@ -151,7 +151,7 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) { } yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->actor.textId == 0x5056) { EnAni_SetupAction(this, func_809B04F0); } else if (this->actor.textId == 0x5055) { @@ -162,22 +162,22 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) { } else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistToPlayer < 150.0f && -80.0f < this->actor.yDistToPlayer) { if (GET_ITEMGETINF(ITEMGETINF_15)) { - EnAni_SetText(this, globalCtx, 0x5056); + EnAni_SetText(this, play, 0x5056); } else { - EnAni_SetText(this, globalCtx, 0x5055); + EnAni_SetText(this, play, 0x5055); } } else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) { - EnAni_SetText(this, globalCtx, textId); + EnAni_SetText(this, play, textId); } } -void func_809B07F8(EnAni* this, GlobalContext* globalCtx) { +void func_809B07F8(EnAni* this, PlayState* play) { s16 pad; s16 yawDiff; u16 textId; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->actor.textId == 0x5056) { EnAni_SetupAction(this, func_809B0524); } else if (this->actor.textId == 0x5055) { @@ -188,9 +188,9 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) { } else if (yawDiff > -0x36B0 && yawDiff < 0 && this->actor.xzDistToPlayer < 150.0f && -80.0f < this->actor.yDistToPlayer) { if (GET_ITEMGETINF(ITEMGETINF_15)) { - EnAni_SetText(this, globalCtx, 0x5056); + EnAni_SetText(this, play, 0x5056); } else { - EnAni_SetText(this, globalCtx, 0x5055); + EnAni_SetText(this, play, 0x5055); } } else if (yawDiff > -0x3E8 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) { if (!GET_EVENTCHKINF(EVENTCHKINF_2F)) { @@ -198,15 +198,15 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) { } else { textId = GET_ITEMGETINF(ITEMGETINF_15) ? 0x5054 : 0x5053; } - EnAni_SetText(this, globalCtx, textId); + EnAni_SetText(this, play, textId); } } -void func_809B0988(EnAni* this, GlobalContext* globalCtx) { +void func_809B0988(EnAni* this, PlayState* play) { } -void func_809B0994(EnAni* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.npcActions[0]->action == 4) { +void func_809B0994(EnAni* this, PlayState* play) { + if (play->csCtx.npcActions[0]->action == 4) { Animation_Change(&this->skelAnime, &gRoofManGettingUpAfterKnockbackAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gRoofManGettingUpAfterKnockbackAnim), ANIMMODE_ONCE, -4.0f); this->unk_2AA++; @@ -214,17 +214,17 @@ void func_809B0994(EnAni* this, GlobalContext* globalCtx) { } } -void func_809B0A28(EnAni* this, GlobalContext* globalCtx) { +void func_809B0A28(EnAni* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_2AA++; } } -void func_809B0A6C(EnAni* this, GlobalContext* globalCtx) { +void func_809B0A6C(EnAni* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->skelAnime.curFrame = 0.0f; } - if (globalCtx->csCtx.npcActions[0]->action == 2) { + if (play->csCtx.npcActions[0]->action == 2) { Animation_Change(&this->skelAnime, &gRoofManKnockbackAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gRoofManKnockbackAnim), ANIMMODE_ONCE, 0.0f); this->actor.shape.shadowDraw = NULL; @@ -232,45 +232,45 @@ void func_809B0A6C(EnAni* this, GlobalContext* globalCtx) { } } -void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAni_Update(Actor* thisx, PlayState* play) { EnAni* this = (EnAni*)thisx; s32 pad[2]; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[0] != NULL)) { + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[0] != NULL)) { switch (this->unk_2AA) { case 0: - func_809B0A6C(this, globalCtx); + func_809B0A6C(this, play); break; case 1: - func_809B0A28(this, globalCtx); + func_809B0A28(this, play); break; case 2: - func_809B0994(this, globalCtx); + func_809B0994(this, play); break; case 3: - func_809B0A28(this, globalCtx); + func_809B0A28(this, play); break; case 4: - func_809B0988(this, globalCtx); + func_809B0988(this, play); break; } - if (globalCtx->csCtx.frames == 100) { + if (play->csCtx.frames == 100) { func_800788CC(NA_SE_IT_EARTHQUAKE); } } else { if (SkelAnime_Update(&this->skelAnime) != 0) { this->skelAnime.curFrame = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } if (this->unk_2A8 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); this->unk_2A2.z = 0; this->unk_2A2.y = this->unk_2A2.z; this->unk_2A2.x = this->unk_2A2.z; @@ -290,7 +290,7 @@ void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnAni_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnAni_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnAni* this = (EnAni*)thisx; if (limbIndex == 15) { @@ -300,7 +300,7 @@ s32 EnAni_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnAni_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +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; @@ -309,7 +309,7 @@ void EnAni_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAni_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gRoofManEyeOpenTex, gRoofManEyeHalfTex, @@ -318,14 +318,14 @@ void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx) { EnAni* this = (EnAni*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ani.c", 719); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ani.c", 719); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnAni_OverrideLimbDraw, EnAni_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ani.c", 736); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ani.c", 736); } 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 6ab185cb8b..99bad6e1cc 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.h +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.h @@ -6,7 +6,7 @@ struct EnAni; -typedef void (*EnAniActionFunc)(struct EnAni*, GlobalContext*); +typedef void (*EnAniActionFunc)(struct EnAni*, PlayState*); typedef struct EnAni { /* 0x0000 */ Actor actor; 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 cd1489d4de..9b9749b228 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -12,18 +12,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnAnubice_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAnubice_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAnubice_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAnubice_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAnubice_Init(Actor* thisx, PlayState* play); +void EnAnubice_Destroy(Actor* thisx, PlayState* play); +void EnAnubice_Update(Actor* thisx, PlayState* play); +void EnAnubice_Draw(Actor* thisx, PlayState* play); -void EnAnubice_FindFlameCircles(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_SetupIdle(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_Idle(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_GoToHome(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_SetupShootFireball(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_ShootFireball(EnAnubice* this, GlobalContext* globalCtx); -void EnAnubice_Die(EnAnubice* this, GlobalContext* globalCtx); +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 EnAnubice_Die(EnAnubice* this, PlayState* play); const ActorInit En_Anubice_InitVars = { ACTOR_EN_ANUBICE, @@ -98,8 +98,8 @@ static DamageTable sDamageTable[] = { /* Unknown 2 */ DMG_ENTRY(0, ANUBICE_DMGEFF_NONE), }; -void EnAnubice_Hover(EnAnubice* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnAnubice_Hover(EnAnubice* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->hoverVelocityTimer += 1500.0f; this->targetHeight = player->actor.world.pos.y + this->playerHeightOffset; @@ -108,12 +108,12 @@ void EnAnubice_Hover(EnAnubice* this, GlobalContext* globalCtx) { this->actor.velocity.y = Math_SinS(this->hoverVelocityTimer); } -void EnAnubice_AimFireball(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_AimFireball(EnAnubice* this, PlayState* play) { f32 xzDist; f32 x; f32 y; f32 z; - Player* player = GET_PLAYER(globalCtx); + 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; @@ -124,11 +124,11 @@ void EnAnubice_AimFireball(EnAnubice* this, GlobalContext* globalCtx) { this->fireballRot.y = RAD_TO_BINANG(Math_FAtan2F(x, z)); } -void EnAnubice_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubice_Init(Actor* thisx, PlayState* play) { EnAnubice* this = (EnAnubice*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gAnubiceSkel, &gAnubiceIdleAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gAnubiceSkel, &gAnubiceIdleAnim, this->jointTable, this->morphTable, ANUBICE_LIMB_MAX); osSyncPrintf("\n\n"); @@ -137,8 +137,8 @@ void EnAnubice_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.naviEnemyId = NAVI_ENEMY_ANUBIS; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, 0.015f); @@ -152,11 +152,11 @@ void EnAnubice_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnAnubice_FindFlameCircles; } -void EnAnubice_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubice_Destroy(Actor* thisx, PlayState* play) { EnAnubice* this = (EnAnubice*)thisx; EnAnubiceTag* tag; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); if (this->actor.params != 0) { if (this->actor.parent) {} @@ -168,14 +168,14 @@ void EnAnubice_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void EnAnubice_FindFlameCircles(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_FindFlameCircles(EnAnubice* this, PlayState* play) { Actor* currentProp; s32 flameCirclesFound; if (this->isMirroringPlayer) { if (!this->hasSearchedForFlameCircles) { flameCirclesFound = 0; - currentProp = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + currentProp = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (currentProp != NULL) { if (currentProp->id != ACTOR_BG_HIDAN_CURTAIN) { currentProp = currentProp->next; @@ -198,7 +198,7 @@ void EnAnubice_FindFlameCircles(EnAnubice* this, GlobalContext* globalCtx) { } } -void EnAnubice_SetupIdle(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_SetupIdle(EnAnubice* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gAnubiceIdleAnim); Animation_Change(&this->skelAnime, &gAnubiceIdleAnim, 1.0f, 0.0f, (s16)lastFrame, ANIMMODE_LOOP, -10.0f); @@ -207,8 +207,8 @@ void EnAnubice_SetupIdle(EnAnubice* this, GlobalContext* globalCtx) { this->actor.velocity.x = this->actor.velocity.z = this->actor.gravity = 0.0f; } -void EnAnubice_Idle(EnAnubice* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnAnubice_Idle(EnAnubice* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->actor.shape.yOffset, 0.5f, 300.0f); @@ -231,7 +231,7 @@ void EnAnubice_Idle(EnAnubice* this, GlobalContext* globalCtx) { } } -void EnAnubice_GoToHome(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_GoToHome(EnAnubice* this, PlayState* play) { f32 xzDist; f32 normalizedX; f32 normalizedY; @@ -263,7 +263,7 @@ void EnAnubice_GoToHome(EnAnubice* this, GlobalContext* globalCtx) { } } -void EnAnubice_SetupShootFireball(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_SetupShootFireball(EnAnubice* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gAnubiceAttackingAnim); this->animLastFrame = lastFrame; @@ -272,7 +272,7 @@ void EnAnubice_SetupShootFireball(EnAnubice* this, GlobalContext* globalCtx) { this->actor.velocity.x = this->actor.velocity.z = 0.0f; } -void EnAnubice_ShootFireball(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_ShootFireball(EnAnubice* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -281,10 +281,10 @@ void EnAnubice_ShootFireball(EnAnubice* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 3000, 0); } - EnAnubice_AimFireball(this, globalCtx); + EnAnubice_AimFireball(this, play); if (curFrame == 12.0f) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ANUBICE_FIRE, this->headPos.x, this->headPos.y + 15.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); } @@ -293,7 +293,7 @@ void EnAnubice_ShootFireball(EnAnubice* this, GlobalContext* globalCtx) { } } -void EnAnubice_SetupDie(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_SetupDie(EnAnubice* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gAnubiceFallDownAnim); this->animLastFrame = lastFrame; @@ -305,7 +305,7 @@ void EnAnubice_SetupDie(EnAnubice* this, GlobalContext* globalCtx) { this->actor.velocity.x = this->actor.velocity.z = 0.0f; this->actor.gravity = -1.0f; - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->headPos, 70.0f)) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->headPos, 70.0f)) { this->isNearWall = true; this->fallTargetYaw = this->actor.shape.rot.x - 0x7F00; } @@ -313,7 +313,7 @@ void EnAnubice_SetupDie(EnAnubice* this, GlobalContext* globalCtx) { this->actionFunc = EnAnubice_Die; } -void EnAnubice_Die(EnAnubice* this, GlobalContext* globalCtx) { +void EnAnubice_Die(EnAnubice* this, PlayState* play) { f32 curFrame; f32 rotX; Vec3f baseFireEffectPos = { 0.0f, 0.0f, 0.0f }; @@ -345,18 +345,18 @@ void EnAnubice_Die(EnAnubice* this, GlobalContext* globalCtx) { 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, 0x4000, 128, 0, 8); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &rotatedFireEffectPos, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &rotatedFireEffectPos, 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(globalCtx, &this->actor, &this->actor.world.pos, 0xC0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xC0); Actor_Kill(&this->actor); } } } -void EnAnubice_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubice_Update(Actor* thisx, PlayState* play) { f32 zero; BgHidanCurtain* flameCircle; s32 i; @@ -366,16 +366,16 @@ void EnAnubice_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actionFunc != EnAnubice_SetupDie) && (this->actionFunc != EnAnubice_Die) && (this->actor.shape.yOffset == 0.0f)) { - EnAnubice_Hover(this, globalCtx); + EnAnubice_Hover(this, play); for (i = 0; i < ARRAY_COUNT(this->flameCircles); 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)) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actor.flags &= ~ACTOR_FLAG_0; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_DEAD); this->actionFunc = EnAnubice_SetupDie; return; @@ -385,9 +385,9 @@ void EnAnubice_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect == ANUBICE_DMGEFF_FIRE) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actor.flags &= ~ACTOR_FLAG_0; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_DEAD); this->actionFunc = EnAnubice_SetupDie; return; @@ -442,33 +442,32 @@ void EnAnubice_Update(Actor* thisx, GlobalContext* globalCtx) { this->deathTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.velocity.y += this->actor.gravity; func_8002D7EC(&this->actor); if (!this->isPlayerOutOfRange) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 5.0f, 10.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 5.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 5.0f, 10.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 5.0f, 10.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } if ((this->actionFunc != EnAnubice_SetupDie) && (this->actionFunc != EnAnubice_Die)) { Actor_SetFocus(&this->actor, this->focusHeightOffset); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (!this->isKnockedback && (this->actor.shape.yOffset == 0.0f)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -s32 EnAnubice_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnAnubice_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnAnubice* this = (EnAnubice*)thisx; if (limbIndex == ANUBICE_LIMB_HEAD) { @@ -478,26 +477,26 @@ s32 EnAnubice_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnAnubice_PostLimbDraw(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnAnubice_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) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_anubice.c", 853); + OPEN_DISPS(play->state.gfxCtx, "../z_en_anubice.c", 853); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_anubice.c", 856), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_anubice.c", 856), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gAnubiceEyesDL); Matrix_MultVec3f(&pos, &this->headPos); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_anubice.c", 868); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_anubice.c", 868); } } -void EnAnubice_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubice_Draw(Actor* thisx, PlayState* play) { EnAnubice* this = (EnAnubice*)thisx; - func_80093D84(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnAnubice_OverrideLimbDraw, + func_80093D84(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnAnubice_OverrideLimbDraw, EnAnubice_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 1baf9e6653..73f70a6845 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h @@ -7,7 +7,7 @@ struct EnAnubice; -typedef void (*EnAnubiceActionFunc)(struct EnAnubice*, struct GlobalContext*); +typedef void (*EnAnubiceActionFunc)(struct EnAnubice*, struct PlayState*); typedef enum { /* 0 */ ANUBICE_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c index ecd1c0852b..ae2934891c 100644 --- a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c +++ b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c @@ -10,14 +10,14 @@ #define FLAGS ACTOR_FLAG_4 -void EnAnubiceFire_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAnubiceFire_Init(Actor* thisx, PlayState* play); +void EnAnubiceFire_Destroy(Actor* thisx, PlayState* play); +void EnAnubiceFire_Update(Actor* thisx, PlayState* play); +void EnAnubiceFire_Draw(Actor* thisx, PlayState* play); -void func_809B26EC(EnAnubiceFire* this, GlobalContext* globalCtx); -void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx); -void func_809B2B48(EnAnubiceFire* this, GlobalContext* globalCtx); +void func_809B26EC(EnAnubiceFire* this, PlayState* play); +void func_809B27D8(EnAnubiceFire* this, PlayState* play); +void func_809B2B48(EnAnubiceFire* this, PlayState* play); const ActorInit En_Anubice_Fire_InitVars = { ACTOR_EN_ANUBICE_FIRE, @@ -51,12 +51,12 @@ static ColliderCylinderInit sCylinderInit = { { 0, 0, 0, { 0, 0, 0 } }, }; -void EnAnubiceFire_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceFire_Init(Actor* thisx, PlayState* play) { EnAnubiceFire* this = (EnAnubiceFire*)thisx; s32 i; - Collider_InitCylinder(globalCtx, &this->cylinder); - Collider_SetCylinder(globalCtx, &this->cylinder, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->cylinder); + Collider_SetCylinder(play, &this->cylinder, &this->actor, &sCylinderInit); this->unk_15A = 30; this->unk_154 = 2.0f; @@ -70,13 +70,13 @@ void EnAnubiceFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_809B26EC; } -void EnAnubiceFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceFire_Destroy(Actor* thisx, PlayState* play) { EnAnubiceFire* this = (EnAnubiceFire*)thisx; - Collider_DestroyCylinder(globalCtx, &this->cylinder); + Collider_DestroyCylinder(play, &this->cylinder); } -void func_809B26EC(EnAnubiceFire* this, GlobalContext* globalCtx) { +void func_809B26EC(EnAnubiceFire* this, PlayState* play) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Matrix_Push(); @@ -90,7 +90,7 @@ void func_809B26EC(EnAnubiceFire* this, GlobalContext* globalCtx) { this->actor.world.rot.x = this->actor.world.rot.y = this->actor.world.rot.z = 0; } -void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx) { +void func_809B27D8(EnAnubiceFire* this, PlayState* play) { s32 pad; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -109,7 +109,7 @@ void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx) { if ((this->unk_15A == 0) && (this->scale < 0.1f)) { Actor_Kill(&this->actor); } else if ((this->actor.params == 0) && (this->cylinder.base.atFlags & 4)) { - if (Player_HasMirrorShieldEquipped(globalCtx)) { + if (Player_HasMirrorShieldEquipped(play)) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); this->cylinder.base.atFlags &= 0xFFE9; this->cylinder.base.atFlags |= 8; @@ -121,7 +121,7 @@ void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx) { this->actor.velocity.z *= -1.0f; } else { this->unk_15A = 0; - EffectSsBomb2_SpawnLayered(globalCtx, &this->actor.world.pos, &sp78, &sp84, 10, 5); + EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &sp78, &sp84, 10, 5); this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_FIREBOMB); this->actionFunc = func_809B2B48; @@ -135,13 +135,13 @@ void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + (Rand_ZeroOne() - 0.5f) * (this->scale * 20.0f); pos.y = this->actor.world.pos.y + (Rand_ZeroOne() - 0.5f) * (this->scale * 20.0f); pos.z = this->actor.world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, scale, life); + EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, scale, life); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_FIRE - SFX_FLAG); } } -void func_809B2B48(EnAnubiceFire* this, GlobalContext* globalCtx) { +void func_809B2B48(EnAnubiceFire* this, PlayState* play) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f pos; @@ -158,7 +158,7 @@ void func_809B2B48(EnAnubiceFire* this, GlobalContext* globalCtx) { accel.x = Rand_CenteredFloat(8.0f); accel.y = Rand_CenteredFloat(2.0f); accel.z = Rand_CenteredFloat(8.0f); - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 2000, 10); + EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, 2000, 10); } this->unk_15C = 2; @@ -169,13 +169,13 @@ void func_809B2B48(EnAnubiceFire* this, GlobalContext* globalCtx) { } } -void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceFire_Update(Actor* thisx, PlayState* play) { EnAnubiceFire* this = (EnAnubiceFire*)thisx; s32 pad; s32 i; Actor_SetScale(&this->actor, this->scale); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_8002D7EC(&this->actor); this->unk_160[0] = this->actor.world.pos; @@ -193,7 +193,7 @@ void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_15C--; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 5.0f, 10.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 5.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); if (!(this->scale < 0.6f || this->actionFunc == func_809B2B48)) { @@ -203,11 +203,11 @@ void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_15A != 0) { Collider_UpdateCylinder(&this->actor, &this->cylinder); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder.base); } - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->actor.world.pos, 30.0f)) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->actor.world.pos, 30.0f)) { this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_FIREBOMB); this->actionFunc = func_809B2B48; @@ -215,7 +215,7 @@ void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceFire_Draw(Actor* thisx, PlayState* play) { static void* D_809B3270[] = { gDust4Tex, gDust5Tex, gDust6Tex, gDust7Tex, gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, }; @@ -223,8 +223,8 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad[2]; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_anubice_fire.c", 503); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_anubice_fire.c", 503); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); @@ -242,10 +242,10 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { if (scale >= 0.1f) { Matrix_Translate(this->unk_160[i].x, this->unk_160[i].y, this->unk_160[i].z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ(this->actor.world.rot.z + i * 1000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_anubice_fire.c", 546), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_anubice_fire.c", 546), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gAnubiceFireAttackDL); @@ -257,5 +257,5 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_anubice_fire.c", 556); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_anubice_fire.c", 556); } diff --git a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h index 1ea831ffc4..8119efa7a5 100644 --- a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h +++ b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h @@ -6,7 +6,7 @@ struct EnAnubiceFire; -typedef void (*EnAnubiceFireActionFunc)(struct EnAnubiceFire*, GlobalContext*); +typedef void (*EnAnubiceFireActionFunc)(struct EnAnubiceFire*, PlayState*); typedef struct EnAnubiceFire { /* 0x0000 */ Actor actor; 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 052b70352b..b9042518fd 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 @@ -9,13 +9,13 @@ #define FLAGS ACTOR_FLAG_4 -void EnAnubiceTag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceTag_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAnubiceTag_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAnubiceTag_Init(Actor* thisx, PlayState* play); +void EnAnubiceTag_Destroy(Actor* thisx, PlayState* play); +void EnAnubiceTag_Update(Actor* thisx, PlayState* play); +void EnAnubiceTag_Draw(Actor* thisx, PlayState* play); -void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx); -void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, GlobalContext* globalCtx); +void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, PlayState* play); +void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, PlayState* play); const ActorInit En_Anubice_Tag_InitVars = { ACTOR_EN_ANUBICE_TAG, @@ -29,7 +29,7 @@ const ActorInit En_Anubice_Tag_InitVars = { (ActorFunc)EnAnubiceTag_Draw, }; -void EnAnubiceTag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceTag_Init(Actor* thisx, PlayState* play) { EnAnubiceTag* this = (EnAnubiceTag*)thisx; osSyncPrintf("\n\n"); @@ -45,11 +45,11 @@ void EnAnubiceTag_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnAnubiceTag_SpawnAnubis; } -void EnAnubiceTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceTag_Destroy(Actor* thisx, PlayState* play) { } -void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { - this->anubis = (EnAnubice*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ANUBICE, +void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, PlayState* play) { + this->anubis = (EnAnubice*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ANUBICE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.yawTowardsPlayer, 0, 0); @@ -58,7 +58,7 @@ void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { } } -void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { +void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, PlayState* play) { EnAnubice* anubis; Vec3f offset; @@ -90,18 +90,18 @@ void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { } } -void EnAnubiceTag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceTag_Update(Actor* thisx, PlayState* play) { EnAnubiceTag* this = (EnAnubiceTag*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnAnubiceTag_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAnubiceTag_Draw(Actor* thisx, PlayState* play) { EnAnubiceTag* this = (EnAnubiceTag*)thisx; if (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, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 0, 255, 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 8a7015057e..0147b30cd5 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 @@ -7,7 +7,7 @@ struct EnAnubiceTag; -typedef void (*EnAnubiceTagActionFunc)(struct EnAnubiceTag*, GlobalContext*); +typedef void (*EnAnubiceTagActionFunc)(struct EnAnubiceTag*, PlayState*); typedef struct EnAnubiceTag { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c index 23f98c0156..56423aa825 100644 --- a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c +++ b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c @@ -8,9 +8,9 @@ #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" #define FLAGS ACTOR_FLAG_4 -void EnArowTrap_Init(Actor* thisx, GlobalContext* globalCtx); -void EnArowTrap_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnArowTrap_Update(Actor* thisx, GlobalContext* globalCtx); +void EnArowTrap_Init(Actor* thisx, PlayState* play); +void EnArowTrap_Destroy(Actor* thisx, PlayState* play); +void EnArowTrap_Update(Actor* thisx, PlayState* play); const ActorInit En_Arow_Trap_InitVars = { ACTOR_EN_AROW_TRAP, @@ -24,7 +24,7 @@ const ActorInit En_Arow_Trap_InitVars = { NULL, }; -void EnArowTrap_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnArowTrap_Init(Actor* thisx, PlayState* play) { EnArowTrap* this = (EnArowTrap*)thisx; Actor_SetScale(&this->actor, 0.01); @@ -33,19 +33,19 @@ void EnArowTrap_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; } -void EnArowTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnArowTrap_Destroy(Actor* thisx, PlayState* play) { } -void EnArowTrap_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnArowTrap_Update(Actor* thisx, PlayState* play) { EnArowTrap* this = (EnArowTrap*)thisx; if (this->actor.xzDistToPlayer <= 400) { this->attackTimer--; if (this->attackTimer == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, - this->actor.shape.rot.y, this->actor.shape.rot.z, ARROW_NORMAL_SILENT); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, + this->actor.shape.rot.z, ARROW_NORMAL_SILENT); this->attackTimer = 80; } } diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index 19ce981265..fae838796b 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -9,15 +9,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx); -void EnArrow_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx); -void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnArrow_Init(Actor* thisx, PlayState* play); +void EnArrow_Destroy(Actor* thisx, PlayState* play); +void EnArrow_Update(Actor* thisx, PlayState* play); +void EnArrow_Draw(Actor* thisx, PlayState* play); -void EnArrow_Shoot(EnArrow* this, GlobalContext* globalCtx); -void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx); -void func_809B45E0(EnArrow* this, GlobalContext* globalCtx); -void func_809B4640(EnArrow* this, GlobalContext* globalCtx); +void EnArrow_Shoot(EnArrow* this, PlayState* play); +void EnArrow_Fly(EnArrow* this, PlayState* play); +void func_809B45E0(EnArrow* this, PlayState* play); +void func_809B4640(EnArrow* this, PlayState* play); const ActorInit En_Arrow_InitVars = { ACTOR_EN_ARROW, @@ -59,7 +59,7 @@ void EnArrow_SetupAction(EnArrow* this, EnArrowActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Init(Actor* thisx, PlayState* play) { static EffectBlureInit2 blureNormal = { 0, 4, 0, { 0, 255, 200, 255 }, { 0, 255, 255, 255 }, { 0, 255, 200, 0 }, { 0, 255, 255, 0 }, 16, 0, 1, 0, { 255, 255, 170, 255 }, { 0, 150, 0, 0 }, @@ -92,7 +92,7 @@ void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params <= ARROW_SEED) { if (this->actor.params <= ARROW_0E) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gArrowSkel, &gArrow2Anim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gArrowSkel, &gArrow2Anim, NULL, NULL, 0); } if (this->actor.params <= ARROW_NORMAL) { @@ -102,23 +102,23 @@ void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { blureNormal.elemDuration = 16; } - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureNormal); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureNormal); } else if (this->actor.params == ARROW_FIRE) { - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureFire); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureFire); } else if (this->actor.params == ARROW_ICE) { - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureIce); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureIce); } else if (this->actor.params == ARROW_LIGHT) { - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureLight); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureLight); } - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sColliderInit); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->actor, &sColliderInit); if (this->actor.params <= ARROW_NORMAL) { this->collider.info.toucherFlags &= ~0x18; @@ -137,23 +137,23 @@ void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { EnArrow_SetupAction(this, EnArrow_Shoot); } -void EnArrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Destroy(Actor* thisx, PlayState* play) { EnArrow* this = (EnArrow*)thisx; if (this->actor.params <= ARROW_LIGHT) { - Effect_Delete(globalCtx, this->effectIndex); + Effect_Delete(play, this->effectIndex); } - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyQuad(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyQuad(play, &this->collider); if ((this->hitActor != NULL) && (this->hitActor->update != NULL)) { this->hitActor->flags &= ~ACTOR_FLAG_15; } } -void EnArrow_Shoot(EnArrow* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnArrow_Shoot(EnArrow* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.parent == NULL) { if ((this->actor.params != ARROW_NUT) && (player->unk_A73 == 0)) { @@ -193,7 +193,7 @@ void EnArrow_Shoot(EnArrow* this, GlobalContext* globalCtx) { } } -void func_809B3CEC(GlobalContext* globalCtx, EnArrow* this) { +void func_809B3CEC(PlayState* play, EnArrow* this) { EnArrow_SetupAction(this, func_809B4640); Animation_PlayOnce(&this->skelAnime, &gArrow1Anim); this->actor.world.rot.y += (s32)(24576.0f * (Rand_ZeroOne() - 0.5f)) + 0x8000; @@ -203,7 +203,7 @@ void func_809B3CEC(GlobalContext* globalCtx, EnArrow* this) { this->actor.gravity = -1.5f; } -void EnArrow_CarryActor(EnArrow* this, GlobalContext* globalCtx) { +void EnArrow_CarryActor(EnArrow* this, PlayState* play) { CollisionPoly* hitPoly; Vec3f posDiffLastFrame; Vec3f actorNextPos; @@ -226,8 +226,8 @@ void EnArrow_CarryActor(EnArrow* this, GlobalContext* globalCtx) { Math_Vec3f_Scale(&posDiffLastFrame, scale); Math_Vec3f_Sum(&this->hitActor->world.pos, &posDiffLastFrame, &actorNextPos); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->hitActor->world.pos, &actorNextPos, &hitPos, - &hitPoly, true, true, true, true, &bgId)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->hitActor->world.pos, &actorNextPos, &hitPos, &hitPoly, + true, true, true, true, &bgId)) { this->hitActor->world.pos.x = hitPos.x + ((actorNextPos.x <= hitPos.x) ? 1.0f : -1.0f); this->hitActor->world.pos.y = hitPos.y + ((actorNextPos.y <= hitPos.y) ? 1.0f : -1.0f); this->hitActor->world.pos.z = hitPos.z + ((actorNextPos.z <= hitPos.z) ? 1.0f : -1.0f); @@ -238,7 +238,7 @@ void EnArrow_CarryActor(EnArrow* this, GlobalContext* globalCtx) { } } -void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { +void EnArrow_Fly(EnArrow* this, PlayState* play) { CollisionPoly* hitPoly; s32 bgId; Vec3f hitPoint; @@ -271,18 +271,18 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { if (this->actor.params == ARROW_NUT) { iREG(50) = -1; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_M_FIRE1, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_M_FIRE1, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 0); sfxId = NA_SE_IT_DEKU; } else { sfxId = NA_SE_IT_SLING_REFLECT; } - EffectSsStone1_Spawn(globalCtx, &this->actor.world.pos, 0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, sfxId); + EffectSsStone1_Spawn(play, &this->actor.world.pos, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, sfxId); Actor_Kill(&this->actor); } else { - EffectSsHitMark_SpawnCustomScale(globalCtx, 0, 150, &this->actor.world.pos); + EffectSsHitMark_SpawnCustomScale(play, 0, 150, &this->actor.world.pos); if (atTouched && (this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) { hitActor = this->collider.base.at; @@ -290,7 +290,7 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { if ((hitActor->update != NULL) && !(this->collider.base.atFlags & AT_BOUNCED) && (hitActor->flags & ACTOR_FLAG_14)) { this->hitActor = hitActor; - EnArrow_CarryActor(this, globalCtx); + EnArrow_CarryActor(this, play); Math_Vec3f_Diff(&hitActor->world.pos, &this->actor.world.pos, &this->unk_250); hitActor->flags |= ACTOR_FLAG_15; this->collider.base.atFlags &= ~AT_HIT; @@ -306,7 +306,7 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { this->actor.world.pos.z = this->collider.info.atHitInfo->bumper.hitPos.z; } - func_809B3CEC(globalCtx, this); + func_809B3CEC(play, this); Audio_PlayActorSound2(&this->actor, NA_SE_IT_ARROW_STICK_CRE); } } else if (this->touchedPoly) { @@ -328,9 +328,9 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if ((this->touchedPoly = - BgCheck_ProjectileLineTest(&globalCtx->colCtx, &this->actor.prevPos, &this->actor.world.pos, &hitPoint, + BgCheck_ProjectileLineTest(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, &hitPoint, &this->actor.wallPoly, true, true, true, true, &bgId))) { - func_8002F9EC(globalCtx, &this->actor, this->actor.wallPoly, bgId, &hitPoint); + func_8002F9EC(play, &this->actor, this->actor.wallPoly, bgId, &hitPoint); Math_Vec3f_Copy(&posCopy, &this->actor.world.pos); Math_Vec3f_Copy(&this->actor.world.pos, &hitPoint); } @@ -345,7 +345,7 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { Math_Vec3f_Sum(&this->unk_210, &this->unk_250, &sp60); Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_250, &sp54); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp60, &sp54, &hitPoint, &hitPoly, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &sp54, &hitPoint, &hitPoly, true, true, true, true, &bgId)) { this->hitActor->world.pos.x = hitPoint.x + ((sp54.x <= hitPoint.x) ? 1.0f : -1.0f); this->hitActor->world.pos.y = hitPoint.y + ((sp54.y <= hitPoint.y) ? 1.0f : -1.0f); @@ -367,7 +367,7 @@ void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) { } } -void func_809B45E0(EnArrow* this, GlobalContext* globalCtx) { +void func_809B45E0(EnArrow* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (DECR(this->timer) == 0) { @@ -375,7 +375,7 @@ void func_809B45E0(EnArrow* this, GlobalContext* globalCtx) { } } -void func_809B4640(EnArrow* this, GlobalContext* globalCtx) { +void func_809B4640(EnArrow* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Actor_MoveForward(&this->actor); @@ -384,14 +384,14 @@ void func_809B4640(EnArrow* this, GlobalContext* globalCtx) { } } -void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Update(Actor* thisx, PlayState* play) { s32 pad; EnArrow* this = (EnArrow*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->isCsNut || ((this->actor.params >= ARROW_NORMAL_LIT) && (player->unk_A73 != 0)) || - !Player_InBlockingCsMode(globalCtx, player)) { - this->actionFunc(this, globalCtx); + !Player_InBlockingCsMode(play, player)) { + this->actionFunc(this, play); } if ((this->actor.params >= ARROW_FIRE) && (this->actor.params <= ARROW_0E)) { @@ -399,7 +399,7 @@ void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx) { ACTOR_ARROW_FIRE, ACTOR_ARROW_FIRE, ACTOR_ARROW_FIRE }; if (this->actor.child == NULL) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, elementalActorIds[this->actor.params - 3], + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, elementalActorIds[this->actor.params - 3], this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } } else if (this->actor.params == ARROW_NORMAL_LIT) { @@ -408,11 +408,11 @@ void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx) { static Color_RGBA8 primColor = { 255, 255, 100, 255 }; static Color_RGBA8 envColor = { 255, 50, 0, 0 }; // spawn dust for the flame - func_8002836C(globalCtx, &this->unk_21C, &velocity, &accel, &primColor, &envColor, 100, 0, 8); + func_8002836C(play, &this->unk_21C, &velocity, &accel, &primColor, &envColor, 100, 0, 8); } } -void func_809B4800(EnArrow* this, GlobalContext* globalCtx) { +void func_809B4800(EnArrow* this, PlayState* play) { static Vec3f D_809B4E88 = { 0.0f, 400.0f, 1500.0f }; static Vec3f D_809B4E94 = { 0.0f, -400.0f, 1500.0f }; static Vec3f D_809B4EA0 = { 0.0f, 0.0f, -300.0f }; @@ -430,7 +430,7 @@ void func_809B4800(EnArrow* this, GlobalContext* globalCtx) { addBlureVertex = this->actor.params <= ARROW_LIGHT; if (this->hitActor == NULL) { - addBlureVertex &= func_80090480(globalCtx, &this->collider, &this->weaponInfo, &sp44, &sp38); + addBlureVertex &= func_80090480(play, &this->collider, &this->weaponInfo, &sp44, &sp38); } else { if (addBlureVertex) { if ((sp44.x == this->weaponInfo.tip.x) && (sp44.y == this->weaponInfo.tip.y) && @@ -448,22 +448,22 @@ void func_809B4800(EnArrow* this, GlobalContext* globalCtx) { } } -void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Draw(Actor* thisx, PlayState* play) { s32 pad; EnArrow* this = (EnArrow*)thisx; u8 alpha; f32 scale; if (this->actor.params <= ARROW_0E) { - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawLod(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, this, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawLod(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, this, (this->actor.projectedPos.z < MREG(95)) ? 0 : 1); } else if (this->actor.speedXZ != 0.0f) { alpha = (Math_CosS(this->timer * 5000) * 127.5f) + 127.5f; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_arrow.c", 1346); + OPEN_DISPS(play->state.gfxCtx, "../z_en_arrow.c", 1346); - func_80093C14(globalCtx->state.gfxCtx); + func_80093C14(play->state.gfxCtx); if (this->actor.params == ARROW_SEED) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); @@ -476,19 +476,19 @@ void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Push(); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); // redundant check because this is contained in an if block for non-zero speed - Matrix_RotateZ((this->actor.speedXZ == 0.0f) ? 0.0f : BINANG_TO_RAD((globalCtx->gameplayFrames & 0xFF) * 4000), + Matrix_RotateZ((this->actor.speedXZ == 0.0f) ? 0.0f : BINANG_TO_RAD((play->gameplayFrames & 0xFF) * 4000), MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_arrow.c", 1374), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_arrow.c", 1374), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffSparklesDL); Matrix_Pop(); Matrix_RotateY(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_APPLY); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_arrow.c", 1381); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_arrow.c", 1381); } - func_809B4800(this, globalCtx); + func_809B4800(this, play); } diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h index 2cb30afcc7..f250cafe30 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h @@ -6,7 +6,7 @@ struct EnArrow; -typedef void (*EnArrowActionFunc)(struct EnArrow*, GlobalContext*); +typedef void (*EnArrowActionFunc)(struct EnArrow*, PlayState*); typedef struct EnArrow { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index 872f7083fc..8fcea6764a 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -10,14 +10,14 @@ #define FLAGS ACTOR_FLAG_4 -void EnAttackNiw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAttackNiw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAttackNiw_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAttackNiw_Init(Actor* thisx, PlayState* play); +void EnAttackNiw_Destroy(Actor* thisx, PlayState* play); +void EnAttackNiw_Update(Actor* thisx, PlayState* play); +void EnAttackNiw_Draw(Actor* thisx, PlayState* play); -void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx); -void func_809B5C18(EnAttackNiw* this, GlobalContext* globalCtx); -void func_809B59B0(EnAttackNiw* this, GlobalContext* globalCtx); +void func_809B5670(EnAttackNiw* this, PlayState* play); +void func_809B5C18(EnAttackNiw* this, PlayState* play); +void func_809B59B0(EnAttackNiw* this, PlayState* play); const ActorInit En_Attack_Niw_InitVars = { ACTOR_EN_ATTACK_NIW, @@ -37,13 +37,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void EnAttackNiw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAttackNiw_Init(Actor* thisx, PlayState* play) { EnAttackNiw* this = (EnAttackNiw*)thisx; s32 pad; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); if (this->actor.params < 0) { this->actor.params = 0; } @@ -58,7 +58,7 @@ void EnAttackNiw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_809B5670; } -void EnAttackNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAttackNiw_Destroy(Actor* thisx, PlayState* play) { EnAttackNiw* this = (EnAttackNiw*)thisx; EnNiw* cucco = (EnNiw*)this->actor.parent; @@ -69,7 +69,7 @@ void EnAttackNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_809B5268(EnAttackNiw* this, GlobalContext* globalCtx, s16 arg2) { +void func_809B5268(EnAttackNiw* this, PlayState* play, s16 arg2) { if (this->unk_254 == 0) { if (arg2 == 0) { this->unk_264 = 0.0f; @@ -163,12 +163,12 @@ void func_809B5268(EnAttackNiw* this, GlobalContext* globalCtx, s16 arg2) { } } -s32 func_809B55EC(EnAttackNiw* this, GlobalContext* globalCtx) { +s32 func_809B55EC(EnAttackNiw* this, PlayState* play) { s16 sp1E; s16 sp1C; Actor_SetFocus(&this->actor, this->unk_2E4); - Actor_GetScreenPos(globalCtx, &this->actor, &sp1E, &sp1C); + Actor_GetScreenPos(play, &this->actor, &sp1E, &sp1C); if ((this->actor.projectedPos.z < -20.0f) || (sp1E < 0) || (sp1E > SCREEN_WIDTH) || (sp1C < 0) || (sp1C > SCREEN_HEIGHT)) { return 0; @@ -177,7 +177,7 @@ s32 func_809B55EC(EnAttackNiw* this, GlobalContext* globalCtx) { } } -void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) { +void func_809B5670(EnAttackNiw* this, PlayState* play) { s16 sp4E; s16 sp4C; f32 tmpf1; @@ -187,13 +187,13 @@ void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) { this->actor.speedXZ = 10.0f; - tmpf1 = (this->unk_298.x + globalCtx->view.at.x) - globalCtx->view.eye.x; - tmpf2 = (this->unk_298.y + globalCtx->view.at.y) - globalCtx->view.eye.y; - tmpf3 = (this->unk_298.z + globalCtx->view.at.z) - globalCtx->view.eye.z; + tmpf1 = (this->unk_298.x + play->view.at.x) - play->view.eye.x; + tmpf2 = (this->unk_298.y + play->view.at.y) - play->view.eye.y; + tmpf3 = (this->unk_298.z + play->view.at.z) - play->view.eye.z; - sp34.x = globalCtx->view.at.x + tmpf1; - sp34.y = globalCtx->view.at.y + tmpf2; - sp34.z = globalCtx->view.at.z + tmpf3; + sp34.x = play->view.at.x + tmpf1; + sp34.y = play->view.at.y + tmpf2; + sp34.z = play->view.at.z + tmpf3; this->unk_2D4 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp34); this->unk_2D0 = Math_Vec3f_Pitch(&this->actor.world.pos, &sp34) * -1.0f; @@ -203,7 +203,7 @@ void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_2DC, 5000.0f, 1.0f, 100.0f); Actor_SetFocus(&this->actor, this->unk_2E4); - Actor_GetScreenPos(globalCtx, &this->actor, &sp4E, &sp4C); + Actor_GetScreenPos(play, &this->actor, &sp4E, &sp4C); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_2D4 = this->actor.yawTowardsPlayer; @@ -236,12 +236,12 @@ void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) { this->unk_254 = 10; this->unk_264 = -10000.0f; this->unk_288 = -3000.0f; - func_809B5268(this, globalCtx, 2); + func_809B5268(this, play, 2); } } -void func_809B59B0(EnAttackNiw* this, GlobalContext* globalCtx) { - if (!func_809B55EC(this, globalCtx)) { +void func_809B59B0(EnAttackNiw* this, PlayState* play) { + if (!func_809B55EC(this, play)) { Actor_Kill(&this->actor); return; } @@ -275,31 +275,31 @@ void func_809B59B0(EnAttackNiw* this, GlobalContext* globalCtx) { this->unk_2D0 = this->actor.world.rot.x - 5000.0f; this->actionFunc = func_809B5C18; } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_809B5268(this, globalCtx, 5); + func_809B5268(this, play, 5); } else { - func_809B5268(this, globalCtx, 2); + func_809B5268(this, play, 2); } } -void func_809B5C18(EnAttackNiw* this, GlobalContext* globalCtx) { - if (!func_809B55EC(this, globalCtx)) { +void func_809B5C18(EnAttackNiw* this, PlayState* play) { + if (!func_809B55EC(this, play)) { Actor_Kill(&this->actor); return; } Math_SmoothStepToS(&this->actor.world.rot.x, this->unk_2D0, 5, this->unk_2DC, 0); Math_ApproachF(&this->unk_2DC, 5000.0f, 1.0f, 100.0f); Math_ApproachF(&this->actor.velocity.y, 5.0f, 0.3f, 1.0f); - func_809B5268(this, globalCtx, 2); + func_809B5268(this, play, 2); } -void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAttackNiw_Update(Actor* thisx, PlayState* play) { f32 tmpf1; EnAttackNiw* this = (EnAttackNiw*)thisx; EnNiw* cucco; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp30; - GlobalContext* globalCtx2 = globalCtx; + PlayState* play2 = play; this->unk_28C++; if (this->unk_254 != 0) { @@ -326,8 +326,8 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot = this->actor.world.rot; this->actor.shape.shadowScale = 15.0f; - this->actionFunc(this, globalCtx2); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, + this->actionFunc(this, play2); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); @@ -345,7 +345,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actionFunc != func_809B5C18)) { Math_Vec3f_Copy(&sp30, &this->actor.world.pos); sp30.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(globalCtx, &sp30, 0, 0, 0, 0x190); + EffectSsGSplash_Spawn(play, &sp30, 0, 0, 0, 0x190); this->unk_2DC = 0.0f; this->actor.gravity = 0.0f; this->unk_2E0 = 0.0f; @@ -359,7 +359,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { cucco = (EnNiw*)this->actor.parent; if ((this->actor.parent->update != NULL) && (this->actor.parent != NULL) && (cucco != NULL) && (cucco->timer9 == 0) && (player->invincibilityTimer == 0)) { - func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); + func_8002F6D4(play, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); cucco->timer9 = 0x46; } } @@ -373,7 +373,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 func_809B5F98(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_809B5F98(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnAttackNiw* this = (EnAttackNiw*)thisx; Vec3f sp0 = { 0.0f, 0.0f, 0.0f }; @@ -396,10 +396,10 @@ s32 func_809B5F98(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return 0; } -void EnAttackNiw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAttackNiw_Draw(Actor* thisx, PlayState* play) { EnAttackNiw* this = (EnAttackNiw*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_809B5F98, NULL, this); } diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h index 746ecb23c0..381b6a2aae 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h @@ -6,7 +6,7 @@ struct EnAttackNiw; -typedef void (*EnAttackNiwActionFunc)(struct EnAttackNiw*, GlobalContext*); +typedef void (*EnAttackNiwActionFunc)(struct EnAttackNiw*, PlayState*); typedef struct EnAttackNiw { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/src/overlays/actors/ovl_En_Ba/z_en_ba.c index 9746792b4c..be992a1b70 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -9,18 +9,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnBa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBa_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBa_Init(Actor* thisx, PlayState* play); +void EnBa_Destroy(Actor* thisx, PlayState* play); +void EnBa_Update(Actor* thisx, PlayState* play); +void EnBa_Draw(Actor* thisx, PlayState* play); void EnBa_SetupIdle(EnBa* this); void EnBa_SetupFallAsBlob(EnBa* this); -void EnBa_Idle(EnBa* this, GlobalContext* globalCtx); -void EnBa_FallAsBlob(EnBa* this, GlobalContext* globalCtx); -void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx); -void EnBa_RecoilFromDamage(EnBa* this, GlobalContext* globalCtx); -void EnBa_Die(EnBa* this, GlobalContext* globalCtx); +void EnBa_Idle(EnBa* this, PlayState* play); +void EnBa_FallAsBlob(EnBa* this, PlayState* play); +void EnBa_SwingAtPlayer(EnBa* this, PlayState* play); +void EnBa_RecoilFromDamage(EnBa* this, PlayState* play); +void EnBa_Die(EnBa* this, PlayState* play); void EnBa_SetupSwingAtPlayer(EnBa* this); const ActorInit En_Ba_InitVars = { @@ -88,7 +88,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void EnBa_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBa_Init(Actor* thisx, PlayState* play) { EnBa* this = (EnBa*)thisx; Vec3f sp38 = D_809B80E4; s32 pad; @@ -108,7 +108,7 @@ void EnBa_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params &= 0xFF; if (this->actor.params < EN_BA_DEAD_BLOB) { - if (Flags_GetSwitch(globalCtx, this->upperParams)) { + if (Flags_GetSwitch(play, this->upperParams)) { Actor_Kill(&this->actor); return; } @@ -117,17 +117,17 @@ void EnBa_Init(Actor* thisx, GlobalContext* globalCtx) { EnBa_SetupIdle(this); this->actor.colChkInfo.health = 4; this->actor.colChkInfo.mass = MASS_HEAVY; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); } else { Actor_SetScale(&this->actor, 0.021f); EnBa_SetupFallAsBlob(this); } } -void EnBa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBa_Destroy(Actor* thisx, PlayState* play) { EnBa* this = (EnBa*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnBa_SetupIdle(EnBa* this) { @@ -137,8 +137,8 @@ void EnBa_SetupIdle(EnBa* this) { EnBa_SetupAction(this, EnBa_Idle); } -void EnBa_Idle(EnBa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBa_Idle(EnBa* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; s32 pad; Vec3s sp5C; @@ -150,7 +150,7 @@ void EnBa_Idle(EnBa* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 100.0f, 1.0f, 10.0f, 0.0f); } this->unk_2FC = this->actor.world.pos; - if (globalCtx->gameplayFrames % 16 == 0) { + if (play->gameplayFrames % 16 == 0) { this->unk_308.z += Rand_CenteredFloat(180.0f); this->unk_314 += Rand_CenteredFloat(180.0f); this->unk_308.x = Math_SinF(this->unk_308.z) * 80.0f; @@ -202,7 +202,7 @@ void EnBa_SetupFallAsBlob(EnBa* this) { /** * Action function of the pink fleshy blobs that spawn and fall to the floor when a tentacle dies */ -void EnBa_FallAsBlob(EnBa* this, GlobalContext* globalCtx) { +void EnBa_FallAsBlob(EnBa* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.scale.y -= 0.001f; this->actor.scale.x += 0.0005f; @@ -213,8 +213,7 @@ void EnBa_FallAsBlob(EnBa* this, GlobalContext* globalCtx) { } } else { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 28.0f, 80.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 28.0f, 80.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } } @@ -228,8 +227,8 @@ void EnBa_SetupSwingAtPlayer(EnBa* this) { EnBa_SetupAction(this, EnBa_SwingAtPlayer); } -void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBa_SwingAtPlayer(EnBa* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 temp; s16 i; Vec3s sp58; @@ -304,10 +303,10 @@ void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx) { if (this->collider.base.atFlags & 2) { this->collider.base.atFlags &= ~2; if (this->collider.base.at == &player->actor) { - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); } } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); return; } if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & PLAYER_STATE1_26)) { @@ -330,13 +329,13 @@ void func_809B7174(EnBa* this) { EnBa_SetupAction(this, EnBa_RecoilFromDamage); } -void EnBa_RecoilFromDamage(EnBa* this, GlobalContext* globalCtx) { +void EnBa_RecoilFromDamage(EnBa* this, PlayState* play) { s32 i; Vec3s sp6C; Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 330.0f, 1.0f, 30.0f, 0.0f); this->unk_2FC = this->actor.world.pos; - if (globalCtx->gameplayFrames % 16 == 0) { + if (play->gameplayFrames % 16 == 0) { this->unk_308.z += Rand_CenteredFloat(180.0f); this->unk_314 += Rand_CenteredFloat(180.0f); this->unk_308.x = Math_SinF(this->unk_308.z) * 80.0f; @@ -376,19 +375,19 @@ void EnBa_RecoilFromDamage(EnBa* this, GlobalContext* globalCtx) { } } -void func_809B75A0(EnBa* this, GlobalContext* globalCtx2) { +void func_809B75A0(EnBa* this, PlayState* play2) { s16 unk_temp; s32 i; Vec3f sp74 = { 0.0f, 0.0f, 0.0f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; this->unk_31C = 2500; - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_BALINADE_HAND_DEAD, 1, 1, 40); + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_BALINADE_HAND_DEAD, 1, 1, 40); this->unk_14C = 0; for (i = 7; i < 14; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BA, this->unk_158[i].x, this->unk_158[i].y, - this->unk_158[i].z, 0, 0, 0, EN_BA_DEAD_BLOB); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BA, this->unk_158[i].x, this->unk_158[i].y, this->unk_158[i].z, 0, + 0, 0, EN_BA_DEAD_BLOB); } unk_temp = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_158[0]) + 0x8000; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, this->unk_31C, 0); @@ -408,7 +407,7 @@ void func_809B75A0(EnBa* this, GlobalContext* globalCtx2) { EnBa_SetupAction(this, EnBa_Die); } -void EnBa_Die(EnBa* this, GlobalContext* globalCtx) { +void EnBa_Die(EnBa* this, PlayState* play) { Vec3f sp6C = { 0.0f, 0.0f, 0.0f }; s16 temp; s32 i; @@ -440,29 +439,29 @@ void EnBa_Die(EnBa* this, GlobalContext* globalCtx) { } this->unk_31A--; } else { - Flags_SetSwitch(globalCtx, this->upperParams); + Flags_SetSwitch(play, this->upperParams); Actor_Kill(&this->actor); } } -void EnBa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBa_Update(Actor* thisx, PlayState* play) { EnBa* this = (EnBa*)thisx; if ((this->actor.params < EN_BA_DEAD_BLOB) && (this->collider.base.acFlags & 2)) { this->collider.base.acFlags &= ~2; this->actor.colChkInfo.health--; if (this->actor.colChkInfo.health == 0) { - func_809B75A0(this, globalCtx); + func_809B75A0(this, play); } else { func_809B7174(this); } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params < EN_BA_DEAD_BLOB) { this->actor.focus.pos = this->unk_158[6]; } if (this->unk_14C >= 2) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -472,22 +471,22 @@ static void* D_809B8118[] = { object_bxa_Tex_0029F0, }; -void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBa_Draw(Actor* thisx, PlayState* play) { EnBa* this = (EnBa*)thisx; s32 pad; s16 i; - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx) * 14); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 14); Vec3f unused = { 0.0f, 0.0f, 448.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ba.c", 933); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ba.c", 933); + func_80093D18(play->state.gfxCtx); if (this->actor.params < EN_BA_DEAD_BLOB) { Matrix_Push(); gSPSegment(POLY_OPA_DISP++, 0x0C, mtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809B8118[this->actor.params])); - gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, - (globalCtx->gameplayFrames * -10) % 128, 32, 32)); + gSPSegment( + POLY_OPA_DISP++, 0x09, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, (play->gameplayFrames * -10) % 128, 32, 32)); for (i = 0; i < 14; i++, mtx++) { Matrix_Translate(this->unk_158[i].x, this->unk_158[i].y, this->unk_158[i].z, MTXMODE_NEW); Matrix_RotateZYX(this->unk_2A8[i].x, this->unk_2A8[i].y, this->unk_2A8[i].z, MTXMODE_APPLY); @@ -506,19 +505,18 @@ void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_ToMtx(mtx, "../z_en_ba.c", 970); } Matrix_Pop(); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ba.c", 973), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ba.c", 973), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_bxa_DL_000890); } else { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->gameplayFrames * 2) % 128, - (globalCtx->gameplayFrames * 2) % 128, 32, 32, 1, - (globalCtx->gameplayFrames * -5) % 128, (globalCtx->gameplayFrames * -5) % 128, 32, - 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (play->gameplayFrames * 2) % 128, + (play->gameplayFrames * 2) % 128, 32, 32, 1, (play->gameplayFrames * -5) % 128, + (play->gameplayFrames * -5) % 128, 32, 32)); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 125, 100, 255); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ba.c", 991), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ba.c", 991), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_bxa_DL_001D80); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ba.c", 995); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ba.c", 995); } diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.h b/src/overlays/actors/ovl_En_Ba/z_en_ba.h index 7e447af051..d19368c199 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.h +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.h @@ -6,7 +6,7 @@ struct EnBa; -typedef void (*EnBaActionFunc)(struct EnBa*, GlobalContext*); +typedef void (*EnBaActionFunc)(struct EnBa*, PlayState*); typedef enum { /* 0x00 */ EN_BA_TENTACLE_RED, 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 e8845f44e0..4ea6ab8c10 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -53,42 +53,42 @@ typedef enum { // Main functions -void EnBb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBb_Update(Actor* this, GlobalContext* globalCtx); -void EnBb_Draw(Actor* this, GlobalContext* globalCtx); +void EnBb_Init(Actor* thisx, PlayState* play); +void EnBb_Destroy(Actor* thisx, PlayState* play); +void EnBb_Update(Actor* this, PlayState* play); +void EnBb_Draw(Actor* this, PlayState* play); // Helper functions void EnBb_FaceWaypoint(EnBb* this); -void EnBb_SetWaypoint(EnBb* this, GlobalContext* globalCtx); +void EnBb_SetWaypoint(EnBb* this, PlayState* play); // Action functions void EnBb_SetupFlameTrail(EnBb* this); -void EnBb_FlameTrail(EnBb* this, GlobalContext* globalCtx); +void EnBb_FlameTrail(EnBb* this, PlayState* play); -void EnBb_SetupDeath(EnBb* this, GlobalContext* globalCtx); -void EnBb_Death(EnBb* this, GlobalContext* globalCtx); +void EnBb_SetupDeath(EnBb* this, PlayState* play); +void EnBb_Death(EnBb* this, PlayState* play); -void EnBb_Damage(EnBb* this, GlobalContext* globalCtx); +void EnBb_Damage(EnBb* this, PlayState* play); void EnBb_SetupBlue(EnBb* this); -void EnBb_Blue(EnBb* this, GlobalContext* globalCtx); +void EnBb_Blue(EnBb* this, PlayState* play); void EnBb_SetupDown(EnBb* this); -void EnBb_Down(EnBb* this, GlobalContext* globalCtx); +void EnBb_Down(EnBb* this, PlayState* play); -void EnBb_SetupRed(GlobalContext* globalCtx, EnBb* this); -void EnBb_Red(EnBb* this, GlobalContext* globalCtx); +void EnBb_SetupRed(PlayState* play, EnBb* this); +void EnBb_Red(EnBb* this, PlayState* play); -void EnBb_SetupWhite(GlobalContext* globalCtx, EnBb* this); -void EnBb_White(EnBb* this, GlobalContext* globalCtx); +void EnBb_SetupWhite(PlayState* play, EnBb* this); +void EnBb_White(EnBb* this, PlayState* play); -void EnBb_InitGreen(EnBb* this, GlobalContext* globalCtx); -void EnBb_Green(EnBb* this, GlobalContext* globalCtx); +void EnBb_InitGreen(EnBb* this, PlayState* play); +void EnBb_Green(EnBb* this, PlayState* play); -void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx); +void EnBb_Stunned(EnBb* this, PlayState* play); static DamageTable sDamageTableBlueGreen = { /* Deku nut */ DMG_ENTRY(0, 0xF), @@ -242,8 +242,8 @@ void EnBb_SetupAction(EnBb* this, EnBbActionFunc actionFunc) { this->actionFunc = actionFunc; } -Actor* EnBb_FindExplosive(GlobalContext* globalCtx, EnBb* this, f32 range) { - Actor* explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; +Actor* EnBb_FindExplosive(PlayState* play, EnBb* this, f32 range) { + Actor* explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; f32 dist; while (explosive != NULL) { @@ -260,14 +260,14 @@ Actor* EnBb_FindExplosive(GlobalContext* globalCtx, EnBb* this, f32 range) { return NULL; } -void EnBb_SpawnFlameTrail(GlobalContext* globalCtx, EnBb* this, s16 startAtZero) { +void EnBb_SpawnFlameTrail(PlayState* play, EnBb* this, s16 startAtZero) { EnBb* now = this; EnBb* next; s32 i; for (i = 0; i < 5; i++) { - next = (EnBb*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BB, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); + next = (EnBb*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BB, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 0); if (next != NULL) { now->actor.child = &next->actor; next->actor.parent = &now->actor; @@ -305,18 +305,18 @@ void EnBb_KillFlameTrail(EnBb* this) { this->actor.child = NULL; } -void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBb_Init(Actor* thisx, PlayState* play) { EffectBlureInit1 blureInit; s32 pad; EnBb* this = (EnBb*)thisx; Actor_ProcessInitChain(thisx, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_Bb_Skel_001A30, &object_Bb_Anim_000444, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_Bb_Skel_001A30, &object_Bb_Anim_000444, this->jointTable, this->morphTable, 16); this->unk_254 = 0; thisx->colChkInfo.health = 4; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, thisx, &sJntSphInit, this->elements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, this->elements); this->actionState = thisx->params >> 8; @@ -351,7 +351,7 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->colChkInfo.damageTable = &sDamageTableRed; this->flameEnvColor.r = 255; this->collider.elements[0].info.toucher.effect = 1; - EnBb_SetupRed(globalCtx, this); + EnBb_SetupRed(play, this); break; case ENBB_WHITE: thisx->naviEnemyId = NAVI_ENEMY_WHITE_BUBBLE; @@ -369,9 +369,9 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); - EnBb_SetupWhite(globalCtx, this); - EnBb_SetWaypoint(this, globalCtx); + Effect_Add(play, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); + EnBb_SetupWhite(play, this); + EnBb_SetWaypoint(this, play); EnBb_FaceWaypoint(this); thisx->flags |= ACTOR_FLAG_14; break; @@ -387,7 +387,7 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { this->flameEnvColor.g = 255; thisx->colChkInfo.health = 1; - EnBb_InitGreen(this, globalCtx); + EnBb_InitGreen(this, play); break; } thisx->focus.pos = thisx->world.pos; @@ -398,11 +398,11 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.elements[0].dim.modelSphere.radius * this->collider.elements[0].dim.scale; } -void EnBb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBb_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnBb* this = (EnBb*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnBb_SetupFlameTrail(EnBb* this) { @@ -415,10 +415,10 @@ void EnBb_SetupFlameTrail(EnBb* this) { EnBb_SetupAction(this, EnBb_FlameTrail); } -void EnBb_FlameTrail(EnBb* this, GlobalContext* globalCtx) { +void EnBb_FlameTrail(EnBb* this, PlayState* play) { if (this->actor.params == ENBB_KILL_TRAIL) { if (this->actor.parent == NULL) { - EnBb_SetupDeath(this, globalCtx); + EnBb_SetupDeath(this, play); } } else { if (this->timer == 0) { @@ -452,19 +452,19 @@ void EnBb_FlameTrail(EnBb* this, GlobalContext* globalCtx) { } } -void EnBb_SetupDeath(EnBb* this, GlobalContext* globalCtx) { +void EnBb_SetupDeath(EnBb* this, PlayState* play) { if (this->actor.params <= ENBB_BLUE) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.speedXZ = -7.0f; this->timer = 5; this->actor.shape.rot.x += 0x4E20; - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_BUBLE_DEAD, 1, 1, 0x28); + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_BUBLE_DEAD, 1, 1, 0x28); } this->action = BB_KILL; EnBb_SetupAction(this, EnBb_Death); } -void EnBb_Death(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Death(EnBb* this, PlayState* play) { s16 enpartType = 3; Vec3f sp40 = { 0.0f, 0.5f, 0.0f }; Vec3f sp34 = { 0.0f, 0.0f, 0.0f }; @@ -479,17 +479,17 @@ void EnBb_Death(EnBb* this, GlobalContext* globalCtx) { } if (this->bodyBreak.val == BODYBREAK_STATUS_FINISHED) { - BodyBreak_Alloc(&this->bodyBreak, 12, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 12, play); } if ((this->dmgEffect == 7) || (this->dmgEffect == 5)) { enpartType = 11; } - if (!BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, enpartType)) { + if (!BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, enpartType)) { return; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xD0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xD0); } else { if (this->flamePrimAlpha) { if (this->flamePrimAlpha <= 20) { @@ -521,7 +521,7 @@ void EnBb_SetupDamage(EnBb* this) { EnBb_SetupAction(this, EnBb_Damage); } -void EnBb_Damage(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Damage(EnBb* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); if (this->actor.speedXZ == 0.0f) { this->actor.shape.yOffset = 200.0f; @@ -539,7 +539,7 @@ void EnBb_SetupBlue(EnBb* this) { EnBb_SetupAction(this, EnBb_Blue); } -void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Blue(EnBb* this, PlayState* play) { Actor* explosive; s16 moveYawToWall; s16 thisYawToWall; @@ -600,7 +600,7 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) { this->vMoveAngleY = this->actor.yawTowardsPlayer; } if (this->targetActor == NULL) { - explosive = EnBb_FindExplosive(globalCtx, this, 300.0f); + explosive = EnBb_FindExplosive(play, this, 300.0f); } else if (this->targetActor->params == 0) { explosive = this->targetActor; } else { @@ -641,7 +641,7 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) { } else { afterHitAngle = 0x4000; Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_BITE); - if (globalCtx->gameplayFrames & 1) { + if (play->gameplayFrames & 1) { afterHitAngle = -0x4000; } } @@ -681,7 +681,7 @@ void EnBb_SetupDown(EnBb* this) { EnBb_SetupAction(this, EnBb_Down); } -void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Down(EnBb* this, PlayState* play) { s16 yawDiff = this->actor.world.rot.y - this->actor.wallYaw; SkelAnime_Update(&this->skelAnime); @@ -693,7 +693,7 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { } if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { if (this->actor.params == ENBB_RED) { - s32 floorType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + s32 floorType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorType == 2) || (floorType == 3) || (floorType == 9)) { this->moveMode = BBMOVE_HIDDEN; @@ -712,7 +712,7 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { this->actor.velocity.y = 10.0f; } this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, false); Math_SmoothStepToS(&this->actor.world.rot.y, -this->actor.yawTowardsPlayer, 1, 0xBB8, 0); } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -729,14 +729,14 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { break; case ENBB_RED: if (this->actor.velocity.y == 10.0f) { - EnBb_SetupRed(globalCtx, this); - EnBb_SpawnFlameTrail(globalCtx, this, true); + EnBb_SetupRed(play, this); + EnBb_SpawnFlameTrail(play, this, true); } break; case ENBB_WHITE: this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; - EnBb_SetupWhite(globalCtx, this); + EnBb_SetupWhite(play, this); this->actor.world.pos.y -= 60.0f; break; } @@ -745,7 +745,7 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { } } -void EnBb_SetupRed(GlobalContext* globalCtx, EnBb* this) { +void EnBb_SetupRed(PlayState* play, EnBb* this) { Animation_PlayLoop(&this->skelAnime, &object_Bb_Anim_000184); if (this->action == BB_DOWN) { this->actor.speedXZ = 5.0f; @@ -770,8 +770,8 @@ void EnBb_SetupRed(GlobalContext* globalCtx, EnBb* this) { EnBb_SetupAction(this, EnBb_Red); } -void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBb_Red(EnBb* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 floorType; s16 yawDiff; @@ -792,7 +792,7 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { this->timer = 7; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actionState++; - EnBb_SpawnFlameTrail(globalCtx, this, false); + EnBb_SpawnFlameTrail(play, this, false); } break; case BBRED_ATTACK: @@ -812,7 +812,7 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - floorType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + floorType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorType == 2) || (floorType == 3) || (floorType == 9)) { this->moveMode = BBMOVE_HIDDEN; this->timer = 10; @@ -828,7 +828,7 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } this->actor.shape.rot.y = this->actor.world.rot.y; - if (Actor_GetCollidedExplosive(globalCtx, &this->collider.base) != NULL) { + if (Actor_GetCollidedExplosive(play, &this->collider.base) != NULL) { EnBb_SetupDown(this); } break; @@ -857,8 +857,8 @@ void EnBb_FaceWaypoint(EnBb* this) { this->actor.world.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->waypointPos); } -void EnBb_SetWaypoint(EnBb* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->path]; +void EnBb_SetWaypoint(EnBb* this, PlayState* play) { + Path* path = &play->setupPathList[this->path]; Vec3s* point; if (this->waypoint == (s16)(path->count - 1)) { @@ -872,7 +872,7 @@ void EnBb_SetWaypoint(EnBb* this, GlobalContext* globalCtx) { this->waypointPos.z = point->z; } -void EnBb_SetupWhite(GlobalContext* globalCtx, EnBb* this) { +void EnBb_SetupWhite(PlayState* play, EnBb* this) { Animation_PlayLoop(&this->skelAnime, &object_Bb_Anim_000444); this->actor.speedXZ = 0.0f; this->actor.world.pos.y += 60.0f; @@ -884,7 +884,7 @@ void EnBb_SetupWhite(GlobalContext* globalCtx, EnBb* this) { EnBb_SetupAction(this, EnBb_White); } -void EnBb_White(EnBb* this, GlobalContext* globalCtx) { +void EnBb_White(EnBb* this, PlayState* play) { if (this->actor.speedXZ == 0.0f) { f32 distL1; f32 vx; @@ -902,7 +902,7 @@ void EnBb_White(EnBb* this, GlobalContext* globalCtx) { if (distL1 == 0.0f) { this->timer--; if (this->timer == 0) { - EnBb_SetWaypoint(this, globalCtx); + EnBb_SetWaypoint(this, play); EnBb_FaceWaypoint(this); Animation_PlayLoop(&this->skelAnime, &object_Bb_Anim_000184); this->timer = Rand_ZeroOne() * 30.0f + 40.0f; @@ -938,7 +938,7 @@ void EnBb_White(EnBb* this, GlobalContext* globalCtx) { } } -void EnBb_InitGreen(EnBb* this, GlobalContext* globalCtx) { +void EnBb_InitGreen(EnBb* this, PlayState* play) { Vec3f bobOffset = { 0.0f, 0.0f, 0.0f }; Animation_PlayLoop(&this->skelAnime, &object_Bb_Anim_000444); @@ -948,7 +948,7 @@ void EnBb_InitGreen(EnBb* this, GlobalContext* globalCtx) { this->actor.shape.rot.x = this->actor.shape.rot.z = 0; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; if (this->actor.params == ENBB_GREEN_BIG) { - EnBb_SetWaypoint(this, globalCtx); + EnBb_SetWaypoint(this, play); EnBb_FaceWaypoint(this); } Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW); @@ -976,8 +976,8 @@ void EnBb_SetupGreen(EnBb* this) { EnBb_SetupAction(this, EnBb_Green); } -void EnBb_Green(EnBb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBb_Green(EnBb* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f bobOffset = { 0.0f, 0.0f, 0.0f }; Vec3f nextPos = player->actor.world.pos; @@ -1000,7 +1000,7 @@ void EnBb_Green(EnBb* this, GlobalContext* globalCtx) { vz += Math_SmoothStepToF(&this->actor.home.pos.z, this->waypointPos.z, 1.0f, ABS(distL1), 0.0f); this->bobPhase += (0.05f + (Rand_ZeroOne() * 0.01f)); if (vz == 0.0f) { - EnBb_SetWaypoint(this, globalCtx); + EnBb_SetWaypoint(this, play); } this->moveMode = BBMOVE_NOCLIP; this->maxSpeed = 10.0f; @@ -1037,7 +1037,7 @@ void EnBb_Green(EnBb* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.world.pos.y, nextPos.y, 1.0f, this->bobPhase * 0.75f, 0.0f); Math_SmoothStepToF(&this->actor.world.pos.z, nextPos.z, 1.0f, this->bobPhase * 0.75f, 0.0f); this->bobPhase += 0.1f + this->bobSpeedMod; - if (Actor_GetCollidedExplosive(globalCtx, &this->collider.base) || (--this->vFlameTimer == 0)) { + if (Actor_GetCollidedExplosive(play, &this->collider.base) || (--this->vFlameTimer == 0)) { this->actionState++; this->timer = (Rand_ZeroOne() * 30.0f) + 60.0f; if (this->vFlameTimer != 0) { @@ -1096,7 +1096,7 @@ void EnBb_SetupStunned(EnBb* this) { EnBb_SetupAction(this, EnBb_Stunned); } -void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Stunned(EnBb* this, PlayState* play) { s16 yawDiff = this->actor.world.rot.y - this->actor.wallYaw; if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { @@ -1112,7 +1112,7 @@ void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx) { } else { this->actor.velocity.y = 0.0f; } - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, false); } if (this->actor.colorFilterTimer == 0) { this->actor.shape.yOffset = 200.0f; @@ -1127,12 +1127,12 @@ void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx) { } } else { this->actor.flags &= ~ACTOR_FLAG_0; - EnBb_SetupDeath(this, globalCtx); + EnBb_SetupDeath(this, play); } } } -void EnBb_CollisionCheck(EnBb* this, GlobalContext* globalCtx) { +void EnBb_CollisionCheck(EnBb* this, PlayState* play) { if (this->collider.base.atFlags & AT_BOUNCED) { this->collider.base.atFlags &= ~AT_BOUNCED; if (this->action != BB_DOWN) { @@ -1195,7 +1195,7 @@ void EnBb_CollisionCheck(EnBb* this, GlobalContext* globalCtx) { if (this->actor.params == ENBB_RED) { EnBb_KillFlameTrail(this); } - EnBb_SetupDeath(this, globalCtx); + EnBb_SetupDeath(this, play); //! @bug //! Because Din's Fire kills the bubble in a single hit, Actor_SetColorFilter is never called and //! colorFilterParams is never set. And because Din's Fire halts updating during its cutscene, @@ -1218,8 +1218,8 @@ void EnBb_CollisionCheck(EnBb* this, GlobalContext* globalCtx) { } } -void EnBb_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBb_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBb* this = (EnBb*)thisx; Vec3f sp4C = { 0.0f, 0.0f, 0.0f }; Vec3f sp40 = { 0.0f, -0.6f, 0.0f }; @@ -1228,10 +1228,10 @@ void EnBb_Update(Actor* thisx, GlobalContext* globalCtx2) { f32 sp34 = -15.0f; if (this->actor.params <= ENBB_BLUE) { - EnBb_CollisionCheck(this, globalCtx); + EnBb_CollisionCheck(this, play); } if (this->actor.colChkInfo.damageEffect != 0xD) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actor.params <= ENBB_BLUE) && (this->actor.speedXZ >= -6.0f) && ((this->actor.flags & ACTOR_FLAG_15) == 0)) { Actor_MoveForward(&this->actor); @@ -1240,7 +1240,7 @@ void EnBb_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((this->actor.world.pos.y - 20.0f) <= this->actor.floorHeight) { sp34 = 20.0f; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, sp34, 25.0f, 20.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, sp34, 25.0f, 20.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } this->actor.focus.pos = this->actor.world.pos; @@ -1250,18 +1250,18 @@ void EnBb_Update(Actor* thisx, GlobalContext* globalCtx2) { this->collider.elements->dim.worldSphere.center.z = this->actor.world.pos.z; if ((this->action > BB_KILL) && ((this->actor.speedXZ != 0.0f) || (this->action == BB_GREEN))) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->action > BB_FLAME_TRAIL) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) && (this->moveMode != BBMOVE_HIDDEN)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } -void EnBb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnBb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnBb* this = (EnBb*)thisx; BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 4, 15, 15, dList, BODYBREAK_OBJECT_DEFAULT); @@ -1273,7 +1273,7 @@ static Vec3f sFireIceOffsets[] = { { 5.0f, 0.0f, -5.0f }, { 0.0f, 10.0f, 13.0f }, { -5.0f, 0.0f, 5.0f }, { -5.0f, 0.0f, -5.0f }, }; -void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBb_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBb* this = (EnBb*)thisx; Vec3f blureBase1 = { 0.0f, 5000.0f, 0.0f }; @@ -1281,14 +1281,14 @@ void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { Vec3f blureVtx1; Vec3f blureVtx2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bb.c", 2044); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bb.c", 2044); blureBase1.z = this->maxSpeed * 80.0f; blureBase2.z = this->maxSpeed * 80.0f; if (this->moveMode != BBMOVE_HIDDEN) { if (this->actor.params <= ENBB_BLUE) { - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnBb_PostLimbDraw, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnBb_PostLimbDraw, this); if (this->fireIceTimer != 0) { @@ -1309,11 +1309,11 @@ void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { sp70.z = this->actor.world.pos.z + sFireIceOffsets[index].z; if ((this->dmgEffect != 7) && (this->dmgEffect != 5)) { - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &sp70, 0x96, 0x96, 0x96, 0xFA, 0xEB, - 0xF5, 0xFF, 0.8f); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &sp70, 0x96, 0x96, 0x96, 0xFA, 0xEB, 0xF5, + 0xFF, 0.8f); } else { sp70.y -= 17.0f; - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &sp70, 0x28, 1, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &sp70, 0x28, 1, 0, -1); } } } @@ -1322,26 +1322,26 @@ void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, -40.0f, 0.0f, MTXMODE_APPLY); } if (this->actor.params != ENBB_WHITE) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - ((globalCtx->gameplayFrames + (this->flameScrollMod * 10)) * + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + ((play->gameplayFrames + (this->flameScrollMod * 10)) * (-20 - (this->flameScrollMod * -2))) % 0x200, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, this->flamePrimBlue, this->flamePrimAlpha); gDPSetEnvColor(POLY_XLU_DISP++, this->flameEnvColor.r, this->flameEnvColor.g, this->flameEnvColor.b, 0); Matrix_RotateY( - BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - 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(this->flameScaleX * 0.01f, this->flameScaleY * 0.01f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bb.c", 2106), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_bb.c", 2106), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } else { Matrix_MultVec3f(&blureBase1, &blureVtx1); Matrix_MultVec3f(&blureBase2, &blureVtx2); - if ((this->maxSpeed != 0.0f) && (this->action == BB_WHITE) && !(globalCtx->gameplayFrames & 1) && + if ((this->maxSpeed != 0.0f) && (this->action == BB_WHITE) && !(play->gameplayFrames & 1) && (this->actor.colChkInfo.health != 0)) { EffectBlure_AddVertex(Effect_GetByIndex(this->blureIdx), &blureVtx1, &blureVtx2); } else if (this->action != BB_WHITE) { @@ -1349,5 +1349,5 @@ void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { } } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bb.c", 2127); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bb.c", 2127); } diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.h b/src/overlays/actors/ovl_En_Bb/z_en_bb.h index f964f23e52..242088a10b 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.h +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.h @@ -6,7 +6,7 @@ struct EnBb; -typedef void (*EnBbActionFunc)(struct EnBb*, GlobalContext*); +typedef void (*EnBbActionFunc)(struct EnBb*, PlayState*); typedef struct EnBb { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c index 753df1d8e0..098ce4211c 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnBdfire_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBdfire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBdfire_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBdfire_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBdfire_Init(Actor* thisx, PlayState* play); +void EnBdfire_Destroy(Actor* thisx, PlayState* play); +void EnBdfire_Update(Actor* thisx, PlayState* play); +void EnBdfire_Draw(Actor* thisx, PlayState* play); -void EnBdfire_DrawFire(EnBdfire* this, GlobalContext* globalCtx); -void func_809BC2A4(EnBdfire* this, GlobalContext* globalCtx); -void func_809BC598(EnBdfire* this, GlobalContext* globalCtx); +void EnBdfire_DrawFire(EnBdfire* this, PlayState* play); +void func_809BC2A4(EnBdfire* this, PlayState* play); +void func_809BC598(EnBdfire* this, PlayState* play); const ActorInit En_Bdfire_InitVars = { 0, @@ -38,7 +38,7 @@ void EnbdFire_SetupDraw(EnBdfire* this, EnBdfireDrawFunc drawFunc) { this->drawFunc = drawFunc; } -void EnBdfire_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBdfire_Init(Actor* thisx, PlayState* play) { EnBdfire* this = (EnBdfire*)thisx; s32 pad; @@ -50,7 +50,7 @@ void EnBdfire_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_154 = 90; Lights_PointNoGlowSetInfo(&this->lightInfoNoGlow, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 255, 300); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfoNoGlow); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfoNoGlow); } else { EnBdfire_SetupAction(this, func_809BC598); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); @@ -72,15 +72,15 @@ void EnBdfire_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBdfire_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBdfire_Destroy(Actor* thisx, PlayState* play) { EnBdfire* this = (EnBdfire*)thisx; if (this->actor.params < 0) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } } -void func_809BC2A4(EnBdfire* this, GlobalContext* globalCtx) { +void func_809BC2A4(EnBdfire* this, PlayState* play) { BossDodongo* kingDodongo; s32 temp; @@ -118,9 +118,9 @@ void func_809BC2A4(EnBdfire* this, GlobalContext* globalCtx) { } } -void func_809BC598(EnBdfire* this, GlobalContext* globalCtx) { +void func_809BC598(EnBdfire* this, PlayState* play) { s16 quarterTurn; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 distToBurn; BossDodongo* bossDodongo; s16 i; @@ -170,21 +170,21 @@ void func_809BC598(EnBdfire* this, GlobalContext* globalCtx) { player->flameTimers[i] = Rand_S16Offset(0, 200); } player->isBurning = true; - func_8002F6D4(globalCtx, &this->actor, 20.0f, this->actor.world.rot.y, 0.0f, 8); + func_8002F6D4(play, &this->actor, 20.0f, this->actor.world.rot.y, 0.0f, 8); osSyncPrintf("POWER\n"); } } } -void EnBdfire_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBdfire_Update(Actor* thisx, PlayState* play) { EnBdfire* this = (EnBdfire*)thisx; this->unk_156++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); } -void EnBdfire_DrawFire(EnBdfire* this, GlobalContext* globalCtx) { +void EnBdfire_DrawFire(EnBdfire* this, PlayState* play) { static void* D_809BCB10[] = { object_kingdodongo_Tex_0264E0, object_kingdodongo_Tex_0274E0, object_kingdodongo_Tex_0284E0, object_kingdodongo_Tex_0294E0, object_kingdodongo_Tex_02A4E0, object_kingdodongo_Tex_02B4E0, @@ -193,10 +193,10 @@ void EnBdfire_DrawFire(EnBdfire* this, GlobalContext* globalCtx) { s16 texIndex; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bdfire.c", 612); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bdfire.c", 612); texIndex = this->unk_156 & 7; - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - func_80094BC4(globalCtx->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); + func_80094BC4(play->state.gfxCtx); POLY_XLU_DISP = func_80094968(POLY_XLU_DISP); gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, @@ -206,14 +206,14 @@ void EnBdfire_DrawFire(EnBdfire* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 200, 0, 0, 0); gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_809BCB10[texIndex])); Matrix_Translate(0.0f, 11.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bdfire.c", 647), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_bdfire.c", 647), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_kingdodongo_DL_01D950); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bdfire.c", 651); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bdfire.c", 651); } -void EnBdfire_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBdfire_Draw(Actor* thisx, PlayState* play) { EnBdfire* this = (EnBdfire*)thisx; - this->drawFunc(this, globalCtx); + this->drawFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h index 190de9b49b..93b37e3b1a 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h @@ -7,8 +7,8 @@ struct EnBdfire; -typedef void (*EnBdfireActionFunc)(struct EnBdfire*, GlobalContext*); -typedef void (*EnBdfireDrawFunc)(struct EnBdfire*, GlobalContext*); +typedef void (*EnBdfireActionFunc)(struct EnBdfire*, PlayState*); +typedef void (*EnBdfireDrawFunc)(struct EnBdfire*, PlayState*); typedef struct EnBdfire { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 433cc08e64..5b2e11ce14 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -3,28 +3,28 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnBigokuta_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBigokuta_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBigokuta_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBigokuta_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBigokuta_Init(Actor* thisx, PlayState* play); +void EnBigokuta_Destroy(Actor* thisx, PlayState* play); +void EnBigokuta_Update(Actor* thisx, PlayState* play); +void EnBigokuta_Draw(Actor* thisx, PlayState* play); void func_809BD318(EnBigokuta* this); void func_809BD3E0(EnBigokuta* this); -void func_809BDF34(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BD84C(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BD8DC(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BDAE8(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BDB90(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BDC08(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE3E4(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE4A4(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE518(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BCF68(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BDFC8(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE26C(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE180(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BE058(EnBigokuta* this, GlobalContext* globalCtx); -void func_809BD1C8(EnBigokuta* this, GlobalContext* globalCtx); +void func_809BDF34(EnBigokuta* this, PlayState* play); +void func_809BD84C(EnBigokuta* this, PlayState* play); +void func_809BD8DC(EnBigokuta* this, PlayState* play); +void func_809BDAE8(EnBigokuta* this, PlayState* play); +void func_809BDB90(EnBigokuta* this, PlayState* play); +void func_809BDC08(EnBigokuta* this, PlayState* play); +void func_809BE3E4(EnBigokuta* this, PlayState* play); +void func_809BE4A4(EnBigokuta* this, PlayState* play); +void func_809BE518(EnBigokuta* this, PlayState* play); +void func_809BCF68(EnBigokuta* this, PlayState* play); +void func_809BDFC8(EnBigokuta* this, PlayState* play); +void func_809BE26C(EnBigokuta* this, PlayState* play); +void func_809BE180(EnBigokuta* this, PlayState* play); +void func_809BE058(EnBigokuta* this, PlayState* play); +void func_809BD1C8(EnBigokuta* this, PlayState* play); static Color_RGBA8 sEffectPrimColor = { 255, 255, 255, 255 }; static Color_RGBA8 sEffectEnvColor = { 100, 255, 255, 255 }; @@ -154,22 +154,22 @@ static InitChainEntry sInitChain[] = { // possibly color data static s32 sUnused[] = { 0xFFFFFFFF, 0x969696FF }; -void EnBigokuta_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBigokuta_Init(Actor* thisx, PlayState* play) { EnBigokuta* this = (EnBigokuta*)thisx; s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_bigokuta_Skel_006BC0, &object_bigokuta_Anim_0014B8, + SkelAnime_InitFlex(play, &this->skelAnime, &object_bigokuta_Skel_006BC0, &object_bigokuta_Anim_0014B8, this->jointTable, this->morphTable, 20); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, &this->element); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->element); this->collider.elements->dim.worldSphere.radius = this->collider.elements->dim.modelSphere.radius; for (i = 0; i < ARRAY_COUNT(sCylinderInit); i++) { - Collider_InitCylinder(globalCtx, &this->cylinder[i]); - Collider_SetCylinder(globalCtx, &this->cylinder[i], &this->actor, &sCylinderInit[i]); + Collider_InitCylinder(play, &this->cylinder[i]); + Collider_SetCylinder(play, &this->cylinder[i], &this->actor, &sCylinderInit[i]); } CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, sColChkInfoInit); @@ -177,7 +177,7 @@ void EnBigokuta_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_194 = 1; if (this->actor.params == 0) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); func_809BD318(this); } else { func_809BD3E0(this); @@ -187,13 +187,13 @@ void EnBigokuta_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBigokuta_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBigokuta_Destroy(Actor* thisx, PlayState* play) { EnBigokuta* this = (EnBigokuta*)thisx; s32 i; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - Collider_DestroyCylinder(globalCtx, &this->cylinder[i]); + Collider_DestroyCylinder(play, &this->cylinder[i]); } } @@ -203,7 +203,7 @@ void func_809BCE3C(EnBigokuta* this) { this->actor.world.pos.z = Math_CosS(this->actor.world.rot.y) * 263.0f + this->actor.home.pos.z; } -void func_809BCEBC(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BCEBC(EnBigokuta* this, PlayState* play) { Vec3f pos; f32 yDistFromHome = this->actor.world.pos.y - this->actor.home.pos.y; @@ -211,26 +211,26 @@ void func_809BCEBC(EnBigokuta* this, GlobalContext* globalCtx) { pos.y = this->actor.home.pos.y + 3.0f; pos.z = this->actor.world.pos.z; - if (((globalCtx->gameplayFrames % 7) == 0) && (yDistFromHome <= 0.0f) && (yDistFromHome > -100.0f)) { - EffectSsGRipple_Spawn(globalCtx, &pos, 800, 1300, 0); + if (((play->gameplayFrames % 7) == 0) && (yDistFromHome <= 0.0f) && (yDistFromHome > -100.0f)) { + EffectSsGRipple_Spawn(play, &pos, 800, 1300, 0); } } -void func_809BCF68(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BCF68(EnBigokuta* this, PlayState* play) { Vec3f effectPos; s16 rot; - if (globalCtx->gameplayFrames & 1) { + if (play->gameplayFrames & 1) { rot = Rand_S16Offset(0x1200, 0xC00) + this->actor.shape.rot.y - this->unk_194 * 0xA00; } else { rot = this->actor.shape.rot.y - this->unk_194 * 0xA00 - Rand_S16Offset(0x1200, 0xC00); } if (this->actionFunc != func_809BE4A4) { - if (this->actionFunc == func_809BE3E4 || (globalCtx->gameplayFrames & 2)) { + if (this->actionFunc == func_809BE3E4 || (play->gameplayFrames & 2)) { effectPos.x = this->actor.world.pos.x - Math_SinS(rot) * 80.0f; effectPos.z = this->actor.world.pos.z - Math_CosS(rot) * 80.0f; effectPos.y = this->actor.home.pos.y + 1.0f; - EffectSsGRipple_Spawn(globalCtx, &effectPos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &effectPos, 100, 500, 0); } else { effectPos.x = this->actor.world.pos.x - Math_SinS(rot) * 120.0f; effectPos.z = this->actor.world.pos.z - Math_CosS(rot) * 120.0f; @@ -240,15 +240,15 @@ void func_809BCF68(EnBigokuta* this, GlobalContext* globalCtx) { effectPos.x = this->actor.world.pos.x - Math_SinS(rot) * 50.0f; effectPos.z = this->actor.world.pos.z - Math_CosS(rot) * 50.0f; effectPos.y = this->actor.home.pos.y + 1.0f; - EffectSsGRipple_Spawn(globalCtx, &effectPos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &effectPos, 100, 500, 0); } - EffectSsGSplash_Spawn(globalCtx, &effectPos, NULL, NULL, 1, 800); + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 800); if (this->actionFunc != func_809BE4A4) { func_8002F974(&this->actor, NA_SE_EN_DAIOCTA_SPLASH - SFX_FLAG); } } -void func_809BD1C8(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BD1C8(EnBigokuta* this, PlayState* play) { s32 i; Vec3f effectPos; @@ -257,12 +257,12 @@ void func_809BD1C8(EnBigokuta* this, GlobalContext* globalCtx) { for (i = 0; i < 4; i++) { effectPos.x = ((i >= 2) ? 1 : -1) * 60.0f + this->actor.world.pos.x; effectPos.z = ((i & 1) ? 1 : -1) * 60.0f + this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &effectPos, NULL, NULL, 1, 2000); + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 2000); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIOCTA_LAND_WATER); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOLON_LAND_BIG); - func_80033E88(&this->actor, globalCtx, 0xA, 8); + func_80033E88(&this->actor, play, 0xA, 8); } void func_809BD2E4(EnBigokuta* this) { @@ -389,14 +389,14 @@ void func_809BD768(EnBigokuta* this) { this->actionFunc = func_809BE4A4; } -void func_809BD7F0(EnBigokuta* this, GlobalContext* globalCtx) { - this->actor.world.rot.y = Actor_WorldYawTowardPoint(&GET_PLAYER(globalCtx)->actor, &this->actor.home.pos); +void func_809BD7F0(EnBigokuta* this, PlayState* play) { + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&GET_PLAYER(play)->actor, &this->actor.home.pos); this->actor.shape.rot.y = this->actor.world.rot.y + (this->unk_194 * 0x4000); func_809BCE3C(this); this->actionFunc = func_809BE518; } -void func_809BD84C(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BD84C(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->unk_196--; @@ -412,7 +412,7 @@ void func_809BD84C(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BD8DC(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BD8DC(EnBigokuta* this, PlayState* play) { Vec3f effectPos; this->unk_196--; @@ -430,9 +430,9 @@ void func_809BD8DC(EnBigokuta* this, GlobalContext* globalCtx) { effectPos.x = this->actor.world.pos.x + 40.0f; effectPos.y = this->actor.world.pos.y; effectPos.z = this->actor.world.pos.z - 70.0f; - EffectSsGSplash_Spawn(globalCtx, &effectPos, NULL, NULL, 1, 2000); + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 2000); effectPos.x = this->actor.world.pos.x - 40.0f; - EffectSsGSplash_Spawn(globalCtx, &effectPos, NULL, NULL, 1, 2000); + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 2000); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIOCTA_LAND_WATER); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOLON_LAND_BIG); func_800AA000(0.0f, 0xFF, 0x14, 0x96); @@ -445,7 +445,7 @@ void func_809BD8DC(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BDAE8(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BDAE8(EnBigokuta* this, PlayState* play) { if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y + 0x4000, 0x400)) { if (this->unk_196 != 0) { this->unk_196--; @@ -453,7 +453,7 @@ void func_809BDAE8(EnBigokuta* this, GlobalContext* globalCtx) { if (this->unk_196 == 0) { func_809BCE3C(this); this->actor.home.pos.y = this->actor.world.pos.y; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); this->actor.params = 2; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIOCTA_VOICE); func_809BD3E0(this); @@ -461,7 +461,7 @@ void func_809BDAE8(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BDB90(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BDB90(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_196 != 0) { this->unk_196--; @@ -474,8 +474,8 @@ void func_809BDB90(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BDC08(EnBigokuta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809BDC08(EnBigokuta* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_v0; s16 pad; s16 phi_v1; @@ -493,14 +493,14 @@ void func_809BDC08(EnBigokuta* this, GlobalContext* globalCtx) { if (this->unk_196 == 0) { this->unk_196 = 350; } - func_809BCF68(this, globalCtx); + func_809BCF68(this, play); return; } phi_v1 = (Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos) - 180.0f) * (8.0f / 15); func_8002DBD0(&this->actor, &sp28, &player->actor.world.pos); if (fabsf(sp28.x) > 263.0f || ((sp28.z > 0.0f) && !Actor_IsFacingPlayer(&this->actor, 0x1B00) && - !Player_IsFacingActor(&this->actor, 0x2000, globalCtx))) { + !Player_IsFacingActor(&this->actor, 0x2000, play))) { phi_v1 -= 0x80; if (this->unk_196 != 0) { this->unk_196--; @@ -524,7 +524,7 @@ void func_809BDC08(EnBigokuta* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y += phi_v1 * this->unk_194; func_809BCE3C(this); - func_809BCF68(this, globalCtx); + func_809BCF68(this, play); if (this->unk_198 == 0) { func_809BD768(this); } else if (this->unk_196 == 0) { @@ -544,19 +544,19 @@ void func_809BDC08(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BDF34(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BDF34(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_196 != 0) { this->unk_196--; } this->actor.world.pos.y = (sinf(this->unk_196 * (M_PI / 16)) * 100.0f) + this->actor.home.pos.y; if (this->unk_196 == 0) { - func_809BD1C8(this, globalCtx); + func_809BD1C8(this, play); func_809BD3F8(this); } } -void func_809BDFC8(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BDFC8(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_196 != 0) { this->unk_196--; @@ -570,8 +570,8 @@ void func_809BDFC8(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BE058(EnBigokuta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809BE058(EnBigokuta* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 speedXZ; if (this->unk_196 != 0) { @@ -596,7 +596,7 @@ void func_809BE058(EnBigokuta* this, GlobalContext* globalCtx) { } } -void func_809BE180(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE180(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_196 != 0) { this->unk_196--; @@ -612,11 +612,11 @@ void func_809BE180(EnBigokuta* this, GlobalContext* globalCtx) { this->actor.world.pos.y = sinf((this->unk_196 - 8) * (M_PI / 16)) * 100.0f + this->actor.home.pos.y; func_809BCE3C(this); if (this->unk_196 == 8) { - func_809BD1C8(this, globalCtx); + func_809BD1C8(this, play); } } } -void func_809BE26C(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE26C(EnBigokuta* this, PlayState* play) { Vec3f effectPos; if (this->unk_196 != 0) { @@ -634,22 +634,22 @@ void func_809BE26C(EnBigokuta* this, GlobalContext* globalCtx) { effectPos.x = this->actor.world.pos.x; effectPos.y = this->actor.world.pos.y + 150.0f; effectPos.z = this->actor.world.pos.z; - func_8002829C(globalCtx, &effectPos, &sEffectPosAccel, &sEffectPosAccel, &sEffectPrimColor, - &sEffectEnvColor, 1200, 20); + func_8002829C(play, &effectPos, &sEffectPosAccel, &sEffectPosAccel, &sEffectPrimColor, &sEffectEnvColor, + 1200, 20); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_DEAD2); } if (this->unk_198 == 0 && Math_StepToF(&this->actor.scale.y, 0.0f, 0.001f)) { - Flags_SetClear(globalCtx, this->actor.room); - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); - func_8005ACFC(globalCtx->cameraPtrs[CAM_ID_MAIN], 4); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EN_OCTAROCK_BUBLE); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xB0); + Flags_SetClear(play, this->actor.room); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); + func_8005ACFC(play->cameraPtrs[CAM_ID_MAIN], 4); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EN_OCTAROCK_BUBLE); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xB0); Actor_Kill(&this->actor); } } } -void func_809BE3E4(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE3E4(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_196 != 0) { @@ -670,19 +670,19 @@ void func_809BE3E4(EnBigokuta* this, GlobalContext* globalCtx) { this->unk_196 = -40; } } - func_809BCF68(this, globalCtx); + func_809BCF68(this, play); } -void func_809BE4A4(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE4A4(EnBigokuta* this, PlayState* play) { this->actor.world.pos.y -= 10.0f; this->actor.shape.rot.y += 0x2000; if (this->actor.world.pos.y < (this->actor.home.pos.y + -200.0f)) { - func_809BD7F0(this, globalCtx); + func_809BD7F0(this, play); } - func_809BCF68(this, globalCtx); + func_809BCF68(this, play); } -void func_809BE518(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE518(EnBigokuta* this, PlayState* play) { if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 10.0f)) { this->actor.flags |= ACTOR_FLAG_0; func_809BD3F8(this); @@ -712,7 +712,7 @@ void func_809BE568(EnBigokuta* this) { } } -void func_809BE798(EnBigokuta* this, GlobalContext* globalCtx) { +void func_809BE798(EnBigokuta* this, PlayState* play) { s16 effectRot; s16 yawDiff; @@ -731,7 +731,7 @@ void func_809BE798(EnBigokuta* this, GlobalContext* globalCtx) { } else { effectRot = -0x6000; } - func_8002F71C(globalCtx, &this->actor, 10.0f, this->actor.world.rot.y + effectRot, 5.0f); + func_8002F71C(play, &this->actor, 10.0f, this->actor.world.rot.y + effectRot, 5.0f); if (this->actionFunc == func_809BDC08) { func_809BD4A4(this); this->unk_196 = 40; @@ -744,7 +744,7 @@ void func_809BE798(EnBigokuta* this, GlobalContext* globalCtx) { } } -void EnBigokuta_UpdateDamage(EnBigokuta* this, GlobalContext* globalCtx) { +void EnBigokuta_UpdateDamage(EnBigokuta* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect != 0 || this->actor.colChkInfo.damage != 0) { @@ -757,7 +757,7 @@ void EnBigokuta_UpdateDamage(EnBigokuta* this, GlobalContext* globalCtx) { } else if (!Actor_IsFacingPlayer(&this->actor, 0x4000)) { if (Actor_ApplyDamage(&this->actor) == 0) { // Dead Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIOCTA_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIOCTA_DAMAGE); } @@ -767,48 +767,47 @@ void EnBigokuta_UpdateDamage(EnBigokuta* this, GlobalContext* globalCtx) { } } -void EnBigokuta_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnBigokuta_Update(Actor* thisx, PlayState* play2) { EnBigokuta* this = (EnBigokuta*)thisx; s32 i; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; - func_809BE798(this, globalCtx); - EnBigokuta_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + func_809BE798(this, play); + EnBigokuta_UpdateDamage(this, play); + this->actionFunc(this, play); func_809BD2E4(this); func_809BE568(this); - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BIG_OCTO); - func_8005AD1C(globalCtx->cameraPtrs[CAM_ID_MAIN], 4); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_BIG_OCTO); + func_8005AD1C(play->cameraPtrs[CAM_ID_MAIN], 4); if (this->cylinder[0].base.atFlags & AT_ON) { if (this->actionFunc != func_809BE058) { for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->cylinder[i].base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinder[i].base); } this->actor.flags |= ACTOR_FLAG_24; } else { for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cylinder[i].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder[i].base); } } for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder[i].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder[i].base); } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } else { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, this->actor.scale.y * 25.0f * 100.0f); - func_809BCEBC(this, globalCtx); + func_809BCEBC(this, play); } -s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnBigokuta* this = (EnBigokuta*)thisx; u8 intensity; f32 temp_f0; @@ -816,7 +815,7 @@ s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d if (limbIndex == 15) { if (this->actionFunc == func_809BE058 || this->actionFunc == func_809BE180) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bigokuta.c", 1914); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bigokuta.c", 1914); if (this->actionFunc == func_809BE058) { temp_hi = this->unk_196 % 12; @@ -838,10 +837,10 @@ s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, temp_f0, temp_f0, temp_f0, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bigokuta.c", 1945); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bigokuta.c", 1945); } } else if (limbIndex == 10) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bigokuta.c", 1950); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bigokuta.c", 1950); if (this->actionFunc == func_809BE26C) { intensity = this->unk_196 * (255.0f / 38); } else { @@ -850,7 +849,7 @@ s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, intensity, intensity, intensity, intensity); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bigokuta.c", 1972); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bigokuta.c", 1972); } else if (limbIndex == 17 && this->actionFunc == func_809BE26C) { if (this->unk_198 < 5) { Matrix_Scale((this->unk_198 * 0.2f * 0.25f) + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY); @@ -865,13 +864,13 @@ s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnBigokuta_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBigokuta_Draw(Actor* thisx, PlayState* play) { EnBigokuta* this = (EnBigokuta*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bigokuta.c", 2017); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bigokuta.c", 2017); if ((this->actionFunc != func_809BE26C) || (this->unk_196 != 0) || (this->unk_198 != 0)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); if (this->unk_196 & 1) { @@ -887,14 +886,14 @@ void EnBigokuta_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(-rotY, MTXMODE_APPLY); } } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnBigokuta_OverrideLimbDraw, NULL, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnBigokuta_OverrideLimbDraw, NULL, this); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, (this->actor.scale.y * (255 / 0.033f))); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, NULL, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bigokuta.c", 2076); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bigokuta.c", 2076); } diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h index 2044a18653..fc6ca9ac7a 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h @@ -6,7 +6,7 @@ struct EnBigokuta; -typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, GlobalContext*); +typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, PlayState*); typedef struct EnBigokuta { /* 0x0000 */ Actor actor; 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 6029700499..146fec106b 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -9,24 +9,24 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14) -void EnBili_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBili_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBili_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBili_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBili_Init(Actor* thisx, PlayState* play); +void EnBili_Destroy(Actor* thisx, PlayState* play); +void EnBili_Update(Actor* thisx, PlayState* play); +void EnBili_Draw(Actor* thisx, PlayState* play); void EnBili_SetupFloatIdle(EnBili* this); void EnBili_SetupSpawnedFlyApart(EnBili* this); -void EnBili_FloatIdle(EnBili* this, GlobalContext* globalCtx); -void EnBili_SpawnedFlyApart(EnBili* this, GlobalContext* globalCtx); -void EnBili_DischargeLightning(EnBili* this, GlobalContext* globalCtx); -void EnBili_Climb(EnBili* this, GlobalContext* globalCtx); -void EnBili_ApproachPlayer(EnBili* this, GlobalContext* globalCtx); -void EnBili_SetNewHomeHeight(EnBili* this, GlobalContext* globalCtx); -void EnBili_Recoil(EnBili* this, GlobalContext* globalCtx); -void EnBili_Burnt(EnBili* this, GlobalContext* globalCtx); -void EnBili_Die(EnBili* this, GlobalContext* globalCtx); -void EnBili_Stunned(EnBili* this, GlobalContext* globalCtx); -void EnBili_Frozen(EnBili* this, GlobalContext* globalCtx); +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); const ActorInit En_Bili_InitVars = { ACTOR_EN_BILI, @@ -111,16 +111,16 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP), }; -void EnBili_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBili_Init(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 17.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(globalCtx, &this->skelAnime, &gBiriSkel, &gBiriDefaultAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gBiriSkel, &gBiriDefaultAnim, this->jointTable, this->morphTable, EN_BILI_LIMB_MAX); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->playFlySound = false; @@ -131,10 +131,10 @@ void EnBili_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBili_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBili_Destroy(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } // Setup Action Functions @@ -246,7 +246,7 @@ void EnBili_SetupStunned(EnBili* this) { this->actionFunc = EnBili_Stunned; } -void EnBili_SetupFrozen(EnBili* this, GlobalContext* globalCtx) { +void EnBili_SetupFrozen(EnBili* this, PlayState* play) { s32 i; Vec3f effectPos; @@ -263,7 +263,7 @@ void EnBili_SetupFrozen(EnBili* this, GlobalContext* globalCtx) { effectPos.y += 2.5f; effectPos.z = this->actor.world.pos.z + ((i & 4) ? 7.0f : -7.0f); - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &effectPos, 150, 150, 150, 250, 235, 245, 255, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &effectPos, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.2f) + 0.7f); } @@ -323,7 +323,7 @@ void EnBili_UpdateFloating(EnBili* this) { // Action functions -void EnBili_FloatIdle(EnBili* this, GlobalContext* globalCtx) { +void EnBili_FloatIdle(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -345,7 +345,7 @@ void EnBili_FloatIdle(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_SpawnedFlyApart(EnBili* this, GlobalContext* globalCtx) { +void EnBili_SpawnedFlyApart(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -356,7 +356,7 @@ void EnBili_SpawnedFlyApart(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_DischargeLightning(EnBili* this, GlobalContext* globalCtx) { +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; @@ -369,7 +369,7 @@ void EnBili_DischargeLightning(EnBili* this, GlobalContext* globalCtx) { 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(globalCtx, &effectPos, &primColor, &envColor, 15, effectYaw, 6, 2); + EffectSsLightning_Spawn(play, &effectPos, &primColor, &envColor, 15, effectYaw, 6, 2); } } @@ -391,7 +391,7 @@ void EnBili_DischargeLightning(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Climb(EnBili* this, GlobalContext* globalCtx) { +void EnBili_Climb(EnBili* this, PlayState* play) { s32 skelAnimeUpdate = SkelAnime_Update(&this->skelAnime); f32 curFrame = this->skelAnime.curFrame; @@ -409,7 +409,7 @@ void EnBili_Climb(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_ApproachPlayer(EnBili* this, GlobalContext* globalCtx) { +void EnBili_ApproachPlayer(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 1820); @@ -428,7 +428,7 @@ void EnBili_ApproachPlayer(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_SetNewHomeHeight(EnBili* this, GlobalContext* globalCtx) { +void EnBili_SetNewHomeHeight(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -443,7 +443,7 @@ void EnBili_SetNewHomeHeight(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Recoil(EnBili* this, GlobalContext* globalCtx) { +void EnBili_Recoil(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.3f)) { @@ -452,7 +452,7 @@ void EnBili_Recoil(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Burnt(EnBili* this, GlobalContext* globalCtx) { +void EnBili_Burnt(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.flags & ACTOR_FLAG_15) { @@ -468,7 +468,7 @@ void EnBili_Burnt(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Die(EnBili* this, GlobalContext* globalCtx) { +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; @@ -480,7 +480,7 @@ void EnBili_Die(EnBili* this, GlobalContext* globalCtx) { return; } this->actor.draw = NULL; - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x50); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x50); } if (this->timer != 0) { @@ -497,11 +497,11 @@ void EnBili_Die(EnBili* this, GlobalContext* globalCtx) { effectScale = Rand_S16Offset(40, 40); if (Rand_ZeroOne() < 0.7f) { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &effectPos, &effectVelocity, &effectAccel, effectScale, - 25, 2, 1); + EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &effectAccel, effectScale, 25, 2, + 1); } else { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &effectPos, &effectVelocity, &effectAccel, effectScale, - 25, 0, 1); + EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &effectAccel, effectScale, 25, 0, + 1); } } } else { @@ -509,11 +509,11 @@ void EnBili_Die(EnBili* this, GlobalContext* globalCtx) { } if (this->timer == 14) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_BIRI_BUBLE); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BIRI_BUBLE); } } -void EnBili_Stunned(EnBili* this, GlobalContext* globalCtx) { +void EnBili_Stunned(EnBili* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -527,7 +527,7 @@ void EnBili_Stunned(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Frozen(EnBili* this, GlobalContext* globalCtx) { +void EnBili_Frozen(EnBili* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -544,7 +544,7 @@ void EnBili_Frozen(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_UpdateDamage(EnBili* this, GlobalContext* globalCtx) { +void EnBili_UpdateDamage(EnBili* this, PlayState* play) { u8 damageEffect; if ((this->actor.colChkInfo.health != 0) && (this->collider.base.acFlags & AC_HIT)) { @@ -554,7 +554,7 @@ void EnBili_UpdateDamage(EnBili* this, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BIRI_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_0; } @@ -579,7 +579,7 @@ void EnBili_UpdateDamage(EnBili* this, GlobalContext* globalCtx) { EnBili_SetupBurnt(this); this->timer = 2; } else if (damageEffect == BIRI_DMGEFF_ICE) { - EnBili_SetupFrozen(this, globalCtx); + EnBili_SetupFrozen(this, play); } else if (damageEffect == BIRI_DMGEFF_SLINGSHOT) { EnBili_SetupRecoil(this); } else { @@ -593,8 +593,8 @@ void EnBili_UpdateDamage(EnBili* this, GlobalContext* globalCtx) { } } -void EnBili_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBili_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBili* this = (EnBili*)thisx; if (this->collider.base.atFlags & AT_HIT) { @@ -602,8 +602,8 @@ void EnBili_Update(Actor* thisx, GlobalContext* globalCtx2) { EnBili_SetupDischargeLightning(this); } - EnBili_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnBili_UpdateDamage(this, play); + this->actionFunc(this, play); if (this->actionFunc != EnBili_Die) { EnBili_UpdateTentaclesIndex(this); @@ -624,18 +624,18 @@ void EnBili_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_MoveForward(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, this->collider.dim.radius, this->collider.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->collider); if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_SetFocus(&this->actor, 0.0f); } } @@ -722,7 +722,7 @@ void EnBili_PulseLimb4(EnBili* this, f32 frame, Vec3f* arg2) { } } -s32 EnBili_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +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 }; @@ -734,7 +734,7 @@ s32 EnBili_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList EnBili_PulseLimb2(this, curFrame, &limbScale); } else if (limbIndex == EN_BILI_LIMB_TENTACLES) { EnBili_PulseLimb4(this, curFrame, &limbScale); - rot->y = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y) + 0x8000; + rot->y = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y) + 0x8000; } Matrix_Scale(limbScale.x, limbScale.y, limbScale.z, MTXMODE_APPLY); @@ -748,11 +748,11 @@ static void* sTentaclesTextures[] = { #include "overlays/ovl_En_Bili/ovl_En_Bili.c" -void EnBili_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBili_Draw(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bili.c", 1521); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bili.c", 1521); + func_80093D84(play->state.gfxCtx); this->tentaclesTexIndex = CLAMP_MAX(this->tentaclesTexIndex, 7); @@ -764,7 +764,7 @@ void EnBili_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x09, D_809C1700); } - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - EnBili_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bili.c", 1552); + 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 5e5f6815f7..782412af87 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.h +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.h @@ -6,7 +6,7 @@ struct EnBili; -typedef void (*EnBiliActionFunc)(struct EnBili*, GlobalContext*); +typedef void (*EnBiliActionFunc)(struct EnBili*, PlayState*); typedef enum { /* 0 */ EN_BILI_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Bird/z_en_bird.c b/src/overlays/actors/ovl_En_Bird/z_en_bird.c index 511ae96884..192e600afb 100644 --- a/src/overlays/actors/ovl_En_Bird/z_en_bird.c +++ b/src/overlays/actors/ovl_En_Bird/z_en_bird.c @@ -9,14 +9,14 @@ #define FLAGS 0 -void EnBird_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBird_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBird_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBird_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBird_Init(Actor* thisx, PlayState* play); +void EnBird_Destroy(Actor* thisx, PlayState* play); +void EnBird_Update(Actor* thisx, PlayState* play); +void EnBird_Draw(Actor* thisx, PlayState* play); void func_809C1E00(EnBird* this, s16 params); -void func_809C1E40(EnBird* this, GlobalContext* globalCtx); -void func_809C1D60(EnBird* this, GlobalContext* globalCtx); +void func_809C1E40(EnBird* this, PlayState* play); +void func_809C1D60(EnBird* this, PlayState* play); void func_809C1CAC(EnBird* this, s16 params); const ActorInit En_Bird_InitVars = { @@ -39,12 +39,12 @@ void EnBird_SetupAction(EnBird* this, EnBirdActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBird_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBird_Init(Actor* thisx, PlayState* play) { EnBird* this = (EnBird*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetScale(&this->actor, 0.01); - SkelAnime_Init(globalCtx, &this->skelAnime, &gBirdSkel, &gBirdFlyAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gBirdSkel, &gBirdFlyAnim, NULL, NULL, 0); ActorShape_Init(&this->actor.shape, 5500, ActorShadow_DrawCircle, 4); this->unk_194 = 0; this->unk_198 = 0; @@ -60,7 +60,7 @@ void EnBird_Init(Actor* thisx, GlobalContext* globalCtx) { func_809C1CAC(this, this->actor.params); } -void EnBird_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBird_Destroy(Actor* thisx, PlayState* play) { } void func_809C1CAC(EnBird* this, s16 params) { @@ -73,7 +73,7 @@ void func_809C1CAC(EnBird* this, s16 params) { EnBird_SetupAction(this, func_809C1D60); } -void func_809C1D60(EnBird* this, GlobalContext* globalCtx) { +void func_809C1D60(EnBird* this, PlayState* play) { f32 fVar2 = sinf(this->unk_1B4); this->actor.shape.yOffset = this->actor.shape.yOffset + fVar2 * this->unk_1A0; @@ -96,7 +96,7 @@ void func_809C1E00(EnBird* this, s16 params) { EnBird_SetupAction(this, func_809C1E40); } -void func_809C1E40(EnBird* this, GlobalContext* globalCtx) { +void func_809C1E40(EnBird* this, PlayState* play) { f32 fVar4 = sinf(this->unk_1B4); this->actor.shape.yOffset += fVar4 * this->unk_1A0; @@ -118,15 +118,15 @@ void func_809C1E40(EnBird* this, GlobalContext* globalCtx) { } } -void EnBird_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBird_Update(Actor* thisx, PlayState* play) { EnBird* this = (EnBird*)thisx; this->unk_1B4 += this->unk_1B8; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnBird_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBird_Draw(Actor* thisx, PlayState* play) { EnBird* this = (EnBird*)thisx; - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); } diff --git a/src/overlays/actors/ovl_En_Bird/z_en_bird.h b/src/overlays/actors/ovl_En_Bird/z_en_bird.h index bd5c232982..a8a745f2da 100644 --- a/src/overlays/actors/ovl_En_Bird/z_en_bird.h +++ b/src/overlays/actors/ovl_En_Bird/z_en_bird.h @@ -6,7 +6,7 @@ struct EnBird; -typedef void (*EnBirdActionFunc)(struct EnBird*, GlobalContext*); +typedef void (*EnBirdActionFunc)(struct EnBird*, PlayState*); typedef struct EnBird { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c index 965b78c000..f7336ed9da 100644 --- a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c +++ b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c @@ -9,15 +9,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnBlkobj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBlkobj_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBlkobj_Init(Actor* thisx, PlayState* play); +void EnBlkobj_Destroy(Actor* thisx, PlayState* play); +void EnBlkobj_Update(Actor* thisx, PlayState* play); +void EnBlkobj_Draw(Actor* thisx, PlayState* play); -void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx); -void EnBlkobj_SpawnDarkLink(EnBlkobj* this, GlobalContext* globalCtx); -void EnBlkobj_DarkLinkFight(EnBlkobj* this, GlobalContext* globalCtx); -void EnBlkobj_DoNothing(EnBlkobj* this, GlobalContext* globalCtx); +void EnBlkobj_Wait(EnBlkobj* this, PlayState* play); +void EnBlkobj_SpawnDarkLink(EnBlkobj* this, PlayState* play); +void EnBlkobj_DarkLinkFight(EnBlkobj* this, PlayState* play); +void EnBlkobj_DoNothing(EnBlkobj* this, PlayState* play); const ActorInit En_Blkobj_InitVars = { ACTOR_EN_BLKOBJ, @@ -53,32 +53,32 @@ void EnBlkobj_SetupAction(EnBlkobj* this, EnBlkobjActionFunc actionFunc) { this->timer = 0; } -void EnBlkobj_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBlkobj_Init(Actor* thisx, PlayState* play) { s32 pad; EnBlkobj* this = (EnBlkobj*)thisx; CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); - if (Flags_GetClear(globalCtx, this->dyna.actor.room)) { + if (Flags_GetClear(play, this->dyna.actor.room)) { this->alpha = 255; EnBlkobj_SetupAction(this, EnBlkobj_DoNothing); } else { CollisionHeader_GetVirtual(&gIllusionRoomCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); EnBlkobj_SetupAction(this, EnBlkobj_Wait); } } -void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBlkobj_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnBlkobj* this = (EnBlkobj*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBlkobj_Wait(EnBlkobj* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->dyna.actor.xzDistToPlayer < 120.0f) { EnBlkobj_SetupAction(this, EnBlkobj_SpawnDarkLink); @@ -86,21 +86,20 @@ void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx) { player->stateFlags2 |= PLAYER_STATE2_26; } -void EnBlkobj_SpawnDarkLink(EnBlkobj* this, GlobalContext* globalCtx) { +void EnBlkobj_SpawnDarkLink(EnBlkobj* this, PlayState* play) { if (!(this->dyna.actor.flags & ACTOR_FLAG_6)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TORCH2, this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.yawTowardsPlayer, 0, - 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TORCH2, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, + this->dyna.actor.world.pos.z, 0, this->dyna.actor.yawTowardsPlayer, 0, 0); EnBlkobj_SetupAction(this, EnBlkobj_DarkLinkFight); } } -void EnBlkobj_DarkLinkFight(EnBlkobj* this, GlobalContext* globalCtx) { +void EnBlkobj_DarkLinkFight(EnBlkobj* this, PlayState* play) { s32 alphaMod; if (this->timer == 0) { - if (Actor_Find(&globalCtx->actorCtx, ACTOR_EN_TORCH2, ACTORCAT_BOSS) == NULL) { - Flags_SetClear(globalCtx, this->dyna.actor.room); + if (Actor_Find(&play->actorCtx, ACTOR_EN_TORCH2, ACTORCAT_BOSS) == NULL) { + Flags_SetClear(play, this->dyna.actor.room); this->timer++; } } else if (this->timer++ > 100) { @@ -112,25 +111,25 @@ void EnBlkobj_DarkLinkFight(EnBlkobj* this, GlobalContext* globalCtx) { if (this->alpha > 255) { this->alpha = 255; EnBlkobj_SetupAction(this, EnBlkobj_DoNothing); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } } -void EnBlkobj_DoNothing(EnBlkobj* this, GlobalContext* globalCtx) { +void EnBlkobj_DoNothing(EnBlkobj* this, PlayState* play) { } -void EnBlkobj_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBlkobj_Update(Actor* thisx, PlayState* play) { s32 pad; EnBlkobj* this = (EnBlkobj*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnBlkobj_DrawAlpha(GlobalContext* globalCtx, Gfx* dList, s32 alpha) { +void EnBlkobj_DrawAlpha(PlayState* play, Gfx* dList, s32 alpha) { Gfx* segment; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 322); + OPEN_DISPS(play->state.gfxCtx, "../z_en_blkobj.c", 322); if (alpha == 255) { segment = sSetupOpaDL; @@ -142,33 +141,33 @@ void EnBlkobj_DrawAlpha(GlobalContext* globalCtx, Gfx* dList, s32 alpha) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, alpha); gSPDisplayList(POLY_XLU_DISP++, dList); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 330); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_blkobj.c", 330); } -void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBlkobj_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBlkobj* this = (EnBlkobj*)thisx; s32 illusionAlpha; u32 gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 349); + OPEN_DISPS(play->state.gfxCtx, "../z_en_blkobj.c", 349); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gameplayFrames = globalCtx->gameplayFrames % 128; + gameplayFrames = play->gameplayFrames % 128; gSPSegment(POLY_XLU_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames, 0, 32, 32, 1, gameplayFrames, 0, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 363), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames, 0, 32, 32, 1, gameplayFrames, 0, 32, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_blkobj.c", 363), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->alpha != 0) { - EnBlkobj_DrawAlpha(globalCtx, gIllusionRoomNormalDL, this->alpha); + EnBlkobj_DrawAlpha(play, gIllusionRoomNormalDL, this->alpha); } illusionAlpha = 255 - this->alpha; if (illusionAlpha != 0) { - EnBlkobj_DrawAlpha(globalCtx, gIllusionRoomIllusionDL, illusionAlpha); + EnBlkobj_DrawAlpha(play, gIllusionRoomIllusionDL, illusionAlpha); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 375); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_blkobj.c", 375); } diff --git a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h index ada8f21dee..4218c64664 100644 --- a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h +++ b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h @@ -6,7 +6,7 @@ struct EnBlkobj; -typedef void (*EnBlkobjActionFunc)(struct EnBlkobj*, GlobalContext*); +typedef void (*EnBlkobjActionFunc)(struct EnBlkobj*, PlayState*); typedef struct EnBlkobj { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 1cc3199cfd..3813e29498 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -10,13 +10,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnBom_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBom_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBom_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBom_Init(Actor* thisx, PlayState* play); +void EnBom_Destroy(Actor* thisx, PlayState* play); +void EnBom_Update(Actor* thisx, PlayState* play); +void EnBom_Draw(Actor* thisx, PlayState* play); -void EnBom_Move(EnBom* this, GlobalContext* globalCtx); -void EnBom_WaitForRelease(EnBom* this, GlobalContext* globalCtx); +void EnBom_Move(EnBom* this, PlayState* play); +void EnBom_WaitForRelease(EnBom* this, PlayState* play); const ActorInit En_Bom_InitVars = { ACTOR_EN_BOM, @@ -87,7 +87,7 @@ void EnBom_SetupAction(EnBom* this, EnBomActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBom_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBom_Init(Actor* thisx, PlayState* play) { EnBom* this = (EnBom*)thisx; Actor_ProcessInitChain(thisx, sInitChain); @@ -97,10 +97,10 @@ void EnBom_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->colChkInfo.cylHeight = 10; this->timer = 70; this->flashSpeedScale = 7; - Collider_InitCylinder(globalCtx, &this->bombCollider); - Collider_InitJntSph(globalCtx, &this->explosionCollider); - Collider_SetCylinder(globalCtx, &this->bombCollider, thisx, &sCylinderInit); - Collider_SetJntSph(globalCtx, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); + Collider_InitCylinder(play, &this->bombCollider); + Collider_InitJntSph(play, &this->explosionCollider); + Collider_SetCylinder(play, &this->bombCollider, thisx, &sCylinderInit); + Collider_SetJntSph(play, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); this->explosionColliderItems[0].info.toucher.damage += (thisx->shape.rot.z & 0xFF00) >> 8; thisx->shape.rot.z &= 0xFF; @@ -111,16 +111,16 @@ void EnBom_Init(Actor* thisx, GlobalContext* globalCtx) { EnBom_SetupAction(this, EnBom_Move); } -void EnBom_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBom_Destroy(Actor* thisx, PlayState* play) { EnBom* this = (EnBom*)thisx; - Collider_DestroyJntSph(globalCtx, &this->explosionCollider); - Collider_DestroyCylinder(globalCtx, &this->bombCollider); + Collider_DestroyJntSph(play, &this->explosionCollider); + Collider_DestroyCylinder(play, &this->bombCollider); } -void EnBom_Move(EnBom* this, GlobalContext* globalCtx) { +void EnBom_Move(EnBom* this, PlayState* play) { // if bomb has a parent actor, the bomb hasnt been released yet - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { EnBom_SetupAction(this, EnBom_WaitForRelease); this->actor.room = -1; return; @@ -146,26 +146,26 @@ void EnBom_Move(EnBom* this, GlobalContext* globalCtx) { } else { Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && (this->actor.velocity.y < -3.0f)) { - func_8002F850(globalCtx, &this->actor); + func_8002F850(play, &this->actor); this->actor.velocity.y *= -0.3f; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; } else if (this->timer >= 4) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } } Actor_MoveForward(&this->actor); } -void EnBom_WaitForRelease(EnBom* this, GlobalContext* globalCtx) { +void EnBom_WaitForRelease(EnBom* this, PlayState* play) { // if parent is NULL bomb has been released - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { EnBom_SetupAction(this, EnBom_Move); - EnBom_Move(this, globalCtx); + EnBom_Move(this, play); } } -void EnBom_Explode(EnBom* this, GlobalContext* globalCtx) { +void EnBom_Explode(EnBom* this, PlayState* play) { Player* player; if (this->explosionCollider.elements[0].dim.modelSphere.radius == 0) { @@ -176,35 +176,35 @@ void EnBom_Explode(EnBom* this, GlobalContext* globalCtx) { this->explosionCollider.elements[0].dim.worldSphere.radius += this->actor.shape.rot.z + 8; if (this->actor.params == BOMB_EXPLOSION) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->explosionCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->explosionCollider.base); } - if (globalCtx->envCtx.adjLight1Color[0] != 0) { - globalCtx->envCtx.adjLight1Color[0] -= 25; + if (play->envCtx.adjLight1Color[0] != 0) { + play->envCtx.adjLight1Color[0] -= 25; } - if (globalCtx->envCtx.adjLight1Color[1] != 0) { - globalCtx->envCtx.adjLight1Color[1] -= 25; + if (play->envCtx.adjLight1Color[1] != 0) { + play->envCtx.adjLight1Color[1] -= 25; } - if (globalCtx->envCtx.adjLight1Color[2] != 0) { - globalCtx->envCtx.adjLight1Color[2] -= 25; + if (play->envCtx.adjLight1Color[2] != 0) { + play->envCtx.adjLight1Color[2] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[0] != 0) { - globalCtx->envCtx.adjAmbientColor[0] -= 25; + if (play->envCtx.adjAmbientColor[0] != 0) { + play->envCtx.adjAmbientColor[0] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[1] != 0) { - globalCtx->envCtx.adjAmbientColor[1] -= 25; + if (play->envCtx.adjAmbientColor[1] != 0) { + play->envCtx.adjAmbientColor[1] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[2] != 0) { - globalCtx->envCtx.adjAmbientColor[2] -= 25; + if (play->envCtx.adjAmbientColor[2] != 0) { + play->envCtx.adjAmbientColor[2] -= 25; } if (this->timer == 0) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if ((player->stateFlags1 & PLAYER_STATE1_11) && (player->heldActor == &this->actor)) { player->actor.child = NULL; @@ -217,7 +217,7 @@ void EnBom_Explode(EnBom* this, GlobalContext* globalCtx) { } } -void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnBom_Update(Actor* thisx, PlayState* play2) { Vec3f effVelocity = { 0.0f, 0.0f, 0.0f }; Vec3f bomb2Accel = { 0.0f, 0.1f, 0.0f }; Vec3f effAccel = { 0.0f, 0.0f, 0.0f }; @@ -225,7 +225,7 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { Vec3f dustAccel = { 0.0f, 0.6f, 0.0f }; Color_RGBA8 dustColor = { 255, 255, 255, 255 }; s32 pad; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnBom* this = (EnBom*)thisx; thisx->gravity = -1.2f; @@ -243,9 +243,9 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { this->bumpOn = true; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 5.0f, 10.0f, 15.0f, + Actor_UpdateBgCheckInfo(play, thisx, 5.0f, 10.0f, 15.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); @@ -256,14 +256,14 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { // spawn spark effect on even frames effPos = thisx->world.pos; effPos.y += 17.0f; - if ((globalCtx->gameplayFrames % 2) == 0) { - EffectSsGSpk_SpawnFuse(globalCtx, thisx, &effPos, &effVelocity, &effAccel); + if ((play->gameplayFrames % 2) == 0) { + EffectSsGSpk_SpawnFuse(play, thisx, &effPos, &effVelocity, &effAccel); } Audio_PlayActorSound2(thisx, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); effPos.y += 3.0f; - func_8002829C(globalCtx, &effPos, &effVelocity, &dustAccel, &dustColor, &dustColor, 50, 5); + func_8002829C(play, &effPos, &effVelocity, &dustAccel, &dustColor, &dustColor, 50, 5); } if ((this->bombCollider.base.acFlags & AC_HIT) || ((this->bombCollider.base.ocFlags1 & OC1_HIT) && @@ -273,7 +273,7 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { // if a lit stick touches the bomb, set timer to 100 // these bombs never have a timer over 70, so this isnt used - if ((this->timer > 100) && Player_IsBurningStickInRange(globalCtx, &thisx->world.pos, 30.0f, 50.0f)) { + if ((this->timer > 100) && Player_IsBurningStickInRange(play, &thisx->world.pos, 30.0f, 50.0f)) { this->timer = 100; } } @@ -302,27 +302,24 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { effPos = thisx->world.pos; effPos.y += 10.0f; - if (Actor_HasParent(thisx, globalCtx)) { + if (Actor_HasParent(thisx, play)) { effPos.y += 30.0f; } - EffectSsBomb2_SpawnLayered(globalCtx, &effPos, &effVelocity, &bomb2Accel, 100, - (thisx->shape.rot.z * 6) + 19); + EffectSsBomb2_SpawnLayered(play, &effPos, &effVelocity, &bomb2Accel, 100, (thisx->shape.rot.z * 6) + 19); effPos.y = thisx->floorHeight; if (thisx->floorHeight > BGCHECK_Y_MIN) { - EffectSsBlast_SpawnWhiteShockwave(globalCtx, &effPos, &effVelocity, &effAccel); + EffectSsBlast_SpawnWhiteShockwave(play, &effPos, &effVelocity, &effAccel); } Audio_PlayActorSound2(thisx, NA_SE_IT_BOMB_EXPLOSION); - globalCtx->envCtx.adjLight1Color[0] = globalCtx->envCtx.adjLight1Color[1] = - globalCtx->envCtx.adjLight1Color[2] = 250; + play->envCtx.adjLight1Color[0] = play->envCtx.adjLight1Color[1] = play->envCtx.adjLight1Color[2] = 250; - globalCtx->envCtx.adjAmbientColor[0] = globalCtx->envCtx.adjAmbientColor[1] = - globalCtx->envCtx.adjAmbientColor[2] = 250; + play->envCtx.adjAmbientColor[0] = play->envCtx.adjAmbientColor[1] = play->envCtx.adjAmbientColor[2] = 250; - Camera_AddQuake(&globalCtx->mainCamera, 2, 0xB, 8); + Camera_AddQuake(&play->mainCamera, 2, 0xB, 8); thisx->params = BOMB_EXPLOSION; this->timer = 10; thisx->flags |= ACTOR_FLAG_5; @@ -336,16 +333,16 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { Collider_UpdateCylinder(thisx, &this->bombCollider); // if link is not holding the bomb anymore and bump conditions are met, subscribe to OC - if (!Actor_HasParent(thisx, globalCtx) && this->bumpOn) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base); + if (!Actor_HasParent(thisx, play) && this->bumpOn) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bombCollider.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bombCollider.base); } if ((thisx->scale.x >= 0.01f) && (thisx->params != BOMB_EXPLOSION)) { if (thisx->yDistToWater >= 20.0f) { - EffectSsDeadSound_SpawnStationary(globalCtx, &thisx->projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, true, + EffectSsDeadSound_SpawnStationary(play, &thisx->projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, true, DEADSOUND_REPEAT_MODE_OFF, 10); Actor_Kill(thisx); return; @@ -357,24 +354,24 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBom_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBom* this = (EnBom*)thisx; if (1) {} - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bom.c", 913); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bom.c", 913); if (thisx->params == BOMB_BODY) { - func_80093D18(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - func_8002EBCC(thisx, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); + func_8002EBCC(thisx, play, 0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bom.c", 928), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_bom.c", 928), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBombCapDL); Matrix_RotateZYX(0x4000, 0, 0, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bom.c", 934), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_bom.c", 934), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, (s16)this->flashIntensity, 0, 40, 255); @@ -383,5 +380,5 @@ void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateSpheres(0, &this->explosionCollider); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bom.c", 951); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bom.c", 951); } diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.h b/src/overlays/actors/ovl_En_Bom/z_en_bom.h index f6d6f88559..7399d6edd3 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.h +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.h @@ -6,7 +6,7 @@ struct EnBom; -typedef void (*EnBomActionFunc)(struct EnBom*, struct GlobalContext*); +typedef void (*EnBomActionFunc)(struct EnBom*, struct PlayState*); typedef struct EnBom { /* 0x0000 */ Actor actor; 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 895e115419..001c00e650 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 @@ -13,26 +13,26 @@ typedef enum { /* 3 */ CHU_GIRL_EYES_AWAKE } BombchuGirlEyeMode; -void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBomBowlMan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBomBowlMan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBomBowlMan_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBomBowlMan_Init(Actor* thisx, PlayState* play); +void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play); +void EnBomBowlMan_Update(Actor* thisx, PlayState* play); +void EnBomBowlMan_Draw(Actor* thisx, PlayState* play); -void EnBomBowMan_SetupWaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_WaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_TalkAsleep(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_WakeUp(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_CheckBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_WaitNotBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_TalkNotBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_SetupRunGame(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, GlobalContext* globalCtx); -void func_809C41FC(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_SetupChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx); -void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, GlobalContext* globalCtx); +void EnBomBowMan_SetupWaitAsleep(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_WaitAsleep(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_TalkAsleep(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_WakeUp(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_CheckBeatenDC(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_WaitNotBeatenDC(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_TalkNotBeatenDC(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_SetupRunGame(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_RunGame(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, PlayState* play); +void func_809C41FC(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_SetupChooseShowPrize(EnBomBowlMan* this, PlayState* play); +void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, PlayState* play); const ActorInit En_Bom_Bowl_Man_InitVars = { ACTOR_EN_BOM_BOWL_MAN, @@ -46,29 +46,29 @@ const ActorInit En_Bom_Bowl_Man_InitVars = { (ActorFunc)EnBomBowlMan_Draw, }; -void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx2) { +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; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gChuGirlSkel, &gChuGirlNoddingOffAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gChuGirlSkel, &gChuGirlNoddingOffAnim, this->jointTable, this->morphTable, 11); // "☆ Man, my shoulders hurt~ ☆" osSyncPrintf(VT_FGCOL(GREEN) "☆ もー 肩こっちゃうよねぇ〜 \t\t ☆ \n" VT_RST); // "☆ Isn't there some sort of job that will pay better and be more relaxing? ☆ %d" osSyncPrintf(VT_FGCOL(GREEN) "☆ もっとラクしてもうかるバイトないかしら? ☆ %d\n" VT_RST, - globalCtx->bombchuBowlingStatus); + play->bombchuBowlingStatus); this->posCopy = 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(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SYATEKI_NIW, cuccoSpawnPos[i].x, + cucco = (EnSyatekiNiw*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SYATEKI_NIW, cuccoSpawnPos[i].x, cuccoSpawnPos[i].y, cuccoSpawnPos[i].z, 0, 0, 0, 1); if (cucco != NULL) { @@ -83,10 +83,10 @@ void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc = EnBomBowMan_SetupWaitAsleep; } -void EnBomBowlMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play) { } -void EnBomBowMan_SetupWaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_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); this->actor.textId = 0xC0; @@ -94,39 +94,39 @@ void EnBomBowMan_SetupWaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx) { this->actionFunc = EnBomBowMan_WaitAsleep; } -void EnBomBowMan_WaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_WaitAsleep(EnBomBowlMan* this, PlayState* play) { s16 yawDiff; SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnBomBowMan_TalkAsleep; } else { yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if (!(this->actor.xzDistToPlayer > 120.0f) && (yawDiff < 0x4300)) { - func_8002F2CC(&this->actor, globalCtx, 120.0f); + func_8002F2CC(&this->actor, play, 120.0f); } } } -void EnBomBowMan_TalkAsleep(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_TalkAsleep(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = EnBomBowMan_WakeUp; } } -void EnBomBowMan_WakeUp(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_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 = EnBomBowMan_BlinkAwake; } -void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, PlayState* play) { f32 frameCount = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -140,7 +140,7 @@ void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, GlobalContext* globalCtx) { this->actor.textId = 0x7058; } } - Message_ContinueTextbox(globalCtx, this->actor.textId); + 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 @@ -152,11 +152,11 @@ void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, GlobalContext* globalCtx) { } } -void EnBomBowMan_CheckBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_CheckBeatenDC(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == this->dialogState) && 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); @@ -169,32 +169,32 @@ void EnBomBowMan_CheckBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x18; this->dialogState = TEXT_STATE_CHOICE; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = EnBomBowlMan_HandlePlayChoice; } } } -void EnBomBowMan_WaitNotBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_WaitNotBeatenDC(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnBomBowMan_TalkNotBeatenDC; } else { - func_8002F2CC(&this->actor, globalCtx, 120.0f); + func_8002F2CC(&this->actor, play, 120.0f); } } -void EnBomBowMan_TalkNotBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_TalkNotBeatenDC(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = EnBomBowMan_WaitNotBeatenDC; } } -void EnBomBowMan_SetupRunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_SetupRunGame(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->minigamePlayStatus == 0) { @@ -213,13 +213,13 @@ void EnBomBowMan_SetupRunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { this->actionFunc = EnBomBowMan_RunGame; } -void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_RunGame(EnBomBowlMan* this, PlayState* play) { s16 yawDiff; SkelAnime_Update(&this->skelAnime); if (BREG(3)) { - osSyncPrintf(VT_FGCOL(RED) "☆ game_play->bomchu_game_flag ☆ %d\n" VT_RST, globalCtx->bombchuBowlingStatus); + osSyncPrintf(VT_FGCOL(RED) "☆ game_play->bomchu_game_flag ☆ %d\n" VT_RST, play->bombchuBowlingStatus); // "HOW'S THE FIRST WALL DOING?" osSyncPrintf(VT_FGCOL(RED) "☆ 壁1の状態どう? ☆ %d\n" VT_RST, this->wallStatus[0]); // "HOW'S THE SECOND WALL DOING?" @@ -239,9 +239,8 @@ void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 中央HIT!!!! ☆☆☆☆☆ \n" VT_RST); } - if ((globalCtx->bombchuBowlingStatus == -1) && - (globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length == 0) && (this->bowlPit->status == 0) && - (this->wallStatus[0] != 1) && (this->wallStatus[1] != 1)) { + 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 // "Bombchu lost" osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ ボムチュウ消化 ☆☆☆☆☆ \n" VT_RST); @@ -258,16 +257,16 @@ void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { this->exItem = NULL; } - globalCtx->bombchuBowlingStatus = 0; + play->bombchuBowlingStatus = 0; this->playingAgain = true; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); if (this->gameResult == 2) { - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); } this->actionFunc = EnBomBowlMan_HandlePlayChoice; } else { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->minigamePlayStatus == 0) { this->actionFunc = EnBomBowlMan_HandlePlayChoice; } else { @@ -277,44 +276,44 @@ void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if (!(this->actor.xzDistToPlayer > 120.0f) && (yawDiff < 0x4300)) { - func_8002F2CC(&this->actor, globalCtx, 120.0f); + func_8002F2CC(&this->actor, play, 120.0f); } } } } -void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: // Yes if (gSaveContext.rupees >= 30) { Rupees_ChangeBy(-30); this->minigamePlayStatus = 1; this->wallStatus[0] = this->wallStatus[1] = 0; - globalCtx->bombchuBowlingStatus = 10; - Flags_SetSwitch(globalCtx, 0x38); + play->bombchuBowlingStatus = 10; + Flags_SetSwitch(play, 0x38); if (!this->startedPlaying && !this->playingAgain) { this->actor.textId = 0x19; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; } else { this->actor.textId = 0x1B; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; - OnePointCutscene_Init(globalCtx, 8010, -99, NULL, CAM_ID_MAIN); - func_8002DF54(globalCtx, NULL, 8); + OnePointCutscene_Init(play, 8010, -99, NULL, CAM_ID_MAIN); + func_8002DF54(play, NULL, 8); this->actionFunc = EnBomBowMan_SetupChooseShowPrize; } } else { this->playingAgain = false; this->actor.textId = 0x85; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; } @@ -323,50 +322,50 @@ void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, GlobalContext* globalCtx) case 1: // No this->playingAgain = false; this->actor.textId = 0x2D; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; } } } -void func_809C41FC(EnBomBowlMan* this, GlobalContext* globalCtx) { +void func_809C41FC(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - if (((this->actor.textId == 0x2D) || (this->actor.textId == 0x85)) && Flags_GetSwitch(globalCtx, 0x38)) { - Flags_UnsetSwitch(globalCtx, 0x38); + if (((this->actor.textId == 0x2D) || (this->actor.textId == 0x85)) && Flags_GetSwitch(play, 0x38)) { + Flags_UnsetSwitch(play, 0x38); } if (this->minigamePlayStatus == 1) { this->actor.textId = 0x1B; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; - OnePointCutscene_Init(globalCtx, 8010, -99, NULL, CAM_ID_MAIN); - func_8002DF54(globalCtx, NULL, 8); + OnePointCutscene_Init(play, 8010, -99, NULL, CAM_ID_MAIN); + func_8002DF54(play, NULL, 8); this->actionFunc = EnBomBowMan_SetupChooseShowPrize; } else { if (this->gameResult == 2) { - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); } this->actionFunc = EnBomBowMan_SetupRunGame; } } } -void EnBomBowMan_SetupChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_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(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { pos.x = 148.0f; pos.y = 40.0f; pos.z = 300.0f; - EffectSsBomb2_SpawnLayered(globalCtx, &pos, &velocity, &accel, 50, 15); + EffectSsBomb2_SpawnLayered(play, &pos, &velocity, &accel, 50, 15); Audio_PlayActorSound2(&this->actor, NA_SE_IT_GOODS_APPEAR); this->prizeRevealTimer = 10; this->actionFunc = EnBomBowMan_ChooseShowPrize; @@ -379,7 +378,7 @@ static Vec3f sPrizePosOffset[] = { static s16 sPrizeRot[] = { 0x4268, 0x4268, -0x03E8, 0x0000, 0x4268, 0x0000 }; -void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, PlayState* play) { s16 prizeTemp; s32 pad; @@ -416,14 +415,13 @@ void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { this->prizeIndex = BREG(7) - 1; } - this->exItem = (EnExItem*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, 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_COUNTER); + 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_COUNTER); if (!this->startedPlaying) { - this->bowlPit = (EnBomBowlPit*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, + 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; @@ -435,7 +433,7 @@ void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { this->bowlPit->start = 1; this->minigamePlayStatus = 2; this->actor.textId = 0x405A; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; // Cycle through prizes in order @@ -447,12 +445,12 @@ void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { } } -void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, GlobalContext* globalCtx) { +void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == this->dialogState) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + func_8005B1A4(GET_ACTIVE_CAM(play)); this->startedPlaying = true; if (BREG(2)) { @@ -460,13 +458,13 @@ void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, GlobalContext* globalCtx) { } // "Wow" - osSyncPrintf(VT_FGCOL(YELLOW) "☆ わー ☆ %d\n" VT_RST, globalCtx->bombchuBowlingStatus); - func_8002DF54(globalCtx, NULL, 7); + osSyncPrintf(VT_FGCOL(YELLOW) "☆ わー ☆ %d\n" VT_RST, play->bombchuBowlingStatus); + func_8002DF54(play, NULL, 7); this->actionFunc = EnBomBowMan_SetupRunGame; } } -void EnBomBowlMan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlMan_Update(Actor* thisx, PlayState* play) { EnBomBowlMan* this = (EnBomBowlMan*)thisx; this->timer++; @@ -499,18 +497,17 @@ void EnBomBowlMan_Update(Actor* thisx, GlobalContext* globalCtx) { } } - func_80038290(globalCtx, &this->actor, &this->unk_218, &this->unk_224, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_218, &this->unk_224, this->actor.focus.pos); break; } DECR(this->prizeRevealTimer); DECR(this->blinkTimer); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnBomBowlMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnBomBowlMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnBomBowlMan* this = (EnBomBowlMan*)thisx; if (limbIndex == 4) { // head @@ -521,16 +518,16 @@ s32 EnBomBowlMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnBomBowlMan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlMan_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gChuGirlEyeOpenTex, gChuGirlEyeHalfTex, gChuGirlEyeClosedTex }; EnBomBowlMan* this = (EnBomBowlMan*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bom_bowl_man.c", 907); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bom_bowl_man.c", 907); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTextureIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBomBowlMan_OverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bom_bowl_man.c", 923); + 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 83b6217cde..fada65b556 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 @@ -8,7 +8,7 @@ struct EnBomBowlMan; -typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, GlobalContext*); +typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, PlayState*); typedef struct EnBomBowlMan { /* 0x0000 */ Actor actor; 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 3a4c33efa3..33ebe5a66b 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 @@ -5,18 +5,18 @@ #define FLAGS ACTOR_FLAG_4 -void EnBomBowlPit_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBomBowlPit_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBomBowlPit_Update(Actor* thisx, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); -void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_SpawnPrize(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_GivePrize(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_WaitTillPrizeGiven(EnBomBowlPit* this, GlobalContext* globalCtx); -void EnBomBowlPit_Reset(EnBomBowlPit* this, GlobalContext* globalCtx); +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 }; @@ -32,28 +32,28 @@ const ActorInit En_Bom_Bowl_Pit_InitVars = { NULL, }; -void EnBomBowlPit_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlPit_Init(Actor* thisx, PlayState* play) { EnBomBowlPit* this = (EnBomBowlPit*)thisx; this->actionFunc = EnBomBowlPit_SetupDetectHit; } -void EnBomBowlPit_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlPit_Destroy(Actor* thisx, PlayState* play) { } -void EnBomBowlPit_SetupDetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { +void EnBomBowlPit_SetupDetectHit(EnBomBowlPit* this, PlayState* play) { if (this->start != 0) { this->start = this->status = 0; this->actionFunc = EnBomBowlPit_DetectHit; } } -void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { +void EnBomBowlPit_DetectHit(EnBomBowlPit* this, PlayState* play) { EnBomChu* chu; Vec3f chuPosDiff; - if (globalCtx->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING) { - chu = (EnBomChu*)globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + 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)) { @@ -67,23 +67,23 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { if (((fabsf(chuPosDiff.x) < 40.0f) || (BREG(2))) && ((fabsf(chuPosDiff.y) < 40.0f) || (BREG(2))) && ((fabsf(chuPosDiff.z) < 40.0f) || (BREG(2)))) { - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); chu->timer = 1; - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + 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 = globalCtx->view.at.x; - this->subCamAt.y = this->viewAt.y = globalCtx->view.at.y; - this->subCamAt.z = this->viewAt.z = globalCtx->view.at.z; + 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 = globalCtx->view.eye.x; - this->subCamEye.y = this->viewEye.y = globalCtx->view.eye.y; - this->subCamEye.z = this->viewEye.z = globalCtx->view.eye.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; @@ -101,12 +101,12 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { 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_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); this->actor.textId = 0xF; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_154 = TEXT_STATE_EVENT; func_80078884(NA_SE_EV_HIT_SOUND); - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->status = 1; this->actionFunc = EnBomBowlPit_CameraDollyIn; break; @@ -117,7 +117,7 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { } } -void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, GlobalContext* globalCtx) { +void EnBomBowlPit_CameraDollyIn(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); @@ -127,10 +127,10 @@ void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, this->subCamEyeMaxVelFrac.z, this->subCamEyeVel.z); } - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); - if ((this->unk_154 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((this->unk_154 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); } if ((fabsf(this->subCamEye.x - this->subCamEyeNext.x) < 5.0f) && @@ -139,15 +139,15 @@ void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, GlobalContext* globalCtx) { (fabsf(this->subCamAt.x - this->subCamAtNext.x) < 5.0f) && (fabsf(this->subCamAt.y - this->subCamAtNext.y) < 5.0f) && (fabsf(this->subCamAt.z - this->subCamAtNext.z) < 5.0f)) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->timer = 30; this->actionFunc = EnBomBowlPit_SpawnPrize; } } -void EnBomBowlPit_SpawnPrize(EnBomBowlPit* this, GlobalContext* globalCtx) { +void EnBomBowlPit_SpawnPrize(EnBomBowlPit* this, PlayState* play) { if (this->timer == 0) { - this->exItem = (EnExItem*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_ITEM, + 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) { @@ -156,7 +156,7 @@ void EnBomBowlPit_SpawnPrize(EnBomBowlPit* this, GlobalContext* globalCtx) { } } -void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) { +void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, PlayState* play) { if (this->exItemDone != 0) { switch (this->prizeIndex) { case EXITEM_BOMB_BAG_BOWLING: @@ -167,17 +167,17 @@ void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) { break; } - Play_ClearCamera(globalCtx, this->subCamId); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, NULL, 8); + Play_ClearCamera(play, this->subCamId); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); + func_8002DF54(play, NULL, 8); this->actionFunc = EnBomBowlPit_GivePrize; } } -void EnBomBowlPit_GivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBomBowlPit_GivePrize(EnBomBowlPit* this, PlayState* play) { + Player* player = GET_PLAYER(play); - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->getItemId = sGetItemIds[this->prizeIndex]; if ((this->getItemId == GI_BOMB_BAG_30) && (CUR_CAPACITY(UPG_BOMB_BAG) == 30)) { @@ -186,21 +186,21 @@ void EnBomBowlPit_GivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) { player->stateFlags1 &= ~PLAYER_STATE1_29; this->actor.parent = NULL; - func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); player->stateFlags1 |= PLAYER_STATE1_29; this->actionFunc = EnBomBowlPit_WaitTillPrizeGiven; } -void EnBomBowlPit_WaitTillPrizeGiven(EnBomBowlPit* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnBomBowlPit_WaitTillPrizeGiven(EnBomBowlPit* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = EnBomBowlPit_Reset; } else { - func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); } } -void EnBomBowlPit_Reset(EnBomBowlPit* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnBomBowlPit_Reset(EnBomBowlPit* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // "Normal termination"/"completion" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); if (this->getItemId == GI_HEART_PIECE) { @@ -214,10 +214,10 @@ void EnBomBowlPit_Reset(EnBomBowlPit* this, GlobalContext* globalCtx) { } } -void EnBomBowlPit_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlPit_Update(Actor* thisx, PlayState* play) { EnBomBowlPit* this = (EnBomBowlPit*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); 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 873c57a8aa..a4e838ff49 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 @@ -7,7 +7,7 @@ struct EnBomBowlPit; -typedef void (*EnBomBowlPitActionFunc)(struct EnBomBowlPit*, GlobalContext*); +typedef void (*EnBomBowlPitActionFunc)(struct EnBomBowlPit*, PlayState*); typedef struct EnBomBowlPit { /* 0x0000 */ Actor actor; 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 24e42290f5..dd2f053dd1 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 @@ -6,14 +6,14 @@ #define BOMBCHU_SCALE 0.01f -void EnBomChu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBomChu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBomChu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBomChu_Init(Actor* thisx, PlayState* play); +void EnBomChu_Destroy(Actor* thisx, PlayState* play); +void EnBomChu_Update(Actor* thisx, PlayState* play); +void EnBomChu_Draw(Actor* thisx, PlayState* play); -void EnBomChu_WaitForRelease(EnBomChu* this, GlobalContext* globalCtx); -void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx); -void EnBomChu_WaitForKill(EnBomChu* this, GlobalContext* globalCtx); +void EnBomChu_WaitForRelease(EnBomChu* this, PlayState* play); +void EnBomChu_Move(EnBomChu* this, PlayState* play); +void EnBomChu_WaitForKill(EnBomChu* this, PlayState* play); const ActorInit En_Bom_Chu_InitVars = { ACTOR_EN_BOM_CHU, @@ -59,7 +59,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000 * BOMBCHU_SCALE, ICHAIN_STOP), }; -void EnBomChu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBomChu_Init(Actor* thisx, PlayState* play) { static u8 p1StartColor[] = { 250, 0, 0, 250 }; static u8 p2StartColor[] = { 200, 0, 0, 130 }; static u8 p1EndColor[] = { 150, 0, 0, 100 }; @@ -69,8 +69,8 @@ void EnBomChu_Init(Actor* thisx, GlobalContext* globalCtx) { s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements[0].dim.worldSphere.radius = this->collider.elements[0].dim.modelSphere.radius; @@ -85,28 +85,28 @@ void EnBomChu_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 0; - Effect_Add(globalCtx, &this->blure1Index, EFFECT_BLURE1, 0, 0, &blureInit); - Effect_Add(globalCtx, &this->blure2Index, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blure1Index, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blure2Index, EFFECT_BLURE1, 0, 0, &blureInit); this->actor.room = -1; this->timer = 120; this->actionFunc = EnBomChu_WaitForRelease; } -void EnBomChu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBomChu_Destroy(Actor* thisx, PlayState* play) { EnBomChu* this = (EnBomChu*)thisx; - Effect_Delete(globalCtx, this->blure1Index); - Effect_Delete(globalCtx, this->blure2Index); - Collider_DestroyJntSph(globalCtx, &this->collider); + Effect_Delete(play, this->blure1Index); + Effect_Delete(play, this->blure2Index); + Collider_DestroyJntSph(play, &this->collider); } -void EnBomChu_Explode(EnBomChu* this, GlobalContext* globalCtx) { +void EnBomChu_Explode(EnBomChu* this, PlayState* play) { EnBom* bomb; s32 i; - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOMB_BODY); + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, BOMB_BODY); if (bomb != NULL) { bomb->timer = 0; } @@ -116,7 +116,7 @@ void EnBomChu_Explode(EnBomChu* this, GlobalContext* globalCtx) { if (this->actor.yDistToWater > 0.0f) { for (i = 0; i < 40; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 1.0f, 5.0f, 30.0f, 0.25f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 1.0f, 5.0f, 30.0f, 0.25f); } } @@ -129,7 +129,7 @@ void EnBomChu_CrossProduct(Vec3f* a, Vec3f* b, Vec3f* dest) { dest->z = (a->x * b->y) - (a->y * b->x); } -void EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalContext* globalCtx) { +void EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, PlayState* play) { Vec3f normal; Vec3f vec; f32 angle; @@ -161,7 +161,7 @@ void EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalCo magnitude = Math3D_Vec3fMagnitude(&this->axisForwards); if (magnitude < 0.001f) { - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); return; } @@ -198,21 +198,21 @@ void EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalCo } } -void EnBomChu_WaitForRelease(EnBomChu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBomChu_WaitForRelease(EnBomChu* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->timer != 0) { this->timer--; } if (this->timer == 0) { - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); return; } - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { this->actor.world.pos = player->actor.world.pos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); this->actor.shape.rot.y = player->actor.shape.rot.y; // rot.y = 0 -> +z (forwards in model space) @@ -233,14 +233,14 @@ void EnBomChu_WaitForRelease(EnBomChu* this, GlobalContext* globalCtx) { this->actor.speedXZ = 8.0f; //! @bug there is no NULL check on the floor poly. If the player is out of bounds the floor poly will be NULL //! and will cause a crash inside this function. - EnBomChu_UpdateFloorPoly(this, this->actor.floorPoly, globalCtx); + EnBomChu_UpdateFloorPoly(this, this->actor.floorPoly, play); this->actor.flags |= ACTOR_FLAG_0; // make chu targetable - func_8002F850(globalCtx, &this->actor); + func_8002F850(play, &this->actor); this->actionFunc = EnBomChu_Move; } } -void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { +void EnBomChu_Move(EnBomChu* this, PlayState* play) { CollisionPoly* polySide; CollisionPoly* polyUpDown; s32 bgIdSide; @@ -261,7 +261,7 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { if ((this->timer == 0) || (this->collider.base.acFlags & AC_HIT) || ((this->collider.base.ocFlags1 & OC1_HIT) && (this->collider.base.oc->category != ACTORCAT_PLAYER))) { - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); return; } @@ -273,26 +273,26 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { posB.y = this->actor.world.pos.y - (this->axisUp.y * 4.0f); posB.z = this->actor.world.pos.z - (this->axisUp.z * 4.0f); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &posUpDown, &polyUpDown, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posUpDown, &polyUpDown, true, true, true, true, &bgIdUpDown) && - !(func_80041DB8(&globalCtx->colCtx, polyUpDown, bgIdUpDown) & 0x30) && // && not crawl space? - !SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, polyUpDown, bgIdUpDown)) { + !(func_80041DB8(&play->colCtx, polyUpDown, bgIdUpDown) & 0x30) && // && not crawl space? + !SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polyUpDown, bgIdUpDown)) { // forwards posB.x = (this->axisForwards.x * lineLength) + posA.x; posB.y = (this->axisForwards.y * lineLength) + posA.y; posB.z = (this->axisForwards.z * lineLength) + posA.z; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true, &bgIdSide) && - !(func_80041DB8(&globalCtx->colCtx, polySide, bgIdSide) & 0x30) && - !SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, polySide, bgIdSide)) { - EnBomChu_UpdateFloorPoly(this, polySide, globalCtx); + !(func_80041DB8(&play->colCtx, polySide, bgIdSide) & 0x30) && + !SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polySide, bgIdSide)) { + EnBomChu_UpdateFloorPoly(this, polySide, play); this->actor.world.pos = posSide; this->actor.floorBgId = bgIdSide; this->actor.speedXZ = 0.0f; } else { if (this->actor.floorPoly != polyUpDown) { - EnBomChu_UpdateFloorPoly(this, polyUpDown, globalCtx); + EnBomChu_UpdateFloorPoly(this, polyUpDown, play); } this->actor.world.pos = posUpDown; @@ -321,11 +321,11 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { posB.z = posA.z - (this->axisLeft.z * lineLength); } - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true, &bgIdSide) && - !(func_80041DB8(&globalCtx->colCtx, polySide, bgIdSide) & 0x30) && - !SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, polySide, bgIdSide)) { - EnBomChu_UpdateFloorPoly(this, polySide, globalCtx); + !(func_80041DB8(&play->colCtx, polySide, bgIdSide) & 0x30) && + !SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polySide, bgIdSide)) { + EnBomChu_UpdateFloorPoly(this, polySide, play); this->actor.world.pos = posSide; this->actor.floorBgId = bgIdSide; break; @@ -334,7 +334,7 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { if (i == 3) { // no collision nearby - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); } } @@ -345,7 +345,7 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { func_8002F8F0(&this->actor, NA_SE_IT_BOMBCHU_MOVE - SFX_FLAG); } -void EnBomChu_WaitForKill(EnBomChu* this, GlobalContext* globalCtx) { +void EnBomChu_WaitForKill(EnBomChu* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -370,23 +370,23 @@ void EnBomChu_ModelToWorld(EnBomChu* this, Vec3f* modelPos, Vec3f* dest) { (this->axisForwards.z * modelPos->z); } -void EnBomChu_SpawnRipples(EnBomChu* this, GlobalContext* globalCtx, f32 y) { +void EnBomChu_SpawnRipples(EnBomChu* this, PlayState* play, f32 y) { Vec3f pos; pos.x = this->actor.world.pos.x; pos.y = y; pos.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &pos, 70, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &pos, 70, 500, 4); - EffectSsGRipple_Spawn(globalCtx, &pos, 70, 500, 8); + EffectSsGRipple_Spawn(play, &pos, 70, 500, 0); + EffectSsGRipple_Spawn(play, &pos, 70, 500, 4); + EffectSsGRipple_Spawn(play, &pos, 70, 500, 8); } -void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnBomChu_Update(Actor* thisx, PlayState* play2) { static Vec3f blureP1Model = { 0.0f, 7.0f, -6.0f }; static Vec3f blureP2LeftModel = { 12.0f, 0.0f, -5.0f }; static Vec3f blureP2RightModel = { -12.0f, 0.0f, -5.0f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnBomChu* this = (EnBomChu*)thisx; s16 yaw; f32 sin; @@ -399,7 +399,7 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->actor.floorBgId != BGCHECK_SCENE) { yaw = this->actor.shape.rot.y; - func_800433A4(&globalCtx->colCtx, this->actor.floorBgId, &this->actor); + func_800433A4(&play->colCtx, this->actor.floorBgId, &this->actor); if (yaw != this->actor.shape.rot.y) { yaw = this->actor.shape.rot.y - yaw; @@ -421,17 +421,17 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_8002D97C(&this->actor); 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; this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actionFunc != EnBomChu_WaitForRelease) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, 0.0f); @@ -450,21 +450,21 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx2) { waterY = this->actor.world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &waterY, &waterBox)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterY, + &waterBox)) { this->actor.yDistToWater = waterY - this->actor.world.pos.y; if (this->actor.yDistToWater < 0.0f) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { - EnBomChu_SpawnRipples(this, globalCtx, waterY); + EnBomChu_SpawnRipples(this, play, waterY); } this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER; } else { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->timer != 120)) { - EnBomChu_SpawnRipples(this, globalCtx, waterY); + EnBomChu_SpawnRipples(this, play, waterY); } else { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 3.0f, 15.0f, 0.25f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 3.0f, 15.0f, 0.25f); } this->actor.bgCheckFlags |= BGCHECKFLAG_WATER; @@ -476,17 +476,17 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnBomChu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBomChu_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBomChu* this = (EnBomChu*)thisx; f32 colorIntensity; s32 blinkHalfPeriod; s32 blinkTime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bom_chu.c", 921); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bom_chu.c", 921); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); if (this->timer >= 40) { blinkTime = this->timer % 20; @@ -508,9 +508,9 @@ void EnBomChu_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 9.0f + (colorIntensity * 209.0f), 9.0f + (colorIntensity * 34.0f), 35.0f + (colorIntensity * -35.0f), 255); Matrix_Translate(this->visualJitter * (1.0f / BOMBCHU_SCALE), 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bom_chu.c", 956), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_bom_chu.c", 956), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBombchuDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bom_chu.c", 961); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bom_chu.c", 961); } diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h index 9efc1e0d5b..7e2154a0a6 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h @@ -6,7 +6,7 @@ struct EnBomChu; -typedef void (*EnBomChuActionFunc)(struct EnBomChu*, GlobalContext*); +typedef void (*EnBomChuActionFunc)(struct EnBomChu*, PlayState*); typedef struct EnBomChu { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index aa73f2b659..acc27597eb 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -10,15 +10,15 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4) -void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBombf_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBombf_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBombf_Init(Actor* thisx, PlayState* play); +void EnBombf_Destroy(Actor* thisx, PlayState* play); +void EnBombf_Update(Actor* thisx, PlayState* play); +void EnBombf_Draw(Actor* thisx, PlayState* play); -void EnBombf_Move(EnBombf* this, GlobalContext* globalCtx); -void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx); -void EnBombf_WaitForRelease(EnBombf* this, GlobalContext* globalCtx); -void EnBombf_Explode(EnBombf* this, GlobalContext* globalCtx); +void EnBombf_Move(EnBombf* this, PlayState* play); +void EnBombf_GrowBomb(EnBombf* this, PlayState* play); +void EnBombf_WaitForRelease(EnBombf* this, PlayState* play); +void EnBombf_Explode(EnBombf* this, PlayState* play); void EnBombf_SetupGrowBomb(EnBombf* this, s16 params); const ActorInit En_Bombf_InitVars = { @@ -84,17 +84,17 @@ void EnBombf_SetupAction(EnBombf* this, EnBombfActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBombf_Init(Actor* thisx, PlayState* play) { f32 shapeUnk10 = 0.0f; s32 pad; EnBombf* this = (EnBombf*)thisx; Actor_SetScale(thisx, 0.01f); this->unk_200 = 1; - Collider_InitCylinder(globalCtx, &this->bombCollider); - Collider_InitJntSph(globalCtx, &this->explosionCollider); - Collider_SetCylinder(globalCtx, &this->bombCollider, thisx, &sCylinderInit); - Collider_SetJntSph(globalCtx, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); + Collider_InitCylinder(play, &this->bombCollider); + Collider_InitJntSph(play, &this->explosionCollider); + Collider_SetCylinder(play, &this->bombCollider, thisx, &sCylinderInit); + Collider_SetJntSph(play, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); if (thisx->params == BOMBFLOWER_BODY) { shapeUnk10 = 1000.0f; @@ -103,7 +103,7 @@ void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&thisx->shape, shapeUnk10, ActorShadow_DrawCircle, 12.0f); thisx->focus.pos = thisx->world.pos; - if (Actor_FindNearby(globalCtx, thisx, ACTOR_BG_DDAN_KD, ACTORCAT_BG, 10000.0f) != NULL) { + if (Actor_FindNearby(play, thisx, ACTOR_BG_DDAN_KD, ACTORCAT_BG, 10000.0f) != NULL) { thisx->flags |= ACTOR_FLAG_5; } @@ -115,7 +115,7 @@ void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx) { this->timer = 140; this->flashSpeedScale = 15; thisx->gravity = -1.5f; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_EXPLOSIVE); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_EXPLOSIVE); thisx->colChkInfo.mass = 200; thisx->flags &= ~ACTOR_FLAG_0; EnBombf_SetupAction(this, EnBombf_Move); @@ -130,30 +130,30 @@ void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->uncullZoneForward += 31000.0f; } -void EnBombf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBombf_Destroy(Actor* thisx, PlayState* play) { EnBombf* this = (EnBombf*)thisx; - Collider_DestroyCylinder(globalCtx, &this->bombCollider); - Collider_DestroyJntSph(globalCtx, &this->explosionCollider); + Collider_DestroyCylinder(play, &this->bombCollider); + Collider_DestroyJntSph(play, &this->explosionCollider); } void EnBombf_SetupGrowBomb(EnBombf* this, s16 params) { EnBombf_SetupAction(this, EnBombf_GrowBomb); } -void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { +void EnBombf_GrowBomb(EnBombf* this, PlayState* play) { EnBombf* bombFlower; s32 pad; s32 pad1; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; if (this->flowerBombScale >= 1.0f) { - if (Actor_HasParent(&this->actor, globalCtx)) { - bombFlower = (EnBombf*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBF, this->actor.world.pos.x, + if (Actor_HasParent(&this->actor, play)) { + bombFlower = (EnBombf*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bombFlower != NULL) { - func_8002F5C4(&this->actor, &bombFlower->actor, globalCtx); + func_8002F5C4(&this->actor, &bombFlower->actor, play); this->timer = 180; this->flowerBombScale = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_PL_PULL_UP_ROCK); @@ -169,9 +169,8 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { this->bombCollider.base.acFlags &= ~AC_HIT; if (this->bombCollider.base.ac->category != ACTORCAT_BOSS) { - bombFlower = - (EnBombf*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBF, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); + bombFlower = (EnBombf*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBF, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bombFlower != NULL) { bombFlower->unk_200 = 1; bombFlower->timer = 0; @@ -181,10 +180,9 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { } } } else { - if (Player_IsBurningStickInRange(globalCtx, &this->actor.world.pos, 30.0f, 50.0f)) { - bombFlower = - (EnBombf*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBF, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); + if (Player_IsBurningStickInRange(play, &this->actor.world.pos, 30.0f, 50.0f)) { + bombFlower = (EnBombf*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBF, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bombFlower != NULL) { bombFlower->timer = 100; this->timer = 180; @@ -192,8 +190,8 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { this->flowerBombScale = 0.0f; } } else { - if (!Actor_HasParent(&this->actor, globalCtx)) { - func_8002F580(&this->actor, globalCtx); + if (!Actor_HasParent(&this->actor, play)) { + func_8002F580(&this->actor, play); } else { player->actor.child = NULL; player->heldActor = NULL; @@ -212,7 +210,7 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { } } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { player->actor.child = NULL; player->heldActor = NULL; player->interactRangeActor = NULL; @@ -223,8 +221,8 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { } } -void EnBombf_Move(EnBombf* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnBombf_Move(EnBombf* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { // setting flowerBombScale does not do anything in the context of a bomb that link picks up // this and the assignment below are probably left overs this->flowerBombScale = 0.0f; @@ -240,25 +238,25 @@ void EnBombf_Move(EnBombf* this, GlobalContext* globalCtx) { } else { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.5f, 0.0f); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && (this->actor.velocity.y < -6.0f)) { - func_8002F850(globalCtx, &this->actor); + func_8002F850(play, &this->actor); this->actor.velocity.y *= -0.5f; } else if (this->timer >= 4) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } } } -void EnBombf_WaitForRelease(EnBombf* this, GlobalContext* globalCtx) { +void EnBombf_WaitForRelease(EnBombf* this, PlayState* play) { // if parent is NULL bomb has been released - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { EnBombf_SetupAction(this, EnBombf_Move); - EnBombf_Move(this, globalCtx); + EnBombf_Move(this, play); } else { this->actor.velocity.y = 0.0f; } } -void EnBombf_Explode(EnBombf* this, GlobalContext* globalCtx) { +void EnBombf_Explode(EnBombf* this, PlayState* play) { Player* player; if (this->explosionCollider.elements[0].dim.modelSphere.radius == 0) { @@ -271,35 +269,35 @@ void EnBombf_Explode(EnBombf* this, GlobalContext* globalCtx) { this->explosionCollider.elements[0].dim.modelSphere.radius; if (this->actor.params == BOMBFLOWER_EXPLOSION) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->explosionCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->explosionCollider.base); } - if (globalCtx->envCtx.adjLight1Color[0] != 0) { - globalCtx->envCtx.adjLight1Color[0] -= 25; + if (play->envCtx.adjLight1Color[0] != 0) { + play->envCtx.adjLight1Color[0] -= 25; } - if (globalCtx->envCtx.adjLight1Color[1] != 0) { - globalCtx->envCtx.adjLight1Color[1] -= 25; + if (play->envCtx.adjLight1Color[1] != 0) { + play->envCtx.adjLight1Color[1] -= 25; } - if (globalCtx->envCtx.adjLight1Color[2] != 0) { - globalCtx->envCtx.adjLight1Color[2] -= 25; + if (play->envCtx.adjLight1Color[2] != 0) { + play->envCtx.adjLight1Color[2] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[0] != 0) { - globalCtx->envCtx.adjAmbientColor[0] -= 25; + if (play->envCtx.adjAmbientColor[0] != 0) { + play->envCtx.adjAmbientColor[0] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[1] != 0) { - globalCtx->envCtx.adjAmbientColor[1] -= 25; + if (play->envCtx.adjAmbientColor[1] != 0) { + play->envCtx.adjAmbientColor[1] -= 25; } - if (globalCtx->envCtx.adjAmbientColor[2] != 0) { - globalCtx->envCtx.adjAmbientColor[2] -= 25; + if (play->envCtx.adjAmbientColor[2] != 0) { + play->envCtx.adjAmbientColor[2] -= 25; } if (this->timer == 0) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if ((player->stateFlags1 & PLAYER_STATE1_11) && (player->heldActor == &this->actor)) { player->actor.child = NULL; @@ -312,7 +310,7 @@ void EnBombf_Explode(EnBombf* this, GlobalContext* globalCtx) { } } -void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBombf_Update(Actor* thisx, PlayState* play) { Vec3f effVelocity = { 0.0f, 0.0f, 0.0f }; Vec3f bomb2Accel = { 0.0f, 0.1f, 0.0f }; Vec3f effAccel = { 0.0f, 0.0f, 0.0f }; @@ -326,12 +324,12 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { this->timer--; } - if ((!this->bumpOn) && (!Actor_HasParent(thisx, globalCtx)) && + if ((!this->bumpOn) && (!Actor_HasParent(thisx, play)) && ((thisx->xzDistToPlayer >= 20.0f) || (ABS(thisx->yDistToPlayer) >= 80.0f))) { this->bumpOn = true; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (thisx->params == BOMBFLOWER_BODY) { Actor_MoveForward(thisx); @@ -339,7 +337,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { if (thisx->gravity != 0.0f) { DREG(6) = 1; - Actor_UpdateBgCheckInfo(globalCtx, thisx, 5.0f, 10.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, thisx, 5.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); DREG(6) = 0; @@ -361,7 +359,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { Audio_PlayActorSound2(thisx, NA_SE_EV_BOMB_BOUND); Actor_MoveForward(thisx); DREG(6) = 1; - Actor_UpdateBgCheckInfo(globalCtx, thisx, 5.0f, 10.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, thisx, 5.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); DREG(6) = 0; @@ -375,7 +373,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { this->timer = 0; } else { // if a lit stick touches the bomb, set timer to 100 - if ((this->timer > 100) && Player_IsBurningStickInRange(globalCtx, &thisx->world.pos, 30.0f, 50.0f)) { + if ((this->timer > 100) && Player_IsBurningStickInRange(play, &thisx->world.pos, 30.0f, 50.0f)) { this->timer = 100; } } @@ -386,13 +384,13 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { effPos.y += 25.0f; if (this->timer < 127) { // spawn spark effect on even frames - if ((globalCtx->gameplayFrames % 2) == 0) { - EffectSsGSpk_SpawnFuse(globalCtx, thisx, &effPos, &effVelocity, &effAccel); + if ((play->gameplayFrames % 2) == 0) { + EffectSsGSpk_SpawnFuse(play, thisx, &effPos, &effVelocity, &effAccel); } Audio_PlayActorSound2(thisx, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); effPos.y += 3.0f; - func_8002829C(globalCtx, &effPos, &effVelocity, &dustAccel, &dustColor, &dustColor, 50, 5); + func_8002829C(play, &effPos, &effVelocity, &dustAccel, &dustColor, &dustColor, 50, 5); } // double bomb flash speed and adjust red color at certain times during the countdown @@ -415,23 +413,22 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { effPos.y += 10.0f; - if (Actor_HasParent(thisx, globalCtx)) { + if (Actor_HasParent(thisx, play)) { effPos.y += 30.0f; } - EffectSsBomb2_SpawnLayered(globalCtx, &effPos, &effVelocity, &bomb2Accel, 100, 19); + EffectSsBomb2_SpawnLayered(play, &effPos, &effVelocity, &bomb2Accel, 100, 19); effPos.y = thisx->floorHeight; if (thisx->floorHeight > BGCHECK_Y_MIN) { - EffectSsBlast_SpawnWhiteShockwave(globalCtx, &effPos, &effVelocity, &effAccel); + EffectSsBlast_SpawnWhiteShockwave(play, &effPos, &effVelocity, &effAccel); } Audio_PlayActorSound2(thisx, NA_SE_IT_BOMB_EXPLOSION); - globalCtx->envCtx.adjLight1Color[0] = globalCtx->envCtx.adjLight1Color[1] = - globalCtx->envCtx.adjLight1Color[2] = 250; - globalCtx->envCtx.adjAmbientColor[0] = globalCtx->envCtx.adjAmbientColor[1] = - globalCtx->envCtx.adjAmbientColor[2] = 250; - Camera_AddQuake(&globalCtx->mainCamera, 2, 0xB, 8); + play->envCtx.adjLight1Color[0] = play->envCtx.adjLight1Color[1] = play->envCtx.adjLight1Color[2] = 250; + play->envCtx.adjAmbientColor[0] = play->envCtx.adjAmbientColor[1] = play->envCtx.adjAmbientColor[2] = + 250; + Camera_AddQuake(&play->mainCamera, 2, 0xB, 8); thisx->params = BOMBFLOWER_EXPLOSION; this->timer = 10; thisx->flags |= ACTOR_FLAG_5; @@ -448,15 +445,15 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(thisx, &this->bombCollider); if ((this->flowerBombScale >= 1.0f) && (this->bumpOn)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bombCollider.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bombCollider.base); } if ((thisx->scale.x >= 0.01f) && (thisx->params != BOMBFLOWER_EXPLOSION)) { if (thisx->yDistToWater >= 20.0f) { - EffectSsDeadSound_SpawnStationary(globalCtx, &thisx->projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, true, + EffectSsDeadSound_SpawnStationary(play, &thisx->projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, true, DEADSOUND_REPEAT_MODE_OFF, 10); Actor_Kill(thisx); return; @@ -468,32 +465,32 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { } } -Gfx* EnBombf_NewMtxDList(GraphicsContext* gfxCtx, GlobalContext* globalCtx) { +Gfx* EnBombf_NewMtxDList(GraphicsContext* gfxCtx, PlayState* play) { Gfx* displayList; Gfx* displayListHead; displayList = Graph_Alloc(gfxCtx, 5 * sizeof(Gfx)); displayListHead = displayList; - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(displayListHead++, Matrix_NewMtx(gfxCtx, "../z_en_bombf.c", 1021), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPEndDisplayList(displayListHead); return displayList; } -void EnBombf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBombf_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBombf* this = (EnBombf*)thisx; if (1) {} - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bombf.c", 1034); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bombf.c", 1034); if (thisx->params <= BOMBFLOWER_BODY) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (thisx->params != BOMBFLOWER_BODY) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bombf.c", 1041), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_bombf.c", 1041), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBombFlowerLeavesDL); gSPDisplayList(POLY_OPA_DISP++, gBombFlowerBaseLeavesDL); @@ -505,14 +502,13 @@ void EnBombf_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 200, 255, 200, 255); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, (s16)this->flashIntensity, 20, 10, 0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bombf.c", 1054), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_bombf.c", 1054), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_OPA_DISP++, 0x08, - SEGMENTED_TO_VIRTUAL(EnBombf_NewMtxDList(globalCtx->state.gfxCtx, globalCtx))); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(EnBombf_NewMtxDList(play->state.gfxCtx, play))); gSPDisplayList(POLY_OPA_DISP++, gBombFlowerBombAndSparkDL); } else { Collider_UpdateSpheres(0, &this->explosionCollider); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bombf.c", 1063); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bombf.c", 1063); } diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h index e33880451c..7822098d0a 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h @@ -6,7 +6,7 @@ struct EnBombf; -typedef void (*EnBombfActionFunc)(struct EnBombf*, struct GlobalContext*); +typedef void (*EnBombfActionFunc)(struct EnBombf*, struct PlayState*); typedef struct EnBombf { /* 0x0000 */ Actor actor; 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 40699422d0..91776d8ff9 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBoom_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBoom_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBoom_Init(Actor* thisx, PlayState* play); +void EnBoom_Destroy(Actor* thisx, PlayState* play); +void EnBoom_Update(Actor* thisx, PlayState* play); +void EnBoom_Draw(Actor* thisx, PlayState* play); -void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx); +void EnBoom_Fly(EnBoom* this, PlayState* play); const ActorInit En_Boom_InitVars = { ACTOR_EN_BOOM, @@ -57,7 +57,7 @@ void EnBoom_SetupAction(EnBoom* this, EnBoomActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Init(Actor* thisx, PlayState* play) { EnBoom* this = (EnBoom*)thisx; EffectBlureInit1 blure; @@ -89,22 +89,22 @@ void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx) { blure.unkFlag = 0; blure.calcMode = 0; - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE1, 0, 0, &blure); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE1, 0, 0, &blure); - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->actor, &sQuadInit); EnBoom_SetupAction(this, EnBoom_Fly); } -void EnBoom_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Destroy(Actor* thisx, PlayState* play) { EnBoom* this = (EnBoom*)thisx; - Effect_Delete(globalCtx, this->effectIndex); - Collider_DestroyQuad(globalCtx, &this->collider); + Effect_Delete(play, this->effectIndex); + Collider_DestroyQuad(play, &this->collider); } -void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { +void EnBoom_Fly(EnBoom* this, PlayState* play) { Actor* target; Player* player; s32 collided; @@ -120,7 +120,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { Vec3f hitPoint; s32 pad2; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); target = this->moveTo; // If the boomerang is moving toward a targeted actor, handle setting the proper x and y angle to fly toward it. @@ -196,20 +196,19 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { // Copy the position from the prevous frame to the boomerang to start the bounce back. Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); } else { - collided = BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.prevPos, &this->actor.world.pos, - &hitPoint, &this->actor.wallPoly, true, true, true, true, &hitDynaID); + collided = BgCheck_EntityLineTest1(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, &hitPoint, + &this->actor.wallPoly, true, true, true, true, &hitDynaID); if (collided) { // If the boomerang collides with something and it's is a Jabu Object actor with params equal to 0, then // set collided to 0 so that the boomerang will go through the wall. // Otherwise play a clank sound and keep collided set to bounce back. - if (func_8002F9EC(globalCtx, &this->actor, this->actor.wallPoly, hitDynaID, &hitPoint) != 0 || - (hitDynaID != BGCHECK_SCENE && - ((hitActor = DynaPoly_GetActor(&globalCtx->colCtx, hitDynaID)) != NULL) && + if (func_8002F9EC(play, &this->actor, this->actor.wallPoly, hitDynaID, &hitPoint) != 0 || + (hitDynaID != BGCHECK_SCENE && ((hitActor = DynaPoly_GetActor(&play->colCtx, hitDynaID)) != NULL) && hitActor->actor.id == ACTOR_BG_BDAN_OBJECTS && hitActor->actor.params == 0)) { collided = false; } else { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &hitPoint); + CollisionCheck_SpawnShieldParticlesMetal(play, &hitPoint); } } } @@ -236,25 +235,25 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { } } -void EnBoom_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Update(Actor* thisx, PlayState* play) { EnBoom* this = (EnBoom*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & PLAYER_STATE1_29)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 0.0f); this->activeTimer = this->activeTimer + 1; } } -void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Draw(Actor* thisx, PlayState* play) { static Vec3f sMultVec1 = { -960.0f, 0.0f, 0.0f }; static Vec3f sMultVec2 = { 960.0f, 0.0f, 0.0f }; EnBoom* this = (EnBoom*)thisx; Vec3f vec1; Vec3f vec2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_boom.c", 567); + OPEN_DISPS(play->state.gfxCtx, "../z_en_boom.c", 567); Matrix_RotateY(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD(0x1F40), MTXMODE_APPLY); @@ -262,16 +261,16 @@ void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&sMultVec1, &vec1); Matrix_MultVec3f(&sMultVec2, &vec2); - if (func_80090480(globalCtx, &this->collider, &this->boomerangInfo, &vec1, &vec2) != 0) { + if (func_80090480(play, &this->collider, &this->boomerangInfo, &vec1, &vec2) != 0) { EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &vec1, &vec2); } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_RotateY(BINANG_TO_RAD(this->activeTimer * 12000), MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_boom.c", 601), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_boom.c", 601), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBoomerangRefDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_boom.c", 604); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_boom.c", 604); } 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 cb93b27ddf..4284063726 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.h +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.h @@ -6,7 +6,7 @@ struct EnBoom; -typedef void (*EnBoomActionFunc)(struct EnBoom*, GlobalContext*); +typedef void (*EnBoomActionFunc)(struct EnBoom*, PlayState*); typedef struct EnBoom { /* 0x0000 */ Actor actor; 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 c80231c630..72a8b2138a 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -35,19 +35,19 @@ typedef enum { ENBOX_STATE_2 // waiting for something message context-related } EnBoxStateUnk1FB; -void EnBox_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBox_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBox_Init(Actor* thisx, PlayState* play); +void EnBox_Destroy(Actor* thisx, PlayState* play); +void EnBox_Update(Actor* thisx, PlayState* play); +void EnBox_Draw(Actor* thisx, PlayState* play); -void EnBox_FallOnSwitchFlag(EnBox* this, GlobalContext* globalCtx); -void func_809C9700(EnBox* this, GlobalContext* globalCtx); -void EnBox_AppearOnSwitchFlag(EnBox* this, GlobalContext* globalCtx); -void EnBox_AppearOnRoomClear(EnBox* this, GlobalContext* globalCtx); -void EnBox_AppearInit(EnBox* this, GlobalContext* globalCtx); -void EnBox_AppearAnimation(EnBox* this, GlobalContext* globalCtx); -void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx); -void EnBox_Open(EnBox* this, GlobalContext* globalCtx); +void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play); +void func_809C9700(EnBox* this, PlayState* play); +void EnBox_AppearOnSwitchFlag(EnBox* this, PlayState* play); +void EnBox_AppearOnRoomClear(EnBox* this, PlayState* play); +void EnBox_AppearInit(EnBox* this, PlayState* play); +void EnBox_AppearAnimation(EnBox* this, PlayState* play); +void EnBox_WaitOpen(EnBox* this, PlayState* play); +void EnBox_Open(EnBox* this, PlayState* play); const ActorInit En_Box_InitVars = { ACTOR_EN_BOX, @@ -74,7 +74,7 @@ void EnBox_SetupAction(EnBox* this, EnBoxActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBox_ClipToGround(EnBox* this, GlobalContext* globalCtx) { +void EnBox_ClipToGround(EnBox* this, PlayState* play) { f32 newY; CollisionPoly* poly; s32 bgId; @@ -82,14 +82,14 @@ void EnBox_ClipToGround(EnBox* this, GlobalContext* globalCtx) { pos = this->dyna.actor.world.pos; pos.y += 1.0f; - newY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &poly, &bgId, &this->dyna.actor, &pos); + newY = BgCheck_EntityRaycastFloor4(&play->colCtx, &poly, &bgId, &this->dyna.actor, &pos); if (newY != BGCHECK_Y_MIN) { this->dyna.actor.world.pos.y = newY; } } -void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBox_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBox* this = (EnBox*)thisx; AnimationHeader* anim; CollisionHeader* colHeader; @@ -104,8 +104,8 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gTreasureChestCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - func_8003ECA8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + func_8003ECA8(play, &play->colCtx.dyna, this->dyna.bgId); this->movementFlags = 0; this->type = thisx->params >> 12 & 0xF; @@ -115,17 +115,17 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { this->switchFlag = this->dyna.actor.world.rot.z; this->dyna.actor.minVelocityY = -50.0f; - if (globalCtx) {} // helps the compiler store globalCtx2 into s1 + if (play) {} // helps the compiler store play2 into s1 - if (Flags_GetTreasure(globalCtx, this->dyna.actor.params & 0x1F)) { + if (Flags_GetTreasure(play, this->dyna.actor.params & 0x1F)) { this->alpha = 255; this->iceSmokeTimer = 100; EnBox_SetupAction(this, EnBox_Open); this->movementFlags |= ENBOX_MOVE_STICK_TO_GROUND; animFrameStart = endFrame; } else if ((this->type == ENBOX_TYPE_SWITCH_FLAG_FALL_BIG || this->type == ENBOX_TYPE_SWITCH_FLAG_FALL_SMALL) && - !Flags_GetSwitch(globalCtx, this->switchFlag)) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + !Flags_GetSwitch(play, this->switchFlag)) { + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); if (Rand_ZeroOne() < 0.5f) { this->movementFlags |= ENBOX_MOVE_FALL_ANGLE_SIDE; } @@ -135,9 +135,9 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->dyna.actor.flags |= ACTOR_FLAG_4; } else if ((this->type == ENBOX_TYPE_ROOM_CLEAR_BIG || this->type == ENBOX_TYPE_ROOM_CLEAR_SMALL) && - !Flags_GetClear(globalCtx, this->dyna.actor.room)) { + !Flags_GetClear(play, this->dyna.actor.room)) { EnBox_SetupAction(this, EnBox_AppearOnRoomClear); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f; this->alpha = 0; @@ -145,14 +145,14 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { } else if (this->type == ENBOX_TYPE_9 || this->type == ENBOX_TYPE_10) { EnBox_SetupAction(this, func_809C9700); this->dyna.actor.flags |= ACTOR_FLAG_25; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f; this->alpha = 0; this->dyna.actor.flags |= ACTOR_FLAG_4; - } else if (this->type == ENBOX_TYPE_SWITCH_FLAG_BIG && !Flags_GetSwitch(globalCtx, this->switchFlag)) { + } else if (this->type == ENBOX_TYPE_SWITCH_FLAG_BIG && !Flags_GetSwitch(play, this->switchFlag)) { EnBox_SetupAction(this, EnBox_AppearOnSwitchFlag); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f; this->alpha = 0; @@ -169,7 +169,7 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { this->dyna.actor.world.rot.y += 0x8000; this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z = 0; - SkelAnime_Init(globalCtx, &this->skelanime, &gTreasureChestSkel, anim, this->jointTable, this->morphTable, 5); + SkelAnime_Init(play, &this->skelanime, &gTreasureChestSkel, anim, this->jointTable, this->morphTable, 5); Animation_Change(&this->skelanime, anim, 1.5f, animFrameStart, endFrame, ANIMMODE_ONCE, 0.0f); switch (this->type) { @@ -186,10 +186,10 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnBox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBox_Destroy(Actor* thisx, PlayState* play) { EnBox* this = (EnBox*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void EnBox_RandomDustKinematic(EnBox* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { @@ -212,7 +212,7 @@ void EnBox_RandomDustKinematic(EnBox* this, Vec3f* pos, Vec3f* velocity, Vec3f* /** * Spawns dust randomly around the chest when the chest hits the ground after falling (FALL types) */ -void EnBox_SpawnDust(EnBox* this, GlobalContext* globalCtx) { +void EnBox_SpawnDust(EnBox* this, PlayState* play) { s32 i; Vec3f pos; Vec3f velocity; @@ -220,14 +220,14 @@ void EnBox_SpawnDust(EnBox* this, GlobalContext* globalCtx) { for (i = 0; i < 20; i++) { EnBox_RandomDustKinematic(this, &pos, &velocity, &accel); - func_8002873C(globalCtx, &pos, &velocity, &accel, 100, 30, 15); + func_8002873C(play, &pos, &velocity, &accel, 100, 30, 15); } } /** * Used while the chest is falling (FALL types) */ -void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { +void EnBox_Fall(EnBox* this, PlayState* play) { f32 yDiff; this->alpha = 255; @@ -248,11 +248,11 @@ void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.z = 0; this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; EnBox_SetupAction(this, EnBox_WaitOpen); - OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + OnePointCutscene_EndCutscene(play, this->subCamId); } Audio_PlaySoundGeneral(NA_SE_EV_COFFIN_CAP_BOUND, &this->dyna.actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - EnBox_SpawnDust(this, globalCtx); + EnBox_SpawnDust(this, play); } yDiff = this->dyna.actor.world.pos.y - this->dyna.actor.floorHeight; if (this->movementFlags & ENBOX_MOVE_FALL_ANGLE_SIDE) { @@ -262,31 +262,31 @@ void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { } } -void EnBox_FallOnSwitchFlag(EnBox* this, GlobalContext* globalCtx) { +void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) { s32 treasureFlag = this->dyna.actor.params & 0x1F; if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { - func_8002F5F0(&this->dyna.actor, globalCtx); + func_8002F5F0(&this->dyna.actor, play); } if (this->unk_1A8 >= 0) { EnBox_SetupAction(this, EnBox_Fall); - this->subCamId = OnePointCutscene_Init(globalCtx, 4500, 9999, &this->dyna.actor, CAM_ID_MAIN); - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + this->subCamId = OnePointCutscene_Init(play, 4500, 9999, &this->dyna.actor, CAM_ID_MAIN); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } else if (this->unk_1A8 >= -11) { this->unk_1A8++; - } else if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + } else if (Flags_GetSwitch(play, this->switchFlag)) { this->unk_1A8++; } } // used for types 9, 10 -void func_809C9700(EnBox* this, GlobalContext* globalCtx) { +void func_809C9700(EnBox* this, PlayState* play) { s32 treasureFlag = this->dyna.actor.params & 0x1F; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { - func_8002F5F0(&this->dyna.actor, globalCtx); + func_8002F5F0(&this->dyna.actor, play); } if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &player->actor.world.pos) > SQ(150.0f)) { @@ -301,14 +301,14 @@ void func_809C9700(EnBox* this, GlobalContext* globalCtx) { } if (this->unk_1FB == ENBOX_STATE_1) { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->unk_1FB = ENBOX_STATE_2; - } else if (this->unk_1FB == ENBOX_STATE_2 && globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - if ((globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_LULLABY && this->type == ENBOX_TYPE_9) || - (globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS && this->type == ENBOX_TYPE_10)) { + } else if (this->unk_1FB == ENBOX_STATE_2 && play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_LULLABY && this->type == ENBOX_TYPE_9) || + (play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS && this->type == ENBOX_TYPE_10)) { this->dyna.actor.flags &= ~ACTOR_FLAG_25; EnBox_SetupAction(this, EnBox_AppearInit); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->unk_1A8 = 0; this->unk_1FB = ENBOX_STATE_0; } else { @@ -318,32 +318,32 @@ void func_809C9700(EnBox* this, GlobalContext* globalCtx) { } } -void EnBox_AppearOnSwitchFlag(EnBox* this, GlobalContext* globalCtx) { +void EnBox_AppearOnSwitchFlag(EnBox* this, PlayState* play) { s32 treasureFlag = this->dyna.actor.params & 0x1F; if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { - func_8002F5F0(&this->dyna.actor, globalCtx); + func_8002F5F0(&this->dyna.actor, play); } - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + if (Flags_GetSwitch(play, this->switchFlag)) { + OnePointCutscene_Attention(play, &this->dyna.actor); EnBox_SetupAction(this, EnBox_AppearInit); this->unk_1A8 = -30; } } -void EnBox_AppearOnRoomClear(EnBox* this, GlobalContext* globalCtx) { +void EnBox_AppearOnRoomClear(EnBox* this, PlayState* play) { s32 treasureFlag = this->dyna.actor.params & 0x1F; if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { - func_8002F5F0(&this->dyna.actor, globalCtx); + func_8002F5F0(&this->dyna.actor, play); } - if (Flags_GetTempClear(globalCtx, this->dyna.actor.room) && !Player_InCsMode(globalCtx)) { - Flags_SetClear(globalCtx, this->dyna.actor.room); + if (Flags_GetTempClear(play, this->dyna.actor.room) && !Player_InCsMode(play)) { + Flags_SetClear(play, this->dyna.actor.room); EnBox_SetupAction(this, EnBox_AppearInit); - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); - if (OnePointCutscene_CheckForCategory(globalCtx, this->dyna.actor.category)) { + OnePointCutscene_Attention(play, &this->dyna.actor); + if (OnePointCutscene_CheckForCategory(play, this->dyna.actor.category)) { this->unk_1A8 = 0; } else { this->unk_1A8 = -30; @@ -354,19 +354,19 @@ void EnBox_AppearOnRoomClear(EnBox* this, GlobalContext* globalCtx) { /** * The chest is ready to appear, possibly waiting for camera/cutscene-related stuff to happen */ -void EnBox_AppearInit(EnBox* this, GlobalContext* globalCtx) { +void EnBox_AppearInit(EnBox* this, PlayState* play) { if (func_8005B198() == this->dyna.actor.category || this->unk_1A8 != 0) { EnBox_SetupAction(this, EnBox_AppearAnimation); this->unk_1A8 = 0; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_KANKYO, this->dyna.actor.home.pos.x, - this->dyna.actor.home.pos.y, this->dyna.actor.home.pos.z, 0, 0, 0, 0x0011); + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, + this->dyna.actor.home.pos.z, 0, 0, 0, 0x0011); Audio_PlaySoundGeneral(NA_SE_EV_TRE_BOX_APPEAR, &this->dyna.actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } -void EnBox_AppearAnimation(EnBox* this, GlobalContext* globalCtx) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +void EnBox_AppearAnimation(EnBox* this, PlayState* play) { + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); if (this->unk_1A8 < 0) { this->unk_1A8++; @@ -385,7 +385,7 @@ void EnBox_AppearAnimation(EnBox* this, GlobalContext* globalCtx) { /** * Chest is ready to be open */ -void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { +void EnBox_WaitOpen(EnBox* this, PlayState* play) { f32 frameCount; AnimationHeader* anim; s32 linkAge; @@ -409,7 +409,7 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { case ENBOX_TYPE_SWITCH_FLAG_FALL_SMALL: break; default: - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_DEMO_TRE_LGT, + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_DEMO_TRE_LGT, 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, this->dyna.actor.shape.rot.z, 0xFFFF); @@ -417,15 +417,15 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { } } osSyncPrintf("Actor_Environment_Tbox_On() %d\n", this->dyna.actor.params & 0x1F); - Flags_SetTreasure(globalCtx, this->dyna.actor.params & 0x1F); + Flags_SetTreasure(play, this->dyna.actor.params & 0x1F); } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); func_8002DBD0(&this->dyna.actor, &sp4C, &player->actor.world.pos); if (sp4C.z > -50.0f && sp4C.z < 0.0f && fabsf(sp4C.y) < 10.0f && fabsf(sp4C.x) < 20.0f && - Player_IsFacingActor(&this->dyna.actor, 0x3000, globalCtx)) { - func_8002F554(&this->dyna.actor, globalCtx, 0 - (this->dyna.actor.params >> 5 & 0x7F)); + Player_IsFacingActor(&this->dyna.actor, 0x3000, play)) { + func_8002F554(&this->dyna.actor, play, 0 - (this->dyna.actor.params >> 5 & 0x7F)); } - if (Flags_GetTreasure(globalCtx, this->dyna.actor.params & 0x1F)) { + if (Flags_GetTreasure(play, this->dyna.actor.params & 0x1F)) { EnBox_SetupAction(this, EnBox_Open); } } @@ -434,7 +434,7 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { /** * Plays an animation to its end, playing sounds at key points */ -void EnBox_Open(EnBox* this, GlobalContext* globalCtx) { +void EnBox_Open(EnBox* this, PlayState* play) { u16 sfxId; this->dyna.actor.flags &= ~ACTOR_FLAG_7; @@ -478,7 +478,7 @@ void EnBox_Open(EnBox* this, GlobalContext* globalCtx) { } } -void EnBox_SpawnIceSmoke(EnBox* this, GlobalContext* globalCtx) { +void EnBox_SpawnIceSmoke(EnBox* this, PlayState* play) { Vec3f pos; Vec3f vel = { 0.0f, 1.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -505,23 +505,23 @@ void EnBox_SpawnIceSmoke(EnBox* this, GlobalContext* globalCtx) { vel.y = 1.8f; vel.z = f0 * 1.6f * Math_CosS(this->dyna.actor.world.rot.y); } - EffectSsIceSmoke_Spawn(globalCtx, &pos, &vel, &accel, 150); + EffectSsIceSmoke_Spawn(play, &pos, &vel, &accel, 150); } } -void EnBox_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBox_Update(Actor* thisx, PlayState* play) { EnBox* this = (EnBox*)thisx; if (this->movementFlags & ENBOX_MOVE_STICK_TO_GROUND) { this->movementFlags &= ~ENBOX_MOVE_STICK_TO_GROUND; - EnBox_ClipToGround(this, globalCtx); + EnBox_ClipToGround(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (!(this->movementFlags & ENBOX_MOVE_IMMOBILE)) { Actor_MoveForward(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } @@ -538,16 +538,16 @@ void EnBox_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->dyna.actor.params >> 5 & 0x7F) == 0x7C && this->actionFunc == EnBox_Open && this->skelanime.curFrame > 45 && this->iceSmokeTimer < 100) { - EnBox_SpawnIceSmoke(this, globalCtx); + EnBox_SpawnIceSmoke(this, play); } } -void EnBox_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnBox_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnBox* this = (EnBox*)thisx; s32 pad; if (limbIndex == 1) { - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_box.c", 1492), + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_box.c", 1492), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->type != ENBOX_TYPE_DECORATED_BIG) { gSPDisplayList((*gfx)++, gTreasureChestChestFrontDL); @@ -555,7 +555,7 @@ void EnBox_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve gSPDisplayList((*gfx)++, gTreasureChestBossKeyChestFrontDL); } } else if (limbIndex == 3) { - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_box.c", 1502), + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_box.c", 1502), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->type != ENBOX_TYPE_DECORATED_BIG) { gSPDisplayList((*gfx)++, gTreasureChestChestSideAndLidDL); @@ -614,10 +614,10 @@ Gfx* func_809CA518(GraphicsContext* gfxCtx) { return dList; } -void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBox_Draw(Actor* thisx, PlayState* play) { EnBox* this = (EnBox*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_box.c", 1581); + OPEN_DISPS(play->state.gfxCtx, "../z_en_box.c", 1581); /* this->dyna.actor.flags & ACTOR_FLAG_7 is set by Init (if type is 4 or 6) @@ -628,22 +628,22 @@ void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx) { (this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6))) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0x08, EnBox_EmptyDList(globalCtx->state.gfxCtx)); - func_80093D18(globalCtx->state.gfxCtx); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, NULL, + gSPSegment(POLY_OPA_DISP++, 0x08, EnBox_EmptyDList(play->state.gfxCtx)); + func_80093D18(play->state.gfxCtx); + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelanime.skeleton, this->skelanime.jointTable, NULL, EnBox_PostLimbDraw, this, POLY_OPA_DISP); } else if (this->alpha != 0) { gDPPipeSync(POLY_XLU_DISP++); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); if (this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6) { - gSPSegment(POLY_XLU_DISP++, 0x08, func_809CA518(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x08, func_809CA518(play->state.gfxCtx)); } else { - gSPSegment(POLY_XLU_DISP++, 0x08, func_809CA4A0(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x08, func_809CA4A0(play->state.gfxCtx)); } - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, NULL, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelanime.skeleton, this->skelanime.jointTable, NULL, EnBox_PostLimbDraw, this, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_box.c", 1639); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_box.c", 1639); } diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.h b/src/overlays/actors/ovl_En_Box/z_en_box.h index a5ab0dfa72..6ab9b6c0fb 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.h +++ b/src/overlays/actors/ovl_En_Box/z_en_box.h @@ -9,7 +9,7 @@ struct EnBox; -typedef void (*EnBoxActionFunc)(struct EnBox*, GlobalContext*); +typedef void (*EnBoxActionFunc)(struct EnBox*, PlayState*); typedef enum { /* diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.c b/src/overlays/actors/ovl_En_Brob/z_en_brob.c index c113fcedd9..c497186a85 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.c +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.c @@ -9,18 +9,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnBrob_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBrob_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBrob_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBrob_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBrob_Init(Actor* thisx, PlayState* play); +void EnBrob_Destroy(Actor* thisx, PlayState* play); +void EnBrob_Update(Actor* thisx, PlayState* play); +void EnBrob_Draw(Actor* thisx, PlayState* play); -void func_809CADDC(EnBrob* this, GlobalContext* globalCtx); -void func_809CB054(EnBrob* this, GlobalContext* globalCtx); -void func_809CB114(EnBrob* this, GlobalContext* globalCtx); -void func_809CB218(EnBrob* this, GlobalContext* globalCtx); -void func_809CB2B8(EnBrob* this, GlobalContext* globalCtx); -void func_809CB354(EnBrob* this, GlobalContext* globalCtx); -void func_809CB458(EnBrob* this, GlobalContext* globalCtx); +void func_809CADDC(EnBrob* this, PlayState* play); +void func_809CB054(EnBrob* this, PlayState* play); +void func_809CB114(EnBrob* this, PlayState* play); +void func_809CB218(EnBrob* this, PlayState* play); +void func_809CB2B8(EnBrob* this, PlayState* play); +void func_809CB354(EnBrob* this, PlayState* play); +void func_809CB458(EnBrob* this, PlayState* play); const ActorInit En_Brob_InitVars = { ACTOR_EN_BROB, @@ -56,20 +56,20 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit sColChkInfoInit = { 0, 60, 120, MASS_IMMOVABLE }; -void EnBrob_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBrob_Init(Actor* thisx, PlayState* play) { s32 pad; EnBrob* this = (EnBrob*)thisx; CollisionHeader* colHeader = NULL; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_brob_Skel_0015D8, &object_brob_Anim_001750, - this->jointTable, this->morphTable, 10); + SkelAnime_InitFlex(play, &this->skelAnime, &object_brob_Skel_0015D8, &object_brob_Anim_001750, this->jointTable, + this->morphTable, 10); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&object_brob_Col_001A70, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); - Collider_InitCylinder(globalCtx, &this->colliders[0]); - Collider_SetCylinder(globalCtx, &this->colliders[0], &this->dyna.actor, &sCylinderInit); - Collider_InitCylinder(globalCtx, &this->colliders[1]); - Collider_SetCylinder(globalCtx, &this->colliders[1], &this->dyna.actor, &sCylinderInit); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + Collider_InitCylinder(play, &this->colliders[0]); + Collider_SetCylinder(play, &this->colliders[0], &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliders[1]); + Collider_SetCylinder(play, &this->colliders[1], &this->dyna.actor, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); if (((thisx->params >> 8) & 0xFF) == 0) { Actor_SetScale(&this->dyna.actor, 0.01f); @@ -92,27 +92,27 @@ void EnBrob_Init(Actor* thisx, GlobalContext* globalCtx) { this->colliders[1].dim.yShift *= thisx->scale.y; this->actionFunc = NULL; thisx->flags &= ~ACTOR_FLAG_0; - func_809CADDC(this, globalCtx); + func_809CADDC(this, play); } -void EnBrob_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBrob_Destroy(Actor* thisx, PlayState* play) { EnBrob* this = (EnBrob*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->colliders[0]); - Collider_DestroyCylinder(globalCtx, &this->colliders[1]); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->colliders[0]); + Collider_DestroyCylinder(play, &this->colliders[1]); } -void func_809CADDC(EnBrob* this, GlobalContext* globalCtx) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +void func_809CADDC(EnBrob* this, PlayState* play) { + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); this->timer = this->actionFunc == func_809CB2B8 ? 200 : 0; this->unk_1AE = 0; this->actionFunc = func_809CB054; } -void func_809CAE44(EnBrob* this, GlobalContext* globalCtx) { +void func_809CAE44(EnBrob* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &object_brob_Anim_001750); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->unk_1AE = 1000; this->actionFunc = func_809CB114; } @@ -145,23 +145,23 @@ void func_809CB008(EnBrob* this) { this->actionFunc = func_809CB458; } -void func_809CB054(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB054(EnBrob* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { if (func_8004356C(&this->dyna) != 0) { - func_8002F71C(globalCtx, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); - func_809CAE44(this, globalCtx); + func_8002F71C(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); + func_809CAE44(this, play); } else if (this->dyna.actor.xzDistToPlayer < 300.0f) { - func_809CAE44(this, globalCtx); + func_809CAE44(this, play); } } else if (this->timer >= 81) { this->dyna.actor.colorFilterTimer = 80; } } -void func_809CB114(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB114(EnBrob* this, PlayState* play) { f32 curFrame; if (SkelAnime_Update(&this->skelAnime)) { @@ -178,7 +178,7 @@ void func_809CB114(EnBrob* this, GlobalContext* globalCtx) { } } -void func_809CB218(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB218(EnBrob* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_BROB_WAVE); @@ -191,20 +191,20 @@ void func_809CB218(EnBrob* this, GlobalContext* globalCtx) { } } -void func_809CB2B8(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB2B8(EnBrob* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - func_809CADDC(this, globalCtx); + func_809CADDC(this, play); } else if (this->skelAnime.curFrame < 8.0f) { this->unk_1AE -= 1250.0f; } this->dyna.actor.colorFilterTimer = 0x50; } -void func_809CB354(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB354(EnBrob* this, PlayState* play) { f32 curFrame; if (SkelAnime_Update(&this->skelAnime)) { - func_809CADDC(this, globalCtx); + func_809CADDC(this, play); } else { curFrame = this->skelAnime.curFrame; if (curFrame < 8.0f) { @@ -217,7 +217,7 @@ void func_809CB354(EnBrob* this, GlobalContext* globalCtx) { } } -void func_809CB458(EnBrob* this, GlobalContext* globalCtx) { +void func_809CB458(EnBrob* this, PlayState* play) { Vec3f pos; f32 dist1; f32 dist2; @@ -228,7 +228,7 @@ void func_809CB458(EnBrob* this, GlobalContext* globalCtx) { this->timer--; } - dist1 = globalCtx->gameplayFrames % 2 ? 0.0f : this->dyna.actor.scale.x * 5500.0f; + dist1 = play->gameplayFrames % 2 ? 0.0f : this->dyna.actor.scale.x * 5500.0f; dist2 = this->dyna.actor.scale.x * 5500.0f; for (i = 0; i < 4; i++) { @@ -245,7 +245,7 @@ void func_809CB458(EnBrob* this, GlobalContext* globalCtx) { dist2 = -dist2; } pos.y = (((Rand_ZeroOne() * 15000.0f) + 1000.0f) * this->dyna.actor.scale.y) + this->dyna.actor.world.pos.y; - EffectSsLightning_Spawn(globalCtx, &pos, &primColor, &envColor, this->dyna.actor.scale.y * 8000.0f, + EffectSsLightning_Spawn(play, &pos, &primColor, &envColor, this->dyna.actor.scale.y * 8000.0f, Rand_ZeroOne() * 65536.0f, 4, 1); } @@ -254,8 +254,8 @@ void func_809CB458(EnBrob* this, GlobalContext* globalCtx) { } } -void EnBrob_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBrob_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBrob* this = (EnBrob*)thisx; s32 i; s32 acHits[2]; @@ -277,7 +277,7 @@ void EnBrob_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->actionFunc == func_809CB114 && !(this->colliders[0].base.atFlags & AT_BOUNCED) && !(this->colliders[1].base.atFlags & AT_BOUNCED)) { - func_8002F71C(globalCtx, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); + func_8002F71C(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); } else if (this->actionFunc != func_809CB114) { func_809CB008(this); } @@ -287,22 +287,22 @@ void EnBrob_Update(Actor* thisx, GlobalContext* globalCtx2) { this->colliders[i].base.acFlags &= ~AC_HIT; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != func_809CB054 && this->actionFunc != func_809CB354) { if (this->actionFunc != func_809CB2B8) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliders[0].base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliders[1].base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliders[0].base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliders[1].base); if (this->actionFunc != func_809CB114) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliders[0].base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliders[1].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliders[0].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliders[1].base); } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[0].base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[1].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliders[0].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliders[1].base); } } -void EnBrob_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnBrob_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnBrob* this = (EnBrob*)thisx; MtxF mtx; @@ -318,11 +318,11 @@ void EnBrob_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void EnBrob_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBrob_Draw(Actor* thisx, PlayState* play) { EnBrob* this = (EnBrob*)thisx; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(0.0f, this->unk_1AE, 0.0f, MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnBrob_PostLimbDraw, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnBrob_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.h b/src/overlays/actors/ovl_En_Brob/z_en_brob.h index 4f71d489ef..2e54a46d89 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.h +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.h @@ -6,7 +6,7 @@ struct EnBrob; -typedef void (*EnBrobActionFunc)(struct EnBrob* this, GlobalContext* globalCtx); +typedef void (*EnBrobActionFunc)(struct EnBrob* this, PlayState* play); typedef struct EnBrob { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index 1aa084aadf..ce39e7d2a9 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -3,14 +3,14 @@ #define FLAGS ACTOR_FLAG_0 -void EnBubble_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBubble_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBubble_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBubble_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBubble_Init(Actor* thisx, PlayState* play); +void EnBubble_Destroy(Actor* thisx, PlayState* play); +void EnBubble_Update(Actor* thisx, PlayState* play); +void EnBubble_Draw(Actor* thisx, PlayState* play); -void EnBubble_Wait(EnBubble* this, GlobalContext* globalCtx); -void EnBubble_Pop(EnBubble* this, GlobalContext* globalCtx); -void EnBubble_Regrow(EnBubble* this, GlobalContext* globalCtx); +void EnBubble_Wait(EnBubble* this, PlayState* play); +void EnBubble_Pop(EnBubble* this, PlayState* play); +void EnBubble_Regrow(EnBubble* this, PlayState* play); const ActorInit En_Bubble_InitVars = { ACTOR_EN_BUBBLE, @@ -113,14 +113,14 @@ u32 func_809CBCEC(EnBubble* this) { return 12; } -void EnBubble_DamagePlayer(EnBubble* this, GlobalContext* globalCtx) { +void EnBubble_DamagePlayer(EnBubble* this, PlayState* play) { s32 damage = -this->colliderSphere.elements[0].info.toucher.damage; - globalCtx->damagePlayer(globalCtx, damage); - func_8002F7A0(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); + play->damagePlayer(play, damage); + func_8002F7A0(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); } -s32 EnBubble_Explosion(EnBubble* this, GlobalContext* globalCtx) { +s32 EnBubble_Explosion(EnBubble* this, PlayState* play) { u32 i; Vec3f effectAccel; Vec3f effectVel; @@ -143,10 +143,10 @@ s32 EnBubble_Explosion(EnBubble* this, GlobalContext* globalCtx) { effectVel.x = (Rand_ZeroOne() - 0.5f) * 7.0f; effectVel.y = Rand_ZeroOne() * 7.0f; effectVel.z = (Rand_ZeroOne() - 0.5f) * 7.0f; - EffectSsDtBubble_SpawnCustomColor(globalCtx, &effectPos, &effectVel, &effectAccel, &sEffectPrimColor, + EffectSsDtBubble_SpawnCustomColor(play, &effectPos, &effectVel, &effectAccel, &sEffectPrimColor, &sEffectEnvColor, Rand_S16Offset(100, 50), 0x19, 0); } - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x50); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x50); this->actor.flags &= ~ACTOR_FLAG_0; return Rand_S16Offset(90, 60); } @@ -196,7 +196,7 @@ void EnBubble_Vec3fNormalize(Vec3f* vec) { } } -void EnBubble_Fly(EnBubble* this, GlobalContext* globalCtx) { +void EnBubble_Fly(EnBubble* this, PlayState* play) { CollisionPoly* poly; Actor* bumpActor; Vec3f sp84; @@ -233,7 +233,7 @@ void EnBubble_Fly(EnBubble* this, GlobalContext* globalCtx) { sp6C.x += (sp54.x * 24.0f); sp6C.y += (sp54.y * 24.0f); sp6C.z += (sp54.z * 24.0f); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp78, &sp6C, &sp84, &poly, true, true, true, false, &bgId)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &sp78, &sp6C, &sp84, &poly, true, true, true, false, &bgId)) { sp60.x = COLPOLY_GET_NORMAL(poly->normal.x); sp60.y = COLPOLY_GET_NORMAL(poly->normal.y); sp60.z = COLPOLY_GET_NORMAL(poly->normal.z); @@ -298,13 +298,13 @@ u32 func_809CC648(EnBubble* this) { return true; } -u32 EnBubble_DetectPop(EnBubble* this, GlobalContext* globalCtx) { +u32 EnBubble_DetectPop(EnBubble* this, PlayState* play) { if (DECR(this->unk_208) != 0 || this->actionFunc == EnBubble_Pop) { return false; } if (this->colliderSphere.base.ocFlags2 & OC2_HIT_PLAYER) { this->colliderSphere.base.ocFlags2 &= ~OC2_HIT_PLAYER; - EnBubble_DamagePlayer(this, globalCtx); + EnBubble_DamagePlayer(this, play); this->unk_208 = 8; return true; } @@ -329,13 +329,13 @@ void func_809CC774(EnBubble* this) { this->colliderSphere.elements[1].dim = *dim; } -void EnBubble_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBubble_Init(Actor* thisx, PlayState* play) { EnBubble* this = (EnBubble*)thisx; u32 pad; ActorShape_Init(&this->actor.shape, 16.0f, ActorShadow_DrawCircle, 0.2f); - Collider_InitJntSph(globalCtx, &this->colliderSphere); - Collider_SetJntSph(globalCtx, &this->colliderSphere, &this->actor, &sJntSphInit, this->colliderSphereItems); + Collider_InitJntSph(play, &this->colliderSphere); + Collider_SetJntSph(play, &this->colliderSphere, &this->actor, &sJntSphInit, this->colliderSphereItems); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(9), &sColChkInfoInit2); this->actor.naviEnemyId = NAVI_ENEMY_SHABOM; this->bounceDirection.x = Rand_ZeroOne(); @@ -349,33 +349,33 @@ void EnBubble_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnBubble_Wait; } -void EnBubble_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBubble_Destroy(Actor* thisx, PlayState* play) { EnBubble* this = (EnBubble*)thisx; - Collider_DestroyJntSph(globalCtx, &this->colliderSphere); + Collider_DestroyJntSph(play, &this->colliderSphere); } -void EnBubble_Wait(EnBubble* this, GlobalContext* globalCtx) { - if (EnBubble_DetectPop(this, globalCtx)) { +void EnBubble_Wait(EnBubble* this, PlayState* play) { + if (EnBubble_DetectPop(this, play)) { this->explosionCountdown = func_809CBCBC(this); this->actionFunc = EnBubble_Pop; } else { - EnBubble_Fly(this, globalCtx); + EnBubble_Fly(this, play); this->actor.shape.yOffset = ((this->expansionHeight + 1.0f) * 16.0f); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); } } -void EnBubble_Pop(EnBubble* this, GlobalContext* globalCtx) { - if (EnBubble_Explosion(this, globalCtx) >= 0) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK); +void EnBubble_Pop(EnBubble* this, PlayState* play) { + if (EnBubble_Explosion(this, play) >= 0) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK); Actor_Kill(&this->actor); } } // unused -void EnBubble_Disappear(EnBubble* this, GlobalContext* globalCtx) { +void EnBubble_Disappear(EnBubble* this, PlayState* play) { s32 temp_v0; temp_v0 = func_809CBFD4(this); @@ -387,47 +387,47 @@ void EnBubble_Disappear(EnBubble* this, GlobalContext* globalCtx) { } // unused -void EnBubble_Regrow(EnBubble* this, GlobalContext* globalCtx) { +void EnBubble_Regrow(EnBubble* this, PlayState* play) { if (func_809CC020(this)) { this->actionFunc = EnBubble_Wait; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); } -void EnBubble_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBubble_Update(Actor* thisx, PlayState* play) { EnBubble* this = (EnBubble*)thisx; func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 16.0f, 16.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 16.0f, 16.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, this->actor.shape.yOffset); } -void EnBubble_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBubble_Draw(Actor* thisx, PlayState* play) { EnBubble* this = (EnBubble*)thisx; u32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bubble.c", 1175); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bubble.c", 1175); if (this->actionFunc != EnBubble_Disappear) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Math_SmoothStepToF(&this->graphicRotSpeed, 16.0f, 0.2f, 1000.0f, 0.0f); Math_SmoothStepToF(&this->graphicEccentricity, 0.08f, 0.2f, 1000.0f, 0.0f); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->expansionWidth + 1.0f, this->expansionHeight + 1.0f, 1.0f, MTXMODE_APPLY); - Matrix_RotateZ(DEG_TO_RAD((f32)globalCtx->state.frames) * this->graphicRotSpeed, MTXMODE_APPLY); + Matrix_RotateZ(DEG_TO_RAD((f32)play->state.frames) * this->graphicRotSpeed, MTXMODE_APPLY); Matrix_Scale(this->graphicEccentricity + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - Matrix_RotateZ(DEG_TO_RAD(-(f32)globalCtx->state.frames) * this->graphicRotSpeed, MTXMODE_APPLY); + Matrix_RotateZ(DEG_TO_RAD(-(f32)play->state.frames) * this->graphicRotSpeed, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bubble.c", 1220), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_bubble.c", 1220), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBubbleDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bubble.c", 1226); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bubble.c", 1226); if (this->actionFunc != EnBubble_Disappear) { this->actor.shape.shadowScale = (f32)((this->expansionWidth + 1.0f) * 0.2f); diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h index 37594d694a..938d1b2fd4 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h @@ -6,7 +6,7 @@ struct EnBubble; -typedef void (*EnBubbleActionFunc)(struct EnBubble*, GlobalContext*); +typedef void (*EnBubbleActionFunc)(struct EnBubble*, PlayState*); typedef struct EnBubble { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index e789e682d5..c2079e8a33 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -11,19 +11,19 @@ #define FLAGS 0 -void EnButte_Init(Actor* thisx, GlobalContext* globalCtx); -void EnButte_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnButte_Update(Actor* thisx, GlobalContext* globalCtx); -void EnButte_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnButte_Init(Actor* thisx, PlayState* play); +void EnButte_Destroy(Actor* thisx, PlayState* play); +void EnButte_Update(Actor* thisx, PlayState* play); +void EnButte_Draw(Actor* thisx, PlayState* play); void EnButte_SetupFlyAround(EnButte* this); -void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx); +void EnButte_FlyAround(EnButte* this, PlayState* play); void EnButte_SetupFollowLink(EnButte* this); -void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx); +void EnButte_FollowLink(EnButte* this, PlayState* play); void EnButte_SetupTransformIntoFairy(EnButte* this); -void EnButte_TransformIntoFairy(EnButte* this, GlobalContext* globalCtx); +void EnButte_TransformIntoFairy(EnButte* this, PlayState* play); void EnButte_SetupWaitToDie(EnButte* this); -void EnButte_WaitToDie(EnButte* this, GlobalContext* globalCtx); +void EnButte_WaitToDie(EnButte* this, PlayState* play); static ColliderJntSphElementInit sJntSphElementsInit[] = { { { @@ -108,20 +108,20 @@ void EnButte_UpdateTransformationEffect(void) { sTransformationEffectAlpha += 4000; } -void EnButte_DrawTransformationEffect(EnButte* this, GlobalContext* globalCtx) { +void EnButte_DrawTransformationEffect(EnButte* this, PlayState* play) { static Vec3f D_809CE3C4 = { 0.0f, 0.0f, -3.0f }; Vec3f sp5C; s32 alpha; Vec3s camDir; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_choo.c", 295); + OPEN_DISPS(play->state.gfxCtx, "../z_en_choo.c", 295); - func_80093C14(globalCtx->state.gfxCtx); + func_80093C14(play->state.gfxCtx); alpha = Math_SinS(sTransformationEffectAlpha) * 250; alpha = CLAMP(alpha, 0, 255); - Camera_GetCamDir(&camDir, GET_ACTIVE_CAM(globalCtx)); + Camera_GetCamDir(&camDir, GET_ACTIVE_CAM(play)); Matrix_RotateY(BINANG_TO_RAD(camDir.y), MTXMODE_NEW); Matrix_RotateX(BINANG_TO_RAD(camDir.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD(camDir.z), MTXMODE_APPLY); @@ -129,13 +129,13 @@ void EnButte_DrawTransformationEffect(EnButte* this, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(this->actor.focus.pos.x + sp5C.x, this->actor.focus.pos.y + sp5C.y, this->actor.focus.pos.z + sp5C.z, &camDir); Matrix_Scale(sTransformationEffectScale, sTransformationEffectScale, sTransformationEffectScale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_choo.c", 317), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_choo.c", 317), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 200, 200, 180, alpha); gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 210, 255); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffFlash1DL)); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_choo.c", 326); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_choo.c", 326); } static InitChainEntry sInitChain[] = { @@ -145,7 +145,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 600, ICHAIN_STOP), }; -void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnButte_Init(Actor* thisx, PlayState* play) { EnButte* this = (EnButte*)thisx; if (this->actor.params == -1) { @@ -158,10 +158,9 @@ void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.uncullZoneScale = 200.0f; } - SkelAnime_Init(globalCtx, &this->skelAnime, &gButterflySkel, &gButterflyAnim, this->jointTable, this->morphTable, - 8); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderInit, this->colliderItems); + SkelAnime_Init(play, &this->skelAnime, &gButterflySkel, &gButterflyAnim, this->jointTable, this->morphTable, 8); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, this->colliderItems); this->actor.colChkInfo.mass = 0; this->unk_25C = Rand_ZeroOne() * 0xFFFF; this->unk_25E = Rand_ZeroOne() * 0xFFFF; @@ -174,11 +173,11 @@ void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(field keep 蝶)(%x)(arg_data 0x%04x)\n", this, this->actor.params); } -void EnButte_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnButte_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnButte* this = (EnButte*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_809CD56C(EnButte* this) { @@ -212,10 +211,10 @@ void EnButte_SetupFlyAround(EnButte* this) { this->actionFunc = EnButte_FlyAround; } -void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) { +void EnButte_FlyAround(EnButte* this, PlayState* play) { EnButteFlightParams* flightParams = &sFlyAroundParams[this->flightParamsIdx]; s16 yaw; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 distSqFromHome; f32 maxDistSqFromHome; f32 minAnimSpeed; @@ -288,10 +287,10 @@ void EnButte_SetupFollowLink(EnButte* this) { this->actionFunc = EnButte_FollowLink; } -void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) { +void EnButte_FollowLink(EnButte* this, PlayState* play) { static s32 D_809CE410 = 1500; EnButteFlightParams* flightParams = &sFollowLinkParams[this->flightParamsIdx]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 distSqFromHome; Vec3f swordTip; f32 animSpeed; @@ -311,7 +310,7 @@ void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &swordTip) + (s16)(Rand_ZeroOne() * D_809CE410); if (Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 2000) != 0) { - if (globalCtx->gameplayFrames % 2) { + if (play->gameplayFrames % 2) { this->actor.world.rot.y += (s16)(sinf(this->unk_25C) * 60.0f); } } else { @@ -355,14 +354,14 @@ void EnButte_SetupTransformIntoFairy(EnButte* this) { this->actionFunc = EnButte_TransformIntoFairy; } -void EnButte_TransformIntoFairy(EnButte* this, GlobalContext* globalCtx) { +void EnButte_TransformIntoFairy(EnButte* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnButte_UpdateTransformationEffect(); if (this->timer == 5) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 60, NA_SE_EV_BUTTERFRY_TO_FAIRY); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EV_BUTTERFRY_TO_FAIRY); } else if (this->timer == 4) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.focus.pos.x, this->actor.focus.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.focus.pos.x, this->actor.focus.pos.y, this->actor.focus.pos.z, 0, this->actor.shape.rot.y, 0, FAIRY_HEAL_TIMED); this->drawSkelAnime = false; } else if (this->timer <= 0) { @@ -376,13 +375,13 @@ void EnButte_SetupWaitToDie(EnButte* this) { this->actor.draw = NULL; } -void EnButte_WaitToDie(EnButte* this, GlobalContext* globalCtx) { +void EnButte_WaitToDie(EnButte* this, PlayState* play) { if (this->timer <= 0) { Actor_Kill(&this->actor); } } -void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnButte_Update(Actor* thisx, PlayState* play) { EnButte* this = (EnButte*)thisx; if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (this->actor.child != &this->actor)) { @@ -398,7 +397,7 @@ void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_260 += 0x600; if ((this->actor.params & 1) == 1) { - if (GET_PLAYER(globalCtx)->meleeWeaponState == 0) { + if (GET_PLAYER(play)->meleeWeaponState == 0) { if (this->swordDownTimer > 0) { this->swordDownTimer--; } @@ -407,28 +406,28 @@ void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { Actor_MoveForward(&this->actor); Math_StepToF(&this->actor.world.pos.y, this->posYTarget, 0.6f); if (this->actor.xyzDistToPlayerSq < 5000.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, this->actor.shape.yOffset * this->actor.scale.y); } } -void EnButte_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnButte_Draw(Actor* thisx, PlayState* play) { EnButte* this = (EnButte*)thisx; if (this->drawSkelAnime) { - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); Collider_UpdateSpheres(0, &this->collider); } if (((this->actor.params & 1) == 1) && (this->actionFunc == EnButte_TransformIntoFairy)) { - EnButte_DrawTransformationEffect(this, globalCtx); + EnButte_DrawTransformationEffect(this, play); } } diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.h b/src/overlays/actors/ovl_En_Butte/z_en_butte.h index 9443e5081b..1a34747dbd 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.h +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.h @@ -6,7 +6,7 @@ struct EnButte; -typedef void (*EnButteActionFunc)(struct EnButte*, GlobalContext*); +typedef void (*EnButteActionFunc)(struct EnButte*, PlayState*); typedef struct EnButte { /* 0x0000 */ Actor actor; 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 75fc39f40d..898b0092a9 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -10,28 +10,28 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnBw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBw_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBw_Init(Actor* thisx, PlayState* play); +void EnBw_Destroy(Actor* thisx, PlayState* play); +void EnBw_Update(Actor* thisx, PlayState* play); +void EnBw_Draw(Actor* thisx, PlayState* play); -void func_809CE884(EnBw* this, GlobalContext* globalCtx); +void func_809CE884(EnBw* this, PlayState* play); void func_809CE9A8(EnBw* this); -void func_809CEA24(EnBw* this, GlobalContext* globalCtx); +void func_809CEA24(EnBw* this, PlayState* play); void func_809CF72C(EnBw* this); -void func_809CF7AC(EnBw* this, GlobalContext* globalCtx); +void func_809CF7AC(EnBw* this, PlayState* play); void func_809CF8F0(EnBw* this); -void func_809CF984(EnBw* this, GlobalContext* globalCtx); +void func_809CF984(EnBw* this, PlayState* play); void func_809CFBA8(EnBw* this); -void func_809CFC4C(EnBw* this, GlobalContext* globalCtx); +void func_809CFC4C(EnBw* this, PlayState* play); void func_809CFF10(EnBw* this); -void func_809CFF98(EnBw* this, GlobalContext* globalCtx); +void func_809CFF98(EnBw* this, PlayState* play); void func_809D00F4(EnBw* this); -void func_809D014C(EnBw* this, GlobalContext* globalCtx); +void func_809D014C(EnBw* this, PlayState* play); void func_809D01CC(EnBw* this); -void func_809D0268(EnBw* this, GlobalContext* globalCtx); +void func_809D0268(EnBw* this, PlayState* play); void func_809D03CC(EnBw* this); -void func_809D0424(EnBw* this, GlobalContext* globalCtx); +void func_809D0424(EnBw* this, PlayState* play); const ActorInit En_Bw_InitVars = { ACTOR_EN_BW, @@ -126,13 +126,13 @@ void EnBw_SetupAction(EnBw* this, EnBwActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBw_Init(Actor* thisx, PlayState* play) { EnBw* this = (EnBw*)thisx; Actor_SetScale(&this->actor, 0.012999999f); this->actor.naviEnemyId = NAVI_ENEMY_TORCH_SLUG; this->actor.gravity = -2.0f; - SkelAnime_Init(globalCtx, &this->skelAnime, &object_bw_Skel_0020F0, &object_bw_Anim_000228, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_bw_Skel_0020F0, &object_bw_Anim_000228, this->jointTable, this->morphTable, 12); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); this->actor.colChkInfo.damageTable = &sDamageTable; @@ -144,24 +144,24 @@ void EnBw_Init(Actor* thisx, GlobalContext* globalCtx) { this->color1.g = this->color1.b = 0; this->unk_248 = 0.6f; this->unk_221 = 3; - Collider_InitCylinder(globalCtx, &this->collider1); + Collider_InitCylinder(play, &this->collider1); //! this->collider2 should have Init called on it, but it doesn't matter since the heap is zeroed before use. - Collider_SetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit1); - Collider_SetCylinder(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); + Collider_SetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); + Collider_SetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); this->unk_236 = this->actor.world.rot.y; this->actor.params = sSlugGroup; sSlugGroup = (sSlugGroup + 1) & 3; } -void EnBw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBw_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnBw* this = (EnBw*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); } -void func_809CE884(EnBw* this, GlobalContext* globalCtx) { +void func_809CE884(EnBw* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); this->unk_222 -= 250; this->actor.scale.x = 0.013f + Math_SinF(this->unk_222 * 0.001f) * 0.0069999998f; @@ -182,7 +182,7 @@ void func_809CE9A8(EnBw* this) { EnBw_SetupAction(this, func_809CEA24); } -void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { +void func_809CEA24(EnBw* this, PlayState* play) { CollisionPoly* sp74 = NULL; Vec3f sp68; u32 sp64 = 0; @@ -190,8 +190,8 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { s16 sp60; f32 sp5C; f32 sp58; - Player* player = GET_PLAYER(globalCtx); - Player* player2 = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); + Player* player2 = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); this->unk_244 = this->unk_250 + 0.1f; @@ -221,9 +221,9 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { sp60 = ABS(sp58) * 85.0f; this->color1.g = sp60; } - if ((((globalCtx->gameplayFrames % 4) == (u32)this->actor.params) && (this->actor.speedXZ != 0.0f) && - (sp64 = BgCheck_AnyLineTest2(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_264, &sp68, &sp74, 1, 0, 0, - 1))) || + if ((((play->gameplayFrames % 4) == (u32)this->actor.params) && (this->actor.speedXZ != 0.0f) && + (sp64 = + BgCheck_AnyLineTest2(&play->colCtx, &this->actor.world.pos, &this->unk_264, &sp68, &sp74, 1, 0, 0, 1))) || (this->unk_222 == 0)) { if (sp74 != NULL) { sp74 = SEGMENTED_TO_VIRTUAL(sp74); @@ -232,10 +232,10 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { sp62 = this->actor.world.rot.y + 0x8000; } if ((this->unk_236 != sp62) || (sp64 == 0)) { - if (BgCheck_AnyLineTest2(&globalCtx->colCtx, &this->unk_270, &this->unk_288, &sp68, &sp74, 1, 0, 0, 1)) { + if (BgCheck_AnyLineTest2(&play->colCtx, &this->unk_270, &this->unk_288, &sp68, &sp74, 1, 0, 0, 1)) { sp64 |= 2; } - if (BgCheck_AnyLineTest2(&globalCtx->colCtx, &this->unk_270, &this->unk_27C, &sp68, &sp74, 1, 0, 0, 1)) { + if (BgCheck_AnyLineTest2(&play->colCtx, &this->unk_270, &this->unk_27C, &sp68, &sp74, 1, 0, 0, 1)) { sp64 |= 4; } switch (sp64) { @@ -243,7 +243,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { this->unk_236 += this->unk_238; case 1: if (this->unk_221 == 3) { - if (globalCtx->gameplayFrames & 2) { + if (play->gameplayFrames & 2) { this->unk_238 = 0x4000; } else { this->unk_238 = -0x4000; @@ -283,7 +283,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { sp64 = 1; this->unk_236 = this->actor.wallYaw; if (this->unk_221 == 3) { - if (globalCtx->gameplayFrames & 0x20) { + if (play->gameplayFrames & 0x20) { this->unk_238 = 0x4000; } else { this->unk_238 = -0x4000; @@ -301,8 +301,8 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { } } } else if (this->unk_221 == 0) { - sp64 = BgCheck_AnyLineTest2(&globalCtx->colCtx, &this->actor.world.pos, &player->actor.world.pos, &sp68, - &sp74, 1, 0, 0, 1); + sp64 = BgCheck_AnyLineTest2(&play->colCtx, &this->actor.world.pos, &player->actor.world.pos, &sp68, &sp74, + 1, 0, 0, 1); if (sp64 != 0) { sp74 = SEGMENTED_TO_VIRTUAL(sp74); sp60 = RAD_TO_BINANG(Math_FAtan2F(sp74->normal.x, sp74->normal.z)); @@ -321,8 +321,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { if (this->unk_224 != 0) { this->unk_224--; } - if ((this->unk_234 == 0) && - !Actor_TestFloorInDirection(&this->actor, globalCtx, 50.0f, this->unk_236 + this->unk_238)) { + if ((this->unk_234 == 0) && !Actor_TestFloorInDirection(&this->actor, play, 50.0f, this->unk_236 + this->unk_238)) { if (this->unk_238 != 0x4000) { this->unk_238 = 0x4000; } else { @@ -347,7 +346,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { this->actor.speedXZ * 1000.0f, 0); if ((this->actor.xzDistToPlayer < 90.0f) && (this->actor.yDistToPlayer < 50.0f) && Actor_IsFacingPlayer(&this->actor, 0x1554) && - Actor_TestFloorInDirection(&this->actor, globalCtx, 71.24802f, this->actor.yawTowardsPlayer)) { + Actor_TestFloorInDirection(&this->actor, play, 71.24802f, this->actor.yawTowardsPlayer)) { func_809CF8F0(this); } } else { @@ -402,7 +401,7 @@ void func_809CF72C(EnBw* this) { EnBw_SetupAction(this, func_809CF7AC); } -void func_809CF7AC(EnBw* this, GlobalContext* globalCtx) { +void func_809CF7AC(EnBw* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_222 > 0) { this->unk_222--; @@ -434,8 +433,8 @@ void func_809CF8F0(EnBw* this) { EnBw_SetupAction(this, func_809CF984); } -void func_809CF984(EnBw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809CF984(EnBw* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 floorPolyType; Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); @@ -453,12 +452,12 @@ void func_809CF984(EnBw* this, GlobalContext* globalCtx) { } SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { - floorPolyType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + floorPolyType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorPolyType == 2) || (floorPolyType == 3) || (floorPolyType == 9)) { Actor_Kill(&this->actor); return; } - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); this->unk_222 = 3000; this->actor.flags &= ~ACTOR_FLAG_24; this->actor.speedXZ = 0.0f; @@ -480,19 +479,19 @@ void func_809CFBA8(EnBw* this) { EnBw_SetupAction(this, func_809CFC4C); } -void func_809CFC4C(EnBw* this, GlobalContext* globalCtx) { +void func_809CFC4C(EnBw* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0x7FFF, 1, 0xFA0, 0); Math_SmoothStepToF(&this->unk_248, 0.0f, 1.0f, 0.05f, 0.0f); SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { - if ((globalCtx->gameplayFrames % 0x80) == 0) { + if ((play->gameplayFrames % 0x80) == 0) { this->unk_25C = (Rand_ZeroOne() * 0.25f) + 0.7f; } this->unk_221 = 4; this->unk_258 += this->unk_25C; Math_SmoothStepToF(&this->unk_260, 0.075f, 1.0f, 0.005f, 0.0f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } if (this->unk_224 != 0) { @@ -537,12 +536,12 @@ void func_809CFF10(EnBw* this) { EnBw_SetupAction(this, func_809CFF98); } -void func_809CFF98(EnBw* this, GlobalContext* globalCtx) { +void func_809CFF98(EnBw* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 0xFA0, 0); Math_SmoothStepToF(&this->unk_248, 0.6f, 1.0f, 0.05f, 0.0f); SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); this->unk_222 = 0xBB8; this->unk_250 = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); @@ -577,7 +576,7 @@ void func_809D00F4(EnBw* this) { EnBw_SetupAction(this, func_809D014C); } -void func_809D014C(EnBw* this, GlobalContext* globalCtx) { +void func_809D014C(EnBw* this, PlayState* play) { if (this->unk_230) { this->actor.scale.x += 0.0002f; this->actor.scale.y -= 0.0002f; @@ -602,7 +601,7 @@ void func_809D01CC(EnBw* this) { EnBw_SetupAction(this, func_809D0268); } -void func_809D0268(EnBw* this, GlobalContext* globalCtx) { +void func_809D0268(EnBw* this, PlayState* play) { this->color1.r -= 1; this->color1.g += 4; this->color1.b += 5; @@ -616,7 +615,7 @@ void func_809D0268(EnBw* this, GlobalContext* globalCtx) { this->color1.b = 230; } if (this->actor.colorFilterParams & 0x4000) { - if ((globalCtx->gameplayFrames % 0x80) == 0) { + if ((play->gameplayFrames % 0x80) == 0) { this->unk_25C = 0.5f + Rand_ZeroOne() * 0.25f; } this->unk_258 += this->unk_25C; @@ -644,7 +643,7 @@ void func_809D03CC(EnBw* this) { EnBw_SetupAction(this, func_809D0424); } -void func_809D0424(EnBw* this, GlobalContext* globalCtx) { +void func_809D0424(EnBw* this, PlayState* play) { if (this->actor.colorFilterTimer == 0) { this->unk_23C = 0; if (this->actor.colChkInfo.health != 0) { @@ -662,24 +661,24 @@ void func_809D0424(EnBw* this, GlobalContext* globalCtx) { func_809CFF10(this); } } else { - if (func_800355E4(globalCtx, &this->collider2.base)) { + if (func_800355E4(play, &this->collider2.base)) { this->unk_230 = 0; this->actor.scale.y -= 0.009f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); } else { this->unk_230 = 1; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); func_809D00F4(this); } } } -void func_809D0584(EnBw* this, GlobalContext* globalCtx) { +void func_809D0584(EnBw* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->unk_230 = 0; this->actor.scale.y -= 0.009f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); func_809D00F4(this); } else { if (this->collider2.base.acFlags & AC_HIT) { @@ -704,15 +703,15 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) { if (((this->unk_221 == 1) || (this->unk_221 == 4)) && (this->actor.colChkInfo.health == 0)) { if (this->unk_220 != 0) { Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); - if (func_800355E4(globalCtx, &this->collider2.base)) { + if (func_800355E4(play, &this->collider2.base)) { this->unk_230 = 0; this->actor.scale.y -= 0.009f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); } else { this->unk_230 = 1; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); func_809D00F4(this); } } else if ((this->unk_220 != 1) && (this->unk_220 != 6)) { @@ -724,7 +723,7 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) { this->unk_248 = 0.0f; } } - if ((globalCtx->actorCtx.unk_02 != 0) && (this->actor.xzDistToPlayer <= 400.0f) && + if ((play->actorCtx.unk_02 != 0) && (this->actor.xzDistToPlayer <= 400.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->unk_220 == 5) { this->unk_23C = 0; @@ -737,8 +736,8 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) { } } -void EnBw_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBw_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBw* this = (EnBw*)thisx; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -748,24 +747,24 @@ void EnBw_Update(Actor* thisx, GlobalContext* globalCtx2) { Color_RGBA8 sp48 = { 0, 0, 0, 255 }; Color_RGBA8 sp44 = { 0, 0, 0, 220 }; - func_809D0584(this, globalCtx); + func_809D0584(this, play); if (thisx->colChkInfo.damageEffect != 6) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_23C == 0) { this->unk_23A = (this->unk_23A + 4) & 0x7F; } - if ((globalCtx->gameplayFrames & this->unk_221) == 0) { + if ((play->gameplayFrames & this->unk_221) == 0) { accel.y = -3.0f; velocity.x = Rand_CenteredFloat(this->unk_248 * 24.0f); velocity.y = this->unk_248 * 30.0f; velocity.z = Rand_CenteredFloat(this->unk_248 * 24.0f); accel.x = velocity.x * -0.075f; accel.z = velocity.z * -0.075f; - func_8002836C(globalCtx, &thisx->world.pos, &velocity, &accel, &sp50, &sp4C, 0x3C, 0, 0x14); + func_8002836C(play, &thisx->world.pos, &velocity, &accel, &sp50, &sp4C, 0x3C, 0, 0x14); } if (this->unk_248 <= 0.4f) { this->collider1.info.toucher.effect = 0; - if (((globalCtx->gameplayFrames & 1) == 0) && (this->unk_220 < 5) && (this->unk_23C == 0)) { + if (((play->gameplayFrames & 1) == 0) && (this->unk_220 < 5) && (this->unk_23C == 0)) { accel.y = -0.1f; velocity.x = Rand_CenteredFloat(4.0f); velocity.y = Rand_CenteredFloat(2.0f) + 6.0f; @@ -780,42 +779,41 @@ void EnBw_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { sp44.a = 0; } - func_8002836C(globalCtx, &thisx->world.pos, &velocity, &accel, &sp48, &sp44, 0xB4, 0x28, + func_8002836C(play, &thisx->world.pos, &velocity, &accel, &sp48, &sp44, 0xB4, 0x28, 20.0f - (this->unk_248 * 40.0f)); } } else { this->collider1.info.toucher.effect = 1; } - this->unk_234 = Actor_TestFloorInDirection(thisx, globalCtx, 50.0f, thisx->world.rot.y); + this->unk_234 = Actor_TestFloorInDirection(thisx, play, 50.0f, thisx->world.rot.y); if ((this->unk_220 == 4) || (this->unk_220 == 6) || (this->unk_220 == 5) || (this->unk_220 == 1) || (this->unk_234 != 0)) { Actor_MoveForward(thisx); } - Actor_UpdateBgCheckInfo(globalCtx, thisx, 20.0f, 30.0f, 21.0f, + Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 30.0f, 21.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } Collider_UpdateCylinder(thisx, &this->collider2); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); if ((this->unk_220 != 0) && ((thisx->colorFilterTimer == 0) || !(thisx->colorFilterParams & 0x4000))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); } if ((this->unk_221 != 1) && (this->unk_220 < 5) && (this->unk_248 > 0.4f)) { Collider_UpdateCylinder(thisx, &this->collider1); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); } thisx->focus.pos = thisx->world.pos; thisx->focus.pos.y += 5.0f; } -s32 EnBw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { +s32 EnBw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnBw* this = (EnBw*)thisx; if (limbIndex == 1) { gSPSegment((*gfx)++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, this->unk_23A, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, 0, this->unk_23A, 0x20, 0x20)); if ((this->unk_220 == 1) || (this->unk_220 == 5)) { Matrix_Push(); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); @@ -826,7 +824,7 @@ s32 EnBw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Matrix_RotateZ(-(this->unk_258 * 0.1f), MTXMODE_APPLY); Matrix_RotateY(-(this->unk_258 * 0.13f), MTXMODE_APPLY); Matrix_RotateX(-(this->unk_258 * 0.115f), MTXMODE_APPLY); - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bw.c", 1388), + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_bw.c", 1388), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, *dList); Matrix_Pop(); @@ -841,32 +839,32 @@ static Vec3f sIceOffsets[] = { { 10.0f, 0.0f, -15.0f }, { 0.0f, 10.0f, 25.0f }, { -10.0f, 0.0f, 15.0f }, { -10.0f, 0.0f, -15.0f }, }; -void EnBw_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnBw_Draw(Actor* thisx, PlayState* play2) { Vec3f spAC = { 0.0f, 0.0f, 0.0f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnBw* this = (EnBw*)thisx; Vec3f icePos; s32 iceIndex; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bw.c", 1423); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bw.c", 1423); if (this->color1.a == 0xFF) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, this->color1.r, this->color1.g, this->color1.b, this->color1.a); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBw_OverrideLimbDraw, NULL, this, POLY_OPA_DISP); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 0, 0, 0, this->color1.a); gDPSetEnvColor(POLY_XLU_DISP++, this->color1.r, this->color1.g, this->color1.b, this->color1.a); gSPSegment(POLY_XLU_DISP++, 0x08, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBw_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); } - if (((globalCtx->gameplayFrames + 1) % 4) == (u32)thisx->params) { + if (((play->gameplayFrames + 1) % 4) == (u32)thisx->params) { spAC.z = thisx->scale.z * 375000.0f; Matrix_MultVec3f(&spAC, &this->unk_264); spAC.z = thisx->scale.z * 150000.0f; @@ -879,16 +877,16 @@ void EnBw_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y + ((thisx->scale.y - 0.013f) * 1000.0f), thisx->world.pos.z, MTXMODE_NEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - (globalCtx->gameplayFrames * -20) % 0x200, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (play->gameplayFrames * -20) % 0x200, + 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); Matrix_Scale(this->unk_248 * 0.01f, this->unk_248 * 0.01f, this->unk_248 * 0.01f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bw.c", 1500), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_bw.c", 1500), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); @@ -901,8 +899,8 @@ void EnBw_Draw(Actor* thisx, GlobalContext* globalCtx2) { icePos.x = sIceOffsets[iceIndex].x + thisx->world.pos.x; icePos.y = sIceOffsets[iceIndex].y + thisx->world.pos.y; icePos.z = sIceOffsets[iceIndex].z + thisx->world.pos.z; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, thisx, &icePos, 0x96, 0x96, 0x96, 0xFA, 0xEB, 0xF5, 0xFF, 1.3f); + EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &icePos, 0x96, 0x96, 0x96, 0xFA, 0xEB, 0xF5, 0xFF, 1.3f); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bw.c", 1521); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bw.c", 1521); } diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.h b/src/overlays/actors/ovl_En_Bw/z_en_bw.h index 3f0ae5ea9f..ffdc3bba4e 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.h +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.h @@ -5,7 +5,7 @@ #include "global.h" struct EnBw; -typedef void (*EnBwActionFunc)(struct EnBw*, GlobalContext*); +typedef void (*EnBwActionFunc)(struct EnBw*, PlayState*); typedef struct EnBw { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index be68336464..858a85053c 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -9,10 +9,10 @@ #define FLAGS ACTOR_FLAG_4 -void EnBx_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBx_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBx_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBx_Init(Actor* thisx, PlayState* play); +void EnBx_Destroy(Actor* thisx, PlayState* play); +void EnBx_Update(Actor* thisx, PlayState* play); +void EnBx_Draw(Actor* thisx, PlayState* play); const ActorInit En_Bx_InitVars = { ACTOR_EN_BX, @@ -66,7 +66,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 } } }, }; -void EnBx_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBx_Init(Actor* thisx, PlayState* play) { EnBx* this = (EnBx*)thisx; Vec3f sp48 = { 0.015f, 0.015f, 0.015f }; Vec3f sp3C = { 0.0f, 0.0f, 0.0f }; @@ -91,26 +91,26 @@ void EnBx_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 48.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - Collider_InitQuad(globalCtx, &this->colliderQuad); - Collider_SetQuad(globalCtx, &this->colliderQuad, &this->actor, &sQuadInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + Collider_InitQuad(play, &this->colliderQuad); + Collider_SetQuad(play, &this->colliderQuad, &this->actor, &sQuadInit); thisx->colChkInfo.mass = MASS_IMMOVABLE; this->unk_14C = 0; thisx->uncullZoneDownward = 2000.0f; - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0xFF)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0xFF)) { Actor_Kill(&this->actor); } thisx->params &= 0xFF; } -void EnBx_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBx_Destroy(Actor* thisx, PlayState* play) { EnBx* this = (EnBx*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_809D1D0C(Actor* thisx, GlobalContext* globalCtx) { +void func_809D1D0C(Actor* thisx, PlayState* play) { Vec3f sp5C = { 8000.0f, 15000.0f, 2500.0f }; Vec3f sp50 = { 8000.0f, 10000.0f, 2500.0f }; static Vec3f D_809D2540 = { -8000.0f, 15000.0f, 2500.0f }; @@ -127,9 +127,9 @@ void func_809D1D0C(Actor* thisx, GlobalContext* globalCtx) { &this->colliderQuad.dim.quad[1]); } -void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBx_Update(Actor* thisx, PlayState* play) { EnBx* this = (EnBx*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; s16 tmp32; s32 tmp33; @@ -149,10 +149,10 @@ void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -4); + play->damagePlayer(play, -4); } } - func_8002F71C(globalCtx, &this->actor, 6.0f, tmp32, 6.0f); + func_8002F71C(play, &this->actor, 6.0f, tmp32, 6.0f); player->invincibilityTimer = tmp33; } @@ -179,7 +179,7 @@ void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(5.0f) + thisx->world.pos.x; pos.y = Rand_CenteredFloat(30.0f) + thisx->world.pos.y + 170.0f; pos.z = Rand_CenteredFloat(5.0f) + thisx->world.pos.z; - EffectSsLightning_Spawn(globalCtx, &pos, &primColor, &envColor, 230, yaw, 6, 0); + EffectSsLightning_Spawn(play, &pos, &primColor, &envColor, 230, yaw, 6, 0); } } @@ -187,14 +187,14 @@ void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) { } thisx->focus.pos = thisx->world.pos; Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); if (thisx->params & 0x80) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderQuad.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderQuad.base); } } -void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBx_Draw(Actor* thisx, PlayState* play) { static void* D_809D2560[] = { object_bxa_Tex_0024F0, object_bxa_Tex_0027F0, @@ -202,23 +202,22 @@ void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnBx* this = (EnBx*)thisx; s32 pad; - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Mtx)); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, 4 * sizeof(Mtx)); s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bx.c", 464); + OPEN_DISPS(play->state.gfxCtx, "../z_en_bx.c", 464); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0C, mtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809D2560[this->actor.params & 0x7F])); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, (globalCtx->gameplayFrames * -10) % 128, - 32, 32)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bx.c", 478), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, (play->gameplayFrames * -10) % 128, 32, 32)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_bx.c", 478), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params & 0x80) { - func_809D1D0C(&this->actor, globalCtx); + func_809D1D0C(&this->actor, play); } this->unk_14E -= 0xBB8; @@ -242,5 +241,5 @@ void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, object_bxa_DL_0022F0); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bx.c", 511); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bx.c", 511); } 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 8dae6cc2ac..68366f8d36 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -16,13 +16,13 @@ typedef enum { /* 1 */ CHEST_RIGHT } ChangerChestSide; -void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx); -void EnChanger_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnChanger_Update(Actor* thisx, GlobalContext* globalCtx); +void EnChanger_Init(Actor* thisx, PlayState* play); +void EnChanger_Destroy(Actor* thisx, PlayState* play); +void EnChanger_Update(Actor* thisx, PlayState* play); -void EnChanger_Wait(EnChanger* this, GlobalContext* globalCtx); -void EnChanger_OpenChests(EnChanger* this, GlobalContext* globalCtx); -void EnChanger_SetHeartPieceFlag(EnChanger* this, GlobalContext* globalCtx); +void EnChanger_Wait(EnChanger* this, PlayState* play); +void EnChanger_OpenChests(EnChanger* this, PlayState* play); +void EnChanger_SetHeartPieceFlag(EnChanger* this, PlayState* play); const ActorInit En_Changer_InitVars = { ACTOR_EN_CHANGER, @@ -61,12 +61,12 @@ static s32 sItemEtcTypes[] = { static s32 sTreasureFlags[] = { 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000A }; -void EnChanger_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnChanger_Destroy(Actor* thisx, PlayState* play) { } -void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnChanger_Init(Actor* thisx, PlayState* play2) { EnChanger* this = (EnChanger*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s16 leftChestParams; s16 rightChestParams; s16 rewardChestParams; @@ -79,19 +79,19 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { if (1) {} - minigameRoomNum = globalCtx->roomCtx.curRoom.num - 1; + minigameRoomNum = play->roomCtx.curRoom.num - 1; if (minigameRoomNum < 0) { minigameRoomNum = 0; } - if (Flags_GetTreasure(globalCtx, sTreasureFlags[minigameRoomNum])) { + if (Flags_GetTreasure(play, sTreasureFlags[minigameRoomNum])) { this->roomChestsOpened = true; } osSyncPrintf("\n\n"); // "Treasure generation (which room is it?)" - osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 宝発生(部屋はどれ?) %d\n" VT_RST, globalCtx->roomCtx.curRoom.num); + osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 宝発生(部屋はどれ?) %d\n" VT_RST, play->roomCtx.curRoom.num); // "How is the Bit?" - osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ビットは? \t %x\n" VT_RST, globalCtx->actorCtx.flags.chest); + osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ビットは? \t %x\n" VT_RST, play->actorCtx.flags.chest); // "How is the Save BIT?" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ セーブBITは? %x\n" VT_RST, sTreasureFlags[minigameRoomNum]); // "Is it already a zombie?" @@ -100,21 +100,21 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { minigameRoomNum *= 2; // Spawn Heart Piece in chest (or Purple Rupee if won Heart Piece) - if (globalCtx->roomCtx.curRoom.num >= 6) { + if (play->roomCtx.curRoom.num >= 6) { rewardChestParams = GET_ITEMGETINF(ITEMGETINF_1B) ? 0x4EA0 : 0x4EC0; rewardChestParams = sTreasureFlags[5] | rewardChestParams; - this->finalChest = (EnBox*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BOX, - 20.0f, 20.0f, -2500.0f, 0, 0x7FFF, 0, 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(globalCtx, rewardChestParams & 0x1F); + Flags_SetTreasure(play, rewardChestParams & 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(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_ETCETERA, 20.0f, 20.0f, -2500.0f, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, 20.0f, 20.0f, -2500.0f, 0, 0, 0, ((sTreasureFlags[5] & 0x1F) << 8) + rewardParams); // "Central treasure instance/occurrence (GREAT)" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 中央宝発生(GREAT) ☆☆☆☆☆ %x\n" VT_RST, rewardChestParams); @@ -126,11 +126,11 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { temp_v1_3 = minigameRoomNum; // Set up items in chests, swap them round with probability 1/2 - leftChestParams = (sLoserGetItemIds[globalCtx->roomCtx.curRoom.num] << 5) | 0x4000; + leftChestParams = (sLoserGetItemIds[play->roomCtx.curRoom.num] << 5) | 0x4000; new_var = temp_v1_3; this->leftChestNum = new_var; - this->leftChestGetItemId = sLoserGetItemIds[globalCtx->roomCtx.curRoom.num]; - leftChestItem = sItemEtcTypes[globalCtx->roomCtx.curRoom.num]; + this->leftChestGetItemId = sLoserGetItemIds[play->roomCtx.curRoom.num]; + leftChestItem = sItemEtcTypes[play->roomCtx.curRoom.num]; leftChestParams |= new_var; rightChestParams = new_var | 0x4E21; this->rightChestNum = new_var | 1; @@ -138,10 +138,10 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { rightChestItem = ITEM_ETC_KEY_SMALL_CHEST_GAME; if (Rand_ZeroFloat(1.99f) < 1.0f) { - rightChestParams = (sLoserGetItemIds[globalCtx->roomCtx.curRoom.num] << 5) | 0x4000; + rightChestParams = (sLoserGetItemIds[play->roomCtx.curRoom.num] << 5) | 0x4000; this->rightChestNum = new_var; - this->rightChestGetItemId = sLoserGetItemIds[globalCtx->roomCtx.curRoom.num]; - rightChestItem = sItemEtcTypes[globalCtx->roomCtx.curRoom.num]; + this->rightChestGetItemId = sLoserGetItemIds[play->roomCtx.curRoom.num]; + rightChestItem = sItemEtcTypes[play->roomCtx.curRoom.num]; leftChestParams = new_var | 0x4E21; rightChestParams |= new_var; this->leftChestNum = temp_v1_3 | 1; @@ -150,40 +150,39 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { } this->leftChest = (EnBox*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BOX, sLeftChestPos[globalCtx->roomCtx.curRoom.num].x, - sLeftChestPos[globalCtx->roomCtx.curRoom.num].y, sLeftChestPos[globalCtx->roomCtx.curRoom.num].z, 0, -0x3FFF, 0, + &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) { // "Left treasure generation (what does it contain?)" osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 左宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n" VT_RST, leftChestParams); // "What is the room number?" - osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 部屋番号は? %x\n" VT_RST, globalCtx->roomCtx.curRoom.num); + osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 部屋番号は? %x\n" VT_RST, play->roomCtx.curRoom.num); // "What is the bit?" osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ ビットはなぁに? %x\n" VT_RST, this->rightChestNum); // "Sukesuke-kun" (something to do with being invisible) osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ すけすけ君? %x\n" VT_RST, rightChestItem); osSyncPrintf("\n\n"); if (this->roomChestsOpened) { - Flags_SetTreasure(globalCtx, this->leftChestNum & 0x1F); + Flags_SetTreasure(play, this->leftChestNum & 0x1F); } else { - Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_ITEM_ETCETERA, sLeftChestPos[globalCtx->roomCtx.curRoom.num].x, - sLeftChestPos[globalCtx->roomCtx.curRoom.num].y, sLeftChestPos[globalCtx->roomCtx.curRoom.num].z, 0, 0, - 0, ((this->leftChestNum & 0x1F) << 8) + (leftChestItem & 0xFF)); + 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)); } } this->rightChest = (EnBox*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BOX, sRightChestPos[globalCtx->roomCtx.curRoom.num].x, - sRightChestPos[globalCtx->roomCtx.curRoom.num].y, sRightChestPos[globalCtx->roomCtx.curRoom.num].z, 0, 0x3FFF, - 0, rightChestParams); + &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) { // "Right treasure generation (what does it contain?)" osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 右宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n" VT_RST, rightChestParams); // "What is the room number?" - osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 部屋番号は? %d\n" VT_RST, globalCtx->roomCtx.curRoom.num); + osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 部屋番号は? %d\n" VT_RST, play->roomCtx.curRoom.num); // "What is the bit?" osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ ビットはなぁに? %x\n" VT_RST, this->leftChestNum); // "Sukesuke-kun" (something to do with being invisible) @@ -191,14 +190,13 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { osSyncPrintf("\n\n"); if (this->roomChestsOpened) { - Flags_SetTreasure(globalCtx, this->rightChestNum & 0x1F); + Flags_SetTreasure(play, this->rightChestNum & 0x1F); Actor_Kill(&this->actor); return; } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_ETCETERA, - sRightChestPos[globalCtx->roomCtx.curRoom.num].x, sRightChestPos[globalCtx->roomCtx.curRoom.num].y, - sRightChestPos[globalCtx->roomCtx.curRoom.num].z, 0, 0, 0, + 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)); } @@ -206,21 +204,21 @@ void EnChanger_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc = EnChanger_Wait; } -void EnChanger_Wait(EnChanger* this, GlobalContext* globalCtx) { +void EnChanger_Wait(EnChanger* this, PlayState* play) { if (this->leftChest->unk_1F4 != 0) { this->timer = 80; - Flags_SetTreasure(globalCtx, this->rightChestNum & 0x1F); + Flags_SetTreasure(play, this->rightChestNum & 0x1F); this->actionFunc = EnChanger_OpenChests; } else if (this->rightChest->unk_1F4 != 0) { this->chestOpened = CHEST_RIGHT; this->timer = 80; - Flags_SetTreasure(globalCtx, this->leftChestNum & 0x1F); + Flags_SetTreasure(play, this->leftChestNum & 0x1F); this->actionFunc = EnChanger_OpenChests; } } // Spawns the EnExItem showing what was in the other chest -void EnChanger_OpenChests(EnChanger* this, GlobalContext* globalCtx) { +void EnChanger_OpenChests(EnChanger* this, PlayState* play) { f32 zPos; f32 yPos; f32 xPos; @@ -242,14 +240,13 @@ void EnChanger_OpenChests(EnChanger* this, GlobalContext* globalCtx) { zPos = right->dyna.actor.world.pos.z; if (this->rightChestGetItemId == GI_DOOR_KEY) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, 0xF); - Flags_SetSwitch(globalCtx, 0x32); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, 0xF); + Flags_SetSwitch(play, 0x32); } else { temp_s0_2 = (s16)(this->rightChestGetItemId - GI_RUPEE_GREEN_LOSE) + EXITEM_CHEST; // "Open right treasure (chest)" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 右宝開く ☆☆☆☆☆ %d\n" VT_RST, temp_s0_2); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, - temp_s0_2); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, temp_s0_2); } break; case CHEST_RIGHT: @@ -258,14 +255,13 @@ void EnChanger_OpenChests(EnChanger* this, GlobalContext* globalCtx) { zPos = left->dyna.actor.world.pos.z; if (this->leftChestGetItemId == GI_DOOR_KEY) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, 0xF); - Flags_SetSwitch(globalCtx, 0x32); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, 0xF); + Flags_SetSwitch(play, 0x32); } else { temp_s0_2 = (s16)(this->leftChestGetItemId - 0x72) + 0xA; // "Open left treasure (chest)" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 左宝開く ☆☆☆☆☆ %d\n" VT_RST, temp_s0_2); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, - temp_s0_2); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, temp_s0_2); } break; } @@ -274,7 +270,7 @@ void EnChanger_OpenChests(EnChanger* this, GlobalContext* globalCtx) { } } -void EnChanger_SetHeartPieceFlag(EnChanger* this, GlobalContext* globalCtx) { +void EnChanger_SetHeartPieceFlag(EnChanger* this, PlayState* play) { if (this->finalChest->unk_1F4 != 0) { if (!GET_ITEMGETINF(ITEMGETINF_1B)) { SET_ITEMGETINF(ITEMGETINF_1B); @@ -283,10 +279,10 @@ void EnChanger_SetHeartPieceFlag(EnChanger* this, GlobalContext* globalCtx) { } } -void EnChanger_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnChanger_Update(Actor* thisx, PlayState* play) { EnChanger* this = (EnChanger*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->timer != 0) { this->timer--; @@ -295,6 +291,6 @@ void EnChanger_Update(Actor* thisx, GlobalContext* globalCtx) { if (BREG(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, globalCtx->state.gfxCtx); + 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 6b5560e565..b5209109ef 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.h +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.h @@ -7,7 +7,7 @@ struct EnChanger; -typedef void (*EnChangerActionFunc)(struct EnChanger*, GlobalContext*); +typedef void (*EnChangerActionFunc)(struct EnChanger*, PlayState*); typedef struct EnChanger { /* 0x0000 */ Actor actor; 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 dd1351aa34..43ad89bdda 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 @@ -2,20 +2,19 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnClearTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx); -void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnClearTag_Init(Actor* thisx, PlayState* play); +void EnClearTag_Destroy(Actor* thisx, PlayState* play); +void EnClearTag_Update(Actor* thisx, PlayState* play); +void EnClearTag_Draw(Actor* thisx, PlayState* play); -void EnClearTag_UpdateEffects(GlobalContext* globalCtx); -void EnClearTag_DrawEffects(GlobalContext* globalCtx); +void EnClearTag_UpdateEffects(PlayState* play); +void EnClearTag_DrawEffects(PlayState* play); -void EnClearTag_CreateDebrisEffect(GlobalContext* globalCtx, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, - f32 scale, f32 floorHeight); -void EnClearTag_CreateFireEffect(GlobalContext* globalCtx, Vec3f* pos, f32 scale); -void EnClearTag_CreateSmokeEffect(GlobalContext* globalCtx, Vec3f* position, f32 scale); -void EnClearTag_CreateFlashEffect(GlobalContext* globalCtx, Vec3f* position, f32 scale, f32 floorHeight, - Vec3f* floorTangent); +void EnClearTag_CreateDebrisEffect(PlayState* play, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, + f32 floorHeight); +void EnClearTag_CreateFireEffect(PlayState* play, Vec3f* pos, f32 scale); +void EnClearTag_CreateSmokeEffect(PlayState* play, Vec3f* position, f32 scale); +void EnClearTag_CreateFlashEffect(PlayState* play, Vec3f* position, f32 scale, f32 floorHeight, Vec3f* floorTangent); void EnClearTag_CalculateFloorTangent(EnClearTag* this); @@ -86,10 +85,10 @@ static EnClearTagEffect sEffects[CLEAR_TAG_EFFECT_COUNT]; * Creates a debris effect. * Debris effects are spawned when the Arwing dies. It spawns fire effects. */ -void EnClearTag_CreateDebrisEffect(GlobalContext* globalCtx, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, - f32 scale, f32 floorHeight) { +void EnClearTag_CreateDebrisEffect(PlayState* play, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, + f32 floorHeight) { s16 i; - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; // Look for an available effect to allocate a Debris effect to. for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) { @@ -121,9 +120,9 @@ void EnClearTag_CreateDebrisEffect(GlobalContext* globalCtx, Vec3f* position, Ve * Creates a fire effect. * Fire effects are spawned by debris effects. Fire effects spawn smoke effects */ -void EnClearTag_CreateFireEffect(GlobalContext* globalCtx, Vec3f* pos, f32 scale) { +void EnClearTag_CreateFireEffect(PlayState* play, Vec3f* pos, f32 scale) { s16 i; - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; // Look for an available effect to allocate a fire effect to. for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) { @@ -149,9 +148,9 @@ void EnClearTag_CreateFireEffect(GlobalContext* globalCtx, Vec3f* pos, f32 scale * Creates a smoke effect. * Smoke effects are spawned by fire effects. */ -void EnClearTag_CreateSmokeEffect(GlobalContext* globalCtx, Vec3f* position, f32 scale) { +void EnClearTag_CreateSmokeEffect(PlayState* play, Vec3f* position, f32 scale) { s16 i; - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; // Look for an available effect to allocate a smoke effect to. for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) { @@ -184,10 +183,9 @@ void EnClearTag_CreateSmokeEffect(GlobalContext* globalCtx, Vec3f* position, f32 * Flash effects are spawned when the Arwing dies. * Flash effects two components: 1) a billboard flash, and 2) a light effect on the ground. */ -void EnClearTag_CreateFlashEffect(GlobalContext* globalCtx, Vec3f* position, f32 scale, f32 floorHeight, - Vec3f* floorTangent) { +void EnClearTag_CreateFlashEffect(PlayState* play, Vec3f* position, f32 scale, f32 floorHeight, Vec3f* floorTangent) { s16 i; - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; // Look for an available effect to allocate a flash effect to. for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) { @@ -215,23 +213,23 @@ void EnClearTag_CreateFlashEffect(GlobalContext* globalCtx, Vec3f* position, f32 * EnClear_Tag destructor. * This just destroys the collider. */ -void EnClearTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnClearTag_Destroy(Actor* thisx, PlayState* play) { EnClearTag* this = (EnClearTag*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } /** * EnClear_Tag constructor. * This allocates a collider, initializes effects, and sets up ClearTag instance data. */ -void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnClearTag_Init(Actor* thisx, PlayState* play) { EnClearTag* this = (EnClearTag*)thisx; s32 defaultCutsceneTimer = 100; s16 i; s16 j; - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); // Initialize the Arwing laser. if (this->actor.params == CLEAR_TAG_LASER) { @@ -249,12 +247,12 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.x = -this->actor.shape.rot.x; func_8002D908(&this->actor); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sLaserCylinderInit); + Collider_SetCylinder(play, &this->collider, &this->actor, &sLaserCylinderInit); Audio_PlayActorSound2(&this->actor, NA_SE_IT_SWORD_REFLECT_MG); } else { // Initialize the Arwing. this->actor.flags |= ACTOR_FLAG_0; this->actor.targetMode = 5; - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sArwingCylinderInit); + Collider_SetCylinder(play, &this->collider, &this->actor, &sArwingCylinderInit); this->actor.colChkInfo.health = 3; // Update the Arwing to play the intro cutscene. @@ -271,7 +269,7 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { // Initialize all effects to available if effects have not been initialized. if (!sIsEffectsInitialized) { sIsEffectsInitialized = true; - globalCtx->specialEffects = sEffects; + play->specialEffects = sEffects; for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++) { sEffects[i].type = CLEAR_TAG_EFFECT_AVAILABLE; } @@ -310,14 +308,14 @@ void EnClearTag_CalculateFloorTangent(EnClearTag* this) { * This function controls the cutscene that plays when the Arwing has params for * cutscene. The cutscene stops playing when the Arwing is a specified distance from the starting point. */ -void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnClearTag_Update(Actor* thisx, PlayState* play2) { u8 hasAtHit = false; s16 i; s16 xRotationTarget; s16 rotationScale; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnClearTag* this = (EnClearTag*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->frameCounter++; @@ -486,7 +484,7 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { // Fire the Arwing laser. if (this->shouldShootLaser) { this->shouldShootLaser = false; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, 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, CLEAR_TAG_STATE_LASER); } @@ -507,18 +505,18 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { this->collider.dim.yShift = -5; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); if (this->timers[CLEAR_TAG_TIMER_ARWING_UPDATE_BG_INFO] == 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 30.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 30.0f, 100.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); EnClearTag_CalculateFloorTangent(this); } if (this->state == CLEAR_TAG_STATE_CRASHING) { // Create fire effects while the Arwing crashes. - EnClearTag_CreateFireEffect(globalCtx, &this->actor.world.pos, 1.0f); + EnClearTag_CreateFireEffect(play, &this->actor.world.pos, 1.0f); // Causes the Arwing to roll around seemingly randomly while crashing. this->roll -= 0.5f; @@ -555,8 +553,8 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { this->collider.dim.height = 25; this->collider.dim.yShift = -10; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 80.0f, 100.0f, + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 80.0f, 100.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); // Check if the laser has hit a target, timed out, or hit the ground or a wall. @@ -566,7 +564,7 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_Kill(&this->actor); // Player laser sound effect if the laser did not time out. if (this->timers[CLEAR_TAG_TIMER_LASER_DEATH] != 0) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_FANTOM_THUNDER_GND); } } @@ -589,10 +587,10 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { case CLEAR_TAG_CUTSCENE_MODE_SETUP: // Initializes Arwing cutscene camera data. this->cutsceneMode = CLEAR_TAG_CUTSCENE_MODE_PLAY; - func_80064520(globalCtx, &globalCtx->csCtx); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); case CLEAR_TAG_CUTSCENE_MODE_PLAY: // Update the Arwing cutscene camera to spin around in a circle. cutsceneTimer = this->frameCounter * 128; @@ -613,15 +611,15 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachF(&this->subCamAt.x, subCamAtNext.x, 0.2f, 500.0f); Math_ApproachF(&this->subCamAt.y, subCamAtNext.y, 0.2f, 500.0f); Math_ApproachF(&this->subCamAt.z, subCamAtNext.z, 0.2f, 500.0f); - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } // Cutscene has finished. if (this->cutsceneTimer == 1) { - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); // CLEAR_TAG_CUTSCENE_MODE_NONE / SUB_CAM_ID_DONE this->cutsceneMode = this->subCamId = 0; - func_80064534(globalCtx, &globalCtx->csCtx); + func_80064534(play, &play->csCtx); } } } @@ -634,18 +632,17 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { Vec3f debrisEffectAcceleration; this->shouldExplode = false; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_IT_BOMB_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_IT_BOMB_EXPLOSION); // Spawn flash effect. crashEffectLocation.x = this->actor.world.pos.x; crashEffectLocation.y = (this->actor.world.pos.y + 40.0f) - 30.0f; crashEffectLocation.z = this->actor.world.pos.z; - EnClearTag_CreateFlashEffect(globalCtx, &crashEffectLocation, 6.0f, this->actor.floorHeight, - &this->floorTangent); + EnClearTag_CreateFlashEffect(play, &crashEffectLocation, 6.0f, this->actor.floorHeight, &this->floorTangent); // Spawn smoke effect. crashEffectLocation.y = (this->actor.world.pos.y + 30.0f) - 50.0f; - EnClearTag_CreateSmokeEffect(globalCtx, &crashEffectLocation, 3.0f); + EnClearTag_CreateSmokeEffect(play, &crashEffectLocation, 3.0f); crashEffectLocation.y = this->actor.world.pos.y; // Spawn debris effects. @@ -660,9 +657,8 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { debrisEffectAcceleration.y = -1.0f; debrisEffectAcceleration.z = 0.0f; - EnClearTag_CreateDebrisEffect(globalCtx, &crashEffectLocation, &crashEffectVelocity, - &debrisEffectAcceleration, Rand_ZeroFloat(0.15f) + 0.075f, - this->actor.floorHeight); + EnClearTag_CreateDebrisEffect(play, &crashEffectLocation, &crashEffectVelocity, &debrisEffectAcceleration, + Rand_ZeroFloat(0.15f) + 0.075f, this->actor.floorHeight); } } @@ -672,7 +668,7 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_Kill(&this->actor); } - EnClearTag_UpdateEffects(globalCtx); + EnClearTag_UpdateEffects(play); } } @@ -681,30 +677,30 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { * Laser clear tag type will draw two lasers. * Arwing clear tage types will draw the Arwing, the backfire, and a shadow. */ -void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnClearTag_Draw(Actor* thisx, PlayState* play) { s32 pad; EnClearTag* this = (EnClearTag*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_clear_tag.c", 983); + OPEN_DISPS(play->state.gfxCtx, "../z_en_clear_tag.c", 983); if (this->drawMode != CLEAR_TAG_DRAW_MODE_EFFECT) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->state >= CLEAR_TAG_STATE_LASER) { // Draw Arwing lasers. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 255, 0, 255); Matrix_Translate(25.0f, 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_clear_tag.c", 1004), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_clear_tag.c", 1004), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingLaserDL); Matrix_Translate(-50.0f, 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_clear_tag.c", 1011), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_clear_tag.c", 1011), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingLaserDL); } else { // Draw the Arwing itself. - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); if (this->crashingTimer != 0) { f32 xRotation; @@ -717,13 +713,13 @@ void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(yRotation, MTXMODE_APPLY); } Matrix_RotateZ(this->roll, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_clear_tag.c", 1030), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_clear_tag.c", 1030), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gArwingDL); // Draw the Arwing Backfire Matrix_Translate(0.0f, 0.0f, -60.0f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(2.5f, 1.3f, 0.0f, MTXMODE_APPLY); if ((this->frameCounter % 2) != 0) { Matrix_Scale(1.15f, 1.15f, 1.15f, MTXMODE_APPLY); @@ -731,7 +727,7 @@ void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, 155); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_clear_tag.c", 1067), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_clear_tag.c", 1067), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingBackfireDL); @@ -755,17 +751,17 @@ void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(yRotation, MTXMODE_APPLY); } Matrix_RotateZ(this->roll, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_clear_tag.c", 1104), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_clear_tag.c", 1104), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingShadowDL); } } if (this->drawMode != CLEAR_TAG_DRAW_MODE_ARWING) { - EnClearTag_DrawEffects(globalCtx); + EnClearTag_DrawEffects(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_clear_tag.c", 1119); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_clear_tag.c", 1119); } /** @@ -774,8 +770,8 @@ void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { * Moves and bounces debris effects. * Fades most effects out of view. When effects are completely faded away they are removed. */ -void EnClearTag_UpdateEffects(GlobalContext* globalCtx) { - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; +void EnClearTag_UpdateEffects(PlayState* play) { + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; s16 i; f32 originalYPosition; Vec3f sphereCenter; @@ -805,7 +801,7 @@ void EnClearTag_UpdateEffects(GlobalContext* globalCtx) { sphereCenter.y += 5.0f; // Check if the debris has hit the ground. - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &sphereCenter, 11.0f)) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, &sphereCenter, 11.0f)) { effect->position.y = originalYPosition; // Bounce the debris effect. @@ -835,7 +831,7 @@ void EnClearTag_UpdateEffects(GlobalContext* globalCtx) { // Spawn a fire effect every 3 frames. if (effect->random >= 3) { effect->random = 0; - EnClearTag_CreateFireEffect(globalCtx, &effect->position, effect->scale * 8.0f); + EnClearTag_CreateFireEffect(play, &effect->position, effect->scale * 8.0f); } } else if (effect->type == CLEAR_TAG_EFFECT_FIRE) { // Fade the fire effect. @@ -888,16 +884,16 @@ void EnClearTag_UpdateEffects(GlobalContext* globalCtx) { * Each effect type is drawn before the next. The function will apply a material that applies to all effects of that * type while drawing the first effect of that type. */ -void EnClearTag_DrawEffects(GlobalContext* globalCtx) { +void EnClearTag_DrawEffects(PlayState* play) { s16 i; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 materialFlag = 0; - EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects; + EnClearTagEffect* effect = (EnClearTagEffect*)play->specialEffects; EnClearTagEffect* firstEffect = effect; OPEN_DISPS(gfxCtx, "../z_en_clear_tag.c", 1288); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); // Draw all Debris effects. for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) { @@ -961,9 +957,9 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s8)effect->primColor.r, (s8)effect->primColor.g, (s8)effect->primColor.b, (s8)effect->primColor.a); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, effect->random * -5, 32, 64, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, effect->random * -5, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, 20.0f, 0.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_clear_tag.c", 1392), @@ -986,11 +982,11 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { // Draw the fire effect. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, (s8)effect->primColor.a); - gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (effect->random * -15) & 0xFF, 32, 64, 1, 0, 0, - 32, 32)); + gSPSegment( + POLY_XLU_DISP++, 8, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (effect->random * -15) & 0xFF, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_clear_tag.c", 1439), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1013,7 +1009,7 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { // Draw the flash billboard effect. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (s8)effect->primColor.a); Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_clear_tag.c", 1470), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index af1dc7cc3b..f9b74e3e60 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -9,21 +9,21 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnCow_Init(Actor* thisx, GlobalContext* globalCtx); -void EnCow_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnCow_Update(Actor* thisx, GlobalContext* globalCtx); -void EnCow_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_809DFE98(Actor* thisx, GlobalContext* globalCtx); -void func_809E0070(Actor* thisx, GlobalContext* globalCtx); +void EnCow_Init(Actor* thisx, PlayState* play); +void EnCow_Destroy(Actor* thisx, PlayState* play); +void EnCow_Update(Actor* thisx, PlayState* play); +void EnCow_Draw(Actor* thisx, PlayState* play); +void func_809DFE98(Actor* thisx, PlayState* play); +void func_809E0070(Actor* thisx, PlayState* play); -void func_809DF494(EnCow* this, GlobalContext* globalCtx); -void func_809DF6BC(EnCow* this, GlobalContext* globalCtx); -void func_809DF778(EnCow* this, GlobalContext* globalCtx); -void func_809DF7D8(EnCow* this, GlobalContext* globalCtx); -void func_809DF870(EnCow* this, GlobalContext* globalCtx); -void func_809DF8FC(EnCow* this, GlobalContext* globalCtx); -void func_809DF96C(EnCow* this, GlobalContext* globalCtx); -void func_809DFA84(EnCow* this, GlobalContext* globalCtx); +void func_809DF494(EnCow* this, PlayState* play); +void func_809DF6BC(EnCow* this, PlayState* play); +void func_809DF778(EnCow* this, PlayState* play); +void func_809DF7D8(EnCow* this, PlayState* play); +void func_809DF870(EnCow* this, PlayState* play); +void func_809DF8FC(EnCow* this, PlayState* play); +void func_809DF96C(EnCow* this, PlayState* play); +void func_809DFA84(EnCow* this, PlayState* play); const ActorInit En_Cow_InitVars = { ACTOR_EN_COW, @@ -101,22 +101,22 @@ void func_809DEF94(EnCow* this) { this->actor.world.pos.z += vec.z; } -void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnCow_Init(Actor* thisx, PlayState* play) { EnCow* this = (EnCow*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 72.0f); switch (this->actor.params) { case 0: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowBodySkel, NULL, this->jointTable, this->morphTable, 6); + SkelAnime_InitFlex(play, &this->skelAnime, &gCowBodySkel, NULL, this->jointTable, this->morphTable, 6); Animation_PlayLoop(&this->skelAnime, &gCowBodyChewAnim); - Collider_InitCylinder(globalCtx, &this->colliders[0]); - Collider_SetCylinder(globalCtx, &this->colliders[0], &this->actor, &sCylinderInit); - Collider_InitCylinder(globalCtx, &this->colliders[1]); - Collider_SetCylinder(globalCtx, &this->colliders[1], &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliders[0]); + Collider_SetCylinder(play, &this->colliders[0], &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliders[1]); + Collider_SetCylinder(play, &this->colliders[1], &this->actor, &sCylinderInit); func_809DEE9C(this); this->actionFunc = func_809DF96C; - if (globalCtx->sceneNum == SCENE_LINK_HOME) { + if (play->sceneNum == SCENE_LINK_HOME) { if (!LINK_IS_ADULT) { Actor_Kill(&this->actor); return; @@ -126,7 +126,7 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { return; } } - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_COW, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_COW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 1); this->unk_278 = Rand_ZeroFloat(1000.0f) + 40.0f; this->unk_27A = 0; @@ -134,7 +134,7 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { DREG(53) = 0; break; case 1: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, 6); + SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, 6); Animation_PlayLoop(&this->skelAnime, &gCowTailIdleAnim); this->actor.update = func_809DFE98; this->actor.draw = func_809E0070; @@ -149,16 +149,16 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_276 = 0; } -void EnCow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnCow_Destroy(Actor* thisx, PlayState* play) { EnCow* this = (EnCow*)thisx; if (this->actor.params == 0) { - Collider_DestroyCylinder(globalCtx, &this->colliders[0]); - Collider_DestroyCylinder(globalCtx, &this->colliders[1]); + Collider_DestroyCylinder(play, &this->colliders[0]); + Collider_DestroyCylinder(play, &this->colliders[1]); } } -void func_809DF494(EnCow* this, GlobalContext* globalCtx) { +void func_809DF494(EnCow* this, PlayState* play) { if (this->unk_278 > 0) { this->unk_278 -= 1; } else { @@ -193,64 +193,64 @@ void func_809DF494(EnCow* this, GlobalContext* globalCtx) { } } -void func_809DF6BC(EnCow* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void func_809DF6BC(EnCow* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_16; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = func_809DF96C; } } -void func_809DF730(EnCow* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_809DF730(EnCow* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = func_809DF96C; } } -void func_809DF778(EnCow* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809DF778(EnCow* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_809DF730; } else { - func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 100.0f); + func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 100.0f); } } -void func_809DF7D8(EnCow* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void func_809DF7D8(EnCow* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_16; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = func_809DF778; - func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 100.0f); + func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 100.0f); } } -void func_809DF870(EnCow* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void func_809DF870(EnCow* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { if (Inventory_HasEmptyBottle()) { - Message_ContinueTextbox(globalCtx, 0x2007); + Message_ContinueTextbox(play, 0x2007); this->actionFunc = func_809DF7D8; } else { - Message_ContinueTextbox(globalCtx, 0x2013); + Message_ContinueTextbox(play, 0x2013); this->actionFunc = func_809DF6BC; } } } -void func_809DF8FC(EnCow* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_809DF8FC(EnCow* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_809DF870; } else { this->actor.flags |= ACTOR_FLAG_16; - func_8002F2CC(&this->actor, globalCtx, 170.0f); + func_8002F2CC(&this->actor, play, 170.0f); this->actor.textId = 0x2006; } - func_809DF494(this, globalCtx); + func_809DF494(this, play); } -void func_809DF96C(EnCow* this, GlobalContext* globalCtx) { - if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_00) || (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04)) { +void func_809DF96C(EnCow* this, PlayState* play) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_00) || (play->msgCtx.ocarinaMode == OCARINA_MODE_04)) { if (DREG(53) != 0) { if (this->unk_276 & 4) { this->unk_276 &= ~0x4; @@ -261,7 +261,7 @@ void func_809DF96C(EnCow* this, GlobalContext* globalCtx) { DREG(53) = 0; this->actionFunc = func_809DF8FC; this->actor.flags |= ACTOR_FLAG_16; - func_8002F2CC(&this->actor, globalCtx, 170.0f); + func_8002F2CC(&this->actor, play, 170.0f); this->actor.textId = 0x2006; } else { this->unk_276 |= 4; @@ -271,10 +271,10 @@ void func_809DF96C(EnCow* this, GlobalContext* globalCtx) { this->unk_276 &= ~0x4; } } - func_809DF494(this, globalCtx); + func_809DF494(this, play); } -void func_809DFA84(EnCow* this, GlobalContext* globalCtx) { +void func_809DFA84(EnCow* this, PlayState* play) { if (this->unk_278 > 0) { this->unk_278--; } else { @@ -292,17 +292,17 @@ void func_809DFA84(EnCow* this, GlobalContext* globalCtx) { } } -void EnCow_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnCow_Update(Actor* thisx, PlayState* play2) { EnCow* this = (EnCow*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s16 targetX; s16 targetY; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[0].base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[1].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliders[0].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliders[1].base); Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->skelAnime.animation == &gCowBodyChewAnim) { Audio_PlayActorSound2(thisx, NA_SE_EV_COW_CRY); @@ -313,7 +313,7 @@ void EnCow_Update(Actor* thisx, GlobalContext* globalCtx2) { ANIMMODE_LOOP, 1.0f); } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((thisx->xzDistToPlayer < 150.0f) && (ABS(Math_Vec3f_Yaw(&thisx->world.pos, &player->actor.world.pos)) < 0xC000)) { targetX = Math_Vec3f_Pitch(&thisx->focus.pos, &player->actor.focus.pos); @@ -339,7 +339,7 @@ void EnCow_Update(Actor* thisx, GlobalContext* globalCtx2) { Math_SmoothStepToS(&this->someRot.y, targetY, 0xA, 0xC8, 0xA); } -void func_809DFE98(Actor* thisx, GlobalContext* globalCtx) { +void func_809DFE98(Actor* thisx, PlayState* play) { EnCow* this = (EnCow*)thisx; s32 pad; @@ -352,10 +352,10 @@ void func_809DFE98(Actor* thisx, GlobalContext* globalCtx) { ANIMMODE_LOOP, 1.0f); } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnCow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnCow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnCow* this = (EnCow*)thisx; if (limbIndex == 2) { @@ -368,7 +368,7 @@ s32 EnCow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnCow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnCow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnCow* this = (EnCow*)thisx; if (limbIndex == 2) { @@ -376,18 +376,18 @@ void EnCow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnCow_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnCow_Draw(Actor* thisx, PlayState* play) { EnCow* this = (EnCow*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnCow_OverrideLimbDraw, EnCow_PostLimbDraw, this); } -void func_809E0070(Actor* thisx, GlobalContext* globalCtx) { +void func_809E0070(Actor* thisx, PlayState* play) { EnCow* this = (EnCow*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, this); + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, this); } diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.h b/src/overlays/actors/ovl_En_Cow/z_en_cow.h index ccb165bf72..9fcc67c797 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.h +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.h @@ -6,7 +6,7 @@ struct EnCow; -typedef void (*EnCowActionFunc)(struct EnCow*, GlobalContext*); +typedef void (*EnCowActionFunc)(struct EnCow*, PlayState*); typedef struct EnCow { /* 0x0000 */ Actor actor; 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 af845c32f7..50aabcb887 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -3,18 +3,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14) -void EnCrow_Init(Actor* thisx, GlobalContext* globalCtx); -void EnCrow_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx); -void EnCrow_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnCrow_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); -void EnCrow_Respawn(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx); +void EnCrow_FlyIdle(EnCrow* this, PlayState* play); +void EnCrow_Respawn(EnCrow* this, PlayState* play); +void EnCrow_DiveAttack(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); static Vec3f sZeroVecAccel = { 0.0f, 0.0f, 0.0f }; @@ -105,13 +105,13 @@ static InitChainEntry sInitChain[] = { static Vec3f sHeadVec = { 2500.0f, 0.0f, 0.0f }; -void EnCrow_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnCrow_Init(Actor* thisx, PlayState* play) { EnCrow* this = (EnCrow*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, 9); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, 9); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); this->collider.elements[0].dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); @@ -119,10 +119,10 @@ void EnCrow_Init(Actor* thisx, GlobalContext* globalCtx) { EnCrow_SetupFlyIdle(this); } -void EnCrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnCrow_Destroy(Actor* thisx, PlayState* play) { EnCrow* this = (EnCrow*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } // Setup Action functions @@ -141,7 +141,7 @@ void EnCrow_SetupDiveAttack(EnCrow* this) { this->actionFunc = EnCrow_DiveAttack; } -void EnCrow_SetupDamaged(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { s32 i; f32 scale; Vec3f iceParticlePos; @@ -162,14 +162,14 @@ void EnCrow_SetupDamaged(EnCrow* this, GlobalContext* globalCtx) { iceParticlePos.x = ((i & 1 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.x; iceParticlePos.y = ((i & 2 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.y; iceParticlePos.z = ((i & 4 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.z; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255, + 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.damageEffect == 2) { // Fire arrows and Din's Fire Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); for (i = 0; i < 4; i++) { - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &this->actor.world.pos, 50.0f * scale, 0, 0, i); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, 50.0f * scale, 0, 0, i); } } else { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); @@ -225,8 +225,8 @@ void EnCrow_SetupRespawn(EnCrow* this) { // Action functions -void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 skelanimeUpdated; s16 var; @@ -277,13 +277,13 @@ void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx) { this->timer--; } if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & PLAYER_STATE1_23) && - (this->actor.yDistToWater < -40.0f) && (Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) { + (this->actor.yDistToWater < -40.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL)) { EnCrow_SetupDiveAttack(this); } } -void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 facingPlayer; Vec3f pos; s16 target; @@ -312,8 +312,7 @@ void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00); } - if ((this->timer == 0) || (Player_GetMask(globalCtx) == PLAYER_MASK_SKULL) || - (this->collider.base.atFlags & AT_HIT) || + if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL) || (this->collider.base.atFlags & AT_HIT) || (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) || (player->stateFlags1 & PLAYER_STATE1_23) || (this->actor.yDistToWater > -40.0f)) { if (this->collider.base.atFlags & AT_HIT) { @@ -325,7 +324,7 @@ void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx) { } } -void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_Damaged(EnCrow* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); this->actor.colorFilterTimer = 40; @@ -335,14 +334,14 @@ void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx) { this->actor.shape.rot.z += 0x1780; } if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { - EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &sZeroVecAccel, &sZeroVecAccel, + EffectSsDeadDb_Spawn(play, &this->actor.world.pos, &sZeroVecAccel, &sZeroVecAccel, this->actor.scale.x * 10000.0f, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1); EnCrow_SetupDie(this); } } } -void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_Die(EnCrow* this, PlayState* play) { f32 step; if (this->actor.params != 0) { @@ -354,9 +353,9 @@ void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->actor.scale.x, 0.0f, step)) { if (this->actor.params == 0) { sDeathCount++; - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); } EnCrow_SetupRespawn(this); } @@ -364,7 +363,7 @@ void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) { this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; } -void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_TurnAway(EnCrow* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { @@ -384,7 +383,7 @@ void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx) { } } -void EnCrow_Respawn(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_Respawn(EnCrow* this, PlayState* play) { f32 target; if (this->timer != 0) { @@ -409,7 +408,7 @@ void EnCrow_Respawn(EnCrow* this, GlobalContext* globalCtx) { } } -void EnCrow_UpdateDamage(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_UpdateDamage(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].info, true); @@ -419,21 +418,21 @@ void EnCrow_UpdateDamage(EnCrow* this, GlobalContext* globalCtx) { } else { Actor_ApplyDamage(&this->actor); this->actor.flags &= ~ACTOR_FLAG_0; - Enemy_StartFinishingBlow(globalCtx, &this->actor); - EnCrow_SetupDamaged(this, globalCtx); + Enemy_StartFinishingBlow(play, &this->actor); + EnCrow_SetupDamaged(this, play); } } } } -void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnCrow_Update(Actor* thisx, PlayState* play) { EnCrow* this = (EnCrow*)thisx; f32 pad; f32 height; f32 scale; - EnCrow_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnCrow_UpdateDamage(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; @@ -446,7 +445,7 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) { height = 0.0f; Actor_MoveForward(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 12.0f * scale, 25.0f * scale, 50.0f * scale, + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f * scale, 25.0f * scale, 50.0f * scale, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); } else { height = 0.0f; @@ -457,15 +456,15 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; if (this->actionFunc == EnCrow_DiveAttack) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnCrow_Respawn) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, height); @@ -475,7 +474,7 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnCrow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnCrow* this = (EnCrow*)thisx; if (this->actor.colChkInfo.health != 0) { @@ -488,7 +487,7 @@ s32 EnCrow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnCrow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnCrow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnCrow* this = (EnCrow*)thisx; Vec3f* vec; @@ -502,10 +501,10 @@ void EnCrow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void EnCrow_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnCrow_Draw(Actor* thisx, PlayState* play) { EnCrow* this = (EnCrow*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnCrow_OverrideLimbDraw, EnCrow_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.h b/src/overlays/actors/ovl_En_Crow/z_en_crow.h index 59447f9cef..87e9ae0542 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.h +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.h @@ -6,7 +6,7 @@ struct EnCrow; -typedef void (*EnCrowActionFunc)(struct EnCrow*, GlobalContext*); +typedef void (*EnCrowActionFunc)(struct EnCrow*, PlayState*); typedef struct EnCrow { /* 0x0000 */ Actor actor; 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 5a088c54a6..14a66a32af 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -4,16 +4,16 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnCs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnCs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnCs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnCs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnCs_Init(Actor* thisx, PlayState* play); +void EnCs_Destroy(Actor* thisx, PlayState* play); +void EnCs_Update(Actor* thisx, PlayState* play); +void EnCs_Draw(Actor* thisx, PlayState* play); -void EnCs_Walk(EnCs* this, GlobalContext* globalCtx); -void EnCs_Talk(EnCs* this, GlobalContext* globalCtx); -void EnCs_Wait(EnCs* this, GlobalContext* globalCtx); -s32 EnCs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -void EnCs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); +void EnCs_Walk(EnCs* this, PlayState* play); +void EnCs_Talk(EnCs* this, PlayState* play); +void EnCs_Wait(EnCs* this, PlayState* play); +s32 EnCs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); +void EnCs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); const ActorInit En_Cs_InitVars = { ACTOR_EN_CS, @@ -120,7 +120,7 @@ void EnCs_ChangeAnim(EnCs* this, s32 index, s32* currentIndex) { *currentIndex = index; } -void EnCs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnCs_Init(Actor* thisx, PlayState* play) { EnCs* this = (EnCs*)thisx; s32 pad; @@ -131,13 +131,13 @@ void EnCs_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGraveyardKidSkel, NULL, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gGraveyardKidSkel, NULL, this->jointTable, this->morphTable, 16); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, sDamageTable, &sColChkInfoInit2); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); Animation_Change(&this->skelAnime, sAnimationInfo[ENCS_ANIM_0].animation, 1.0f, 0.0f, Animation_GetLastFrame(sAnimationInfo[ENCS_ANIM_0].animation), sAnimationInfo[ENCS_ANIM_0].mode, @@ -156,21 +156,21 @@ void EnCs_Init(Actor* thisx, GlobalContext* globalCtx) { this->walkSpeed = 1.0f; } -void EnCs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnCs_Destroy(Actor* thisx, PlayState* play) { EnCs* this = (EnCs*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 EnCs_GetTalkState(EnCs* this, GlobalContext* globalCtx) { +s32 EnCs_GetTalkState(EnCs* this, PlayState* play) { s32 pad; s32 pad2; s32 talkState = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { this->actor.textId = 0x2026; EnCs_ChangeAnim(this, ENCS_ANIM_3, &this->currentAnimIndex); talkState = 2; @@ -182,10 +182,10 @@ s32 EnCs_GetTalkState(EnCs* this, GlobalContext* globalCtx) { } break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x2026) { - Player_UnsetMask(globalCtx); - Item_Give(globalCtx, ITEM_SOLD_OUT); + Player_UnsetMask(play); + Item_Give(play, ITEM_SOLD_OUT); SET_ITEMGETINF(ITEMGETINF_3A); Rupees_ChangeBy(30); this->actor.textId = 0x2027; @@ -206,9 +206,9 @@ s32 EnCs_GetTalkState(EnCs* this, GlobalContext* globalCtx) { return talkState; } -s32 EnCs_GetTextID(EnCs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - s32 textId = Text_GetFaceReaction(globalCtx, 15); +s32 EnCs_GetTextID(EnCs* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 textId = Text_GetFaceReaction(play, 15); if (GET_ITEMGETINF(ITEMGETINF_3A)) { if (textId == 0) { @@ -225,17 +225,17 @@ s32 EnCs_GetTextID(EnCs* this, GlobalContext* globalCtx) { return textId; } -void EnCs_HandleTalking(EnCs* this, GlobalContext* globalCtx) { +void EnCs_HandleTalking(EnCs* this, PlayState* play) { s32 pad; s16 sp2A; s16 sp28; if (this->talkState == 2) { - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->talkState = 1; } else if (this->talkState == 1) { - this->talkState = EnCs_GetTalkState(this, globalCtx); - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + this->talkState = EnCs_GetTalkState(this, play); + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { if ((this->actor.textId == 0x2022) || ((this->actor.textId != 0x2022) && (this->actor.textId != 0x2028))) { EnCs_ChangeAnim(this, ENCS_ANIM_3, &this->currentAnimIndex); } @@ -250,11 +250,11 @@ void EnCs_HandleTalking(EnCs* this, GlobalContext* globalCtx) { this->talkState = 1; } else { - Actor_GetScreenPos(globalCtx, &this->actor, &sp2A, &sp28); + Actor_GetScreenPos(play, &this->actor, &sp2A, &sp28); if ((sp2A >= 0) && (sp2A <= 320) && (sp28 >= 0) && (sp28 <= 240) && - (func_8002F2CC(&this->actor, globalCtx, 100.0f))) { - this->actor.textId = EnCs_GetTextID(this, globalCtx); + (func_8002F2CC(&this->actor, play, 100.0f))) { + this->actor.textId = EnCs_GetTextID(this, play); } } } @@ -279,7 +279,7 @@ s32 EnCs_GetPathPoint(Path* pathList, Vec3f* dest, s32 pathIndex, s32 waypoint) return 0; } -s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) { +s32 EnCs_HandleWalking(EnCs* this, PlayState* play) { f32 xDiff; f32 zDiff; Vec3f pathPos; @@ -287,7 +287,7 @@ s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) { s16 walkAngle1; s16 walkAngle2; - EnCs_GetPathPoint(globalCtx->setupPathList, &pathPos, this->path, this->waypoint); + EnCs_GetPathPoint(play->setupPathList, &pathPos, this->path, this->waypoint); xDiff = pathPos.x - this->actor.world.pos.x; zDiff = pathPos.z - this->actor.world.pos.z; walkAngle1 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff)); @@ -296,13 +296,13 @@ s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) { while (this->walkDist <= 10.44f) { this->waypoint++; - waypointCount = EnCs_GetwaypointCount(globalCtx->setupPathList, this->path); + waypointCount = EnCs_GetwaypointCount(play->setupPathList, this->path); if ((this->waypoint < 0) || (!(this->waypoint < waypointCount))) { this->waypoint = 0; } - EnCs_GetPathPoint(globalCtx->setupPathList, &pathPos, this->path, this->waypoint); + EnCs_GetPathPoint(play->setupPathList, &pathPos, this->path, this->waypoint); xDiff = pathPos.x - this->actor.world.pos.x; zDiff = pathPos.z - this->actor.world.pos.z; walkAngle2 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff)); @@ -314,12 +314,12 @@ s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.speedXZ = this->walkSpeed; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); return 0; } -void EnCs_Walk(EnCs* this, GlobalContext* globalCtx) { +void EnCs_Walk(EnCs* this, PlayState* play) { s32 rnd; s32 animIndex; s32 curAnimFrame; @@ -366,11 +366,11 @@ void EnCs_Walk(EnCs* this, GlobalContext* globalCtx) { this->walkSpeed = 1.0f; } - EnCs_HandleWalking(this, globalCtx); + EnCs_HandleWalking(this, play); } } -void EnCs_Wait(EnCs* this, GlobalContext* globalCtx) { +void EnCs_Wait(EnCs* this, PlayState* play) { s32 animIndex; if (this->talkState != 0) { @@ -395,8 +395,8 @@ void EnCs_Wait(EnCs* this, GlobalContext* globalCtx) { } } -void EnCs_Talk(EnCs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnCs_Talk(EnCs* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (SkelAnime_Update(&this->skelAnime) != 0) { EnCs_ChangeAnim(this, this->currentAnimIndex, &this->currentAnimIndex); @@ -415,7 +415,7 @@ void EnCs_Talk(EnCs* this, GlobalContext* globalCtx) { } } -void EnCs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnCs_Update(Actor* thisx, PlayState* play) { static s32 eyeBlinkFrames[] = { 70, 1, 1 }; EnCs* this = (EnCs*)thisx; s32 pad; @@ -433,11 +433,11 @@ void EnCs_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - EnCs_HandleTalking(this, globalCtx); + EnCs_HandleTalking(this, play); this->eyeBlinkTimer--; @@ -452,7 +452,7 @@ void EnCs_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnCs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnCs_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gGraveyardKidEyesOpenTex, gGraveyardKidEyesHalfTex, @@ -461,34 +461,34 @@ void EnCs_Draw(Actor* thisx, GlobalContext* globalCtx) { EnCs* this = (EnCs*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_cs.c", 968); + OPEN_DISPS(play->state.gfxCtx, "../z_en_cs.c", 968); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnCs_OverrideLimbDraw, EnCs_PostLimbDraw, &this->actor); if (GET_ITEMGETINF(ITEMGETINF_3A)) { - s32 childLinkObjectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_LINK_CHILD); + s32 childLinkObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD); // Handle attaching the Spooky Mask to the boy's face if (childLinkObjectIndex >= 0) { Mtx* mtx; Matrix_Put(&this->spookyMaskMtx); - mtx = Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_cs.c", 1000); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[childLinkObjectIndex].segment); + mtx = Matrix_NewMtx(play->state.gfxCtx, "../z_en_cs.c", 1000); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[childLinkObjectIndex].segment); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx - 7); gSPDisplayList(POLY_OPA_DISP++, gLinkChildSpookyMaskDL); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_cs.c", 1015); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_cs.c", 1015); } -s32 EnCs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnCs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnCs* this = (EnCs*)thisx; if (this->flag & 1) { @@ -507,7 +507,7 @@ s32 EnCs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnCs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnCs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_809E2970 = { 500.0f, 800.0f, 0.0f }; EnCs* this = (EnCs*)thisx; diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.h b/src/overlays/actors/ovl_En_Cs/z_en_cs.h index 6b2b0d109f..0bc6676520 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.h +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.h @@ -6,7 +6,7 @@ struct EnCs; -typedef void (*EnCsActionFunc)(struct EnCs*, GlobalContext*); +typedef void (*EnCsActionFunc)(struct EnCs*, PlayState*); typedef struct EnCs { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 8c518cf602..dc0810d61c 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -26,20 +26,20 @@ typedef enum { /* 3 */ ENDAIKU_STATE_NO_TALK } EnDaikuTalkState; -void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDaiku_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDaiku_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDaiku_Init(Actor* thisx, PlayState* play); +void EnDaiku_Destroy(Actor* thisx, PlayState* play); +void EnDaiku_Update(Actor* thisx, PlayState* play); +void EnDaiku_Draw(Actor* thisx, PlayState* play); -void EnDaiku_TentIdle(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_Jailed(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_WaitFreedom(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_EscapeRotate(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_InitSubCamera(EnDaiku* this, GlobalContext* globalCtx); -void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx); -s32 EnDaiku_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -void EnDaiku_PostLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3s* rot, void* thisx); +void EnDaiku_TentIdle(EnDaiku* this, PlayState* play); +void EnDaiku_Jailed(EnDaiku* this, PlayState* play); +void EnDaiku_WaitFreedom(EnDaiku* this, PlayState* play); +void EnDaiku_InitEscape(EnDaiku* this, PlayState* play); +void EnDaiku_EscapeRotate(EnDaiku* this, PlayState* play); +void EnDaiku_InitSubCamera(EnDaiku* this, PlayState* play); +void EnDaiku_EscapeRun(EnDaiku* this, PlayState* play); +s32 EnDaiku_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); +void EnDaiku_PostLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3s* rot, void* thisx); const ActorInit En_Daiku_InitVars = { ACTOR_EN_DAIKU, @@ -146,7 +146,7 @@ void EnDaiku_ChangeAnim(EnDaiku* this, s32 index, s32* currentIndex) { *currentIndex = index; } -void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Init(Actor* thisx, PlayState* play) { EnDaiku* this = (EnDaiku*)thisx; s32 pad; s32 noKill = true; @@ -162,9 +162,9 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { isFree = true; } - if (isFree == true && globalCtx->sceneNum == SCENE_GERUDOWAY) { + if (isFree == true && play->sceneNum == SCENE_GERUDOWAY) { noKill = false; - } else if (isFree == false && globalCtx->sceneNum == SCENE_TENT) { + } else if (isFree == false && play->sceneNum == SCENE_TENT) { noKill = false; } @@ -172,23 +172,22 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.z = 0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_daiku_Skel_007958, NULL, this->jointTable, this->morphTable, - 17); + SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_007958, NULL, this->jointTable, this->morphTable, 17); if (!noKill) { Actor_Kill(&this->actor); return; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); Animation_Change(&this->skelAnime, sAnimationInfo[ENDAIKU_ANIM_SHOUT].animation, 1.0f, 0.0f, Animation_GetLastFrame(sAnimationInfo[ENDAIKU_ANIM_SHOUT].animation), sAnimationInfo[ENDAIKU_ANIM_SHOUT].mode, sAnimationInfo[ENDAIKU_ANIM_SHOUT].morphFrames); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); this->actor.targetMode = 6; this->currentAnimIndex = -1; @@ -196,7 +195,7 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { this->initRot = this->actor.world.rot; this->initPos = this->actor.world.pos; - if (globalCtx->sceneNum == SCENE_GERUDOWAY) { + if (play->sceneNum == SCENE_GERUDOWAY) { EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_STAND, &this->currentAnimIndex); this->stateFlags |= ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2; this->actionFunc = EnDaiku_Jailed; @@ -214,28 +213,28 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDaiku_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Destroy(Actor* thisx, PlayState* play) { EnDaiku* this = (EnDaiku*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 EnDaiku_UpdateTalking(EnDaiku* this, GlobalContext* globalCtx) { +s32 EnDaiku_UpdateTalking(EnDaiku* this, PlayState* play) { s32 newTalkState = ENDAIKU_STATE_TALKING; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) { - if (globalCtx->sceneNum == SCENE_GERUDOWAY) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) { + if (play->sceneNum == SCENE_GERUDOWAY) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x6007) { - Flags_SetSwitch(globalCtx, this->startFightSwitchFlag); + Flags_SetSwitch(play, this->startFightSwitchFlag); newTalkState = ENDAIKU_STATE_CAN_TALK; } else { this->actionFunc = EnDaiku_InitEscape; newTalkState = ENDAIKU_STATE_NO_TALK; } } - } else if (globalCtx->sceneNum == SCENE_TENT) { - if (Message_ShouldAdvance(globalCtx)) { + } else if (play->sceneNum == SCENE_TENT) { + if (Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x6061: SET_INFTABLE(INFTABLE_176); @@ -253,21 +252,21 @@ s32 EnDaiku_UpdateTalking(EnDaiku* this, GlobalContext* globalCtx) { return newTalkState; } -void EnDaiku_UpdateText(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_UpdateText(EnDaiku* this, PlayState* play) { s32 carpenterType; s32 freedCount; s16 sp2E; s16 sp2C; if (this->talkState == ENDAIKU_STATE_TALKING) { - this->talkState = EnDaiku_UpdateTalking(this, globalCtx); - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + this->talkState = EnDaiku_UpdateTalking(this, play); + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->talkState = ENDAIKU_STATE_TALKING; } else { - Actor_GetScreenPos(globalCtx, &this->actor, &sp2E, &sp2C); + Actor_GetScreenPos(play, &this->actor, &sp2E, &sp2C); if (sp2E >= 0 && sp2E <= 320 && sp2C >= 0 && sp2C <= 240 && this->talkState == ENDAIKU_STATE_CAN_TALK && - func_8002F2CC(&this->actor, globalCtx, 100.0f) == 1) { - if (globalCtx->sceneNum == SCENE_GERUDOWAY) { + func_8002F2CC(&this->actor, play, 100.0f) == 1) { + if (play->sceneNum == SCENE_GERUDOWAY) { if (this->stateFlags & ENDAIKU_STATEFLAG_GERUDODEFEATED) { freedCount = 0; for (carpenterType = 0; carpenterType < 4; carpenterType++) { @@ -295,7 +294,7 @@ void EnDaiku_UpdateText(EnDaiku* this, GlobalContext* globalCtx) { (ENDAIKU_STATEFLAG_GERUDOFIGHTING | ENDAIKU_STATEFLAG_GERUDODEFEATED))) { this->actor.textId = 0x6007; } - } else if (globalCtx->sceneNum == SCENE_TENT) { + } else if (play->sceneNum == SCENE_TENT) { switch (this->actor.params & 3) { case 0: if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { @@ -342,25 +341,25 @@ void EnDaiku_UpdateText(EnDaiku* this, GlobalContext* globalCtx) { /** * The carpenter is idling in the tent. */ -void EnDaiku_TentIdle(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_TentIdle(EnDaiku* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - EnDaiku_UpdateText(this, globalCtx); + EnDaiku_UpdateText(this, play); } /** * The carpenter is jailed in a Gerudo fortress cell, talking to him starts a fight against a gerudo guard */ -void EnDaiku_Jailed(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_Jailed(EnDaiku* this, PlayState* play) { EnGeldB* gerudo; s32 temp_t9; s32 temp_v1; if (!(this->stateFlags & ENDAIKU_STATEFLAG_GERUDOFIGHTING)) { - EnDaiku_UpdateText(this, globalCtx); + EnDaiku_UpdateText(this, play); } SkelAnime_Update(&this->skelAnime); - gerudo = (EnGeldB*)Actor_Find(&globalCtx->actorCtx, ACTOR_EN_GELDB, ACTORCAT_ENEMY); + gerudo = (EnGeldB*)Actor_Find(&play->actorCtx, ACTOR_EN_GELDB, ACTORCAT_ENEMY); if (gerudo == NULL) { this->stateFlags |= ENDAIKU_STATEFLAG_GERUDODEFEATED; this->stateFlags &= ~ENDAIKU_STATEFLAG_GERUDOFIGHTING; @@ -376,19 +375,19 @@ void EnDaiku_Jailed(EnDaiku* this, GlobalContext* globalCtx) { * The player defeated the gerudo guard and the carpenter is waiting for the cell door to be opened, and for the player * to then talk to him */ -void EnDaiku_WaitFreedom(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_WaitFreedom(EnDaiku* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Flags_GetSwitch(globalCtx, this->actor.params >> 8 & 0x3F)) { + if (Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - EnDaiku_UpdateText(this, globalCtx); + EnDaiku_UpdateText(this, play); } } /** * The carpenter is free, initializes his running away animation */ -void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_InitEscape(EnDaiku* this, PlayState* play) { Path* path; f32 dxz; f32 dx; @@ -405,10 +404,10 @@ void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; this->escapeSubCamTimer = sEscapeSubCamParams[this->actor.params & 3].maxFramesActive; - EnDaiku_InitSubCamera(this, globalCtx); + EnDaiku_InitSubCamera(this, play); exitLoop = false; - path = &globalCtx->setupPathList[this->actor.params >> 4 & 0xF]; + path = &play->setupPathList[this->actor.params >> 4 & 0xF]; while (!exitLoop) { pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint; dx = pointPos->x - this->actor.world.pos.x; @@ -428,18 +427,18 @@ void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) { /** * The carpenter is rotating towards where he is going next */ -void EnDaiku_EscapeRotate(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_EscapeRotate(EnDaiku* this, PlayState* play) { s16 diff; diff = Math_SmoothStepToS(&this->actor.shape.rot.y, this->rotYtowardsPath, 1, 0x1388, 0); SkelAnime_Update(&this->skelAnime); if (diff == 0) { this->actionFunc = EnDaiku_EscapeRun; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void EnDaiku_InitSubCamera(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_InitSubCamera(EnDaiku* this, PlayState* play) { s32 pad; Vec3f eyePosDeltaLocal; Vec3f eyePosDeltaWorld; @@ -464,16 +463,16 @@ void EnDaiku_InitSubCamera(EnDaiku* this, GlobalContext* globalCtx) { if (1) {} this->subCamAtNext.z = this->subCamAt.z = this->actor.world.pos.z; - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); - Play_CameraSetFov(globalCtx, this->subCamId, globalCtx->mainCamera.fov); - func_8002DF54(globalCtx, &this->actor, 1); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetFov(play, this->subCamId, play->mainCamera.fov); + func_8002DF54(play, &this->actor, 1); } -void EnDaiku_UpdateSubCamera(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_UpdateSubCamera(EnDaiku* this, PlayState* play) { s32 pad; this->subCamAtNext.x = this->actor.world.pos.x; @@ -484,37 +483,36 @@ void EnDaiku_UpdateSubCamera(EnDaiku* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->subCamAt.y, this->subCamAtNext.y, 1.0f, 1000.0f, 0.0f); Math_SmoothStepToF(&this->subCamAt.z, this->subCamAtNext.z, 1.0f, 1000.0f, 0.0f); - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } -void EnDaiku_EscapeSuccess(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_EscapeSuccess(EnDaiku* this, PlayState* play) { static Vec3f D_809E4148 = { 0.0f, 0.0f, 120.0f }; Actor* gerudoGuard; Vec3f vec; - Play_ClearCamera(globalCtx, this->subCamId); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->subCamId); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); this->subCamActive = false; if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { Matrix_RotateY(BINANG_TO_RAD(this->initRot.y), MTXMODE_NEW); Matrix_MultVec3f(&D_809E4148, &vec); - gerudoGuard = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_GE3, this->initPos.x + vec.x, this->initPos.y + vec.y, - this->initPos.z + vec.z, 0, RAD_TO_BINANG(Math_FAtan2F(-vec.x, -vec.z)), 0, 2); + gerudoGuard = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_GE3, this->initPos.x + vec.x, this->initPos.y + vec.y, + this->initPos.z + vec.z, 0, RAD_TO_BINANG(Math_FAtan2F(-vec.x, -vec.z)), 0, 2); if (gerudoGuard == NULL) { Actor_Kill(&this->actor); } } else { - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); } } /** * The carpenter is running away */ -void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) { +void EnDaiku_EscapeRun(EnDaiku* this, PlayState* play) { s32 pad1; Path* path; s16 ry; @@ -524,7 +522,7 @@ void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) { f32 dxz; Vec3s* pointPos; - path = &globalCtx->setupPathList[this->actor.params >> 4 & 0xF]; + path = &play->setupPathList[this->actor.params >> 4 & 0xF]; pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint; dx = pointPos->x - this->actor.world.pos.x; dz = pointPos->z - this->actor.world.pos.z; @@ -534,7 +532,7 @@ void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) { this->waypoint++; if (this->waypoint >= path->count) { if (this->subCamActive) { - EnDaiku_EscapeSuccess(this, globalCtx); + EnDaiku_EscapeSuccess(this, play); } Actor_Kill(&this->actor); return; @@ -545,22 +543,22 @@ void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; Math_SmoothStepToF(&this->actor.speedXZ, this->runSpeed, 0.6f, dxz, 0.0f); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (this->subCamActive) { - EnDaiku_UpdateSubCamera(this, globalCtx); + EnDaiku_UpdateSubCamera(this, play); if (this->escapeSubCamTimer-- <= 0) { - EnDaiku_EscapeSuccess(this, globalCtx); + EnDaiku_EscapeSuccess(this, play); } } SkelAnime_Update(&this->skelAnime); } -void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Update(Actor* thisx, PlayState* play) { EnDaiku* this = (EnDaiku*)thisx; s32 curFrame; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->currentAnimIndex == ENDAIKU_ANIM_RUN) { curFrame = this->skelAnime.curFrame; @@ -570,9 +568,9 @@ void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->stateFlags & ENDAIKU_STATEFLAG_1) { this->unk_244.unk_18.x = player->actor.focus.pos.x; @@ -587,12 +585,12 @@ void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDaiku_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Draw(Actor* thisx, PlayState* play) { EnDaiku* this = (EnDaiku*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_daiku.c", 1227); + OPEN_DISPS(play->state.gfxCtx, "../z_en_daiku.c", 1227); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if ((thisx->params & 3) == 0) { gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255); @@ -604,13 +602,13 @@ void EnDaiku_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDaiku_OverrideLimbDraw, EnDaiku_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_daiku.c", 1255); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku.c", 1255); } -s32 EnDaiku_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnDaiku_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDaiku* this = (EnDaiku*)thisx; switch (limb) { @@ -627,18 +625,18 @@ s32 EnDaiku_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Ve return false; } -void EnDaiku_PostLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDaiku_PostLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3s* rot, void* thisx) { static Gfx* hairDLists[] = { object_daiku_DL_005BD0, object_daiku_DL_005AC0, object_daiku_DL_005990, object_daiku_DL_005880 }; static Vec3f targetPosHeadLocal = { 700, 1100, 0 }; EnDaiku* this = (EnDaiku*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_daiku.c", 1323); + OPEN_DISPS(play->state.gfxCtx, "../z_en_daiku.c", 1323); if (limb == 15) { // head Matrix_MultVec3f(&targetPosHeadLocal, &this->actor.focus.pos); gSPDisplayList(POLY_OPA_DISP++, hairDLists[this->actor.params & 3]); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_daiku.c", 1330); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku.c", 1330); } diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h index f4282c2102..4bfe985135 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h @@ -6,7 +6,7 @@ struct EnDaiku; -typedef void (*EnDaikuActionFunc)(struct EnDaiku*, GlobalContext*); +typedef void (*EnDaikuActionFunc)(struct EnDaiku*, PlayState*); typedef struct EnDaiku { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index 671aa84f46..1af1c1002f 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -16,13 +16,13 @@ typedef enum { /* 0x3 */ CARPENTER_SHIRO // Pink and purple pants, two-spiked hair } KakarikoCarpenterType; -void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDaikuKakariko_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDaikuKakariko_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDaikuKakariko_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDaikuKakariko_Init(Actor* thisx, PlayState* play); +void EnDaikuKakariko_Destroy(Actor* thisx, PlayState* play); +void EnDaikuKakariko_Update(Actor* thisx, PlayState* play); +void EnDaikuKakariko_Draw(Actor* thisx, PlayState* play); -void EnDaikuKakariko_Wait(EnDaikuKakariko* this, GlobalContext* globalCtx); -void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx); +void EnDaikuKakariko_Wait(EnDaikuKakariko* this, PlayState* play); +void EnDaikuKakariko_Run(EnDaikuKakariko* this, PlayState* play); const ActorInit En_Daiku_Kakariko_InitVars = { ACTOR_EN_DAIKU_KAKARIKO, @@ -123,13 +123,13 @@ void EnDaikuKakariko_ChangeAnim(EnDaikuKakariko* this, s32 index, s32* currentIn *currentIndex = index; } -void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDaikuKakariko_Init(Actor* thisx, PlayState* play) { static u16 initFlags[] = { 0x0080, 0x00B0, 0x0070, 0x0470 }; // List of inital values for this->flags EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; s32 pad; if (LINK_AGE_IN_YEARS == YEARS_CHILD) { - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT01: if (IS_DAY) { this->flags |= 1; @@ -157,10 +157,9 @@ void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_daiku_Skel_007958, NULL, this->jointTable, this->morphTable, - 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_007958, NULL, this->jointTable, this->morphTable, 17); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInit); @@ -168,7 +167,7 @@ void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { Animation_GetLastFrame(sAnimationInfo[ENDAIKUKAKARIKO_ANIM_0].animation), sAnimationInfo[ENDAIKUKAKARIKO_ANIM_0].mode, sAnimationInfo[ENDAIKUKAKARIKO_ANIM_0].morphFrames); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); this->actor.gravity = 0.0f; this->runSpeed = 3.0f; @@ -203,16 +202,16 @@ void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDaikuKakariko_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDaikuKakariko_Destroy(Actor* thisx, PlayState* play) { EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 EnDaikuKakariko_GetTalkState(EnDaikuKakariko* this, GlobalContext* globalCtx) { +s32 EnDaikuKakariko_GetTalkState(EnDaikuKakariko* this, PlayState* play) { s32 talkState = 2; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x6061: SET_INFTABLE(INFTABLE_176); @@ -226,21 +225,21 @@ s32 EnDaikuKakariko_GetTalkState(EnDaikuKakariko* this, GlobalContext* globalCtx return talkState; } -void EnDaikuKakariko_HandleTalking(EnDaikuKakariko* this, GlobalContext* globalCtx) { +void EnDaikuKakariko_HandleTalking(EnDaikuKakariko* this, PlayState* play) { static s32 maskReactionSets[] = { 1, 2, 3, 4 }; s16 sp26; s16 sp24; if (this->talkState == 2) { - this->talkState = EnDaikuKakariko_GetTalkState(this, globalCtx); - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + this->talkState = EnDaikuKakariko_GetTalkState(this, play); + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->talkState = 2; } else { - Actor_GetScreenPos(globalCtx, &this->actor, &sp26, &sp24); + Actor_GetScreenPos(play, &this->actor, &sp26, &sp24); if ((sp26 >= 0) && (sp26 <= 320) && (sp24 >= 0) && (sp24 <= 240) && (this->talkState == 0) && - (func_8002F2CC(&this->actor, globalCtx, 100.0f) == 1)) { - this->actor.textId = Text_GetFaceReaction(globalCtx, maskReactionSets[this->actor.params & 3]); + (func_8002F2CC(&this->actor, play, 100.0f) == 1)) { + this->actor.textId = Text_GetFaceReaction(play, maskReactionSets[this->actor.params & 3]); if (this->actor.textId == 0) { switch (this->actor.params & 3) { @@ -278,12 +277,12 @@ void EnDaikuKakariko_HandleTalking(EnDaikuKakariko* this, GlobalContext* globalC } } -void EnDaikuKakariko_Talk(EnDaikuKakariko* this, GlobalContext* globalCtx) { +void EnDaikuKakariko_Talk(EnDaikuKakariko* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_3, &this->currentAnimIndex); } - EnDaikuKakariko_HandleTalking(this, globalCtx); + EnDaikuKakariko_HandleTalking(this, play); if (this->talkState == 0) { if (this->flags & 0x10) { @@ -306,8 +305,8 @@ void EnDaikuKakariko_Talk(EnDaikuKakariko* this, GlobalContext* globalCtx) { } } -void EnDaikuKakariko_Wait(EnDaikuKakariko* this, GlobalContext* globalCtx) { - EnDaikuKakariko_HandleTalking(this, globalCtx); +void EnDaikuKakariko_Wait(EnDaikuKakariko* this, PlayState* play) { + EnDaikuKakariko_HandleTalking(this, play); if (SkelAnime_Update(&this->skelAnime)) { EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_0, &this->currentAnimIndex); @@ -327,7 +326,7 @@ void EnDaikuKakariko_Wait(EnDaikuKakariko* this, GlobalContext* globalCtx) { } } -void EnDaikuKakariko_StopRunning(EnDaikuKakariko* this, GlobalContext* globalCtx) { +void EnDaikuKakariko_StopRunning(EnDaikuKakariko* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->timer--; @@ -339,7 +338,7 @@ void EnDaikuKakariko_StopRunning(EnDaikuKakariko* this, GlobalContext* globalCtx } } - EnDaikuKakariko_HandleTalking(this, globalCtx); + EnDaikuKakariko_HandleTalking(this, play); if (this->talkState != 0) { this->flags |= 0x200; @@ -348,7 +347,7 @@ void EnDaikuKakariko_StopRunning(EnDaikuKakariko* this, GlobalContext* globalCtx } } -void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { +void EnDaikuKakariko_Run(EnDaikuKakariko* this, PlayState* play) { s32 pad; Path* path; Vec3s* pathPos; @@ -360,7 +359,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { s32 run; do { - path = &globalCtx->setupPathList[(this->actor.params >> 8) & 0xFF]; + path = &play->setupPathList[(this->actor.params >> 8) & 0xFF]; pathPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->waypoint]; xDist = pathPos->x - this->actor.world.pos.x; zDist = pathPos->z - this->actor.world.pos.z; @@ -432,17 +431,17 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if (this->flags & 0x40) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); } else if (this->flags & 0x80) { this->runFlag |= 1; this->flags &= ~0x0080; } else if (this->runFlag & 1) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); this->runFlag &= ~1; } SkelAnime_Update(&this->skelAnime); - EnDaikuKakariko_HandleTalking(this, globalCtx); + EnDaikuKakariko_HandleTalking(this, play); if (this->talkState != 0) { this->flags |= 0x200; @@ -451,10 +450,10 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { } } -void EnDaikuKakariko_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDaikuKakariko_Update(Actor* thisx, PlayState* play) { EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; if (this->currentAnimIndex == 3) { @@ -471,9 +470,9 @@ void EnDaikuKakariko_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.radius = 63; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->npcInfo.unk_18.x = player->actor.focus.pos.x; this->npcInfo.unk_18.y = player->actor.focus.pos.y; @@ -492,8 +491,7 @@ void EnDaikuKakariko_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->neckAngle.x, this->neckAngleTarget.x, 1, 1820, 0); } -s32 EnDaikuKakariko_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnDaikuKakariko_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; Vec3s angle; @@ -523,28 +521,28 @@ s32 EnDaikuKakariko_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gf return 0; } -void EnDaikuKakariko_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDaikuKakariko_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Gfx* carpenterHeadDLists[] = { object_daiku_DL_005BD0, object_daiku_DL_005AC0, object_daiku_DL_005990, object_daiku_DL_005880 }; static Vec3f unkVec = { 700.0f, 1100.0f, 0.0f }; EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_daiku_kakariko.c", 1104); + OPEN_DISPS(play->state.gfxCtx, "../z_en_daiku_kakariko.c", 1104); if (limbIndex == 15) { Matrix_MultVec3f(&unkVec, &this->actor.focus.pos); gSPDisplayList(POLY_OPA_DISP++, carpenterHeadDLists[this->actor.params & 3]); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_daiku_kakariko.c", 1113); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku_kakariko.c", 1113); } -void EnDaikuKakariko_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDaikuKakariko_Draw(Actor* thisx, PlayState* play) { EnDaikuKakariko* this = (EnDaikuKakariko*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_daiku_kakariko.c", 1124); + OPEN_DISPS(play->state.gfxCtx, "../z_en_daiku_kakariko.c", 1124); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if ((thisx->params & 3) == CARPENTER_ICHIRO) { gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255); @@ -556,8 +554,8 @@ void EnDaikuKakariko_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDaikuKakariko_OverrideLimbDraw, EnDaikuKakariko_PostLimbDraw, thisx); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_daiku_kakariko.c", 1151); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku_kakariko.c", 1151); } diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h index ebb5187c2b..ad87945ca4 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h @@ -6,7 +6,7 @@ struct EnDaikuKakariko; -typedef void (*EnDaikuKakarikoActionFunc)(struct EnDaikuKakariko*, GlobalContext*); +typedef void (*EnDaikuKakarikoActionFunc)(struct EnDaikuKakariko*, PlayState*); typedef struct EnDaikuKakariko { /* 0x0000 */ Actor actor; 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 e2801c6021..5afcc86182 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -5,27 +5,27 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnDekubaba_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDekubaba_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDekubaba_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDekubaba_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDekubaba_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); -void EnDekubaba_Grow(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_Retract(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_DecideLunge(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_Lunge(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_PrepareLunge(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_PullBack(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_Recover(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_Hit(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_StunnedVertical(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_Sway(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_PrunedSomersault(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_ShrinkDie(EnDekubaba* this, GlobalContext* globalCtx); -void EnDekubaba_DeadStickDrop(EnDekubaba* this, GlobalContext* globalCtx); +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 }; @@ -220,16 +220,16 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_STOP), }; -void EnDekubaba_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDekubaba_Init(Actor* thisx, PlayState* play) { EnDekubaba* this = (EnDekubaba*)thisx; s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDekuBabaSkel, &gDekuBabaFastChompAnim, this->jointTable, - this->morphTable, 8); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + 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; @@ -272,10 +272,10 @@ void EnDekubaba_Init(Actor* thisx, GlobalContext* globalCtx) { this->bodyPartsPos[3] = this->actor.home.pos; } -void EnDekubaba_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDekubaba_Destroy(Actor* thisx, PlayState* play) { EnDekubaba* this = (EnDekubaba*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnDekubaba_DisableHitboxes(EnDekubaba* this) { @@ -447,14 +447,14 @@ void EnDekubaba_SetupSway(EnDekubaba* this) { this->actionFunc = EnDekubaba_Sway; } -void EnDekubaba_SetupDeadStickDrop(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_SetupDeadStickDrop(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(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_MISC); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); this->actor.flags &= ~ACTOR_FLAG_5; this->timer = 200; this->actionFunc = EnDekubaba_DeadStickDrop; @@ -462,7 +462,7 @@ void EnDekubaba_SetupDeadStickDrop(EnDekubaba* this, GlobalContext* globalCtx) { // Action functions -void EnDekubaba_Wait(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_Wait(EnDekubaba* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -477,8 +477,8 @@ void EnDekubaba_Wait(EnDekubaba* this, GlobalContext* globalCtx) { } } -void EnDekubaba_Grow(EnDekubaba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDekubaba_Grow(EnDekubaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 headDistHorizontal; f32 headDistVertical; f32 headShiftX; @@ -533,8 +533,8 @@ void EnDekubaba_Grow(EnDekubaba* this, GlobalContext* globalCtx) { this->actor.world.pos.x = this->actor.home.pos.x + headShiftX; this->actor.world.pos.z = this->actor.home.pos.z + headShiftZ; - EffectSsHahen_SpawnBurst(globalCtx, &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->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) { @@ -545,7 +545,7 @@ void EnDekubaba_Grow(EnDekubaba* this, GlobalContext* globalCtx) { } } -void EnDekubaba_Retract(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_Retract(EnDekubaba* this, PlayState* play) { f32 headDistHorizontal; f32 headDistVertical; f32 xShift; @@ -594,8 +594,8 @@ void EnDekubaba_Retract(EnDekubaba* this, GlobalContext* globalCtx) { this->actor.world.pos.x = this->actor.home.pos.x + xShift; this->actor.world.pos.z = this->actor.home.pos.z + zShift; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, this->size * 3.0f, 0, this->size * 12.0f, - this->size * 5.0f, 1, HAHEN_OBJECT_DEFAULT, 0xA, NULL); + 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); @@ -617,8 +617,8 @@ void EnDekubaba_UpdateHeadPosition(EnDekubaba* this) { this->actor.home.pos.z + Math_CosS(this->actor.shape.rot.y) * (horizontalHeadShift * this->size); } -void EnDekubaba_DecideLunge(EnDekubaba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDekubaba_DecideLunge(EnDekubaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { @@ -663,7 +663,7 @@ void EnDekubaba_DecideLunge(EnDekubaba* this, GlobalContext* globalCtx) { } } -void EnDekubaba_Lunge(EnDekubaba* this, GlobalContext* globalCtx) { +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; @@ -696,7 +696,7 @@ void EnDekubaba_Lunge(EnDekubaba* this, GlobalContext* globalCtx) { velocity.y = 0.0f; velocity.z = Math_CosS(this->actor.shape.rot.y) * 5.0f; - func_8002829C(globalCtx, &this->actor.world.pos, &velocity, &sZeroVec, &primColor, &envColor, 1, + 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; @@ -722,8 +722,8 @@ void EnDekubaba_Lunge(EnDekubaba* this, GlobalContext* globalCtx) { EnDekubaba_UpdateHeadPosition(this); } -void EnDekubaba_PrepareLunge(EnDekubaba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDekubaba_PrepareLunge(EnDekubaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->timer != 0) { this->timer--; @@ -742,7 +742,7 @@ void EnDekubaba_PrepareLunge(EnDekubaba* this, GlobalContext* globalCtx) { EnDekubaba_UpdateHeadPosition(this); } -void EnDekubaba_PullBack(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_PullBack(EnDekubaba* this, PlayState* play) { Vec3f dustPos; f32 xIncr; f32 zIncr; @@ -760,7 +760,7 @@ void EnDekubaba_PullBack(EnDekubaba* this, GlobalContext* globalCtx) { dustPos = this->actor.home.pos; for (i = 0; i < 3; i++) { - func_800286CC(globalCtx, &dustPos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 50.0f); + func_800286CC(play, &dustPos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 50.0f); dustPos.x += xIncr; dustPos.z += zIncr; } @@ -827,7 +827,7 @@ void EnDekubaba_PullBack(EnDekubaba* this, GlobalContext* globalCtx) { EnDekubaba_UpdateHeadPosition(this); } -void EnDekubaba_Recover(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_Recover(EnDekubaba* this, PlayState* play) { s32 anyStepsDone; SkelAnime_Update(&this->skelAnime); @@ -857,7 +857,7 @@ void EnDekubaba_Recover(EnDekubaba* this, GlobalContext* globalCtx) { /** * Hit by a weapon or hit something when lunging. */ -void EnDekubaba_Hit(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_Hit(EnDekubaba* this, PlayState* play) { s32 allStepsDone; SkelAnime_Update(&this->skelAnime); @@ -888,7 +888,7 @@ void EnDekubaba_Hit(EnDekubaba* this, GlobalContext* globalCtx) { EnDekubaba_UpdateHeadPosition(this); } -void EnDekubaba_StunnedVertical(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_StunnedVertical(EnDekubaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -909,7 +909,7 @@ void EnDekubaba_StunnedVertical(EnDekubaba* this, GlobalContext* globalCtx) { /** * Sway back and forth with decaying amplitude until close enough to vertical. */ -void EnDekubaba_Sway(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_Sway(EnDekubaba* this, PlayState* play) { s16 angleToVertical; SkelAnime_Update(&this->skelAnime); @@ -934,7 +934,7 @@ void EnDekubaba_Sway(EnDekubaba* this, GlobalContext* globalCtx) { EnDekubaba_UpdateHeadPosition(this); } -void EnDekubaba_PrunedSomersault(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_PrunedSomersault(EnDekubaba* this, PlayState* play) { s32 i; Vec3f dustPos; f32 deltaX; @@ -948,7 +948,7 @@ void EnDekubaba_PrunedSomersault(EnDekubaba* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->stemSectionAngle[0], 0x4800, 0x71C); Math_ScaledStepToS(&this->stemSectionAngle[1], 0x4800, 0x71C); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, this->size * 3.0f, 0, this->size * 12.0f, + 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) && @@ -956,7 +956,7 @@ void EnDekubaba_PrunedSomersault(EnDekubaba* this, GlobalContext* globalCtx) { this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 0.0f; this->actor.speedXZ = 0.0f; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, this->size * 3.0f, 0, this->size * 12.0f, + 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); } @@ -972,60 +972,60 @@ void EnDekubaba_PrunedSomersault(EnDekubaba* this, GlobalContext* globalCtx) { 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(globalCtx, &dustPos, &sZeroVec, &sZeroVec, 500, 50); + func_800286CC(play, &dustPos, &sZeroVec, &sZeroVec, 500, 50); dustPos.x += deltaX; dustPos.y += deltaY; dustPos.z += deltaZ; } - func_800286CC(globalCtx, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 100.0f); - EnDekubaba_SetupDeadStickDrop(this, globalCtx); + func_800286CC(play, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 100.0f); + EnDekubaba_SetupDeadStickDrop(this, play); } } /** * Die and drop Deku Nuts (Stick drop is handled elsewhere) */ -void EnDekubaba_ShrinkDie(EnDekubaba* this, GlobalContext* globalCtx) { +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(globalCtx, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 100.0f); + func_800286CC(play, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 100.0f); if (this->actor.dropFlag == 0) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_NUTS); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); if (this->actor.params == DEKUBABA_BIG) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_NUTS); - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_NUTS); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); } } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x30); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x30); } Actor_Kill(&this->actor); } this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; this->actor.shape.rot.z += 0x1C70; - EffectSsHahen_SpawnBurst(globalCtx, &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->size * 3.0f, 0, this->size * 12.0f, this->size * 5.0f, + 1, HAHEN_OBJECT_DEFAULT, 10, NULL); } -void EnDekubaba_DeadStickDrop(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_DeadStickDrop(EnDekubaba* this, PlayState* play) { if (this->timer != 0) { this->timer--; } - if (Actor_HasParent(&this->actor, globalCtx) || (this->timer == 0)) { + if (Actor_HasParent(&this->actor, play) || (this->timer == 0)) { Actor_Kill(&this->actor); return; } - func_8002F554(&this->actor, globalCtx, GI_STICKS_1); + func_8002F554(&this->actor, play, GI_STICKS_1); } // Update and associated functions -void EnDekubaba_UpdateDamage(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_UpdateDamage(EnDekubaba* this, PlayState* play) { Vec3f* firePos; f32 fireScale; s32 phi_s0; // Used for both health and iterator @@ -1076,13 +1076,13 @@ void EnDekubaba_UpdateDamage(EnDekubaba* this, GlobalContext* globalCtx) { fireScale = (this->size * 70.0f); for (phi_s0 = 0; phi_s0 < 4; phi_s0++) { - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, firePos, fireScale, 0, 0, phi_s0); + EffectSsEnFire_SpawnVec3f(play, &this->actor, firePos, fireScale, 0, 0, phi_s0); } } } else { return; } - } else if ((globalCtx->actorCtx.unk_02 != 0) && (this->collider.base.colType != COLTYPE_HARD) && + } else if ((play->actorCtx.unk_02 != 0) && (this->collider.base.colType != COLTYPE_HARD) && (this->actionFunc != EnDekubaba_StunnedVertical) && (this->actionFunc != EnDekubaba_Hit) && (this->actor.colChkInfo.health != 0)) { this->actor.colChkInfo.health--; @@ -1099,7 +1099,7 @@ void EnDekubaba_UpdateDamage(EnDekubaba* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKU_DAMAGE); } } else { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); if (this->actor.params == DEKUBABA_BIG) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKU_DEAD); } else { @@ -1108,7 +1108,7 @@ void EnDekubaba_UpdateDamage(EnDekubaba* this, GlobalContext* globalCtx) { } } -void EnDekubaba_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDekubaba_Update(Actor* thisx, PlayState* play) { s32 pad; EnDekubaba* this = (EnDekubaba*)thisx; @@ -1117,39 +1117,39 @@ void EnDekubaba_Update(Actor* thisx, GlobalContext* globalCtx) { EnDekubaba_SetupRecover(this); } - EnDekubaba_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnDekubaba_UpdateDamage(this, play); + this->actionFunc(this, play); if (this->actionFunc == EnDekubaba_PrunedSomersault) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, this->size * 15.0f, 10.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->size * 15.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } else if (this->actionFunc != EnDekubaba_DeadStickDrop) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (this->boundFloor == NULL) { this->boundFloor = this->actor.floorPoly; } } if (this->actionFunc == EnDekubaba_Lunge) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); this->actor.flags |= ACTOR_FLAG_24; } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnDekubaba_DeadStickDrop) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } // Draw functions -void EnDekubaba_DrawStemRetracted(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_DrawStemRetracted(EnDekubaba* this, PlayState* play) { f32 horizontalScale; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2445); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2445); horizontalScale = this->size * 0.01f; @@ -1157,16 +1157,16 @@ void EnDekubaba_DrawStemRetracted(EnDekubaba* this, GlobalContext* globalCtx) { MTXMODE_NEW); Matrix_RotateZYX(this->stemSectionAngle[0], this->actor.shape.rot.y, 0, MTXMODE_APPLY); Matrix_Scale(horizontalScale, horizontalScale, horizontalScale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2461), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dekubaba.c", 2461), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemTopDL); Actor_SetFocus(&this->actor, 0.0f); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2468); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2468); } -void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_DrawStemExtended(EnDekubaba* this, PlayState* play) { static Gfx* stemDLists[] = { gDekuBabaStemTopDL, gDekuBabaStemMiddleDL, gDekuBabaStemBaseDL }; MtxF mtx; s32 i; @@ -1175,7 +1175,7 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { f32 scale; s32 stemSections; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2487); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2487); if (this->actionFunc == EnDekubaba_PrunedSomersault) { stemSections = 2; @@ -1202,7 +1202,7 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { Matrix_Put(&mtx); Matrix_RotateZYX(this->stemSectionAngle[i], this->actor.shape.rot.y, 0, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2533), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dekubaba.c", 2533), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, stemDLists[i]); @@ -1230,28 +1230,28 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2569); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2569); } -void EnDekubaba_DrawStemBasePruned(EnDekubaba* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2579); +void EnDekubaba_DrawStemBasePruned(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); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2586), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dekubaba.c", 2586), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemBaseDL); Collider_UpdateSpheres(55, &this->collider); Collider_UpdateSpheres(56, &this->collider); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2596); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2596); } -void EnDekubaba_DrawBaseShadow(EnDekubaba* this, GlobalContext* globalCtx) { +void EnDekubaba_DrawBaseShadow(EnDekubaba* this, PlayState* play) { MtxF mtx; f32 horizontalScale; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2692); - func_80094044(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2692); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); @@ -1260,13 +1260,13 @@ void EnDekubaba_DrawBaseShadow(EnDekubaba* this, GlobalContext* globalCtx) { horizontalScale = this->size * 0.15f; Matrix_Scale(horizontalScale, 1.0f, horizontalScale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2710), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dekubaba.c", 2710), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2715); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2715); } -void EnDekubaba_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDekubaba_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnDekubaba* this = (EnDekubaba*)thisx; if (limbIndex == 1) { @@ -1274,47 +1274,47 @@ void EnDekubaba_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } -void EnDekubaba_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDekubaba_Draw(Actor* thisx, PlayState* play) { EnDekubaba* this = (EnDekubaba*)thisx; f32 scale; if (1) {} - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2752); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2752); + func_80093D18(play->state.gfxCtx); if (this->actionFunc != EnDekubaba_DeadStickDrop) { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, - EnDekubaba_PostLimbDraw, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDekubaba_PostLimbDraw, + this); if (this->actionFunc == EnDekubaba_Wait) { - EnDekubaba_DrawStemRetracted(this, globalCtx); + EnDekubaba_DrawStemRetracted(this, play); } else { - EnDekubaba_DrawStemExtended(this, globalCtx); + EnDekubaba_DrawStemExtended(this, play); } scale = this->size * 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); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2780), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dekubaba.c", 2780), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaBaseLeavesDL); if (this->actionFunc == EnDekubaba_PrunedSomersault) { - EnDekubaba_DrawStemBasePruned(this, globalCtx); + EnDekubaba_DrawStemBasePruned(this, play); } if (this->boundFloor != NULL) { - EnDekubaba_DrawBaseShadow(this, globalCtx); + EnDekubaba_DrawBaseShadow(this, play); } // 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); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2797), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dekubaba.c", 2797), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStickDropDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2804); + 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 fa80ce82dd..b6e5243e95 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -6,7 +6,7 @@ struct EnDekubaba; -typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, GlobalContext*); +typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, PlayState*); typedef enum { /* 0 */ DEKUBABA_NORMAL, diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index 23df57679a..f292bbdd72 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -12,23 +12,23 @@ #define DEKUNUTS_FLOWER 10 -void EnDekunuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDekunuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDekunuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDekunuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDekunuts_Init(Actor* thisx, PlayState* play); +void EnDekunuts_Destroy(Actor* thisx, PlayState* play); +void EnDekunuts_Update(Actor* thisx, PlayState* play); +void EnDekunuts_Draw(Actor* thisx, PlayState* play); void EnDekunuts_SetupWait(EnDekunuts* this); -void EnDekunuts_Wait(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_LookAround(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_Stand(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_ThrowNut(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_Burrow(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_BeginRun(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_Run(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_Gasp(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_BeDamaged(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_BeStunned(EnDekunuts* this, GlobalContext* globalCtx); -void EnDekunuts_Die(EnDekunuts* this, GlobalContext* globalCtx); +void EnDekunuts_Wait(EnDekunuts* this, PlayState* play); +void EnDekunuts_LookAround(EnDekunuts* this, PlayState* play); +void EnDekunuts_Stand(EnDekunuts* this, PlayState* play); +void EnDekunuts_ThrowNut(EnDekunuts* this, PlayState* play); +void EnDekunuts_Burrow(EnDekunuts* this, PlayState* play); +void EnDekunuts_BeginRun(EnDekunuts* this, PlayState* play); +void EnDekunuts_Run(EnDekunuts* this, PlayState* play); +void EnDekunuts_Gasp(EnDekunuts* this, PlayState* play); +void EnDekunuts_BeDamaged(EnDekunuts* this, PlayState* play); +void EnDekunuts_BeStunned(EnDekunuts* this, PlayState* play); +void EnDekunuts_Die(EnDekunuts* this, PlayState* play); const ActorInit En_Dekunuts_InitVars = { ACTOR_EN_DEKUNUTS, @@ -105,7 +105,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2600, ICHAIN_STOP), }; -void EnDekunuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDekunuts_Init(Actor* thisx, PlayState* play) { EnDekunuts* this = (EnDekunuts*)thisx; s32 pad; @@ -114,10 +114,10 @@ void EnDekunuts_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); } else { ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDekuNutsSkel, &gDekuNutsStandAnim, this->jointTable, - this->morphTable, 25); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_Init(play, &this->skelAnime, &gDekuNutsSkel, &gDekuNutsStandAnim, this->jointTable, this->morphTable, + 25); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); this->shotsPerRound = ((thisx->params >> 8) & 0xFF); thisx->params &= 0xFF; @@ -125,16 +125,16 @@ void EnDekunuts_Init(Actor* thisx, GlobalContext* globalCtx) { this->shotsPerRound = 1; } EnDekunuts_SetupWait(this); - Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_DEKUNUTS, thisx->world.pos.x, - thisx->world.pos.y, thisx->world.pos.z, 0, thisx->world.rot.y, 0, DEKUNUTS_FLOWER); + Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_DEKUNUTS, thisx->world.pos.x, thisx->world.pos.y, + thisx->world.pos.z, 0, thisx->world.rot.y, 0, DEKUNUTS_FLOWER); } } -void EnDekunuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDekunuts_Destroy(Actor* thisx, PlayState* play) { EnDekunuts* this = (EnDekunuts*)thisx; if (this->actor.params != DEKUNUTS_FLOWER) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } @@ -234,7 +234,7 @@ void EnDekunuts_SetupDie(EnDekunuts* this) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DEAD); } -void EnDekunuts_Wait(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Wait(EnDekunuts* this, PlayState* play) { s32 hasSlowPlaybackSpeed = false; if (this->skelAnime.playSpeed < 0.5f) { @@ -268,7 +268,7 @@ void EnDekunuts_Wait(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_LookAround(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_LookAround(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; @@ -278,7 +278,7 @@ void EnDekunuts_LookAround(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_Stand(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Stand(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; @@ -297,7 +297,7 @@ void EnDekunuts_Stand(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_ThrowNut(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_ThrowNut(EnDekunuts* this, PlayState* play) { Vec3f spawnPos; Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); @@ -307,7 +307,7 @@ void EnDekunuts_ThrowNut(EnDekunuts* this, GlobalContext* globalCtx) { spawnPos.x = this->actor.world.pos.x + (Math_SinS(this->actor.shape.rot.y) * 23.0f); spawnPos.y = this->actor.world.pos.y + 12.0f; spawnPos.z = this->actor.world.pos.z + (Math_CosS(this->actor.shape.rot.y) * 23.0f); - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NUTSBALL, spawnPos.x, spawnPos.y, spawnPos.z, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, spawnPos.x, spawnPos.y, spawnPos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 0) != NULL) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW); } @@ -319,7 +319,7 @@ void EnDekunuts_ThrowNut(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_Burrow(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Burrow(EnDekunuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnDekunuts_SetupWait(this); } else { @@ -332,7 +332,7 @@ void EnDekunuts_Burrow(EnDekunuts* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.world.pos.z, this->actor.home.pos.z, 0.5f, 3.0f); } -void EnDekunuts_BeginRun(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_BeginRun(EnDekunuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->runDirection = this->actor.yawTowardsPlayer + 0x8000; this->runAwayCount = 3; @@ -341,7 +341,7 @@ void EnDekunuts_BeginRun(EnDekunuts* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); } -void EnDekunuts_Run(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Run(EnDekunuts* this, PlayState* play) { s16 diffRotInit; s16 diffRot; f32 phi_f0; @@ -388,7 +388,7 @@ void EnDekunuts_Run(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_Gasp(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Gasp(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; @@ -398,14 +398,14 @@ void EnDekunuts_Gasp(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_BeDamaged(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_BeDamaged(EnDekunuts* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); if (SkelAnime_Update(&this->skelAnime)) { EnDekunuts_SetupDie(this); } } -void EnDekunuts_BeStunned(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_BeStunned(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { if (this->animFlagAndTimer != 0) { @@ -419,7 +419,7 @@ void EnDekunuts_BeStunned(EnDekunuts* this, GlobalContext* globalCtx) { } } -void EnDekunuts_Die(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_Die(EnDekunuts* this, PlayState* play) { static Vec3f effectVelAndAccel = { 0.0f, 0.0f, 0.0f }; s32 pad; @@ -429,19 +429,19 @@ void EnDekunuts_Die(EnDekunuts* this, GlobalContext* globalCtx) { effectPos.x = this->actor.world.pos.x; effectPos.y = this->actor.world.pos.y + 18.0f; effectPos.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &effectPos, &effectVelAndAccel, &effectVelAndAccel, 200, 0, 255, 255, 255, 255, - 150, 150, 150, 1, 13, 1); + EffectSsDeadDb_Spawn(play, &effectPos, &effectVelAndAccel, &effectVelAndAccel, 200, 0, 255, 255, 255, 255, 150, + 150, 150, 1, 13, 1); effectPos.y = this->actor.world.pos.y + 10.0f; - EffectSsHahen_SpawnBurst(globalCtx, &effectPos, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x30); + EffectSsHahen_SpawnBurst(play, &effectPos, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x30); if (this->actor.child != NULL) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, this->actor.child, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, this->actor.child, ACTORCAT_PROP); } Actor_Kill(&this->actor); } } -void EnDekunuts_ColliderCheck(EnDekunuts* this, GlobalContext* globalCtx) { +void EnDekunuts_ColliderCheck(EnDekunuts* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, true); @@ -449,11 +449,11 @@ void EnDekunuts_ColliderCheck(EnDekunuts* this, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (this->actor.colChkInfo.damageEffect != 1) { if (this->actor.colChkInfo.damageEffect == 2) { - EffectSsFCircle_Spawn(globalCtx, &this->actor, &this->actor.world.pos, 40, 50); + EffectSsFCircle_Spawn(play, &this->actor, &this->actor.world.pos, 40, 50); } EnDekunuts_SetupBeDamaged(this); if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } } else if (this->actionFunc != EnDekunuts_BeStunned) { EnDekunuts_SetupBeStunned(this); @@ -462,27 +462,27 @@ void EnDekunuts_ColliderCheck(EnDekunuts* this, GlobalContext* globalCtx) { } else { EnDekunuts_SetupBeginRun(this); } - } else if ((this->actor.colChkInfo.mass == MASS_IMMOVABLE) && (globalCtx->actorCtx.unk_02 != 0)) { + } else if ((this->actor.colChkInfo.mass == MASS_IMMOVABLE) && (play->actorCtx.unk_02 != 0)) { EnDekunuts_SetupBeginRun(this); } } -void EnDekunuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDekunuts_Update(Actor* thisx, PlayState* play) { EnDekunuts* this = (EnDekunuts*)thisx; s32 pad; if (this->actor.params != DEKUNUTS_FLOWER) { - EnDekunuts_ColliderCheck(this, globalCtx); - this->actionFunc(this, globalCtx); + EnDekunuts_ColliderCheck(this, play); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actionFunc == EnDekunuts_Wait) { Actor_SetFocus(&this->actor, this->skelAnime.curFrame); } else if (this->actionFunc == EnDekunuts_Burrow) { @@ -494,8 +494,7 @@ void EnDekunuts_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnDekunuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnDekunuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDekunuts* this = (EnDekunuts*)thisx; f32 x; f32 y; @@ -525,13 +524,13 @@ s32 EnDekunuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnDekunuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDekunuts_Draw(Actor* thisx, PlayState* play) { EnDekunuts* this = (EnDekunuts*)thisx; if (this->actor.params == DEKUNUTS_FLOWER) { - Gfx_DrawDListOpa(globalCtx, gDekuNutsFlowerDL); + Gfx_DrawDListOpa(play, gDekuNutsFlowerDL); } else { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDekunuts_OverrideLimbDraw, - NULL, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDekunuts_OverrideLimbDraw, NULL, + this); } } diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h index f80727ac73..9003055978 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h @@ -6,7 +6,7 @@ struct EnDekunuts; -typedef void (*EnDekunutsActionFunc)(struct EnDekunuts*, GlobalContext*); +typedef void (*EnDekunutsActionFunc)(struct EnDekunuts*, PlayState*); typedef struct EnDekunuts { /* 0x0000 */ Actor actor; 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 19822c2798..dad253def9 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -13,23 +13,23 @@ typedef enum { /* 6 */ DH_DAMAGE } EnDhAction; -void EnDh_Init(Actor* this, GlobalContext* globalCtx); -void EnDh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDh_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDh_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDh_Init(Actor* this, PlayState* play); +void EnDh_Destroy(Actor* thisx, PlayState* play); +void EnDh_Update(Actor* thisx, PlayState* play); +void EnDh_Draw(Actor* thisx, PlayState* play); void EnDh_SetupWait(EnDh* this); void EnDh_SetupWalk(EnDh* this); void EnDh_SetupAttack(EnDh* this); void EnDh_SetupBurrow(EnDh* this); -void EnDh_Wait(EnDh* this, GlobalContext* globalCtx); -void EnDh_Walk(EnDh* this, GlobalContext* globalCtx); -void EnDh_Retreat(EnDh* this, GlobalContext* globalCtx); -void EnDh_Attack(EnDh* this, GlobalContext* globalCtx); -void EnDh_Burrow(EnDh* this, GlobalContext* globalCtx); -void EnDh_Damage(EnDh* this, GlobalContext* globalCtx); -void EnDh_Death(EnDh* this, GlobalContext* globalCtx); +void EnDh_Wait(EnDh* this, PlayState* play); +void EnDh_Walk(EnDh* this, PlayState* play); +void EnDh_Retreat(EnDh* this, PlayState* play); +void EnDh_Attack(EnDh* this, PlayState* play); +void EnDh_Burrow(EnDh* this, PlayState* play); +void EnDh_Damage(EnDh* this, PlayState* play); +void EnDh_Death(EnDh* this, PlayState* play); const ActorInit En_Dh_InitVars = { ACTOR_EN_DH, @@ -136,12 +136,12 @@ void EnDh_SetupAction(EnDh* this, EnDhActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnDh_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDh_Init(Actor* thisx, PlayState* play) { EnDh* this = (EnDh*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &D_809EC620; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dh_Skel_007E88, &object_dh_Anim_005880, this->jointTable, + 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); this->actor.params = ENDH_WAIT_UNDERGROUND; @@ -149,24 +149,23 @@ void EnDh_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.health = LINK_IS_ADULT ? 14 : 20; this->alpha = this->unk_258 = 255; this->actor.flags &= ~ACTOR_FLAG_0; - Collider_InitCylinder(globalCtx, &this->collider1); - Collider_SetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit); - Collider_InitJntSph(globalCtx, &this->collider2); - Collider_SetJntSph(globalCtx, &this->collider2, &this->actor, &sJntSphInit, this->elements); + Collider_InitCylinder(play, &this->collider1); + Collider_SetCylinder(play, &this->collider1, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->collider2); + Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit, this->elements); EnDh_SetupWait(this); } -void EnDh_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDh_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnDh* this = (EnDh*)thisx; func_800F5B58(); - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyJntSph(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyJntSph(play, &this->collider2); } -void EnDh_SpawnDebris(GlobalContext* globalCtx, EnDh* this, Vec3f* spawnPos, f32 spread, s32 arg4, f32 accelXZ, - f32 scale) { +void EnDh_SpawnDebris(PlayState* play, EnDh* this, Vec3f* spawnPos, f32 spread, s32 arg4, f32 accelXZ, f32 scale) { Vec3f pos; Vec3f vel = { 0.0f, 8.0f, 0.0f }; Vec3f accel = { 0.0f, -1.5f, 0.0f }; @@ -181,7 +180,7 @@ void EnDh_SpawnDebris(GlobalContext* globalCtx, EnDh* this, Vec3f* spawnPos, f32 accel.z = (Rand_ZeroOne() - 0.5f) * accelXZ; vel.y += (Rand_ZeroOne() - 0.5f) * 4.0f; scaleMod = (Rand_ZeroOne() * 5.0f) + 12.0f; - EffectSsHahen_Spawn(globalCtx, &pos, &vel, &accel, arg4, scaleMod * scale, -1, 10, NULL); + EffectSsHahen_Spawn(play, &pos, &vel, &accel, arg4, scaleMod * scale, -1, 10, NULL); } void EnDh_SetupWait(EnDh* this) { @@ -197,11 +196,11 @@ void EnDh_SetupWait(EnDh* this) { EnDh_SetupAction(this, EnDh_Wait); } -void EnDh_Wait(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Wait(EnDh* this, PlayState* play) { if ((s32)this->skelAnime.curFrame == 5) { func_800F5ACC(NA_BGM_MINI_BOSS); } - if (Actor_GetCollidedExplosive(globalCtx, &this->collider1.base)) { + if (Actor_GetCollidedExplosive(play, &this->collider1.base)) { this->actor.params = ENDH_START_ATTACK_BOMB; } if ((this->actor.params >= ENDH_START_ATTACK_GRAB) || (this->actor.params <= ENDH_HANDS_KILLED_4)) { @@ -218,7 +217,7 @@ void EnDh_Wait(EnDh* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->dirtWaveSpread, 300.0f, 1.0f, 5.0f, 0.0f); this->dirtWaveHeight = Math_SinS(this->dirtWavePhase) * 55.0f; this->dirtWaveAlpha = (s16)(Math_SinS(this->dirtWavePhase) * 255.0f); - EnDh_SpawnDebris(globalCtx, this, &this->actor.world.pos, this->dirtWaveSpread, 4, 2.05f, 1.2f); + EnDh_SpawnDebris(play, this, &this->actor.world.pos, this->dirtWaveSpread, 4, 2.05f, 1.2f); if (this->actor.shape.yOffset == 0.0f) { this->drawDirtWave = false; this->actionState++; @@ -233,7 +232,7 @@ void EnDh_Wait(EnDh* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x7D0, 0); SkelAnime_Update(&this->skelAnime); if (this->actor.params != ENDH_START_ATTACK_BOMB) { - func_8008EEAC(globalCtx, &this->actor); + func_8008EEAC(play, &this->actor); } } } @@ -247,14 +246,14 @@ void EnDh_SetupWalk(EnDh* this) { EnDh_SetupAction(this, EnDh_Walk); } -void EnDh_Walk(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Walk(EnDh* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA, 0); this->actor.world.rot.y = this->actor.shape.rot.y; SkelAnime_Update(&this->skelAnime); if (((s32)this->skelAnime.curFrame % 8) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEADHAND_WALK); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEADHAND_LAUGH); } if (this->actor.xzDistToPlayer <= 100.0f) { @@ -267,7 +266,7 @@ void EnDh_Walk(EnDh* this, GlobalContext* globalCtx) { } } -void EnDh_SetupRetreat(EnDh* this, GlobalContext* globalCtx) { +void EnDh_SetupRetreat(EnDh* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &object_dh_Anim_005880, -4.0f); this->curAction = DH_RETREAT; this->timer = 70; @@ -275,7 +274,7 @@ void EnDh_SetupRetreat(EnDh* this, GlobalContext* globalCtx) { EnDh_SetupAction(this, EnDh_Retreat); } -void EnDh_Retreat(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Retreat(EnDh* this, PlayState* play) { this->timer--; if (this->timer == 0) { this->retreat = false; @@ -295,7 +294,7 @@ void EnDh_SetupAttack(EnDh* this) { EnDh_SetupAction(this, EnDh_Attack); } -void EnDh_Attack(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Attack(EnDh* this, PlayState* play) { s32 pad; if (SkelAnime_Update(&this->skelAnime)) { @@ -330,7 +329,7 @@ void EnDh_Attack(EnDh* this, GlobalContext* globalCtx) { this->actionState++; } else if (this->collider2.base.atFlags & AT_HIT) { this->collider2.base.atFlags &= ~AT_HIT; - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.shape.rot.y, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.shape.rot.y, 8.0f); } break; case 3: @@ -368,7 +367,7 @@ void EnDh_SetupBurrow(EnDh* this) { EnDh_SetupAction(this, EnDh_Burrow); } -void EnDh_Burrow(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Burrow(EnDh* this, PlayState* play) { switch (this->actionState) { case 0: this->actionState++; @@ -382,7 +381,7 @@ void EnDh_Burrow(EnDh* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->dirtWaveSpread, 300.0f, 1.0f, 8.0f, 0.0f); this->dirtWaveHeight = Math_SinS(this->dirtWavePhase) * 55.0f; this->dirtWaveAlpha = (s16)(Math_SinS(this->dirtWavePhase) * 255.0f); - EnDh_SpawnDebris(globalCtx, this, &this->actor.world.pos, this->dirtWaveSpread, 4, 2.05f, 1.2f); + EnDh_SpawnDebris(play, this, &this->actor.world.pos, this->dirtWaveSpread, 4, 2.05f, 1.2f); this->collider1.dim.radius = this->dirtWaveSpread * 0.6f; if (SkelAnime_Update(&this->skelAnime)) { this->actionState++; @@ -408,7 +407,7 @@ void EnDh_SetupDamage(EnDh* this) { EnDh_SetupAction(this, EnDh_Damage); } -void EnDh_Damage(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Damage(EnDh* this, PlayState* play) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; } @@ -416,7 +415,7 @@ void EnDh_Damage(EnDh* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.world.rot.y = this->actor.shape.rot.y; if (this->retreat) { - EnDh_SetupRetreat(this, globalCtx); + EnDh_SetupRetreat(this, play); } else if ((this->actor.xzDistToPlayer <= 105.0f) && Actor_IsFacingPlayer(&this->actor, 60 * 0x10000 / 360)) { f32 frames = Animation_GetLastFrame(&object_dh_Anim_004658); @@ -441,7 +440,7 @@ void EnDh_SetupDeath(EnDh* this) { EnDh_SetupAction(this, EnDh_Death); } -void EnDh_Death(EnDh* this, GlobalContext* globalCtx) { +void EnDh_Death(EnDh* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) || (this->timer != 300)) { if (this->timer == 300) { Animation_PlayLoop(&this->skelAnime, &object_dh_Anim_00375C); @@ -462,14 +461,14 @@ void EnDh_Death(EnDh* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DOWN); } if ((s32)this->skelAnime.curFrame == 61) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } } } -void EnDh_CollisionCheck(EnDh* this, GlobalContext* globalCtx) { +void EnDh_CollisionCheck(EnDh* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 lastHealth; if ((this->collider2.base.acFlags & AC_HIT) && !this->retreat) { @@ -484,7 +483,7 @@ void EnDh_CollisionCheck(EnDh* this, GlobalContext* globalCtx) { lastHealth = this->actor.colChkInfo.health; if (Actor_ApplyDamage(&this->actor) == 0) { EnDh_SetupDeath(this); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); } else { if (((lastHealth >= 15) && (this->actor.colChkInfo.health < 15)) || ((lastHealth >= 9) && (this->actor.colChkInfo.health < 9)) || @@ -498,40 +497,40 @@ void EnDh_CollisionCheck(EnDh* this, GlobalContext* globalCtx) { } } -void EnDh_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDh_Update(Actor* thisx, PlayState* play) { s32 pad; EnDh* this = (EnDh*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad40; - EnDh_CollisionCheck(this, globalCtx); - this->actionFunc(this, globalCtx); + EnDh_CollisionCheck(this, play); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 45.0f, 45.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 45.0f, 45.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); this->actor.focus.pos = this->headPos; Collider_UpdateCylinder(&this->actor, &this->collider1); if (this->actor.colChkInfo.health > 0) { if (this->curAction == DH_WAIT) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); } else { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); } if (((this->curAction != DH_DAMAGE) && (this->actor.shape.yOffset == 0.0f)) || ((player->unk_844 != 0) && (player->unk_845 != this->unk_258))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); } } else { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } } -void EnDh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnDh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { Vec3f headOffset = { 2000.0f, 1000.0f, 0.0f }; EnDh* this = (EnDh*)thisx; @@ -544,40 +543,39 @@ void EnDh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnDh_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDh_Draw(Actor* thisx, PlayState* play) { s32 pad; EnDh* this = (EnDh*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dh.c", 1099); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dh.c", 1099); if (this->alpha == 255) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); POLY_OPA_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, NULL, EnDh_PostLimbDraw, &this->actor, POLY_OPA_DISP); + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + NULL, EnDh_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x08, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor, POLY_XLU_DISP); } if (this->drawDirtWave) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 85, 55, 0, 130); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * -3) % 0x80, 0, 0x20, 0x40, 1, - (globalCtx->state.frames * -10) % 0x80, (globalCtx->state.frames * -20) % 0x100, - 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (play->state.frames * -3) % 0x80, 0, 0x20, 0x40, 1, + (play->state.frames * -10) % 0x80, (play->state.frames * -20) % 0x100, 0x20, 0x40)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 0, 0, 0, this->dirtWaveAlpha); Matrix_Translate(0.0f, -this->actor.shape.yOffset, 0.0f, MTXMODE_APPLY); Matrix_Scale(this->dirtWaveSpread * 0.01f, this->dirtWaveHeight * 0.01f, this->dirtWaveSpread * 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dh.c", 1160), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dh.c", 1160), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_dh_DL_007FC0); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dh.c", 1166); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dh.c", 1166); } diff --git a/src/overlays/actors/ovl_En_Dh/z_en_dh.h b/src/overlays/actors/ovl_En_Dh/z_en_dh.h index 37d716c59e..afe0ffddea 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.h +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.h @@ -6,7 +6,7 @@ struct EnDh; -typedef void (*EnDhActionFunc)(struct EnDh*, GlobalContext*); +typedef void (*EnDhActionFunc)(struct EnDh*, PlayState*); typedef struct EnDh { /* 0x0000 */ Actor actor; 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 467360c85a..7225a41881 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -10,18 +10,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnDha_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDha_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDha_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDha_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDha_Init(Actor* thisx, PlayState* play); +void EnDha_Destroy(Actor* thisx, PlayState* play); +void EnDha_Update(Actor* thisx, PlayState* play); +void EnDha_Draw(Actor* thisx, PlayState* play); void EnDha_SetupWait(EnDha* this); -void EnDha_Wait(EnDha* this, GlobalContext* globalCtx); +void EnDha_Wait(EnDha* this, PlayState* play); void EnDha_SetupTakeDamage(EnDha* this); -void EnDha_TakeDamage(EnDha* this, GlobalContext* globalCtx); +void EnDha_TakeDamage(EnDha* this, PlayState* play); void EnDha_SetupDeath(EnDha* this); -void EnDha_Die(EnDha* this, GlobalContext* globalCtx); -void EnDha_UpdateHealth(EnDha* this, GlobalContext* globalCtx); +void EnDha_Die(EnDha* this, PlayState* play); +void EnDha_UpdateHealth(EnDha* this, PlayState* play); const ActorInit En_Dha_InitVars = { ACTOR_EN_DHA, @@ -151,12 +151,12 @@ void EnDha_SetupAction(EnDha* this, EnDhaActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnDha_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDha_Init(Actor* thisx, PlayState* play) { EnDha* this = (EnDha*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dh_Skel_000BD8, &object_dh_Anim_0015B0, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_dh_Skel_000BD8, &object_dh_Anim_0015B0, this->jointTable, this->morphTable, 4); ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawFeet, 90.0f); this->actor.focus.pos = this->actor.world.pos; @@ -164,18 +164,18 @@ void EnDha_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 8; this->limbAngleX[0] = -0x4000; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItem); this->actor.flags &= ~ACTOR_FLAG_0; EnDha_SetupWait(this); } -void EnDha_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDha_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnDha* this = (EnDha*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnDha_SetupWait(EnDha* this) { @@ -188,11 +188,11 @@ void EnDha_SetupWait(EnDha* this) { EnDha_SetupAction(this, EnDha_Wait); } -void EnDha_Wait(EnDha* this, GlobalContext* globalCtx) { +void EnDha_Wait(EnDha* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; // unused Vec3f armPosMultiplier1 = { 0.0f, 0.0f, 55.0f }; Vec3f armPosMultiplier2 = { 0.0f, 0.0f, -54.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; s32 pad2; Vec3f playerPos = player->actor.world.pos; @@ -213,7 +213,7 @@ void EnDha_Wait(EnDha* this, GlobalContext* globalCtx) { if (Math_Vec3f_DistXYZ(&playerPos, &this->handPos[0]) <= 12.0f) { if (this->unk_1CC == 0) { - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { this->timer = 0; this->unk_1CC++; @@ -300,8 +300,8 @@ void EnDha_SetupTakeDamage(EnDha* this) { EnDha_SetupAction(this, EnDha_TakeDamage); } -void EnDha_TakeDamage(EnDha* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDha_TakeDamage(EnDha* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~PLAYER_STATE2_7; @@ -336,10 +336,10 @@ void EnDha_SetupDeath(EnDha* this) { EnDha_SetupAction(this, EnDha_Die); } -void EnDha_Die(EnDha* this, GlobalContext* globalCtx) { +void EnDha_Die(EnDha* this, PlayState* play) { s16 angle; Vec3f vec; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~PLAYER_STATE2_7; @@ -357,7 +357,7 @@ void EnDha_Die(EnDha* this, GlobalContext* globalCtx) { if (this->actionTimer != 0) { if (-12000.0f < this->actor.shape.yOffset) { this->actor.shape.yOffset -= 1000.0f; - func_80033480(globalCtx, &vec, 7.0f, 1, 0x5A, 0x14, 1); + func_80033480(play, &vec, 7.0f, 1, 0x5A, 0x14, 1); } else { this->actionTimer--; @@ -367,7 +367,7 @@ void EnDha_Die(EnDha* this, GlobalContext* globalCtx) { } } else { this->actor.shape.yOffset += 500.0f; - func_80033480(globalCtx, &vec, 7.0f, 1, 0x5A, 0x14, 1); + func_80033480(play, &vec, 7.0f, 1, 0x5A, 0x14, 1); if (this->actor.shape.yOffset == 0.0f) { EnDha_SetupWait(this); @@ -376,7 +376,7 @@ void EnDha_Die(EnDha* this, GlobalContext* globalCtx) { } } -void EnDha_UpdateHealth(EnDha* this, GlobalContext* globalCtx) { +void EnDha_UpdateHealth(EnDha* this, PlayState* play) { if (!((this->unk_1C0 >= 8) || !(this->collider.base.acFlags & AC_HIT))) { this->collider.base.acFlags &= ~AC_HIT; @@ -387,7 +387,7 @@ void EnDha_UpdateHealth(EnDha* this, GlobalContext* globalCtx) { if (Actor_ApplyDamage(&this->actor) == 0) { EnDha_SetupDeath(this); this->actor.colChkInfo.health = 8; - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEADHAND_DAMAGE); this->unk_1C0 = 9; @@ -401,21 +401,21 @@ void EnDha_UpdateHealth(EnDha* this, GlobalContext* globalCtx) { } } -void EnDha_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDha_Update(Actor* thisx, PlayState* play) { s32 pad; EnDha* this = (EnDha*)thisx; if (this->actor.parent == NULL) { - this->actor.parent = Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_DH, ACTORCAT_ENEMY, 10000.0f); + this->actor.parent = Actor_FindNearby(play, &this->actor, ACTOR_EN_DH, ACTORCAT_ENEMY, 10000.0f); } - EnDha_UpdateHealth(this, globalCtx); - this->actionFunc(this, globalCtx); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + EnDha_UpdateHealth(this, play); + this->actionFunc(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnDha_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnDha_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDha* this = (EnDha*)thisx; if (limbIndex == 1) { @@ -432,7 +432,7 @@ s32 EnDha_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnDha_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDha_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Vec3f handVec = { 1100.0f, 0.0f, 0.0f }; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EnDha* this = (EnDha*)thisx; @@ -455,11 +455,11 @@ void EnDha_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnDha_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDha_Draw(Actor* thisx, PlayState* play) { s32 pad; EnDha* this = (EnDha*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDha_OverrideLimbDraw, EnDha_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_Dha/z_en_dha.h b/src/overlays/actors/ovl_En_Dha/z_en_dha.h index 7bc146f92a..2ef37c54c9 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.h +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.h @@ -6,7 +6,7 @@ struct EnDha; -typedef void (*EnDhaActionFunc)(struct EnDha*, GlobalContext*); +typedef void (*EnDhaActionFunc)(struct EnDha*, PlayState*); typedef struct EnDha { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index 2216cd17a4..00b4949724 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -11,27 +11,27 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnDivingGame_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDivingGame_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDivingGame_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDivingGame_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDivingGame_Init(Actor* thisx, PlayState* play); +void EnDivingGame_Destroy(Actor* thisx, PlayState* play); +void EnDivingGame_Update(Actor* thisx, PlayState* play); +void EnDivingGame_Draw(Actor* thisx, PlayState* play); -void func_809EDCB0(EnDivingGame* this, GlobalContext* globalCtx); -void EnDivingGame_Talk(EnDivingGame* this, GlobalContext* globalCtx); -void EnDivingGame_HandlePlayChoice(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE048(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE0FC(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE194(EnDivingGame* this, GlobalContext* globalCtx); -void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, GlobalContext* globalCtx); -void EnDivingGame_RupeeThrow(EnDivingGame* this, GlobalContext* globalCtx); -void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE780(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE800(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE8F0(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EE96C(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EEA00(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EEA90(EnDivingGame* this, GlobalContext* globalCtx); -void func_809EEAF8(EnDivingGame* this, GlobalContext* globalCtx); +void func_809EDCB0(EnDivingGame* this, PlayState* play); +void EnDivingGame_Talk(EnDivingGame* this, PlayState* play); +void EnDivingGame_HandlePlayChoice(EnDivingGame* this, PlayState* play); +void func_809EE048(EnDivingGame* this, PlayState* play); +void func_809EE0FC(EnDivingGame* this, PlayState* play); +void func_809EE194(EnDivingGame* this, PlayState* play); +void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, PlayState* play); +void EnDivingGame_RupeeThrow(EnDivingGame* this, PlayState* play); +void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, PlayState* play); +void func_809EE780(EnDivingGame* this, PlayState* play); +void func_809EE800(EnDivingGame* this, PlayState* play); +void func_809EE8F0(EnDivingGame* this, PlayState* play); +void func_809EE96C(EnDivingGame* this, PlayState* play); +void func_809EEA00(EnDivingGame* this, PlayState* play); +void func_809EEA90(EnDivingGame* this, PlayState* play); +void func_809EEAF8(EnDivingGame* this, PlayState* play); const ActorInit En_Diving_Game_InitVars = { ACTOR_EN_DIVING_GAME, @@ -74,14 +74,14 @@ static void* sEyeTextures[] = { gZoraEyeClosedTex, }; -void EnDivingGame_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDivingGame_Init(Actor* thisx, PlayState* play) { EnDivingGame* this = (EnDivingGame*)thisx; this->actor.gravity = -3.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, &gZoraIdleAnim, this->jointTable, this->morphTable, 20); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, &gZoraIdleAnim, this->jointTable, this->morphTable, 20); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 素もぐりGO ☆☆☆☆☆ \n" VT_RST); this->actor.room = -1; this->actor.scale.x = 0.01f; @@ -99,23 +99,23 @@ void EnDivingGame_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDivingGame_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDivingGame_Destroy(Actor* thisx, PlayState* play) { EnDivingGame* this = (EnDivingGame*)thisx; if (this->unk_31F == 0) { gSaveContext.timer1State = 0; } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDivingGame_SpawnRuppy(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_SpawnRuppy(EnDivingGame* this, PlayState* play) { EnExRuppy* rupee; Vec3f rupeePos; rupeePos.x = (Rand_ZeroOne() - 0.5f) * 30.0f + this->actor.world.pos.x; rupeePos.y = (Rand_ZeroOne() - 0.5f) * 20.0f + (this->actor.world.pos.y + 30.0f); rupeePos.z = (Rand_ZeroOne() - 0.5f) * 20.0f + this->actor.world.pos.z; - rupee = (EnExRuppy*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_RUPPY, rupeePos.x, + rupee = (EnExRuppy*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_RUPPY, rupeePos.x, rupeePos.y, rupeePos.z, 0, (s16)Rand_CenteredFloat(3500.0f) - 1000, this->rupeesLeftToThrow, 0); if (rupee != NULL) { @@ -124,17 +124,17 @@ void EnDivingGame_SpawnRuppy(EnDivingGame* this, GlobalContext* globalCtx) { } } -s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, GlobalContext* globalCtx) { - if (gSaveContext.timer1State == 10 && !Play_InCsMode(globalCtx)) { +s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) { + if (gSaveContext.timer1State == 10 && !Play_InCsMode(play)) { // Failed. gSaveContext.timer1State = 0; func_800F5B58(); func_80078884(NA_SE_SY_FOUND); this->actor.textId = 0x71AD; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_292 = TEXT_STATE_EVENT; this->allRupeesThrown = this->state = this->phase = this->unk_2A2 = this->grabbedRupeesCounter = 0; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = func_809EE048; return true; } else { @@ -155,11 +155,11 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, GlobalContext* globalCt this->extraWinCount++; } } - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_292 = TEXT_STATE_EVENT; func_800F5B58(); Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { this->actionFunc = func_809EE96C; } else { @@ -172,7 +172,7 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, GlobalContext* globalCt } // EnDivingGame_FinishMinigame ? // Reset probably -void func_809EDCB0(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EDCB0(EnDivingGame* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gZoraIdleAnim); Animation_Change(&this->skelAnime, &gZoraIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -180,14 +180,14 @@ void func_809EDCB0(EnDivingGame* this, GlobalContext* globalCtx) { this->actionFunc = EnDivingGame_Talk; } -void EnDivingGame_Talk(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_Talk(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->state != ENDIVINGGAME_STATE_PLAYING || !EnDivingGame_HasMinigameFinished(this, globalCtx)) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (this->state != ENDIVINGGAME_STATE_PLAYING || !EnDivingGame_HasMinigameFinished(this, play)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->unk_292 != TEXT_STATE_DONE) { switch (this->state) { case ENDIVINGGAME_STATE_NOTPLAYING: - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = EnDivingGame_HandlePlayChoice; break; case ENDIVINGGAME_STATE_AWARDPRIZE: @@ -199,8 +199,8 @@ void EnDivingGame_Talk(EnDivingGame* this, GlobalContext* globalCtx) { } } } else { - if (Text_GetFaceReaction(globalCtx, 0x1D) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x1D); + if (Text_GetFaceReaction(play, 0x1D) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 0x1D); this->unk_292 = TEXT_STATE_DONE; } else { switch (this->state) { @@ -224,16 +224,16 @@ void EnDivingGame_Talk(EnDivingGame* this, GlobalContext* globalCtx) { break; } } - func_8002F2CC(&this->actor, globalCtx, 80.0f); + func_8002F2CC(&this->actor, play, 80.0f); } } } -void EnDivingGame_HandlePlayChoice(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_HandlePlayChoice(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_292 == Message_GetState(&globalCtx->msgCtx) && - Message_ShouldAdvance(globalCtx)) { // Did the player select an answer? - switch (globalCtx->msgCtx.choiceIndex) { + if (this->unk_292 == Message_GetState(&play->msgCtx) && + Message_ShouldAdvance(play)) { // Did the player select an answer? + switch (play->msgCtx.choiceIndex) { case 0: // Yes if (gSaveContext.rupees >= 20) { Rupees_ChangeBy(-20); @@ -249,35 +249,35 @@ void EnDivingGame_HandlePlayChoice(EnDivingGame* this, GlobalContext* globalCtx) break; } if (!GET_EVENTCHKINF(EVENTCHKINF_38) || this->actor.textId == 0x85 || this->actor.textId == 0x2D) { - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_292 = TEXT_STATE_EVENT; this->actionFunc = func_809EE048; } else { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - func_8002DF54(globalCtx, NULL, 8); + play->msgCtx.msgMode = MSGMODE_PAUSED; + func_8002DF54(play, NULL, 8); this->actionFunc = func_809EE0FC; } } } // Waits for the message to close -void func_809EE048(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE048(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_292 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { + if (this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { if (this->phase == ENDIVINGGAME_PHASE_ENDED) { - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, NULL, 7); + Message_CloseTextbox(play); + func_8002DF54(play, NULL, 7); this->actionFunc = func_809EDCB0; } else { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - func_8002DF54(globalCtx, NULL, 8); + play->msgCtx.msgMode = MSGMODE_PAUSED; + func_8002DF54(play, NULL, 8); this->actionFunc = func_809EE0FC; } } } // another "start minigame" step -void func_809EE0FC(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE0FC(EnDivingGame* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gZoraThrowRupeesAnim); Animation_Change(&this->skelAnime, &gZoraThrowRupeesAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_ONCE, -10.0f); @@ -286,7 +286,7 @@ void func_809EE0FC(EnDivingGame* this, GlobalContext* globalCtx) { } // Wait a bit before start throwing the rupees. -void func_809EE194(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE194(EnDivingGame* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -295,11 +295,11 @@ void func_809EE194(EnDivingGame* this, GlobalContext* globalCtx) { } } -void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->spawnRuppyTimer = 10; this->subCamAtNext.x = -210.0f; this->subCamAtNext.y = -80.0f; @@ -314,29 +314,29 @@ void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) } this->subCamEyeMaxVelFrac.x = this->subCamEyeMaxVelFrac.y = this->subCamEyeMaxVelFrac.z = this->subCamAtMaxVelFrac.x = this->subCamAtMaxVelFrac.y = this->subCamAtMaxVelFrac.z = 0.1f; - this->subCamAt.x = globalCtx->view.at.x; - this->subCamAt.y = globalCtx->view.at.y; - this->subCamAt.z = globalCtx->view.at.z; - this->subCamEye.x = globalCtx->view.eye.x; - this->subCamEye.y = globalCtx->view.eye.y + 80.0f; - this->subCamEye.z = globalCtx->view.eye.z + 250.0f; + this->subCamAt.x = play->view.at.x; + this->subCamAt.y = play->view.at.y; + this->subCamAt.z = play->view.at.z; + this->subCamEye.x = play->view.eye.x; + this->subCamEye.y = play->view.eye.y + 80.0f; + this->subCamEye.z = play->view.eye.z + 250.0f; this->subCamEyeVel.x = fabsf(this->subCamEye.x - this->subCamEyeNext.x) * 0.04f; this->subCamEyeVel.y = fabsf(this->subCamEye.y - this->subCamEyeNext.y) * 0.04f; this->subCamEyeVel.z = fabsf(this->subCamEye.z - this->subCamEyeNext.z) * 0.04f; this->subCamAtVel.x = fabsf(this->subCamAt.x - this->subCamAtNext.x) * 0.04f; this->subCamAtVel.y = fabsf(this->subCamAt.y - this->subCamAtNext.y) * 0.04f; this->subCamAtVel.z = fabsf(this->subCamAt.z - this->subCamAtNext.z) * 0.04f; - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); - Play_CameraSetFov(globalCtx, this->subCamId, globalCtx->mainCamera.fov); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetFov(play, this->subCamId, play->mainCamera.fov); this->subCamTimer = 60; this->actionFunc = EnDivingGame_RupeeThrow; this->subCamVelFactor = 0.0f; } // Throws rupee when this->spawnRuppyTimer == 0 -void EnDivingGame_RupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_RupeeThrow(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (func_800C0DB4(globalCtx, &this->actor.projectedPos)) { + if (func_800C0DB4(play, &this->actor.projectedPos)) { Audio_SetExtraFilter(0); } if (this->subCamId != SUB_CAM_ID_DONE) { @@ -352,10 +352,10 @@ void EnDivingGame_RupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) { this->subCamAtVel.z * this->subCamVelFactor); Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, 0.02f); } - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); if (!this->allRupeesThrown && this->spawnRuppyTimer == 0) { this->spawnRuppyTimer = 5; - EnDivingGame_SpawnRuppy(this, globalCtx); + EnDivingGame_SpawnRuppy(this, play); this->rupeesLeftToThrow--; if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { this->unk_296 = 30; @@ -384,7 +384,7 @@ void EnDivingGame_RupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) { } // Called just before changing the camera to focus the underwater rupees. -void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, GlobalContext* globalCtx) { +void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_296 == 0) { this->unk_2A2 = 1; @@ -400,30 +400,30 @@ void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, GlobalContext* globa } // EnDivingGame_SayStartAndWait ? -void func_809EE780(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE780(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->subCamTimer == 0) { - Play_ClearCamera(globalCtx, this->subCamId); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->subCamId); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); this->actor.textId = 0x405A; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_292 = TEXT_STATE_EVENT; this->actionFunc = func_809EE800; } } // EnDivingGame_TalkDuringMinigame -void func_809EE800(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE800(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_292 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if (this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { func_80088B34(BREG(2) + 50); } else { func_80088B34(BREG(2) + 50); } func_800F5ACC(NA_BGM_TIMED_MINI_GAME); - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->actor.textId = 0x405B; this->unk_292 = TEXT_STATE_EVENT; this->state = ENDIVINGGAME_STATE_PLAYING; @@ -431,22 +431,22 @@ void func_809EE800(EnDivingGame* this, GlobalContext* globalCtx) { } } -void func_809EE8F0(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE8F0(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk_292 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx))) { - Message_CloseTextbox(globalCtx); + if ((this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { + Message_CloseTextbox(play); this->actionFunc = EnDivingGame_Talk; } else { - EnDivingGame_HasMinigameFinished(this, globalCtx); + EnDivingGame_HasMinigameFinished(this, play); } } // EnDivingGame_SayCongratsAndWait ? // EnDivingGame_PlayerWonPhase1 -void func_809EE96C(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EE96C(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk_292 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx))) { - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, NULL, 7); + if ((this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { + Message_CloseTextbox(play); + func_8002DF54(play, NULL, 7); this->actor.textId = 0x4056; this->unk_292 = TEXT_STATE_EVENT; this->state = ENDIVINGGAME_STATE_AWARDPRIZE; @@ -454,29 +454,29 @@ void func_809EE96C(EnDivingGame* this, GlobalContext* globalCtx) { } } -void func_809EEA00(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EEA00(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk_292 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx))) { - Message_CloseTextbox(globalCtx); + if ((this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { + Message_CloseTextbox(play); this->actor.parent = NULL; - func_8002F434(&this->actor, globalCtx, GI_SCALE_SILVER, 90.0f, 10.0f); + func_8002F434(&this->actor, play, GI_SCALE_SILVER, 90.0f, 10.0f); this->actionFunc = func_809EEA90; } } -void func_809EEA90(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EEA90(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_809EEAF8; } else { - func_8002F434(&this->actor, globalCtx, GI_SCALE_SILVER, 90.0f, 10.0f); + func_8002F434(&this->actor, play, GI_SCALE_SILVER, 90.0f, 10.0f); } } // Award the scale? -void func_809EEAF8(EnDivingGame* this, GlobalContext* globalCtx) { +void func_809EEAF8(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { // "Successful completion" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); this->allRupeesThrown = this->state = this->phase = this->unk_2A2 = this->grabbedRupeesCounter = 0; @@ -485,10 +485,10 @@ void func_809EEAF8(EnDivingGame* this, GlobalContext* globalCtx) { } } -void EnDivingGame_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnDivingGame_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnDivingGame* this = (EnDivingGame*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f pos; if (this->subCamTimer != 0) { @@ -517,24 +517,24 @@ void EnDivingGame_Update(Actor* thisx, GlobalContext* globalCtx2) { this->eyeTimer = (s16)Rand_ZeroFloat(60.0f) + 20; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 80.0f); this->unk_324.unk_18 = player->actor.world.pos; this->unk_324.unk_18.y = player->actor.world.pos.y; func_80034A14(&this->actor, &this->unk_324, 2, 4); this->vec_284 = this->unk_324.unk_08; this->vec_28A = this->unk_324.unk_0E; - if ((globalCtx->gameplayFrames % 16) == 0) { + if ((play->gameplayFrames % 16) == 0) { pos = this->actor.world.pos; pos.y += 20.0f; - EffectSsGRipple_Spawn(globalCtx, &pos, 100, 500, 30); + EffectSsGRipple_Spawn(play, &pos, 100, 500, 30); } this->unk_290++; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Gfx* EnDivingGame_EmptyDList(GraphicsContext* gfxCtx) { @@ -544,8 +544,7 @@ Gfx* EnDivingGame_EmptyDList(GraphicsContext* gfxCtx) { return displayList; } -s32 EnDivingGame_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnDivingGame_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDivingGame* this = (EnDivingGame*)thisx; s32 pad; @@ -559,24 +558,24 @@ s32 EnDivingGame_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** } if (this->notPlayingMinigame && (limbIndex == 8 || limbIndex == 9 || limbIndex == 12)) { - rot->y += Math_SinS((globalCtx->state.frames * (limbIndex * 50 + 0x814))) * 200.0f; - rot->z += Math_CosS((globalCtx->state.frames * (limbIndex * 50 + 0x940))) * 200.0f; + rot->y += Math_SinS((play->state.frames * (limbIndex * 50 + 0x814))) * 200.0f; + rot->z += Math_CosS((play->state.frames * (limbIndex * 50 + 0x940))) * 200.0f; } return 0; } -void EnDivingGame_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDivingGame_Draw(Actor* thisx, PlayState* play) { EnDivingGame* this = (EnDivingGame*)thisx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_diving_game.c", 1212); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_diving_game.c", 1212); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0x0C, EnDivingGame_EmptyDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnDivingGame_EmptyDList(play->state.gfxCtx)); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDivingGame_OverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_diving_game.c", 1232); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_diving_game.c", 1232); } 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 9875f077dd..dbc1ede7ae 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 @@ -6,7 +6,7 @@ struct EnDivingGame; -typedef void (*EnDivingGameActionFunc)(struct EnDivingGame*, GlobalContext*); +typedef void (*EnDivingGameActionFunc)(struct EnDivingGame*, PlayState*); typedef struct EnDivingGame { /* 0x0000 */ Actor actor; 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 0286f30179..f3e2df8c9c 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -10,10 +10,10 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnDns_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDns_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDns_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDns_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDns_Init(Actor* thisx, PlayState* play); +void EnDns_Destroy(Actor* thisx, PlayState* play); +void EnDns_Update(Actor* thisx, PlayState* play); +void EnDns_Draw(Actor* thisx, PlayState* play); u32 func_809EF5A4(EnDns* this); u32 func_809EF658(EnDns* this); @@ -32,16 +32,16 @@ void func_809EFACC(EnDns* this); void func_809EFAFC(EnDns* this); void func_809EFB40(EnDns* this); -void EnDns_SetupWait(EnDns* this, GlobalContext* globalCtx); -void EnDns_Wait(EnDns* this, GlobalContext* globalCtx); -void EnDns_Talk(EnDns* this, GlobalContext* globalCtx); -void func_809EFDD0(EnDns* this, GlobalContext* globalCtx); -void func_809EFEE8(EnDns* this, GlobalContext* globalCtx); -void func_809EFF50(EnDns* this, GlobalContext* globalCtx); -void func_809EFF98(EnDns* this, GlobalContext* globalCtx); -void func_809F008C(EnDns* this, GlobalContext* globalCtx); -void EnDns_SetupBurrow(EnDns* this, GlobalContext* globalCtx); -void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx); +void EnDns_SetupWait(EnDns* this, PlayState* play); +void EnDns_Wait(EnDns* this, PlayState* play); +void EnDns_Talk(EnDns* this, PlayState* play); +void func_809EFDD0(EnDns* this, PlayState* play); +void func_809EFEE8(EnDns* this, PlayState* play); +void func_809EFF50(EnDns* this, PlayState* play); +void func_809EFF98(EnDns* this, PlayState* play); +void func_809F008C(EnDns* this, PlayState* play); +void EnDns_SetupBurrow(EnDns* this, PlayState* play); +void EnDns_Burrow(EnDns* this, PlayState* play); const ActorInit En_Dns_InitVars = { ACTOR_EN_DNS, @@ -132,7 +132,7 @@ static AnimationMinimalInfo sAnimationInfo[] = { { &gBusinessScrubNervousTransitionAnim, ANIMMODE_ONCE, 0.0f }, }; -void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Init(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; if (this->actor.params < 0) { @@ -149,10 +149,10 @@ void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "◆◆◆ 売りナッツ『%s』 ◆◆◆" VT_RST "\n", D_809F0424[this->actor.params], this->actor.params); Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, this->jointTable, this->morphTable, 18); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + 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 = D_809F040C[this->actor.params]; Actor_SetScale(&this->actor, 0.01f); @@ -167,10 +167,10 @@ void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnDns_SetupWait; } -void EnDns_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Destroy(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnDns_ChangeAnim(EnDns* this, u8 index) { @@ -312,17 +312,17 @@ void func_809EFB40(EnDns* this) { Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); } -void EnDns_SetupWait(EnDns* this, GlobalContext* globalCtx) { +void EnDns_SetupWait(EnDns* this, PlayState* play) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { this->actionFunc = EnDns_Wait; EnDns_ChangeAnim(this, ENDNS_ANIM_0); } } -void EnDns_Wait(EnDns* this, GlobalContext* globalCtx) { +void EnDns_Wait(EnDns* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 2000, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnDns_Talk; } else { if ((this->collider.base.ocFlags1 & OC1_HIT) || this->actor.isTargeted) { @@ -331,82 +331,82 @@ void EnDns_Wait(EnDns* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_16; } if (this->actor.xzDistToPlayer < 130.0f) { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } } -void EnDns_Talk(EnDns* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void EnDns_Talk(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->purchaseableCheck(this)) { case 0: - Message_ContinueTextbox(globalCtx, 0x10A5); + Message_ContinueTextbox(play, 0x10A5); this->actionFunc = func_809F008C; break; case 1: - Message_ContinueTextbox(globalCtx, 0x10A6); + Message_ContinueTextbox(play, 0x10A6); this->actionFunc = func_809F008C; break; case 3: - Message_ContinueTextbox(globalCtx, 0x10DE); + Message_ContinueTextbox(play, 0x10DE); this->actionFunc = func_809F008C; break; case 2: case 4: - Message_ContinueTextbox(globalCtx, 0x10A7); + Message_ContinueTextbox(play, 0x10A7); this->actionFunc = func_809EFEE8; break; } break; case 1: // No way - Message_ContinueTextbox(globalCtx, 0x10A4); + Message_ContinueTextbox(play, 0x10A4); this->actionFunc = func_809F008C; } } } -void func_809EFDD0(EnDns* this, GlobalContext* globalCtx) { +void func_809EFDD0(EnDns* this, PlayState* play) { if (this->actor.params == 0x9) { if (CUR_UPG_VALUE(UPG_STICKS) < 2) { - func_8002F434(&this->actor, globalCtx, GI_STICK_UPGRADE_20, 130.0f, 100.0f); + func_8002F434(&this->actor, play, GI_STICK_UPGRADE_20, 130.0f, 100.0f); } else { - func_8002F434(&this->actor, globalCtx, GI_STICK_UPGRADE_30, 130.0f, 100.0f); + func_8002F434(&this->actor, play, GI_STICK_UPGRADE_30, 130.0f, 100.0f); } } else if (this->actor.params == 0xA) { if (CUR_UPG_VALUE(UPG_NUTS) < 2) { - func_8002F434(&this->actor, globalCtx, GI_NUT_UPGRADE_30, 130.0f, 100.0f); + func_8002F434(&this->actor, play, GI_NUT_UPGRADE_30, 130.0f, 100.0f); } else { - func_8002F434(&this->actor, globalCtx, GI_NUT_UPGRADE_40, 130.0f, 100.0f); + func_8002F434(&this->actor, play, GI_NUT_UPGRADE_40, 130.0f, 100.0f); } } else { - func_8002F434(&this->actor, globalCtx, this->dnsItemEntry->getItemId, 130.0f, 100.0f); + func_8002F434(&this->actor, play, this->dnsItemEntry->getItemId, 130.0f, 100.0f); } } -void func_809EFEE8(EnDns* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - func_809EFDD0(this, globalCtx); +void func_809EFEE8(EnDns* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + func_809EFDD0(this, play); this->actionFunc = func_809EFF50; } } -void func_809EFF50(EnDns* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809EFF50(EnDns* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_809EFF98; } else { - func_809EFDD0(this, globalCtx); + func_809EFDD0(this, play); } } -void func_809EFF98(EnDns* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809EFF98(EnDns* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags1 & PLAYER_STATE1_10) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->dnsItemEntry->setRupeesAndFlags(this); this->dropCollectible = 1; this->maintainCollider = 0; @@ -424,8 +424,8 @@ void func_809EFF98(EnDns* this, GlobalContext* globalCtx) { } } -void func_809F008C(EnDns* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_809F008C(EnDns* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->maintainCollider = 0; this->actor.flags &= ~ACTOR_FLAG_0; EnDns_ChangeAnim(this, ENDNS_ANIM_1); @@ -433,7 +433,7 @@ void func_809F008C(EnDns* this, GlobalContext* globalCtx) { } } -void EnDns_SetupBurrow(EnDns* this, GlobalContext* globalCtx) { +void EnDns_SetupBurrow(EnDns* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gBusinessScrubAnim_4404); if (this->skelAnime.curFrame == frameCount) { @@ -444,7 +444,7 @@ void EnDns_SetupBurrow(EnDns* this, GlobalContext* globalCtx) { } } -void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx) { +void EnDns_Burrow(EnDns* this, PlayState* play) { f32 depth; Vec3f initPos; s32 i; @@ -454,7 +454,7 @@ void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx) { initPos.x = this->actor.world.pos.x; initPos.y = this->yInitPos; initPos.z = this->actor.world.pos.z; - func_80028990(globalCtx, 20.0f, &initPos); + func_80028990(play, 20.0f, &initPos); } this->actor.shape.rot.y += 0x2000; // Drops only if you bought its item @@ -464,14 +464,14 @@ void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx) { initPos.y = this->yInitPos; initPos.z = this->actor.world.pos.z; for (i = 0; i < 3; i++) { - Item_DropCollectible(globalCtx, &initPos, ITEM00_HEART); + Item_DropCollectible(play, &initPos, ITEM00_HEART); } } Actor_Kill(&this->actor); } } -void EnDns_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Update(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; s16 pad; @@ -481,20 +481,20 @@ void EnDns_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); SkelAnime_Update(&this->skelAnime); Actor_MoveForward(&this->actor); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->standOnGround) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2); } if (this->maintainCollider) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void EnDns_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Draw(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + func_80093D18(play->state.gfxCtx); + 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 90bd3d0955..97acf8241a 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -6,7 +6,7 @@ struct EnDns; -typedef void (*EnDnsActionFunc)(struct EnDns*, GlobalContext*); +typedef void (*EnDnsActionFunc)(struct EnDns*, PlayState*); typedef u32 (*EnDnsPurchaseableCheck)(struct EnDns*); typedef void (*EnDnsSetRupeesAndFlags)(struct EnDns*); diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c index e2e210bf8b..7863578025 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c @@ -18,13 +18,13 @@ typedef enum { /* 2 */ DNT_LOVE } EnDntDemoResults; -void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDntDemo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDntDemo_Update(Actor* this, GlobalContext* globalCtx); +void EnDntDemo_Init(Actor* thisx, PlayState* play); +void EnDntDemo_Destroy(Actor* thisx, PlayState* play); +void EnDntDemo_Update(Actor* this, PlayState* play); -void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx); -void EnDntDemo_Results(EnDntDemo* this, GlobalContext* globalCtx); -void EnDntDemo_Prize(EnDntDemo* this, GlobalContext* globalCtx); +void EnDntDemo_Judge(EnDntDemo* this, PlayState* play); +void EnDntDemo_Results(EnDntDemo* this, PlayState* play); +void EnDntDemo_Prize(EnDntDemo* this, PlayState* play); const ActorInit En_Dnt_Demo_InitVars = { ACTOR_EN_DNT_DEMO, @@ -65,11 +65,11 @@ static Vec3f sScrubPos[] = { { 3710.0f, -20.0f, 840.0f }, { 3860.0f, -20.0f, 790.0f }, { 3750.0f, -20.0f, 750.0f }, }; -void EnDntDemo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDntDemo_Destroy(Actor* thisx, PlayState* play) { } -void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnDntDemo_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnDntDemo* this = (EnDntDemo*)thisx; s32 i; s32 pad; @@ -79,9 +79,9 @@ void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx2) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツお面品評会開始 ☆☆☆☆☆ \n" VT_RST); for (i = 0; i < 9; i++) { this->scrubPos[i] = sScrubPos[i]; - this->scrubs[i] = (EnDntNomal*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, - ACTOR_EN_DNT_NOMAL, this->scrubPos[i].x, this->scrubPos[i].y, - this->scrubPos[i].z, 0, 0, 0, i + ENDNTNOMAL_STAGE); + this->scrubs[i] = (EnDntNomal*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DNT_NOMAL, + this->scrubPos[i].x, this->scrubPos[i].y, this->scrubPos[i].z, + 0, 0, 0, i + ENDNTNOMAL_STAGE); if (this->scrubs[i] != NULL) { // "zako zako" [small fries] osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ザコザコ ☆☆☆☆☆ %x\n" VT_RST, this->scrubs[i]); @@ -91,7 +91,7 @@ void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx2) { this->leaderPos.x = 4050.0f; this->leaderPos.y = -20.0f; this->leaderPos.z = 1000.0f; - this->leader = (EnDntJiji*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_DNT_JIJI, + this->leader = (EnDntJiji*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DNT_JIJI, this->leaderPos.x, this->leaderPos.y, this->leaderPos.z, 0, 0, 0, 0); if (this->leader != NULL) { // "jiji jiji jiji jiji jiji" [onomatopoeia for the scrub sound?] @@ -102,7 +102,7 @@ void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc = EnDntDemo_Judge; } -void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { +void EnDntDemo_Judge(EnDntDemo* this, PlayState* play) { s16 delay; s16 reaction; s16 rand9; @@ -122,7 +122,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { } this->leaderSignal = DNT_SIGNAL_NONE; this->actionFunc = EnDntDemo_Results; - } else if ((this->actor.xzDistToPlayer > 30.0f) || (Player_GetMask(globalCtx) == 0)) { + } else if ((this->actor.xzDistToPlayer > 30.0f) || (Player_GetMask(play) == 0)) { this->debugArrowTimer++; if (this->subCamId != SUB_CAM_ID_DONE) { this->subCamId = SUB_CAM_ID_DONE; @@ -134,8 +134,8 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { this->judgeTimer = 0; } } else { - if ((Player_GetMask(globalCtx) != 0) && (this->subCamId == SUB_CAM_ID_DONE)) { - this->subCamId = OnePointCutscene_Init(globalCtx, 2220, -99, &this->scrubs[3]->actor, CAM_ID_MAIN); + if ((Player_GetMask(play) != 0) && (this->subCamId == SUB_CAM_ID_DONE)) { + this->subCamId = OnePointCutscene_Init(play, 2220, -99, &this->scrubs[3]->actor, CAM_ID_MAIN); } this->debugArrowTimer = 0; if (this->judgeTimer == 40) { @@ -154,7 +154,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { ignore = false; reaction = DNT_SIGNAL_NONE; delay = 0; - switch (Player_GetMask(globalCtx)) { + switch (Player_GetMask(play)) { case PLAYER_MASK_SKULL: if (!GET_ITEMGETINF(ITEMGETINF_1E)) { reaction = DNT_SIGNAL_CELEBRATE; @@ -163,7 +163,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { break; } case PLAYER_MASK_TRUTH: - if (!GET_ITEMGETINF(ITEMGETINF_1F) && (Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) { + if (!GET_ITEMGETINF(ITEMGETINF_1F) && (Player_GetMask(play) != PLAYER_MASK_SKULL)) { Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->prize = DNT_PRIZE_NUTS; @@ -172,7 +172,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { if (this->subCamId != SUB_CAM_ID_DONE) { this->subCamId = SUB_CAM_ID_DONE; reaction = DNT_SIGNAL_LOOK; - OnePointCutscene_Init(globalCtx, 2340, -99, &this->leader->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 2340, -99, &this->leader->actor, CAM_ID_MAIN); } break; } @@ -183,7 +183,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { case PLAYER_MASK_ZORA: case PLAYER_MASK_GERUDO: rand9 = Rand_ZeroFloat(8.99f); - maskIdx = Player_GetMask(globalCtx); + maskIdx = Player_GetMask(play); maskIdx--; if (rand9 == 8) { ignore = true; @@ -211,7 +211,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { case DNT_ACTION_ATTACK: if (this->subCamId != SUB_CAM_ID_DONE) { this->subCamId = SUB_CAM_ID_DONE; - OnePointCutscene_Init(globalCtx, 2350, -99, &this->scrubs[3]->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 2350, -99, &this->scrubs[3]->actor, CAM_ID_MAIN); } Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ENEMY | 0x800); break; @@ -261,7 +261,7 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { } } -void EnDntDemo_Results(EnDntDemo* this, GlobalContext* globalCtx) { +void EnDntDemo_Results(EnDntDemo* this, PlayState* play) { s32 i; if (this->leaderSignal != DNT_SIGNAL_NONE) { @@ -298,7 +298,7 @@ void EnDntDemo_Results(EnDntDemo* this, GlobalContext* globalCtx) { } } -void EnDntDemo_Prize(EnDntDemo* this, GlobalContext* globalCtx) { +void EnDntDemo_Prize(EnDntDemo* this, PlayState* play) { s32 i; if (this->leaderSignal != DNT_SIGNAL_NONE) { @@ -311,7 +311,7 @@ void EnDntDemo_Prize(EnDntDemo* this, GlobalContext* globalCtx) { } } -void EnDntDemo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDntDemo_Update(Actor* thisx, PlayState* play) { s32 pad; EnDntDemo* this = (EnDntDemo*)thisx; @@ -321,18 +321,18 @@ void EnDntDemo_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unkTimer1 != 0) { this->unkTimer1--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (BREG(0)) { if (this->debugArrowTimer != 0) { if (!(this->debugArrowTimer & 1)) { 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, 120, 120, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 120, 120, 0, 255, 4, play->state.gfxCtx); } } else { 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, 255, 255, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 255, 255, 255, 255, 4, play->state.gfxCtx); } } } diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h index 71170f22e5..4349a972ea 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h @@ -6,7 +6,7 @@ struct EnDntDemo; -typedef void (*EnDntDemoActionFunc)(struct EnDntDemo*, GlobalContext*); +typedef void (*EnDntDemoActionFunc)(struct EnDntDemo*, PlayState*); typedef struct EnDntDemo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index b26eda46d5..5533830941 100644 --- a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -12,32 +12,32 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnDntJiji_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDntJiji_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDntJiji_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDntJiji_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDntJiji_Init(Actor* thisx, PlayState* play); +void EnDntJiji_Destroy(Actor* thisx, PlayState* play); +void EnDntJiji_Update(Actor* thisx, PlayState* play); +void EnDntJiji_Draw(Actor* thisx, PlayState* play); -void EnDntJiji_SetFlower(EnDntJiji* this, GlobalContext* globalCtx); +void EnDntJiji_SetFlower(EnDntJiji* this, PlayState* play); -void EnDntJiji_SetupWait(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupUnburrow(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupWalk(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupCower(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupGivePrize(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupHide(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupReturn(EnDntJiji* this, GlobalContext* globalCtx); +void EnDntJiji_SetupWait(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupUnburrow(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupWalk(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupCower(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupGivePrize(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupHide(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupReturn(EnDntJiji* this, PlayState* play); -void EnDntJiji_Wait(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Up(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Unburrow(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Walk(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Burrow(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Cower(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_SetupTalk(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Talk(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_GivePrize(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Hide(EnDntJiji* this, GlobalContext* globalCtx); -void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx); +void EnDntJiji_Wait(EnDntJiji* this, PlayState* play); +void EnDntJiji_Up(EnDntJiji* this, PlayState* play); +void EnDntJiji_Unburrow(EnDntJiji* this, PlayState* play); +void EnDntJiji_Walk(EnDntJiji* this, PlayState* play); +void EnDntJiji_Burrow(EnDntJiji* this, PlayState* play); +void EnDntJiji_Cower(EnDntJiji* this, PlayState* play); +void EnDntJiji_SetupTalk(EnDntJiji* this, PlayState* play); +void EnDntJiji_Talk(EnDntJiji* this, PlayState* play); +void EnDntJiji_GivePrize(EnDntJiji* this, PlayState* play); +void EnDntJiji_Hide(EnDntJiji* this, PlayState* play); +void EnDntJiji_Return(EnDntJiji* this, PlayState* play); const ActorInit En_Dnt_Jiji_InitVars = { ACTOR_EN_DNT_JIJI, @@ -71,14 +71,13 @@ static ColliderCylinderInit sCylinderInit = { { 30, 80, 0, { 0, 0, 0 } }, }; -void EnDntJiji_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDntJiji_Init(Actor* thisx, PlayState* play) { EnDntJiji* this = (EnDntJiji*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDntJijiSkel, &gDntJijiBurrowAnim, this->jointTable, this->morphTable, - 13); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_Init(play, &this->skelAnime, &gDntJijiSkel, &gDntJijiBurrowAnim, this->jointTable, this->morphTable, 13); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->stage = (EnDntDemo*)this->actor.parent; osSyncPrintf("\n\n"); // "Deku Scrub mask show elder" @@ -90,21 +89,21 @@ void EnDntJiji_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -2.0f; } -void EnDntJiji_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDntJiji_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnDntJiji* this = (EnDntJiji*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDntJiji_SetFlower(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetFlower(EnDntJiji* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->flowerPos = this->actor.world.pos; this->actionFunc = EnDntJiji_SetupWait; } } -void EnDntJiji_SetupWait(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupWait(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiBurrowAnim); Animation_Change(&this->skelAnime, &gDntJijiBurrowAnim, 0.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->skelAnime.curFrame = 8.0f; @@ -112,28 +111,28 @@ void EnDntJiji_SetupWait(EnDntJiji* this, GlobalContext* globalCtx) { this->actionFunc = EnDntJiji_Wait; } -void EnDntJiji_Wait(EnDntJiji* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDntJiji_Wait(EnDntJiji* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - if ((this->timer == 1) && (this->actor.xzDistToPlayer < 150.0f) && !Play_InCsMode(globalCtx) && + if ((this->timer == 1) && (this->actor.xzDistToPlayer < 150.0f) && !Play_InCsMode(play) && !(player->stateFlags1 & PLAYER_STATE1_11)) { - OnePointCutscene_Init(globalCtx, 2230, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 2230, -99, &this->actor, CAM_ID_MAIN); this->timer = 0; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = EnDntJiji_SetupUnburrow; } } -void EnDntJiji_SetupUp(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupUp(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiUpAnim); Animation_Change(&this->skelAnime, &gDntJijiUpAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); this->actionFunc = EnDntJiji_Up; } -void EnDntJiji_Up(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Up(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0); if (this->actor.xzDistToPlayer < 150.0f) { @@ -141,15 +140,15 @@ void EnDntJiji_Up(EnDntJiji* this, GlobalContext* globalCtx) { } } -void EnDntJiji_SetupUnburrow(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupUnburrow(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiUnburrowAnim); Animation_Change(&this->skelAnime, &gDntJijiUnburrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); this->actionFunc = EnDntJiji_Unburrow; } -void EnDntJiji_Unburrow(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Unburrow(EnDntJiji* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -162,7 +161,7 @@ void EnDntJiji_Unburrow(EnDntJiji* this, GlobalContext* globalCtx) { } } -void EnDntJiji_SetupWalk(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupWalk(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiWalkAnim); Animation_Change(&this->skelAnime, &gDntJijiWalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.speedXZ = 1.0f; @@ -171,7 +170,7 @@ void EnDntJiji_SetupWalk(EnDntJiji* this, GlobalContext* globalCtx) { this->actionFunc = EnDntJiji_Walk; } -void EnDntJiji_Walk(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Walk(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x3E8, 0); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -191,30 +190,30 @@ void EnDntJiji_Walk(EnDntJiji* this, GlobalContext* globalCtx) { this->getItemId = GI_STICK_UPGRADE_30; } this->actor.textId = 0x104D; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->actor.speedXZ = 0.0f; this->unused = 5; this->actionFunc = EnDntJiji_Talk; } } -void EnDntJiji_SetupBurrow(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupBurrow(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiBurrowAnim); Animation_Change(&this->skelAnime, &gDntJijiBurrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DOWN); this->actionFunc = EnDntJiji_Burrow; } -void EnDntJiji_Burrow(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Burrow(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnDntJiji_SetupCower(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupCower(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiCowerAnim); Animation_Change(&this->skelAnime, &gDntJijiCowerAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 9, 3, 10, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 9, 3, 10, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); if ((CUR_UPG_VALUE(UPG_NUTS) == 1) || (CUR_UPG_VALUE(UPG_NUTS) == 0)) { @@ -228,51 +227,51 @@ void EnDntJiji_SetupCower(EnDntJiji* this, GlobalContext* globalCtx) { this->actionFunc = EnDntJiji_Cower; } -void EnDntJiji_Cower(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Cower(EnDntJiji* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0); if (frame >= this->endFrame) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnDntJiji_SetupTalk; } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } -void EnDntJiji_SetupTalk(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupTalk(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiTalkAnim); Animation_Change(&this->skelAnime, &gDntJijiTalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actionFunc = EnDntJiji_Talk; } -void EnDntJiji_Talk(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Talk(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, NULL, 7); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + func_8005B1A4(GET_ACTIVE_CAM(play)); + Message_CloseTextbox(play); + func_8002DF54(play, NULL, 7); this->actor.parent = NULL; - func_8002F434(&this->actor, globalCtx, this->getItemId, 400.0f, 200.0f); + func_8002F434(&this->actor, play, this->getItemId, 400.0f, 200.0f); this->actionFunc = EnDntJiji_SetupGivePrize; } } -void EnDntJiji_SetupGivePrize(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupGivePrize(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = EnDntJiji_GivePrize; } else { - func_8002F434(&this->actor, globalCtx, this->getItemId, 400.0f, 200.0f); + func_8002F434(&this->actor, play, this->getItemId, 400.0f, 200.0f); } } -void EnDntJiji_GivePrize(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_GivePrize(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if ((this->getItemId == GI_NUT_UPGRADE_30) || (this->getItemId == GI_NUT_UPGRADE_40)) { // "nut" osSyncPrintf("実 \n"); @@ -312,13 +311,13 @@ void EnDntJiji_GivePrize(EnDntJiji* this, GlobalContext* globalCtx) { } } -void EnDntJiji_SetupHide(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupHide(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiHideAnim); Animation_Change(&this->skelAnime, &gDntJijiHideAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); this->actionFunc = EnDntJiji_Hide; } -void EnDntJiji_Hide(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Hide(EnDntJiji* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -327,7 +326,7 @@ void EnDntJiji_Hide(EnDntJiji* this, GlobalContext* globalCtx) { } } -void EnDntJiji_SetupReturn(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_SetupReturn(EnDntJiji* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiWalkAnim); Animation_Change(&this->skelAnime, &gDntJijiWalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.speedXZ = 2.0f; @@ -335,7 +334,7 @@ void EnDntJiji_SetupReturn(EnDntJiji* this, GlobalContext* globalCtx) { this->actionFunc = EnDntJiji_Return; } -void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx) { +void EnDntJiji_Return(EnDntJiji* this, PlayState* play) { f32 dx; f32 dz; @@ -368,7 +367,7 @@ void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx) { } } -void EnDntJiji_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDntJiji_Update(Actor* thisx, PlayState* play) { s32 pad; EnDntJiji* this = (EnDntJiji*)thisx; @@ -417,31 +416,31 @@ void EnDntJiji_Update(Actor* thisx, GlobalContext* globalCtx) { this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); if (this->isSolid != 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void EnDntJiji_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDntJiji_Draw(Actor* thisx, PlayState* play) { static void* blinkTex[] = { gDntJijiEyeOpenTex, gDntJijiEyeHalfTex, gDntJijiEyeShutTex }; EnDntJiji* this = (EnDntJiji*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_jiji.c", 1019); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dnt_jiji.c", 1019); + func_80093D18(play->state.gfxCtx); Matrix_Push(); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(blinkTex[this->eyeState])); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, this); Matrix_Pop(); Matrix_Translate(this->flowerPos.x, this->flowerPos.y, this->flowerPos.z, MTXMODE_NEW); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dnt_jiji.c", 1040), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dnt_jiji.c", 1040), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDntJijiFlowerDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_jiji.c", 1043); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dnt_jiji.c", 1043); } diff --git a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h index 1d809c3090..20199a7c2e 100644 --- a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h +++ b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h @@ -6,7 +6,7 @@ struct EnDntJiji; -typedef void (*EnDntJijiActionFunc)(struct EnDntJiji*, GlobalContext*); +typedef void (*EnDntJijiActionFunc)(struct EnDntJiji*, PlayState*); typedef struct EnDntJiji { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index 9188ab95e9..0a0429350f 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -15,46 +15,46 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnDntNomal_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDntNomal_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDntNomal_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDntNomal_DrawTargetScrub(Actor* thisx, GlobalContext* globalCtx); -void EnDntNomal_DrawStageScrub(Actor* thisx, GlobalContext* globalCtx); +void EnDntNomal_Init(Actor* thisx, PlayState* play); +void EnDntNomal_Destroy(Actor* thisx, PlayState* play); +void EnDntNomal_Update(Actor* thisx, PlayState* play); +void EnDntNomal_DrawTargetScrub(Actor* thisx, PlayState* play); +void EnDntNomal_DrawStageScrub(Actor* thisx, PlayState* play); -void EnDntNomal_WaitForObject(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetFlower(EnDntNomal* this, GlobalContext* globalCtx); +void EnDntNomal_WaitForObject(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetFlower(EnDntNomal* this, PlayState* play); -void EnDntNomal_SetupTargetWait(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupTargetWalk(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupTargetTalk(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupTargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx); +void EnDntNomal_SetupTargetWait(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupTargetWalk(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupTargetTalk(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupTargetGivePrize(EnDntNomal* this, PlayState* play); -void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetWalk(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetFacePlayer(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetTalk(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetReturn(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_TargetBurrow(EnDntNomal* this, GlobalContext* globalCtx); +void EnDntNomal_TargetWait(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetUnburrow(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetWalk(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetFacePlayer(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetTalk(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetGivePrize(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetReturn(EnDntNomal* this, PlayState* play); +void EnDntNomal_TargetBurrow(EnDntNomal* this, PlayState* play); -void EnDntNomal_SetupStageWait(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupStageDance(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupStageHide(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_SetupStageAttack(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageSetupReturn(EnDntNomal* this, GlobalContext* globalCtx); +void EnDntNomal_SetupStageWait(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupStageDance(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupStageHide(EnDntNomal* this, PlayState* play); +void EnDntNomal_SetupStageAttack(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageSetupReturn(EnDntNomal* this, PlayState* play); -void EnDntNomal_StageWait(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageUp(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageUnburrow(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageCelebrate(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageDance(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageHide(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageAttackHide(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx); -void EnDntNomal_StageReturn(EnDntNomal* this, GlobalContext* globalCtx); +void EnDntNomal_StageWait(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageUp(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageUnburrow(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageCelebrate(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageDance(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageHide(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageAttackHide(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageAttack(EnDntNomal* this, PlayState* play); +void EnDntNomal_StageReturn(EnDntNomal* this, PlayState* play); const ActorInit En_Dnt_Nomal_InitVars = { ACTOR_EN_DNT_NOMAL, @@ -114,7 +114,7 @@ static Color_RGBA8 sLeafColors[] = { { 255, 255, 255, 255 }, { 255, 195, 175, 255 }, { 210, 255, 0, 255 }, }; -void EnDntNomal_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDntNomal_Init(Actor* thisx, PlayState* play) { s32 pad; EnDntNomal* this = (EnDntNomal*)thisx; @@ -129,20 +129,20 @@ void EnDntNomal_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); // "Deku Scrub target" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツ的当て ☆☆☆☆☆ \n" VT_RST); - Collider_InitQuad(globalCtx, &this->targetQuad); - Collider_SetQuad(globalCtx, &this->targetQuad, &this->actor, &sTargetQuadInit); + Collider_InitQuad(play, &this->targetQuad); + Collider_SetQuad(play, &this->targetQuad, &this->actor, &sTargetQuadInit); this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->objId = OBJECT_HINTNUTS; } else { osSyncPrintf("\n\n"); // "Deku Scrub mask show audience" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツお面品評会一般人 ☆☆☆☆☆ \n" VT_RST); - Collider_InitCylinder(globalCtx, &this->bodyCyl); - Collider_SetCylinder(globalCtx, &this->bodyCyl, &this->actor, &sBodyCylinderInit); + Collider_InitCylinder(play, &this->bodyCyl); + Collider_SetCylinder(play, &this->bodyCyl, &this->actor, &sBodyCylinderInit); this->objId = OBJECT_DNK; } if (this->objId >= 0) { - this->objIndex = Object_GetIndex(&globalCtx->objectCtx, this->objId); + this->objIndex = Object_GetIndex(&play->objectCtx, this->objId); if (this->objIndex < 0) { Actor_Kill(&this->actor); // "What?" @@ -157,30 +157,30 @@ void EnDntNomal_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnDntNomal_WaitForObject; } -void EnDntNomal_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDntNomal_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnDntNomal* this = (EnDntNomal*)thisx; if (this->type == ENDNTNOMAL_TARGET) { - Collider_DestroyQuad(globalCtx, &this->targetQuad); + Collider_DestroyQuad(play, &this->targetQuad); } else { - Collider_DestroyCylinder(globalCtx, &this->bodyCyl); + Collider_DestroyCylinder(play, &this->bodyCyl); } } -void EnDntNomal_WaitForObject(EnDntNomal* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objIndex].segment); +void EnDntNomal_WaitForObject(EnDntNomal* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objIndex].segment); this->actor.objBankIndex = this->objIndex; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); this->actor.gravity = -2.0f; Actor_SetScale(&this->actor, 0.01f); if (this->type == ENDNTNOMAL_TARGET) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gHintNutsSkel, &gHintNutsBurrowAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gHintNutsSkel, &gHintNutsBurrowAnim, this->jointTable, this->morphTable, 10); this->actor.draw = EnDntNomal_DrawTargetScrub; } else { - SkelAnime_Init(globalCtx, &this->skelAnime, &gDntStageSkel, &gDntStageHideAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gDntStageSkel, &gDntStageHideAnim, this->jointTable, this->morphTable, 11); this->actor.draw = EnDntNomal_DrawStageScrub; } @@ -188,7 +188,7 @@ void EnDntNomal_WaitForObject(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetFlower(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetFlower(EnDntNomal* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->flowerPos = this->actor.world.pos; if (this->type == ENDNTNOMAL_TARGET) { @@ -199,14 +199,14 @@ void EnDntNomal_SetFlower(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupTargetWait(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupTargetWait(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsBurrowAnim); Animation_Change(&this->skelAnime, &gHintNutsBurrowAnim, 0.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); this->skelAnime.curFrame = 8.0f; this->actionFunc = EnDntNomal_TargetWait; } -void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetWait(EnDntNomal* this, PlayState* play) { Vec3f scorePos; f32 targetX = 1340.0f; f32 targetY = 50.0f; @@ -241,7 +241,7 @@ void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx) { scorePos.x = this->actor.world.pos.x - 20.0f; scorePos.y = this->actor.world.pos.y + 20.0f; scorePos.z = this->actor.world.pos.z; - EffectSsExtra_Spawn(globalCtx, &scorePos, &scoreVel, &scoreAccel, 4, 2); + EffectSsExtra_Spawn(play, &scorePos, &scoreVel, &scoreAccel, 4, 2); Audio_StopSfxById(NA_SE_SY_TRE_BOX_APPEAR); func_80078884(NA_SE_SY_TRE_BOX_APPEAR); // "Big hit" @@ -249,8 +249,8 @@ void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx) { if (!LINK_IS_ADULT && !GET_ITEMGETINF(ITEMGETINF_1D)) { this->hitCounter++; if (this->hitCounter >= 3) { - OnePointCutscene_Init(globalCtx, 4140, -99, &this->actor, CAM_ID_MAIN); - func_8002DF54(globalCtx, &this->actor, 1); + OnePointCutscene_Init(play, 4140, -99, &this->actor, CAM_ID_MAIN); + func_8002DF54(play, &this->actor, 1); this->timer4 = 50; this->actionFunc = EnDntNomal_SetupTargetUnburrow; } @@ -259,13 +259,13 @@ void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx) { scorePos.x = this->actor.world.pos.x; scorePos.y = this->actor.world.pos.y + 20.0f; scorePos.z = this->actor.world.pos.z; - EffectSsExtra_Spawn(globalCtx, &scorePos, &scoreVel, &scoreAccel, 4, 0); + EffectSsExtra_Spawn(play, &scorePos, &scoreVel, &scoreAccel, 4, 0); this->hitCounter = 0; } } } -void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, PlayState* play) { Vec3f spawnPos; if (this->timer4 == 0) { @@ -273,13 +273,13 @@ void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx) Animation_Change(&this->skelAnime, &gHintNutsUnburrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); spawnPos = this->actor.world.pos; spawnPos.y = this->actor.world.pos.y + 50.0f; - EffectSsHahen_SpawnBurst(globalCtx, &spawnPos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &spawnPos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); this->actionFunc = EnDntNomal_TargetUnburrow; } } -void EnDntNomal_TargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetUnburrow(EnDntNomal* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -288,7 +288,7 @@ void EnDntNomal_TargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupTargetWalk(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupTargetWalk(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsRunAnim); Animation_Change(&this->skelAnime, &gHintNutsRunAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.speedXZ = 1.0f; @@ -296,7 +296,7 @@ void EnDntNomal_SetupTargetWalk(EnDntNomal* this, GlobalContext* globalCtx) { this->actionFunc = EnDntNomal_TargetWalk; } -void EnDntNomal_TargetWalk(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetWalk(EnDntNomal* this, PlayState* play) { f32 dx; f32 dz; @@ -314,7 +314,7 @@ void EnDntNomal_TargetWalk(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_TargetFacePlayer(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetFacePlayer(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { @@ -325,32 +325,32 @@ void EnDntNomal_TargetFacePlayer(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupTargetTalk(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupTargetTalk(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsTalkAnim); Animation_Change(&this->skelAnime, &gHintNutsTalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.textId = 0x10AF; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->actionFunc = EnDntNomal_TargetTalk; } -void EnDntNomal_TargetTalk(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetTalk(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); - GET_ACTIVE_CAM(globalCtx)->csId = 0; - func_8002DF54(globalCtx, NULL, 8); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + func_8005B1A4(GET_ACTIVE_CAM(play)); + GET_ACTIVE_CAM(play)->csId = 0; + func_8002DF54(play, NULL, 8); this->actionFunc = EnDntNomal_SetupTargetGivePrize; } } -void EnDntNomal_SetupTargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupTargetGivePrize(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsSpitAnim); Animation_Change(&this->skelAnime, &gHintNutsSpitAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); this->actionFunc = EnDntNomal_TargetGivePrize; } -void EnDntNomal_TargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetGivePrize(EnDntNomal* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -359,9 +359,9 @@ void EnDntNomal_TargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx) { f32 itemY = this->mouthPos.y; f32 itemZ = this->mouthPos.z; - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_ITEM, itemX, itemY, itemZ, 0, - 0, 0, EXITEM_BULLET_BAG) == NULL) { - func_8002DF54(globalCtx, NULL, 7); + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, itemX, itemY, itemZ, 0, 0, 0, + EXITEM_BULLET_BAG) == NULL) { + func_8002DF54(play, NULL, 7); Actor_Kill(&this->actor); } this->spawnedItem = true; @@ -374,7 +374,7 @@ void EnDntNomal_TargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_TargetReturn(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetReturn(EnDntNomal* this, PlayState* play) { f32 dx; f32 dz; @@ -399,7 +399,7 @@ void EnDntNomal_TargetReturn(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_TargetBurrow(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_TargetBurrow(EnDntNomal* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -408,7 +408,7 @@ void EnDntNomal_TargetBurrow(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupStageWait(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageWait(EnDntNomal* this, PlayState* play) { if (this->timer3 == 0) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageHideAnim); Animation_Change(&this->skelAnime, &gDntStageHideAnim, 0.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); @@ -418,25 +418,25 @@ void EnDntNomal_SetupStageWait(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_StageWait(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageWait(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnDntNomal_SetupStageUp(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageUp(EnDntNomal* this, PlayState* play) { if (this->timer3 == 0) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageUpAnim); Animation_Change(&this->skelAnime, &gDntStageUpAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); if (this->action != DNT_ACTION_ATTACK) { this->rotDirection = -1; } - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); this->isSolid = true; this->actionFunc = EnDntNomal_StageUp; } } -void EnDntNomal_StageUp(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageUp(EnDntNomal* this, PlayState* play) { s16 rotTarget; f32 frame = this->skelAnime.curFrame; f32 turnMod; @@ -479,18 +479,18 @@ void EnDntNomal_StageUp(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupStageUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageUnburrow(EnDntNomal* this, PlayState* play) { if (this->timer3 == 0) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageUnburrowAnim); Animation_Change(&this->skelAnime, &gDntStageUnburrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); this->isSolid = false; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); this->actionFunc = EnDntNomal_StageUnburrow; } } -void EnDntNomal_StageUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageUnburrow(EnDntNomal* this, PlayState* play) { f32 frame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -505,7 +505,7 @@ void EnDntNomal_StageUnburrow(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageWalkAnim); Animation_Change(&this->skelAnime, &gDntStageWalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.speedXZ = 3.0f; @@ -513,13 +513,13 @@ void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) this->actionFunc = EnDntNomal_StageCelebrate; } -void EnDntNomal_StageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageCelebrate(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->timer1 == 0) && (this->timer3 == 0)) { f32 dx = this->targetPos.x - this->actor.world.pos.x; f32 dz = this->targetPos.z - this->actor.world.pos.z; - if ((fabsf(dx) < 10.0f) && (fabsf(dz) < 10.0f) && (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE)) { + if ((fabsf(dx) < 10.0f) && (fabsf(dz) < 10.0f) && (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) { this->action = DNT_ACTION_PRIZE; this->actionFunc = EnDntNomal_SetupStageDance; this->actor.speedXZ = 0.0f; @@ -547,7 +547,7 @@ void EnDntNomal_StageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupStageDance(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageDance(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageDanceAnim); Animation_Change(&this->skelAnime, &gDntStageDanceAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->isSolid = true; @@ -559,7 +559,7 @@ void EnDntNomal_SetupStageDance(EnDntNomal* this, GlobalContext* globalCtx) { this->actionFunc = EnDntNomal_StageDance; } -void EnDntNomal_StageDance(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageDance(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer2 == 0) { if (this->action == DNT_ACTION_DANCE) { @@ -583,7 +583,7 @@ void EnDntNomal_StageDance(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_SetupStageHide(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageHide(EnDntNomal* this, PlayState* play) { if (this->timer3 != 0) { if ((this->timer3 == 1) && (this->ignore == 1)) { func_80078884(NA_SE_SY_ERROR); @@ -597,14 +597,14 @@ void EnDntNomal_SetupStageHide(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_StageHide(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageHide(EnDntNomal* this, PlayState* play) { EnExRuppy* rupee; f32 frame = this->skelAnime.curFrame; s16 rupeeColor; SkelAnime_Update(&this->skelAnime); if (frame >= this->endFrame) { - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP); switch (this->action) { case DNT_ACTION_NONE: @@ -615,9 +615,8 @@ void EnDntNomal_StageHide(EnDntNomal* this, GlobalContext* globalCtx) { break; case DNT_ACTION_LOW_RUPEES: case DNT_ACTION_HIGH_RUPEES: - rupee = - (EnExRuppy*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EX_RUPPY, this->actor.world.pos.x, - this->actor.world.pos.y + 20.0f, this->actor.world.pos.z, 0, 0, 0, 3); + rupee = (EnExRuppy*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_RUPPY, this->actor.world.pos.x, + this->actor.world.pos.y + 20.0f, this->actor.world.pos.z, 0, 0, 0, 3); if (rupee != NULL) { rupeeColor = this->action - DNT_ACTION_LOW_RUPEES; rupee->colorIdx = rupeeColor; @@ -637,26 +636,26 @@ void EnDntNomal_StageHide(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_StageAttackHide(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageAttackHide(EnDntNomal* this, PlayState* play) { if (this->actor.xzDistToPlayer > 70.0f) { this->actionFunc = EnDntNomal_SetupStageUp; } } -void EnDntNomal_SetupStageAttack(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_SetupStageAttack(EnDntNomal* this, PlayState* play) { if (this->timer3 == 0) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageSpitAnim); Animation_Change(&this->skelAnime, &gDntStageSpitAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f); this->actor.colChkInfo.mass = 0xFF; this->isSolid = true; this->timer2 = 0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); this->actionFunc = EnDntNomal_StageAttack; } } -void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDntNomal_StageAttack(EnDntNomal* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* nut; f32 frame = this->skelAnime.curFrame; f32 dz; @@ -696,8 +695,8 @@ void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx) { spawnY = this->mouthPos.y + spawnOffset.y; spawnZ = this->mouthPos.z + spawnOffset.z; - nut = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NUTSBALL, spawnX, spawnY, spawnZ, - this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 4); + nut = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, spawnX, spawnY, spawnZ, this->actor.shape.rot.x, + this->actor.shape.rot.y, this->actor.shape.rot.z, 4); if (nut != NULL) { nut->velocity.y = spawnOffset.y * 0.5f; } @@ -706,7 +705,7 @@ void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_StageSetupReturn(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageSetupReturn(EnDntNomal* this, PlayState* play) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageWalkAnim); Animation_Change(&this->skelAnime, &gDntStageWalkAnim, 1.5f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f); this->actor.speedXZ = 4.0f; @@ -714,7 +713,7 @@ void EnDntNomal_StageSetupReturn(EnDntNomal* this, GlobalContext* globalCtx) { this->actionFunc = EnDntNomal_StageReturn; } -void EnDntNomal_StageReturn(EnDntNomal* this, GlobalContext* globalCtx) { +void EnDntNomal_StageReturn(EnDntNomal* this, PlayState* play) { f32 sp2C; f32 sp28; @@ -735,7 +734,7 @@ void EnDntNomal_StageReturn(EnDntNomal* this, GlobalContext* globalCtx) { } } -void EnDntNomal_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDntNomal_Update(Actor* thisx, PlayState* play) { s32 pad; EnDntNomal* this = (EnDntNomal*)thisx; @@ -804,38 +803,37 @@ void EnDntNomal_Update(Actor* thisx, GlobalContext* globalCtx) { this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); if (this->type == ENDNTNOMAL_TARGET) { Collider_SetQuadVertices(&this->targetQuad, &this->targetVtx[0], &this->targetVtx[1], &this->targetVtx[2], &this->targetVtx[3]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->targetQuad.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->targetQuad.base); } else { Collider_UpdateCylinder(&this->actor, &this->bodyCyl); if (this->isSolid) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCyl.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCyl.base); } } } -s32 EnDntNomal_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnDntNomal_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDntNomal* this = (EnDntNomal*)thisx; if ((limbIndex == 1) || (limbIndex == 3) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1733); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1733); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sLeafColors[this->type - ENDNTNOMAL_STAGE].r, sLeafColors[this->type - ENDNTNOMAL_STAGE].g, sLeafColors[this->type - ENDNTNOMAL_STAGE].b, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1743); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1743); } return false; } -void EnDntNomal_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDntNomal_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnDntNomal* this = (EnDntNomal*)thisx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -848,42 +846,41 @@ void EnDntNomal_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } -void EnDntNomal_DrawStageScrub(Actor* thisx, GlobalContext* globalCtx) { +void EnDntNomal_DrawStageScrub(Actor* thisx, PlayState* play) { static void* blinkTex[] = { gDntStageEyeOpenTex, gDntStageEyeHalfTex, gDntStageEyeShutTex }; EnDntNomal* this = (EnDntNomal*)thisx; Vec3f dustScale = { 0.25f, 0.25f, 0.25f }; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1790); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1790); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(blinkTex[this->eyeState])); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDntNomal_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDntNomal_OverrideLimbDraw, EnDntNomal_PostLimbDraw, this); Matrix_Translate(this->flowerPos.x, this->flowerPos.y, this->flowerPos.z, MTXMODE_NEW); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sLeafColors[this->type - ENDNTNOMAL_STAGE].r, sLeafColors[this->type - ENDNTNOMAL_STAGE].g, sLeafColors[this->type - ENDNTNOMAL_STAGE].b, 255); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1814), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1814), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDntStageFlowerDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1817); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1817); if (this->actionFunc == EnDntNomal_StageCelebrate) { - func_80033C30(&this->actor.world.pos, &dustScale, 255, globalCtx); + func_80033C30(&this->actor.world.pos, &dustScale, 255, play); } } -void EnDntNomal_DrawTargetScrub(Actor* thisx, GlobalContext* globalCtx) { +void EnDntNomal_DrawTargetScrub(Actor* thisx, PlayState* play) { EnDntNomal* this = (EnDntNomal*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1833); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDntNomal_PostLimbDraw, - this); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1833); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDntNomal_PostLimbDraw, this); Matrix_Translate(this->flowerPos.x, this->flowerPos.y, this->flowerPos.z, MTXMODE_NEW); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1848), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1848), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gHintNutsFlowerDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1851); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1851); } diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h index d94da9e101..0b5c6f12ec 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h @@ -6,7 +6,7 @@ struct EnDntNomal; -typedef void (*EnDntNomalActionFunc)(struct EnDntNomal*, GlobalContext*); +typedef void (*EnDntNomalActionFunc)(struct EnDntNomal*, PlayState*); typedef struct EnDntNomal { /* 0x0000 */ Actor actor; 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 a406d1fb34..fe3a9c6674 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c @@ -10,26 +10,26 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnDodojr_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDodojr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDodojr_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDodojr_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDodojr_Init(Actor* thisx, PlayState* play); +void EnDodojr_Destroy(Actor* thisx, PlayState* play); +void EnDodojr_Update(Actor* thisx, PlayState* play); +void EnDodojr_Draw(Actor* thisx, PlayState* play); -void func_809F73AC(EnDodojr* this, GlobalContext* globalCtx); -void func_809F7BE4(EnDodojr* this, GlobalContext* globalCtx); -void func_809F74C4(EnDodojr* this, GlobalContext* globalCtx); -void func_809F758C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F786C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F799C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F78EC(EnDodojr* this, GlobalContext* globalCtx); -void func_809F773C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F77AC(EnDodojr* this, GlobalContext* globalCtx); -void func_809F784C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F7AB8(EnDodojr* this, GlobalContext* globalCtx); -void func_809F7A00(EnDodojr* this, GlobalContext* globalCtx); -void func_809F7B3C(EnDodojr* this, GlobalContext* globalCtx); -void func_809F7C48(EnDodojr* this, GlobalContext* globalCtx); -void func_809F768C(EnDodojr* this, GlobalContext* globalCtx); +void func_809F73AC(EnDodojr* this, PlayState* play); +void func_809F7BE4(EnDodojr* this, PlayState* play); +void func_809F74C4(EnDodojr* this, PlayState* play); +void func_809F758C(EnDodojr* this, PlayState* play); +void func_809F786C(EnDodojr* this, PlayState* play); +void func_809F799C(EnDodojr* this, PlayState* play); +void func_809F78EC(EnDodojr* this, PlayState* play); +void func_809F773C(EnDodojr* this, PlayState* play); +void func_809F77AC(EnDodojr* this, PlayState* play); +void func_809F784C(EnDodojr* this, PlayState* play); +void func_809F7AB8(EnDodojr* this, PlayState* play); +void func_809F7A00(EnDodojr* this, PlayState* play); +void func_809F7B3C(EnDodojr* this, PlayState* play); +void func_809F7C48(EnDodojr* this, PlayState* play); +void func_809F768C(EnDodojr* this, PlayState* play); const ActorInit En_Dodojr_InitVars = { ACTOR_EN_DODOJR, @@ -65,14 +65,14 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInit = { 1, 2, 25, 25, 0xFF }; -void EnDodojr_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDodojr_Init(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 18.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_dodojr_Skel_0020E0, &object_dodojr_Anim_0009D4, - this->jointTable, this->morphTable, 15); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_Init(play, &this->skelAnime, &object_dodojr_Skel_0020E0, &object_dodojr_Anim_0009D4, this->jointTable, + this->morphTable, 15); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(4), &sColChkInit); this->actor.naviEnemyId = NAVI_ENEMY_BABY_DODONGO; @@ -83,10 +83,10 @@ void EnDodojr_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_809F73AC; } -void EnDodojr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDodojr_Destroy(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_809F64D0(EnDodojr* this) { @@ -94,7 +94,7 @@ void func_809F64D0(EnDodojr* this) { Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, 8); } -void func_809F6510(EnDodojr* this, GlobalContext* globalCtx, s32 count) { +void func_809F6510(EnDodojr* this, PlayState* play, s32 count) { Color_RGBA8 prim = { 170, 130, 90, 255 }; Color_RGBA8 env = { 100, 60, 20, 0 }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -112,11 +112,11 @@ void func_809F6510(EnDodojr* this, GlobalContext* globalCtx, s32 count) { pos.x = (Math_SinS(angle) * 22.0f) + this->dustPos.x; pos.z = (Math_CosS(angle) * 22.0f) + this->dustPos.z; - func_8002836C(globalCtx, &pos, &velocity, &accel, &prim, &env, 120, 40, 10); + func_8002836C(play, &pos, &velocity, &accel, &prim, &env, 120, 40, 10); } } -void func_809F6730(EnDodojr* this, GlobalContext* globalCtx, Vec3f* arg2) { +void func_809F6730(EnDodojr* this, PlayState* play, Vec3f* arg2) { Color_RGBA8 prim = { 170, 130, 90, 255 }; Color_RGBA8 env = { 100, 60, 20, 0 }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -132,10 +132,10 @@ void func_809F6730(EnDodojr* this, GlobalContext* globalCtx, Vec3f* arg2) { pos.x = (Math_SinS(angle) * 11.0f) + arg2->x; pos.z = (Math_CosS(angle) * 11.0f) + arg2->z; - func_8002836C(globalCtx, &pos, &velocity, &accel, &prim, &env, 100, 60, 8); + func_8002836C(play, &pos, &velocity, &accel, &prim, &env, 100, 60, 8); } -s32 func_809F68B0(EnDodojr* this, GlobalContext* globalCtx) { +s32 func_809F68B0(EnDodojr* this, PlayState* play) { if (this->actor.velocity.y >= 0.0f) { return 0; } @@ -147,7 +147,7 @@ s32 func_809F68B0(EnDodojr* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); this->dustPos = this->actor.world.pos; - func_809F6510(this, globalCtx, 10); + func_809F6510(this, play, 10); this->actor.velocity.y = 10.0f / (4 - this->unk_1FC); this->unk_1FC--; @@ -220,7 +220,7 @@ void func_809F6C24(EnDodojr* this) { this->actor.gravity = -0.8f; } -s32 func_809F6CA4(EnDodojr* this, GlobalContext* globalCtx) { +s32 func_809F6CA4(EnDodojr* this, PlayState* play) { Actor* bomb; Vec3f unkVec = { 99999.0f, 99999.0f, 99999.0f }; s32 retVar = 0; @@ -228,7 +228,7 @@ s32 func_809F6CA4(EnDodojr* this, GlobalContext* globalCtx) { f32 yDist; f32 zDist; - bomb = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + bomb = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; this->bomb = NULL; while (bomb != NULL) { @@ -274,16 +274,16 @@ s32 func_809F6DD0(EnDodojr* this) { } } -void func_809F6E54(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F6E54(EnDodojr* this, PlayState* play) { f32 angles[] = { 0.0f, 210.0f, 60.0f, 270.0f, 120.0f, 330.0f, 180.0f, 30.0f, 240.0f, 90.0f, 300.0f, 150.0f }; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f pos; s16 angleIndex; if ((this->bomb == NULL) || (this->bomb->update == NULL) || ((this->bomb != NULL) && (this->bomb->parent != NULL))) { - func_809F6CA4(this, globalCtx); + func_809F6CA4(this, play); } if (this->bomb != NULL) { @@ -293,9 +293,9 @@ void func_809F6E54(EnDodojr* this, GlobalContext* globalCtx) { } if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &pos) > 80.0f) { - angleIndex = (s16)(this->actor.home.pos.x + this->actor.home.pos.y + this->actor.home.pos.z + - globalCtx->state.frames / 30) % - 12; + angleIndex = + (s16)(this->actor.home.pos.x + this->actor.home.pos.y + this->actor.home.pos.z + play->state.frames / 30) % + 12; angleIndex = ABS(angleIndex); pos.x += 80.0f * sinf(angles[angleIndex]); pos.z += 80.0f * cosf(angles[angleIndex]); @@ -320,7 +320,7 @@ void func_809F709C(EnDodojr* this) { this->actionFunc = func_809F7AB8; } -s32 func_809F70E8(EnDodojr* this, GlobalContext* globalCtx) { +s32 func_809F70E8(EnDodojr* this, PlayState* play) { if ((this->actionFunc == func_809F773C) || (this->actionFunc == func_809F77AC) || (this->actionFunc == func_809F784C) || (this->actionFunc == func_809F7A00) || (this->actionFunc == func_809F7AB8) || (this->actionFunc == func_809F7B3C) || @@ -328,7 +328,7 @@ s32 func_809F70E8(EnDodojr* this, GlobalContext* globalCtx) { return 0; } - if (globalCtx->actorCtx.unk_02 != 0) { + if (play->actorCtx.unk_02 != 0) { if (this->actionFunc != func_809F73AC) { if (this->actionFunc == func_809F74C4) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; @@ -349,7 +349,7 @@ s32 func_809F70E8(EnDodojr* this, GlobalContext* globalCtx) { } if ((this->actor.colChkInfo.damageEffect == 0) && (this->actor.colChkInfo.damage != 0)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->timer2 = 2; this->actionFunc = func_809F7C48; return 1; @@ -368,28 +368,28 @@ s32 func_809F70E8(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F72A4(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F72A4(EnDodojr* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); if ((this->actionFunc != func_809F73AC) && (this->actionFunc != func_809F7BE4)) { if ((this->actionFunc == func_809F74C4) || (this->actionFunc == func_809F758C) || (this->actionFunc == func_809F799C)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->actionFunc == func_809F74C4) || (this->actionFunc == func_809F758C) || (this->actionFunc == func_809F786C) || (this->actionFunc == func_809F78EC) || (this->actionFunc == func_809F799C)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void func_809F73AC(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F73AC(EnDodojr* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&object_dodojr_Anim_000860); - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 dist; if (!(this->actor.xzDistToPlayer >= 320.0f)) { @@ -410,14 +410,14 @@ void func_809F73AC(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F74C4(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F74C4(EnDodojr* this, PlayState* play) { f32 sp2C; Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 4, 0x3E8, 0x64); sp2C = this->actor.shape.rot.x; sp2C /= 16384.0f; this->actor.world.pos.y = this->actor.home.pos.y + (60.0f * sp2C); - func_809F6510(this, globalCtx, 3); + func_809F6510(this, play, 3); if (sp2C == 0.0f) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; @@ -427,9 +427,9 @@ void func_809F74C4(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F758C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F758C(EnDodojr* this, PlayState* play) { func_8002D868(&this->actor); - func_809F6730(this, globalCtx, &this->actor.world.pos); + func_809F6730(this, play, &this->actor.world.pos); if (DECR(this->timer4) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_MOVE); @@ -442,7 +442,7 @@ void func_809F758C(EnDodojr* this, GlobalContext* globalCtx) { return; } - func_809F6E54(this, globalCtx); + func_809F6E54(this, play); if (func_809F706C(this) != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_CRY); @@ -457,7 +457,7 @@ void func_809F758C(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F768C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F768C(EnDodojr* this, PlayState* play) { EnBom* bomb; if (((s16)this->skelAnime.curFrame - 8) < 4) { @@ -473,7 +473,7 @@ void func_809F768C(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F773C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F773C(EnDodojr* this, PlayState* play) { if (DECR(this->timer3) == 0) { func_809F64D0(this); this->actor.flags &= ~ACTOR_FLAG_0; @@ -482,12 +482,12 @@ void func_809F773C(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F77AC(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F77AC(EnDodojr* this, PlayState* play) { this->rootScale = 1.2f; this->rootScale *= ((f32)this->actor.colorFilterTimer / 8); func_8002D868(&this->actor); - if (func_809F68B0(this, globalCtx) != 0) { + if (func_809F68B0(this, play) != 0) { this->timer3 = 60; func_809F6AC4(this); this->unk_1FC = 7; @@ -495,14 +495,14 @@ void func_809F77AC(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F784C(EnDodojr* this, GlobalContext* globalCtx) { - func_809F7B3C(this, globalCtx); +void func_809F784C(EnDodojr* this, PlayState* play) { + func_809F7B3C(this, play); } -void func_809F786C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F786C(EnDodojr* this, PlayState* play) { func_8002D868(&this->actor); - if (func_809F68B0(this, globalCtx) != 0) { + if (func_809F68B0(this, play) != 0) { func_809F6AC4(this); this->actionFunc = func_809F78EC; } @@ -512,7 +512,7 @@ void func_809F786C(EnDodojr* this, GlobalContext* globalCtx) { this->actor.colorFilterTimer = this->timer1; } -void func_809F78EC(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F78EC(EnDodojr* this, PlayState* play) { if (DECR(this->timer1) != 0) { if (this->timer1 < 30) { if ((this->timer1 & 1) != 0) { @@ -531,17 +531,17 @@ void func_809F78EC(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F799C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F799C(EnDodojr* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_24; func_8002D868(&this->actor); - if (func_809F68B0(this, globalCtx) != 0) { + if (func_809F68B0(this, play) != 0) { func_809F6994(this); this->actionFunc = func_809F758C; } } -void func_809F7A00(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F7A00(EnDodojr* this, PlayState* play) { f32 tmp; Math_SmoothStepToS(&this->actor.shape.rot.x, 0x4000, 4, 1000, 100); @@ -553,15 +553,15 @@ void func_809F7A00(EnDodojr* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } - func_809F6510(this, globalCtx, 3); + func_809F6510(this, play, 3); } -void func_809F7AB8(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F7AB8(EnDodojr* this, PlayState* play) { func_8002D868(&this->actor); Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 4, 1000, 10); this->actor.world.rot.x = this->actor.shape.rot.x; - if (func_809F68B0(this, globalCtx) != 0) { + if (func_809F68B0(this, play) != 0) { this->timer3 = 60; func_809F6AC4(this); this->unk_1FC = 7; @@ -569,7 +569,7 @@ void func_809F7AB8(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F7B3C(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F7B3C(EnDodojr* this, PlayState* play) { EnBom* bomb; if (this->unk_1FC != 0) { @@ -578,7 +578,7 @@ void func_809F7B3C(EnDodojr* this, GlobalContext* globalCtx) { this->unk_1FC--; } } else { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOMB_BODY); if (bomb != NULL) { @@ -590,37 +590,37 @@ void func_809F7B3C(EnDodojr* this, GlobalContext* globalCtx) { } } -void func_809F7BE4(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F7BE4(EnDodojr* this, PlayState* play) { if (DECR(this->timer3) == 0) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x40); Actor_Kill(&this->actor); } } -void func_809F7C48(EnDodojr* this, GlobalContext* globalCtx) { +void func_809F7C48(EnDodojr* this, PlayState* play) { if (DECR(this->timer2) == 0) { func_809F709C(this); } } -void EnDodojr_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDodojr_Update(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; SkelAnime_Update(&this->skelAnime); Actor_MoveForward(&this->actor); - func_809F70E8(this, globalCtx); + func_809F70E8(this, play); if (this->actionFunc != func_809F73AC) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, this->collider.dim.radius, this->collider.dim.height, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, this->collider.dim.radius, this->collider.dim.height, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 10.0f); - func_809F72A4(this, globalCtx); + func_809F72A4(this, play); } -s32 func_809F7D50(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_809F7D50(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDodojr* this = (EnDodojr*)thisx; Vec3f D_809F7F64 = { 480.0f, 620.0f, 0.0f }; @@ -636,15 +636,15 @@ s32 func_809F7D50(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void func_809F7DFC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void func_809F7DFC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { } -void EnDodojr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDodojr_Draw(Actor* thisx, PlayState* play) { EnDodojr* this = (EnDodojr*)thisx; if ((this->actionFunc != func_809F73AC) && (this->actionFunc != func_809F7BE4)) { - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, func_809F7D50, func_809F7DFC, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_809F7D50, func_809F7DFC, &this->actor); } } diff --git a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h index 2ca10bd5f6..e202095980 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h @@ -6,7 +6,7 @@ struct EnDodojr; -typedef void (*EnDodojrActionFunc)(struct EnDodojr*, GlobalContext*); +typedef void (*EnDodojrActionFunc)(struct EnDodojr*, PlayState*); typedef struct EnDodojr { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 4b03148c23..a264ebeec2 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -17,24 +17,24 @@ typedef enum { DODONGO_WALK } EnDodongoActionState; -void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDodongo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDodongo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDodongo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDodongo_Init(Actor* thisx, PlayState* play); +void EnDodongo_Destroy(Actor* thisx, PlayState* play); +void EnDodongo_Update(Actor* thisx, PlayState* play); +void EnDodongo_Draw(Actor* thisx, PlayState* play); -void EnDodongo_SetupDeath(EnDodongo* this, GlobalContext* globalCtx); +void EnDodongo_SetupDeath(EnDodongo* this, PlayState* play); void EnDodongo_ShiftVecRadial(s16 yaw, f32 radius, Vec3f* vec); -s32 EnDodongo_AteBomb(EnDodongo* this, GlobalContext* globalCtx); +s32 EnDodongo_AteBomb(EnDodongo* this, PlayState* play); void EnDodongo_SetupIdle(EnDodongo* this); -void EnDodongo_Idle(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_EndBreatheFire(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_BreatheFire(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_Walk(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_Stunned(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_Death(EnDodongo* this, GlobalContext* globalCtx); -void EnDodongo_SweepTail(EnDodongo* this, GlobalContext* globalCtx); +void EnDodongo_Idle(EnDodongo* this, PlayState* play); +void EnDodongo_EndBreatheFire(EnDodongo* this, PlayState* play); +void EnDodongo_BreatheFire(EnDodongo* this, PlayState* play); +void EnDodongo_SwallowBomb(EnDodongo* this, PlayState* play); +void EnDodongo_Walk(EnDodongo* this, PlayState* play); +void EnDodongo_Stunned(EnDodongo* this, PlayState* play); +void EnDodongo_Death(EnDodongo* this, PlayState* play); +void EnDodongo_SweepTail(EnDodongo* this, PlayState* play); const ActorInit En_Dodongo_InitVars = { ACTOR_EN_DODONGO, @@ -238,7 +238,7 @@ void EnDodongo_SetupAction(EnDodongo* this, EnDodongoActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnDodongo_SpawnBombSmoke(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_SpawnBombSmoke(EnDodongo* this, PlayState* play) { s32 pad; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.3f, 0.0f }; @@ -270,7 +270,7 @@ void EnDodongo_SpawnBombSmoke(EnDodongo* this, GlobalContext* globalCtx) { velocity.z = randCos * 3.5f; accel.x = ((Rand_ZeroOne() * 0.1f) + 0.15f) * -randSin; accel.z = ((Rand_ZeroOne() * 0.1f) + 0.15f) * -randCos; - func_8002836C(globalCtx, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); + func_8002836C(play, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); randAngle = Rand_ZeroOne() * 0x2000; randCos = Math_CosS(this->actor.shape.rot.y + randAngle); @@ -282,7 +282,7 @@ void EnDodongo_SpawnBombSmoke(EnDodongo* this, GlobalContext* globalCtx) { velocity.z = randSin * 3.5f; accel.x = ((Rand_ZeroOne() * 0.1f) + 0.15f) * randCos; accel.z = ((Rand_ZeroOne() * 0.1f) + 0.15f) * -randSin; - func_8002836C(globalCtx, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); + func_8002836C(play, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); randAngle = Rand_ZeroOne() * 0x2000; randCos = Math_CosS(this->actor.shape.rot.y + randAngle); @@ -295,7 +295,7 @@ void EnDodongo_SpawnBombSmoke(EnDodongo* this, GlobalContext* globalCtx) { velocity.z = -randSin * 3.5f; accel.x = ((Rand_ZeroOne() * 0.1f) + 0.15f) * -randCos; accel.z = ((Rand_ZeroOne() * 0.1f) + 0.15f) * randSin; - func_8002836C(globalCtx, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); + func_8002836C(play, &pos, &velocity, &accel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 100, 25, 20); } static InitChainEntry sInitChain[] = { @@ -304,7 +304,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2800, ICHAIN_STOP), }; -void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDodongo_Init(Actor* thisx, PlayState* play) { EnDodongo* this = (EnDodongo*)thisx; EffectBlureInit1 blureInit; @@ -316,17 +316,16 @@ void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { this->bodyScale.x = this->bodyScale.y = this->bodyScale.z = 1.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 48.0f); Actor_SetScale(&this->actor, 0.01875f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDodongoSkel, &gDodongoWaitAnim, this->jointTable, this->morphTable, - 31); + SkelAnime_Init(play, &this->skelAnime, &gDodongoSkel, &gDodongoWaitAnim, this->jointTable, this->morphTable, 31); this->actor.colChkInfo.health = 4; this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.damageTable = &sDamageTable; - Collider_InitQuad(globalCtx, &this->colliderAT); - Collider_InitTris(globalCtx, &this->colliderHard); - Collider_InitJntSph(globalCtx, &this->colliderBody); - Collider_SetQuad(globalCtx, &this->colliderAT, &this->actor, &sAttackQuadInit); - Collider_SetTris(globalCtx, &this->colliderHard, &this->actor, &sHardTrisInit, this->trisElements); - Collider_SetJntSph(globalCtx, &this->colliderBody, &this->actor, &sBodyJntSphInit, this->sphElements); + Collider_InitQuad(play, &this->colliderAT); + Collider_InitTris(play, &this->colliderHard); + Collider_InitJntSph(play, &this->colliderBody); + Collider_SetQuad(play, &this->colliderAT, &this->actor, &sAttackQuadInit); + Collider_SetTris(play, &this->colliderHard, &this->actor, &sHardTrisInit, this->trisElements); + Collider_SetJntSph(play, &this->colliderBody, &this->actor, &sBodyJntSphInit, this->sphElements); blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p1StartColor[2] = blureInit.p1StartColor[3] = blureInit.p2StartColor[0] = blureInit.p2StartColor[1] = blureInit.p2StartColor[2] = blureInit.p1EndColor[0] = @@ -339,21 +338,21 @@ void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.unkFlag = false; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 60.0f, 70.0f, + Effect_Add(play, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 60.0f, 70.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); EnDodongo_SetupIdle(this); } -void EnDodongo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDodongo_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnDodongo* this = (EnDodongo*)thisx; - Effect_Delete(globalCtx, this->blureIdx); - Collider_DestroyTris(globalCtx, &this->colliderHard); - Collider_DestroyJntSph(globalCtx, &this->colliderBody); - Collider_DestroyQuad(globalCtx, &this->colliderAT); + Effect_Delete(play, this->blureIdx); + Collider_DestroyTris(play, &this->colliderHard); + Collider_DestroyJntSph(play, &this->colliderBody); + Collider_DestroyQuad(play, &this->colliderAT); } void EnDodongo_SetupIdle(EnDodongo* this) { @@ -408,21 +407,21 @@ void EnDodongo_SetupStunned(EnDodongo* this) { EnDodongo_SetupAction(this, EnDodongo_Stunned); } -void EnDodongo_Idle(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_Idle(EnDodongo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((DECR(this->timer) == 0) && Animation_OnFrame(&this->skelAnime, 0.0f)) { EnDodongo_SetupWalk(this); } } -void EnDodongo_EndBreatheFire(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_EndBreatheFire(EnDodongo* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnDodongo_SetupIdle(this); this->timer = Rand_S16Offset(10, 20); } } -void EnDodongo_BreatheFire(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_BreatheFire(EnDodongo* this, PlayState* play) { s32 pad; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -440,7 +439,7 @@ void EnDodongo_BreatheFire(EnDodongo* this, GlobalContext* globalCtx) { pos.y += 35.0f; EnDodongo_ShiftVecRadial(this->actor.world.rot.y, 30.0f, &pos); EnDodongo_ShiftVecRadial(this->actor.world.rot.y, 2.5f, &accel); - EffectSsDFire_SpawnFixedScale(globalCtx, &pos, &velocity, &accel, 255 - (fireFrame * 10), fireFrame + 3); + EffectSsDFire_SpawnFixedScale(play, &pos, &velocity, &accel, 255 - (fireFrame * 10), fireFrame + 3); } else if ((2.0f <= this->skelAnime.curFrame) && (this->skelAnime.curFrame <= 20.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_BREATH - SFX_FLAG); } @@ -449,7 +448,7 @@ void EnDodongo_BreatheFire(EnDodongo* this, GlobalContext* globalCtx) { } } -void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_SwallowBomb(EnDodongo* this, PlayState* play) { Vec3f smokeVel = { 0.0f, 0.0f, 0.0f }; Vec3f smokeAccel = { 0.0f, 0.6f, 0.0f }; Color_RGBA8 white = { 255, 255, 255, 255 }; @@ -494,7 +493,7 @@ void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx) { pos.x = this->sphElements[0].dim.worldSphere.center.x + deathFireVel.x; pos.y = this->sphElements[0].dim.worldSphere.center.y + deathFireVel.y; pos.z = this->sphElements[0].dim.worldSphere.center.z + deathFireVel.z; - func_8002836C(globalCtx, &pos, &deathFireVel, &deathFireAccel, &this->bombSmokePrimColor, + func_8002836C(play, &pos, &deathFireVel, &deathFireAccel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 400, 10, 10); } Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); @@ -504,16 +503,16 @@ void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx) { } if ((s32)this->skelAnime.curFrame < 28) { if (((s32)this->skelAnime.curFrame < 26) && (this->timer <= 10)) { - EnDodongo_SpawnBombSmoke(this, globalCtx); + EnDodongo_SpawnBombSmoke(this, play); } else { pos = this->headPos; - func_8002829C(globalCtx, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); + func_8002829C(play, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); pos.x -= (Math_CosS(this->actor.shape.rot.y) * 6.0f); pos.z += (Math_SinS(this->actor.shape.rot.y) * 6.0f); - func_8002829C(globalCtx, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); + func_8002829C(play, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); pos.x = this->headPos.x + (Math_CosS(this->actor.shape.rot.y) * 6.0f); pos.z = this->headPos.z - (Math_SinS(this->actor.shape.rot.y) * 6.0f); - func_8002829C(globalCtx, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); + func_8002829C(play, &pos, &smokeVel, &smokeAccel, &white, &white, 50, 5); } } this->bodyScale.y = this->bodyScale.z = (Math_SinS(this->actor.colorFilterTimer * 0x1000) * 0.5f) + 1.0f; @@ -521,14 +520,14 @@ void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if (this->timer == 0) { - EnDodongo_SetupDeath(this, globalCtx); + EnDodongo_SetupDeath(this, play); } } -void EnDodongo_Walk(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_Walk(EnDodongo* this, PlayState* play) { s32 pad; f32 playbackSpeed; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 yawDiff = (s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y); yawDiff = ABS(yawDiff); @@ -551,13 +550,13 @@ void EnDodongo_Walk(EnDodongo* this, GlobalContext* globalCtx) { if ((s32)this->skelAnime.curFrame < 21) { if (!this->rightFootStep) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 10.0f, 3, 2.0f, 200, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 10.0f, 3, 2.0f, 200, 15, false); this->rightFootStep = true; } } else { if (this->rightFootStep) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 10.0f, 3, 2.0f, 200, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 10.0f, 3, 2.0f, 200, 15, false); this->rightFootStep = false; } } @@ -601,7 +600,7 @@ void EnDodongo_SetupSweepTail(EnDodongo* this) { EnDodongo_SetupAction(this, EnDodongo_SweepTail); } -void EnDodongo_SweepTail(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_SweepTail(EnDodongo* this, PlayState* play) { s16 yawDiff1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (SkelAnime_Update(&this->skelAnime)) { @@ -642,24 +641,24 @@ void EnDodongo_SweepTail(EnDodongo* this, GlobalContext* globalCtx) { tailPos.x = this->sphElements[1].dim.worldSphere.center.x; tailPos.y = this->sphElements[1].dim.worldSphere.center.y; tailPos.z = this->sphElements[1].dim.worldSphere.center.z; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); tailPos.x = this->sphElements[2].dim.worldSphere.center.x; tailPos.y = this->sphElements[2].dim.worldSphere.center.y; tailPos.z = this->sphElements[2].dim.worldSphere.center.z; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); if (this->colliderBody.base.atFlags & AT_HIT) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->colliderBody.base.at == &player->actor) { Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); } } -void EnDodongo_SetupDeath(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_SetupDeath(EnDodongo* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gDodongoDieAnim, -8.0f); this->timer = 0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_DEAD); @@ -669,19 +668,19 @@ void EnDodongo_SetupDeath(EnDodongo* this, GlobalContext* globalCtx) { EnDodongo_SetupAction(this, EnDodongo_Death); } -void EnDodongo_Death(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_Death(EnDodongo* this, PlayState* play) { EnBom* bomb; if (this->skelAnime.curFrame < 35.0f) { if (this->actor.params == EN_DODONGO_SMOKE_DEATH) { - EnDodongo_SpawnBombSmoke(this, globalCtx); + EnDodongo_SpawnBombSmoke(this, play); } } else if (this->actor.colorFilterTimer == 0) { Actor_SetColorFilter(&this->actor, 0x4000, 0x78, 0, 4); } if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->timer == 0) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 6, BOMB_BODY); if (bomb != NULL) { bomb->timer = 0; @@ -694,24 +693,24 @@ void EnDodongo_Death(EnDodongo* this, GlobalContext* globalCtx) { if (this->timer != 0) { this->timer--; if (this->timer == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x40); Actor_Kill(&this->actor); } } } -void EnDodongo_Stunned(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_Stunned(EnDodongo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.colorFilterTimer == 0) { if (this->actor.colChkInfo.health == 0) { - EnDodongo_SetupDeath(this, globalCtx); + EnDodongo_SetupDeath(this, play); } else { EnDodongo_SetupIdle(this); } } } -void EnDodongo_CollisionCheck(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_CollisionCheck(EnDodongo* this, PlayState* play) { if (this->colliderHard.base.acFlags & AC_BOUNCED) { this->colliderHard.base.acFlags &= ~AC_BOUNCED; this->colliderBody.base.acFlags &= ~AC_HIT; @@ -729,7 +728,7 @@ void EnDodongo_CollisionCheck(EnDodongo* this, GlobalContext* globalCtx) { } else { Actor_SetColorFilter(&this->actor, 0x4000, 0x78, 0, 8); if (Actor_ApplyDamage(&this->actor) == 0) { - EnDodongo_SetupDeath(this, globalCtx); + EnDodongo_SetupDeath(this, play); } else { EnDodongo_SetupSweepTail(this); } @@ -738,7 +737,7 @@ void EnDodongo_CollisionCheck(EnDodongo* this, GlobalContext* globalCtx) { } } -void EnDodongo_UpdateQuad(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_UpdateQuad(EnDodongo* this, PlayState* play) { Vec3f sp94 = { -1000.0f, -1500.0f, 0.0f }; Vec3f sp88 = { -1000.0f, -200.0f, 1500.0f }; Vec3f sp7C = { -1000.0f, -200.0f, -1500.0f }; @@ -763,34 +762,34 @@ void EnDodongo_UpdateQuad(EnDodongo* this, GlobalContext* globalCtx) { &this->colliderAT.dim.quad[c], &this->colliderAT.dim.quad[d]); } -void EnDodongo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDodongo_Update(Actor* thisx, PlayState* play) { s32 pad; EnDodongo* this = (EnDodongo*)thisx; - EnDodongo_CollisionCheck(this, globalCtx); + EnDodongo_CollisionCheck(this, play); if (this->actor.colChkInfo.damageEffect != 0xE) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 60.0f, 70.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 60.0f, 70.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DOWN); } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); if (this->actionState != DODONGO_DEATH) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderHard.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderHard.base); } if (this->actionState > DODONGO_DEATH) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); } - if ((this->actionState >= DODONGO_IDLE) && EnDodongo_AteBomb(this, globalCtx)) { + if ((this->actionState >= DODONGO_IDLE) && EnDodongo_AteBomb(this, play)) { EnDodongo_SetupSwallowBomb(this); } if (this->actionState == DODONGO_BREATHE_FIRE) { if ((29.0f < this->skelAnime.curFrame) && (this->skelAnime.curFrame < 43.0f)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderAT.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderAT.base); } } this->actor.focus.pos.x = this->actor.world.pos.x + Math_SinS(this->actor.shape.rot.y) * -30.0f; @@ -798,8 +797,7 @@ void EnDodongo_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y) * -30.0f; } -s32 EnDodongo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnDodongo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDodongo* this = (EnDodongo*)thisx; if ((limbIndex == 15) || (limbIndex == 16)) { @@ -808,7 +806,7 @@ s32 EnDodongo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDodongo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f legOffsets[3] = { { 1100.0f, -700.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, @@ -847,7 +845,7 @@ void EnDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList case 2: if ((this->actionState == DODONGO_BREATHE_FIRE) && (29.0f < this->skelAnime.curFrame) && (this->skelAnime.curFrame < 43.0f)) { - EnDodongo_UpdateQuad(this, globalCtx); + EnDodongo_UpdateQuad(this, play); } break; case 7: @@ -916,13 +914,13 @@ void EnDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnDodongo_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnDodongo_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnDodongo* this = (EnDodongo*)thisx; s32 index; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDodongo_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDodongo_OverrideLimbDraw, EnDodongo_PostLimbDraw, this); if (this->iceTimer != 0) { @@ -931,8 +929,8 @@ void EnDodongo_Draw(Actor* thisx, GlobalContext* globalCtx2) { this->iceTimer--; if ((this->iceTimer % 4) == 0) { index = this->iceTimer >> 2; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &this->icePos[index], 150, 150, 150, 250, 235, 245, - 255, 1.8f); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &this->icePos[index], 150, 150, 150, 250, 235, 245, 255, + 1.8f); } } } @@ -942,8 +940,8 @@ void EnDodongo_ShiftVecRadial(s16 yaw, f32 radius, Vec3f* vec) { vec->z += Math_CosS(yaw) * radius; } -s32 EnDodongo_AteBomb(EnDodongo* this, GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; +s32 EnDodongo_AteBomb(EnDodongo* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; f32 dx; f32 dy; f32 dz; diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h index 1889eaf030..f29c644eba 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h @@ -6,7 +6,7 @@ struct EnDodongo; -typedef void (*EnDodongoActionFunc)(struct EnDodongo*, GlobalContext*); +typedef void (*EnDodongoActionFunc)(struct EnDodongo*, PlayState*); typedef struct EnDodongo { /* 0x0000 */ Actor actor; 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 bd10ac0e05..1b46aceb06 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -9,17 +9,17 @@ #define FLAGS 0 -void EnDog_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDog_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDog_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDog_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDog_Init(Actor* thisx, PlayState* play); +void EnDog_Destroy(Actor* thisx, PlayState* play); +void EnDog_Update(Actor* thisx, PlayState* play); +void EnDog_Draw(Actor* thisx, PlayState* play); -void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx); -void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx); -void EnDog_FollowPlayer(EnDog* this, GlobalContext* globalCtx); -void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx); -void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx); -void EnDog_Wait(EnDog* this, GlobalContext* globalCtx); +void EnDog_FollowPath(EnDog* this, PlayState* play); +void EnDog_ChooseMovement(EnDog* this, PlayState* play); +void EnDog_FollowPlayer(EnDog* this, PlayState* play); +void EnDog_RunAway(EnDog* this, PlayState* play); +void EnDog_FaceLink(EnDog* this, PlayState* play); +void EnDog_Wait(EnDog* this, PlayState* play); const ActorInit En_Dog_InitVars = { ACTOR_EN_DOG, @@ -175,13 +175,13 @@ s32 EnDog_PlayAnimAndSFX(EnDog* this) { return 0; } -s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) { +s8 EnDog_CanFollow(EnDog* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; return 2; } - if (globalCtx->sceneNum == SCENE_MARKET_DAY) { + if (play->sceneNum == SCENE_MARKET_DAY) { return 0; } @@ -197,7 +197,7 @@ s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) { return 0; } -s32 EnDog_UpdateWaypoint(EnDog* this, GlobalContext* globalCtx) { +s32 EnDog_UpdateWaypoint(EnDog* this, PlayState* play) { s32 change; if (this->path == NULL) { @@ -225,7 +225,7 @@ s32 EnDog_UpdateWaypoint(EnDog* this, GlobalContext* globalCtx) { return 1; } -s32 EnDog_Orient(EnDog* this, GlobalContext* globalCtx) { +s32 EnDog_Orient(EnDog* this, PlayState* play) { s16 targetYaw; f32 waypointDistSq; @@ -233,19 +233,19 @@ s32 EnDog_Orient(EnDog* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.y, targetYaw, 10, 1000, 1); if ((waypointDistSq > 0.0f) && (waypointDistSq < 1000.0f)) { - return EnDog_UpdateWaypoint(this, globalCtx); + return EnDog_UpdateWaypoint(this, play); } else { return 0; } } -void EnDog_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDog_Init(Actor* thisx, PlayState* play) { EnDog* this = (EnDog*)thisx; s16 followingDog; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDogSkel, NULL, this->jointTable, this->morphTable, 13); + SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, NULL, this->jointTable, this->morphTable, 13); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDOG_ANIM_0); if ((this->actor.params & 0x8000) == 0) { @@ -258,15 +258,15 @@ void EnDog_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, 0, &sColChkInfoInit); Actor_SetScale(&this->actor, 0.0075f); this->waypoint = 0; this->actor.gravity = -1.0f; - this->path = Path_GetByIndex(globalCtx, (this->actor.params & 0x00F0) >> 4, 0xF); + this->path = Path_GetByIndex(play, (this->actor.params & 0x00F0) >> 4, 0xF); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_MARKET_NIGHT: if ((!gSaveContext.dogIsLost) && (((this->actor.params & 0x0F00) >> 8) == 1)) { Actor_Kill(&this->actor); @@ -296,18 +296,18 @@ void EnDog_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDog_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDog_Destroy(Actor* thisx, PlayState* play) { EnDog* this = (EnDog*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) { +void EnDog_FollowPath(EnDog* this, PlayState* play) { s32 behaviors[] = { DOG_SIT, DOG_BOW, DOG_BARK }; s32 unused[] = { 40, 80, 20 }; f32 speed; s32 frame; - if (EnDog_CanFollow(this, globalCtx) == 1) { + if (EnDog_CanFollow(this, play) == 1) { this->actionFunc = EnDog_FollowPlayer; } @@ -318,7 +318,7 @@ void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) { speed = 4.0f; } Math_SmoothStepToF(&this->actor.speedXZ, speed, 0.4f, 1.0f, 0.0f); - EnDog_Orient(this, globalCtx); + EnDog_Orient(this, play); this->actor.shape.rot = this->actor.world.rot; // Used to change between two text boxes for Richard's owner in the Market Day scene @@ -331,7 +331,7 @@ void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) { CLEAR_EVENTINF(EVENTINF_30); } } else { - frame = globalCtx->state.frames % 3; + frame = play->state.frames % 3; this->nextBehavior = behaviors[frame]; // no clue why they're using the behavior id to calculate timer. possibly meant to use the unused array? this->behaviorTimer = Rand_S16Offset(60, behaviors[frame]); @@ -339,14 +339,14 @@ void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) { } } -void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx) { - if (EnDog_CanFollow(this, globalCtx) == 1) { +void EnDog_ChooseMovement(EnDog* this, PlayState* play) { + if (EnDog_CanFollow(this, play) == 1) { this->actionFunc = EnDog_FollowPlayer; } if (DECR(this->behaviorTimer) == 0) { this->behaviorTimer = Rand_S16Offset(200, 100); - if (globalCtx->state.frames % 2) { + if (play->state.frames % 2) { this->nextBehavior = DOG_WALK; } else { this->nextBehavior = DOG_RUN; @@ -360,7 +360,7 @@ void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.4f, 1.0f, 0.0f); } -void EnDog_FollowPlayer(EnDog* this, GlobalContext* globalCtx) { +void EnDog_FollowPlayer(EnDog* this, PlayState* play) { f32 speed; if (gSaveContext.dogParams == 0) { @@ -397,7 +397,7 @@ void EnDog_FollowPlayer(EnDog* this, GlobalContext* globalCtx) { } } -void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx) { +void EnDog_RunAway(EnDog* this, PlayState* play) { if (this->actor.xzDistToPlayer < 200.0f) { Math_ApproachF(&this->actor.speedXZ, 4.0f, 0.6f, 1.0f); Math_SmoothStepToS(&this->actor.world.rot.y, (this->actor.yawTowardsPlayer ^ 0x8000), 10, 1000, 1); @@ -407,7 +407,7 @@ void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx) { this->actor.shape.rot = this->actor.world.rot; } -void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx) { +void EnDog_FaceLink(EnDog* this, PlayState* play) { s16 rotTowardLink; s16 prevRotY; f32 absAngleDiff; @@ -437,7 +437,7 @@ void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx) { this->actor.shape.rot = this->actor.world.rot; } -void EnDog_Wait(EnDog* this, GlobalContext* globalCtx) { +void EnDog_Wait(EnDog* this, PlayState* play) { this->unusedAngle = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y); // If another dog is following Link and he gets within 200 units of waiting dog, run away @@ -447,41 +447,41 @@ void EnDog_Wait(EnDog* this, GlobalContext* globalCtx) { } } -void EnDog_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDog_Update(Actor* thisx, PlayState* play) { EnDog* this = (EnDog*)thisx; s32 pad; EnDog_PlayAnimAndSFX(this); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, this->collider.dim.radius, this->collider.dim.height * 0.5f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, this->collider.dim.radius, this->collider.dim.height * 0.5f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); Actor_MoveForward(&this->actor); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnDog_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnDog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { return false; } -void EnDog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { } -void EnDog_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDog_Draw(Actor* thisx, PlayState* play) { EnDog* this = (EnDog*)thisx; Color_RGBA8 colors[] = { { 255, 255, 200, 0 }, { 150, 100, 50, 0 } }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dog.c", 972); + OPEN_DISPS(play->state.gfxCtx, "../z_en_dog.c", 972); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, colors[this->actor.params & 0xF].r, colors[this->actor.params & 0xF].g, colors[this->actor.params & 0xF].b, colors[this->actor.params & 0xF].a); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDog_OverrideLimbDraw, EnDog_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dog.c", 994); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_dog.c", 994); } diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.h b/src/overlays/actors/ovl_En_Dog/z_en_dog.h index 83abbed7e1..dec2b5c180 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.h +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.h @@ -6,7 +6,7 @@ struct EnDog; -typedef void (*EnDogActionFunc)(struct EnDog*, GlobalContext*); +typedef void (*EnDogActionFunc)(struct EnDog*, PlayState*); typedef struct EnDog { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 0837c640f1..870da97a69 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -18,19 +18,19 @@ #define DOOR_CHECK_RANGE 40.0f -void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDoor_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDoor_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDoor_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDoor_Init(Actor* thisx, PlayState* play); +void EnDoor_Destroy(Actor* thisx, PlayState* play); +void EnDoor_Update(Actor* thisx, PlayState* play); +void EnDoor_Draw(Actor* thisx, PlayState* play); -void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_WaitForCheck(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_Check(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_AjarWait(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_AjarOpen(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_AjarClose(EnDoor* this, GlobalContext* globalCtx); -void EnDoor_Open(EnDoor* this, GlobalContext* globalCtx); +void EnDoor_SetupType(EnDoor* this, PlayState* play); +void EnDoor_Idle(EnDoor* this, PlayState* play); +void EnDoor_WaitForCheck(EnDoor* this, PlayState* play); +void EnDoor_Check(EnDoor* this, PlayState* play); +void EnDoor_AjarWait(EnDoor* this, PlayState* play); +void EnDoor_AjarOpen(EnDoor* this, PlayState* play); +void EnDoor_AjarClose(EnDoor* this, PlayState* play); +void EnDoor_Open(EnDoor* this, PlayState* play); const ActorInit En_Door_InitVars = { ACTOR_EN_DOOR, @@ -76,8 +76,8 @@ static Gfx* sDoorDLists[5][2] = { { gFieldDoor1DL, gFieldDoor2DL }, }; -void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnDoor_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnDoor* this = (EnDoor*)thisx; EnDoorInfo* objectInfo; s32 i; @@ -87,18 +87,18 @@ void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { objectInfo = &sDoorInfo[0]; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDoorSkel, &gDoor3Anim, this->jointTable, this->morphTable, 5); + SkelAnime_Init(play, &this->skelAnime, &gDoorSkel, &gDoor3Anim, this->jointTable, this->morphTable, 5); for (i = 0; i < ARRAY_COUNT(sDoorInfo) - 2; i++, objectInfo++) { - if (globalCtx->sceneNum == objectInfo->sceneNum) { + if (play->sceneNum == objectInfo->sceneNum) { break; } } - if (i >= ARRAY_COUNT(sDoorInfo) - 2 && Object_GetIndex(&globalCtx->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) >= 0) { + if (i >= ARRAY_COUNT(sDoorInfo) - 2 && Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) >= 0) { objectInfo++; } this->dListIndex = objectInfo->dListIndex; - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectInfo->objectId); + objBankIndex = Object_GetIndex(&play->objectCtx, objectInfo->objectId); if (objBankIndex < 0) { Actor_Kill(&this->actor); return; @@ -107,7 +107,7 @@ void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { this->requiredObjBankIndex = objBankIndex; this->dListIndex = objectInfo->dListIndex; if (this->actor.objBankIndex == this->requiredObjBankIndex) { - EnDoor_SetupType(this, globalCtx); + EnDoor_SetupType(this, play); } else { this->actionFunc = EnDoor_SetupType; } @@ -118,7 +118,7 @@ void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { xOffset = Math_CosS(this->actor.shape.rot.y) * 30.0f; zOffset = Math_SinS(this->actor.shape.rot.y) * 30.0f; - other = (EnDoor*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_DOOR, + other = (EnDoor*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DOOR, this->actor.world.pos.x + xOffset, this->actor.world.pos.y, this->actor.world.pos.z - zOffset, 0, this->actor.shape.rot.y + 0x8000, 0, this->actor.params & ~0x40); @@ -131,20 +131,20 @@ void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetFocus(&this->actor, 70.0f); } -void EnDoor_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDoor_Destroy(Actor* thisx, PlayState* play) { TransitionActorEntry* transitionEntry; EnDoor* this = (EnDoor*)thisx; - transitionEntry = &globalCtx->transiActorCtx.list[(u16)this->actor.params >> 0xA]; + transitionEntry = &play->transiActorCtx.list[(u16)this->actor.params >> 0xA]; if (transitionEntry->id < 0) { transitionEntry->id = -transitionEntry->id; } } -void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx) { +void EnDoor_SetupType(EnDoor* this, PlayState* play) { s32 doorType; - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { doorType = this->actor.params >> 7 & 7; this->actor.flags &= ~ACTOR_FLAG_4; this->actor.objBankIndex = this->requiredObjBankIndex; @@ -156,11 +156,11 @@ void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx) { } this->actor.world.rot.y = 0x0000; if (doorType == DOOR_LOCKED) { - if (!Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { + if (!Flags_GetSwitch(play, this->actor.params & 0x3F)) { this->lockTimer = 10; } } else if (doorType == DOOR_AJAR) { - if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor) > DOOR_AJAR_SLAM_RANGE) { + if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor) > DOOR_AJAR_SLAM_RANGE) { this->actionFunc = EnDoor_AjarWait; this->actor.world.rot.y = -0x1800; } @@ -182,8 +182,8 @@ void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx) { } } -void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDoor_Idle(EnDoor* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 doorType; Vec3f playerPosRelToDoor; s16 yawDiff; @@ -196,10 +196,10 @@ void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) { (player->stateFlags1 & PLAYER_STATE1_27) ? 0.75f : 1.5f); if (this->lockTimer != 0) { gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--; - Flags_SetSwitch(globalCtx, this->actor.params & 0x3F); + Flags_SetSwitch(play, this->actor.params & 0x3F); Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } - } else if (!Player_InCsMode(globalCtx)) { + } else if (!Player_InCsMode(play)) { if (fabsf(playerPosRelToDoor.y) < 20.0f && fabsf(playerPosRelToDoor.x) < 20.0f && fabsf(playerPosRelToDoor.z) < 50.0f) { yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; @@ -209,7 +209,7 @@ void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) { if (ABS(yawDiff) < 0x3000) { if (this->lockTimer != 0) { if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] <= 0) { - Player* player2 = GET_PLAYER(globalCtx); + Player* player2 = GET_PLAYER(play); player2->naviTextId = -0x203; return; @@ -227,27 +227,27 @@ void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) { } } -void EnDoor_WaitForCheck(EnDoor* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnDoor_WaitForCheck(EnDoor* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnDoor_Check; } else { - func_8002F2CC(&this->actor, globalCtx, DOOR_CHECK_RANGE); + func_8002F2CC(&this->actor, play, DOOR_CHECK_RANGE); } } -void EnDoor_Check(EnDoor* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnDoor_Check(EnDoor* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnDoor_WaitForCheck; } } -void EnDoor_AjarWait(EnDoor* this, GlobalContext* globalCtx) { +void EnDoor_AjarWait(EnDoor* this, PlayState* play) { if (this->actor.xzDistToPlayer < DOOR_AJAR_SLAM_RANGE) { this->actionFunc = EnDoor_AjarClose; } } -void EnDoor_AjarOpen(EnDoor* this, GlobalContext* globalCtx) { +void EnDoor_AjarOpen(EnDoor* this, PlayState* play) { if (this->actor.xzDistToPlayer < DOOR_AJAR_SLAM_RANGE) { this->actionFunc = EnDoor_AjarClose; } else if (Math_ScaledStepToS(&this->actor.world.rot.y, -0x1800, 0x100)) { @@ -255,13 +255,13 @@ void EnDoor_AjarOpen(EnDoor* this, GlobalContext* globalCtx) { } } -void EnDoor_AjarClose(EnDoor* this, GlobalContext* globalCtx) { +void EnDoor_AjarClose(EnDoor* this, PlayState* play) { if (Math_ScaledStepToS(&this->actor.world.rot.y, 0, 0x700)) { this->actionFunc = EnDoor_Idle; } } -void EnDoor_Open(EnDoor* this, GlobalContext* globalCtx) { +void EnDoor_Open(EnDoor* this, PlayState* play) { s32 i; s32 numEffects; @@ -270,34 +270,32 @@ void EnDoor_Open(EnDoor* this, GlobalContext* globalCtx) { this->actionFunc = EnDoor_Idle; this->playerIsOpening = 0; } else if (Animation_OnFrame(&this->skelAnime, sDoorAnimOpenFrames[this->animStyle])) { - Audio_PlayActorSound2(&this->actor, - (globalCtx->sceneNum == SCENE_HAKADAN || globalCtx->sceneNum == SCENE_HAKADANCH || - globalCtx->sceneNum == SCENE_HIDAN) - ? NA_SE_EV_IRON_DOOR_OPEN - : NA_SE_OC_DOOR_OPEN); + Audio_PlayActorSound2(&this->actor, (play->sceneNum == SCENE_HAKADAN || play->sceneNum == SCENE_HAKADANCH || + play->sceneNum == SCENE_HIDAN) + ? NA_SE_EV_IRON_DOOR_OPEN + : NA_SE_OC_DOOR_OPEN); if (this->skelAnime.playSpeed < 1.5f) { numEffects = (s32)(Rand_ZeroOne() * 30.0f) + 50; for (i = 0; i < numEffects; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 60.0f, 100.0f, 50.0f, 0.15f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 60.0f, 100.0f, 50.0f, 0.15f); } } } else if (Animation_OnFrame(&this->skelAnime, sDoorAnimCloseFrames[this->animStyle])) { - Audio_PlayActorSound2(&this->actor, - (globalCtx->sceneNum == SCENE_HAKADAN || globalCtx->sceneNum == SCENE_HAKADANCH || - globalCtx->sceneNum == SCENE_HIDAN) - ? NA_SE_EV_IRON_DOOR_CLOSE - : NA_SE_EV_DOOR_CLOSE); + Audio_PlayActorSound2(&this->actor, (play->sceneNum == SCENE_HAKADAN || play->sceneNum == SCENE_HAKADANCH || + play->sceneNum == SCENE_HIDAN) + ? NA_SE_EV_IRON_DOOR_CLOSE + : NA_SE_EV_DOOR_CLOSE); } } } -void EnDoor_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDoor_Update(Actor* thisx, PlayState* play) { EnDoor* this = (EnDoor*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnDoor_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnDoor_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 pad; TransitionActorEntry* transitionEntry; Gfx** doorDLists; @@ -308,12 +306,11 @@ s32 EnDoor_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList if (limbIndex == 4) { doorDLists = sDoorDLists[this->dListIndex]; - transitionEntry = &globalCtx->transiActorCtx.list[(u16)this->actor.params >> 0xA]; + transitionEntry = &play->transiActorCtx.list[(u16)this->actor.params >> 0xA]; rot->z += this->actor.world.rot.y; - if ((globalCtx->roomCtx.prevRoom.num >= 0) || - (transitionEntry->sides[0].room == transitionEntry->sides[1].room)) { + if ((play->roomCtx.prevRoom.num >= 0) || (transitionEntry->sides[0].room == transitionEntry->sides[1].room)) { rotDiff = ((this->actor.shape.rot.y + this->skelAnime.jointTable[3].z) + rot->z) - - Math_Vec3f_Yaw(&globalCtx->view.eye, &this->actor.world.pos); + Math_Vec3f_Yaw(&play->view.eye, &this->actor.world.pos); *dList = (ABS(rotDiff) < 0x4000) ? doorDLists[0] : doorDLists[1]; } else { doorDListIndex = this->unk_192; @@ -326,15 +323,15 @@ s32 EnDoor_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnDoor_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDoor_Draw(Actor* thisx, PlayState* play) { EnDoor* this = (EnDoor*)thisx; if (this->actor.objBankIndex == this->requiredObjBankIndex) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_door.c", 910); + OPEN_DISPS(play->state.gfxCtx, "../z_en_door.c", 910); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDoor_OverrideLimbDraw, - NULL, &this->actor); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDoor_OverrideLimbDraw, NULL, + &this->actor); if (this->actor.world.rot.y != 0) { if (1) {} if (this->actor.world.rot.y > 0) { @@ -344,9 +341,9 @@ void EnDoor_Draw(Actor* thisx, GlobalContext* globalCtx) { } } if (this->lockTimer != 0) { - Actor_DrawDoorLock(globalCtx, this->lockTimer, DOORLOCK_NORMAL); + Actor_DrawDoorLock(play, this->lockTimer, DOORLOCK_NORMAL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_door.c", 941); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_door.c", 941); } } diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.h b/src/overlays/actors/ovl_En_Door/z_en_door.h index 94909cb36e..b7e3d5d2f1 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.h +++ b/src/overlays/actors/ovl_En_Door/z_en_door.h @@ -41,7 +41,7 @@ typedef enum { struct EnDoor; -typedef void (*EnDoorActionFunc)(struct EnDoor*, GlobalContext*); +typedef void (*EnDoorActionFunc)(struct EnDoor*, PlayState*); typedef struct EnDoor { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index 2b5782c45a..a8050754fb 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnDs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDs_Init(Actor* thisx, PlayState* play); +void EnDs_Destroy(Actor* thisx, PlayState* play); +void EnDs_Update(Actor* thisx, PlayState* play); +void EnDs_Draw(Actor* thisx, PlayState* play); -void EnDs_Wait(EnDs* this, GlobalContext* globalCtx); +void EnDs_Wait(EnDs* this, PlayState* play); const ActorInit En_Ds_InitVars = { ACTOR_EN_DS, @@ -28,11 +28,11 @@ const ActorInit En_Ds_InitVars = { (ActorFunc)EnDs_Draw, }; -void EnDs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDs_Init(Actor* thisx, PlayState* play) { EnDs* this = (EnDs*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gPotionShopLadySkel, &gPotionShopLadyAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gPotionShopLadySkel, &gPotionShopLadyAnim, this->jointTable, this->morphTable, 6); Animation_PlayOnce(&this->skelAnime, &gPotionShopLadyAnim); @@ -47,36 +47,36 @@ void EnDs_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1E4 = 0.0f; } -void EnDs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDs_Destroy(Actor* thisx, PlayState* play) { } -void EnDs_Talk(EnDs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnDs_Talk(EnDs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnDs_Wait; this->actor.flags &= ~ACTOR_FLAG_16; } this->unk_1E8 |= 1; } -void EnDs_TalkNoEmptyBottle(EnDs* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnDs_TalkNoEmptyBottle(EnDs* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = EnDs_Wait; } this->unk_1E8 |= 1; } -void EnDs_TalkAfterGiveOddPotion(EnDs* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnDs_TalkAfterGiveOddPotion(EnDs* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnDs_Talk; } else { this->actor.flags |= ACTOR_FLAG_16; - func_8002F2CC(&this->actor, globalCtx, 1000.0f); + func_8002F2CC(&this->actor, play, 1000.0f); } } -void EnDs_DisplayOddPotionText(EnDs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnDs_DisplayOddPotionText(EnDs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.textId = 0x504F; this->actionFunc = EnDs_TalkAfterGiveOddPotion; this->actor.flags &= ~ACTOR_FLAG_8; @@ -84,47 +84,47 @@ void EnDs_DisplayOddPotionText(EnDs* this, GlobalContext* globalCtx) { } } -void EnDs_GiveOddPotion(EnDs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnDs_GiveOddPotion(EnDs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnDs_DisplayOddPotionText; gSaveContext.timer2State = 0; } else { - func_8002F434(&this->actor, globalCtx, GI_ODD_POTION, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_ODD_POTION, 10000.0f, 50.0f); } } -void EnDs_TalkAfterBrewOddPotion(EnDs* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnDs_TalkAfterBrewOddPotion(EnDs* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = EnDs_GiveOddPotion; - func_8002F434(&this->actor, globalCtx, GI_ODD_POTION, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_ODD_POTION, 10000.0f, 50.0f); } } -void EnDs_BrewOddPotion3(EnDs* this, GlobalContext* globalCtx) { +void EnDs_BrewOddPotion3(EnDs* this, PlayState* play) { if (this->brewTimer > 0) { this->brewTimer -= 1; } else { this->actionFunc = EnDs_TalkAfterBrewOddPotion; - Message_ContinueTextbox(globalCtx, 0x504D); + Message_ContinueTextbox(play, 0x504D); } Math_StepToF(&this->unk_1E4, 0, 0.03f); - Environment_AdjustLights(globalCtx, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f); + Environment_AdjustLights(play, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f); } -void EnDs_BrewOddPotion2(EnDs* this, GlobalContext* globalCtx) { +void EnDs_BrewOddPotion2(EnDs* this, PlayState* play) { if (this->brewTimer > 0) { this->brewTimer -= 1; } else { this->actionFunc = EnDs_BrewOddPotion3; this->brewTimer = 60; - Flags_UnsetSwitch(globalCtx, 0x3F); + Flags_UnsetSwitch(play, 0x3F); } } -void EnDs_BrewOddPotion1(EnDs* this, GlobalContext* globalCtx) { +void EnDs_BrewOddPotion1(EnDs* this, PlayState* play) { if (this->brewTimer > 0) { this->brewTimer -= 1; } else { @@ -133,23 +133,23 @@ void EnDs_BrewOddPotion1(EnDs* this, GlobalContext* globalCtx) { } Math_StepToF(&this->unk_1E4, 1.0f, 0.01f); - Environment_AdjustLights(globalCtx, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f); + Environment_AdjustLights(play, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f); } -void EnDs_OfferOddPotion(EnDs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDs_OfferOddPotion(EnDs* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes this->actionFunc = EnDs_BrewOddPotion1; this->brewTimer = 60; - Flags_SetSwitch(globalCtx, 0x3F); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + Flags_SetSwitch(play, 0x3F); + play->msgCtx.msgMode = MSGMODE_PAUSED; player->exchangeItemId = EXCH_ITEM_NONE; break; case 1: // no - Message_ContinueTextbox(globalCtx, 0x504C); + Message_ContinueTextbox(play, 0x504C); this->actionFunc = EnDs_Talk; } } @@ -165,48 +165,48 @@ s32 EnDs_CheckRupeesAndBottle() { } } -void EnDs_GiveBluePotion(EnDs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnDs_GiveBluePotion(EnDs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnDs_Talk; } else { - func_8002F434(&this->actor, globalCtx, GI_POTION_BLUE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_POTION_BLUE, 10000.0f, 50.0f); } } -void EnDs_OfferBluePotion(EnDs* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void EnDs_OfferBluePotion(EnDs* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes switch (EnDs_CheckRupeesAndBottle()) { case 0: // have less than 100 rupees - Message_ContinueTextbox(globalCtx, 0x500E); + Message_ContinueTextbox(play, 0x500E); break; case 1: // have 100 rupees but no empty bottle - Message_ContinueTextbox(globalCtx, 0x96); + Message_ContinueTextbox(play, 0x96); this->actionFunc = EnDs_TalkNoEmptyBottle; return; case 2: // have 100 rupees and empty bottle Rupees_ChangeBy(-100); this->actor.flags &= ~ACTOR_FLAG_16; - func_8002F434(&this->actor, globalCtx, GI_POTION_BLUE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_POTION_BLUE, 10000.0f, 50.0f); this->actionFunc = EnDs_GiveBluePotion; return; } break; case 1: // no - Message_ContinueTextbox(globalCtx, 0x500D); + Message_ContinueTextbox(play, 0x500D); } this->actionFunc = EnDs_Talk; } } -void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDs_Wait(EnDs* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - if (func_8002F368(globalCtx) == EXCH_ITEM_ODD_MUSHROOM) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { + if (func_8002F368(play) == EXCH_ITEM_ODD_MUSHROOM) { Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); player->actor.textId = 0x504A; @@ -227,23 +227,23 @@ void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) { this->actor.textId = 0x5048; if ((ABS(yawDiff) < 0x2151) && (this->actor.xzDistToPlayer < 200.0f)) { - func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_ODD_MUSHROOM); + func_8002F298(&this->actor, play, 100.0f, EXCH_ITEM_ODD_MUSHROOM); this->unk_1E8 |= 1; } } } -void EnDs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDs_Update(Actor* thisx, PlayState* play) { EnDs* this = (EnDs*)thisx; if (SkelAnime_Update(&this->skelAnime) != 0) { this->skelAnime.curFrame = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_1E8 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_1D8.x, 0, 6, 0x1838, 100); Math_SmoothStepToS(&this->unk_1D8.y, 0, 6, 0x1838, 100); @@ -252,7 +252,7 @@ void EnDs_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnDs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnDs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDs* this = (EnDs*)thisx; if (limbIndex == 5) { @@ -262,7 +262,7 @@ s32 EnDs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnDs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnDs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f sMultVec = { 1100.0f, 500.0f, 0.0f }; EnDs* this = (EnDs*)thisx; @@ -271,10 +271,10 @@ void EnDs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnDs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDs_Draw(Actor* thisx, PlayState* play) { EnDs* this = (EnDs*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDs_OverrideLimbDraw, EnDs_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.h b/src/overlays/actors/ovl_En_Ds/z_en_ds.h index 035332f48a..8f10ce8285 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.h +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.h @@ -6,7 +6,7 @@ struct EnDs; -typedef void (*EnDsActionFunc)(struct EnDs*, GlobalContext*); +typedef void (*EnDsActionFunc)(struct EnDs*, PlayState*); typedef struct EnDs { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index ece973e769..ae61f5595c 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -4,23 +4,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_25) -void EnDu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDu_Init(Actor* thisx, PlayState* play); +void EnDu_Destroy(Actor* thisx, PlayState* play); +void EnDu_Update(Actor* thisx, PlayState* play); +void EnDu_Draw(Actor* thisx, PlayState* play); -void func_809FE3B4(EnDu* this, GlobalContext* globalCtx); -void func_809FE3C0(EnDu* this, GlobalContext* globalCtx); -void func_809FE638(EnDu* this, GlobalContext* globalCtx); -void func_809FE890(EnDu* this, GlobalContext* globalCtx); -void func_809FE4A4(EnDu* this, GlobalContext* globalCtx); -void func_809FE6CC(EnDu* this, GlobalContext* globalCtx); -void func_809FE740(EnDu* this, GlobalContext* globalCtx); -void func_809FE798(EnDu* this, GlobalContext* globalCtx); -void func_809FEC14(EnDu* this, GlobalContext* globalCtx); -void func_809FEC70(EnDu* this, GlobalContext* globalCtx); -void func_809FECE4(EnDu* this, GlobalContext* globalCtx); -void func_809FEB08(EnDu* this, GlobalContext* globalCtx); +void func_809FE3B4(EnDu* this, PlayState* play); +void func_809FE3C0(EnDu* this, PlayState* play); +void func_809FE638(EnDu* this, PlayState* play); +void func_809FE890(EnDu* this, PlayState* play); +void func_809FE4A4(EnDu* this, PlayState* play); +void func_809FE6CC(EnDu* this, PlayState* play); +void func_809FE740(EnDu* this, PlayState* play); +void func_809FE798(EnDu* this, PlayState* play); +void func_809FEC14(EnDu* this, PlayState* play); +void func_809FEC70(EnDu* this, PlayState* play); +void func_809FECE4(EnDu* this, PlayState* play); +void func_809FEB08(EnDu* this, PlayState* play); const ActorInit En_Du_InitVars = { ACTOR_EN_DU, @@ -98,8 +98,8 @@ void EnDu_SetupAction(EnDu* this, EnDuActionFunc actionFunc) { this->actionFunc = actionFunc; } -u16 func_809FDC38(GlobalContext* globalCtx, Actor* actor) { - u16 reaction = Text_GetFaceReaction(globalCtx, 0x21); +u16 func_809FDC38(PlayState* play, Actor* actor) { + u16 reaction = Text_GetFaceReaction(play, 0x21); if (reaction != 0) { return reaction; @@ -118,8 +118,8 @@ u16 func_809FDC38(GlobalContext* globalCtx, Actor* actor) { } } -s16 func_809FDCDC(GlobalContext* globalCtx, Actor* actor) { - switch (Message_GetState(&globalCtx->msgCtx)) { +s16 func_809FDCDC(PlayState* play, Actor* actor) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: break; @@ -141,7 +141,7 @@ s16 func_809FDCDC(GlobalContext* globalCtx, Actor* actor) { case TEXT_STATE_EVENT: break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { return 3; } break; @@ -153,17 +153,17 @@ s16 func_809FDCDC(GlobalContext* globalCtx, Actor* actor) { return 1; } -s32 func_809FDDB4(EnDu* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT18 && LINK_IS_CHILD) { +s32 func_809FDDB4(EnDu* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT18 && LINK_IS_CHILD) { return 1; - } else if (globalCtx->sceneNum == SCENE_HIDAN && !GET_INFTABLE(INFTABLE_11A) && LINK_IS_ADULT) { + } else if (play->sceneNum == SCENE_HIDAN && !GET_INFTABLE(INFTABLE_11A) && LINK_IS_ADULT) { return 1; } return 0; } -void func_809FDE24(EnDu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809FDE24(EnDu* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3 = 0; if (this->unk_1F4.unk_00 == 0) { @@ -276,16 +276,16 @@ void func_809FE104(EnDu* this) { } } -void EnDu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDu_Init(Actor* thisx, PlayState* play) { EnDu* this = (EnDu*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDaruniaSkel, NULL, 0, 0, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gDaruniaSkel, NULL, 0, 0, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); - if (func_809FDDB4(this, globalCtx) == 0) { + if (func_809FDDB4(this, play) == 0) { Actor_Kill(&this->actor); return; } @@ -295,10 +295,10 @@ void EnDu_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1F4.unk_00 = 0; if (gSaveContext.cutsceneIndex >= 0xFFF0) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDarunia01Cs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDarunia01Cs); gSaveContext.cutsceneTrigger = 1; EnDu_SetupAction(this, func_809FE890); - } else if (globalCtx->sceneNum == 4) { + } else if (play->sceneNum == 4) { EnDu_SetupAction(this, func_809FE638); } else if (!LINK_IS_ADULT) { EnDu_SetupAction(this, func_809FE3C0); @@ -307,28 +307,28 @@ void EnDu_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDu_Destroy(Actor* thisx, PlayState* play) { EnDu* this = (EnDu*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void func_809FE3B4(EnDu* this, GlobalContext* globalCtx) { +void func_809FE3B4(EnDu* this, PlayState* play) { } -void func_809FE3C0(EnDu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809FE3C0(EnDu* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags2 & PLAYER_STATE2_24) { - func_8010BD88(globalCtx, OCARINA_ACTION_CHECK_SARIA); + func_8010BD88(play, OCARINA_ACTION_CHECK_SARIA); player->stateFlags2 |= PLAYER_STATE2_25; player->unk_6A8 = &this->actor; EnDu_SetupAction(this, func_809FE4A4); return; } if (this->unk_1F4.unk_00 == 2) { - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); this->unk_1F4.unk_00 = 0; } if (this->actor.xzDistToPlayer < 116.0f + this->collider.dim.radius) { @@ -336,36 +336,36 @@ void func_809FE3C0(EnDu* this, GlobalContext* globalCtx) { } } -void func_809FE4A4(EnDu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809FE4A4(EnDu* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + play->msgCtx.ocarinaMode = OCARINA_MODE_00; EnDu_SetupAction(this, func_809FE3C0); - } else if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_06) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDaruniaWrongCs); + } else if (play->msgCtx.ocarinaMode >= OCARINA_MODE_06) { + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDaruniaWrongCs); gSaveContext.cutsceneTrigger = 1; this->unk_1E8 = 1; EnDu_SetupAction(this, func_809FE890); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDaruniaCorrectCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDaruniaCorrectCs); gSaveContext.cutsceneTrigger = 1; this->unk_1E8 = 0; EnDu_SetupAction(this, func_809FE890); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { player->stateFlags2 |= PLAYER_STATE2_23; } } -void func_809FE638(EnDu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809FE638(EnDu* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & PLAYER_STATE1_29)) { - OnePointCutscene_Init(globalCtx, 3330, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3330, -99, &this->actor, CAM_ID_MAIN); player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.world.rot.y + 0x7FFF; Audio_PlayFanfare(NA_BGM_APPEAR); EnDu_SetupAction(this, func_809FE6CC); @@ -373,24 +373,24 @@ void func_809FE638(EnDu* this, GlobalContext* globalCtx) { } } -void func_809FE6CC(EnDu* this, GlobalContext* globalCtx) { +void func_809FE6CC(EnDu* this, PlayState* play) { if (DECR(this->unk_1E2) == 0) { this->actor.textId = 0x3039; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_1F4.unk_00 = 1; EnDu_SetupAction(this, func_809FE740); } } -void func_809FE740(EnDu* this, GlobalContext* globalCtx) { +void func_809FE740(EnDu* this, PlayState* play) { if (this->unk_1F4.unk_00 == 0) { - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); this->unk_1E2 = 0x5A; EnDu_SetupAction(this, func_809FE798); } } -void func_809FE798(EnDu* this, GlobalContext* globalCtx) { +void func_809FE798(EnDu* this, PlayState* play) { if (DECR(this->unk_1E2) != 0) { switch (this->unk_1E2) { case 0x50: @@ -415,19 +415,19 @@ void func_809FE798(EnDu* this, GlobalContext* globalCtx) { } } -void func_809FE890(EnDu* this, GlobalContext* globalCtx) { +void func_809FE890(EnDu* this, PlayState* play) { f32 frame; Vec3f startPos; Vec3f endPos; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; CsCmdActorAction* csAction; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { - func_8002DF54(globalCtx, &this->actor, 1); + if (play->csCtx.state == CS_STATE_IDLE) { + func_8002DF54(play, &this->actor, 1); EnDu_SetupAction(this, func_809FEB08); return; } - csAction = globalCtx->csCtx.npcActions[2]; + csAction = play->csCtx.npcActions[2]; if (csAction != NULL) { func_809FDFC0(csAction, &startPos); @@ -469,7 +469,7 @@ void func_809FE890(EnDu* this, GlobalContext* globalCtx) { this->actor.shape.rot.z = csAction->urot.z; this->actor.velocity = velocity; - if (globalCtx->csCtx.frames < csAction->endFrame) { + if (play->csCtx.frames < csAction->endFrame) { frame = csAction->endFrame - csAction->startFrame; this->actor.velocity.x = (endPos.x - startPos.x) / frame; @@ -483,14 +483,14 @@ void func_809FE890(EnDu* this, GlobalContext* globalCtx) { } } -void func_809FEB08(EnDu* this, GlobalContext* globalCtx) { +void func_809FEB08(EnDu* this, PlayState* play) { this->blinkTimer = 11; this->unk_1EC = 0; this->unk_1ED = 0; this->unk_1EE = 0; if (this->unk_1E8 == 1) { - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_1); EnDu_SetupAction(this, func_809FE3C0); return; @@ -502,43 +502,43 @@ void func_809FEB08(EnDu* this, GlobalContext* globalCtx) { this->actor.textId = 0x301F; EnDu_SetupAction(this, func_809FE3C0); } - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_14); this->unk_1F4.unk_00 = 1; } -void func_809FEC14(EnDu* this, GlobalContext* globalCtx) { +void func_809FEC14(EnDu* this, PlayState* play) { if (this->unk_1F4.unk_00 == 2) { - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); EnDu_SetupAction(this, func_809FEC70); - func_809FEC70(this, globalCtx); + func_809FEC70(this, play); } } -void func_809FEC70(EnDu* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809FEC70(EnDu* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; EnDu_SetupAction(this, func_809FECE4); } else { f32 xzRange = this->actor.xzDistToPlayer + 1.0f; - func_8002F434(&this->actor, globalCtx, GI_BRACELET, xzRange, fabsf(this->actor.yDistToPlayer) + 1.0f); + func_8002F434(&this->actor, play, GI_BRACELET, xzRange, fabsf(this->actor.yDistToPlayer) + 1.0f); } } -void func_809FECE4(EnDu* this, GlobalContext* globalCtx) { +void func_809FECE4(EnDu* this, PlayState* play) { if (this->unk_1F4.unk_00 == 3) { this->unk_1F4.unk_00 = 0; EnDu_SetupAction(this, func_809FE3C0); } } -void EnDu_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDu_Update(Actor* thisx, PlayState* play) { EnDu* this = (EnDu*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->skelAnime.animation == &gDaruniaDancingEndAnim && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -547,7 +547,7 @@ void EnDu_Update(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); func_809FDE9C(this); - func_809FDE24(this, globalCtx); + func_809FDE24(this, play); if (this->actionFunc == func_809FE890) { this->actor.world.pos.x += this->actor.velocity.x; @@ -557,17 +557,16 @@ void EnDu_Update(Actor* thisx, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (this->actionFunc != func_809FE4A4) { - func_800343CC(globalCtx, &this->actor, &this->unk_1F4.unk_00, this->collider.dim.radius + 116.0f, func_809FDC38, + func_800343CC(play, &this->actor, &this->unk_1F4.unk_00, this->collider.dim.radius + 116.0f, func_809FDC38, func_809FDCDC); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnDu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { +s32 EnDu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnDu* this = (EnDu*)thisx; Vec3s sp1C; @@ -586,7 +585,7 @@ s32 EnDu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnDu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnDu_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnDu* this = (EnDu*)thisx; Vec3f D_809FF40C = { 0.0f, -1000.0f, 0.0f }; @@ -595,7 +594,7 @@ void EnDu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnDu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDu_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gDaruniaEyeOpenTex, gDaruniaEyeOpeningTex, @@ -614,13 +613,13 @@ void EnDu_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnDu* this = (EnDu*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_du.c", 1470); + OPEN_DISPS(play->state.gfxCtx, "../z_en_du.c", 1470); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(noseTextures[this->noseTexIndex])); - func_80034BA0(globalCtx, &this->skelAnime, EnDu_OverrideLimbDraw, EnDu_PostLimbDraw, &this->actor, 255); + func_80034BA0(play, &this->skelAnime, EnDu_OverrideLimbDraw, EnDu_PostLimbDraw, &this->actor, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_du.c", 1487); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_du.c", 1487); } diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.h b/src/overlays/actors/ovl_En_Du/z_en_du.h index b5045b5ab2..c7a3ec69c9 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.h +++ b/src/overlays/actors/ovl_En_Du/z_en_du.h @@ -6,7 +6,7 @@ struct EnDu; -typedef void (*EnDuActionFunc)(struct EnDu*, GlobalContext*); +typedef void (*EnDuActionFunc)(struct EnDu*, PlayState*); typedef struct EnDu { /* 0x0000 */ Actor actor; 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 de6e1f5953..f697182fa2 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 @@ -10,13 +10,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnDyExtra_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDyExtra_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDyExtra_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); -void EnDyExtra_FallAndKill(EnDyExtra* this, GlobalContext* globalCtx); +void EnDyExtra_WaitForTrigger(EnDyExtra* this, PlayState* play); +void EnDyExtra_FallAndKill(EnDyExtra* this, PlayState* play); const ActorInit En_Dy_Extra_InitVars = { ACTOR_EN_DY_EXTRA, @@ -30,10 +30,10 @@ const ActorInit En_Dy_Extra_InitVars = { (ActorFunc)EnDyExtra_Draw, }; -void EnDyExtra_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDyExtra_Destroy(Actor* thisx, PlayState* play) { } -void EnDyExtra_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDyExtra_Init(Actor* thisx, PlayState* play) { EnDyExtra* this = (EnDyExtra*)thisx; osSyncPrintf("\n\n"); @@ -50,7 +50,7 @@ void EnDyExtra_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnDyExtra_WaitForTrigger; } -void EnDyExtra_WaitForTrigger(EnDyExtra* this, GlobalContext* globalCtx) { +void EnDyExtra_WaitForTrigger(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; @@ -61,7 +61,7 @@ void EnDyExtra_WaitForTrigger(EnDyExtra* this, GlobalContext* globalCtx) { } } -void EnDyExtra_FallAndKill(EnDyExtra* this, GlobalContext* globalCtx) { +void EnDyExtra_FallAndKill(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); if (this->timer == 0 || this->unk_158 < 0.02f) { Actor_Kill(&this->actor); @@ -73,7 +73,7 @@ void EnDyExtra_FallAndKill(EnDyExtra* this, GlobalContext* globalCtx) { } } -void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDyExtra_Update(Actor* thisx, PlayState* play) { EnDyExtra* this = (EnDyExtra*)thisx; if (this->timer != 0) { @@ -83,18 +83,18 @@ void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.scale.y = this->scale.y; this->actor.scale.z = this->scale.z; Audio_PlayActorSound2(&this->actor, NA_SE_PL_SPIRAL_HEAL_BEAM - SFX_FLAG); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); } -void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) { +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 }; EnDyExtra* this = (EnDyExtra*)thisx; s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; Vtx* vertices = SEGMENTED_TO_VIRTUAL(gGreatFairySpiralBeamVtx); s32 i; u8 unk[3]; @@ -111,12 +111,12 @@ void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(gfxCtx, "../z_en_dy_extra.c", 294); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames * 2, 0, 0x20, 0x40, 1, - globalCtx->state.frames, globalCtx->state.frames * -8, 0x10, 0x10)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->state.frames * 2, 0, 0x20, 0x40, 1, play->state.frames, + play->state.frames * -8, 0x10, 0x10)); gDPPipeSync(POLY_XLU_DISP++); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dy_extra.c", 307), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dy_extra.c", 307), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColors[this->type].r, primColors[this->type].g, primColors[this->type].b, 255); 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 4cb282ac61..0a6ce3c3a8 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 @@ -6,7 +6,7 @@ struct EnDyExtra; -typedef void (*EnDyExtraActionFunc)(struct EnDyExtra*, GlobalContext*); +typedef void (*EnDyExtraActionFunc)(struct EnDyExtra*, PlayState*); typedef struct EnDyExtra { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Eg/z_en_eg.c b/src/overlays/actors/ovl_En_Eg/z_en_eg.c index 6ba2ba7d74..2cc4be65f1 100644 --- a/src/overlays/actors/ovl_En_Eg/z_en_eg.c +++ b/src/overlays/actors/ovl_En_Eg/z_en_eg.c @@ -9,12 +9,12 @@ #define FLAGS ACTOR_FLAG_4 -void EnEg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEg_Init(Actor* thisx, PlayState* play); +void EnEg_Destroy(Actor* thisx, PlayState* play); +void EnEg_Update(Actor* thisx, PlayState* play); +void EnEg_Draw(Actor* thisx, PlayState* play); -void func_809FFDC8(EnEg* this, GlobalContext* globalCtx); +void func_809FFDC8(EnEg* this, PlayState* play); static s32 voided = false; @@ -38,28 +38,28 @@ void EnEg_PlayVoidOutSFX() { func_800788CC(NA_SE_OC_ABYSS); } -void EnEg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnEg_Destroy(Actor* thisx, PlayState* play) { } -void EnEg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEg_Init(Actor* thisx, PlayState* play) { EnEg* this = (EnEg*)thisx; this->action = 0; } -void func_809FFDC8(EnEg* this, GlobalContext* globalCtx) { - if (!voided && (gSaveContext.timer2Value < 1) && Flags_GetSwitch(globalCtx, 0x36) && (kREG(0) == 0)) { +void func_809FFDC8(EnEg* this, PlayState* play) { + if (!voided && (gSaveContext.timer2Value < 1) && Flags_GetSwitch(play, 0x36) && (kREG(0) == 0)) { // Void the player out - Play_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); gSaveContext.respawnFlag = -2; Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP); - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; EnEg_PlayVoidOutSFX(); voided = true; } } -void EnEg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEg_Update(Actor* thisx, PlayState* play) { EnEg* this = (EnEg*)thisx; s32 action = this->action; @@ -67,9 +67,9 @@ void EnEg_Update(Actor* thisx, GlobalContext* globalCtx) { // "Main Mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sActionFuncs[action](this, globalCtx); + sActionFuncs[action](this, play); } } -void EnEg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEg_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Eg/z_en_eg.h b/src/overlays/actors/ovl_En_Eg/z_en_eg.h index 86b3898ced..ad02d8a6b7 100644 --- a/src/overlays/actors/ovl_En_Eg/z_en_eg.h +++ b/src/overlays/actors/ovl_En_Eg/z_en_eg.h @@ -6,7 +6,7 @@ struct EnEg; -typedef void (*EnEgActionFunc)(struct EnEg*, GlobalContext*); +typedef void (*EnEgActionFunc)(struct EnEg*, PlayState*); typedef struct EnEg { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c index 85af0043aa..ced17f9e01 100644 --- a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c +++ b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c @@ -3,37 +3,37 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnEiyer_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEiyer_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEiyer_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEiyer_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEiyer_Init(Actor* thisx, PlayState* play); +void EnEiyer_Destroy(Actor* thisx, PlayState* play); +void EnEiyer_Update(Actor* thisx, PlayState* play); +void EnEiyer_Draw(Actor* thisx, PlayState* play); void EnEiyer_SetupAppearFromGround(EnEiyer* this); void EnEiyer_SetupUnderground(EnEiyer* this); void EnEiyer_SetupInactive(EnEiyer* this); -void EnEiyer_SetupAmbush(EnEiyer* this, GlobalContext* globalCtx); +void EnEiyer_SetupAmbush(EnEiyer* this, PlayState* play); void EnEiyer_SetupGlide(EnEiyer* this); void EnEiyer_SetupStartAttack(EnEiyer* this); -void EnEiyer_SetupDiveAttack(EnEiyer* this, GlobalContext* globalCtx); +void EnEiyer_SetupDiveAttack(EnEiyer* this, PlayState* play); void EnEiyer_SetupLand(EnEiyer* this); void EnEiyer_SetupHurt(EnEiyer* this); void EnEiyer_SetupDie(EnEiyer* this); void EnEiyer_SetupDead(EnEiyer* this); void EnEiyer_SetupStunned(EnEiyer* this); -void EnEiyer_AppearFromGround(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_WanderUnderground(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_CircleUnderground(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Inactive(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Ambush(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Glide(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_StartAttack(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_DiveAttack(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Land(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Hurt(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Die(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Dead(EnEiyer* this, GlobalContext* globalCtx); -void EnEiyer_Stunned(EnEiyer* this, GlobalContext* globalCtx); +void EnEiyer_AppearFromGround(EnEiyer* this, PlayState* play); +void EnEiyer_WanderUnderground(EnEiyer* this, PlayState* play); +void EnEiyer_CircleUnderground(EnEiyer* this, PlayState* play); +void EnEiyer_Inactive(EnEiyer* this, PlayState* play); +void EnEiyer_Ambush(EnEiyer* this, PlayState* play); +void EnEiyer_Glide(EnEiyer* this, PlayState* play); +void EnEiyer_StartAttack(EnEiyer* this, PlayState* play); +void EnEiyer_DiveAttack(EnEiyer* this, PlayState* play); +void EnEiyer_Land(EnEiyer* this, PlayState* play); +void EnEiyer_Hurt(EnEiyer* this, PlayState* play); +void EnEiyer_Die(EnEiyer* this, PlayState* play); +void EnEiyer_Dead(EnEiyer* this, PlayState* play); +void EnEiyer_Stunned(EnEiyer* this, PlayState* play); const ActorInit En_Eiyer_InitVars = { ACTOR_EN_EIYER, @@ -115,21 +115,20 @@ static InitChainEntry sInitChain[] = { * params 1-3: Clone, spawn another clone for the main Eiyer if params < 3 * params 10: Normal Eiyer, wander around spawn point */ -void EnEiyer_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEiyer_Init(Actor* thisx, PlayState* play) { EnEiyer* this = (EnEiyer*)thisx; s32 pad; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 600.0f, ActorShadow_DrawCircle, 65.0f); - SkelAnime_Init(globalCtx, &this->skelanime, &gStingerSkel, &gStingerIdleAnim, this->jointTable, this->morphTable, - 19); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sColCylInit); + SkelAnime_Init(play, &this->skelanime, &gStingerSkel, &gStingerIdleAnim, this->jointTable, this->morphTable, 19); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sColCylInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (this->actor.params < 3) { // Each clone spawns another clone - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EIYER, this->actor.home.pos.x, + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EIYER, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, this->actor.shape.rot.y + 0x4000, 0, this->actor.params + 1) == NULL) { Actor_Kill(&this->actor); @@ -167,9 +166,9 @@ void EnEiyer_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnEiyer_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnEiyer_Destroy(Actor* thisx, PlayState* play) { EnEiyer* this = (EnEiyer*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnEiyer_RotateAroundHome(EnEiyer* this) { @@ -226,7 +225,7 @@ void EnEiyer_SetupInactive(EnEiyer* this) { this->actionFunc = EnEiyer_Inactive; } -void EnEiyer_SetupAmbush(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_SetupAmbush(EnEiyer* this, PlayState* play) { this->actor.speedXZ = 0.0f; Animation_PlayOnce(&this->skelanime, &gStingerBackflipAnim); this->collider.info.bumper.dmgFlags = ~0x00300000; @@ -237,7 +236,7 @@ void EnEiyer_SetupAmbush(EnEiyer* this, GlobalContext* globalCtx) { this->actor.shape.shadowScale = 65.0f; this->actor.shape.yOffset = 600.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_JUMP); - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 700); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 700); this->actionFunc = EnEiyer_Ambush; } @@ -253,8 +252,8 @@ void EnEiyer_SetupStartAttack(EnEiyer* this) { this->actionFunc = EnEiyer_StartAttack; } -void EnEiyer_SetupDiveAttack(EnEiyer* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEiyer_SetupDiveAttack(EnEiyer* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.velocity.y = 0.0f; this->basePos.y = player->actor.world.pos.y + 15.0f; @@ -324,7 +323,7 @@ void EnEiyer_SetupStunned(EnEiyer* this) { this->actionFunc = EnEiyer_Stunned; } -void EnEiyer_AppearFromGround(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_AppearFromGround(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.75f)) { @@ -332,18 +331,18 @@ void EnEiyer_AppearFromGround(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_CheckPlayerCollision(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_CheckPlayerCollision(EnEiyer* this, PlayState* play) { if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; - EnEiyer_SetupAmbush(this, globalCtx); + EnEiyer_SetupAmbush(this, play); } } -void EnEiyer_CircleUnderground(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_CircleUnderground(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); this->actor.world.rot.y += -0x60; EnEiyer_RotateAroundHome(this); - EnEiyer_CheckPlayerCollision(this, globalCtx); + EnEiyer_CheckPlayerCollision(this, play); // Clones disappear when the main Eiyer leaves the ground if (this->actor.params != 0 && ((EnEiyer*)this->actor.parent)->actionFunc != EnEiyer_CircleUnderground) { @@ -351,7 +350,7 @@ void EnEiyer_CircleUnderground(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_WanderUnderground(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_WanderUnderground(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 100.0f) { @@ -362,10 +361,10 @@ void EnEiyer_WanderUnderground(EnEiyer* this, GlobalContext* globalCtx) { } Math_ScaledStepToS(&this->actor.world.rot.y, this->targetYaw, 0xB6); - EnEiyer_CheckPlayerCollision(this, globalCtx); + EnEiyer_CheckPlayerCollision(this, play); } -void EnEiyer_Inactive(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Inactive(EnEiyer* this, PlayState* play) { EnEiyer* parent; if (this->actor.home.pos.y - 50.0f < this->actor.world.pos.y) { @@ -380,7 +379,7 @@ void EnEiyer_Inactive(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_Ambush(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Ambush(EnEiyer* this, PlayState* play) { s32 animFinished; f32 curFrame; f32 xzOffset; @@ -403,12 +402,12 @@ void EnEiyer_Ambush(EnEiyer* this, GlobalContext* globalCtx) { this->collider.base.acFlags |= AC_ON; EnEiyer_SetupGlide(this); } else { - this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, + this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); } } -void EnEiyer_Glide(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Glide(EnEiyer* this, PlayState* play) { f32 curFrame; s32 pad; s16 yawChange; @@ -449,8 +448,8 @@ void EnEiyer_Glide(EnEiyer* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_EIER_FLY - SFX_FLAG); } -void EnEiyer_StartAttack(EnEiyer* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEiyer_StartAttack(EnEiyer* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f focus; SkelAnime_Update(&this->skelanime); @@ -461,7 +460,7 @@ void EnEiyer_StartAttack(EnEiyer* this, GlobalContext* globalCtx) { focus.z = player->actor.world.pos.z; if (Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &focus), 0x1000)) { - EnEiyer_SetupDiveAttack(this, globalCtx); + EnEiyer_SetupDiveAttack(this, play); } } else { this->actor.shape.rot.x -= 0x1000; @@ -473,7 +472,7 @@ void EnEiyer_StartAttack(EnEiyer* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_EIER_FLY - SFX_FLAG); } -void EnEiyer_DiveAttack(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_DiveAttack(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); this->actor.speedXZ *= 1.1f; @@ -488,7 +487,7 @@ void EnEiyer_DiveAttack(EnEiyer* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_EIER_FLY - SFX_FLAG); } -void EnEiyer_Land(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Land(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ScaledStepToS(&this->actor.world.rot.x, -0x4000, 0x450); Math_StepToF(&this->actor.speedXZ, 7.0f, 1.0f); @@ -496,10 +495,10 @@ void EnEiyer_Land(EnEiyer* this, GlobalContext* globalCtx) { if (this->timer == -1) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->timer = 10; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_SINK); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_SINK); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 700); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 700); } } } else { @@ -515,7 +514,7 @@ void EnEiyer_Land(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_Hurt(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Hurt(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->timer != 0) { @@ -544,7 +543,7 @@ void EnEiyer_Hurt(EnEiyer* this, GlobalContext* globalCtx) { this->actor.world.rot.x = -this->actor.shape.rot.x; } -void EnEiyer_Die(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Die(EnEiyer* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actor.speedXZ > 0.0f) { @@ -566,17 +565,17 @@ void EnEiyer_Die(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_Dead(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Dead(EnEiyer* this, PlayState* play) { this->actor.shape.shadowAlpha = CLAMP_MIN((s16)(this->actor.shape.shadowAlpha - 5), 0); this->actor.world.pos.y -= 2.0f; if (this->actor.shape.shadowAlpha == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 80); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 80); Actor_Kill(&this->actor); } } -void EnEiyer_Stunned(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_Stunned(EnEiyer* this, PlayState* play) { if (this->timer != 0) { this->timer--; } @@ -600,14 +599,14 @@ void EnEiyer_Stunned(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_UpdateDamage(EnEiyer* this, GlobalContext* globalCtx) { +void EnEiyer_UpdateDamage(EnEiyer* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, true); if (this->actor.colChkInfo.damageEffect != 0 || this->actor.colChkInfo.damage != 0) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_EIER_DEAD); this->actor.flags &= ~ACTOR_FLAG_0; } @@ -615,7 +614,7 @@ void EnEiyer_UpdateDamage(EnEiyer* this, GlobalContext* globalCtx) { // If underground, one hit kill if (this->collider.info.bumper.dmgFlags == 0x19) { if (this->actor.colChkInfo.damage == 0) { - EnEiyer_SetupAmbush(this, globalCtx); + EnEiyer_SetupAmbush(this, play); } else { EnEiyer_SetupDie(this); } @@ -634,12 +633,12 @@ void EnEiyer_UpdateDamage(EnEiyer* this, GlobalContext* globalCtx) { } } -void EnEiyer_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEiyer_Update(Actor* thisx, PlayState* play) { EnEiyer* this = (EnEiyer*)thisx; s32 pad; - EnEiyer_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnEiyer_UpdateDamage(this, play); + this->actionFunc(this, play); if (this->actor.world.rot.x == 0 || this->actionFunc == EnEiyer_Stunned) { Actor_MoveForward(&this->actor); @@ -650,7 +649,7 @@ void EnEiyer_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actionFunc == EnEiyer_Glide || this->actionFunc == EnEiyer_DiveAttack || this->actionFunc == EnEiyer_Stunned || this->actionFunc == EnEiyer_Die || this->actionFunc == EnEiyer_Hurt || (this->actionFunc == EnEiyer_Land && this->timer == -1)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 27.0f, 30.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 27.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); } @@ -663,13 +662,13 @@ void EnEiyer_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == 0 || this->actor.params == 0xA) { Collider_UpdateCylinder(&this->actor, &this->collider); if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnEiyer_Ambush) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -680,7 +679,7 @@ void EnEiyer_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnEiyer_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnEiyer_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnEiyer* this = (EnEiyer*)thisx; @@ -694,25 +693,25 @@ s32 EnEiyer_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return 0; } -void EnEiyer_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEiyer_Draw(Actor* thisx, PlayState* play) { EnEiyer* this = (EnEiyer*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_eiyer.c", 1494); + OPEN_DISPS(play->state.gfxCtx, "../z_en_eiyer.c", 1494); if (this->actionFunc != EnEiyer_Dead) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelanime.skeleton, this->skelanime.jointTable, EnEiyer_OverrideLimbDraw, NULL, this, POLY_OPA_DISP); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, D_80116280); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->actor.shape.shadowAlpha); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelanime.skeleton, this->skelanime.jointTable, EnEiyer_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_eiyer.c", 1541); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_eiyer.c", 1541); } diff --git a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h index fbd1529969..7f756596aa 100644 --- a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h +++ b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h @@ -6,7 +6,7 @@ struct EnEiyer; -typedef void (*EnEiyerActionFunc)(struct EnEiyer*, GlobalContext*); +typedef void (*EnEiyerActionFunc)(struct EnEiyer*, PlayState*); typedef struct EnEiyer { /* 0x0000 */ Actor actor; 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 1225a0e3e5..180dd766db 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -12,47 +12,47 @@ #define FAIRY_FLAG_TIMED (1 << 8) #define FAIRY_FLAG_BIG (1 << 9) -void EnElf_Init(Actor* thisx, GlobalContext* globalCtx); -void EnElf_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnElf_Update(Actor* thisx, GlobalContext* globalCtx); -void EnElf_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80A053F0(Actor* thisx, GlobalContext* globalCtx); -void func_80A052F4(Actor* thisx, GlobalContext* globalCtx); -void func_80A05208(Actor* thisx, GlobalContext* globalCtx); -void func_80A05188(Actor* thisx, GlobalContext* globalCtx); -void func_80A05114(Actor* thisx, GlobalContext* globalCtx); -void func_80A05040(Actor* thisx, GlobalContext* globalCtx); +void EnElf_Init(Actor* thisx, PlayState* play); +void EnElf_Destroy(Actor* thisx, PlayState* play); +void EnElf_Update(Actor* thisx, PlayState* play); +void EnElf_Draw(Actor* thisx, PlayState* play); +void func_80A053F0(Actor* thisx, PlayState* play); +void func_80A052F4(Actor* thisx, PlayState* play); +void func_80A05208(Actor* thisx, PlayState* play); +void func_80A05188(Actor* thisx, PlayState* play); +void func_80A05114(Actor* thisx, PlayState* play); +void func_80A05040(Actor* thisx, PlayState* play); // Navi -void func_80A03CF8(EnElf* this, GlobalContext* globalCtx); +void func_80A03CF8(EnElf* this, PlayState* play); // Healing Fairies -void func_80A0329C(EnElf* this, GlobalContext* globalCtx); -void func_80A03610(EnElf* this, GlobalContext* globalCtx); +void func_80A0329C(EnElf* this, PlayState* play); +void func_80A03610(EnElf* this, PlayState* play); // Healing Fairies Revive From Death -void func_80A03990(EnElf* this, GlobalContext* globalCtx); -void func_80A03814(EnElf* this, GlobalContext* globalCtx); +void func_80A03990(EnElf* this, PlayState* play); +void func_80A03814(EnElf* this, PlayState* play); // Kokiri Fairies -void func_80A0353C(EnElf* this, GlobalContext* globalCtx); +void func_80A0353C(EnElf* this, PlayState* play); // Fairy Spawner -void func_80A03604(EnElf* this, GlobalContext* globalCtx); +void func_80A03604(EnElf* this, PlayState* play); // Move(?) functions -void func_80A0214C(EnElf* this, GlobalContext* globalCtx); -void func_80A02AA4(EnElf* this, GlobalContext* globalCtx); -void func_80A02A20(EnElf* this, GlobalContext* globalCtx); -void func_80A02B38(EnElf* this, GlobalContext* globalCtx); -void func_80A020A4(EnElf* this, GlobalContext* globalCtx); -void func_80A01FE0(EnElf* this, GlobalContext* globalCtx); +void func_80A0214C(EnElf* this, PlayState* play); +void func_80A02AA4(EnElf* this, PlayState* play); +void func_80A02A20(EnElf* this, PlayState* play); +void func_80A02B38(EnElf* this, PlayState* play); +void func_80A020A4(EnElf* this, PlayState* play); +void func_80A01FE0(EnElf* this, PlayState* play); // misc -void func_80A04414(EnElf* this, GlobalContext* globalCtx); -void func_80A0461C(EnElf* this, GlobalContext* globalCtx); -void EnElf_SpawnSparkles(EnElf* this, GlobalContext* globalCtx, s32 sparkleLife); -void EnElf_GetCutsceneNextPos(Vec3f* vec, GlobalContext* globalCtx, s32 action); +void func_80A04414(EnElf* this, PlayState* play); +void func_80A0461C(EnElf* this, PlayState* play); +void EnElf_SpawnSparkles(EnElf* this, PlayState* play, s32 sparkleLife); +void EnElf_GetCutsceneNextPos(Vec3f* vec, PlayState* play, s32 action); const ActorInit En_Elf_InitVars = { ACTOR_EN_ELF, @@ -208,8 +208,8 @@ s32 func_80A01F90(Vec3f* this, Vec3f* arg1, f32 arg2) { return SQ(arg2) < (SQ(arg1->x - this->x) + SQ(arg1->z - this->z)); } -void func_80A01FE0(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A01FE0(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!func_80A01F90(&this->actor.world.pos, &player->actor.world.pos, 30.0f)) { this->unk_2B8 = 0.5f; @@ -228,8 +228,8 @@ void func_80A01FE0(EnElf* this, GlobalContext* globalCtx) { } } -void func_80A020A4(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A020A4(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (func_80A01F90(&this->actor.world.pos, &player->actor.world.pos, 50.0f)) { if (this->unk_2C0 > 0) { @@ -244,7 +244,7 @@ void func_80A020A4(EnElf* this, GlobalContext* globalCtx) { } } -void func_80A0214C(EnElf* this, GlobalContext* globalCtx) { +void func_80A0214C(EnElf* this, PlayState* play) { f32 xzDistToPlayer; if (this->unk_2C0 > 0) { @@ -289,14 +289,14 @@ void func_80A0214C(EnElf* this, GlobalContext* globalCtx) { } } -void func_80A0232C(EnElf* this, GlobalContext* globalCtx) { +void func_80A0232C(EnElf* this, PlayState* play) { if (func_80A01F90(&this->unk_28C, &this->actor.world.pos, 100.0f)) { this->unk_2A8 = 0; this->unk_2AC = 0x200; this->func_2C8 = func_80A0214C; this->unk_2B8 = 1.5f; } else { - this->func_2C8(this, globalCtx); + this->func_2C8(this, play); } } @@ -311,25 +311,25 @@ f32 EnElf_GetColorValue(s32 colorFlag) { } } -void EnElf_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnElf_Init(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 colorConfig; s32 i; Actor_ProcessInitChain(thisx, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gFairySkel, &gFairyAnim, this->jointTable, this->morphTable, 15); + SkelAnime_Init(play, &this->skelAnime, &gFairySkel, &gFairyAnim, this->jointTable, this->morphTable, 15); ActorShape_Init(&thisx->shape, 0.0f, NULL, 15.0f); thisx->shape.shadowAlpha = 0xFF; Lights_PointGlowSetInfo(&this->lightInfoGlow, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 255, 255, 255, 0); - this->lightNodeGlow = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfoGlow); + this->lightNodeGlow = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfoGlow); Lights_PointNoGlowSetInfo(&this->lightInfoNoGlow, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 255, 255, 255, 0); - this->lightNodeNoGlow = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfoNoGlow); + this->lightNodeNoGlow = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfoNoGlow); this->fairyFlags = 0; this->disappearTimer = 600; @@ -384,7 +384,7 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_28C = thisx->world.pos; this->unk_2BC = Rand_CenteredFloat(32767.0f); this->func_2C8 = func_80A0214C; - func_80A0232C(this, globalCtx); + func_80A0232C(this, play); this->unk_2C0 = 0; this->disappearTimer = 240; break; @@ -398,8 +398,8 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A01C38(this, 8); for (i = 0; i < 8; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, thisx->world.pos.x, - thisx->world.pos.y - 30.0f, thisx->world.pos.z, 0, 0, 0, FAIRY_HEAL); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, thisx->world.pos.x, thisx->world.pos.y - 30.0f, + thisx->world.pos.z, 0, 0, 0, FAIRY_HEAL); } break; default: @@ -430,15 +430,15 @@ void func_80A029A8(EnElf* this, s16 increment) { } } -void EnElf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnElf_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnElf* this = (EnElf*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNodeGlow); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNodeNoGlow); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNodeGlow); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNodeNoGlow); } -void func_80A02A20(EnElf* this, GlobalContext* globalCtx) { +void func_80A02A20(EnElf* this, PlayState* play) { this->unk_28C.x = Math_SinS(this->unk_2AC) * this->unk_2B8; this->unk_28C.y = Math_SinS(this->unk_2AA) * this->unk_2B4; this->unk_28C.z = Math_CosS(this->unk_2AC) * this->unk_2B8; @@ -446,7 +446,7 @@ void func_80A02A20(EnElf* this, GlobalContext* globalCtx) { this->unk_2AA += this->unk_2AE; } -void func_80A02AA4(EnElf* this, GlobalContext* globalCtx) { +void func_80A02AA4(EnElf* this, PlayState* play) { f32 xzScale; xzScale = (Math_CosS(this->unk_2AA) * this->unk_2B4) + this->unk_2B8; @@ -459,8 +459,8 @@ void func_80A02AA4(EnElf* this, GlobalContext* globalCtx) { this->unk_2AA += this->unk_2AE; } -void func_80A02B38(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A02B38(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_2AA = (this->unk_2AC * 2) & 0xFFFF; this->unk_28C.x = Math_SinS(this->unk_2AC) * this->unk_2B8; @@ -534,9 +534,9 @@ void func_80A02F2C(EnElf* this, Vec3f* targetPos) { Math_StepToF(&this->actor.velocity.y, yVelTarget, 1.5f); } -void func_80A03018(EnElf* this, GlobalContext* globalCtx) { +void func_80A03018(EnElf* this, PlayState* play) { s32 pad[2]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 targetYaw; Vec3f* unk_28C = &this->unk_28C; @@ -595,10 +595,10 @@ void func_80A03148(EnElf* this, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4) { func_8002D7EC(&this->actor); } -void func_80A0329C(EnElf* this, GlobalContext* globalCtx) { - Player* refActor = GET_PLAYER(globalCtx); +void func_80A0329C(EnElf* this, PlayState* play) { + Player* refActor = GET_PLAYER(play); s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 heightDiff; SkelAnime_Update(&this->skelAnime); @@ -608,28 +608,28 @@ void func_80A0329C(EnElf* this, GlobalContext* globalCtx) { this->unk_2AE = (s16)(Rand_ZeroFloat(1024.0f)) + 0x200; } - func_80A0232C(this, globalCtx); + func_80A0232C(this, play); this->unk_28C.y = player->bodyPartsPos[PLAYER_BODYPART_WAIST].y; func_80A02F2C(this, &this->unk_28C); - func_80A03018(this, globalCtx); + func_80A03018(this, play); if ((this->unk_2A8 == 2) || (this->unk_2A8 == 3)) { - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Actor_Kill(&this->actor); return; } - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { heightDiff = this->actor.world.pos.y - refActor->actor.world.pos.y; if ((heightDiff > 0.0f) && (heightDiff < 60.0f)) { if (!func_80A01F90(&this->actor.world.pos, &refActor->actor.world.pos, 10.0f)) { - Health_ChangeBy(globalCtx, 128); + Health_ChangeBy(play, 128); if (this->fairyFlags & FAIRY_FLAG_BIG) { - Magic_Fill(globalCtx); + Magic_Fill(play); } this->unk_2B8 = 50.0f; this->unk_2AC = refActor->actor.shape.rot.y; @@ -659,17 +659,17 @@ void func_80A0329C(EnElf* this, GlobalContext* globalCtx) { if (!(this->fairyFlags & FAIRY_FLAG_BIG)) { // GI_MAX in this case allows the player to catch the actor in a bottle - func_8002F434(&this->actor, globalCtx, GI_MAX, 80.0f, 60.0f); + func_8002F434(&this->actor, play, GI_MAX, 80.0f, 60.0f); } } } -void func_80A0353C(EnElf* this, GlobalContext* globalCtx) { +void func_80A0353C(EnElf* this, PlayState* play) { Vec3f parentPos; Actor* parent; SkelAnime_Update(&this->skelAnime); - func_80A02A20(this, globalCtx); + func_80A02A20(this, play); parent = this->actor.parent; if ((parent != NULL) && (parent->update != NULL)) { @@ -683,11 +683,11 @@ void func_80A0353C(EnElf* this, GlobalContext* globalCtx) { this->unk_2BC = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); } -void func_80A03604(EnElf* this, GlobalContext* globalCtx) { +void func_80A03604(EnElf* this, PlayState* play) { } -void func_80A03610(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A03610(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); Math_SmoothStepToF(&this->unk_2B8, 30.0f, 0.1f, 4.0f, 1.0f); @@ -725,12 +725,12 @@ void func_80A03610(EnElf* this, GlobalContext* globalCtx) { } this->unk_2BC = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); - EnElf_SpawnSparkles(this, globalCtx, 32); + EnElf_SpawnSparkles(this, play, 32); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } -void func_80A03814(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A03814(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); @@ -760,12 +760,12 @@ void func_80A03814(EnElf* this, GlobalContext* globalCtx) { this->unk_2AC += this->unk_2B0; func_80A02E30(this, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]); this->unk_2BC = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); - EnElf_SpawnSparkles(this, globalCtx, 32); + EnElf_SpawnSparkles(this, play, 32); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } -void func_80A03990(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A03990(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); @@ -785,13 +785,13 @@ void func_80A03990(EnElf* this, GlobalContext* globalCtx) { func_80A02E30(this, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]); Actor_SetScale(&this->actor, (1.0f - (SQ(this->unk_2B4) * SQ(1.0f / 9.0f))) * 0.008f); this->unk_2BC = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); - EnElf_SpawnSparkles(this, globalCtx, 32); + EnElf_SpawnSparkles(this, play, 32); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } -void func_80A03AB0(EnElf* this, GlobalContext* globalCtx) { +void func_80A03AB0(EnElf* this, PlayState* play) { if (this->fairyFlags & 4) { - func_80A04414(this, globalCtx); + func_80A04414(this, play); } SkelAnime_Update(&this->skelAnime); @@ -800,10 +800,10 @@ void func_80A03AB0(EnElf* this, GlobalContext* globalCtx) { ASSERT(0, "0", "../z_en_elf.c", 1725); } - this->func_2C8(this, globalCtx); + this->func_2C8(this, play); } -void EnElf_UpdateLights(EnElf* this, GlobalContext* globalCtx) { +void EnElf_UpdateLights(EnElf* this, PlayState* play) { s16 glowLightRadius; Player* player; @@ -814,7 +814,7 @@ void EnElf_UpdateLights(EnElf* this, GlobalContext* globalCtx) { } if (this->fairyFlags & 0x20) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); Lights_PointNoGlowSetInfo(&this->lightInfoNoGlow, player->actor.world.pos.x, (s16)(player->actor.world.pos.y) + 60.0f, player->actor.world.pos.z, 255, 255, 255, 200); @@ -831,25 +831,25 @@ void EnElf_UpdateLights(EnElf* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.scale.x); } -void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { +void func_80A03CF8(EnElf* this, PlayState* play) { Vec3f nextPos; Vec3f prevPos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* arrowPointedActor; f32 xScale; f32 distFromPlayerHat; - func_80A0461C(this, globalCtx); - func_80A03AB0(this, globalCtx); + func_80A0461C(this, play); + func_80A03AB0(this, play); xScale = 0.0f; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[8] != NULL)) { - EnElf_GetCutsceneNextPos(&nextPos, globalCtx, 8); + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[8] != NULL)) { + EnElf_GetCutsceneNextPos(&nextPos, play, 8); - if (globalCtx->csCtx.npcActions[8]->action == 5) { + if (play->csCtx.npcActions[8]->action == 5) { if (1) {} - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); } prevPos = this->actor.world.pos; @@ -860,10 +860,10 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { func_80A02C98(this, &nextPos, 0.2f); } - if ((globalCtx->sceneNum == SCENE_LINK_HOME) && (gSaveContext.sceneSetupIndex == 4)) { + if ((play->sceneNum == SCENE_LINK_HOME) && (gSaveContext.sceneSetupIndex == 4)) { // play dash sound as Navi enters Links house in the intro if (1) {} - if (globalCtx->csCtx.frames == 55) { + if (play->csCtx.frames == 55) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_FAIRY_DASH); } @@ -899,7 +899,7 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { } else { xScale = 0.008f; } - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); break; case 8: func_80A02C98(this, &player->bodyPartsPos[PLAYER_BODYPART_HAT], 0.2f); @@ -910,7 +910,7 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { nextPos = player->bodyPartsPos[PLAYER_BODYPART_HAT]; nextPos.y += 1500.0f * this->actor.scale.y; func_80A02E30(this, &nextPos); - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); if (this->unk_2B8 <= 19.0f) { this->unk_2B8 += 1.0f; @@ -926,21 +926,21 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { } break; case 12: - nextPos = GET_ACTIVE_CAM(globalCtx)->eye; + nextPos = GET_ACTIVE_CAM(play)->eye; nextPos.y += (-2000.0f * this->actor.scale.y); func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f); break; default: func_80A029A8(this, 1); - nextPos = globalCtx->actorCtx.targetCtx.naviRefPos; + nextPos = play->actorCtx.targetCtx.naviRefPos; nextPos.y += (1500.0f * this->actor.scale.y); - arrowPointedActor = globalCtx->actorCtx.targetCtx.arrowPointedActor; + arrowPointedActor = play->actorCtx.targetCtx.arrowPointedActor; if (arrowPointedActor != NULL) { func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f); if (this->actor.speedXZ >= 5.0f) { - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); } } else { if ((this->timer % 32) == 0) { @@ -953,7 +953,7 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { } func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f); - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); } else { if (distFromPlayerHat > 100.0f) { this->fairyFlags |= 2; @@ -979,7 +979,7 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.scale.x, 0.008f, 0.3f, 0.00080000004f, 0.000080000005f); } - EnElf_UpdateLights(this, globalCtx); + EnElf_UpdateLights(this, play); } void EnElf_ChangeColor(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* curColor, f32 rate) { @@ -996,13 +996,13 @@ void EnElf_ChangeColor(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* cu dest->a += (rgbaDiff.a * rate); } -void func_80A04414(EnElf* this, GlobalContext* globalCtx) { - Actor* arrowPointedActor = globalCtx->actorCtx.targetCtx.arrowPointedActor; - Player* player = GET_PLAYER(globalCtx); +void func_80A04414(EnElf* this, PlayState* play) { + Actor* arrowPointedActor = play->actorCtx.targetCtx.arrowPointedActor; + Player* player = GET_PLAYER(play); f32 transitionRate; u16 targetSound; - if (globalCtx->actorCtx.targetCtx.unk_40 != 0.0f) { + if (play->actorCtx.targetCtx.unk_40 != 0.0f) { this->unk_2C6 = 0; this->unk_29C = 1.0f; @@ -1013,18 +1013,18 @@ void func_80A04414(EnElf* this, GlobalContext* globalCtx) { } else { if (this->unk_2C6 == 0) { if ((arrowPointedActor == NULL) || - (Math_Vec3f_DistXYZ(&this->actor.world.pos, &globalCtx->actorCtx.targetCtx.naviRefPos) < 50.0f)) { + (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetCtx.naviRefPos) < 50.0f)) { this->unk_2C6 = 1; } } else if (this->unk_29C != 0.0f) { if (Math_StepToF(&this->unk_29C, 0.0f, 0.25f) != 0) { - this->innerColor = globalCtx->actorCtx.targetCtx.naviInner; - this->outerColor = globalCtx->actorCtx.targetCtx.naviOuter; + this->innerColor = play->actorCtx.targetCtx.naviInner; + this->outerColor = play->actorCtx.targetCtx.naviOuter; } else { transitionRate = 0.25f / this->unk_29C; - EnElf_ChangeColor(&this->innerColor, &globalCtx->actorCtx.targetCtx.naviInner, &this->innerColor, + EnElf_ChangeColor(&this->innerColor, &play->actorCtx.targetCtx.naviInner, &this->innerColor, transitionRate); - EnElf_ChangeColor(&this->outerColor, &globalCtx->actorCtx.targetCtx.naviOuter, &this->outerColor, + EnElf_ChangeColor(&this->outerColor, &play->actorCtx.targetCtx.naviOuter, &this->outerColor, transitionRate); } } @@ -1052,14 +1052,14 @@ void func_80A04414(EnElf* this, GlobalContext* globalCtx) { } } -void func_80A0461C(EnElf* this, GlobalContext* globalCtx) { +void func_80A0461C(EnElf* this, PlayState* play) { s32 temp; Actor* arrowPointedActor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[8] != NULL) { - switch (globalCtx->csCtx.npcActions[8]->action) { + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[8] != NULL) { + switch (play->csCtx.npcActions[8]->action) { case 4: temp = 9; break; @@ -1079,9 +1079,9 @@ void func_80A0461C(EnElf* this, GlobalContext* globalCtx) { } } else { - arrowPointedActor = globalCtx->actorCtx.targetCtx.arrowPointedActor; + arrowPointedActor = play->actorCtx.targetCtx.arrowPointedActor; - if ((player->stateFlags1 & PLAYER_STATE1_10) || ((YREG(15) & 0x10) && func_800BC56C(globalCtx, 2))) { + if ((player->stateFlags1 & PLAYER_STATE1_10) || ((YREG(15) & 0x10) && func_800BC56C(play, 2))) { temp = 12; this->unk_2C0 = 100; } else if (arrowPointedActor == NULL || arrowPointedActor->category == ACTORCAT_NPC) { @@ -1174,7 +1174,7 @@ void func_80A0461C(EnElf* this, GlobalContext* globalCtx) { } } -void EnElf_SpawnSparkles(EnElf* this, GlobalContext* globalCtx, s32 sparkleLife) { +void EnElf_SpawnSparkles(EnElf* this, PlayState* play, s32 sparkleLife) { static Vec3f sparkleVelocity = { 0.0f, -0.05f, 0.0f }; static Vec3f sparkleAccel = { 0.0f, -0.025f, 0.0f }; s32 pad; @@ -1194,27 +1194,27 @@ void EnElf_SpawnSparkles(EnElf* this, GlobalContext* globalCtx, s32 sparkleLife) envColor.g = this->outerColor.g; envColor.b = this->outerColor.b; - EffectSsKiraKira_SpawnDispersed(globalCtx, &sparklePos, &sparkleVelocity, &sparkleAccel, &primColor, &envColor, - 1000, sparkleLife); + EffectSsKiraKira_SpawnDispersed(play, &sparklePos, &sparkleVelocity, &sparkleAccel, &primColor, &envColor, 1000, + sparkleLife); } -void func_80A04D90(EnElf* this, GlobalContext* globalCtx) { +void func_80A04D90(EnElf* this, PlayState* play) { s32 pad; s32 bgId; - this->actor.floorHeight = BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &this->actor.floorPoly, &bgId, + this->actor.floorHeight = BgCheck_EntityRaycastFloor5(play, &play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); this->actor.shape.shadowAlpha = 0x32; } // move to talk to player -void func_80A04DE4(EnElf* this, GlobalContext* globalCtx) { +void func_80A04DE4(EnElf* this, PlayState* play) { Vec3f headCopy; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f naviRefPos; if (this->fairyFlags & 0x10) { - naviRefPos = globalCtx->actorCtx.targetCtx.naviRefPos; + naviRefPos = play->actorCtx.targetCtx.naviRefPos; if ((player->unk_664 == NULL) || (&player->actor == player->unk_664) || (&this->actor == player->unk_664)) { naviRefPos.x = @@ -1228,43 +1228,43 @@ void func_80A04DE4(EnElf* this, GlobalContext* globalCtx) { this->fairyFlags &= ~0x10; } - func_80A03AB0(this, globalCtx); + func_80A03AB0(this, play); headCopy = this->actor.focus.pos; func_80A03148(this, &headCopy, 0, 20.0f, 0.2f); if (this->actor.speedXZ >= 5.0f) { - EnElf_SpawnSparkles(this, globalCtx, 16); + EnElf_SpawnSparkles(this, play, 16); } Math_SmoothStepToF(&this->actor.scale.x, 0.008f, 0.3f, 0.00080000004f, 0.000080000005f); - EnElf_UpdateLights(this, globalCtx); + EnElf_UpdateLights(this, play); } // move after talking to player -void func_80A04F94(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A04F94(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_2BC, 5, 0x1000, 0x400); this->timer++; Math_StepToF(&this->unk_2A4, 1.0f, 0.05f); - Environment_AdjustLights(globalCtx, SQ(this->unk_2A4), player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f); + Environment_AdjustLights(play, SQ(this->unk_2A4), player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f); } // ask to talk to saria again -void func_80A05040(Actor* thisx, GlobalContext* globalCtx) { +void func_80A05040(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; - func_80A04DE4(this, globalCtx); + func_80A04DE4(this, play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes - Message_ContinueTextbox(globalCtx, ElfMessage_GetSariaText(globalCtx)); + Message_ContinueTextbox(play, ElfMessage_GetSariaText(play)); this->actor.update = func_80A05114; break; case 1: // no - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.update = func_80A053F0; func_80A01C38(this, 0); this->fairyFlags &= ~0x20; @@ -1272,57 +1272,57 @@ void func_80A05040(Actor* thisx, GlobalContext* globalCtx) { } } - func_80A04F94(this, globalCtx); + func_80A04F94(this, play); } -void func_80A05114(Actor* thisx, GlobalContext* globalCtx) { +void func_80A05114(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; - func_80A04DE4(this, globalCtx); + func_80A04DE4(this, play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0xE3); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0xE3); this->actor.update = func_80A05040; } - func_80A04F94(this, globalCtx); + func_80A04F94(this, play); } -void func_80A05188(Actor* thisx, GlobalContext* globalCtx) { +void func_80A05188(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; - func_80A04DE4(this, globalCtx); + func_80A04DE4(this, play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, ElfMessage_GetSariaText(globalCtx)); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, ElfMessage_GetSariaText(play)); this->actor.update = func_80A05114; } - func_80A04F94(this, globalCtx); + func_80A04F94(this, play); } // ask to talk to navi -void func_80A05208(Actor* thisx, GlobalContext* globalCtx) { +void func_80A05208(Actor* thisx, PlayState* play) { s32 naviCUpText; EnElf* this = (EnElf*)thisx; - func_80A04DE4(this, globalCtx); + func_80A04DE4(this, play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes - naviCUpText = ElfMessage_GetCUpText(globalCtx); + naviCUpText = ElfMessage_GetCUpText(play); if (naviCUpText != 0) { - Message_ContinueTextbox(globalCtx, naviCUpText); + Message_ContinueTextbox(play, naviCUpText); } else { - Message_ContinueTextbox(globalCtx, 0x15F); + Message_ContinueTextbox(play, 0x15F); } this->actor.update = func_80A052F4; break; case 1: // no - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.update = func_80A053F0; func_80A01C38(this, 0); this->fairyFlags &= ~0x20; @@ -1330,49 +1330,49 @@ void func_80A05208(Actor* thisx, GlobalContext* globalCtx) { } } - func_80A04F94(this, globalCtx); + func_80A04F94(this, play); } // ask to talk to saria -void func_80A052F4(Actor* thisx, GlobalContext* globalCtx) { +void func_80A052F4(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; - func_80A04DE4(this, globalCtx); + func_80A04DE4(this, play); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) { - if (Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.unk_E3F2 = 0xFF; + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) { + if (Message_ShouldAdvance(play)) { + play->msgCtx.unk_E3F2 = 0xFF; - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: // yes this->actor.update = func_80A05188; - Message_ContinueTextbox(globalCtx, 0xE2); + Message_ContinueTextbox(play, 0xE2); break; case 1: // no this->actor.update = func_80A05208; - Message_ContinueTextbox(globalCtx, 0xE1); + Message_ContinueTextbox(play, 0xE1); break; } } - } else if (Actor_TextboxIsClosing(thisx, globalCtx)) { + } else if (Actor_TextboxIsClosing(thisx, play)) { this->actor.update = func_80A053F0; func_80A01C38(this, 0); this->fairyFlags &= ~0x20; } - func_80A04F94(this, globalCtx); + func_80A04F94(this, play); } -void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { +void func_80A053F0(Actor* thisx, PlayState* play) { u8 unk2C7; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnElf* this = (EnElf*)thisx; if (player->naviTextId == 0) { if (player->unk_664 == NULL) { if (((gSaveContext.naviTimer >= 600) && (gSaveContext.naviTimer <= 3000)) || (nREG(89) != 0)) { - player->naviTextId = ElfMessage_GetCUpText(globalCtx); + player->naviTextId = ElfMessage_GetCUpText(play); if (player->naviTextId == 0x15F) { player->naviTextId = 0; @@ -1384,11 +1384,11 @@ void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { thisx->flags |= ACTOR_FLAG_16; } - if (Actor_ProcessTalkRequest(thisx, globalCtx)) { + if (Actor_ProcessTalkRequest(thisx, play)) { func_800F4524(&gSfxDefaultPos, NA_SE_VO_SK_LAUGH, 0x20); thisx->focus.pos = thisx->world.pos; - if (thisx->textId == ElfMessage_GetCUpText(globalCtx)) { + if (thisx->textId == ElfMessage_GetCUpText(play)) { this->fairyFlags |= 0x80; gSaveContext.naviTimer = 3001; } @@ -1404,7 +1404,7 @@ void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { thisx->flags &= ~ACTOR_FLAG_16; } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); thisx->shape.rot.y = this->unk_2BC; // `gSaveContext.sceneFlags[127].chest` (like in the debug string) instead of `HIGH_SCORE(HS_HBA)` matches too, @@ -1418,7 +1418,7 @@ void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { LOG_NUM("z_common_data.memory.information.room_inf[127][ 0 ]", HIGH_SCORE(HS_HBA), "../z_en_elf.c", 2595); } - if (!Play_InCsMode(globalCtx)) { + if (!Play_InCsMode(play)) { if (gSaveContext.naviTimer < 25800) { gSaveContext.naviTimer++; } else if (!(this->fairyFlags & 0x80)) { @@ -1432,8 +1432,8 @@ void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_2A4 > 0.0f) { Math_StepToF(&this->unk_2A4, 0.0f, 0.05f); - Environment_AdjustLights(globalCtx, SQ(this->unk_2A4) * this->unk_2A4, player->actor.projectedPos.z + 780.0f, - 0.2f, 0.5f); + Environment_AdjustLights(play, SQ(this->unk_2A4) * this->unk_2A4, player->actor.projectedPos.z + 780.0f, 0.2f, + 0.5f); } // temp probably fake match @@ -1442,27 +1442,27 @@ void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { this->unk_2C7--; } - if ((this->unk_2C7 == 0) && (globalCtx->csCtx.state != CS_STATE_IDLE)) { + if ((this->unk_2C7 == 0) && (play->csCtx.state != CS_STATE_IDLE)) { this->unk_2C7 = 1; } - func_80A04D90(this, globalCtx); + func_80A04D90(this, play); } -void EnElf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnElf_Update(Actor* thisx, PlayState* play) { s32 pad; EnElf* this = (EnElf*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.shape.rot.y = this->unk_2BC; this->timer++; if (this->fairyFlags & FAIRY_FLAG_BIG) { - func_80A04D90(this, globalCtx); + func_80A04D90(this, play); } } -s32 EnElf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnElf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 pad; @@ -1493,22 +1493,22 @@ s32 EnElf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnElf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnElf_Draw(Actor* thisx, PlayState* play) { s32 pad; f32 alphaScale; s32 envAlpha; EnElf* this = (EnElf*)thisx; s32 pad1; Gfx* dListHead; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->unk_2A8 != 8) && !(this->fairyFlags & 8)) { if (!(player->stateFlags1 & PLAYER_STATE1_20) || (kREG(90) < this->actor.projectedPos.z)) { - dListHead = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Gfx) * 4); + dListHead = Graph_Alloc(play->state.gfxCtx, sizeof(Gfx) * 4); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_elf.c", 2730); + OPEN_DISPS(play->state.gfxCtx, "../z_en_elf.c", 2730); - func_80094B58(globalCtx->state.gfxCtx); + func_80094B58(play->state.gfxCtx); envAlpha = (this->timer * 50) & 0x1FF; envAlpha = (envAlpha > 255) ? 511 - envAlpha : envAlpha; @@ -1529,18 +1529,18 @@ void EnElf_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPEndDisplayList(dListHead++); gDPSetEnvColor(POLY_XLU_DISP++, (u8)this->outerColor.r, (u8)this->outerColor.g, (u8)this->outerColor.b, (u8)(envAlpha * alphaScale)); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnElf_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_elf.c", 2793); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_elf.c", 2793); } } } -void EnElf_GetCutsceneNextPos(Vec3f* vec, GlobalContext* globalCtx, s32 action) { +void EnElf_GetCutsceneNextPos(Vec3f* vec, PlayState* play, s32 action) { Vec3f startPos; Vec3f endPos; - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[action]; + CsCmdActorAction* npcAction = play->csCtx.npcActions[action]; f32 lerp; startPos.x = npcAction->startPos.x; @@ -1551,7 +1551,7 @@ void EnElf_GetCutsceneNextPos(Vec3f* vec, GlobalContext* globalCtx, s32 action) endPos.y = npcAction->endPos.y; endPos.z = npcAction->endPos.z; - lerp = Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames); + lerp = Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames); vec->x = ((endPos.x - startPos.x) * lerp) + startPos.x; vec->y = ((endPos.y - startPos.y) * lerp) + startPos.y; diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.h b/src/overlays/actors/ovl_En_Elf/z_en_elf.h index 1aaa029c79..cc2bfd3961 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.h +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.h @@ -7,8 +7,8 @@ struct EnElf; -typedef void (*EnElfActionFunc)(struct EnElf*, GlobalContext*); -typedef void (*EnElfUnkFunc)(struct EnElf*, GlobalContext*); +typedef void (*EnElfActionFunc)(struct EnElf*, PlayState*); +typedef void (*EnElfUnkFunc)(struct EnElf*, PlayState*); typedef struct EnElf { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index 065da52c7f..015779aa84 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -4,12 +4,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_27) -void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEncount1_Update(Actor* thisx, GlobalContext* globalCtx); +void EnEncount1_Init(Actor* thisx, PlayState* play); +void EnEncount1_Update(Actor* thisx, PlayState* play); -void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx); -void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx); -void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCtx); +void EnEncount1_SpawnLeevers(EnEncount1* this, PlayState* play); +void EnEncount1_SpawnTektites(EnEncount1* this, PlayState* play); +void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play); static s16 sLeeverAngles[] = { 0x0000, 0x2710, 0x7148, 0x8EB8, 0xD8F0 }; static f32 sLeeverDists[] = { 200.0f, 170.0f, 120.0f, 120.0f, 170.0f }; @@ -26,7 +26,7 @@ const ActorInit En_Encount1_InitVars = { NULL, }; -void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount1_Init(Actor* thisx, PlayState* play) { s32 pad; EnEncount1* this = (EnEncount1*)thisx; f32 spawnRange; @@ -69,7 +69,7 @@ void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx) { case SPAWNER_LEEVER: this->timer = 30; this->maxCurSpawns = 5; - if (globalCtx->sceneNum == SCENE_SPOT13) { // Haunted Wasteland + if (play->sceneNum == SCENE_SPOT13) { // Haunted Wasteland this->reduceLeevers = true; this->maxCurSpawns = 3; } @@ -81,7 +81,7 @@ void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx) { break; case SPAWNER_STALCHILDREN: case SPAWNER_WOLFOS: - if (globalCtx->sceneNum == SCENE_SPOT00) { // Hyrule Field + if (play->sceneNum == SCENE_SPOT00) { // Hyrule Field this->maxTotalSpawns = 10000; } this->updateFunc = EnEncount1_SpawnStalchildOrWolfos; @@ -89,8 +89,8 @@ void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEncount1_SpawnLeevers(EnEncount1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 floorType; f32 spawnDist; s32 spawnParams; @@ -105,9 +105,9 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) { this->outOfRangeTimer = 0; spawnPos = this->actor.world.pos; - if ((this->timer == 0) && (globalCtx->csCtx.state == CS_STATE_IDLE) && (this->curNumSpawn <= this->maxCurSpawns) && + if ((this->timer == 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->curNumSpawn <= this->maxCurSpawns) && (this->curNumSpawn < 5)) { - floorType = func_80041D4C(&globalCtx->colCtx, player->actor.floorPoly, player->actor.floorBgId); + floorType = func_80041D4C(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId); if ((floorType != 4) && (floorType != 7) && (floorType != 12)) { this->numLeeverSpawns = 0; } else if (!(this->reduceLeevers && (this->actor.xzDistToPlayer > 1300.0f))) { @@ -131,14 +131,14 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) { spawnPos.y = player->actor.floorHeight + 120.0f; spawnPos.z = player->actor.world.pos.z + Math_CosS(spawnAngle) * spawnDist; - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); if (floorY <= BGCHECK_Y_MIN) { break; } spawnPos.y = floorY; - leever = (EnReeba*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_REEBA, - spawnPos.x, spawnPos.y, spawnPos.z, 0, 0, 0, spawnParams); + leever = (EnReeba*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_REEBA, spawnPos.x, + spawnPos.y, spawnPos.z, 0, 0, 0, spawnParams); if (1) {} if (1) {} @@ -174,8 +174,8 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) { } } -void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEncount1_SpawnTektites(EnEncount1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 bgId; CollisionPoly* floorPoly; Vec3f spawnPos; @@ -192,13 +192,13 @@ void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx) { spawnPos.x = this->actor.world.pos.x + Rand_CenteredFloat(50.0f); spawnPos.y = this->actor.world.pos.y + 120.0f; spawnPos.z = this->actor.world.pos.z + Rand_CenteredFloat(50.0f); - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); if (floorY <= BGCHECK_Y_MIN) { return; } spawnPos.y = floorY; - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TITE, spawnPos.x, - spawnPos.y, spawnPos.z, 0, 0, 0, TEKTITE_RED) != NULL) { + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TITE, spawnPos.x, spawnPos.y, + spawnPos.z, 0, 0, 0, TEKTITE_RED) != NULL) { this->curNumSpawn++; this->totalNumSpawn++; } else { @@ -212,8 +212,8 @@ void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx) { } } -void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 spawnDist; s16 spawnAngle; s16 spawnId; @@ -225,13 +225,13 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt s32 bgId; f32 floorY; - if (globalCtx->sceneNum != SCENE_SPOT00) { + if (play->sceneNum != SCENE_SPOT00) { if ((fabsf(player->actor.world.pos.y - this->actor.world.pos.y) > 100.0f) || (this->actor.xzDistToPlayer > this->spawnRange)) { this->outOfRangeTimer++; return; } - } else if (IS_DAY || (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY)) { + } else if (IS_DAY || (Player_GetMask(play) == PLAYER_MASK_BUNNY)) { this->killCount = 0; return; } @@ -240,7 +240,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt spawnPos = this->actor.world.pos; if ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { while ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { - if (globalCtx->sceneNum == SCENE_SPOT00) { + if (play->sceneNum == SCENE_SPOT00) { if ((player->unk_89E == 0) || (player->actor.floorBgId != BGCHECK_SCENE) || !(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (player->stateFlags1 & PLAYER_STATE1_27)) { @@ -266,7 +266,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt spawnPos.y = player->actor.floorHeight + 120.0f; spawnPos.z = player->actor.world.pos.z + (Math_CosS(spawnAngle) * spawnDist) + Rand_CenteredFloat(40.0f); - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); if (floorY <= BGCHECK_Y_MIN) { break; } @@ -292,13 +292,13 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt } this->killCount++; } - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, spawnId, spawnPos.x, spawnPos.y, - spawnPos.z, 0, 0, 0, spawnParams) != NULL) { + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, spawnId, spawnPos.x, spawnPos.y, spawnPos.z, 0, + 0, 0, spawnParams) != NULL) { this->curNumSpawn++; if (this->curNumSpawn >= this->maxCurSpawns) { this->fieldSpawnTimer = 100; } - if (globalCtx->sceneNum != SCENE_SPOT00) { + if (play->sceneNum != SCENE_SPOT00) { this->totalNumSpawn++; } } else { @@ -312,7 +312,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt } } -void EnEncount1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount1_Update(Actor* thisx, PlayState* play) { s32 pad; EnEncount1* this = (EnEncount1*)thisx; @@ -320,19 +320,19 @@ void EnEncount1_Update(Actor* thisx, GlobalContext* globalCtx) { this->timer--; } - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); if (BREG(0) != 0) { if (this->outOfRangeTimer != 0) { if ((this->outOfRangeTimer & 1) == 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, 120, 120, 120, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 120, 120, 120, 255, 4, play->state.gfxCtx); } } else { 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, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); } } } diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h index 2df4b11b46..efd770f266 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h @@ -9,7 +9,7 @@ struct EnEncount1; -typedef void (*EnEncount1UpdateFunc)(struct EnEncount1*, GlobalContext*); +typedef void (*EnEncount1UpdateFunc)(struct EnEncount1*, PlayState*); typedef struct EnEncount1 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index dc86407aa4..26e5c13bbe 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -11,16 +11,16 @@ typedef enum { /* 0x2 */ ENCOUNT2_ACTIVE_GANONS_TOWER } Encount2State; -void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEncount2_Init(Actor* thisx, PlayState* play); +void EnEncount2_Update(Actor* thisx, PlayState* play); +void EnEncount2_Draw(Actor* thisx, PlayState* play); -void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx); -void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx); +void EnEncount2_Wait(EnEncount2* this, PlayState* play); +void EnEncount2_SpawnRocks(EnEncount2* this, PlayState* play); void EnEncount2_SpawnEffect(EnEncount2* this, Vec3f* position, f32 scale); -void EnEncount2_DrawEffects(Actor* thisx, GlobalContext* globalCtx); -void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx); +void EnEncount2_DrawEffects(Actor* thisx, PlayState* play); +void EnEncount2_UpdateEffects(EnEncount2* this, PlayState* play); const ActorInit En_Encount2_InitVars = { ACTOR_EN_ENCOUNT2, @@ -34,10 +34,10 @@ const ActorInit En_Encount2_InitVars = { (ActorFunc)EnEncount2_Draw, }; -void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount2_Init(Actor* thisx, PlayState* play) { EnEncount2* this = (EnEncount2*)thisx; - if (globalCtx->sceneNum != SCENE_SPOT16) { + if (play->sceneNum != SCENE_SPOT16) { this->isNotDeathMountain = true; } @@ -59,11 +59,11 @@ void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnEncount2_Wait; } -void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { +void EnEncount2_Wait(EnEncount2* this, PlayState* play) { s32 pad; s16 quakeIndex; s16 spawnerState; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); spawnerState = ENCOUNT2_INACTIVE; if (!this->isNotDeathMountain) { @@ -72,8 +72,8 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { (player->actor.world.pos.z > -3600.0f)) { spawnerState = ENCOUNT2_ACTIVE_DEATH_MOUNTAIN; } - } else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(globalCtx, 0x37))) { - s16 scene = globalCtx->sceneNum; + } else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(play, 0x37))) { + s16 scene = play->sceneNum; if (((scene == SCENE_GANON_DEMO) || (scene == SCENE_GANON_FINAL) || (scene == SCENE_GANON_SONOGO) || (scene == SCENE_GANONTIKA_SONOGO)) && @@ -92,7 +92,7 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { break; case ENCOUNT2_ACTIVE_DEATH_MOUNTAIN: if ((this->deathMountainSpawnerTimer == 1) || (!this->isQuaking)) { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1); Quake_SetSpeed(quakeIndex, 0x7FFF); Quake_SetQuakeValues(quakeIndex, 50, 0, 0, 0); Quake_SetCountdown(quakeIndex, 300); @@ -113,8 +113,8 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { return; } -void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnEncount2_SpawnRocks(EnEncount2* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnFireRock* spawnedRock; f32 tempVec1X; f32 tempVec1Y; @@ -152,8 +152,8 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->actor, NA_SE_EV_VOLCANO - SFX_FLAG); - } else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(globalCtx, 0x37) != 0)) { - s16 scene = globalCtx->sceneNum; + } else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(play, 0x37) != 0)) { + s16 scene = play->sceneNum; if (((scene == SCENE_GANON_DEMO) || (scene == SCENE_GANON_FINAL) || (scene == SCENE_GANON_SONOGO) || (scene == SCENE_GANONTIKA_SONOGO)) && @@ -164,9 +164,9 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { } if (spawnerState != ENCOUNT2_INACTIVE) { // Direction vector for the direction the camera is facing - tempVec1X = globalCtx->view.at.x - globalCtx->view.eye.x; - tempVec1Y = globalCtx->view.at.y - globalCtx->view.eye.y; - tempVec1Z = globalCtx->view.at.z - globalCtx->view.eye.z; + tempVec1X = play->view.at.x - play->view.eye.x; + tempVec1Y = play->view.at.y - play->view.eye.y; + tempVec1Z = play->view.at.z - play->view.eye.z; // Normalised direction vector for the direction the camera is facing magnitude = sqrtf(SQ(tempVec1X) + SQ(tempVec1Y) + SQ(tempVec1Z)); @@ -175,15 +175,15 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { tempVec2Z = tempVec1Z / magnitude; // Position between 160 and 300 units ahead of camera depending on camera pitch, plus a 400 unit offset in +y - tempVec1X = globalCtx->view.eye.x + (tempVec2X * 300.0f); - tempVec1Y = globalCtx->view.eye.y + (tempVec2Y * 160.0f) + 400.0f; - tempVec1Z = globalCtx->view.eye.z + (tempVec2Z * 300.0f); + tempVec1X = play->view.eye.x + (tempVec2X * 300.0f); + tempVec1Y = play->view.eye.y + (tempVec2Y * 160.0f) + 400.0f; + tempVec1Z = play->view.eye.z + (tempVec2Z * 300.0f); // Position between 160 and 200 units ahead of camera depending on camera pitch, plus a 400 unit offset in +y // (plus some random variation) - effectPos.x = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.x + (tempVec2X * 200.0f)); + effectPos.x = Rand_CenteredFloat(200.0f) + (play->view.eye.x + (tempVec2X * 200.0f)); effectPos.y = Rand_CenteredFloat(50.0f) + tempVec1Y; - effectPos.z = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.z + (tempVec2Z * 200.0f)); + effectPos.z = Rand_CenteredFloat(200.0f) + (play->view.eye.z + (tempVec2Z * 200.0f)); effectScale = Rand_CenteredFloat(0.005f) + 0.007f; if (spawnerState == ENCOUNT2_ACTIVE_DEATH_MOUNTAIN) { @@ -205,8 +205,8 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { if (player->linearVelocity != 0.0f) { // rock spawn pos is between 300 and 600 units from the camera depending on the camera yaw. // Rocks will generally spawn closer to the camera in the X axis than in the Z axis. - tempVec2X = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.x + (tempVec2X * 300.0f)); - tempVec2Z = Rand_CenteredFloat(50.0f) + (globalCtx->view.eye.z + (tempVec2Z * 600.0f)); + tempVec2X = Rand_CenteredFloat(200.0f) + (play->view.eye.x + (tempVec2X * 300.0f)); + tempVec2Z = Rand_CenteredFloat(50.0f) + (play->view.eye.z + (tempVec2Z * 600.0f)); } else { // rock spawn pos X, Z near player tempVec2X = Rand_CenteredFloat(10.0f) + player->actor.world.pos.x; @@ -227,9 +227,8 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { tempVec2Z = Rand_CenteredFloat(70.0f) + player->actor.world.pos.z; } } - spawnedRock = - (EnFireRock*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FIRE_ROCK, - tempVec2X, tempVec1Y, tempVec2Z, 0, 0, 0, spawnedRockType); + spawnedRock = (EnFireRock*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FIRE_ROCK, + tempVec2X, tempVec1Y, tempVec2Z, 0, 0, 0, spawnedRockType); if (spawnedRock != NULL) { spawnedRock->spawner = this; this->numSpawnedRocks++; @@ -245,9 +244,9 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { } } -void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnEncount2_Update(Actor* thisx, PlayState* play2) { EnEncount2* this = (EnEncount2*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; if (this->deathMountainSpawnerTimer != 0) { this->deathMountainSpawnerTimer--; @@ -261,30 +260,30 @@ void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->effectSpawnTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - EnEncount2_UpdateEffects(this, globalCtx); + EnEncount2_UpdateEffects(this, play); if (!this->isNotDeathMountain) { this->unk_17C = this->envEffectsTimer / 60.0f; this->unk_160 = this->unk_17C * -50.0f; - globalCtx->envCtx.adjAmbientColor[0] = (s16)this->unk_160 * -1.5f; - globalCtx->envCtx.adjAmbientColor[1] = globalCtx->envCtx.adjAmbientColor[2] = this->unk_160; + play->envCtx.adjAmbientColor[0] = (s16)this->unk_160 * -1.5f; + play->envCtx.adjAmbientColor[1] = play->envCtx.adjAmbientColor[2] = this->unk_160; this->unk_168 = this->unk_17C * -20.0f; - globalCtx->envCtx.adjLight1Color[0] = (s16)this->unk_168 * -1.5f; - globalCtx->envCtx.adjLight1Color[1] = globalCtx->envCtx.adjLight1Color[2] = this->unk_168; + play->envCtx.adjLight1Color[0] = (s16)this->unk_168 * -1.5f; + play->envCtx.adjLight1Color[1] = play->envCtx.adjLight1Color[2] = this->unk_168; this->unk_170 = this->unk_17C * -50.0f; - globalCtx->envCtx.adjFogNear = this->unk_170; - globalCtx->envCtx.adjFogColor[0] = (u8)((160.0f - globalCtx->envCtx.lightSettings.fogColor[0]) * this->unk_17C); - globalCtx->envCtx.adjFogColor[1] = (u8)((160.0f - globalCtx->envCtx.lightSettings.fogColor[1]) * this->unk_17C); - globalCtx->envCtx.adjFogColor[2] = (u8)((150.0f - globalCtx->envCtx.lightSettings.fogColor[2]) * this->unk_17C); + play->envCtx.adjFogNear = this->unk_170; + play->envCtx.adjFogColor[0] = (u8)((160.0f - play->envCtx.lightSettings.fogColor[0]) * this->unk_17C); + play->envCtx.adjFogColor[1] = (u8)((160.0f - play->envCtx.lightSettings.fogColor[1]) * this->unk_17C); + play->envCtx.adjFogColor[2] = (u8)((150.0f - play->envCtx.lightSettings.fogColor[2]) * this->unk_17C); } } -void EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount2_Draw(Actor* thisx, PlayState* play) { EnEncount2* this = (EnEncount2*)thisx; - EnEncount2_DrawEffects(&this->actor, globalCtx); + EnEncount2_DrawEffects(&this->actor, play); } void EnEncount2_SpawnEffect(EnEncount2* this, Vec3f* position, f32 scale) { @@ -307,10 +306,10 @@ void EnEncount2_SpawnEffect(EnEncount2* this, Vec3f* position, f32 scale) { } } -void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx) { +void EnEncount2_UpdateEffects(EnEncount2* this, PlayState* play) { s16 i; EnEncount2Effect* effect = this->effects; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f targetPos; for (i = 0; i < EN_ENCOUNT2_EFFECT_COUNT; effect++, i++) { @@ -326,7 +325,7 @@ void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx) { Math_ApproachF(&effect->pos.z, targetPos.z, 0.3f, 30.0f); Math_ApproachF(&effect->moveDirection.y, -20.0f, 0.9f, 1.0f); - if (globalCtx->sceneNum != SCENE_SPOT16) { + if (play->sceneNum != SCENE_SPOT16) { if (effect->pos.y < (player->actor.floorHeight - 50.0f)) { effect->isAlive = 0; } @@ -337,20 +336,20 @@ void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx) { } } -void EnEncount2_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount2_DrawEffects(Actor* thisx, PlayState* play) { EnEncount2* this = (EnEncount2*)thisx; EnEncount2Effect* effect = this->effects; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; s32 objBankIndex; OPEN_DISPS(gfxCtx, "../z_en_encount2.c", 642); - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_EFC_STAR_FIELD); + objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_EFC_STAR_FIELD); if (objBankIndex >= 0) { gDPPipeSync(POLY_XLU_DISP++); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objBankIndex].segment); for (i = 0; i < EN_ENCOUNT2_EFFECT_COUNT; effect++, i++) { if (effect->isAlive) { @@ -361,7 +360,7 @@ void EnEncount2_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 155, 55, 255); gDPSetEnvColor(POLY_OPA_DISP++, 155, 255, 55, 255); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_encount2.c", 669), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_encount2.c", 669), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_efc_star_field_DL_000DE0); } diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h index e998be8399..7141abd17d 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h @@ -6,7 +6,7 @@ struct EnEncount2; -typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, GlobalContext*); +typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, PlayState*); #define EN_ENCOUNT2_EFFECT_COUNT 50 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 453efb880d..2360be2329 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 @@ -11,26 +11,26 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnExItem_Init(Actor* thisx, GlobalContext* globalCtx); -void EnExItem_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnExItem_Update(Actor* thisx, GlobalContext* globalCtx); -void EnExItem_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnExItem_Init(Actor* thisx, PlayState* play); +void EnExItem_Destroy(Actor* thisx, PlayState* play); +void EnExItem_Update(Actor* thisx, PlayState* play); +void EnExItem_Draw(Actor* thisx, PlayState* play); -void EnExItem_DrawItems(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_DrawHeartPiece(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_DrawRupee(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_DrawKey(EnExItem* this, GlobalContext* globalCtx, s32 index); -void EnExItem_DrawMagic(EnExItem* this, GlobalContext* globalCtx, s16 magicIndex); +void EnExItem_DrawItems(EnExItem* this, PlayState* play); +void EnExItem_DrawHeartPiece(EnExItem* this, PlayState* play); +void EnExItem_DrawRupee(EnExItem* this, PlayState* play); +void EnExItem_DrawKey(EnExItem* this, PlayState* play, s32 index); +void EnExItem_DrawMagic(EnExItem* this, PlayState* play, s16 magicIndex); -void EnExItem_WaitForObject(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_BowlPrize(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_SetupBowlCounter(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_BowlCounter(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_ExitChest(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_FairyMagic(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_TargetPrizeGive(EnExItem* this, GlobalContext* globalCtx); -void EnExItem_TargetPrizeFinish(EnExItem* this, GlobalContext* globalCtx); +void EnExItem_WaitForObject(EnExItem* this, PlayState* play); +void EnExItem_BowlPrize(EnExItem* this, PlayState* play); +void EnExItem_SetupBowlCounter(EnExItem* this, PlayState* play); +void EnExItem_BowlCounter(EnExItem* this, PlayState* play); +void EnExItem_ExitChest(EnExItem* this, PlayState* play); +void EnExItem_FairyMagic(EnExItem* this, PlayState* play); +void EnExItem_TargetPrizeApproach(EnExItem* this, PlayState* play); +void EnExItem_TargetPrizeGive(EnExItem* this, PlayState* play); +void EnExItem_TargetPrizeFinish(EnExItem* this, PlayState* play); const ActorInit En_Ex_Item_InitVars = { ACTOR_EN_EX_ITEM, @@ -44,10 +44,10 @@ const ActorInit En_Ex_Item_InitVars = { (ActorFunc)EnExItem_Draw, }; -void EnExItem_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnExItem_Destroy(Actor* thisx, PlayState* play) { } -void EnExItem_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnExItem_Init(Actor* thisx, PlayState* play) { s32 pad; EnExItem* this = (EnExItem*)thisx; @@ -103,7 +103,7 @@ void EnExItem_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->getItemObjId >= 0) { - this->objectIdx = Object_GetIndex(&globalCtx->objectCtx, this->getItemObjId); + this->objectIdx = Object_GetIndex(&play->objectCtx, this->getItemObjId); this->actor.draw = NULL; if (this->objectIdx < 0) { Actor_Kill(&this->actor); @@ -117,10 +117,10 @@ void EnExItem_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnExItem_WaitForObject(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_WaitForObject(EnExItem* this, PlayState* play) { s32 onCounter; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objectIdx)) { + if (Object_IsLoaded(&play->objectCtx, this->objectIdx)) { // "End of transfer" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this); @@ -254,7 +254,7 @@ void EnExItem_WaitForObject(EnExItem* this, GlobalContext* globalCtx) { } } -void EnExItem_BowlPrize(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_BowlPrize(EnExItem* this, PlayState* play) { s32 pad; f32 tmpf1; f32 tmpf2; @@ -279,18 +279,18 @@ void EnExItem_BowlPrize(EnExItem* this, GlobalContext* globalCtx) { if (this->type == EXITEM_BOMBCHUS_BOWLING) { sp3C = 220.0f; } - tmpf1 = globalCtx->view.at.x - globalCtx->view.eye.x; - tmpf2 = globalCtx->view.at.y - globalCtx->view.eye.y; - tmpf3 = globalCtx->view.at.z + sp3C - globalCtx->view.eye.z; + tmpf1 = play->view.at.x - play->view.eye.x; + tmpf2 = play->view.at.y - play->view.eye.y; + tmpf3 = play->view.at.z + sp3C - play->view.eye.z; tmpf4 = sqrtf(SQ(tmpf1) + SQ(tmpf2) + SQ(tmpf3)); tmpf5 = (tmpf1 / tmpf4) * 5.0f; tmpf6 = (tmpf2 / tmpf4) * 5.0f; tmpf7 = (tmpf3 / tmpf4) * 5.0f; - tmpf1 = globalCtx->view.eye.x + tmpf5 - this->actor.world.pos.x; - tmpf2 = globalCtx->view.eye.y + tmpf6 - this->actor.world.pos.y; - tmpf3 = globalCtx->view.eye.z + tmpf7 - this->actor.world.pos.z; + tmpf1 = play->view.eye.x + tmpf5 - this->actor.world.pos.x; + tmpf2 = play->view.eye.y + tmpf6 - this->actor.world.pos.y; + tmpf3 = play->view.eye.z + tmpf7 - this->actor.world.pos.z; this->actor.world.pos.x += (tmpf1 / tmpf4) * 5.0f; this->actor.world.pos.y += (tmpf2 / tmpf4) * 5.0f; @@ -310,19 +310,19 @@ void EnExItem_BowlPrize(EnExItem* this, GlobalContext* globalCtx) { } } -void EnExItem_SetupBowlCounter(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_SetupBowlCounter(EnExItem* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y = 0x4268; this->actionFunc = EnExItem_BowlCounter; } -void EnExItem_BowlCounter(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_BowlCounter(EnExItem* this, PlayState* play) { this->actor.shape.rot.y += 0x800; if (this->killItem) { Actor_Kill(&this->actor); } } -void EnExItem_ExitChest(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_ExitChest(EnExItem* this, PlayState* play) { this->actor.shape.rot.y += 0x1000; if (this->timer != 0) { if (this->timer == 1) { @@ -337,11 +337,11 @@ void EnExItem_ExitChest(EnExItem* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } -void EnExItem_FairyMagic(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_FairyMagic(EnExItem* this, PlayState* play) { this->actor.shape.rot.y += 0x800; } -void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_TargetPrizeApproach(EnExItem* this, PlayState* play) { f32 tmpf1; f32 tmpf2; f32 tmpf3; @@ -362,18 +362,18 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx) { if (this->timer != 0) { if (this->prizeRotateTimer != 0) { - tmpf1 = globalCtx->view.at.x - globalCtx->view.eye.x; - tmpf2 = globalCtx->view.at.y - 10.0f - globalCtx->view.eye.y; - tmpf3 = globalCtx->view.at.z + 10.0f - globalCtx->view.eye.z; + tmpf1 = play->view.at.x - play->view.eye.x; + tmpf2 = play->view.at.y - 10.0f - play->view.eye.y; + tmpf3 = play->view.at.z + 10.0f - play->view.eye.z; tmpf4 = sqrtf(SQ(tmpf1) + SQ(tmpf2) + SQ(tmpf3)); tmpf5 = (tmpf1 / tmpf4) * 5.0f; tmpf6 = (tmpf2 / tmpf4) * 5.0f; tmpf7 = (tmpf3 / tmpf4) * 5.0f; - tmpf1 = globalCtx->view.eye.x + tmpf5 - this->actor.world.pos.x; - tmpf2 = globalCtx->view.eye.y - 10.0f + tmpf6 - this->actor.world.pos.y; - tmpf3 = globalCtx->view.eye.z + 10.0f + tmpf7 - this->actor.world.pos.z; + tmpf1 = play->view.eye.x + tmpf5 - this->actor.world.pos.x; + tmpf2 = play->view.eye.y - 10.0f + tmpf6 - this->actor.world.pos.y; + tmpf3 = play->view.eye.z + 10.0f + tmpf7 - this->actor.world.pos.z; this->actor.world.pos.x += (tmpf1 / tmpf4) * 5.0f; this->actor.world.pos.y += (tmpf2 / tmpf4) * 5.0f; @@ -383,32 +383,32 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx) { s32 getItemId; this->actor.draw = NULL; - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->actor.parent = NULL; if (CUR_UPG_VALUE(UPG_BULLET_BAG) == 1) { getItemId = GI_BULLET_BAG_40; } else { getItemId = GI_BULLET_BAG_50; } - func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, getItemId, 2000.0f, 1000.0f); this->actionFunc = EnExItem_TargetPrizeGive; } } -void EnExItem_TargetPrizeGive(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_TargetPrizeGive(EnExItem* this, PlayState* play) { s32 getItemId; - if (Actor_HasParent(&this->actor, globalCtx)) { + 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; - func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, getItemId, 2000.0f, 1000.0f); } } -void EnExItem_TargetPrizeFinish(EnExItem* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnExItem_TargetPrizeFinish(EnExItem* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // "Successful completion" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); SET_ITEMGETINF(ITEMGETINF_1D); @@ -416,7 +416,7 @@ void EnExItem_TargetPrizeFinish(EnExItem* this, GlobalContext* globalCtx) { } } -void EnExItem_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnExItem_Update(Actor* thisx, PlayState* play) { s32 pad; EnExItem* this = (EnExItem*)thisx; @@ -429,10 +429,10 @@ void EnExItem_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->prizeRotateTimer != 0) { this->prizeRotateTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnExItem_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnExItem_Draw(Actor* thisx, PlayState* play) { s32 pad; EnExItem* this = (EnExItem*)thisx; s32 magicType; @@ -446,11 +446,11 @@ void EnExItem_Draw(Actor* thisx, GlobalContext* globalCtx) { case EXITEM_BOMBCHUS_COUNTER: case EXITEM_BOMBS_COUNTER: case EXITEM_BULLET_BAG: - EnExItem_DrawItems(this, globalCtx); + EnExItem_DrawItems(this, play); break; case EXITEM_HEART_PIECE_BOWLING: case EXITEM_HEART_PIECE_COUNTER: - EnExItem_DrawHeartPiece(this, globalCtx); + EnExItem_DrawHeartPiece(this, play); break; case EXITEM_PURPLE_RUPEE_BOWLING: case EXITEM_PURPLE_RUPEE_COUNTER: @@ -459,61 +459,61 @@ void EnExItem_Draw(Actor* thisx, GlobalContext* globalCtx) { case EXITEM_RED_RUPEE_CHEST: case EXITEM_13: case EXITEM_14: - EnExItem_DrawRupee(this, globalCtx); + EnExItem_DrawRupee(this, play); break; case EXITEM_SMALL_KEY_CHEST: - EnExItem_DrawKey(this, globalCtx, 0); + EnExItem_DrawKey(this, play, 0); break; case EXITEM_MAGIC_FIRE: case EXITEM_MAGIC_WIND: case EXITEM_MAGIC_DARK: magicType = this->type - EXITEM_MAGIC_FIRE; - EnExItem_DrawMagic(this, globalCtx, magicType); + EnExItem_DrawMagic(this, play, magicType); break; } } -void EnExItem_DrawItems(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_DrawItems(EnExItem* this, PlayState* play) { if (this->unk_17C != NULL) { - this->unk_17C(&this->actor, globalCtx, 0); + this->unk_17C(&this->actor, play, 0); } if (this) {} - func_8002ED80(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, this->giDrawId); + func_8002ED80(&this->actor, play, 0); + GetItem_Draw(play, this->giDrawId); } -void EnExItem_DrawHeartPiece(EnExItem* this, GlobalContext* globalCtx) { - func_8002ED80(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, GID_HEART_PIECE); +void EnExItem_DrawHeartPiece(EnExItem* this, PlayState* play) { + func_8002ED80(&this->actor, play, 0); + GetItem_Draw(play, GID_HEART_PIECE); } -void EnExItem_DrawMagic(EnExItem* this, GlobalContext* globalCtx, s16 magicIndex) { +void EnExItem_DrawMagic(EnExItem* this, PlayState* play, s16 magicIndex) { static s16 giDrawIds[] = { GID_DINS_FIRE, GID_FARORES_WIND, GID_NAYRUS_LOVE }; - func_8002ED80(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, giDrawIds[magicIndex]); + func_8002ED80(&this->actor, play, 0); + GetItem_Draw(play, giDrawIds[magicIndex]); } -void EnExItem_DrawKey(EnExItem* this, GlobalContext* globalCtx, s32 index) { +void EnExItem_DrawKey(EnExItem* this, PlayState* play, s32 index) { static void* keySegments[] = { gDropKeySmallTex }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ex_item.c", 880); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ex_item.c", 880); - func_8009460C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ex_item.c", 887), + func_8009460C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ex_item.c", 887), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(keySegments[index])); gSPDisplayList(POLY_OPA_DISP++, gItemDropDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ex_item.c", 893); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ex_item.c", 893); } -void EnExItem_DrawRupee(EnExItem* this, GlobalContext* globalCtx) { +void EnExItem_DrawRupee(EnExItem* this, PlayState* play) { if (this->unk_17C != NULL) { - this->unk_17C(&this->actor, globalCtx, 0); + this->unk_17C(&this->actor, play, 0); } if (this->unk_180 != NULL) { - this->unk_180(&this->actor, globalCtx, 0); + this->unk_180(&this->actor, play, 0); } - GetItem_Draw(globalCtx, this->giDrawId); + GetItem_Draw(play, this->giDrawId); } diff --git a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h index 5dff368592..b8e4d27126 100644 --- a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h +++ b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h @@ -6,8 +6,8 @@ struct EnExItem; -typedef void (*EnExItemActionFunc)(struct EnExItem* this, GlobalContext* globalCtx); -typedef void (*EnExItemLightFunc)(Actor*, GlobalContext*, s32); +typedef void (*EnExItemActionFunc)(struct EnExItem* this, PlayState* play); +typedef void (*EnExItemLightFunc)(Actor*, PlayState*, s32); typedef struct EnExItem { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c index 0aa5e02507..055be01d7f 100644 --- a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c +++ b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c @@ -5,19 +5,19 @@ #define FLAGS ACTOR_FLAG_4 -void EnExRuppy_Init(Actor* thisx, GlobalContext* globalCtx); -void EnExRuppy_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnExRuppy_Update(Actor* thisx, GlobalContext* globalCtx); -void EnExRuppy_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnExRuppy_Init(Actor* thisx, PlayState* play); +void EnExRuppy_Destroy(Actor* thisx, PlayState* play); +void EnExRuppy_Update(Actor* thisx, PlayState* play); +void EnExRuppy_Draw(Actor* thisx, PlayState* play); -void EnExRuppy_DropIntoWater(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_WaitToBlowUp(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_WaitAsCollectible(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_GalleryTarget(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_EnterWater(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_Sink(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_WaitInGame(EnExRuppy* this, GlobalContext* globalCtx); -void EnExRuppy_Kill(EnExRuppy* this, GlobalContext* globalCtx); +void EnExRuppy_DropIntoWater(EnExRuppy* this, PlayState* play); +void EnExRuppy_WaitToBlowUp(EnExRuppy* this, PlayState* play); +void EnExRuppy_WaitAsCollectible(EnExRuppy* this, PlayState* play); +void EnExRuppy_GalleryTarget(EnExRuppy* this, PlayState* play); +void EnExRuppy_EnterWater(EnExRuppy* this, PlayState* play); +void EnExRuppy_Sink(EnExRuppy* this, PlayState* play); +void EnExRuppy_WaitInGame(EnExRuppy* this, PlayState* play); +void EnExRuppy_Kill(EnExRuppy* this, PlayState* play); static s16 sEnExRuppyCollectibleTypes[] = { ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_RUPEE_ORANGE, ITEM00_RUPEE_PURPLE, @@ -40,7 +40,7 @@ const ActorInit En_Ex_Ruppy_InitVars = { (ActorFunc)EnExRuppy_Draw, }; -void EnExRuppy_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnExRuppy_Init(Actor* thisx, PlayState* play) { EnExRuppy* this = (EnExRuppy*)thisx; EnDivingGame* divingGame; f32 temp1; @@ -160,10 +160,10 @@ void EnExRuppy_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnExRuppy_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnExRuppy_Destroy(Actor* thisx, PlayState* play) { } -void EnExRuppy_SpawnSparkles(EnExRuppy* this, GlobalContext* globalCtx, s16 numSparkles, s32 movementType) { +void EnExRuppy_SpawnSparkles(EnExRuppy* this, PlayState* play, s16 numSparkles, s32 movementType) { static Vec3f velocities[] = { { 0.0f, 0.1f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; static Vec3f accelerations[] = { { 0.0f, 0.01f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; Vec3f pos; @@ -200,16 +200,16 @@ void EnExRuppy_SpawnSparkles(EnExRuppy* this, GlobalContext* globalCtx, s16 numS pos.x = (Rand_ZeroOne() - 0.5f) * 10.0f + this->actor.world.pos.x; pos.y = (Rand_ZeroOne() - 0.5f) * 10.0f + (this->actor.world.pos.y + this->unk_160 * 600.0f); pos.z = (Rand_ZeroOne() - 0.5f) * 10.0f + this->actor.world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, scale, life); + EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, scale, life); } } -void EnExRuppy_DropIntoWater(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_DropIntoWater(EnExRuppy* this, PlayState* play) { EnDivingGame* divingGame; this->actor.shape.rot.y += 0x7A8; Math_ApproachF(&this->actor.gravity, -2.0f, 0.3f, 1.0f); - EnExRuppy_SpawnSparkles(this, globalCtx, 2, 0); + EnExRuppy_SpawnSparkles(this, play, 2, 0); func_80078884(NA_SE_EV_RAINBOW_SHOWER - SFX_FLAG); divingGame = (EnDivingGame*)this->actor.parent; if ((divingGame != NULL) && (divingGame->actor.update != NULL) && @@ -223,7 +223,7 @@ void EnExRuppy_DropIntoWater(EnExRuppy* this, GlobalContext* globalCtx) { } } -void EnExRuppy_EnterWater(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_EnterWater(EnExRuppy* this, PlayState* play) { EnDivingGame* divingGame = (EnDivingGame*)this->actor.parent; f32 temp_f2; @@ -244,7 +244,7 @@ void EnExRuppy_EnterWater(EnExRuppy* this, GlobalContext* globalCtx) { } } -void EnExRuppy_Sink(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_Sink(EnExRuppy* this, PlayState* play) { EnDivingGame* divingGame; Vec3f pos; s32 pad; @@ -254,7 +254,7 @@ void EnExRuppy_Sink(EnExRuppy* this, GlobalContext* globalCtx) { pos.y += this->actor.yDistToWater; this->actor.velocity.y = -1.0f; this->actor.gravity = -0.2f; - EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 800); + EffectSsGSplash_Spawn(play, &pos, 0, 0, 0, 800); func_80078914(&this->actor.projectedPos, NA_SE_EV_BOMB_DROP_WATER); this->actionFunc = EnExRuppy_WaitInGame; } @@ -265,7 +265,7 @@ void EnExRuppy_Sink(EnExRuppy* this, GlobalContext* globalCtx) { } } -void EnExRuppy_WaitInGame(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_WaitInGame(EnExRuppy* this, PlayState* play) { EnDivingGame* divingGame; Vec3f D_80A0B388 = { 0.0f, 0.1f, 0.0f }; Vec3f D_80A0B394 = { 0.0f, 0.0f, 0.0f }; @@ -273,7 +273,7 @@ void EnExRuppy_WaitInGame(EnExRuppy* this, GlobalContext* globalCtx) { if (this->timer == 0) { this->timer = 10; - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); } if (this->actor.parent != NULL) { divingGame = (EnDivingGame*)this->actor.parent; @@ -294,7 +294,7 @@ void EnExRuppy_WaitInGame(EnExRuppy* this, GlobalContext* globalCtx) { } } -void EnExRuppy_Kill(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_Kill(EnExRuppy* this, PlayState* play) { this->invisible += 1; this->invisible &= 1; // Net effect is this->invisible = !this->invisible; if (this->timer == 0) { @@ -308,7 +308,7 @@ typedef struct { /* 0x226 */ s16 unk_226; } EnExRuppyParentActor; // Unclear what actor was intended to spawn this. -void EnExRuppy_WaitToBlowUp(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_WaitToBlowUp(EnExRuppy* this, PlayState* play) { EnExRuppyParentActor* parent; Vec3f accel = { 0.0f, 0.1f, 0.0f }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -336,25 +336,24 @@ void EnExRuppy_WaitToBlowUp(EnExRuppy* this, GlobalContext* globalCtx) { explosionScale = 20; explosionScaleStep = 6; } - EffectSsBomb2_SpawnLayered(globalCtx, &this->actor.world.pos, &velocity, &accel, explosionScale, - explosionScaleStep); - func_8002F71C(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f); + EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &velocity, &accel, explosionScale, explosionScaleStep); + func_8002F71C(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f); Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); Actor_Kill(&this->actor); } } -void EnExRuppy_WaitAsCollectible(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_WaitAsCollectible(EnExRuppy* this, PlayState* play) { f32 localConst = 30.0f; if (this->actor.xyzDistToPlayerSq < SQ(localConst)) { func_80078884(NA_SE_SY_GET_RUPY); - Item_DropCollectible(globalCtx, &this->actor.world.pos, (sEnExRuppyCollectibleTypes[this->colorIdx] | 0x8000)); + Item_DropCollectible(play, &this->actor.world.pos, (sEnExRuppyCollectibleTypes[this->colorIdx] | 0x8000)); Actor_Kill(&this->actor); } } -void EnExRuppy_GalleryTarget(EnExRuppy* this, GlobalContext* globalCtx) { +void EnExRuppy_GalleryTarget(EnExRuppy* this, PlayState* play) { if (this->galleryFlag) { Math_ApproachF(&this->actor.shape.yOffset, 700.0f, 0.5f, 200.0f); } else { @@ -362,20 +361,20 @@ void EnExRuppy_GalleryTarget(EnExRuppy* this, GlobalContext* globalCtx) { } } -void EnExRuppy_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnExRuppy_Update(Actor* thisx, PlayState* play) { EnExRuppy* this = (EnExRuppy*)thisx; this->actor.shape.rot.y += 1960; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->timer != 0) { this->timer--; } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } -void EnExRuppy_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnExRuppy_Draw(Actor* thisx, PlayState* play) { static void* rupeeTextures[] = { gRupeeGreenTex, gRupeeBlueTex, gRupeeRedTex, gRupeePinkTex, gRupeeOrangeTex, }; @@ -383,15 +382,15 @@ void EnExRuppy_Draw(Actor* thisx, GlobalContext* globalCtx) { EnExRuppy* this = (EnExRuppy*)thisx; if (!this->invisible) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ex_ruppy.c", 774); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ex_ruppy.c", 774); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(thisx, globalCtx, 0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ex_ruppy.c", 780), + func_80093D18(play->state.gfxCtx); + func_8002EBCC(thisx, play, 0); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ex_ruppy.c", 780), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(rupeeTextures[this->colorIdx])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ex_ruppy.c", 784); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ex_ruppy.c", 784); } } 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 7c23851282..33dcca4447 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 @@ -6,7 +6,7 @@ struct EnExRuppy; -typedef void (*EnExRuppyActionFunc)(struct EnExRuppy*, GlobalContext*); +typedef void (*EnExRuppyActionFunc)(struct EnExRuppy*, PlayState*); typedef struct EnExRuppy { /* 0x0000 */ Actor actor; 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 74c8badf32..7112f965d8 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -13,22 +13,22 @@ #define FLG_COREDEAD (0x4000) #define FLG_COREDONE (0x8000) -void EnFd_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFd_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFd_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnFd_Run(EnFd* this, GlobalContext* globalCtx); -void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx); -void EnFd_Reappear(EnFd* this, GlobalContext* globalCtx); -void EnFd_SpinAndGrow(EnFd* this, GlobalContext* globalCtx); -void EnFd_JumpToGround(EnFd* this, GlobalContext* globalCtx); -void EnFd_WaitForCore(EnFd* this, GlobalContext* globalCtx); +void EnFd_Init(Actor* thisx, PlayState* play); +void EnFd_Destroy(Actor* thisx, PlayState* play); +void EnFd_Update(Actor* thisx, PlayState* play); +void EnFd_Draw(Actor* thisx, PlayState* play); +void EnFd_Run(EnFd* this, PlayState* play); +void EnFd_SpinAndSpawnFire(EnFd* this, PlayState* play); +void EnFd_Reappear(EnFd* this, PlayState* play); +void EnFd_SpinAndGrow(EnFd* this, PlayState* play); +void EnFd_JumpToGround(EnFd* this, PlayState* play); +void EnFd_WaitForCore(EnFd* this, PlayState* play); void EnFd_UpdateEffectsFlames(EnFd* this); void EnFd_UpdateEffectsDots(EnFd* this); void EnFd_SpawnEffect(EnFd*, u8, Vec3f*, Vec3f*, Vec3f*, u8, f32, f32); -void EnFd_DrawEffectsDots(EnFd* this, GlobalContext* globalCtx); -void EnFd_DrawEffectsFlames(EnFd* this, GlobalContext* globalCtx); -void EnFd_Land(EnFd* this, GlobalContext* globalCtx); +void EnFd_DrawEffectsDots(EnFd* this, PlayState* play); +void EnFd_DrawEffectsFlames(EnFd* this, PlayState* play); +void EnFd_Land(EnFd* this, PlayState* play); const ActorInit En_Fd_InitVars = { ACTOR_EN_FD, @@ -208,12 +208,12 @@ static AnimationInfo sAnimationInfo[] = { { &gFlareDancerTwirlAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -10.0f }, }; -s32 EnFd_SpawnCore(EnFd* this, GlobalContext* globalCtx) { +s32 EnFd_SpawnCore(EnFd* this, PlayState* play) { if (this->invincibilityTimer != 0) { return false; } - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FW, this->corePos.x, this->corePos.y, + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FW, this->corePos.x, this->corePos.y, this->corePos.z, 0, this->actor.shape.rot.y, 0, this->runDir) == NULL) { return false; } @@ -225,7 +225,7 @@ s32 EnFd_SpawnCore(EnFd* this, GlobalContext* globalCtx) { } if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { - func_8002DE04(globalCtx, &this->actor, this->actor.child); + func_8002DE04(play, &this->actor, this->actor.child); } this->coreActive = true; @@ -233,17 +233,17 @@ s32 EnFd_SpawnCore(EnFd* this, GlobalContext* globalCtx) { return true; } -void EnFd_SpawnChildFire(EnFd* this, GlobalContext* globalCtx, s16 fireCnt, s16 color) { +void EnFd_SpawnChildFire(EnFd* this, PlayState* play, s16 fireCnt, s16 color) { s32 i; for (i = 0; i < fireCnt; i++) { s16 angle = (s16)((((i * 360.0f) / fireCnt) * (0x10000 / 360.0f))) + this->actor.yawTowardsPlayer; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FD_FIRE, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FD_FIRE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, angle, 0, (color << 0xF) | i); } } -void EnFd_SpawnDot(EnFd* this, GlobalContext* globalCtx) { +void EnFd_SpawnDot(EnFd* this, PlayState* play) { Vec3f pos = { 0.0f, 0.0f, 0.0f }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -262,23 +262,22 @@ void EnFd_SpawnDot(EnFd* this, GlobalContext* globalCtx) { /** * Checks to see if the hammer effect is active, and if it should be applied */ -s32 EnFd_CheckHammer(EnFd* this, GlobalContext* globalCtx) { +s32 EnFd_CheckHammer(EnFd* this, PlayState* play) { if (this->actionFunc == EnFd_Reappear || this->actionFunc == EnFd_SpinAndGrow || this->actionFunc == EnFd_JumpToGround || this->actionFunc == EnFd_WaitForCore) { return false; - } else if (globalCtx->actorCtx.unk_02 != 0 && this->actor.xzDistToPlayer < 300.0f && - this->actor.yDistToPlayer < 60.0f) { + } else if (play->actorCtx.unk_02 != 0 && this->actor.xzDistToPlayer < 300.0f && this->actor.yDistToPlayer < 60.0f) { return true; } else { return false; } } -s32 EnFd_ColliderCheck(EnFd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnFd_ColliderCheck(EnFd* this, PlayState* play) { + Player* player = GET_PLAYER(play); ColliderInfo* info; - if (this->collider.base.acFlags & AC_HIT || EnFd_CheckHammer(this, globalCtx)) { + if (this->collider.base.acFlags & AC_HIT || EnFd_CheckHammer(this, play)) { this->collider.base.acFlags &= ~AC_HIT; if (this->invincibilityTimer != 0) { return false; @@ -288,13 +287,13 @@ s32 EnFd_ColliderCheck(EnFd* this, GlobalContext* globalCtx) { return false; } - if (!EnFd_SpawnCore(this, globalCtx)) { + if (!EnFd_SpawnCore(this, play)) { return false; } this->invincibilityTimer = 30; this->actor.flags &= ~ACTOR_FLAG_0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_DAMAGE); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); return true; } else if (DECR(this->attackTimer) == 0 && this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; @@ -307,7 +306,7 @@ s32 EnFd_ColliderCheck(EnFd* this, GlobalContext* globalCtx) { } this->attackTimer = 30; Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); - func_8002F71C(globalCtx, &this->actor, this->actor.speedXZ + 2.0f, this->actor.yawTowardsPlayer, 6.0f); + func_8002F71C(play, &this->actor, this->actor.speedXZ + 2.0f, this->actor.yawTowardsPlayer, 6.0f); } return false; } @@ -317,7 +316,7 @@ s32 EnFd_ColliderCheck(EnFd* this, GlobalContext* globalCtx) { * `actor` must be within 400 units of `this`, `actor` must be within +/- 40 degrees facing angle * towards `actor`, and there must not be a collision poly between `this` and `actor` */ -s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, GlobalContext* globalCtx) { +s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, PlayState* play) { CollisionPoly* colPoly; s32 bgId; Vec3f colPoint; @@ -336,16 +335,16 @@ s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, GlobalContext* globalCtx) { } // check to see if the line between `this` and `actor` does not intersect a collision poly - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &actor->world.pos, &colPoint, &colPoly, - true, false, false, true, &bgId)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &actor->world.pos, &colPoint, &colPoly, true, + false, false, true, &bgId)) { return false; } return true; } -Actor* EnFd_FindBomb(EnFd* this, GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; +Actor* EnFd_FindBomb(EnFd* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (actor != NULL) { if (actor->params != 0 || actor->parent != NULL) { @@ -358,7 +357,7 @@ Actor* EnFd_FindBomb(EnFd* this, GlobalContext* globalCtx) { continue; } - if (EnFd_CanSeeActor(this, actor, globalCtx) != 1) { + if (EnFd_CanSeeActor(this, actor, play) != 1) { actor = actor->next; continue; } @@ -368,9 +367,9 @@ Actor* EnFd_FindBomb(EnFd* this, GlobalContext* globalCtx) { return NULL; } -Actor* EnFd_FindPotentialTheat(EnFd* this, GlobalContext* globalCtx) { +Actor* EnFd_FindPotentialTheat(EnFd* this, PlayState* play) { Player* player; - Actor* bomb = EnFd_FindBomb(this, globalCtx); + Actor* bomb = EnFd_FindBomb(this, play); if (bomb != NULL) { return bomb; @@ -380,8 +379,8 @@ Actor* EnFd_FindPotentialTheat(EnFd* this, GlobalContext* globalCtx) { return NULL; } - player = GET_PLAYER(globalCtx); - if (!EnFd_CanSeeActor(this, &player->actor, globalCtx)) { + player = GET_PLAYER(play); + if (!EnFd_CanSeeActor(this, &player->actor, play)) { return NULL; } @@ -405,7 +404,7 @@ Vec3f* EnFd_GetPosAdjAroundCircle(Vec3f* dst, EnFd* this, f32 radius, s16 dir) { return dst; } -s32 EnFd_ShouldStopRunning(EnFd* this, GlobalContext* globalCtx, f32 radius, s16* runDir) { +s32 EnFd_ShouldStopRunning(EnFd* this, PlayState* play, f32 radius, s16* runDir) { CollisionPoly* poly; s32 bgId; Vec3f colPoint; @@ -419,8 +418,8 @@ s32 EnFd_ShouldStopRunning(EnFd* this, GlobalContext* globalCtx, f32 radius, s16 pos.y = this->actor.world.pos.y; pos.z += this->actor.world.pos.z; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &pos, &colPoint, &poly, true, false, false, - true, &bgId)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &pos, &colPoint, &poly, true, false, false, true, + &bgId)) { *runDir = -*runDir; return true; } @@ -435,7 +434,7 @@ s32 EnFd_ShouldStopRunning(EnFd* this, GlobalContext* globalCtx, f32 radius, s16 return true; } -void EnFd_Fade(EnFd* this, GlobalContext* globalCtx) { +void EnFd_Fade(EnFd* this, PlayState* play) { if (this->invincibilityTimer != 0) { Math_SmoothStepToF(&this->fadeAlpha, 0.0f, 0.3f, 10.0f, 0.0f); this->actor.shape.shadowAlpha = this->fadeAlpha; @@ -448,13 +447,13 @@ void EnFd_Fade(EnFd* this, GlobalContext* globalCtx) { } } -void EnFd_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFd_Init(Actor* thisx, PlayState* play) { EnFd* this = (EnFd*)thisx; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFlareDancerSkel, NULL, this->jointTable, this->morphTable, 27); + SkelAnime_InitFlex(play, &this->skelAnime, &gFlareDancerSkel, NULL, this->jointTable, this->morphTable, 27); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 32.0f); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colSphs); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colSphs); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0xF), &sColChkInit); this->actor.flags &= ~ACTOR_FLAG_0; this->actor.flags |= ACTOR_FLAG_24; @@ -466,13 +465,13 @@ void EnFd_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnFd_Reappear; } -void EnFd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFd_Destroy(Actor* thisx, PlayState* play) { EnFd* this = (EnFd*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void EnFd_Reappear(EnFd* this, GlobalContext* globalCtx) { +void EnFd_Reappear(EnFd* this, PlayState* play) { this->actor.world.pos = this->actor.home.pos; this->actor.params = 0; this->actor.shape.shadowAlpha = 0xFF; @@ -484,7 +483,7 @@ void EnFd_Reappear(EnFd* this, GlobalContext* globalCtx) { this->actionFunc = EnFd_SpinAndGrow; } -void EnFd_SpinAndGrow(EnFd* this, GlobalContext* globalCtx) { +void EnFd_SpinAndGrow(EnFd* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->actor.velocity.y = 6.0f; this->actor.scale.y = 0.01f; @@ -500,7 +499,7 @@ void EnFd_SpinAndGrow(EnFd* this, GlobalContext* globalCtx) { } } -void EnFd_JumpToGround(EnFd* this, GlobalContext* globalCtx) { +void EnFd_JumpToGround(EnFd* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(this->actor.velocity.y > 0.0f)) { this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; @@ -510,7 +509,7 @@ void EnFd_JumpToGround(EnFd* this, GlobalContext* globalCtx) { } } -void EnFd_Land(EnFd* this, GlobalContext* globalCtx) { +void EnFd_Land(EnFd* this, PlayState* play) { Vec3f adjPos; Math_SmoothStepToF(&this->skelAnime.playSpeed, 1.0f, 0.1f, 1.0f, 0.0f); @@ -524,7 +523,7 @@ void EnFd_Land(EnFd* this, GlobalContext* globalCtx) { } } -void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) { +void EnFd_SpinAndSpawnFire(EnFd* this, PlayState* play) { f32 deceleration; f32 tgtSpeed; f32 rotSpeed; @@ -540,10 +539,10 @@ void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) { if (this->spinTimer == 30 && this->invincibilityTimer == 0) { if (this->actor.xzDistToPlayer > 160.0f) { // orange flames - EnFd_SpawnChildFire(this, globalCtx, 8, 0); + EnFd_SpawnChildFire(this, play, 8, 0); } else { // blue flames - EnFd_SpawnChildFire(this, globalCtx, 8, 1); + EnFd_SpawnChildFire(this, play, 8, 1); } } } else { @@ -565,7 +564,7 @@ void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) { if (this->actor.shape.rot.y == this->actor.world.rot.y) { this->initYawToInitPos = Math_Vec3f_Yaw(&this->actor.home.pos, &this->actor.world.pos); this->curYawToInitPos = this->runDir < 0 ? 0xFFFF : 0; - this->circlesToComplete = (globalCtx->state.frames & 7) + 2; + this->circlesToComplete = (play->state.frames & 7) + 2; this->spinTimer = Rand_S16Offset(30, 120); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_3); this->actionFunc = EnFd_Run; @@ -578,13 +577,13 @@ void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) { * the radius being the distance from the initial position to the nearest * threat (bomb or player). */ -void EnFd_Run(EnFd* this, GlobalContext* globalCtx) { +void EnFd_Run(EnFd* this, PlayState* play) { Actor* potentialThreat; s16 yawToYawTarget; f32 runRadiusTarget; Vec3f adjPos; - if (EnFd_ShouldStopRunning(this, globalCtx, this->runRadius, &this->runDir)) { + if (EnFd_ShouldStopRunning(this, play, this->runRadius, &this->runDir)) { if (this->invincibilityTimer == 0) { this->actor.world.rot.y ^= 0x8000; this->actor.velocity.y = 6.0f; @@ -611,7 +610,7 @@ void EnFd_Run(EnFd* this, GlobalContext* globalCtx) { // If there is a bomb out, or if the player exists, set radius to // the distance to that threat, otherwise default to 200. - potentialThreat = EnFd_FindPotentialTheat(this, globalCtx); + potentialThreat = EnFd_FindPotentialTheat(this, play); if ((potentialThreat != NULL) && (this->invincibilityTimer == 0)) { runRadiusTarget = Math_Vec3f_DistXYZ(&this->actor.home.pos, &potentialThreat->world.pos); } else { @@ -633,7 +632,7 @@ void EnFd_Run(EnFd* this, GlobalContext* globalCtx) { * It will set FLG_COREDONE when the core has returned to `this`'s initial * position, and FLG_COREDEAD when there is no health left */ -void EnFd_WaitForCore(EnFd* this, GlobalContext* globalCtx) { +void EnFd_WaitForCore(EnFd* this, PlayState* play) { if (this->spinTimer != 0) { this->spinTimer--; if (this->spinTimer == 0) { @@ -647,7 +646,7 @@ void EnFd_WaitForCore(EnFd* this, GlobalContext* globalCtx) { } } -void EnFd_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFd_Update(Actor* thisx, PlayState* play) { EnFd* this = (EnFd*)thisx; s32 pad; @@ -658,42 +657,42 @@ void EnFd_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actionFunc != EnFd_Reappear) { SkelAnime_Update(&this->skelAnime); - EnFd_SpawnDot(this, globalCtx); + EnFd_SpawnDot(this, play); } if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { // has been hookshoted - if (EnFd_SpawnCore(this, globalCtx)) { + if (EnFd_SpawnCore(this, play)) { this->actor.flags &= ~ACTOR_FLAG_0; this->invincibilityTimer = 30; Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_DAMAGE); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { this->actor.flags &= ~ACTOR_FLAG_13; } } else if (this->actionFunc != EnFd_WaitForCore) { - EnFd_ColliderCheck(this, globalCtx); + EnFd_ColliderCheck(this, play); } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - EnFd_Fade(this, globalCtx); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + EnFd_Fade(this, play); + this->actionFunc(this, play); EnFd_UpdateEffectsDots(this); EnFd_UpdateEffectsFlames(this); if (this->actionFunc != EnFd_Reappear && this->actionFunc != EnFd_SpinAndGrow && this->actionFunc != EnFd_WaitForCore) { if (this->attackTimer == 0 && this->invincibilityTimer == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->actionFunc == EnFd_Run) || (this->actionFunc == EnFd_SpinAndSpawnFire)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -s32 EnFd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnFd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfxP) { EnFd* this = (EnFd*)thisx; @@ -709,7 +708,7 @@ s32 EnFd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnFd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { +void EnFd_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { EnFd* this = (EnFd*)thisx; Vec3f unused0 = { 6800.0f, 0.0f, 0.0f }; Vec3f unused1 = { 6800.0f, 0.0f, 0.0f }; @@ -730,7 +729,7 @@ void EnFd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec if (limbIndex == 3 || limbIndex == 6 || limbIndex == 7 || limbIndex == 10 || limbIndex == 14 || limbIndex == 15 || limbIndex == 17 || limbIndex == 18 || limbIndex == 20 || limbIndex == 22 || limbIndex == 23 || limbIndex == 24 || limbIndex == 25 || limbIndex == 26) { - if ((globalCtx->state.frames % 2) != 0) { + if ((play->state.frames % 2) != 0) { for (i = 0; i < 1; i++) { Matrix_MultVec3f(&initialPos, &pos); pos.x += (Rand_ZeroOne() - 0.5f) * 20.0f; @@ -747,7 +746,7 @@ void EnFd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Collider_UpdateSpheres(limbIndex, &this->collider); } -void EnFd_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFd_Draw(Actor* thisx, PlayState* play) { EnFd* this = (EnFd*)thisx; s32 clampedHealth; Color_RGBA8 primColors[] = { @@ -763,33 +762,32 @@ void EnFd_Draw(Actor* thisx, GlobalContext* globalCtx) { u32 frames; s32 pad; - frames = globalCtx->state.frames; + frames = play->state.frames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 1751); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fd.c", 1751); Matrix_Push(); - EnFd_DrawEffectsDots(this, globalCtx); - EnFd_DrawEffectsFlames(this, globalCtx); + EnFd_DrawEffectsDots(this, play); + EnFd_DrawEffectsFlames(this, play); Matrix_Pop(); if (this->actionFunc != EnFd_Reappear && !(this->fadeAlpha < 0.9f)) { if (1) {} - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); clampedHealth = CLAMP(thisx->colChkInfo.health - 1, 0, 23); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, primColors[clampedHealth / 8].r, primColors[clampedHealth / 8].g, primColors[clampedHealth / 8].b, (u8)this->fadeAlpha); gDPSetEnvColor(POLY_XLU_DISP++, envColors[clampedHealth / 8].r, envColors[clampedHealth / 8].g, envColors[clampedHealth / 8].b, (u8)this->fadeAlpha); - gSPSegment( - POLY_XLU_DISP++, 0x8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, 0xFF - (u8)(frames * 6), 8, 0x40)); + gSPSegment(POLY_XLU_DISP++, 0x8, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, 0xFF - (u8)(frames * 6), 8, 0x40)); gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x9, D_80116280); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnFd_OverrideLimbDraw, EnFd_PostLimbDraw, this, - POLY_XLU_DISP); + POLY_XLU_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnFd_OverrideLimbDraw, EnFd_PostLimbDraw, this, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 1822); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fd.c", 1822); } void EnFd_SpawnEffect(EnFd* this, u8 type, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 timer, f32 scale, @@ -872,7 +870,7 @@ void EnFd_UpdateEffectsDots(EnFd* this) { } } -void EnFd_DrawEffectsFlames(EnFd* this, GlobalContext* globalCtx) { +void EnFd_DrawEffectsFlames(EnFd* this, PlayState* play) { static void* dustTextures[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; @@ -881,10 +879,10 @@ void EnFd_DrawEffectsFlames(EnFd* this, GlobalContext* globalCtx) { s16 idx; EnFdEffect* eff = this->effects; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 1969); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fd.c", 1969); materialFlag = false; if (1) {} - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < EN_FD_EFFECT_COUNT; i++, eff++) { if (eff->type == FD_EFFECT_FLAME) { if (!materialFlag) { @@ -896,32 +894,32 @@ void EnFd_DrawEffectsFlames(EnFd* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, (u8)((this->fadeAlpha / 255.0f) * 255)); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fd.c", 2006), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fd.c", 2006), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); idx = eff->timer * (8.0f / eff->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerSquareParticleDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 2020); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fd.c", 2020); } -void EnFd_DrawEffectsDots(EnFd* this, GlobalContext* globalCtx) { +void EnFd_DrawEffectsDots(EnFd* this, PlayState* play) { s16 i; s16 materialFlag; EnFdEffect* eff = this->effects; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 2034); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fd.c", 2034); materialFlag = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < EN_FD_EFFECT_COUNT; i++, eff++) { if (eff->type == FD_EFFECT_DOT) { if (!materialFlag) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_79F8); materialFlag = true; } @@ -930,13 +928,13 @@ void EnFd_DrawEffectsDots(EnFd* this, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); if (1) {} Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fd.c", 2064), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fd.c", 2064), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerTriangleParticleDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 2071); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fd.c", 2071); } diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.h b/src/overlays/actors/ovl_En_Fd/z_en_fd.h index cde714a400..8f7f831709 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.h +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.h @@ -6,7 +6,7 @@ struct EnFd; -typedef void (*EnFdActionFunc)(struct EnFd* this, GlobalContext* globalCtx); +typedef void (*EnFdActionFunc)(struct EnFd* this, PlayState* play); typedef enum { FD_EFFECT_NONE, diff --git a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c index 332e942145..260d399843 100644 --- a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c +++ b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c @@ -3,14 +3,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnFdFire_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFdFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFdFire_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnFdFire_Disappear(EnFdFire* this, GlobalContext* globalCtx); -void func_80A0E70C(EnFdFire* this, GlobalContext* globalCtx); -void EnFdFire_DanceTowardsPlayer(EnFdFire* this, GlobalContext* globalCtx); -void EnFdFire_WaitToDie(EnFdFire* this, GlobalContext* globalCtx); +void EnFdFire_Init(Actor* thisx, PlayState* play); +void EnFdFire_Destroy(Actor* thisx, PlayState* play); +void EnFdFire_Update(Actor* thisx, PlayState* play); +void EnFdFire_Draw(Actor* thisx, PlayState* play); +void EnFdFire_Disappear(EnFdFire* this, PlayState* play); +void func_80A0E70C(EnFdFire* this, PlayState* play); +void EnFdFire_DanceTowardsPlayer(EnFdFire* this, PlayState* play); +void EnFdFire_WaitToDie(EnFdFire* this, PlayState* play); const ActorInit En_Fd_Fire_InitVars = { ACTOR_EN_FD_FIRE, @@ -102,7 +102,7 @@ void EnFdFire_UpdatePos(EnFdFire* this, Vec3f* targetPos) { } } -s32 EnFdFire_CheckCollider(EnFdFire* this, GlobalContext* globalCtx) { +s32 EnFdFire_CheckCollider(EnFdFire* this, PlayState* play) { if (this->actionFunc == EnFdFire_Disappear) { return false; } @@ -119,14 +119,14 @@ s32 EnFdFire_CheckCollider(EnFdFire* this, GlobalContext* globalCtx) { return false; } -void EnFdFire_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFdFire_Init(Actor* thisx, PlayState* play) { EnFdFire* this = (EnFdFire*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInit); this->actor.flags &= ~ACTOR_FLAG_0; this->actor.gravity = -0.6f; @@ -138,13 +138,13 @@ void EnFdFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80A0E70C; } -void EnFdFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFdFire_Destroy(Actor* thisx, PlayState* play) { EnFdFire* this = (EnFdFire*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80A0E70C(EnFdFire* this, GlobalContext* globalCtx) { +void func_80A0E70C(EnFdFire* this, PlayState* play) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f targetPos = this->actor.parent->world.pos; @@ -165,21 +165,21 @@ void func_80A0E70C(EnFdFire* this, GlobalContext* globalCtx) { } } -void EnFdFire_WaitToDie(EnFdFire* this, GlobalContext* globalCtx) { +void EnFdFire_WaitToDie(EnFdFire* this, PlayState* play) { if (DECR(this->deathTimer) == 0) { this->actionFunc = EnFdFire_Disappear; } } -void EnFdFire_DanceTowardsPlayer(EnFdFire* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFdFire_DanceTowardsPlayer(EnFdFire* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 angles[] = { 0.0f, 210.0f, 60.0f, 270.0f, 120.0f, 330.0f, 180.0f, 30.0f, 240.0f, 90.0f, 300.0f, 150.0f, }; Vec3f pos; s16 idx; - idx = ((globalCtx->state.frames / 10) + (this->actor.params & 0x7FFF)) % ARRAY_COUNT(angles); + idx = ((play->state.frames / 10) + (this->actor.params & 0x7FFF)) % ARRAY_COUNT(angles); pos = player->actor.world.pos; pos.x += 120.0f * sinf(angles[idx]); pos.z += 120.0f * cosf(angles[idx]); @@ -196,7 +196,7 @@ void EnFdFire_DanceTowardsPlayer(EnFdFire* this, GlobalContext* globalCtx) { } } -void EnFdFire_Disappear(EnFdFire* this, GlobalContext* globalCtx) { +void EnFdFire_Disappear(EnFdFire* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.6f, 9.0f, 0.0f); func_8002D868(&this->actor); Math_SmoothStepToF(&this->scale, 0.0f, 0.3f, 0.1f, 0.0f); @@ -207,28 +207,28 @@ void EnFdFire_Disappear(EnFdFire* this, GlobalContext* globalCtx) { } } -void EnFdFire_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFdFire_Update(Actor* thisx, PlayState* play) { EnFdFire* this = (EnFdFire*)thisx; s32 pad; if (this->actionFunc != EnFdFire_Disappear) { - if ((this->actor.parent->update == NULL) || EnFdFire_CheckCollider(this, globalCtx)) { + if ((this->actor.parent->update == NULL) || EnFdFire_CheckCollider(this, play)) { this->actionFunc = EnFdFire_Disappear; } } func_8002D7EC(&this->actor); - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 12.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if (this->actionFunc != EnFdFire_Disappear) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFdFire_Draw(Actor* thisx, PlayState* play) { Color_RGBA8 primColors[] = { { 255, 255, 0, 255 }, { 255, 255, 255, 255 }, @@ -246,17 +246,17 @@ void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 sp84; f32 sp80; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd_fire.c", 572); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fd_fire.c", 572); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - sp8E = Math_Vec3f_Yaw(&scale, &this->actor.velocity) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); + sp8E = Math_Vec3f_Yaw(&scale, &this->actor.velocity) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); sp84 = fabsf(Math_CosS(sp8E)); sp88 = Math_SinS(sp8E); sp80 = Math_Vec3f_DistXZ(&scale, &this->actor.velocity) / 1.5f; if (1) {} if (1) {} if (1) {} - Matrix_RotateY(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000)), MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000)), MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD((sp88 * -10.0f) * sp80), MTXMODE_APPLY); scale.x = scale.y = scale.z = this->scale * 0.001f; Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); @@ -265,12 +265,12 @@ void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx) { sp84 = 0.1f; } Matrix_Scale(1.0f, sp84, 1.0f / sp84, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fd_fire.c", 623), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fd_fire.c", 623), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(POLY_XLU_DISP++, 0x8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - globalCtx->state.frames * this->tile2Y, 0x20, 0x80)); + func_80093D84(play->state.gfxCtx); + gSPSegment( + POLY_XLU_DISP++, 0x8, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, play->state.frames * this->tile2Y, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, primColors[((this->actor.params & 0x8000) >> 0xF)].r, primColors[((this->actor.params & 0x8000) >> 0xF)].g, primColors[((this->actor.params & 0x8000) >> 0xF)].b, @@ -282,5 +282,5 @@ void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fd_fire.c", 672); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fd_fire.c", 672); } diff --git a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h index 7de1c53fec..414fdf997a 100644 --- a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h +++ b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h @@ -6,7 +6,7 @@ struct EnFdFire; -typedef void (*EnFdFireActionFunc)(struct EnFdFire* this, GlobalContext* globalCtx); +typedef void (*EnFdFireActionFunc)(struct EnFdFire* this, PlayState* play); typedef struct EnFdFire { /* 0x0000 */ Actor actor; 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 8e9cc11c78..4877df839d 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 @@ -31,18 +31,18 @@ typedef enum { /* 2 */ BALL_IMPACT } BallKillMode; -void EnFhgFire_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFhgFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFhgFire_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFhgFire_Init(Actor* thisx, PlayState* play); +void EnFhgFire_Destroy(Actor* thisx, PlayState* play); +void EnFhgFire_Update(Actor* thisx, PlayState* play); +void EnFhgFire_Draw(Actor* thisx, PlayState* play); -void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_LightningTrail(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_LightningShock(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_LightningBurst(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_SpearLight(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx); -void EnFhgFire_PhantomWarp(EnFhgFire* this, GlobalContext* globalCtx); +void EnFhgFire_LightningStrike(EnFhgFire* this, PlayState* play); +void EnFhgFire_LightningTrail(EnFhgFire* this, PlayState* play); +void EnFhgFire_LightningShock(EnFhgFire* this, PlayState* play); +void EnFhgFire_LightningBurst(EnFhgFire* this, PlayState* play); +void EnFhgFire_SpearLight(EnFhgFire* this, PlayState* play); +void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play); +void EnFhgFire_PhantomWarp(EnFhgFire* this, PlayState* play); const ActorInit En_Fhg_Fire_InitVars = { 0, @@ -80,16 +80,16 @@ void EnFhgFire_SetUpdate(EnFhgFire* this, EnFhgFireUpdateFunc updateFunc) { this->updateFunc = updateFunc; } -void EnFhgFire_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFhgFire_Init(Actor* thisx, PlayState* play) { s32 pad; EnFhgFire* this = (EnFhgFire*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); if ((this->actor.params == FHGFIRE_LIGHTNING_SHOCK) || (this->actor.params == FHGFIRE_LIGHTNING_BURST) || (this->actor.params == FHGFIRE_ENERGY_BALL)) { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } this->fwork[FHGFIRE_ALPHA] = 200.0f; Actor_SetScale(&this->actor, 0.0f); @@ -156,28 +156,28 @@ void EnFhgFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.radius = 40; this->collider.dim.height = 50; this->collider.dim.yShift = -25; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 255, 255); } } -void EnFhgFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFhgFire_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnFhgFire* this = (EnFhgFire*)thisx; if ((this->actor.params == FHGFIRE_LIGHTNING_SHOCK) || (this->actor.params == FHGFIRE_LIGHTNING_BURST) || (this->actor.params == FHGFIRE_ENERGY_BALL)) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } if (this->actor.params == FHGFIRE_ENERGY_BALL) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } } -void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); +void EnFhgFire_LightningStrike(EnFhgFire* this, PlayState* play) { + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); s16 i; switch (this->work[FHGFIRE_FIRE_MODE]) { @@ -196,8 +196,8 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { this->work[FHGFIRE_TIMER] = 37; this->actor.world.pos.y -= 200.0f; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 500, 0, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 500, 0, 0, FHGFIRE_LIGHTNING_BURST); { Vec3f sp7C; @@ -208,11 +208,11 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { sp7C.y = Rand_ZeroFloat(5.0f) + 3.0f; sp7C.z = Rand_CenteredFloat(30.f); sp70.y = -0.2f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &sp7C, &sp70, + EffectSsFhgFlash_SpawnLightBall(play, &this->actor.world.pos, &sp7C, &sp70, (s16)(Rand_ZeroOne() * 100.0f) + 240, FHGFLASH_LIGHTBALL_GREEN); } } - func_80033E88(&this->actor, globalCtx, 4, 10); + func_80033E88(&this->actor, play, 4, 10); } break; @@ -225,15 +225,15 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { s16 randY = (Rand_ZeroOne() < 0.5f) ? 0x1000 : 0; for (i = 0; i < 8; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, - (i * 0x2000) + randY, 0x4000, FHGFIRE_LIGHTNING_TRAIL + i); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, (i * 0x2000) + randY, + 0x4000, FHGFIRE_LIGHTNING_TRAIL + i); } for (i = 0; i < 8; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, - (i * 0x2000) + randY, 0, FHGFIRE_LIGHTNING_SHOCK); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, (i * 0x2000) + randY, 0, + FHGFIRE_LIGHTNING_SHOCK); } } @@ -245,7 +245,7 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->fwork[FHGFIRE_SCALE]); } -void EnFhgFire_LightningTrail(EnFhgFire* this, GlobalContext* globalCtx) { +void EnFhgFire_LightningTrail(EnFhgFire* this, PlayState* play) { osSyncPrintf("FF MOVE 1\n"); this->actor.shape.rot.x += (s16)(Rand_ZeroOne() * 4000.0f) + 0x4000; @@ -280,8 +280,8 @@ void EnFhgFire_LightningTrail(EnFhgFire* this, GlobalContext* globalCtx) { osSyncPrintf("FF MOVE 2\n"); } -void EnFhgFire_LightningShock(EnFhgFire* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFhgFire_LightningShock(EnFhgFire* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f pos; if (this->collider.base.atFlags & AT_HIT) { @@ -292,46 +292,45 @@ void EnFhgFire_LightningShock(EnFhgFire* this, GlobalContext* globalCtx) { if (Rand_ZeroOne() < 0.5f) { pos = this->actor.world.pos; pos.y -= 20.0f; - EffectSsFhgFlash_SpawnShock(globalCtx, &this->actor, &pos, 200, FHGFLASH_SHOCK_NO_ACTOR); + EffectSsFhgFlash_SpawnShock(play, &this->actor, &pos, 200, FHGFLASH_SHOCK_NO_ACTOR); } Actor_MoveForward(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); if (player->invincibilityTimer == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_0); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_0); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Actor_Kill(&this->actor); } } -void EnFhgFire_LightningBurst(EnFhgFire* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFhgFire_LightningBurst(EnFhgFire* this, PlayState* play) { + Player* player = GET_PLAYER(play); - globalCtx->envCtx.fillScreen = true; + play->envCtx.fillScreen = true; this->actor.shape.rot.y += 0x1000; if (this->work[FHGFIRE_FX_TIMER] == 49) { - globalCtx->envCtx.lightSettingOverride = 1; - globalCtx->envCtx.lightBlendRateOverride = 255; + play->envCtx.lightSettingOverride = 1; + play->envCtx.lightBlendRateOverride = 255; } if (this->work[FHGFIRE_FX_TIMER] == 31) { - globalCtx->envCtx.lightSettingOverride = 0; - globalCtx->envCtx.lightBlendRateOverride = 20; + play->envCtx.lightSettingOverride = 0; + play->envCtx.lightBlendRateOverride = 20; } if (this->work[FHGFIRE_FX_TIMER] >= 48) { - globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = - globalCtx->envCtx.screenFillColor[2] = 255; + play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = play->envCtx.screenFillColor[2] = 255; if ((this->work[FHGFIRE_TIMER] % 2) != 0) { - globalCtx->envCtx.screenFillColor[3] = 70; + play->envCtx.screenFillColor[3] = 70; } else { - globalCtx->envCtx.screenFillColor[3] = 0; + play->envCtx.screenFillColor[3] = 0; } } else { - globalCtx->envCtx.screenFillColor[3] = 0; + play->envCtx.screenFillColor[3] = 0; } if (this->work[FHGFIRE_TIMER] <= 20) { @@ -345,13 +344,13 @@ void EnFhgFire_LightningBurst(EnFhgFire* this, GlobalContext* globalCtx) { if (this->fwork[FHGFIRE_BURST_SCALE] > 3.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); if (player->invincibilityTimer == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } if (this->work[FHGFIRE_TIMER] == 0) { Actor_Kill(&this->actor); - globalCtx->envCtx.fillScreen = false; + play->envCtx.fillScreen = false; } if (this->lensFlareTimer != 0) { @@ -372,7 +371,7 @@ void EnFhgFire_LightningBurst(EnFhgFire* this, GlobalContext* globalCtx) { gLensFlareGlareStrength = 0; } -void EnFhgFire_SpearLight(EnFhgFire* this, GlobalContext* globalCtx) { +void EnFhgFire_SpearLight(EnFhgFire* this, PlayState* play) { BossGanondrof* bossGnd; s16 i; @@ -401,8 +400,8 @@ void EnFhgFire_SpearLight(EnFhgFire* this, GlobalContext* globalCtx) { ballPos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; ballAccel.y = -0.08f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &ballPos, &ballVel, &ballAccel, - (s16)(Rand_ZeroOne() * 80.0f) + 150, FHGFLASH_LIGHTBALL_GREEN); + EffectSsFhgFlash_SpawnLightBall(play, &ballPos, &ballVel, &ballAccel, (s16)(Rand_ZeroOne() * 80.0f) + 150, + FHGFLASH_LIGHTBALL_GREEN); } } @@ -411,7 +410,7 @@ void EnFhgFire_SpearLight(EnFhgFire* this, GlobalContext* globalCtx) { } } -void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { +void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { f32 dxL; f32 dyL; f32 dzL; @@ -421,7 +420,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { f32 dzPG; u8 killMode = BALL_FIZZLE; u8 canBottleReflect1; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->work[FHGFIRE_KILL_TIMER] != 0) { this->work[FHGFIRE_KILL_TIMER]--; @@ -462,7 +461,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { spD4.y = Rand_CenteredFloat(20.0f) + this->actor.world.pos.y; spD4.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; spBC.y = -0.08f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &spD4, &spC8, &spBC, (s16)(Rand_ZeroOne() * 80.0f) + 150, + EffectSsFhgFlash_SpawnLightBall(play, &spD4, &spC8, &spBC, (s16)(Rand_ZeroOne() * 80.0f) + 150, lightBallColor1); } } @@ -487,7 +486,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { spA8.x = Rand_CenteredFloat(20.0f); spA8.y = Rand_CenteredFloat(20.0f); spA8.z = Rand_CenteredFloat(20.0f); - EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &spA8, &sp9C, + EffectSsFhgFlash_SpawnLightBall(play, &this->actor.world.pos, &spA8, &sp9C, (s16)(Rand_ZeroOne() * 25.0f) + 50, FHGFLASH_LIGHTBALL_GREEN); } canBottleReflect2 = canBottleReflect1; @@ -533,7 +532,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { if ((bossGnd->flyMode >= GND_FLY_VOLLEY) && (this->work[FHGFIRE_RETURN_COUNT] >= 2)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_LAUGH); } - func_8002F698(globalCtx, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 3, 0x10); + func_8002F698(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 3, 0x10); } break; case FHGFIRE_LIGHT_BLUE: @@ -574,7 +573,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { sp88.x = Rand_CenteredFloat(20.0f); sp88.y = Rand_CenteredFloat(20.0f); sp88.z = Rand_CenteredFloat(20.0f); - EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &sp88, &sp7C, + EffectSsFhgFlash_SpawnLightBall(play, &this->actor.world.pos, &sp88, &sp7C, (s16)(Rand_ZeroOne() * 40.0f) + 80, FHGFLASH_LIGHTBALL_GREEN); } this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dxL, dzL)); @@ -590,7 +589,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { osSyncPrintf("F_FIRE_MODE %d\n", this->work[FHGFIRE_FIRE_MODE]); osSyncPrintf("fly_mode %d\n", bossGnd->flyMode); if (this->work[FHGFIRE_FX_TIMER] == 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING)) || killMode) { @@ -607,13 +606,13 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { sp6C.y = Rand_CenteredFloat(20.0f); sp6C.z = Rand_CenteredFloat(20.0f); sp60.y = -0.1f; - EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &sp6C, &sp60, + EffectSsFhgFlash_SpawnLightBall(play, &this->actor.world.pos, &sp6C, &sp60, (s16)(Rand_ZeroOne() * 50.0f) + 100, lightBallColor2); } if (killMode == BALL_BURST) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, - this->actor.world.pos.x, player->actor.world.pos.y + 20.0f, - this->actor.world.pos.z, 0xC8, 0, 0, FHGFIRE_LIGHTNING_BURST); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, + player->actor.world.pos.y + 20.0f, this->actor.world.pos.z, 0xC8, 0, 0, + FHGFIRE_LIGHTNING_BURST); } bossGnd->flyMode = GND_FLY_NEUTRAL; this->work[FHGFIRE_KILL_TIMER] = 30; @@ -625,7 +624,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { } else { Collider_UpdateCylinder(&this->actor, &this->collider); osSyncPrintf("BEFORE setAC %d\n", this->collider.base.shape); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); osSyncPrintf("AFTER setAC\n"); } } @@ -640,7 +639,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { } } -void EnFhgFire_PhantomWarp(EnFhgFire* this, GlobalContext* globalCtx) { +void EnFhgFire_PhantomWarp(EnFhgFire* this, PlayState* play) { EnfHG* horse = (EnfHG*)this->actor.parent; f32 scrollDirection; @@ -680,7 +679,7 @@ void EnFhgFire_PhantomWarp(EnFhgFire* this, GlobalContext* globalCtx) { osSyncPrintf("EFC 2\n"); } -void EnFhgFire_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFhgFire_Update(Actor* thisx, PlayState* play) { s32 pad; EnFhgFire* this = (EnFhgFire*)thisx; @@ -693,31 +692,31 @@ void EnFhgFire_Update(Actor* thisx, GlobalContext* globalCtx) { this->work[FHGFIRE_FX_TIMER]--; } - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); } static void* sDustTextures[] = { gDust1Tex, gDust2Tex, gDust3Tex, gDust4Tex, gDust5Tex, gDust6Tex, gDust7Tex, gDust8Tex, }; -void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFhgFire_Draw(Actor* thisx, PlayState* play) { s32 pad; EnFhgFire* this = (EnFhgFire*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1723); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fhg_fire.c", 1723); if (this->actor.params == FHGFIRE_LIGHTNING_BURST) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->fwork[FHGFIRE_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 165, 255, 75, 0); gDPPipeSync(POLY_XLU_DISP++); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1745), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fhg_fire.c", 1745), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gPhantomLightningBlastDL)); } else if ((this->actor.params == FHGFIRE_SPEAR_LIGHT) || (this->actor.params == FHGFIRE_ENERGY_BALL)) { osSyncPrintf("yari hikari draw 1\n"); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - func_80093D84(globalCtx->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->fwork[FHGFIRE_ALPHA]); if (this->work[FHGFIRE_FIRE_MODE] > FHGFIRE_LIGHT_GREEN) { @@ -727,19 +726,19 @@ void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) { } gDPPipeSync(POLY_XLU_DISP++); Matrix_RotateZ((this->actor.shape.rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1801), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fhg_fire.c", 1801), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPhantomEnergyBallDL); } else if ((this->actor.params == FHGFIRE_WARP_EMERGE) || (this->actor.params == FHGFIRE_WARP_RETREAT) || (this->actor.params == FHGFIRE_WARP_DEATH)) { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, (u8)this->fwork[FHGFIRE_WARP_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 90, 50, 95, (s8)(this->fwork[FHGFIRE_WARP_ALPHA] * 0.5f)); gDPPipeSync(POLY_XLU_DISP++); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1833), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fhg_fire.c", 1833), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->fwork[FHGFIRE_WARP_TEX_1_X], + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s16)this->fwork[FHGFIRE_WARP_TEX_1_X], (s16)this->fwork[FHGFIRE_WARP_TEX_1_Y], 0x40, 0x40, 1, (s16)this->fwork[FHGFIRE_WARP_TEX_2_X], (s16)this->fwork[FHGFIRE_WARP_TEX_2_Y], 0x40, 0x40)); @@ -747,15 +746,15 @@ void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) { } else { osSyncPrintf("FF DRAW 1\n"); Matrix_Translate(0.0f, -100.0f, 0.0f, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->fwork[FHGFIRE_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 30, 0); gDPPipeSync(POLY_XLU_DISP++); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1892), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fhg_fire.c", 1892), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPhantomLightningDL); osSyncPrintf("FF DRAW 2\n"); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1900); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fhg_fire.c", 1900); } diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h index 8bc564a3fc..2f43770770 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h @@ -6,7 +6,7 @@ struct EnFhgFire; -typedef void (*EnFhgFireUpdateFunc)(struct EnFhgFire*, GlobalContext*); +typedef void (*EnFhgFireUpdateFunc)(struct EnFhgFire*, PlayState*); typedef enum { /* 1 */ FHGFIRE_LIGHTNING_STRIKE = 1, diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index 8ae9eccee6..cd9bae7533 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -5,15 +5,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFireRock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFireRock_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFireRock_Init(Actor* thisx, PlayState* play); +void EnFireRock_Destroy(Actor* thisx, PlayState* play); +void EnFireRock_Update(Actor* thisx, PlayState* play); +void EnFireRock_Draw(Actor* thisx, PlayState* play); -void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, GlobalContext* globalCtx); -void FireRock_WaitOnFloor(EnFireRock* this, GlobalContext* globalCtx); -void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx); -void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, GlobalContext* globalCtx); +void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, PlayState* play); +void FireRock_WaitOnFloor(EnFireRock* this, PlayState* play); +void EnFireRock_Fall(EnFireRock* this, PlayState* play); +void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, PlayState* play); const ActorInit En_Fire_Rock_InitVars = { ACTOR_EN_FIRE_ROCK, @@ -67,9 +67,9 @@ static ColliderCylinderInit D_80A12CCC = { { 30, 30, -10, { 0, 0, 0 } }, }; -void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { - GlobalContext* globalCtx2 = globalCtx; - Player* player = GET_PLAYER(globalCtx); +void EnFireRock_Init(Actor* thisx, PlayState* play) { + PlayState* play2 = play; + Player* player = GET_PLAYER(play); EnFireRock* this = (EnFireRock*)thisx; s16 temp; @@ -91,14 +91,14 @@ void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { break; case FIRE_ROCK_ON_FLOOR: Actor_SetScale(&this->actor, 0.03f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80A12CCC); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &D_80A12CCC); // "☆☆☆☆☆ floor rock ☆☆☆☆☆" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 床岩 ☆☆☆☆☆ \n" VT_RST); this->collider.dim.radius = 23; this->collider.dim.height = 37; this->collider.dim.yShift = -10; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actionFunc = FireRock_WaitOnFloor; break; @@ -109,8 +109,8 @@ void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { case FIRE_ROCK_SPAWNED_FALLING2: // spawned by encount2 and by the ceilling spawner this->scale = (Rand_ZeroFloat(2.0f) / 100.0f) + 0.02f; Actor_SetScale(&this->actor, this->scale); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80A12CA0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &D_80A12CA0); this->actor.world.rot.y = this->actor.shape.rot.y = Rand_CenteredFloat(65535.0f); this->actionFunc = EnFireRock_Fall; this->actor.shape.shadowScale = 15.0f; @@ -121,8 +121,8 @@ void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { this->scale = (Rand_ZeroFloat(1.0f) / 100.0f) + 0.02f; Actor_SetScale(&this->actor, this->scale); this->actor.gravity = -1.5f; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80A12CA0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &D_80A12CA0); this->actor.shape.shadowScale = 10.0f; this->actor.world.rot.y = this->actor.shape.rot.y = Rand_CenteredFloat(65535.0f); this->actionFunc = EnFireRock_Fall; @@ -145,7 +145,7 @@ void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnFireRock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFireRock_Destroy(Actor* thisx, PlayState* play) { EnFireRock* this = (EnFireRock*)thisx; if ((this->actor.parent != NULL) && (this->actor.parent == &this->spawner->actor)) { @@ -158,15 +158,15 @@ void EnFireRock_Destroy(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); } } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { +void EnFireRock_Fall(EnFireRock* this, PlayState* play) { Player* player; Vec3f flamePos; s32 i; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if ((this->actor.floorHeight == -10000.0f) || (this->actor.world.pos.y < (player->actor.world.pos.y - 200.0f))) { Actor_Kill(&this->actor); return; @@ -184,10 +184,10 @@ void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { flamePos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; flamePos.y = Rand_CenteredFloat(20.0f) + this->actor.world.pos.y; flamePos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, 100, 0, 0, -1); break; case FIRE_ROCK_BROKEN_PIECE1: - if ((globalCtx->gameplayFrames & 3) == 0) { + if ((play->gameplayFrames & 3) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_ROCK); } break; @@ -196,22 +196,22 @@ void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { switch (this->type) { case FIRE_ROCK_SPAWNED_FALLING1: case FIRE_ROCK_SPAWNED_FALLING2: - func_80033E88(&this->actor, globalCtx, 5, 2); + func_80033E88(&this->actor, play, 5, 2); case FIRE_ROCK_BROKEN_PIECE1: - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, - 1, 8.0f, 500, 10, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, + 8.0f, 500, 10, false); for (i = 0; i < 5; i++) { flamePos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; flamePos.y = this->actor.floorHeight; flamePos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, 300, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, 300, 0, 0, -1); } this->actionFunc = EnFireRock_SpawnMoreBrokenPieces; break; default: - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, - 3, 8.0f, 200, 10, false); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 3, + 8.0f, 200, 10, false); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); Actor_Kill(&this->actor); break; } @@ -222,7 +222,7 @@ void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { * After the rock has already hit the ground and started rolling, spawn two more, giving the illusion of breaking into * two pieces. */ -void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, GlobalContext* globalCtx) { +void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, PlayState* play) { EnFireRock* spawnedFireRock; s32 nextRockType; s32 i; @@ -241,7 +241,7 @@ void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, GlobalContext* globalCtx if (nextRockType != FIRE_ROCK_SPAWNED_FALLING1) { for (i = 0; i < 2; i++) { spawnedFireRock = (EnFireRock*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_FIRE_ROCK, Rand_CenteredFloat(3.0f) + this->actor.world.pos.x, + &play->actorCtx, play, ACTOR_EN_FIRE_ROCK, Rand_CenteredFloat(3.0f) + this->actor.world.pos.x, Rand_CenteredFloat(3.0f) + (this->actor.world.pos.y + 10.0f), Rand_CenteredFloat(3.0f) + this->actor.world.pos.z, 0, 0, 0, nextRockType); if (spawnedFireRock != NULL) { @@ -259,14 +259,14 @@ void EnFireRock_SpawnMoreBrokenPieces(EnFireRock* this, GlobalContext* globalCtx Actor_Kill(&this->actor); } -void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, GlobalContext* globalCtx) { +void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, PlayState* play) { EnFireRock* spawnedFireRock; if (this->actor.xzDistToPlayer < 200.0f) { if ((this->playerNearby == 0) && (this->timer2 == 0)) { this->timer2 = 30; spawnedFireRock = (EnFireRock*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_FIRE_ROCK, Rand_CenteredFloat(3.0f) + this->actor.world.pos.x, + &play->actorCtx, play, ACTOR_EN_FIRE_ROCK, Rand_CenteredFloat(3.0f) + this->actor.world.pos.x, this->actor.world.pos.y + 10.0f, Rand_CenteredFloat(3.0f) + this->actor.world.pos.z, 0, 0, 0, FIRE_ROCK_SPAWNED_FALLING2); if (spawnedFireRock != NULL) { @@ -282,11 +282,11 @@ void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, GlobalContext* globalC if (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, 255, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); } } -void FireRock_WaitOnFloor(EnFireRock* this, GlobalContext* globalCtx) { +void FireRock_WaitOnFloor(EnFireRock* this, PlayState* play) { Vec3f flamePos; s16 scale; @@ -296,15 +296,15 @@ void FireRock_WaitOnFloor(EnFireRock* this, GlobalContext* globalCtx) { flamePos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; scale = 130 + (s16)Rand_CenteredFloat(60.0f); this->timer2 = 3 + (s16)Rand_ZeroFloat(3.0f); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, scale, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, scale, 0, 0, -1); } } -void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFireRock_Update(Actor* thisx, PlayState* play) { EnFireRock* this = (EnFireRock*)thisx; s16 setCollision; - Player* player = GET_PLAYER(globalCtx); - Actor* playerActor = &GET_PLAYER(globalCtx)->actor; + Player* player = GET_PLAYER(play); + Actor* playerActor = &GET_PLAYER(play)->actor; if (this->timer2 != 0) { this->timer2--; @@ -312,7 +312,7 @@ void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->timer != 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->type != FIRE_ROCK_CEILING_SPOT_SPAWNER) { f32 temp; @@ -336,7 +336,7 @@ void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->type != FIRE_ROCK_ON_FLOOR) { Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 50.0f, 50.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, thisx, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } @@ -363,7 +363,7 @@ void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.base.atFlags &= ~2; if (this->collider.base.at == playerActor) { if (!(player->stateFlags1 & PLAYER_STATE1_26)) { - func_8002F758(globalCtx, thisx, 2.0f, -player->actor.world.rot.y, 3.0f, 4); + func_8002F758(play, thisx, 2.0f, -player->actor.world.rot.y, 3.0f, 4); } return; } @@ -372,28 +372,28 @@ void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { } if (setCollision) { Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -void EnFireRock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFireRock_Draw(Actor* thisx, PlayState* play) { EnFireRock* this = (EnFireRock*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fire_rock.c", 747); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fire_rock.c", 747); Matrix_Translate(thisx->world.pos.x + this->relativePos.x, thisx->world.pos.y + this->relativePos.y, thisx->world.pos.z + this->relativePos.z, MTXMODE_NEW); Matrix_RotateX(DEG_TO_RAD(this->rockRotation.x), MTXMODE_APPLY); Matrix_RotateY(DEG_TO_RAD(this->rockRotation.y), MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(this->rockRotation.z), MTXMODE_APPLY); Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 155, 55, 255); gDPSetEnvColor(POLY_OPA_DISP++, 155, 255, 55, 255); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fire_rock.c", 768), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fire_rock.c", 768), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_efc_star_field_DL_000DE0); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fire_rock.c", 773); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fire_rock.c", 773); } diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h index 9dd7de61fb..3530cecb75 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h @@ -17,7 +17,7 @@ typedef enum { struct EnFireRock; -typedef void (*EnFireRockActionFunc)(struct EnFireRock*, GlobalContext*); +typedef void (*EnFireRockActionFunc)(struct EnFireRock*, PlayState*); typedef struct EnFireRock { /* 0x0000 */ Actor actor; 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 1d9c416877..e35b519d54 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -10,23 +10,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14) -void EnFirefly_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFirefly_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFirefly_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFirefly_Init(Actor* thisx, PlayState* play); +void EnFirefly_Destroy(Actor* thisx, PlayState* play); +void EnFirefly_Update(Actor* thisx, PlayState* play); +void EnFirefly_Draw(Actor* thisx, PlayState* play); -void EnFirefly_DrawInvisible(Actor* thisx, GlobalContext* globalCtx); +void EnFirefly_DrawInvisible(Actor* thisx, PlayState* play); -void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Fall(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Die(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Rebound(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Stunned(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_FrozenFall(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Perch(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx); +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 { /* 0 */ KEESE_AURA_NONE, @@ -136,15 +136,14 @@ void EnFirefly_Ignite(EnFirefly* this) { this->actor.naviEnemyId = NAVI_ENEMY_FIRE_KEESE; } -void EnFirefly_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly_Init(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->jointTable, this->morphTable, - 28); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->jointTable, this->morphTable, 28); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if ((this->actor.params & 0x8000) != 0) { @@ -194,10 +193,10 @@ void EnFirefly_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.elements[0].dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; } -void EnFirefly_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly_Destroy(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnFirefly_SetupFlyIdle(EnFirefly* this) { @@ -257,7 +256,7 @@ void EnFirefly_SetupStunned(EnFirefly* this) { this->actionFunc = EnFirefly_Stunned; } -void EnFirefly_SetupFrozenFall(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_SetupFrozenFall(EnFirefly* this, PlayState* play) { s32 i; Vec3f iceParticlePos; @@ -271,7 +270,7 @@ void EnFirefly_SetupFrozenFall(EnFirefly* this, GlobalContext* globalCtx) { 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(globalCtx, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.15f) + 0.85f); } @@ -293,8 +292,8 @@ void EnFirefly_SetupDisturbDiveAttack(EnFirefly* this) { this->actionFunc = EnFirefly_DisturbDiveAttack; } -s32 EnFirefly_ReturnToPerch(EnFirefly* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnFirefly_ReturnToPerch(EnFirefly* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 distFromHome; if (this->actor.params != KEESE_NORMAL_PERCH) { @@ -325,14 +324,14 @@ s32 EnFirefly_ReturnToPerch(EnFirefly* this, GlobalContext* globalCtx) { return 0; } -s32 EnFirefly_SeekTorch(EnFirefly* this, GlobalContext* globalCtx) { +s32 EnFirefly_SeekTorch(EnFirefly* this, PlayState* play) { ObjSyokudai* findTorch; ObjSyokudai* closestTorch; f32 torchDist; f32 currentMinDist; Vec3f flamePos; - findTorch = (ObjSyokudai*)globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + findTorch = (ObjSyokudai*)play->actorCtx.actorLists[ACTORCAT_PROP].head; closestTorch = NULL; currentMinDist = 35000.0f; @@ -365,7 +364,7 @@ s32 EnFirefly_SeekTorch(EnFirefly* this, GlobalContext* globalCtx) { return 0; } -void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { s32 skelanimeUpdated; f32 rand; @@ -376,7 +375,7 @@ void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) { skelanimeUpdated = Animation_OnFrame(&this->skelAnime, 0.0f); this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 1.5f; if (this->onFire || (this->actor.params == KEESE_ICE_FLY) || - ((EnFirefly_ReturnToPerch(this, globalCtx) == 0) && (EnFirefly_SeekTorch(this, globalCtx) == 0))) { + ((EnFirefly_ReturnToPerch(this, play) == 0) && (EnFirefly_SeekTorch(this, play) == 0))) { if (skelanimeUpdated) { rand = Rand_ZeroOne(); if (rand < 0.5f) { @@ -410,14 +409,13 @@ void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) { 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(globalCtx) != PLAYER_MASK_SKULL)) { + if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL)) { EnFirefly_SetupDiveAttack(this); } } // Fall to the ground after being hit -void EnFirefly_Fall(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Fall(EnFirefly* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 6.0f)) { this->skelAnime.playSpeed = 0.0f; } @@ -439,20 +437,20 @@ void EnFirefly_Fall(EnFirefly* this, GlobalContext* globalCtx) { } // Hit the ground or burn up, spawn drops -void EnFirefly_Die(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Die(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->timer == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); Actor_Kill(&this->actor); } } -void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f preyPos; SkelAnime_Update(&this->skelAnime); @@ -489,13 +487,13 @@ void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) { } Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } - if ((this->timer == 0) || (Player_GetMask(globalCtx) == PLAYER_MASK_SKULL)) { + if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL)) { EnFirefly_SetupFlyAway(this); } } // Knockback after hitting player -void EnFirefly_Rebound(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Rebound(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); @@ -509,7 +507,7 @@ void EnFirefly_Rebound(EnFirefly* this, GlobalContext* globalCtx) { } } -void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_FlyAway(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -537,7 +535,7 @@ void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } -void EnFirefly_Stunned(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Stunned(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1554, 0x100); @@ -554,7 +552,7 @@ void EnFirefly_Stunned(EnFirefly* this, GlobalContext* globalCtx) { } } -void EnFirefly_FrozenFall(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_FrozenFall(EnFirefly* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { this->actor.colorFilterTimer = 0; EnFirefly_SetupDie(this); @@ -564,7 +562,7 @@ void EnFirefly_FrozenFall(EnFirefly* this, GlobalContext* globalCtx) { } // When perching, sit on collision and flap at random intervals -void EnFirefly_Perch(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Perch(EnFirefly* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x100); if (this->timer != 0) { @@ -581,8 +579,8 @@ void EnFirefly_Perch(EnFirefly* this, GlobalContext* globalCtx) { } } -void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFirefly_DisturbDiveAttack(EnFirefly* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f preyPos; SkelAnime_Update(&this->skelAnime); @@ -607,17 +605,17 @@ void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx) { } } -void EnFirefly_Combust(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Combust(EnFirefly* this, PlayState* play) { s32 i; for (i = 0; i <= 2; i++) { - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &this->actor.world.pos, 40, 0, 0, i); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, 40, 0, 0, i); } this->auraType = KEESE_AURA_NONE; } -void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_UpdateDamage(EnFirefly* this, PlayState* play) { u8 damageEffect; if (this->collider.base.acFlags & AC_HIT) { @@ -626,7 +624,7 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_0; } @@ -635,8 +633,8 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { if (damageEffect == 2) { // Din's Fire if (this->actor.params == KEESE_ICE_FLY) { this->actor.colChkInfo.health = 0; - Enemy_StartFinishingBlow(globalCtx, &this->actor); - EnFirefly_Combust(this, globalCtx); + Enemy_StartFinishingBlow(play, &this->actor); + EnFirefly_Combust(this, play); EnFirefly_SetupFall(this); } else if (!this->onFire) { EnFirefly_Ignite(this); @@ -648,7 +646,7 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { if (this->actor.params == KEESE_ICE_FLY) { EnFirefly_SetupFall(this); } else { - EnFirefly_SetupFrozenFall(this, globalCtx); + EnFirefly_SetupFrozenFall(this, play); } } else if (damageEffect == 1) { // Deku Nuts if (this->actionFunc != EnFirefly_Stunned) { @@ -656,7 +654,7 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { } } else { // Fire Arrows if ((damageEffect == 0xF) && (this->actor.params == KEESE_ICE_FLY)) { - EnFirefly_Combust(this, globalCtx); + EnFirefly_Combust(this, play); } EnFirefly_SetupFall(this); } @@ -664,9 +662,9 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { } } -void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnFirefly_Update(Actor* thisx, PlayState* play2) { EnFirefly* this = (EnFirefly*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; @@ -679,9 +677,9 @@ void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - EnFirefly_UpdateDamage(this, globalCtx); + EnFirefly_UpdateDamage(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (!(this->actor.flags & ACTOR_FLAG_15)) { if ((this->actor.colChkInfo.health == 0) || (this->actionFunc == EnFirefly_Stunned)) { @@ -694,25 +692,25 @@ void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 15.0f, + 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)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actor.colChkInfo.health != 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + 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)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FFLY_FLY); } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + 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; @@ -720,11 +718,11 @@ void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { (10.0f * Math_SinS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y)) + this->actor.world.pos.z; } -s32 EnFirefly_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx, Gfx** gfx) { +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) && !globalCtx->actorCtx.lensActive) { + if ((this->actor.draw == EnFirefly_DrawInvisible) && !play->actorCtx.lensActive) { *dList = NULL; } else if (limbIndex == 1) { pos->y += 2300.0f; @@ -732,7 +730,7 @@ s32 EnFirefly_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +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 }; @@ -783,7 +781,7 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList effEnvColor = &iceAuraEnvColor; } - func_8002843C(globalCtx, &effPos, &effVelocity, &effAccel, effPrimColor, effEnvColor, 250, effScaleStep, + func_8002843C(play, &effPos, &effVelocity, &effAccel, effPrimColor, effEnvColor, 250, effScaleStep, effLife); } } @@ -802,11 +800,11 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnFirefly_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly_Draw(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_firefly.c", 1733); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 1733); + func_80093D18(play->state.gfxCtx); if (this->onFire) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); @@ -814,16 +812,16 @@ void EnFirefly_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); } - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnFirefly_OverrideLimbDraw, EnFirefly_PostLimbDraw, &this->actor, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_firefly.c", 1763); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 1763); } -void EnFirefly_DrawInvisible(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly_DrawInvisible(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_firefly.c", 1775); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 1775); + func_80093D84(play->state.gfxCtx); if (this->onFire) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); @@ -831,7 +829,7 @@ void EnFirefly_DrawInvisible(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 255); } - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnFirefly_OverrideLimbDraw, EnFirefly_PostLimbDraw, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_firefly.c", 1805); + 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 0241d4ebd6..862779e189 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -6,7 +6,7 @@ struct EnFirefly; -typedef void (*EnFireflyActionFunc)(struct EnFirefly*, GlobalContext*); +typedef void (*EnFireflyActionFunc)(struct EnFirefly*, PlayState*); typedef struct EnFirefly { /* 0x0000 */ Actor actor; 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 41c72faaee..1b176f5bc5 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -10,27 +10,27 @@ #define FLAGS 0 -void EnFish_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFish_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFish_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFish_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFish_Init(Actor* thisx, PlayState* play); +void EnFish_Destroy(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); +void EnFish_Respawning_SlowDown(EnFish* this, PlayState* play); void EnFish_Respawning_SetupFollowChild(EnFish* this); -void EnFish_Respawning_FollowChild(EnFish* this, GlobalContext* globalCtx); +void EnFish_Respawning_FollowChild(EnFish* this, PlayState* play); void EnFish_Respawning_SetupFleePlayer(EnFish* this); -void EnFish_Respawning_FleePlayer(EnFish* this, GlobalContext* globalCtx); +void EnFish_Respawning_FleePlayer(EnFish* this, PlayState* play); void EnFish_Respawning_SetupApproachPlayer(EnFish* this); -void EnFish_Respawning_ApproachPlayer(EnFish* this, GlobalContext* globalCtx); +void EnFish_Respawning_ApproachPlayer(EnFish* this, PlayState* play); void EnFish_Dropped_SetupFall(EnFish* this); -void EnFish_Dropped_Fall(EnFish* this, GlobalContext* globalCtx); +void EnFish_Dropped_Fall(EnFish* this, PlayState* play); void EnFish_Dropped_SetupFlopOnGround(EnFish* this); -void EnFish_Dropped_FlopOnGround(EnFish* this, GlobalContext* globalCtx); +void EnFish_Dropped_FlopOnGround(EnFish* this, PlayState* play); void EnFish_Dropped_SetupSwimAway(EnFish* this); -void EnFish_Dropped_SwimAway(EnFish* this, GlobalContext* globalCtx); +void EnFish_Dropped_SwimAway(EnFish* this, PlayState* play); void EnFish_Unique_SetupSwimIdle(EnFish* this); -void EnFish_Unique_SwimIdle(EnFish* this, GlobalContext* globalCtx); +void EnFish_Unique_SwimIdle(EnFish* this, PlayState* play); // Used in the cutscene functions static Actor* D_80A17010 = NULL; @@ -127,15 +127,14 @@ void EnFish_ClearCutsceneData(EnFish* this) { D_80A17018 = 0.0f; } -void EnFish_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFish_Init(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; s16 params = this->actor.params; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishSkel, &gFishInWaterAnim, this->jointTable, this->morphTable, - 7); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + 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->colliderItems); this->actor.colChkInfo.mass = 50; this->slowPhase = Rand_ZeroOne() * (0xFFFF + 0.5f); this->fastPhase = Rand_ZeroOne() * (0xFFFF + 0.5f); @@ -151,11 +150,11 @@ void EnFish_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnFish_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnFish_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnFish* this = (EnFish*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnFish_SetYOffset(EnFish* this) { @@ -163,9 +162,9 @@ void EnFish_SetYOffset(EnFish* this) { this->actor.shape.yOffset = CLAMP(this->actor.shape.yOffset, -200.0f, 200.0f); } -s32 EnFish_InBottleRange(EnFish* this, GlobalContext* globalCtx) { +s32 EnFish_InBottleRange(EnFish* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f sp1C; if (this->actor.xzDistToPlayer < 32.0f) { @@ -184,7 +183,7 @@ s32 EnFish_InBottleRange(EnFish* this, GlobalContext* globalCtx) { return false; } -s32 EnFish_CheckXZDistanceToPlayer(EnFish* this, GlobalContext* globalCtx) { +s32 EnFish_CheckXZDistanceToPlayer(EnFish* this, PlayState* play) { return (this->actor.xzDistToPlayer < 60.0f); } @@ -199,7 +198,7 @@ void EnFish_Respawning_SetupSlowDown(EnFish* this) { this->actionFunc = EnFish_Respawning_SlowDown; } -void EnFish_Respawning_SlowDown(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Respawning_SlowDown(EnFish* this, PlayState* play) { EnFish_SetYOffset(this); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.05f, 0.3f, 0.0f); this->skelAnime.playSpeed = CLAMP_MAX(this->actor.speedXZ * 1.4f + 0.8f, 2.0f); @@ -210,7 +209,7 @@ void EnFish_Respawning_SlowDown(EnFish* this, GlobalContext* globalCtx) { EnFish_Respawning_SetupFollowChild(this); } else if (&this->actor == this->actor.child) { EnFish_Respawning_SetupApproachPlayer(this); - } else if (EnFish_CheckXZDistanceToPlayer(this, globalCtx)) { + } else if (EnFish_CheckXZDistanceToPlayer(this, play)) { EnFish_Respawning_SetupFleePlayer(this); } } @@ -226,7 +225,7 @@ void EnFish_Respawning_SetupFollowChild(EnFish* this) { this->actionFunc = EnFish_Respawning_FollowChild; } -void EnFish_Respawning_FollowChild(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Respawning_FollowChild(EnFish* this, PlayState* play) { s32 pad; EnFish_SetYOffset(this); @@ -248,7 +247,7 @@ void EnFish_Respawning_FollowChild(EnFish* this, GlobalContext* globalCtx) { EnFish_Respawning_SetupSlowDown(this); } else if (&this->actor == this->actor.child) { EnFish_Respawning_SetupApproachPlayer(this); - } else if (EnFish_CheckXZDistanceToPlayer(this, globalCtx)) { + } else if (EnFish_CheckXZDistanceToPlayer(this, play)) { EnFish_Respawning_SetupFleePlayer(this); } } @@ -262,7 +261,7 @@ void EnFish_Respawning_SetupFleePlayer(EnFish* this) { this->actionFunc = EnFish_Respawning_FleePlayer; } -void EnFish_Respawning_FleePlayer(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Respawning_FleePlayer(EnFish* this, PlayState* play) { s32 pad; s16 pad2; s16 frames; @@ -270,7 +269,7 @@ void EnFish_Respawning_FleePlayer(EnFish* this, GlobalContext* globalCtx) { s16 playerClose; EnFish_SetYOffset(this); - playerClose = EnFish_CheckXZDistanceToPlayer(this, globalCtx); + playerClose = EnFish_CheckXZDistanceToPlayer(this, play); Math_SmoothStepToF(&this->actor.speedXZ, 4.2f, 0.08f, 1.4f, 0.0f); if (EnFish_XZDistanceSquared(&this->actor.world.pos, &this->actor.home.pos) > SQ(160.0f)) { @@ -281,7 +280,7 @@ void EnFish_Respawning_FleePlayer(EnFish* this, GlobalContext* globalCtx) { Math_StepToAngleS(&this->actor.world.rot.y, yaw, 2000); } else if (playerClose) { yaw = this->actor.yawTowardsPlayer + 0x8000; - frames = globalCtx->state.frames; + frames = play->state.frames; if (frames & 0x10) { if (frames & 0x20) { @@ -292,7 +291,7 @@ void EnFish_Respawning_FleePlayer(EnFish* this, GlobalContext* globalCtx) { yaw -= 0x2000; } } - if (globalCtx) {} + if (play) {} Math_StepToAngleS(&this->actor.world.rot.y, yaw, 2000); } @@ -317,9 +316,9 @@ void EnFish_Respawning_SetupApproachPlayer(EnFish* this) { this->actionFunc = EnFish_Respawning_ApproachPlayer; } -void EnFish_Respawning_ApproachPlayer(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Respawning_ApproachPlayer(EnFish* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; Vec3f sp38; s16 yaw; @@ -332,7 +331,7 @@ void EnFish_Respawning_ApproachPlayer(EnFish* this, GlobalContext* globalCtx) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); Math_StepToAngleS(&this->actor.world.rot.y, yaw, 3000); } else { - if ((s16)globalCtx->state.frames & 0x40) { + if ((s16)play->state.frames & 0x40) { temp_a0_2 = (this->actor.yawTowardsPlayer + 0x9000); } else { temp_a0_2 = (this->actor.yawTowardsPlayer + 0x7000); @@ -368,7 +367,7 @@ void EnFish_Dropped_SetupFall(EnFish* this) { this->timer = 300; } -void EnFish_Dropped_Fall(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Dropped_Fall(EnFish* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 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); @@ -431,9 +430,9 @@ void EnFish_Dropped_SetupFlopOnGround(EnFish* this) { } } -void EnFish_Dropped_FlopOnGround(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Dropped_FlopOnGround(EnFish* this, PlayState* play) { s32 pad; - s16 frames = globalCtx->state.frames; + s16 frames = play->state.frames; s16 targetXRot; Math_SmoothStepToF(&this->actor.speedXZ, Rand_ZeroOne() * 0.2f, 0.1f, 0.1f, 0.0f); @@ -483,7 +482,7 @@ void EnFish_Dropped_SetupSwimAway(EnFish* this) { this->unk_250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; } -void EnFish_Dropped_SwimAway(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Dropped_SwimAway(EnFish* this, PlayState* play) { s32 pad; Math_SmoothStepToF(&this->actor.speedXZ, 2.8f, 0.1f, 0.4f, 0.0f); @@ -531,11 +530,11 @@ void EnFish_Unique_SetupSwimIdle(EnFish* this) { this->actionFunc = EnFish_Unique_SwimIdle; } -void EnFish_Unique_SwimIdle(EnFish* this, GlobalContext* globalCtx) { +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 = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; f32* speed; s32 pad2; f32 extraPlaySpeed; @@ -581,7 +580,7 @@ void EnFish_Unique_SwimIdle(EnFish* this, GlobalContext* globalCtx) { // Cutscene functions -void EnFish_Cutscene_FlopOnGround(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Cutscene_FlopOnGround(EnFish* this, PlayState* play) { f32 sp24 = Math_SinS(this->slowPhase); f32 sp20 = Math_SinS(this->fastPhase); @@ -604,7 +603,7 @@ void EnFish_Cutscene_FlopOnGround(EnFish* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } -void EnFish_Cutscene_WiggleFlyingThroughAir(EnFish* this, GlobalContext* globalCtx) { +void EnFish_Cutscene_WiggleFlyingThroughAir(EnFish* this, PlayState* play) { s32 pad; f32 sp28 = Math_SinS(this->slowPhase); f32 sp24 = Math_SinS(this->fastPhase); @@ -616,10 +615,10 @@ void EnFish_Cutscene_WiggleFlyingThroughAir(EnFish* this, GlobalContext* globalC SkelAnime_Update(&this->skelAnime); } -void EnFish_UpdateCutscene(EnFish* this, GlobalContext* globalCtx) { +void EnFish_UpdateCutscene(EnFish* this, PlayState* play) { s32 pad; s32 pad2; - CsCmdActorAction* csAction = globalCtx->csCtx.npcActions[1]; + CsCmdActorAction* csAction = play->csCtx.npcActions[1]; Vec3f startPos; Vec3f endPos; f32 progress; @@ -639,10 +638,10 @@ void EnFish_UpdateCutscene(EnFish* this, GlobalContext* globalCtx) { switch (csAction->action) { case 1: - EnFish_Cutscene_FlopOnGround(this, globalCtx); + EnFish_Cutscene_FlopOnGround(this, play); break; case 2: - EnFish_Cutscene_WiggleFlyingThroughAir(this, globalCtx); + EnFish_Cutscene_WiggleFlyingThroughAir(this, play); break; case 3: // "DEMO fish termination" @@ -663,19 +662,19 @@ void EnFish_UpdateCutscene(EnFish* this, GlobalContext* globalCtx) { endPos.y = csAction->endPos.y; endPos.z = csAction->endPos.z; - progress = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, globalCtx->csCtx.frames); + progress = Environment_LerpWeight(csAction->endFrame, csAction->startFrame, play->csCtx.frames); this->actor.world.pos.x = (endPos.x - startPos.x) * progress + startPos.x; this->actor.world.pos.y = (endPos.y - startPos.y) * progress + startPos.y + D_80A17014; this->actor.world.pos.z = (endPos.z - startPos.z) * progress + startPos.z; - this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, - &this->actor, &this->actor.world.pos); + this->actor.floorHeight = + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); } // Update functions and Draw -void EnFish_OrdinaryUpdate(EnFish* this, GlobalContext* globalCtx) { +void EnFish_OrdinaryUpdate(EnFish* this, PlayState* play) { if (this->timer > 0) { this->timer--; } @@ -687,20 +686,20 @@ void EnFish_OrdinaryUpdate(EnFish* this, GlobalContext* globalCtx) { this->actor.child = NULL; } - if ((this->actionFunc == NULL) || (this->actionFunc(this, globalCtx), (this->actor.update != NULL))) { + if ((this->actionFunc == NULL) || (this->actionFunc(this, play), (this->actor.update != NULL))) { Actor_MoveForward(&this->actor); if (this->unk_250 != 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 17.5f, 4.0f, 0.0f, this->unk_250); + Actor_UpdateBgCheckInfo(play, &this->actor, 17.5f, 4.0f, 0.0f, this->unk_250); } if (this->actor.xzDistToPlayer < 70.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, this->actor.shape.yOffset * 0.01f); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; if (this->actor.params == FISH_DROPPED) { @@ -709,14 +708,14 @@ void EnFish_OrdinaryUpdate(EnFish* this, GlobalContext* globalCtx) { } EnFish_BeginRespawn(this); - } else if (EnFish_InBottleRange(this, globalCtx)) { + } else if (EnFish_InBottleRange(this, play)) { // GI_MAX in this case allows the player to catch the actor in a bottle - func_8002F434(&this->actor, globalCtx, GI_MAX, 80.0f, 20.0f); + func_8002F434(&this->actor, play, GI_MAX, 80.0f, 20.0f); } } } -void EnFish_RespawningUpdate(EnFish* this, GlobalContext* globalCtx) { +void EnFish_RespawningUpdate(EnFish* this, PlayState* play) { if (this->actor.params == FISH_SWIMMING_UNIQUE) { Actor_Kill(&this->actor); return; @@ -726,7 +725,7 @@ void EnFish_RespawningUpdate(EnFish* this, GlobalContext* globalCtx) { this->actor.child = NULL; } - if ((this->actionFunc == NULL) || (this->actionFunc(this, globalCtx), (this->actor.update != NULL))) { + if ((this->actionFunc == NULL) || (this->actionFunc(this, play), (this->actor.update != NULL))) { Actor_MoveForward(&this->actor); if (this->respawnTimer == 20) { @@ -739,29 +738,29 @@ void EnFish_RespawningUpdate(EnFish* this, GlobalContext* globalCtx) { } } -void EnFish_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFish_Update(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; - if ((D_80A17010 == NULL) && (this->actor.params == FISH_DROPPED) && (globalCtx->csCtx.state != 0) && - (globalCtx->csCtx.npcActions[1] != NULL)) { + if ((D_80A17010 == NULL) && (this->actor.params == FISH_DROPPED) && (play->csCtx.state != 0) && + (play->csCtx.npcActions[1] != NULL)) { EnFish_SetCutsceneData(this); } if ((D_80A17010 != NULL) && (&this->actor == D_80A17010)) { - EnFish_UpdateCutscene(this, globalCtx); + EnFish_UpdateCutscene(this, play); } else if (this->respawnTimer > 0) { this->respawnTimer--; - EnFish_RespawningUpdate(this, globalCtx); + EnFish_RespawningUpdate(this, play); } else { - EnFish_OrdinaryUpdate(this, globalCtx); + EnFish_OrdinaryUpdate(this, play); } } -void EnFish_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFish_Draw(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, NULL); + func_80093D18(play->state.gfxCtx); + 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 911f79a451..7169077b58 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -6,7 +6,7 @@ struct EnFish; -typedef void (*EnFishActionFunc)(struct EnFish*, GlobalContext*); +typedef void (*EnFishActionFunc)(struct EnFish*, PlayState*); typedef struct EnFish { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index aa195bbf57..65260a142a 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -15,34 +15,34 @@ #define MERGE_MASTER 0x40 #define MERGE_SLAVE 0x20 -void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFloormas_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFloormas_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFloormas_Init(Actor* thisx, PlayState* play); +void EnFloormas_Destroy(Actor* thisx, PlayState* play); +void EnFloormas_Update(Actor* thisx, PlayState* play); +void EnFloormas_Draw(Actor* thisx, PlayState* play); -void EnFloormas_GrabLink(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Split(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Recover(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_DrawHighlighted(Actor* this, GlobalContext* globalCtx); -void EnFloormas_SmWait(EnFloormas* this, GlobalContext* globalCtx); +void EnFloormas_GrabLink(EnFloormas* this, PlayState* play); +void EnFloormas_Split(EnFloormas* this, PlayState* play); +void EnFloormas_Recover(EnFloormas* this, PlayState* play); +void EnFloormas_DrawHighlighted(Actor* this, PlayState* play); +void EnFloormas_SmWait(EnFloormas* this, PlayState* play); void EnFloormas_SetupBigDecideAction(EnFloormas* this); -void EnFloormas_Freeze(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_TakeDamage(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Merge(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_SmShrink(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_SmDecideAction(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_SmWalk(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Hover(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Turn(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Run(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_BigStopWalk(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_BigWalk(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Stand(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_BigDecideAction(EnFloormas* this, GlobalContext* globalCtx); -void EnFloormas_Charge(EnFloormas* this, GlobalContext* globalCtx); +void EnFloormas_Freeze(EnFloormas* this, PlayState* play); +void EnFloormas_TakeDamage(EnFloormas* this, PlayState* play); +void EnFloormas_Merge(EnFloormas* this, PlayState* play); +void EnFloormas_JumpAtLink(EnFloormas* this, PlayState* play); +void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, PlayState* play); +void EnFloormas_SmShrink(EnFloormas* this, PlayState* play); +void EnFloormas_SmDecideAction(EnFloormas* this, PlayState* play); +void EnFloormas_SmWalk(EnFloormas* this, PlayState* play); +void EnFloormas_Land(EnFloormas* this, PlayState* play); +void EnFloormas_Hover(EnFloormas* this, PlayState* play); +void EnFloormas_Turn(EnFloormas* this, PlayState* play); +void EnFloormas_Run(EnFloormas* this, PlayState* play); +void EnFloormas_BigStopWalk(EnFloormas* this, PlayState* play); +void EnFloormas_BigWalk(EnFloormas* this, PlayState* play); +void EnFloormas_Stand(EnFloormas* this, PlayState* play); +void EnFloormas_BigDecideAction(EnFloormas* this, PlayState* play); +void EnFloormas_Charge(EnFloormas* this, PlayState* play); const ActorInit En_Floormas_InitVars = { ACTOR_EN_FLOORMAS, @@ -119,18 +119,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_STOP), }; -void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnFloormas_Init(Actor* thisx, PlayState* play2) { EnFloormas* this = (EnFloormas*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 invisble; s32 pad; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWallmasterSkel, &gWallmasterWaitAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWallmasterSkel, &gWallmasterWaitAnim, this->jointTable, this->morphTable, 25); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->zOffset = -1600; invisble = this->actor.params & SPAWN_INVISIBLE; @@ -149,16 +149,16 @@ void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx2) { } else { // spawn first small floormaster this->actor.parent = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, invisble + SPAWN_SMALL); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, invisble + SPAWN_SMALL); if (this->actor.parent == NULL) { Actor_Kill(&this->actor); return; } // spawn 2nd small floormaster this->actor.child = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, invisble + SPAWN_SMALL); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, invisble + SPAWN_SMALL); if (this->actor.child == NULL) { Actor_Kill(this->actor.parent); Actor_Kill(&this->actor); @@ -174,10 +174,10 @@ void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnFloormas_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFloormas_Destroy(Actor* thisx, PlayState* play) { EnFloormas* this = (EnFloormas*)thisx; ColliderCylinder* col = &this->collider; - Collider_DestroyCylinder(globalCtx, col); + Collider_DestroyCylinder(play, col); } void EnFloormas_MakeInvulnerable(EnFloormas* this) { @@ -248,13 +248,13 @@ void EnFloormas_SetupTurn(EnFloormas* this) { this->actionFunc = EnFloormas_Turn; } -void EnFloormas_SetupHover(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SetupHover(EnFloormas* this, PlayState* play) { Animation_Change(&this->skelAnime, &gWallmasterHoverAnim, 3.0f, 0, Animation_GetLastFrame(&gWallmasterHoverAnim), ANIMMODE_ONCE, -3.0f); this->actor.speedXZ = 0.0f; this->actor.gravity = 0.0f; EnFloormas_MakeInvulnerable(this); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, true); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_ATTACK); this->actionFunc = EnFloormas_Hover; } @@ -315,7 +315,7 @@ void EnFloormas_SetupSmDecideAction(EnFloormas* this) { this->actor.speedXZ = 5.0f; } -void EnFloormas_SetupSmShrink(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SetupSmShrink(EnFloormas* this, PlayState* play) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f pos; @@ -325,7 +325,7 @@ void EnFloormas_SetupSmShrink(EnFloormas* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 15.0f; pos.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &velocity, &accel, 150, -10, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &velocity, &accel, 150, -10, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); this->actionFunc = EnFloormas_SmShrink; } @@ -425,7 +425,7 @@ void EnFloormas_SetupFreeze(EnFloormas* this) { this->actionFunc = EnFloormas_Freeze; } -void EnFloormas_Die(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Die(EnFloormas* this, PlayState* play) { if (this->actor.scale.x > 0.004f) { // split this->actor.shape.rot.y = this->actor.yawTowardsPlayer + 0x8000; @@ -435,12 +435,12 @@ void EnFloormas_Die(EnFloormas* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SPLIT); } else { // Die - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); - EnFloormas_SetupSmShrink(this, globalCtx); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); + EnFloormas_SetupSmShrink(this, play); } } -void EnFloormas_BigDecideAction(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_BigDecideAction(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { // within 400 units of link and within 90 degrees rotation of him if (this->actor.xzDistToPlayer < 400.0f && !Actor_IsFacingPlayer(&this->actor, 0x4000)) { @@ -448,14 +448,14 @@ void EnFloormas_BigDecideAction(EnFloormas* this, GlobalContext* globalCtx) { EnFloormas_SetupTurn(this); // within 280 units of link and within 45 degrees rotation of him } else if (this->actor.xzDistToPlayer < 280.0f && Actor_IsFacingPlayer(&this->actor, 0x2000)) { - EnFloormas_SetupHover(this, globalCtx); + EnFloormas_SetupHover(this, play); } else { EnFloormas_SetupStand(this); } } } -void EnFloormas_Stand(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Stand(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.scale.x > 0.004f) { EnFloormas_SetupBigWalk(this); @@ -467,7 +467,7 @@ void EnFloormas_Stand(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_BigWalk(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_BigWalk(EnFloormas* this, PlayState* play) { s32 animPastFrame; SkelAnime_Update(&this->skelAnime); @@ -498,13 +498,13 @@ void EnFloormas_BigWalk(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_BigStopWalk(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_BigStopWalk(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnFloormas_SetupBigDecideAction(this); } } -void EnFloormas_Run(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Run(EnFloormas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 24.0f) || Animation_OnFrame(&this->skelAnime, 36.0f)) { @@ -515,13 +515,13 @@ void EnFloormas_Run(EnFloormas* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer < 280.0f) && Actor_IsFacingPlayer(&this->actor, 0x2000) && !(this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { - EnFloormas_SetupHover(this, globalCtx); + EnFloormas_SetupHover(this, play); } else if (this->actor.xzDistToPlayer > 400.0f) { EnFloormas_SetupBigWalk(this); } } -void EnFloormas_Turn(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Turn(EnFloormas* this, PlayState* play) { char pad[4]; f32 sp30; f32 sp2C; @@ -551,7 +551,7 @@ void EnFloormas_Turn(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_Hover(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Hover(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnFloormas_SetupCharge(this); } @@ -561,7 +561,7 @@ void EnFloormas_Hover(EnFloormas* this, GlobalContext* globalCtx) { Math_StepToS(&this->zOffset, 1200, 100); } -void EnFloormas_Slide(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Slide(EnFloormas* this, PlayState* play) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f pos; Vec3f velocity; @@ -574,17 +574,17 @@ void EnFloormas_Slide(EnFloormas* this, GlobalContext* globalCtx) { velocity.x = Math_SinS(this->actor.shape.rot.y + 0x6000) * 7.0f; velocity.z = Math_CosS(this->actor.shape.rot.y + 0x6000) * 7.0f; - func_800286CC(globalCtx, &pos, &velocity, &accel, 450, 100); + func_800286CC(play, &pos, &velocity, &accel, 450, 100); velocity.x = Math_SinS(this->actor.shape.rot.y - 0x6000) * 7.0f; velocity.z = Math_CosS(this->actor.shape.rot.y - 0x6000) * 7.0f; - func_800286CC(globalCtx, &pos, &velocity, &accel, 450, 100); + func_800286CC(play, &pos, &velocity, &accel, 450, 100); func_8002F974(&this->actor, NA_SE_EN_FLOORMASTER_SLIDING); } -void EnFloormas_Charge(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Charge(EnFloormas* this, PlayState* play) { f32 distFromGround; if (this->actionTimer != 0) { @@ -602,7 +602,7 @@ void EnFloormas_Charge(EnFloormas* this, GlobalContext* globalCtx) { } if (distFromGround < 12.0f) { - EnFloormas_Slide(this, globalCtx); + EnFloormas_Slide(this, play); } if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actionTimer == 0)) { @@ -610,7 +610,7 @@ void EnFloormas_Charge(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Land(EnFloormas* this, PlayState* play) { s32 isOnGround; isOnGround = this->actor.bgCheckFlags & BGCHECKFLAG_GROUND; @@ -636,7 +636,7 @@ void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx) { } if ((this->actor.speedXZ > 0.0f) && ((this->actor.world.pos.y - this->actor.floorHeight) < 12.0f)) { - EnFloormas_Slide(this, globalCtx); + EnFloormas_Slide(this, play); } if (SkelAnime_Update(&this->skelAnime)) { @@ -660,7 +660,7 @@ void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx) { Math_StepToS(&this->zOffset, -1600, 100); } -void EnFloormas_Split(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Split(EnFloormas* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.flags |= ACTOR_FLAG_0; @@ -675,7 +675,7 @@ void EnFloormas_Split(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_SmWalk(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SmWalk(EnFloormas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); DECR(this->smActionTimer); @@ -693,7 +693,7 @@ void EnFloormas_SmWalk(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_SmDecideAction(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SmDecideAction(EnFloormas* this, PlayState* play) { Actor* primaryFloormas; s32 isAgainstWall; @@ -730,7 +730,7 @@ void EnFloormas_SmDecideAction(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_SmShrink(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SmShrink(EnFloormas* this, PlayState* play) { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0015f)) { EnFloormas_SetupSmWait(this); } @@ -738,8 +738,8 @@ void EnFloormas_SmShrink(EnFloormas* this, GlobalContext* globalCtx) { this->actor.scale.y = this->actor.scale.x; } -void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFloormas_JumpAtLink(EnFloormas* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->skelAnime.curFrame < 20.0f) { @@ -754,13 +754,13 @@ void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx) { EnFloormas_SetupLand(this); } else if ((this->actor.yDistToPlayer < -10.0f) && (this->collider.base.ocFlags1 & OC1_HIT) && (&player->actor == this->collider.base.oc)) { - globalCtx->grabPlayer(globalCtx, player); + play->grabPlayer(play, player); EnFloormas_SetupGrabLink(this, player); } } -void EnFloormas_GrabLink(EnFloormas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFloormas_GrabLink(EnFloormas* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnFloormas* parent; EnFloormas* child; f32 yDelta; @@ -816,14 +816,14 @@ void EnFloormas_GrabLink(EnFloormas* this, GlobalContext* globalCtx) { } else { func_8002F7DC(&player->actor, NA_SE_VO_LI_DAMAGE_S); } - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } } Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_STICK); } -void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, PlayState* play) { Actor* primFloormas; SkelAnime_Update(&this->skelAnime); @@ -860,7 +860,7 @@ void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, GlobalContext* globalCtx) } } -void EnFloormas_Merge(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Merge(EnFloormas* this, PlayState* play) { EnFloormas* parent; EnFloormas* child; s32 mergeCnt; @@ -876,11 +876,11 @@ void EnFloormas_Merge(EnFloormas* this, GlobalContext* globalCtx) { if (this->smActionTimer == 0) { if (parent->actionFunc != EnFloormas_SmWait) { - EnFloormas_SetupSmShrink(parent, globalCtx); + EnFloormas_SetupSmShrink(parent, play); } if (child->actionFunc != EnFloormas_SmWait) { - EnFloormas_SetupSmShrink(child, globalCtx); + EnFloormas_SetupSmShrink(child, play); } } else { if ((parent->actionFunc != EnFloormas_SmWait) && (parent->actionFunc != EnFloormas_SmShrink)) { @@ -931,13 +931,13 @@ void EnFloormas_Merge(EnFloormas* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_FLOORMASTER_RESTORE - SFX_FLAG); } -void EnFloormas_SmWait(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_SmWait(EnFloormas* this, PlayState* play) { } -void EnFloormas_TakeDamage(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_TakeDamage(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->actor.colChkInfo.health == 0) { - EnFloormas_Die(this, globalCtx); + EnFloormas_Die(this, play); } else { EnFloormas_SetupRecover(this); } @@ -953,27 +953,27 @@ void EnFloormas_TakeDamage(EnFloormas* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); } -void EnFloormas_Recover(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Recover(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnFloormas_SetupStand(this); } } -void EnFloormas_Freeze(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_Freeze(EnFloormas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actionTimer != 0) { this->actionTimer--; } if (this->actionTimer == 0) { if (this->actor.colChkInfo.health == 0) { - EnFloormas_Die(this, globalCtx); + EnFloormas_Die(this, play); return; } EnFloormas_SetupStand(this); } } -void EnFloormas_ColliderCheck(EnFloormas* this, GlobalContext* globalCtx) { +void EnFloormas_ColliderCheck(EnFloormas* this, PlayState* play) { s32 pad; s32 isSmall; @@ -996,7 +996,7 @@ void EnFloormas_ColliderCheck(EnFloormas* this, GlobalContext* globalCtx) { } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_DEAD); } - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_0; } else if (this->actor.colChkInfo.damage != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_DAMAGE); @@ -1008,8 +1008,8 @@ void EnFloormas_ColliderCheck(EnFloormas* this, GlobalContext* globalCtx) { } } else { if (this->actor.colChkInfo.damageEffect == 2) { - EffectSsFCircle_Spawn(globalCtx, &this->actor, &this->actor.world.pos, - this->actor.scale.x * 4000.0f, this->actor.scale.x * 4000.0f); + EffectSsFCircle_Spawn(play, &this->actor, &this->actor.world.pos, this->actor.scale.x * 4000.0f, + this->actor.scale.x * 4000.0f); } EnFloormas_SetupTakeDamage(this); } @@ -1018,7 +1018,7 @@ void EnFloormas_ColliderCheck(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFloormas_Update(Actor* thisx, PlayState* play) { EnFloormas* this = (EnFloormas*)thisx; s32 pad; @@ -1037,8 +1037,8 @@ void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { EnFloormas_SetupLand(this); } - EnFloormas_ColliderCheck(this, globalCtx); - this->actionFunc(this, globalCtx); + EnFloormas_ColliderCheck(this, play); + this->actionFunc(this, play); if (this->actionFunc != EnFloormas_TakeDamage) { this->actor.world.rot.y = this->actor.shape.rot.y; @@ -1048,22 +1048,22 @@ void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, this->actor.scale.x * 3000.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->actor.scale.x * 3000.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); if (this->actionFunc == EnFloormas_Charge) { this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnFloormas_GrabLink) { if (this->actionFunc != EnFloormas_Split && this->actionFunc != EnFloormas_TakeDamage && this->actor.freezeTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if ((this->actionFunc != EnFloormas_SmSlaveJumpAtMaster) || (this->skelAnime.curFrame < 20.0f)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -1081,8 +1081,8 @@ void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnFloormas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx, Gfx** gfx) { +s32 EnFloormas_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, + Gfx** gfx) { EnFloormas* this = (EnFloormas*)thisx; if (limbIndex == 1) { @@ -1091,14 +1091,14 @@ s32 EnFloormas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnFloormas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnFloormas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { if (limbIndex == 2) { Matrix_Push(); Matrix_Translate(1600.0f, -700.0f, -1700.0f, MTXMODE_APPLY); Matrix_RotateY(DEG_TO_RAD(60), MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(15), MTXMODE_APPLY); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_floormas.c", 2299), G_MTX_LOAD); + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_floormas.c", 2299), G_MTX_LOAD); gSPDisplayList((*gfx)++, gWallmasterFingerDL); Matrix_Pop(); } @@ -1106,41 +1106,41 @@ void EnFloormas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis static Color_RGBA8 sMergeColor = { 0, 255, 0, 0 }; -void EnFloormas_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFloormas_Draw(Actor* thisx, PlayState* play) { EnFloormas* this = (EnFloormas*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_floormas.c", 2318); + OPEN_DISPS(play->state.gfxCtx, "../z_en_floormas.c", 2318); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->collider.base.colType == COLTYPE_HARD) { - func_80026230(globalCtx, &sMergeColor, this->actionTarget % 0x28, 0x28); + func_80026230(play, &sMergeColor, this->actionTarget % 0x28, 0x28); } POLY_OPA_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFloormas_OverrideLimbDraw, EnFloormas_PostLimbDraw, this, POLY_OPA_DISP); if (this->collider.base.colType == COLTYPE_HARD) { - func_80026608(globalCtx); + func_80026608(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_floormas.c", 2340); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_floormas.c", 2340); } -void EnFloormas_DrawHighlighted(Actor* thisx, GlobalContext* globalCtx) { +void EnFloormas_DrawHighlighted(Actor* thisx, PlayState* play) { EnFloormas* this = (EnFloormas*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_floormas.c", 2352); + OPEN_DISPS(play->state.gfxCtx, "../z_en_floormas.c", 2352); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->collider.base.colType == COLTYPE_HARD) { - func_80026690(globalCtx, &sMergeColor, this->actionTarget % 0x28, 0x28); + func_80026690(play, &sMergeColor, this->actionTarget % 0x28, 0x28); } POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFloormas_OverrideLimbDraw, EnFloormas_PostLimbDraw, this, POLY_XLU_DISP); if (this->collider.base.colType == COLTYPE_HARD) { - func_80026A6C(globalCtx); + func_80026A6C(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_floormas.c", 2374); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_floormas.c", 2374); } diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h index 52f98fc9f5..c4233bf2ac 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h @@ -6,7 +6,7 @@ typedef struct EnFloormas EnFloormas; -typedef void (*EnFloormasActionFunc)(EnFloormas* this, GlobalContext* globalCtx); +typedef void (*EnFloormasActionFunc)(EnFloormas* this, PlayState* play); struct EnFloormas{ /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index c8d9105e35..1dffa5e0ef 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -5,49 +5,49 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnFr_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFr_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFr_UpdateIdle(Actor* thisx, GlobalContext* globalCtx); -void EnFr_UpdateActive(Actor* thisx, GlobalContext* globalCtx); -void EnFr_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFr_Init(Actor* thisx, PlayState* play); +void EnFr_Destroy(Actor* thisx, PlayState* play); +void EnFr_Update(Actor* thisx, PlayState* play); +void EnFr_UpdateIdle(Actor* thisx, PlayState* play); +void EnFr_UpdateActive(Actor* thisx, PlayState* play); +void EnFr_Draw(Actor* thisx, PlayState* play); // Animation Functions -void EnFr_SetupJumpingOutOfWater(EnFr* this, GlobalContext* globalCtx); -void EnFr_JumpingOutOfWater(EnFr* this, GlobalContext* globalCtx); -void EnFr_OrientOnLogSpot(EnFr* this, GlobalContext* globalCtx); -void EnFr_ChooseJumpFromLogSpot(EnFr* this, GlobalContext* globalCtx); -void EnFr_JumpingUp(EnFr* this, GlobalContext* globalCtx); -void EnFr_JumpingBackIntoWater(EnFr* this, GlobalContext* globalCtx); +void EnFr_SetupJumpingOutOfWater(EnFr* this, PlayState* play); +void EnFr_JumpingOutOfWater(EnFr* this, PlayState* play); +void EnFr_OrientOnLogSpot(EnFr* this, PlayState* play); +void EnFr_ChooseJumpFromLogSpot(EnFr* this, PlayState* play); +void EnFr_JumpingUp(EnFr* this, PlayState* play); +void EnFr_JumpingBackIntoWater(EnFr* this, PlayState* play); void EnFr_DecrementBlinkTimerUpdate(EnFr* this); // Activation -void EnFr_Idle(EnFr* this, GlobalContext* globalCtx); -void EnFr_Activate(EnFr* this, GlobalContext* globalCtx); -void EnFr_ActivateCheckFrogSong(EnFr* this, GlobalContext* globalCtx); +void EnFr_Idle(EnFr* this, PlayState* play); +void EnFr_Activate(EnFr* this, PlayState* play); +void EnFr_ActivateCheckFrogSong(EnFr* this, PlayState* play); // Listening for Child Songs -void func_80A1BE98(EnFr* this, GlobalContext* globalCtx); -void EnFr_ListeningToOcarinaNotes(EnFr* this, GlobalContext* globalCtx); -void EnFr_ChildSong(EnFr* this, GlobalContext* globalCtx); -void EnFr_ChildSongFirstTime(EnFr* this, GlobalContext* globalCtx); +void func_80A1BE98(EnFr* this, PlayState* play); +void EnFr_ListeningToOcarinaNotes(EnFr* this, PlayState* play); +void EnFr_ChildSong(EnFr* this, PlayState* play); +void EnFr_ChildSongFirstTime(EnFr* this, PlayState* play); // Frog Song for HP Functions -void EnFr_TalkBeforeFrogSong(EnFr* this, GlobalContext* globalCtx); -void EnFr_SetupFrogSong(EnFr* this, GlobalContext* globalCtx); -void EnFr_ContinueFrogSong(EnFr* this, GlobalContext* globalCtx); -void EnFr_OcarinaMistake(EnFr* this, GlobalContext* globalCtx); +void EnFr_TalkBeforeFrogSong(EnFr* this, PlayState* play); +void EnFr_SetupFrogSong(EnFr* this, PlayState* play); +void EnFr_ContinueFrogSong(EnFr* this, PlayState* play); +void EnFr_OcarinaMistake(EnFr* this, PlayState* play); // Reward Functions -void EnFr_SetupReward(EnFr* this, GlobalContext* globalCtx, u8 unkCondition); -void EnFr_PrintTextBox(EnFr* this, GlobalContext* globalCtx); -void EnFr_TalkBeforeReward(EnFr* this, GlobalContext* globalCtx); -void EnFr_SetReward(EnFr* this, GlobalContext* globalCtx); +void EnFr_SetupReward(EnFr* this, PlayState* play, u8 unkCondition); +void EnFr_PrintTextBox(EnFr* this, PlayState* play); +void EnFr_TalkBeforeReward(EnFr* this, PlayState* play); +void EnFr_SetReward(EnFr* this, PlayState* play); // Deactivate -void EnFr_Deactivate(EnFr* this, GlobalContext* globalCtx); -void EnFr_GiveReward(EnFr* this, GlobalContext* globalCtx); -void EnFr_SetIdle(EnFr* this, GlobalContext* globalCtx); +void EnFr_Deactivate(EnFr* this, PlayState* play); +void EnFr_GiveReward(EnFr* this, PlayState* play); +void EnFr_SetIdle(EnFr* this, PlayState* play); /* Frogs params WIP docs @@ -229,7 +229,7 @@ void EnFr_OrientUnderwater(EnFr* this) { this->actor.gravity = 0.0f; } -void EnFr_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_Init(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; if (this->actor.params == 0) { @@ -238,7 +238,7 @@ void EnFr_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.update = EnFr_UpdateIdle; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_4); this->actor.flags &= ~0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actor.textId = 0x40AC; this->actionFunc = EnFr_Idle; } else { @@ -250,7 +250,7 @@ void EnFr_Init(Actor* thisx, GlobalContext* globalCtx) { ASSERT(0, "0", "../z_en_fr.c", 372); } - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP); + this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP); if (this->objBankIndex < 0) { Actor_Kill(&this->actor); osSyncPrintf(VT_COL(RED, WHITE)); @@ -271,25 +271,25 @@ void EnFr_DrawActive(EnFr* this) { this->actor.draw = EnFr_Draw; } -void EnFr_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_Update(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; s32 pad; s32 frogIndex; s32 pad2; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.flags &= ~ACTOR_FLAG_4; frogIndex = this->actor.params - 1; sEnFrPointers.frogs[frogIndex] = this; Actor_ProcessInitChain(&this->actor, sInitChain); // frog - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_fr_Skel_00B498, &object_fr_Anim_001534, - this->jointTable, this->morphTable, 24); + SkelAnime_InitFlex(play, &this->skelAnime, &object_fr_Skel_00B498, &object_fr_Anim_001534, this->jointTable, + this->morphTable, 24); // butterfly - SkelAnime_Init(globalCtx, &this->skelAnimeButterfly, &gButterflySkel, &gButterflyAnim, - this->jointTableButterfly, this->morphTableButterfly, 8); + SkelAnime_Init(play, &this->skelAnimeButterfly, &gButterflySkel, &gButterflyAnim, this->jointTableButterfly, + this->morphTableButterfly, 8); // When playing the song for the HP, the frog with the next note and the butterfly turns on its lightsource - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 255, 255, 255, -1); // Check to see if the song for a particular frog has been played. @@ -325,24 +325,24 @@ void EnFr_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnFr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_Destroy(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void EnFr_IsDivingIntoWater(EnFr* this, GlobalContext* globalCtx) { +void EnFr_IsDivingIntoWater(EnFr* this, PlayState* play) { WaterBox* waterBox; f32 waterSurface; - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &waterSurface, &waterBox)) { + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, + &waterBox)) { this->isBelowWaterSurfacePrevious = this->isBelowWaterSurfaceCurrent; this->isBelowWaterSurfaceCurrent = this->actor.world.pos.y <= waterSurface ? true : false; } } -void EnFr_DivingIntoWater(EnFr* this, GlobalContext* globalCtx) { +void EnFr_DivingIntoWater(EnFr* this, PlayState* play) { Vec3f vec; // Jumping into or out of water @@ -350,7 +350,7 @@ void EnFr_DivingIntoWater(EnFr* this, GlobalContext* globalCtx) { vec.x = this->actor.world.pos.x; vec.y = this->actor.world.pos.y - 10.0f; vec.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &vec, NULL, NULL, 1, 1); + EffectSsGSplash_Spawn(play, &vec, NULL, NULL, 1, 1); if (this->isBelowWaterSurfaceCurrent == false) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); @@ -400,7 +400,7 @@ void EnFr_DecrementBlinkTimerUpdate(EnFr* this) { } } -void EnFr_SetupJumpingOutOfWater(EnFr* this, GlobalContext* globalCtx) { +void EnFr_SetupJumpingOutOfWater(EnFr* this, PlayState* play) { if (sEnFrPointers.flags == sTimerJumpingOutOfWater[this->actor.params - 1]) { Animation_Change(&this->skelAnime, &object_fr_Anim_0007BC, 1.0f, 0.0f, Animation_GetLastFrame(&object_fr_Anim_0007BC), ANIMMODE_ONCE, 0.0f); @@ -409,7 +409,7 @@ void EnFr_SetupJumpingOutOfWater(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_JumpingOutOfWater(EnFr* this, GlobalContext* globalCtx) { +void EnFr_JumpingOutOfWater(EnFr* this, PlayState* play) { Vec3f vec1; Vec3f vec2; @@ -443,7 +443,7 @@ void EnFr_JumpingOutOfWater(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_OrientOnLogSpot(EnFr* this, GlobalContext* globalCtx) { +void EnFr_OrientOnLogSpot(EnFr* this, PlayState* play) { s16 rotYRemaining = Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 10000, 100); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -456,7 +456,7 @@ void EnFr_OrientOnLogSpot(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_ChooseJumpFromLogSpot(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ChooseJumpFromLogSpot(EnFr* this, PlayState* play) { if (sEnFrPointers.flags == 12) { this->actor.world.rot.y = RAD_TO_BINANG(sLogSpotToFromWater[this->actor.params].yaw); Animation_Change(&this->skelAnime, &object_fr_Anim_0007BC, 1.0f, 0.0f, @@ -469,7 +469,7 @@ void EnFr_ChooseJumpFromLogSpot(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_JumpingUp(EnFr* this, GlobalContext* globalCtx) { +void EnFr_JumpingUp(EnFr* this, PlayState* play) { f32 yDistToLogSpot; if (this->skelAnime.curFrame == 6.0f) { @@ -494,7 +494,7 @@ void EnFr_JumpingUp(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_JumpingBackIntoWater(EnFr* this, GlobalContext* globalCtx) { +void EnFr_JumpingBackIntoWater(EnFr* this, PlayState* play) { f32 yUnderwater = sLogSpotToFromWater[this->actor.params].yDist + this->posLogSpot.y; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 2, 10000, 100); @@ -517,7 +517,7 @@ void EnFr_JumpingBackIntoWater(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_SetScaleActive(EnFr* this, GlobalContext* globalCtx) { +void EnFr_SetScaleActive(EnFr* this, PlayState* play) { switch (this->isGrowing) { case false: Math_ApproachF(&this->scale, sGrowingScale[this->growingScaleIndex], 2.0f, 25.0f); @@ -545,7 +545,7 @@ void EnFr_SetScaleActive(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_ButterflyPath(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ButterflyPath(EnFr* this, PlayState* play) { s16 rotY = this->actor.shape.rot.y; f32 sin; Vec3f vec1; @@ -569,23 +569,23 @@ void EnFr_ButterflyPath(EnFr* this, GlobalContext* globalCtx) { Matrix_MultVec3f(&vec1, &this->posButterflyLight); } -void EnFr_UpdateActive(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_UpdateActive(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; this->jumpCounter++; Actor_SetScale(&this->actor, this->scale * 0.0001f); if (this->isActive) { - EnFr_SetScaleActive(this, globalCtx); + EnFr_SetScaleActive(this, play); } else { Actor_SetFocus(&this->actor, 10.0f); this->blinkFunc(this); - this->actionFunc(this, globalCtx); - EnFr_IsDivingIntoWater(this, globalCtx); - EnFr_DivingIntoWater(this, globalCtx); + this->actionFunc(this, play); + EnFr_IsDivingIntoWater(this, play); + EnFr_DivingIntoWater(this, play); SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnimeButterfly); - EnFr_ButterflyPath(this, globalCtx); + EnFr_ButterflyPath(this, play); Actor_MoveForward(&this->actor); } } @@ -607,16 +607,16 @@ s32 EnFr_SetupJumpingUp(EnFr* this, s32 frogIndex) { } } -void EnFr_Idle(EnFr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFr_Idle(EnFr* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags2 & PLAYER_STATE2_25) { - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + play->msgCtx.ocarinaMode = OCARINA_MODE_00; } - OnePointCutscene_Init(globalCtx, 4110, ~0x62, &this->actor, CAM_ID_MAIN); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + OnePointCutscene_Init(play, 4110, ~0x62, &this->actor, CAM_ID_MAIN); + play->msgCtx.msgMode = MSGMODE_PAUSED; player->actor.world.pos.x = this->actor.world.pos.x; // x = 990.0f player->actor.world.pos.y = this->actor.world.pos.y; // y = 205.0f player->actor.world.pos.z = this->actor.world.pos.z; // z = -1220.0f @@ -628,18 +628,18 @@ void EnFr_Idle(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_Activate(EnFr* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_PLAYING) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; +void EnFr_Activate(EnFr* this, PlayState* play) { + if (play->msgCtx.msgMode == MSGMODE_OCARINA_PLAYING) { + play->msgCtx.msgMode = MSGMODE_PAUSED; sEnFrPointers.flags = 1; this->actionFunc = EnFr_ActivateCheckFrogSong; - } else if (globalCtx->msgCtx.msgMode == MSGMODE_PAUSED) { // Goes to Frogs 2 Song + } else if (play->msgCtx.msgMode == MSGMODE_PAUSED) { // Goes to Frogs 2 Song sEnFrPointers.flags = 1; this->actionFunc = EnFr_ActivateCheckFrogSong; } } -void EnFr_ActivateCheckFrogSong(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ActivateCheckFrogSong(EnFr* this, PlayState* play) { if (sEnFrPointers.flags == 11) { // Check if all 6 child songs have been played for the frogs if (GET_EVENTCHKINF(EVENTCHKINF_SONGS_FOR_FROGS_ZL) && GET_EVENTCHKINF(EVENTCHKINF_SONGS_FOR_FROGS_EPONA) && @@ -647,7 +647,7 @@ void EnFr_ActivateCheckFrogSong(EnFr* this, GlobalContext* globalCtx) { GET_EVENTCHKINF(EVENTCHKINF_SONGS_FOR_FROGS_SOT) && GET_EVENTCHKINF(EVENTCHKINF_SONGS_FOR_FROGS_STORMS)) { this->actionFunc = EnFr_TalkBeforeFrogSong; this->songIndex = FROG_CHOIR_SONG; - Message_StartTextbox(globalCtx, 0x40AB, &this->actor); + Message_StartTextbox(play, 0x40AB, &this->actor); } else { this->songIndex = FROG_ZL; this->actionFunc = func_80A1BE98; @@ -655,7 +655,7 @@ void EnFr_ActivateCheckFrogSong(EnFr* this, GlobalContext* globalCtx) { } } -void func_80A1BE98(EnFr* this, GlobalContext* globalCtx) { +void func_80A1BE98(EnFr* this, PlayState* play) { EnFr* frog; s32 frogIndex; @@ -668,13 +668,13 @@ void func_80A1BE98(EnFr* this, GlobalContext* globalCtx) { } } - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_NOWARP); + func_8010BD58(play, OCARINA_ACTION_CHECK_NOWARP); this->actionFunc = EnFr_ListeningToOcarinaNotes; } -void EnFr_ListeningToOcarinaNotes(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ListeningToOcarinaNotes(EnFr* this, PlayState* play) { this->songIndex = FROG_NO_SONG; - switch (globalCtx->msgCtx.ocarinaMode) { // Ocarina Song played + switch (play->msgCtx.ocarinaMode) { // Ocarina Song played case OCARINA_MODE_07: this->songIndex = FROG_ZL; break; @@ -694,10 +694,10 @@ void EnFr_ListeningToOcarinaNotes(EnFr* this, GlobalContext* globalCtx) { this->songIndex = FROG_STORMS; break; case OCARINA_MODE_04: - EnFr_OcarinaMistake(this, globalCtx); + EnFr_OcarinaMistake(this, play); break; case OCARINA_MODE_01: // Ocarina note played, but no song played - switch (globalCtx->msgCtx.lastOcarinaButtonIndex) { + switch (play->msgCtx.lastOcarinaButtonIndex) { // Jumping frogs in open ocarina based on ocarina note played case OCARINA_BTN_A: EnFr_SetupJumpingUp(this, FROG_BLUE); @@ -722,7 +722,7 @@ void EnFr_ListeningToOcarinaNotes(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_ChildSong(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ChildSong(EnFr* this, PlayState* play) { EnFr* frog; u8 songIndex; @@ -734,7 +734,7 @@ void EnFr_ChildSong(EnFr* this, GlobalContext* globalCtx) { songIndex = this->songIndex; if (songIndex == FROG_STORMS) { this->actor.textId = 0x40AA; - EnFr_SetupReward(this, globalCtx, false); + EnFr_SetupReward(this, play, false); } else if (!FROG_HAS_SONG_BEEN_PLAYED(songIndex)) { frog = sEnFrPointers.frogs[sSongToFrog[songIndex]]; func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -748,23 +748,23 @@ void EnFr_ChildSong(EnFr* this, GlobalContext* globalCtx) { } } else { this->actor.textId = 0x40A9; - EnFr_SetupReward(this, globalCtx, true); + EnFr_SetupReward(this, play, true); } } } -void EnFr_ChildSongFirstTime(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ChildSongFirstTime(EnFr* this, PlayState* play) { EnFr* frog = sEnFrPointers.frogs[sSongToFrog[this->songIndex]]; if (frog->isActive == false) { this->actor.textId = 0x40A9; - EnFr_SetupReward(this, globalCtx, true); + EnFr_SetupReward(this, play, true); } } -void EnFr_TalkBeforeFrogSong(EnFr* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnFr_TalkBeforeFrogSong(EnFr* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->frogSongTimer = 2; this->actionFunc = EnFr_SetupFrogSong; } @@ -816,23 +816,23 @@ u8 EnFr_GetNextNoteFrogSong(u8 ocarinaNoteIndex) { } } -void EnFr_SetupFrogSong(EnFr* this, GlobalContext* globalCtx) { +void EnFr_SetupFrogSong(EnFr* this, PlayState* play) { if (this->frogSongTimer != 0) { this->frogSongTimer--; } else { this->frogSongTimer = 40; this->ocarinaNoteIndex = 0; - func_8010BD58(globalCtx, OCARINA_ACTION_FROGS); + func_8010BD58(play, OCARINA_ACTION_FROGS); this->ocarinaNote = EnFr_GetNextNoteFrogSong(this->ocarinaNoteIndex); EnFr_CheckOcarinaInputFrogSong(this->ocarinaNote); this->actionFunc = EnFr_ContinueFrogSong; } } -s32 EnFr_IsFrogSongComplete(EnFr* this, GlobalContext* globalCtx) { +s32 EnFr_IsFrogSongComplete(EnFr* this, PlayState* play) { u8 index; u8 ocarinaNote; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; u8 ocarinaNoteIndex; if (this->ocarinaNote == (*msgCtx).lastOcarinaButtonIndex) { // required to match, possibly an array? @@ -853,8 +853,8 @@ s32 EnFr_IsFrogSongComplete(EnFr* this, GlobalContext* globalCtx) { return false; } -void EnFr_OcarinaMistake(EnFr* this, GlobalContext* globalCtx) { - Message_CloseTextbox(globalCtx); +void EnFr_OcarinaMistake(EnFr* this, PlayState* play) { + Message_CloseTextbox(play); this->reward = GI_NONE; func_80078884(NA_SE_SY_OCARINA_ERROR); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); @@ -863,16 +863,16 @@ void EnFr_OcarinaMistake(EnFr* this, GlobalContext* globalCtx) { this->actionFunc = EnFr_Deactivate; } -void EnFr_ContinueFrogSong(EnFr* this, GlobalContext* globalCtx) { +void EnFr_ContinueFrogSong(EnFr* this, PlayState* play) { s32 counter; EnFr* frog; s32 i; if (this->frogSongTimer == 0) { - EnFr_OcarinaMistake(this, globalCtx); + EnFr_OcarinaMistake(this, play); } else { this->frogSongTimer--; - if (globalCtx->msgCtx.msgMode == MSGMODE_FROGS_PLAYING) { + if (play->msgCtx.msgMode == MSGMODE_FROGS_PLAYING) { counter = 0; for (i = 0; i < ARRAY_COUNT(sEnFrPointers.frogs); i++) { frog = sEnFrPointers.frogs[i]; @@ -882,15 +882,15 @@ void EnFr_ContinueFrogSong(EnFr* this, GlobalContext* globalCtx) { counter++; } } - if (counter == 0 && CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B)) { - EnFr_OcarinaMistake(this, globalCtx); + if (counter == 0 && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { + EnFr_OcarinaMistake(this, play); return; } } - if (globalCtx->msgCtx.msgMode == MSGMODE_FROGS_WAITING) { - globalCtx->msgCtx.msgMode = MSGMODE_FROGS_START; - switch (globalCtx->msgCtx.lastOcarinaButtonIndex) { + if (play->msgCtx.msgMode == MSGMODE_FROGS_WAITING) { + play->msgCtx.msgMode = MSGMODE_FROGS_START; + switch (play->msgCtx.lastOcarinaButtonIndex) { case OCARINA_BTN_A: EnFr_SetupJumpingUp(this, FROG_BLUE); break; @@ -906,15 +906,15 @@ void EnFr_ContinueFrogSong(EnFr* this, GlobalContext* globalCtx) { case OCARINA_BTN_C_UP: EnFr_SetupJumpingUp(this, FROG_WHITE); } - if (EnFr_IsFrogSongComplete(this, globalCtx)) { + if (EnFr_IsFrogSongComplete(this, play)) { this->actor.textId = 0x40AC; - EnFr_SetupReward(this, globalCtx, false); + EnFr_SetupReward(this, play, false); } } } } -void EnFr_SetupReward(EnFr* this, GlobalContext* globalCtx, u8 unkCondition) { +void EnFr_SetupReward(EnFr* this, PlayState* play, u8 unkCondition) { EnFr_DeactivateButterfly(); if (unkCondition) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); @@ -923,24 +923,24 @@ void EnFr_SetupReward(EnFr* this, GlobalContext* globalCtx, u8 unkCondition) { } AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = EnFr_PrintTextBox; } -void EnFr_PrintTextBox(EnFr* this, GlobalContext* globalCtx) { - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); +void EnFr_PrintTextBox(EnFr* this, PlayState* play) { + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = EnFr_TalkBeforeReward; } -void EnFr_TalkBeforeReward(EnFr* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void EnFr_TalkBeforeReward(EnFr* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->frogSongTimer = 100; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = EnFr_SetReward; } } -void EnFr_SetReward(EnFr* this, GlobalContext* globalCtx) { +void EnFr_SetReward(EnFr* this, PlayState* play) { u16 songIndex; sEnFrPointers.flags = 12; @@ -971,7 +971,7 @@ void EnFr_SetReward(EnFr* this, GlobalContext* globalCtx) { } } -void EnFr_Deactivate(EnFr* this, GlobalContext* globalCtx) { +void EnFr_Deactivate(EnFr* this, PlayState* play) { EnFr* frogLoop1; EnFr* frogLoop2; s32 frogIndex; @@ -1008,66 +1008,66 @@ void EnFr_Deactivate(EnFr* this, GlobalContext* globalCtx) { frogLoop2->isDeactivating = false; } - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; Audio_PlayActorSound2(&this->actor, NA_SE_EV_FROG_CRY_0); if (this->reward == GI_NONE) { this->actionFunc = EnFr_Idle; } else { this->actionFunc = EnFr_GiveReward; - func_8002F434(&this->actor, globalCtx, this->reward, 30.0f, 100.0f); + func_8002F434(&this->actor, play, this->reward, 30.0f, 100.0f); } } -void EnFr_GiveReward(EnFr* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnFr_GiveReward(EnFr* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnFr_SetIdle; } else { - func_8002F434(&this->actor, globalCtx, this->reward, 30.0f, 100.0f); + func_8002F434(&this->actor, play, this->reward, 30.0f, 100.0f); } } -void EnFr_SetIdle(EnFr* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnFr_SetIdle(EnFr* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->actionFunc = EnFr_Idle; } } -void EnFr_UpdateIdle(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_UpdateIdle(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; if (BREG(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, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } this->jumpCounter++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnFr_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnFr_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { if ((limbIndex == 7) || (limbIndex == 8)) { *dList = NULL; } return 0; } -void EnFr_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnFr_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnFr* this = (EnFr*)thisx; if ((limbIndex == 7) || (limbIndex == 8)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fr.c", 1735); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fr.c", 1735); Matrix_Push(); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fr.c", 1738), + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fr.c", 1738), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fr.c", 1741); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fr.c", 1741); } } -void EnFr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { object_fr_Tex_0059A0, object_fr_Tex_005BA0, @@ -1076,8 +1076,8 @@ void EnFr_Draw(Actor* thisx, GlobalContext* globalCtx) { EnFr* this = (EnFr*)thisx; s16 frogIndex = this->actor.params - 1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fr.c", 1754); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fr.c", 1754); + func_80093D18(play->state.gfxCtx); // For the frogs 2 HP, the frog with the next note and the butterfly lights up lightRadius = this->isButterflyDrawn ? 95 : -1; gDPPipeSync(POLY_OPA_DISP++); @@ -1087,14 +1087,14 @@ void EnFr_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, sEnFrColor[frogIndex].r, sEnFrColor[frogIndex].g, sEnFrColor[frogIndex].b, 255); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFr_OverrideLimbDraw, EnFr_PostLimbDraw, this); if (this->isButterflyDrawn) { Matrix_Translate(this->posButterfly.x, this->posButterfly.y, this->posButterfly.z, MTXMODE_NEW); Matrix_Scale(0.015f, 0.015f, 0.015f, MTXMODE_APPLY); Matrix_RotateZYX(this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnimeButterfly.skeleton, this->skelAnimeButterfly.jointTable, NULL, NULL, + SkelAnime_DrawOpa(play, this->skelAnimeButterfly.skeleton, this->skelAnimeButterfly.jointTable, NULL, NULL, NULL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fr.c", 1816); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fr.c", 1816); } diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.h b/src/overlays/actors/ovl_En_Fr/z_en_fr.h index 0a1de60308..c5425e6b2a 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.h +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.h @@ -6,7 +6,7 @@ struct EnFr; -typedef void (*EnFrActionFunc)(struct EnFr*, GlobalContext*); +typedef void (*EnFrActionFunc)(struct EnFr*, PlayState*); typedef void (*EnFrBlinkFunc)(struct EnFr*); typedef enum { 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 9adf56be25..5b1773fc58 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -13,20 +13,20 @@ #define FU_RESET_LOOK_ANGLE (1 << 0) #define FU_WAIT (1 << 1) -void EnFu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFu_Init(Actor* thisx, PlayState* play); +void EnFu_Destroy(Actor* thisx, PlayState* play); +void EnFu_Update(Actor* thisx, PlayState* play); +void EnFu_Draw(Actor* thisx, PlayState* play); -void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx); -void func_80A1DA04(EnFu* this, GlobalContext* globalCtx); +void EnFu_WaitChild(EnFu* this, PlayState* play); +void func_80A1DA04(EnFu* this, PlayState* play); -void EnFu_WaitAdult(EnFu* this, GlobalContext* globalCtx); -void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx); -void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx); -void func_80A1DBA0(EnFu* this, GlobalContext* globalCtx); -void func_80A1DBD4(EnFu* this, GlobalContext* globalCtx); -void func_80A1DB60(EnFu* this, GlobalContext* globalCtx); +void EnFu_WaitAdult(EnFu* this, PlayState* play); +void EnFu_TeachSong(EnFu* this, PlayState* play); +void EnFu_WaitForPlayback(EnFu* this, PlayState* play); +void func_80A1DBA0(EnFu* this, PlayState* play); +void func_80A1DBD4(EnFu* this, PlayState* play); +void func_80A1DB60(EnFu* this, PlayState* play); const ActorInit En_Fu_InitVars = { ACTOR_EN_FU, @@ -71,16 +71,16 @@ typedef enum { /* 0x01 */ FU_FACE_MAD } EnFuFace; -void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Init(Actor* thisx, PlayState* play) { s32 pad; EnFu* this = (EnFu*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelanime, &gWindmillManSkel, &gWindmillManPlayStillAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelanime, &gWindmillManSkel, &gWindmillManPlayStillAnim, this->jointTable, this->morphTable, FU_LIMB_MAX); Animation_PlayLoop(&this->skelanime, &gWindmillManPlayStillAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &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 (!LINK_IS_ADULT) { @@ -95,15 +95,15 @@ void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; } -void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Destroy(Actor* thisx, PlayState* play) { EnFu* this = (EnFu*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80A1D94C(EnFu* this, GlobalContext* globalCtx, u16 textID, EnFuActionFunc actionFunc) { +s32 func_80A1D94C(EnFu* this, PlayState* play, u16 textID, EnFuActionFunc actionFunc) { s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = actionFunc; return true; } @@ -111,15 +111,15 @@ s32 func_80A1D94C(EnFu* this, GlobalContext* globalCtx, u16 textID, EnFuActionFu yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(yawDiff) < 0x2301) && (this->actor.xzDistToPlayer < 100.0f)) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } else { this->behaviorFlags |= FU_RESET_LOOK_ANGLE; } return false; } -void func_80A1DA04(EnFu* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A1DA04(EnFu* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->behaviorFlags &= ~FU_WAIT; this->actionFunc = EnFu_WaitChild; @@ -130,8 +130,8 @@ void func_80A1DA04(EnFu* this, GlobalContext* globalCtx) { } } -void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) { - u16 textID = Text_GetFaceReaction(globalCtx, 0xB); +void EnFu_WaitChild(EnFu* this, PlayState* play) { + u16 textID = Text_GetFaceReaction(play, 0xB); if (textID == 0) { textID = GET_EVENTCHKINF(EVENTCHKINF_67) ? 0x5033 : 0x5032; @@ -139,7 +139,7 @@ void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) { // if ACTOR_FLAG_8 is set and textID is 0x5033, change animation // if func_80A1D94C returns 1, actionFunc is set to func_80A1DA04 - if (func_80A1D94C(this, globalCtx, textID, func_80A1DA04)) { + if (func_80A1D94C(this, play, textID, func_80A1DA04)) { if (textID == 0x5033) { Animation_Change(&this->skelanime, &gWindmillManPlayAndMoveHeadAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gWindmillManPlayAndMoveHeadAnim), ANIMMODE_ONCE, -4.0f); @@ -147,105 +147,105 @@ void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) { } } -void func_80A1DB60(EnFu* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +void func_80A1DB60(EnFu* this, PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { this->actionFunc = EnFu_WaitAdult; SET_EVENTCHKINF(EVENTCHKINF_5B); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } } -void func_80A1DBA0(EnFu* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A1DBA0(EnFu* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnFu_WaitAdult; } } -void func_80A1DBD4(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A1DBD4(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_04) { + if (play->msgCtx.ocarinaMode >= OCARINA_MODE_04) { this->actionFunc = EnFu_WaitAdult; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; this->actor.flags &= ~ACTOR_FLAG_16; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { func_80078884(NA_SE_SY_CORRECT_CHIME); this->actionFunc = func_80A1DB60; this->actor.flags &= ~ACTOR_FLAG_16; - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gSongOfStormsCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gSongOfStormsCs); gSaveContext.cutsceneTrigger = 1; - Item_Give(globalCtx, ITEM_SONG_STORMS); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + Item_Give(play, ITEM_SONG_STORMS); + play->msgCtx.ocarinaMode = OCARINA_MODE_00; SET_EVENTCHKINF(EVENTCHKINF_65); - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_02) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_02) { player->stateFlags2 &= ~PLAYER_STATE2_24; this->actionFunc = EnFu_WaitAdult; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { player->stateFlags2 |= PLAYER_STATE2_23; } } -void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +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(&globalCtx->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) { - func_8010BD58(globalCtx, OCARINA_ACTION_PLAYBACK_STORMS); + if (Message_GetState(&play->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) { + func_8010BD58(play, OCARINA_ACTION_PLAYBACK_STORMS); this->actionFunc = func_80A1DBD4; } } -void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +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(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->behaviorFlags &= ~FU_WAIT; // Ocarina is set to harp here but is immediately overwritten to the grind organ in the message system AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_HARP); - func_8010BD58(globalCtx, OCARINA_ACTION_TEACH_STORMS); + func_8010BD58(play, OCARINA_ACTION_TEACH_STORMS); this->actionFunc = EnFu_WaitForPlayback; } } -void EnFu_WaitAdult(EnFu* this, GlobalContext* globalCtx) { +void EnFu_WaitAdult(EnFu* this, PlayState* play) { static s16 yawDiff; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (GET_EVENTCHKINF(EVENTCHKINF_5B)) { - func_80A1D94C(this, globalCtx, 0x508E, func_80A1DBA0); + func_80A1D94C(this, play, 0x508E, func_80A1DBA0); } else if (player->stateFlags2 & PLAYER_STATE2_24) { this->actor.textId = 0x5035; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->actionFunc = EnFu_TeachSong; this->behaviorFlags |= FU_WAIT; - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80A1DBA0; } else if (ABS(yawDiff) < 0x2301) { if (this->actor.xzDistToPlayer < 100.0f) { this->actor.textId = 0x5034; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); player->stateFlags2 |= PLAYER_STATE2_23; } } } -void EnFu_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Update(Actor* thisx, PlayState* play) { s32 pad; EnFu* this = (EnFu*)thisx; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (!(this->behaviorFlags & FU_WAIT) && (SkelAnime_Update(&this->skelanime) != 0)) { Animation_Change(&this->skelanime, this->skelanime.animation, 1.0f, 0.0f, Animation_GetLastFrame(this->skelanime.animation), ANIMMODE_ONCE, 0.0f); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->behaviorFlags & FU_RESET_LOOK_ANGLE) { Math_SmoothStepToS(&this->lookAngleOffset.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->lookAngleOffset.y, 0, 6, 6200, 100); @@ -253,11 +253,11 @@ void EnFu_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_2A2.y, 0, 6, 6200, 100); this->behaviorFlags &= ~FU_RESET_LOOK_ANGLE; } else { - func_80038290(globalCtx, &this->actor, &this->lookAngleOffset, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->lookAngleOffset, &this->unk_2A2, this->actor.focus.pos); } } -s32 EnFu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnFu* this = (EnFu*)thisx; s32 pad; @@ -278,13 +278,13 @@ s32 EnFu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } if (limbIndex == FU_LIMB_CHEST_MUSIC_BOX) { - rot->y += (Math_SinS((globalCtx->state.frames * (limbIndex * 50 + 0x814))) * 200.0f); - rot->z += (Math_CosS((globalCtx->state.frames * (limbIndex * 50 + 0x940))) * 200.0f); + rot->y += (Math_SinS((play->state.frames * (limbIndex * 50 + 0x814))) * 200.0f); + rot->z += (Math_CosS((play->state.frames * (limbIndex * 50 + 0x940))) * 200.0f); } return false; } -void EnFu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnFu_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnFu* this = (EnFu*)thisx; if (limbIndex == FU_LIMB_HEAD) { @@ -292,19 +292,19 @@ void EnFu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnFu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Draw(Actor* thisx, PlayState* play) { static void* sEyesSegments[] = { gWindmillManEyeClosedTex, gWindmillManEyeAngryTex }; static void* sMouthSegments[] = { gWindmillManMouthOpenTex, gWindmillManMouthAngryTex }; s32 pad; EnFu* this = (EnFu*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fu.c", 773); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fu.c", 773); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->facialExpression])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthSegments[this->facialExpression])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, EnFu_OverrideLimbDraw, EnFu_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fu.c", 791); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fu.c", 791); } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.h b/src/overlays/actors/ovl_En_Fu/z_en_fu.h index a3d22b0d9a..f8135e64c4 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.h +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.h @@ -6,7 +6,7 @@ struct EnFu; -typedef void (*EnFuActionFunc)(struct EnFu*, GlobalContext*); +typedef void (*EnFuActionFunc)(struct EnFu*, PlayState*); typedef enum { /* 0x00 */ FU_LIMB_ROOT, 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 5dc69cc467..665279c1ea 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -11,18 +11,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9) -void EnFw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFw_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFw_Init(Actor* thisx, PlayState* play); +void EnFw_Destroy(Actor* thisx, PlayState* play); +void EnFw_Update(Actor* thisx, PlayState* play); +void EnFw_Draw(Actor* thisx, PlayState* play); void EnFw_UpdateEffects(EnFw* this); -void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx); +void EnFw_DrawEffects(EnFw* this, PlayState* play); void EnFw_SpawnEffectDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* accel, u8 initialTimer, f32 scale, f32 scaleStep); -void EnFw_Bounce(EnFw* this, GlobalContext* globalCtx); -void EnFw_Run(EnFw* this, GlobalContext* globalCtx); -void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx); -void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx); +void EnFw_Bounce(EnFw* this, PlayState* play); +void EnFw_Run(EnFw* this, PlayState* play); +void EnFw_JumpToParentInitPos(EnFw* this, PlayState* play); +void EnFw_TurnToParentInitPos(EnFw* this, PlayState* play); const ActorInit En_Fw_InitVars = { ACTOR_EN_FW, @@ -98,8 +98,8 @@ s32 EnFw_DoBounce(EnFw* this, s32 totalBounces, f32 yVelocity) { return true; } -s32 EnFw_PlayerInRange(EnFw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnFw_PlayerInRange(EnFw* this, PlayState* play) { + Player* player = GET_PLAYER(play); CollisionPoly* poly; s32 bgId; Vec3f collisionPos; @@ -112,8 +112,8 @@ s32 EnFw_PlayerInRange(EnFw* this, GlobalContext* globalCtx) { return false; } - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &player->actor.world.pos, &collisionPos, - &poly, true, false, false, true, &bgId)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &player->actor.world.pos, &collisionPos, &poly, + true, false, false, true, &bgId)) { return false; } @@ -134,7 +134,7 @@ Vec3f* EnFw_GetPosAdjAroundCircle(Vec3f* dst, EnFw* this, f32 radius, s16 dir) { return dst; } -s32 EnFw_CheckCollider(EnFw* this, GlobalContext* globalCtx) { +s32 EnFw_CheckCollider(EnFw* this, PlayState* play) { ColliderInfo* info; if (this->collider.base.acFlags & AC_HIT) { @@ -147,7 +147,7 @@ s32 EnFw_CheckCollider(EnFw* this, GlobalContext* globalCtx) { this->collider.base.acFlags &= ~AC_HIT; if (Actor_ApplyDamage(&this->actor) <= 0) { if (this->actor.parent->colChkInfo.health <= 8) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.parent->colChkInfo.health = 0; } else { this->actor.parent->colChkInfo.health -= 8; @@ -184,15 +184,14 @@ s32 EnFw_SpawnDust(EnFw* this, u8 timer, f32 scale, f32 scaleStep, s32 dustCnt, return 0; } -void EnFw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFw_Init(Actor* thisx, PlayState* play) { EnFw* this = (EnFw*)thisx; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFlareDancerCoreSkel, NULL, this->jointTable, this->morphTable, - 11); + SkelAnime_InitFlex(play, &this->skelAnime, &gFlareDancerCoreSkel, NULL, this->jointTable, this->morphTable, 11); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFW_ANIM_0); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->sphs); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->sphs); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x10), &D_80A1FB94); Actor_SetScale(&this->actor, 0.01f); this->runDirection = -this->actor.params; @@ -200,20 +199,20 @@ void EnFw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; } -void EnFw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFw_Destroy(Actor* thisx, PlayState* play) { EnFw* this = (EnFw*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void EnFw_Bounce(EnFw* this, GlobalContext* globalCtx) { +void EnFw_Bounce(EnFw* this, PlayState* play) { if (EnFw_DoBounce(this, 3, 8.0f) && this->bounceCnt == 0) { this->returnToParentTimer = Rand_S16Offset(300, 150); this->actionFunc = EnFw_Run; } } -void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { +void EnFw_Run(EnFw* this, PlayState* play) { f32 tmpAngle; s16 curFrame; f32 facingDir; @@ -229,7 +228,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { return; } - if (this->damageTimer == 0 && this->explosionTimer == 0 && EnFw_CheckCollider(this, globalCtx)) { + if (this->damageTimer == 0 && this->explosionTimer == 0 && EnFw_CheckCollider(this, play)) { if (this->actor.parent->colChkInfo.health > 0) { if (!this->lastDmgHook) { this->actor.velocity.y = 6.0f; @@ -253,14 +252,14 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { } if (this->explosionTimer == 0) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->bompPos.x, this->bompPos.y, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->bompPos.x, this->bompPos.y, this->bompPos.z, 0, 0, 0x600, 0); if (bomb != NULL) { bomb->timer = 0; } flareDancer = this->actor.parent; flareDancer->params |= 0x4000; - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0xA0); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0xA0); Actor_Kill(&this->actor); return; } @@ -300,7 +299,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { this->actor.world.rot = this->actor.shape.rot; - if (this->slideTimer == 0 && EnFw_PlayerInRange(this, globalCtx)) { + if (this->slideTimer == 0 && EnFw_PlayerInRange(this, play)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_MAN_SURP); this->slideSfxTimer = 8; this->slideTimer = 8; @@ -330,7 +329,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { } } -void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx) { +void EnFw_TurnToParentInitPos(EnFw* this, PlayState* play) { s16 angleToParentInit; angleToParentInit = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.parent->home.pos); @@ -346,7 +345,7 @@ void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx) { } } -void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx) { +void EnFw_JumpToParentInitPos(EnFw* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && this->actor.velocity.y <= 0.0f) { this->actor.parent->params |= 0x8000; Actor_Kill(&this->actor); @@ -356,29 +355,27 @@ void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx) { } } -void EnFw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFw_Update(Actor* thisx, PlayState* play) { EnFw* this = (EnFw*)thisx; SkelAnime_Update(&this->skelAnime); if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { // not attached to hookshot. Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 20.0f, 0.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + this->actionFunc(this, play); if (this->damageTimer == 0 && this->explosionTimer == 0 && this->actionFunc == EnFw_Run) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -s32 EnFw_OverrideLimbDraw(GlobalContext* globalContext, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnFw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { return false; } -void EnFw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnFw_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnFw* this = (EnFw*)thisx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -395,15 +392,15 @@ void EnFw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Collider_UpdateSpheres(limbIndex, &this->collider); } -void EnFw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFw_Draw(Actor* thisx, PlayState* play) { EnFw* this = (EnFw*)thisx; EnFw_UpdateEffects(this); Matrix_Push(); - EnFw_DrawEffects(this, globalCtx); + EnFw_DrawEffects(this, play); Matrix_Pop(); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFw_OverrideLimbDraw, EnFw_PostLimbDraw, this); } @@ -448,7 +445,7 @@ void EnFw_UpdateEffects(EnFw* this) { } } -void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx) { +void EnFw_DrawEffects(EnFw* this, PlayState* play) { static void* dustTextures[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; @@ -458,10 +455,10 @@ void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx) { s16 i; s16 idx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fw.c", 1191); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fw.c", 1191); materialFlag = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (1) {} for (i = 0; i < EN_FW_EFFECT_COUNT; i++, eff++) { @@ -477,9 +474,9 @@ void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fw.c", 1229), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fw.c", 1229), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); idx = eff->timer * (8.0f / eff->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); @@ -487,5 +484,5 @@ void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fw.c", 1243); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fw.c", 1243); } diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.h b/src/overlays/actors/ovl_En_Fw/z_en_fw.h index c2d482b98f..79ccf12d9c 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.h +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.h @@ -6,7 +6,7 @@ struct EnFw; -typedef void (*EnFwActionFunc)(struct EnFw* this, GlobalContext* globalCtx); +typedef void (*EnFwActionFunc)(struct EnFw* this, PlayState* play); #define EN_FW_EFFECT_COUNT 20 diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 62fa71bc2f..897ffb8495 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -3,47 +3,47 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_10) -void EnFz_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFz_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFz_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFz_Init(Actor* thisx, PlayState* play); +void EnFz_Destroy(Actor* thisx, PlayState* play); +void EnFz_Update(Actor* thisx, PlayState* play); +void EnFz_Draw(Actor* thisx, PlayState* play); -void EnFz_UpdateTargetPos(EnFz* this, GlobalContext* globalCtx); +void EnFz_UpdateTargetPos(EnFz* this, PlayState* play); // Stationary Freezard void EnFz_SetupBlowSmokeStationary(EnFz* this); -void EnFz_BlowSmokeStationary(EnFz* this, GlobalContext* globalCtx); +void EnFz_BlowSmokeStationary(EnFz* this, PlayState* play); // Moving Freezard that can vanish and reappear -void EnFz_Wait(EnFz* this, GlobalContext* globalCtx); +void EnFz_Wait(EnFz* this, PlayState* play); void EnFz_SetupAppear(EnFz* this); -void EnFz_Appear(EnFz* this, GlobalContext* globalCtx); +void EnFz_Appear(EnFz* this, PlayState* play); void EnFz_SetupAimForMove(EnFz* this); -void EnFz_AimForMove(EnFz* this, GlobalContext* globalCtx); +void EnFz_AimForMove(EnFz* this, PlayState* play); void EnFz_SetupMoveTowardsPlayer(EnFz* this); -void EnFz_MoveTowardsPlayer(EnFz* this, GlobalContext* globalCtx); +void EnFz_MoveTowardsPlayer(EnFz* this, PlayState* play); void EnFz_SetupAimForFreeze(EnFz* this); -void EnFz_AimForFreeze(EnFz* this, GlobalContext* globalCtx); -void EnFz_SetupBlowSmoke(EnFz* this, GlobalContext* globalCtx); -void EnFz_BlowSmoke(EnFz* this, GlobalContext* globalCtx); +void EnFz_AimForFreeze(EnFz* this, PlayState* play); +void EnFz_SetupBlowSmoke(EnFz* this, PlayState* play); +void EnFz_BlowSmoke(EnFz* this, PlayState* play); void EnFz_SetupDisappear(EnFz* this); -void EnFz_Disappear(EnFz* this, GlobalContext* globalCtx); +void EnFz_Disappear(EnFz* this, PlayState* play); void EnFz_SetupWait(EnFz* this); // Killed with fire source void EnFz_SetupMelt(EnFz* this); -void EnFz_Melt(EnFz* this, GlobalContext* globalCtx); +void EnFz_Melt(EnFz* this, PlayState* play); // Death -void EnFz_SetupDespawn(EnFz* this, GlobalContext* globalCtx); -void EnFz_Despawn(EnFz* this, GlobalContext* globalCtx); +void EnFz_SetupDespawn(EnFz* this, PlayState* play); +void EnFz_Despawn(EnFz* this, PlayState* play); // Ice Smoke Effects void EnFz_SpawnIceSmokeNoFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 xyScale); void EnFz_SpawnIceSmokeFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 xyScale, f32 xyScaleTarget, s16 primAlpha, u8 isTimerMod8); -void EnFz_UpdateIceSmoke(EnFz* this, GlobalContext* globalCtx); -void EnFz_DrawEffects(EnFz* this, GlobalContext* globalCtx); +void EnFz_UpdateIceSmoke(EnFz* this, PlayState* play); +void EnFz_DrawEffects(EnFz* this, PlayState* play); const ActorInit En_Fz_InitVars = { ACTOR_EN_FZ, @@ -155,21 +155,21 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void EnFz_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFz_Init(Actor* thisx, PlayState* play) { EnFz* this = (EnFz*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 6; - Collider_InitCylinder(globalCtx, &this->collider1); - Collider_SetCylinderType1(globalCtx, &this->collider1, &this->actor, &sCylinderInit1); + Collider_InitCylinder(play, &this->collider1); + Collider_SetCylinderType1(play, &this->collider1, &this->actor, &sCylinderInit1); - Collider_InitCylinder(globalCtx, &this->collider2); - Collider_SetCylinderType1(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); + Collider_InitCylinder(play, &this->collider2); + Collider_SetCylinderType1(play, &this->collider2, &this->actor, &sCylinderInit2); - Collider_InitCylinder(globalCtx, &this->collider3); - Collider_SetCylinderType1(globalCtx, &this->collider3, &this->actor, &sCylinderInit3); + Collider_InitCylinder(play, &this->collider3); + Collider_SetCylinderType1(play, &this->collider3, &this->actor, &sCylinderInit3); Actor_SetScale(&this->actor, 0.008f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -199,18 +199,18 @@ void EnFz_Init(Actor* thisx, GlobalContext* globalCtx) { EnFz_SetupBlowSmokeStationary(this); } - EnFz_UpdateTargetPos(this, globalCtx); + EnFz_UpdateTargetPos(this, play); } -void EnFz_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFz_Destroy(Actor* thisx, PlayState* play) { EnFz* this = (EnFz*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); - Collider_DestroyCylinder(globalCtx, &this->collider3); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); + Collider_DestroyCylinder(play, &this->collider3); } -void EnFz_UpdateTargetPos(EnFz* this, GlobalContext* globalCtx) { +void EnFz_UpdateTargetPos(EnFz* this, PlayState* play) { Vec3f pos; Vec3f hitPos; Vec3f vec1; @@ -227,8 +227,8 @@ void EnFz_UpdateTargetPos(EnFz* this, GlobalContext* globalCtx) { vec1.z = 220.0f; Matrix_MultVec3f(&vec1, &this->wallHitPos); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &pos, &this->wallHitPos, &hitPos, &hitPoly, true, false, false, - true, &bgId)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &pos, &this->wallHitPos, &hitPos, &hitPoly, true, false, false, true, + &bgId)) { Math_Vec3f_Copy(&this->wallHitPos, &hitPos); } @@ -246,7 +246,7 @@ s32 EnFz_ReachedTarget(EnFz* this, Vec3f* vec) { } } -void EnFz_Damaged(EnFz* this, GlobalContext* globalCtx, Vec3f* vec, s32 numEffects, f32 unkFloat) { +void EnFz_Damaged(EnFz* this, PlayState* play, Vec3f* vec, s32 numEffects, f32 unkFloat) { s32 i; Vec3f pos; Vec3f vel; @@ -275,10 +275,10 @@ void EnFz_Damaged(EnFz* this, GlobalContext* globalCtx, Vec3f* vec, s32 numEffec vel.x = Rand_CenteredFloat(10.0f); vel.y = Rand_ZeroFloat(10.0f) + 2.0f; vel.z = Rand_CenteredFloat(10.0f); - EffectSsEnIce_Spawn(globalCtx, &pos, scale, &vel, &accel, &primColor, &envColor, life); + EffectSsEnIce_Spawn(play, &pos, scale, &vel, &accel, &primColor, &envColor, life); } - CollisionCheck_SpawnShieldParticles(globalCtx, vec); + CollisionCheck_SpawnShieldParticles(play, vec); } void EnFz_SpawnIceSmokeHiddenState(EnFz* this) { @@ -318,12 +318,11 @@ void EnFz_SpawnIceSmokeActiveState(EnFz* this) { } } -void EnFz_ApplyDamage(EnFz* this, GlobalContext* globalCtx) { +void EnFz_ApplyDamage(EnFz* this, PlayState* play) { Vec3f vec; - if (this->isMoving && - ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - (Actor_TestFloorInDirection(&this->actor, globalCtx, 60.0f, this->actor.world.rot.y) == 0))) { + if (this->isMoving && ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || + (Actor_TestFloorInDirection(&this->actor, play, 60.0f, this->actor.world.rot.y) == 0))) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; this->isMoving = false; this->speedXZ = 0.0f; @@ -351,7 +350,7 @@ void EnFz_ApplyDamage(EnFz* this, GlobalContext* globalCtx) { vec.x = this->actor.world.pos.x; vec.y = this->actor.world.pos.y; vec.z = this->actor.world.pos.z; - EnFz_Damaged(this, globalCtx, &vec, 10, 0.0f); + EnFz_Damaged(this, play, &vec, 10, 0.0f); this->unusedCounter++; } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FREEZAD_DEAD); @@ -359,8 +358,8 @@ void EnFz_ApplyDamage(EnFz* this, GlobalContext* globalCtx) { vec.x = this->actor.world.pos.x; vec.y = this->actor.world.pos.y; vec.z = this->actor.world.pos.z; - EnFz_Damaged(this, globalCtx, &vec, 30, 10.0f); - EnFz_SetupDespawn(this, globalCtx); + EnFz_Damaged(this, play, &vec, 30, 10.0f); + EnFz_SetupDespawn(this, play); } } } else { @@ -389,7 +388,7 @@ void EnFz_SetupDisappear(EnFz* this) { this->actionFunc = EnFz_Disappear; } -void EnFz_Disappear(EnFz* this, GlobalContext* globalCtx) { +void EnFz_Disappear(EnFz* this, PlayState* play) { this->envAlpha -= 16; if (this->envAlpha > 255) { @@ -412,7 +411,7 @@ void EnFz_SetupWait(EnFz* this) { this->actor.world.pos.z = this->posOrigin.z; } -void EnFz_Wait(EnFz* this, GlobalContext* globalCtx) { +void EnFz_Wait(EnFz* this, PlayState* play) { if ((this->timer == 0) && (this->actor.xzDistToPlayer < 400.0f)) { EnFz_SetupAppear(this); } @@ -425,7 +424,7 @@ void EnFz_SetupAppear(EnFz* this) { this->actionFunc = EnFz_Appear; } -void EnFz_Appear(EnFz* this, GlobalContext* globalCtx) { +void EnFz_Appear(EnFz* this, PlayState* play) { if (this->timer == 0) { this->envAlpha += 8; if (this->envAlpha > 255) { @@ -448,7 +447,7 @@ void EnFz_SetupAimForMove(EnFz* this) { this->actor.gravity = -1.0f; } -void EnFz_AimForMove(EnFz* this, GlobalContext* globalCtx) { +void EnFz_AimForMove(EnFz* this, PlayState* play) { EnFz_SetYawTowardsPlayer(this); if (this->timer == 0) { @@ -464,7 +463,7 @@ void EnFz_SetupMoveTowardsPlayer(EnFz* this) { this->speedXZ = 4.0f; } -void EnFz_MoveTowardsPlayer(EnFz* this, GlobalContext* globalCtx) { +void EnFz_MoveTowardsPlayer(EnFz* this, PlayState* play) { if ((this->timer == 0) || !this->isMoving) { EnFz_SetupAimForFreeze(this); } @@ -478,22 +477,22 @@ void EnFz_SetupAimForFreeze(EnFz* this) { this->actor.speedXZ = 0.0f; } -void EnFz_AimForFreeze(EnFz* this, GlobalContext* globalCtx) { +void EnFz_AimForFreeze(EnFz* this, PlayState* play) { EnFz_SetYawTowardsPlayer(this); if (this->timer == 0) { - EnFz_SetupBlowSmoke(this, globalCtx); + EnFz_SetupBlowSmoke(this, play); } } -void EnFz_SetupBlowSmoke(EnFz* this, GlobalContext* globalCtx) { +void EnFz_SetupBlowSmoke(EnFz* this, PlayState* play) { this->state = 1; this->timer = 80; this->actionFunc = EnFz_BlowSmoke; - EnFz_UpdateTargetPos(this, globalCtx); + EnFz_UpdateTargetPos(this, play); } -void EnFz_BlowSmoke(EnFz* this, GlobalContext* globalCtx) { +void EnFz_BlowSmoke(EnFz* this, PlayState* play) { Vec3f vec1; Vec3f pos; Vec3f velocity; @@ -541,7 +540,7 @@ void EnFz_BlowSmoke(EnFz* this, GlobalContext* globalCtx) { } } -void EnFz_SetupDespawn(EnFz* this, GlobalContext* globalCtx) { +void EnFz_SetupDespawn(EnFz* this, PlayState* play) { this->state = 0; this->updateBgInfo = true; this->isFreezing = false; @@ -553,12 +552,12 @@ void EnFz_SetupDespawn(EnFz* this, GlobalContext* globalCtx) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x60); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x60); this->actionFunc = EnFz_Despawn; } -void EnFz_Despawn(EnFz* this, GlobalContext* globalCtx) { +void EnFz_Despawn(EnFz* this, PlayState* play) { if (this->timer == 0) { Actor_Kill(&this->actor); } @@ -574,7 +573,7 @@ void EnFz_SetupMelt(EnFz* this) { this->speedXZ = 0.0f; } -void EnFz_Melt(EnFz* this, GlobalContext* globalCtx) { +void EnFz_Melt(EnFz* this, PlayState* play) { Math_StepToF(&this->actor.scale.y, 0.0006f, 0.0002f); if (this->actor.scale.y < 0.006f) { @@ -590,7 +589,7 @@ void EnFz_Melt(EnFz* this, GlobalContext* globalCtx) { } if (this->envAlpha == 0) { - EnFz_SetupDespawn(this, globalCtx); + EnFz_SetupDespawn(this, play); } } @@ -604,7 +603,7 @@ void EnFz_SetupBlowSmokeStationary(EnFz* this) { this->actor.gravity = -1.0f; } -void EnFz_BlowSmokeStationary(EnFz* this, GlobalContext* globalCtx) { +void EnFz_BlowSmokeStationary(EnFz* this, PlayState* play) { Vec3f vec1; Vec3f pos; Vec3f velocity; @@ -614,7 +613,7 @@ void EnFz_BlowSmokeStationary(EnFz* this, GlobalContext* globalCtx) { if (this->counter & 0xC0) { EnFz_SetYawTowardsPlayer(this); - EnFz_UpdateTargetPos(this, globalCtx); + EnFz_UpdateTargetPos(this, play); } else { isTimerMod8 = false; primAlpha = 150; @@ -660,7 +659,7 @@ static EnFzSpawnIceSmokeFunc iceSmokeSpawnFuncs[] = { EnFz_SpawnIceSmokeActiveState, }; -void EnFz_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFz_Update(Actor* thisx, PlayState* play) { EnFz* this = (EnFz*)thisx; s32 pad; @@ -679,17 +678,17 @@ void EnFz_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, 50.0f); - EnFz_ApplyDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnFz_ApplyDamage(this, play); + this->actionFunc(this, play); if (this->isDespawning == false) { Collider_UpdateCylinder(&this->actor, &this->collider1); Collider_UpdateCylinder(&this->actor, &this->collider2); if (this->isFreezing) { if (this->actor.colorFilterTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); } } @@ -697,15 +696,14 @@ void EnFz_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if (this->updateBgInfo) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } iceSmokeSpawnFuncs[this->state](this); - EnFz_UpdateIceSmoke(this, globalCtx); + EnFz_UpdateIceSmoke(this, play); } -void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFz_Draw(Actor* thisx, PlayState* play) { static Gfx* displayLists[] = { gFreezardIntactDL, // Body fully intact (5 or 6 health) gFreezardTopRightHornChippedDL, // Top right horn chipped off (from Freezards perspective) (3 or 4 health) @@ -717,7 +715,7 @@ void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx) { index = (6 - this->actor.colChkInfo.health) >> 1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fz.c", 1167); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fz.c", 1167); if (1) {} @@ -726,12 +724,12 @@ void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (this->isActive) { - func_8002ED80(&this->actor, globalCtx, 0); - func_80093D84(globalCtx->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, globalCtx->state.frames & 0x7F, 32, 32, 1, 0, - (2 * globalCtx->state.frames) & 0x7F, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fz.c", 1183), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->state.frames & 0x7F, 32, 32, 1, 0, + (2 * play->state.frames) & 0x7F, 32, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fz.c", 1183), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetCombineLERP(POLY_XLU_DISP++, TEXEL1, PRIMITIVE, PRIM_LOD_FRAC, TEXEL0, TEXEL1, TEXEL0, PRIMITIVE, TEXEL0, PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, ENVIRONMENT, 0); @@ -740,8 +738,8 @@ void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, displayLists[index]); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fz.c", 1200); - EnFz_DrawEffects(this, globalCtx); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fz.c", 1200); + EnFz_DrawEffects(this, play); } void EnFz_SpawnIceSmokeNoFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 xyScale) { @@ -789,7 +787,7 @@ void EnFz_SpawnIceSmokeFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* ac } } -void EnFz_UpdateIceSmoke(EnFz* this, GlobalContext* globalCtx) { +void EnFz_UpdateIceSmoke(EnFz* this, PlayState* play) { EnFzEffect* effect = this->effects; s16 i; Vec3f pos; @@ -837,7 +835,7 @@ void EnFz_UpdateIceSmoke(EnFz* this, GlobalContext* globalCtx) { this->collider3.dim.pos.x = (s16)effect->pos.x; this->collider3.dim.pos.y = (s16)effect->pos.y; this->collider3.dim.pos.z = (s16)effect->pos.z; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider3.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider3.base); } pos.x = effect->pos.x; @@ -855,15 +853,15 @@ void EnFz_UpdateIceSmoke(EnFz* this, GlobalContext* globalCtx) { } } -void EnFz_DrawEffects(EnFz* this, GlobalContext* globalCtx) { +void EnFz_DrawEffects(EnFz* this, PlayState* play) { EnFzEffect* effect = this->effects; s16 i; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 materialFlag = 0; OPEN_DISPS(gfxCtx, "../z_en_fz.c", 1384); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < EN_FZ_EFFECT_COUNT; i++) { if (effect->type > 0) { @@ -876,10 +874,10 @@ void EnFz_DrawEffects(EnFz* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, effect->primAlpha); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 3 * (effect->timer + (3 * i)), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 3 * (effect->timer + (3 * i)), 15 * (effect->timer + (3 * i)), 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->xyScale, effect->xyScale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_fz.c", 1424), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); 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 eac5e972e1..5c54720f2d 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.h +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.h @@ -6,7 +6,7 @@ struct EnFz; -typedef void (*EnFzActionFunc)(struct EnFz*, GlobalContext*); +typedef void (*EnFzActionFunc)(struct EnFz*, PlayState*); typedef void (*EnFzSpawnIceSmokeFunc)(struct EnFz*); typedef struct { diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index 02805691a2..977f9e3260 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -19,23 +19,23 @@ typedef enum { /* 1 */ MOVE_HOME } GSwitchMoveState; -void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGSwitch_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGSwitch_DrawRupee(Actor* thisx, GlobalContext* globalCtx); -void EnGSwitch_DrawPot(Actor* thisx, GlobalContext* globalCtx); +void EnGSwitch_Init(Actor* thisx, PlayState* play); +void EnGSwitch_Destroy(Actor* thisx, PlayState* play); +void EnGSwitch_Update(Actor* thisx, PlayState* play); +void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play); +void EnGSwitch_DrawPot(Actor* thisx, PlayState* play); -void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_WaitForObject(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_SilverRupeeCollected(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_GalleryRupee(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_ArcheryPot(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_Kill(EnGSwitch* this, GlobalContext* globalCtx); +void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, PlayState* play); +void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, PlayState* play); +void EnGSwitch_WaitForObject(EnGSwitch* this, PlayState* play); +void EnGSwitch_SilverRupeeCollected(EnGSwitch* this, PlayState* play); +void EnGSwitch_GalleryRupee(EnGSwitch* this, PlayState* play); +void EnGSwitch_ArcheryPot(EnGSwitch* this, PlayState* play); +void EnGSwitch_Kill(EnGSwitch* this, PlayState* play); void EnGSwitch_SpawnEffects(EnGSwitch* this, Vec3f* pos, s16 scale, s16 colorIdx); -void EnGSwitch_UpdateEffects(EnGSwitch* this, GlobalContext* globalCtx); -void EnGSwitch_DrawEffects(EnGSwitch* this, GlobalContext* globalCtx); +void EnGSwitch_UpdateEffects(EnGSwitch* this, PlayState* play); +void EnGSwitch_DrawEffects(EnGSwitch* this, PlayState* play); static s16 sCollectedCount = 0; @@ -76,7 +76,7 @@ const ActorInit En_G_Switch_InitVars = { NULL, }; -void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGSwitch_Init(Actor* thisx, PlayState* play) { s32 pad; EnGSwitch* this = (EnGSwitch*)thisx; @@ -98,7 +98,7 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { // "maximum number of checks" osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 最大チェック数 ☆☆☆☆☆ %d\n" VT_RST, this->silverCount); osSyncPrintf("\n\n"); - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { // This is a reference to Hokuto no Ken osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); Actor_Kill(&this->actor); @@ -112,11 +112,11 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 子スイッチ発生 ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); this->colorIdx = 5; this->numEffects = 20; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.draw = EnGSwitch_DrawRupee; this->actor.shape.yOffset = 700.0f; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); Actor_Kill(&this->actor); } else { @@ -130,14 +130,14 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ やぶさめぶち抜き壷 ☆☆☆☆☆ \n" VT_RST); this->actor.gravity = -3.0f; this->colorIdx = Rand_ZeroFloat(2.99f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.scale.x = 0.25f; this->actor.scale.y = 0.45f; this->actor.scale.z = 0.25f; this->collider.info.bumper.dmgFlags = 0x1F820; this->objId = OBJECT_TSUBO; - this->objIndex = Object_GetIndex(&globalCtx->objectCtx, this->objId); + this->objIndex = Object_GetIndex(&play->objectCtx, this->objId); if (this->objIndex < 0) { Actor_Kill(&this->actor); // "what?" @@ -153,8 +153,8 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { case ENGSWITCH_TARGET_RUPEE: this->actor.shape.yOffset = 700.0f; Actor_SetScale(&this->actor, 0.05f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.draw = EnGSwitch_DrawRupee; this->collider.dim.radius = 20; this->collider.dim.height = 60; @@ -164,14 +164,14 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGSwitch_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnGSwitch* this = (EnGSwitch*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnGSwitch_Break(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_Break(EnGSwitch* this, PlayState* play) { Vec3f randPos; Vec3f hitPos; Vec3f accel = { 0.0f, 0.0f, 0.0f }; @@ -184,10 +184,10 @@ void EnGSwitch_Break(EnGSwitch* this, GlobalContext* globalCtx) { hitPos.x = this->collider.info.bumper.hitPos.x; hitPos.y = this->collider.info.bumper.hitPos.y; hitPos.z = this->collider.info.bumper.hitPos.z; - EffectSsHitMark_SpawnCustomScale(globalCtx, EFFECT_HITMARK_WHITE, 700, &hitPos); + EffectSsHitMark_SpawnCustomScale(play, EFFECT_HITMARK_WHITE, 700, &hitPos); if (this->type == ENGSWITCH_ARCHERY_POT) { velocity.y = 15.0f; - EffectSsExtra_Spawn(globalCtx, &hitPos, &velocity, &accel, 5, 2); + EffectSsExtra_Spawn(play, &hitPos, &velocity, &accel, 5, 2); } if (this->type == ENGSWITCH_TARGET_RUPEE) { for (i = 0; i < this->numEffects; i++) { @@ -196,16 +196,16 @@ void EnGSwitch_Break(EnGSwitch* this, GlobalContext* globalCtx) { } } -void EnGSwitch_WaitForObject(EnGSwitch* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objIndex].segment); +void EnGSwitch_WaitForObject(EnGSwitch* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objIndex].segment); this->actor.objBankIndex = this->objIndex; this->actor.draw = EnGSwitch_DrawPot; this->actionFunc = EnGSwitch_ArcheryPot; } } -void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, PlayState* play) { static s8 majorScale[] = { 0, 2, 4, 5, 7 }; if (this->noteIndex < sCollectedCount) { @@ -222,19 +222,19 @@ void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 時はまさに世紀末〜 ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); // "Last!" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ らすとぉ! ☆☆☆☆☆ \n" VT_RST); - if ((globalCtx->sceneNum == SCENE_MEN) && (this->actor.room == 2)) { - Flags_SetTempClear(globalCtx, this->actor.room); + if ((play->sceneNum == SCENE_MEN) && (this->actor.room == 2)) { + Flags_SetTempClear(play, this->actor.room); } else { func_80078884(NA_SE_SY_CORRECT_CHIME); - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } func_80078884(NA_SE_SY_GET_RUPY); Actor_Kill(&this->actor); } } -void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.shape.rot.y += 0x800; if (this->actor.xyzDistToPlayerSq < SQ(30.0f)) { @@ -252,8 +252,8 @@ void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, GlobalContext* globalCtx) { } } -void EnGSwitch_SilverRupeeCollected(EnGSwitch* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGSwitch_SilverRupeeCollected(EnGSwitch* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.shape.rot.y += 0x3C0; if (this->killTimer == 0) { @@ -268,7 +268,7 @@ void EnGSwitch_SilverRupeeCollected(EnGSwitch* this, GlobalContext* globalCtx) { } } -void EnGSwitch_GalleryRupee(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_GalleryRupee(EnGSwitch* this, PlayState* play) { EnSyatekiItm* gallery; this->actor.shape.rot.y += 0x3C0; @@ -346,7 +346,7 @@ void EnGSwitch_GalleryRupee(EnGSwitch* this, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_GET_RUPY); // "Yeah !" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ いぇぇーす!HIT!! ☆☆☆☆☆ %d\n" VT_RST, gallery->hitCount); - EnGSwitch_Break(this, globalCtx); + EnGSwitch_Break(this, play); this->killTimer = 50; this->broken = true; this->actionFunc = EnGSwitch_Kill; @@ -355,7 +355,7 @@ void EnGSwitch_GalleryRupee(EnGSwitch* this, GlobalContext* globalCtx) { } } -void EnGSwitch_ArcheryPot(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_ArcheryPot(EnGSwitch* this, PlayState* play) { s32 i; s16 angle; Vec3f* thisPos = &this->actor.world.pos; @@ -396,29 +396,29 @@ void EnGSwitch_ArcheryPot(EnGSwitch* this, GlobalContext* globalCtx) { scale = 30.0f + Rand_ZeroOne() * 130.0f; - EffectSsKakera_Spawn(globalCtx, &pos, &vel, thisPos, -240, phi_s0, 10, 10, 0, scale, 0, 0x20, 60, + EffectSsKakera_Spawn(play, &pos, &vel, thisPos, -240, phi_s0, 10, 10, 0, scale, 0, 0x20, 60, KAKERA_COLOR_NONE, OBJECT_TSUBO, object_tsubo_DL_001960); } - func_80033480(globalCtx, thisPos, 30.0f, 4, 20, 50, 0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, thisPos, 40, NA_SE_EV_POT_BROKEN); - EnGSwitch_Break(this, globalCtx); + func_80033480(play, thisPos, 30.0f, 4, 20, 50, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, thisPos, 40, NA_SE_EV_POT_BROKEN); + EnGSwitch_Break(this, play); this->killTimer = 50; this->broken = true; this->actionFunc = EnGSwitch_Kill; } } -void EnGSwitch_Kill(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_Kill(EnGSwitch* this, PlayState* play) { if (this->killTimer == 0) { Actor_Kill(&this->actor); } } -void EnGSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGSwitch_Update(Actor* thisx, PlayState* play) { s32 pad; EnGSwitch* this = (EnGSwitch*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->killTimer != 0) { this->killTimer--; } @@ -431,36 +431,36 @@ void EnGSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->type != ENGSWITCH_SILVER_TRACKER) && (this->type != ENGSWITCH_SILVER_RUPEE) && (this->type != ENGSWITCH_TARGET_RUPEE)) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } if (this->actor.draw != NULL) { if (this->type == ENGSWITCH_TARGET_RUPEE) { - EnGSwitch_UpdateEffects(this, globalCtx); + EnGSwitch_UpdateEffects(this, play); } if ((this->actionFunc != EnGSwitch_Kill) && (this->actionFunc != EnGSwitch_SilverRupeeIdle)) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } if (BREG(0) && (this->type == ENGSWITCH_SILVER_TRACKER)) { 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, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } } -void EnGSwitch_DrawPot(Actor* thisx, GlobalContext* globalCtx) { +void EnGSwitch_DrawPot(Actor* thisx, PlayState* play) { s32 pad; EnGSwitch* this = (EnGSwitch*)thisx; if (!this->broken) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_g_switch.c", 918); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_g_switch.c", 925), + OPEN_DISPS(play->state.gfxCtx, "../z_en_g_switch.c", 918); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_g_switch.c", 925), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_tsubo_DL_0017C0); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_g_switch.c", 928); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_g_switch.c", 928); } } @@ -468,23 +468,23 @@ static void* sRupeeTextures[] = { gRupeeGreenTex, gRupeeBlueTex, gRupeeRedTex, gRupeePinkTex, gRupeeOrangeTex, gRupeeSilverTex, }; -void EnGSwitch_DrawRupee(Actor* thisx, GlobalContext* globalCtx) { +void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) { s32 pad; EnGSwitch* this = (EnGSwitch*)thisx; if (1) {} if (!this->broken) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_g_switch.c", 951); - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_g_switch.c", 957), + OPEN_DISPS(play->state.gfxCtx, "../z_en_g_switch.c", 951); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 0); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_g_switch.c", 957), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTextures[this->colorIdx])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_g_switch.c", 961); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_g_switch.c", 961); } if (this->type == ENGSWITCH_TARGET_RUPEE) { - EnGSwitch_DrawEffects(this, globalCtx); + EnGSwitch_DrawEffects(this, play); } } @@ -516,7 +516,7 @@ void EnGSwitch_SpawnEffects(EnGSwitch* this, Vec3f* pos, s16 scale, s16 colorIdx } } -void EnGSwitch_UpdateEffects(EnGSwitch* this, GlobalContext* globalCtx) { +void EnGSwitch_UpdateEffects(EnGSwitch* this, PlayState* play) { Vec3f temp; s16 i; EnGSwitchEffect* effect = this->effects; @@ -544,15 +544,15 @@ void EnGSwitch_UpdateEffects(EnGSwitch* this, GlobalContext* globalCtx) { } } -void EnGSwitch_DrawEffects(EnGSwitch* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EnGSwitch_DrawEffects(EnGSwitch* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; EnGSwitchEffect* effect = this->effects; s16 i; f32 scale; s32 pad; OPEN_DISPS(gfxCtx, "../z_en_g_switch.c", 1073); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); for (i = 0; i < this->numEffects; i++, effect++) { if (effect->flag) { scale = effect->scale / 10000.0f; @@ -561,7 +561,7 @@ void EnGSwitch_DrawEffects(EnGSwitch* this, GlobalContext* globalCtx) { Matrix_RotateX(effect->rot.x, MTXMODE_APPLY); Matrix_RotateY(effect->rot.y, MTXMODE_APPLY); Matrix_RotateZ(effect->rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_g_switch.c", 1088), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_g_switch.c", 1088), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTextures[effect->colorIdx])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h index dd4f885a34..b79c6e4566 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h @@ -6,7 +6,7 @@ struct EnGSwitch; -typedef void (*EnGSwitchActionFunc)(struct EnGSwitch*, GlobalContext*); +typedef void (*EnGSwitchActionFunc)(struct EnGSwitch*, PlayState*); typedef enum { /* 0 */ GSWITCH_NONE, diff --git a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c index 9d1a941a9e..eb528338b6 100644 --- a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c +++ b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnGanonMant_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGanonMant_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGanonMant_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGanonMant_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGanonMant_Init(Actor* thisx, PlayState* play); +void EnGanonMant_Destroy(Actor* thisx, PlayState* play); +void EnGanonMant_Update(Actor* thisx, PlayState* play); +void EnGanonMant_Draw(Actor* thisx, PlayState* play); const ActorInit En_Ganon_Mant_InitVars = { ACTOR_EN_GANON_MANT, @@ -99,13 +99,13 @@ static u64 sForceAlignment = 0; #include "overlays/ovl_En_Ganon_Mant/ovl_En_Ganon_Mant.c" -void EnGanonMant_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonMant_Init(Actor* thisx, PlayState* play) { EnGanonMant* this = (EnGanonMant*)thisx; this->actor.flags &= ~ACTOR_FLAG_0; } -void EnGanonMant_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonMant_Destroy(Actor* thisx, PlayState* play) { } /** @@ -152,8 +152,8 @@ void EnGanonMant_Tear(EnGanonMant* this) { /** * Updates the dynamic strands that control the shape and motion of the cloak */ -void EnGanonMant_UpdateStrand(GlobalContext* globalCtx, EnGanonMant* this, Vec3f* root, Vec3f* pos, Vec3f* nextPos, - Vec3f* rot, Vec3f* vel, s16 strandNum) { +void EnGanonMant_UpdateStrand(PlayState* play, EnGanonMant* this, Vec3f* root, Vec3f* pos, Vec3f* nextPos, Vec3f* rot, + Vec3f* vel, s16 strandNum) { f32 xDiff; f32 zDiff; f32 gravity; @@ -329,7 +329,7 @@ void EnGanonMant_UpdateVertices(EnGanonMant* this) { } } -void EnGanonMant_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonMant_Update(Actor* thisx, PlayState* play) { EnGanonMant* this = (EnGanonMant*)thisx; BossGanon* ganon = (BossGanon*)this->actor.parent; @@ -355,14 +355,14 @@ void EnGanonMant_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGanonMant_DrawCloak(GlobalContext* globalCtx, EnGanonMant* this) { +void EnGanonMant_DrawCloak(PlayState* play, EnGanonMant* this) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ganon_mant.c", 564); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ganon_mant.c", 564); Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_NEW); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ganon_mant.c", 572), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ganon_mant.c", 572), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); // set texture @@ -379,10 +379,10 @@ void EnGanonMant_DrawCloak(GlobalContext* globalCtx, EnGanonMant* this) { // draw cloak gSPDisplayList(POLY_OPA_DISP++, gMantDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ganon_mant.c", 584); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ganon_mant.c", 584); } -void EnGanonMant_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonMant_Draw(Actor* thisx, PlayState* play) { EnGanonMant* this = (EnGanonMant*)thisx; f32 xDiff; f32 pitch; @@ -454,7 +454,7 @@ void EnGanonMant_Draw(Actor* thisx, GlobalContext* globalCtx) { } // Update the strand joints - EnGanonMant_UpdateStrand(globalCtx, this, &this->strands[strandIdx].root, this->strands[strandIdx].joints, + EnGanonMant_UpdateStrand(play, this, &this->strands[strandIdx].root, this->strands[strandIdx].joints, this->strands[nextStrandIdx].joints, this->strands[strandIdx].rotations, this->strands[strandIdx].velocities, strandIdx); Matrix_Pop(); @@ -463,5 +463,5 @@ void EnGanonMant_Draw(Actor* thisx, GlobalContext* globalCtx) { this->updateHasRun = false; } - EnGanonMant_DrawCloak(globalCtx, this); + EnGanonMant_DrawCloak(play, this); } 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 89f7c20c65..94efd81ca5 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 @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnGanonOrgan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGanonOrgan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGanonOrgan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGanonOrgan_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGanonOrgan_Init(Actor* thisx, PlayState* play); +void EnGanonOrgan_Destroy(Actor* thisx, PlayState* play); +void EnGanonOrgan_Update(Actor* thisx, PlayState* play); +void EnGanonOrgan_Draw(Actor* thisx, PlayState* play); const ActorInit En_Ganon_Organ_InitVars = { ACTOR_EN_GANON_ORGAN, @@ -30,14 +30,14 @@ static u64 sForceAlignment = 0; #include "overlays/ovl_En_Ganon_Organ/ovl_En_Ganon_Organ.c" -void EnGanonOrgan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonOrgan_Init(Actor* thisx, PlayState* play) { thisx->flags &= ~ACTOR_FLAG_0; } -void EnGanonOrgan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonOrgan_Destroy(Actor* thisx, PlayState* play) { } -void EnGanonOrgan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonOrgan_Update(Actor* thisx, PlayState* play) { BossGanon* dorf; osSyncPrintf("ORGAN MOVE 1\n"); @@ -89,22 +89,22 @@ Gfx* func_80A28148(GraphicsContext* gfxCtx, BossGanon* dorf) { return displayList; } -void EnGanonOrgan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGanonOrgan_Draw(Actor* thisx, PlayState* play) { BossGanon* dorf = (BossGanon*)thisx->parent; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ganon_organ.c", 205); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ganon_organ.c", 205); osSyncPrintf("ORGAN DRAW 1\n"); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if ((thisx->params == 1) && (dorf->organAlpha != 255)) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80A280BC(globalCtx->state.gfxCtx, dorf)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A28148(globalCtx->state.gfxCtx, dorf)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A280BC(play->state.gfxCtx, dorf)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A28148(play->state.gfxCtx, dorf)); } else { - gSPSegment(POLY_OPA_DISP++, 0x08, EnGanonOrgan_EmptyDList(globalCtx->state.gfxCtx)); - gSPSegment(POLY_OPA_DISP++, 0x09, EnGanonOrgan_EmptyDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, EnGanonOrgan_EmptyDList(play->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x09, EnGanonOrgan_EmptyDList(play->state.gfxCtx)); } Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_NEW); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ganon_organ.c", 221), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ganon_organ.c", 221), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sRoomOrganAndFloorDL); @@ -112,5 +112,5 @@ void EnGanonOrgan_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("ORGAN DRAW 2\n"); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ganon_organ.c", 230); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ganon_organ.c", 230); } diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 1f40f9abe4..679248d3a9 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -9,22 +9,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnGb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGb_Init(Actor* thisx, PlayState* play); +void EnGb_Destroy(Actor* thisx, PlayState* play); +void EnGb_Update(Actor* thisx, PlayState* play); +void EnGb_Draw(Actor* thisx, PlayState* play); -void func_80A2F83C(EnGb* this, GlobalContext* globalCtx); -void func_80A2FC70(EnGb* this, GlobalContext* globalCtx); -void func_80A2FA50(EnGb* this, GlobalContext* globalCtx); -void func_80A2F9C0(EnGb* this, GlobalContext* globalCtx); -void func_80A2F94C(EnGb* this, GlobalContext* globalCtx); -void func_80A2FB40(EnGb* this, GlobalContext* globalCtx); -void func_80A2FBB0(EnGb* this, GlobalContext* globalCtx); -void func_80A2FC0C(EnGb* this, GlobalContext* globalCtx); +void func_80A2F83C(EnGb* this, PlayState* play); +void func_80A2FC70(EnGb* this, PlayState* play); +void func_80A2FA50(EnGb* this, PlayState* play); +void func_80A2F9C0(EnGb* this, PlayState* play); +void func_80A2F94C(EnGb* this, PlayState* play); +void func_80A2FB40(EnGb* this, PlayState* play); +void func_80A2FBB0(EnGb* this, PlayState* play); +void func_80A2FC0C(EnGb* this, PlayState* play); -void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx); -void EnGb_UpdateCagedSouls(EnGb* this, GlobalContext* globalCtx); +void EnGb_DrawCagedSouls(EnGb* this, PlayState* play); +void EnGb_UpdateCagedSouls(EnGb* this, PlayState* play); const ActorInit En_Gb_InitVars = { ACTOR_EN_GB, @@ -148,7 +148,7 @@ void func_80A2F180(EnGb* this) { } } -void EnGb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGb_Init(Actor* thisx, PlayState* play) { EnGb* this = (EnGb*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -159,18 +159,18 @@ void EnGb_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gPoeSellerCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gPoeSellerSkel, &gPoeSellerIdleAnim, this->jointTable, - this->morphTable, 12); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + SkelAnime_InitFlex(play, &this->skelAnime, &gPoeSellerSkel, &gPoeSellerIdleAnim, this->jointTable, this->morphTable, + 12); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->dyna.actor, &sCylinderInit); for (i = 0; i < ARRAY_COUNT(sBottlesCylindersInit); i++) { - Collider_InitCylinder(globalCtx, &this->bottlesColliders[i]); - Collider_SetCylinderType1(globalCtx, &this->bottlesColliders[i], &this->dyna.actor, &sBottlesCylindersInit[i]); + Collider_InitCylinder(play, &this->bottlesColliders[i]); + Collider_SetCylinderType1(play, &this->bottlesColliders[i], &this->dyna.actor, &sBottlesCylindersInit[i]); } - this->light = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->light = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, this->dyna.actor.home.pos.z, 255, 255, 255, 200); @@ -215,12 +215,12 @@ void EnGb_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80A2F83C; } -void EnGb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGb_Destroy(Actor* thisx, PlayState* play) { EnGb* this = (EnGb*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->light); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->light); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80A2F608(EnGb* this) { @@ -268,8 +268,8 @@ void func_80A2F7C0(EnGb* this) { this->actionFunc = func_80A2FC70; } -void func_80A2F83C(EnGb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A2F83C(EnGb* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!func_80A2F760(this)) { if (this->actionTimer != 0) { @@ -279,8 +279,8 @@ void func_80A2F83C(EnGb* this, GlobalContext* globalCtx) { return; } } - if (Actor_ProcessTalkRequest(&this->dyna.actor, globalCtx)) { - switch (func_8002F368(globalCtx)) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, play)) { + switch (func_8002F368(play)) { case EXCH_ITEM_NONE: func_80A2F180(this); this->actionFunc = func_80A2F94C; @@ -297,12 +297,12 @@ void func_80A2F83C(EnGb* this, GlobalContext* globalCtx) { return; } if (this->dyna.actor.xzDistToPlayer < 100.0f) { - func_8002F298(&this->dyna.actor, globalCtx, 100.0f, EXCH_ITEM_POE); + func_8002F298(&this->dyna.actor, play, 100.0f, EXCH_ITEM_POE); } } -void func_80A2F94C(EnGb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { +void func_80A2F94C(EnGb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { if (!GET_INFTABLE(INFTABLE_B6)) { SET_INFTABLE(INFTABLE_B6); } @@ -311,25 +311,25 @@ void func_80A2F94C(EnGb* this, GlobalContext* globalCtx) { } } -void func_80A2F9C0(EnGb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { +void func_80A2F9C0(EnGb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { if (!GET_INFTABLE(INFTABLE_B6)) { SET_INFTABLE(INFTABLE_B6); } func_80A2F180(this); - Player_UpdateBottleHeld(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); Rupees_ChangeBy(10); this->actionFunc = func_80A2F83C; } } -void func_80A2FA50(EnGb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { +void func_80A2FA50(EnGb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { if (!GET_INFTABLE(INFTABLE_B6)) { SET_INFTABLE(INFTABLE_B6); } func_80A2F180(this); - Player_UpdateBottleHeld(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); Rupees_ChangeBy(50); HIGH_SCORE(HS_POE_POINTS) += 100; if (HIGH_SCORE(HS_POE_POINTS) != 1000) { @@ -338,41 +338,41 @@ void func_80A2FA50(EnGb* this, GlobalContext* globalCtx) { } this->actionFunc = func_80A2F83C; } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->exchangeItemId = EXCH_ITEM_NONE; this->textId = 0x70F8; - Message_ContinueTextbox(globalCtx, this->textId); + Message_ContinueTextbox(play, this->textId); this->actionFunc = func_80A2FB40; } } } -void func_80A2FB40(EnGb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { - func_8002F434(&this->dyna.actor, globalCtx, GI_BOTTLE, 100.0f, 10.0f); +void func_80A2FB40(EnGb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { + func_8002F434(&this->dyna.actor, play, GI_BOTTLE, 100.0f, 10.0f); this->actionFunc = func_80A2FBB0; } } -void func_80A2FBB0(EnGb* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->dyna.actor, globalCtx)) { +void func_80A2FBB0(EnGb* this, PlayState* play) { + if (Actor_HasParent(&this->dyna.actor, play)) { this->dyna.actor.parent = NULL; this->actionFunc = func_80A2FC0C; } else { - func_8002F434(&this->dyna.actor, globalCtx, GI_BOTTLE, 100.0f, 10.0f); + func_8002F434(&this->dyna.actor, play, GI_BOTTLE, 100.0f, 10.0f); } } -void func_80A2FC0C(EnGb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { - Actor_ProcessTalkRequest(&this->dyna.actor, globalCtx); +void func_80A2FC0C(EnGb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { + Actor_ProcessTalkRequest(&this->dyna.actor, play); func_80A2F180(this); this->actionFunc = func_80A2F83C; } } -void func_80A2FC70(EnGb* this, GlobalContext* globalCtx) { +void func_80A2FC70(EnGb* this, PlayState* play) { if (this->skelAnime.curFrame == Animation_GetLastFrame(&gPoeSellerSwingStickAnim)) { Animation_Change(&this->skelAnime, &gPoeSellerIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gPoeSellerIdleAnim), ANIMMODE_LOOP, 0.0f); @@ -393,21 +393,21 @@ void func_80A2FC70(EnGb* this, GlobalContext* globalCtx) { } } -void EnGb_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnGb_Update(Actor* thisx, PlayState* play2) { EnGb* this = (EnGb*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 i; f32 rand; this->frameTimer++; SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->dyna.actor.textId = this->textId; func_80A2F608(this); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); for (i = 0; i < ARRAY_COUNT(this->bottlesColliders); i++) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bottlesColliders[i].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bottlesColliders[i].base); } rand = Rand_ZeroOne(); @@ -415,16 +415,16 @@ void EnGb_Update(Actor* thisx, GlobalContext* globalCtx2) { this->lightColor.g = (s8)(rand * 100.0f) + 155; this->lightColor.b = (s8)(rand * 160.0f) + 95; this->lightColor.a = 200; - EnGb_UpdateCagedSouls(this, globalCtx); + EnGb_UpdateCagedSouls(this, play); } -void EnGb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGb_Draw(Actor* thisx, PlayState* play) { EnGb* this = (EnGb*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_gb.c", 763); + OPEN_DISPS(play->state.gfxCtx, "../z_en_gb.c", 763); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 255); @@ -432,13 +432,13 @@ void EnGb_Draw(Actor* thisx, GlobalContext* globalCtx) { Lights_PointNoGlowSetInfo(&this->lightInfo, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->dyna.actor); - EnGb_DrawCagedSouls(this, globalCtx); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_gb.c", 796); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, &this->dyna.actor); + EnGb_DrawCagedSouls(this, play); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_gb.c", 796); } -void EnGb_UpdateCagedSouls(EnGb* this, GlobalContext* globalCtx) { +void EnGb_UpdateCagedSouls(EnGb* this, PlayState* play) { f32 temp_f20; s16 rot; s32 i; @@ -512,19 +512,19 @@ void EnGb_UpdateCagedSouls(EnGb* this, GlobalContext* globalCtx) { } } -void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) { +void EnGb_DrawCagedSouls(EnGb* this, PlayState* play) { s32 pad; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_gb.c", 914); + OPEN_DISPS(play->state.gfxCtx, "../z_en_gb.c", 914); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < 4; i++) { s32 idx = this->cagedSouls[i].infoIdx; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (u32)(sCagedSoulInfo[idx].timerMultiplier * this->frameTimer) % 512, 32, 128)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sCagedSoulInfo[idx].texture)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, sCagedSoulInfo[idx].prim.r, sCagedSoulInfo[idx].prim.g, @@ -535,19 +535,19 @@ void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) { Matrix_Push(); Matrix_Translate(this->cagedSouls[i].translation.x, this->cagedSouls[i].translation.y, this->cagedSouls[i].translation.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); if (this->cagedSouls[i].rotate180) { Matrix_RotateZYX(0, -0x8000, 0, MTXMODE_APPLY); } Matrix_Scale(0.007f, 0.007f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_gb.c", 955), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_gb.c", 955), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPoeSellerCagedSoulDL); Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_gb.c", 962); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_gb.c", 962); } diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.h b/src/overlays/actors/ovl_En_Gb/z_en_gb.h index 5de160ff24..99694a59e9 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.h +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.h @@ -6,7 +6,7 @@ struct EnGb; -typedef void (*EnGbActionFunc)(struct EnGb*, GlobalContext*); +typedef void (*EnGbActionFunc)(struct EnGb*, PlayState*); typedef struct { /* 0x00 */ Color_RGBA8 prim; 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 30f0ba391a..b54e6165b7 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -21,21 +21,21 @@ typedef enum { /* 02 */ GE1_HAIR_SPIKY } EnGe1Hairstyle; -void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGe1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGe1_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGe1_Draw(Actor* thisx, GlobalContext* globalCtx); +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_CheckCarpentersFreed(void); -void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_SetNormalText(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_WatchForAndSensePlayer(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_GetReaction_ValleyFloor(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_CheckForCard_GTGGuard(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_CheckGate_GateOp(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_GetReaction_GateGuard(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_TalkAfterGame_Archery(EnGe1* this, GlobalContext* globalCtx); -void EnGe1_Wait_Archery(EnGe1* this, GlobalContext* globalCtx); +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); @@ -85,16 +85,16 @@ static void* sEyeTextures[] = { gGerudoWhiteEyeClosedTex, }; -void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGe1_Init(Actor* thisx, PlayState* play) { s32 pad; EnGe1* this = (EnGe1*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoWhiteSkel, &gGerudoWhiteIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoWhiteSkel, &gGerudoWhiteIdleAnim, this->jointTable, this->morphTable, GE1_LIMB_MAX); Animation_PlayOnce(&this->skelAnime, &gGerudoWhiteIdleAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->animation = &gGerudoWhiteIdleAnim; this->animFunc = EnGe1_CueUpAnimation; @@ -102,7 +102,7 @@ void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); // In Gerudo Valley - this->actor.uncullZoneForward = ((globalCtx->sceneNum == SCENE_SPOT09) ? 1000.0f : 1200.0f); + this->actor.uncullZoneForward = ((play->sceneNum == SCENE_SPOT09) ? 1000.0f : 1200.0f); switch (this->actor.params & 0xFF) { @@ -175,14 +175,14 @@ void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx) { this->stateFlags = 0; } -void EnGe1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGe1_Destroy(Actor* thisx, PlayState* play) { EnGe1* this = (EnGe1*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 EnGe1_SetTalkAction(EnGe1* this, GlobalContext* globalCtx, u16 textId, f32 arg3, EnGe1ActionFunc actionFunc) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 EnGe1_SetTalkAction(EnGe1* this, PlayState* play, u16 textId, f32 arg3, EnGe1ActionFunc actionFunc) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = actionFunc; this->animFunc = EnGe1_StopFidget; this->stateFlags &= ~GE1_STATE_IDLE_ANIM; @@ -195,7 +195,7 @@ s32 EnGe1_SetTalkAction(EnGe1* this, GlobalContext* globalCtx, u16 textId, f32 a this->actor.textId = textId; if (this->actor.xzDistToPlayer < arg3) { - func_8002F2CC(&this->actor, globalCtx, arg3); + func_8002F2CC(&this->actor, play, arg3); } return false; @@ -219,53 +219,53 @@ s32 EnGe1_CheckCarpentersFreed(void) { /** * Sends player to different places depending on if has hookshot, and if this is the first time captured */ -void EnGe1_KickPlayer(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_KickPlayer(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; if (this->cutsceneTimer > 0) { this->cutsceneTimer--; } else { - func_8006D074(globalCtx); + func_8006D074(play); if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { - globalCtx->nextEntranceIndex = ENTR_SPOT09_1; + play->nextEntranceIndex = ENTR_SPOT09_1; } else if (GET_EVENTCHKINF(EVENTCHKINF_C7)) { // Caught previously - globalCtx->nextEntranceIndex = ENTR_SPOT12_18; + play->nextEntranceIndex = ENTR_SPOT12_18; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT12_17; + play->nextEntranceIndex = ENTR_SPOT12_17; } - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); + play->transitionTrigger = TRANS_TRIGGER_START; } } -void EnGe1_SpotPlayer(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_SpotPlayer(EnGe1* this, PlayState* play) { this->cutsceneTimer = 30; this->actionFunc = EnGe1_KickPlayer; - func_8002DF54(globalCtx, &this->actor, 0x5F); + func_8002DF54(play, &this->actor, 0x5F); func_80078884(NA_SE_SY_FOUND); - Message_StartTextbox(globalCtx, 0x6000, &this->actor); + Message_StartTextbox(play, 0x6000, &this->actor); } -void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, PlayState* play) { s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(angleDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - EnGe1_SpotPlayer(this, globalCtx); + EnGe1_SpotPlayer(this, play); } if (this->collider.base.acFlags & AC_HIT) { - EnGe1_SpotPlayer(this, globalCtx); + EnGe1_SpotPlayer(this, play); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void EnGe1_ChooseActionFromTextId(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_ChooseActionFromTextId(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { switch (this->actor.textId) { case 0x6001: this->actionFunc = EnGe1_SetNormalText; @@ -287,36 +287,36 @@ void EnGe1_ChooseActionFromTextId(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_SetNormalText(EnGe1* this, GlobalContext* globalCtx) { - EnGe1_SetTalkAction(this, globalCtx, 0x6001, 100.0f, EnGe1_ChooseActionFromTextId); +void EnGe1_SetNormalText(EnGe1* this, PlayState* play) { + EnGe1_SetTalkAction(this, play, 0x6001, 100.0f, EnGe1_ChooseActionFromTextId); } -void EnGe1_WatchForAndSensePlayer(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WatchForAndSensePlayer(EnGe1* this, PlayState* play) { s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer < 50.0f) || ((ABS(angleDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 400.0f))) { - EnGe1_SpotPlayer(this, globalCtx); + EnGe1_SpotPlayer(this, play); } if (this->collider.base.acFlags & AC_HIT) { - EnGe1_SpotPlayer(this, globalCtx); + EnGe1_SpotPlayer(this, play); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void EnGe1_GetReaction_ValleyFloor(EnGe1* this, GlobalContext* globalCtx) { - u16 reactionText = Text_GetFaceReaction(globalCtx, 0x22); +void EnGe1_GetReaction_ValleyFloor(EnGe1* this, PlayState* play) { + u16 reactionText = Text_GetFaceReaction(play, 0x22); if (reactionText == 0) { reactionText = 0x6019; } - EnGe1_SetTalkAction(this, globalCtx, reactionText, 100.0f, EnGe1_ChooseActionFromTextId); + EnGe1_SetTalkAction(this, play, reactionText, 100.0f, EnGe1_ChooseActionFromTextId); } // Gerudo Training Ground Guard functions -void EnGe1_WaitTillOpened_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WaitTillOpened_GTGGuard(EnGe1* this, PlayState* play) { if (this->cutsceneTimer > 0) { this->cutsceneTimer--; } else { @@ -327,19 +327,19 @@ void EnGe1_WaitTillOpened_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { this->stateFlags |= GE1_STATE_STOP_FIDGET; } -void EnGe1_Open_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_Open_GTGGuard(EnGe1* this, PlayState* play) { if (this->stateFlags & GE1_STATE_IDLE_ANIM) { this->actionFunc = EnGe1_WaitTillOpened_GTGGuard; - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); this->cutsceneTimer = 50; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_HAND_CLAP); } } -void EnGe1_SetupOpen_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void EnGe1_SetupOpen_GTGGuard(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); @@ -349,26 +349,26 @@ void EnGe1_SetupOpen_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_RefuseEntryTooPoor_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void EnGe1_RefuseEntryTooPoor_GTGGuard(EnGe1* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actionFunc = EnGe1_CheckForCard_GTGGuard; EnGe1_SetAnimationIdle(this); } } -void EnGe1_OfferOpen_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_OfferOpen_GTGGuard(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees < 10) { - Message_ContinueTextbox(globalCtx, 0x6016); + Message_ContinueTextbox(play, 0x6016); this->actionFunc = EnGe1_RefuseEntryTooPoor_GTGGuard; } else { Rupees_ChangeBy(-10); - Message_ContinueTextbox(globalCtx, 0x6015); + Message_ContinueTextbox(play, 0x6015); this->actionFunc = EnGe1_SetupOpen_GTGGuard; } break; @@ -380,37 +380,37 @@ void EnGe1_OfferOpen_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_RefuseOpenNoCard_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_RefuseOpenNoCard_GTGGuard(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe1_CheckForCard_GTGGuard; EnGe1_SetAnimationIdle(this); } } -void EnGe1_CheckForCard_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_CheckForCard_GTGGuard(EnGe1* this, PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_GERUDO_CARD)) { - EnGe1_SetTalkAction(this, globalCtx, 0x6014, 100.0f, EnGe1_OfferOpen_GTGGuard); + EnGe1_SetTalkAction(this, play, 0x6014, 100.0f, EnGe1_OfferOpen_GTGGuard); } 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, globalCtx, 0x6013, 100.0f, EnGe1_RefuseOpenNoCard_GTGGuard); + EnGe1_SetTalkAction(this, play, 0x6013, 100.0f, EnGe1_RefuseOpenNoCard_GTGGuard); } } // Gate Operator functions -void EnGe1_WaitGateOpen_GateOp(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WaitGateOpen_GateOp(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = EnGe1_CheckGate_GateOp; EnGe1_SetAnimationIdle(this); } } -void EnGe1_WaitUntilGateOpened_GateOp(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WaitUntilGateOpened_GateOp(EnGe1* this, PlayState* play) { if (this->cutsceneTimer > 0) { this->cutsceneTimer--; } else { @@ -420,21 +420,21 @@ void EnGe1_WaitUntilGateOpened_GateOp(EnGe1* this, GlobalContext* globalCtx) { this->stateFlags |= GE1_STATE_STOP_FIDGET; } -void EnGe1_OpenGate_GateOp(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_OpenGate_GateOp(EnGe1* this, PlayState* play) { if (this->stateFlags & GE1_STATE_IDLE_ANIM) { this->actionFunc = EnGe1_WaitUntilGateOpened_GateOp; - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); this->cutsceneTimer = 50; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_HAND_CLAP); } } -void EnGe1_SetupOpenGate_GateOp(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_SetupOpenGate_GateOp(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + 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); @@ -444,35 +444,35 @@ void EnGe1_SetupOpenGate_GateOp(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_CheckGate_GateOp(EnGe1* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { - EnGe1_SetTalkAction(this, globalCtx, 0x6018, 100.0f, EnGe1_WaitGateOpen_GateOp); +void EnGe1_CheckGate_GateOp(EnGe1* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { + EnGe1_SetTalkAction(this, play, 0x6018, 100.0f, EnGe1_WaitGateOpen_GateOp); } else { - EnGe1_SetTalkAction(this, globalCtx, 0x6017, 100.0f, EnGe1_SetupOpenGate_GateOp); + EnGe1_SetTalkAction(this, play, 0x6017, 100.0f, EnGe1_SetupOpenGate_GateOp); } } // Gate guard functions -void EnGe1_Talk_GateGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_Talk_GateGuard(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe1_GetReaction_GateGuard; EnGe1_SetAnimationIdle(this); } } -void EnGe1_GetReaction_GateGuard(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_GetReaction_GateGuard(EnGe1* this, PlayState* play) { u16 reactionText; - reactionText = Text_GetFaceReaction(globalCtx, 0x22); + reactionText = Text_GetFaceReaction(play, 0x22); if (reactionText == 0) { reactionText = 0x6069; } - if (EnGe1_SetTalkAction(this, globalCtx, reactionText, 100.0f, EnGe1_Talk_GateGuard)) { + if (EnGe1_SetTalkAction(this, play, reactionText, 100.0f, EnGe1_Talk_GateGuard)) { this->animFunc = EnGe1_CueUpAnimation; this->animation = &gGerudoWhiteDismissiveAnim; Animation_Change(&this->skelAnime, &gGerudoWhiteDismissiveAnim, 1.0f, 0.0f, @@ -482,17 +482,17 @@ void EnGe1_GetReaction_GateGuard(EnGe1* this, GlobalContext* globalCtx) { // Archery functions -void EnGe1_SetupWait_Archery(EnGe1* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnGe1_SetupWait_Archery(EnGe1* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe1_Wait_Archery; EnGe1_SetAnimationIdle(this); } } -void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, PlayState* play) { s32 getItemId; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = EnGe1_SetupWait_Archery; if (this->stateFlags & GE1_STATE_GIVE_QUIVER) { SET_ITEMGETINF(ITEMGETINF_0F); @@ -513,14 +513,14 @@ void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, GlobalContext* globalCtx) { } else { getItemId = GI_HEART_PIECE; } - func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, getItemId, 10000.0f, 50.0f); } } -void EnGe1_BeginGiveItem_Archery(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_BeginGiveItem_Archery(EnGe1* this, PlayState* play) { s32 getItemId; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = EnGe1_WaitTillItemGiven_Archery; } @@ -542,54 +542,54 @@ void EnGe1_BeginGiveItem_Archery(EnGe1* this, GlobalContext* globalCtx) { getItemId = GI_HEART_PIECE; } - func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, getItemId, 10000.0f, 50.0f); } -void EnGe1_TalkWinPrize_Archery(EnGe1* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnGe1_TalkWinPrize_Archery(EnGe1* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnGe1_BeginGiveItem_Archery; this->actor.flags &= ~ACTOR_FLAG_16; } else { - func_8002F2CC(&this->actor, globalCtx, 200.0f); + func_8002F2CC(&this->actor, play, 200.0f); } } -void EnGe1_TalkTooPoor_Archery(EnGe1* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnGe1_TalkTooPoor_Archery(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); } } -void EnGe1_WaitDoNothing(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_WaitDoNothing(EnGe1* this, PlayState* play) { } -void EnGe1_BeginGame_Archery(EnGe1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGe1_BeginGame_Archery(EnGe1* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* horse; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_16; - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees < 20) { - Message_ContinueTextbox(globalCtx, 0x85); + Message_ContinueTextbox(play, 0x85); this->actionFunc = EnGe1_TalkTooPoor_Archery; } else { Rupees_ChangeBy(-20); - globalCtx->nextEntranceIndex = ENTR_SPOT12_0; + play->nextEntranceIndex = ENTR_SPOT12_0; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + 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); if (!(player->stateFlags1 & PLAYER_STATE1_23)) { - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); } else { - horse = Actor_FindNearby(globalCtx, &player->actor, ACTOR_EN_HORSE, ACTORCAT_BG, 1200.0f); + horse = Actor_FindNearby(play, &player->actor, ACTOR_EN_HORSE, ACTORCAT_BG, 1200.0f); player->actor.freezeTimer = 1200; if (horse != NULL) { @@ -603,28 +603,28 @@ void EnGe1_BeginGame_Archery(EnGe1* this, GlobalContext* globalCtx) { case 1: this->actionFunc = EnGe1_Wait_Archery; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); break; } } } -void EnGe1_TalkOfferPlay_Archery(EnGe1* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x6041); +void EnGe1_TalkOfferPlay_Archery(EnGe1* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x6041); this->actionFunc = EnGe1_BeginGame_Archery; } } -void EnGe1_TalkNoPrize_Archery(EnGe1* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnGe1_TalkNoPrize_Archery(EnGe1* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnGe1_TalkOfferPlay_Archery; } else { - func_8002F2CC(&this->actor, globalCtx, 300.0f); + func_8002F2CC(&this->actor, play, 300.0f); } } -void EnGe1_TalkAfterGame_Archery(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_TalkAfterGame_Archery(EnGe1* this, PlayState* play) { CLEAR_EVENTINF(EVENTINF_HORSES_08); 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, @@ -656,20 +656,20 @@ void EnGe1_TalkAfterGame_Archery(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_TalkNoHorse_Archery(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_TalkNoHorse_Archery(EnGe1* this, PlayState* play) { this->stateFlags |= GE1_STATE_TALKING; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe1_Wait_Archery; EnGe1_SetAnimationIdle(this); } } -void EnGe1_Wait_Archery(EnGe1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGe1_Wait_Archery(EnGe1* this, PlayState* play) { + Player* player = GET_PLAYER(play); u16 textId; if (!(player->stateFlags1 & PLAYER_STATE1_23)) { - EnGe1_SetTalkAction(this, globalCtx, 0x603F, 100.0f, EnGe1_TalkNoHorse_Archery); + EnGe1_SetTalkAction(this, play, 0x603F, 100.0f, EnGe1_TalkNoHorse_Archery); } else { if (GET_EVENTCHKINF(EVENTCHKINF_68)) { if (GET_INFTABLE(INFTABLE_190)) { @@ -680,20 +680,20 @@ void EnGe1_Wait_Archery(EnGe1* this, GlobalContext* globalCtx) { } else { textId = 0x6040; } - EnGe1_SetTalkAction(this, globalCtx, textId, 200.0f, EnGe1_TalkOfferPlay_Archery); + EnGe1_SetTalkAction(this, play, textId, 200.0f, EnGe1_TalkOfferPlay_Archery); } } // General functions -void EnGe1_TurnToFacePlayer(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_TurnToFacePlayer(EnGe1* this, PlayState* play) { 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); this->actor.world.rot.y = this->actor.shape.rot.y; - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos); } else { if (angleDiff < 0) { Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100); @@ -706,34 +706,33 @@ void EnGe1_TurnToFacePlayer(EnGe1* this, GlobalContext* globalCtx) { } } -void EnGe1_LookAtPlayer(EnGe1* this, GlobalContext* globalCtx) { +void EnGe1_LookAtPlayer(EnGe1* this, PlayState* play) { s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(angleDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100); } } -void EnGe1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGe1_Update(Actor* thisx, PlayState* play) { s32 pad; EnGe1* this = (EnGe1*)thisx; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 25.0f, 40.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); this->animFunc(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->stateFlags & GE1_STATE_TALKING) { - EnGe1_TurnToFacePlayer(this, globalCtx); + EnGe1_TurnToFacePlayer(this, play); this->stateFlags &= ~GE1_STATE_TALKING; } else { - EnGe1_LookAtPlayer(this, globalCtx); + EnGe1_LookAtPlayer(this, play); } this->unk_2A2.x = this->unk_2A2.y = this->unk_2A2.z = 0; @@ -764,7 +763,7 @@ void EnGe1_StopFidget(EnGe1* this) { } } -s32 EnGe1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 pad; EnGe1* this = (EnGe1*)thisx; @@ -781,35 +780,35 @@ s32 EnGe1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, // 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 == GE1_LIMB_TORSO) || (limbIndex == GE1_LIMB_L_FOREARM) || (limbIndex == GE1_LIMB_R_FOREARM)) { - rot->y += Math_SinS(globalCtx->state.frames * (limbIndex * 50 + 0x814)) * 200.0f; - rot->z += Math_CosS(globalCtx->state.frames * (limbIndex * 50 + 0x940)) * 200.0f; + rot->y += Math_SinS(play->state.frames * (limbIndex * 50 + 0x814)) * 200.0f; + rot->z += Math_CosS(play->state.frames * (limbIndex * 50 + 0x940)) * 200.0f; } return 0; } -void EnGe1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnGe1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnGe1* this = (EnGe1*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ge1.c", 1419); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1419); if (limbIndex == GE1_LIMB_HEAD) { gSPDisplayList(POLY_OPA_DISP++, sHairstyleDLists[this->hairstyle]); Matrix_MultVec3f(&D_80A327A8, &this->actor.focus.pos); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ge1.c", 1427); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1427); } -void EnGe1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGe1_Draw(Actor* thisx, PlayState* play) { s32 pad; EnGe1* this = (EnGe1*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ge1.c", 1442); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1442); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGe1_OverrideLimbDraw, EnGe1_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ge1.c", 1459); + 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 84a96be510..f286ce3146 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -7,7 +7,7 @@ struct EnGe1; typedef void (*EnGe1AnimFunc)(struct EnGe1*); -typedef void (*EnGe1ActionFunc)(struct EnGe1*, GlobalContext*); +typedef void (*EnGe1ActionFunc)(struct EnGe1*, PlayState*); typedef enum { /* 0x00 */ GE1_TYPE_GATE_GUARD, 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 1adb43a525..6ed33a2ea9 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -33,27 +33,27 @@ typedef enum { /* 8 */ GE2_ACTION_WAITLOOKATPLAYER } EnGe2Action; -void EnGe2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGe2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGe2_Draw(Actor* thisx, GlobalContext* globalCtx); +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_CheckCarpentersFreed(void); -void EnGe2_CaptureClose(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_CaptureCharge(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_CaptureTurn(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_KnockedOut(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_AboutTurn(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_Walk(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_Stand(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_WaitLookAtPlayer(EnGe2* this, GlobalContext* globalCtx); -void EnGe2_ForceTalk(EnGe2* this, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); -void EnGe2_UpdateAfterTalk(Actor* thisx, GlobalContext* globalCtx); -void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx); +void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play); +void EnGe2_UpdateAfterTalk(Actor* thisx, PlayState* play); +void EnGe2_UpdateStunned(Actor* thisx, PlayState* play); const ActorInit En_Ge2_InitVars = { ACTOR_EN_GE2, @@ -111,19 +111,19 @@ void EnGe2_ChangeAction(EnGe2* this, s32 i) { this->stateFlags &= ~GE2_STATE_ANIMCOMPLETE; } -void EnGe2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_Init(Actor* thisx, PlayState* play) { s32 pad; EnGe2* this = (EnGe2*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, 22); Animation_PlayLoop(&this->skelAnime, &gGerudoPurpleWalkingAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &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 (globalCtx->sceneNum == SCENE_SPOT09) { + if (play->sceneNum == SCENE_SPOT09) { this->actor.uncullZoneForward = 1000.0f; } else { this->actor.uncullZoneForward = 1200.0f; @@ -168,15 +168,15 @@ void EnGe2_Init(Actor* thisx, GlobalContext* globalCtx) { this->walkDuration = ((this->actor.params & 0xFF00) >> 8) * 10; } -void EnGe2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_Destroy(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } // Detection/check functions -s32 Ge2_DetectPlayerInAction(GlobalContext* globalCtx, EnGe2* this) { +s32 Ge2_DetectPlayerInAction(PlayState* play, EnGe2* this) { f32 visionScale; visionScale = (!IS_DAY ? 0.75f : 1.5f); @@ -189,14 +189,14 @@ s32 Ge2_DetectPlayerInAction(GlobalContext* globalCtx, EnGe2* this) { return 2; } - if (func_8002DDE4(globalCtx)) { + if (func_8002DDE4(play)) { return 1; } return 0; } -s32 Ge2_DetectPlayerInUpdate(GlobalContext* globalCtx, EnGe2* this, Vec3f* pos, s16 yRot, f32 yDetectRange) { - Player* player = GET_PLAYER(globalCtx); +s32 Ge2_DetectPlayerInUpdate(PlayState* play, EnGe2* this, Vec3f* pos, s16 yRot, f32 yDetectRange) { + Player* player = GET_PLAYER(play); Vec3f posResult; CollisionPoly* outPoly; f32 visionScale; @@ -215,7 +215,7 @@ s32 Ge2_DetectPlayerInUpdate(GlobalContext* globalCtx, EnGe2* this, Vec3f* pos, return 0; } - if (BgCheck_AnyLineTest1(&globalCtx->colCtx, pos, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &posResult, &outPoly, + if (BgCheck_AnyLineTest1(&play->colCtx, pos, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &posResult, &outPoly, 0)) { return 0; } @@ -233,26 +233,26 @@ s32 EnGe2_CheckCarpentersFreed(void) { // Actions -void EnGe2_CaptureClose(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_CaptureClose(EnGe2* this, PlayState* play) { if (this->timer > 0) { this->timer--; } else { - func_8006D074(globalCtx); + func_8006D074(play); if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { - globalCtx->nextEntranceIndex = ENTR_SPOT09_1; + play->nextEntranceIndex = ENTR_SPOT09_1; } else if (GET_EVENTCHKINF(EVENTCHKINF_C7)) { - globalCtx->nextEntranceIndex = ENTR_SPOT12_18; + play->nextEntranceIndex = ENTR_SPOT12_18; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT12_17; + play->nextEntranceIndex = ENTR_SPOT12_17; } - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); + play->transitionTrigger = TRANS_TRIGGER_START; } } -void EnGe2_CaptureCharge(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_CaptureCharge(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) { @@ -263,22 +263,22 @@ void EnGe2_CaptureCharge(EnGe2* this, GlobalContext* globalCtx) { if (this->timer > 0) { this->timer--; } else { - func_8006D074(globalCtx); + func_8006D074(play); if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { - globalCtx->nextEntranceIndex = ENTR_SPOT09_1; + play->nextEntranceIndex = ENTR_SPOT09_1; } else if (GET_EVENTCHKINF(EVENTCHKINF_C7)) { - globalCtx->nextEntranceIndex = ENTR_SPOT12_18; + play->nextEntranceIndex = ENTR_SPOT12_18; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT12_17; + play->nextEntranceIndex = ENTR_SPOT12_17; } - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); + play->transitionTrigger = TRANS_TRIGGER_START; } } -void EnGe2_CaptureTurn(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_CaptureTurn(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; @@ -289,7 +289,7 @@ void EnGe2_CaptureTurn(EnGe2* this, GlobalContext* globalCtx) { } } -void EnGe2_KnockedOut(EnGe2* this, GlobalContext* globalCtx) { +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 }; @@ -299,16 +299,16 @@ void EnGe2_KnockedOut(EnGe2* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; if (this->stateFlags & GE2_STATE_ANIMCOMPLETE) { - effectAngle = (globalCtx->state.frames) * 0x2800; + 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(globalCtx, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor, + EffectSsKiraKira_SpawnDispersed(play, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor, &effectEnvColor, 1000, 16); } } -void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_TurnPlayerSpotted(EnGe2* this, PlayState* play) { s32 playerSpotted; this->actor.speedXZ = 0.0f; @@ -316,7 +316,7 @@ void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx) { if (this->stateFlags & GE2_STATE_TALKED) { this->stateFlags &= ~GE2_STATE_TALKED; } else { - playerSpotted = Ge2_DetectPlayerInAction(globalCtx, this); + playerSpotted = Ge2_DetectPlayerInAction(play, this); if (playerSpotted != 0) { this->timer = 100; @@ -344,11 +344,11 @@ void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnGe2_AboutTurn(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_AboutTurn(EnGe2* this, PlayState* play) { s32 playerSpotted; this->actor.speedXZ = 0.0f; - playerSpotted = Ge2_DetectPlayerInAction(globalCtx, this); + playerSpotted = Ge2_DetectPlayerInAction(play, this); if (playerSpotted != 0) { EnGe2_ChangeAction(this, GE2_ACTION_TURNPLAYERSPOTTED); @@ -365,10 +365,10 @@ void EnGe2_AboutTurn(EnGe2* this, GlobalContext* globalCtx) { } } -void EnGe2_Walk(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_Walk(EnGe2* this, PlayState* play) { u8 playerSpotted; - playerSpotted = Ge2_DetectPlayerInAction(globalCtx, this); + playerSpotted = Ge2_DetectPlayerInAction(play, this); if (playerSpotted != 0) { this->actor.speedXZ = 0.0f; EnGe2_ChangeAction(this, GE2_ACTION_TURNPLAYERSPOTTED); @@ -386,18 +386,18 @@ void EnGe2_Walk(EnGe2* this, GlobalContext* globalCtx) { } } -void EnGe2_Stand(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_Stand(EnGe2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->walkDirection, 2, 0x400, 0x200); } -void EnGe2_TurnToFacePlayer(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_TurnToFacePlayer(EnGe2* this, PlayState* play) { 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); this->actor.world.rot.y = this->actor.shape.rot.y; - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos); } else { if (angleDiff < 0) { Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100); @@ -410,10 +410,10 @@ void EnGe2_TurnToFacePlayer(EnGe2* this, GlobalContext* globalCtx) { } } -void EnGe2_LookAtPlayer(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_LookAtPlayer(EnGe2* this, PlayState* play) { if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) && (this->actor.xzDistToPlayer < 200.0f)) { - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100); @@ -422,8 +422,8 @@ void EnGe2_LookAtPlayer(EnGe2* this, GlobalContext* globalCtx) { } } -void EnGe2_SetActionAfterTalk(EnGe2* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnGe2_SetActionAfterTalk(EnGe2* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { switch (this->actor.params & 0xFF) { case GE2_TYPE_PATROLLING: @@ -439,67 +439,66 @@ void EnGe2_SetActionAfterTalk(EnGe2* this, GlobalContext* globalCtx) { this->actor.update = EnGe2_UpdateFriendly; this->actor.flags &= ~ACTOR_FLAG_16; } - EnGe2_TurnToFacePlayer(this, globalCtx); + EnGe2_TurnToFacePlayer(this, play); } -void EnGe2_WaitLookAtPlayer(EnGe2* this, GlobalContext* globalCtx) { - EnGe2_LookAtPlayer(this, globalCtx); +void EnGe2_WaitLookAtPlayer(EnGe2* this, PlayState* play) { + EnGe2_LookAtPlayer(this, play); } -void EnGe2_WaitTillCardGiven(EnGe2* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnGe2_WaitTillCardGiven(EnGe2* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnGe2_SetActionAfterTalk; } else { - func_8002F434(&this->actor, globalCtx, GI_GERUDO_CARD, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_GERUDO_CARD, 10000.0f, 50.0f); } } -void EnGe2_GiveCard(EnGe2* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnGe2_GiveCard(EnGe2* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = EnGe2_WaitTillCardGiven; - func_8002F434(&this->actor, globalCtx, GI_GERUDO_CARD, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_GERUDO_CARD, 10000.0f, 50.0f); } } -void EnGe2_ForceTalk(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_ForceTalk(EnGe2* this, PlayState* play) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnGe2_GiveCard; } else { this->actor.textId = 0x6004; this->actor.flags |= ACTOR_FLAG_16; - func_8002F1C4(&this->actor, globalCtx, 300.0f, 300.0f, 0); + func_8002F1C4(&this->actor, play, 300.0f, 300.0f, 0); } - EnGe2_LookAtPlayer(this, globalCtx); + EnGe2_LookAtPlayer(this, play); } -void EnGe2_SetupCapturePlayer(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_SetupCapturePlayer(EnGe2* this, PlayState* play) { this->stateFlags |= GE2_STATE_CAPTURING; this->actor.speedXZ = 0.0f; EnGe2_ChangeAction(this, GE2_ACTION_CAPTURETURN); - func_8002DF54(globalCtx, &this->actor, 95); + func_8002DF54(play, &this->actor, 95); func_80078884(NA_SE_SY_FOUND); - Message_StartTextbox(globalCtx, 0x6000, &this->actor); + Message_StartTextbox(play, 0x6000, &this->actor); } -void EnGe2_MaintainColliderAndSetAnimState(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_MaintainColliderAndSetAnimState(EnGe2* this, PlayState* play) { s32 pad; s32 pad2; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 25.0f, 40.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + 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->stateFlags & GE2_STATE_ANIMCOMPLETE) && SkelAnime_Update(&this->skelAnime)) { this->stateFlags |= GE2_STATE_ANIMCOMPLETE; } } -void EnGe2_MoveAndBlink(EnGe2* this, GlobalContext* globalCtx) { +void EnGe2_MoveAndBlink(EnGe2* this, PlayState* play) { Actor_MoveForward(&this->actor); if (DECR(this->blinkTimer) == 0) { @@ -514,13 +513,13 @@ void EnGe2_MoveAndBlink(EnGe2* this, GlobalContext* globalCtx) { // Update functions -void EnGe2_UpdateFriendly(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - EnGe2_MaintainColliderAndSetAnimState(this, globalCtx); - this->actionFunc(this, globalCtx); + EnGe2_MaintainColliderAndSetAnimState(this, play); + this->actionFunc(this, play); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if ((this->actor.params & 0xFF) == GE2_TYPE_PATROLLING) { this->actor.speedXZ = 0.0f; EnGe2_ChangeAction(this, GE2_ACTION_WAITLOOKATPLAYER); @@ -531,29 +530,29 @@ void EnGe2_UpdateFriendly(Actor* thisx, GlobalContext* globalCtx) { this->actor.textId = 0x6005; if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } - EnGe2_MoveAndBlink(this, globalCtx); + EnGe2_MoveAndBlink(this, play); } -void EnGe2_UpdateAfterTalk(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_UpdateAfterTalk(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; this->stateFlags |= GE2_STATE_TALKED; - EnGe2_MaintainColliderAndSetAnimState(this, globalCtx); - this->actionFunc(this, globalCtx); - EnGe2_MoveAndBlink(this, globalCtx); + EnGe2_MaintainColliderAndSetAnimState(this, play); + this->actionFunc(this, play); + EnGe2_MoveAndBlink(this, play); } -void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_Update(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; s32 paramsType; - EnGe2_MaintainColliderAndSetAnimState(this, globalCtx); + EnGe2_MaintainColliderAndSetAnimState(this, play); if ((this->stateFlags & GE2_STATE_KO) || (this->stateFlags & GE2_STATE_CAPTURING)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } else if (this->collider.base.acFlags & 2) { if ((this->collider.info.acHitInfo != NULL) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x80)) { Actor_SetColorFilter(&this->actor, 0, 120, 0, 400); @@ -567,29 +566,28 @@ void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_VO_SK_CRASH); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if (Ge2_DetectPlayerInUpdate(globalCtx, this, &this->actor.focus.pos, this->actor.shape.rot.y, - this->yDetectRange)) { + if (Ge2_DetectPlayerInUpdate(play, this, &this->actor.focus.pos, this->actor.shape.rot.y, this->yDetectRange)) { // "Discovered!" osSyncPrintf(VT_FGCOL(GREEN) "発見!!!!!!!!!!!!\n" VT_RST); - EnGe2_SetupCapturePlayer(this, globalCtx); + EnGe2_SetupCapturePlayer(this, play); } if (((this->actor.params & 0xFF) == GE2_TYPE_STATIONARY) && (this->actor.xzDistToPlayer < 100.0f)) { // "Discovered!" osSyncPrintf(VT_FGCOL(GREEN) "発見!!!!!!!!!!!!\n" VT_RST); - EnGe2_SetupCapturePlayer(this, globalCtx); + EnGe2_SetupCapturePlayer(this, play); } } if (!(this->stateFlags & GE2_STATE_KO)) { paramsType = this->actor.params & 0xFF; // Not necessary, but looks a bit nicer if ((paramsType == GE2_TYPE_PATROLLING) || (paramsType == GE2_TYPE_STATIONARY)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } - EnGe2_MoveAndBlink(this, globalCtx); + EnGe2_MoveAndBlink(this, play); if (EnGe2_CheckCarpentersFreed() && !(this->stateFlags & GE2_STATE_KO)) { this->actor.update = EnGe2_UpdateFriendly; @@ -597,14 +595,13 @@ void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnGe2* this = (EnGe2*)thisx; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 25.0f, 40.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + 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 & 2) && ((this->collider.info.acHitInfo == NULL) || !(this->collider.info.acHitInfo->toucher.dmgFlags & 0x80))) { @@ -615,7 +612,7 @@ void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx2) { this->actor.speedXZ = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_VO_SK_CRASH); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (EnGe2_CheckCarpentersFreed()) { this->actor.update = EnGe2_UpdateFriendly; @@ -626,7 +623,7 @@ void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 EnGe2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGe2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGe2* this = (EnGe2*)thisx; if (limbIndex == 3) { @@ -636,7 +633,7 @@ s32 EnGe2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnGe2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +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; @@ -645,18 +642,18 @@ void EnGe2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnGe2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGe2_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gGerudoPurpleEyeOpenTex, gGerudoPurpleEyeHalfTex, gGerudoPurpleEyeClosedTex }; s32 pad; EnGe2* this = (EnGe2*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ge2.c", 1274); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ge2.c", 1274); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - func_8002EBCC(&this->actor, globalCtx, 0); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8002EBCC(&this->actor, play, 0); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGe2_OverrideLimbDraw, EnGe2_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ge2.c", 1291); + 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 b9d08f0bb6..7c78ad91a6 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -6,7 +6,7 @@ struct EnGe2; -typedef void (*EnGe2ActionFunc)(struct EnGe2*, GlobalContext*); +typedef void (*EnGe2ActionFunc)(struct EnGe2*, PlayState*); typedef struct EnGe2 { /* 0x0000 */ Actor actor; 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 b9ea0553cb..7f31b3fe57 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnGe3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGe3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGe3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGe3_Draw(Actor* thisx, GlobalContext* globalCtx); +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* play); -void EnGe3_WaitLookAtPlayer(EnGe3* this, GlobalContext* globalCtx); -void EnGe3_ForceTalk(EnGe3* this, GlobalContext* globalCtx); -void EnGe3_UpdateWhenNotTalking(Actor* thisx, GlobalContext* globalCtx); +void EnGe3_WaitLookAtPlayer(EnGe3* this, PlayState* play); +void EnGe3_ForceTalk(EnGe3* this, PlayState* play); +void EnGe3_UpdateWhenNotTalking(Actor* thisx, PlayState* play); const ActorInit En_Ge3_InitVars = { ACTOR_EN_GE3, @@ -63,16 +63,16 @@ void EnGe3_ChangeAction(EnGe3* this, s32 i) { this->unk_30C &= ~2; } -void EnGe3_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnGe3_Init(Actor* thisx, PlayState* play2) { EnGe3* this = (EnGe3*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoRedSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, NULL, this->jointTable, this->morphTable, GELDB_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gGerudoRedStandAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &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; @@ -85,20 +85,20 @@ void EnGe3_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.gravity = -1.0f; } -void EnGe3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGe3_Destroy(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnGe3_TurnToFacePlayer(EnGe3* this, GlobalContext* globalCtx) { +void EnGe3_TurnToFacePlayer(EnGe3* this, PlayState* play) { 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); this->actor.world.rot.y = this->actor.shape.rot.y; - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos); } else { if (angleDiff < 0) { Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100); @@ -111,10 +111,10 @@ void EnGe3_TurnToFacePlayer(EnGe3* this, GlobalContext* globalCtx) { } } -void EnGe3_LookAtPlayer(EnGe3* this, GlobalContext* globalCtx) { +void EnGe3_LookAtPlayer(EnGe3* this, PlayState* play) { if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x2300) && (this->actor.xzDistToPlayer < 100.0f)) { - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100); @@ -123,67 +123,66 @@ void EnGe3_LookAtPlayer(EnGe3* this, GlobalContext* globalCtx) { } } -void EnGe3_Wait(EnGe3* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnGe3_Wait(EnGe3* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe3_WaitLookAtPlayer; this->actor.update = EnGe3_UpdateWhenNotTalking; this->actor.flags &= ~ACTOR_FLAG_16; } - EnGe3_TurnToFacePlayer(this, globalCtx); + EnGe3_TurnToFacePlayer(this, play); } -void EnGe3_WaitLookAtPlayer(EnGe3* this, GlobalContext* globalCtx) { - EnGe3_LookAtPlayer(this, globalCtx); +void EnGe3_WaitLookAtPlayer(EnGe3* this, PlayState* play) { + EnGe3_LookAtPlayer(this, play); } -void EnGe3_WaitTillCardGiven(EnGe3* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnGe3_WaitTillCardGiven(EnGe3* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnGe3_Wait; } else { - func_8002F434(&this->actor, globalCtx, GI_GERUDO_CARD, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_GERUDO_CARD, 10000.0f, 50.0f); } } -void EnGe3_GiveCard(EnGe3* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnGe3_GiveCard(EnGe3* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = EnGe3_WaitTillCardGiven; - func_8002F434(&this->actor, globalCtx, GI_GERUDO_CARD, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_GERUDO_CARD, 10000.0f, 50.0f); } } -void EnGe3_ForceTalk(EnGe3* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnGe3_ForceTalk(EnGe3* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnGe3_GiveCard; } else { if (!(this->unk_30C & 4)) { - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); this->unk_30C |= 4; } this->actor.textId = 0x6004; this->actor.flags |= ACTOR_FLAG_16; - func_8002F1C4(&this->actor, globalCtx, 300.0f, 300.0f, 0); + func_8002F1C4(&this->actor, play, 300.0f, 300.0f, 0); } - EnGe3_LookAtPlayer(this, globalCtx); + EnGe3_LookAtPlayer(this, play); } -void EnGe3_UpdateCollision(EnGe3* this, GlobalContext* globalCtx) { +void EnGe3_UpdateCollision(EnGe3* this, PlayState* play) { s32 pad; s32 pad2; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 25.0f, 40.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + 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->unk_30C & 2) && SkelAnime_Update(&this->skelAnime)) { this->unk_30C |= 2; } } -void EnGe3_MoveAndBlink(EnGe3* this, GlobalContext* globalCtx) { +void EnGe3_MoveAndBlink(EnGe3* this, PlayState* play) { Actor_MoveForward(&this->actor); @@ -198,34 +197,34 @@ void EnGe3_MoveAndBlink(EnGe3* this, GlobalContext* globalCtx) { } } -void EnGe3_UpdateWhenNotTalking(Actor* thisx, GlobalContext* globalCtx) { +void EnGe3_UpdateWhenNotTalking(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - EnGe3_UpdateCollision(this, globalCtx); - this->actionFunc(this, globalCtx); + EnGe3_UpdateCollision(this, play); + this->actionFunc(this, play); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnGe3_Wait; this->actor.update = EnGe3_Update; } else { this->actor.textId = 0x6005; if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } - EnGe3_MoveAndBlink(this, globalCtx); + EnGe3_MoveAndBlink(this, play); } -void EnGe3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGe3_Update(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - EnGe3_UpdateCollision(this, globalCtx); - this->actionFunc(this, globalCtx); - EnGe3_MoveAndBlink(this, globalCtx); + EnGe3_UpdateCollision(this, play); + this->actionFunc(this, play); + EnGe3_MoveAndBlink(this, play); } -s32 EnGe3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGe3* this = (EnGe3*)thisx; switch (limbIndex) { @@ -241,7 +240,7 @@ s32 EnGe3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, // This is a hack to fix the color-changing clothes this Gerudo has on N64 versions default: - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ge3.c", 547); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ge3.c", 547); switch (limbIndex) { case GELDB_LIMB_NECK: break; @@ -260,13 +259,13 @@ s32 EnGe3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, gDPSetEnvColor(POLY_OPA_DISP++, 140, 0, 0, 255); break; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ge3.c", 566); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge3.c", 566); break; } return false; } -void EnGe3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +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 }; @@ -275,22 +274,22 @@ void EnGe3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnGe3_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnGe3_Draw(Actor* thisx, PlayState* play2) { static void* eyeTextures[] = { gGerudoRedEyeOpenTex, gGerudoRedEyeHalfTex, gGerudoRedEyeShutTex, }; EnGe3* this = (EnGe3*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ge3.c", 614); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ge3.c", 614); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - func_8002EBCC(&this->actor, globalCtx, 0); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8002EBCC(&this->actor, play, 0); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGe3_OverrideLimbDraw, EnGe3_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ge3.c", 631); + 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 f292c9968a..4bb5c7b3fc 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -7,7 +7,7 @@ struct EnGe3; -typedef void (*EnGe3ActionFunc)(struct EnGe3*, GlobalContext*); +typedef void (*EnGe3ActionFunc)(struct EnGe3*, PlayState*); typedef struct EnGe3 { /* 0x0000 */ Actor actor; 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 32486c34cc..373738366c 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -29,45 +29,45 @@ typedef enum { /* 16 */ GELDB_SPIN_DODGE } EnGeldBAction; -void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGeldB_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGeldB_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGeldB_Init(Actor* thisx, PlayState* play); +void EnGeldB_Destroy(Actor* thisx, PlayState* play); +void EnGeldB_Update(Actor* thisx, PlayState* play); +void EnGeldB_Draw(Actor* thisx, PlayState* play); -s32 EnGeldB_DodgeRanged(GlobalContext* globalCtx, EnGeldB* this); +s32 EnGeldB_DodgeRanged(PlayState* play, EnGeldB* this); void EnGeldB_SetupWait(EnGeldB* this); void EnGeldB_SetupReady(EnGeldB* this); -void EnGeldB_SetupAdvance(EnGeldB* this, GlobalContext* globalCtx); +void EnGeldB_SetupAdvance(EnGeldB* this, PlayState* play); void EnGeldB_SetupPivot(EnGeldB* this); void EnGeldB_SetupRollForward(EnGeldB* this); void EnGeldB_SetupCircle(EnGeldB* this); -void EnGeldB_SetupSpinDodge(EnGeldB* this, GlobalContext* globalCtx); +void EnGeldB_SetupSpinDodge(EnGeldB* this, PlayState* play); void EnGeldB_SetupSlash(EnGeldB* this); void EnGeldB_SetupSpinAttack(EnGeldB* this); void EnGeldB_SetupRollBack(EnGeldB* this); void EnGeldB_SetupJump(EnGeldB* this); void EnGeldB_SetupBlock(EnGeldB* this); -void EnGeldB_SetupSidestep(EnGeldB* this, GlobalContext* globalCtx); +void EnGeldB_SetupSidestep(EnGeldB* this, PlayState* play); void EnGeldB_SetupDefeated(EnGeldB* this); -void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Flee(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_RollForward(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Pivot(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Slash(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_RollBack(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Stunned(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Jump(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx); -void EnGeldB_Defeated(EnGeldB* this, GlobalContext* globalCtx); +void EnGeldB_Wait(EnGeldB* this, PlayState* play); +void EnGeldB_Flee(EnGeldB* this, PlayState* play); +void EnGeldB_Ready(EnGeldB* this, PlayState* play); +void EnGeldB_Advance(EnGeldB* this, PlayState* play); +void EnGeldB_RollForward(EnGeldB* this, PlayState* play); +void EnGeldB_Pivot(EnGeldB* this, PlayState* play); +void EnGeldB_Circle(EnGeldB* this, PlayState* play); +void EnGeldB_SpinDodge(EnGeldB* this, PlayState* play); +void EnGeldB_Slash(EnGeldB* this, PlayState* play); +void EnGeldB_SpinAttack(EnGeldB* this, PlayState* play); +void EnGeldB_RollBack(EnGeldB* this, PlayState* play); +void EnGeldB_Stunned(EnGeldB* this, PlayState* play); +void EnGeldB_Damaged(EnGeldB* this, PlayState* play); +void EnGeldB_Jump(EnGeldB* this, PlayState* play); +void EnGeldB_Block(EnGeldB* this, PlayState* play); +void EnGeldB_Sidestep(EnGeldB* this, PlayState* play); +void EnGeldB_Defeated(EnGeldB* this, PlayState* play); const ActorInit En_GeldB_InitVars = { ACTOR_EN_GELDB, @@ -215,7 +215,7 @@ void EnGeldB_SetupAction(EnGeldB* this, EnGeldBActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGeldB_Init(Actor* thisx, PlayState* play) { s32 pad; EffectBlureInit1 blureInit; EnGeldB* this = (EnGeldB*)thisx; @@ -232,14 +232,14 @@ void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params &= 0xFF; this->blinkState = 0; this->unkFloat = 10.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoRedSkel, &gGerudoRedNeutralAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, &gGerudoRedNeutralAnim, this->jointTable, this->morphTable, GELDB_LIMB_MAX); - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, thisx, &sBodyCylInit); - Collider_InitTris(globalCtx, &this->blockCollider); - Collider_SetTris(globalCtx, &this->blockCollider, thisx, &sBlockTrisInit, this->blockElements); - Collider_InitQuad(globalCtx, &this->swordCollider); - Collider_SetQuad(globalCtx, &this->swordCollider, thisx, &sSwordQuadInit); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, thisx, &sBodyCylInit); + Collider_InitTris(play, &this->blockCollider); + Collider_SetTris(play, &this->blockCollider, thisx, &sBlockTrisInit, this->blockElements); + Collider_InitQuad(play, &this->swordCollider); + Collider_SetQuad(play, &this->swordCollider, thisx, &sSwordQuadInit); 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] = @@ -250,27 +250,27 @@ void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); Actor_SetScale(thisx, 0.012499999f); EnGeldB_SetupWait(this); - if ((this->keyFlag != 0) && Flags_GetCollectible(globalCtx, this->keyFlag >> 8)) { + if ((this->keyFlag != 0) && Flags_GetCollectible(play, this->keyFlag >> 8)) { Actor_Kill(thisx); } } -void EnGeldB_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGeldB_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnGeldB* this = (EnGeldB*)thisx; func_800F5B58(); - Effect_Delete(globalCtx, this->blureIndex); - Collider_DestroyTris(globalCtx, &this->blockCollider); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyQuad(globalCtx, &this->swordCollider); + Effect_Delete(play, this->blureIndex); + Collider_DestroyTris(play, &this->blockCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->swordCollider); } -s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) { - Player* player = GET_PLAYER(globalCtx); +s32 EnGeldB_ReactToPlayer(PlayState* play, EnGeldB* this, s16 arg2) { + Player* player = GET_PLAYER(play); Actor* thisx = &this->actor; s16 angleToWall; s16 angleToLink; @@ -281,32 +281,32 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) { angleToLink = thisx->yawTowardsPlayer - thisx->shape.rot.y; angleToLink = ABS(angleToLink); - if (func_800354B4(globalCtx, thisx, 100.0f, 0x2710, 0x3E80, thisx->shape.rot.y)) { + if (func_800354B4(play, thisx, 100.0f, 0x2710, 0x3E80, thisx->shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - EnGeldB_SetupSpinDodge(this, globalCtx); + EnGeldB_SetupSpinDodge(this, play); return true; - } else if (globalCtx->gameplayFrames & 1) { + } else if (play->gameplayFrames & 1) { EnGeldB_SetupBlock(this); return true; } } - if (func_800354B4(globalCtx, thisx, 100.0f, 0x5DC0, 0x2AA8, thisx->shape.rot.y)) { + if (func_800354B4(play, thisx, 100.0f, 0x5DC0, 0x2AA8, thisx->shape.rot.y)) { thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer; if ((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 0x2EE0) && (thisx->xzDistToPlayer < 90.0f)) { EnGeldB_SetupJump(this); return true; } else if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - EnGeldB_SetupSpinDodge(this, globalCtx); + EnGeldB_SetupSpinDodge(this, play); return true; - } else if ((thisx->xzDistToPlayer < 90.0f) && (globalCtx->gameplayFrames & 1)) { + } else if ((thisx->xzDistToPlayer < 90.0f) && (play->gameplayFrames & 1)) { EnGeldB_SetupBlock(this); return true; } else { EnGeldB_SetupRollBack(this); return true; } - } else if ((bomb = Actor_FindNearby(globalCtx, thisx, -1, ACTORCAT_EXPLOSIVE, 80.0f)) != NULL) { + } else if ((bomb = Actor_FindNearby(play, thisx, -1, ACTORCAT_EXPLOSIVE, 80.0f)) != NULL) { thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer; if (((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall < 0x2EE0)) || (bomb->id == ACTOR_EN_BOM_CHU)) { if ((bomb->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(thisx, bomb) < 80.0f) && @@ -314,7 +314,7 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) { EnGeldB_SetupJump(this); return true; } else { - EnGeldB_SetupSidestep(this, globalCtx); + EnGeldB_SetupSidestep(this, play); return true; } } else { @@ -323,13 +323,13 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) { } } else if (arg2) { if (angleToLink >= 0x1B58) { - EnGeldB_SetupSidestep(this, globalCtx); + EnGeldB_SetupSidestep(this, play); return true; } else { s16 angleToFacingLink = player->actor.shape.rot.y - thisx->shape.rot.y; - if ((thisx->xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(globalCtx, thisx) && - ((globalCtx->gameplayFrames & 7) || (ABS(angleToFacingLink) < 0x38E0))) { + if ((thisx->xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(play, thisx) && + ((play->gameplayFrames & 7) || (ABS(angleToFacingLink) < 0x38E0))) { EnGeldB_SetupSlash(this); return true; } else { @@ -353,9 +353,8 @@ void EnGeldB_SetupWait(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Wait); } -void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx) { - if ((this->invisible && !Flags_GetSwitch(globalCtx, this->actor.home.rot.z)) || - this->actor.xzDistToPlayer > 300.0f) { +void EnGeldB_Wait(EnGeldB* this, PlayState* play) { + if ((this->invisible && !Flags_GetSwitch(play, this->actor.home.rot.z)) || this->actor.xzDistToPlayer > 300.0f) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.world.pos.y = this->actor.floorHeight + 120.0f; } else { @@ -371,8 +370,8 @@ void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.velocity.y = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(globalCtx, &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); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { EnGeldB_SetupReady(this); @@ -390,14 +389,14 @@ void EnGeldB_SetupFlee(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Flee); } -void EnGeldB_Flee(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Flee(EnGeldB* this, PlayState* play) { if (this->skelAnime.curFrame == 10.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_JUMP); } if (this->skelAnime.curFrame == 2.0f) { this->actor.gravity = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(globalCtx, &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); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 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); @@ -417,8 +416,8 @@ void EnGeldB_SetupReady(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Ready); } -void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGeldB_Ready(EnGeldB* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 angleToLink; @@ -432,7 +431,7 @@ void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) { this->lookTimer = 0; } angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (!EnGeldB_DodgeRanged(globalCtx, this)) { + if (!EnGeldB_DodgeRanged(play, this)) { if (this->unkTimer != 0) { this->unkTimer--; @@ -440,7 +439,7 @@ void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) { return; } this->unkTimer = 0; - } else if (EnGeldB_ReactToPlayer(globalCtx, this, 0)) { + } else if (EnGeldB_ReactToPlayer(play, this, 0)) { return; } angleToLink = player->actor.shape.rot.y - this->actor.shape.rot.y; @@ -451,28 +450,28 @@ void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) { if (Actor_IsFacingPlayer(&this->actor, 30 * 0x10000 / 360)) { if ((210.0f > this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 150.0f) && (Rand_ZeroOne() < 0.3f)) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor) || (Rand_ZeroOne() > 0.5f) || + if (Actor_OtherIsTargeted(play, &this->actor) || (Rand_ZeroOne() > 0.5f) || (ABS(angleToLink) < 0x38E0)) { EnGeldB_SetupRollForward(this); } else { EnGeldB_SetupSpinAttack(this); } } else if (Rand_ZeroOne() > 0.3f) { - EnGeldB_SetupAdvance(this, globalCtx); + EnGeldB_SetupAdvance(this, play); } else { EnGeldB_SetupCircle(this); } } else { EnGeldB_SetupPivot(this); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } } } } -void EnGeldB_SetupAdvance(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_SetupAdvance(EnGeldB* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gGerudoRedWalkAnim); Animation_Change(&this->skelAnime, &gGerudoRedWalkAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, -4.0f); @@ -480,14 +479,14 @@ void EnGeldB_SetupAdvance(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupAction(this, EnGeldB_Advance); } -void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Advance(EnGeldB* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 absPlaySpeed; s16 facingAngletoLink; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (!EnGeldB_DodgeRanged(globalCtx, this)) { + if (!EnGeldB_DodgeRanged(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 (this->actor.xzDistToPlayer <= 40.0f) { @@ -520,19 +519,19 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupReady(this); } } else if (this->actor.xzDistToPlayer < 90.0f) { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && + if (!Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.03f || (this->actor.xzDistToPlayer <= 45.0f && facingAngletoLink < 0x38E0))) { EnGeldB_SetupSlash(this); - } else if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) { + } else if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { EnGeldB_SetupRollBack(this); } else { EnGeldB_SetupCircle(this); } } - if (!EnGeldB_ReactToPlayer(globalCtx, this, 0)) { + if (!EnGeldB_ReactToPlayer(play, this, 0)) { if ((this->actor.xzDistToPlayer < 210.0f) && (this->actor.xzDistToPlayer > 150.0f) && Actor_IsFacingPlayer(&this->actor, 0x71C)) { - if (Actor_IsTargeted(globalCtx, &this->actor)) { + if (Actor_IsTargeted(play, &this->actor)) { if (Rand_ZeroOne() > 0.5f) { EnGeldB_SetupRollForward(this); } else { @@ -543,7 +542,7 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) { return; } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } if (prevFrame != (s32)this->skelAnime.curFrame) { @@ -570,8 +569,8 @@ void EnGeldB_SetupRollForward(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_RollForward); } -void EnGeldB_RollForward(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGeldB_RollForward(EnGeldB* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 facingAngleToLink = player->actor.shape.rot.y - this->actor.shape.rot.y; if (SkelAnime_Update(&this->skelAnime)) { @@ -583,14 +582,14 @@ void EnGeldB_RollForward(EnGeldB* this, GlobalContext* globalCtx) { if (ABS(facingAngleToLink) < 0x38E0) { this->lookTimer = 20; } - } else if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && + } else if (!Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f || (ABS(facingAngleToLink) < 0x3FFC))) { EnGeldB_SetupSlash(this); } else { - EnGeldB_SetupAdvance(this, globalCtx); + EnGeldB_SetupAdvance(this, play); } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } } @@ -601,12 +600,12 @@ void EnGeldB_SetupPivot(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Pivot); } -void EnGeldB_Pivot(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Pivot(EnGeldB* this, PlayState* play) { s16 angleToLink; s16 turnRate; f32 playSpeed; - if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0)) { + if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0)) { angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; turnRate = (angleToLink > 0) ? ((angleToLink * 0.25f) + 2000.0f) : ((angleToLink * 0.25f) - 2000.0f); this->actor.world.rot.y = this->actor.shape.rot.y += turnRate; @@ -623,10 +622,10 @@ void EnGeldB_Pivot(EnGeldB* this, GlobalContext* globalCtx) { if (Rand_ZeroOne() > 0.8f) { EnGeldB_SetupCircle(this); } else { - EnGeldB_SetupAdvance(this, globalCtx); + EnGeldB_SetupAdvance(this, play); } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } } @@ -645,17 +644,17 @@ void EnGeldB_SetupCircle(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Circle); } -void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Circle(EnGeldB* this, PlayState* play) { s16 angleBehindLink; s16 phi_v1; s32 afterPrevFrame; s32 prevFrame; s32 pad; s32 beforeCurFrame; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); - if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0)) { + if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0)) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3A98; angleBehindLink = player->actor.shape.rot.y + 0x8000; if (Math_SinS(angleBehindLink - this->actor.shape.rot.y) >= 0.0f) { @@ -670,8 +669,7 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) { } } if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, - this->actor.shape.rot.y + 0x3E80)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { phi_v1 = this->actor.shape.rot.y + 0x3E80; @@ -720,14 +718,14 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } if ((Math_CosS(angleBehindLink - this->actor.shape.rot.y) < -0.85f) && - !Actor_OtherIsTargeted(globalCtx, &this->actor) && (this->actor.xzDistToPlayer <= 45.0f)) { + !Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer <= 45.0f)) { EnGeldB_SetupSlash(this); } else if (--this->timer == 0) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) { + if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { EnGeldB_SetupRollBack(this); } else { EnGeldB_SetupReady(this); @@ -736,9 +734,9 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) { } } -void EnGeldB_SetupSpinDodge(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_SetupSpinDodge(EnGeldB* this, PlayState* play) { s16 sp3E; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 lastFrame = Animation_GetLastFrame(&gGerudoRedSidestepAnim); Animation_Change(&this->skelAnime, &gGerudoRedSidestepAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, 0.0f); @@ -762,7 +760,7 @@ void EnGeldB_SetupSpinDodge(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupAction(this, EnGeldB_SpinDodge); } -void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_SpinDodge(EnGeldB* this, PlayState* play) { s16 phi_v1; s32 prevFrame; s32 pad; @@ -771,7 +769,7 @@ void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x3A98; if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { phi_v1 = this->actor.shape.rot.y + 0x3E80; @@ -816,14 +814,14 @@ void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } this->timer--; if (this->timer == 0) { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - if (!EnGeldB_DodgeRanged(globalCtx, this)) { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && (this->actor.xzDistToPlayer <= 70.0f)) { + if (!EnGeldB_DodgeRanged(play, this)) { + if (!Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer <= 70.0f)) { EnGeldB_SetupSlash(this); } else { EnGeldB_SetupRollBack(this); @@ -848,8 +846,8 @@ void EnGeldB_SetupSlash(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Slash); } -void EnGeldB_Slash(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGeldB_Slash(EnGeldB* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y; s16 angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; @@ -880,13 +878,13 @@ void EnGeldB_Slash(EnGeldB* this, GlobalContext* globalCtx) { } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnGeldB_SetupSidestep(this, globalCtx); + EnGeldB_SetupSidestep(this, play); } else if (angleFacingLink <= 0x2710) { if (angleToLink > 0x3E80) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnGeldB_SetupCircle(this); } else { - EnGeldB_ReactToPlayer(globalCtx, this, 1); + EnGeldB_ReactToPlayer(play, this, 1); } } else { EnGeldB_SetupCircle(this); @@ -906,8 +904,8 @@ void EnGeldB_SetupSpinAttack(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_SpinAttack); } -void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGeldB_SpinAttack(EnGeldB* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 angleFacingLink; s16 angleToLink; @@ -919,10 +917,10 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { } else if (this->swordCollider.base.atFlags & AT_HIT) { this->swordCollider.base.atFlags &= ~AT_HIT; if (&player->actor == this->swordCollider.base.at) { - func_8002F71C(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); + func_8002F71C(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); this->spinAttackState = 2; - func_8002DF54(globalCtx, &this->actor, 0x18); - Message_StartTextbox(globalCtx, 0x6003, &this->actor); + func_8002DF54(play, &this->actor, 0x18); + Message_StartTextbox(play, 0x6003, &this->actor); this->timer = 30; this->actor.speedXZ = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_YOUNG_LAUGH); @@ -933,8 +931,8 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { 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(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(globalCtx, &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); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); this->swordState = 1; this->actor.speedXZ = 10.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_ATTACK); @@ -956,7 +954,7 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnGeldB_SetupSidestep(this, globalCtx); + EnGeldB_SetupSidestep(this, play); } else { angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y; angleFacingLink = ABS(angleFacingLink); @@ -967,7 +965,7 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnGeldB_SetupCircle(this); } else { - EnGeldB_ReactToPlayer(globalCtx, this, 1); + EnGeldB_ReactToPlayer(play, this, 1); } } else { EnGeldB_SetupCircle(this); @@ -988,18 +986,18 @@ void EnGeldB_SetupRollBack(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_RollBack); } -void EnGeldB_RollBack(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_RollBack(EnGeldB* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && + if (!Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && (this->actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { EnGeldB_SetupSpinAttack(this); - } else if (globalCtx->gameplayFrames & 1) { - EnGeldB_SetupSidestep(this, globalCtx); + } else if (play->gameplayFrames & 1) { + EnGeldB_SetupSidestep(this, play); } else { EnGeldB_SetupReady(this); } } - if ((globalCtx->state.frames & 0x5F) == 0) { + if ((play->state.frames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } } @@ -1019,7 +1017,7 @@ void EnGeldB_SetupStunned(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Stunned); } -void EnGeldB_Stunned(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Stunned(EnGeldB* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } @@ -1033,7 +1031,7 @@ void EnGeldB_Stunned(EnGeldB* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.health == 0) { EnGeldB_SetupDefeated(this); } else { - EnGeldB_ReactToPlayer(globalCtx, this, 1); + EnGeldB_ReactToPlayer(play, this, 1); } } } @@ -1053,7 +1051,7 @@ void EnGeldB_SetupDamaged(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Damaged); } -void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Damaged(EnGeldB* this, PlayState* play) { s16 angleToWall; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { @@ -1066,15 +1064,15 @@ void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx) { this->invisible = false; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0) && + if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0) && SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { EnGeldB_SetupJump(this); - } else if (!EnGeldB_DodgeRanged(globalCtx, this)) { - if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && - (globalCtx->gameplayFrames & 7)) { + } else if (!EnGeldB_DodgeRanged(play, this)) { + if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + (play->gameplayFrames & 7)) { EnGeldB_SetupSlash(this); } else { EnGeldB_SetupRollBack(this); @@ -1097,11 +1095,11 @@ void EnGeldB_SetupJump(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Jump); } -void EnGeldB_Jump(EnGeldB* this, GlobalContext* globalCtx) { +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(globalCtx, &this->leftFootPos); - func_800355B8(globalCtx, &this->rightFootPos); + func_800355B8(play, &this->leftFootPos); + func_800355B8(play, &this->rightFootPos); } if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { @@ -1110,7 +1108,7 @@ void EnGeldB_Jump(EnGeldB* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (!Actor_OtherIsTargeted(play, &this->actor)) { EnGeldB_SetupSlash(this); } else { EnGeldB_SetupReady(this); @@ -1131,8 +1129,8 @@ void EnGeldB_SetupBlock(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Block); } -void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGeldB_Block(EnGeldB* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 angleToLink; s16 angleFacingLink; @@ -1146,18 +1144,18 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) { angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(angleToLink) <= 0x4000) && (this->actor.xzDistToPlayer < 40.0f) && (ABS(this->actor.yDistToPlayer) < 50.0f)) { - if (func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { + if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - EnGeldB_SetupSpinDodge(this, globalCtx); - } else if (globalCtx->gameplayFrames & 1) { + EnGeldB_SetupSpinDodge(this, play); + } else if (play->gameplayFrames & 1) { EnGeldB_SetupBlock(this); } else { EnGeldB_SetupRollBack(this); } } else { angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && - ((globalCtx->gameplayFrames & 1) || (ABS(angleFacingLink) < 0x38E0))) { + if (!Actor_OtherIsTargeted(play, &this->actor) && + ((play->gameplayFrames & 1) || (ABS(angleFacingLink) < 0x38E0))) { EnGeldB_SetupSlash(this); } else { EnGeldB_SetupCircle(this); @@ -1167,11 +1165,11 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupCircle(this); } } else if ((this->timer == 0) && - func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { + func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - EnGeldB_SetupSpinDodge(this, globalCtx); - } else if (!EnGeldB_DodgeRanged(globalCtx, this)) { - if (globalCtx->gameplayFrames & 1) { + EnGeldB_SetupSpinDodge(this, play); + } else if (!EnGeldB_DodgeRanged(play, this)) { + if (play->gameplayFrames & 1) { if ((this->actor.xzDistToPlayer < 100.0f) && (Rand_ZeroOne() > 0.7f)) { EnGeldB_SetupJump(this); } else { @@ -1184,13 +1182,13 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) { } } -void EnGeldB_SetupSidestep(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_SetupSidestep(EnGeldB* this, PlayState* play) { s16 linkAngle; Player* player; f32 lastFrame = Animation_GetLastFrame(&gGerudoRedSidestepAnim); Animation_Change(&this->skelAnime, &gGerudoRedSidestepAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, 0.0f); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); linkAngle = player->actor.shape.rot.y; if (Math_SinS(linkAngle - this->actor.shape.rot.y) > 0.0f) { @@ -1208,10 +1206,10 @@ void EnGeldB_SetupSidestep(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupAction(this, EnGeldB_Sidestep); } -void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Sidestep(EnGeldB* this, PlayState* play) { s16 behindLinkAngle; s16 phi_v1; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 prevFrame; s32 beforeCurFrame; f32 absPlaySpeed; @@ -1225,7 +1223,7 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { } if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { phi_v1 = this->actor.shape.rot.y + 0x3E80; @@ -1274,7 +1272,7 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = ((void)0, ABS(this->skelAnime.playSpeed)); // Needed to match for some reason - if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0)) { + if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0)) { if (--this->timer == 0) { s16 angleFacingPlayer = player->actor.shape.rot.y - this->actor.shape.rot.y; @@ -1283,23 +1281,23 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupReady(this); this->timer = (Rand_ZeroOne() * 5.0f) + 1.0f; } else { - Player* player2 = GET_PLAYER(globalCtx); + Player* player2 = GET_PLAYER(play); s16 angleFacingPlayer2 = player2->actor.shape.rot.y - this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && - (!(globalCtx->gameplayFrames & 3) || (ABS(angleFacingPlayer2) < 0x38E0))) { + if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + (!(play->gameplayFrames & 3) || (ABS(angleFacingPlayer2) < 0x38E0))) { EnGeldB_SetupSlash(this); } else if ((210.0f > this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 150.0f) && - !(globalCtx->gameplayFrames & 1)) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor) || (Rand_ZeroOne() > 0.5f) || + !(play->gameplayFrames & 1)) { + if (Actor_OtherIsTargeted(play, &this->actor) || (Rand_ZeroOne() > 0.5f) || (ABS(angleFacingPlayer2) < 0x38E0)) { EnGeldB_SetupRollForward(this); } else { EnGeldB_SetupSpinAttack(this); } } else { - EnGeldB_SetupAdvance(this, globalCtx); + EnGeldB_SetupAdvance(this, play); } } } @@ -1308,7 +1306,7 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { ((beforeCurFrame < 5) && (((s32)absPlaySpeed + prevFrame) > 5)))) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } } @@ -1329,7 +1327,7 @@ void EnGeldB_SetupDefeated(EnGeldB* this) { EnGeldB_SetupAction(this, EnGeldB_Defeated); } -void EnGeldB_Defeated(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_Defeated(EnGeldB* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } @@ -1345,7 +1343,7 @@ void EnGeldB_Defeated(EnGeldB* this, GlobalContext* globalCtx) { } } -void EnGeldB_TurnHead(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_TurnHead(EnGeldB* this, PlayState* play) { if ((this->action == GELDB_READY) && (this->lookTimer != 0)) { this->headRot.y = Math_SinS(this->lookTimer * 0x1068) * 8920.0f; } else if (this->action != GELDB_STUNNED) { @@ -1358,7 +1356,7 @@ void EnGeldB_TurnHead(EnGeldB* this, GlobalContext* globalCtx) { } } -void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) { +void EnGeldB_CollisionCheck(EnGeldB* this, PlayState* play) { s32 pad; EnItem00* key; @@ -1383,7 +1381,7 @@ void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) { Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); if (Actor_ApplyDamage(&this->actor) == 0) { if (this->keyFlag != 0) { - key = Item_DropCollectible(globalCtx, &this->actor.world.pos, this->keyFlag | ITEM00_SMALL_KEY); + key = Item_DropCollectible(play, &this->actor.world.pos, this->keyFlag | ITEM00_SMALL_KEY); if (key != NULL) { key->actor.world.rot.y = Math_Vec3f_Yaw(&key->actor.world.pos, &this->actor.home.pos); key->actor.speedXZ = 6.0f; @@ -1393,7 +1391,7 @@ void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) { } } EnGeldB_SetupDefeated(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { EnGeldB_SetupDamaged(this); } @@ -1402,35 +1400,35 @@ void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) { } } -void EnGeldB_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGeldB_Update(Actor* thisx, PlayState* play) { s32 pad; EnGeldB* this = (EnGeldB*)thisx; - EnGeldB_CollisionCheck(this, globalCtx); + EnGeldB_CollisionCheck(this, play); if (this->actor.colChkInfo.damageEffect != GELDB_DMG_UNK_6) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 60.0f, + 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, globalCtx); + this->actionFunc(this, play); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 40.0f; - EnGeldB_TurnHead(this, globalCtx); + EnGeldB_TurnHead(this, play); } Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if ((this->action >= GELDB_READY) && (this->spinAttackState < 2) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if ((this->action == GELDB_BLOCK) && (this->skelAnime.curFrame == 0.0f)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->blockCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->blockCollider.base); } if (this->swordState > 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->swordCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->swordCollider.base); } if (this->blinkState == 0) { - if ((Rand_ZeroOne() < 0.1f) && ((globalCtx->gameplayFrames % 4) == 0)) { + if ((Rand_ZeroOne() < 0.1f) && ((play->gameplayFrames % 4) == 0)) { this->blinkState++; } } else { @@ -1438,11 +1436,10 @@ void EnGeldB_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnGeldB_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnGeldB_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGeldB* this = (EnGeldB*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_geldB.c", 2507); + OPEN_DISPS(play->state.gfxCtx, "../z_en_geldB.c", 2507); if (limbIndex == GELDB_LIMB_NECK) { rot->z += this->headRot.x; rot->x += this->headRot.y; @@ -1458,11 +1455,11 @@ s32 EnGeldB_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 140, 0, 0, 255); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_geldB.c", 2529); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_geldB.c", 2529); return false; } -void EnGeldB_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnGeldB_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f footOffset = { 300.0f, 0.0f, 0.0f }; static Vec3f swordTipOffset = { 0.0f, -3000.0f, 0.0f }; static Vec3f swordHiltOffset = { 400.0f, 0.0f, 0.0f }; @@ -1547,7 +1544,7 @@ void EnGeldB_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGeldB_Draw(Actor* thisx, PlayState* play) { static Vec3f blockTrisOffsets0[3] = { { -3000.0f, 6000.0f, 1600.0f }, { -3000.0f, 0.0f, 1600.0f }, @@ -1563,7 +1560,7 @@ void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnGeldB* this = (EnGeldB*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_geldB.c", 2672); + OPEN_DISPS(play->state.gfxCtx, "../z_en_geldB.c", 2672); if (1) {} if ((this->spinAttackState >= 2) && SkelAnime_Update(&this->skelAnime)) { @@ -1576,23 +1573,23 @@ void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) { this->timer--; if (this->timer == 0) { if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { - globalCtx->nextEntranceIndex = ENTR_SPOT09_1; + play->nextEntranceIndex = ENTR_SPOT09_1; } else if (GET_EVENTCHKINF(EVENTCHKINF_C7)) { - globalCtx->nextEntranceIndex = ENTR_SPOT12_18; + play->nextEntranceIndex = ENTR_SPOT12_18; } else { - globalCtx->nextEntranceIndex = ENTR_SPOT12_17; + play->nextEntranceIndex = ENTR_SPOT12_17; } - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); + play->transitionTrigger = TRANS_TRIGGER_START; } } } if ((this->action != GELDB_WAIT) || !this->invisible) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->blinkState])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnGeldB_OverrideLimbDraw, EnGeldB_PostLimbDraw, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGeldB_OverrideLimbDraw, EnGeldB_PostLimbDraw, this); if (this->action == GELDB_BLOCK) { s32 i; Vec3f blockTrisVtx0[3]; @@ -1612,16 +1609,16 @@ void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->iceTimer % 4) == 0) { s32 iceIndex = this->iceTimer >> 2; - EffectSsEnIce_SpawnFlyingVec3s(globalCtx, thisx, &this->bodyPartsPos[iceIndex], 150, 150, 150, 250, 235, - 245, 255, 1.5f); + EffectSsEnIce_SpawnFlyingVec3s(play, thisx, &this->bodyPartsPos[iceIndex], 150, 150, 150, 250, 235, 245, + 255, 1.5f); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_geldB.c", 2744); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_geldB.c", 2744); } -s32 EnGeldB_DodgeRanged(GlobalContext* globalCtx, EnGeldB* this) { - Actor* actor = Actor_GetProjectileActor(globalCtx, &this->actor, 800.0f); +s32 EnGeldB_DodgeRanged(PlayState* play, EnGeldB* this) { + Actor* actor = Actor_GetProjectileActor(play, &this->actor, 800.0f); if (actor != NULL) { s16 angleToFacing; @@ -1642,7 +1639,7 @@ s32 EnGeldB_DodgeRanged(GlobalContext* globalCtx, EnGeldB* this) { } else { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; if ((ABS(angleToFacing) < 0x2000) || (ABS(angleToFacing) > 0x5FFF)) { - EnGeldB_SetupSidestep(this, globalCtx); + EnGeldB_SetupSidestep(this, play); this->actor.speedXZ *= 3.0f; } else if (ABS(angleToFacing) < 0x5FFF) { EnGeldB_SetupRollBack(this); 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 b4c3c3e846..149f8ac0aa 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h @@ -34,7 +34,7 @@ typedef enum { /* 0x18 */ GELDB_LIMB_MAX } EnGeldBLimb; -typedef void (*EnGeldBActionFunc)(struct EnGeldB*, GlobalContext*); +typedef void (*EnGeldBActionFunc)(struct EnGeldB*, PlayState*); typedef struct EnGeldB { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 911195474f..fc08569055 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -9,63 +9,63 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnGirlA_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGirlA_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGirlA_Update(Actor* thisx, GlobalContext* globalCtx); +void EnGirlA_Init(Actor* thisx, PlayState* play); +void EnGirlA_Destroy(Actor* thisx, PlayState* play); +void EnGirlA_Update(Actor* thisx, PlayState* play); -void EnGirlA_SetItemOutOfStock(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_UpdateStockedItem(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx); -void EnGirlA_Update2(EnGirlA* this, GlobalContext* globalCtx); -void func_80A3C498(Actor* thisx, GlobalContext* globalCtx, s32 flags); -void EnGirlA_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGirlA_SetItemOutOfStock(PlayState* play, EnGirlA* this); +void EnGirlA_UpdateStockedItem(PlayState* play, EnGirlA* this); +void EnGirlA_InitializeItemAction(EnGirlA* this, PlayState* play); +void EnGirlA_Update2(EnGirlA* this, PlayState* play); +void func_80A3C498(Actor* thisx, PlayState* play, s32 flags); +void EnGirlA_Draw(Actor* thisx, PlayState* play); -s32 EnGirlA_CanBuy_Arrows(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Bombs(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_DekuNuts(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_DekuSticks(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Fish(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_RedPotion(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_GreenPotion(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_BluePotion(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Longsword(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_HylianShield(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_DekuShield(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_GoronTunic(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Health(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_MilkBottle(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_WeirdEgg(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Unk19(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Unk20(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Bombchus(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_DekuSeeds(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_SoldOut(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_BlueFire(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Bugs(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Poe(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuy_Fairy(GlobalContext* globalCtx, EnGirlA* this); +s32 EnGirlA_CanBuy_Arrows(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Bombs(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_DekuNuts(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_DekuSticks(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Fish(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_RedPotion(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_GreenPotion(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_BluePotion(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Longsword(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_HylianShield(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_DekuShield(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_GoronTunic(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_ZoraTunic(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Health(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_MilkBottle(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_WeirdEgg(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Unk19(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Unk20(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Bombchus(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_DekuSeeds(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_SoldOut(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_BlueFire(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Bugs(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Poe(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuy_Fairy(PlayState* play, EnGirlA* this); -void EnGirlA_ItemGive_DekuNuts(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Arrows(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Bombs(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_DekuSticks(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_BottledItem(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Longsword(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_HylianShield(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_DekuShield(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_GoronTunic(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Health(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_MilkBottle(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_WeirdEgg(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Unk19(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_Unk20(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_ItemGive_DekuSeeds(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyEvent_ShieldDiscount(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyEvent_ObtainBombchuPack(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyEvent_GoronTunic(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyEvent_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this); +void EnGirlA_ItemGive_DekuNuts(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Arrows(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Bombs(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_DekuSticks(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_BottledItem(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Longsword(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_HylianShield(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_DekuShield(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_GoronTunic(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_ZoraTunic(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Health(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_MilkBottle(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_WeirdEgg(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Unk19(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_Unk20(PlayState* play, EnGirlA* this); +void EnGirlA_ItemGive_DekuSeeds(PlayState* play, EnGirlA* this); +void EnGirlA_BuyEvent_ShieldDiscount(PlayState* play, EnGirlA* this); +void EnGirlA_BuyEvent_ObtainBombchuPack(PlayState* play, EnGirlA* this); +void EnGirlA_BuyEvent_GoronTunic(PlayState* play, EnGirlA* this); +void EnGirlA_BuyEvent_ZoraTunic(PlayState* play, EnGirlA* this); const ActorInit En_GirlA_InitVars = { ACTOR_EN_GIRLA, @@ -142,15 +142,15 @@ static u16 sMaskShopFreeToBorrowTextIds[5] = { 0x70B6, 0x70B5, 0x70B4, 0x70B7, 0 typedef struct { /* 0x00 */ s16 objID; /* 0x02 */ s16 giDrawId; - /* 0x04 */ void (*hiliteFunc)(Actor*, GlobalContext*, s32); + /* 0x04 */ void (*hiliteFunc)(Actor*, PlayState*, s32); /* 0x08 */ s16 price; /* 0x0A */ s16 count; /* 0x0C */ u16 itemDescTextId; /* 0x0C */ u16 itemBuyPromptTextId; /* 0x10 */ s32 getItemId; - /* 0x14 */ s32 (*canBuyFunc)(GlobalContext*, EnGirlA*); - /* 0x18 */ void (*itemGiveFunc)(GlobalContext*, EnGirlA*); - /* 0x1C */ void (*buyEventFunc)(GlobalContext*, EnGirlA*); + /* 0x14 */ s32 (*canBuyFunc)(PlayState*, EnGirlA*); + /* 0x18 */ void (*itemGiveFunc)(PlayState*, EnGirlA*); + /* 0x1C */ void (*buyEventFunc)(PlayState*, EnGirlA*); } ShopItemEntry; // size = 0x20 static ShopItemEntry shopItemEntries[] = { @@ -373,7 +373,7 @@ s32 EnGirlA_TryChangeShopItem(EnGirlA* this) { return false; } -void EnGirlA_InitItem(EnGirlA* this, GlobalContext* globalCtx) { +void EnGirlA_InitItem(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; osSyncPrintf("%s(%2d)初期設定\n", sShopItemDescriptions[params], params); @@ -387,7 +387,7 @@ void EnGirlA_InitItem(EnGirlA* this, GlobalContext* globalCtx) { return; } - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, shopItemEntries[params].objID); + this->objBankIndex = Object_GetIndex(&play->objectCtx, shopItemEntries[params].objID); if (this->objBankIndex < 0) { Actor_Kill(&this->actor); @@ -402,23 +402,23 @@ void EnGirlA_InitItem(EnGirlA* this, GlobalContext* globalCtx) { this->actionFunc2 = EnGirlA_InitializeItemAction; } -void EnGirlA_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Init(Actor* thisx, PlayState* play) { EnGirlA* this = (EnGirlA*)thisx; EnGirlA_TryChangeShopItem(this); - EnGirlA_InitItem(this, globalCtx); + EnGirlA_InitItem(this, play); osSyncPrintf("%s(%2d)初期設定\n", sShopItemDescriptions[this->actor.params], this->actor.params); } -void EnGirlA_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Destroy(Actor* thisx, PlayState* play) { EnGirlA* this = (EnGirlA*)thisx; if (this->isInitialized) { - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } } -s32 EnGirlA_CanBuy_Arrows(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Arrows(PlayState* play, EnGirlA* this) { if (Item_CheckObtainability(ITEM_BOW) == ITEM_NONE) { return CANBUY_RESULT_CANT_GET_NOW_5; } @@ -431,7 +431,7 @@ s32 EnGirlA_CanBuy_Arrows(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Bombs(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Bombs(PlayState* play, EnGirlA* this) { if (!CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -444,7 +444,7 @@ s32 EnGirlA_CanBuy_Bombs(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_DekuNuts(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_DekuNuts(PlayState* play, EnGirlA* this) { if ((CUR_CAPACITY(UPG_NUTS) != 0) && (AMMO(ITEM_NUT) >= CUR_CAPACITY(UPG_NUTS))) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -457,7 +457,7 @@ s32 EnGirlA_CanBuy_DekuNuts(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_DekuSticks(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_DekuSticks(PlayState* play, EnGirlA* this) { if ((CUR_CAPACITY(UPG_STICKS) != 0) && (AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS))) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -470,7 +470,7 @@ s32 EnGirlA_CanBuy_DekuSticks(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Fish(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Fish(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -483,7 +483,7 @@ s32 EnGirlA_CanBuy_Fish(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_RedPotion(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_RedPotion(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -496,7 +496,7 @@ s32 EnGirlA_CanBuy_RedPotion(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_GreenPotion(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_GreenPotion(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -509,7 +509,7 @@ s32 EnGirlA_CanBuy_GreenPotion(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_BluePotion(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_BluePotion(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -522,7 +522,7 @@ s32 EnGirlA_CanBuy_BluePotion(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Longsword(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Longsword(PlayState* play, EnGirlA* this) { if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BGS) && !CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE)) { return CANBUY_RESULT_CANT_GET_NOW; @@ -536,7 +536,7 @@ s32 EnGirlA_CanBuy_Longsword(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_HylianShield(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_HylianShield(PlayState* play, EnGirlA* this) { if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, EQUIP_INV_SHIELD_HYLIAN)) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -549,7 +549,7 @@ s32 EnGirlA_CanBuy_HylianShield(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_DekuShield(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_DekuShield(PlayState* play, EnGirlA* this) { if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, EQUIP_INV_SHIELD_DEKU)) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -562,7 +562,7 @@ s32 EnGirlA_CanBuy_DekuShield(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_GoronTunic(PlayState* play, EnGirlA* this) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -578,7 +578,7 @@ s32 EnGirlA_CanBuy_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_ZoraTunic(PlayState* play, EnGirlA* this) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -594,7 +594,7 @@ s32 EnGirlA_CanBuy_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Health(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Health(PlayState* play, EnGirlA* this) { if (gSaveContext.healthCapacity == gSaveContext.health) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -604,7 +604,7 @@ s32 EnGirlA_CanBuy_Health(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_MilkBottle(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_MilkBottle(PlayState* play, EnGirlA* this) { if (gSaveContext.rupees < this->basePrice) { return CANBUY_RESULT_NEED_RUPEES; } @@ -614,7 +614,7 @@ s32 EnGirlA_CanBuy_MilkBottle(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_WeirdEgg(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_WeirdEgg(PlayState* play, EnGirlA* this) { if (gSaveContext.rupees < this->basePrice) { return CANBUY_RESULT_NEED_RUPEES; } @@ -624,15 +624,15 @@ s32 EnGirlA_CanBuy_WeirdEgg(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Unk19(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Unk19(PlayState* play, EnGirlA* this) { return CANBUY_RESULT_NEED_RUPEES; } -s32 EnGirlA_CanBuy_Unk20(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Unk20(PlayState* play, EnGirlA* this) { return CANBUY_RESULT_NEED_RUPEES; } -s32 EnGirlA_CanBuy_Bombchus(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Bombchus(PlayState* play, EnGirlA* this) { if (AMMO(ITEM_BOMBCHU) >= 50) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -645,7 +645,7 @@ s32 EnGirlA_CanBuy_Bombchus(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_DekuSeeds(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_DekuSeeds(PlayState* play, EnGirlA* this) { if (AMMO(ITEM_SLINGSHOT) >= CUR_CAPACITY(UPG_BULLET_BAG)) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -658,11 +658,11 @@ s32 EnGirlA_CanBuy_DekuSeeds(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_SoldOut(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_SoldOut(PlayState* play, EnGirlA* this) { return CANBUY_RESULT_CANT_GET_NOW_5; } -s32 EnGirlA_CanBuy_BlueFire(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_BlueFire(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -675,7 +675,7 @@ s32 EnGirlA_CanBuy_BlueFire(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Bugs(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Bugs(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -688,7 +688,7 @@ s32 EnGirlA_CanBuy_Bugs(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Poe(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Poe(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -701,7 +701,7 @@ s32 EnGirlA_CanBuy_Poe(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -s32 EnGirlA_CanBuy_Fairy(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuy_Fairy(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_BOTTLE; } @@ -714,134 +714,134 @@ s32 EnGirlA_CanBuy_Fairy(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS; } -void EnGirlA_ItemGive_Arrows(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_Arrows(PlayState* play, EnGirlA* this) { Inventory_ChangeAmmo(ITEM_BOW, this->itemCount); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_Bombs(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_Bombs(PlayState* play, EnGirlA* this) { switch (this->itemCount) { case 5: - Item_Give(globalCtx, ITEM_BOMBS_5); + Item_Give(play, ITEM_BOMBS_5); break; case 10: - Item_Give(globalCtx, ITEM_BOMBS_10); + Item_Give(play, ITEM_BOMBS_10); break; case 20: - Item_Give(globalCtx, ITEM_BOMBS_20); + Item_Give(play, ITEM_BOMBS_20); break; case 30: - Item_Give(globalCtx, ITEM_BOMBS_30); + Item_Give(play, ITEM_BOMBS_30); break; } Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_DekuNuts(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_DekuNuts(PlayState* play, EnGirlA* this) { switch (this->itemCount) { case 5: - Item_Give(globalCtx, ITEM_NUTS_5); + Item_Give(play, ITEM_NUTS_5); break; case 10: - Item_Give(globalCtx, ITEM_NUTS_10); + Item_Give(play, ITEM_NUTS_10); break; } Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_DekuSticks(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_STICK); +void EnGirlA_ItemGive_DekuSticks(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_STICK); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_Longsword(GlobalContext* globalCtx, EnGirlA* this) { - func_800849EC(globalCtx); +void EnGirlA_ItemGive_Longsword(PlayState* play, EnGirlA* this) { + func_800849EC(play); gSaveContext.swordHealth = 8; Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_HylianShield(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_SHIELD_HYLIAN); +void EnGirlA_ItemGive_HylianShield(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_SHIELD_HYLIAN); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_DekuShield(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_SHIELD_DEKU); +void EnGirlA_ItemGive_DekuShield(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_SHIELD_DEKU); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_TUNIC_GORON); +void EnGirlA_ItemGive_GoronTunic(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_TUNIC_GORON); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_TUNIC_ZORA); +void EnGirlA_ItemGive_ZoraTunic(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_TUNIC_ZORA); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_Health(GlobalContext* globalCtx, EnGirlA* this) { - Health_ChangeBy(globalCtx, this->itemCount); +void EnGirlA_ItemGive_Health(PlayState* play, EnGirlA* this) { + Health_ChangeBy(play, this->itemCount); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_MilkBottle(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_MILK_BOTTLE); +void EnGirlA_ItemGive_MilkBottle(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_MILK_BOTTLE); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_WeirdEgg(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_WEIRD_EGG); +void EnGirlA_ItemGive_WeirdEgg(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_WEIRD_EGG); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_Unk19(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_Unk19(PlayState* play, EnGirlA* this) { Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_Unk20(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_Unk20(PlayState* play, EnGirlA* this) { Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_DekuSeeds(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_SEEDS_30); +void EnGirlA_ItemGive_DekuSeeds(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_SEEDS_30); Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_ItemGive_BottledItem(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_ItemGive_BottledItem(PlayState* play, EnGirlA* this) { switch (this->actor.params) { case SI_FISH: - Item_Give(globalCtx, ITEM_FISH); + Item_Give(play, ITEM_FISH); break; case SI_RED_POTION_R30: - Item_Give(globalCtx, ITEM_POTION_RED); + Item_Give(play, ITEM_POTION_RED); break; case SI_GREEN_POTION: - Item_Give(globalCtx, ITEM_POTION_GREEN); + Item_Give(play, ITEM_POTION_GREEN); break; case SI_BLUE_POTION: - Item_Give(globalCtx, ITEM_POTION_BLUE); + Item_Give(play, ITEM_POTION_BLUE); break; case SI_BLUE_FIRE: - Item_Give(globalCtx, ITEM_BLUE_FIRE); + Item_Give(play, ITEM_BLUE_FIRE); break; case SI_BUGS: - Item_Give(globalCtx, ITEM_BUG); + Item_Give(play, ITEM_BUG); break; case SI_BIG_POE: - Item_Give(globalCtx, ITEM_BIG_POE); + Item_Give(play, ITEM_BIG_POE); break; case SI_POE: - Item_Give(globalCtx, ITEM_POE); + Item_Give(play, ITEM_POE); break; case SI_FAIRY: - Item_Give(globalCtx, ITEM_FAIRY); + Item_Give(play, ITEM_FAIRY); break; } Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_BuyEvent_ShieldDiscount(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyEvent_ShieldDiscount(PlayState* play, EnGirlA* this) { if (this->actor.params == SI_HYLIAN_SHIELD) { if (GET_INFTABLE(INFTABLE_76)) { Rupees_ChangeBy(-(this->basePrice - sShieldDiscounts[(s32)Rand_ZeroFloat(7.9f)])); @@ -851,15 +851,15 @@ void EnGirlA_BuyEvent_ShieldDiscount(GlobalContext* globalCtx, EnGirlA* this) { Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_BuyEvent_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyEvent_GoronTunic(PlayState* play, EnGirlA* this) { Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_BuyEvent_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyEvent_ZoraTunic(PlayState* play, EnGirlA* this) { Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_BuyEvent_ObtainBombchuPack(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyEvent_ObtainBombchuPack(PlayState* play, EnGirlA* this) { switch (this->actor.params) { case SI_BOMBCHU_10_2: SET_ITEMGETINF(ITEMGETINF_06); @@ -889,10 +889,10 @@ void EnGirlA_BuyEvent_ObtainBombchuPack(GlobalContext* globalCtx, EnGirlA* this) Rupees_ChangeBy(-this->basePrice); } -void EnGirlA_Noop(EnGirlA* this, GlobalContext* globalCtx) { +void EnGirlA_Noop(EnGirlA* this, PlayState* play) { } -void EnGirlA_SetItemDescription(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_SetItemDescription(PlayState* play, EnGirlA* this) { ShopItemEntry* tmp = &shopItemEntries[this->actor.params]; s32 params = this->actor.params; s32 maskId; @@ -940,7 +940,7 @@ void EnGirlA_SetItemDescription(GlobalContext* globalCtx, EnGirlA* this) { this->actor.draw = EnGirlA_Draw; } -void EnGirlA_SetItemOutOfStock(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_SetItemOutOfStock(PlayState* play, EnGirlA* this) { this->isInvisible = true; this->actor.draw = NULL; if ((this->actor.params >= SI_KEATON_MASK) && (this->actor.params <= SI_GERUDO_MASK)) { @@ -948,11 +948,11 @@ void EnGirlA_SetItemOutOfStock(GlobalContext* globalCtx, EnGirlA* this) { } } -void EnGirlA_UpdateStockedItem(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_UpdateStockedItem(PlayState* play, EnGirlA* this) { ShopItemEntry* itemEntry; if (EnGirlA_TryChangeShopItem(this)) { - EnGirlA_InitItem(this, globalCtx); + EnGirlA_InitItem(this, play); itemEntry = &shopItemEntries[this->actor.params]; this->actor.textId = itemEntry->itemDescTextId; } else { @@ -961,26 +961,26 @@ void EnGirlA_UpdateStockedItem(GlobalContext* globalCtx, EnGirlA* this) { } } -s32 EnGirlA_TrySetMaskItemDescription(EnGirlA* this, GlobalContext* globalCtx) { +s32 EnGirlA_TrySetMaskItemDescription(EnGirlA* this, PlayState* play) { s32 params; if ((this->actor.params >= SI_KEATON_MASK) && (this->actor.params <= SI_GERUDO_MASK)) { params = this->actor.params - SI_KEATON_MASK; if (INV_CONTENT(ITEM_TRADE_CHILD) == sMaskShopItems[params]) { - EnGirlA_SetItemOutOfStock(globalCtx, this); + EnGirlA_SetItemOutOfStock(play, this); } else { - EnGirlA_SetItemDescription(globalCtx, this); + EnGirlA_SetItemDescription(play, this); } return true; } return false; } -void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx) { +void EnGirlA_InitializeItemAction(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; ShopItemEntry* itemEntry = &shopItemEntries[params]; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.objBankIndex = this->objBankIndex; switch (this->actor.params) { @@ -1042,8 +1042,8 @@ void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx) { this->itemBuyPromptTextId = itemEntry->itemBuyPromptTextId; break; } - if (!EnGirlA_TrySetMaskItemDescription(this, globalCtx)) { - EnGirlA_SetItemDescription(globalCtx, this); + if (!EnGirlA_TrySetMaskItemDescription(this, play)) { + EnGirlA_SetItemDescription(play, this); } this->setOutOfStockFunc = EnGirlA_SetItemOutOfStock; @@ -1072,12 +1072,12 @@ void EnGirlA_InitializeItemAction(EnGirlA* this, GlobalContext* globalCtx) { } } -void EnGirlA_Update2(EnGirlA* this, GlobalContext* globalCtx) { +void EnGirlA_Update2(EnGirlA* this, PlayState* play) { Actor_SetScale(&this->actor, 0.25f); this->actor.shape.yOffset = 24.0f; this->actor.shape.shadowScale = 4.0f; - EnGirlA_TrySetMaskItemDescription(this, globalCtx); - this->actionFunc(this, globalCtx); + EnGirlA_TrySetMaskItemDescription(this, play); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 5.0f); this->actor.shape.rot.x = 0.0f; if (this->actor.params != SI_SOLD_OUT) { @@ -1089,23 +1089,23 @@ void EnGirlA_Update2(EnGirlA* this, GlobalContext* globalCtx) { } } -void EnGirlA_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Update(Actor* thisx, PlayState* play) { EnGirlA* this = (EnGirlA*)thisx; - this->actionFunc2(this, globalCtx); + this->actionFunc2(this, play); } -void func_80A3C498(Actor* thisx, GlobalContext* globalCtx, s32 flags) { - func_8002EBCC(thisx, globalCtx, 0); - func_8002ED80(thisx, globalCtx, 0); +void func_80A3C498(Actor* thisx, PlayState* play, s32 flags) { + func_8002EBCC(thisx, play, 0); + func_8002ED80(thisx, play, 0); } -void EnGirlA_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Draw(Actor* thisx, PlayState* play) { EnGirlA* this = (EnGirlA*)thisx; Matrix_RotateY(DEG_TO_RAD((this->yRotation * 360.0f) / 65536.0f), MTXMODE_APPLY); if (this->hiliteFunc != NULL) { - this->hiliteFunc(thisx, globalCtx, 0); + this->hiliteFunc(thisx, play, 0); } - GetItem_Draw(globalCtx, this->giDrawId); + GetItem_Draw(play, this->giDrawId); } diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.h b/src/overlays/actors/ovl_En_GirlA/z_en_girla.h index 1fdc18929c..e829696544 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.h +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.h @@ -6,10 +6,10 @@ struct EnGirlA; -typedef void (*EnGirlAActionFunc)(struct EnGirlA*, GlobalContext*); -typedef void (*EnGirlA2Func)(GlobalContext*, struct EnGirlA*); -typedef void (*EnGirlA3Func)(Actor*, GlobalContext*, s32); -typedef s32 (*EnGirlA4Func)(GlobalContext*, struct EnGirlA*); +typedef void (*EnGirlAActionFunc)(struct EnGirlA*, PlayState*); +typedef void (*EnGirlA2Func)(PlayState*, struct EnGirlA*); +typedef void (*EnGirlA3Func)(Actor*, PlayState*, s32); +typedef s32 (*EnGirlA4Func)(PlayState*, struct EnGirlA*); typedef struct EnGirlA { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 832f19779c..6984f98cf8 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -11,20 +11,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnGm_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGm_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGm_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGm_Init(Actor* thisx, PlayState* play); +void EnGm_Destroy(Actor* thisx, PlayState* play); +void EnGm_Update(Actor* thisx, PlayState* play); +void EnGm_Draw(Actor* thisx, PlayState* play); -void func_80A3D838(EnGm* this, GlobalContext* globalCtx); -void func_80A3DFBC(EnGm* this, GlobalContext* globalCtx); -void func_80A3DB04(EnGm* this, GlobalContext* globalCtx); -void func_80A3DC44(EnGm* this, GlobalContext* globalCtx); -void func_80A3DBF4(EnGm* this, GlobalContext* globalCtx); -void func_80A3DD7C(EnGm* this, GlobalContext* globalCtx); -void EnGm_ProcessChoiceIndex(EnGm* this, GlobalContext* globalCtx); -void func_80A3DF00(EnGm* this, GlobalContext* globalCtx); -void func_80A3DF60(EnGm* this, GlobalContext* globalCtx); +void func_80A3D838(EnGm* this, PlayState* play); +void func_80A3DFBC(EnGm* this, PlayState* play); +void func_80A3DB04(EnGm* this, PlayState* play); +void func_80A3DC44(EnGm* this, PlayState* play); +void func_80A3DBF4(EnGm* this, PlayState* play); +void func_80A3DD7C(EnGm* this, PlayState* play); +void EnGm_ProcessChoiceIndex(EnGm* this, PlayState* play); +void func_80A3DF00(EnGm* this, PlayState* play); +void func_80A3DF60(EnGm* this, PlayState* play); const ActorInit En_Gm_InitVars = { ACTOR_EN_GM, @@ -62,7 +62,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void EnGm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Init(Actor* thisx, PlayState* play) { EnGm* this = (EnGm*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -70,7 +70,7 @@ void EnGm_Init(Actor* thisx, GlobalContext* globalCtx) { // "Medi Goron" osSyncPrintf(VT_FGCOL(GREEN) "%s[%d] : 中ゴロン[%d]" VT_RST "\n", "../z_en_gm.c", 133, this->actor.params); - this->objGmBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GM); + this->objGmBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GM); if (this->objGmBankIndex < 0) { osSyncPrintf(VT_COL(RED, WHITE)); @@ -83,10 +83,10 @@ void EnGm_Init(Actor* thisx, GlobalContext* globalCtx) { this->updateFunc = func_80A3D838; } -void EnGm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Destroy(Actor* thisx, PlayState* play) { EnGm* this = (EnGm*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 func_80A3D7C8(void) { @@ -101,16 +101,16 @@ s32 func_80A3D7C8(void) { } } -void func_80A3D838(EnGm* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objGmBankIndex)) { +void func_80A3D838(EnGm* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objGmBankIndex)) { this->actor.flags &= ~ACTOR_FLAG_4; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objGmBankIndex].segment); + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objGmBankIndex].segment); Animation_Change(&this->skelAnime, &object_gm_Anim_0002B8, 1.0f, 0.0f, Animation_GetLastFrame(&object_gm_Anim_0002B8), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnGm_Draw; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); Actor_SetScale(&this->actor, 0.05f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -163,43 +163,43 @@ void EnGm_SetTextID(EnGm* this) { } } -void func_80A3DB04(EnGm* this, GlobalContext* globalCtx) { +void func_80A3DB04(EnGm* this, PlayState* play) { f32 dx; f32 dz; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); dx = this->talkPos.x - player->actor.world.pos.x; dz = this->talkPos.z - player->actor.world.pos.z; - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { EnGm_SetTextID(this); this->actionFunc = func_80A3DC44; - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80A3DBF4; } else if ((this->collider.base.ocFlags1 & OC1_HIT) || (SQ(dx) + SQ(dz)) < SQ(100.0f)) { this->collider.base.acFlags &= ~AC_HIT; - func_8002F2CC(&this->actor, globalCtx, 415.0f); + func_8002F2CC(&this->actor, play, 415.0f); } } -void func_80A3DBF4(EnGm* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_80A3DBF4(EnGm* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->actionFunc = func_80A3DB04; } } -void func_80A3DC44(EnGm* this, GlobalContext* globalCtx) { +void func_80A3DC44(EnGm* this, PlayState* play) { f32 dx; f32 dz; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnGm_SetTextID(this); dx = this->talkPos.x - player->actor.world.pos.x; dz = this->talkPos.z - player->actor.world.pos.z; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { switch (func_80A3D7C8()) { case 0: SET_INFTABLE(INFTABLE_B0); @@ -218,74 +218,74 @@ void func_80A3DC44(EnGm* this, GlobalContext* globalCtx) { } if ((this->collider.base.ocFlags1 & OC1_HIT) || (SQ(dx) + SQ(dz)) < SQ(100.0f)) { this->collider.base.acFlags &= ~AC_HIT; - func_8002F2CC(&this->actor, globalCtx, 415.0f); + func_8002F2CC(&this->actor, play, 415.0f); } } -void func_80A3DD7C(EnGm* this, GlobalContext* globalCtx) { - u8 dialogState = Message_GetState(&globalCtx->msgCtx); +void func_80A3DD7C(EnGm* this, PlayState* play) { + u8 dialogState = Message_GetState(&play->msgCtx); - if ((dialogState == TEXT_STATE_DONE || dialogState == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((dialogState == TEXT_STATE_DONE || dialogState == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actionFunc = func_80A3DC44; if (dialogState == TEXT_STATE_EVENT) { - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; - globalCtx->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; } } } -void EnGm_ProcessChoiceIndex(EnGm* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void EnGm_ProcessChoiceIndex(EnGm* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes if (gSaveContext.rupees < 200) { - Message_ContinueTextbox(globalCtx, 0xC8); + Message_ContinueTextbox(play, 0xC8); this->actionFunc = func_80A3DD7C; } else { - func_8002F434(&this->actor, globalCtx, GI_SWORD_KNIFE, 415.0f, 10.0f); + func_8002F434(&this->actor, play, GI_SWORD_KNIFE, 415.0f, 10.0f); this->actionFunc = func_80A3DF00; } break; case 1: // no - Message_ContinueTextbox(globalCtx, 0x3050); + Message_ContinueTextbox(play, 0x3050); this->actionFunc = func_80A3DD7C; break; } } } -void func_80A3DF00(EnGm* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A3DF00(EnGm* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80A3DF60; } else { - func_8002F434(&this->actor, globalCtx, GI_SWORD_KNIFE, 415.0f, 10.0f); + func_8002F434(&this->actor, play, GI_SWORD_KNIFE, 415.0f, 10.0f); } } -void func_80A3DF60(EnGm* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_80A3DF60(EnGm* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { Rupees_ChangeBy(-200); this->actionFunc = func_80A3DC44; } } -void func_80A3DFBC(EnGm* this, GlobalContext* globalCtx) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objGmBankIndex].segment); +void func_80A3DFBC(EnGm* this, PlayState* play) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objGmBankIndex].segment); this->timer++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.focus.rot.x = this->actor.world.rot.x; this->actor.focus.rot.y = this->actor.world.rot.y; this->actor.focus.rot.z = this->actor.world.rot.z; EnGm_UpdateEye(this); SkelAnime_Update(&this->skelAnime); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnGm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Update(Actor* thisx, PlayState* play) { EnGm* this = (EnGm*)thisx; - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); } void func_80A3E090(EnGm* this) { @@ -314,20 +314,20 @@ void func_80A3E090(EnGm* this) { this->actor.focus.pos.y += 100.0f; } -void EnGm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gGoronCsEyeOpenTex, gGoronCsEyeHalfTex, gGoronCsEyeClosedTex }; EnGm* this = (EnGm*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_gm.c", 613); + OPEN_DISPS(play->state.gfxCtx, "../z_en_gm.c", 613); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGoronCsMouthNeutralTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_gm.c", 629); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_gm.c", 629); func_80A3E090(this); } diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.h b/src/overlays/actors/ovl_En_Gm/z_en_gm.h index 94e454e4f0..fd699d518d 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.h +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.h @@ -6,8 +6,8 @@ struct EnGm; -typedef void (*EnGmUpdateFunc)(struct EnGm*, GlobalContext*); -typedef void (*EnGmActionFunc)(struct EnGm*, GlobalContext*); +typedef void (*EnGmUpdateFunc)(struct EnGm*, PlayState*); +typedef void (*EnGmActionFunc)(struct EnGm*, PlayState*); typedef struct EnGm { /* 0x0000 */ Actor actor; 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 94fa2dcce7..e75038932e 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -5,34 +5,34 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnGo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGo_Init(Actor* thisx, PlayState* play); +void EnGo_Destroy(Actor* thisx, PlayState* play); +void EnGo_Update(Actor* thisx, PlayState* play); +void EnGo_Draw(Actor* thisx, PlayState* play); -void func_80A3FEB4(EnGo* this, GlobalContext* globalCtx); -void EnGo_StopRolling(EnGo* this, GlobalContext* globalCtx); -void func_80A4008C(EnGo* this, GlobalContext* globalCtx); -void EnGo_GoronLinkRolling(EnGo* this, GlobalContext* globalCtx); -void EnGo_FireGenericActionFunc(EnGo* this, GlobalContext* globalCtx); -void EnGo_CurledUp(EnGo* this, GlobalContext* globalCtx); -void EnGo_WakeUp(EnGo* this, GlobalContext* globalCtx); +void func_80A3FEB4(EnGo* this, PlayState* play); +void EnGo_StopRolling(EnGo* this, PlayState* play); +void func_80A4008C(EnGo* this, PlayState* play); +void EnGo_GoronLinkRolling(EnGo* this, PlayState* play); +void EnGo_FireGenericActionFunc(EnGo* this, PlayState* play); +void EnGo_CurledUp(EnGo* this, PlayState* play); +void EnGo_WakeUp(EnGo* this, PlayState* play); -void func_80A40494(EnGo* this, GlobalContext* globalCtx); -void func_80A405CC(EnGo* this, GlobalContext* globalCtx); -void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx); -void func_80A408D8(EnGo* this, GlobalContext* globalCtx); +void func_80A40494(EnGo* this, PlayState* play); +void func_80A405CC(EnGo* this, PlayState* play); +void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play); +void func_80A408D8(EnGo* this, PlayState* play); -void func_80A40B1C(EnGo* this, GlobalContext* globalCtx); -void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx); -void func_80A40C78(EnGo* this, GlobalContext* globalCtx); -void EnGo_Eyedrops(EnGo* this, GlobalContext* globalCtx); -void func_80A40DCC(EnGo* this, GlobalContext* globalCtx); +void func_80A40B1C(EnGo* this, PlayState* play); +void EnGo_GetItem(EnGo* this, PlayState* play); +void func_80A40C78(EnGo* this, PlayState* play); +void EnGo_Eyedrops(EnGo* this, PlayState* play); +void func_80A40DCC(EnGo* this, PlayState* play); void EnGo_SpawnEffectDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale, f32 scaleStep); void EnGo_UpdateEffects(EnGo* this); -void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx); +void EnGo_DrawEffects(EnGo* this, PlayState* play); const ActorInit En_Go_InitVars = { ACTOR_EN_GO, @@ -88,8 +88,8 @@ void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { this->actionFunc = actionFunc; } -u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) { - Player* player = GET_PLAYER(globalCtx); +u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { + Player* player = GET_PLAYER(play); switch (thisx->params & 0xF0) { case 0x90: @@ -135,7 +135,7 @@ u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) { } } case 0x10: - if (Flags_GetSwitch(globalCtx, thisx->params >> 8)) { + if (Flags_GetSwitch(play, thisx->params >> 8)) { return 0x3052; } else { return 0x3051; @@ -195,14 +195,14 @@ u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) { } } -s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { +s16 EnGo_SetFlagsGetStates(PlayState* play, Actor* thisx) { s16 unkState = 1; f32 xzRange; f32 yRange = fabsf(thisx->yDistToPlayer) + 1.0f; xzRange = thisx->xzDistToPlayer + 1.0f; - switch (Message_GetState(&globalCtx->msgCtx)) { - if (globalCtx) {} + switch (Message_GetState(&play->msgCtx)) { + if (play) {} case TEXT_STATE_CLOSING: switch (thisx->textId) { case 0x3008: @@ -226,7 +226,7 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { unkState = 0; break; case 0x3036: - func_8002F434(thisx, globalCtx, GI_TUNIC_GORON, xzRange, yRange); + func_8002F434(thisx, play, GI_TUNIC_GORON, xzRange, yRange); SET_INFTABLE(INFTABLE_10D); // EnGo exclusive flag unkState = 2; break; @@ -256,10 +256,10 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { } break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (thisx->textId) { case 0x300A: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (CUR_UPG_VALUE(UPG_STRENGTH) != 0 || GET_INFTABLE(INFTABLE_EB)) { thisx->textId = 0x300B; } else { @@ -268,11 +268,11 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { } else { thisx->textId = 0x300D; } - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); unkState = 1; break; case 0x3034: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (GET_INFTABLE(INFTABLE_10B)) { thisx->textId = 0x3033; } else { @@ -283,16 +283,16 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { } else { thisx->textId = 0x3033; } - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); unkState = 1; break; case 0x3054: case 0x3055: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { unkState = 2; } else { thisx->textId = 0x3056; - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); unkState = 1; } SET_INFTABLE(INFTABLE_B4); @@ -301,14 +301,14 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (thisx->textId) { case 0x3035: SET_INFTABLE(INFTABLE_10B); case 0x3032: case 0x3033: thisx->textId = 0x3034; - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); unkState = 1; break; default: @@ -318,7 +318,7 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { } break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { unkState = 3; } break; @@ -332,18 +332,18 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { return unkState; } -s32 func_80A3ED24(GlobalContext* globalCtx, EnGo* this, struct_80034A14_arg1* arg2, f32 arg3, - u16 (*getTextId)(GlobalContext*, Actor*), s16 (*unkFunc2)(GlobalContext*, Actor*)) { +s32 func_80A3ED24(PlayState* play, EnGo* this, struct_80034A14_arg1* arg2, f32 arg3, + u16 (*getTextId)(PlayState*, Actor*), s16 (*unkFunc2)(PlayState*, Actor*)) { if (arg2->unk_00) { - arg2->unk_00 = unkFunc2(globalCtx, &this->actor); + arg2->unk_00 = unkFunc2(play, &this->actor); return false; - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { arg2->unk_00 = 1; return true; - } else if (!func_8002F2CC(&this->actor, globalCtx, arg3)) { + } else if (!func_8002F2CC(&this->actor, play, arg3)) { return false; } else { - this->actor.textId = getTextId(globalCtx, &this->actor); + this->actor.textId = getTextId(play, &this->actor); return false; } } @@ -355,19 +355,19 @@ void EnGo_ChangeAnim(EnGo* this, s32 index) { sAnimationInfo[index].morphFrames); } -s32 EnGo_IsActorSpawned(EnGo* this, GlobalContext* globalCtx) { +s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) { if (((this->actor.params) & 0xF0) == 0x90) { return true; - } else if (globalCtx->sceneNum == SCENE_HIDAN && !Flags_GetSwitch(globalCtx, (this->actor.params) >> 8) && - LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x10) { + } else if (play->sceneNum == SCENE_HIDAN && !Flags_GetSwitch(play, (this->actor.params) >> 8) && LINK_IS_ADULT && + (this->actor.params & 0xF0) == 0x10) { return true; - } else if (globalCtx->sceneNum == SCENE_SPOT18 && LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x00) { + } else if (play->sceneNum == SCENE_SPOT18 && LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x00) { return true; - } else if (globalCtx->sceneNum == SCENE_SPOT16 && LINK_IS_CHILD && + } else if (play->sceneNum == SCENE_SPOT16 && LINK_IS_CHILD && ((this->actor.params & 0xF0) == 0x20 || (this->actor.params & 0xF0) == 0x30 || (this->actor.params & 0xF0) == 0x40)) { return true; - } else if (globalCtx->sceneNum == SCENE_SPOT18 && LINK_IS_CHILD && + } else if (play->sceneNum == SCENE_SPOT18 && LINK_IS_CHILD && ((this->actor.params & 0xF0) == 0x50 || (this->actor.params & 0xF0) == 0x60 || (this->actor.params & 0xF0) == 0x70)) { return true; @@ -393,8 +393,8 @@ f32 EnGo_GetGoronSize(EnGo* this) { } } -void func_80A3F060(EnGo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A3F060(EnGo* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 unkVal; if (this->actionFunc != EnGo_BiggoronActionFunc && this->actionFunc != EnGo_FireGenericActionFunc && @@ -417,10 +417,10 @@ void func_80A3F0E4(EnGo* this) { } } -s32 EnGo_IsCameraModified(EnGo* this, GlobalContext* globalCtx) { +s32 EnGo_IsCameraModified(EnGo* this, PlayState* play) { f32 xyzDistSq; s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - Camera* mainCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; + Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; if (fabsf(yawDiff) > 10920.0f) { return 0; @@ -462,7 +462,7 @@ void EnGo_UpdateShadow(EnGo* this) { this->actor.shape.shadowAlpha = shadowAlpha; } -s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) { +s32 EnGo_FollowPath(EnGo* this, PlayState* play) { Path* path; Vec3s* pointPos; f32 xDist; @@ -472,7 +472,7 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) { return false; } - path = &globalCtx->setupPathList[this->actor.params & 0xF]; + path = &play->setupPathList[this->actor.params & 0xF]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->unk_218; xDist = pointPos->x - this->actor.world.pos.x; @@ -487,7 +487,7 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) { if ((this->actor.params & 0xF0) != 0x00) { return true; - } else if (Flags_GetSwitch(globalCtx, this->actor.params >> 8)) { + } else if (Flags_GetSwitch(play, this->actor.params >> 8)) { return true; } else if (this->unk_218 >= this->actor.shape.rot.z) { this->unk_218 = 0; @@ -499,14 +499,14 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) { return false; } -s32 EnGo_SetMovedPos(EnGo* this, GlobalContext* globalCtx) { +s32 EnGo_SetMovedPos(EnGo* this, PlayState* play) { Path* path; Vec3s* pointPos; if ((this->actor.params & 0xF) == 0xF) { return false; } else { - path = &globalCtx->setupPathList[this->actor.params & 0xF]; + path = &play->setupPathList[this->actor.params & 0xF]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += (path->count - 1); this->actor.world.pos.x = pointPos->x; @@ -568,8 +568,8 @@ s32 EnGo_IsRollingOnGround(EnGo* this, s16 unkArg1, f32 unkArg2) { } } -void func_80A3F908(EnGo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A3F908(EnGo* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 float1; s32 isUnkCondition; @@ -585,16 +585,15 @@ void func_80A3F908(EnGo* this, GlobalContext* globalCtx) { } if ((this->actor.params & 0xF0) == 0x90) { - isUnkCondition = - func_80A3ED24(globalCtx, this, &this->unk_1E0, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates); + isUnkCondition = func_80A3ED24(play, this, &this->unk_1E0, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates); } else { - isUnkCondition = func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, float1, EnGo_GetTextID, + isUnkCondition = func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates); } if (((this->actor.params & 0xF0) == 0x90) && (isUnkCondition == true)) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_SWORD_BROKEN) { - if (func_8002F368(globalCtx) == EXCH_ITEM_SWORD_BROKEN) { + if (func_8002F368(play) == EXCH_ITEM_SWORD_BROKEN) { if (GET_INFTABLE(INFTABLE_B4)) { this->actor.textId = 0x3055; } else { @@ -607,7 +606,7 @@ void func_80A3F908(EnGo* this, GlobalContext* globalCtx) { } if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYEDROPS) { - if (func_8002F368(globalCtx) == EXCH_ITEM_EYEDROPS) { + if (func_8002F368(play) == EXCH_ITEM_EYEDROPS) { this->actor.textId = 0x3059; } else { this->actor.textId = 0x3058; @@ -618,19 +617,19 @@ void func_80A3F908(EnGo* this, GlobalContext* globalCtx) { } } -void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGo_Init(Actor* thisx, PlayState* play) { EnGo* this = (EnGo*)thisx; s32 pad; Vec3f D_80A41B9C = { 0.0f, 0.0f, 0.0f }; // unused Vec3f D_80A41BA8 = { 0.0f, 0.0f, 0.0f }; // unused ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, 0, 0, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, 0, 0, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); - if (!EnGo_IsActorSpawned(this, globalCtx)) { + if (!EnGo_IsActorSpawned(this, play)) { Actor_Kill(&this->actor); return; } @@ -649,7 +648,7 @@ void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) { case 0x00: Actor_SetScale(&this->actor, 0.008f); if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { - EnGo_SetMovedPos(this, globalCtx); + EnGo_SetMovedPos(this, play); EnGo_SetupAction(this, EnGo_CurledUp); } else { this->actor.shape.yOffset = 1400.0f; @@ -664,7 +663,7 @@ void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) { break; case 0x40: if (GET_INFTABLE(INFTABLE_EB)) { - EnGo_SetMovedPos(this, globalCtx); + EnGo_SetMovedPos(this, play); } Actor_SetScale(&this->actor, 0.015f); EnGo_SetupAction(this, EnGo_CurledUp); @@ -691,34 +690,34 @@ void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGo_Destroy(Actor* thisx, PlayState* play) { EnGo* this = (EnGo*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void func_80A3FEB4(EnGo* this, GlobalContext* globalCtx) { +void func_80A3FEB4(EnGo* this, PlayState* play) { if (!(this->actor.xyzDistToPlayerSq > SQ(1200.0f))) { EnGo_SetupAction(this, EnGo_StopRolling); } } -void EnGo_StopRolling(EnGo* this, GlobalContext* globalCtx) { +void EnGo_StopRolling(EnGo* this, PlayState* play) { EnBom* bomb; if (DECR(this->unk_20E) == 0) { if (this->collider.base.ocFlags2 & 1) { this->collider.base.ocFlags2 &= ~1; - globalCtx->damagePlayer(globalCtx, -4); - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); + play->damagePlayer(play, -4); + func_8002F71C(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); this->unk_20E = 0x10; } } this->actor.speedXZ = 3.0f; - if ((EnGo_FollowPath(this, globalCtx) == true) && (this->unk_218 == 0)) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + if ((EnGo_FollowPath(this, play) == true) && (this->unk_218 == 0)) { + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bomb != NULL) { bomb->timer = 0; @@ -735,7 +734,7 @@ void EnGo_StopRolling(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A4008C(EnGo* this, GlobalContext* globalCtx) { +void func_80A4008C(EnGo* this, PlayState* play) { if (EnGo_IsRollingOnGround(this, 3, 6.0f)) { if (this->unk_21A == 0) { this->actor.shape.yOffset = 0.0f; @@ -746,8 +745,8 @@ void func_80A4008C(EnGo* this, GlobalContext* globalCtx) { } } -void EnGo_GoronLinkRolling(EnGo* this, GlobalContext* globalCtx) { - if ((EnGo_FollowPath(this, globalCtx) == true) && Flags_GetSwitch(globalCtx, this->actor.params >> 8) && +void EnGo_GoronLinkRolling(EnGo* this, PlayState* play) { + if ((EnGo_FollowPath(this, play) == true) && Flags_GetSwitch(play, this->actor.params >> 8) && (this->unk_218 == 0)) { this->actor.speedXZ = 0.0f; EnGo_SetupAction(this, func_80A4008C); @@ -761,11 +760,11 @@ void EnGo_GoronLinkRolling(EnGo* this, GlobalContext* globalCtx) { } } -void EnGo_FireGenericActionFunc(EnGo* this, GlobalContext* globalCtx) { +void EnGo_FireGenericActionFunc(EnGo* this, PlayState* play) { } -void EnGo_CurledUp(EnGo* this, GlobalContext* globalCtx) { - if ((DECR(this->unk_210) == 0) && EnGo_IsCameraModified(this, globalCtx)) { +void EnGo_CurledUp(EnGo* this, PlayState* play) { + if ((DECR(this->unk_210) == 0) && EnGo_IsCameraModified(this, play)) { Audio_PlaySoundGeneral(NA_SE_EN_GOLON_WAKE_UP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -774,12 +773,12 @@ void EnGo_CurledUp(EnGo* this, GlobalContext* globalCtx) { EnGo_SetupAction(this, EnGo_WakeUp); if ((this->actor.params & 0xF0) == 0x90) { - OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4200, -99, &this->actor, CAM_ID_MAIN); } } } -void EnGo_WakeUp(EnGo* this, GlobalContext* globalCtx) { +void EnGo_WakeUp(EnGo* this, PlayState* play) { f32 frame; if (this->skelAnime.playSpeed != 0.0f) { @@ -804,14 +803,14 @@ void EnGo_WakeUp(EnGo* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); EnGo_SetupAction(this, func_80A405CC); - } else if (!EnGo_IsCameraModified(this, globalCtx)) { + } else if (!EnGo_IsCameraModified(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = 0.0f; EnGo_SetupAction(this, func_80A40494); } } -void func_80A40494(EnGo* this, GlobalContext* globalCtx) { +void func_80A40494(EnGo* this, PlayState* play) { f32 frame; Math_SmoothStepToF(&this->skelAnime.playSpeed, ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f) * -0.5f, 0.1f, @@ -831,7 +830,7 @@ void func_80A40494(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A405CC(EnGo* this, GlobalContext* globalCtx) { +void func_80A405CC(EnGo* this, PlayState* play) { f32 lastFrame; f32 frame; @@ -854,7 +853,7 @@ void func_80A405CC(EnGo* this, GlobalContext* globalCtx) { } } -void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx) { +void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { if (((this->actor.params & 0xF0) == 0x90) && (this->unk_1E0.unk_00 == 2)) { if (gSaveContext.bgsFlag) { this->unk_1E0.unk_00 = 0; @@ -864,22 +863,22 @@ void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx) { this->unk_21E = 100; this->unk_1E0.unk_00 = 0; EnGo_SetupAction(this, EnGo_Eyedrops); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; gSaveContext.timer2State = 0; - OnePointCutscene_Init(globalCtx, 4190, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4190, -99, &this->actor, CAM_ID_MAIN); } else { this->unk_1E0.unk_00 = 0; EnGo_SetupAction(this, EnGo_GetItem); - Message_CloseTextbox(globalCtx); - EnGo_GetItem(this, globalCtx); + Message_CloseTextbox(play); + EnGo_GetItem(this, play); } } } else if (((this->actor.params & 0xF0) == 0) && (this->unk_1E0.unk_00 == 2)) { EnGo_SetupAction(this, EnGo_GetItem); - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } else { - if ((DECR(this->unk_212) == 0) && !EnGo_IsCameraModified(this, globalCtx)) { + if ((DECR(this->unk_212) == 0) && !EnGo_IsCameraModified(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = -0.1f; this->skelAnime.playSpeed *= (this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f; @@ -888,7 +887,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A408D8(EnGo* this, GlobalContext* globalCtx) { +void func_80A408D8(EnGo* this, PlayState* play) { f32 frame; if (this->skelAnime.playSpeed != 0.0f) { @@ -910,7 +909,7 @@ void func_80A408D8(EnGo* this, GlobalContext* globalCtx) { if (DECR(this->unk_212) == 0) { EnGo_SetupAction(this, func_80A40494); - } else if (EnGo_IsCameraModified(this, globalCtx)) { + } else if (EnGo_IsCameraModified(this, play)) { EnGo_ReverseAnimation(this); Audio_PlaySoundGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -919,12 +918,12 @@ void func_80A408D8(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A40A54(EnGo* this, GlobalContext* globalCtx) { +void func_80A40A54(EnGo* this, PlayState* play) { f32 float1 = ((f32)0x8000 / Animation_GetLastFrame(&gGoronAnim_010590)); f32 float2 = this->skelAnime.curFrame * float1; this->actor.speedXZ = Math_SinS((s16)float2); - if (EnGo_FollowPath(this, globalCtx) && this->unk_218 == 0) { + if (EnGo_FollowPath(this, play) && this->unk_218 == 0) { EnGo_ChangeAnim(this, ENGO_ANIM_1); this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930); this->actor.speedXZ = 0.0f; @@ -932,21 +931,21 @@ void func_80A40A54(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A40B1C(EnGo* this, GlobalContext* globalCtx) { +void func_80A40B1C(EnGo* this, PlayState* play) { if (GET_INFTABLE(INFTABLE_EB)) { EnGo_ChangeAnim(this, ENGO_ANIM_3); EnGo_SetupAction(this, func_80A40A54); } else { - EnGo_BiggoronActionFunc(this, globalCtx); + EnGo_BiggoronActionFunc(this, play); } } -void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx) { +void EnGo_GetItem(EnGo* this, PlayState* play) { f32 xzDist; f32 yDist; s32 getItemId; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->unk_1E0.unk_00 = 2; this->actor.parent = NULL; EnGo_SetupAction(this, func_80A40C78); @@ -971,11 +970,11 @@ void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx) { yDist = fabsf(this->actor.yDistToPlayer) + 1.0f; xzDist = this->actor.xzDistToPlayer + 1.0f; - func_8002F434(&this->actor, globalCtx, getItemId, xzDist, yDist); + func_8002F434(&this->actor, play, getItemId, xzDist, yDist); } } -void func_80A40C78(EnGo* this, GlobalContext* globalCtx) { +void func_80A40C78(EnGo* this, PlayState* play) { if (this->unk_1E0.unk_00 == 3) { EnGo_SetupAction(this, EnGo_BiggoronActionFunc); if ((this->actor.params & 0xF0) != 0x90) { @@ -985,47 +984,47 @@ void func_80A40C78(EnGo* this, GlobalContext* globalCtx) { gSaveContext.bgsFlag = true; } else if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_PRESCRIPTION) { this->actor.textId = 0x3058; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E0.unk_00 = 1; } else if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK) { this->actor.textId = 0x305C; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E0.unk_00 = 1; Environment_ClearBgsDayCount(); } } } -void EnGo_Eyedrops(EnGo* this, GlobalContext* globalCtx) { +void EnGo_Eyedrops(EnGo* this, PlayState* play) { if (DECR(this->unk_21E) == 0) { this->actor.textId = 0x305A; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E0.unk_00 = 1; EnGo_SetupAction(this, func_80A40DCC); } } -void func_80A40DCC(EnGo* this, GlobalContext* globalCtx) { +void func_80A40DCC(EnGo* this, PlayState* play) { if (this->unk_1E0.unk_00 == 2) { EnGo_ChangeAnim(this, ENGO_ANIM_1); this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930); - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); EnGo_SetupAction(this, EnGo_GetItem); - EnGo_GetItem(this, globalCtx); + EnGo_GetItem(this, play); } } -void EnGo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGo_Update(Actor* thisx, PlayState* play) { s32 pad; EnGo* this = (EnGo*)thisx; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_FireGenericActionFunc || this->actionFunc == func_80A40B1C) { - func_80034F54(globalCtx, this->jointTable, this->morphTable, 18); + func_80034F54(play, this->jointTable, this->morphTable, 18); } EnGo_UpdateShadow(this); @@ -1034,22 +1033,22 @@ void EnGo_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); func_80A3F0E4(this); - func_80A3F908(this, globalCtx); - this->actionFunc(this, globalCtx); - func_80A3F060(this, globalCtx); + func_80A3F908(this, play); + this->actionFunc(this, play); + func_80A3F060(this, play); } -void EnGo_DrawCurledUp(EnGo* this, GlobalContext* globalCtx) { +void EnGo_DrawCurledUp(EnGo* this, PlayState* play) { Vec3f D_80A41BB4 = { 0.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2320); + OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2320); Matrix_Push(); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go.c", 2326), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go.c", 2326), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00BD80); @@ -1057,28 +1056,28 @@ void EnGo_DrawCurledUp(EnGo* this, GlobalContext* globalCtx) { Matrix_MultVec3f(&D_80A41BB4, &this->actor.focus.pos); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2341); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2341); } -void EnGo_DrawRolling(EnGo* this, GlobalContext* globalCtx) { +void EnGo_DrawRolling(EnGo* this, PlayState* play) { Vec3f D_80A41BC0 = { 0.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2355); + OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2355); Matrix_Push(); - func_80093D18(globalCtx->state.gfxCtx); - Matrix_RotateZYX((s16)(globalCtx->state.frames * ((s16)this->actor.speedXZ * 1400)), 0, this->actor.shape.rot.z, + func_80093D18(play->state.gfxCtx); + Matrix_RotateZYX((s16)(play->state.frames * ((s16)this->actor.speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go.c", 2368), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go.c", 2368), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00C140); Matrix_MultVec3f(&D_80A41BC0, &this->actor.focus.pos); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2383); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2383); } -s32 EnGo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGo* this = (EnGo*)thisx; Vec3s vec1; f32 float1; @@ -1111,7 +1110,7 @@ s32 EnGo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f return 0; } -void EnGo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnGo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnGo* this = (EnGo*)thisx; Vec3f D_80A41BCC = { 600.0f, 0.0f, 0.0f }; @@ -1120,33 +1119,33 @@ void EnGo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGo_Draw(Actor* thisx, PlayState* play) { EnGo* this = (EnGo*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2479); + OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2479); EnGo_UpdateEffects(this); Matrix_Push(); - EnGo_DrawEffects(this, globalCtx); + EnGo_DrawEffects(this, play); Matrix_Pop(); if (this->actionFunc == EnGo_CurledUp) { - EnGo_DrawCurledUp(this, globalCtx); + EnGo_DrawCurledUp(this, play); return; // needed for match? } else if (this->actionFunc == EnGo_GoronLinkRolling || this->actionFunc == func_80A3FEB4 || this->actionFunc == EnGo_StopRolling || this->actionFunc == func_80A3FEB4) { - EnGo_DrawRolling(this, globalCtx); + EnGo_DrawRolling(this, play); return; // needed for match? } else { - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gGoronCsEyeOpenTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGoronCsMouthNeutralTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnGo_OverrideLimbDraw, EnGo_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2525); - EnGo_DrawEffects(this, globalCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGo_OverrideLimbDraw, EnGo_PostLimbDraw, &this->actor); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2525); + EnGo_DrawEffects(this, play); } } @@ -1199,7 +1198,7 @@ void EnGo_UpdateEffects(EnGo* this) { } } -void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx) { +void EnGo_DrawEffects(EnGo* this, PlayState* play) { static void* dustTex[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex }; EnGoEffect* dustEffect = this->effects; s16 alpha; @@ -1207,9 +1206,9 @@ void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx) { s16 index; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2626); + OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2626); materialFlag = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (1) {} for (i = 0; i < EN_GO_EFFECT_COUNT; i++, dustEffect++) { if (dustEffect->type) { @@ -1224,9 +1223,9 @@ void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go.c", 2664), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go.c", 2664), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); index = dustEffect->timer * (8.0f / dustEffect->initialTimer); @@ -1234,5 +1233,5 @@ void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2678); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2678); } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index 551299e550..43c098f9ab 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -6,9 +6,9 @@ struct EnGo; -typedef void (*EnGoActionFunc)(struct EnGo*, GlobalContext*); -typedef u16 (*callback1_80A3ED24)(GlobalContext*, struct EnGo*); -typedef s16 (*callback2_80A3ED24)(GlobalContext*, struct EnGo*); +typedef void (*EnGoActionFunc)(struct EnGo*, PlayState*); +typedef u16 (*callback1_80A3ED24)(PlayState*, struct EnGo*); +typedef s16 (*callback2_80A3ED24)(PlayState*, struct EnGo*); // WIP type docs // /* 0x00 */ GORON1_CITY_LINK, 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 8116f0c81a..228e4fb1b8 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -43,27 +43,27 @@ this->actor.params & 0x1F Gorons only move when this->unk_194.unk_00 == 0 */ -void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGo2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGo2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGo2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGo2_Init(Actor* thisx, PlayState* play); +void EnGo2_Destroy(Actor* thisx, PlayState* play); +void EnGo2_Update(Actor* thisx, PlayState* play); +void EnGo2_Draw(Actor* thisx, PlayState* play); -void EnGo2_StopRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_CurledUp(EnGo2* this, GlobalContext* globalCtx); +void EnGo2_StopRolling(EnGo2* this, PlayState* play); +void EnGo2_CurledUp(EnGo2* this, PlayState* play); -void func_80A46B40(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_GoronDmtBombFlowerAnimation(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_ContinueRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_SlowRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_GroundRolling(EnGo2* this, GlobalContext* globalCtx); +void func_80A46B40(EnGo2* this, PlayState* play); +void EnGo2_GoronDmtBombFlowerAnimation(EnGo2* this, PlayState* play); +void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, PlayState* play); +void EnGo2_ContinueRolling(EnGo2* this, PlayState* play); +void EnGo2_SlowRolling(EnGo2* this, PlayState* play); +void EnGo2_GroundRolling(EnGo2* this, PlayState* play); -void EnGo2_ReverseRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_SetupGetItem(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_SetGetItem(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx); -void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx); +void EnGo2_ReverseRolling(EnGo2* this, PlayState* play); +void EnGo2_SetupGetItem(EnGo2* this, PlayState* play); +void EnGo2_SetGetItem(EnGo2* this, PlayState* play); +void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play); +void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play); +void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play); static void* sDustTex[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex }; @@ -217,17 +217,17 @@ void EnGo2_UpdateEffects(EnGo2* this) { } } -void EnGo2_DrawEffects(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_DrawEffects(EnGo2* this, PlayState* play) { EnGoEffect* dustEffect = this->effects; s16 alpha; s16 materialFlag; s16 index; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go2_eff.c", 111); + OPEN_DISPS(play->state.gfxCtx, "../z_en_go2_eff.c", 111); materialFlag = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (1) {} for (i = 0; i < EN_GO2_EFFECT_COUNT; i++, dustEffect++) { @@ -243,9 +243,9 @@ void EnGo2_DrawEffects(EnGo2* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go2_eff.c", 137), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go2_eff.c", 137), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); index = dustEffect->timer * (8.0f / dustEffect->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sDustTex[index])); @@ -253,7 +253,7 @@ void EnGo2_DrawEffects(EnGo2* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go2_eff.c", 151); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2_eff.c", 151); } s32 EnGo2_SpawnDust(EnGo2* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 numDustEffects, f32 radius, @@ -279,14 +279,14 @@ s32 EnGo2_SpawnDust(EnGo2* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 return 0; } -void EnGo2_GetItem(EnGo2* this, GlobalContext* globalCtx, s32 getItemId) { +void EnGo2_GetItem(EnGo2* this, PlayState* play, s32 getItemId) { this->getItemId = getItemId; - func_8002F434(&this->actor, globalCtx, getItemId, this->actor.xzDistToPlayer + 1.0f, + func_8002F434(&this->actor, play, getItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } -s32 EnGo2_GetDialogState(EnGo2* this, GlobalContext* globalCtx) { - s16 dialogState = Message_GetState(&globalCtx->msgCtx); +s32 EnGo2_GetDialogState(EnGo2* this, PlayState* play) { + s16 dialogState = Message_GetState(&play->msgCtx); if ((this->dialogState == TEXT_STATE_AWAITING_NEXT) || (this->dialogState == TEXT_STATE_EVENT) || (this->dialogState == TEXT_STATE_CLOSING) || (this->dialogState == TEXT_STATE_DONE_HAS_NEXT)) { @@ -322,7 +322,7 @@ u16 EnGo2_GoronFireGenericGetTextId(EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityRollingBig(PlayState* play, EnGo2* this) { if (GET_INFTABLE(INFTABLE_11E)) { return 0x3013; } else if (CUR_CAPACITY(UPG_BOMB_BAG) >= 20 && this->waypoint > 7 && this->waypoint < 12) { @@ -332,19 +332,19 @@ u16 EnGo2_GetTextIdGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) { +s16 EnGo2_GetStateGoronCityRollingBig(PlayState* play, EnGo2* this) { s32 bombBagUpgrade; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: return 2; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x3012) { this->actionFunc = EnGo2_SetupGetItem; bombBagUpgrade = CUR_CAPACITY(UPG_BOMB_BAG) == 30 ? GI_BOMB_BAG_40 : GI_BOMB_BAG_30; - EnGo2_GetItem(this, globalCtx, bombBagUpgrade); - Message_CloseTextbox(globalCtx); + EnGo2_GetItem(this, play, bombBagUpgrade); + Message_CloseTextbox(play); SET_INFTABLE(INFTABLE_11E); return 2; } else { @@ -356,13 +356,13 @@ s16 EnGo2_GetStateGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronDmtBombFlower(PlayState* play, EnGo2* this) { return CHECK_QUEST_ITEM(QUEST_GORON_RUBY) ? 0x3027 : 0x300A; } // DMT Goron by Bomb Flower Choice -s16 EnGo2_GetStateGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) { - switch (Message_GetState(&globalCtx->msgCtx)) { +s16 EnGo2_GetStateGoronDmtBombFlower(PlayState* play, EnGo2* this) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: if ((this->actor.textId == 0x300B) && !GET_INFTABLE(INFTABLE_EB)) { SET_INFTABLE(INFTABLE_EB); @@ -371,15 +371,15 @@ s16 EnGo2_GetStateGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) { return 0; } case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { // Ask question to DMT Goron by bomb flower if (this->actor.textId == 0x300A) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { this->actor.textId = CUR_UPG_VALUE(UPG_STRENGTH) != 0 ? 0x300B : 0x300C; } else { this->actor.textId = 0x300D; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } return 1; } @@ -388,7 +388,7 @@ s16 EnGo2_GetStateGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronDmtRollingSmall(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronDmtRollingSmall(PlayState* play, EnGo2* this) { if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return 0x3027; } else { @@ -396,15 +396,15 @@ u16 EnGo2_GetTextIdGoronDmtRollingSmall(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronDmtRollingSmall(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronDmtRollingSmall(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return 0; } else { return 1; } } -u16 EnGo2_GetTextIdGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronDmtDcEntrance(PlayState* play, EnGo2* this) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && LINK_IS_ADULT) { return 0x3043; } else if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { @@ -414,8 +414,8 @@ u16 EnGo2_GetTextIdGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronDmtDcEntrance(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x3008) { SET_INFTABLE(INFTABLE_E0); } @@ -425,7 +425,7 @@ s16 EnGo2_GetStateGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityEntrance(PlayState* play, EnGo2* this) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && LINK_IS_ADULT) { return 0x3043; } else if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { @@ -435,8 +435,8 @@ u16 EnGo2_GetTextIdGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronCityEntrance(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x3014) { SET_INFTABLE(INFTABLE_F0); } @@ -446,7 +446,7 @@ s16 EnGo2_GetStateGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityIsland(PlayState* play, EnGo2* this) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && LINK_IS_ADULT) { return 0x3043; } else if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { @@ -456,8 +456,8 @@ u16 EnGo2_GetTextIdGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronCityIsland(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x3016) { SET_INFTABLE(INFTABLE_F4); } @@ -467,21 +467,21 @@ s16 EnGo2_GetStateGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityLowestFloor(PlayState* play, EnGo2* this) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && LINK_IS_ADULT) { return 0x3043; } else if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return 0x3027; } else { - return CUR_UPG_VALUE(UPG_STRENGTH) != 0 ? 0x302C - : !Flags_GetSwitch(globalCtx, 0x1B) ? 0x3017 - : GET_INFTABLE(INFTABLE_F8) ? 0x3019 - : 0x3018; + return CUR_UPG_VALUE(UPG_STRENGTH) != 0 ? 0x302C + : !Flags_GetSwitch(play, 0x1B) ? 0x3017 + : GET_INFTABLE(INFTABLE_F8) ? 0x3019 + : 0x3018; } } -s16 EnGo2_GetStateGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronCityLowestFloor(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x3018) { SET_INFTABLE(INFTABLE_F8); } @@ -491,7 +491,7 @@ s16 EnGo2_GetStateGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityLink(PlayState* play, EnGo2* this) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE)) { return GET_INFTABLE(INFTABLE_10F) ? 0x3042 : 0x3041; } else if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { @@ -505,12 +505,12 @@ u16 EnGo2_GetTextIdGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { - switch (EnGo2_GetDialogState(this, globalCtx)) { +s16 EnGo2_GetStateGoronCityLink(PlayState* play, EnGo2* this) { + switch (EnGo2_GetDialogState(this, play)) { case TEXT_STATE_CLOSING: switch (this->actor.textId) { case 0x3036: - EnGo2_GetItem(this, globalCtx, GI_TUNIC_GORON); + EnGo2_GetItem(this, play, GI_TUNIC_GORON); this->actionFunc = EnGo2_SetupGetItem; return 2; case 0x3037: @@ -519,9 +519,9 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { return 0; } case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x3034) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { this->actor.textId = GET_INFTABLE(INFTABLE_10B) ? 0x3033 : 0x3035; if (this->actor.textId == 0x3035) { Audio_StopSfxById(NA_SE_EN_GOLON_CRY); @@ -532,7 +532,7 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { Audio_StopSfxById(NA_SE_EN_GOLON_CRY); } } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_20C = 0; } } else { @@ -540,14 +540,14 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { } return 1; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x3035: SET_INFTABLE(INFTABLE_10B); case 0x3032: case 0x3033: this->actor.textId = 0x3034; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); return 1; default: return 2; @@ -557,8 +557,8 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { return 1; } -u16 EnGo2_GetTextIdGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { - Player* player = GET_PLAYER(globalCtx); +u16 EnGo2_GetTextIdGoronDmtBiggoron(PlayState* play, EnGo2* this) { + Player* player = GET_PLAYER(play); if (gSaveContext.bgsFlag) { player->exchangeItemId = EXCH_ITEM_CLAIM_CHECK; @@ -575,15 +575,15 @@ u16 EnGo2_GetTextIdGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { +s16 EnGo2_GetStateGoronDmtBiggoron(PlayState* play, EnGo2* this) { s32 unusedPad; u8 dialogState = this->dialogState; - switch (EnGo2_GetDialogState(this, globalCtx)) { + switch (EnGo2_GetDialogState(this, play)) { case TEXT_STATE_DONE: if (this->actor.textId == 0x305E) { if (!gSaveContext.bgsFlag) { - EnGo2_GetItem(this, globalCtx, GI_SWORD_BGS); + EnGo2_GetItem(this, play, GI_SWORD_BGS); this->actionFunc = EnGo2_SetupGetItem; return 2; } else { @@ -595,7 +595,7 @@ s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { case TEXT_STATE_DONE_FADING: switch (this->actor.textId) { case 0x305E: - if (func_8002F368(globalCtx) != EXCH_ITEM_CLAIM_CHECK) { + if (func_8002F368(play) != EXCH_ITEM_CLAIM_CHECK) { break; } case 0x3059: @@ -610,23 +610,23 @@ s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { } return 1; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if ((this->actor.textId == 0x3054) || (this->actor.textId == 0x3055)) { - if (globalCtx->msgCtx.choiceIndex == 0) { - EnGo2_GetItem(this, globalCtx, GI_PRESCRIPTION); + if (play->msgCtx.choiceIndex == 0) { + EnGo2_GetItem(this, play, GI_PRESCRIPTION); this->actionFunc = EnGo2_SetupGetItem; return 2; } this->actor.textId = 0x3056; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } return 1; } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x3059) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = EnGo2_BiggoronEyedrops; } return 2; @@ -635,23 +635,23 @@ s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { return 1; } -u16 EnGo2_GetTextIdGoronFireGeneric(GlobalContext* globalCtx, EnGo2* this) { - if (Flags_GetSwitch(globalCtx, (this->actor.params & 0xFC00) >> 0xA)) { +u16 EnGo2_GetTextIdGoronFireGeneric(PlayState* play, EnGo2* this) { + if (Flags_GetSwitch(play, (this->actor.params & 0xFC00) >> 0xA)) { return 0x3071; } else { return 0x3051; } } -s16 EnGo2_GetStateGoronFireGeneric(GlobalContext* globalCtx, EnGo2* this) { - switch (Message_GetState(&globalCtx->msgCtx)) { +s16 EnGo2_GetStateGoronFireGeneric(PlayState* play, EnGo2* this) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: return 0; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x3071) { this->actor.textId = EnGo2_GoronFireGenericGetTextId(this); - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } return 1; } @@ -660,12 +660,12 @@ s16 EnGo2_GetStateGoronFireGeneric(GlobalContext* globalCtx, EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityStairwell(PlayState* play, EnGo2* this) { return !LINK_IS_ADULT ? GET_INFTABLE(INFTABLE_E3) ? 0x3022 : 0x300E : 0x3043; } -s16 EnGo2_GetStateGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronCityStairwell(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x300E) { SET_INFTABLE(INFTABLE_E3); } @@ -676,21 +676,21 @@ s16 EnGo2_GetStateGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) { } // Goron in child market bazaar after obtaining Goron Ruby -u16 EnGo2_GetTextIdGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronMarketBazaar(PlayState* play, EnGo2* this) { return 0x7122; } -s16 EnGo2_GetStateGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronMarketBazaar(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return 0; } else { return 1; } } -u16 EnGo2_GetTextIdGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityLostWoods(PlayState* play, EnGo2* this) { if (!LINK_IS_ADULT) { - if (Flags_GetSwitch(globalCtx, 0x1C)) { + if (Flags_GetSwitch(play, 0x1C)) { return 0x302F; } else { return GET_INFTABLE(INFTABLE_E6) ? 0x3025 : 0x3024; @@ -700,8 +700,8 @@ u16 EnGo2_GetTextIdGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronCityLostWoods(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->actor.textId == 0x3024) { SET_INFTABLE(INFTABLE_E6); } @@ -712,7 +712,7 @@ s16 EnGo2_GetStateGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) { } // Goron at base of DMT summit -u16 EnGo2_GetTextIdGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) { +u16 EnGo2_GetTextIdGoronDmtFairyHint(PlayState* play, EnGo2* this) { if (!LINK_IS_ADULT) { return CHECK_QUEST_ITEM(QUEST_GORON_RUBY) ? 0x3065 : 0x3064; } else { @@ -720,103 +720,102 @@ u16 EnGo2_GetTextIdGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) { } } -s16 EnGo2_GetStateGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 EnGo2_GetStateGoronDmtFairyHint(PlayState* play, EnGo2* this) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return 0; } else { return 1; } } -u16 EnGo2_GetTextId(GlobalContext* globalCtx, Actor* thisx) { +u16 EnGo2_GetTextId(PlayState* play, Actor* thisx) { EnGo2* this = (EnGo2*)thisx; - u16 faceReaction = Text_GetFaceReaction(globalCtx, 0x20); + u16 faceReaction = Text_GetFaceReaction(play, 0x20); if (faceReaction) { return faceReaction; } else { switch (this->actor.params & 0x1F) { case GORON_CITY_ROLLING_BIG: - return EnGo2_GetTextIdGoronCityRollingBig(globalCtx, this); + return EnGo2_GetTextIdGoronCityRollingBig(play, this); case GORON_CITY_LINK: - return EnGo2_GetTextIdGoronCityLink(globalCtx, this); + return EnGo2_GetTextIdGoronCityLink(play, this); case GORON_DMT_BIGGORON: - return EnGo2_GetTextIdGoronDmtBiggoron(globalCtx, this); + return EnGo2_GetTextIdGoronDmtBiggoron(play, this); case GORON_FIRE_GENERIC: - return EnGo2_GetTextIdGoronFireGeneric(globalCtx, this); + return EnGo2_GetTextIdGoronFireGeneric(play, this); case GORON_DMT_BOMB_FLOWER: - return EnGo2_GetTextIdGoronDmtBombFlower(globalCtx, this); + return EnGo2_GetTextIdGoronDmtBombFlower(play, this); case GORON_DMT_ROLLING_SMALL: - return EnGo2_GetTextIdGoronDmtRollingSmall(globalCtx, this); + return EnGo2_GetTextIdGoronDmtRollingSmall(play, this); case GORON_DMT_DC_ENTRANCE: - return EnGo2_GetTextIdGoronDmtDcEntrance(globalCtx, this); + return EnGo2_GetTextIdGoronDmtDcEntrance(play, this); case GORON_CITY_ENTRANCE: - return EnGo2_GetTextIdGoronCityEntrance(globalCtx, this); + return EnGo2_GetTextIdGoronCityEntrance(play, this); case GORON_CITY_ISLAND: - return EnGo2_GetTextIdGoronCityIsland(globalCtx, this); + return EnGo2_GetTextIdGoronCityIsland(play, this); case GORON_CITY_LOWEST_FLOOR: - return EnGo2_GetTextIdGoronCityLowestFloor(globalCtx, this); + return EnGo2_GetTextIdGoronCityLowestFloor(play, this); case GORON_CITY_STAIRWELL: - return EnGo2_GetTextIdGoronCityStairwell(globalCtx, this); + return EnGo2_GetTextIdGoronCityStairwell(play, this); case GORON_CITY_LOST_WOODS: - return EnGo2_GetTextIdGoronCityLostWoods(globalCtx, this); + return EnGo2_GetTextIdGoronCityLostWoods(play, this); case GORON_DMT_FAIRY_HINT: - return EnGo2_GetTextIdGoronDmtFairyHint(globalCtx, this); + return EnGo2_GetTextIdGoronDmtFairyHint(play, this); case GORON_MARKET_BAZAAR: - return EnGo2_GetTextIdGoronMarketBazaar(globalCtx, this); + return EnGo2_GetTextIdGoronMarketBazaar(play, this); } } } -s16 EnGo2_GetState(GlobalContext* globalCtx, Actor* thisx) { +s16 EnGo2_GetState(PlayState* play, Actor* thisx) { EnGo2* this = (EnGo2*)thisx; switch (this->actor.params & 0x1F) { case GORON_CITY_ROLLING_BIG: - return EnGo2_GetStateGoronCityRollingBig(globalCtx, this); + return EnGo2_GetStateGoronCityRollingBig(play, this); case GORON_CITY_LINK: - return EnGo2_GetStateGoronCityLink(globalCtx, this); + return EnGo2_GetStateGoronCityLink(play, this); case GORON_DMT_BIGGORON: - return EnGo2_GetStateGoronDmtBiggoron(globalCtx, this); + return EnGo2_GetStateGoronDmtBiggoron(play, this); case GORON_FIRE_GENERIC: - return EnGo2_GetStateGoronFireGeneric(globalCtx, this); + return EnGo2_GetStateGoronFireGeneric(play, this); case GORON_DMT_BOMB_FLOWER: - return EnGo2_GetStateGoronDmtBombFlower(globalCtx, this); + return EnGo2_GetStateGoronDmtBombFlower(play, this); case GORON_DMT_ROLLING_SMALL: - return EnGo2_GetStateGoronDmtRollingSmall(globalCtx, this); + return EnGo2_GetStateGoronDmtRollingSmall(play, this); case GORON_DMT_DC_ENTRANCE: - return EnGo2_GetStateGoronDmtDcEntrance(globalCtx, this); + return EnGo2_GetStateGoronDmtDcEntrance(play, this); case GORON_CITY_ENTRANCE: - return EnGo2_GetStateGoronCityEntrance(globalCtx, this); + return EnGo2_GetStateGoronCityEntrance(play, this); case GORON_CITY_ISLAND: - return EnGo2_GetStateGoronCityIsland(globalCtx, this); + return EnGo2_GetStateGoronCityIsland(play, this); case GORON_CITY_LOWEST_FLOOR: - return EnGo2_GetStateGoronCityLowestFloor(globalCtx, this); + return EnGo2_GetStateGoronCityLowestFloor(play, this); case GORON_CITY_STAIRWELL: - return EnGo2_GetStateGoronCityStairwell(globalCtx, this); + return EnGo2_GetStateGoronCityStairwell(play, this); case GORON_CITY_LOST_WOODS: - return EnGo2_GetStateGoronCityLostWoods(globalCtx, this); + return EnGo2_GetStateGoronCityLostWoods(play, this); case GORON_DMT_FAIRY_HINT: - return EnGo2_GetStateGoronDmtFairyHint(globalCtx, this); + return EnGo2_GetStateGoronDmtFairyHint(play, this); case GORON_MARKET_BAZAAR: - return EnGo2_GetStateGoronMarketBazaar(globalCtx, this); + return EnGo2_GetStateGoronMarketBazaar(play, this); } } -s32 func_80A44790(EnGo2* this, GlobalContext* globalCtx) { +s32 func_80A44790(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) != GORON_DMT_BIGGORON && (this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG) { - return func_800343CC(globalCtx, &this->actor, &this->unk_194.unk_00, this->unk_218, EnGo2_GetTextId, - EnGo2_GetState); + return func_800343CC(play, &this->actor, &this->unk_194.unk_00, this->unk_218, EnGo2_GetTextId, EnGo2_GetState); } else if (((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) && ((this->collider.base.ocFlags2 & 1) == 0)) { return false; } else { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_194.unk_00 = 1; return true; } else if (this->unk_194.unk_00 != 0) { - this->unk_194.unk_00 = EnGo2_GetState(globalCtx, &this->actor); + this->unk_194.unk_00 = EnGo2_GetState(play, &this->actor); return false; - } else if (func_8002F2CC(&this->actor, globalCtx, this->unk_218)) { - this->actor.textId = EnGo2_GetTextId(globalCtx, &this->actor); + } else if (func_8002F2CC(&this->actor, play, this->unk_218)) { + this->actor.textId = EnGo2_GetTextId(play, &this->actor); } return false; } @@ -839,7 +838,7 @@ void EnGo2_SetShape(EnGo2* this) { this->unk_218 += this->collider.dim.radius; } -void EnGo2_CheckCollision(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_CheckCollision(EnGo2* this, PlayState* play) { Vec3s pos; f32 xzDist; @@ -851,8 +850,8 @@ void EnGo2_CheckCollision(EnGo2* this, GlobalContext* globalCtx) { pos.z += (s16)(xzDist * Math_CosS(this->actor.shape.rot.y)); pos.y += D_80A4816C[this->actor.params & 0x1F].yDist; this->collider.dim.pos = pos; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } void EnGo2_SwapInitialFrameAnimFrameCount(EnGo2* this) { @@ -863,8 +862,8 @@ void EnGo2_SwapInitialFrameAnimFrameCount(EnGo2* this) { this->skelAnime.endFrame = initialFrame; } -s32 func_80A44AB0(EnGo2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80A44AB0(EnGo2* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 arg2; if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { @@ -879,7 +878,7 @@ s32 func_80A44AB0(EnGo2* this, GlobalContext* globalCtx) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->actor.flags &= ~ACTOR_FLAG_24; this->collider.base.acFlags &= ~0x2; - EnGo2_StopRolling(this, globalCtx); + EnGo2_StopRolling(this, play); return true; } if (player->invincibilityTimer <= 0) { @@ -892,8 +891,8 @@ s32 func_80A44AB0(EnGo2* this, GlobalContext* globalCtx) { arg2 = this->actionFunc == EnGo2_ContinueRolling ? 1.5f : this->actor.speedXZ * 1.5f; - globalCtx->damagePlayer(globalCtx, -4); - func_8002F71C(globalCtx, &this->actor, arg2, this->actor.yawTowardsPlayer, 6.0f); + play->damagePlayer(play, -4); + func_8002F71C(play, &this->actor, arg2, this->actor.yawTowardsPlayer, 6.0f); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); this->collider.base.ocFlags1 &= ~0x8; } @@ -902,7 +901,7 @@ s32 func_80A44AB0(EnGo2* this, GlobalContext* globalCtx) { return false; } -s32 EnGo2_UpdateWaypoint(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_UpdateWaypoint(EnGo2* this, PlayState* play) { s32 change; if (this->path == NULL) { @@ -925,13 +924,13 @@ s32 EnGo2_UpdateWaypoint(EnGo2* this, GlobalContext* globalCtx) { return 1; } -s32 EnGo2_Orient(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_Orient(EnGo2* this, PlayState* play) { s16 targetYaw; f32 waypointDistSq = Path_OrientAndGetDistSq(&this->actor, this->path, this->waypoint, &targetYaw); Math_SmoothStepToS(&this->actor.world.rot.y, targetYaw, 6, 4000, 1); if (waypointDistSq > 0.0f && waypointDistSq < SQ(30.0f)) { - return EnGo2_UpdateWaypoint(this, globalCtx); + return EnGo2_UpdateWaypoint(this, play); } else { return 0; } @@ -1009,12 +1008,12 @@ s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 arg1, f32 arg2, s16 arg3) { return true; } -void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* player) { +void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { u16 textId; if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { if (gSaveContext.bgsFlag) { - if (func_8002F368(globalCtx) == EXCH_ITEM_CLAIM_CHECK) { + if (func_8002F368(play) == EXCH_ITEM_CLAIM_CHECK) { this->actor.textId = 0x3003; } else { this->actor.textId = 0x305E; @@ -1022,7 +1021,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* play player->actor.textId = this->actor.textId; } else if (!gSaveContext.bgsFlag && (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK)) { - if (func_8002F368(globalCtx) == EXCH_ITEM_CLAIM_CHECK) { + if (func_8002F368(play) == EXCH_ITEM_CLAIM_CHECK) { if (Environment_GetBgsDayCount() >= 3) { textId = 0x305E; } else { @@ -1041,7 +1040,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* play } else if ((INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_PRESCRIPTION) && (INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_CLAIM_CHECK)) { - if (func_8002F368(globalCtx) == EXCH_ITEM_EYEDROPS) { + if (func_8002F368(play) == EXCH_ITEM_EYEDROPS) { this->actor.textId = 0x3059; } else { this->actor.textId = 0x3058; @@ -1052,7 +1051,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* play player->actor.textId = this->actor.textId; } else if (INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_SWORD_BROKEN) { - if (func_8002F368(globalCtx) == EXCH_ITEM_SWORD_BROKEN) { + if (func_8002F368(play) == EXCH_ITEM_SWORD_BROKEN) { if (GET_INFTABLE(INFTABLE_B4)) { textId = 0x3055; } else { @@ -1070,8 +1069,8 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* play } } -void func_80A45288(EnGo2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A45288(EnGo2* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actionFunc != EnGo2_GoronFireGenericAction) { this->unk_194.unk_18 = player->actor.world.pos; @@ -1079,8 +1078,8 @@ void func_80A45288(EnGo2* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_194, 4, this->unk_26E); } if ((this->actionFunc != EnGo2_SetGetItem) && (this->isAwake == true)) { - if (func_80A44790(this, globalCtx)) { - EnGo2_BiggoronSetTextId(this, globalCtx, player); + if (func_80A44790(this, play)) { + EnGo2_BiggoronSetTextId(this, play, player); } } } @@ -1139,8 +1138,8 @@ f32 EnGo2_GetTargetXZSpeed(EnGo2* this) { } } -s32 EnGo2_IsCameraModified(EnGo2* this, GlobalContext* globalCtx) { - Camera* mainCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; +s32 EnGo2_IsCameraModified(EnGo2* this, PlayState* play) { + Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { if (EnGo2_IsWakingUp(this)) { @@ -1279,7 +1278,7 @@ void EnGo2_GetDustData(EnGo2* this, s32 index2) { dustEffectData->numDustEffects, dustEffectData->radius, dustEffectData->yAccel); } -void EnGo2_RollingAnimation(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { this->actor.flags &= ~ACTOR_FLAG_0; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); @@ -1295,7 +1294,7 @@ void EnGo2_RollingAnimation(EnGo2* this, GlobalContext* globalCtx) { this->actionFunc = EnGo2_CurledUp; } -void EnGo2_WakeUp(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_WakeUp(EnGo2* this, PlayState* play) { if (this->skelAnime.playSpeed == 0.0f) { if ((this->actor.params & 0x1F) != GORON_DMT_BIGGORON) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOLON_WAKE_UP); @@ -1304,7 +1303,7 @@ void EnGo2_WakeUp(EnGo2* this, GlobalContext* globalCtx) { } } if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { - OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4200, -99, &this->actor, CAM_ID_MAIN); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); this->skelAnime.playSpeed = 0.5f; } else { @@ -1314,7 +1313,7 @@ void EnGo2_WakeUp(EnGo2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A46B40; } -void EnGo2_GetItemAnimation(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GetItemAnimation(EnGo2* this, PlayState* play) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); this->unk_211 = true; this->actionFunc = func_80A46B40; @@ -1323,7 +1322,7 @@ void EnGo2_GetItemAnimation(EnGo2* this, GlobalContext* globalCtx) { this->skelAnime.curFrame = this->skelAnime.endFrame; } -void EnGo2_SetupRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_SetupRolling(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) == GORON_CITY_ROLLING_BIG || (this->actor.params & 0x1F) == GORON_CITY_LINK) { this->collider.info.bumperFlags = 1; this->actor.speedXZ = GET_INFTABLE(INFTABLE_11E) ? 6.0f : 3.6000001f; @@ -1337,12 +1336,12 @@ void EnGo2_SetupRolling(EnGo2* this, GlobalContext* globalCtx) { this->actionFunc = EnGo2_ContinueRolling; } -void EnGo2_StopRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_StopRolling(EnGo2* this, PlayState* play) { EnBom* bomb; if (((this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG) && ((this->actor.params & 0x1F) != GORON_CITY_LINK)) { if ((this->actor.params & 0x1F) == GORON_DMT_ROLLING_SMALL) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bomb != NULL) { bomb->timer = 0; @@ -1360,14 +1359,14 @@ void EnGo2_StopRolling(EnGo2* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; } -s32 EnGo2_IsFreeingGoronInFire(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_IsFreeingGoronInFire(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) != GORON_FIRE_GENERIC) { return false; } // shaking curled up - this->actor.world.pos.x += (globalCtx->state.frames & 1) ? 1.0f : -1.0f; - if (Flags_GetSwitch(globalCtx, (this->actor.params & 0xFC00) >> 0xA)) { + this->actor.world.pos.x += (play->state.frames & 1) ? 1.0f : -1.0f; + if (Flags_GetSwitch(play, (this->actor.params & 0xFC00) >> 0xA)) { return true; } return false; @@ -1386,12 +1385,12 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { return true; } -s32 EnGo2_IsGoronRollingBig(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_IsGoronRollingBig(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG || (this->unk_194.unk_00 != 2)) { return false; } this->unk_194.unk_00 = 0; - EnGo2_RollingAnimation(this, globalCtx); + EnGo2_RollingAnimation(this, play); this->actionFunc = EnGo2_GoronRollingBigContinueRolling; return true; } @@ -1425,7 +1424,7 @@ s32 EnGo2_IsRolling(EnGo2* this) { return true; } -void EnGo2_GoronLinkAnimation(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GoronLinkAnimation(EnGo2* this, PlayState* play) { s32 animation = ARRAY_COUNT(sAnimationInfo); if ((this->actor.params & 0x1F) == GORON_CITY_LINK) { @@ -1457,12 +1456,12 @@ void EnGo2_GoronLinkAnimation(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_GoronFireCamera(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GoronFireCamera(EnGo2* this, PlayState* play) { s16 yaw; - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); Path_CopyLastPoint(this->path, &this->subCamAt); yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->subCamAt) + 0xE38; this->subCamEye.x = Math_SinS(yaw) * 100.0f + this->actor.world.pos.x; @@ -1471,12 +1470,12 @@ void EnGo2_GoronFireCamera(EnGo2* this, GlobalContext* globalCtx) { this->subCamAt.x = this->actor.world.pos.x; this->subCamAt.y = this->actor.world.pos.y + 40.0f; this->subCamAt.z = this->actor.world.pos.z; - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } -void EnGo2_GoronFireClearCamera(EnGo2* this, GlobalContext* globalCtx) { - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); - Play_ClearCamera(globalCtx, this->subCamId); +void EnGo2_GoronFireClearCamera(EnGo2* this, PlayState* play) { + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->subCamId); } void EnGo2_BiggoronAnimation(EnGo2* this) { @@ -1489,14 +1488,14 @@ void EnGo2_BiggoronAnimation(EnGo2* this) { } } -void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGo2_Init(Actor* thisx, PlayState* play) { EnGo2* this = (EnGo2*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); // Not GORON_CITY_ROLLING_BIG, GORON_CITY_LINK, GORON_DMT_BIGGORON @@ -1528,7 +1527,7 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { this->waypoint = 0; this->unk_216 = this->actor.shape.rot.z; this->unk_26E = 1; - this->path = Path_GetByIndex(globalCtx, (this->actor.params & 0x3E0) >> 5, 0x1F); + this->path = Path_GetByIndex(play, (this->actor.params & 0x3E0) >> 5, 0x1F); switch (this->actor.params & 0x1F) { case GORON_CITY_ENTRANCE: case GORON_CITY_ISLAND: @@ -1544,7 +1543,7 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { if ((LINK_IS_ADULT) || !CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { Actor_Kill(&this->actor); } - EnGo2_GetItemAnimation(this, globalCtx); + EnGo2_GetItemAnimation(this, play); break; case GORON_CITY_LINK: if (GET_INFTABLE(INFTABLE_109)) { @@ -1552,24 +1551,24 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.home.pos = this->actor.world.pos; if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { - EnGo2_GetItemAnimation(this, globalCtx); + EnGo2_GetItemAnimation(this, play); } else { this->actionFunc = EnGo2_CurledUp; } } else { CLEAR_INFTABLE(INFTABLE_10C); this->collider.dim.height = (D_80A4816C[this->actor.params & 0x1F].height * 0.6f); - EnGo2_SetupRolling(this, globalCtx); + EnGo2_SetupRolling(this, play); this->isAwake = true; } break; case GORON_CITY_ROLLING_BIG: case GORON_DMT_ROLLING_SMALL: this->collider.dim.height = (D_80A4816C[this->actor.params & 0x1F].height * 0.6f); - EnGo2_SetupRolling(this, globalCtx); + EnGo2_SetupRolling(this, play); break; case GORON_FIRE_GENERIC: - if (Flags_GetSwitch(globalCtx, (this->actor.params & 0xFC00) >> 0xA)) { + if (Flags_GetSwitch(play, (this->actor.params & 0xFC00) >> 0xA)) { Actor_Kill(&this->actor); } else { this->isAwake = true; @@ -1599,17 +1598,17 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGo2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGo2_Destroy(Actor* thisx, PlayState* play) { } -void EnGo2_CurledUp(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_CurledUp(EnGo2* this, PlayState* play) { u8 index = this->actor.params & 0x1F; s16 height; s32 quake; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { - quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, -0x3CB0); Quake_SetQuakeValues(quake, 8, 0, 0, 0); Quake_SetCountdown(quake, 16); @@ -1627,25 +1626,25 @@ void EnGo2_CurledUp(EnGo2* this, GlobalContext* globalCtx) { ((D_80A4816C[index].height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.startFrame)) + (height * 0.6f)); } - if (EnGo2_IsFreeingGoronInFire(this, globalCtx)) { + if (EnGo2_IsFreeingGoronInFire(this, play)) { this->isAwake = false; - EnGo2_WakeUp(this, globalCtx); + EnGo2_WakeUp(this, play); } if (((this->actor.params & 0x1F) != GORON_FIRE_GENERIC) && EnGo2_IsWakingUp(this)) { - EnGo2_WakeUp(this, globalCtx); + EnGo2_WakeUp(this, play); } } -void func_80A46B40(EnGo2* this, GlobalContext* globalCtx) { +void func_80A46B40(EnGo2* this, PlayState* play) { u8 index = (this->actor.params & 0x1F); f32 height; if (this->unk_211 == true) { EnGo2_BiggoronAnimation(this); - EnGo2_GoronLinkAnimation(this, globalCtx); + EnGo2_GoronLinkAnimation(this, play); EnGo2_SelectGoronWakingUp(this); - if (!EnGo2_IsGoronRollingBig(this, globalCtx) && !EnGo2_IsGoronFireGeneric(this)) { + if (!EnGo2_IsGoronRollingBig(this, play) && !EnGo2_IsGoronFireGeneric(this)) { if (EnGo2_IsGoronDmtBombFlower(this)) { return; } @@ -1666,30 +1665,30 @@ void func_80A46B40(EnGo2* this, GlobalContext* globalCtx) { (s16)((height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.endFrame)) + (height * 0.6f)); } } - if ((!EnGo2_IsCameraModified(this, globalCtx)) && (!EnGo2_IsWakingUp(this))) { - EnGo2_RollingAnimation(this, globalCtx); + if ((!EnGo2_IsCameraModified(this, play)) && (!EnGo2_IsWakingUp(this))) { + EnGo2_RollingAnimation(this, play); } } -void EnGo2_GoronDmtBombFlowerAnimation(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GoronDmtBombFlowerAnimation(EnGo2* this, PlayState* play) { f32 float1 = this->skelAnime.endFrame; f32 float2 = this->skelAnime.curFrame * ((f32)0x8000 / float1); this->actor.speedXZ = Math_SinS(float2); - if ((EnGo2_Orient(this, globalCtx)) && (this->waypoint == 0)) { - EnGo2_GetItemAnimation(this, globalCtx); + if ((EnGo2_Orient(this, play)) && (this->waypoint == 0)) { + EnGo2_GetItemAnimation(this, play); } } -void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnGo2_GetDustData(this, 1); this->skelAnime.playSpeed = 0.0f; - EnGo2_SetupRolling(this, globalCtx); + EnGo2_SetupRolling(this, play); } } -void EnGo2_ContinueRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_ContinueRolling(EnGo2* this, PlayState* play) { f32 float1 = 1000.0f; if (((this->actor.params & 0x1F) != GORON_DMT_ROLLING_SMALL || !(this->actor.xyzDistToPlayerSq > SQ(float1))) && @@ -1700,7 +1699,7 @@ void EnGo2_ContinueRolling(EnGo2* this, GlobalContext* globalCtx) { EnGo2_GetDustData(this, 2); } -void EnGo2_SlowRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_SlowRolling(EnGo2* this, PlayState* play) { s32 orientation; s32 index; @@ -1712,15 +1711,15 @@ void EnGo2_SlowRolling(EnGo2* this, GlobalContext* globalCtx) { } EnGo2_GetDustData(this, 3); } - orientation = EnGo2_Orient(this, globalCtx); + orientation = EnGo2_Orient(this, play); index = this->actor.params & 0x1F; if (index != GORON_CITY_LINK) { if ((index == GORON_DMT_ROLLING_SMALL) && (orientation == 1) && (this->waypoint == 0)) { - EnGo2_StopRolling(this, globalCtx); + EnGo2_StopRolling(this, play); return; } } else if ((orientation == 2) && (this->waypoint == 1)) { - EnGo2_StopRolling(this, globalCtx); + EnGo2_StopRolling(this, play); return; } Math_ApproachF(&this->actor.speedXZ, EnGo2_GetTargetXZSpeed(this), 0.4f, 0.6f); @@ -1728,7 +1727,7 @@ void EnGo2_SlowRolling(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_GroundRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_GroundRolling(EnGo2* this, PlayState* play) { if (EnGo2_IsRollingOnGround(this, 4, 8.0f, 0)) { EnGo2_GetDustData(this, 0); if (this->unk_59C == 0) { @@ -1738,7 +1737,7 @@ void EnGo2_GroundRolling(EnGo2* this, GlobalContext* globalCtx) { this->actionFunc = EnGo2_GoronLinkStopRolling; break; case GORON_CITY_ROLLING_BIG: - EnGo2_WakeUp(this, globalCtx); + EnGo2_WakeUp(this, play); break; default: this->actionFunc = EnGo2_CurledUp; @@ -1747,7 +1746,7 @@ void EnGo2_GroundRolling(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_ReverseRolling(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_ReverseRolling(EnGo2* this, PlayState* play) { if (!EnGo2_IsRolling(this)) { Math_ApproachF(&this->actor.speedXZ, 0.0f, 0.6f, 0.8f); if (this->actor.speedXZ >= 1.0f) { @@ -1757,40 +1756,40 @@ void EnGo2_ReverseRolling(EnGo2* this, GlobalContext* globalCtx) { this->actor.world.rot.y ^= 0x8000; this->actor.shape.rot.y = this->actor.world.rot.y; this->reverse ^= 1; - EnGo2_UpdateWaypoint(this, globalCtx); - EnGo2_SetupRolling(this, globalCtx); + EnGo2_UpdateWaypoint(this, play); + EnGo2_SetupRolling(this, play); } } } -void EnGo2_SetupGetItem(EnGo2* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnGo2_SetupGetItem(EnGo2* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnGo2_SetGetItem; } else { - func_8002F434(&this->actor, globalCtx, this->getItemId, this->actor.xzDistToPlayer + 1.0f, + func_8002F434(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } } -void EnGo2_SetGetItem(EnGo2* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnGo2_SetGetItem(EnGo2* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->unk_194.unk_00 = 0; switch (this->getItemId) { case GI_CLAIM_CHECK: Environment_ClearBgsDayCount(); - EnGo2_GetItemAnimation(this, globalCtx); + EnGo2_GetItemAnimation(this, play); return; case GI_TUNIC_GORON: SET_INFTABLE(INFTABLE_109); - EnGo2_GetItemAnimation(this, globalCtx); + EnGo2_GetItemAnimation(this, play); return; case GI_SWORD_BGS: gSaveContext.bgsFlag = true; break; case GI_BOMB_BAG_30: case GI_BOMB_BAG_40: - EnGo2_RollingAnimation(this, globalCtx); + EnGo2_RollingAnimation(this, play); this->actionFunc = EnGo2_GoronRollingBigContinueRolling; return; } @@ -1798,7 +1797,7 @@ void EnGo2_SetGetItem(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { +void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { switch (this->goronState) { case 0: Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_5); @@ -1810,18 +1809,18 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { this->unk_20C = 0; this->goronState++; func_800F483C(0x28, 5); - OnePointCutscene_Init(globalCtx, 4190, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4190, -99, &this->actor, CAM_ID_MAIN); break; case 1: if (DECR(this->animTimer)) { if (this->animTimer == 60 || this->animTimer == 120) { - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); func_800F4524(&gSfxDefaultPos, NA_SE_EV_GORON_WATER_DROP, 60); } } else { func_800F4524(&gSfxDefaultPos, NA_SE_EN_GOLON_GOOD_BIG, 60); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_6); - Message_ContinueTextbox(globalCtx, 0x305A); + Message_ContinueTextbox(play, 0x305A); this->eyeMouthTexState = 3; this->goronState++; func_800F483C(0x7F, 5); @@ -1831,13 +1830,13 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->eyeMouthTexState = 0; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); this->actor.flags |= ACTOR_FLAG_0; this->unk_26E = 2; this->skelAnime.playSpeed = 0.0f; this->skelAnime.curFrame = this->skelAnime.endFrame; - EnGo2_GetItem(this, globalCtx, GI_CLAIM_CHECK); + EnGo2_GetItem(this, play, GI_CLAIM_CHECK); this->actionFunc = EnGo2_SetupGetItem; this->goronState = 0; } @@ -1845,15 +1844,15 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->goronState) { case 0: - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { return; } else { - Message_StartTextbox(globalCtx, 0x3031, NULL); + Message_StartTextbox(play, 0x3031, NULL); player->actor.freezeTimer = 10; this->goronState++; } @@ -1863,7 +1862,7 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx) { return; } - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_CLOSING) { player->actor.freezeTimer = 10; } else { SET_INFTABLE(INFTABLE_10C); @@ -1874,15 +1873,15 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3s D_80A4854C = { 0x00, 0x00, 0x00 }; switch (this->goronState) { case 0: // Wake up - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { - EnGo2_GoronFireCamera(this, globalCtx); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { + EnGo2_GoronFireCamera(this, play); + play->msgCtx.msgMode = MSGMODE_PAUSED; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_2); this->waypoint = 1; this->skelAnime.playSpeed = 2.0f; @@ -1901,7 +1900,7 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) { (f32)((Math_SinS(this->actor.world.rot.y) * -30.0f) + this->actor.world.pos.x); player->actor.world.pos.z = (f32)((Math_CosS(this->actor.world.rot.y) * -30.0f) + this->actor.world.pos.z); - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); Audio_PlayFanfare(NA_BGM_APPEAR); } break; @@ -1931,14 +1930,14 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_IRON_DOOR_OPEN); } if (this->animTimer > 44) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_IRON_DOOR_CLOSE); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_IRON_DOOR_CLOSE); } else { break; } case 4: // Finalize walking away - Message_CloseTextbox(globalCtx); - EnGo2_GoronFireClearCamera(this, globalCtx); - func_8002DF54(globalCtx, &this->actor, 7); + Message_CloseTextbox(play); + EnGo2_GoronFireClearCamera(this, play); + func_8002DF54(play, &this->actor, 7); Actor_Kill(&this->actor); break; case 1: @@ -1946,59 +1945,59 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) { } } -void EnGo2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGo2_Update(Actor* thisx, PlayState* play) { EnGo2* this = (EnGo2*)thisx; func_80A45360(this, &this->alpha); EnGo2_SitDownAnimation(this); SkelAnime_Update(&this->skelAnime); EnGo2_RollForward(this); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, (f32)this->collider.dim.height * 0.5f, + Actor_UpdateBgCheckInfo(play, &this->actor, (f32)this->collider.dim.height * 0.5f, (f32)this->collider.dim.radius * 0.6f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if (this->unk_194.unk_00 == 0) { - func_80A44AB0(this, globalCtx); + func_80A44AB0(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_211 == true) { - func_80034F54(globalCtx, this->unk_226, this->unk_24A, 18); + func_80034F54(play, this->unk_226, this->unk_24A, 18); } - func_80A45288(this, globalCtx); + func_80A45288(this, play); EnGo2_EyeMouthTexState(this); - EnGo2_CheckCollision(this, globalCtx); + EnGo2_CheckCollision(this, play); } -s32 EnGo2_DrawCurledUp(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_DrawCurledUp(EnGo2* this, PlayState* play) { Vec3f D_80A48554 = { 0.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go2.c", 2881); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go2.c", 2884), + OPEN_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2881); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go2.c", 2884), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00BD80); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go2.c", 2889); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2889); Matrix_MultVec3f(&D_80A48554, &this->actor.focus.pos); return 1; } -s32 EnGo2_DrawRolling(EnGo2* this, GlobalContext* globalCtx) { +s32 EnGo2_DrawRolling(EnGo2* this, PlayState* play) { s32 pad; Vec3f D_80A48560 = { 0.0f, 0.0f, 0.0f }; f32 speedXZ; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go2.c", 2914); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2914); + func_80093D18(play->state.gfxCtx); speedXZ = this->actionFunc == EnGo2_ReverseRolling ? 0.0f : this->actor.speedXZ; - Matrix_RotateZYX((globalCtx->state.frames * ((s16)speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go2.c", 2926), + Matrix_RotateZYX((play->state.frames * ((s16)speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go2.c", 2926), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00C140); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go2.c", 2930); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2930); Matrix_MultVec3f(&D_80A48560, &this->actor.focus.pos); return 1; } -s32 EnGo2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGo2_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGo2* this = (EnGo2*)thisx; Vec3s vec1; f32 float1; @@ -2028,7 +2027,7 @@ s32 EnGo2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3 return 0; } -void EnGo2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnGo2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnGo2* this = (EnGo2*)thisx; Vec3f D_80A4856C = { 600.0f, 0.0f, 0.0f }; @@ -2037,32 +2036,32 @@ void EnGo2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnGo2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGo2_Draw(Actor* thisx, PlayState* play) { EnGo2* this = (EnGo2*)thisx; void* eyeTextures[] = { gGoronCsEyeClosed2Tex, gGoronCsEyeOpenTex, gGoronCsEyeHalfTex, gGoronCsEyeClosedTex }; void* mouthTextures[] = { gGoronCsMouthNeutralTex, gGoronCsMouthSmileTex }; EnGo2_UpdateEffects(this); Matrix_Push(); - EnGo2_DrawEffects(this, globalCtx); + EnGo2_DrawEffects(this, play); Matrix_Pop(); if ((this->actionFunc == EnGo2_CurledUp) && (this->skelAnime.playSpeed == 0.0f) && (this->skelAnime.curFrame == 0.0f)) { if (1) {} - EnGo2_DrawCurledUp(this, globalCtx); + EnGo2_DrawCurledUp(this, play); } else if (this->actionFunc == EnGo2_SlowRolling || this->actionFunc == EnGo2_ReverseRolling || this->actionFunc == EnGo2_ContinueRolling) { - EnGo2_DrawRolling(this, globalCtx); + EnGo2_DrawRolling(this, play); } else { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go2.c", 3063); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_go2.c", 3063); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnGo2_OverrideLimbDraw, EnGo2_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go2.c", 3081); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGo2_OverrideLimbDraw, EnGo2_PostLimbDraw, this); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2.c", 3081); } } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 83e50e6ecf..e6580cd26d 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -7,7 +7,7 @@ struct EnGo2; -typedef void (*EnGo2ActionFunc)(struct EnGo2*, GlobalContext*); +typedef void (*EnGo2ActionFunc)(struct EnGo2*, PlayState*); typedef enum { /* 0x00 */ GORON_CITY_ROLLING_BIG, diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c index a8957b3272..55c8577110 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -6,33 +6,33 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnGoma_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGoma_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGoma_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGoma_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGoma_Init(Actor* thisx, PlayState* play); +void EnGoma_Destroy(Actor* thisx, PlayState* play); +void EnGoma_Update(Actor* thisx, PlayState* play); +void EnGoma_Draw(Actor* thisx, PlayState* play); -void EnGoma_Flee(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Egg(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Hatch(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Hurt(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Die(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Dead(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_PrepareJump(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Land(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Jump(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Stand(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_ChasePlayer(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Stunned(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_LookAtPlayer(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_UpdateHit(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_Debris(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_SpawnHatchDebris(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_BossLimb(EnGoma* this, GlobalContext* globalCtx); +void EnGoma_Flee(EnGoma* this, PlayState* play); +void EnGoma_EggFallToGround(EnGoma* this, PlayState* play); +void EnGoma_Egg(EnGoma* this, PlayState* play); +void EnGoma_Hatch(EnGoma* this, PlayState* play); +void EnGoma_Hurt(EnGoma* this, PlayState* play); +void EnGoma_Die(EnGoma* this, PlayState* play); +void EnGoma_Dead(EnGoma* this, PlayState* play); +void EnGoma_PrepareJump(EnGoma* this, PlayState* play); +void EnGoma_Land(EnGoma* this, PlayState* play); +void EnGoma_Jump(EnGoma* this, PlayState* play); +void EnGoma_Stand(EnGoma* this, PlayState* play); +void EnGoma_ChasePlayer(EnGoma* this, PlayState* play); +void EnGoma_Stunned(EnGoma* this, PlayState* play); +void EnGoma_LookAtPlayer(EnGoma* this, PlayState* play); +void EnGoma_UpdateHit(EnGoma* this, PlayState* play); +void EnGoma_Debris(EnGoma* this, PlayState* play); +void EnGoma_SpawnHatchDebris(EnGoma* this, PlayState* play); +void EnGoma_BossLimb(EnGoma* this, PlayState* play); void EnGoma_SetupFlee(EnGoma* this); -void EnGoma_SetupHatch(EnGoma* this, GlobalContext* globalCtx); -void EnGoma_SetupHurt(EnGoma* this, GlobalContext* globalCtx); +void EnGoma_SetupHatch(EnGoma* this, PlayState* play); +void EnGoma_SetupHurt(EnGoma* this, PlayState* play); void EnGoma_SetupDie(EnGoma* this); void EnGoma_SetupDead(EnGoma* this); void EnGoma_SetupStand(EnGoma* this); @@ -40,7 +40,7 @@ void EnGoma_SetupChasePlayer(EnGoma* this); void EnGoma_SetupPrepareJump(EnGoma* this); void EnGoma_SetupLand(EnGoma* this); void EnGoma_SetupJump(EnGoma* this); -void EnGoma_SetupStunned(EnGoma* this, GlobalContext* globalCtx); +void EnGoma_SetupStunned(EnGoma* this, PlayState* play); const ActorInit En_Goma_InitVars = { ACTOR_BOSS_GOMA, @@ -104,7 +104,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 20, ICHAIN_STOP), }; -void EnGoma_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGoma_Init(Actor* thisx, PlayState* play) { EnGoma* this = (EnGoma*)thisx; s16 params; @@ -114,7 +114,7 @@ void EnGoma_Init(Actor* thisx, GlobalContext* globalCtx) { params = this->actor.params; if (params >= 100) { // piece of boss goma - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_BOSS); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS); this->actionFunc = EnGoma_BossLimb; this->gomaType = ENGOMA_BOSSLIMB; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); @@ -136,7 +136,7 @@ void EnGoma_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); } else { // Egg ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); - SkelAnime_Init(globalCtx, &this->skelanime, &gObjectGolSkel, &gObjectGolStandAnim, this->jointTable, + SkelAnime_Init(play, &this->skelanime, &gObjectGolSkel, &gObjectGolStandAnim, this->jointTable, this->morphTable, GOMA_LIMB_MAX); Animation_PlayLoop(&this->skelanime, &gObjectGolStandAnim); this->actor.colChkInfo.health = 2; @@ -162,19 +162,19 @@ void EnGoma_Init(Actor* thisx, GlobalContext* globalCtx) { this->eggScale = 1.0f; this->eggSquishAngle = Rand_ZeroOne() * 1000.0f; this->actionTimer = 50; - Collider_InitCylinder(globalCtx, &this->colCyl1); - Collider_SetCylinder(globalCtx, &this->colCyl1, &this->actor, &D_80A4B7A0); - Collider_InitCylinder(globalCtx, &this->colCyl2); - Collider_SetCylinder(globalCtx, &this->colCyl2, &this->actor, &D_80A4B7CC); + Collider_InitCylinder(play, &this->colCyl1); + Collider_SetCylinder(play, &this->colCyl1, &this->actor, &D_80A4B7A0); + Collider_InitCylinder(play, &this->colCyl2); + Collider_SetCylinder(play, &this->colCyl2, &this->actor, &D_80A4B7CC); } } -void EnGoma_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGoma_Destroy(Actor* thisx, PlayState* play) { EnGoma* this = (EnGoma*)thisx; if (this->actor.params < 10) { - Collider_DestroyCylinder(globalCtx, &this->colCyl1); - Collider_DestroyCylinder(globalCtx, &this->colCyl2); + Collider_DestroyCylinder(play, &this->colCyl1); + Collider_DestroyCylinder(play, &this->colCyl2); } } @@ -191,11 +191,11 @@ void EnGoma_SetupFlee(EnGoma* this) { } } -void EnGoma_Flee(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Flee(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachF(&this->actor.speedXZ, 20.0f / 3.0f, 0.5f, 2.0f); - Math_ApproachS(&this->actor.world.rot.y, - Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) + 0x8000, 3, 2000); + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) + 0x8000, + 3, 2000); Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 2, 3000); if (this->actionTimer == 0) { @@ -203,7 +203,7 @@ void EnGoma_Flee(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_EggFallToGround(EnGoma* this, PlayState* play) { this->actor.gravity = -1.3f; this->eggSquishAccel += 0.03f; this->eggSquishAngle += 1.0f + this->eggSquishAccel; @@ -220,7 +220,7 @@ void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx) { } if (this->actor.params > 5) { - EnGoma_SetupHatch(this, globalCtx); + EnGoma_SetupHatch(this, play); } else { this->hatchState = 1; this->actionTimer = 3; @@ -253,7 +253,7 @@ void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx) { case 3: Math_ApproachF(&this->eggScale, 1.0f, 0.1f, 0.1f); if (this->actionTimer == 0) { - EnGoma_SetupHatch(this, globalCtx); + EnGoma_SetupHatch(this, play); } break; } @@ -265,8 +265,8 @@ void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnGoma_Egg(EnGoma* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGoma_Egg(EnGoma* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; this->eggSquishAngle += 1.0f; @@ -289,41 +289,41 @@ void EnGoma_Egg(EnGoma* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(30.0f) + this->actor.world.pos.x; pos.y = Rand_ZeroFloat(30.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; - EffectSsHahen_Spawn(globalCtx, &pos, &vel, &acc, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, HAHEN_OBJECT_DEFAULT, - 10, NULL); + EffectSsHahen_Spawn(play, &pos, &vel, &acc, 0, (s16)(Rand_ZeroOne() * 5.0f) + 10, HAHEN_OBJECT_DEFAULT, 10, + NULL); } } } -void EnGoma_SetupHatch(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_SetupHatch(EnGoma* this, PlayState* play) { Animation_Change(&this->skelanime, &gObjectGolJumpHeadbuttAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gObjectGolJumpHeadbuttAnim), ANIMMODE_ONCE, 0.0f); this->actionFunc = EnGoma_Hatch; Actor_SetScale(&this->actor, 0.005f); this->gomaType = ENGOMA_NORMAL; this->actionTimer = 5; - this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); this->actor.world.rot.y = this->actor.shape.rot.y; - EnGoma_SpawnHatchDebris(this, globalCtx); + EnGoma_SpawnHatchDebris(this, play); this->eggScale = 1.0f; this->actor.speedXZ = 0.0f; } -void EnGoma_Hatch(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Hatch(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actionTimer == 0) { EnGoma_SetupStand(this); } } -void EnGoma_SetupHurt(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_SetupHurt(EnGoma* this, PlayState* play) { Animation_Change(&this->skelanime, &gObjectGolDamagedAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gObjectGolDamagedAnim), ANIMMODE_ONCE, -2.0f); this->actionFunc = EnGoma_Hurt; if ((s8)this->actor.colChkInfo.health <= 0) { this->actionTimer = 5; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { this->actionTimer = 10; } @@ -337,7 +337,7 @@ void EnGoma_SetupHurt(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_Hurt(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Hurt(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { @@ -369,7 +369,7 @@ void EnGoma_SetupDie(EnGoma* this) { this->actor.flags &= ~ACTOR_FLAG_0; } -void EnGoma_Die(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Die(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { @@ -396,7 +396,7 @@ void EnGoma_SetupDead(EnGoma* this) { this->actionTimer = 3; } -void EnGoma_Dead(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Dead(EnGoma* this, PlayState* play) { Vec3f accel; Vec3f pos; @@ -409,7 +409,7 @@ void EnGoma_Dead(EnGoma* this, GlobalContext* globalCtx) { pos.z = this->actor.world.pos.z; accel = sDeadEffectVel; accel.y = 0.03f; - EffectSsKFire_Spawn(globalCtx, &pos, &sDeadEffectVel, &accel, 40, 0); + EffectSsKFire_Spawn(play, &pos, &sDeadEffectVel, &accel, 40, 0); } if (this->actionTimer == 0 && Math_SmoothStepToF(&this->actor.scale.y, 0.0f, 0.5f, 0.00225f, 0.00001f) <= 0.001f) { @@ -421,7 +421,7 @@ void EnGoma_Dead(EnGoma* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_EN_EXTINCT, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); Actor_Kill(&this->actor); - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x30); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x30); } this->visualState = 2; } @@ -450,13 +450,13 @@ void EnGoma_SetupPrepareJump(EnGoma* this) { this->actionTimer = 30; } -void EnGoma_PrepareJump(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_PrepareJump(EnGoma* this, PlayState* play) { s16 targetAngle; SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); - targetAngle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + targetAngle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); Math_ApproachS(&this->actor.world.rot.y, targetAngle, 2, 4000); Math_ApproachS(&this->actor.shape.rot.y, targetAngle, 2, 3000); @@ -473,7 +473,7 @@ void EnGoma_SetupLand(EnGoma* this) { this->actionTimer = 10; } -void EnGoma_Land(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Land(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { @@ -497,7 +497,7 @@ void EnGoma_SetupJump(EnGoma* this) { } } -void EnGoma_Jump(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Jump(EnGoma* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_24; SkelAnime_Update(&this->skelanime); Math_ApproachF(&this->actor.speedXZ, 10.0f, 0.5f, 5.0f); @@ -513,10 +513,10 @@ void EnGoma_Jump(EnGoma* this, GlobalContext* globalCtx) { this->visualState = 0; } -void EnGoma_Stand(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Stand(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); - Math_ApproachS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, + Math_ApproachS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor), 2, 3000); if (this->actionTimer == 0) { @@ -524,7 +524,7 @@ void EnGoma_Stand(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_ChasePlayer(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_ChasePlayer(EnGoma* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 5.0f)) { @@ -547,7 +547,7 @@ void EnGoma_ChasePlayer(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_SetupStunned(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_SetupStunned(EnGoma* this, PlayState* play) { this->actionFunc = EnGoma_Stunned; this->stunTimer = 100; Animation_MorphToLoop(&this->skelanime, &gObjectGolStandAnim, -5.0f); @@ -560,7 +560,7 @@ void EnGoma_SetupStunned(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_Stunned(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Stunned(EnGoma* this, PlayState* play) { Actor_SetColorFilter(&this->actor, 0, 180, 0, 2); this->visualState = 2; @@ -586,12 +586,12 @@ void EnGoma_Stunned(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_LookAtPlayer(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_LookAtPlayer(EnGoma* this, PlayState* play) { s16 eyePitch; s16 eyeYaw; - eyeYaw = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.y; - eyePitch = Actor_WorldPitchTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.x; + eyeYaw = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.shape.rot.y; + eyePitch = Actor_WorldPitchTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.shape.rot.x; if (eyeYaw > 6000) { eyeYaw = 6000; @@ -603,9 +603,9 @@ void EnGoma_LookAtPlayer(EnGoma* this, GlobalContext* globalCtx) { Math_ApproachS(&this->eyePitch, eyePitch, 3, 2000); } -void EnGoma_UpdateHit(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_UpdateHit(EnGoma* this, PlayState* play) { static Vec3f sShieldKnockbackVel = { 0.0f, 0.0f, 20.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->hurtTimer != 0) { this->hurtTimer--; @@ -638,20 +638,20 @@ void EnGoma_UpdateHit(EnGoma* this, GlobalContext* globalCtx) { } } else if (dmgFlags & 1) { // stun if (this->actionFunc != EnGoma_Stunned) { - EnGoma_SetupStunned(this, globalCtx); + EnGoma_SetupStunned(this, play); this->hurtTimer = 8; } } else { swordDamage = CollisionCheck_GetSwordDamage(dmgFlags); if (swordDamage) { - EffectSsSibuki_SpawnBurst(globalCtx, &this->actor.focus.pos); + EffectSsSibuki_SpawnBurst(play, &this->actor.focus.pos); } else { swordDamage = 1; } this->actor.colChkInfo.health -= swordDamage; - EnGoma_SetupHurt(this, globalCtx); + EnGoma_SetupHurt(this, play); Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 5); this->hurtTimer = 13; } @@ -663,7 +663,7 @@ void EnGoma_UpdateHit(EnGoma* this, GlobalContext* globalCtx) { parent->childrenGohmaState[this->actor.params] = -1; } - EnGoma_SpawnHatchDebris(this, globalCtx); + EnGoma_SpawnHatchDebris(this, play); Actor_Kill(&this->actor); } } @@ -696,10 +696,10 @@ void EnGoma_SetFloorRot(EnGoma* this) { } } -void EnGoma_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGoma_Update(Actor* thisx, PlayState* play) { EnGoma* this = (EnGoma*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->actionTimer != 0) { this->actionTimer--; @@ -708,7 +708,7 @@ void EnGoma_Update(Actor* thisx, GlobalContext* globalCtx) { this->invincibilityTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); this->actor.world.pos.x = this->actor.world.pos.x + this->shieldKnockbackVel.x; this->actor.world.pos.z = this->actor.world.pos.z + this->shieldKnockbackVel.z; @@ -720,12 +720,12 @@ void EnGoma_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.scale.x, 0.01f, 0.5f, 0.00075f, 0.000001f); Math_SmoothStepToF(&this->actor.scale.y, 0.01f, 0.5f, 0.00075f, 0.000001f); Math_SmoothStepToF(&this->actor.scale.z, 0.01f, 0.5f, 0.00075f, 0.000001f); - EnGoma_UpdateHit(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, + EnGoma_UpdateHit(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); EnGoma_SetFloorRot(this); Actor_SetFocus(&this->actor, 20.0f); - EnGoma_LookAtPlayer(this, globalCtx); + EnGoma_LookAtPlayer(this, play); EnGoma_UpdateEyeEnvColor(this); this->visualState = 1; if (player->meleeWeaponState != 0) { @@ -740,17 +740,17 @@ void EnGoma_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->invincibilityTimer == 0) { Collider_UpdateCylinder(&this->actor, &this->colCyl1); Collider_UpdateCylinder(&this->actor, &this->colCyl2); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colCyl1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCyl2.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colCyl1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCyl1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCyl2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colCyl1.base); } } } -s32 EnGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGoma_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGoma* this = (EnGoma*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_goma.c", 1976); + OPEN_DISPS(play->state.gfxCtx, "../z_en_goma.c", 1976); gDPSetEnvColor(POLY_OPA_DISP++, (s16)this->eyeEnvColor[0], (s16)this->eyeEnvColor[1], (s16)this->eyeEnvColor[2], 255); @@ -762,7 +762,7 @@ s32 EnGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList (s16)(Rand_ZeroOne() * 255.0f), 255); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_goma.c", 2011); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_goma.c", 2011); return 0; } @@ -778,20 +778,20 @@ Gfx* EnGoma_NoBackfaceCullingDlist(GraphicsContext* gfxCtx) { return dList; } -void EnGoma_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGoma_Draw(Actor* thisx, PlayState* play) { EnGoma* this = (EnGoma*)thisx; s32 y; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_goma.c", 2040); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_goma.c", 2040); + func_80093D18(play->state.gfxCtx); switch (this->gomaType) { case ENGOMA_NORMAL: this->actor.naviEnemyId = NAVI_ENEMY_GOHMA_LARVA; Matrix_Translate(this->actor.world.pos.x, - this->actor.world.pos.y + ((this->actor.shape.yOffset * this->actor.scale.y) + - globalCtx->mainCamera.skyboxOffset.y), + this->actor.world.pos.y + + ((this->actor.shape.yOffset * this->actor.scale.y) + play->mainCamera.skyboxOffset.y), this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateX(BINANG_TO_RAD_ALT(this->slopePitch), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(this->slopeRoll), MTXMODE_APPLY); @@ -799,15 +799,15 @@ void EnGoma_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX(BINANG_TO_RAD_ALT(this->actor.shape.rot.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(this->actor.shape.rot.z), MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, EnGoma_OverrideLimbDraw, - NULL, this); + SkelAnime_DrawOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, EnGoma_OverrideLimbDraw, NULL, + this); break; case ENGOMA_EGG: this->actor.naviEnemyId = NAVI_ENEMY_GOHMA_EGG; y = (s16)(sinf((this->eggTimer * 5.0f * 3.1415f) / 180.0f) * 31.9f); y = (s16)(y + 31); - gSPSegment(POLY_OPA_DISP++, 0x08, func_80094E78(globalCtx->state.gfxCtx, 0, y)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80094E78(play->state.gfxCtx, 0, y)); Matrix_Push(); Matrix_Scale(this->eggScale, 1.0f / this->eggScale, this->eggScale, MTXMODE_APPLY); Matrix_RotateY(this->eggSquishAngle * 0.15f, MTXMODE_APPLY); @@ -818,31 +818,31 @@ void EnGoma_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(-(this->eggSquishAngle * 0.15f), MTXMODE_APPLY); Matrix_Translate(0.0f, this->eggYOffset, 0.0f, MTXMODE_APPLY); Matrix_RotateX(this->eggPitch, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_goma.c", 2101), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_goma.c", 2101), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gObjectGolEggDL); Matrix_Pop(); break; case ENGOMA_HATCH_DEBRIS: - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_goma.c", 2107), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_goma.c", 2107), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBrownFragmentDL); break; case ENGOMA_BOSSLIMB: if (this->bossLimbDL != NULL) { - gSPSegment(POLY_OPA_DISP++, 0x08, EnGoma_NoBackfaceCullingDlist(globalCtx->state.gfxCtx)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_goma.c", 2114), + gSPSegment(POLY_OPA_DISP++, 0x08, EnGoma_NoBackfaceCullingDlist(play->state.gfxCtx)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_goma.c", 2114), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->bossLimbDL); } break; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_goma.c", 2119); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_goma.c", 2119); } -void EnGoma_Debris(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_Debris(EnGoma* this, PlayState* play) { this->actor.shape.rot.y += 2500; this->actor.shape.rot.x += 3500; if (this->actionTimer == 0) { @@ -850,26 +850,25 @@ void EnGoma_Debris(EnGoma* this, GlobalContext* globalCtx) { } } -void EnGoma_SpawnHatchDebris(EnGoma* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnGoma_SpawnHatchDebris(EnGoma* this, PlayState* play2) { + PlayState* play = play2; s16 i; if (this->actor.params < 6) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_GOMA_BJR_EGG2); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GOMA_BJR_EGG2); } else { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_GOMA_EGG2); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GOMA_EGG2); } for (i = 0; i < 15; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_GOMA, - Rand_CenteredFloat(10.0f) + this->actor.world.pos.x, - Rand_CenteredFloat(10.0f) + this->actor.world.pos.y + 15.0f, - Rand_CenteredFloat(10.0f) + this->actor.world.pos.z, 0, Rand_CenteredFloat(0x10000 - 0.01f), - 0, i + 10); + Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_EN_GOMA, Rand_CenteredFloat(10.0f) + this->actor.world.pos.x, + Rand_CenteredFloat(10.0f) + this->actor.world.pos.y + 15.0f, + Rand_CenteredFloat(10.0f) + this->actor.world.pos.z, 0, Rand_CenteredFloat(0x10000 - 0.01f), 0, i + 10); } } -void EnGoma_BossLimb(EnGoma* this, GlobalContext* globalCtx) { +void EnGoma_BossLimb(EnGoma* this, PlayState* play) { Vec3f vel = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 1.0f, 0.0f }; Color_RGBA8 primColor = { 255, 255, 255, 255 }; @@ -877,7 +876,7 @@ void EnGoma_BossLimb(EnGoma* this, GlobalContext* globalCtx) { Vec3f pos; this->actor.world.pos.y -= 5.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2); this->actor.world.pos.y += 5.0f; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { @@ -901,6 +900,6 @@ void EnGoma_BossLimb(EnGoma* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; pos.y = Rand_CenteredFloat(10.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - func_8002836C(globalCtx, &pos, &vel, &accel, &primColor, &envColor, 500, 10, 10); + func_8002836C(play, &pos, &vel, &accel, &primColor, &envColor, 500, 10, 10); } } diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.h b/src/overlays/actors/ovl_En_Goma/z_en_goma.h index bcce4b4d5f..b04162acad 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.h +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.h @@ -13,7 +13,7 @@ typedef enum { struct EnGoma; -typedef void (*EnGomaActionFunc)(struct EnGoma*, GlobalContext*); +typedef void (*EnGomaActionFunc)(struct EnGoma*, PlayState*); typedef enum { /* 0 */ GOMA_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index b50b06dac1..da912d1c49 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -12,7 +12,7 @@ #define FLAGS ACTOR_FLAG_4 -typedef s32 (*EnGoroiwaUnkFunc1)(EnGoroiwa* this, GlobalContext* globalCtx); +typedef s32 (*EnGoroiwaUnkFunc1)(EnGoroiwa* this, PlayState* play); typedef void (*EnGoroiwaUnkFunc2)(EnGoroiwa* this); #define ENGOROIWA_ENABLE_AT (1 << 0) @@ -26,21 +26,21 @@ typedef void (*EnGoroiwaUnkFunc2)(EnGoroiwa* this); #define ENGOROIWA_LOOPMODE_ONEWAY_BREAK 1 #define ENGOROIWA_LOOPMODE_ROUNDTRIP 3 -void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGoroiwa_Init(Actor* thisx, PlayState* play); +void EnGoroiwa_Destroy(Actor* thisx, PlayState* play); +void EnGoroiwa_Update(Actor* thisx, PlayState* play); +void EnGoroiwa_Draw(Actor* thisx, PlayState* play); void EnGoroiwa_SetupRoll(EnGoroiwa* this); -void EnGoroiwa_Roll(EnGoroiwa* this, GlobalContext* globalCtx); +void EnGoroiwa_Roll(EnGoroiwa* this, PlayState* play); void EnGoroiwa_SetupMoveAndFallToGround(EnGoroiwa* this); -void EnGoroiwa_MoveAndFallToGround(EnGoroiwa* this, GlobalContext* globalCtx); +void EnGoroiwa_MoveAndFallToGround(EnGoroiwa* this, PlayState* play); void EnGoroiwa_SetupWait(EnGoroiwa* this); -void EnGoroiwa_Wait(EnGoroiwa* this, GlobalContext* globalCtx); +void EnGoroiwa_Wait(EnGoroiwa* this, PlayState* play); void EnGoroiwa_SetupMoveUp(EnGoroiwa* this); -void EnGoroiwa_MoveUp(EnGoroiwa* this, GlobalContext* globalCtx); +void EnGoroiwa_MoveUp(EnGoroiwa* this, PlayState* play); void EnGoroiwa_SetupMoveDown(EnGoroiwa* this); -void EnGoroiwa_MoveDown(EnGoroiwa* this, GlobalContext* globalCtx); +void EnGoroiwa_MoveDown(EnGoroiwa* this, PlayState* play); const ActorInit En_Goroiwa_InitVars = { ACTOR_EN_GOROIWA, @@ -94,11 +94,11 @@ void EnGoroiwa_UpdateCollider(EnGoroiwa* this) { worldSphere->center.z = this->actor.world.pos.z; } -void EnGoroiwa_InitCollider(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_InitCollider(EnGoroiwa* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); EnGoroiwa_UpdateCollider(this); this->collider.elements[0].dim.worldSphere.radius = 58; } @@ -125,8 +125,8 @@ s32 EnGoroiwa_Vec3fNormalize(Vec3f* ret, Vec3f* a) { return true; } -void EnGoroiwa_SetSpeed(EnGoroiwa* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT04) { +void EnGoroiwa_SetSpeed(EnGoroiwa* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT04) { this->isInKokiri = true; R_EN_GOROIWA_SPEED = 920; } else { @@ -135,8 +135,8 @@ void EnGoroiwa_SetSpeed(EnGoroiwa* this, GlobalContext* globalCtx) { } } -void EnGoroiwa_FaceNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; +void EnGoroiwa_FaceNextWaypoint(EnGoroiwa* this, PlayState* play) { + Path* path = &play->setupPathList[this->actor.params & 0xFF]; Vec3s* nextPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Vec3f nextPosF; @@ -147,9 +147,9 @@ void EnGoroiwa_FaceNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &nextPosF); } -void EnGoroiwa_GetPrevWaypointDiff(EnGoroiwa* this, GlobalContext* globalCtx, Vec3f* dest) { +void EnGoroiwa_GetPrevWaypointDiff(EnGoroiwa* this, PlayState* play, Vec3f* dest) { s16 loopMode = (this->actor.params >> 8) & 3; - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; + Path* path = &play->setupPathList[this->actor.params & 0xFF]; s16 prevWaypoint = this->currentWaypoint - this->pathDirection; Vec3s* prevPointPos; Vec3s* currentPointPos; @@ -213,15 +213,15 @@ void EnGoroiwa_ReverseDirection(EnGoroiwa* this) { this->nextWaypoint += this->pathDirection; } -void EnGoroiwa_InitPath(EnGoroiwa* this, GlobalContext* globalCtx) { - this->endWaypoint = globalCtx->setupPathList[this->actor.params & 0xFF].count - 1; +void EnGoroiwa_InitPath(EnGoroiwa* this, PlayState* play) { + this->endWaypoint = play->setupPathList[this->actor.params & 0xFF].count - 1; this->currentWaypoint = 0; this->nextWaypoint = 1; this->pathDirection = 1; } -void EnGoroiwa_TeleportToWaypoint(EnGoroiwa* this, GlobalContext* globalCtx, s32 waypoint) { - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; +void EnGoroiwa_TeleportToWaypoint(EnGoroiwa* this, PlayState* play, s32 waypoint) { + Path* path = &play->setupPathList[this->actor.params & 0xFF]; Vec3s* pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + waypoint; this->actor.world.pos.x = pointPos->x; @@ -234,9 +234,9 @@ void EnGoroiwa_InitRotation(EnGoroiwa* this) { this->rollRotSpeed = 1.0f; } -s32 EnGoroiwa_GetAscendDirection(EnGoroiwa* this, GlobalContext* globalCtx) { +s32 EnGoroiwa_GetAscendDirection(EnGoroiwa* this, PlayState* play) { s32 pad; - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; + Path* path = &play->setupPathList[this->actor.params & 0xFF]; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Vec3s* currentPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->currentWaypoint; @@ -257,7 +257,7 @@ s32 EnGoroiwa_GetAscendDirection(EnGoroiwa* this, GlobalContext* globalCtx) { return 0; } -void EnGoroiwa_SpawnDust(GlobalContext* globalCtx, Vec3f* pos) { +void EnGoroiwa_SpawnDust(PlayState* play, Vec3f* pos) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.3f, 0.0f }; Vec3f randPos; @@ -269,12 +269,12 @@ void EnGoroiwa_SpawnDust(GlobalContext* globalCtx, Vec3f* pos) { randPos.x = pos->x + (47.0f * (Rand_ZeroOne() * 0.5f + 0.5f)) * Math_SinS(angle); randPos.y = pos->y + (Rand_ZeroOne() - 0.5f) * 40.0f; randPos.z = pos->z + ((47.0f * (Rand_ZeroOne() * 0.5f + 0.5f))) * Math_CosS(angle); - func_800286CC(globalCtx, &randPos, &velocity, &accel, (s16)(Rand_ZeroOne() * 30.0f) + 100, 80); - func_800286CC(globalCtx, &randPos, &velocity, &accel, (s16)(Rand_ZeroOne() * 20.0f) + 80, 80); + func_800286CC(play, &randPos, &velocity, &accel, (s16)(Rand_ZeroOne() * 30.0f) + 100, 80); + func_800286CC(play, &randPos, &velocity, &accel, (s16)(Rand_ZeroOne() * 20.0f) + 80, 80); } } -void EnGoroiwa_SpawnWaterEffects(GlobalContext* globalCtx, Vec3f* contactPos) { +void EnGoroiwa_SpawnWaterEffects(PlayState* play, Vec3f* contactPos) { Vec3f splashPos; s32 i; s16 angle = 0; @@ -284,15 +284,15 @@ void EnGoroiwa_SpawnWaterEffects(GlobalContext* globalCtx, Vec3f* contactPos) { splashPos.x = contactPos->x + (Math_SinS(angle) * 55.0f); splashPos.y = contactPos->y; splashPos.z = contactPos->z + (Math_CosS(angle) * 55.0f); - EffectSsGSplash_Spawn(globalCtx, &splashPos, 0, 0, 0, 350); + EffectSsGSplash_Spawn(play, &splashPos, 0, 0, 0, 350); } - EffectSsGRipple_Spawn(globalCtx, contactPos, 300, 700, 0); - EffectSsGRipple_Spawn(globalCtx, contactPos, 500, 900, 4); - EffectSsGRipple_Spawn(globalCtx, contactPos, 500, 1300, 8); + EffectSsGRipple_Spawn(play, contactPos, 300, 700, 0); + EffectSsGRipple_Spawn(play, contactPos, 500, 900, 4); + EffectSsGRipple_Spawn(play, contactPos, 500, 1300, 8); } -s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, GlobalContext* globalCtx) { +s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, PlayState* play) { Path* path; s32 result; s32 pad; @@ -300,7 +300,7 @@ s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, R_EN_GOROIWA_SPEED * 0.01f, 0.3f); func_8002D868(&this->actor); - path = &globalCtx->setupPathList[this->actor.params & 0xFF]; + path = &play->setupPathList[this->actor.params & 0xFF]; nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; result = true; result &= Math_StepToF(&this->actor.world.pos.x, nextPointPos->x, fabsf(this->actor.velocity.x)); @@ -309,8 +309,8 @@ s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, GlobalContext* globalCtx) { return result; } -s32 EnGoroiwa_Move(EnGoroiwa* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; +s32 EnGoroiwa_Move(EnGoroiwa* this, PlayState* play) { + Path* path = &play->setupPathList[this->actor.params & 0xFF]; s32 pad; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Vec3s* currentPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->currentWaypoint; @@ -340,9 +340,9 @@ s32 EnGoroiwa_Move(EnGoroiwa* this, GlobalContext* globalCtx) { return nextPointReached; } -s32 EnGoroiwa_MoveUpToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { +s32 EnGoroiwa_MoveUpToNextWaypoint(EnGoroiwa* this, PlayState* play) { s32 pad; - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; + Path* path = &play->setupPathList[this->actor.params & 0xFF]; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; Math_StepToF(&this->actor.velocity.y, (R_EN_GOROIWA_SPEED * 0.01f) * 0.5f, 0.18f); @@ -351,9 +351,9 @@ s32 EnGoroiwa_MoveUpToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { return Math_StepToF(&this->actor.world.pos.y, nextPointPos->y, fabsf(this->actor.velocity.y)); } -s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { +s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, PlayState* play) { s32 pad; - Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF]; + Path* path = &play->setupPathList[this->actor.params & 0xFF]; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; f32 nextPointY; f32 thisY; @@ -379,7 +379,7 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) if (this->actor.velocity.y < 0.0f && this->actor.world.pos.y <= nextPointY) { if (this->bounceCount == 0) { if (this->actor.xzDistToPlayer < 600.0f) { - quakeIdx = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIdx = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIdx, -0x3CB0); Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0); Quake_SetCountdown(quakeIdx, 7); @@ -389,14 +389,14 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) raycastFrom.x = this->actor.world.pos.x; raycastFrom.y = this->actor.world.pos.y + 50.0f; raycastFrom.z = this->actor.world.pos.z; - floorY = BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &floorPoly, &floorBgId, - &this->actor, &raycastFrom); + floorY = BgCheck_EntityRaycastFloor5(play, &play->colCtx, &floorPoly, &floorBgId, &this->actor, + &raycastFrom); yDistToFloor = floorY - (this->actor.world.pos.y - 59.5f); if (fabsf(yDistToFloor) < 15.0f) { dustPos.x = this->actor.world.pos.x; dustPos.y = floorY + 10.0f; dustPos.z = this->actor.world.pos.z; - EnGoroiwa_SpawnDust(globalCtx, &dustPos); + EnGoroiwa_SpawnDust(play, &dustPos); } } } @@ -408,15 +408,15 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) this->actor.world.pos.y = nextPointY - ((this->actor.world.pos.y - nextPointY) * 0.3f); } if (this->bounceCount == 0 && - WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &ySurface, &waterBox) && + WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, + &waterBox) && this->actor.world.pos.y <= ySurface) { this->stateFlags |= ENGOROIWA_IN_WATER; if (ySurface < thisY) { waterHitPos.x = this->actor.world.pos.x; waterHitPos.y = ySurface; waterHitPos.z = this->actor.world.pos.z; - EnGoroiwa_SpawnWaterEffects(globalCtx, &waterHitPos); + EnGoroiwa_SpawnWaterEffects(play, &waterHitPos); this->actor.velocity.y *= 0.2f; } if (this->actor.velocity.y < -8.0f) { @@ -426,7 +426,7 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) return false; } -void EnGoroiwa_UpdateRotation(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_UpdateRotation(EnGoroiwa* this, PlayState* play) { static Vec3f unitY = { 0.0f, 1.0f, 0.0f }; s32 pad; Vec3f* rollAxisPtr; @@ -450,7 +450,7 @@ void EnGoroiwa_UpdateRotation(EnGoroiwa* this, GlobalContext* globalCtx) { * its result was probably meant to be used instead of the actor's velocity in the * Math3D_Vec3f_Cross call. */ - EnGoroiwa_GetPrevWaypointDiff(this, globalCtx, &unusedDiff); + EnGoroiwa_GetPrevWaypointDiff(this, play, &unusedDiff); Math3D_Vec3f_Cross(&unitY, &this->actor.velocity, rollAxisPtr); } else { Math3D_Vec3f_Cross(&unitY, &this->actor.velocity, rollAxisPtr); @@ -470,21 +470,21 @@ void EnGoroiwa_UpdateRotation(EnGoroiwa* this, GlobalContext* globalCtx) { Matrix_MtxFToYXZRotS(&mtx, &this->actor.shape.rot, 0); } -void EnGoroiwa_NextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_NextWaypoint(EnGoroiwa* this, PlayState* play) { s16 loopMode = (this->actor.params >> 8) & 3; EnGoroiwa_SetNextWaypoint(this); if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY || loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK) { if (this->currentWaypoint == 0 || this->currentWaypoint == this->endWaypoint) { - EnGoroiwa_TeleportToWaypoint(this, globalCtx, this->currentWaypoint); + EnGoroiwa_TeleportToWaypoint(this, play, this->currentWaypoint); } } - EnGoroiwa_FaceNextWaypoint(this, globalCtx); + EnGoroiwa_FaceNextWaypoint(this, play); } -void EnGoroiwa_SpawnFragments(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_SpawnFragments(EnGoroiwa* this, PlayState* play) { static f32 yOffsets[] = { 0.0f, 59.5f }; s16 angle1; s16 angle2; @@ -510,15 +510,15 @@ void EnGoroiwa_SpawnFragments(EnGoroiwa* this, GlobalContext* globalCtx) { fragmentVelocity.y = Rand_ZeroOne() * 15.0f + 2.0f; fragmentVelocity.z = effectPos.z * 0.2f; Math_Vec3f_Sum(&effectPos, thisPos, &effectPos); - EffectSsKakera_Spawn(globalCtx, &effectPos, &fragmentVelocity, &effectPos, -340, 33, 28, 2, 0, + EffectSsKakera_Spawn(play, &effectPos, &fragmentVelocity, &effectPos, -340, 33, 28, 2, 0, Rand_ZeroOne() * 7.0f + 1.0f, 1, 0, 70, KAKERA_COLOR_NONE, 1, gBoulderFragmentsDL); } effectPos.x = thisPos->x; effectPos.y = thisPos->y + yOffsets[yOffsetIdx]; effectPos.z = thisPos->z; - func_80033480(globalCtx, &effectPos, 80.0f, 5, 70, 110, 1); - func_80033480(globalCtx, &effectPos, 90.0f, 5, 110, 160, 1); + func_80033480(play, &effectPos, 80.0f, 5, 70, 110, 1); + func_80033480(play, &effectPos, 90.0f, 5, 110, 160, 1); } static InitChainEntry sInitChain[] = { @@ -527,13 +527,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 150, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 1500, ICHAIN_STOP), }; -void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGoroiwa_Init(Actor* thisx, PlayState* play) { static f32 yOffsets[] = { 0.0f, 595.0f }; EnGoroiwa* this = (EnGoroiwa*)thisx; s32 pathIdx; Actor_ProcessInitChain(&this->actor, sInitChain); - EnGoroiwa_InitCollider(this, globalCtx); + EnGoroiwa_InitCollider(this, play); pathIdx = this->actor.params & 0xFF; if (pathIdx == 0xFF) { // "Error: Invalid arg_data" @@ -542,7 +542,7 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->actor); return; } - if (globalCtx->setupPathList[pathIdx].count < 2) { + if (play->setupPathList[pathIdx].count < 2) { // "Error: Invalid Path Data" osSyncPrintf("Error : レールデータ が不正(%s %d)\n", "../z_en_gr.c", 1043); Actor_Kill(&this->actor); @@ -551,11 +551,11 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, yOffsets[(this->actor.params >> 10) & 1], ActorShadow_DrawCircle, 9.4f); this->actor.shape.shadowAlpha = 200; - EnGoroiwa_SetSpeed(this, globalCtx); - EnGoroiwa_InitPath(this, globalCtx); - EnGoroiwa_TeleportToWaypoint(this, globalCtx, 0); + EnGoroiwa_SetSpeed(this, play); + EnGoroiwa_InitPath(this, play); + EnGoroiwa_TeleportToWaypoint(this, play, 0); EnGoroiwa_InitRotation(this); - EnGoroiwa_FaceNextWaypoint(this, globalCtx); + EnGoroiwa_FaceNextWaypoint(this, play); EnGoroiwa_SetupRoll(this); // "(Goroiwa)" osSyncPrintf("(ごろ岩)(arg 0x%04x)(rail %d)(end %d)(bgc %d)(hit %d)\n", this->actor.params, @@ -563,11 +563,11 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.home.rot.z & 1); } -void EnGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnGoroiwa_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnGoroiwa* this = (EnGoroiwa*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnGoroiwa_SetupRoll(EnGoroiwa* this) { @@ -576,7 +576,7 @@ void EnGoroiwa_SetupRoll(EnGoroiwa* this) { this->rollRotSpeed = 1.0f; } -void EnGoroiwa_Roll(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_Roll(EnGoroiwa* this, PlayState* play) { static EnGoroiwaUnkFunc1 moveFuncs[] = { EnGoroiwa_Move, EnGoroiwa_MoveAndFall }; static EnGoroiwaUnkFunc2 onHitSetupFuncs[] = { EnGoroiwa_SetupWait, EnGoroiwa_SetupMoveAndFallToGround }; @@ -592,31 +592,31 @@ void EnGoroiwa_Roll(EnGoroiwa* this, GlobalContext* globalCtx) { this->stateFlags |= ENGOROIWA_PLAYER_IN_THE_WAY; if (((this->actor.params >> 10) & 1) || (this->actor.home.rot.z & 1) != 1) { EnGoroiwa_ReverseDirection(this); - EnGoroiwa_FaceNextWaypoint(this, globalCtx); + EnGoroiwa_FaceNextWaypoint(this, play); } } - func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); + func_8002F6D4(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); osSyncPrintf(VT_FGCOL(CYAN)); osSyncPrintf("Player ぶっ飛ばし\n"); // "Player knocked down" osSyncPrintf(VT_RST); onHitSetupFuncs[(this->actor.params >> 10) & 1](this); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; } - } else if (moveFuncs[(this->actor.params >> 10) & 1](this, globalCtx)) { + } else if (moveFuncs[(this->actor.params >> 10) & 1](this, play)) { loopMode = (this->actor.params >> 8) & 3; if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK && (this->nextWaypoint == 0 || this->nextWaypoint == this->endWaypoint)) { - EnGoroiwa_SpawnFragments(this, globalCtx); + EnGoroiwa_SpawnFragments(this, play); } - EnGoroiwa_NextWaypoint(this, globalCtx); + EnGoroiwa_NextWaypoint(this, play); if ((loopMode == ENGOROIWA_LOOPMODE_ROUNDTRIP) && (this->currentWaypoint == 0 || this->currentWaypoint == this->endWaypoint)) { EnGoroiwa_SetupWait(this); } else if (!((this->actor.params >> 10) & 1) && this->currentWaypoint != 0 && this->currentWaypoint != this->endWaypoint) { - ascendDirection = EnGoroiwa_GetAscendDirection(this, globalCtx); + ascendDirection = EnGoroiwa_GetAscendDirection(this, play); if (ascendDirection > 0) { EnGoroiwa_SetupMoveUp(this); } else if (ascendDirection < 0) { @@ -641,12 +641,12 @@ void EnGoroiwa_SetupMoveAndFallToGround(EnGoroiwa* this) { this->rollRotSpeed = 1.0f; } -void EnGoroiwa_MoveAndFallToGround(EnGoroiwa* this, GlobalContext* globalCtx) { - EnGoroiwa_MoveAndFall(this, globalCtx); +void EnGoroiwa_MoveAndFallToGround(EnGoroiwa* this, PlayState* play) { + EnGoroiwa_MoveAndFall(this, play); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && this->actor.velocity.y < 0.0f) { if ((this->stateFlags & ENGOROIWA_PLAYER_IN_THE_WAY) && (this->actor.home.rot.z & 1) == 1) { EnGoroiwa_ReverseDirection(this); - EnGoroiwa_FaceNextWaypoint(this, globalCtx); + EnGoroiwa_FaceNextWaypoint(this, play); } EnGoroiwa_SetupWait(this); } @@ -662,7 +662,7 @@ void EnGoroiwa_SetupWait(EnGoroiwa* this) { this->rollRotSpeed = 0.0f; } -void EnGoroiwa_Wait(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_Wait(EnGoroiwa* this, PlayState* play) { if (this->waitTimer > 0) { this->waitTimer--; } else { @@ -678,16 +678,16 @@ void EnGoroiwa_SetupMoveUp(EnGoroiwa* this) { this->actor.velocity.y = fabsf(this->actor.speedXZ) * 0.1f; } -void EnGoroiwa_MoveUp(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_MoveUp(EnGoroiwa* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F6D4(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; } - } else if (EnGoroiwa_MoveUpToNextWaypoint(this, globalCtx)) { - EnGoroiwa_NextWaypoint(this, globalCtx); + } else if (EnGoroiwa_MoveUpToNextWaypoint(this, play)) { + EnGoroiwa_NextWaypoint(this, play); EnGoroiwa_SetupRoll(this); this->actor.speedXZ = 0.0f; } @@ -703,25 +703,25 @@ void EnGoroiwa_SetupMoveDown(EnGoroiwa* this) { this->stateFlags &= ~ENGOROIWA_IN_WATER; } -void EnGoroiwa_MoveDown(EnGoroiwa* this, GlobalContext* globalCtx) { +void EnGoroiwa_MoveDown(EnGoroiwa* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); - func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); + func_8002F6D4(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); + func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; } - } else if (EnGoroiwa_MoveDownToNextWaypoint(this, globalCtx)) { - EnGoroiwa_NextWaypoint(this, globalCtx); + } else if (EnGoroiwa_MoveDownToNextWaypoint(this, play)) { + EnGoroiwa_NextWaypoint(this, play); EnGoroiwa_SetupRoll(this); this->stateFlags &= ~ENGOROIWA_RETAIN_ROT_SPEED; this->actor.speedXZ = 0.0f; } } -void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGoroiwa_Update(Actor* thisx, PlayState* play) { EnGoroiwa* this = (EnGoroiwa*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; s32 sp30; @@ -729,30 +729,30 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->collisionDisabledTimer > 0) { this->collisionDisabledTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); switch ((this->actor.params >> 10) & 1) { case 1: - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); break; case 0: - this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &sp30, + this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &sp30, &this->actor, &this->actor.world.pos); break; } - EnGoroiwa_UpdateRotation(this, globalCtx); + EnGoroiwa_UpdateRotation(this, play); if (this->actor.xzDistToPlayer < 300.0f) { EnGoroiwa_UpdateCollider(this); if ((this->stateFlags & ENGOROIWA_ENABLE_AT) && this->collisionDisabledTimer <= 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->stateFlags & ENGOROIWA_ENABLE_OC) && this->collisionDisabledTimer <= 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } } -void EnGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gRollingRockDL); +void EnGoroiwa_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gRollingRockDL); } diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h index 0f36f7a42a..6285432936 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h @@ -6,7 +6,7 @@ struct EnGoroiwa; -typedef void (*EnGoroiwaActionFunc)(struct EnGoroiwa*, GlobalContext*); +typedef void (*EnGoroiwaActionFunc)(struct EnGoroiwa*, PlayState*); typedef struct EnGoroiwa { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 67498710d6..81392eeade 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -11,13 +11,13 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_25) -void EnGs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGs_Init(Actor* thisx, PlayState* play); +void EnGs_Destroy(Actor* thisx, PlayState* play); +void EnGs_Update(Actor* thisx, PlayState* play); +void EnGs_Draw(Actor* thisx, PlayState* play); -void func_80A4F734(EnGs* this, GlobalContext* globalCtx); -void func_80A4F700(EnGs* this, GlobalContext* globalCtx); +void func_80A4F734(EnGs* this, PlayState* play); +void func_80A4F700(EnGs* this, PlayState* play); void func_80A4F77C(EnGs* this); @@ -94,12 +94,12 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void EnGs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGs_Init(Actor* thisx, PlayState* play) { EnGs* this = (EnGs*)thisx; Actor_ProcessInitChain(thisx, sInitChain); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); CollisionCheck_SetInfo2(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); thisx->targetMode = 6; @@ -113,14 +113,14 @@ void EnGs_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1B4[1].z = 1.0f; } -void EnGs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGs_Destroy(Actor* thisx, PlayState* play) { } -s32 func_80A4E3EC(EnGs* this, GlobalContext* globalCtx) { +s32 func_80A4E3EC(EnGs* this, PlayState* play) { s32 ret = 2; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x2054: this->actor.textId = (this->actor.params & 0xFF) + 0x400; @@ -136,8 +136,8 @@ s32 func_80A4E3EC(EnGs* this, GlobalContext* globalCtx) { return ret; } -void func_80A4E470(EnGs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A4E470(EnGs* this, PlayState* play) { + Player* player = GET_PLAYER(play); bREG(15) = 0; if (this->actor.xzDistToPlayer <= 100.0f) { @@ -145,50 +145,48 @@ void func_80A4E470(EnGs* this, GlobalContext* globalCtx) { if (this->unk_19D == 0) { player->stateFlags2 |= PLAYER_STATE2_23; if (player->stateFlags2 & PLAYER_STATE2_24) { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->unk_19D |= 1; } } else if (this->unk_19D & 1) { - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - if ((globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_SARIAS) || - (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_EPONAS) || - (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_LULLABY) || - (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_SUNS) || - (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_TIME)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + if ((play->msgCtx.unk_E3F2 == OCARINA_SONG_SARIAS) || (play->msgCtx.unk_E3F2 == OCARINA_SONG_EPONAS) || + (play->msgCtx.unk_E3F2 == OCARINA_SONG_LULLABY) || (play->msgCtx.unk_E3F2 == OCARINA_SONG_SUNS) || + (play->msgCtx.unk_E3F2 == OCARINA_SONG_TIME)) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, FAIRY_HEAL_TIMED); Audio_PlayActorSound2(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); - } else if (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_STORMS) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + } else if (play->msgCtx.unk_E3F2 == OCARINA_SONG_STORMS) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, FAIRY_HEAL_BIG); Audio_PlayActorSound2(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); } this->unk_19D = 0; - Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { player->stateFlags2 |= PLAYER_STATE2_23; } } } } -void func_80A4E648(EnGs* this, GlobalContext* globalCtx) { +void func_80A4E648(EnGs* this, PlayState* play) { s16 sp26; s16 sp24; if (this->unk_19C == 1) { - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_19C = 2; } else if (this->unk_19C == 2) { - this->unk_19C = func_80A4E3EC(this, globalCtx); - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + this->unk_19C = func_80A4E3EC(this, play); + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_19C = 2; } else { - Actor_GetScreenPos(globalCtx, &this->actor, &sp26, &sp24); + Actor_GetScreenPos(play, &this->actor, &sp26, &sp24); if ((sp26 >= 0) && (sp26 <= SCREEN_WIDTH) && (sp24 >= 0) && (sp24 <= SCREEN_HEIGHT) && (this->unk_19C != 3)) { - if (func_8002F2CC(&this->actor, globalCtx, 40.0f) == 1) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_TRUTH) { + if (func_8002F2CC(&this->actor, play, 40.0f) == 1) { + if (Player_GetMask(play) == PLAYER_MASK_TRUTH) { this->actor.textId = 0x2054; } else { this->actor.textId = 0x2053; @@ -198,8 +196,8 @@ void func_80A4E648(EnGs* this, GlobalContext* globalCtx) { } } -f32 func_80A4E754(EnGs* this, GlobalContext* globalCtx, f32* arg2, f32* arg3, u16* arg4, f32 arg5, f32 arg6, f32 arg7, - s32 arg8, s32 arg9) { +f32 func_80A4E754(EnGs* this, PlayState* play, f32* arg2, f32* arg3, u16* arg4, f32 arg5, f32 arg6, f32 arg7, s32 arg8, + s32 arg9) { f32 sp2C = Math_SmoothStepToF(arg2, *arg3, arg5, arg6, arg7); if (arg9 == 0) { @@ -211,24 +209,24 @@ f32 func_80A4E754(EnGs* this, GlobalContext* globalCtx, f32* arg2, f32* arg3, u1 return sp2C; } -void func_80A4E910(EnGs* this, GlobalContext* globalCtx) { +void func_80A4E910(EnGs* this, PlayState* play) { if (this->unk_19F == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_200 = 0; this->unk_19F = 1; this->unk_1E8 = 0.5f; this->unk_1EC = 0.0f; - } else if ((this->unk_19F == 1) && (func_80A4E754(this, globalCtx, &this->unk_1E8, &this->unk_1EC, &this->unk_200, - 0.8f, 0.007f, 0.001f, 7, 0) == 0.0f)) { - if (!Play_InCsMode(globalCtx)) { - Message_StartTextbox(globalCtx, 0x71B1, NULL); + } else if ((this->unk_19F == 1) && (func_80A4E754(this, play, &this->unk_1E8, &this->unk_1EC, &this->unk_200, 0.8f, + 0.007f, 0.001f, 7, 0) == 0.0f)) { + if (!Play_InCsMode(play)) { + Message_StartTextbox(play, 0x71B1, NULL); } this->unk_19C = 0; this->actionFunc = func_80A4F734; } } -void func_80A4EA08(EnGs* this, GlobalContext* globalCtx) { +void func_80A4EA08(EnGs* this, PlayState* play) { if (this->unk_19F == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_1E8 = 0.3f; @@ -238,15 +236,15 @@ void func_80A4EA08(EnGs* this, GlobalContext* globalCtx) { } else if (this->unk_19F == 1) { this->unk_1A0[0].z = (((this->unk_200 % 8) / 8.0f) * 360.0f) * (0x10000 / 360.0f); this->unk_1A0[1].z = -this->unk_1A0[0].z; - if (func_80A4E754(this, globalCtx, &this->unk_1E8, &this->unk_1EC, &this->unk_200, 0.8f, 0.005f, 0.001f, 7, - 0) == 0.0f) { + if (func_80A4E754(this, play, &this->unk_1E8, &this->unk_1EC, &this->unk_200, 0.8f, 0.005f, 0.001f, 7, 0) == + 0.0f) { this->unk_19C = 0; this->actionFunc = func_80A4F734; } } } -void func_80A4EB3C(EnGs* this, GlobalContext* globalCtx) { +void func_80A4EB3C(EnGs* this, PlayState* play) { f32 ret; if (this->unk_19F == 0) { @@ -278,7 +276,7 @@ void func_80A4EB3C(EnGs* this, GlobalContext* globalCtx) { this->unk_19F++; } } else if (this->unk_19F == 4) { - if (func_80A4E754(this, globalCtx, &this->unk_1E8, &this->unk_1EC, &this->unk_200, 1.0f, 0.03f, 0.001f, 5, 0) == + if (func_80A4E754(this, play, &this->unk_1E8, &this->unk_1EC, &this->unk_200, 1.0f, 0.03f, 0.001f, 5, 0) == 0.0f) { this->unk_19C = 0; this->actionFunc = func_80A4F734; @@ -286,7 +284,7 @@ void func_80A4EB3C(EnGs* this, GlobalContext* globalCtx) { } } -void func_80A4ED34(EnGs* this, GlobalContext* globalCtx) { +void func_80A4ED34(EnGs* this, PlayState* play) { static Color_RGBA8 flashRed = { 255, 50, 50, 0 }; static Color_RGBA8 flashBlue = { 50, 50, 255, 0 }; static Color_RGBA8 baseWhite = { 255, 255, 255, 0 }; @@ -346,7 +344,7 @@ void func_80A4ED34(EnGs* this, GlobalContext* globalCtx) { dustPos.x = this->actor.world.pos.x + (dustVelocity.x + dustVelocity.x); dustPos.y = this->actor.world.pos.y + 7.0f; dustPos.z = this->actor.world.pos.z + (dustVelocity.z + dustVelocity.z); - func_8002836C(globalCtx, &dustPos, &dustVelocity, &dustAccel, &dustPrim, &dustEnv, + func_8002836C(play, &dustPos, &dustVelocity, &dustAccel, &dustPrim, &dustEnv, (s16)Rand_ZeroFloat(50.0f) + 200, 40, 15); } @@ -362,14 +360,13 @@ void func_80A4ED34(EnGs* this, GlobalContext* globalCtx) { } if (this->unk_19F == 4) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1); if (this->actor.bgCheckFlags & (BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING)) { bomb2Pos.x = this->actor.world.pos.x; bomb2Pos.y = this->actor.world.pos.y; bomb2Pos.z = this->actor.world.pos.z; Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); - EffectSsBomb2_SpawnLayered(globalCtx, &bomb2Pos, &bomb2Velocity, &bomb2Accel, 100, 20); + EffectSsBomb2_SpawnLayered(play, &bomb2Pos, &bomb2Velocity, &bomb2Accel, 100, 20); this->unk_200 = 10; this->unk_19E |= 8; this->actionFunc = func_80A4F700; @@ -384,7 +381,7 @@ void func_80A4ED34(EnGs* this, GlobalContext* globalCtx) { } } -void func_80A4F13C(EnGs* this, GlobalContext* globalCtx) { +void func_80A4F13C(EnGs* this, PlayState* play) { f32 tmpf1; f32 tmpf2; f32 tmpf3; @@ -486,15 +483,15 @@ void func_80A4F13C(EnGs* this, GlobalContext* globalCtx) { } } -void func_80A4F700(EnGs* this, GlobalContext* globalCtx) { +void func_80A4F700(EnGs* this, PlayState* play) { if (this->unk_200-- <= 0) { Actor_Kill(&this->actor); } } -void func_80A4F734(EnGs* this, GlobalContext* globalCtx) { - if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { - func_80A4E470(this, globalCtx); +void func_80A4F734(EnGs* this, PlayState* play) { + if (!Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) { + func_80A4E470(this, play); } } @@ -514,8 +511,8 @@ void func_80A4F77C(EnGs* this) { this->unk_19C = 3; } -void EnGs_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnGs_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnGs* this = (EnGs*)thisx; Actor_SetFocus(&this->actor, 23.0f); @@ -553,23 +550,23 @@ void EnGs_Update(Actor* thisx, GlobalContext* globalCtx2) { } } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - this->actionFunc(this, globalCtx); - func_80A4E648(this, globalCtx); + this->actionFunc(this, play); + func_80A4E648(this, play); } -void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGs_Draw(Actor* thisx, PlayState* play) { EnGs* this = (EnGs*)thisx; s32 tmp; u32 frames; if (!(this->unk_19E & 8)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_gs.c", 1046); + OPEN_DISPS(play->state.gfxCtx, "../z_en_gs.c", 1046); - frames = globalCtx->gameplayFrames; - func_80093D18(globalCtx->state.gfxCtx); + frames = play->gameplayFrames; + func_80093D18(play->state.gfxCtx); Matrix_Push(); if (this->unk_19E & 1) { Matrix_RotateY(BINANG_TO_RAD(this->unk_1A0[0].y), MTXMODE_APPLY); @@ -581,7 +578,7 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZ(BINANG_TO_RAD(this->unk_1A0[1].z), MTXMODE_APPLY); } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_gs.c", 1064), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_gs.c", 1064), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGossipStoneMaterialDL); @@ -597,20 +594,19 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Pop(); if (this->unk_19E & 2) { - func_80093D84(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + func_80093D84(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(0.05f, -0.05f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_gs.c", 1087), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_gs.c", 1087), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment( - POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 0x14, 0x20, 0x80)); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 0x14, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_gs.c", 1101); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_gs.c", 1101); } } diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.h b/src/overlays/actors/ovl_En_Gs/z_en_gs.h index cc95e3ee01..47edd278db 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.h +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.h @@ -6,7 +6,7 @@ struct EnGs; -typedef void (*EnGsActionFunc)(struct EnGs*, GlobalContext*); +typedef void (*EnGsActionFunc)(struct EnGs*, PlayState*); typedef struct EnGs { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 3e11adf081..95e7e20798 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -11,14 +11,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnGuest_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGuest_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGuest_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGuest_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGuest_Init(Actor* thisx, PlayState* play); +void EnGuest_Destroy(Actor* thisx, PlayState* play); +void EnGuest_Update(Actor* thisx, PlayState* play); +void EnGuest_Draw(Actor* thisx, PlayState* play); -void func_80A50518(EnGuest* this, GlobalContext* globalCtx); -void func_80A5057C(EnGuest* this, GlobalContext* globalCtx); -void func_80A505CC(Actor* thisx, GlobalContext* globalCtx); +void func_80A50518(EnGuest* this, PlayState* play); +void func_80A5057C(EnGuest* this, PlayState* play); +void func_80A505CC(Actor* thisx, PlayState* play); const ActorInit En_Guest_InitVars = { ACTOR_EN_GUEST, @@ -49,13 +49,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; -void EnGuest_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGuest_Init(Actor* thisx, PlayState* play) { EnGuest* this = (EnGuest*)thisx; if (GET_INFTABLE(INFTABLE_76)) { Actor_Kill(&this->actor); } else { - this->osAnimeBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_OS_ANIME); + this->osAnimeBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); if (this->osAnimeBankIndex < 0) { osSyncPrintf(VT_COL(RED, WHITE)); // "No such bank!!" @@ -66,31 +66,31 @@ void EnGuest_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGuest_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGuest_Destroy(Actor* thisx, PlayState* play) { EnGuest* this = (EnGuest*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnGuest_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGuest_Update(Actor* thisx, PlayState* play) { EnGuest* this = (EnGuest*)thisx; s32 pad; - if (Object_IsLoaded(&globalCtx->objectCtx, this->osAnimeBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->osAnimeBankIndex)) { this->actor.flags &= ~ACTOR_FLAG_4; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_boj_Skel_0000F0, NULL, this->jointTable, - this->morphTable, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->osAnimeBankIndex].segment); + SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_0000F0, NULL, this->jointTable, this->morphTable, + 16); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); Animation_Change(&this->skelAnime, &gObjOsAnim_42AC, 1.0f, 0.0f, Animation_GetLastFrame(&gObjOsAnim_42AC), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnGuest_Draw; this->actor.update = func_80A505CC; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetFocus(&this->actor, 60.0f); @@ -125,30 +125,30 @@ void func_80A5046C(EnGuest* this) { } } -void func_80A50518(EnGuest* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80A50518(EnGuest* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80A5057C; } else if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } -void func_80A5057C(EnGuest* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_80A5057C(EnGuest* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->actionFunc = func_80A50518; } } -void func_80A505CC(Actor* thisx, GlobalContext* globalCtx) { +void func_80A505CC(Actor* thisx, PlayState* play) { EnGuest* this = (EnGuest*)thisx; s32 pad; Player* player; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->unk_2C8++; func_80A5046C(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk_2A0.unk_18 = player->actor.world.pos; if (LINK_IS_ADULT) { @@ -158,15 +158,15 @@ void func_80A505CC(Actor* thisx, GlobalContext* globalCtx) { } func_80034A14(&this->actor, &this->unk_2A0, 6, 2); - func_80034F54(globalCtx, this->unk_2CC, this->unk_2EC, 16); + func_80034F54(play, this->unk_2CC, this->unk_2EC, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->osAnimeBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); SkelAnime_Update(&this->skelAnime); Actor_SetFocus(&this->actor, 60.0f); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Gfx* func_80A50708(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { @@ -179,12 +179,11 @@ Gfx* func_80A50708(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { return dlist; } -s32 EnGuest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnGuest_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGuest* this = (EnGuest*)thisx; Vec3s sp3C; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_guest.c", 352); + OPEN_DISPS(play->state.gfxCtx, "../z_en_guest.c", 352); if (limbIndex == 15) { *dList = object_boj_DL_0059B0; @@ -206,12 +205,12 @@ s32 EnGuest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis rot->z += Math_CosS(this->unk_2EC[limbIndex]) * 200.0f; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_guest.c", 388); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_guest.c", 388); return false; } -void EnGuest_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGuest_Draw(Actor* thisx, PlayState* play) { static void* D_80A50BA4[] = { object_boj_Tex_0005FC, object_boj_Tex_0006FC, @@ -220,16 +219,16 @@ void EnGuest_Draw(Actor* thisx, GlobalContext* globalCtx) { EnGuest* this = (EnGuest*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_guest.c", 404); + OPEN_DISPS(play->state.gfxCtx, "../z_en_guest.c", 404); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, func_80A50708(globalCtx->state.gfxCtx, 0xFF, 0xFF, 0xFF, 0xFF)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A50708(globalCtx->state.gfxCtx, 0xA0, 0x3C, 0xDC, 0xFF)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A50708(play->state.gfxCtx, 0xFF, 0xFF, 0xFF, 0xFF)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A50708(play->state.gfxCtx, 0xA0, 0x3C, 0xDC, 0xFF)); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(D_80A50BA4[this->unk_30E])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGuest_OverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_guest.c", 421); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_guest.c", 421); } diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.h b/src/overlays/actors/ovl_En_Guest/z_en_guest.h index a86caa6130..d99514686e 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.h +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.h @@ -6,7 +6,7 @@ struct EnGuest; -typedef void (*EnGuestActionFunc)(struct EnGuest* this, GlobalContext* globalCtx); +typedef void (*EnGuestActionFunc)(struct EnGuest* this, PlayState* play); typedef struct EnGuest { /* 0x0000 */ Actor actor; 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 1e4d89be5d..189292943b 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.c +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void EnHata_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHata_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHata_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHata_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHata_Init(Actor* thisx, PlayState* play); +void EnHata_Destroy(Actor* thisx, PlayState* play); +void EnHata_Update(Actor* thisx, PlayState* play); +void EnHata_Draw(Actor* thisx, PlayState* play); const ActorInit En_Hata_InitVars = { ACTOR_EN_HATA, @@ -49,18 +49,18 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -void EnHata_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHata_Init(Actor* thisx, PlayState* play) { EnHata* this = (EnHata*)thisx; s32 pad; CollisionHeader* colHeader = NULL; f32 frameCount = Animation_GetLastFrame(&gFlagpoleFlapAnim); Actor_SetScale(&this->dyna.actor, 1.0f / 75.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gFlagpoleSkel, &gFlagpoleFlapAnim, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gFlagpoleSkel, &gFlagpoleFlapAnim, NULL, NULL, 0); Animation_Change(&this->skelAnime, &gFlagpoleFlapAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&gFlagpoleCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.actor.uncullZoneScale = 500.0f; this->dyna.actor.uncullZoneDownward = 550.0f; this->dyna.actor.uncullZoneForward = 2200.0f; @@ -70,15 +70,15 @@ void EnHata_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_278 = Rand_ZeroOne() * 0xFFFF; } -void EnHata_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHata_Destroy(Actor* thisx, PlayState* play) { EnHata* this = (EnHata*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + SkelAnime_Free(&this->skelAnime, play); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void EnHata_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnHata_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnHata* this = (EnHata*)thisx; s32 pitch; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -88,16 +88,16 @@ void EnHata_Update(Actor* thisx, GlobalContext* globalCtx2) { 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 = globalCtx->envCtx.windDirection.x; - windVec.y = globalCtx->envCtx.windDirection.y; - windVec.z = globalCtx->envCtx.windDirection.z; + windVec.x = play->envCtx.windDirection.x; + windVec.y = play->envCtx.windDirection.y; + windVec.z = play->envCtx.windDirection.z; - if (globalCtx->envCtx.windSpeed > 255.0f) { - globalCtx->envCtx.windSpeed = 255.0f; + if (play->envCtx.windSpeed > 255.0f) { + play->envCtx.windSpeed = 255.0f; } - if (globalCtx->envCtx.windSpeed < 0.0f) { - globalCtx->envCtx.windSpeed = 0.0f; + if (play->envCtx.windSpeed < 0.0f) { + play->envCtx.windSpeed = 0.0f; } if (Rand_ZeroOne() > 0.5f) { @@ -109,16 +109,16 @@ void EnHata_Update(Actor* thisx, GlobalContext* globalCtx2) { // Mimic varying wind gusts sin = Math_SinS(this->unk_278) * 80.0f; pitch = -Math_Vec3f_Pitch(&zeroVec, &windVec); - pitch = ((s32)((15000 - pitch) * (1.0f - (globalCtx->envCtx.windSpeed / (255.0f - sin))))) + pitch; + 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; - this->skelAnime.playSpeed = (Rand_ZeroFloat(1.25f) + 2.75f) * (globalCtx->envCtx.windSpeed / 255.0f); + this->skelAnime.playSpeed = (Rand_ZeroFloat(1.25f) + 2.75f) * (play->envCtx.windSpeed / 255.0f); } -s32 EnHata_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnHata_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHata* this = (EnHata*)thisx; Vec3s* limbs; @@ -132,14 +132,14 @@ s32 EnHata_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnHata_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnHata_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { } -void EnHata_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHata_Draw(Actor* thisx, PlayState* play) { EnHata* this = (EnHata*)thisx; - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); Matrix_Scale(1.0f, 1.1f, 1.0f, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHata_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHata_OverrideLimbDraw, EnHata_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index e5879d18ab..fb84c104eb 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -10,24 +10,24 @@ #define FLAGS ACTOR_FLAG_4 -void EnHeishi1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi1_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHeishi1_Init(Actor* thisx, PlayState* play); +void EnHeishi1_Destroy(Actor* thisx, PlayState* play); +void EnHeishi1_Update(Actor* thisx, PlayState* play); +void EnHeishi1_Draw(Actor* thisx, PlayState* play); -void EnHeishi1_SetupWait(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_SetupWalk(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_SetupMoveToLink(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_SetupTurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_SetupKick(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_SetupWaitNight(EnHeishi1* this, GlobalContext* globalCtx); +void EnHeishi1_SetupWait(EnHeishi1* this, PlayState* play); +void EnHeishi1_SetupWalk(EnHeishi1* this, PlayState* play); +void EnHeishi1_SetupMoveToLink(EnHeishi1* this, PlayState* play); +void EnHeishi1_SetupTurnTowardLink(EnHeishi1* this, PlayState* play); +void EnHeishi1_SetupKick(EnHeishi1* this, PlayState* play); +void EnHeishi1_SetupWaitNight(EnHeishi1* this, PlayState* play); -void EnHeishi1_Wait(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_MoveToLink(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_TurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_Kick(EnHeishi1* this, GlobalContext* globalCtx); -void EnHeishi1_WaitNight(EnHeishi1* this, GlobalContext* globalCtx); +void EnHeishi1_Wait(EnHeishi1* this, PlayState* play); +void EnHeishi1_Walk(EnHeishi1* this, PlayState* play); +void EnHeishi1_MoveToLink(EnHeishi1* this, PlayState* play); +void EnHeishi1_TurnTowardLink(EnHeishi1* this, PlayState* play); +void EnHeishi1_Kick(EnHeishi1* this, PlayState* play); +void EnHeishi1_WaitNight(EnHeishi1* this, PlayState* play); static s32 sPlayerIsCaught = false; @@ -63,15 +63,14 @@ static s32 sCamDataIdxs[] = { static s16 sWaypoints[] = { 0, 4, 1, 5, 2, 6, 3, 7 }; -void EnHeishi1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi1_Init(Actor* thisx, PlayState* play) { s32 pad; EnHeishi1* this = (EnHeishi1*)thisx; Vec3f rupeePos; s32 i; Actor_SetScale(&this->actor, 0.01f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, - 17); + SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, 17); this->type = (this->actor.params >> 8) & 0xFF; this->path = this->actor.params & 0xFF; @@ -106,7 +105,7 @@ void EnHeishi1_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->path == 3) { for (i = 0; i < ARRAY_COUNT(sRupeePositions); i++) { rupeePos = sRupeePositions[i]; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_RUPPY, rupeePos.x, rupeePos.y, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_RUPPY, rupeePos.x, rupeePos.y, rupeePos.z, 0, 0, 0, 3); } } @@ -126,10 +125,10 @@ void EnHeishi1_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnHeishi1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi1_Destroy(Actor* thisx, PlayState* play) { } -void EnHeishi1_SetupWalk(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupWalk(EnHeishi1* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiWalkAnim); Animation_Change(&this->skelAnime, &gEnHeishiWalkAnim, this->animSpeed, 0.0f, (s16)frameCount, ANIMMODE_LOOP, @@ -140,7 +139,7 @@ void EnHeishi1_SetupWalk(EnHeishi1* this, GlobalContext* globalCtx) { this->actionFunc = EnHeishi1_Walk; } -void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_Walk(EnHeishi1* this, PlayState* play) { Path* path; Vec3s* pointPos; f32 pathDiffX; @@ -154,7 +153,7 @@ void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) { } if (!sPlayerIsCaught) { - path = &globalCtx->setupPathList[this->path]; + path = &play->setupPathList[this->path]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->waypoint; @@ -213,19 +212,19 @@ void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) { } } -void EnHeishi1_SetupMoveToLink(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupMoveToLink(EnHeishi1* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiWalkAnim); Animation_Change(&this->skelAnime, &gEnHeishiWalkAnim, 3.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -3.0f); this->bodyTurnSpeed = 0.0f; this->moveSpeed = 0.0f; - Message_StartTextbox(globalCtx, 0x702D, &this->actor); - Interface_SetDoAction(globalCtx, DO_ACTION_STOP); + Message_StartTextbox(play, 0x702D, &this->actor); + Interface_SetDoAction(play, DO_ACTION_STOP); this->actionFunc = EnHeishi1_MoveToLink; } -void EnHeishi1_MoveToLink(EnHeishi1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnHeishi1_MoveToLink(EnHeishi1* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->actor.world.pos.x, player->actor.world.pos.x, 1.0f, this->moveSpeed); @@ -240,7 +239,7 @@ void EnHeishi1_MoveToLink(EnHeishi1* this, GlobalContext* globalCtx) { } } -void EnHeishi1_SetupWait(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupWait(EnHeishi1* this, PlayState* play) { s16 rand; f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); @@ -253,7 +252,7 @@ void EnHeishi1_SetupWait(EnHeishi1* this, GlobalContext* globalCtx) { this->actionFunc = EnHeishi1_Wait; } -void EnHeishi1_Wait(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_Wait(EnHeishi1* this, PlayState* play) { s16 randOffset; s32 i; @@ -311,7 +310,7 @@ void EnHeishi1_Wait(EnHeishi1* this, GlobalContext* globalCtx) { } } -void EnHeishi1_SetupTurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupTurnTowardLink(EnHeishi1* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -319,7 +318,7 @@ void EnHeishi1_SetupTurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx) { this->actionFunc = EnHeishi1_TurnTowardLink; } -void EnHeishi1_TurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_TurnTowardLink(EnHeishi1* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->type != 5) { @@ -333,57 +332,57 @@ void EnHeishi1_TurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx) { } } -void EnHeishi1_SetupKick(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupKick(EnHeishi1* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = EnHeishi1_Kick; } -void EnHeishi1_Kick(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_Kick(EnHeishi1* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (!this->loadStarted) { // if dialog state is 5 and textbox has been advanced, kick player out - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); if (!this->loadStarted) { SET_EVENTCHKINF(EVENTCHKINF_4E); - globalCtx->nextEntranceIndex = ENTR_SPOT15_3; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT15_3; + play->transitionTrigger = TRANS_TRIGGER_START; this->loadStarted = true; sPlayerIsCaught = false; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); gSaveContext.nextTransitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); } } } } -void EnHeishi1_SetupWaitNight(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_SetupWaitNight(EnHeishi1* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = EnHeishi1_WaitNight; } -void EnHeishi1_WaitNight(EnHeishi1* this, GlobalContext* globalCtx) { +void EnHeishi1_WaitNight(EnHeishi1* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.xzDistToPlayer < 100.0f) { - Message_StartTextbox(globalCtx, 0x702D, &this->actor); + Message_StartTextbox(play, 0x702D, &this->actor); func_80078884(NA_SE_SY_FOUND); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->actionFunc = EnHeishi1_SetupKick; } } -void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi1_Update(Actor* thisx, PlayState* play) { EnHeishi1* this = (EnHeishi1*)thisx; s16 path; u8 i; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; Camera* activeCam; @@ -399,11 +398,11 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { this->waypointTimer--; } - activeCam = GET_ACTIVE_CAM(globalCtx); + activeCam = GET_ACTIVE_CAM(play); if (player->actor.freezeTimer == 0) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.uncullZoneForward = 550.0f; this->actor.uncullZoneScale = 350.0f; @@ -429,7 +428,7 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&searchBallMult, &searchBallVel); Matrix_Pop(); - EffectSsSolderSrchBall_Spawn(globalCtx, &searchBallPos, &searchBallVel, &searchBallAccel, 2, + EffectSsSolderSrchBall_Spawn(play, &searchBallPos, &searchBallVel, &searchBallAccel, 2, &this->linkDetected); if (this->actor.xzDistToPlayer < 60.0f) { @@ -457,7 +456,7 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_FOUND); // "Discovered!" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); sPlayerIsCaught = true; this->actionFunc = EnHeishi1_SetupMoveToLink; } @@ -470,8 +469,7 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnHeishi1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnHeishi1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHeishi1* this = (EnHeishi1*)thisx; // turn the guards head to match the direction he is looking @@ -482,19 +480,19 @@ s32 EnHeishi1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnHeishi1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi1_Draw(Actor* thisx, PlayState* play) { s32 pad; EnHeishi1* this = (EnHeishi1*)thisx; Vec3f matrixScale = { 0.3f, 0.3f, 0.3f }; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi1_OverrideLimbDraw, NULL, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi1_OverrideLimbDraw, NULL, this); - func_80033C30(&this->actor.world.pos, &matrixScale, 0xFF, globalCtx); + func_80033C30(&this->actor.world.pos, &matrixScale, 0xFF, play); if ((this->path == BREG(1)) && (BREG(0) != 0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y + 100.0f, this->actor.world.pos.z, 17000, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, - 255, 4, globalCtx->state.gfxCtx); + 255, 4, play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h index 98c863fd3d..93bc570223 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h @@ -6,7 +6,7 @@ struct EnHeishi1; -typedef void (*EnHeishi1ActionFunc)(struct EnHeishi1*, GlobalContext*); +typedef void (*EnHeishi1ActionFunc)(struct EnHeishi1*, PlayState*); typedef struct EnHeishi1 { /* 0x0000 */ Actor actor; 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 fd333b3d71..f3bd48cbc1 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -14,41 +14,41 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHeishi2_Init(Actor* thisx, PlayState* play); +void EnHeishi2_Destroy(Actor* thisx, PlayState* play); +void EnHeishi2_Update(Actor* thisx, PlayState* play); +void EnHeishi2_Draw(Actor* thisx, PlayState* play); -void EnHeishi2_DrawKingGuard(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi2_DoNothing1(EnHeishi2* this, GlobalContext* globalCtx); -void EnHeishi_DoNothing2(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A531E4(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53278(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5344C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A54954(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53538(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A535BC(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5399C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53638(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5372C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5475C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53AD4(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53C0C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53C90(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53D0C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A544AC(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53908(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53F30(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A54038(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5427C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A549E8(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53850(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A54320(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A543A0(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A5455C(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A546DC(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A541FC(EnHeishi2* this, GlobalContext* globalCtx); -void func_80A53DF8(EnHeishi2* this, GlobalContext* globalCtx); +void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play); +void EnHeishi2_DoNothing1(EnHeishi2* this, PlayState* play); +void EnHeishi_DoNothing2(EnHeishi2* this, PlayState* play); +void func_80A531E4(EnHeishi2* this, PlayState* play); +void func_80A53278(EnHeishi2* this, PlayState* play); +void func_80A5344C(EnHeishi2* this, PlayState* play); +void func_80A54954(EnHeishi2* this, PlayState* play); +void func_80A53538(EnHeishi2* this, PlayState* play); +void func_80A535BC(EnHeishi2* this, PlayState* play); +void func_80A5399C(EnHeishi2* this, PlayState* play); +void func_80A53638(EnHeishi2* this, PlayState* play); +void func_80A5372C(EnHeishi2* this, PlayState* play); +void func_80A5475C(EnHeishi2* this, PlayState* play); +void func_80A53AD4(EnHeishi2* this, PlayState* play); +void func_80A53C0C(EnHeishi2* this, PlayState* play); +void func_80A53C90(EnHeishi2* this, PlayState* play); +void func_80A53D0C(EnHeishi2* this, PlayState* play); +void func_80A544AC(EnHeishi2* this, PlayState* play); +void func_80A53908(EnHeishi2* this, PlayState* play); +void func_80A53F30(EnHeishi2* this, PlayState* play); +void func_80A54038(EnHeishi2* this, PlayState* play); +void func_80A5427C(EnHeishi2* this, PlayState* play); +void func_80A549E8(EnHeishi2* this, PlayState* play); +void func_80A53850(EnHeishi2* this, PlayState* play); +void func_80A54320(EnHeishi2* this, PlayState* play); +void func_80A543A0(EnHeishi2* this, PlayState* play); +void func_80A5455C(EnHeishi2* this, PlayState* play); +void func_80A546DC(EnHeishi2* this, PlayState* play); +void func_80A541FC(EnHeishi2* this, PlayState* play); +void func_80A53DF8(EnHeishi2* this, PlayState* play); const ActorInit En_Heishi2_InitVars = { ACTOR_EN_HEISHI2, @@ -82,7 +82,7 @@ static ColliderCylinderInit sCylinderInit = { { 33, 40, 0, { 0, 0, 0 } }, }; -void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi2_Init(Actor* thisx, PlayState* play) { ColliderCylinder* collider; EnHeishi2* this = (EnHeishi2*)thisx; @@ -93,7 +93,7 @@ void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx) { if ((this->type == 6) || (this->type == 9)) { this->actor.draw = EnHeishi2_DrawKingGuard; this->actor.flags &= ~ACTOR_FLAG_0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, 6); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, 6); if (this->type == 6) { this->actionFunc = EnHeishi2_DoNothing1; @@ -110,19 +110,19 @@ void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.y -= 60.0f; this->actor.world.pos.z += 90.0f; this->actor.shape.rot.y = this->actor.world.rot.y; - Collider_DestroyCylinder(globalCtx, &this->collider); - func_8002DF54(globalCtx, 0, 8); + Collider_DestroyCylinder(play, &this->collider); + func_8002DF54(play, 0, 8); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_4; this->actionFunc = func_80A544AC; } } else { this->unk_2E0 = 60.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, - this->morphTable, 17); + SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, + 17); collider = &this->collider; - Collider_InitCylinder(globalCtx, collider); - Collider_SetCylinder(globalCtx, collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, collider); + Collider_SetCylinder(play, collider, &this->actor, &sCylinderInit); this->collider.dim.yShift = 0; this->collider.dim.radius = 15; this->collider.dim.height = 70; @@ -142,7 +142,7 @@ void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); // "Peep hole soldier!" osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 覗き穴奥兵士ふぃ〜 ☆☆☆☆☆ \n" VT_RST); - Collider_DestroyCylinder(globalCtx, collider); + Collider_DestroyCylinder(play, collider); this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); this->actionFunc = EnHeishi_DoNothing2; break; @@ -160,32 +160,32 @@ void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnHeishi2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi2_Destroy(Actor* thisx, PlayState* play) { EnHeishi2* this = (EnHeishi2*)thisx; if ((this->collider.dim.radius != 0) || (this->collider.dim.height != 0)) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnHeishi2_DoNothing1(EnHeishi2* this, GlobalContext* globalCtx) { +void EnHeishi2_DoNothing1(EnHeishi2* this, PlayState* play) { } -void EnHeishi_DoNothing2(EnHeishi2* this, GlobalContext* globalCtx) { +void EnHeishi_DoNothing2(EnHeishi2* this, PlayState* play) { } -void func_80A531E4(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A531E4(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A53278; } -void func_80A53278(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53278(EnHeishi2* this, PlayState* play) { this->unk_30B = 0; this->unk_30E = 0; - if (Text_GetFaceReaction(globalCtx, 5) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 5); + if (Text_GetFaceReaction(play, 5) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 5); this->unk_30B = 1; this->unk_300 = TEXT_STATE_DONE; this->actionFunc = func_80A5475C; @@ -231,11 +231,11 @@ void func_80A53278(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A5344C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5344C(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { this->unk_300 = TEXT_STATE_EVENT; - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees >= 10) { Rupees_ChangeBy(-10); @@ -255,20 +255,20 @@ void func_80A5344C(EnHeishi2* this, GlobalContext* globalCtx) { default: break; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } -void func_80A53538(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53538(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_300 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - func_8002DF54(globalCtx, NULL, 8); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if (this->unk_300 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + func_8002DF54(play, NULL, 8); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = func_80A535BC; } } -void func_80A535BC(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A535BC(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiSlamSpearAnim); this->unk_2EC = frameCount; @@ -276,11 +276,11 @@ void func_80A535BC(EnHeishi2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A53638; } -void func_80A53638(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53638(EnHeishi2* this, PlayState* play) { s32 pad; f32 frameCount = this->skelAnime.curFrame; - BgSpot15Saku* actor = (BgSpot15Saku*)globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + BgSpot15Saku* actor = (BgSpot15Saku*)play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; SkelAnime_Update(&this->skelAnime); if ((frameCount >= 12.0f) && (!this->audioFlag)) { @@ -303,14 +303,14 @@ void func_80A53638(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A5372C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5372C(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->unk_2F2[0] = 200; - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->subCamEye.x = 947.0f; this->subCamEye.y = 1195.0f; this->subCamEye.z = 2682.0f; @@ -319,41 +319,41 @@ void func_80A5372C(EnHeishi2* this, GlobalContext* globalCtx) { this->subCamAt.y = 1145.0f; this->subCamAt.z = 3014.0f; - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamEye, &this->subCamAt); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamEye, &this->subCamAt); this->actionFunc = func_80A53850; } -void func_80A53850(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53850(EnHeishi2* this, PlayState* play) { BgSpot15Saku* gate; SkelAnime_Update(&this->skelAnime); - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamEye, &this->subCamAt); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamEye, &this->subCamAt); gate = (BgSpot15Saku*)this->gate; if ((this->unk_2F2[0] == 0) || (gate->unk_168 == 0)) { - Play_ClearCamera(globalCtx, this->subCamId); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); - Message_CloseTextbox(globalCtx); + Play_ClearCamera(play, this->subCamId); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Message_CloseTextbox(play); this->unk_30C = 1; - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->actionFunc = func_80A531E4; } } -void func_80A53908(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53908(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A5399C; } -void func_80A5399C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5399C(EnHeishi2* this, PlayState* play) { s16 var; this->unk_30B = 0; var = 0; if (GET_INFTABLE(INFTABLE_76)) { if (!GET_INFTABLE(INFTABLE_77)) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_KEATON) { + if (Player_GetMask(play) == PLAYER_MASK_KEATON) { if (this->unk_309 == 0) { this->actor.textId = 0x200A; } else { @@ -372,9 +372,9 @@ void func_80A5399C(EnHeishi2* this, GlobalContext* globalCtx) { this->unk_300 = TEXT_STATE_EVENT; this->unk_30E = 0; } - if (Text_GetFaceReaction(globalCtx, 5) != 0) { + if (Text_GetFaceReaction(play, 5) != 0) { if (var == 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 5); + this->actor.textId = Text_GetFaceReaction(play, 5); this->unk_30B = 1; this->unk_300 = TEXT_STATE_DONE; this->unk_30E = 0; @@ -388,21 +388,21 @@ void func_80A5399C(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A53AD4(EnHeishi2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A53AD4(EnHeishi2* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 exchangeItemId; s16 yawDiffTemp; s16 yawDiff; SkelAnime_Update(&this->skelAnime); - if (Text_GetFaceReaction(globalCtx, 5) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 5); + if (Text_GetFaceReaction(play, 5) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 5); } else { this->actor.textId = 0x200E; } this->unk_300 = TEXT_STATE_DONE; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - exchangeItemId = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + exchangeItemId = func_8002F368(play); if (exchangeItemId == EXCH_ITEM_LETTER_ZELDA) { func_80078884(NA_SE_SY_CORRECT_CHIME); player->actor.textId = 0x2010; @@ -415,21 +415,21 @@ void func_80A53AD4(EnHeishi2* this, GlobalContext* globalCtx) { yawDiffTemp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; yawDiff = ABS(yawDiffTemp); if (!(120.0f < this->actor.xzDistToPlayer) && (yawDiff < 0x4300)) { - func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_LETTER_ZELDA); + func_8002F298(&this->actor, play, 100.0f, EXCH_ITEM_LETTER_ZELDA); } } } -void func_80A53C0C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53C0C(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk_300 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - func_8002DF54(globalCtx, 0, 8); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((this->unk_300 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + func_8002DF54(play, 0, 8); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = func_80A53C90; } } -void func_80A53C90(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53C90(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiSlamSpearAnim); this->unk_2EC = frameCount; @@ -437,13 +437,13 @@ void func_80A53C90(EnHeishi2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A53D0C; } -void func_80A53D0C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53D0C(EnHeishi2* this, PlayState* play) { s32 pad; f32 frameCount; BgGateShutter* gate; frameCount = this->skelAnime.curFrame; - gate = (BgGateShutter*)globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + gate = (BgGateShutter*)play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; SkelAnime_Update(&this->skelAnime); if (12.0f <= frameCount) { if (this->audioFlag == 0) { @@ -467,14 +467,14 @@ void func_80A53D0C(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A53DF8(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53DF8(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->unk_2F2[0] = 200; - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->subCamEyeInit.x = -71.0f; this->subCamEye.x = -71.0f; this->subCamEyeInit.y = 571.0f; @@ -487,60 +487,60 @@ void func_80A53DF8(EnHeishi2* this, GlobalContext* globalCtx) { this->subCamAt.y = 417.0f; this->subCamAtInit.z = -1079.0f; this->subCamAt.z = -1079.0f; - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamEye, &this->subCamAt); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamEye, &this->subCamAt); this->actionFunc = func_80A53F30; } -void func_80A53F30(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A53F30(EnHeishi2* this, PlayState* play) { BgGateShutter* gate; SkelAnime_Update(&this->skelAnime); - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamEye, &this->subCamAt); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamEye, &this->subCamAt); gate = (BgGateShutter*)this->gate; if ((this->unk_2F2[0] == 0) || (gate->openingState == 0)) { - Play_ClearCamera(globalCtx, this->subCamId); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->subCamId); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); if (this->unk_30A != 2) { if (this->unk_30A == 0) { this->actor.textId = 0x2015; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = func_80A54038; } else { - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, NULL, 7); + Message_CloseTextbox(play); + func_8002DF54(play, NULL, 7); this->actionFunc = func_80A53908; } } else { this->unk_30E = 0; this->actor.textId = 0x2021; Rupees_ChangeBy(15); - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = func_80A5427C; } } } -void func_80A54038(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A54038(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { SET_INFTABLE(INFTABLE_76); - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, 0, 7); + Message_CloseTextbox(play); + func_8002DF54(play, 0, 7); this->actionFunc = func_80A53908; } } -void func_80A540C0(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A540C0(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: this->actor.textId = 0x2020; - Message_ContinueTextbox(globalCtx, this->actor.textId); - Player_UnsetMask(globalCtx); + Message_ContinueTextbox(play, this->actor.textId); + Player_UnsetMask(play); SET_INFTABLE(INFTABLE_77); SET_ITEMGETINF(ITEMGETINF_38); - Item_Give(globalCtx, ITEM_SOLD_OUT); + Item_Give(play, ITEM_SOLD_OUT); if (this->unk_30A != 0) { this->unk_30A = 2; this->unk_30E = 1; @@ -553,7 +553,7 @@ void func_80A540C0(EnHeishi2* this, GlobalContext* globalCtx) { case 1: this->unk_30E = 1; this->actor.textId = 0x200C; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_300 = TEXT_STATE_EVENT; if (this->unk_30A == 0) { this->actionFunc = func_80A5427C; @@ -564,32 +564,32 @@ void func_80A540C0(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A541FC(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A541FC(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.textId = 0x2021; Rupees_ChangeBy(15); - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = func_80A5427C; } } -void func_80A5427C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5427C(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { if (this->unk_30E == 0) { this->unk_30E = 0; this->unk_30A = this->unk_30E; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = func_80A53908; } else { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = func_80A54320; } } } -void func_80A54320(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A54320(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiSlamSpearAnim); this->unk_2EC = frameCount; @@ -598,10 +598,10 @@ void func_80A54320(EnHeishi2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A543A0; } -void func_80A543A0(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A543A0(EnHeishi2* this, PlayState* play) { s32 pad; f32 frameCount = this->skelAnime.curFrame; - BgGateShutter* gate = (BgGateShutter*)(globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head); + BgGateShutter* gate = (BgGateShutter*)(play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head); SkelAnime_Update(&this->skelAnime); if ((frameCount >= 12.0f) && (!this->audioFlag)) { @@ -631,33 +631,33 @@ void func_80A543A0(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A544AC(EnHeishi2* this, GlobalContext* globalCtx) { +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); this->actor.world.rot.z = this->actor.shape.rot.z; if (this->actor.shape.rot.z < -6000) { - Message_StartTextbox(globalCtx, 0x708F, NULL); + Message_StartTextbox(play, 0x708F, NULL); this->actor.flags |= ACTOR_FLAG_16; this->actionFunc = func_80A5455C; this->unk_2E4 = 0.0f; } } -void func_80A5455C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5455C(EnHeishi2* this, PlayState* play) { s32 pad; Vec3f pos; f32 rotY; EnBom* bomb; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - func_8002DF54(globalCtx, NULL, 7); - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + func_8002DF54(play, NULL, 7); + Message_CloseTextbox(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; - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, pos.x, pos.y, pos.z, 0, rotY, 0, 0); + 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.speedXZ = Rand_CenteredFloat(5.0f) + 10.0f; bomb->actor.velocity.y = Rand_CenteredFloat(5.0f) + 10.0f; @@ -669,7 +669,7 @@ void func_80A5455C(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A546DC(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A546DC(EnHeishi2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, 200, 5, this->unk_2E4, 0); Math_ApproachF(&this->unk_2E4, 3000.0f, 1.0f, 500.0f); this->actor.world.rot.z = this->actor.shape.rot.z; @@ -678,12 +678,12 @@ void func_80A546DC(EnHeishi2* this, GlobalContext* globalCtx) { } } -void func_80A5475C(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A5475C(EnHeishi2* this, PlayState* play) { s16 yawDiff; SkelAnime_Update(&this->skelAnime); - if (Text_GetFaceReaction(globalCtx, 5) != 0) { + if (Text_GetFaceReaction(play, 5) != 0) { if (this->unk_30B == 0) { if (this->type == 2) { this->actionFunc = func_80A53278; @@ -705,7 +705,7 @@ void func_80A5475C(EnHeishi2* this, GlobalContext* globalCtx) { } } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->type == 2) { if (this->unk_30E == 1) { this->actionFunc = func_80A5344C; @@ -736,21 +736,21 @@ void func_80A5475C(EnHeishi2* this, GlobalContext* globalCtx) { ((yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)), !(this->actor.xzDistToPlayer > 120.0f)) && (yawDiff < 0x4300))) { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } -void func_80A54954(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A54954(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A549E8; } -void func_80A549E8(EnHeishi2* this, GlobalContext* globalCtx) { +void func_80A549E8(EnHeishi2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_300 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if (this->unk_300 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); if (this->type == 2) { this->actionFunc = func_80A531E4; } @@ -760,7 +760,7 @@ void func_80A549E8(EnHeishi2* this, GlobalContext* globalCtx) { } } -void EnHeishi2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi2_Update(Actor* thisx, PlayState* play) { s32 pad; EnHeishi2* this = (EnHeishi2*)thisx; s32 i; @@ -769,7 +769,7 @@ void EnHeishi2_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->type == 2) || (this->type == 5)) { this->actor.focus.pos.y = 70.0f; Actor_SetFocus(&this->actor, 70.0f); - func_80038290(globalCtx, &this->actor, &this->unk_260, &this->unk_26C, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_260, &this->unk_26C, this->actor.focus.pos); } this->unk_2FC++; @@ -779,7 +779,7 @@ void EnHeishi2_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_2F2[i]--; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); switch (this->type) { case 6: @@ -787,17 +787,16 @@ void EnHeishi2_Update(Actor* thisx, GlobalContext* globalCtx) { case 9: break; default: - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 30.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); break; } } -s32 EnHeishi2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnHeishi2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHeishi2* this = (EnHeishi2*)thisx; switch (this->type) { @@ -818,7 +817,7 @@ s32 EnHeishi2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnHeishi2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnHeishi2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnHeishi2* this = (EnHeishi2*)thisx; if (limbIndex == 16) { @@ -826,41 +825,41 @@ void EnHeishi2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnHeishi2_DrawKingGuard(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1772); +void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1772); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1774), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_heishi2.c", 1774), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gHeishiKingGuardDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1777); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1777); } -void EnHeishi2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi2_Draw(Actor* thisx, PlayState* play) { EnHeishi2* this = (EnHeishi2*)thisx; Mtx* mtx; s32 linkObjBankIndex; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1792); + OPEN_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1792); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi2_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi2_OverrideLimbDraw, EnHeishi2_PostLimbDraw, this); if ((this->type == 5) && GET_INFTABLE(INFTABLE_77)) { - linkObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_LINK_CHILD); + linkObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD); if (linkObjBankIndex >= 0) { Matrix_Put(&this->mtxf_330); Matrix_Translate(-570.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(70), MTXMODE_APPLY); - mtx = Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1820) - 7; + mtx = Matrix_NewMtx(play->state.gfxCtx, "../z_en_heishi2.c", 1820) - 7; - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[linkObjBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[linkObjBankIndex].segment); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx); gSPDisplayList(POLY_OPA_DISP++, gLinkChildKeatonMaskDL); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1834); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1834); } diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h index e3a648383a..631c71551a 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h @@ -7,7 +7,7 @@ struct EnHeishi2; -typedef void (*EnHeishi2ActionFunc)(struct EnHeishi2*, GlobalContext*); +typedef void (*EnHeishi2ActionFunc)(struct EnHeishi2*, PlayState*); typedef struct EnHeishi2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c index 4c10623fae..880be59346 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -10,18 +10,18 @@ #define FLAGS 0 -void EnHeishi3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi3_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHeishi3_Init(Actor* thisx, PlayState* play); +void EnHeishi3_Destroy(Actor* thisx, PlayState* play); +void EnHeishi3_Update(Actor* thisx, PlayState* play); +void EnHeishi3_Draw(Actor* thisx, PlayState* play); -void EnHeishi3_SetupGuardType(EnHeishi3* this, GlobalContext* globalCtx); -void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx); -void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, GlobalContext* globalCtx); -void EnHeishi3_CatchStart(EnHeishi3* this, GlobalContext* globalCtx); -void EnHeishi3_ResetAnimationToIdle(EnHeishi3* this, GlobalContext* globalCtx); -void func_80A55D00(EnHeishi3* this, GlobalContext* globalCtx); -void func_80A55BD4(EnHeishi3* this, GlobalContext* globalCtx); +void EnHeishi3_SetupGuardType(EnHeishi3* this, PlayState* play); +void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, PlayState* play); +void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, PlayState* play); +void EnHeishi3_CatchStart(EnHeishi3* this, PlayState* play); +void EnHeishi3_ResetAnimationToIdle(EnHeishi3* this, PlayState* play); +void func_80A55D00(EnHeishi3* this, PlayState* play); +void func_80A55BD4(EnHeishi3* this, PlayState* play); static s16 sPlayerCaught = 0; @@ -57,7 +57,7 @@ static ColliderCylinderInit sCylinderInit = { { 15, 70, 0, { 0, 0, 0 } }, }; -void EnHeishi3_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi3_Init(Actor* thisx, PlayState* play) { EnHeishi3* this = (EnHeishi3*)thisx; sPlayerCaught = 0; @@ -71,12 +71,11 @@ void EnHeishi3_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetScale(&this->actor, 0.01f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, - 17); + SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, 17); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 6; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); // "Castle Gate Soldier - Power Up" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 城門兵パワーアップ ☆☆☆☆☆ \n" VT_RST); @@ -85,13 +84,13 @@ void EnHeishi3_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnHeishi3_SetupGuardType; } -void EnHeishi3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi3_Destroy(Actor* thisx, PlayState* play) { EnHeishi3* this = (EnHeishi3*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnHeishi3_SetupGuardType(EnHeishi3* this, GlobalContext* globalCtx) { +void EnHeishi3_SetupGuardType(EnHeishi3* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -105,13 +104,13 @@ void EnHeishi3_SetupGuardType(EnHeishi3* this, GlobalContext* globalCtx) { /** * Handles the guards standing on Hyrule Castle Grounds. **/ -void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx) { +void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, PlayState* play) { Player* player; s16 yawDiff; s16 yawDiffNew; f32 sightRange; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; yawDiffNew = ABS(yawDiff); @@ -131,10 +130,10 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx) if ((this->actor.xzDistToPlayer < sightRange) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 100.0f) && (sPlayerCaught == 0)) { sPlayerCaught = 1; - Message_StartTextbox(globalCtx, 0x702D, &this->actor); + Message_StartTextbox(play, 0x702D, &this->actor); func_80078884(NA_SE_SY_FOUND); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->actionFunc = EnHeishi3_CatchStart; } } @@ -142,8 +141,8 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx) /** * Handles the guards standing in front of Hyrule Castle. **/ -void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if ((player->actor.world.pos.x < -190.0f) && (player->actor.world.pos.x > -380.0f) && @@ -159,15 +158,15 @@ void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, GlobalContext* globalCtx) } } sPlayerCaught = 1; - Message_StartTextbox(globalCtx, 0x702D, &this->actor); + Message_StartTextbox(play, 0x702D, &this->actor); func_80078884(NA_SE_SY_FOUND); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); this->actionFunc = EnHeishi3_CatchStart; } } -void EnHeishi3_CatchStart(EnHeishi3* this, GlobalContext* globalCtx) { +void EnHeishi3_CatchStart(EnHeishi3* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiWalkAnim); Animation_Change(&this->skelAnime, &gEnHeishiWalkAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -176,7 +175,7 @@ void EnHeishi3_CatchStart(EnHeishi3* this, GlobalContext* globalCtx) { this->actor.speedXZ = 2.5f; } -void func_80A55BD4(EnHeishi3* this, GlobalContext* globalCtx) { +void func_80A55BD4(EnHeishi3* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 17.0f)) { @@ -190,7 +189,7 @@ void func_80A55BD4(EnHeishi3* this, GlobalContext* globalCtx) { } } -void EnHeishi3_ResetAnimationToIdle(EnHeishi3* this, GlobalContext* globalCtx) { +void EnHeishi3_ResetAnimationToIdle(EnHeishi3* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -198,20 +197,20 @@ void EnHeishi3_ResetAnimationToIdle(EnHeishi3* this, GlobalContext* globalCtx) { } // This function initiates the respawn after the player gets caught. -void func_80A55D00(EnHeishi3* this, GlobalContext* globalCtx) { +void func_80A55D00(EnHeishi3* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx) && + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play) && (this->respawnFlag == 0)) { SET_EVENTCHKINF(EVENTCHKINF_4E); - globalCtx->nextEntranceIndex = ENTR_SPOT15_4; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT15_4; + play->transitionTrigger = TRANS_TRIGGER_START; this->respawnFlag = 1; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); gSaveContext.nextTransitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); } } -void EnHeishi3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi3_Update(Actor* thisx, PlayState* play) { EnHeishi3* this = (EnHeishi3*)thisx; s32 pad; @@ -220,17 +219,16 @@ void EnHeishi3_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->caughtTimer != 0) { this->caughtTimer -= 1; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.shape.rot = this->actor.world.rot; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnHeishi3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnHeishi3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHeishi3* this = (EnHeishi3*)thisx; if (limbIndex == 9) { @@ -245,10 +243,10 @@ s32 EnHeishi3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnHeishi3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi3_Draw(Actor* thisx, PlayState* play) { EnHeishi3* this = (EnHeishi3*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi3_OverrideLimbDraw, NULL, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi3_OverrideLimbDraw, NULL, this); } diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h index 824e721ca0..63b4311393 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h @@ -6,7 +6,7 @@ struct EnHeishi3; -typedef void (*EnHeishi3ActionFunc)(struct EnHeishi3*, GlobalContext*); +typedef void (*EnHeishi3ActionFunc)(struct EnHeishi3*, PlayState*); typedef struct EnHeishi3 { /* 0x0000 */ Actor actor; 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 b112eed95b..b0bccbb260 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -4,22 +4,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnHeishi4_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi4_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi4_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHeishi4_Init(Actor* thisx, PlayState* play); +void EnHeishi4_Destroy(Actor* thisx, PlayState* play); +void EnHeishi4_Update(Actor* thisx, PlayState* play); +void EnHeishi4_Draw(Actor* thisx, PlayState* play); -void func_80A56544(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A5673C(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56328(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A563BC(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56614(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56874(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56900(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56994(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56A50(EnHeishi4* this, GlobalContext* globalCtx); -void func_80A56ACC(EnHeishi4* this, GlobalContext* globalCtx); +void func_80A56544(EnHeishi4* this, PlayState* play); +void func_80A5673C(EnHeishi4* this, PlayState* play); +void func_80A56328(EnHeishi4* this, PlayState* play); +void func_80A563BC(EnHeishi4* this, PlayState* play); +void func_80A56B40(EnHeishi4* this, PlayState* play); +void func_80A56614(EnHeishi4* this, PlayState* play); +void func_80A56874(EnHeishi4* this, PlayState* play); +void func_80A56900(EnHeishi4* this, PlayState* play); +void func_80A56994(EnHeishi4* this, PlayState* play); +void func_80A56A50(EnHeishi4* this, PlayState* play); +void func_80A56ACC(EnHeishi4* this, PlayState* play); const ActorInit En_Heishi4_InitVars = { ACTOR_EN_HEISHI4, @@ -55,7 +55,7 @@ static ColliderCylinderInit sCylinderInit = { { 33, 40, 0, { 0, 0, 0 } }, }; -void EnHeishi4_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi4_Init(Actor* thisx, PlayState* play) { EnHeishi4* this = (EnHeishi4*)thisx; Actor_SetScale(thisx, 0.01f); @@ -66,16 +66,16 @@ void EnHeishi4_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->type == HEISHI4_AT_MARKET_DYING) { this->height = 30.0f; ActorShape_Init(&thisx->shape, 0.0f, NULL, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiDyingGuardAnim_00C444, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiDyingGuardAnim_00C444, this->jointTable, this->morphTable, 17); } else { this->height = 60.0f; ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, - this->morphTable, 17); + SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, + 17); } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); this->collider.dim.yShift = 0; this->collider.dim.radius = 15; this->collider.dim.height = 70; @@ -101,20 +101,20 @@ void EnHeishi4_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); } -void EnHeishi4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi4_Destroy(Actor* thisx, PlayState* play) { EnHeishi4* this = (EnHeishi4*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80A56328(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56328(EnHeishi4* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frames, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A563BC; } -void func_80A563BC(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A563BC(EnHeishi4* this, PlayState* play) { s16 reactionOffset; this->unk_2B4 = 0; @@ -125,8 +125,8 @@ void func_80A563BC(EnHeishi4* this, GlobalContext* globalCtx) { if (reactionOffset >= 3) { reactionOffset = 1; } - if (Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]); + if (Text_GetFaceReaction(play, sFaceReactionSets[reactionOffset]) != 0) { + this->actor.textId = Text_GetFaceReaction(play, sFaceReactionSets[reactionOffset]); this->unk_2B4 = 1; this->actionFunc = func_80A56B40; } else { @@ -162,7 +162,7 @@ void func_80A563BC(EnHeishi4* this, GlobalContext* globalCtx) { } } -void func_80A56544(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56544(EnHeishi4* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frames, ANIMMODE_LOOP, -10.0f); @@ -174,7 +174,7 @@ void func_80A56544(EnHeishi4* this, GlobalContext* globalCtx) { } } -void func_80A56614(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56614(EnHeishi4* this, PlayState* play) { s16 reactionOffset; reactionOffset = this->type - 4; @@ -185,19 +185,19 @@ void func_80A56614(EnHeishi4* this, GlobalContext* globalCtx) { if (reactionOffset >= 3) { reactionOffset = 1; } - if (Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]); + if (Text_GetFaceReaction(play, sFaceReactionSets[reactionOffset]) != 0) { + this->actor.textId = Text_GetFaceReaction(play, sFaceReactionSets[reactionOffset]); this->unk_2B4 = 1; this->actionFunc = func_80A56B40; return; } - if (globalCtx->sceneNum == SCENE_MIHARIGOYA) { + if (play->sceneNum == SCENE_MIHARIGOYA) { if (IS_DAY) { this->actor.textId = 0x7004; } else { this->actor.textId = 0x709A; } - } else if (globalCtx->sceneNum != SCENE_MARKET_NIGHT) { + } else if (play->sceneNum != SCENE_MARKET_NIGHT) { if (IS_DAY) { this->actor.textId = 0x7002; } else { @@ -210,7 +210,7 @@ void func_80A56614(EnHeishi4* this, GlobalContext* globalCtx) { this->actionFunc = func_80A56B40; } -void func_80A5673C(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A5673C(EnHeishi4* this, PlayState* play) { if (GET_EVENTCHKINF(EVENTCHKINF_45)) { osSyncPrintf(VT_FGCOL(YELLOW) " ☆☆☆☆☆ マスターソード祝入手! ☆☆☆☆☆ \n" VT_RST); Actor_Kill(&this->actor); @@ -237,11 +237,11 @@ void func_80A5673C(EnHeishi4* this, GlobalContext* globalCtx) { } } -void func_80A56874(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56874(EnHeishi4* this, PlayState* play) { if (this->unk_284 != 0) { SkelAnime_Update(&this->skelAnime); } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->unk_284 == 0) { this->actionFunc = func_80A5673C; @@ -249,29 +249,29 @@ void func_80A56874(EnHeishi4* this, GlobalContext* globalCtx) { this->actionFunc = func_80A56900; } } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } -void func_80A56900(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56900(EnHeishi4* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&gEnHeishiDyingGuardTalkAnim); Animation_Change(&this->skelAnime, &gEnHeishiDyingGuardTalkAnim, 1.0f, 0.0f, (s16)frames, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A56994; } -void func_80A56994(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56994(EnHeishi4* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - func_80038290(globalCtx, &this->actor, &this->unk_260, &this->unk_266, this->actor.focus.pos); - if ((this->unk_282 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + func_80038290(play, &this->actor, &this->unk_260, &this->unk_266, this->actor.focus.pos); + if ((this->unk_282 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); SET_INFTABLE(INFTABLE_6C); - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = func_80A56A50; } } -void func_80A56A50(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56A50(EnHeishi4* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&gEnHeishiDyingGuardDieAnim); this->unk_288 = frames; @@ -279,17 +279,17 @@ void func_80A56A50(EnHeishi4* this, GlobalContext* globalCtx) { this->actionFunc = func_80A56ACC; } -void func_80A56ACC(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56ACC(EnHeishi4* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); if (this->unk_288 <= currentFrame) { - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->actionFunc = func_80A5673C; } } -void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx) { +void func_80A56B40(EnHeishi4* this, PlayState* play) { s16 reactionOffset; SkelAnime_Update(&this->skelAnime); @@ -300,7 +300,7 @@ void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx) { if (reactionOffset >= 3) { reactionOffset = 1; } - if (Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]) != 0) { + if (Text_GetFaceReaction(play, sFaceReactionSets[reactionOffset]) != 0) { if (this->unk_2B4 == 0) { if ((this->type == HEISHI4_AT_KAKRIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) { this->actionFunc = func_80A563BC; @@ -323,7 +323,7 @@ void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx) { } } } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if ((this->type == HEISHI4_AT_KAKRIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) { this->unk_284 = 1; this->actionFunc = func_80A563BC; @@ -334,13 +334,13 @@ void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx) { return; } } - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } -void EnHeishi4_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi4_Update(Actor* thisx, PlayState* play) { EnHeishi4* this = (EnHeishi4*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); thisx->world.pos.x = this->pos.x; thisx->world.pos.y = this->pos.y; @@ -356,17 +356,16 @@ void EnHeishi4_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_266 = this->unk_28C.unk_0E; } this->unk_27E += 1; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 10.0f, 10.0f, 30.0f, + Actor_UpdateBgCheckInfo(play, thisx, 10.0f, 10.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnHeishi_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnHeishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHeishi4* this = (EnHeishi4*)thisx; if (limbIndex == 9) { @@ -379,10 +378,10 @@ s32 EnHeishi_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return false; } -void EnHeishi4_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi4_Draw(Actor* thisx, PlayState* play) { EnHeishi4* this = (EnHeishi4*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi_OverrideLimbDraw, NULL, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi_OverrideLimbDraw, NULL, this); } diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h index 7af01e3fb1..0d254f4324 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h @@ -13,7 +13,7 @@ typedef enum { struct EnHeishi4; -typedef void (*EnHeishi4ActionFunc)(struct EnHeishi4*, GlobalContext*); +typedef void (*EnHeishi4ActionFunc)(struct EnHeishi4*, PlayState*); typedef struct EnHeishi4 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index af2b75fbf4..fb180b101e 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -9,23 +9,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnHintnuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHintnuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHintnuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHintnuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHintnuts_Init(Actor* thisx, PlayState* play); +void EnHintnuts_Destroy(Actor* thisx, PlayState* play); +void EnHintnuts_Update(Actor* thisx, PlayState* play); +void EnHintnuts_Draw(Actor* thisx, PlayState* play); void EnHintnuts_SetupWait(EnHintnuts* this); -void EnHintnuts_Wait(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_LookAround(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Stand(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_ThrowNut(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Burrow(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_BeginRun(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_BeginFreeze(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Run(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Talk(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx); -void EnHintnuts_Freeze(EnHintnuts* this, GlobalContext* globalCtx); +void EnHintnuts_Wait(EnHintnuts* this, PlayState* play); +void EnHintnuts_LookAround(EnHintnuts* this, PlayState* play); +void EnHintnuts_Stand(EnHintnuts* this, PlayState* play); +void EnHintnuts_ThrowNut(EnHintnuts* this, PlayState* play); +void EnHintnuts_Burrow(EnHintnuts* this, PlayState* play); +void EnHintnuts_BeginRun(EnHintnuts* this, PlayState* play); +void EnHintnuts_BeginFreeze(EnHintnuts* this, PlayState* play); +void EnHintnuts_Run(EnHintnuts* this, PlayState* play); +void EnHintnuts_Talk(EnHintnuts* this, PlayState* play); +void EnHintnuts_Leave(EnHintnuts* this, PlayState* play); +void EnHintnuts_Freeze(EnHintnuts* this, PlayState* play); const ActorInit En_Hintnuts_InitVars = { ACTOR_EN_HINTNUTS, @@ -69,7 +69,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2600, ICHAIN_STOP), }; -void EnHintnuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHintnuts_Init(Actor* thisx, PlayState* play) { EnHintnuts* this = (EnHintnuts*)thisx; s32 pad; @@ -78,41 +78,41 @@ void EnHintnuts_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); } else { ActorShape_Init(&this->actor.shape, 0x0, ActorShadow_DrawCircle, 35.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gHintNutsSkel, &gHintNutsStandAnim, this->jointTable, - this->morphTable, 10); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_Init(play, &this->skelAnime, &gHintNutsSkel, &gHintNutsStandAnim, this->jointTable, this->morphTable, + 10); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - Actor_SetTextWithPrefix(globalCtx, &this->actor, (this->actor.params >> 8) & 0xFF); + Actor_SetTextWithPrefix(play, &this->actor, (this->actor.params >> 8) & 0xFF); this->textIdCopy = this->actor.textId; this->actor.params &= 0xFF; sPuzzleCounter = 0; if (this->actor.textId == 0x109B) { - if (Flags_GetClear(globalCtx, 0x9) != 0) { + if (Flags_GetClear(play, 0x9) != 0) { Actor_Kill(&this->actor); return; } } EnHintnuts_SetupWait(this); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_HINTNUTS, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HINTNUTS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 0xA); } } -void EnHintnuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHintnuts_Destroy(Actor* thisx, PlayState* play) { EnHintnuts* this = (EnHintnuts*)thisx; if (this->actor.params != 0xA) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnHintnuts_HitByScrubProjectile1(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_HitByScrubProjectile1(EnHintnuts* this, PlayState* play) { if (this->actor.textId != 0 && this->actor.category == ACTORCAT_ENEMY && ((this->actor.params == 0) || (sPuzzleCounter == 2))) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_BG); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BG); } } @@ -189,7 +189,7 @@ void EnHintnuts_SetupTalk(EnHintnuts* this) { this->actor.speedXZ = 0.0f; } -void EnHintnuts_SetupLeave(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_SetupLeave(EnHintnuts* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gHintNutsRunAnim, -5.0f); this->actor.speedXZ = 3.0f; this->animFlagAndTimer = 100; @@ -197,7 +197,7 @@ void EnHintnuts_SetupLeave(EnHintnuts* this, GlobalContext* globalCtx) { this->collider.base.ocFlags1 &= ~OC1_ON; this->actor.flags |= ACTOR_FLAG_4; Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DAMAGE); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0x0, 0x0, 0x0, 0x3); // recovery heart this->actionFunc = EnHintnuts_Leave; } @@ -216,7 +216,7 @@ void EnHintnuts_SetupFreeze(EnHintnuts* this) { this->actionFunc = EnHintnuts_Freeze; } -void EnHintnuts_Wait(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Wait(EnHintnuts* this, PlayState* play) { s32 hasSlowPlaybackSpeed = false; if (this->skelAnime.playSpeed < 0.5f) { @@ -249,7 +249,7 @@ void EnHintnuts_Wait(EnHintnuts* this, GlobalContext* globalCtx) { } } -void EnHintnuts_LookAround(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_LookAround(EnHintnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->animFlagAndTimer != 0) { this->animFlagAndTimer--; @@ -259,7 +259,7 @@ void EnHintnuts_LookAround(EnHintnuts* this, GlobalContext* globalCtx) { } } -void EnHintnuts_Stand(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Stand(EnHintnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->animFlagAndTimer != 0) { this->animFlagAndTimer--; @@ -274,7 +274,7 @@ void EnHintnuts_Stand(EnHintnuts* this, GlobalContext* globalCtx) { } } -void EnHintnuts_ThrowNut(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_ThrowNut(EnHintnuts* this, PlayState* play) { Vec3f nutPos; Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); @@ -286,14 +286,14 @@ void EnHintnuts_ThrowNut(EnHintnuts* this, GlobalContext* globalCtx) { nutPos.x = this->actor.world.pos.x + (Math_SinS(this->actor.shape.rot.y) * 23.0f); nutPos.y = this->actor.world.pos.y + 12.0f; nutPos.z = this->actor.world.pos.z + (Math_CosS(this->actor.shape.rot.y) * 23.0f); - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NUTSBALL, nutPos.x, nutPos.y, nutPos.z, - this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 1) != NULL) { + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, nutPos.x, nutPos.y, nutPos.z, this->actor.shape.rot.x, + this->actor.shape.rot.y, this->actor.shape.rot.z, 1) != NULL) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW); } } } -void EnHintnuts_Burrow(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Burrow(EnHintnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnHintnuts_SetupWait(this); } else { @@ -307,7 +307,7 @@ void EnHintnuts_Burrow(EnHintnuts* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.world.pos.z, this->actor.home.pos.z, 0.5f, 3.0f); } -void EnHintnuts_BeginRun(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_BeginRun(EnHintnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_196 = this->actor.yawTowardsPlayer + 0x8000; EnHintnuts_SetupRun(this); @@ -315,13 +315,13 @@ void EnHintnuts_BeginRun(EnHintnuts* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); } -void EnHintnuts_BeginFreeze(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_BeginFreeze(EnHintnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnHintnuts_SetupFreeze(this); } } -void EnHintnuts_CheckProximity(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_CheckProximity(EnHintnuts* this, PlayState* play) { if (this->actor.category != ACTORCAT_ENEMY) { if ((this->collider.base.ocFlags1 & OC1_HIT) || this->actor.isTargeted) { this->actor.flags |= ACTOR_FLAG_16; @@ -330,12 +330,12 @@ void EnHintnuts_CheckProximity(EnHintnuts* this, GlobalContext* globalCtx) { } if (this->actor.xzDistToPlayer < 130.0f) { this->actor.textId = this->textIdCopy; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } } -void EnHintnuts_Run(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Run(EnHintnuts* this, PlayState* play) { s32 temp_ret; s16 diffRotInit; s16 diffRot; @@ -371,7 +371,7 @@ void EnHintnuts_Run(EnHintnuts* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { EnHintnuts_SetupTalk(this); } else if (this->animFlagAndTimer == 0 && Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 20.0f && fabsf(this->actor.world.pos.y - this->actor.home.pos.y) < 2.0f) { @@ -379,23 +379,23 @@ void EnHintnuts_Run(EnHintnuts* this, GlobalContext* globalCtx) { if (this->actor.category == ACTORCAT_BG) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_16); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } EnHintnuts_SetupBurrow(this); } else { - EnHintnuts_CheckProximity(this, globalCtx); + EnHintnuts_CheckProximity(this, play); } } -void EnHintnuts_Talk(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Talk(EnHintnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x3, 0x400, 0x100); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) { - EnHintnuts_SetupLeave(this, globalCtx); + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) { + EnHintnuts_SetupLeave(this, play); } } -void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Leave(EnHintnuts* this, PlayState* play) { s16 temp_a1; SkelAnime_Update(&this->skelAnime); @@ -408,29 +408,29 @@ void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { temp_a1 = this->actor.wallYaw; } else { - temp_a1 = this->actor.yawTowardsPlayer - Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - 0x8000; + temp_a1 = this->actor.yawTowardsPlayer - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - 0x8000; if (ABS(temp_a1) >= 0x4001) { - temp_a1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000; + temp_a1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000; } else { - temp_a1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - (temp_a1 >> 1) + 0x8000; + temp_a1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - (temp_a1 >> 1) + 0x8000; } } Math_ScaledStepToS(&this->actor.shape.rot.y, temp_a1, 0x800); this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->animFlagAndTimer == 0) || (this->actor.projectedPos.z < 0.0f)) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); if (this->actor.params == 3) { - Flags_SetClear(globalCtx, this->actor.room); + Flags_SetClear(play, this->actor.room); sPuzzleCounter = 3; } if (this->actor.child != NULL) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, this->actor.child, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, this->actor.child, ACTORCAT_PROP); } Actor_Kill(&this->actor); } } -void EnHintnuts_Freeze(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_Freeze(EnHintnuts* this, PlayState* play) { this->actor.colorFilterTimer = 1; SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { @@ -439,7 +439,7 @@ void EnHintnuts_Freeze(EnHintnuts* this, GlobalContext* globalCtx) { if (this->animFlagAndTimer == 0) { if (sPuzzleCounter == 3) { if (this->actor.child != NULL) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, this->actor.child, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, this->actor.child, ACTORCAT_PROP); } this->animFlagAndTimer = 1; } else if (sPuzzleCounter == -4) { @@ -458,40 +458,40 @@ void EnHintnuts_Freeze(EnHintnuts* this, GlobalContext* globalCtx) { } } -void EnHintnuts_ColliderCheck(EnHintnuts* this, GlobalContext* globalCtx) { +void EnHintnuts_ColliderCheck(EnHintnuts* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, true); if (this->collider.base.ac->id != ACTOR_EN_NUTSBALL) { EnHintnuts_SetupBurrow(this); } else { - EnHintnuts_HitByScrubProjectile1(this, globalCtx); + EnHintnuts_HitByScrubProjectile1(this, play); EnHintnuts_HitByScrubProjectile2(this); } - } else if (globalCtx->actorCtx.unk_02 != 0) { - EnHintnuts_HitByScrubProjectile1(this, globalCtx); + } else if (play->actorCtx.unk_02 != 0) { + EnHintnuts_HitByScrubProjectile1(this, play); EnHintnuts_HitByScrubProjectile2(this); } } -void EnHintnuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHintnuts_Update(Actor* thisx, PlayState* play) { EnHintnuts* this = (EnHintnuts*)thisx; s32 pad; if (this->actor.params != 0xA) { - EnHintnuts_ColliderCheck(this, globalCtx); - this->actionFunc(this, globalCtx); + EnHintnuts_ColliderCheck(this, play); + this->actionFunc(this, play); if (this->actionFunc != EnHintnuts_Freeze && this->actionFunc != EnHintnuts_BeginFreeze) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo( - globalCtx, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, + UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | + UPDBGCHECKINFO_FLAG_4); } Collider_UpdateCylinder(&this->actor, &this->collider); if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actionFunc == EnHintnuts_Wait) { Actor_SetFocus(&this->actor, this->skelAnime.curFrame); } else if (this->actionFunc == EnHintnuts_Burrow) { @@ -503,8 +503,7 @@ void EnHintnuts_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnHintnuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnHintnuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Vec3f vec; f32 curFrame; EnHintnuts* this = (EnHintnuts*)thisx; @@ -532,13 +531,13 @@ s32 EnHintnuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnHintnuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHintnuts_Draw(Actor* thisx, PlayState* play) { EnHintnuts* this = (EnHintnuts*)thisx; if (this->actor.params == 0xA) { - Gfx_DrawDListOpa(globalCtx, gHintNutsFlowerDL); + Gfx_DrawDListOpa(play, gHintNutsFlowerDL); } else { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHintnuts_OverrideLimbDraw, - NULL, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHintnuts_OverrideLimbDraw, NULL, + this); } } diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h index f474591b31..fcc0201659 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h @@ -6,7 +6,7 @@ struct EnHintnuts; -typedef void (*EnHintnutsActionFunc)(struct EnHintnuts*, GlobalContext*); +typedef void (*EnHintnutsActionFunc)(struct EnHintnuts*, PlayState*); typedef struct EnHintnuts { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index 44ab9353e0..cf17d5b8a7 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -10,18 +10,18 @@ #define PLANE_HALFWIDTH 100.0f #define PLANE_HALFWIDTH_2 200.0f -void EnHoll_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHoll_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHoll_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHoll_Init(Actor* thisx, PlayState* play); +void EnHoll_Destroy(Actor* thisx, PlayState* play); +void EnHoll_Update(Actor* thisx, PlayState* play); +void EnHoll_Draw(Actor* thisx, PlayState* play); -void EnHoll_NextAction(EnHoll* this, GlobalContext* globalCtx); -void func_80A58DD4(EnHoll* this, GlobalContext* globalCtx); -void func_80A59014(EnHoll* this, GlobalContext* globalCtx); -void func_80A591C0(EnHoll* this, GlobalContext* globalCtx); -void func_80A593A4(EnHoll* this, GlobalContext* globalCtx); -void func_80A59520(EnHoll* this, GlobalContext* globalCtx); -void func_80A59618(EnHoll* this, GlobalContext* globalCtx); +void EnHoll_NextAction(EnHoll* this, PlayState* play); +void func_80A58DD4(EnHoll* this, PlayState* play); +void func_80A59014(EnHoll* this, PlayState* play); +void func_80A591C0(EnHoll* this, PlayState* play); +void func_80A593A4(EnHoll* this, PlayState* play); +void func_80A59520(EnHoll* this, PlayState* play); +void func_80A59618(EnHoll* this, PlayState* play); const ActorInit En_Holl_InitVars = { ACTOR_EN_HOLL, @@ -91,7 +91,7 @@ void EnHoll_ChooseAction(EnHoll* this) { } } -void EnHoll_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Init(Actor* thisx, PlayState* play) { EnHoll* this = (EnHoll*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -99,27 +99,27 @@ void EnHoll_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_14F = 0; } -void EnHoll_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Destroy(Actor* thisx, PlayState* play) { s32 transitionActorIdx = (u16)thisx->params >> 0xA; - TransitionActorEntry* transitionEntry = &globalCtx->transiActorCtx.list[transitionActorIdx]; + TransitionActorEntry* transitionEntry = &play->transiActorCtx.list[transitionActorIdx]; transitionEntry->id = -transitionEntry->id; } -void EnHoll_SwapRooms(GlobalContext* globalCtx) { +void EnHoll_SwapRooms(PlayState* play) { Room tempRoom; - RoomContext* roomCtx = &globalCtx->roomCtx; + RoomContext* roomCtx = &play->roomCtx; tempRoom = roomCtx->curRoom; roomCtx->curRoom = roomCtx->prevRoom; roomCtx->prevRoom = tempRoom; - globalCtx->roomCtx.unk_30 ^= 1; + play->roomCtx.unk_30 ^= 1; } // Horizontal Planes -void func_80A58DD4(EnHoll* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - s32 phi_t0 = ((globalCtx->sceneNum == SCENE_JYASINZOU) ? 1 : 0) & 0xFFFFFFFF; +void func_80A58DD4(EnHoll* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 phi_t0 = ((play->sceneNum == SCENE_JYASINZOU) ? 1 : 0) & 0xFFFFFFFF; Vec3f vec; f32 absZ; s32 transitionActorIdx; @@ -131,21 +131,21 @@ void func_80A58DD4(EnHoll* this, GlobalContext* globalCtx) { absZ < sHorizTriggerDists[phi_t0][0]) { transitionActorIdx = (u16)this->actor.params >> 0xA; if (absZ > sHorizTriggerDists[phi_t0][1]) { - if (globalCtx->roomCtx.prevRoom.num >= 0 && globalCtx->roomCtx.status == 0) { - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[this->side].room; - EnHoll_SwapRooms(globalCtx); - func_80097534(globalCtx, &globalCtx->roomCtx); + if (play->roomCtx.prevRoom.num >= 0 && play->roomCtx.status == 0) { + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[this->side].room; + EnHoll_SwapRooms(play); + func_80097534(play, &play->roomCtx); } } else { - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[this->side ^ 1].room; - if (globalCtx->roomCtx.prevRoom.num < 0) { - func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room); + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[this->side ^ 1].room; + if (play->roomCtx.prevRoom.num < 0) { + func_8009728C(play, &play->roomCtx, this->actor.room); } else { this->planeAlpha = (255.0f / (sHorizTriggerDists[phi_t0][2] - sHorizTriggerDists[phi_t0][3])) * (absZ - sHorizTriggerDists[phi_t0][3]); this->planeAlpha = CLAMP(this->planeAlpha, 0, 255); - if (globalCtx->roomCtx.curRoom.num != this->actor.room) { - EnHoll_SwapRooms(globalCtx); + if (play->roomCtx.curRoom.num != this->actor.room) { + EnHoll_SwapRooms(play); } } } @@ -153,15 +153,15 @@ void func_80A58DD4(EnHoll* this, GlobalContext* globalCtx) { } // Horizontal Planes -void func_80A59014(EnHoll* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - s32 useViewEye = gDbgCamEnabled || globalCtx->csCtx.state != CS_STATE_IDLE; +void func_80A59014(EnHoll* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 useViewEye = gDbgCamEnabled || play->csCtx.state != CS_STATE_IDLE; Vec3f vec; s32 temp; f32 planeHalfWidth; f32 absZ; - func_8002DBD0(&this->actor, &vec, (useViewEye) ? &globalCtx->view.eye : &player->actor.world.pos); + func_8002DBD0(&this->actor, &vec, (useViewEye) ? &play->view.eye : &player->actor.world.pos); planeHalfWidth = (((this->actor.params >> 6) & 7) == 6) ? PLANE_HALFWIDTH : PLANE_HALFWIDTH_2; temp = EnHoll_IsKokiriSetup8(); @@ -169,14 +169,14 @@ void func_80A59014(EnHoll* this, GlobalContext* globalCtx) { (absZ = fabsf(vec.z), 100.0f > absZ && absZ > 50.0f))) { s32 transitionActorIdx = (u16)this->actor.params >> 0xA; s32 side = (vec.z < 0.0f) ? 0 : 1; - TransitionActorEntry* transitionEntry = &globalCtx->transiActorCtx.list[transitionActorIdx]; + TransitionActorEntry* transitionEntry = &play->transiActorCtx.list[transitionActorIdx]; s32 room = transitionEntry->sides[side].room; this->actor.room = room; if (temp) {} - if (this->actor.room != globalCtx->roomCtx.curRoom.num) { + if (this->actor.room != play->roomCtx.curRoom.num) { if (room) {} - if (func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room)) { + if (func_8009728C(play, &play->roomCtx, this->actor.room)) { EnHoll_SetupAction(this, EnHoll_NextAction); } } @@ -184,67 +184,67 @@ void func_80A59014(EnHoll* this, GlobalContext* globalCtx) { } // Vertical Planes -void func_80A591C0(EnHoll* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A591C0(EnHoll* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 absY = fabsf(this->actor.yDistToPlayer); s32 transitionActorIdx; if (this->actor.xzDistToPlayer < 500.0f && absY < 700.0f) { transitionActorIdx = (u16)this->actor.params >> 0xA; if (absY < 95.0f) { - globalCtx->unk_11E18 = 0xFF; + play->unk_11E18 = 0xFF; } else if (absY > 605.0f) { - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0; } else { - globalCtx->unk_11E18 = (s16)(605.0f - absY) * 0.5f; + play->unk_11E18 = (s16)(605.0f - absY) * 0.5f; } if (absY < 95.0f) { - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[1].room; + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[1].room; Math_SmoothStepToF(&player->actor.world.pos.x, this->actor.world.pos.x, 1.0f, 50.0f, 10.0f); Math_SmoothStepToF(&player->actor.world.pos.z, this->actor.world.pos.z, 1.0f, 50.0f, 10.0f); - if (this->actor.room != globalCtx->roomCtx.curRoom.num && - func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room) != 0) { + if (this->actor.room != play->roomCtx.curRoom.num && + func_8009728C(play, &play->roomCtx, this->actor.room) != 0) { EnHoll_SetupAction(this, EnHoll_NextAction); this->unk_14F = 1; player->actor.speedXZ = 0.0f; } } } else if (this->unk_14F != 0) { - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0; this->unk_14F = 0; } } // Vertical Planes -void func_80A593A4(EnHoll* this, GlobalContext* globalCtx) { +void func_80A593A4(EnHoll* this, PlayState* play) { f32 absY; s32 side; s32 transitionActorIdx; if ((this->actor.xzDistToPlayer < 120.0f) && (absY = fabsf(this->actor.yDistToPlayer), absY < 200.0f)) { if (absY < 50.0f) { - globalCtx->unk_11E18 = 0xFF; + play->unk_11E18 = 0xFF; } else { - globalCtx->unk_11E18 = (200.0f - absY) * 1.7f; + play->unk_11E18 = (200.0f - absY) * 1.7f; } if (absY > 50.0f) { transitionActorIdx = (u16)this->actor.params >> 0xA; side = (0.0f < this->actor.yDistToPlayer) ? 0 : 1; - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[side].room; - if (this->actor.room != globalCtx->roomCtx.curRoom.num && - func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room) != 0) { + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[side].room; + if (this->actor.room != play->roomCtx.curRoom.num && + func_8009728C(play, &play->roomCtx, this->actor.room) != 0) { EnHoll_SetupAction(this, EnHoll_NextAction); this->unk_14F = 1; } } } else if (this->unk_14F != 0) { this->unk_14F = 0; - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0; } } // Vertical Planes -void func_80A59520(EnHoll* this, GlobalContext* globalCtx) { +void func_80A59520(EnHoll* this, PlayState* play) { f32 absY; s8 side; s32 transitionActorIdx; @@ -254,9 +254,9 @@ void func_80A59520(EnHoll* this, GlobalContext* globalCtx) { if (absY < 200.0f && absY > 50.0f) { transitionActorIdx = (u16)this->actor.params >> 0xA; side = (0.0f < this->actor.yDistToPlayer) ? 0 : 1; - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[side].room; - if (this->actor.room != globalCtx->roomCtx.curRoom.num && - func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room) != 0) { + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[side].room; + if (this->actor.room != play->roomCtx.curRoom.num && + func_8009728C(play, &play->roomCtx, this->actor.room) != 0) { EnHoll_SetupAction(this, EnHoll_NextAction); } } @@ -264,16 +264,16 @@ void func_80A59520(EnHoll* this, GlobalContext* globalCtx) { } // Horizontal Planes -void func_80A59618(EnHoll* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A59618(EnHoll* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f vec; f32 absZ; s32 side; s32 transitionActorIdx; - if (!Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { + if (!Flags_GetSwitch(play, this->actor.params & 0x3F)) { if (this->unk_14F != 0) { - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0; this->unk_14F = 0; } } else { @@ -282,53 +282,53 @@ void func_80A59618(EnHoll* this, GlobalContext* globalCtx) { if (PLANE_Y_MIN < vec.y && vec.y < PLANE_Y_MAX && fabsf(vec.x) < PLANE_HALFWIDTH_2 && absZ < 100.0f) { this->unk_14F = 1; transitionActorIdx = (u16)this->actor.params >> 0xA; - globalCtx->unk_11E18 = 0xFF - (s32)((absZ - 50.0f) * 5.9f); - if (globalCtx->unk_11E18 >= 0x100) { - globalCtx->unk_11E18 = 0xFF; - } else if (globalCtx->unk_11E18 < 0) { - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0xFF - (s32)((absZ - 50.0f) * 5.9f); + if (play->unk_11E18 >= 0x100) { + play->unk_11E18 = 0xFF; + } else if (play->unk_11E18 < 0) { + play->unk_11E18 = 0; } if (absZ < 50.0f) { side = (vec.z < 0.0f) ? 0 : 1; - this->actor.room = globalCtx->transiActorCtx.list[transitionActorIdx].sides[side].room; - if (this->actor.room != globalCtx->roomCtx.curRoom.num && - func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room) != 0) { + this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[side].room; + if (this->actor.room != play->roomCtx.curRoom.num && + func_8009728C(play, &play->roomCtx, this->actor.room) != 0) { EnHoll_SetupAction(this, EnHoll_NextAction); } } } else if (this->unk_14F != 0) { - globalCtx->unk_11E18 = 0; + play->unk_11E18 = 0; this->unk_14F = 0; } } } -void EnHoll_NextAction(EnHoll* this, GlobalContext* globalCtx) { - if (!EnHoll_IsKokiriSetup8() && globalCtx->roomCtx.status == 0) { - func_80097534(globalCtx, &globalCtx->roomCtx); - if (globalCtx->unk_11E18 == 0) { +void EnHoll_NextAction(EnHoll* this, PlayState* play) { + if (!EnHoll_IsKokiriSetup8() && play->roomCtx.status == 0) { + func_80097534(play, &play->roomCtx); + if (play->unk_11E18 == 0) { this->unk_14F = 0; } EnHoll_ChooseAction(this); } } -void EnHoll_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Update(Actor* thisx, PlayState* play) { EnHoll* this = (EnHoll*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } #include "overlays/ovl_En_Holl/ovl_En_Holl.c" -void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Draw(Actor* thisx, PlayState* play) { EnHoll* this = (EnHoll*)thisx; Gfx* gfxP; u32 setupDlIdx; // Only draw the plane if not invisible if (this->planeAlpha != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_holl.c", 805); + OPEN_DISPS(play->state.gfxCtx, "../z_en_holl.c", 805); if (this->planeAlpha == 255) { gfxP = POLY_OPA_DISP; @@ -342,7 +342,7 @@ void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(M_PI, MTXMODE_APPLY); } - gSPMatrix(gfxP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_holl.c", 824), + gSPMatrix(gfxP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_holl.c", 824), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(gfxP++, 0, 0, 0, 0, 0, (u8)this->planeAlpha); gSPDisplayList(gfxP++, sPlaneDL); @@ -353,6 +353,6 @@ void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = gfxP; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_holl.c", 831); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_holl.c", 831); } } diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.h b/src/overlays/actors/ovl_En_Holl/z_en_holl.h index b163d0fecc..452de700a0 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.h +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.h @@ -6,7 +6,7 @@ struct EnHoll; -typedef void (*EnHollActionFunc)(struct EnHoll*, GlobalContext*); +typedef void (*EnHollActionFunc)(struct EnHoll*, PlayState*); typedef struct EnHoll { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index 24dd469e79..3463bf643a 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -21,31 +21,31 @@ typedef enum { /* 3 */ HONOTRAP_EYE_SHUT } EnHonotrapEyeState; -void EnHonotrap_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHonotrap_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHonotrap_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHonotrap_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHonotrap_Init(Actor* thisx, PlayState* play); +void EnHonotrap_Destroy(Actor* thisx, PlayState* play); +void EnHonotrap_Update(Actor* thisx, PlayState* play); +void EnHonotrap_Draw(Actor* thisx, PlayState* play); void EnHonotrap_SetupEyeIdle(EnHonotrap* this); -void EnHonotrap_EyeIdle(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_EyeIdle(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupEyeOpen(EnHonotrap* this); -void EnHonotrap_EyeOpen(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_EyeOpen(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupEyeAttack(EnHonotrap* this); -void EnHonotrap_EyeAttack(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_EyeAttack(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupEyeClose(EnHonotrap* this); -void EnHonotrap_EyeClose(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_EyeClose(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlame(EnHonotrap* this); -void EnHonotrap_Flame(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_Flame(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlameDrop(EnHonotrap* this); -void EnHonotrap_FlameDrop(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_FlameDrop(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlameMove(EnHonotrap* this); -void EnHonotrap_FlameMove(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_FlameMove(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlameChase(EnHonotrap* this); -void EnHonotrap_FlameChase(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_FlameChase(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlameVanish(EnHonotrap* this); -void EnHonotrap_FlameVanish(EnHonotrap* this, GlobalContext* globalCtx); +void EnHonotrap_FlameVanish(EnHonotrap* this, PlayState* play); const ActorInit En_Honotrap_InitVars = { ACTOR_EN_HONOTRAP, @@ -125,13 +125,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void EnHonotrap_FlameCollisionCheck(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_FlameCollisionCheck(EnHonotrap* this, PlayState* play) { s32 pad[3]; Collider_UpdateCylinder(&this->actor, &this->collider.cyl); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.cyl.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.cyl.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.cyl.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.cyl.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.cyl.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.cyl.base); this->colChkFlags |= HONOTRAP_AT_ACTIVE; this->colChkFlags |= HONOTRAP_AC_ACTIVE; this->colChkFlags |= HONOTRAP_OC_ACTIVE; @@ -152,7 +152,7 @@ void EnHonotrap_GetNormal(Vec3f* normal, Vec3f* vec) { } } -void EnHonotrap_InitEye(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_InitEye(Actor* thisx, PlayState* play) { s32 pad; EnHonotrap* this = (EnHonotrap*)thisx; s32 i; @@ -165,8 +165,8 @@ void EnHonotrap_InitEye(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(thisx, 0.1f); sin = Math_SinS(thisx->home.rot.y); cos = Math_CosS(thisx->home.rot.y); - Collider_InitTris(globalCtx, &this->collider.tris); - Collider_SetTris(globalCtx, &this->collider.tris, thisx, &sTrisInit, this->collider.elements); + Collider_InitTris(play, &this->collider.tris); + Collider_SetTris(play, &this->collider.tris, thisx, &sTrisInit, this->collider.elements); for (i = 0; i < 2; i++) { for (j = 0, vtx = triangle; j < 3; j++, vtx++) { @@ -183,19 +183,19 @@ void EnHonotrap_InitEye(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(thisx, 0.0f); } -void EnHonotrap_InitFlame(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_InitFlame(Actor* thisx, PlayState* play) { s32 pad; EnHonotrap* this = (EnHonotrap*)thisx; Actor_SetScale(&this->actor, 0.0001f); - Collider_InitCylinder(globalCtx, &this->collider.cyl); - Collider_SetCylinder(globalCtx, &this->collider.cyl, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider.cyl); + Collider_SetCylinder(play, &this->collider.cyl, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider.cyl); this->actor.minVelocityY = -1.0f; CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.shape.shadowAlpha = 128; - this->targetPos = GET_PLAYER(globalCtx)->actor.world.pos; + this->targetPos = GET_PLAYER(play)->actor.world.pos; this->targetPos.y += 10.0f; this->flameScroll = Rand_ZeroOne() * 511.0f; EnHonotrap_SetupFlame(this); @@ -208,23 +208,23 @@ void EnHonotrap_InitFlame(Actor* thisx, GlobalContext* globalCtx) { } } -void EnHonotrap_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); if (thisx->params == HONOTRAP_EYE) { - EnHonotrap_InitEye(thisx, globalCtx); + EnHonotrap_InitEye(thisx, play); } else { - EnHonotrap_InitFlame(thisx, globalCtx); + EnHonotrap_InitFlame(thisx, play); } } -void EnHonotrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnHonotrap* this = (EnHonotrap*)thisx; if (this->actor.params == HONOTRAP_EYE) { - Collider_DestroyTris(globalCtx, &this->collider.tris); + Collider_DestroyTris(play, &this->collider.tris); } else { - Collider_DestroyCylinder(globalCtx, &this->collider.cyl); + Collider_DestroyCylinder(play, &this->collider.cyl); } } @@ -233,7 +233,7 @@ void EnHonotrap_SetupEyeIdle(EnHonotrap* this) { this->eyeState = HONOTRAP_EYE_SHUT; } -void EnHonotrap_EyeIdle(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_EyeIdle(EnHonotrap* this, PlayState* play) { if (this->actor.child != NULL) { this->timer = 200; } else if ((this->timer <= 0) && (this->actor.xzDistToPlayer < 750.0f) && (0.0f > this->actor.yDistToPlayer) && @@ -251,7 +251,7 @@ void EnHonotrap_SetupEyeOpen(EnHonotrap* this) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_RED_EYE); } -void EnHonotrap_EyeOpen(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_EyeOpen(EnHonotrap* this, PlayState* play) { f32 cos; f32 sin; @@ -260,7 +260,7 @@ void EnHonotrap_EyeOpen(EnHonotrap* this, GlobalContext* globalCtx) { EnHonotrap_SetupEyeAttack(this); sin = Math_SinS(this->actor.shape.rot.y); cos = Math_CosS(this->actor.shape.rot.y); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_HONOTRAP, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HONOTRAP, (sin * 12.0f) + this->actor.home.pos.x, this->actor.home.pos.y - 10.0f, (cos * 12.0f) + this->actor.home.pos.z, this->actor.home.rot.x, this->actor.home.rot.y, this->actor.home.rot.z, HONOTRAP_FLAME_MOVE); @@ -272,7 +272,7 @@ void EnHonotrap_SetupEyeAttack(EnHonotrap* this) { this->eyeState = HONOTRAP_EYE_OPEN; } -void EnHonotrap_EyeAttack(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_EyeAttack(EnHonotrap* this, PlayState* play) { if (this->timer <= 0) { EnHonotrap_SetupEyeClose(this); } @@ -282,7 +282,7 @@ void EnHonotrap_SetupEyeClose(EnHonotrap* this) { this->actionFunc = EnHonotrap_EyeClose; } -void EnHonotrap_EyeClose(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_EyeClose(EnHonotrap* this, PlayState* play) { this->eyeState++; if (this->eyeState >= HONOTRAP_EYE_SHUT) { EnHonotrap_SetupEyeIdle(this); @@ -294,7 +294,7 @@ void EnHonotrap_SetupFlame(EnHonotrap* this) { this->actionFunc = EnHonotrap_Flame; } -void EnHonotrap_Flame(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_Flame(EnHonotrap* this, PlayState* play) { s32 pad; s32 ready = Math_StepToF(&this->actor.scale.x, (this->actor.params == HONOTRAP_FLAME_MOVE) ? 0.004f : 0.0048f, 0.0006f); @@ -317,10 +317,10 @@ void EnHonotrap_SetupFlameDrop(EnHonotrap* this) { this->actionFunc = EnHonotrap_FlameDrop; } -void EnHonotrap_FlameDrop(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_FlameDrop(EnHonotrap* this, PlayState* play) { if ((this->collider.cyl.base.atFlags & AT_HIT) || (this->timer <= 0)) { if ((this->collider.cyl.base.atFlags & AT_HIT) && !(this->collider.cyl.base.atFlags & AT_BOUNCED)) { - func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); + func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); } this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; EnHonotrap_SetupFlameVanish(this); @@ -328,7 +328,7 @@ void EnHonotrap_FlameDrop(EnHonotrap* this, GlobalContext* globalCtx) { if (this->actor.velocity.y > 0.0f) { this->actor.world.pos.x += this->actor.velocity.x; this->actor.world.pos.z += this->actor.velocity.z; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.0f, 12.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 7.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } if (!Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight + 1.0f, this->actor.velocity.y)) { @@ -336,7 +336,7 @@ void EnHonotrap_FlameDrop(EnHonotrap* this, GlobalContext* globalCtx) { } else { this->actor.velocity.y = 0.0f; } - EnHonotrap_FlameCollisionCheck(this, globalCtx); + EnHonotrap_FlameCollisionCheck(this, play); } } @@ -354,7 +354,7 @@ void EnHonotrap_SetupFlameMove(EnHonotrap* this) { this->timer = 160; } -void EnHonotrap_FlameMove(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_FlameMove(EnHonotrap* this, PlayState* play) { s32 pad; Vec3f speed; s32 ready; @@ -367,12 +367,12 @@ void EnHonotrap_FlameMove(EnHonotrap* this, GlobalContext* globalCtx) { ready &= Math_StepToF(&this->actor.world.pos.x, this->targetPos.x, speed.x); ready &= Math_StepToF(&this->actor.world.pos.y, this->targetPos.y, speed.y); ready &= Math_StepToF(&this->actor.world.pos.z, this->targetPos.z, speed.z); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.0f, 10.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 7.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); if (this->collider.tris.base.atFlags & AT_BOUNCED) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f shieldNorm; Vec3f tempVel; Vec3f shieldVec; @@ -393,7 +393,7 @@ void EnHonotrap_FlameMove(EnHonotrap* this, GlobalContext* globalCtx) { } else if (this->timer <= 0) { EnHonotrap_SetupFlameVanish(this); } else { - EnHonotrap_FlameCollisionCheck(this, globalCtx); + EnHonotrap_FlameCollisionCheck(this, play); if (ready) { EnHonotrap_SetupFlameChase(this); } @@ -409,7 +409,7 @@ void EnHonotrap_SetupFlameChase(EnHonotrap* this) { this->timer = 100; } -void EnHonotrap_FlameChase(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_FlameChase(EnHonotrap* this, PlayState* play) { s32 pad; Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x300); @@ -421,11 +421,11 @@ void EnHonotrap_FlameChase(EnHonotrap* this, GlobalContext* globalCtx) { } this->actor.velocity.y *= 0.95f; func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.0f, 10.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 7.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); if (this->collider.cyl.base.atFlags & AT_BOUNCED) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3s shieldRot; Matrix_MtxFToYXZRotS(&player->shieldMf, &shieldRot, false); @@ -438,7 +438,7 @@ void EnHonotrap_FlameChase(EnHonotrap* this, GlobalContext* globalCtx) { } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->timer <= 0)) { EnHonotrap_SetupFlameVanish(this); } else { - EnHonotrap_FlameCollisionCheck(this, globalCtx); + EnHonotrap_FlameCollisionCheck(this, play); } } @@ -446,13 +446,13 @@ void EnHonotrap_SetupFlameVanish(EnHonotrap* this) { this->actionFunc = EnHonotrap_FlameVanish; } -void EnHonotrap_FlameVanish(EnHonotrap* this, GlobalContext* globalCtx) { +void EnHonotrap_FlameVanish(EnHonotrap* this, PlayState* play) { s32 pad; s32 ready = Math_StepToF(&this->actor.scale.x, 0.0001f, 0.00015f); this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.0f, 10.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 7.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); if (ready) { @@ -460,7 +460,7 @@ void EnHonotrap_FlameVanish(EnHonotrap* this, GlobalContext* globalCtx) { } } -void EnHonotrap_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_Update(Actor* thisx, PlayState* play) { static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.1f, 0.0f }; s32 pad; @@ -480,19 +480,19 @@ void EnHonotrap_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 5.0f); Audio_PlayActorSound2(&this->actor, NA_SE_EV_BURN_OUT - SFX_FLAG); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params == HONOTRAP_EYE) { if (this->collider.tris.base.acFlags & AC_HIT) { - EffectSsBomb2_SpawnLayered(globalCtx, &this->actor.world.pos, &velocity, &accel, 15, 8); + EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &velocity, &accel, 15, 8); Actor_Kill(&this->actor); } else if (this->eyeState < HONOTRAP_EYE_SHUT) { this->collider.tris.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.tris.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.tris.base); } } } -void EnHonotrap_DrawEye(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_DrawEye(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gEyeSwitchSilverOpenTex, gEyeSwitchSilverHalfTex, @@ -501,48 +501,47 @@ void EnHonotrap_DrawEye(Actor* thisx, GlobalContext* globalCtx) { }; EnHonotrap* this = (EnHonotrap*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_honotrap.c", 982); + OPEN_DISPS(play->state.gfxCtx, "../z_en_honotrap.c", 982); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeState])); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_honotrap.c", 987), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_honotrap.c", 987), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gEyeSwitch2DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_honotrap.c", 991); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_honotrap.c", 991); } -void EnHonotrap_DrawFlame(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_DrawFlame(Actor* thisx, PlayState* play) { s32 pad; EnHonotrap* this = (EnHonotrap*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_honotrap.c", 1000); + OPEN_DISPS(play->state.gfxCtx, "../z_en_honotrap.c", 1000); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); this->flameScroll -= 20; this->flameScroll &= 0x1FF; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, this->flameScroll, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, this->flameScroll, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); - Matrix_RotateY( - BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000)), - MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_honotrap.c", 1024), + Matrix_RotateY(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y + 0x8000)), + MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_honotrap.c", 1024), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_honotrap.c", 1028); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_honotrap.c", 1028); } -void EnHonotrap_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHonotrap_Draw(Actor* thisx, PlayState* play) { switch (thisx->params) { case HONOTRAP_EYE: - EnHonotrap_DrawEye(thisx, globalCtx); + EnHonotrap_DrawEye(thisx, play); break; case HONOTRAP_FLAME_MOVE: case HONOTRAP_FLAME_DROP: - EnHonotrap_DrawFlame(thisx, globalCtx); + EnHonotrap_DrawFlame(thisx, play); break; } } diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h index 73e3cdf073..f576377b11 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h @@ -6,7 +6,7 @@ struct EnHonotrap; -typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, GlobalContext*); +typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, PlayState*); typedef union { struct { 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 c5af12f99e..9ce4e39af0 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -12,15 +12,15 @@ #define FLAGS ACTOR_FLAG_4 -typedef void (*EnHorseCsFunc)(EnHorse*, GlobalContext*, CsCmdActorAction*); -typedef void (*EnHorseActionFunc)(EnHorse*, GlobalContext*); +typedef void (*EnHorseCsFunc)(EnHorse*, PlayState*, CsCmdActorAction*); +typedef void (*EnHorseActionFunc)(EnHorse*, PlayState*); -void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorse_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorse_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorse_Init(Actor* thisx, PlayState* play); +void EnHorse_Destroy(Actor* thisx, PlayState* play); +void EnHorse_Update(Actor* thisx, PlayState* play); +void EnHorse_Draw(Actor* thisx, PlayState* play); -void EnHorse_InitCutscene(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_InitCutscene(EnHorse* this, PlayState* play); void EnHorse_InitHorsebackArchery(EnHorse* this); void EnHorse_InitFleePlayer(EnHorse* this); void EnHorse_ResetIdleAnimation(EnHorse* this); @@ -28,26 +28,26 @@ void EnHorse_StartIdleRidable(EnHorse* this); void EnHorse_InitInactive(EnHorse* this); void EnHorse_InitIngoHorse(EnHorse* this); -void EnHorse_Frozen(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_Inactive(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_Idle(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_UpdateIngoRace(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedIdle(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedIdleWhinneying(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedTurn(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedWalk(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedTrot(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedGallop(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_MountedRearing(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_Stopping(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_Reverse(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_LowJump(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_HighJump(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_BridgeJump(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_CutsceneUpdate(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_UpdateHorsebackArchery(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_FleePlayer(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_Frozen(EnHorse* this, PlayState* play); +void EnHorse_Inactive(EnHorse* this, PlayState* play); +void EnHorse_Idle(EnHorse* this, PlayState* play); +void EnHorse_FollowPlayer(EnHorse* this, PlayState* play); +void EnHorse_UpdateIngoRace(EnHorse* this, PlayState* play); +void EnHorse_MountedIdle(EnHorse* this, PlayState* play); +void EnHorse_MountedIdleWhinneying(EnHorse* this, PlayState* play); +void EnHorse_MountedTurn(EnHorse* this, PlayState* play); +void EnHorse_MountedWalk(EnHorse* this, PlayState* play); +void EnHorse_MountedTrot(EnHorse* this, PlayState* play); +void EnHorse_MountedGallop(EnHorse* this, PlayState* play); +void EnHorse_MountedRearing(EnHorse* this, PlayState* play); +void EnHorse_Stopping(EnHorse* this, PlayState* play); +void EnHorse_Reverse(EnHorse* this, PlayState* play); +void EnHorse_LowJump(EnHorse* this, PlayState* play); +void EnHorse_HighJump(EnHorse* this, PlayState* play); +void EnHorse_BridgeJump(EnHorse* this, PlayState* play); +void EnHorse_CutsceneUpdate(EnHorse* this, PlayState* play); +void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play); +void EnHorse_FleePlayer(EnHorse* this, PlayState* play); static AnimationHeader* sEponaAnimHeaders[] = { &gEponaIdleAnim, &gEponaWhinnyAnim, &gEponaRefuseAnim, &gEponaRearingAnim, &gEponaWalkingAnim, @@ -386,11 +386,11 @@ static s32 sIdleAnimIds[] = { 1, 3, 0, 3, 1, 0 }; static s16 sIngoAnimations[] = { 7, 6, 2, 2, 1, 1, 0, 0, 0, 0 }; -void EnHorse_CsMoveInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsJumpInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsRearingInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_WarpMoveInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsWarpRearingInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); +void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); static EnHorseCsFunc sCutsceneInitFuncs[] = { NULL, @@ -401,11 +401,11 @@ static EnHorseCsFunc sCutsceneInitFuncs[] = { EnHorse_CsWarpRearingInit, }; -void EnHorse_CsMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsJump(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsRearing(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsWarpMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsWarpRearing(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); +void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action); static EnHorseCsFunc sCutsceneActionFuncs[] = { NULL, EnHorse_CsMoveToPoint, EnHorse_CsJump, EnHorse_CsRearing, EnHorse_CsWarpMoveToPoint, EnHorse_CsWarpRearing, @@ -450,12 +450,12 @@ static EnHorseActionFunc sActionFuncs[] = { EnHorse_FleePlayer, }; -s32 EnHorse_BgCheckBridgeJumpPoint(EnHorse* this, GlobalContext* globalCtx) { +s32 EnHorse_BgCheckBridgeJumpPoint(EnHorse* this, PlayState* play) { f32 xMin; f32 xMax; s32 i; - if (globalCtx->sceneNum != SCENE_SPOT09) { + if (play->sceneNum != SCENE_SPOT09) { return false; } if (this->actor.speedXZ < 12.8f) { @@ -486,9 +486,9 @@ s32 EnHorse_BgCheckBridgeJumpPoint(EnHorse* this, GlobalContext* globalCtx) { return false; } -void EnHorse_StartBridgeJump(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_StartBridgeJump(EnHorse* this, PlayState* play); -s32 EnHorse_CheckBridgeJumps(EnHorse* this, GlobalContext* globalCtx) { +s32 EnHorse_CheckBridgeJumps(EnHorse* this, PlayState* play) { f32 xMin; f32 xMax; s32 i; @@ -513,7 +513,7 @@ s32 EnHorse_CheckBridgeJumps(EnHorse* this, GlobalContext* globalCtx) { if (sBridgeJumps[i].angle - sBridgeJumps[i].angleRange < this->actor.world.rot.y && this->actor.world.rot.y < sBridgeJumps[i].angle + sBridgeJumps[i].angleRange) { this->bridgeJumpIdx = i; - EnHorse_StartBridgeJump(this, globalCtx); + EnHorse_StartBridgeJump(this, play); return true; } } @@ -529,11 +529,11 @@ void EnHorse_RaceWaypointPos(RaceWaypoint* waypoints, s32 idx, Vec3f* pos) { pos->z = waypoints[idx].z; } -void EnHorse_RotateToPoint(EnHorse* this, GlobalContext* globalCtx, Vec3f* pos, s16 turnAmount) { +void EnHorse_RotateToPoint(EnHorse* this, PlayState* play, Vec3f* pos, s16 turnAmount) { func_8006DD9C(&this->actor, pos, turnAmount); } -void EnHorse_UpdateIngoRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInfo* raceInfo) { +void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceInfo) { Vec3f curWaypointPos; Vec3f prevWaypointPos; f32 playerDist; @@ -563,7 +563,7 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInf EnHorse_RaceWaypointPos(raceInfo->waypoints, prevWaypoint, &prevWaypointPos); Math3D_PointDistToLine2D(this->actor.world.pos.x, this->actor.world.pos.z, prevWaypointPos.x, prevWaypointPos.z, curWaypointPos.x, curWaypointPos.z, &dist); - EnHorse_RotateToPoint(this, globalCtx, &curWaypointPos, 400); + EnHorse_RotateToPoint(this, play, &curWaypointPos, 400); if (dist < 90000.0f) { playerDist = this->actor.xzDistToPlayer; @@ -583,8 +583,8 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInf this->actor.shape.rot.y = this->actor.world.rot.y; } - sp50 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); - relPlayerYaw = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + sp50 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); + relPlayerYaw = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if (sp50 <= 200.0f || (fabsf(Math_SinS(relPlayerYaw)) < 0.8f && Math_CosS(relPlayerYaw) > 0.0f)) { if (this->actor.speedXZ < this->ingoHorseMaxSpeed) { this->actor.speedXZ += 0.47f; @@ -627,7 +627,7 @@ void EnHorse_PlayGallopingSound(EnHorse* this) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } -f32 EnHorse_SlopeSpeedMultiplier(EnHorse* this, GlobalContext* globalCtx) { +f32 EnHorse_SlopeSpeedMultiplier(EnHorse* this, PlayState* play) { f32 multiplier = 1.0f; if (Math_CosS(this->actor.shape.rot.x) < 0.939262f && Math_SinS(this->actor.shape.rot.x) < 0.0f) { @@ -636,24 +636,24 @@ f32 EnHorse_SlopeSpeedMultiplier(EnHorse* this, GlobalContext* globalCtx) { return multiplier; } -void func_80A5BB90(GlobalContext* globalCtx, Vec3f* vec, Vec3f* arg2, f32* arg3) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, vec, arg2, arg3); +void func_80A5BB90(PlayState* play, Vec3f* vec, Vec3f* arg2, f32* arg3) { + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, vec, arg2, arg3); } -s32 func_80A5BBBC(GlobalContext* globalCtx, EnHorse* this, Vec3f* pos) { +s32 func_80A5BBBC(PlayState* play, EnHorse* this, Vec3f* pos) { Vec3f sp24; f32 sp20; f32 eyeDist; - func_80A5BB90(globalCtx, pos, &sp24, &sp20); + func_80A5BB90(play, pos, &sp24, &sp20); if (fabsf(sp20) < 0.008f) { return false; } - eyeDist = Math3D_Vec3f_DistXYZ(pos, &globalCtx->view.eye); - return func_800314D4(globalCtx, &this->actor, &sp24, sp20) || eyeDist < 100.0f; + eyeDist = Math3D_Vec3f_DistXYZ(pos, &play->view.eye); + return func_800314D4(play, &this->actor, &sp24, sp20) || eyeDist < 100.0f; } -void EnHorse_IdleAnimSounds(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_IdleAnimSounds(EnHorse* this, PlayState* play) { if (this->animationIdx == ENHORSE_ANIM_IDLE && ((this->curFrame > 35.0f && this->type == HORSE_EPONA) || (this->curFrame > 28.0f && this->type == HORSE_HNI)) && @@ -669,7 +669,7 @@ void EnHorse_IdleAnimSounds(EnHorse* this, GlobalContext* globalCtx) { } } -s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { +s32 EnHorse_Spawn(EnHorse* this, PlayState* play) { f32 minDist = 1e38f; s32 spawn = false; f32 dist; @@ -678,9 +678,9 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { Vec3f spawnPos; for (i = 0; i < 169; i++) { - if (sHorseSpawns[i].scene == globalCtx->sceneNum) { - player = GET_PLAYER(globalCtx); - if (globalCtx->sceneNum != SCENE_SPOT20 || + if (sHorseSpawns[i].scene == play->sceneNum) { + player = GET_PLAYER(play); + if (play->sceneNum != SCENE_SPOT20 || //! Same flag checked twice (Flags_GetEventChkInf(EVENTCHKINF_18) && (GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_6 || Flags_GetEventChkInf(EVENTCHKINF_18))) || @@ -693,17 +693,17 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { spawnPos.z = sHorseSpawns[i].pos.z; dist = Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &spawnPos); - if (globalCtx->sceneNum) {} - if (!(minDist < dist) && !func_80A5BBBC(globalCtx, this, &spawnPos)) { + if (play->sceneNum) {} + if (!(minDist < dist) && !func_80A5BBBC(play, this, &spawnPos)) { minDist = dist; this->actor.world.pos.x = sHorseSpawns[i].pos.x; this->actor.world.pos.y = sHorseSpawns[i].pos.y; this->actor.world.pos.z = sHorseSpawns[i].pos.z; this->actor.prevPos = this->actor.world.pos; this->actor.world.rot.y = sHorseSpawns[i].angle; - this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); spawn = true; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->actor.world.pos, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, &this->actor.projectedPos, &this->actor.projectedW); } } @@ -713,27 +713,27 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { return spawn; } -void EnHorse_ResetCutscene(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_ResetCutscene(EnHorse* this, PlayState* play) { this->cutsceneAction = -1; this->cutsceneFlags = 0; } -void EnHorse_ResetRace(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_ResetRace(EnHorse* this, PlayState* play) { this->inRace = false; } -s32 EnHorse_PlayerCanMove(EnHorse* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnHorse_PlayerCanMove(EnHorse* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & PLAYER_STATE1_0) || func_8002DD78(GET_PLAYER(globalCtx)) == 1 || + if ((player->stateFlags1 & PLAYER_STATE1_0) || func_8002DD78(GET_PLAYER(play)) == 1 || (player->stateFlags1 & PLAYER_STATE1_20) || ((this->stateFlags & ENHORSE_FLAG_19) && !this->inRace) || - this->action == ENHORSE_ACT_HBA || player->actor.flags & ACTOR_FLAG_8 || globalCtx->csCtx.state != 0) { + this->action == ENHORSE_ACT_HBA || player->actor.flags & ACTOR_FLAG_8 || play->csCtx.state != 0) { return false; } return true; } -void EnHorse_ResetHorsebackArchery(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_ResetHorsebackArchery(EnHorse* this, PlayState* play) { this->unk_39C = 0; this->hbaStarted = 0; this->hbaFlags = 0; @@ -743,9 +743,9 @@ void EnHorse_ClearDustFlags(u16* dustFlags) { *dustFlags = 0; } -void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnHorse_Init(Actor* thisx, PlayState* play2) { EnHorse* this = (EnHorse*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; AREG(6) = 0; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -764,16 +764,16 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.params &= ~0x8000; this->type = HORSE_HNI; - if ((this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HNI)) < 0) { + if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HNI)) < 0) { Actor_Kill(&this->actor); return; } do { - } while (!Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)); + } while (!Object_IsLoaded(&play->objectCtx, this->bankIndex)); this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); this->boostSpeed = 12; } else { this->type = HORSE_EPONA; @@ -785,9 +785,9 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.params = 1; } - if (globalCtx->sceneNum == SCENE_SOUKO) { + if (play->sceneNum == SCENE_SOUKO) { this->stateFlags = ENHORSE_UNRIDEABLE; - } else if (globalCtx->sceneNum == SCENE_SPOT12 && this->type == HORSE_HNI) { + } else if (play->sceneNum == SCENE_SPOT12 && this->type == HORSE_HNI) { this->stateFlags = ENHORSE_FLAG_18 | ENHORSE_UNRIDEABLE; } else { if (this->actor.params == 3) { @@ -807,7 +807,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { } } - if (globalCtx->sceneNum == SCENE_SPOT20 && GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6 && + if (play->sceneNum == SCENE_SPOT20 && GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6 && !Flags_GetEventChkInf(EVENTCHKINF_18) && !DREG(1)) { this->stateFlags |= ENHORSE_FLAG_25; } @@ -817,18 +817,18 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawHorse, 20.0f); this->action = ENHORSE_ACT_IDLE; this->actor.speedXZ = 0.0f; - Collider_InitCylinder(globalCtx, &this->cyl1); - Collider_SetCylinder(globalCtx, &this->cyl1, &this->actor, &sCylinderInit1); - Collider_InitCylinder(globalCtx, &this->cyl2); - Collider_SetCylinder(globalCtx, &this->cyl2, &this->actor, &sCylinderInit2); - Collider_InitJntSph(globalCtx, &this->jntSph); - Collider_SetJntSph(globalCtx, &this->jntSph, &this->actor, &sJntSphInit, &this->jntSphList); + Collider_InitCylinder(play, &this->cyl1); + Collider_SetCylinder(play, &this->cyl1, &this->actor, &sCylinderInit1); + Collider_InitCylinder(play, &this->cyl2); + Collider_SetCylinder(play, &this->cyl2, &this->actor, &sCylinderInit2); + Collider_InitJntSph(play, &this->jntSph); + Collider_SetJntSph(play, &this->jntSph, &this->actor, &sJntSphInit, &this->jntSphList); CollisionCheck_SetInfo(&this->actor.colChkInfo, DamageTable_Get(0xB), &D_80A65F38); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; this->playerControlled = false; - if ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex < 4)) { + if ((play->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex < 4)) { if (this->type == HORSE_HNI) { if (this->actor.world.rot.z == 0 || !IS_DAY) { Actor_Kill(&this->actor); @@ -846,7 +846,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_Kill(&this->actor); return; } - } else if (globalCtx->sceneNum == SCENE_MALON_STABLE) { + } else if (play->sceneNum == SCENE_MALON_STABLE) { if (IS_DAY || Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1) != 0 || !LINK_IS_ADULT) { Actor_Kill(&this->actor); return; @@ -854,22 +854,21 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->stateFlags |= ENHORSE_UNRIDEABLE; } - Skin_Init(globalCtx, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][ENHORSE_ANIM_IDLE]); + Skin_Init(play, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][ENHORSE_ANIM_IDLE]); this->animationIdx = ENHORSE_ANIM_IDLE; Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); this->numBoosts = 6; this->blinkTimer = this->postDrawFunc = this->boostRegenTime = 0; - EnHorse_ResetCutscene(this, globalCtx); - EnHorse_ResetRace(this, globalCtx); - EnHorse_ResetHorsebackArchery(this, globalCtx); + EnHorse_ResetCutscene(this, play); + EnHorse_ResetRace(this, play); + EnHorse_ResetHorsebackArchery(this, play); if (this->actor.params == 2) { EnHorse_InitInactive(this); } else if (this->actor.params == 3) { EnHorse_InitIngoHorse(this); - this->rider = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_IN, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, 1, 1); + this->rider = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_IN, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, 1, 1); ASSERT(this->rider != NULL, "this->race.rider != NULL", "../z_en_horse.c", 3077); if (!GET_EVENTINF(EVENTINF_HORSES_06)) { this->ingoHorseMaxSpeed = 12.07f; @@ -877,16 +876,16 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->ingoHorseMaxSpeed = 12.625f; } } else if (this->actor.params == 7) { - EnHorse_InitCutscene(this, globalCtx); + EnHorse_InitCutscene(this, play); } else if (this->actor.params == 8) { EnHorse_InitHorsebackArchery(this); - Interface_InitHorsebackArchery(globalCtx); - } else if (globalCtx->sceneNum == SCENE_SPOT20 && !Flags_GetEventChkInf(EVENTCHKINF_18) && !DREG(1)) { + Interface_InitHorsebackArchery(play); + } else if (play->sceneNum == SCENE_SPOT20 && !Flags_GetEventChkInf(EVENTCHKINF_18) && !DREG(1)) { EnHorse_InitFleePlayer(this); } else { - if (globalCtx->sceneNum == SCENE_SOUKO) { + if (play->sceneNum == SCENE_SOUKO) { EnHorse_ResetIdleAnimation(this); - } else if (globalCtx->sceneNum == SCENE_SPOT12 && this->type == HORSE_HNI) { + } else if (play->sceneNum == SCENE_SPOT12 && this->type == HORSE_HNI) { EnHorse_ResetIdleAnimation(this); } else { EnHorse_StartIdleRidable(this); @@ -895,20 +894,20 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.home.rot.z = this->actor.world.rot.z = this->actor.shape.rot.z = 0; } -void EnHorse_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorse_Destroy(Actor* thisx, PlayState* play) { EnHorse* this = (EnHorse*)thisx; if (this->stateFlags & ENHORSE_DRAW) { Audio_StopSfxByPos(&this->unk_21C); } - Skin_Free(globalCtx, &this->skin); - Collider_DestroyCylinder(globalCtx, &this->cyl1); - Collider_DestroyCylinder(globalCtx, &this->cyl2); - Collider_DestroyJntSph(globalCtx, &this->jntSph); + Skin_Free(play, &this->skin); + Collider_DestroyCylinder(play, &this->cyl1); + Collider_DestroyCylinder(play, &this->cyl2); + Collider_DestroyJntSph(play, &this->jntSph); } -void EnHorse_RotateToPlayer(EnHorse* this, GlobalContext* globalCtx) { - EnHorse_RotateToPoint(this, globalCtx, &GET_PLAYER(globalCtx)->actor.world.pos, 400); +void EnHorse_RotateToPlayer(EnHorse* this, PlayState* play) { + EnHorse_RotateToPoint(this, play, &GET_PLAYER(play)->actor.world.pos, 400); if (this->stateFlags & ENHORSE_OBSTACLE) { this->actor.world.rot.y += 800.0f; } @@ -935,7 +934,7 @@ void EnHorse_StartMountedIdleResetAnim(EnHorse* this); void EnHorse_StartMountedIdle(EnHorse* this); void EnHorse_StartGalloping(EnHorse* this); -void EnHorse_Frozen(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_Frozen(EnHorse* this, PlayState* play) { this->actor.speedXZ = 0.0f; this->noInputTimer--; if (this->noInputTimer < 0) { @@ -948,7 +947,7 @@ void EnHorse_Frozen(EnHorse* this, GlobalContext* globalCtx) { EnHorse_StartMountedIdleResetAnim(this); } else if (this->actor.params == 9) { this->actor.params = 5; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { EnHorse_StartMountedIdle(this); } else { this->actor.speedXZ = 8.0f; @@ -979,8 +978,8 @@ void EnHorse_Frozen(EnHorse* this, GlobalContext* globalCtx) { void EnHorse_StickDirection(Vec2f* curStick, f32* stickMag, s16* angle); -void EnHorse_UpdateSpeed(EnHorse* this, GlobalContext* globalCtx, f32 brakeDecel, f32 brakeAngle, f32 minStickMag, - f32 decel, f32 baseSpeed, s16 turnSpeed) { +void EnHorse_UpdateSpeed(EnHorse* this, PlayState* play, f32 brakeDecel, f32 brakeAngle, f32 minStickMag, f32 decel, + f32 baseSpeed, s16 turnSpeed) { s16* stickAnglePtr; // probably fake f32 stickMag; s16 stickAngle; @@ -988,7 +987,7 @@ void EnHorse_UpdateSpeed(EnHorse* this, GlobalContext* globalCtx, f32 brakeDecel f32 traction; s16 turn; - if (!EnHorse_PlayerCanMove(this, globalCtx)) { + if (!EnHorse_PlayerCanMove(this, play)) { if (this->actor.speedXZ > 8) { this->actor.speedXZ -= decel; } else if (this->actor.speedXZ < 0) { @@ -1000,7 +999,7 @@ void EnHorse_UpdateSpeed(EnHorse* this, GlobalContext* globalCtx, f32 brakeDecel stickAnglePtr = &stickAngle; - baseSpeed *= EnHorse_SlopeSpeedMultiplier(this, globalCtx); + baseSpeed *= EnHorse_SlopeSpeedMultiplier(this, play); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (Math_CosS(stickAngle) <= brakeAngle) { this->actor.speedXZ -= brakeDecel; @@ -1021,15 +1020,14 @@ void EnHorse_UpdateSpeed(EnHorse* this, GlobalContext* globalCtx, f32 brakeDecel if (this->stateFlags & ENHORSE_BOOST) { if ((16 - this->boostTimer) > 0) { - this->actor.speedXZ = - (EnHorse_SlopeSpeedMultiplier(this, globalCtx) * this->boostSpeed - this->actor.speedXZ) / - (16 - this->boostTimer) + - this->actor.speedXZ; + this->actor.speedXZ = (EnHorse_SlopeSpeedMultiplier(this, play) * this->boostSpeed - this->actor.speedXZ) / + (16 - this->boostTimer) + + this->actor.speedXZ; } else { - this->actor.speedXZ = EnHorse_SlopeSpeedMultiplier(this, globalCtx) * this->boostSpeed; + this->actor.speedXZ = EnHorse_SlopeSpeedMultiplier(this, play) * this->boostSpeed; } - if ((EnHorse_SlopeSpeedMultiplier(this, globalCtx) * this->boostSpeed) <= this->actor.speedXZ) { + if ((EnHorse_SlopeSpeedMultiplier(this, play) * this->boostSpeed) <= this->actor.speedXZ) { this->stateFlags &= ~ENHORSE_BOOST; this->stateFlags |= ENHORSE_BOOST_DECEL; } @@ -1093,13 +1091,13 @@ void EnHorse_StartWalkingInterruptable(EnHorse* this); void EnHorse_MountedIdleWhinney(EnHorse* this); void EnHorse_StartWalking(EnHorse* this); -void EnHorse_MountedIdle(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedIdle(EnHorse* this, PlayState* play) { f32 mag; s16 angle = 0; this->actor.speedXZ = 0; EnHorse_StickDirection(&this->curStick, &mag, &angle); - if (mag > 10.0f && EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (mag > 10.0f && EnHorse_PlayerCanMove(this, play) == true) { if (Math_CosS(angle) <= -0.5f) { EnHorse_StartReversingInterruptable(this); } else if (Math_CosS(angle) <= 0.7071) { // cos(45 degrees) @@ -1133,13 +1131,13 @@ void EnHorse_MountedIdleWhinney(EnHorse* this) { } } -void EnHorse_MountedIdleWhinneying(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedIdleWhinneying(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle = 0; this->actor.speedXZ = 0; EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); - if (stickMag > 10.0f && EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (stickMag > 10.0f && EnHorse_PlayerCanMove(this, play) == true) { if (Math_CosS(stickAngle) <= -0.5f) { EnHorse_StartReversingInterruptable(this); } else if (Math_CosS(stickAngle) <= 0.7071) { // cos(45 degrees) @@ -1161,7 +1159,7 @@ void EnHorse_StartTurning(EnHorse* this) { Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); } -void EnHorse_MountedTurn(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedTurn(EnHorse* this, PlayState* play) { f32 stickMag; s16 clampedYaw; s16 stickAngle; @@ -1170,7 +1168,7 @@ void EnHorse_MountedTurn(EnHorse* this, GlobalContext* globalCtx) { EnHorse_PlayWalkingSound(this); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (stickMag > 10.0f) { - if (!EnHorse_PlayerCanMove(this, globalCtx)) { + if (!EnHorse_PlayerCanMove(this, play)) { EnHorse_StartMountedIdleResetAnim(this); } else if (Math_CosS(stickAngle) <= -0.5f) { EnHorse_StartReversingInterruptable(this); @@ -1228,7 +1226,7 @@ void EnHorse_MountedWalkingReset(EnHorse* this) { void EnHorse_StartTrotting(EnHorse* this); -void EnHorse_MountedWalk(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedWalk(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; @@ -1236,7 +1234,7 @@ void EnHorse_MountedWalk(EnHorse* this, GlobalContext* globalCtx) { EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (this->noInputTimerMax == 0.0f || (this->noInputTimer > 0.0f && this->noInputTimer < this->noInputTimerMax - 20.0f)) { - EnHorse_UpdateSpeed(this, globalCtx, 0.3f, -0.5f, 10.0f, 0.06f, 3.0f, 400); + EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 3.0f, 400); } else { this->actor.speedXZ = 3.0f; } @@ -1299,11 +1297,11 @@ void EnHorse_MountedTrotReset(EnHorse* this) { void EnHorse_StartGallopingInterruptable(EnHorse* this); -void EnHorse_MountedTrot(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedTrot(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; - EnHorse_UpdateSpeed(this, globalCtx, 0.3f, -0.5f, 10.0f, 0.06f, 6.0f, 400); + EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 6.0f, 400); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (this->actor.speedXZ < 3.0f) { EnHorse_StartWalkingInterruptable(this); @@ -1346,7 +1344,7 @@ void EnHorse_MountedGallopReset(EnHorse* this) { Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); } -void EnHorse_JumpLanding(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_JumpLanding(EnHorse* this, PlayState* play) { Vec3s* jointTable; f32 y; @@ -1359,16 +1357,16 @@ void EnHorse_JumpLanding(EnHorse* this, GlobalContext* globalCtx) { this->postDrawFunc = NULL; } -void EnHorse_StartBraking(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_StartBraking(EnHorse* this, PlayState* play); -void EnHorse_MountedGallop(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedGallop(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (this->noInputTimer <= 0.0f) { - EnHorse_UpdateSpeed(this, globalCtx, 0.3f, -0.5f, 10.0f, 0.06f, 8.0f, 0x190); + EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 8.0f, 0x190); } else if (this->noInputTimer > 0.0f) { this->noInputTimer -= 1; this->actor.speedXZ = 8.0f; @@ -1381,9 +1379,9 @@ void EnHorse_MountedGallop(EnHorse* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skin.skelAnime)) { EnHorse_PlayGallopingSound(this); func_800AA000(0, 120, 8, 255); - if (EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (EnHorse_PlayerCanMove(this, play) == true) { if (stickMag >= 10.0f && Math_CosS(stickAngle) <= -0.5f) { - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } else if (this->actor.speedXZ < 6.0f) { EnHorse_StartTrotting(this); } else { @@ -1409,7 +1407,7 @@ void EnHorse_StartRearing(EnHorse* this) { Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); } -void EnHorse_MountedRearing(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedRearing(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; @@ -1425,7 +1423,7 @@ void EnHorse_MountedRearing(EnHorse* this, GlobalContext* globalCtx) { EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (SkelAnime_Update(&this->skin.skelAnime)) { - if (EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (EnHorse_PlayerCanMove(this, play) == true) { if (this->stateFlags & ENHORSE_FORCE_REVERSING) { this->noInputTimer = 100; this->noInputTimerMax = 100; @@ -1447,7 +1445,7 @@ void EnHorse_MountedRearing(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_StartBraking(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_StartBraking(EnHorse* this, PlayState* play) { this->action = ENHORSE_ACT_STOPPING; this->animationIdx = ENHORSE_ANIM_STOPPING; @@ -1460,7 +1458,7 @@ void EnHorse_StartBraking(EnHorse* this, GlobalContext* globalCtx) { this->stateFlags &= ~ENHORSE_BOOST; } -void EnHorse_Stopping(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_Stopping(EnHorse* this, PlayState* play) { if (this->actor.speedXZ > 0.0f) { this->actor.speedXZ = this->actor.speedXZ - 0.6f; if (this->actor.speedXZ < 0.0f) { @@ -1515,15 +1513,15 @@ void EnHorse_StartReversing(EnHorse* this) { Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_LOOP, -3.0f); } -void EnHorse_Reverse(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_Reverse(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; s16 turnAmount; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnHorse_PlayWalkingSound(this); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); - if (EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (EnHorse_PlayerCanMove(this, play) == true) { if (this->noInputTimerMax == 0.0f || (this->noInputTimer > 0.0f && this->noInputTimer < this->noInputTimerMax - 20.0f)) { if (stickMag < 10.0f && this->noInputTimer <= 0.0f) { @@ -1564,7 +1562,7 @@ void EnHorse_Reverse(EnHorse* this, GlobalContext* globalCtx) { } this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.5f * 1.5f; if (SkelAnime_Update(&this->skin.skelAnime) && (f32)this->noInputTimer <= 0.0f && - EnHorse_PlayerCanMove(this, globalCtx) == true) { + EnHorse_PlayerCanMove(this, play) == true) { if (stickMag > 10.0f && Math_CosS(stickAngle) <= -0.5f) { this->noInputTimerMax = 0; EnHorse_StartReversingInterruptable(this); @@ -1577,14 +1575,14 @@ void EnHorse_Reverse(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_StartLowJump(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_StartLowJump(EnHorse* this, PlayState* play); -void EnHorse_LowJumpInit(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_LowJumpInit(EnHorse* this, PlayState* play) { this->skin.skelAnime.curFrame = 0.0f; - EnHorse_StartLowJump(this, globalCtx); + EnHorse_StartLowJump(this, play); } -void EnHorse_StartLowJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_StartLowJump(EnHorse* this, PlayState* play) { f32 curFrame; Vec3s* jointTable; f32 y; @@ -1613,7 +1611,7 @@ void EnHorse_StartLowJump(EnHorse* this, GlobalContext* globalCtx) { void EnHorse_Stub1(EnHorse* this) { } -void EnHorse_LowJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_LowJump(EnHorse* this, PlayState* play) { Vec3f pad; Vec3s* jointTable; f32 curFrame; @@ -1646,19 +1644,19 @@ void EnHorse_LowJump(EnHorse* this, GlobalContext* globalCtx) { this->stateFlags &= ~ENHORSE_JUMPING; this->actor.gravity = -3.5f; this->actor.world.pos.y = this->actor.floorHeight; - func_80028A54(globalCtx, 25.0f, &this->actor.world.pos); - EnHorse_JumpLanding(this, globalCtx); + func_80028A54(play, 25.0f, &this->actor.world.pos); + EnHorse_JumpLanding(this, play); } } -void EnHorse_StartHighJump(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_StartHighJump(EnHorse* this, PlayState* play); -void EnHorse_HighJumpInit(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_HighJumpInit(EnHorse* this, PlayState* play) { this->skin.skelAnime.curFrame = 0.0f; - EnHorse_StartHighJump(this, globalCtx); + EnHorse_StartHighJump(this, play); } -void EnHorse_StartHighJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_StartHighJump(EnHorse* this, PlayState* play) { f32 curFrame; Vec3s* jointTable; f32 y; @@ -1688,7 +1686,7 @@ void EnHorse_StartHighJump(EnHorse* this, GlobalContext* globalCtx) { void EnHorse_Stub2(EnHorse* this) { } -void EnHorse_HighJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_HighJump(EnHorse* this, PlayState* play) { Vec3f pad; Vec3s* jointTable; f32 curFrame; @@ -1722,8 +1720,8 @@ void EnHorse_HighJump(EnHorse* this, GlobalContext* globalCtx) { this->stateFlags &= ~ENHORSE_JUMPING; this->actor.gravity = -3.5f; this->actor.world.pos.y = this->actor.floorHeight; - func_80028A54(globalCtx, 25.0f, &this->actor.world.pos); - EnHorse_JumpLanding(this, globalCtx); + func_80028A54(play, 25.0f, &this->actor.world.pos); + EnHorse_JumpLanding(this, play); } } @@ -1737,28 +1735,28 @@ void EnHorse_InitInactive(EnHorse* this) { this->followTimer = 0; } -void EnHorse_SetFollowAnimation(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play); -void EnHorse_Inactive(EnHorse* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnHorse_Inactive(EnHorse* this, PlayState* play2) { + PlayState* play = play2; if (DREG(53) != 0 && this->type == HORSE_EPONA) { DREG(53) = 0; - if (EnHorse_Spawn(this, globalCtx) != 0) { + if (EnHorse_Spawn(this, play) != 0) { Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->stateFlags &= ~ENHORSE_INACTIVE; - gSaveContext.horseData.scene = globalCtx->sceneNum; + gSaveContext.horseData.scene = play->sceneNum; // Focus the camera on Epona - Camera_SetParam(globalCtx->cameraPtrs[CAM_ID_MAIN], 8, this); - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_TURN_AROUND); - Camera_SetCameraData(globalCtx->cameraPtrs[CAM_ID_MAIN], 4, NULL, NULL, 0x51, 0, 0); + Camera_SetParam(play->cameraPtrs[CAM_ID_MAIN], 8, this); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_TURN_AROUND); + Camera_SetCameraData(play->cameraPtrs[CAM_ID_MAIN], 4, NULL, NULL, 0x51, 0, 0); } } if (!(this->stateFlags & ENHORSE_INACTIVE)) { this->followTimer = 0; - EnHorse_SetFollowAnimation(this, globalCtx); + EnHorse_SetFollowAnimation(this, play); this->actor.params = 0; this->cyl1.base.ocFlags1 |= OC1_ON; this->cyl2.base.ocFlags1 |= OC1_ON; @@ -1813,21 +1811,21 @@ void EnHorse_StartIdleRidable(EnHorse* this) { void EnHorse_StartMovingAnimation(EnHorse* this, s32 arg1, f32 arg2, f32 arg3); -void EnHorse_Idle(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_Idle(EnHorse* this, PlayState* play) { this->actor.speedXZ = 0.0f; - EnHorse_IdleAnimSounds(this, globalCtx); + EnHorse_IdleAnimSounds(this, play); if (DREG(53) && this->type == HORSE_EPONA) { DREG(53) = 0; - if (!func_80A5BBBC(globalCtx, this, &this->actor.world.pos)) { - if (EnHorse_Spawn(this, globalCtx)) { + if (!func_80A5BBBC(play, this, &this->actor.world.pos)) { + if (EnHorse_Spawn(this, play)) { Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->followTimer = 0; - EnHorse_SetFollowAnimation(this, globalCtx); - Camera_SetParam(globalCtx->cameraPtrs[CAM_ID_MAIN], 8, this); - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_TURN_AROUND); - Camera_SetCameraData(globalCtx->cameraPtrs[CAM_ID_MAIN], 4, NULL, NULL, 0x51, 0, 0); + EnHorse_SetFollowAnimation(this, play); + Camera_SetParam(play->cameraPtrs[CAM_ID_MAIN], 8, this); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_TURN_AROUND); + Camera_SetCameraData(play->cameraPtrs[CAM_ID_MAIN], 4, NULL, NULL, 0x51, 0, 0); } } else { Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, @@ -1871,11 +1869,11 @@ void EnHorse_StartMovingAnimation(EnHorse* this, s32 animId, f32 morphFrames, f3 } } -void EnHorse_SetFollowAnimation(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) { s32 animId = ENHORSE_ANIM_WALK; f32 distToPlayer; - distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); if (distToPlayer > 400.0f) { animId = ENHORSE_ANIM_GALLOP; } else if (!(distToPlayer <= 300.0f)) { @@ -1908,19 +1906,19 @@ void EnHorse_SetFollowAnimation(EnHorse* this, GlobalContext* globalCtx) { EnHorse_StartMovingAnimation(this, animId, -3.0f, 0.0f); } -void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { f32 distToPlayer; f32 angleDiff; DREG(53) = 0; - distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); // First rotate if the player is behind if ((this->playerDir == PLAYER_DIR_BACK_R || this->playerDir == PLAYER_DIR_BACK_L) && (distToPlayer > 300.0f && !(this->stateFlags & ENHORSE_TURNING_TO_PLAYER))) { this->animationIdx = ENHORSE_ANIM_REARING; this->stateFlags |= ENHORSE_TURNING_TO_PLAYER; - this->angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + this->angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); angleDiff = (f32)this->angleToPlayer - (f32)this->actor.world.rot.y; if (angleDiff > 32767.f) { angleDiff -= 32767.0f; @@ -1945,7 +1943,7 @@ void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx) { } } } else { - EnHorse_RotateToPlayer(this, globalCtx); + EnHorse_RotateToPlayer(this, play); } if (this->animationIdx == ENHORSE_ANIM_GALLOP) { @@ -1983,7 +1981,7 @@ void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx) { if (distToPlayer < 100.0f) { EnHorse_StartIdleRidable(this); } else { - EnHorse_SetFollowAnimation(this, globalCtx); + EnHorse_SetFollowAnimation(this, play); } } } @@ -2072,16 +2070,16 @@ void EnHorse_UpdateIngoHorseAnim(EnHorse* this) { } } -void EnHorse_UpdateIngoRace(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdateIngoRace(EnHorse* this, PlayState* play) { f32 playSpeed; if (this->animationIdx == ENHORSE_ANIM_IDLE || this->animationIdx == ENHORSE_ANIM_WHINNEY) { - EnHorse_IdleAnimSounds(this, globalCtx); + EnHorse_IdleAnimSounds(this, play); } else if (this->animationIdx == ENHORSE_ANIM_WALK) { EnHorse_PlayWalkingSound(this); } - EnHorse_UpdateIngoRaceInfo(this, globalCtx, &sIngoRace); + EnHorse_UpdateIngoRaceInfo(this, play, &sIngoRace); if (!this->inRace) { this->actor.speedXZ = 0.0f; this->rider->speedXZ = 0.0f; @@ -2115,16 +2113,16 @@ void EnHorse_UpdateIngoRace(EnHorse* this, GlobalContext* globalCtx) { &((EnIn*)this->rider)->animationIdx, &((EnIn*)this->rider)->unk_1E0); } -void EnHorse_CsMoveInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { this->animationIdx = ENHORSE_ANIM_GALLOP; this->cutsceneAction = 1; Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], this->actor.speedXZ * 0.3f); } -void EnHorse_CsPlayHighJumpAnim(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play); -void EnHorse_CsMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action) { Vec3f endPos; f32 speed = 8.0f; @@ -2132,7 +2130,7 @@ void EnHorse_CsMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAc endPos.y = action->endPos.y; endPos.z = action->endPos.z; if (Math3D_Vec3f_DistXYZ(&endPos, &this->actor.world.pos) > speed) { - EnHorse_RotateToPoint(this, globalCtx, &endPos, 400); + EnHorse_RotateToPoint(this, play, &endPos, 400); this->actor.speedXZ = speed; this->skin.skelAnime.playSpeed = speed * 0.3f; } else { @@ -2148,12 +2146,12 @@ void EnHorse_CsMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAc } } -void EnHorse_CsSetAnimHighJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_CsSetAnimHighJump(EnHorse* this, PlayState* play) { this->skin.skelAnime.curFrame = 0.0f; - EnHorse_CsPlayHighJumpAnim(this, globalCtx); + EnHorse_CsPlayHighJumpAnim(this, play); } -void EnHorse_CsPlayHighJumpAnim(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play) { f32 curFrame; f32 y; Vec3s* jointTable; @@ -2177,17 +2175,17 @@ void EnHorse_CsPlayHighJumpAnim(EnHorse* this, GlobalContext* globalCtx) { func_800AA000(0.0f, 170, 10, 10); } -void EnHorse_CsJumpInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { - EnHorse_CsSetAnimHighJump(this, globalCtx); +void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { + EnHorse_CsSetAnimHighJump(this, play); this->cutsceneAction = 2; this->cutsceneFlags &= ~1; } -void EnHorse_CsJump(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action) { f32 temp_f2; if (this->cutsceneFlags & 1) { - EnHorse_CsMoveToPoint(this, globalCtx, action); + EnHorse_CsMoveToPoint(this, play, action); return; } temp_f2 = this->skin.skelAnime.curFrame; @@ -2224,7 +2222,7 @@ void EnHorse_CsJump(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* a this->actor.gravity = -3.5f; this->actor.velocity.y = 0; this->actor.world.pos.y = this->actor.floorHeight; - func_80028A54(globalCtx, 25.0f, &this->actor.world.pos); + func_80028A54(play, 25.0f, &this->actor.world.pos); this->animationIdx = ENHORSE_ANIM_GALLOP; Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], sPlaybackSpeeds[6]); @@ -2235,7 +2233,7 @@ void EnHorse_CsJump(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* a } } -void EnHorse_CsRearingInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { this->animationIdx = ENHORSE_ANIM_REARING; this->cutsceneAction = 3; this->cutsceneFlags &= ~4; @@ -2249,7 +2247,7 @@ void EnHorse_CsRearingInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAc Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); } -void EnHorse_CsRearing(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) { this->actor.speedXZ = 0.0f; if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { @@ -2272,7 +2270,7 @@ void EnHorse_CsRearing(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction } } -void EnHorse_WarpMoveInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { this->actor.world.pos.x = action->startPos.x; this->actor.world.pos.y = action->startPos.y; this->actor.world.pos.z = action->startPos.z; @@ -2285,7 +2283,7 @@ void EnHorse_WarpMoveInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAct this->actor.speedXZ * 0.3f); } -void EnHorse_CsWarpMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action) { Vec3f endPos; f32 speed = 8.0f; @@ -2293,7 +2291,7 @@ void EnHorse_CsWarpMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdAct endPos.y = action->endPos.y; endPos.z = action->endPos.z; if (Math3D_Vec3f_DistXYZ(&endPos, &this->actor.world.pos) > speed) { - EnHorse_RotateToPoint(this, globalCtx, &endPos, 400); + EnHorse_RotateToPoint(this, play, &endPos, 400); this->actor.speedXZ = speed; this->skin.skelAnime.playSpeed = speed * 0.3f; } else { @@ -2309,7 +2307,7 @@ void EnHorse_CsWarpMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdAct } } -void EnHorse_CsWarpRearingInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { this->actor.world.pos.x = action->startPos.x; this->actor.world.pos.y = action->startPos.y; this->actor.world.pos.z = action->startPos.z; @@ -2329,7 +2327,7 @@ void EnHorse_CsWarpRearingInit(EnHorse* this, GlobalContext* globalCtx, CsCmdAct Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); } -void EnHorse_CsWarpRearing(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) { this->actor.speedXZ = 0.0f; if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { @@ -2352,7 +2350,7 @@ void EnHorse_CsWarpRearing(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAc } } -void EnHorse_InitCutscene(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_InitCutscene(EnHorse* this, PlayState* play) { this->playerControlled = false; this->action = ENHORSE_ACT_CS_UPDATE; this->cutsceneAction = 0; @@ -2374,11 +2372,11 @@ s32 EnHorse_GetCutsceneFunctionIndex(s32 csAction) { return 0; } -void EnHorse_CutsceneUpdate(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_CutsceneUpdate(EnHorse* this, PlayState* play) { s32 csFunctionIdx; - CsCmdActorAction* linkCsAction = globalCtx->csCtx.linkAction; + CsCmdActorAction* linkCsAction = play->csCtx.linkAction; - if (globalCtx->csCtx.state == 3) { + if (play->csCtx.state == 3) { this->playerControlled = 1; this->actor.params = 10; this->action = ENHORSE_ACT_IDLE; @@ -2398,14 +2396,14 @@ void EnHorse_CutsceneUpdate(EnHorse* this, GlobalContext* globalCtx) { this->actor.prevPos = this->actor.world.pos; } this->cutsceneAction = csFunctionIdx; - sCutsceneInitFuncs[this->cutsceneAction](this, globalCtx, linkCsAction); + sCutsceneInitFuncs[this->cutsceneAction](this, play, linkCsAction); } - sCutsceneActionFuncs[this->cutsceneAction](this, globalCtx, linkCsAction); + sCutsceneActionFuncs[this->cutsceneAction](this, play, linkCsAction); } } } -s32 EnHorse_UpdateHbaRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInfo* raceInfo) { +s32 EnHorse_UpdateHbaRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceInfo) { Vec3f pos; f32 px; f32 pz; @@ -2428,7 +2426,7 @@ s32 EnHorse_UpdateHbaRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInfo* } if (!(this->hbaFlags & 1)) { - EnHorse_RotateToPoint(this, globalCtx, &pos, 800); + EnHorse_RotateToPoint(this, play, &pos, 800); } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -2509,29 +2507,29 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { } } -void EnHorse_UpdateHorsebackArchery(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { f32 playSpeed; s32 sp20; if (this->animationIdx == ENHORSE_ANIM_WALK) { EnHorse_PlayWalkingSound(this); } - if (globalCtx->interfaceCtx.hbaAmmo == 0) { + if (play->interfaceCtx.hbaAmmo == 0) { this->hbaTimer++; } sp20 = func_800F5A58(NA_BGM_HORSE_GOAL); - EnHorse_UpdateHbaRaceInfo(this, globalCtx, &sHbaInfo); + EnHorse_UpdateHbaRaceInfo(this, play, &sHbaInfo); if (this->hbaFlags & 1 || this->hbaTimer >= 46) { if (sp20 != 1 && gSaveContext.minigameState != 3) { gSaveContext.cutsceneIndex = 0; - globalCtx->nextEntranceIndex = ENTR_SPOT12_16; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST); + play->nextEntranceIndex = ENTR_SPOT12_16; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST); } } - if (globalCtx->interfaceCtx.hbaAmmo != 0) { + if (play->interfaceCtx.hbaAmmo != 0) { if (!(this->hbaFlags & 2)) { if (GET_INFTABLE(INFTABLE_190)) { if ((s32)gSaveContext.minigameScore >= 1500) { @@ -2545,7 +2543,7 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, GlobalContext* globalCtx) { } } - if ((globalCtx->interfaceCtx.hbaAmmo == 0) || (this->hbaFlags & 2)) { + if ((play->interfaceCtx.hbaAmmo == 0) || (this->hbaFlags & 2)) { if (this->hbaFlags & 4) { this->hbaFlags &= ~4; Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_HORSE_GOAL); @@ -2582,8 +2580,8 @@ void EnHorse_InitFleePlayer(EnHorse* this) { this->actor.speedXZ = 0.0f; } -void EnHorse_FleePlayer(EnHorse* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 distToHome; f32 playerDistToHome; f32 distToPlayer; @@ -2641,7 +2639,7 @@ void EnHorse_FleePlayer(EnHorse* this, GlobalContext* globalCtx) { EnHorse_PlayWalkingSound(this); } else { // idle nextAnim = Rand_ZeroOne() > 0.5f ? 1 : 0; - EnHorse_IdleAnimSounds(this, globalCtx); + EnHorse_IdleAnimSounds(this, play); this->skin.skelAnime.playSpeed = 1.0f; } @@ -2738,10 +2736,10 @@ void EnHorse_FleePlayer(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_BridgeJumpInit(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_BridgeJumpInit(EnHorse* this, PlayState* play) { f32 y; - func_80028A54(globalCtx, 25.0f, &this->actor.world.pos); + func_80028A54(play, 25.0f, &this->actor.world.pos); this->action = ENHORSE_ACT_BRIDGE_JUMP; this->stateFlags |= ENHORSE_JUMPING; this->animationIdx = ENHORSE_ANIM_HIGH_JUMP; @@ -2770,18 +2768,18 @@ void EnHorse_BridgeJumpInit(EnHorse* this, GlobalContext* globalCtx) { this->postDrawFunc = NULL; } -void EnHorse_StartBridgeJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_StartBridgeJump(EnHorse* this, PlayState* play) { this->postDrawFunc = EnHorse_BridgeJumpInit; if (this->bridgeJumpIdx == 0) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGerudoValleyBridgeJumpFieldFortressCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGerudoValleyBridgeJumpFieldFortressCs); gSaveContext.cutsceneTrigger = 1; } else { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGerudoValleyBridgeJumpFortressToFieldCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGerudoValleyBridgeJumpFortressToFieldCs); gSaveContext.cutsceneTrigger = 1; } } -void EnHorse_BridgeJumpMove(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_BridgeJumpMove(EnHorse* this, PlayState* play) { f32 interp; f32 timeSq; @@ -2805,28 +2803,28 @@ void EnHorse_BridgeJumpMove(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_CheckBridgeJumpLanding(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_CheckBridgeJumpLanding(EnHorse* this, PlayState* play) { this->actor.speedXZ = 8.0f; this->skin.skelAnime.playSpeed = 1.5f; if (SkelAnime_Update(&this->skin.skelAnime)) { this->stateFlags &= ~ENHORSE_JUMPING; this->actor.gravity = -3.5f; this->actor.world.pos.y = sBridgeJumps[this->bridgeJumpIdx].pos.y; - func_80028A54(globalCtx, 25.0f, &this->actor.world.pos); - EnHorse_JumpLanding(this, globalCtx); + func_80028A54(play, 25.0f, &this->actor.world.pos); + EnHorse_JumpLanding(this, play); Audio_PlaySoundGeneral(NA_SE_EV_HORSE_LAND, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); func_800AA000(0.0f, 255, 10, 80); } } -void EnHorse_BridgeJump(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_BridgeJump(EnHorse* this, PlayState* play) { this->bridgeJumpTimer++; if (this->bridgeJumpTimer < 30) { - EnHorse_BridgeJumpMove(this, globalCtx); + EnHorse_BridgeJumpMove(this, play); return; } - EnHorse_CheckBridgeJumpLanding(this, globalCtx); + EnHorse_CheckBridgeJumpLanding(this, play); } void EnHorse_Vec3fOffset(Vec3f* src, s16 yaw, f32 dist, f32 height, Vec3f* dst) { @@ -2835,27 +2833,26 @@ void EnHorse_Vec3fOffset(Vec3f* src, s16 yaw, f32 dist, f32 height, Vec3f* dst) dst->z = src->z + Math_CosS(yaw) * dist; } -s32 EnHorse_CalcFloorHeight(EnHorse* this, GlobalContext* globalCtx, Vec3f* pos, CollisionPoly** floorPoly, - f32* floorHeight) { +s32 EnHorse_CalcFloorHeight(EnHorse* this, PlayState* play, Vec3f* pos, CollisionPoly** floorPoly, f32* floorHeight) { s32 bgId; f32 waterY; WaterBox* waterBox; *floorPoly = NULL; - *floorHeight = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, floorPoly, &bgId, pos); + *floorHeight = BgCheck_EntityRaycastFloor3(&play->colCtx, floorPoly, &bgId, pos); if (*floorHeight == BGCHECK_Y_MIN) { return 1; // No floor } - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, pos->x, pos->z, &waterY, &waterBox) == 1 && + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, pos->x, pos->z, &waterY, &waterBox) == 1 && *floorHeight < waterY) { return 2; // Water } if ((*floorPoly)->normal.y * COLPOLY_NORMAL_FRAC < 0.81915206f || // cos(35 degrees) - SurfaceType_IsHorseBlocked(&globalCtx->colCtx, *floorPoly, bgId) || - func_80041D4C(&globalCtx->colCtx, *floorPoly, bgId) == 7) { + SurfaceType_IsHorseBlocked(&play->colCtx, *floorPoly, bgId) || + func_80041D4C(&play->colCtx, *floorPoly, bgId) == 7) { return 3; // Horse blocked surface } return 0; @@ -2869,8 +2866,8 @@ s32 EnHorse_CalcFloorHeight(EnHorse* this, GlobalContext* globalCtx, Vec3f* pos, * 4: Obstructed in front * 5: Obstructed behind */ -void EnHorse_ObstructMovement(EnHorse* this, GlobalContext* globalCtx, s32 obstacleType, s32 galloping) { - if (this->action == ENHORSE_ACT_CS_UPDATE || EnHorse_BgCheckBridgeJumpPoint(this, globalCtx)) { +void EnHorse_ObstructMovement(EnHorse* this, PlayState* play, s32 obstacleType, s32 galloping) { + if (this->action == ENHORSE_ACT_CS_UPDATE || EnHorse_BgCheckBridgeJumpPoint(this, play)) { return; } @@ -2900,7 +2897,7 @@ void EnHorse_ObstructMovement(EnHorse* this, GlobalContext* globalCtx, s32 obsta } } -void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_CheckFloors(EnHorse* this, PlayState* play) { s32 status; CollisionPoly* frontFloor; CollisionPoly* backFloor; @@ -2917,42 +2914,42 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { WaterBox* waterBox; s32 pad; - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &waterHeight, &waterBox) == 1 && + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterHeight, + &waterBox) == 1 && this->actor.floorHeight < waterHeight) { - EnHorse_ObstructMovement(this, globalCtx, 1, galloping); + EnHorse_ObstructMovement(this, play, 1, galloping); return; } EnHorse_Vec3fOffset(&this->actor.world.pos, this->actor.shape.rot.y, 30.0f, 60.0f, &frontPos); - status = EnHorse_CalcFloorHeight(this, globalCtx, &frontPos, &frontFloor, &this->yFront); + status = EnHorse_CalcFloorHeight(this, play, &frontPos, &frontFloor, &this->yFront); if (status == 1) { this->actor.shape.rot.x = 0; - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); return; } if (status == 2) { - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); return; } if (status == 3) { - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); return; } EnHorse_Vec3fOffset(&this->actor.world.pos, this->actor.shape.rot.y, -30.0f, 60.0f, &backPos); - status = EnHorse_CalcFloorHeight(this, globalCtx, &backPos, &backFloor, &this->yBack); + status = EnHorse_CalcFloorHeight(this, play, &backPos, &backFloor, &this->yBack); if (status == 1) { this->actor.shape.rot.x = 0; - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); return; } if (status == 2) { - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); return; } if (status == 3) { - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); return; } @@ -2967,7 +2964,7 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { if ((frontFloor != this->actor.floorPoly) && (this->actor.speedXZ >= 0.0f)) { if ((!(this->stateFlags & ENHORSE_JUMPING) && dist < -40.0f) || (this->stateFlags & ENHORSE_JUMPING && dist < -200.0f)) { - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); return; } } @@ -2978,17 +2975,17 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { if (((backFloor != this->actor.floorPoly) && (this->actor.speedXZ <= 0.0f) && !(this->stateFlags & ENHORSE_JUMPING) && (dist < -40.0f)) || (this->stateFlags & ENHORSE_JUMPING && dist < -200.0f)) { - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); return; } if (ny < 0.81915206f || // cos(35 degrees) - SurfaceType_IsHorseBlocked(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) || - func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 7) { + SurfaceType_IsHorseBlocked(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) || + func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 7) { if (this->actor.speedXZ >= 0.0f) { - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); } else { - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); } return; } @@ -3013,24 +3010,24 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { } } -s32 EnHorse_GetMountSide(EnHorse* this, GlobalContext* globalCtx); +s32 EnHorse_GetMountSide(EnHorse* this, PlayState* play); -void EnHorse_MountDismount(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountDismount(EnHorse* this, PlayState* play) { s32 pad[2]; s32 mountSide; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - mountSide = EnHorse_GetMountSide(this, globalCtx); + mountSide = EnHorse_GetMountSide(this, play); if (mountSide != 0 && !(this->stateFlags & ENHORSE_UNRIDEABLE) && player->rideActor == NULL) { - Actor_SetRideActor(globalCtx, &this->actor, mountSide); + Actor_SetRideActor(play, &this->actor, mountSide); } - if (this->playerControlled == false && Actor_IsMounted(globalCtx, &this->actor) == true) { + if (this->playerControlled == false && Actor_IsMounted(play, &this->actor) == true) { this->noInputTimer = 55; this->noInputTimerMax = 55; this->playerControlled = 1; EnHorse_Freeze(this); - } else if (this->playerControlled == true && Actor_NotMounted(globalCtx, &this->actor) == true) { + } else if (this->playerControlled == true && Actor_NotMounted(play, &this->actor) == true) { this->noInputTimer = 35; this->noInputTimerMax = 35; this->stateFlags &= ~ENHORSE_UNRIDEABLE; @@ -3058,13 +3055,13 @@ void EnHorse_StickDirection(Vec2f* curStick, f32* stickMag, s16* angle) { *angle = RAD_TO_BINANG(Math_FAtan2F(-curStick->x, curStick->y)); } -void EnHorse_UpdateStick(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdateStick(EnHorse* this, PlayState* play) { this->lastStick = this->curStick; - this->curStick.x = globalCtx->state.input[0].rel.stick_x; - this->curStick.y = globalCtx->state.input[0].rel.stick_y; + this->curStick.x = play->state.input[0].rel.stick_x; + this->curStick.y = play->state.input[0].rel.stick_y; } -void EnHorse_ResolveCollision(EnHorse* this, GlobalContext* globalCtx, CollisionPoly* colPoly) { +void EnHorse_ResolveCollision(EnHorse* this, PlayState* play, CollisionPoly* colPoly) { f32 dist; f32 nx; f32 ny; @@ -3084,7 +3081,7 @@ void EnHorse_ResolveCollision(EnHorse* this, GlobalContext* globalCtx, Collision } } -void EnHorse_BgCheckSlowMoving(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_BgCheckSlowMoving(EnHorse* this, PlayState* play) { f32 yOffset; Vec3f start; Vec3f end; @@ -3092,7 +3089,7 @@ void EnHorse_BgCheckSlowMoving(EnHorse* this, GlobalContext* globalCtx) { CollisionPoly* colPoly; s32 bgId; - if (globalCtx->sceneNum == SCENE_SPOT20) { + if (play->sceneNum == SCENE_SPOT20) { yOffset = 19.0f; } else { yOffset = 40.0f; @@ -3104,16 +3101,16 @@ void EnHorse_BgCheckSlowMoving(EnHorse* this, GlobalContext* globalCtx) { end.x += 30.0f * Math_SinS(this->actor.world.rot.y); end.y += 30.0f * Math_SinS(-this->actor.shape.rot.x); end.z += 30.0f * Math_CosS(this->actor.world.rot.y); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &start, &end, &intersect, &colPoly, 1, 0, 0, 1, &bgId) != 0) { - EnHorse_ResolveCollision(this, globalCtx, colPoly); + if (BgCheck_EntityLineTest1(&play->colCtx, &start, &end, &intersect, &colPoly, 1, 0, 0, 1, &bgId) != 0) { + EnHorse_ResolveCollision(this, play, colPoly); } } -void EnHorse_HighJumpInit(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_HighJumpInit(EnHorse* this, PlayState* play); void EnHorse_Stub2(EnHorse* this); void EnHorse_Stub1(EnHorse* this); -void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { s32 pad; s32 pad2; Vec3f startPos; @@ -3133,11 +3130,11 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { Vec3f intersect; Vec3f obstacleTop; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, globalCtx->sceneNum == SCENE_SPOT20 ? 19.0f : 40.0f, 35.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, play->sceneNum == SCENE_SPOT20 ? 19.0f : 40.0f, 35.0f, 100.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - if (EnHorse_BgCheckBridgeJumpPoint(this, globalCtx)) { + if (EnHorse_BgCheckBridgeJumpPoint(this, play)) { return; } @@ -3173,7 +3170,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { movingFast = 1; } } else { - EnHorse_BgCheckSlowMoving(this, globalCtx); + EnHorse_BgCheckSlowMoving(this, play); return; } @@ -3185,18 +3182,18 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { endPos.z += (intersectDist * Math_CosS(this->actor.world.rot.y)); intersect = endPos; wall = NULL; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &startPos, &endPos, &intersect, &wall, 1, 0, 0, 1, &bgId) == 1) { + if (BgCheck_EntityLineTest1(&play->colCtx, &startPos, &endPos, &intersect, &wall, 1, 0, 0, 1, &bgId) == 1) { intersectDist = sqrt(Math3D_Vec3fDistSq(&startPos, &intersect)); this->stateFlags |= ENHORSE_OBSTACLE; } if (wall != NULL) { if (intersectDist < 30.0f) { - EnHorse_ResolveCollision(this, globalCtx, wall); + EnHorse_ResolveCollision(this, play, wall); } if ((Math_CosS(this->actor.world.rot.y - RAD_TO_BINANG(Math_FAtan2F(wall->normal.x, wall->normal.z)) - 0x7FFF) < 0.5f) || - SurfaceType_IsHorseBlocked(&globalCtx->colCtx, wall, bgId) != 0) { + SurfaceType_IsHorseBlocked(&play->colCtx, wall, bgId) != 0) { return; } @@ -3206,18 +3203,18 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { this->stateFlags |= ENHORSE_FORCE_REVERSING; } else if (movingFast == true) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } return; } - dynaPoly = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + dynaPoly = DynaPoly_GetActor(&play->colCtx, bgId); if ((this->stateFlags & ENHORSE_FLAG_26) && ((dynaPoly && dynaPoly->actor.id != 0x108) || dynaPoly == 0)) { if (movingFast == false) { this->stateFlags |= ENHORSE_FORCE_REVERSING; } else if (movingFast == true) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } return; } @@ -3230,7 +3227,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { obstaclePos.y = this->actor.world.pos.y + 120.0f; obstaclePos.z += intersectDist * Math_CosS(this->actor.world.rot.y); obstacleTop = obstaclePos; - obstacleTop.y = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &obstacleFloor, &bgId, &obstaclePos); + obstacleTop.y = BgCheck_EntityRaycastFloor3(&play->colCtx, &obstacleFloor, &bgId, &obstaclePos); if (obstacleTop.y == BGCHECK_Y_MIN) { return; } @@ -3248,7 +3245,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { obstacleFloor->normal.z * COLPOLY_NORMAL_FRAC, obstacleFloor->dist, &this->actor.world.pos) > 40.0f) { if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } this->stateFlags |= ENHORSE_OBSTACLE; return; @@ -3256,11 +3253,11 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { ny = obstacleFloor->normal.y * COLPOLY_NORMAL_FRAC; if (ny < 0.81915206f || // cos(35 degrees) - (SurfaceType_IsHorseBlocked(&globalCtx->colCtx, obstacleFloor, bgId) != 0) || - (func_80041D4C(&globalCtx->colCtx, obstacleFloor, bgId) == 7)) { + (SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) != 0) || + (func_80041D4C(&play->colCtx, obstacleFloor, bgId) == 7)) { if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } return; } @@ -3280,7 +3277,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { } obstacleTop = obstaclePos; - obstacleTop.y = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &obstacleFloor, &bgId, &obstaclePos); + obstacleTop.y = BgCheck_EntityRaycastFloor3(&play->colCtx, &obstacleFloor, &bgId, &obstaclePos); if (obstacleTop.y == BGCHECK_Y_MIN) { return; } @@ -3293,16 +3290,16 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { ny = obstacleFloor->normal.y * COLPOLY_NORMAL_FRAC; if (ny < 0.81915206f || // cos(35 degrees) - SurfaceType_IsHorseBlocked(&globalCtx->colCtx, obstacleFloor, bgId) || - func_80041D4C(&globalCtx->colCtx, obstacleFloor, bgId) == 7) { + SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || + func_80041D4C(&play->colCtx, obstacleFloor, bgId) == 7) { if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } } else if (behindObstacleHeight < -DREG(4)) { // -70 if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } } else if (movingFast == false && obstacleHeight > 19.0f && obstacleHeight <= 40.0f) { EnHorse_Stub1(this); @@ -3316,14 +3313,14 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_CheckBoost(EnHorse* thisx, GlobalContext* globalCtx2) { +void EnHorse_CheckBoost(EnHorse* thisx, PlayState* play2) { EnHorse* this = (EnHorse*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 pad; if (this->action == ENHORSE_ACT_MOUNTED_WALK || this->action == ENHORSE_ACT_MOUNTED_TROT || this->action == ENHORSE_ACT_MOUNTED_GALLOP) { - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) && (globalCtx->interfaceCtx.unk_1EE == 8)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) && (play->interfaceCtx.unk_1EE == 8)) { if (!(this->stateFlags & ENHORSE_BOOST) && !(this->stateFlags & ENHORSE_FLAG_8) && !(this->stateFlags & ENHORSE_FLAG_9)) { if (this->numBoosts > 0) { @@ -3361,7 +3358,7 @@ void EnHorse_CheckBoost(EnHorse* thisx, GlobalContext* globalCtx2) { } } -void EnHorse_RegenBoost(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_RegenBoost(EnHorse* this, PlayState* play) { if (this->numBoosts < 6 && this->numBoosts > 0) { this->boostRegenTime--; this->boostTimer++; @@ -3400,16 +3397,16 @@ void EnHorse_RegenBoost(EnHorse* this, GlobalContext* globalCtx) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } - globalCtx->interfaceCtx.numHorseBoosts = this->numBoosts; + play->interfaceCtx.numHorseBoosts = this->numBoosts; } -void EnHorse_UpdatePlayerDir(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdatePlayerDir(EnHorse* this, PlayState* play) { EnHorse* pad; s16 angle; f32 s; f32 c; - angle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + angle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; s = Math_SinS(angle); c = Math_CosS(angle); if (s > 0.8660254f) { // sin(60 degrees) @@ -3433,7 +3430,7 @@ void EnHorse_UpdatePlayerDir(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_TiltBody(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_TiltBody(EnHorse* this, PlayState* play) { f32 speed; f32 rollDiff; s32 targetRoll; @@ -3457,14 +3454,14 @@ void EnHorse_TiltBody(EnHorse* this, GlobalContext* globalCtx) { this->actor.shape.rot.z = this->actor.world.rot.z; } -s32 EnHorse_UpdateConveyors(EnHorse* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnHorse_UpdateConveyors(EnHorse* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 conveyorDir; if ((this->actor.floorPoly == NULL) && (this != (EnHorse*)player->rideActor)) { return 0; } - conveyorDir = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + conveyorDir = SurfaceType_GetConveyorDirection(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); conveyorDir = (conveyorDir * (0x10000 / 64)) - this->actor.world.rot.y; if (conveyorDir > 800.0f) { this->actor.world.rot.y += 800.0f; @@ -3482,19 +3479,19 @@ s32 EnHorse_RandInt(f32 range) { return Rand_ZeroOne() * range; } -void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnHorse_Update(Actor* thisx, PlayState* play2) { EnHorse* this = (EnHorse*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Vec3f dustAcc = { 0.0f, 0.0f, 0.0f }; Vec3f dustVel = { 0.0f, 1.0f, 0.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->lastYaw = thisx->shape.rot.y; - EnHorse_UpdateStick(this, globalCtx); - EnHorse_UpdatePlayerDir(this, globalCtx); + EnHorse_UpdateStick(this, play); + EnHorse_UpdatePlayerDir(this, play); if (!(this->stateFlags & ENHORSE_INACTIVE)) { - EnHorse_MountDismount(this, globalCtx); + EnHorse_MountDismount(this, play); } if (this->stateFlags & ENHORSE_FLAG_19) { @@ -3508,17 +3505,17 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); this->stateFlags &= ~ENHORSE_OBSTACLE; this->curFrame = this->skin.skelAnime.curFrame; this->lastPos = thisx->world.pos; if (!(this->stateFlags & ENHORSE_INACTIVE)) { if (this->action == ENHORSE_ACT_MOUNTED_GALLOP || this->action == ENHORSE_ACT_MOUNTED_TROT || this->action == ENHORSE_ACT_MOUNTED_WALK) { - EnHorse_CheckBoost(this, globalCtx); + EnHorse_CheckBoost(this, play); } if (this->playerControlled == true) { - EnHorse_RegenBoost(this, globalCtx); + EnHorse_RegenBoost(this, play); } Actor_MoveForward(thisx); if (this->action == ENHORSE_ACT_INGO_RACE) { @@ -3543,7 +3540,7 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { } } if (this->action != ENHORSE_ACT_INGO_RACE) { - EnHorse_TiltBody(this, globalCtx); + EnHorse_TiltBody(this, play); } Collider_UpdateCylinder(thisx, &this->cyl1); Collider_UpdateCylinder(thisx, &this->cyl2); @@ -3553,18 +3550,17 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { this->cyl1.dim.pos.z = this->cyl1.dim.pos.z + (s16)(Math_CosS(thisx->shape.rot.y) * 11.0f); this->cyl2.dim.pos.x = this->cyl2.dim.pos.x + (s16)(Math_SinS(thisx->shape.rot.y) * -18.0f); this->cyl2.dim.pos.z = this->cyl2.dim.pos.z + (s16)(Math_CosS(thisx->shape.rot.y) * -18.0f); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->cyl1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cyl1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cyl2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->cyl1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cyl1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cyl2.base); if ((player->stateFlags1 & PLAYER_STATE1_0) && player->rideActor != NULL) { - if (globalCtx->sceneNum != SCENE_SPOT20 || - (globalCtx->sceneNum == SCENE_SPOT20 && (thisx->world.pos.z < -2400.0f))) { - EnHorse_UpdateConveyors(this, globalCtx); + if (play->sceneNum != SCENE_SPOT20 || (play->sceneNum == SCENE_SPOT20 && (thisx->world.pos.z < -2400.0f))) { + EnHorse_UpdateConveyors(this, play); } } if (!(this->stateFlags & ENHORSE_FLAG_24)) { - EnHorse_UpdateBgCheckInfo(this, globalCtx); - EnHorse_CheckFloors(this, globalCtx); + EnHorse_UpdateBgCheckInfo(this, play); + EnHorse_CheckFloors(this, play); if (thisx->world.pos.y < this->yFront && thisx->world.pos.y < this->yBack) { if (this->yBack < this->yFront) { thisx->world.pos.y = this->yBack; @@ -3577,8 +3573,8 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { this->stateFlags &= ~ENHORSE_FLAG_24; } - if (globalCtx->sceneNum == SCENE_SPOT09 && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { - EnHorse_CheckBridgeJumps(this, globalCtx); + if (play->sceneNum == SCENE_SPOT09 && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { + EnHorse_CheckBridgeJumps(this, play); } thisx->focus.pos = thisx->world.pos; @@ -3607,19 +3603,19 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { if (gSaveContext.entranceIndex != 343 || gSaveContext.sceneSetupIndex != 9) { if (this->dustFlags & 1) { this->dustFlags &= ~1; - func_800287AC(globalCtx, &this->frontRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, + func_800287AC(play, &this->frontRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, EnHorse_RandInt(10) + 30, EnHorse_RandInt(20) + 30); } else if (this->dustFlags & 2) { this->dustFlags &= ~2; - func_800287AC(globalCtx, &this->frontLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, + func_800287AC(play, &this->frontLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, EnHorse_RandInt(10) + 30, EnHorse_RandInt(20) + 30); } else if (this->dustFlags & 4) { this->dustFlags &= ~4; - func_800287AC(globalCtx, &this->backRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, + func_800287AC(play, &this->backRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, EnHorse_RandInt(10) + 30, EnHorse_RandInt(20) + 30); } else if (this->dustFlags & 8) { this->dustFlags &= ~8; - func_800287AC(globalCtx, &this->backLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, + func_800287AC(play, &this->backLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, EnHorse_RandInt(10) + 30, EnHorse_RandInt(20) + 30); } } @@ -3627,7 +3623,7 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 EnHorse_PlayerDirToMountSide(EnHorse* this, GlobalContext* globalCtx, Player* player) { +s32 EnHorse_PlayerDirToMountSide(EnHorse* this, PlayState* play, Player* player) { if (this->playerDir == PLAYER_DIR_SIDE_L) { return -1; } @@ -3637,7 +3633,7 @@ s32 EnHorse_PlayerDirToMountSide(EnHorse* this, GlobalContext* globalCtx, Player return 0; } -s32 EnHorse_MountSideCheck(EnHorse* this, GlobalContext* globalCtx, Player* player) { +s32 EnHorse_MountSideCheck(EnHorse* this, PlayState* play, Player* player) { s32 mountSide; if (Actor_WorldDistXZToActor(&this->actor, &player->actor) > 75.0f) { @@ -3648,7 +3644,7 @@ s32 EnHorse_MountSideCheck(EnHorse* this, GlobalContext* globalCtx, Player* play 0.17364818f) { // cos(80 degrees) return 0; } else { - mountSide = EnHorse_PlayerDirToMountSide(this, globalCtx, player); + mountSide = EnHorse_PlayerDirToMountSide(this, play, player); if (mountSide == -1) { return -1; } @@ -3659,14 +3655,14 @@ s32 EnHorse_MountSideCheck(EnHorse* this, GlobalContext* globalCtx, Player* play return 0; } -s32 EnHorse_GetMountSide(EnHorse* this, GlobalContext* globalCtx) { +s32 EnHorse_GetMountSide(EnHorse* this, PlayState* play) { if (this->action != ENHORSE_ACT_IDLE) { return 0; } if ((this->animationIdx != ENHORSE_ANIM_IDLE) && (this->animationIdx != ENHORSE_ANIM_WHINNEY)) { return 0; } - return EnHorse_MountSideCheck(this, globalCtx, GET_PLAYER(globalCtx)); + return EnHorse_MountSideCheck(this, play, GET_PLAYER(play)); } void EnHorse_RandomOffset(Vec3f* src, f32 dist, Vec3f* dst) { @@ -3675,7 +3671,7 @@ void EnHorse_RandomOffset(Vec3f* src, f32 dist, Vec3f* dst) { dst->z = (Rand_ZeroOne() * (dist * 2.0f) + src->z) - dist; } -void EnHorse_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { EnHorse* this = (EnHorse*)thisx; s32 pad; Vec3f sp94 = { 0.0f, 0.0f, 0.0f }; @@ -3702,7 +3698,7 @@ void EnHorse_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { } Skin_GetLimbPos(skin, 13, &sp94, &sp2C); - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp2C, &this->unk_228, &sp28); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sp2C, &this->unk_228, &sp28); if ((this->animationIdx == ENHORSE_ANIM_IDLE && this->action != ENHORSE_ACT_FROZEN) && ((frame > 40.0f && frame < 45.0f && this->type == HORSE_EPONA) || (frame > 28.0f && frame < 33.0f && this->type == HORSE_HNI))) { @@ -3814,14 +3810,14 @@ void EnHorse_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { //! Actors will draw for a couple of frames between the pauses, but some important logic updates will not occur. //! In the case of OC, this can cause unwanted effects such as a very large amount of displacement being applied to //! a colliding actor. - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->jntSph.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->jntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->jntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->jntSph.base); } // unused static s32 D_80A667DC[] = { 0, 3, 7, 14 }; -s32 EnHorse_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 limbIndex, Skin* arg3) { +s32 EnHorse_OverrideLimbDraw(Actor* thisx, PlayState* play, s32 limbIndex, Skin* arg3) { static void* eyeTextures[] = { gEponaEyeOpenTex, gEponaEyeHalfTex, @@ -3831,32 +3827,32 @@ s32 EnHorse_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 limbInd EnHorse* this = (EnHorse*)thisx; s32 drawOriginalLimb = true; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_horse.c", 8582); + OPEN_DISPS(play->state.gfxCtx, "../z_en_horse.c", 8582); if (limbIndex == 13 && this->type == HORSE_EPONA) { u8 index = eyeBlinkIndices[this->blinkTimer]; gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[index])); } else if (this->type == HORSE_HNI && this->stateFlags & ENHORSE_FLAG_18 && limbIndex == 30) { - Skin_DrawLimb(globalCtx->state.gfxCtx, &this->skin, limbIndex, gHorseIngoGerudoSaddleDL, 0); + Skin_DrawLimb(play->state.gfxCtx, &this->skin, limbIndex, gHorseIngoGerudoSaddleDL, 0); drawOriginalLimb = false; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_horse.c", 8601); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_horse.c", 8601); return drawOriginalLimb; } -void EnHorse_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorse_Draw(Actor* thisx, PlayState* play) { EnHorse* this = (EnHorse*)thisx; if (!(this->stateFlags & ENHORSE_INACTIVE)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); this->stateFlags |= ENHORSE_DRAW; if (this->stateFlags & ENHORSE_JUMPING) { - func_800A6360(thisx, globalCtx, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, false); + func_800A6360(thisx, play, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, false); } else { - func_800A6360(thisx, globalCtx, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, true); + func_800A6360(thisx, play, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, true); } if (this->postDrawFunc != NULL) { - this->postDrawFunc(this, globalCtx); + this->postDrawFunc(this, play); } } } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.h b/src/overlays/actors/ovl_En_Horse/z_en_horse.h index 08c1cf2262..fb07caa697 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -89,7 +89,7 @@ typedef enum { /* 1 */ HORSE_HNI } HorseType; -typedef void (*EnHorsePostdrawFunc)(struct EnHorse*, GlobalContext*); +typedef void (*EnHorsePostdrawFunc)(struct EnHorse*, PlayState*); typedef struct EnHorse { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 20a0fc44ec..339312bc02 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -43,10 +43,10 @@ typedef enum { /* 4 */ MALONRACE_FAILURE } HorseGameMalonRaceResult; -void EnHorseGameCheck_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGameCheck_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGameCheck_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGameCheck_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorseGameCheck_Init(Actor* thisx, PlayState* play); +void EnHorseGameCheck_Destroy(Actor* thisx, PlayState* play); +void EnHorseGameCheck_Update(Actor* thisx, PlayState* play); +void EnHorseGameCheck_Draw(Actor* thisx, PlayState* play); const ActorInit En_Horse_Game_Check_InitVars = { ACTOR_EN_HORSE_GAME_CHECK, @@ -78,7 +78,7 @@ static Vec3f sFencePos[] = { { -939.0f, 1.0f, 455.0f }, { -1644.0f, -21.0f, -1035.0f }, }; -s32 EnHorseGameCheck_InitIngoRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_InitIngoRace(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckIngoRace* this = (EnHorseGameCheckIngoRace*)base; s32 i; @@ -87,8 +87,7 @@ s32 EnHorseGameCheck_InitIngoRace(EnHorseGameCheckBase* base, GlobalContext* glo for (i = 0; i < 3; i++) { this->playerCheck[i] = 0; } - this->ingoHorse = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -250.0f, 1.0f, -1650.0f, 0, 0x4000, 0, 0x8003); + this->ingoHorse = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -250.0f, 1.0f, -1650.0f, 0, 0x4000, 0, 0x8003); if (this->ingoHorse == NULL) { LogUtils_HungupThread("../z_en_horse_game_check.c", 385); @@ -102,39 +101,39 @@ s32 EnHorseGameCheck_InitIngoRace(EnHorseGameCheckBase* base, GlobalContext* glo return true; } -s32 EnHorseGameCheck_DestroyIngoRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_DestroyIngoRace(EnHorseGameCheckBase* base, PlayState* play) { return true; } -void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, GlobalContext* globalCtx) { +void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, PlayState* play) { gSaveContext.cutsceneIndex = 0; if (this->result == INGORACE_PLAYER_WIN) { - globalCtx->nextEntranceIndex = ENTR_SPOT20_7; + play->nextEntranceIndex = ENTR_SPOT20_7; if (GET_EVENTINF(EVENTINF_HORSES_06)) { SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_6); SET_EVENTINF_HORSES_0F(1); - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionType = TRANS_TYPE_FADE_WHITE; Environment_ForcePlaySequence(NA_BGM_INGO); } else { SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_4); SET_EVENTINF_HORSES_0F(1); Environment_ForcePlaySequence(NA_BGM_INGO); - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); } } else { - globalCtx->nextEntranceIndex = ENTR_SPOT20_8; + play->nextEntranceIndex = ENTR_SPOT20_8; SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_3); - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST); + play->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST); SET_EVENTINF_HORSES_0F(1); } DREG(25) = 0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.timer1State = 0; } -s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckIngoRace* this = (EnHorseGameCheckIngoRace*)base; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; EnHorse* ingoHorse; EnHorse* horse; @@ -221,13 +220,13 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, GlobalContext* g if (this->finishTimer > 0) { this->finishTimer--; } else { - EnHorseGameCheck_FinishIngoRace(this, globalCtx); + EnHorseGameCheck_FinishIngoRace(this, play); } } return true; } -s32 EnHorseGameCheck_InitGerudoArchery(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_InitGerudoArchery(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckGerudoArchery* this = (EnHorseGameCheckGerudoArchery*)base; this->base.type = HORSEGAME_GERUDO_ARCHERY; @@ -236,13 +235,13 @@ s32 EnHorseGameCheck_InitGerudoArchery(EnHorseGameCheckBase* base, GlobalContext return true; } -s32 EnHorseGameCheck_DestroyGerudoArchery(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_DestroyGerudoArchery(EnHorseGameCheckBase* base, PlayState* play) { return true; } -s32 EnHorseGameCheck_UpdateGerudoArchery(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_UpdateGerudoArchery(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckGerudoArchery* this = (EnHorseGameCheckGerudoArchery*)base; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnHorse* horse = (EnHorse*)player->rideActor; if (horse == NULL) { @@ -250,14 +249,14 @@ s32 EnHorseGameCheck_UpdateGerudoArchery(EnHorseGameCheckBase* base, GlobalConte } if (this->startTimer > 90) { - if (globalCtx) {} + if (play) {} horse->hbaStarted = 1; } this->startTimer++; return true; } -s32 EnHorseGameCheck_InitType3(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_InitType3(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheck3* this = (EnHorseGameCheck3*)base; this->base.type = HORSEGAME_TYPE3; @@ -265,15 +264,15 @@ s32 EnHorseGameCheck_InitType3(EnHorseGameCheckBase* base, GlobalContext* global return true; } -s32 EnHorseGameCheck_DestroyType3(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_DestroyType3(EnHorseGameCheckBase* base, PlayState* play) { return true; } -s32 EnHorseGameCheck_UpdateType3(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_UpdateType3(EnHorseGameCheckBase* base, PlayState* play) { return true; } -s32 EnHorseGameCheck_InitMalonRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_InitMalonRace(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckMalonRace* this = (EnHorseGameCheckMalonRace*)base; s32 i; @@ -288,37 +287,37 @@ s32 EnHorseGameCheck_InitMalonRace(EnHorseGameCheckBase* base, GlobalContext* gl return true; } -s32 EnHorseGameCheck_DestroyMalonRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_DestroyMalonRace(EnHorseGameCheckBase* base, PlayState* play) { return true; } -void EnHorseGameCheck_FinishMalonRace(EnHorseGameCheckMalonRace* this, GlobalContext* globalCtx) { +void EnHorseGameCheck_FinishMalonRace(EnHorseGameCheckMalonRace* this, PlayState* play) { if ((this->result == MALONRACE_SUCCESS) || (this->result == MALONRACE_TIME_UP)) { gSaveContext.cutsceneIndex = 0; - globalCtx->nextEntranceIndex = ENTR_SPOT20_7; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT20_7; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); + play->transitionTrigger = TRANS_TRIGGER_START; } else if (this->result == MALONRACE_FAILURE) { gSaveContext.timer1Value = 240; gSaveContext.timer1State = 0xF; gSaveContext.cutsceneIndex = 0; - globalCtx->nextEntranceIndex = ENTR_SPOT20_7; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT20_7; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); + play->transitionTrigger = TRANS_TRIGGER_START; } else { // "not supported" osSyncPrintf("En_HGC_Spot20_Ta_end():対応せず\n"); gSaveContext.cutsceneIndex = 0; - globalCtx->nextEntranceIndex = ENTR_SPOT20_0; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT20_0; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); + play->transitionTrigger = TRANS_TRIGGER_START; } } -s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { +s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play) { EnHorseGameCheckMalonRace* this = (EnHorseGameCheckMalonRace*)base; s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnHorse* horse; if (!(this->raceFlags & MALONRACE_PLAYER_ON_MARK) && AT_FINISH_LINE(player->rideActor)) { @@ -363,7 +362,7 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* if ((this->fenceCheck[i - 1] == 0) && !(this->raceFlags & MALONRACE_BROKE_RULE)) { this->raceFlags |= MALONRACE_BROKE_RULE; - Message_StartTextbox(globalCtx, 0x208C, NULL); + Message_StartTextbox(play, 0x208C, NULL); this->result = 4; this->finishTimer = 30; } @@ -374,7 +373,7 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* AT_FINISH_LINE(player2->rideActor)) { if ((this->lapCount == 1) && (this->fenceCheck[15] == 0) && (player2->rideActor->prevPos.x < -200.0f)) { this->raceFlags |= MALONRACE_BROKE_RULE; - Message_StartTextbox(globalCtx, 0x208C, NULL); + Message_StartTextbox(play, 0x208C, NULL); this->result = MALONRACE_FAILURE; this->finishTimer = 30; } else if (this->fenceCheck[15] == 1) { @@ -388,15 +387,15 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* } else if ((this->fenceCheck[7] == 1) && !(this->raceFlags & MALONRACE_SECOND_LAP)) { this->lapCount = 1; this->raceFlags |= MALONRACE_SECOND_LAP; - Message_StartTextbox(globalCtx, 0x208D, NULL); + Message_StartTextbox(play, 0x208D, NULL); } else if (this->fenceCheck[7] == 0) { this->raceFlags |= MALONRACE_BROKE_RULE; - Message_StartTextbox(globalCtx, 0x208C, NULL); + Message_StartTextbox(play, 0x208C, NULL); this->result = MALONRACE_FAILURE; this->finishTimer = 30; } else if (player2->rideActor->prevPos.x > 80.0f) { this->raceFlags |= MALONRACE_BROKE_RULE; - Message_StartTextbox(globalCtx, 0x208C, NULL); + Message_StartTextbox(play, 0x208C, NULL); this->result = MALONRACE_FAILURE; this->finishTimer = 30; } @@ -411,7 +410,7 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* if (this->finishTimer > 0) { this->finishTimer--; } else { - EnHorseGameCheck_FinishMalonRace(this, globalCtx); + EnHorseGameCheck_FinishMalonRace(this, play); } } return true; @@ -441,35 +440,35 @@ static EnHorseGameCheckFunc sUpdateFuncs[] = { EnHorseGameCheck_UpdateMalonRace, }; -void EnHorseGameCheck_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Init(Actor* thisx, PlayState* play) { s32 pad; EnHorseGameCheckBase* this = (EnHorseGameCheckBase*)thisx; - if ((globalCtx->sceneNum == SCENE_SPOT20) && (Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1))) { + if ((play->sceneNum == SCENE_SPOT20) && (Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1))) { this->actor.params = HORSEGAME_MALON_RACE; } if (sInitFuncs[this->actor.params] != NULL) { - sInitFuncs[this->actor.params](this, globalCtx); + sInitFuncs[this->actor.params](this, play); } } -void EnHorseGameCheck_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnHorseGameCheckBase* this = (EnHorseGameCheckBase*)thisx; if (sDestroyFuncs[this->actor.params] != NULL) { - sDestroyFuncs[this->actor.params](this, globalCtx); + sDestroyFuncs[this->actor.params](this, play); } } -void EnHorseGameCheck_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Update(Actor* thisx, PlayState* play) { s32 pad; EnHorseGameCheckBase* this = (EnHorseGameCheckBase*)thisx; if (sUpdateFuncs[this->type] != NULL) { - sUpdateFuncs[this->type](this, globalCtx); + sUpdateFuncs[this->type](this, play); } } -void EnHorseGameCheck_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h index 0828d27054..2ef1d2b9a9 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h @@ -6,7 +6,7 @@ struct EnHorseGameCheckBase; -typedef s32 (*EnHorseGameCheckFunc)(struct EnHorseGameCheckBase* this, GlobalContext* globalCtx); +typedef s32 (*EnHorseGameCheckFunc)(struct EnHorseGameCheckBase* this, PlayState* play); typedef struct EnHorseGameCheckBase { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c index dd6572e913..9ed66d8de6 100644 --- a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c +++ b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c @@ -14,14 +14,14 @@ typedef struct { /* 0x6 */ u8 unk_6; } unk_D_80A69248; // size = 0x8 -void EnHorseGanon_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGanon_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGanon_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorseGanon_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorseGanon_Init(Actor* thisx, PlayState* play); +void EnHorseGanon_Destroy(Actor* thisx, PlayState* play); +void EnHorseGanon_Update(Actor* thisx, PlayState* play); +void EnHorseGanon_Draw(Actor* thisx, PlayState* play); void func_80A68AC4(EnHorseGanon* this); -void func_80A68AF0(EnHorseGanon* this, GlobalContext* globalCtx); -void func_80A68DB0(EnHorseGanon* this, GlobalContext* globalCtx); +void func_80A68AF0(EnHorseGanon* this, PlayState* play); +void func_80A68DB0(EnHorseGanon* this, PlayState* play); const ActorInit En_Horse_Ganon_InitVars = { ACTOR_EN_HORSE_GANON, @@ -113,7 +113,7 @@ void func_80A68660(unk_D_80A69248* data, s32 index, Vec3f* vec) { vec->z = data[index].unk_0.z; } -void func_80A686A8(EnHorseGanon* this, GlobalContext* globalCtx) { +void func_80A686A8(EnHorseGanon* this, PlayState* play) { Vec3f* tempPos; Vec3f vec; s16 y; @@ -138,7 +138,7 @@ void func_80A686A8(EnHorseGanon* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y = this->actor.world.rot.y; - if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor) <= 300.0f) { + if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor) <= 300.0f) { if (this->actor.speedXZ < 12.0f) { this->actor.speedXZ += 1.0f; } else { @@ -164,7 +164,7 @@ void func_80A68870(EnHorseGanon* this) { } } -void EnHorseGanon_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGanon_Init(Actor* thisx, PlayState* play) { EnHorseGanon* this = (EnHorseGanon*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -177,25 +177,25 @@ void EnHorseGanon_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; this->action = 0; this->actor.focus.pos.y += 70.0f; - Skin_Init(globalCtx, &this->skin, &gHorseGanonSkel, &gHorseGanonIdleAnim); + Skin_Init(play, &this->skin, &gHorseGanonSkel, &gHorseGanonIdleAnim); this->currentAnimation = 0; Animation_PlayOnce(&this->skin.skelAnime, sAnimations[0]); - Collider_InitCylinder(globalCtx, &this->colliderBody); - Collider_SetCylinder(globalCtx, &this->colliderBody, &this->actor, &sCylinderInit); - Collider_InitJntSph(globalCtx, &this->colliderHead); - Collider_SetJntSph(globalCtx, &this->colliderHead, &this->actor, &sJntSphInit, this->headElements); + Collider_InitCylinder(play, &this->colliderBody); + Collider_SetCylinder(play, &this->colliderBody, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->colliderHead); + Collider_SetJntSph(play, &this->colliderHead, &this->actor, &sJntSphInit, this->headElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, 0, &sColChkInfoInit); func_80A68AC4(this); } -void EnHorseGanon_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGanon_Destroy(Actor* thisx, PlayState* play) { EnHorseGanon* this = (EnHorseGanon*)thisx; - Skin_Free(globalCtx, &this->skin); - Collider_DestroyCylinder(globalCtx, &this->colliderBody); - Collider_DestroyJntSph(globalCtx, &this->colliderHead); + Skin_Free(play, &this->skin); + Collider_DestroyCylinder(play, &this->colliderBody); + Collider_DestroyJntSph(play, &this->colliderHead); } void func_80A68AC4(EnHorseGanon* this) { @@ -203,7 +203,7 @@ void func_80A68AC4(EnHorseGanon* this) { Animation_PlayLoop(&this->skin.skelAnime, sAnimations[4]); } -void func_80A68AF0(EnHorseGanon* this, GlobalContext* globalCtx) { +void func_80A68AF0(EnHorseGanon* this, PlayState* play) { this->actor.speedXZ = 0.0f; SkelAnime_Update(&this->skin.skelAnime); } @@ -256,19 +256,19 @@ void func_80A68B20(EnHorseGanon* this) { } } -void func_80A68DB0(EnHorseGanon* this, GlobalContext* globalCtx) { +void func_80A68DB0(EnHorseGanon* this, PlayState* play) { if (this->currentAnimation == 2) { func_80A68870(this); } - func_80A686A8(this, globalCtx); + func_80A686A8(this, play); if (SkelAnime_Update(&this->skin.skelAnime) != 0) { func_80A68B20(this); } } -void func_80A68E14(EnHorseGanon* this, GlobalContext* globalCtx) { +void func_80A68E14(EnHorseGanon* this, PlayState* play) { s32 pad; CollisionPoly* col; f32 temp_ret; @@ -279,28 +279,28 @@ void func_80A68E14(EnHorseGanon* this, GlobalContext* globalCtx) { v.y = this->actor.world.pos.y + 60.0f; v.z = Math_CosS(this->actor.shape.rot.y) * 30.0f + this->actor.world.pos.z; - temp_ret = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &col, &temp1, &v); + temp_ret = BgCheck_EntityRaycastFloor3(&play->colCtx, &col, &temp1, &v); this->unk_1F4 = temp_ret; this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - temp_ret, 30.0f)); } -void EnHorseGanon_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGanon_Update(Actor* thisx, PlayState* play) { EnHorseGanon* this = (EnHorseGanon*)thisx; s32 pad; - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 55.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 55.0f, 100.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 += 70.0f; Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); } -void EnHorseGanon_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorseGanon_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { Vec3f sp4C; Vec3f sp40; EnHorseGanon* this = (EnHorseGanon*)thisx; @@ -322,13 +322,13 @@ void EnHorseGanon_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { } //! @bug see relevant comment in `EnHorse_SkinCallback1` - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderHead.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderHead.base); } -void EnHorseGanon_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGanon_Draw(Actor* thisx, PlayState* play) { EnHorseGanon* this = (EnHorseGanon*)thisx; - func_80A68E14(this, globalCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_800A6330(&this->actor, globalCtx, &this->skin, EnHorseGanon_PostDraw, true); + func_80A68E14(this, play); + func_80093D18(play->state.gfxCtx); + func_800A6330(&this->actor, play, &this->skin, EnHorseGanon_PostDraw, true); } diff --git a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h index a7fd8378ee..8083adeee6 100644 --- a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h +++ b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h @@ -6,7 +6,7 @@ struct EnHorseGanon; -typedef void (*EnHorseGanonActionFunc)(struct EnHorseGanon*, GlobalContext*); +typedef void (*EnHorseGanonActionFunc)(struct EnHorseGanon*, PlayState*); typedef struct EnHorseGanon { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index b55e70401c..fb0e3fbf2a 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorseLinkChild_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorseLinkChild_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorseLinkChild_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorseLinkChild_Init(Actor* thisx, PlayState* play); +void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play); +void EnHorseLinkChild_Update(Actor* thisx, PlayState* play); +void EnHorseLinkChild_Draw(Actor* thisx, PlayState* play); void func_80A69B7C(EnHorseLinkChild* this); void func_80A69EC0(EnHorseLinkChild* this); @@ -139,7 +139,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1200, ICHAIN_STOP), }; -void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) { EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; s32 pad; @@ -151,20 +151,20 @@ void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx) { this->action = 1; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; - Skin_Init(globalCtx, &this->skin, &gChildEponaSkel, &gChildEponaGallopingAnim); + Skin_Init(play, &this->skin, &gChildEponaSkel, &gChildEponaGallopingAnim); this->animationIdx = 0; Animation_PlayOnce(&this->skin.skelAnime, sAnimations[0]); - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinderType1(globalCtx, &this->bodyCollider, &this->actor, &sCylinderInit); - Collider_InitJntSph(globalCtx, &this->headCollider); - Collider_SetJntSph(globalCtx, &this->headCollider, &this->actor, &sJntSphInit, this->headElements); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinderType1(play, &this->bodyCollider, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->headCollider); + Collider_SetJntSph(play, &this->headCollider, &this->actor, &sJntSphInit, this->headElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColCheckInfoInit); this->unk_1F0 = 0; this->eyeTexIndex = 0; if (gSaveContext.sceneSetupIndex > 3) { func_80A69EC0(this); - } else if (globalCtx->sceneNum == SCENE_SPOT20) { + } else if (play->sceneNum == SCENE_SPOT20) { if (!Flags_GetEventChkInf(EVENTCHKINF_14)) { Actor_Kill(&this->actor); return; @@ -178,12 +178,12 @@ void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.home.rot.z = this->actor.world.rot.z = this->actor.shape.rot.z = 0; } -void EnHorseLinkChild_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play) { EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; - Skin_Free(globalCtx, &this->skin); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyJntSph(globalCtx, &this->headCollider); + Skin_Free(play, &this->skin); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyJntSph(play, &this->headCollider); } void func_80A6988C(EnHorseLinkChild* this) { @@ -197,7 +197,7 @@ void func_80A6988C(EnHorseLinkChild* this) { this->skin.skelAnime.playSpeed = func_80A695A4(this); } -void func_80A698F4(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A698F4(EnHorseLinkChild* this, PlayState* play) { this->actor.speedXZ = 0.0f; if (SkelAnime_Update(&this->skin.skelAnime)) { func_80A6988C(this); @@ -219,11 +219,11 @@ void func_80A6993C(EnHorseLinkChild* this, s32 newAnimationIdx) { } } -void func_80A699FC(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A699FC(EnHorseLinkChild* this, PlayState* play) { f32 distFromLink; s32 newAnimationIdx; - distFromLink = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + distFromLink = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); if (SkelAnime_Update(&this->skin.skelAnime)) { if ((distFromLink < 1000.0f) && (distFromLink > 70.0f)) { @@ -250,13 +250,13 @@ void func_80A69B7C(EnHorseLinkChild* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, -5.0f); } -void func_80A69C18(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A69C18(EnHorseLinkChild* this, PlayState* play) { s16 yawDiff; f32 distFromLink; s32 newAnimationIdx; if ((this->animationIdx == 4) || (this->animationIdx == 3) || (this->animationIdx == 2)) { - yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if (yawDiff > 0x12C) { this->actor.world.rot.y += 0x12C; @@ -270,7 +270,7 @@ void func_80A69C18(EnHorseLinkChild* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skin.skelAnime)) { - distFromLink = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + distFromLink = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); if (distFromLink > 1000.0f) { func_80A6993C(this, 0); @@ -309,14 +309,14 @@ void func_80A69EC0(EnHorseLinkChild* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, -5.0f); } -void func_80A69F5C(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A69F5C(EnHorseLinkChild* this, PlayState* play) { Player* player; s16 yawDiff; s32 yawSign; s32 yawOffset; if ((this->animationIdx == 4) || (this->animationIdx == 3) || (this->animationIdx == 2)) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &this->actor.home.pos) < 250.0f) { yawDiff = player->actor.shape.rot.y; @@ -339,7 +339,7 @@ void func_80A69F5C(EnHorseLinkChild* this, GlobalContext* globalCtx) { } } -void func_80A6A068(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { Player* player; f32 distFromLink; s32 animationEnded; @@ -347,8 +347,8 @@ void func_80A6A068(EnHorseLinkChild* this, GlobalContext* globalCtx) { f32 distFromHome; f32 distLinkFromHome; - func_80A69F5C(this, globalCtx); - player = GET_PLAYER(globalCtx); + func_80A69F5C(this, play); + player = GET_PLAYER(play); distFromLink = Actor_WorldDistXZToActor(&this->actor, &player->actor); if (gSaveContext.entranceIndex == ENTR_SPOT20_1) { @@ -359,7 +359,7 @@ void func_80A6A068(EnHorseLinkChild* this, GlobalContext* globalCtx) { } if ((GET_EVENTCHKINF(EVENTCHKINF_16) && (DREG(53) != 0)) || - ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF1))) { + ((play->sceneNum == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF1))) { func_80A6A4DC(this); } else { this->unk_2A0 = GET_EVENTCHKINF(EVENTCHKINF_16); @@ -439,7 +439,7 @@ void func_80A6A4DC(EnHorseLinkChild* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } -void func_80A6A5A4(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_80A6A5A4(EnHorseLinkChild* this, PlayState* play) { s16 yawDiff; if (DREG(53) != 0) { @@ -449,10 +449,10 @@ void func_80A6A5A4(EnHorseLinkChild* this, GlobalContext* globalCtx) { func_80A6A724(this); } else { this->actor.speedXZ = 0.0f; - yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; // 0.7071 = cos(pi/4) if ((Math_CosS(yawDiff) < 0.7071f) && (this->animationIdx == 2)) { - func_8006DD9C(&this->actor, &GET_PLAYER(globalCtx)->actor.world.pos, 300); + func_8006DD9C(&this->actor, &GET_PLAYER(play)->actor.world.pos, 300); } if (SkelAnime_Update(&this->skin.skelAnime)) { @@ -477,8 +477,8 @@ void func_80A6A724(EnHorseLinkChild* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, -5.0f); } -void func_80A6A7D0(EnHorseLinkChild* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A6A7D0(EnHorseLinkChild* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 dist; s32 newAnimationIdx; @@ -497,7 +497,7 @@ void func_80A6A7D0(EnHorseLinkChild* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skin.skelAnime)) { if (!this->unk_1E8) { - dist = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + dist = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); } else { dist = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos); } @@ -549,17 +549,17 @@ static EnHorseLinkChildActionFunc sActionFuncs[] = { static void* sEyeTextures[] = { gChildEponaEyeOpenTex, gChildEponaEyeHalfTex, gChildEponaEyeCloseTex }; static u8 sEyeIndexOrder[] = { 0, 1, 2, 1 }; -void EnHorseLinkChild_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseLinkChild_Update(Actor* thisx, PlayState* play) { EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; s32 pad; - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 55.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 55.0f, 100.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - if ((globalCtx->sceneNum == SCENE_SPOT20) && (this->actor.world.pos.z < -2400.0f)) { + if ((play->sceneNum == SCENE_SPOT20) && (this->actor.world.pos.z < -2400.0f)) { this->actor.world.pos.z = -2400.0f; } @@ -576,11 +576,11 @@ void EnHorseLinkChild_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); func_80A6948C(this); } -void EnHorseLinkChild_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorseLinkChild_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { Vec3f center; Vec3f newCenter; EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; @@ -599,13 +599,13 @@ void EnHorseLinkChild_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* ski } //! @bug see relevant comment in `EnHorse_SkinCallback1` - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->headCollider.base); } -s32 EnHorseLinkChild_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 arg2, Skin* skin) { +s32 EnHorseLinkChild_OverrideLimbDraw(Actor* thisx, PlayState* play, s32 arg2, Skin* skin) { EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_horse_link_child.c", 1467); + OPEN_DISPS(play->state.gfxCtx, "../z_en_horse_link_child.c", 1467); if (arg2 == 0xD) { u8 index = sEyeIndexOrder[this->eyeTexIndex]; @@ -613,15 +613,14 @@ s32 EnHorseLinkChild_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s3 gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[index])); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_horse_link_child.c", 1479); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_horse_link_child.c", 1479); return 1; } -void EnHorseLinkChild_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseLinkChild_Draw(Actor* thisx, PlayState* play) { EnHorseLinkChild* this = (EnHorseLinkChild*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - func_800A6360(&this->actor, globalCtx, &this->skin, EnHorseLinkChild_PostDraw, EnHorseLinkChild_OverrideLimbDraw, - true); + func_80093D18(play->state.gfxCtx); + func_800A6360(&this->actor, play, &this->skin, EnHorseLinkChild_PostDraw, EnHorseLinkChild_OverrideLimbDraw, true); } diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h index 6e813173df..a61248c70a 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h @@ -6,7 +6,7 @@ struct EnHorseLinkChild; -typedef void (*EnHorseLinkChildActionFunc)(struct EnHorseLinkChild*, GlobalContext*); +typedef void (*EnHorseLinkChildActionFunc)(struct EnHorseLinkChild*, PlayState*); typedef struct EnHorseLinkChild { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index 5b2dd8bc0d..baf9c25ea8 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -28,12 +28,12 @@ typedef enum { /* 0x04 */ HORSE_FOLLOW_PATH } EnHorseNormalAction; -void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorseNormal_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorseNormal_Init(Actor* thisx, PlayState* play); +void EnHorseNormal_Destroy(Actor* thisx, PlayState* play); +void EnHorseNormal_Update(Actor* thisx, PlayState* play); +void EnHorseNormal_Draw(Actor* thisx, PlayState* play); -void func_80A6B91C(EnHorseNormal* this, GlobalContext* globalCtx); +void func_80A6B91C(EnHorseNormal* this, PlayState* play); void func_80A6BC48(EnHorseNormal* this); void func_80A6BCEC(EnHorseNormal* this); void func_80A6C4CC(EnHorseNormal* this); @@ -181,7 +181,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_STOP), }; -void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseNormal_Init(Actor* thisx, PlayState* play) { EnHorseNormal* this = (EnHorseNormal*)thisx; s32 pad; @@ -194,14 +194,14 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos.y += 70.0f; this->action = HORSE_CYCLE_ANIMATIONS; this->animationIdx = 0; - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sCylinderInit1); - Collider_InitJntSph(globalCtx, &this->headCollider); - Collider_SetJntSph(globalCtx, &this->headCollider, &this->actor, &sJntSphInit, this->headElements); - Collider_InitCylinder(globalCtx, &this->cloneCollider); - Collider_SetCylinder(globalCtx, &this->cloneCollider, &this->actor, &sCylinderInit2); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sCylinderInit1); + Collider_InitJntSph(play, &this->headCollider); + Collider_SetJntSph(play, &this->headCollider, &this->actor, &sJntSphInit, this->headElements); + Collider_InitCylinder(play, &this->cloneCollider); + Collider_SetCylinder(play, &this->cloneCollider, &this->actor, &sCylinderInit2); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (globalCtx->sceneNum == SCENE_SPOT20) { + if (play->sceneNum == SCENE_SPOT20) { if (this->actor.world.rot.z == 0 || !IS_DAY) { Actor_Kill(&this->actor); return; @@ -226,7 +226,7 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) { return; } this->actor.home.rot.z = this->actor.world.rot.z = this->actor.shape.rot.z = 0; - Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); + Skin_Init(play, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); if ((this->actor.world.pos.x == -730.0f && this->actor.world.pos.y == 0.0f && this->actor.world.pos.z == -1100.0f) || @@ -235,47 +235,47 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A6C6B0(this); return; } - } else if (globalCtx->sceneNum == SCENE_MALON_STABLE) { + } else if (play->sceneNum == SCENE_MALON_STABLE) { if (IS_DAY) { Actor_Kill(&this->actor); return; } else { - Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); + Skin_Init(play, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); func_80A6C6B0(this); return; } - } else if (globalCtx->sceneNum == SCENE_SPOT12) { + } else if (play->sceneNum == SCENE_SPOT12) { if (this->actor.world.pos.x == 3707.0f && this->actor.world.pos.y == 1413.0f && this->actor.world.pos.z == -665.0f) { - Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); + Skin_Init(play, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); func_80A6C4CC(this); return; } - Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); + Skin_Init(play, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); } else { - Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); + Skin_Init(play, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim); Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); } if ((this->actor.params & 0xF0) == 0x10 && (this->actor.params & 0xF) != 0xF) { - func_80A6B91C(this, globalCtx); + func_80A6B91C(this, play); } else { func_80A6BC48(this); } } -void EnHorseNormal_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseNormal_Destroy(Actor* thisx, PlayState* play) { EnHorseNormal* this = (EnHorseNormal*)thisx; - Skin_Free(globalCtx, &this->skin); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyCylinder(globalCtx, &this->cloneCollider); - Collider_DestroyJntSph(globalCtx, &this->headCollider); + Skin_Free(play, &this->skin); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyCylinder(play, &this->cloneCollider); + Collider_DestroyJntSph(play, &this->headCollider); } -void func_80A6B91C(EnHorseNormal* this, GlobalContext* globalCtx) { +void func_80A6B91C(EnHorseNormal* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_4; this->action = HORSE_FOLLOW_PATH; this->animationIdx = 6; @@ -285,8 +285,8 @@ void func_80A6B91C(EnHorseNormal* this, GlobalContext* globalCtx) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } -void EnHorseNormal_FollowPath(EnHorseNormal* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->actor.params & 0xF]; +void EnHorseNormal_FollowPath(EnHorseNormal* this, PlayState* play) { + Path* path = &play->setupPathList[this->actor.params & 0xF]; Vec3s* pointPos = SEGMENTED_TO_VIRTUAL(path->points); f32 dx; f32 dz; @@ -322,7 +322,7 @@ void EnHorseNormal_NextAnimation(EnHorseNormal* this) { Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]); } -void EnHorseNormal_CycleAnimations(EnHorseNormal* this, GlobalContext* globalCtx) { +void EnHorseNormal_CycleAnimations(EnHorseNormal* this, PlayState* play) { this->actor.speedXZ = 0.0f; if (SkelAnime_Update(&this->skin.skelAnime)) { @@ -365,7 +365,7 @@ void func_80A6BD7C(EnHorseNormal* this) { } } -void EnHorseNormal_Wander(EnHorseNormal* this, GlobalContext* globalCtx) { +void EnHorseNormal_Wander(EnHorseNormal* this, PlayState* play) { static s32 D_80A6D4F4[] = { 0, 1, 4, 5, 6, 2, 3 }; static s32 D_80A6D510[] = { 0, 0, 2, 2, 1, 1, 1, 3, 3 }; s32 phi_t0 = this->animationIdx; @@ -492,7 +492,7 @@ void func_80A6C4CC(EnHorseNormal* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } -void EnHorseNormal_Wait(EnHorseNormal* this, GlobalContext* globalCtx) { +void EnHorseNormal_Wait(EnHorseNormal* this, PlayState* play) { if (SkelAnime_Update(&this->skin.skelAnime)) { f32 rand = Rand_ZeroOne(); @@ -525,7 +525,7 @@ void func_80A6C6B0(EnHorseNormal* this) { Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } -void EnHorseNormal_WaitClone(EnHorseNormal* this, GlobalContext* globalCtx) { +void EnHorseNormal_WaitClone(EnHorseNormal* this, PlayState* play) { func_80A6BD7C(this); if (SkelAnime_Update(&this->skin.skelAnime)) { @@ -555,7 +555,7 @@ void EnHorseNormal_WaitClone(EnHorseNormal* this, GlobalContext* globalCtx) { } } -void func_80A6C8E0(EnHorseNormal* this, GlobalContext* globalCtx) { +void func_80A6C8E0(EnHorseNormal* this, PlayState* play) { s32 pad; CollisionPoly* sp38; s32 pad2; @@ -565,7 +565,7 @@ void func_80A6C8E0(EnHorseNormal* this, GlobalContext* globalCtx) { sp28.x = (Math_SinS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.x; sp28.y = this->actor.world.pos.y + 60.0f; sp28.z = (Math_CosS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.z; - this->unk_220 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &sp38, &sp24, &sp28); + this->unk_220 = BgCheck_EntityRaycastFloor3(&play->colCtx, &sp38, &sp24, &sp28); this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_220, 30.0f)); } @@ -574,16 +574,16 @@ static EnHorseNormalActionFunc sActionFuncs[] = { EnHorseNormal_WaitClone, EnHorseNormal_FollowPath, }; -void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseNormal_Update(Actor* thisx, PlayState* play) { EnHorseNormal* this = (EnHorseNormal*)thisx; s32 pad; - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 35.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 35.0f, 100.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - if (globalCtx->sceneNum == SCENE_SPOT20 && this->actor.world.pos.z < -2400.0f) { + if (play->sceneNum == SCENE_SPOT20 && this->actor.world.pos.z < -2400.0f) { this->actor.world.pos.z = -2400.0f; } this->actor.focus.pos = this->actor.world.pos; @@ -591,7 +591,7 @@ void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_204 = this->actor.projectedPos; this->unk_204.y += 120.0f; Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if (this->actor.speedXZ == 0.0f) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; } else { @@ -599,7 +599,7 @@ void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnHorseNormal_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorseNormal_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { Vec3f sp4C; Vec3f sp40; EnHorseNormal* this = (EnHorseNormal*)thisx; @@ -618,14 +618,14 @@ void EnHorseNormal_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) } //! @bug see relevant comment in `EnHorse_SkinCallback1` - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->headCollider.base); } -void func_80A6CC88(GlobalContext* globalCtx, EnHorseNormal* this, Vec3f* arg2) { +void func_80A6CC88(PlayState* play, EnHorseNormal* this, Vec3f* arg2) { f32 curFrame = this->skin.skelAnime.curFrame; f32 wDest; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, arg2, &this->unk_1E8, &wDest); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg2, &this->unk_1E8, &wDest); this->unk_1F4 = this->unk_1E8; this->unk_1F4.y += 120.0f; @@ -648,17 +648,17 @@ void func_80A6CC88(GlobalContext* globalCtx, EnHorseNormal* this, Vec3f* arg2) { } } -void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { EnHorseNormal* this = (EnHorseNormal*)thisx; Mtx* mtx2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_horse_normal.c", 2224); + OPEN_DISPS(play->state.gfxCtx, "../z_en_horse_normal.c", 2224); - if (globalCtx->sceneNum != SCENE_SPOT20 || globalCtx->sceneNum != SCENE_MALON_STABLE) { - func_80A6C8E0(this, globalCtx); + if (play->sceneNum != SCENE_SPOT20 || play->sceneNum != SCENE_MALON_STABLE) { + func_80A6C8E0(this, play); } - func_80093D18(globalCtx->state.gfxCtx); - func_800A6330(&this->actor, globalCtx, &this->skin, EnHorseNormal_PostDraw, true); + func_80093D18(play->state.gfxCtx); + func_800A6330(&this->actor, play, &this->skin, EnHorseNormal_PostDraw, true); if (this->action == HORSE_WAIT_CLONE) { MtxF skinMtx; @@ -668,7 +668,7 @@ void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 distFromGround = this->actor.world.pos.y - this->actor.floorHeight; f32 temp_f0_4; - if (globalCtx->sceneNum == SCENE_MALON_STABLE) { + if (play->sceneNum == SCENE_MALON_STABLE) { if (this->actor.world.pos.x == 355.0f && this->actor.world.pos.y == 0.0f && this->actor.world.pos.z == -245.0f) { clonePos.x = 235.0f; @@ -682,7 +682,7 @@ void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) { clonePos.z = 100.0f; cloneRotY = 0x7FFF; } - } else if (globalCtx->sceneNum == SCENE_SPOT20) { + } else if (play->sceneNum == SCENE_SPOT20) { if (this->actor.world.pos.x == -730.0f && this->actor.world.pos.y == 0.0f && this->actor.world.pos.z == -1100.0f) { clonePos.x = 780.0f; @@ -697,35 +697,35 @@ void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) { cloneRotY = 0; } } - func_80A6CC88(globalCtx, this, &clonePos); + func_80A6CC88(play, this, &clonePos); SkinMatrix_SetTranslateRotateYXZScale(&skinMtx, this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, this->actor.shape.rot.x, cloneRotY, this->actor.shape.rot.z, clonePos.x, (this->actor.shape.yOffset * this->actor.scale.y) + clonePos.y, clonePos.z); - mtx1 = SkinMatrix_MtxFToNewMtx(globalCtx->state.gfxCtx, &skinMtx); + mtx1 = SkinMatrix_MtxFToNewMtx(play->state.gfxCtx, &skinMtx); if (mtx1 == NULL) { return; } gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(POLY_OPA_DISP++, mtx1, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_800A63CC(&this->actor, globalCtx, &this->skin, NULL, NULL, true, 0, + func_800A63CC(&this->actor, play, &this->skin, NULL, NULL, true, 0, SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS | SKIN_DRAW_FLAG_CUSTOM_MATRIX); this->cloneCollider.dim.pos.x = clonePos.x; this->cloneCollider.dim.pos.y = clonePos.y; this->cloneCollider.dim.pos.z = clonePos.z; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cloneCollider.base); - func_80094044(globalCtx->state.gfxCtx); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cloneCollider.base); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); Matrix_Translate(clonePos.x, clonePos.y, clonePos.z, MTXMODE_NEW); temp_f0_4 = (1.0f - (distFromGround * 0.01f)) * this->actor.shape.shadowScale; Matrix_Scale(this->actor.scale.x * temp_f0_4, 1.0f, this->actor.scale.z * temp_f0_4, MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(cloneRotY), MTXMODE_APPLY); - mtx2 = Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_horse_normal.c", 2329); + mtx2 = Matrix_NewMtx(play->state.gfxCtx, "../z_en_horse_normal.c", 2329); if (mtx2 != NULL) { gSPMatrix(POLY_XLU_DISP++, mtx2, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gHorseShadowDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_horse_normal.c", 2339); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_horse_normal.c", 2339); } diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h index 9c5ffb74cf..f9445eb186 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h @@ -6,7 +6,7 @@ struct EnHorseNormal; -typedef void (*EnHorseNormalActionFunc)(struct EnHorseNormal*, GlobalContext*); +typedef void (*EnHorseNormalActionFunc)(struct EnHorseNormal*, PlayState*); typedef struct EnHorseNormal { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c index b003af490c..7671e1aeb9 100644 --- a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c +++ b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c @@ -9,13 +9,13 @@ #define FLAGS ACTOR_FLAG_4 -void EnHorseZelda_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHorseZelda_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHorseZelda_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHorseZelda_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHorseZelda_Init(Actor* thisx, PlayState* play); +void EnHorseZelda_Destroy(Actor* thisx, PlayState* play); +void EnHorseZelda_Update(Actor* thisx, PlayState* play); +void EnHorseZelda_Draw(Actor* thisx, PlayState* play); -void func_80A6DCCC(EnHorseZelda* this, GlobalContext* globalCtx); -void func_80A6DDFC(EnHorseZelda* this, GlobalContext* globalCtx); +void func_80A6DCCC(EnHorseZelda* this, PlayState* play); +void func_80A6DDFC(EnHorseZelda* this, PlayState* play); void func_80A6DC7C(EnHorseZelda* this); const ActorInit En_Horse_Zelda_InitVars = { @@ -110,7 +110,7 @@ void func_80A6D8D0(unknownStruct* data, s32 index, Vec3f* vec) { vec->z = data[index].unk_0.z; } -void func_80A6D918(EnHorseZelda* this, GlobalContext* globalCtx) { +void func_80A6D918(EnHorseZelda* this, PlayState* play) { s32 pad; Vec3f sp28; s16 yawDiff; @@ -133,7 +133,7 @@ void func_80A6D918(EnHorseZelda* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y = this->actor.world.rot.y; - if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor) <= 300.0f) { + if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor) <= 300.0f) { if (this->actor.speedXZ < 12.0f) { this->actor.speedXZ += 1.0f; } else { @@ -146,7 +146,7 @@ void func_80A6D918(EnHorseZelda* this, GlobalContext* globalCtx) { } } -void EnHorseZelda_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseZelda_Init(Actor* thisx, PlayState* play) { EnHorseZelda* this = (EnHorseZelda*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -157,24 +157,24 @@ void EnHorseZelda_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; this->action = 0; this->actor.focus.pos.y += 70.0f; - Skin_Init(globalCtx, &this->skin, &gHorseZeldaSkel, &gHorseZeldaGallopingAnim); + Skin_Init(play, &this->skin, &gHorseZeldaSkel, &gHorseZeldaGallopingAnim); this->animationIndex = 0; Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[0]); - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinderType1(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); - Collider_InitJntSph(globalCtx, &this->colliderSphere); - Collider_SetJntSph(globalCtx, &this->colliderSphere, &this->actor, &sJntSphInit, &this->colliderSphereItem); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinderType1(play, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->colliderSphere); + Collider_SetJntSph(play, &this->colliderSphere, &this->actor, &sJntSphInit, &this->colliderSphereItem); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->animationIndex = 0; func_80A6DC7C(this); } -void EnHorseZelda_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseZelda_Destroy(Actor* thisx, PlayState* play) { EnHorseZelda* this = (EnHorseZelda*)thisx; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); - Collider_DestroyJntSph(globalCtx, &this->colliderSphere); - Skin_Free(globalCtx, &this->skin); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroyJntSph(play, &this->colliderSphere); + Skin_Free(play, &this->skin); } void func_80A6DC7C(EnHorseZelda* this) { @@ -186,7 +186,7 @@ void func_80A6DC7C(EnHorseZelda* this) { Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->animationIndex]); } -void func_80A6DCCC(EnHorseZelda* this, GlobalContext* globalCtx) { +void func_80A6DCCC(EnHorseZelda* this, PlayState* play) { this->actor.speedXZ = 0.0f; if (SkelAnime_Update(&this->skin.skelAnime)) { func_80A6DC7C(this); @@ -206,14 +206,14 @@ void func_80A6DD14(EnHorseZelda* this) { Animation_GetLastFrame(sAnimationHeaders[this->animationIndex]), ANIMMODE_ONCE, 0.0f); } -void func_80A6DDFC(EnHorseZelda* this, GlobalContext* globalCtx) { - func_80A6D918(this, globalCtx); +void func_80A6DDFC(EnHorseZelda* this, PlayState* play) { + func_80A6D918(this, play); if (SkelAnime_Update(&this->skin.skelAnime)) { func_80A6DD14(this); } } -void func_80A6DE38(EnHorseZelda* this, GlobalContext* globalCtx) { +void func_80A6DE38(EnHorseZelda* this, PlayState* play) { s32 pad; CollisionPoly* poly; s32 pad2; @@ -223,27 +223,27 @@ void func_80A6DE38(EnHorseZelda* this, GlobalContext* globalCtx) { pos.x = (Math_SinS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 60.0f; pos.z = (Math_CosS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.z; - this->unk_1F4 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &poly, &bgId, &pos); + this->unk_1F4 = BgCheck_EntityRaycastFloor3(&play->colCtx, &poly, &bgId, &pos); this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_1F4, 30.0f)); } -void EnHorseZelda_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseZelda_Update(Actor* thisx, PlayState* play) { EnHorseZelda* this = (EnHorseZelda*)thisx; s32 pad; - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); this->actor.speedXZ = 0.0f; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 55.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 55.0f, 100.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 += 70.0f; Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } -void EnHorseZelda_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorseZelda_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { Vec3f sp4C; Vec3f sp40; EnHorseZelda* this = (EnHorseZelda*)thisx; @@ -265,13 +265,13 @@ void EnHorseZelda_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { } //! @bug see relevant comment in `EnHorse_SkinCallback1` - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); } -void EnHorseZelda_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseZelda_Draw(Actor* thisx, PlayState* play) { EnHorseZelda* this = (EnHorseZelda*)thisx; - func_80A6DE38(this, globalCtx); - func_80093D18(globalCtx->state.gfxCtx); - func_800A6330(&this->actor, globalCtx, &this->skin, EnHorseZelda_PostDraw, true); + func_80A6DE38(this, play); + func_80093D18(play->state.gfxCtx); + func_800A6330(&this->actor, play, &this->skin, EnHorseZelda_PostDraw, true); } diff --git a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h index 531a1a6c38..afac221da8 100644 --- a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h +++ b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h @@ -6,7 +6,7 @@ struct EnHorseZelda; -typedef void (*EnHorseZeldaActionFunc)(struct EnHorseZelda*, GlobalContext*); +typedef void (*EnHorseZeldaActionFunc)(struct EnHorseZelda*, PlayState*); typedef struct EnHorseZelda { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index 076d3eae9d..e60b649885 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -10,13 +10,13 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnHs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHs_Init(Actor* thisx, PlayState* play); +void EnHs_Destroy(Actor* thisx, PlayState* play); +void EnHs_Update(Actor* thisx, PlayState* play); +void EnHs_Draw(Actor* thisx, PlayState* play); -void func_80A6E9AC(EnHs* this, GlobalContext* globalCtx); -void func_80A6E6B0(EnHs* this, GlobalContext* globalCtx); +void func_80A6E9AC(EnHs* this, PlayState* play); +void func_80A6E6B0(EnHs* this, PlayState* play); const ActorInit En_Hs_InitVars = { ACTOR_EN_HS, @@ -54,16 +54,16 @@ void func_80A6E3A0(EnHs* this, EnHsActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnHs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHs_Init(Actor* thisx, PlayState* play) { EnHs* this = (EnHs*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_hs_Skel_006260, &object_hs_Anim_0005C0, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_hs_Skel_006260, &object_hs_Anim_0005C0, this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, &object_hs_Anim_0005C0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &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); @@ -92,16 +92,16 @@ void EnHs_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; } -void EnHs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHs_Destroy(Actor* thisx, PlayState* play) { EnHs* this = (EnHs*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80A6E53C(EnHs* this, GlobalContext* globalCtx, u16 textId, EnHsActionFunc actionFunc) { +s32 func_80A6E53C(EnHs* this, PlayState* play, u16 textId, EnHsActionFunc actionFunc) { s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { func_80A6E3A0(this, actionFunc); return 1; } @@ -110,22 +110,22 @@ s32 func_80A6E53C(EnHs* this, GlobalContext* globalCtx, u16 textId, EnHsActionFu yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(yawDiff) <= 0x2150) && (this->actor.xzDistToPlayer < 100.0f)) { this->unk_2A8 |= 1; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } return 0; } -void func_80A6E5EC(EnHs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A6E5EC(EnHs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80A6E3A0(this, func_80A6E6B0); } this->unk_2A8 |= 1; } -void func_80A6E630(EnHs* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_80A6E630(EnHs* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { func_80088AA0(180); func_80A6E3A0(this, func_80A6E6B0); CLEAR_EVENTINF(EVENTINF_10); @@ -134,42 +134,42 @@ void func_80A6E630(EnHs* this, GlobalContext* globalCtx) { this->unk_2A8 |= 1; } -void func_80A6E6B0(EnHs* this, GlobalContext* globalCtx) { - func_80A6E53C(this, globalCtx, 0x10B6, func_80A6E5EC); +void func_80A6E6B0(EnHs* this, PlayState* play) { + func_80A6E53C(this, play, 0x10B6, func_80A6E5EC); } -void func_80A6E6D8(EnHs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A6E6D8(EnHs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80A6E3A0(this, func_80A6E9AC); } } -void func_80A6E70C(EnHs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A6E70C(EnHs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80A6E3A0(this, func_80A6E9AC); } } -void func_80A6E740(EnHs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A6E740(EnHs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; func_80A6E3A0(this, func_80A6E630); } else { - func_8002F434(&this->actor, globalCtx, GI_ODD_MUSHROOM, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_ODD_MUSHROOM, 10000.0f, 50.0f); } this->unk_2A8 |= 1; } -void func_80A6E7BC(EnHs* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80A6E7BC(EnHs* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: func_80A6E3A0(this, func_80A6E740); - func_8002F434(&this->actor, globalCtx, GI_ODD_MUSHROOM, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_ODD_MUSHROOM, 10000.0f, 50.0f); break; case 1: - Message_ContinueTextbox(globalCtx, 0x10B4); + Message_ContinueTextbox(play, 0x10B4); func_80A6E3A0(this, func_80A6E70C); break; } @@ -181,11 +181,11 @@ void func_80A6E7BC(EnHs* this, GlobalContext* globalCtx) { this->unk_2A8 |= 1; } -void func_80A6E8CC(EnHs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A6E8CC(EnHs* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x10B3); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x10B3); func_80A6E3A0(this, func_80A6E7BC); Animation_Change(&this->skelAnime, &object_hs_Anim_000528, 1.0f, 0.0f, Animation_GetLastFrame(&object_hs_Anim_000528), ANIMMODE_LOOP, 8.0f); @@ -201,12 +201,12 @@ void func_80A6E8CC(EnHs* this, GlobalContext* globalCtx) { this->unk_2A8 |= 1; } -void func_80A6E9AC(EnHs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A6E9AC(EnHs* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - if (func_8002F368(globalCtx) == 7) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { + if (func_8002F368(play) == 7) { player->actor.textId = 0x10B2; func_80A6E3A0(this, func_80A6E8CC); Animation_Change(&this->skelAnime, &object_hs_Anim_000304, 1.0f, 0.0f, @@ -221,27 +221,27 @@ void func_80A6E9AC(EnHs* this, GlobalContext* globalCtx) { yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; this->actor.textId = 0x10B1; if ((ABS(yawDiff) <= 0x2150) && (this->actor.xzDistToPlayer < 100.0f)) { - func_8002F298(&this->actor, globalCtx, 100.0f, 7); + func_8002F298(&this->actor, play, 100.0f, 7); } } } -void EnHs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHs_Update(Actor* thisx, PlayState* play) { EnHs* this = (EnHs*)thisx; s32 pad; Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (SkelAnime_Update(&this->skelAnime)) { this->skelAnime.curFrame = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_2A8 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); this->unk_2A8 &= ~1; } else { Math_SmoothStepToS(&this->unk_29C.x, 12800, 6, 6200, 100); @@ -251,7 +251,7 @@ void EnHs_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnHs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnHs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHs* this = (EnHs*)thisx; switch (limbIndex) { @@ -281,7 +281,7 @@ s32 EnHs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnHs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnHs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80A6EDFC = { 300.0f, 1000.0f, 0.0f }; EnHs* this = (EnHs*)thisx; @@ -290,10 +290,10 @@ void EnHs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnHs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHs_Draw(Actor* thisx, PlayState* play) { EnHs* this = (EnHs*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnHs_OverrideLimbDraw, EnHs_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.h b/src/overlays/actors/ovl_En_Hs/z_en_hs.h index 4a6576ddc5..f4b89ce153 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.h +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.h @@ -6,7 +6,7 @@ struct EnHs; -typedef void (*EnHsActionFunc)(struct EnHs*, GlobalContext*); +typedef void (*EnHsActionFunc)(struct EnHs*, PlayState*); typedef struct EnHs { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c index 39e71c8fcc..8f500fa80f 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c @@ -10,11 +10,11 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnHs2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHs2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHs2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHs2_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80A6F1A4(EnHs2* this, GlobalContext* globalCtx); +void EnHs2_Init(Actor* thisx, PlayState* play); +void EnHs2_Destroy(Actor* thisx, PlayState* play); +void EnHs2_Update(Actor* thisx, PlayState* play); +void EnHs2_Draw(Actor* thisx, PlayState* play); +void func_80A6F1A4(EnHs2* this, PlayState* play); const ActorInit En_Hs2_InitVars = { ACTOR_EN_HS2, @@ -48,16 +48,16 @@ static ColliderCylinderInit sCylinderInit = { { 40, 40, 0, { 0, 0, 0 } }, }; -void EnHs2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Init(Actor* thisx, PlayState* play) { EnHs2* this = (EnHs2*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_hs_Skel_006260, &object_hs_Anim_0005C0, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_hs_Skel_006260, &object_hs_Anim_0005C0, this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, &object_hs_Anim_0005C0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &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); osSyncPrintf(VT_FGCOL(CYAN) " ヒヨコの店(子人の時) \n" VT_RST); @@ -66,14 +66,14 @@ void EnHs2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; } -void EnHs2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Destroy(Actor* thisx, PlayState* play) { EnHs2* this = (EnHs2*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80A6F0B4(EnHs2* this, GlobalContext* globalCtx, u16 textId, EnHs2ActionFunc actionFunc) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80A6F0B4(EnHs2* this, PlayState* play, u16 textId, EnHs2ActionFunc actionFunc) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = actionFunc; return 1; } @@ -82,43 +82,43 @@ s32 func_80A6F0B4(EnHs2* this, GlobalContext* globalCtx, u16 textId, EnHs2Action if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x2151 && this->actor.xzDistToPlayer < 100.0f) { this->unk_2A8 |= 0x1; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } return 0; } -void func_80A6F164(EnHs2* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A6F164(EnHs2* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = func_80A6F1A4; } this->unk_2A8 |= 0x1; } -void func_80A6F1A4(EnHs2* this, GlobalContext* globalCtx) { +void func_80A6F1A4(EnHs2* this, PlayState* play) { u16 textId; - textId = Text_GetFaceReaction(globalCtx, 9); + textId = Text_GetFaceReaction(play, 9); if (textId == 0) { textId = 0x5069; } - func_80A6F0B4(this, globalCtx, textId, func_80A6F164); + func_80A6F0B4(this, play, textId, func_80A6F164); } -void EnHs2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Update(Actor* thisx, PlayState* play) { EnHs2* this = (EnHs2*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (SkelAnime_Update(&this->skelAnime) != 0) { this->skelAnime.curFrame = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_2A8 & 0x1) { - func_80038290(globalCtx, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos); this->unk_2A8 &= ~1; } else { Math_SmoothStepToS(&this->unk_29C.x, 12800, 6, 6200, 100); @@ -128,7 +128,7 @@ void EnHs2_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnHs2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnHs2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHs2* this = (EnHs2*)thisx; switch (limbIndex) { @@ -150,7 +150,7 @@ s32 EnHs2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnHs2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnHs2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80A6F4CC = { 300.0f, 1000.0f, 0.0f }; EnHs2* this = (EnHs2*)thisx; @@ -159,10 +159,10 @@ void EnHs2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnHs2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Draw(Actor* thisx, PlayState* play) { EnHs2* this = (EnHs2*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnHs2_OverrideLimbDraw, EnHs2_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h index e006b91f75..e2f66f79c3 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h @@ -6,7 +6,7 @@ struct EnHs2; -typedef void (*EnHs2ActionFunc)(struct EnHs2*, GlobalContext*); +typedef void (*EnHs2ActionFunc)(struct EnHs2*, PlayState*); typedef struct EnHs2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 2bf0279686..e79dab58ff 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -17,20 +17,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnHy_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHy_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHy_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHy_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHy_Init(Actor* thisx, PlayState* play); +void EnHy_Destroy(Actor* thisx, PlayState* play); +void EnHy_Update(Actor* thisx, PlayState* play); +void EnHy_Draw(Actor* thisx, PlayState* play); -void EnHy_InitImpl(EnHy* this, GlobalContext* globalCtx); -void func_80A7134C(EnHy* this, GlobalContext* globalCtx); -void func_80A71530(EnHy* this, GlobalContext* globalCtx); -void func_80A711B4(EnHy* this, GlobalContext* globalCtx); -void func_80A712C0(EnHy* this, GlobalContext* globalCtx); -void func_80A710F8(EnHy* this, GlobalContext* globalCtx); -void func_80A7127C(EnHy* this, GlobalContext* globalCtx); -void EnHy_DoNothing(EnHy* this, GlobalContext* globalCtx); -void func_80A714C4(EnHy* this, GlobalContext* globalCtx); +void EnHy_InitImpl(EnHy* this, PlayState* play); +void func_80A7134C(EnHy* this, PlayState* play); +void func_80A71530(EnHy* this, PlayState* play); +void func_80A711B4(EnHy* this, PlayState* play); +void func_80A712C0(EnHy* this, PlayState* play); +void func_80A710F8(EnHy* this, PlayState* play); +void func_80A7127C(EnHy* this, PlayState* play); +void EnHy_DoNothing(EnHy* this, PlayState* play); +void func_80A714C4(EnHy* this, PlayState* play); const ActorInit En_Hy_InitVars = { ACTOR_EN_HY, @@ -351,22 +351,22 @@ static EnHyInit2Info sInit2Info[] = { /* ENHY_TYPE_AHG_20 */ { 20.0f, { 0.0f, 0.0f, -200.0f }, 0.01f, 0x06, 30.0f }, }; -s32 EnHy_FindSkelAndHeadObjects(EnHy* this, GlobalContext* globalCtx) { +s32 EnHy_FindSkelAndHeadObjects(EnHy* this, PlayState* play) { u8 headInfoIndex = sModelInfo[this->actor.params & 0x7F].headInfoIndex; u8 skelInfoIndex2 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex2; u8 skelInfoIndex1 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex1; - this->objBankIndexSkel1 = Object_GetIndex(&globalCtx->objectCtx, sSkeletonInfo[skelInfoIndex1].objectId); + this->objBankIndexSkel1 = Object_GetIndex(&play->objectCtx, sSkeletonInfo[skelInfoIndex1].objectId); if (this->objBankIndexSkel1 < 0) { return false; } - this->objBankIndexSkel2 = Object_GetIndex(&globalCtx->objectCtx, sSkeletonInfo[skelInfoIndex2].objectId); + this->objBankIndexSkel2 = Object_GetIndex(&play->objectCtx, sSkeletonInfo[skelInfoIndex2].objectId); if (this->objBankIndexSkel2 < 0) { return false; } - this->objBankIndexHead = Object_GetIndex(&globalCtx->objectCtx, sHeadInfo[headInfoIndex].objectId); + this->objBankIndexHead = Object_GetIndex(&play->objectCtx, sHeadInfo[headInfoIndex].objectId); if (this->objBankIndexHead < 0) { return false; } @@ -374,24 +374,24 @@ s32 EnHy_FindSkelAndHeadObjects(EnHy* this, GlobalContext* globalCtx) { return true; } -s32 EnHy_AreSkelAndHeadObjectsLoaded(EnHy* this, GlobalContext* globalCtx) { - if (!Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndexSkel1)) { +s32 EnHy_AreSkelAndHeadObjectsLoaded(EnHy* this, PlayState* play) { + if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexSkel1)) { return false; } - if (!Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndexSkel2)) { + if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexSkel2)) { return false; } - if (!Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndexHead)) { + if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexHead)) { return false; } return true; } -s32 EnHy_FindOsAnimeObject(EnHy* this, GlobalContext* globalCtx) { - this->objBankIndexOsAnime = Object_GetIndex(&globalCtx->objectCtx, OBJECT_OS_ANIME); +s32 EnHy_FindOsAnimeObject(EnHy* this, PlayState* play) { + this->objBankIndexOsAnime = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); if (this->objBankIndexOsAnime < 0) { return false; @@ -400,24 +400,24 @@ s32 EnHy_FindOsAnimeObject(EnHy* this, GlobalContext* globalCtx) { return true; } -s32 EnHy_IsOsAnimeObjectLoaded(EnHy* this, GlobalContext* globalCtx) { - if (!Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndexOsAnime)) { +s32 EnHy_IsOsAnimeObjectLoaded(EnHy* this, PlayState* play) { + if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexOsAnime)) { return false; } return true; } -void func_80A6F7CC(EnHy* this, GlobalContext* globalCtx, s32 getItemId) { +void func_80A6F7CC(EnHy* this, PlayState* play, s32 getItemId) { this->unkGetItemId = getItemId; - func_8002F434(&this->actor, globalCtx, getItemId, this->actor.xzDistToPlayer + 1.0f, + func_8002F434(&this->actor, play, getItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } -u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { - Player* player = GET_PLAYER(globalCtx); +u16 func_80A6F810(PlayState* play, Actor* thisx) { + Player* player = GET_PLAYER(play); EnHy* this = (EnHy*)thisx; - u16 textId = Text_GetFaceReaction(globalCtx, (this->actor.params & 0x7F) + 37); + u16 textId = Text_GetFaceReaction(play, (this->actor.params & 0x7F) + 37); if (textId != 0) { if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_5) { @@ -428,9 +428,9 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { switch (this->actor.params & 0x7F) { case ENHY_TYPE_AOB: - if (globalCtx->sceneNum == SCENE_KAKARIKO) { + if (play->sceneNum == SCENE_KAKARIKO) { return (this->unk_330 & EVENTCHKINF_6B_MASK) ? 0x508D : (GET_INFTABLE(INFTABLE_CB) ? 0x508C : 0x508B); - } else if (globalCtx->sceneNum == SCENE_MARKET_DAY) { + } else if (play->sceneNum == SCENE_MARKET_DAY) { return GET_EVENTINF(EVENTINF_30) ? 0x709B : 0x709C; } else if (gSaveContext.dogIsLost) { s16 followingDog = (gSaveContext.dogParams & 0xF00) >> 8; @@ -451,9 +451,9 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { return GET_INFTABLE(INFTABLE_C0) ? 0x7017 : 0x7016; } case ENHY_TYPE_AHG_2: - if (globalCtx->sceneNum == SCENE_KAKARIKO) { + if (play->sceneNum == SCENE_KAKARIKO) { return 0x5086; - } else if (globalCtx->sceneNum == SCENE_SPOT01) { + } else if (play->sceneNum == SCENE_SPOT01) { return 0x5085; } else if (GET_EVENTCHKINF(EVENTCHKINF_80)) { return GET_INFTABLE(INFTABLE_C3) ? 0x701A : 0x7047; @@ -476,9 +476,9 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { case ENHY_TYPE_BBA: return GET_EVENTCHKINF(EVENTCHKINF_80) ? 0x704A : (GET_INFTABLE(INFTABLE_C6) ? 0x7022 : 0x7021); case ENHY_TYPE_BJI_7: - if (globalCtx->sceneNum == SCENE_KAKARIKO) { + if (play->sceneNum == SCENE_KAKARIKO) { return 0x5088; - } else if (globalCtx->sceneNum == SCENE_SPOT01) { + } else if (play->sceneNum == SCENE_SPOT01) { return 0x5087; } else { return GET_EVENTCHKINF(EVENTCHKINF_80) ? 0x704D : (GET_INFTABLE(INFTABLE_C7) ? 0x7028 : 0x7027); @@ -490,17 +490,17 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { return GET_INFTABLE(INFTABLE_C8) ? 0x701E : 0x701D; } case ENHY_TYPE_BOJ_9: - if (globalCtx->sceneNum == SCENE_KAKARIKO) { + if (play->sceneNum == SCENE_KAKARIKO) { return GET_EVENTCHKINF(EVENTCHKINF_AA) ? 0x5082 : 0x5081; - } else if (globalCtx->sceneNum == SCENE_SPOT01) { + } else if (play->sceneNum == SCENE_SPOT01) { return CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) ? 0x5080 : 0x507F; } else { return GET_EVENTCHKINF(EVENTCHKINF_80) ? 0x7049 : (GET_INFTABLE(INFTABLE_CA) ? 0x7020 : 0x701F); } case ENHY_TYPE_BOJ_10: - if (globalCtx->sceneNum == SCENE_LABO) { + if (play->sceneNum == SCENE_LABO) { return GET_EVENTCHKINF(EVENTCHKINF_AA) ? 0x507E : 0x507D; - } else if (globalCtx->sceneNum == SCENE_SPOT01) { + } else if (play->sceneNum == SCENE_SPOT01) { return CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) ? 0x507C : 0x507B; } else { return GET_EVENTCHKINF(EVENTCHKINF_80) ? 0x7046 : (GET_INFTABLE(INFTABLE_CD) ? 0x7019 : 0x7018); @@ -508,7 +508,7 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { case ENHY_TYPE_CNE_11: return GET_INFTABLE(INFTABLE_8B) ? (GET_INFTABLE(INFTABLE_CC) ? 0x7014 : 0x70A4) : 0x7014; case ENHY_TYPE_BOJ_12: - if (globalCtx->sceneNum == SCENE_SPOT01) { + if (play->sceneNum == SCENE_SPOT01) { return !IS_DAY ? 0x5084 : 0x5083; } else { return GET_EVENTCHKINF(EVENTCHKINF_80) ? 0x7044 : 0x7015; @@ -548,12 +548,12 @@ u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { } } -s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A70058(PlayState* play, Actor* thisx) { EnHy* this = (EnHy*)thisx; s16 beggarItems[] = { ITEM_BLUE_FIRE, ITEM_FISH, ITEM_BUG, ITEM_FAIRY }; s16 beggarRewards[] = { 150, 100, 50, 25 }; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_CHOICE: @@ -592,7 +592,7 @@ s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) { case 0x70F3: Rupees_ChangeBy(beggarRewards[this->actor.textId - 0x70F0]); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_17); - Player_UpdateBottleHeld(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); break; case 0x7016: SET_INFTABLE(INFTABLE_C0); @@ -655,13 +655,13 @@ s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) { gSaveContext.dogParams = 0; break; case 0x709F: - func_80A6F7CC(this, globalCtx, GET_INFTABLE(INFTABLE_191) ? GI_RUPEE_BLUE : GI_HEART_PIECE); + func_80A6F7CC(this, play, GET_INFTABLE(INFTABLE_191) ? GI_RUPEE_BLUE : GI_HEART_PIECE); this->actionFunc = func_80A714C4; break; } return 0; case TEXT_STATE_EVENT: - if (!Message_ShouldAdvance(globalCtx)) { + if (!Message_ShouldAdvance(play)) { return 1; } else { return 2; @@ -702,7 +702,7 @@ void EnHy_InitSetProperties(EnHy* this) { this->unkRange += this->collider.dim.radius; } -void EnHy_UpdateCollider(EnHy* this, GlobalContext* globalCtx) { +void EnHy_UpdateCollider(EnHy* this, PlayState* play) { Vec3s pos; pos.x = this->actor.world.pos.x; @@ -712,29 +712,29 @@ void EnHy_UpdateCollider(EnHy* this, GlobalContext* globalCtx) { pos.y += sColliderInfo[this->actor.params & 0x7F].offset.y; pos.z += sColliderInfo[this->actor.params & 0x7F].offset.z; this->collider.dim.pos = pos; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void func_80A70834(EnHy* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A70834(EnHy* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_5) { if (!Inventory_HasSpecificBottle(ITEM_BLUE_FIRE) && !Inventory_HasSpecificBottle(ITEM_BUG) && !Inventory_HasSpecificBottle(ITEM_FISH)) { - switch (func_8002F368(globalCtx)) { + switch (func_8002F368(play)) { case EXCH_ITEM_POE: case EXCH_ITEM_BIG_POE: case EXCH_ITEM_LETTER_RUTO: this->actor.textId = 0x70EF; break; default: - if (Player_GetMask(globalCtx) == PLAYER_MASK_NONE) { + if (Player_GetMask(play) == PLAYER_MASK_NONE) { this->actor.textId = 0x70ED; } break; } } else { - switch (func_8002F368(globalCtx)) { + switch (func_8002F368(play)) { case EXCH_ITEM_BLUE_FIRE: this->actor.textId = 0x70F0; break; @@ -745,7 +745,7 @@ void func_80A70834(EnHy* this, GlobalContext* globalCtx) { this->actor.textId = 0x70F2; break; default: - if (Player_GetMask(globalCtx) == PLAYER_MASK_NONE) { + if (Player_GetMask(play) == PLAYER_MASK_NONE) { this->actor.textId = 0x700C; } break; @@ -756,8 +756,8 @@ void func_80A70834(EnHy* this, GlobalContext* globalCtx) { } } -void func_80A70978(EnHy* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A70978(EnHy* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3; switch (this->actor.params & 0x7F) { @@ -793,13 +793,13 @@ void func_80A70978(EnHy* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_1E8, sInit1Info[this->actor.params & 0x7F].unkPresetIndex, phi_a3); - if (func_800343CC(globalCtx, &this->actor, &this->unk_1E8.unk_00, this->unkRange, func_80A6F810, func_80A70058)) { - func_80A70834(this, globalCtx); + if (func_800343CC(play, &this->actor, &this->unk_1E8.unk_00, this->unkRange, func_80A6F810, func_80A70058)) { + func_80A70834(this, play); } } -s32 EnHy_ShouldSpawn(EnHy* this, GlobalContext* globalCtx) { - switch (globalCtx->sceneNum) { +s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) { + switch (play->sceneNum) { case SCENE_SPOT01: if (!((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_9 || (this->actor.params & 0x7F) == ENHY_TYPE_BOJ_10 || (this->actor.params & 0x7F) == ENHY_TYPE_BOJ_12 || (this->actor.params & 0x7F) == ENHY_TYPE_AHG_2 || @@ -867,53 +867,53 @@ s32 EnHy_ShouldSpawn(EnHy* this, GlobalContext* globalCtx) { } } -void EnHy_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHy_Init(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; - if ((this->actor.params & 0x7F) >= ENHY_TYPE_MAX || !EnHy_FindOsAnimeObject(this, globalCtx) || - !EnHy_FindSkelAndHeadObjects(this, globalCtx)) { + if ((this->actor.params & 0x7F) >= ENHY_TYPE_MAX || !EnHy_FindOsAnimeObject(this, play) || + !EnHy_FindSkelAndHeadObjects(this, play)) { Actor_Kill(&this->actor); } - if (!EnHy_ShouldSpawn(this, globalCtx)) { + if (!EnHy_ShouldSpawn(this, play)) { Actor_Kill(&this->actor); } this->actionFunc = EnHy_InitImpl; } -void EnHy_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHy_Destroy(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnHy_InitImpl(EnHy* this, GlobalContext* globalCtx) { - if (EnHy_IsOsAnimeObjectLoaded(this, globalCtx) && EnHy_AreSkelAndHeadObjectsLoaded(this, globalCtx)) { +void EnHy_InitImpl(EnHy* this, PlayState* play) { + if (EnHy_IsOsAnimeObjectLoaded(this, play) && EnHy_AreSkelAndHeadObjectsLoaded(this, play)) { this->actor.objBankIndex = this->objBankIndexSkel1; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->actor.objBankIndex].segment); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->actor.objBankIndex].segment); + SkelAnime_InitFlex(play, &this->skelAnime, sSkeletonInfo[sModelInfo[this->actor.params & 0x7F].skelInfoIndex1].skeleton, NULL, this->jointTable, this->morphTable, 16); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndexOsAnime].segment); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sColCylInit); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexOsAnime].segment); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sColCylInit); EnHy_InitCollider(this); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, sModelInfo[this->actor.params & 0x7F].animInfoIndex); - if ((globalCtx->sceneNum == SCENE_MARKET_ALLEY) || (globalCtx->sceneNum == SCENE_MARKET_DAY)) { + if ((play->sceneNum == SCENE_MARKET_ALLEY) || (play->sceneNum == SCENE_MARKET_DAY)) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.uncullZoneScale = 0.0f; } - if (globalCtx->sceneNum == SCENE_KAKARIKO) { + if (play->sceneNum == SCENE_KAKARIKO) { this->unk_330 = gSaveContext.eventChkInf[EVENTCHKINF_6B_INDEX]; } EnHy_InitSetProperties(this); - this->path = Path_GetByIndex(globalCtx, (this->actor.params & 0x780) >> 7, 15); + this->path = Path_GetByIndex(play, (this->actor.params & 0x780) >> 7, 15); switch (this->actor.params & 0x7F) { case ENHY_TYPE_BOJ_3: @@ -927,7 +927,7 @@ void EnHy_InitImpl(EnHy* this, GlobalContext* globalCtx) { this->actionFunc = func_80A712C0; break; case ENHY_TYPE_AOB: - if (globalCtx->sceneNum == SCENE_MARKET_DAY) { + if (play->sceneNum == SCENE_MARKET_DAY) { this->actionFunc = func_80A710F8; break; } @@ -961,7 +961,7 @@ void EnHy_InitImpl(EnHy* this, GlobalContext* globalCtx) { } } -void func_80A710F8(EnHy* this, GlobalContext* globalCtx) { +void func_80A710F8(EnHy* this, PlayState* play) { if (this->unk_1E8.unk_00 != 0) { if (this->skelAnime.animation != &gObjOsAnim_0BFC) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_26); @@ -975,7 +975,7 @@ void func_80A710F8(EnHy* this, GlobalContext* globalCtx) { } } -void func_80A711B4(EnHy* this, GlobalContext* globalCtx) { +void func_80A711B4(EnHy* this, PlayState* play) { s16 yaw; f32 distSq; @@ -991,24 +991,24 @@ void func_80A711B4(EnHy* this, GlobalContext* globalCtx) { } } -void func_80A7127C(EnHy* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_21C, this->unk_23C, 16); +void func_80A7127C(EnHy* this, PlayState* play) { + func_80034F54(play, this->unk_21C, this->unk_23C, 16); } -void EnHy_DoNothing(EnHy* this, GlobalContext* globalCtx) { +void EnHy_DoNothing(EnHy* this, PlayState* play) { } -void func_80A712C0(EnHy* this, GlobalContext* globalCtx) { +void func_80A712C0(EnHy* this, PlayState* play) { if ((this->actor.xzDistToPlayer <= 100.0f) && (this->path != NULL)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_7); this->actor.speedXZ = 0.4f; this->actionFunc = func_80A7134C; } - func_80034F54(globalCtx, this->unk_21C, this->unk_23C, 16); + func_80034F54(play, this->unk_21C, this->unk_23C, 16); } -void func_80A7134C(EnHy* this, GlobalContext* globalCtx) { +void func_80A7134C(EnHy* this, PlayState* play) { s16 yaw; f32 distSq; @@ -1042,17 +1042,17 @@ void func_80A7134C(EnHy* this, GlobalContext* globalCtx) { } } -void func_80A714C4(EnHy* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A714C4(EnHy* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_80A71530; } else { - func_8002F434(&this->actor, globalCtx, this->unkGetItemId, this->actor.xzDistToPlayer + 1.0f, + func_8002F434(&this->actor, play, this->unkGetItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } } -void func_80A71530(EnHy* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void func_80A71530(EnHy* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { switch (this->unkGetItemId) { case GI_HEART_PIECE: gSaveContext.dogParams = 0; @@ -1070,11 +1070,11 @@ void func_80A71530(EnHy* this, GlobalContext* globalCtx) { } } -void EnHy_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHy_Update(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; if (this->actionFunc != EnHy_InitImpl) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndexOsAnime].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexOsAnime].segment); SkelAnime_Update(&this->skelAnime); EnHy_UpdateEyes(this); @@ -1082,15 +1082,15 @@ void EnHy_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); } - this->actionFunc(this, globalCtx); - func_80A70978(this, globalCtx); - EnHy_UpdateCollider(this, globalCtx); + this->actionFunc(this, play); + func_80A70978(this, play); + EnHy_UpdateCollider(this, play); } -s32 EnHy_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHy* this = (EnHy*)thisx; s32 pad; Vec3s sp48; @@ -1099,11 +1099,11 @@ s32 EnHy_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, if (1) {} - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_hy.c", 2170); + OPEN_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2170); if (limbIndex == 15) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->objBankIndexHead].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndexHead].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndexHead].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexHead].segment); i = sModelInfo[this->actor.params & 0x7F].headInfoIndex; *dList = sHeadInfo[i].headDList; @@ -1112,7 +1112,7 @@ s32 EnHy_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(ptr)); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndexSkel1].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexSkel1].segment); } if (limbIndex == 15) { @@ -1134,21 +1134,21 @@ s32 EnHy_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, rot->z += Math_CosS(this->unk_23C[limbIndex]) * 200.0f; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_hy.c", 2228); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2228); return false; } -void EnHy_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnHy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnHy* this = (EnHy*)thisx; s32 pad; Vec3f sp3C = { 400.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_hy.c", 2255); + OPEN_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2255); if (limbIndex == 7) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->objBankIndexSkel2].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndexSkel2].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndexSkel2].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexSkel2].segment); } if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_3 && limbIndex == 8) { @@ -1159,29 +1159,29 @@ void EnHy_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Matrix_MultVec3f(&sp3C, &this->actor.focus.pos); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_hy.c", 2281); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2281); } -Gfx* EnHy_SetEnvColor(GraphicsContext* globalCtx, u8 envR, u8 envG, u8 envB, u8 envA) { +Gfx* EnHy_SetEnvColor(GraphicsContext* play, u8 envR, u8 envG, u8 envB, u8 envA) { Gfx* dList; - dList = Graph_Alloc(globalCtx, 2 * sizeof(Gfx)); + dList = Graph_Alloc(play, 2 * sizeof(Gfx)); gDPSetEnvColor(dList, envR, envG, envB, envA); gSPEndDisplayList(dList + 1); return dList; } -void EnHy_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHy_Draw(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; Color_RGBA8 envColorSeg8; Color_RGBA8 envColorSeg9; Color_RGBA8 envColorSeg10; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_hy.c", 2318); + OPEN_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2318); if (this->actionFunc != EnHy_InitImpl) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(this->modelOffset.x, this->modelOffset.y, this->modelOffset.z, MTXMODE_APPLY); envColorSeg8 = sModelInfo[this->actor.params & 0x7F].envColorSeg8; envColorSeg9 = sModelInfo[this->actor.params & 0x7F].envColorSeg9; @@ -1209,10 +1209,10 @@ void EnHy_Draw(Actor* thisx, GlobalContext* globalCtx) { case ENHY_TYPE_BJI_19: case ENHY_TYPE_AHG_20: gSPSegment(POLY_OPA_DISP++, 0x08, - EnHy_SetEnvColor(globalCtx->state.gfxCtx, envColorSeg8.r, envColorSeg8.g, envColorSeg8.b, + EnHy_SetEnvColor(play->state.gfxCtx, envColorSeg8.r, envColorSeg8.g, envColorSeg8.b, envColorSeg8.a)); gSPSegment(POLY_OPA_DISP++, 0x09, - EnHy_SetEnvColor(globalCtx->state.gfxCtx, envColorSeg9.r, envColorSeg9.g, envColorSeg9.b, + EnHy_SetEnvColor(play->state.gfxCtx, envColorSeg9.r, envColorSeg9.g, envColorSeg9.b, envColorSeg9.a)); if ((this->actor.params & 0x7F) == ENHY_TYPE_CNE_8 || (this->actor.params & 0x7F) == ENHY_TYPE_CNE_11) { @@ -1224,15 +1224,15 @@ void EnHy_Draw(Actor* thisx, GlobalContext* globalCtx) { envColorSeg10.a = 0; } gSPSegment(POLY_OPA_DISP++, 0x0A, - EnHy_SetEnvColor(globalCtx->state.gfxCtx, envColorSeg10.r, envColorSeg10.g, - envColorSeg10.b, envColorSeg10.a)); + EnHy_SetEnvColor(play->state.gfxCtx, envColorSeg10.r, envColorSeg10.g, envColorSeg10.b, + envColorSeg10.a)); } break; } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnHy_OverrideLimbDraw, EnHy_PostLimbDraw, &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnHy_OverrideLimbDraw, EnHy_PostLimbDraw, &this->actor); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_hy.c", 2388); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2388); } diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.h b/src/overlays/actors/ovl_En_Hy/z_en_hy.h index f7e66544da..53d86a416a 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.h +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.h @@ -31,7 +31,7 @@ typedef enum { struct EnHy; -typedef void (*EnHyActionFunc)(struct EnHy*, GlobalContext*); +typedef void (*EnHyActionFunc)(struct EnHy*, PlayState*); typedef struct EnHy { /* 0x0000 */ Actor actor; 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 a0d381c8ca..9571df1333 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 @@ -9,15 +9,15 @@ #define FLAGS 0 -void EnIceHono_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIceHono_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIceHono_Update(Actor* thisx, GlobalContext* globalCtx); -void EnIceHono_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnIceHono_Init(Actor* thisx, PlayState* play); +void EnIceHono_Destroy(Actor* thisx, PlayState* play); +void EnIceHono_Update(Actor* thisx, PlayState* play); +void EnIceHono_Draw(Actor* thisx, PlayState* play); -void EnIceHono_CapturableFlame(EnIceHono* this, GlobalContext* globalCtx); -void EnIceHono_DropFlame(EnIceHono* this, GlobalContext* globalCtx); -void EnIceHono_SpreadFlames(EnIceHono* this, GlobalContext* globalCtx); -void EnIceHono_SmallFlameMove(EnIceHono* this, GlobalContext* globalCtx); +void EnIceHono_CapturableFlame(EnIceHono* this, PlayState* play); +void EnIceHono_DropFlame(EnIceHono* this, PlayState* play); +void EnIceHono_SpreadFlames(EnIceHono* this, PlayState* play); +void EnIceHono_SmallFlameMove(EnIceHono* this, PlayState* play); void EnIceHono_SetupActionCapturableFlame(EnIceHono* this); void EnIceHono_SetupActionDroppedFlame(EnIceHono* this); @@ -100,7 +100,7 @@ f32 EnIceHono_XZDistanceSquared(Vec3f* v1, Vec3f* v2) { return SQ(v1->x - v2->x) + SQ(v1->z - v2->z); } -void EnIceHono_InitCapturableFlame(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_InitCapturableFlame(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; Actor_ProcessInitChain(&this->actor, sInitChainCapturableFlame); @@ -108,15 +108,15 @@ void EnIceHono_InitCapturableFlame(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_0; Actor_SetFocus(&this->actor, 10.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitCapturableFlame); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitCapturableFlame); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.colChkInfo.mass = MASS_IMMOVABLE; EnIceHono_SetupActionCapturableFlame(this); } -void EnIceHono_InitDroppedFlame(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_InitDroppedFlame(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; Actor_ProcessInitChain(&this->actor, sInitChainDroppedFlame); @@ -127,8 +127,8 @@ void EnIceHono_InitDroppedFlame(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.x = this->actor.shape.rot.y = this->actor.shape.rot.z = this->actor.world.rot.x = this->actor.world.rot.y = this->actor.world.rot.z = 0; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitDroppedFlame); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitDroppedFlame); Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = this->actor.scale.x * 4000.4f; @@ -137,7 +137,7 @@ void EnIceHono_InitDroppedFlame(Actor* thisx, GlobalContext* globalCtx) { EnIceHono_SetupActionDroppedFlame(this); } -void EnIceHono_InitSmallFlame(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_InitSmallFlame(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; Actor_ProcessInitChain(&this->actor, sInitChainSmallFlame); @@ -149,44 +149,44 @@ void EnIceHono_InitSmallFlame(Actor* thisx, GlobalContext* globalCtx) { EnIceHono_SetupActionSmallFlame(this); } -void EnIceHono_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_Init(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; s16 params = this->actor.params; switch (this->actor.params) { case -1: - EnIceHono_InitCapturableFlame(&this->actor, globalCtx); + EnIceHono_InitCapturableFlame(&this->actor, play); break; case 0: - EnIceHono_InitDroppedFlame(&this->actor, globalCtx); + EnIceHono_InitDroppedFlame(&this->actor, play); break; case 1: case 2: - EnIceHono_InitSmallFlame(&this->actor, globalCtx); + EnIceHono_InitSmallFlame(&this->actor, play); break; } if ((this->actor.params == -1) || (this->actor.params == 0)) { Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, (s16)this->actor.world.pos.y + 10, this->actor.world.pos.z, 155, 210, 255, 0); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); this->unk_154 = Rand_ZeroOne() * (0x1FFFF / 2.0f); this->unk_156 = Rand_ZeroOne() * (0x1FFFF / 2.0f); osSyncPrintf("(ice 炎)(arg_data 0x%04x)\n", this->actor.params); // "(ice flame)" } } -void EnIceHono_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_Destroy(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; if ((this->actor.params == -1) || (this->actor.params == 0)) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyCylinder(globalCtx, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); } } -u32 EnIceHono_InBottleRange(EnIceHono* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +u32 EnIceHono_InBottleRange(EnIceHono* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 60.0f) { Vec3f tempPos; @@ -210,16 +210,16 @@ void EnIceHono_SetupActionCapturableFlame(EnIceHono* this) { this->actor.shape.yOffset = -1000.0f; } -void EnIceHono_CapturableFlame(EnIceHono* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnIceHono_CapturableFlame(EnIceHono* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - } else if (EnIceHono_InBottleRange(this, globalCtx)) { + } else if (EnIceHono_InBottleRange(this, play)) { // GI_MAX in this case allows the player to catch the actor in a bottle - func_8002F434(&this->actor, globalCtx, GI_MAX, 60.0f, 100.0f); + func_8002F434(&this->actor, play, GI_MAX, 60.0f, 100.0f); } if (this->actor.xzDistToPlayer < 200.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } func_8002F8F0(&this->actor, NA_SE_EV_FIRE_PILLAR_S - SFX_FLAG); } @@ -230,7 +230,7 @@ void EnIceHono_SetupActionDroppedFlame(EnIceHono* this) { this->alpha = 255; } -void EnIceHono_DropFlame(EnIceHono* this, GlobalContext* globalCtx) { +void EnIceHono_DropFlame(EnIceHono* this, PlayState* play) { u32 bgFlag = this->actor.bgCheckFlags & BGCHECKFLAG_GROUND; Math_StepToF(&this->actor.scale.x, 0.0017f, 0.00008f); @@ -240,20 +240,19 @@ void EnIceHono_DropFlame(EnIceHono* this, GlobalContext* globalCtx) { if (bgFlag != 0) { s32 i; for (i = 0; i < 8; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ICE_HONO, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, - ((s32)(Rand_ZeroOne() * 1000.0f) + i * 0x2000) - 0x1F4, 0, 1); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ICE_HONO, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, ((s32)(Rand_ZeroOne() * 1000.0f) + i * 0x2000) - 0x1F4, 0, 1); } EnIceHono_SetupActionSpreadFlames(this); } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, this->actor.scale.x * 3500.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->actor.scale.x * 3500.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = this->actor.scale.x * 4000.0f; this->collider.dim.height = this->actor.scale.y * 8000.0f; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->timer <= 0) { Actor_Kill(&this->actor); @@ -266,7 +265,7 @@ void EnIceHono_SetupActionSpreadFlames(EnIceHono* this) { this->alpha = 255; } -void EnIceHono_SpreadFlames(EnIceHono* this, GlobalContext* globalCtx) { +void EnIceHono_SpreadFlames(EnIceHono* this, PlayState* play) { if (this->timer > 20) { Math_StepToF(&this->actor.scale.x, 0.011f, 0.00014f); Math_StepToF(&this->actor.scale.y, 0.006f, 0.00012f); @@ -276,7 +275,7 @@ void EnIceHono_SpreadFlames(EnIceHono* this, GlobalContext* globalCtx) { } this->actor.scale.z = this->actor.scale.x; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, this->actor.scale.x * 3500.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->actor.scale.x * 3500.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (this->timer < 25) { this->alpha -= 10; this->alpha = CLAMP(this->alpha, 0, 255); @@ -286,15 +285,14 @@ void EnIceHono_SpreadFlames(EnIceHono* this, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = this->actor.scale.x * 6000.0f; this->collider.dim.height = this->actor.scale.y * 8000.0f; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->timer == 46) { s32 i; for (i = 0; i < 10; i++) { s32 rot = i * 0x1999; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ICE_HONO, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, - ((s32)(Rand_ZeroOne() * 1000.0f) + rot) - 0x1F4, 0, 2); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ICE_HONO, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, ((s32)(Rand_ZeroOne() * 1000.0f) + rot) - 0x1F4, 0, 2); } } @@ -316,7 +314,7 @@ void EnIceHono_SetupActionSmallFlame(EnIceHono* this) { } } -void EnIceHono_SmallFlameMove(EnIceHono* this, GlobalContext* globalCtx) { +void EnIceHono_SmallFlameMove(EnIceHono* this, PlayState* play) { if (this->timer > 20) { Math_StepToF(&this->actor.scale.x, 0.006f, 0.00016f); Math_StepToF(&this->actor.scale.y, this->smallFlameTargetYScale * 0.667f, 0.00014f); @@ -327,7 +325,7 @@ void EnIceHono_SmallFlameMove(EnIceHono* this, GlobalContext* globalCtx) { this->actor.scale.z = this->actor.scale.x; Math_StepToF(&this->actor.speedXZ, 0, 0.06f); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if (this->timer < 25) { this->alpha -= 10; @@ -338,7 +336,7 @@ void EnIceHono_SmallFlameMove(EnIceHono* this, GlobalContext* globalCtx) { } } -void EnIceHono_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_Update(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; s32 pad1; f32 intensity; @@ -367,32 +365,30 @@ void EnIceHono_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void EnIceHono_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnIceHono_Draw(Actor* thisx, PlayState* play) { EnIceHono* this = (EnIceHono*)thisx; u32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ice_hono.c", 695); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ice_hono.c", 695); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (globalCtx->state.frames * -20) % 512, - 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (play->state.frames * -20) % 512, 32, 128)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 150, 255, 0); - Matrix_RotateY( - BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000)), - MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y + 0x8000)), + MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ice_hono.c", 718), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ice_hono.c", 718), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ice_hono.c", 722); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ice_hono.c", 722); } diff --git a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h index 8c6b8df3cc..e5ad5fd1cf 100644 --- a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h +++ b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h @@ -6,7 +6,7 @@ struct EnIceHono; -typedef void (*EnIceHonoActionFunc)(struct EnIceHono*, GlobalContext*); +typedef void (*EnIceHonoActionFunc)(struct EnIceHono*, PlayState*); typedef struct EnIceHono { /* 0x0000 */ Actor actor; 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 92274e98bb..740f5a1e3c 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -11,46 +11,46 @@ #define FLAGS ACTOR_FLAG_4 -typedef void (*EnIkDrawFunc)(struct EnIk*, GlobalContext*); +typedef void (*EnIkDrawFunc)(struct EnIk*, PlayState*); -void EnIk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIk_Update(Actor* thisx, GlobalContext* globalCtx); -void EnIk_Draw(Actor* thisx, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); -void func_80A7492C(EnIk* this, GlobalContext* globalCtx); +void func_80A747C0(EnIk* this, PlayState* play); +void func_80A7492C(EnIk* this, PlayState* play); void func_80A74AAC(EnIk* this); -void func_80A74BA4(EnIk* this, GlobalContext* globalCtx); +void func_80A74BA4(EnIk* this, PlayState* play); void func_80A74E2C(EnIk* this); -void func_80A74EBC(EnIk* this, GlobalContext* globalCtx); +void func_80A74EBC(EnIk* this, PlayState* play); void func_80A7506C(EnIk* this); -void func_80A7510C(EnIk* this, GlobalContext* globalCtx); +void func_80A7510C(EnIk* this, PlayState* play); void func_80A751C8(EnIk* this); -void func_80A75260(EnIk* this, GlobalContext* globalCtx); +void func_80A75260(EnIk* this, PlayState* play); void func_80A753D0(EnIk* this); -void func_80A7545C(EnIk* this, GlobalContext* globalCtx); +void func_80A7545C(EnIk* this, PlayState* play); void func_80A754A0(EnIk* this); -void func_80A75530(EnIk* this, GlobalContext* globalCtx); +void func_80A75530(EnIk* this, PlayState* play); void func_80A755F0(EnIk* this); -void func_80A7567C(EnIk* this, GlobalContext* globalCtx); -void func_80A758B0(EnIk* this, GlobalContext* globalCtx); -void func_80A75A38(EnIk* this, GlobalContext* globalCtx); -void func_80A75FA0(Actor* thisx, GlobalContext* globalCtx); -void func_80A76798(Actor* thisx, GlobalContext* globalCtx); -void func_80A7748C(EnIk* this, GlobalContext* globalCtx); -void func_80A774BC(EnIk* this, GlobalContext* globalCtx); -void func_80A774F8(EnIk* this, GlobalContext* globalCtx); -void func_80A77844(EnIk* this, GlobalContext* globalCtx); -void func_80A779DC(EnIk* this, GlobalContext* globalCtx); -void func_80A77AEC(EnIk* this, GlobalContext* globalCtx); -void func_80A77B0C(EnIk* this, GlobalContext* globalCtx); -void func_80A77B3C(EnIk* this, GlobalContext* globalCtx); -void func_80A77ED0(EnIk* this, GlobalContext* globalCtx); -void func_80A77EDC(EnIk* this, GlobalContext* globalCtx); -void func_80A78160(EnIk* this, GlobalContext* globalCtx); -void func_80A781CC(Actor* thisx, GlobalContext* globalCtx); +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 = { { @@ -165,23 +165,23 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -void EnIk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnIk_Destroy(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; - if (Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_IK, ACTORCAT_ENEMY, 8000.0f) == NULL) { + if (Actor_FindNearby(play, &this->actor, ACTOR_EN_IK, ACTORCAT_ENEMY, 8000.0f) == NULL) { func_800F5B58(); } - Collider_DestroyTris(globalCtx, &this->shieldCollider); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyQuad(globalCtx, &this->axeCollider); + Collider_DestroyTris(play, &this->shieldCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->axeCollider); } void EnIk_SetupAction(EnIk* this, EnIkActionFunc actionFunc) { this->actionFunc = actionFunc; } -void func_80A74398(Actor* thisx, GlobalContext* globalCtx) { +void func_80A74398(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; s32 pad; EffectBlureInit1 blureInit; @@ -190,12 +190,12 @@ void func_80A74398(Actor* thisx, GlobalContext* globalCtx) { thisx->draw = func_80A76798; thisx->flags |= ACTOR_FLAG_10; - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, thisx, &sCylinderInit); - Collider_InitTris(globalCtx, &this->shieldCollider); - Collider_SetTris(globalCtx, &this->shieldCollider, thisx, &sTrisInit, this->shieldColliderItems); - Collider_InitQuad(globalCtx, &this->axeCollider); - Collider_SetQuad(globalCtx, &this->axeCollider, thisx, &sQuadInit); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, thisx, &sCylinderInit); + Collider_InitTris(play, &this->shieldCollider); + Collider_SetTris(play, &this->shieldCollider, thisx, &sTrisInit, this->shieldColliderItems); + Collider_InitQuad(play, &this->axeCollider); + Collider_SetQuad(play, &this->axeCollider, thisx, &sQuadInit); thisx->colChkInfo.damageTable = &sDamageTable; thisx->colChkInfo.mass = MASS_HEAVY; @@ -211,7 +211,7 @@ void func_80A74398(Actor* thisx, GlobalContext* globalCtx) { } else { Actor_SetScale(thisx, 0.012f); thisx->naviEnemyId = NAVI_ENEMY_IRON_KNUCKLE; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_ENEMY); } blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p2StartColor[0] = blureInit.p2StartColor[1] = @@ -227,22 +227,22 @@ void func_80A74398(Actor* thisx, GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); func_80A74714(this); if (this->switchFlags != 0xFF) { - if (Flags_GetSwitch(globalCtx, this->switchFlags)) { + if (Flags_GetSwitch(play, this->switchFlags)) { Actor_Kill(thisx); } - } else if (thisx->params != 0 && Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)) { + } else if (thisx->params != 0 && Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(thisx); } } -s32 func_80A745E4(EnIk* this, GlobalContext* globalCtx) { +s32 func_80A745E4(EnIk* this, PlayState* play) { if (((this->unk_2FB != 0) || (this->actor.params == 0)) && - (func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y) != 0) && - (globalCtx->gameplayFrames & 1)) { + (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y) != 0) && + (play->gameplayFrames & 1)) { func_80A755F0(this); return true; } else { @@ -250,8 +250,8 @@ s32 func_80A745E4(EnIk* this, GlobalContext* globalCtx) { } } -Actor* func_80A74674(GlobalContext* globalCtx, Actor* actor) { - Actor* prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; +Actor* func_80A74674(PlayState* play, Actor* actor) { + Actor* prop = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (prop != NULL) { if ((prop == actor) || (prop->id != ACTOR_BG_JYA_IRONOBJ)) { @@ -283,14 +283,14 @@ void func_80A74714(EnIk* this) { EnIk_SetupAction(this, func_80A747C0); } -void func_80A747C0(EnIk* this, GlobalContext* globalCtx) { +void func_80A747C0(EnIk* this, PlayState* play) { Vec3f sp24; if (this->bodyCollider.base.acFlags & AC_HIT) { sp24 = this->actor.world.pos; Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); sp24.y += 30.0f; - func_8003424C(globalCtx, &sp24); + func_8003424C(play, &sp24); this->skelAnime.playSpeed = 1.0f; func_800F5ACC(NA_BGM_MINI_BOSS); } @@ -313,13 +313,13 @@ void func_80A7489C(EnIk* this) { EnIk_SetupAction(this, func_80A7492C); } -void func_80A7492C(EnIk* this, GlobalContext* globalCtx) { +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) <= phi_a0) && (this->actor.xzDistToPlayer < 100.0f) && (ABS(this->actor.yDistToPlayer) < 150.0f)) { - if ((globalCtx->gameplayFrames & 1)) { + if ((play->gameplayFrames & 1)) { func_80A74E2C(this); } else { func_80A751C8(this); @@ -329,7 +329,7 @@ void func_80A7492C(EnIk* this, GlobalContext* globalCtx) { } else { func_80A74AAC(this); } - func_80A745E4(this, globalCtx); + func_80A745E4(this, play); SkelAnime_Update(&this->skelAnime); } @@ -349,7 +349,7 @@ void func_80A74AAC(EnIk* this) { EnIk_SetupAction(this, func_80A74BA4); } -void func_80A74BA4(EnIk* this, GlobalContext* globalCtx) { +void func_80A74BA4(EnIk* this, PlayState* play) { s16 temp_t0; s16 temp_a1; s16 yawDiff; @@ -379,14 +379,14 @@ void func_80A74BA4(EnIk* this, GlobalContext* globalCtx) { 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 ((globalCtx->gameplayFrames & 1)) { + if ((play->gameplayFrames & 1)) { func_80A74E2C(this); } else { func_80A751C8(this); } } } - if (func_80A74674(globalCtx, &this->actor) != NULL) { + if (func_80A74674(play, &this->actor) != NULL) { func_80A751C8(this); this->unk_2FC = 1; } else { @@ -400,7 +400,7 @@ void func_80A74BA4(EnIk* this, GlobalContext* globalCtx) { this->unk_300 = 0x28; } } - func_80A745E4(this, globalCtx); + func_80A745E4(this, play); SkelAnime_Update(&this->skelAnime); if ((sp30 == (s16)this->skelAnime.curFrame) || (sp2E == (s16)this->skelAnime.curFrame)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_WALK); @@ -417,7 +417,7 @@ void func_80A74E2C(EnIk* this) { EnIk_SetupAction(this, func_80A74EBC); } -void func_80A74EBC(EnIk* this, GlobalContext* globalCtx) { +void func_80A74EBC(EnIk* this, PlayState* play) { Vec3f sp2C; if (this->skelAnime.curFrame == 15.0f) { @@ -427,9 +427,9 @@ void func_80A74EBC(EnIk* this, GlobalContext* globalCtx) { sp2C.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y + 0x6A4) * 70.0f; sp2C.y = this->actor.world.pos.y; Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_HIT_GND); - Camera_AddQuake(&globalCtx->mainCamera, 2, 0x19, 5); + Camera_AddQuake(&play->mainCamera, 2, 0x19, 5); func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); - CollisionCheck_SpawnShieldParticles(globalCtx, &sp2C); + CollisionCheck_SpawnShieldParticles(play, &sp2C); } if ((this->skelAnime.curFrame > 17.0f) && (this->skelAnime.curFrame < 23.0f)) { @@ -459,7 +459,7 @@ void func_80A7506C(EnIk* this) { EnIk_SetupAction(this, func_80A7510C); } -void func_80A7510C(EnIk* this, GlobalContext* globalCtx) { +void func_80A7510C(EnIk* this, PlayState* play) { f32 frames; if (SkelAnime_Update(&this->skelAnime) || (--this->unk_2F9 == 0)) { @@ -485,7 +485,7 @@ void func_80A751C8(EnIk* this) { EnIk_SetupAction(this, func_80A75260); } -void func_80A75260(EnIk* this, GlobalContext* globalCtx) { +void func_80A75260(EnIk* this, PlayState* play) { f32 temp_f0; this->unk_300 += 0x1C2; @@ -522,10 +522,10 @@ void func_80A753D0(EnIk* this) { EnIk_SetupAction(this, func_80A7545C); } -void func_80A7545C(EnIk* this, GlobalContext* globalCtx) { +void func_80A7545C(EnIk* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { func_80A7489C(this); - func_80A745E4(this, globalCtx); + func_80A745E4(this, play); } } @@ -539,7 +539,7 @@ void func_80A754A0(EnIk* this) { EnIk_SetupAction(this, func_80A75530); } -void func_80A75530(EnIk* this, GlobalContext* globalCtx) { +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)) { @@ -552,7 +552,7 @@ void func_80A75530(EnIk* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skelAnime)) { func_80A753D0(this); - func_80A745E4(this, globalCtx); + func_80A745E4(this, play); } } @@ -566,12 +566,12 @@ void func_80A755F0(EnIk* this) { EnIk_SetupAction(this, func_80A7567C); } -void func_80A7567C(EnIk* this, GlobalContext* globalCtx) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->shieldCollider.base); +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 ((globalCtx->gameplayFrames & 1)) { + if ((play->gameplayFrames & 1)) { func_80A74E2C(this); } else { func_80A751C8(this); @@ -602,15 +602,15 @@ void func_80A75790(EnIk* this) { EnIk_SetupAction(this, func_80A758B0); } -void func_80A758B0(EnIk* this, GlobalContext* globalCtx) { +void func_80A758B0(EnIk* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params + 4)) { + 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) { func_80A7489C(this); - func_80A745E4(this, globalCtx); + func_80A745E4(this, play); } else { func_80A754A0(this); } @@ -630,7 +630,7 @@ void func_80A7598C(EnIk* this) { EnIk_SetupAction(this, func_80A75A38); } -void func_80A75A38(EnIk* this, GlobalContext* globalCtx) { +void func_80A75A38(EnIk* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if ((this->actor.colChkInfo.health == 0) && (this->unk_2F9 != 0)) { s32 i; @@ -643,12 +643,12 @@ void func_80A75A38(EnIk* this, GlobalContext* globalCtx) { 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(globalCtx, &pos, &sp7C, &sp7C, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &sp7C, &sp7C, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); } if (this->unk_2F9 == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xB0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xB0); if (this->switchFlags != 0xFF) { - Flags_SetSwitch(globalCtx, this->switchFlags); + Flags_SetSwitch(play, this->switchFlags); } Actor_Kill(&this->actor); } @@ -658,7 +658,7 @@ void func_80A75A38(EnIk* this, GlobalContext* globalCtx) { } } -void func_80A75C38(EnIk* this, GlobalContext* globalCtx) { +void func_80A75C38(EnIk* this, PlayState* play) { f32 temp_f0; u8 pad; u8 pad2; @@ -692,7 +692,7 @@ void func_80A75C38(EnIk* this, GlobalContext* globalCtx) { if ((this->unk_2FD == 0) || (this->unk_2FD == 0xD) || ((this->unk_2FB == 0) && (this->unk_2FD == 0xE))) { if (this->unk_2FD != 0) { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &sp38); + CollisionCheck_SpawnShieldParticlesMetal(play, &sp38); } return; } @@ -702,22 +702,22 @@ void func_80A75C38(EnIk* this, GlobalContext* globalCtx) { if (this->actor.params != 0) { if ((prevHealth > 10) && (this->actor.colChkInfo.health <= 10)) { this->unk_2FB = 1; - BodyBreak_Alloc(&this->bodyBreak, 3, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 3, play); } } else if (this->actor.colChkInfo.health <= 10) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_BOSS); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_LAST_DAMAGE); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_LAST_DAMAGE); if (this->switchFlags != 0xFF) { - Flags_SetSwitch(globalCtx, this->switchFlags); + Flags_SetSwitch(play, this->switchFlags); } return; } else if (prevHealth == 50) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } if (this->actor.colChkInfo.health == 0) { func_80A7598C(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); return; } Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x7D0, 0); @@ -738,22 +738,22 @@ void func_80A75C38(EnIk* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_DAMAGE); - CollisionCheck_SpawnShieldParticles(globalCtx, &sp38); + CollisionCheck_SpawnShieldParticles(play, &sp38); } -void func_80A75FA0(Actor* thisx, GlobalContext* globalCtx) { +void func_80A75FA0(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); u8 prevInvincibilityTimer; this->unk_2FA = this->unk_2FB; - func_80A75C38(this, globalCtx); + func_80A75C38(this, play); if ((this->actor.params == 0) && (this->actor.colChkInfo.health <= 10)) { - func_80A781CC(&this->actor, globalCtx); + func_80A781CC(&this->actor, play); return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->axeCollider.base.atFlags & AT_HIT) { this->axeCollider.base.atFlags &= ~AT_HIT; if (&player->actor == this->axeCollider.base.at) { @@ -763,30 +763,30 @@ void func_80A75FA0(Actor* thisx, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -64); + play->damagePlayer(play, -64); this->unk_2FE = 0; } } - func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); player->invincibilityTimer = prevInvincibilityTimer; } } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, + 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(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if ((this->actor.colChkInfo.health > 0) && (this->actor.colorFilterTimer == 0) && (this->unk_2F8 >= 2)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if (this->unk_2FE > 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->axeCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->axeCollider.base); } if (this->unk_2F8 == 9) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->shieldCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->shieldCollider.base); } } @@ -805,7 +805,7 @@ Gfx* func_80A761B0(GraphicsContext* gfxCtx, u8 primR, u8 primG, u8 primB, u8 env return displayList; } -s32 EnIk_OverrideLimbDraw3(GlobalContext* globalCtx, 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 == 12) { @@ -850,18 +850,18 @@ static Vec3f D_80A784D0[] = { { -3000.0, -700.0, -5000.0 }, }; -void EnIk_PostLimbDraw3(GlobalContext* globalCtx, 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(globalCtx->state.gfxCtx, "../z_en_ik_inFight.c", 1201); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ik_inFight.c", 1201); if (this->unk_2FB & 1) { BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 26, 27, 28, dList, BODYBREAK_OBJECT_DEFAULT); } if (limbIndex == 12) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ik_inFight.c", 1217), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ik_inFight.c", 1217), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params != 0) { gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_019E08); @@ -900,63 +900,63 @@ void EnIk_PostLimbDraw3(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve switch (limbIndex) { case 22: - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ik_inFight.c", 1270), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ik_inFight.c", 1270), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016F88); break; case 24: - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ik_inFight.c", 1275), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ik_inFight.c", 1275), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016EE8); break; case 26: if (!(this->unk_2FA & 1)) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ik_inFight.c", 1281), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ik_inFight.c", 1281), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016BE0); } break; case 27: if (!(this->unk_2FA & 1)) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ik_inFight.c", 1288), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ik_inFight.c", 1288), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016CD8); } break; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ik_inFight.c", 1294); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ik_inFight.c", 1294); } -void func_80A76798(Actor* thisx, GlobalContext* globalCtx) { +void func_80A76798(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ik_inFight.c", 1309); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ik_inFight.c", 1309); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->actor.params == 0) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(globalCtx->state.gfxCtx, 245, 225, 155, 30, 30, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(globalCtx->state.gfxCtx, 255, 40, 0, 40, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(globalCtx->state.gfxCtx, 255, 255, 255, 20, 40, 30)); + 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(globalCtx->state.gfxCtx, 245, 255, 205, 30, 35, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(globalCtx->state.gfxCtx, 185, 135, 25, 20, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(globalCtx->state.gfxCtx, 255, 255, 255, 30, 40, 20)); + 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(globalCtx->state.gfxCtx, 55, 65, 55, 0, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(globalCtx->state.gfxCtx, 205, 165, 75, 25, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(globalCtx->state.gfxCtx, 205, 165, 75, 25, 20, 0)); + 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, func_80A761B0(globalCtx->state.gfxCtx, 255, 255, 255, 180, 180, 180)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(globalCtx->state.gfxCtx, 225, 205, 115, 25, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(globalCtx->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(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnIk_OverrideLimbDraw3, EnIk_PostLimbDraw3, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ik_inFight.c", 1351); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ik_inFight.c", 1351); } void EnIk_StartMusic(void) { @@ -985,12 +985,12 @@ void func_80A76C14(EnIk* this) { } } -void func_80A76DDC(EnIk* this, GlobalContext* globalCtx, Vec3f* pos) { +void func_80A76DDC(EnIk* this, PlayState* play, Vec3f* pos) { Audio_PlaySoundGeneral(NA_SE_EN_TWINROBA_TRANSFORM, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } -void func_80A76E2C(EnIk* this, GlobalContext* globalCtx, Vec3f* pos) { +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 }, @@ -1021,34 +1021,33 @@ void func_80A76E2C(EnIk* this, GlobalContext* globalCtx, Vec3f* pos) { envColor.r += temp_v0; envColor.g += temp_v0; envColor.b += temp_v0; - func_8002829C(globalCtx, &effectPos, &effectVelocity, &effectAccel, &primColor, &envColor, + func_8002829C(play, &effectPos, &effectVelocity, &effectAccel, &primColor, &envColor, (Rand_ZeroOne() * 60.0f) + 300.0f, 0); } this->unk_4D4 = 1; - func_80A76DDC(this, globalCtx, pos); + func_80A76DDC(this, play, pos); } } -void func_80A77034(EnIk* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); +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 func_80A7707C(EnIk* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnIk_GetNpcAction(GlobalContext* globalCtx, s32 actionIdx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[actionIdx]; +CsCmdActorAction* EnIk_GetNpcAction(PlayState* play, s32 actionIdx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[actionIdx]; } else { return NULL; } } -void func_80A770C0(EnIk* this, GlobalContext* globalCtx, s32 actionIdx) { - CsCmdActorAction* npcAction = EnIk_GetNpcAction(globalCtx, actionIdx); +void func_80A770C0(EnIk* this, PlayState* play, s32 actionIdx) { + CsCmdActorAction* npcAction = EnIk_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -1070,10 +1069,10 @@ void func_80A77148(EnIk* this) { this->actor.shape.shadowAlpha = 0; } -void func_80A77158(EnIk* this, GlobalContext* globalCtx) { +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); - func_80A770C0(this, globalCtx, 4); + func_80A770C0(this, play, 4); this->action = 1; this->drawMode = 1; this->actor.shape.shadowAlpha = 0xFF; @@ -1088,9 +1087,9 @@ void func_80A771E4(EnIk* this) { this->actor.shape.shadowAlpha = 0xFF; } -void func_80A77264(EnIk* this, GlobalContext* globalCtx, s32 arg2) { - if ((arg2 != 0) && (EnIk_GetNpcAction(globalCtx, 4) != NULL)) { - func_80A78160(this, globalCtx); +void func_80A77264(EnIk* this, PlayState* play, s32 arg2) { + if ((arg2 != 0) && (EnIk_GetNpcAction(play, 4) != NULL)) { + func_80A78160(this, play); } } @@ -1099,61 +1098,60 @@ void func_80A772A4(EnIk* this) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } -void func_80A772EC(EnIk* this, GlobalContext* globalCtx) { +void func_80A772EC(EnIk* this, PlayState* play) { static Vec3f D_80A78FA0; s32 pad[2]; f32 wDest; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->actor.world.pos, &D_80A78FA0, &wDest); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, &D_80A78FA0, &wDest); Audio_PlaySoundGeneral(NA_SE_EN_IRONNACK_DEAD, &D_80A78FA0, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } -void func_80A7735C(EnIk* this, GlobalContext* globalCtx) { +void func_80A7735C(EnIk* this, PlayState* play) { s32 pad[3]; f32 frames = Animation_GetLastFrame(&object_ik_Anim_0203D8); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ik_Skel_0205C0, NULL, this->jointTable, this->morphTable, - 30); + 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; - func_80A770C0(this, globalCtx, 4); - func_80A772EC(this, globalCtx); + func_80A770C0(this, play, 4); + func_80A772EC(this, play); this->actor.shape.shadowAlpha = 0xFF; } -void func_80A77434(EnIk* this, GlobalContext* globalCtx) { +void func_80A77434(EnIk* this, PlayState* play) { this->action = 4; this->drawMode = 2; func_80A772A4(this); this->actor.shape.shadowAlpha = 0xFF; } -void func_80A77474(EnIk* this, GlobalContext* globalCtx) { +void func_80A77474(EnIk* this, PlayState* play) { this->action = 5; this->drawMode = 0; this->actor.shape.shadowAlpha = 0; } -void func_80A7748C(EnIk* this, GlobalContext* globalCtx) { - func_80A77034(this, globalCtx); - func_80A779DC(this, globalCtx); +void func_80A7748C(EnIk* this, PlayState* play) { + func_80A77034(this, play); + func_80A779DC(this, play); } -void func_80A774BC(EnIk* this, GlobalContext* globalCtx) { +void func_80A774BC(EnIk* this, PlayState* play) { func_80A7707C(this); - func_80A77034(this, globalCtx); - func_80A779DC(this, globalCtx); + func_80A77034(this, play); + func_80A779DC(this, play); } -void func_80A774F8(EnIk* this, GlobalContext* globalCtx) { - if (EnIk_GetNpcAction(globalCtx, 4) == NULL) { +void func_80A774F8(EnIk* this, PlayState* play) { + if (EnIk_GetNpcAction(play, 4) == NULL) { Actor_Kill(&this->actor); } } -s32 EnIk_OverrideLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +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)) { @@ -1165,8 +1163,8 @@ s32 EnIk_OverrideLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnIk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +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); @@ -1212,27 +1210,27 @@ void EnIk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve CLOSE_DISPS(gfxCtx, "../z_en_ik_inAwake.c", 304); } -void func_80A77844(EnIk* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80A77844(EnIk* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; s32 pad[2]; OPEN_DISPS(gfxCtx, "../z_en_ik_inAwake.c", 322); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); func_80093D18(gfxCtx); func_80093D84(gfxCtx); 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(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnIk_OverrideLimbDraw2, EnIk_PostLimbDraw2, this); CLOSE_DISPS(gfxCtx, "../z_en_ik_inAwake.c", 345); } -void func_80A779DC(EnIk* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnIk_GetNpcAction(globalCtx, 4); +void func_80A779DC(EnIk* this, PlayState* play) { + CsCmdActorAction* npcAction = EnIk_GetNpcAction(play, 4); u32 action; u32 currentNpcAction; @@ -1245,22 +1243,22 @@ void func_80A779DC(EnIk* this, GlobalContext* globalCtx) { func_80A77148(this); break; case 2: - func_80A77158(this, globalCtx); + func_80A77158(this, play); break; case 3: func_80A771E4(this); break; case 4: - func_80A78160(this, globalCtx); + func_80A78160(this, play); break; case 5: - func_80A7735C(this, globalCtx); + func_80A7735C(this, play); break; case 6: - func_80A77434(this, globalCtx); + func_80A77434(this, play); break; case 7: - func_80A77474(this, globalCtx); + func_80A77474(this, play); break; default: osSyncPrintf("En_Ik_inConfrontion_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); @@ -1271,30 +1269,30 @@ void func_80A779DC(EnIk* this, GlobalContext* globalCtx) { } } -void func_80A77AEC(EnIk* this, GlobalContext* globalCtx) { - func_80A779DC(this, globalCtx); +void func_80A77AEC(EnIk* this, PlayState* play) { + func_80A779DC(this, play); } -void func_80A77B0C(EnIk* this, GlobalContext* globalCtx) { - func_80A77034(this, globalCtx); - func_80A779DC(this, globalCtx); +void func_80A77B0C(EnIk* this, PlayState* play) { + func_80A77034(this, play); + func_80A779DC(this, play); } -void func_80A77B3C(EnIk* this, GlobalContext* globalCtx) { +void func_80A77B3C(EnIk* this, PlayState* play) { s32 sp24; sp24 = func_80A7707C(this); func_80A76C14(this); - func_80A77034(this, globalCtx); - func_80A779DC(this, globalCtx); - func_80A77264(this, globalCtx, sp24); + func_80A77034(this, play); + func_80A779DC(this, play); + func_80A77264(this, play, sp24); } static EnIkActionFunc sActionFuncs[] = { func_80A77AEC, func_80A77B0C, func_80A77B3C, func_80A7748C, func_80A774BC, func_80A774F8, }; -void EnIk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIk_Update(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; if (this->action < 0 || this->action >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->action] == NULL) { @@ -1302,10 +1300,10 @@ void EnIk_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -s32 EnIk_OverrideLimbDraw1(GlobalContext* globalCtx, 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; @@ -1315,7 +1313,7 @@ s32 EnIk_OverrideLimbDraw1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, if (curFrame < 120.0f) { *dList = NULL; } else { - func_80A76E2C(this, globalCtx, pos); + func_80A76E2C(this, play, pos); } break; case 29: @@ -1327,8 +1325,8 @@ s32 EnIk_OverrideLimbDraw1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnIk_PostLimbDraw1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +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); @@ -1363,23 +1361,23 @@ void EnIk_PostLimbDraw1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve CLOSE_DISPS(gfxCtx, "../z_en_ik_inConfrontion.c", 604); } -void func_80A77ED0(EnIk* this, GlobalContext* globalCtx) { +void func_80A77ED0(EnIk* this, PlayState* play) { } -void func_80A77EDC(EnIk* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80A77EDC(EnIk* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; s32 pad[2]; OPEN_DISPS(gfxCtx, "../z_en_ik_inConfrontion.c", 630); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); func_80093D18(gfxCtx); func_80093D84(gfxCtx); 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(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnIk_OverrideLimbDraw1, EnIk_PostLimbDraw1, this); CLOSE_DISPS(gfxCtx, "../z_en_ik_inConfrontion.c", 653); @@ -1387,7 +1385,7 @@ void func_80A77EDC(EnIk* this, GlobalContext* globalCtx) { static EnIkDrawFunc sDrawFuncs[] = { func_80A77ED0, func_80A77EDC, func_80A77844 }; -void EnIk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnIk_Draw(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; if (this->drawMode < 0 || this->drawMode >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawMode] == NULL) { @@ -1395,24 +1393,24 @@ void EnIk_Draw(Actor* thisx, GlobalContext* globalCtx) { return; } - sDrawFuncs[this->drawMode](this, globalCtx); + sDrawFuncs[this->drawMode](this, play); } -void func_80A780D0(EnIk* this, GlobalContext* globalCtx) { +void func_80A780D0(EnIk* this, PlayState* play) { if (this->actor.params == 0) { if (!GET_EVENTCHKINF(EVENTCHKINF_3B)) { this->actor.update = EnIk_Update; this->actor.draw = EnIk_Draw; Actor_SetScale(&this->actor, 0.01f); } else { - func_80A78160(this, globalCtx); + func_80A78160(this, play); EnIk_StartMusic(); } } osSyncPrintf("En_Ik_inConfrontion_Init : %d !!!!!!!!!!!!!!!!\n", this->actor.params); } -void func_80A78160(EnIk* this, GlobalContext* globalCtx) { +void func_80A78160(EnIk* this, PlayState* play) { this->actor.update = func_80A75FA0; this->actor.draw = func_80A76798; this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2; @@ -1421,33 +1419,33 @@ void func_80A78160(EnIk* this, GlobalContext* globalCtx) { func_80A7489C(this); } -void func_80A781CC(Actor* thisx, GlobalContext* globalCtx) { +void func_80A781CC(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; - if (!Play_InCsMode(globalCtx)) { + if (!Play_InCsMode(play)) { this->actor.update = EnIk_Update; this->actor.draw = EnIk_Draw; - Cutscene_SetSegment(globalCtx, gSpiritBossNabooruKnuckleDefeatCs); + Cutscene_SetSegment(play, gSpiritBossNabooruKnuckleDefeatCs); gSaveContext.cutsceneTrigger = 1; Actor_SetScale(&this->actor, 0.01f); SET_EVENTCHKINF(EVENTCHKINF_3C); - func_80A7735C(this, globalCtx); + func_80A7735C(this, play); } } -void EnIk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIk_Init(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; s32 flag = this->actor.params & 0xFF00; if (((this->actor.params & 0xFF) == 0 && GET_EVENTCHKINF(EVENTCHKINF_3C)) || - (flag != 0 && Flags_GetSwitch(globalCtx, flag >> 8))) { + (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(globalCtx, &this->skelAnime, &object_ik_Skel_01E178, &object_ik_Anim_00C114, - this->jointTable, this->morphTable, 30); - func_80A74398(&this->actor, globalCtx); - func_80A780D0(this, globalCtx); + 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); } } 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 6c45cd43b0..418318e602 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -6,7 +6,7 @@ struct EnIk; -typedef void (*EnIkActionFunc)(struct EnIk*, GlobalContext*); +typedef void (*EnIkActionFunc)(struct EnIk*, PlayState*); typedef struct EnIk { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 3e78dd988f..3231cc08ad 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -4,25 +4,25 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnIn_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIn_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIn_Update(Actor* thisx, GlobalContext* globalCtx); -void EnIn_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnIn_Init(Actor* thisx, PlayState* play); +void EnIn_Destroy(Actor* thisx, PlayState* play); +void EnIn_Update(Actor* thisx, PlayState* play); +void EnIn_Draw(Actor* thisx, PlayState* play); -void func_80A79FB0(EnIn* this, GlobalContext* globalCtx); -void func_80A7A304(EnIn* this, GlobalContext* globalCtx); -void func_80A7A4C8(EnIn* this, GlobalContext* globalCtx); -void func_80A7A568(EnIn* this, GlobalContext* globalCtx); -void func_80A7A848(EnIn* this, GlobalContext* globalCtx); -void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx); -void func_80A7AEF0(EnIn* this, GlobalContext* globalCtx); -void func_80A7B018(EnIn* this, GlobalContext* globalCtx); -void func_80A7B024(EnIn* this, GlobalContext* globalCtx); -void func_80A7AE84(EnIn* this, GlobalContext* globalCtx); -void func_80A7A770(EnIn* this, GlobalContext* globalCtx); -void func_80A7A940(EnIn* this, GlobalContext* globalCtx); -void func_80A7AA40(EnIn* this, GlobalContext* globalCtx); -void func_80A7A4BC(EnIn* this, GlobalContext* globalCtx); +void func_80A79FB0(EnIn* this, PlayState* play); +void func_80A7A304(EnIn* this, PlayState* play); +void func_80A7A4C8(EnIn* this, PlayState* play); +void func_80A7A568(EnIn* this, PlayState* play); +void func_80A7A848(EnIn* this, PlayState* play); +void func_80A7ABD4(EnIn* this, PlayState* play); +void func_80A7AEF0(EnIn* this, PlayState* play); +void func_80A7B018(EnIn* this, PlayState* play); +void func_80A7B024(EnIn* this, PlayState* play); +void func_80A7AE84(EnIn* this, PlayState* play); +void func_80A7A770(EnIn* this, PlayState* play); +void func_80A7A940(EnIn* this, PlayState* play); +void func_80A7AA40(EnIn* this, PlayState* play); +void func_80A7A4BC(EnIn* this, PlayState* play); const ActorInit En_In_InitVars = { ACTOR_EN_IN, @@ -109,7 +109,7 @@ static Gfx* sAdultEraDLs[] = { gIngoAdultEraMustacheDL, }; -u16 func_80A78FB0(GlobalContext* globalCtx) { +u16 func_80A78FB0(PlayState* play) { if (GET_EVENTCHKINF(EVENTCHKINF_14)) { if (GET_INFTABLE(INFTABLE_97)) { return 0x2046; @@ -124,9 +124,9 @@ u16 func_80A78FB0(GlobalContext* globalCtx) { } } -u16 func_80A79010(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u16 temp_v0 = Text_GetFaceReaction(globalCtx, 25); +u16 func_80A79010(PlayState* play) { + Player* player = GET_PLAYER(play); + u16 temp_v0 = Text_GetFaceReaction(play, 25); if (temp_v0 != 0) { return temp_v0; @@ -177,20 +177,20 @@ u16 func_80A79010(GlobalContext* globalCtx) { } } -u16 func_80A79168(GlobalContext* globalCtx, Actor* thisx) { - u16 temp_v0 = Text_GetFaceReaction(globalCtx, 25); +u16 func_80A79168(PlayState* play, Actor* thisx) { + u16 temp_v0 = Text_GetFaceReaction(play, 25); if (temp_v0 != 0) { return temp_v0; } if (!LINK_IS_ADULT) { - return func_80A78FB0(globalCtx); + return func_80A78FB0(play); } else { - return func_80A79010(globalCtx); + return func_80A79010(play); } } -s16 func_80A791CC(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A791CC(PlayState* play, Actor* thisx) { s32 ret = 0; switch (thisx->textId) { @@ -208,55 +208,55 @@ s16 func_80A791CC(GlobalContext* globalCtx, Actor* thisx) { return ret; } -s16 func_80A7924C(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A7924C(PlayState* play, Actor* thisx) { EnIn* this = (EnIn*)thisx; s32 sp18 = 1; switch (this->actor.textId) { case 0x2030: case 0x2031: - if (globalCtx->msgCtx.choiceIndex == 1) { + if (play->msgCtx.choiceIndex == 1) { this->actor.textId = 0x2032; } else if (gSaveContext.rupees < 10) { this->actor.textId = 0x2033; } else { this->actor.textId = 0x2034; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); SET_INFTABLE(INFTABLE_9A); break; case 0x2034: - if (globalCtx->msgCtx.choiceIndex == 1) { + if (play->msgCtx.choiceIndex == 1) { Rupees_ChangeBy(-10); this->actor.textId = 0x205C; } else { this->actor.textId = 0x2035; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); break; case 0x2036: case 0x2037: - if (globalCtx->msgCtx.choiceIndex == 1) { + if (play->msgCtx.choiceIndex == 1) { sp18 = 2; } else { this->actor.textId = 0x201F; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } break; case 0x2038: - if (globalCtx->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { + if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { sp18 = 2; } else { this->actor.textId = 0x2039; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); SET_INFTABLE(INFTABLE_A2); } break; case 0x205B: - if (globalCtx->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { + if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { sp18 = 2; } else { - Message_ContinueTextbox(globalCtx, this->actor.textId = 0x2039); + Message_ContinueTextbox(play, this->actor.textId = 0x2039); SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0); CLEAR_EVENTINF(EVENTINF_HORSES_05); CLEAR_EVENTINF(EVENTINF_HORSES_06); @@ -269,40 +269,40 @@ s16 func_80A7924C(GlobalContext* globalCtx, Actor* thisx) { return sp18; } -s16 func_80A7949C(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A7949C(PlayState* play, Actor* thisx) { s32 phi_v1 = 1; if (thisx->textId == 0x2035) { Rupees_ChangeBy(-10); thisx->textId = 0x205C; - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); } else { phi_v1 = 2; } return phi_v1; } -s16 func_80A79500(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A79500(PlayState* play, Actor* thisx) { s16 sp1E = 1; - osSyncPrintf("message_check->(%d[%x])\n", Message_GetState(&globalCtx->msgCtx), thisx->textId); - switch (Message_GetState(&globalCtx->msgCtx)) { + osSyncPrintf("message_check->(%d[%x])\n", Message_GetState(&play->msgCtx), thisx->textId); + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: break; case TEXT_STATE_CLOSING: - sp1E = func_80A791CC(globalCtx, thisx); + sp1E = func_80A791CC(play, thisx); break; case TEXT_STATE_DONE_FADING: break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { - sp1E = func_80A7924C(globalCtx, thisx); + if (Message_ShouldAdvance(play)) { + sp1E = func_80A7924C(play, thisx); } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { - sp1E = func_80A7949C(globalCtx, thisx); + if (Message_ShouldAdvance(play)) { + sp1E = func_80A7949C(play, thisx); } break; case TEXT_STATE_DONE: @@ -314,8 +314,8 @@ s16 func_80A79500(GlobalContext* globalCtx, Actor* thisx) { return sp1E; } -void func_80A795C8(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A795C8(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 arg3; if (this->skelAnime.animation == &object_in_Anim_0003B4 || this->skelAnime.animation == &object_in_Anim_001BE0 || @@ -328,7 +328,7 @@ void func_80A795C8(EnIn* this, GlobalContext* globalCtx) { arg3 = 4; } if (this->actionFunc == func_80A7B024) { - this->unk_308.unk_18 = globalCtx->view.eye; + this->unk_308.unk_18 = play->view.eye; this->unk_308.unk_14 = 60.0f; } else { this->unk_308.unk_18 = player->actor.world.pos; @@ -337,10 +337,10 @@ void func_80A795C8(EnIn* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_308, 1, arg3); } -void func_80A79690(SkelAnime* skelAnime, EnIn* this, GlobalContext* globalCtx) { +void func_80A79690(SkelAnime* skelAnime, EnIn* this, PlayState* play) { if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { skelAnime->moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } @@ -350,7 +350,7 @@ void EnIn_ChangeAnim(EnIn* this, s32 index) { sAnimationInfo[index].morphFrames); } -s32 func_80A7975C(EnIn* this, GlobalContext* globalCtx) { +s32 func_80A7975C(EnIn* this, PlayState* play) { if (this->actor.params != 1 || this->actor.shape.rot.z != 1 || !LINK_IS_ADULT) { return 0; } @@ -362,16 +362,16 @@ s32 func_80A7975C(EnIn* this, GlobalContext* globalCtx) { return 1; } -s32 func_80A79830(EnIn* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT20 && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 1 && +s32 func_80A79830(EnIn* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT20 && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 1 && !GET_EVENTCHKINF(EVENTCHKINF_14)) { return 1; } - if (globalCtx->sceneNum == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 3 && + if (play->sceneNum == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 3 && GET_EVENTCHKINF(EVENTCHKINF_14)) { return 1; } - if (globalCtx->sceneNum == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_NIGHT) { + if (play->sceneNum == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_NIGHT) { if ((this->actor.shape.rot.z == 2) && !GET_EVENTCHKINF(EVENTCHKINF_14)) { return 1; } @@ -379,7 +379,7 @@ s32 func_80A79830(EnIn* this, GlobalContext* globalCtx) { return 1; } } - if (globalCtx->sceneNum == SCENE_SPOT20 && LINK_IS_ADULT && IS_DAY) { + if (play->sceneNum == SCENE_SPOT20 && LINK_IS_ADULT && IS_DAY) { if ((this->actor.shape.rot.z == 5) && !GET_EVENTCHKINF(EVENTCHKINF_18)) { return 2; } @@ -387,7 +387,7 @@ s32 func_80A79830(EnIn* this, GlobalContext* globalCtx) { return 4; } } - if (globalCtx->sceneNum == SCENE_SOUKO && LINK_IS_ADULT && IS_NIGHT) { + if (play->sceneNum == SCENE_SOUKO && LINK_IS_ADULT && IS_NIGHT) { if (this->actor.shape.rot.z == 6 && !GET_EVENTCHKINF(EVENTCHKINF_18)) { return 3; } @@ -410,12 +410,12 @@ void EnIn_UpdateEyes(EnIn* this) { } } -void func_80A79AB4(EnIn* this, GlobalContext* globalCtx) { +void func_80A79AB4(EnIn* this, PlayState* play) { s32 i; u32 f = 0; if (this->skelAnime.animation != &object_in_Anim_014CA8) { - f = globalCtx->gameplayFrames; + f = play->gameplayFrames; } for (i = 0; i < ARRAY_COUNT(this->unk_330); i++) { this->unk_330[i].y = (2068 + 50 * i) * f; @@ -423,16 +423,16 @@ void func_80A79AB4(EnIn* this, GlobalContext* globalCtx) { } } -void func_80A79BAC(EnIn* this, GlobalContext* globalCtx, s32 index, u32 transitionType) { +void func_80A79BAC(EnIn* this, PlayState* play, s32 index, u32 transitionType) { s16 entrances[] = { ENTR_SPOT20_8, ENTR_SPOT20_6, ENTR_SPOT20_0 }; - globalCtx->nextEntranceIndex = entrances[index]; + play->nextEntranceIndex = entrances[index]; if (index == 2) { gSaveContext.nextCutsceneIndex = 0xFFF0; } - globalCtx->transitionType = transitionType; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - func_8002DF54(globalCtx, &this->actor, 8); + play->transitionType = transitionType; + play->transitionTrigger = TRANS_TRIGGER_START; + func_8002DF54(play, &this->actor, 8); Interface_ChangeAlpha(1); if (index == 0) { AREG(6) = 0; @@ -440,26 +440,26 @@ void func_80A79BAC(EnIn* this, GlobalContext* globalCtx, s32 index, u32 transiti gSaveContext.timer1State = 0; } -void func_80A79C78(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A79C78(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f subCamAt; Vec3f subCamEye; Vec3s zeroVec = { 0, 0, 0 }; - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); subCamAt.x = this->actor.world.pos.x; subCamAt.y = this->actor.world.pos.y + 60.0f; subCamAt.z = this->actor.world.pos.z; subCamEye.x = subCamAt.x; subCamEye.y = subCamAt.y - 22.0f; subCamEye.z = subCamAt.z + 40.0f; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &subCamEye); this->unk_308.unk_08 = zeroVec; this->unk_308.unk_0E = zeroVec; - Message_StartTextbox(globalCtx, 0x2025, NULL); + Message_StartTextbox(play, 0x2025, NULL); this->unk_308.unk_00 = 1; player->actor.world.pos = this->actor.world.pos; player->actor.world.pos.x += 100.0f * Math_SinS(this->actor.shape.rot.y); @@ -476,12 +476,12 @@ void func_80A79C78(EnIn* this, GlobalContext* globalCtx) { static s32 D_80A7B998 = 0; -void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Init(Actor* thisx, PlayState* play) { EnIn* this = (EnIn*)thisx; RespawnData* respawn = &gSaveContext.respawn[RESPAWN_MODE_DOWN]; Vec3f respawnPos; - this->ingoObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_IN); + this->ingoObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_IN); if (this->ingoObjBankIndex < 0 && this->actor.params > 0) { this->actionFunc = NULL; Actor_Kill(&this->actor); @@ -496,24 +496,24 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80A79FB0; } -void EnIn_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Destroy(Actor* thisx, PlayState* play) { EnIn* this = (EnIn*)thisx; if (this->actionFunc != NULL && this->actionFunc != func_80A79FB0) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void func_80A79FB0(EnIn* this, GlobalContext* globalCtx) { +void func_80A79FB0(EnIn* this, PlayState* play) { s32 sp3C = 0; - if (Object_IsLoaded(&globalCtx->objectCtx, this->ingoObjBankIndex) || this->actor.params <= 0) { + if (Object_IsLoaded(&play->objectCtx, this->ingoObjBankIndex) || this->actor.params <= 0) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gIngoSkel, NULL, this->jointTable, this->morphTable, 20); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gIngoSkel, NULL, this->jointTable, this->morphTable, 20); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (func_80A7975C(this, globalCtx)) { + if (func_80A7975C(this, play)) { SET_EVENTINF_HORSES_0F(0); return; } @@ -522,7 +522,7 @@ void func_80A79FB0(EnIn* this, GlobalContext* globalCtx) { this->unk_308.unk_00 = 0; this->actionFunc = func_80A7A4BC; - switch (func_80A79830(this, globalCtx)) { + switch (func_80A79830(this, play)) { case 1: EnIn_ChangeAnim(this, ENIN_ANIM_9); this->actionFunc = func_80A7A4BC; @@ -607,7 +607,7 @@ void func_80A79FB0(EnIn* this, GlobalContext* globalCtx) { } } -void func_80A7A304(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A304(EnIn* this, PlayState* play) { if (this->skelAnime.animation == &object_in_Anim_015814 || this->skelAnime.animation == &object_in_Anim_01646C) { if (this->skelAnime.curFrame == 8.0f) { Audio_PlaySoundRandom(&this->actor.projectedPos, NA_SE_VO_IN_LASH_0, @@ -633,24 +633,24 @@ void func_80A7A304(EnIn* this, GlobalContext* globalCtx) { } } -void func_80A7A4BC(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A4BC(EnIn* this, PlayState* play) { } -void func_80A7A4C8(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A4C8(EnIn* this, PlayState* play) { if (this->unk_308.unk_00 == 2) { - func_80A79BAC(this, globalCtx, 1, TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST)); + func_80A79BAC(this, play, 1, TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST)); SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_1); SET_EVENTINF_HORSES_0F(1); CLEAR_INFTABLE(INFTABLE_A2); Environment_ForcePlaySequence(NA_BGM_HORSE); - globalCtx->msgCtx.stateTimer = 0; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 0; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; } } -void func_80A7A568(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A7A568(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 phi_a2; s32 transitionType; @@ -660,18 +660,18 @@ void func_80A7A568(EnIn* this, GlobalContext* globalCtx) { if (gSaveContext.timer1State == 10) { Audio_PlaySoundGeneral(NA_SE_SY_FOUND, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_80A79C78(this, globalCtx); + func_80A79C78(this, play); this->actionFunc = func_80A7B024; gSaveContext.timer1State = 0; } else if (this->unk_308.unk_00 == 2) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (gSaveContext.rupees < 50) { - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; return; } - SET_EVENTINF_HORSES_HORSETYPE(((EnHorse*)GET_PLAYER(globalCtx)->rideActor)->type); + SET_EVENTINF_HORSES_HORSETYPE(((EnHorse*)GET_PLAYER(play)->rideActor)->type); SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_2); phi_a2 = 2; transitionType = TRANS_TYPE_FADE_BLACK; @@ -688,15 +688,15 @@ void func_80A7A568(EnIn* this, GlobalContext* globalCtx) { phi_a2 = 0; transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST); } - func_80A79BAC(this, globalCtx, phi_a2, transitionType); - globalCtx->msgCtx.stateTimer = 0; + func_80A79BAC(this, play, phi_a2, transitionType); + play->msgCtx.stateTimer = 0; SET_EVENTINF_HORSES_0F(1); - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; } } -void func_80A7A770(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A770(EnIn* this, PlayState* play) { if (this->unk_308.unk_00 == 0) { this->actor.flags |= ACTOR_FLAG_16; } else if (this->unk_308.unk_00 == 2) { @@ -709,23 +709,23 @@ void func_80A7A770(EnIn* this, GlobalContext* globalCtx) { gSaveContext.eventInf[EVENTINF_HORSES_INDEX] = (gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & 0xFFFF) | EVENTINF_HORSES_05_MASK; if (!GET_EVENTINF(EVENTINF_HORSES_06)) { - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } } } -void func_80A7A848(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A848(EnIn* this, PlayState* play) { if (this->unk_308.unk_00 == 2) { - if ((globalCtx->msgCtx.choiceIndex == 0 && gSaveContext.rupees < 50) || globalCtx->msgCtx.choiceIndex == 1) { + if ((play->msgCtx.choiceIndex == 0 && gSaveContext.rupees < 50) || play->msgCtx.choiceIndex == 1) { SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0); this->actionFunc = func_80A7A4C8; } else { - func_80A79BAC(this, globalCtx, 2, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST)); + func_80A79BAC(this, play, 2, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST)); SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_2); SET_EVENTINF_HORSES_0F(1); - globalCtx->msgCtx.stateTimer = 0; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 0; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } this->unk_308.unk_00 = 0; CLEAR_EVENTINF(EVENTINF_HORSES_05); @@ -733,7 +733,7 @@ void func_80A7A848(EnIn* this, GlobalContext* globalCtx) { } } -void func_80A7A940(EnIn* this, GlobalContext* globalCtx) { +void func_80A7A940(EnIn* this, PlayState* play) { if (this->unk_308.unk_00 == 0) { this->actor.flags |= ACTOR_FLAG_16; return; @@ -746,26 +746,26 @@ void func_80A7A940(EnIn* this, GlobalContext* globalCtx) { } if (this->unk_308.unk_00 == 2) { this->actor.flags &= ~ACTOR_FLAG_16; - func_80A79BAC(this, globalCtx, 2, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST)); + func_80A79BAC(this, play, 2, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST)); SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_2); SET_EVENTINF_HORSES_0F(1); - globalCtx->msgCtx.stateTimer = 0; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 0; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; gSaveContext.eventInf[EVENTINF_HORSES_INDEX] = (gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & 0xFFFF) | EVENTINF_HORSES_06_MASK; } } -void func_80A7AA40(EnIn* this, GlobalContext* globalCtx) { +void func_80A7AA40(EnIn* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f subCamAt; Vec3f subCamEye; - this->subCamId = Play_CreateSubCamera(globalCtx); - this->returnToCamId = globalCtx->activeCamId; - Play_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamId = Play_CreateSubCamera(play); + this->returnToCamId = play->activeCamId; + Play_ChangeCameraStatus(play, this->returnToCamId, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->subCamAtOffset.x = 0.0f; this->subCamAtOffset.y = 50.0f; @@ -785,19 +785,19 @@ void func_80A7AA40(EnIn* this, GlobalContext* globalCtx) { subCamEye.y += this->subCamEyeOffset.y; subCamEye.z += this->subCamEyeOffset.z; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); this->actor.textId = 0x203B; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_308.unk_00 = 1; this->unk_1FC = 0; - globalCtx->csCtx.frames = 0; + play->csCtx.frames = 0; ShrinkWindow_SetVal(0x20); Interface_ChangeAlpha(2); this->actionFunc = func_80A7ABD4; } -void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A7ABD4(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f subCamAt; Vec3f subCamEye; @@ -817,20 +817,20 @@ void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx) { if (this->unk_308.unk_00 == 2) { if (this->actor.textId == 0x203B) { this->actor.textId = 0x203C; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_308.unk_00 = 1; EnIn_ChangeAnim(this, ENIN_ANIM_3); } else { - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; } } } else { - if (globalCtx->csCtx.frames++ >= 50) { + if (play->csCtx.frames++ >= 50) { this->actionFunc = func_80A7AE84; return; } - if (globalCtx->csCtx.frames == 44) { + if (play->csCtx.frames == 44) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_RONRON_DOOR_CLOSE); } Math_SmoothStepToF(&this->subCamAtOffset.x, 0.0f, 0.06f, 10000.0f, 0.0f); @@ -849,20 +849,20 @@ void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx) { subCamEye.x += this->subCamEyeOffset.x; subCamEye.y += this->subCamEyeOffset.y; subCamEye.z += this->subCamEyeOffset.z; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); } } -void func_80A7AE84(EnIn* this, GlobalContext* globalCtx) { - Play_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_ACTIVE); - Play_ClearCamera(globalCtx, this->subCamId); - func_8002DF54(globalCtx, &this->actor, 7); +void func_80A7AE84(EnIn* this, PlayState* play) { + Play_ChangeCameraStatus(play, this->returnToCamId, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->subCamId); + func_8002DF54(play, &this->actor, 7); Interface_ChangeAlpha(0x32); this->actionFunc = func_80A7AEF0; } -void func_80A7AEF0(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A7AEF0(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 yaw; Vec3f pos = this->actor.world.pos; @@ -870,22 +870,22 @@ void func_80A7AEF0(EnIn* this, GlobalContext* globalCtx) { pos.z += 90.0f * Math_CosS(this->actor.shape.rot.y); yaw = Math_Vec3f_Yaw(&pos, &player->actor.world.pos); if (ABS(yaw) > 0x4000) { - globalCtx->nextEntranceIndex = ENTR_SPOT00_15; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE_FAST; + play->nextEntranceIndex = ENTR_SPOT00_15; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; this->actionFunc = func_80A7B018; } else if (this->unk_308.unk_00 == 2) { - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; } } -void func_80A7B018(EnIn* this, GlobalContext* globalCtx) { +void func_80A7B018(EnIn* this, PlayState* play) { } -void func_80A7B024(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A7B024(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->rideActor != NULL) { player->rideActor->freezeTimer = 10; @@ -897,54 +897,54 @@ void func_80A7B024(EnIn* this, GlobalContext* globalCtx) { SET_EVENTCHKINF(EVENTCHKINF_1B); SET_INFTABLE(INFTABLE_AB); } - func_80A79BAC(this, globalCtx, 0, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST)); + func_80A79BAC(this, play, 0, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST)); SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0); SET_EVENTINF_HORSES_0F(1); - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; } } -void EnIn_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Update(Actor* thisx, PlayState* play) { ColliderCylinder* collider; EnIn* this = (EnIn*)thisx; if (this->actionFunc == func_80A79FB0) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); return; } collider = &this->collider; Collider_UpdateCylinder(&this->actor, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetOC(play, &play->colChkCtx, &collider->base); if (this->actionFunc != func_80A7A304) { SkelAnime_Update(&this->skelAnime); if (this->skelAnime.animation == &object_in_Anim_001BE0 && GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_6) { - func_80A79690(&this->skelAnime, this, globalCtx); + func_80A79690(&this->skelAnime, this, play); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); } EnIn_UpdateEyes(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != func_80A7A304) { - func_80A79AB4(this, globalCtx); + func_80A79AB4(this, play); if (gSaveContext.timer2Value < 6 && gSaveContext.timer2State != 0 && this->unk_308.unk_00 == 0) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {} + if (Actor_ProcessTalkRequest(&this->actor, play)) {} } else { - func_800343CC(globalCtx, &this->actor, &this->unk_308.unk_00, + func_800343CC(play, &this->actor, &this->unk_308.unk_00, ((this->actor.targetMode == 6) ? 80.0f : 320.0f) + this->collider.dim.radius, func_80A79168, func_80A79500); if (this->unk_308.unk_00 != 0) { this->unk_1FA = this->unk_1F8; - this->unk_1F8 = Message_GetState(&globalCtx->msgCtx); + this->unk_1F8 = Message_GetState(&play->msgCtx); } } - func_80A795C8(this, globalCtx); + func_80A795C8(this, play); } } -s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnIn* this = (EnIn*)thisx; Vec3s sp2C; @@ -972,11 +972,11 @@ s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnIn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnIn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnIn* this = (EnIn*)thisx; Vec3f D_80A7B9A8 = { 1600.0, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_in.c", 2335); + OPEN_DISPS(play->state.gfxCtx, "../z_en_in.c", 2335); if (limbIndex == INGO_HEAD_LIMB) { Matrix_MultVec3f(&D_80A7B9A8, &this->actor.focus.pos); @@ -989,21 +989,21 @@ void EnIn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec gSPDisplayList(POLY_OPA_DISP++, gIngoChildEraPitchForkDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_in.c", 2365); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_in.c", 2365); } -void EnIn_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gIngoEyeOpenTex, gIngoEyeHalfTex, gIngoEyeClosedTex, gIngoEyeClosed2Tex }; EnIn* this = (EnIn*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_in.c", 2384); + OPEN_DISPS(play->state.gfxCtx, "../z_en_in.c", 2384); if (this->actionFunc != func_80A79FB0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gIngoHeadGradient2Tex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnIn_OverrideLimbDraw, EnIn_PostLimbDraw, &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnIn_OverrideLimbDraw, EnIn_PostLimbDraw, &this->actor); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_in.c", 2416); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_in.c", 2416); } diff --git a/src/overlays/actors/ovl_En_In/z_en_in.h b/src/overlays/actors/ovl_En_In/z_en_in.h index 272535f252..70725f56f5 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/src/overlays/actors/ovl_En_In/z_en_in.h @@ -6,7 +6,7 @@ struct EnIn; -typedef void (*EnInActionFunc)(struct EnIn*, GlobalContext*); +typedef void (*EnInActionFunc)(struct EnIn*, PlayState*); typedef enum { /* 0x00 */ INGO_LIMB_NONE, 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 55f166d8e6..a5b0befe34 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -10,27 +10,27 @@ #define FLAGS 0 -void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx); -void EnInsect_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx); -void EnInsect_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnInsect_Init(Actor* thisx, PlayState* play); +void EnInsect_Destroy(Actor* thisx, PlayState* play); +void EnInsect_Update(Actor* thisx, PlayState* play); +void EnInsect_Draw(Actor* thisx, PlayState* play); void EnInsect_SetupSlowDown(EnInsect* this); -void EnInsect_SlowDown(EnInsect* this, GlobalContext* globalCtx); +void EnInsect_SlowDown(EnInsect* this, PlayState* play); void EnInsect_SetupCrawl(EnInsect* this); -void EnInsect_Crawl(EnInsect* this, GlobalContext* globalCtx); +void EnInsect_Crawl(EnInsect* this, PlayState* play); void EnInsect_SetupRunFromPlayer(EnInsect* this); -void EnInsect_RunFromPlayer(EnInsect* this, GlobalContext* globalCtx); +void EnInsect_RunFromPlayer(EnInsect* this, PlayState* play); void EnInsect_SetupCaught(EnInsect* this); -void EnInsect_Caught(EnInsect* this, GlobalContext* globalCtx); +void EnInsect_Caught(EnInsect* this, PlayState* play); void EnInsect_SetupDig(EnInsect* this); -void EnInsect_Dig(EnInsect* this, GlobalContext* globalCtx); +void EnInsect_Dig(EnInsect* this, PlayState* play); void EnInsect_SetupWalkOnWater(EnInsect* this); -void EnInsect_WalkOnWater(EnInsect* this, GlobalContext* globalCtx); +void EnInsect_WalkOnWater(EnInsect* this, PlayState* play); void EnInsect_SetupDrown(EnInsect* this); -void EnInsect_Drown(EnInsect* this, GlobalContext* globalCtx); +void EnInsect_Drown(EnInsect* this, PlayState* play); void EnInsect_SetupDropped(EnInsect* this); -void EnInsect_Dropped(EnInsect* this, GlobalContext* globalCtx); +void EnInsect_Dropped(EnInsect* this, PlayState* play); static f32 D_80A7DEB0 = 0.0f; /** @@ -106,9 +106,9 @@ f32 EnInsect_XZDistanceSquared(Vec3f* v1, Vec3f* v2) { return SQ(v1->x - v2->x) + SQ(v1->z - v2->z); } -s32 EnInsect_InBottleRange(EnInsect* this, GlobalContext* globalCtx) { +s32 EnInsect_InBottleRange(EnInsect* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f pos; if (this->actor.xzDistToPlayer < 32.0f) { @@ -136,8 +136,8 @@ void EnInsect_SetCrawlAnim(EnInsect* this) { * * @return true if one was found, false otherwise */ -s32 EnInsect_TryFindNearbySoil(EnInsect* this, GlobalContext* globalCtx) { - Actor* currentActor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; +s32 EnInsect_TryFindNearbySoil(EnInsect* this, PlayState* play) { + Actor* currentActor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; f32 currentDistanceSq; f32 bestDistanceSq = SQ(80.0f); s32 ret = false; @@ -177,9 +177,9 @@ void EnInsect_UpdateCrawlSfx(EnInsect* this) { } } -void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnInsect_Init(Actor* thisx, PlayState* play2) { EnInsect* this = (EnInsect*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 rand; s16 type; s32 count; @@ -189,9 +189,9 @@ void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx2) { type = this->actor.params & 3; - SkelAnime_Init(globalCtx, &this->skelAnime, &gBugSkel, &gBugCrawlAnim, this->jointTable, this->morphTable, 24); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderInit, &this->colliderItem); + SkelAnime_Init(play, &this->skelAnime, &gBugSkel, &gBugCrawlAnim, this->jointTable, this->morphTable, 24); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, &this->colliderItem); this->actor.colChkInfo.mass = 30; @@ -206,7 +206,7 @@ void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx2) { } if (type == INSECT_TYPE_FIRST_DROPPED || type == INSECT_TYPE_EXTRA_DROPPED) { - if (EnInsect_TryFindNearbySoil(this, globalCtx)) { + if (EnInsect_TryFindNearbySoil(this, play)) { this->insectFlags |= INSECT_FLAG_FOUND_SOIL; D_80A7DEB0 = 0.0f; } @@ -216,9 +216,9 @@ void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.shape.rot.z = this->actor.world.rot.z; for (count = 0; count < 2; count++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INSECT, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, - this->actor.shape.rot.y, this->actor.shape.rot.z, INSECT_TYPE_EXTRA_DROPPED); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, + this->actor.shape.rot.z, INSECT_TYPE_EXTRA_DROPPED); } } @@ -238,12 +238,12 @@ void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnInsect_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnInsect_Destroy(Actor* thisx, PlayState* play) { s16 type; EnInsect* this = (EnInsect*)thisx; type = this->actor.params & 3; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); if ((type == INSECT_TYPE_FIRST_DROPPED || type == INSECT_TYPE_EXTRA_DROPPED) && sDroppedCount > 0) { sDroppedCount--; } @@ -256,7 +256,7 @@ void EnInsect_SetupSlowDown(EnInsect* this) { this->insectFlags |= INSECT_FLAG_CRAWLING; } -void EnInsect_SlowDown(EnInsect* this, GlobalContext* globalCtx) { +void EnInsect_SlowDown(EnInsect* this, PlayState* play) { s32 pad[2]; s16 type; f32 playSpeed; @@ -293,7 +293,7 @@ void EnInsect_SetupCrawl(EnInsect* this) { this->insectFlags |= INSECT_FLAG_CRAWLING; } -void EnInsect_Crawl(EnInsect* this, GlobalContext* globalCtx) { +void EnInsect_Crawl(EnInsect* this, PlayState* play) { s32 pad1; s32 pad2; s16 yaw; @@ -338,7 +338,7 @@ void EnInsect_SetupRunFromPlayer(EnInsect* this) { this->insectFlags |= INSECT_FLAG_CRAWLING; } -void EnInsect_RunFromPlayer(EnInsect* this, GlobalContext* globalCtx) { +void EnInsect_RunFromPlayer(EnInsect* this, PlayState* play) { s32 pad1; s32 pad2; s16 pad3; @@ -352,7 +352,7 @@ void EnInsect_RunFromPlayer(EnInsect* this, GlobalContext* globalCtx) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 2000); } else if (playerIsClose) { - frames = globalCtx->state.frames; + frames = play->state.frames; yaw = this->actor.yawTowardsPlayer + 0x8000; if (frames & 0x10) { @@ -364,7 +364,7 @@ void EnInsect_RunFromPlayer(EnInsect* this, GlobalContext* globalCtx) { yaw -= 0x2000; } } - if (globalCtx) {} // Must be 'globalCtx' + if (play) {} // Must be 'play' Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 2000); } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -393,7 +393,7 @@ void EnInsect_SetupCaught(EnInsect* this) { this->insectFlags &= ~INSECT_FLAG_CRAWLING; } -void EnInsect_Caught(EnInsect* this, GlobalContext* globalCtx) { +void EnInsect_Caught(EnInsect* this, PlayState* play) { if (this->actionTimer == 20 && !(this->insectFlags & INSECT_FLAG_IS_SHORT_LIVED)) { this->actor.draw = EnInsect_Draw; } else if (this->actionTimer == 0) { @@ -420,7 +420,7 @@ void EnInsect_SetupDig(EnInsect* this) { this->insectFlags |= INSECT_FLAG_UNCATCHABLE; } -void EnInsect_Dig(EnInsect* this, GlobalContext* globalCtx) { +void EnInsect_Dig(EnInsect* this, PlayState* play) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Vec3f unused = { 0.0f, 0.0f, 0.0f }; s32 pad[2]; @@ -441,7 +441,7 @@ void EnInsect_Dig(EnInsect* this, GlobalContext* globalCtx) { velocity.x = Math_SinS(this->actor.shape.rot.y) * -0.6f; velocity.y = Math_SinS(this->actor.shape.rot.x) * 0.6f; velocity.z = Math_CosS(this->actor.shape.rot.y) * -0.6f; - func_800286CC(globalCtx, &this->actor.world.pos, &velocity, &accel, Rand_ZeroOne() * 5.0f + 8.0f, + func_800286CC(play, &this->actor.world.pos, &velocity, &accel, Rand_ZeroOne() * 5.0f + 8.0f, Rand_ZeroOne() * 5.0f + 8.0f); } @@ -462,7 +462,7 @@ void EnInsect_SetupWalkOnWater(EnInsect* this) { this->insectFlags &= ~INSECT_FLAG_CRAWLING; } -void EnInsect_WalkOnWater(EnInsect* this, GlobalContext* globalCtx) { +void EnInsect_WalkOnWater(EnInsect* this, PlayState* play) { f32 temp_f0; s16 temp_v1; s16 pad; @@ -502,8 +502,8 @@ void EnInsect_WalkOnWater(EnInsect* this, GlobalContext* globalCtx) { ripplePoint.x = this->actor.world.pos.x; ripplePoint.y = this->actor.world.pos.y + this->actor.yDistToWater; ripplePoint.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &ripplePoint, 20, 100, 4); - EffectSsGRipple_Spawn(globalCtx, &ripplePoint, 40, 200, 8); + EffectSsGRipple_Spawn(play, &ripplePoint, 20, 100, 4); + EffectSsGRipple_Spawn(play, &ripplePoint, 40, 200, 8); } if (this->actionTimer <= 0 || ((this->insectFlags & INSECT_FLAG_IS_SHORT_LIVED) && this->lifeTimer <= 0) || @@ -532,13 +532,13 @@ void EnInsect_SetupDrown(EnInsect* this) { this->insectFlags |= INSECT_FLAG_UNCATCHABLE; } -void EnInsect_Drown(EnInsect* this, GlobalContext* globalCtx) { +void EnInsect_Drown(EnInsect* this, PlayState* play) { this->actor.shape.rot.x -= 500; this->actor.shape.rot.y += 200; Actor_SetScale(&this->actor, CLAMP_MIN(this->actor.scale.x - 0.00005f, 0.001f)); if (this->actor.yDistToWater > 5.0f && this->actor.yDistToWater < 30.0f && Rand_ZeroOne() < 0.3f) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, -5.0f, 5.0f, 5.0f, (Rand_ZeroOne() * 0.04f) + 0.02f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, -5.0f, 5.0f, 5.0f, (Rand_ZeroOne() * 0.04f) + 0.02f); } if (this->actionTimer <= 0) { @@ -558,7 +558,7 @@ void EnInsect_SetupDropped(EnInsect* this) { this->insectFlags |= INSECT_FLAG_CRAWLING; } -void EnInsect_Dropped(EnInsect* this, GlobalContext* globalCtx) { +void EnInsect_Dropped(EnInsect* this, PlayState* play) { s32 temp_a0; s32 sp50; f32 phi_f0; @@ -713,7 +713,7 @@ void EnInsect_Dropped(EnInsect* this, GlobalContext* globalCtx) { } } -void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnInsect_Update(Actor* thisx, PlayState* play) { EnInsect* this = (EnInsect*)thisx; s32 tmp; @@ -733,7 +733,7 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { this->lifeTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { Actor_MoveForward(&this->actor); @@ -759,10 +759,10 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { if (tmp != 0) { tmp |= UPDBGCHECKINFO_FLAG_6; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 8.0f, 5.0f, 0.0f, tmp); + Actor_UpdateBgCheckInfo(play, &this->actor, 8.0f, 5.0f, 0.0f, tmp); } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; tmp = this->actor.params & 3; @@ -773,13 +773,13 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { } } else if (this->actor.xzDistToPlayer < 50.0f && this->actionFunc != EnInsect_Caught) { if (!(this->insectFlags & INSECT_FLAG_SOIL_CLOSE) && this->lifeTimer < 180) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (!(this->insectFlags & INSECT_FLAG_UNCATCHABLE) && sCaughtCount < 4 && - EnInsect_InBottleRange(this, globalCtx) && + EnInsect_InBottleRange(this, play) && // GI_MAX in this case allows the player to catch the actor in a bottle - func_8002F434(&this->actor, globalCtx, GI_MAX, 60.0f, 30.0f)) { + func_8002F434(&this->actor, play, GI_MAX, 60.0f, 30.0f)) { sCaughtCount++; } } @@ -788,11 +788,11 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnInsect_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnInsect_Draw(Actor* thisx, PlayState* play) { EnInsect* this = (EnInsect*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); Collider_UpdateSpheres(0, &this->collider); sCaughtCount = 0; } diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.h b/src/overlays/actors/ovl_En_Insect/z_en_insect.h index d4d676478b..2e1931bee4 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.h +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.h @@ -7,7 +7,7 @@ struct EnInsect; -typedef void (*EnInsectActionFunc)(struct EnInsect*, GlobalContext*); +typedef void (*EnInsectActionFunc)(struct EnInsect*, PlayState*); #define INSECT_FLAG_0 (1 << 0) #define INSECT_FLAG_1 (1 << 1) 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 c0a15d94e6..498aa0c141 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -13,21 +13,21 @@ #define FLAGS ACTOR_FLAG_23 -void EnIshi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIshi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIshi_Update(Actor* thisx, GlobalContext* globalCtx); -void EnIshi_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnIshi_Init(Actor* thisx, PlayState* play); +void EnIshi_Destroy(Actor* thisx, PlayState* play); +void EnIshi_Update(Actor* thisx, PlayState* play); +void EnIshi_Draw(Actor* thisx, PlayState* play); void EnIshi_SetupWait(EnIshi* this); -void EnIshi_Wait(EnIshi* this, GlobalContext* globalCtx); +void EnIshi_Wait(EnIshi* this, PlayState* play); void EnIshi_SetupLiftedUp(EnIshi* this); -void EnIshi_LiftedUp(EnIshi* this, GlobalContext* globalCtx); +void EnIshi_LiftedUp(EnIshi* this, PlayState* play); void EnIshi_SetupFly(EnIshi* this); -void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx); -void EnIshi_SpawnFragmentsSmall(EnIshi* this, GlobalContext* globalCtx); -void EnIshi_SpawnFragmentsLarge(EnIshi* this, GlobalContext* globalCtx); -void EnIshi_SpawnDustSmall(EnIshi* this, GlobalContext* globalCtx); -void EnIshi_SpawnDustLarge(EnIshi* this, GlobalContext* globalCtx); +void EnIshi_Fly(EnIshi* this, PlayState* play); +void EnIshi_SpawnFragmentsSmall(EnIshi* this, PlayState* play); +void EnIshi_SpawnFragmentsLarge(EnIshi* this, PlayState* play); +void EnIshi_SpawnDustSmall(EnIshi* this, PlayState* play); +void EnIshi_SpawnDustLarge(EnIshi* this, PlayState* play); static s16 sRotSpeedX = 0; static s16 sRotSpeedY = 0; @@ -102,15 +102,15 @@ static ColliderCylinderInit sCylinderInits[] = { static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 60, MASS_IMMOVABLE }; -void EnIshi_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnIshi_InitCollider(Actor* thisx, PlayState* play) { EnIshi* this = (EnIshi*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInits[this->actor.params & 1]); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInits[this->actor.params & 1]); Collider_UpdateCylinder(&this->actor, &this->collider); } -s32 EnIshi_SnapToFloor(EnIshi* this, GlobalContext* globalCtx, f32 arg2) { +s32 EnIshi_SnapToFloor(EnIshi* this, PlayState* play, f32 arg2) { CollisionPoly* poly; Vec3f pos; s32 bgId; @@ -119,7 +119,7 @@ s32 EnIshi_SnapToFloor(EnIshi* this, GlobalContext* globalCtx, f32 arg2) { 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_EntityRaycastFloor4(&globalCtx->colCtx, &poly, &bgId, &this->actor, &pos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &poly, &bgId, &this->actor, &pos); if (floorY > BGCHECK_Y_MIN) { this->actor.world.pos.y = floorY + arg2; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); @@ -133,7 +133,7 @@ s32 EnIshi_SnapToFloor(EnIshi* this, GlobalContext* globalCtx, f32 arg2) { } } -void EnIshi_SpawnFragmentsSmall(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_SpawnFragmentsSmall(EnIshi* this, PlayState* play) { static s16 scales[] = { 16, 13, 11, 9, 7, 5 }; s32 pad; Vec3f velocity; @@ -163,12 +163,12 @@ void EnIshi_SpawnFragmentsSmall(EnIshi* this, GlobalContext* globalCtx) { } else { phi_v0 = 33; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -420, phi_v0, 30, 5, 0, scales[i], 3, 10, 40, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -420, phi_v0, 30, 5, 0, scales[i], 3, 10, 40, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, gFieldKakeraDL); } } -void EnIshi_SpawnFragmentsLarge(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_SpawnFragmentsLarge(EnIshi* this, PlayState* play) { static s16 scales[] = { 145, 135, 120, 100, 70, 50, 45, 40, 35 }; Actor* thisx = &this->actor; Vec3f velocity; @@ -209,12 +209,12 @@ void EnIshi_SpawnFragmentsLarge(EnIshi* this, GlobalContext* globalCtx) { phi_v0 = 69; phi_v1 = -320; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, phi_v1, phi_v0, 30, 5, 0, scales[i], 5, - 2, 70, KAKERA_COLOR_WHITE, OBJECT_GAMEPLAY_FIELD_KEEP, gSilverRockFragmentsDL); + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, phi_v1, phi_v0, 30, 5, 0, scales[i], 5, 2, + 70, KAKERA_COLOR_WHITE, OBJECT_GAMEPLAY_FIELD_KEEP, gSilverRockFragmentsDL); } } -void EnIshi_SpawnDustSmall(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_SpawnDustSmall(EnIshi* this, PlayState* play) { Vec3f pos; Math_Vec3f_Copy(&pos, &this->actor.world.pos); @@ -227,10 +227,10 @@ void EnIshi_SpawnDustSmall(EnIshi* this, GlobalContext* globalCtx) { pos.y += 2.0f * this->actor.velocity.y; pos.z -= 2.0f * this->actor.velocity.z; } - func_80033480(globalCtx, &pos, 60.0f, 3, 0x50, 0x3C, 1); + func_80033480(play, &pos, 60.0f, 3, 0x50, 0x3C, 1); } -void EnIshi_SpawnDustLarge(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_SpawnDustLarge(EnIshi* this, PlayState* play) { Vec3f pos; Math_Vec3f_Copy(&pos, &this->actor.world.pos); @@ -243,10 +243,10 @@ void EnIshi_SpawnDustLarge(EnIshi* this, GlobalContext* globalCtx) { pos.y += 2.0f * this->actor.velocity.y; pos.z -= 2.0f * this->actor.velocity.z; } - func_80033480(globalCtx, &pos, 140.0f, 0xA, 0xB4, 0x5A, 1); + func_80033480(play, &pos, 140.0f, 0xA, 0xB4, 0x5A, 1); } -void EnIshi_DropCollectible(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_DropCollectible(EnIshi* this, PlayState* play) { s16 dropParams; if ((this->actor.params & 1) == ROCK_SMALL) { @@ -256,7 +256,7 @@ void EnIshi_DropCollectible(EnIshi* this, GlobalContext* globalCtx) { dropParams = 0; } - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, dropParams << 4); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, dropParams << 4); } } @@ -275,13 +275,13 @@ void func_80A7ED94(Vec3f* arg0, f32 arg1) { arg0->z -= arg0->z * arg1; } -void EnIshi_SpawnBugs(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_SpawnBugs(EnIshi* this, PlayState* play) { s32 i; for (i = 0; i < 3; i++) { - Actor* bug = Actor_Spawn(&globalCtx->actorCtx, globalCtx, 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); + 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); if (bug == NULL) { break; @@ -306,75 +306,75 @@ static InitChainEntry sInitChains[][5] = { }, }; -void EnIshi_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIshi_Init(Actor* thisx, PlayState* play) { EnIshi* this = (EnIshi*)thisx; s16 type = this->actor.params & 1; Actor_ProcessInitChain(&this->actor, sInitChains[type]); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.uncullZoneForward += 1000.0f; } if (this->actor.shape.rot.y == 0) { this->actor.shape.rot.y = this->actor.world.rot.y = Rand_ZeroFloat(0x10000); } Actor_SetScale(&this->actor, sRockScales[type]); - EnIshi_InitCollider(&this->actor, globalCtx); + EnIshi_InitCollider(&this->actor, play); if ((type == ROCK_LARGE) && - Flags_GetSwitch(globalCtx, ((this->actor.params >> 0xA) & 0x3C) | ((this->actor.params >> 6) & 3))) { + Flags_GetSwitch(play, ((this->actor.params >> 0xA) & 0x3C) | ((this->actor.params >> 6) & 3))) { Actor_Kill(&this->actor); return; } CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->actor.shape.yOffset = D_80A7FA20[type]; - if (!((this->actor.params >> 5) & 1) && !EnIshi_SnapToFloor(this, globalCtx, 0.0f)) { + if (!((this->actor.params >> 5) & 1) && !EnIshi_SnapToFloor(this, play, 0.0f)) { Actor_Kill(&this->actor); return; } EnIshi_SetupWait(this); } -void EnIshi_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnIshi_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnIshi* this = (EnIshi*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnIshi_SetupWait(EnIshi* this) { this->actionFunc = EnIshi_Wait; } -void EnIshi_Wait(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_Wait(EnIshi* this, PlayState* play) { static u16 liftSounds[] = { NA_SE_PL_PULL_UP_ROCK, NA_SE_PL_PULL_UP_BIGROCK }; s32 pad; s16 type = this->actor.params & 1; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { EnIshi_SetupLiftedUp(this); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, liftSounds[type]); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, liftSounds[type]); if ((this->actor.params >> 4) & 1) { - EnIshi_SpawnBugs(this, globalCtx); + EnIshi_SpawnBugs(this, play); } } else if ((this->collider.base.acFlags & AC_HIT) && (type == ROCK_SMALL) && this->collider.info.acHitInfo->toucher.dmgFlags & 0x40000048) { - EnIshi_DropCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, sBreakSoundDurations[type], + EnIshi_DropCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, sBreakSoundDurations[type], sBreakSounds[type]); - sFragmentSpawnFuncs[type](this, globalCtx); - sDustSpawnFuncs[type](this, globalCtx); + sFragmentSpawnFuncs[type](this, play); + sDustSpawnFuncs[type](this, play); 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(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 400.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + 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) { - func_8002F434(&this->actor, globalCtx, GI_NONE, 80.0f, 20.0f); + func_8002F434(&this->actor, play, GI_NONE, 80.0f, 20.0f); } else { - func_8002F434(&this->actor, globalCtx, GI_NONE, 50.0f, 10.0f); + func_8002F434(&this->actor, play, GI_NONE, 50.0f, 10.0f); } } } @@ -387,17 +387,17 @@ void EnIshi_SetupLiftedUp(EnIshi* this) { this->actor.flags |= ACTOR_FLAG_4; } -void EnIshi_LiftedUp(EnIshi* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.curRoom.num; +void EnIshi_LiftedUp(EnIshi* this, PlayState* play) { + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.curRoom.num; if ((this->actor.params & 1) == ROCK_LARGE) { - Flags_SetSwitch(globalCtx, ((this->actor.params >> 0xA) & 0x3C) | ((this->actor.params >> 6) & 3)); + Flags_SetSwitch(play, ((this->actor.params >> 0xA) & 0x3C) | ((this->actor.params >> 6) & 3)); } EnIshi_SetupFly(this); EnIshi_Fall(this); func_80A7ED94(&this->actor.velocity, D_80A7FA28[this->actor.params & 1]); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_6 | UPDBGCHECKINFO_FLAG_7); } @@ -417,7 +417,7 @@ void EnIshi_SetupFly(EnIshi* this) { this->actionFunc = EnIshi_Fly; } -void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { +void EnIshi_Fly(EnIshi* this, PlayState* play) { s32 pad; s16 type = this->actor.params & 1; s32 pad2; @@ -425,15 +425,15 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { Vec3f contactPos; if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) { - EnIshi_DropCollectible(this, globalCtx); - sFragmentSpawnFuncs[type](this, globalCtx); + EnIshi_DropCollectible(this, play); + sFragmentSpawnFuncs[type](this, play); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, sBreakSoundDurations[type], + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, sBreakSoundDurations[type], sBreakSounds[type]); - sDustSpawnFuncs[type](this, globalCtx); + sDustSpawnFuncs[type](this, play); } if (type == ROCK_LARGE) { - quakeIdx = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quakeIdx = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quakeIdx, -0x3CB0); Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0); Quake_SetCountdown(quakeIdx, 7); @@ -446,20 +446,20 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { contactPos.x = this->actor.world.pos.x; contactPos.y = this->actor.world.pos.y + this->actor.yDistToWater; contactPos.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &contactPos, 0, 0, 0, 350); + EffectSsGSplash_Spawn(play, &contactPos, 0, 0, 0, 350); if (type == ROCK_SMALL) { - EffectSsGRipple_Spawn(globalCtx, &contactPos, 150, 650, 0); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 400, 800, 4); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 500, 1100, 8); + EffectSsGRipple_Spawn(play, &contactPos, 150, 650, 0); + EffectSsGRipple_Spawn(play, &contactPos, 400, 800, 4); + EffectSsGRipple_Spawn(play, &contactPos, 500, 1100, 8); } else { - EffectSsGRipple_Spawn(globalCtx, &contactPos, 300, 700, 0); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 500, 900, 4); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 500, 1300, 8); + EffectSsGRipple_Spawn(play, &contactPos, 300, 700, 0); + EffectSsGRipple_Spawn(play, &contactPos, 500, 900, 4); + EffectSsGRipple_Spawn(play, &contactPos, 500, 1300, 8); } this->actor.minVelocityY = -6.0f; sRotSpeedX >>= 2; sRotSpeedY >>= 2; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; } Math_StepToF(&this->actor.shape.yOffset, 0.0f, 2.0f); @@ -468,39 +468,39 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); this->actor.shape.rot.x += sRotSpeedX; this->actor.shape.rot.y += sRotSpeedY; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, + 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(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnIshi_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIshi_Update(Actor* thisx, PlayState* play) { EnIshi* this = (EnIshi*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnIshi_DrawSmall(EnIshi* this, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gFieldKakeraDL); +void EnIshi_DrawSmall(EnIshi* this, PlayState* play) { + Gfx_DrawDListOpa(play, gFieldKakeraDL); } -void EnIshi_DrawLarge(EnIshi* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ishi.c", 1050); +void EnIshi_DrawLarge(EnIshi* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_en_ishi.c", 1050); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ishi.c", 1055), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ishi.c", 1055), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); gSPDisplayList(POLY_OPA_DISP++, gSilverRockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ishi.c", 1062); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ishi.c", 1062); } static EnIshiDrawFunc sDrawFuncs[] = { EnIshi_DrawSmall, EnIshi_DrawLarge }; -void EnIshi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnIshi_Draw(Actor* thisx, PlayState* play) { EnIshi* this = (EnIshi*)thisx; - sDrawFuncs[this->actor.params & 1](this, globalCtx); + sDrawFuncs[this->actor.params & 1](this, play); } diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h index e1566db3c4..3ce7c72bf3 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h @@ -11,9 +11,9 @@ typedef enum { struct EnIshi; -typedef void (*EnIshiActionFunc)(struct EnIshi*, GlobalContext*); -typedef void (*EnIshiEffectSpawnFunc)(struct EnIshi*, GlobalContext*); -typedef void (*EnIshiDrawFunc)(struct EnIshi*, GlobalContext*); +typedef void (*EnIshiActionFunc)(struct EnIshi*, PlayState*); +typedef void (*EnIshiEffectSpawnFunc)(struct EnIshi*, PlayState*); +typedef void (*EnIshiDrawFunc)(struct EnIshi*, PlayState*); typedef struct EnIshi { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_It/z_en_it.c b/src/overlays/actors/ovl_En_It/z_en_it.c index 424f5a06b8..aaa75343a6 100644 --- a/src/overlays/actors/ovl_En_It/z_en_it.c +++ b/src/overlays/actors/ovl_En_It/z_en_it.c @@ -8,9 +8,9 @@ #define FLAGS 0 -void EnIt_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIt_Update(Actor* thisx, GlobalContext* globalCtx); +void EnIt_Init(Actor* thisx, PlayState* play); +void EnIt_Destroy(Actor* thisx, PlayState* play); +void EnIt_Update(Actor* thisx, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -46,25 +46,25 @@ const ActorInit En_It_InitVars = { (ActorFunc)NULL, }; -void EnIt_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIt_Init(Actor* thisx, PlayState* play) { EnIt* this = (EnIt*)thisx; this->actor.params = 0x0D05; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, 0, &sColChkInfoInit); } -void EnIt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnIt_Destroy(Actor* thisx, PlayState* play) { EnIt* this = (EnIt*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnIt_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIt_Update(Actor* thisx, PlayState* play) { EnIt* this = (EnIt*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } 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 6e13f4aac6..b83cea3f46 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -17,16 +17,16 @@ typedef enum { /* 3 */ JABUJABU_EYE_MAX } EnJjEyeState; -void EnJj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJj_Draw(Actor* thisx, GlobalContext* globalCtx); +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* play); -void EnJj_UpdateStaticCollision(Actor* thisx, GlobalContext* globalCtx); -void EnJj_WaitToOpenMouth(EnJj* this, GlobalContext* globalCtx); -void EnJj_WaitForFish(EnJj* this, GlobalContext* globalCtx); -void EnJj_BeginCutscene(EnJj* this, GlobalContext* globalCtx); -void EnJj_RemoveDust(EnJj* this, GlobalContext* globalCtx); +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); const ActorInit En_Jj_InitVars = { ACTOR_EN_JJ, @@ -77,8 +77,8 @@ void EnJj_SetupAction(EnJj* this, EnJjActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnJj_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnJj* this = (EnJj*)thisx; CollisionHeader* colHeader = NULL; @@ -87,7 +87,7 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) { switch (this->dyna.actor.params) { case JABUJABU_MAIN: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gJabuJabuSkel, &gJabuJabuAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gJabuJabuSkel, &gJabuJabuAnim, this->jointTable, this->morphTable, 22); Animation_PlayLoop(&this->skelAnime, &gJabuJabuAnim); this->unk_30A = 0; @@ -103,22 +103,22 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) { } this->bodyCollisionActor = (DynaPolyActor*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, + &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); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gJabuJabuHeadCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + 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; break; case JABUJABU_COLLISION: DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gJabuJabuBodyCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - func_8003ECA8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + func_8003ECA8(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.update = EnJj_UpdateStaticCollision; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); @@ -127,7 +127,7 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) { case JABUJABU_UNUSED_COLLISION: DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gJabuJabuUnusedCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.actor.update = EnJj_UpdateStaticCollision; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); @@ -135,18 +135,18 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJj_Destroy(Actor* thisx, PlayState* play) { EnJj* this = (EnJj*)thisx; switch (this->dyna.actor.params) { case JABUJABU_MAIN: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); break; case JABUJABU_COLLISION: case JABUJABU_UNUSED_COLLISION: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); break; } } @@ -174,30 +174,29 @@ void EnJj_Blink(EnJj* this) { } } -void EnJj_OpenMouth(EnJj* this, GlobalContext* globalCtx) { +void EnJj_OpenMouth(EnJj* this, PlayState* play) { DynaPolyActor* bodyCollisionActor = this->bodyCollisionActor; if (this->mouthOpenAngle >= -5200) { this->mouthOpenAngle -= 102; if (this->mouthOpenAngle < -2600) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, bodyCollisionActor->bgId); + func_8003EBF8(play, &play->colCtx.dyna, bodyCollisionActor->bgId); } } } -void EnJj_WaitToOpenMouth(EnJj* this, GlobalContext* globalCtx) { +void EnJj_WaitToOpenMouth(EnJj* this, PlayState* play) { if (this->dyna.actor.xzDistToPlayer < 300.0f) { EnJj_SetupAction(this, EnJj_OpenMouth); } } -void EnJj_WaitForFish(EnJj* this, GlobalContext* globalCtx) { +void EnJj_WaitForFish(EnJj* this, PlayState* play) { static Vec3f feedingSpot = { -1589.0f, 53.0f, -43.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if ((Math_Vec3f_DistXZ(&feedingSpot, &player->actor.world.pos) < 300.0f) && - globalCtx->isPlayerDroppingFish(globalCtx)) { + if ((Math_Vec3f_DistXZ(&feedingSpot, &player->actor.world.pos) < 300.0f) && play->isPlayerDroppingFish(play)) { this->cutsceneCountdownTimer = 100; EnJj_SetupAction(this, EnJj_BeginCutscene); } @@ -205,27 +204,27 @@ void EnJj_WaitForFish(EnJj* this, GlobalContext* globalCtx) { this->collider.dim.pos.x = -1245; this->collider.dim.pos.y = 20; this->collider.dim.pos.z = -48; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnJj_BeginCutscene(EnJj* this, GlobalContext* globalCtx) { +void EnJj_BeginCutscene(EnJj* this, PlayState* play) { DynaPolyActor* bodyCollisionActor = this->bodyCollisionActor; if (this->cutsceneCountdownTimer > 0) { this->cutsceneCountdownTimer--; } else { EnJj_SetupAction(this, EnJj_RemoveDust); - globalCtx->csCtx.segment = &D_80A88164; + play->csCtx.segment = &D_80A88164; gSaveContext.cutsceneTrigger = 1; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, bodyCollisionActor->bgId); - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8003EBF8(play, &play->colCtx.dyna, bodyCollisionActor->bgId); + func_8005B1A4(GET_ACTIVE_CAM(play)); SET_EVENTCHKINF(EVENTCHKINF_3A); func_80078884(NA_SE_SY_CORRECT_CHIME); } } -void EnJj_CutsceneUpdate(EnJj* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.npcActions[2]->action) { +void EnJj_CutsceneUpdate(EnJj* this, PlayState* play) { + switch (play->csCtx.npcActions[2]->action) { case 1: if (this->unk_30A & 2) { this->eyeIndex = 0; @@ -240,8 +239,8 @@ void EnJj_CutsceneUpdate(EnJj* this, GlobalContext* globalCtx) { this->unk_30A |= 1; if (!(this->unk_30A & 8)) { - this->dust = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EFF_DUST, - -1100.0f, 105.0f, -27.0f, 0, 0, 0, EFF_DUST_TYPE_0); + 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; } break; @@ -266,7 +265,7 @@ void EnJj_CutsceneUpdate(EnJj* this, GlobalContext* globalCtx) { } } -void EnJj_RemoveDust(EnJj* this, GlobalContext* globalCtx) { +void EnJj_RemoveDust(EnJj* this, PlayState* play) { Actor* dust; if (!(this->unk_30A & 4)) { @@ -280,16 +279,16 @@ void EnJj_RemoveDust(EnJj* this, GlobalContext* globalCtx) { } } -void EnJj_UpdateStaticCollision(Actor* thisx, GlobalContext* globalCtx) { +void EnJj_UpdateStaticCollision(Actor* thisx, PlayState* play) { } -void EnJj_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnJj_Update(Actor* thisx, PlayState* play) { EnJj* this = (EnJj*)thisx; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[2] != NULL)) { - EnJj_CutsceneUpdate(this, globalCtx); + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[2] != NULL)) { + EnJj_CutsceneUpdate(this, play); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->skelAnime.curFrame == 41.0f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_JABJAB_GROAN); @@ -304,19 +303,19 @@ void EnJj_Update(Actor* thisx, GlobalContext* globalCtx) { this->skelAnime.jointTable[10].z = this->mouthOpenAngle; } -void EnJj_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnJj_Draw(Actor* thisx, PlayState* play2) { static void* eyeTextures[] = { gJabuJabuEyeOpenTex, gJabuJabuEyeHalfTex, gJabuJabuEyeClosedTex }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnJj* this = (EnJj*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_jj.c", 879); + OPEN_DISPS(play->state.gfxCtx, "../z_en_jj.c", 879); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); Matrix_Translate(0.0f, (cosf(this->skelAnime.curFrame * (M_PI / 41.0f)) * 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(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_jj.c", 898); + 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 3733cc976a..3d5a9dc154 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.h +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.h @@ -6,7 +6,7 @@ struct EnJj; -typedef void (*EnJjActionFunc)(struct EnJj*, GlobalContext*); +typedef void (*EnJjActionFunc)(struct EnJj*, PlayState*); typedef struct EnJj { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index 56c4a99324..798b12bfc2 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnJs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnJs_Init(Actor* thisx, PlayState* play); +void EnJs_Destroy(Actor* thisx, PlayState* play); +void EnJs_Update(Actor* thisx, PlayState* play); +void EnJs_Draw(Actor* thisx, PlayState* play); -void func_80A89304(EnJs* this, GlobalContext* globalCtx); +void func_80A89304(EnJs* this, PlayState* play); const ActorInit En_Js_InitVars = { ACTOR_EN_JS, @@ -52,35 +52,35 @@ void En_Js_SetupAction(EnJs* this, EnJsActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnJs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnJs_Init(Actor* thisx, PlayState* play) { EnJs* this = (EnJs*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCarpetMerchantSkel, &gCarpetMerchantSlappingKneeAnim, - this->jointTable, this->morphTable, 13); + SkelAnime_InitFlex(play, &this->skelAnime, &gCarpetMerchantSkel, &gCarpetMerchantSlappingKneeAnim, this->jointTable, + this->morphTable, 13); Animation_PlayOnce(&this->skelAnime, &gCarpetMerchantSlappingKneeAnim); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &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); En_Js_SetupAction(this, func_80A89304); this->unk_284 = 0; this->actor.gravity = -1.0f; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_JSJUTAN, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_JSJUTAN, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } -void EnJs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJs_Destroy(Actor* thisx, PlayState* play) { EnJs* this = (EnJs*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -u8 func_80A88F64(EnJs* this, GlobalContext* globalCtx, u16 textId) { +u8 func_80A88F64(EnJs* this, PlayState* play, u16 textId) { s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { return 1; } else { this->actor.textId = textId; @@ -88,7 +88,7 @@ u8 func_80A88F64(EnJs* this, GlobalContext* globalCtx, u16 textId) { if (ABS(yawDiff) <= 0x1800 && this->actor.xzDistToPlayer < 100.0f) { this->unk_284 |= 1; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } return 0; } @@ -100,44 +100,44 @@ void func_80A89008(EnJs* this) { Animation_GetLastFrame(&gCarpetMerchantSlappingKneeAnim), ANIMMODE_ONCE, -4.0f); } -void func_80A89078(EnJs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A89078(EnJs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80A89008(this); this->actor.flags &= ~ACTOR_FLAG_16; } } -void func_80A890C0(EnJs* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80A890C0(EnJs* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { En_Js_SetupAction(this, func_80A89078); } else { - func_8002F2CC(&this->actor, globalCtx, 1000.0f); + func_8002F2CC(&this->actor, play, 1000.0f); } } -void func_80A8910C(EnJs* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80A8910C(EnJs* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.textId = 0x6078; En_Js_SetupAction(this, func_80A890C0); this->actor.flags |= ACTOR_FLAG_16; } } -void func_80A89160(EnJs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A89160(EnJs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; En_Js_SetupAction(this, func_80A8910C); } else { - func_8002F434(&this->actor, globalCtx, GI_BOMBCHUS_10, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_BOMBCHUS_10, 10000.0f, 50.0f); } } -void func_80A891C4(EnJs* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80A891C4(EnJs* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes if (gSaveContext.rupees < 200) { - Message_ContinueTextbox(globalCtx, 0x6075); + Message_ContinueTextbox(play, 0x6075); func_80A89008(this); } else { Rupees_ChangeBy(-200); @@ -145,7 +145,7 @@ void func_80A891C4(EnJs* this, GlobalContext* globalCtx) { } break; case 1: // no - Message_ContinueTextbox(globalCtx, 0x6074); + Message_ContinueTextbox(play, 0x6074); func_80A89008(this); } } @@ -157,24 +157,24 @@ void func_80A89294(EnJs* this) { Animation_GetLastFrame(&gCarpetMerchantIdleAnim), ANIMMODE_ONCE, -4.0f); } -void func_80A89304(EnJs* this, GlobalContext* globalCtx) { - if (func_80A88F64(this, globalCtx, 0x6077)) { +void func_80A89304(EnJs* this, PlayState* play) { + if (func_80A88F64(this, play, 0x6077)) { func_80A89294(this); } } -void EnJs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnJs_Update(Actor* thisx, PlayState* play) { EnJs* this = (EnJs*)thisx; s32 pad; s32 pad2; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - if (SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1) { + if (SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1) { Math_ApproachF(&this->actor.shape.yOffset, sREG(80) + -2000.0f, 1.0f, (sREG(81) / 10.0f) + 50.0f); } } else { @@ -183,9 +183,9 @@ void EnJs_Update(Actor* thisx, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { this->skelAnime.curFrame = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_284 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_278, &this->unk_27E, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_278, &this->unk_27E, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_278.x, 0, 6, 0x1838, 0x64); Math_SmoothStepToS(&this->unk_278.y, 0, 6, 0x1838, 0x64); @@ -205,7 +205,7 @@ void EnJs_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnJs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnJs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnJs* this = (EnJs*)thisx; if (limbIndex == 12) { @@ -214,7 +214,7 @@ s32 EnJs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnJs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnJs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80A896DC = { 0.0f, 0.0f, 0.0f }; EnJs* this = (EnJs*)thisx; @@ -222,10 +222,10 @@ void EnJs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Matrix_MultVec3f(&D_80A896DC, &this->actor.focus.pos); } } -void EnJs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnJs_Draw(Actor* thisx, PlayState* play) { EnJs* this = (EnJs*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnJs_OverrideLimbDraw, EnJs_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.h b/src/overlays/actors/ovl_En_Js/z_en_js.h index 7653b15d3c..f1e356b2c1 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.h +++ b/src/overlays/actors/ovl_En_Js/z_en_js.h @@ -6,7 +6,7 @@ struct EnJs; -typedef void (*EnJsActionFunc)(struct EnJs*, GlobalContext*); +typedef void (*EnJsActionFunc)(struct EnJs*, PlayState*); typedef struct EnJs { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index 74d37040e3..956d97c2d4 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnJsjutan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJsjutan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJsjutan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnJsjutan_Init(Actor* thisx, PlayState* play); +void EnJsjutan_Destroy(Actor* thisx, PlayState* play); +void EnJsjutan_Update(Actor* thisx, PlayState* play); +void EnJsjutan_Draw(Actor* thisx, PlayState* play); const ActorInit En_Jsjutan_InitVars = { ACTOR_EN_JSJUTAN, @@ -35,7 +35,7 @@ static s32 sUnused[2] = { 0, 0 }; #include "overlays/ovl_En_Jsjutan/ovl_En_Jsjutan.c" -void EnJsjutan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnJsjutan_Init(Actor* thisx, PlayState* play) { EnJsjutan* this = (EnJsjutan*)thisx; s32 pad; CollisionHeader* header = NULL; @@ -43,19 +43,19 @@ void EnJsjutan_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.flags &= ~ACTOR_FLAG_0; DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&sCol, &header); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, header); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, header); Actor_SetScale(thisx, 0.02f); this->unk_164 = true; this->shadowAlpha = 100.0f; } -void EnJsjutan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJsjutan_Destroy(Actor* thisx, PlayState* play) { EnJsjutan* this = (EnJsjutan*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80A89860(EnJsjutan* this, GlobalContext* globalCtx) { +void func_80A89860(EnJsjutan* this, PlayState* play) { s16 i; Vtx* oddVtx; Vtx* evenVtx; @@ -72,14 +72,14 @@ void func_80A89860(EnJsjutan* this, GlobalContext* globalCtx) { } else { this->dyna.actor.world.pos.x = oddVtx->v.ob[0] * 0.02f + actorPos.x; this->dyna.actor.world.pos.z = oddVtx->v.ob[2] * 0.02f + actorPos.z; - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_2); oddVtx->v.ob[1] = evenVtx->v.ob[1] = this->dyna.actor.floorHeight; this->dyna.actor.world.pos = actorPos; } } } -void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { +void func_80A89A6C(EnJsjutan* this, PlayState* play) { u8 isPlayerOnTop = false; // sp127 s16 i; s16 j; @@ -111,12 +111,12 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { f32 maxOffset; f32 maxAmp; f32 waveform; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* parent = this->dyna.actor.parent; - Actor* actorExplosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + Actor* actorExplosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; u8 isInCreditsScene = false; // sp8B - if (globalCtx->gameplayFrames % 2 != 0) { + if (play->gameplayFrames % 2 != 0) { carpetVtx = SEGMENTED_TO_VIRTUAL(sCarpetOddVtx); shadowVtx = SEGMENTED_TO_VIRTUAL(gShadowOddVtx); } else { @@ -150,7 +150,7 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { if ((gSaveContext.entranceIndex == ENTR_SPOT20_0) && (gSaveContext.sceneSetupIndex == 8)) { isInCreditsScene = true; - actorProfessor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + actorProfessor = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (actorProfessor != NULL) { if (actorProfessor->id == ACTOR_EN_MK) { break; @@ -158,7 +158,7 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { actorProfessor = actorProfessor->next; } - actorBeanGuy = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + actorBeanGuy = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (actorBeanGuy != NULL) { if (actorBeanGuy->id == ACTOR_EN_MS) { break; @@ -269,7 +269,7 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { * A: spA8 * D: phi_f28 */ - waveform = spA8 * Math_SinS(globalCtx->gameplayFrames * 4000 + i * 10000); + waveform = spA8 * Math_SinS(play->gameplayFrames * 4000 + i * 10000); if (this->unk_174) { s16 phi_v1_4 = offset + waveform; @@ -357,20 +357,20 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { } } -void EnJsjutan_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnJsjutan_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; - thisx->shape.rot.x = Math_SinS(globalCtx->gameplayFrames * 3000) * 300.0f; - thisx->shape.rot.z = Math_CosS(globalCtx->gameplayFrames * 3500) * 300.0f; + thisx->shape.rot.x = Math_SinS(play->gameplayFrames * 3000) * 300.0f; + thisx->shape.rot.z = Math_CosS(play->gameplayFrames * 3500) * 300.0f; } -void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnJsjutan_Draw(Actor* thisx, PlayState* play2) { EnJsjutan* this = (EnJsjutan*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s16 i; Actor* parent = thisx->parent; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_jsjutan.c", 701); + OPEN_DISPS(play->state.gfxCtx, "../z_en_jsjutan.c", 701); if (thisx->params == ENJSJUTAN_TYPE_01) { thisx->world.pos.x = parent->world.pos.x; @@ -379,7 +379,7 @@ void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { this->unk_168 = thisx->world.pos.y; if (!this->unk_175) { this->unk_175 = true; - func_80A89860(this, globalCtx); + func_80A89860(this, play); } } else if (!this->unk_175) { this->unk_175 = true; @@ -387,10 +387,10 @@ void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { thisx->world.pos.y = (parent->world.pos.y + 5.0f) - 10.0f; thisx->world.pos.z = Math_CosS(parent->shape.rot.y) * 60.0f + parent->world.pos.z; this->unk_168 = thisx->world.pos.y; - func_80A89860(this, globalCtx); + func_80A89860(this, play); } - func_80A89A6C(this, globalCtx); + func_80A89A6C(this, play); if (this->unk_164) { this->unk_164 = false; for (i = 0; i < ARRAY_COUNT(sShadowTex); i++) { @@ -401,14 +401,14 @@ void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { } } } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (s16)this->shadowAlpha); Matrix_Translate(thisx->world.pos.x, 3.0f, thisx->world.pos.z, MTXMODE_NEW); Matrix_Scale(thisx->scale.x, 1.0f, thisx->scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_jsjutan.c", 782), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_jsjutan.c", 782), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); // Draws the carpet's shadow texture. @@ -416,18 +416,18 @@ void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { gDPPipeSync(POLY_OPA_DISP++); // Draws the carpet's shadow vertices. Swaps them between frames to get a smoother result. - if (globalCtx->gameplayFrames % 2 != 0) { + if (play->gameplayFrames % 2 != 0) { gSPSegment(POLY_OPA_DISP++, 0x0C, gShadowOddVtx); } else { gSPSegment(POLY_OPA_DISP++, 0x0C, sShadowEvenVtx); } gSPDisplayList(POLY_OPA_DISP++, sModelDL); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(thisx->world.pos.x, this->unk_168 + 3.0f, thisx->world.pos.z, MTXMODE_NEW); Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_jsjutan.c", 805), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_jsjutan.c", 805), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); // Draws the carpet's texture. gSPDisplayList(POLY_OPA_DISP++, sCarpetMaterialDL); @@ -435,12 +435,12 @@ void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { gDPPipeSync(POLY_OPA_DISP++); // Draws the carpet vertices. - if (globalCtx->gameplayFrames % 2 != 0) { + if (play->gameplayFrames % 2 != 0) { gSPSegment(POLY_OPA_DISP++, 0x0C, sCarpetOddVtx); } else { gSPSegment(POLY_OPA_DISP++, 0x0C, sCarpetEvenVtx); } gSPDisplayList(POLY_OPA_DISP++, sModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_jsjutan.c", 823); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_jsjutan.c", 823); } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 28526ef564..446a70a727 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -10,17 +10,17 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_25) -void EnKakasi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKakasi_Init(Actor* thisx, PlayState* play); +void EnKakasi_Destroy(Actor* thisx, PlayState* play); +void EnKakasi_Update(Actor* thisx, PlayState* play); +void EnKakasi_Draw(Actor* thisx, PlayState* play); -void func_80A8F660(EnKakasi* this, GlobalContext* globalCtx); -void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx); -void func_80A8F8D0(EnKakasi* this, GlobalContext* globalCtx); -void func_80A8F9C8(EnKakasi* this, GlobalContext* globalCtx); -void func_80A8FBB8(EnKakasi* this, GlobalContext* globalCtx); -void func_80A8FAA4(EnKakasi* this, GlobalContext* globalCtx); +void func_80A8F660(EnKakasi* this, PlayState* play); +void func_80A8F75C(EnKakasi* this, PlayState* play); +void func_80A8F8D0(EnKakasi* this, PlayState* play); +void func_80A8F9C8(EnKakasi* this, PlayState* play); +void func_80A8FBB8(EnKakasi* this, PlayState* play); +void func_80A8FAA4(EnKakasi* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -54,23 +54,23 @@ const ActorInit En_Kakasi_InitVars = { (ActorFunc)EnKakasi_Draw, }; -void EnKakasi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Destroy(Actor* thisx, PlayState* play) { EnKakasi* this = (EnKakasi*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); //! @bug SkelAnime_Free is not called } -void EnKakasi_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Init(Actor* thisx, PlayState* play) { EnKakasi* this = (EnKakasi*)thisx; osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ Let’s DANCE! ☆☆☆☆☆ %f\n" VT_RST, this->actor.world.pos.y); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.targetMode = 6; - SkelAnime_InitFlex(globalCtx, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); this->rot = this->actor.world.rot; this->actor.flags |= ACTOR_FLAG_10; @@ -91,8 +91,8 @@ void func_80A8F28C(EnKakasi* this) { Math_SmoothStepToS(&this->actor.shape.rot.z, this->rot.z, 5, 0x2710, 0); } -void func_80A8F320(EnKakasi* this, GlobalContext* globalCtx, s16 arg) { - s16 ocarinaNote = globalCtx->msgCtx.lastOcarinaButtonIndex; +void func_80A8F320(EnKakasi* this, PlayState* play, s16 arg) { + s16 ocarinaNote = play->msgCtx.lastOcarinaButtonIndex; s16 currentFrame; if (arg != 0) { @@ -169,7 +169,7 @@ void func_80A8F320(EnKakasi* this, GlobalContext* globalCtx, s16 arg) { } } -void func_80A8F660(EnKakasi* this, GlobalContext* globalCtx) { +void func_80A8F660(EnKakasi* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&object_ka_Anim_000214); Animation_Change(&this->skelanime, &object_ka_Anim_000214, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -192,13 +192,13 @@ void func_80A8F660(EnKakasi* this, GlobalContext* globalCtx) { this->actionFunc = func_80A8F75C; } -void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A8F75C(EnKakasi* this, PlayState* play) { + Player* player = GET_PLAYER(play); func_80A8F28C(this); SkelAnime_Update(&this->skelanime); this->subCamId = CAM_ID_NONE; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->unk_196 == TEXT_STATE_EVENT) { this->actionFunc = func_80A8F9C8; } else { @@ -213,9 +213,9 @@ void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) { if (absyawTowardsPlayer < 0x4300) { if (!this->unk_194) { if (player->stateFlags2 & PLAYER_STATE2_24) { - this->subCamId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, CAM_ID_MAIN); + this->subCamId = OnePointCutscene_Init(play, 2260, -99, &this->actor, CAM_ID_MAIN); - func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_LONG_RECORDING); + func_8010BD58(play, OCARINA_ACTION_SCARECROW_LONG_RECORDING); this->unk_19A = 0; this->unk_1B8 = 0.0; player->stateFlags2 |= PLAYER_STATE2_23; @@ -226,93 +226,93 @@ void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) { player->stateFlags2 |= PLAYER_STATE2_23; } } - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } } -void func_80A8F8D0(EnKakasi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A8F8D0(EnKakasi* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04 && globalCtx->msgCtx.msgMode == MSGMODE_NONE) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04 && play->msgCtx.msgMode == MSGMODE_NONE) { // "end?" osSyncPrintf(VT_FGCOL(BLUE) "☆☆☆☆☆ 終り? ☆☆☆☆☆ \n" VT_RST); if (this->unk_19A != 0) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.textId = 0x4077; this->unk_196 = TEXT_STATE_EVENT; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->actionFunc = func_80A8F9C8; } else { - OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + OnePointCutscene_EndCutscene(play, this->subCamId); this->subCamId = CAM_ID_NONE; this->actionFunc = func_80A8F660; } - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { - func_80A8F320(this, globalCtx, 0); + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { + func_80A8F320(this, play, 0); player->stateFlags2 |= PLAYER_STATE2_23; } } -void func_80A8F9C8(EnKakasi* this, GlobalContext* globalCtx) { +void func_80A8F9C8(EnKakasi* this, PlayState* play) { func_80A8F28C(this); SkelAnime_Update(&this->skelanime); - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); - if (this->unk_196 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { + if (this->unk_196 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { if (this->subCamId != CAM_ID_NONE) { - func_8005B1A4(globalCtx->cameraPtrs[this->subCamId]); + func_8005B1A4(play->cameraPtrs[this->subCamId]); } - this->subCamId = OnePointCutscene_Init(globalCtx, 2270, -99, &this->actor, CAM_ID_MAIN); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - func_8002DF54(globalCtx, NULL, 8); - func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_LONG_PLAYBACK); + this->subCamId = OnePointCutscene_Init(play, 2270, -99, &this->actor, CAM_ID_MAIN); + play->msgCtx.msgMode = MSGMODE_PAUSED; + func_8002DF54(play, NULL, 8); + func_8010BD58(play, OCARINA_ACTION_SCARECROW_LONG_PLAYBACK); this->actionFunc = func_80A8FAA4; } } -void func_80A8FAA4(EnKakasi* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.ocarinaMode != OCARINA_MODE_0F) { - func_80A8F320(this, globalCtx, 1); +void func_80A8FAA4(EnKakasi* this, PlayState* play) { + if (play->msgCtx.ocarinaMode != OCARINA_MODE_0F) { + func_80A8F320(this, play, 1); return; } - osSyncPrintf("game_play->message.msg_mode=%d\n", globalCtx->msgCtx.msgMode); + osSyncPrintf("game_play->message.msg_mode=%d\n", play->msgCtx.msgMode); - if (globalCtx->msgCtx.msgMode == MSGMODE_NONE) { + if (play->msgCtx.msgMode == MSGMODE_NONE) { if (this->unk_194) { this->actor.textId = 0x4077; this->unk_196 = TEXT_STATE_EVENT; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); } else { this->actor.textId = 0x4078; this->unk_196 = TEXT_STATE_EVENT; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); } this->actionFunc = func_80A8FBB8; - OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + OnePointCutscene_EndCutscene(play, this->subCamId); this->subCamId = CAM_ID_NONE; - this->subCamId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, CAM_ID_MAIN); - func_8005B1A4(globalCtx->cameraPtrs[this->subCamId]); + this->subCamId = OnePointCutscene_Init(play, 2260, -99, &this->actor, CAM_ID_MAIN); + func_8005B1A4(play->cameraPtrs[this->subCamId]); } } -void func_80A8FBB8(EnKakasi* this, GlobalContext* globalCtx) { +void func_80A8FBB8(EnKakasi* this, PlayState* play) { func_80A8F28C(this); SkelAnime_Update(&this->skelanime); - if (this->unk_196 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - func_8005B1A4(globalCtx->cameraPtrs[this->subCamId]); - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, NULL, 7); + if (this->unk_196 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + func_8005B1A4(play->cameraPtrs[this->subCamId]); + Message_CloseTextbox(play); + func_8002DF54(play, NULL, 7); this->actionFunc = func_80A8F660; } } -void EnKakasi_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Update(Actor* thisx, PlayState* play) { EnKakasi* this = (EnKakasi*)thisx; s32 pad; s32 i; @@ -327,15 +327,15 @@ void EnKakasi_Update(Actor* thisx, GlobalContext* globalCtx) { this->height = 60.0f; Actor_SetFocus(&this->actor, this->height); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnKakasi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Draw(Actor* thisx, PlayState* play) { EnKakasi* this = (EnKakasi*)thisx; if (BREG(3) != 0) { @@ -343,7 +343,7 @@ void EnKakasi_Draw(Actor* thisx, GlobalContext* globalCtx) { // "flag!" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ フラグ! ☆☆☆☆☆ %d\n" VT_RST, gSaveContext.scarecrowLongSongSet); } - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, - NULL, NULL, this); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, NULL, + NULL, this); } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h index 4b07caae04..ceef6afe9c 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h @@ -6,7 +6,7 @@ struct EnKakasi; -typedef void (*EnKakasiFunc)(struct EnKakasi*, GlobalContext*); +typedef void (*EnKakasiFunc)(struct EnKakasi*, PlayState*); typedef struct EnKakasi { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index a7b2abc22c..d0a739dbb2 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -30,16 +30,16 @@ static ColliderCylinderInit sCylinderInit = { { 20, 70, 0, { 0, 0, 0 } }, }; -void EnKakasi2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi2_Update(Actor* thisx, GlobalContext* globalCtx); -void func_80A90948(Actor* thisx, GlobalContext* globalCtx); +void EnKakasi2_Init(Actor* thisx, PlayState* play); +void EnKakasi2_Destroy(Actor* thisx, PlayState* play); +void EnKakasi2_Update(Actor* thisx, PlayState* play); +void func_80A90948(Actor* thisx, PlayState* play); -void func_80A9062C(EnKakasi2* this, GlobalContext* globalCtx); -void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx); -void func_80A904D8(EnKakasi2* this, GlobalContext* globalCtx); -void func_80A90578(EnKakasi2* this, GlobalContext* globalCtx); -void func_80A906C4(EnKakasi2* this, GlobalContext* globalCtx); +void func_80A9062C(EnKakasi2* this, PlayState* play); +void func_80A90264(EnKakasi2* this, PlayState* play); +void func_80A904D8(EnKakasi2* this, PlayState* play); +void func_80A90578(EnKakasi2* this, PlayState* play); +void func_80A906C4(EnKakasi2* this, PlayState* play); const ActorInit En_Kakasi2_InitVars = { ACTOR_EN_KAKASI2, @@ -53,7 +53,7 @@ const ActorInit En_Kakasi2_InitVars = { NULL, }; -void EnKakasi2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi2_Init(Actor* thisx, PlayState* play) { EnKakasi2* this = (EnKakasi2*)thisx; s32 pad; f32 spawnRangeY; @@ -92,11 +92,11 @@ void EnKakasi2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_10; this->unk_198 = this->actor.shape.rot.y; - if (this->switchFlag >= 0 && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (this->switchFlag >= 0 && Flags_GetSwitch(play, this->switchFlag)) { this->actor.draw = func_80A90948; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); this->actionFunc = func_80A9062C; } else { this->actionFunc = func_80A90264; @@ -104,15 +104,15 @@ void EnKakasi2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKakasi2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi2_Destroy(Actor* thisx, PlayState* play) { EnKakasi2* this = (EnKakasi2*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); //! @bug SkelAnime_Free is not called } -void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A90264(EnKakasi2* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_194++; @@ -120,15 +120,15 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) { (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < this->maxSpawnDistance.y)) { this->actor.draw = func_80A90948; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); - OnePointCutscene_Attention(globalCtx, &this->actor); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); + OnePointCutscene_Attention(play, &this->actor); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_27; func_80078884(NA_SE_SY_CORRECT_CHIME); if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ SAVE 終了 ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); @@ -138,18 +138,17 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) { GET_EVENTCHKINF(EVENTCHKINF_9C)) { this->unk_194 = 0; - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_0B) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_0B) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ SAVE 終了 ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; this->actor.draw = func_80A90948; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, - 0); - OnePointCutscene_Attention(globalCtx, &this->actor); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); + OnePointCutscene_Attention(play, &this->actor); func_80078884(NA_SE_SY_CORRECT_CHIME); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_27; @@ -158,7 +157,7 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) { } } -void func_80A904D8(EnKakasi2* this, GlobalContext* globalCtx) { +void func_80A904D8(EnKakasi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&object_ka_Anim_000214); Animation_Change(&this->skelAnime, &object_ka_Anim_000214, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -166,7 +165,7 @@ void func_80A904D8(EnKakasi2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A90578; } -void func_80A90578(EnKakasi2* this, GlobalContext* globalCtx) { +void func_80A90578(EnKakasi2* this, PlayState* play) { s16 currentFrame; SkelAnime_Update(&this->skelAnime); @@ -185,14 +184,14 @@ void func_80A90578(EnKakasi2* this, GlobalContext* globalCtx) { } } -void func_80A9062C(EnKakasi2* this, GlobalContext* globalCtx) { +void func_80A9062C(EnKakasi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&object_ka_Anim_000214); Animation_Change(&this->skelAnime, &object_ka_Anim_000214, 0.0f, 0.0f, (s16)frameCount, ANIMMODE_ONCE, -10.0f); this->actionFunc = func_80A906C4; } -void func_80A906C4(EnKakasi2* this, GlobalContext* globalCtx) { +void func_80A906C4(EnKakasi2* this, PlayState* play) { if (this->skelAnime.curFrame != 0) { Math_ApproachZeroF(&this->skelAnime.curFrame, 0.5f, 1.0f); } @@ -200,19 +199,19 @@ void func_80A906C4(EnKakasi2* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } -void EnKakasi2_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnKakasi2_Update(Actor* thisx, PlayState* play2) { EnKakasi2* this = (EnKakasi2*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; this->actor.world.rot = this->actor.shape.rot; Actor_SetFocus(&this->actor, this->height); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); if (this->actor.shape.yOffset == 0.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (BREG(0) != 0) { if (BREG(5) != 0) { @@ -226,21 +225,21 @@ void EnKakasi2_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((this->unk_194 % 2) == 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, 70, 70, 70, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 1.0f, 70, 70, 70, 255, 4, play->state.gfxCtx); } } else { 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, 255, 255, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 0, 255, 255, 255, 4, play->state.gfxCtx); } } } } -void func_80A90948(Actor* thisx, GlobalContext* globalCtx) { +void func_80A90948(Actor* thisx, PlayState* play) { EnKakasi2* this = (EnKakasi2*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, this); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, this); } diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h index a917e7e2e9..9309c16725 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h @@ -6,7 +6,7 @@ struct EnKakasi2; -typedef void (*EnKakasi2ActionFunc)(struct EnKakasi2*, GlobalContext*); +typedef void (*EnKakasi2ActionFunc)(struct EnKakasi2*, PlayState*); typedef struct EnKakasi2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index 69a523e98a..bc4b68d256 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -10,21 +10,21 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_25) -void EnKakasi3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKakasi3_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKakasi3_Init(Actor* thisx, PlayState* play); +void EnKakasi3_Destroy(Actor* thisx, PlayState* play); +void EnKakasi3_Update(Actor* thisx, PlayState* play); +void EnKakasi3_Draw(Actor* thisx, PlayState* play); -void func_80A911F0(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A91284(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A915B8(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A91620(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A91760(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A917FC(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A9187C(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A918E4(EnKakasi3* this, GlobalContext* globalCtx); -void func_80A91A90(EnKakasi3* this, GlobalContext* globalCtx); +void func_80A911F0(EnKakasi3* this, PlayState* play); +void func_80A91284(EnKakasi3* this, PlayState* play); +void func_80A91348(EnKakasi3* this, PlayState* play); +void func_80A915B8(EnKakasi3* this, PlayState* play); +void func_80A91620(EnKakasi3* this, PlayState* play); +void func_80A91760(EnKakasi3* this, PlayState* play); +void func_80A917FC(EnKakasi3* this, PlayState* play); +void func_80A9187C(EnKakasi3* this, PlayState* play); +void func_80A918E4(EnKakasi3* this, PlayState* play); +void func_80A91A90(EnKakasi3* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -58,14 +58,14 @@ const ActorInit En_Kakasi3_InitVars = { (ActorFunc)EnKakasi3_Draw, }; -void EnKakasi3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi3_Destroy(Actor* thisx, PlayState* play) { EnKakasi3* this = (EnKakasi3*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); //! @bug SkelAnime_Free is not called } -void EnKakasi3_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi3_Init(Actor* thisx, PlayState* play) { EnKakasi3* this = (EnKakasi3*)thisx; osSyncPrintf("\n\n"); @@ -73,9 +73,9 @@ void EnKakasi3_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ おーボヌール ☆☆☆☆☆ \n" VT_RST); this->actor.targetMode = 6; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); this->actor.flags |= ACTOR_FLAG_10; this->rot = this->actor.world.rot; this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -94,9 +94,9 @@ void func_80A90E28(EnKakasi3* this) { Math_SmoothStepToS(&this->actor.shape.rot.z, this->rot.z, 5, 0x2710, 0); } -void func_80A90EBC(EnKakasi3* this, GlobalContext* globalCtx, s32 arg) { +void func_80A90EBC(EnKakasi3* this, PlayState* play, s32 arg) { s16 currentFrame; - s16 ocarinaNote = globalCtx->msgCtx.lastOcarinaButtonIndex; + s16 ocarinaNote = play->msgCtx.lastOcarinaButtonIndex; if (arg != 0) { if (this->unk_19C[3] == 0) { @@ -172,14 +172,14 @@ void func_80A90EBC(EnKakasi3* this, GlobalContext* globalCtx, s32 arg) { } } -void func_80A911F0(EnKakasi3* this, GlobalContext* globalCtx) { +void func_80A911F0(EnKakasi3* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&object_ka_Anim_000214); Animation_Change(&this->skelAnime, &object_ka_Anim_000214, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->actionFunc = func_80A91284; } -void func_80A91284(EnKakasi3* this, GlobalContext* globalCtx) { +void func_80A91284(EnKakasi3* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.textId = 0x40A1; @@ -206,13 +206,13 @@ void func_80A91284(EnKakasi3* this, GlobalContext* globalCtx) { this->actionFunc = func_80A91348; } -void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A91348(EnKakasi3* this, PlayState* play) { + Player* player = GET_PLAYER(play); func_80A90E28(this); SkelAnime_Update(&this->skelAnime); this->subCamId = CAM_ID_NONE; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (!this->unk_194) { if (this->unk_1A8 == 0) { this->actionFunc = func_80A91284; @@ -232,11 +232,11 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { if (!this->unk_194) { if (player->stateFlags2 & PLAYER_STATE2_24) { - this->subCamId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, CAM_ID_MAIN); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + this->subCamId = OnePointCutscene_Init(play, 2260, -99, &this->actor, CAM_ID_MAIN); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->dialogState = TEXT_STATE_EVENT; this->unk_1B8 = 0.0f; - Message_StartTextbox(globalCtx, 0x40A4, NULL); + Message_StartTextbox(play, 0x40A4, NULL); player->stateFlags2 |= PLAYER_STATE2_23; this->actionFunc = func_80A915B8; return; @@ -247,11 +247,11 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { } else if (gSaveContext.scarecrowSpawnSongSet && !this->unk_195) { if (player->stateFlags2 & PLAYER_STATE2_24) { - this->subCamId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, CAM_ID_MAIN); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + this->subCamId = OnePointCutscene_Init(play, 2260, -99, &this->actor, CAM_ID_MAIN); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->dialogState = TEXT_STATE_EVENT; this->unk_1B8 = 0.0f; - Message_StartTextbox(globalCtx, 0x40A8, NULL); + Message_StartTextbox(play, 0x40A8, NULL); player->stateFlags2 |= PLAYER_STATE2_23; this->actionFunc = func_80A9187C; return; @@ -260,151 +260,150 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { player->stateFlags2 |= PLAYER_STATE2_23; } } - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } } -void func_80A915B8(EnKakasi3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_SPAWN_RECORDING); +void func_80A915B8(EnKakasi3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + func_8010BD58(play, OCARINA_ACTION_SCARECROW_SPAWN_RECORDING); this->actionFunc = func_80A91620; } } -void func_80A91620(EnKakasi3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A91620(EnKakasi3* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04 || - (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05 && globalCtx->msgCtx.ocarinaMode < OCARINA_MODE_0B)) && - (globalCtx->msgCtx.msgMode == MSGMODE_NONE)) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_04 || + (play->msgCtx.ocarinaMode >= OCARINA_MODE_05 && play->msgCtx.ocarinaMode < OCARINA_MODE_0B)) && + (play->msgCtx.msgMode == MSGMODE_NONE)) { - OnePointCutscene_EndCutscene(globalCtx, this->subCamId); - if (globalCtx->cameraPtrs[this->subCamId] == NULL) { + OnePointCutscene_EndCutscene(play, this->subCamId); + if (play->cameraPtrs[this->subCamId] == NULL) { this->subCamId = CAM_ID_NONE; } if (this->subCamId != CAM_ID_NONE) { - func_8005B1A4(globalCtx->cameraPtrs[this->subCamId]); + func_8005B1A4(play->cameraPtrs[this->subCamId]); } this->actionFunc = func_80A911F0; return; } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03 && globalCtx->msgCtx.msgMode == MSGMODE_NONE) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_03 && play->msgCtx.msgMode == MSGMODE_NONE) { this->dialogState = TEXT_STATE_EVENT; - Message_StartTextbox(globalCtx, 0x40A5, NULL); - func_8002DF54(globalCtx, NULL, 8); + Message_StartTextbox(play, 0x40A5, NULL); + func_8002DF54(play, NULL, 8); this->actionFunc = func_80A91A90; return; } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { - func_80A90EBC(this, globalCtx, 0); + if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { + func_80A90EBC(this, play, 0); player->stateFlags2 |= PLAYER_STATE2_23; } } -void func_80A91760(EnKakasi3* this, GlobalContext* globalCtx) { +void func_80A91760(EnKakasi3* this, PlayState* play) { func_80A90E28(this); SkelAnime_Update(&this->skelAnime); - if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK); + if (this->dialogState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; + func_8010BD58(play, OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK); this->actionFunc = func_80A917FC; - this->subCamId = OnePointCutscene_Init(globalCtx, 2280, -99, &this->actor, CAM_ID_MAIN); + this->subCamId = OnePointCutscene_Init(play, 2280, -99, &this->actor, CAM_ID_MAIN); } } -void func_80A917FC(EnKakasi3* this, GlobalContext* globalCtx) { +void func_80A917FC(EnKakasi3* this, PlayState* play) { - if (globalCtx->msgCtx.ocarinaMode != OCARINA_MODE_0F) { - func_80A90EBC(this, globalCtx, 1); + if (play->msgCtx.ocarinaMode != OCARINA_MODE_0F) { + func_80A90EBC(this, play, 1); } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - Message_CloseTextbox(globalCtx); - OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); + OnePointCutscene_EndCutscene(play, this->subCamId); this->actionFunc = func_80A911F0; } } -void func_80A9187C(EnKakasi3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_SCARECROW_SPAWN); +void func_80A9187C(EnKakasi3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + func_8010BD58(play, OCARINA_ACTION_CHECK_SCARECROW_SPAWN); this->actionFunc = func_80A918E4; } } -void func_80A918E4(EnKakasi3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A918E4(EnKakasi3* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (BREG(3) != 0) { // "No way!" - osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ まさか! ☆☆☆☆☆ %d\n" VT_RST, globalCtx->msgCtx.ocarinaMode); + osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ まさか! ☆☆☆☆☆ %d\n" VT_RST, play->msgCtx.ocarinaMode); } - if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04 || - (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05 && globalCtx->msgCtx.ocarinaMode < OCARINA_MODE_0B)) && - globalCtx->msgCtx.msgMode == MSGMODE_NONE) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_04 || + (play->msgCtx.ocarinaMode >= OCARINA_MODE_05 && play->msgCtx.ocarinaMode < OCARINA_MODE_0B)) && + play->msgCtx.msgMode == MSGMODE_NONE) { - Message_StartTextbox(globalCtx, 0x40A6, NULL); + Message_StartTextbox(play, 0x40A6, NULL); this->dialogState = TEXT_STATE_EVENT; - OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + OnePointCutscene_EndCutscene(play, this->subCamId); this->subCamId = CAM_ID_NONE; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = func_80A91A90; return; } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03 && globalCtx->msgCtx.msgMode == MSGMODE_NONE) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_03 && play->msgCtx.msgMode == MSGMODE_NONE) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; if (BREG(3) != 0) { osSyncPrintf("\n\n"); // "With this, other guys are OK! That's it!" - osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ これで、他の奴もOK!だ! ☆☆☆☆☆ %d\n" VT_RST, - globalCtx->msgCtx.ocarinaMode); + osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ これで、他の奴もOK!だ! ☆☆☆☆☆ %d\n" VT_RST, play->msgCtx.ocarinaMode); } this->unk_195 = true; - Message_StartTextbox(globalCtx, 0x40A7, NULL); + Message_StartTextbox(play, 0x40A7, NULL); this->dialogState = TEXT_STATE_EVENT; - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); this->actionFunc = func_80A91A90; return; } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { - func_80A90EBC(this, globalCtx, 0); + if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { + func_80A90EBC(this, play, 0); player->stateFlags2 |= PLAYER_STATE2_23; } } -void func_80A91A90(EnKakasi3* this, GlobalContext* globalCtx) { +void func_80A91A90(EnKakasi3* this, PlayState* play) { func_80A90E28(this); SkelAnime_Update(&this->skelAnime); - func_8002DF54(globalCtx, NULL, 8); + func_8002DF54(play, NULL, 8); - if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { + if (this->dialogState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { if (this->unk_195) { if (!GET_EVENTCHKINF(EVENTCHKINF_9C)) { SET_EVENTCHKINF(EVENTCHKINF_9C); } } - if (globalCtx->cameraPtrs[this->subCamId] == NULL) { + if (play->cameraPtrs[this->subCamId] == NULL) { this->subCamId = CAM_ID_NONE; } if (this->subCamId != CAM_ID_NONE) { - func_8005B1A4(globalCtx->cameraPtrs[this->subCamId]); + func_8005B1A4(play->cameraPtrs[this->subCamId]); } - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - func_8002DF54(globalCtx, NULL, 7); + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + func_8002DF54(play, NULL, 7); this->actionFunc = func_80A911F0; } } -void EnKakasi3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi3_Update(Actor* thisx, PlayState* play) { EnKakasi3* this = (EnKakasi3*)thisx; s32 pad; s32 i; @@ -424,18 +423,18 @@ void EnKakasi3_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, 60.0f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnKakasi3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi3_Draw(Actor* thisx, PlayState* play) { EnKakasi3* this = (EnKakasi3*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, this); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, this); } diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h index 90eadc027b..f402ab5ded 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h @@ -6,7 +6,7 @@ struct EnKakasi3; -typedef void (*EnKakasi3ActionFunc)(struct EnKakasi3*, GlobalContext*); +typedef void (*EnKakasi3ActionFunc)(struct EnKakasi3*, PlayState*); typedef struct EnKakasi3 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index 6e66803973..53651cdf12 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -70,10 +70,10 @@ typedef enum { CUT_VERT_R } EnKanbanCutType; -void EnKanban_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKanban_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKanban_Init(Actor* thisx, PlayState* play); +void EnKanban_Destroy(Actor* thisx, PlayState* play); +void EnKanban_Update(Actor* thisx, PlayState* play); +void EnKanban_Draw(Actor* thisx, PlayState* play); const ActorInit En_Kanban_InitVars = { ACTOR_EN_KANBAN, @@ -204,15 +204,15 @@ void EnKanban_SetFloorRot(EnKanban* this) { } } -void EnKanban_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKanban_Init(Actor* thisx, PlayState* play) { EnKanban* this = (EnKanban*)thisx; Actor_SetScale(&this->actor, 0.01f); if (this->actor.params != ENKANBAN_PIECE) { this->actor.targetMode = 0; this->actor.flags |= ACTOR_FLAG_0; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); osSyncPrintf("KANBAN ARG %x\n", this->actor.params); if (this->actor.params == ENKANBAN_FISHING) { if (LINK_IS_CHILD) { @@ -225,7 +225,7 @@ void EnKanban_Init(Actor* thisx, GlobalContext* globalCtx) { } this->bounceX = 1; this->partFlags = 0xFFFF; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 50.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, UPDBGCHECKINFO_FLAG_2); EnKanban_SetFloorRot(this); if (LINK_IS_CHILD) { this->actor.world.pos.y -= 15.0f; @@ -233,43 +233,43 @@ void EnKanban_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKanban_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKanban_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnKanban* this = (EnKanban*)thisx; if (this->actionState == ENKANBAN_SIGN) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnKanban_Message(EnKanban* this, GlobalContext* globalCtx) { +void EnKanban_Message(EnKanban* this, PlayState* play) { if (!this->msgFlag) { if (this->msgTimer == 0) { if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x2800) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->msgFlag = true; } else { - func_8002F2CC(&this->actor, globalCtx, 68.0f); + func_8002F2CC(&this->actor, play, 68.0f); } } } else { this->msgTimer--; } } else { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->msgFlag = false; this->msgTimer = 20; } } } -void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnKanban_Update(Actor* thisx, PlayState* play2) { u8 bounced = false; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnKanban* this = (EnKanban*)thisx; EnKanban* signpost; EnKanban* piece; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f offset; this->frameCount++; @@ -285,12 +285,12 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.flags &= ~ACTOR_FLAG_0; } if (this->partFlags == 0xFFFF) { - EnKanban_Message(this, globalCtx); + EnKanban_Message(this, play); } if ((this->invincibilityTimer == 0) && (this->collider.base.acFlags & AC_HIT)) { this->collider.base.acFlags &= ~AC_HIT; this->invincibilityTimer = 6; - piece = (EnKanban*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_KANBAN, + piece = (EnKanban*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_KANBAN, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, ENKANBAN_PIECE); @@ -409,8 +409,8 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 44.0f; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer > 500.0f) { this->actor.flags |= ACTOR_FLAG_0; this->partFlags = 0xFFFF; @@ -440,7 +440,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { u8 onGround; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 30.0f, 50.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 50.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); tempX = this->actor.world.pos.x; @@ -450,7 +450,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { tempYDistToWater = this->actor.yDistToWater; this->actor.world.pos.z += ((this->actor.world.pos.y - this->actor.floorHeight) * -50.0f) / 100.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 50.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, UPDBGCHECKINFO_FLAG_2); EnKanban_SetFloorRot(this); this->actor.world.pos.x = tempX; @@ -506,9 +506,9 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_BOMB_DROP_WATER); this->bounceX = this->bounceZ = 0; this->actor.world.pos.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 0, (this->partCount * 20) + 300); - EffectSsGRipple_Spawn(globalCtx, &this->actor.world.pos, 150, 650, 0); - EffectSsGRipple_Spawn(globalCtx, &this->actor.world.pos, 300, 800, 5); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 0, (this->partCount * 20) + 300); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 150, 650, 0); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 300, 800, 5); this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; osSyncPrintf(" WAT Y = %f\n", this->actor.yDistToWater); @@ -577,7 +577,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { for (j = 0; j < dustCount + 3; j++) { pos.x = this->actor.world.pos.x + Rand_CenteredFloat((this->partCount * 0.5f) + 20.0f); pos.z = this->actor.world.pos.z + Rand_CenteredFloat((this->partCount * 0.5f) + 20.0f); - func_800286CC(globalCtx, &pos, &velocity, &accel, 100, 5); + func_800286CC(play, &pos, &velocity, &accel, 100, 5); } } if (DECR(this->airTimer) == 0) { @@ -614,7 +614,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { } Actor_MoveForward(&this->actor); if (this->actor.speedXZ != 0.0f) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 50.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.speedXZ *= -0.5f; @@ -648,9 +648,9 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { rippleScale = 200; } - EffectSsGRipple_Spawn(globalCtx, &this->actor.world.pos, rippleScale, rippleScale + 500, 0); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, rippleScale, rippleScale + 500, 0); } - } else if ((globalCtx->actorCtx.unk_02 != 0) && (this->actor.xyzDistToPlayerSq < SQ(100.0f))) { + } else if ((play->actorCtx.unk_02 != 0) && (this->actor.xyzDistToPlayerSq < SQ(100.0f))) { f32 hammerStrength = (100.0f - sqrtf(this->actor.xyzDistToPlayerSq)) * 0.05f; this->actionState = ENKANBAN_AIR; @@ -676,7 +676,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { this->airTimer = 70; } if (this->bounceX == 0) { - Actor* bomb = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + Actor* bomb = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; f32 dx; f32 dy; f32 dz; @@ -718,17 +718,17 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { } } osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("OCARINA_MODE %d\n", globalCtx->msgCtx.ocarinaMode); + osSyncPrintf("OCARINA_MODE %d\n", play->msgCtx.ocarinaMode); osSyncPrintf(VT_RST); switch (this->ocarinaFlag) { case 0: - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { this->ocarinaFlag = 1; } break; case 1: - if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) && - (globalCtx->msgCtx.unk_E3F2 == OCARINA_SONG_LULLABY)) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_04) && + (play->msgCtx.unk_E3F2 == OCARINA_SONG_LULLABY)) { this->actionState = ENKANBAN_REPAIR; this->bounceX = 1; Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -798,16 +798,16 @@ static s32 sUnused[] = { 0, 0, 0 }; // Unused zero vector? #include "overlays/ovl_En_Kanban/ovl_En_Kanban.c" -void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKanban_Draw(Actor* thisx, PlayState* play) { EnKanban* this = (EnKanban*)thisx; f32 zShift; f32 zShift2; s16 i; - u8* shadowTex = Graph_Alloc(globalCtx->state.gfxCtx, 0x400); + u8* shadowTex = Graph_Alloc(play->state.gfxCtx, 0x400); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_kanban.c", 1659); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_kanban.c", 1659); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, object_kanban_DL_000C30); if (this->actionState != ENKANBAN_SIGN) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); @@ -825,7 +825,7 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX(BINANG_TO_RAD_ALT(this->spinRot.x), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD_ALT(this->spinRot.z), MTXMODE_APPLY); Matrix_Translate(this->offset.x, this->offset.y, this->offset.z - 100.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_kanban.c", 1715), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_kanban.c", 1715), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); for (i = 0; i < ARRAY_COUNT(sPartFlags); i++) { if (sPartFlags[i] & this->partFlags) { @@ -834,7 +834,7 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { } } else { Matrix_Translate(0.0f, 0.0f, -100.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_kanban.c", 1725), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_kanban.c", 1725), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->partFlags == 0xFFFF) { gSPDisplayList(POLY_OPA_DISP++, gSignRectangularDL); @@ -854,7 +854,7 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 255, 255, 255, this->cutMarkAlpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 150, 0); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_kanban.c", 1773), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_kanban.c", 1773), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_kanban_DL_001630); } @@ -893,7 +893,7 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateX(BINANG_TO_RAD_ALT(this->spinRot.x), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD_ALT(this->spinRot.z), MTXMODE_APPLY); Matrix_Translate(this->offset.x, this->offset.y, this->offset.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_kanban.c", 1833), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_kanban.c", 1833), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); for (i = 0; i < 0x400; i++) { @@ -907,5 +907,5 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, sShadowDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_kanban.c", 1857); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_kanban.c", 1857); } 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 9d0d3d3606..031e994ded 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -11,23 +11,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnKarebaba_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKarebaba_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKarebaba_Init(Actor* thisx, PlayState* play); +void EnKarebaba_Destroy(Actor* thisx, PlayState* play); +void EnKarebaba_Update(Actor* thisx, PlayState* play); +void EnKarebaba_Draw(Actor* thisx, PlayState* play); void EnKarebaba_SetupGrow(EnKarebaba* this); void EnKarebaba_SetupIdle(EnKarebaba* this); -void EnKarebaba_Grow(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Idle(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Awaken(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Spin(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_DeadItemDrop(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Retract(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Dead(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Regrow(EnKarebaba* this, GlobalContext* globalCtx); -void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx); +void EnKarebaba_Grow(EnKarebaba* this, PlayState* play); +void EnKarebaba_Idle(EnKarebaba* this, PlayState* play); +void EnKarebaba_Awaken(EnKarebaba* this, PlayState* play); +void EnKarebaba_Spin(EnKarebaba* this, PlayState* play); +void EnKarebaba_Dying(EnKarebaba* this, PlayState* play); +void EnKarebaba_DeadItemDrop(EnKarebaba* this, PlayState* play); +void EnKarebaba_Retract(EnKarebaba* this, PlayState* play); +void EnKarebaba_Dead(EnKarebaba* this, PlayState* play); +void EnKarebaba_Regrow(EnKarebaba* this, PlayState* play); +void EnKarebaba_Upright(EnKarebaba* this, PlayState* play); const ActorInit En_Karebaba_InitVars = { ACTOR_EN_KAREBABA, @@ -89,18 +89,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_WITHERED_DEKU_BABA, ICHAIN_STOP), }; -void EnKarebaba_Init(Actor* thisx, GlobalContext* globalCtx) { +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(globalCtx, &this->skelAnime, &gDekuBabaSkel, &gDekuBabaFastChompAnim, this->jointTable, - this->morphTable, 8); - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sBodyColliderInit); + SkelAnime_Init(play, &this->skelAnime, &gDekuBabaSkel, &gDekuBabaFastChompAnim, this->jointTable, this->morphTable, + 8); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyColliderInit); Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - Collider_InitCylinder(globalCtx, &this->headCollider); - Collider_SetCylinder(globalCtx, &this->headCollider, &this->actor, &sHeadColliderInit); + Collider_InitCylinder(play, &this->headCollider); + Collider_SetCylinder(play, &this->headCollider, &this->actor, &sHeadColliderInit); Collider_UpdateCylinder(&this->actor, &this->headCollider); CollisionCheck_SetInfo(&this->actor.colChkInfo, DamageTable_Get(1), &sColCheckInfoInit); @@ -113,11 +113,11 @@ void EnKarebaba_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKarebaba_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKarebaba_Destroy(Actor* thisx, PlayState* play) { EnKarebaba* this = (EnKarebaba*)thisx; - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyCylinder(globalCtx, &this->headCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyCylinder(play, &this->headCollider); } void EnKarebaba_ResetCollider(EnKarebaba* this) { @@ -181,14 +181,14 @@ void EnKarebaba_SetupDying(EnKarebaba* this) { this->actionFunc = EnKarebaba_Dying; } -void EnKarebaba_SetupDeadItemDrop(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_SetupDeadItemDrop(EnKarebaba* 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(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_MISC); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); this->actor.params = 200; this->actor.flags &= ~ACTOR_FLAG_5; this->actionFunc = EnKarebaba_DeadItemDrop; @@ -220,7 +220,7 @@ void EnKarebaba_SetupRegrow(EnKarebaba* this) { this->actionFunc = EnKarebaba_Regrow; } -void EnKarebaba_Grow(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Grow(EnKarebaba* this, PlayState* play) { f32 scale; this->actor.params++; @@ -232,13 +232,13 @@ void EnKarebaba_Grow(EnKarebaba* this, GlobalContext* globalCtx) { } } -void EnKarebaba_Idle(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Idle(EnKarebaba* this, PlayState* play) { if (this->actor.xzDistToPlayer < 200.0f && fabsf(this->actor.yDistToPlayer) < 30.0f) { EnKarebaba_SetupAwaken(this); } } -void EnKarebaba_Awaken(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Awaken(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.scale.x, 0.01f, 0.0005f); this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; @@ -246,11 +246,11 @@ void EnKarebaba_Awaken(EnKarebaba* this, GlobalContext* globalCtx) { EnKarebaba_SetupUpright(this); } this->actor.shape.rot.y += 0x1999; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); } -void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnKarebaba_Upright(EnKarebaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); @@ -264,7 +264,7 @@ void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx) { if (this->bodyCollider.base.acFlags & AC_HIT) { EnKarebaba_SetupDying(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) > 240.0f) { EnKarebaba_SetupRetract(this); } else if (this->actor.params == 0) { @@ -272,7 +272,7 @@ void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx) { } } -void EnKarebaba_Spin(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Spin(EnKarebaba* this, PlayState* play) { s32 value; f32 cos60; @@ -307,13 +307,13 @@ void EnKarebaba_Spin(EnKarebaba* this, GlobalContext* globalCtx) { if (this->bodyCollider.base.acFlags & AC_HIT) { EnKarebaba_SetupDying(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else if (this->actor.params == 0) { EnKarebaba_SetupUpright(this); } } -void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Dying(EnKarebaba* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 i; Vec3f position; @@ -323,15 +323,14 @@ void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx) { if (this->actor.params == 0) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4800, 0x71C); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 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.speedXZ = 0.0f; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 12, 5, 15, HAHEN_OBJECT_DEFAULT, 10, - NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 12, 5, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { @@ -345,30 +344,30 @@ void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx) { rotation.y = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y); for (i = 0; i < 4; i++) { - func_800286CC(globalCtx, &position, &zeroVec, &zeroVec, 500, 50); + func_800286CC(play, &position, &zeroVec, &zeroVec, 500, 50); position.x += rotation.x; position.y += rotation.z; position.z += rotation.y; } - func_800286CC(globalCtx, &this->actor.home.pos, &zeroVec, &zeroVec, 500, 100); - EnKarebaba_SetupDeadItemDrop(this, globalCtx); + func_800286CC(play, &this->actor.home.pos, &zeroVec, &zeroVec, 500, 100); + EnKarebaba_SetupDeadItemDrop(this, play); } } -void EnKarebaba_DeadItemDrop(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_DeadItemDrop(EnKarebaba* this, PlayState* play) { if (this->actor.params != 0) { this->actor.params--; } - if (Actor_HasParent(&this->actor, globalCtx) || this->actor.params == 0) { + if (Actor_HasParent(&this->actor, play) || this->actor.params == 0) { EnKarebaba_SetupDead(this); } else { - func_8002F554(&this->actor, globalCtx, GI_STICKS_1); + func_8002F554(&this->actor, play, GI_STICKS_1); } } -void EnKarebaba_Retract(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Retract(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.scale.x, 0.005f, 0.0005f); this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; @@ -378,10 +377,10 @@ void EnKarebaba_Retract(EnKarebaba* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y += 0x1999; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); } -void EnKarebaba_Dead(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Dead(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.params != 0) { @@ -392,7 +391,7 @@ void EnKarebaba_Dead(EnKarebaba* this, GlobalContext* globalCtx) { } } -void EnKarebaba_Regrow(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_Regrow(EnKarebaba* this, PlayState* play) { f32 scaleFactor; this->actor.params++; @@ -403,35 +402,35 @@ void EnKarebaba_Regrow(EnKarebaba* this, GlobalContext* globalCtx) { if (this->actor.params == 20) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); EnKarebaba_SetupIdle(this); } } -void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKarebaba_Update(Actor* thisx, PlayState* play) { s32 pad; EnKarebaba* this = (EnKarebaba*)thisx; f32 height; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != EnKarebaba_Dead) { if (this->actionFunc == EnKarebaba_Dying) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 10.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (this->boundFloor == NULL) { this->boundFloor = this->actor.floorPoly; } } if (this->actionFunc != EnKarebaba_Dying && this->actionFunc != EnKarebaba_DeadItemDrop) { if (this->actionFunc != EnKarebaba_Regrow && this->actionFunc != EnKarebaba_Grow) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->headCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->headCollider.base); Actor_SetFocus(&this->actor, (this->actor.scale.x * 10.0f) / 0.01f); height = this->actor.home.pos.y + 40.0f; this->actor.focus.pos.x = this->actor.home.pos.x; @@ -441,25 +440,25 @@ void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKarebaba_DrawBaseShadow(EnKarebaba* this, GlobalContext* globalCtx) { +void EnKarebaba_DrawBaseShadow(EnKarebaba* this, PlayState* play) { MtxF mf; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1013); + OPEN_DISPS(play->state.gfxCtx, "../z_en_karebaba.c", 1013); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(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, &mf); Matrix_Mult(&mf, MTXMODE_NEW); Matrix_Scale(0.15f, 1.0f, 0.15f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1029), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_karebaba.c", 1029), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1034); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_karebaba.c", 1034); } -void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKarebaba_Draw(Actor* thisx, PlayState* play) { static Color_RGBA8 black = { 0, 0, 0, 0 }; static Gfx* stemDLists[] = { gDekuBabaStemTopDL, gDekuBabaStemMiddleDL, gDekuBabaStemBaseDL }; static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -468,20 +467,20 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 stemSections; f32 scale; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1056); + OPEN_DISPS(play->state.gfxCtx, "../z_en_karebaba.c", 1056); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->actionFunc == EnKarebaba_DeadItemDrop) { if (this->actor.params > 40 || (this->actor.params & 1)) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1066), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_karebaba.c", 1066), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStickDropDL); } } else if (this->actionFunc != EnKarebaba_Dead) { - func_80026230(globalCtx, &black, 1, 2); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + func_80026230(play, &black, 1, 2); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); if ((this->actionFunc == EnKarebaba_Regrow) || (this->actionFunc == EnKarebaba_Grow)) { @@ -501,7 +500,7 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < stemSections; i++) { Matrix_Translate(0.0f, 0.0f, -2000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1116), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_karebaba.c", 1116), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, stemDLists[i]); @@ -510,10 +509,10 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { } } - func_80026608(globalCtx); + func_80026608(play); } - func_80026230(globalCtx, &black, 1, 2); + func_80026230(play, &black, 1, 2); Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW); if (this->actionFunc != EnKarebaba_Grow) { @@ -522,22 +521,22 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(this->actor.home.rot.y), MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1144), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_karebaba.c", 1144), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); 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); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1155), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_karebaba.c", 1155), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemBaseDL); } - func_80026608(globalCtx); + func_80026608(play); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1163); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_karebaba.c", 1163); if (this->boundFloor != NULL) { - EnKarebaba_DrawBaseShadow(this, globalCtx); + EnKarebaba_DrawBaseShadow(this, 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 b0f5c83473..0687ade588 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h @@ -6,7 +6,7 @@ struct EnKarebaba; -typedef void (*EnKarebabaActionFunc)(struct EnKarebaba*, GlobalContext*); +typedef void (*EnKarebabaActionFunc)(struct EnKarebaba*, PlayState*); typedef struct EnKarebaba { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 460e00ced7..1515254dba 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -16,19 +16,19 @@ #define ENKO_TYPE (this->actor.params & 0xFF) #define ENKO_PATH ((this->actor.params & 0xFF00) >> 8) -void EnKo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKo_Init(Actor* thisx, PlayState* play); +void EnKo_Destroy(Actor* thisx, PlayState* play); +void EnKo_Update(Actor* thisx, PlayState* play); +void EnKo_Draw(Actor* thisx, PlayState* play); -void func_80A99048(EnKo* this, GlobalContext* globalCtx); -void func_80A995CC(EnKo* this, GlobalContext* globalCtx); -void func_80A99384(EnKo* this, GlobalContext* globalCtx); -void func_80A99438(EnKo* this, GlobalContext* globalCtx); -void func_80A99504(EnKo* this, GlobalContext* globalCtx); -void func_80A99560(EnKo* this, GlobalContext* globalCtx); +void func_80A99048(EnKo* this, PlayState* play); +void func_80A995CC(EnKo* this, PlayState* play); +void func_80A99384(EnKo* this, PlayState* play); +void func_80A99438(EnKo* this, PlayState* play); +void func_80A99504(EnKo* this, PlayState* play); +void func_80A99560(EnKo* this, PlayState* play); -s32 func_80A98ECC(EnKo* this, GlobalContext* globalCtx); +s32 func_80A98ECC(EnKo* this, PlayState* play); const ActorInit En_Ko_InitVars = { ACTOR_EN_KO, @@ -231,57 +231,57 @@ static EnKoInteractInfo sInteractInfo[] = { /* ENKO_TYPE_CHILD_FADO */ { 6, 30.0f, 180.0f }, }; -s32 EnKo_AreObjectsAvailable(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_AreObjectsAvailable(EnKo* this, PlayState* play) { u8 headId = sModelInfo[ENKO_TYPE].headId; u8 bodyId = sModelInfo[ENKO_TYPE].bodyId; u8 legsId = sModelInfo[ENKO_TYPE].legsId; - this->legsObjectBankIdx = Object_GetIndex(&globalCtx->objectCtx, sSkeleton[legsId].objectId); + this->legsObjectBankIdx = Object_GetIndex(&play->objectCtx, sSkeleton[legsId].objectId); if (this->legsObjectBankIdx < 0) { return false; } - this->bodyObjectBankIdx = Object_GetIndex(&globalCtx->objectCtx, sSkeleton[bodyId].objectId); + this->bodyObjectBankIdx = Object_GetIndex(&play->objectCtx, sSkeleton[bodyId].objectId); if (this->bodyObjectBankIdx < 0) { return false; } - this->headObjectBankIdx = Object_GetIndex(&globalCtx->objectCtx, sHead[headId].objectId); + this->headObjectBankIdx = Object_GetIndex(&play->objectCtx, sHead[headId].objectId); if (this->headObjectBankIdx < 0) { return false; } return true; } -s32 EnKo_AreObjectsLoaded(EnKo* this, GlobalContext* globalCtx) { - if (!Object_IsLoaded(&globalCtx->objectCtx, this->legsObjectBankIdx)) { +s32 EnKo_AreObjectsLoaded(EnKo* this, PlayState* play) { + if (!Object_IsLoaded(&play->objectCtx, this->legsObjectBankIdx)) { return false; } - if (!Object_IsLoaded(&globalCtx->objectCtx, this->bodyObjectBankIdx)) { + if (!Object_IsLoaded(&play->objectCtx, this->bodyObjectBankIdx)) { return false; } - if (!Object_IsLoaded(&globalCtx->objectCtx, this->headObjectBankIdx)) { + if (!Object_IsLoaded(&play->objectCtx, this->headObjectBankIdx)) { return false; } return true; } -s32 EnKo_IsOsAnimeAvailable(EnKo* this, GlobalContext* globalCtx) { - this->osAnimeBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_OS_ANIME); +s32 EnKo_IsOsAnimeAvailable(EnKo* this, PlayState* play) { + this->osAnimeBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); if (this->osAnimeBankIndex < 0) { return false; } return true; } -s32 EnKo_IsOsAnimeLoaded(EnKo* this, GlobalContext* globalCtx) { - if (!Object_IsLoaded(&globalCtx->objectCtx, this->osAnimeBankIndex)) { +s32 EnKo_IsOsAnimeLoaded(EnKo* this, PlayState* play) { + if (!Object_IsLoaded(&play->objectCtx, this->osAnimeBankIndex)) { return false; } return true; } -u16 func_80A96FD0(GlobalContext* globalCtx, Actor* thisx) { +u16 func_80A96FD0(PlayState* play, Actor* thisx) { EnKo* this = (EnKo*)thisx; switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_FADO: @@ -380,8 +380,8 @@ u16 func_80A96FD0(GlobalContext* globalCtx, Actor* thisx) { return 0; } -u16 func_80A97338(GlobalContext* globalCtx, Actor* thisx) { - Player* player = GET_PLAYER(globalCtx); +u16 func_80A97338(PlayState* play, Actor* thisx) { + Player* player = GET_PLAYER(play); EnKo* this = (EnKo*)thisx; switch (ENKO_TYPE) { @@ -465,35 +465,35 @@ u16 func_80A97338(GlobalContext* globalCtx, Actor* thisx) { } } -u16 func_80A97610(GlobalContext* globalCtx, Actor* thisx) { +u16 func_80A97610(PlayState* play, Actor* thisx) { u16 faceReaction; EnKo* this = (EnKo*)thisx; if (ENKO_TYPE == ENKO_TYPE_CHILD_0 || ENKO_TYPE == ENKO_TYPE_CHILD_2 || ENKO_TYPE == ENKO_TYPE_CHILD_3 || ENKO_TYPE == ENKO_TYPE_CHILD_4 || ENKO_TYPE == ENKO_TYPE_CHILD_7 || ENKO_TYPE == ENKO_TYPE_CHILD_8 || ENKO_TYPE == ENKO_TYPE_CHILD_11) { - faceReaction = Text_GetFaceReaction(globalCtx, 0x13); + faceReaction = Text_GetFaceReaction(play, 0x13); } if (ENKO_TYPE == ENKO_TYPE_CHILD_1 || ENKO_TYPE == ENKO_TYPE_CHILD_5 || ENKO_TYPE == ENKO_TYPE_CHILD_6 || ENKO_TYPE == ENKO_TYPE_CHILD_9 || ENKO_TYPE == ENKO_TYPE_CHILD_10) { - faceReaction = Text_GetFaceReaction(globalCtx, 0x14); + faceReaction = Text_GetFaceReaction(play, 0x14); } if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO) { - faceReaction = Text_GetFaceReaction(globalCtx, 0x12); + faceReaction = Text_GetFaceReaction(play, 0x12); } if (faceReaction != 0) { return faceReaction; } if (LINK_IS_ADULT) { - return func_80A97338(globalCtx, thisx); + return func_80A97338(play, thisx); } - return func_80A96FD0(globalCtx, thisx); + return func_80A96FD0(play, thisx); } -s16 func_80A97738(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A97738(PlayState* play, Actor* thisx) { EnKo* this = (EnKo*)thisx; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: switch (this->actor.textId) { case 0x1005: @@ -545,34 +545,34 @@ s16 func_80A97738(GlobalContext* globalCtx, Actor* thisx) { } return 1; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x1035: - this->actor.textId = (globalCtx->msgCtx.choiceIndex == 0) ? 0x1036 : 0x1037; - Message_ContinueTextbox(globalCtx, this->actor.textId); + this->actor.textId = (play->msgCtx.choiceIndex == 0) ? 0x1036 : 0x1037; + Message_ContinueTextbox(play, this->actor.textId); break; case 0x1038: - this->actor.textId = (globalCtx->msgCtx.choiceIndex != 0) - ? (globalCtx->msgCtx.choiceIndex == 1) ? 0x103A : 0x103B + this->actor.textId = (play->msgCtx.choiceIndex != 0) + ? (play->msgCtx.choiceIndex == 1) ? 0x103A : 0x103B : 0x1039; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); break; case 0x103E: - this->actor.textId = (globalCtx->msgCtx.choiceIndex == 0) ? 0x103F : 0x1040; - Message_ContinueTextbox(globalCtx, this->actor.textId); + this->actor.textId = (play->msgCtx.choiceIndex == 0) ? 0x103F : 0x1040; + Message_ContinueTextbox(play, this->actor.textId); break; case 0x10B7: SET_INFTABLE(INFTABLE_BC); case 0x10B8: - this->actor.textId = (globalCtx->msgCtx.choiceIndex == 0) ? 0x10BA : 0x10B9; - return (globalCtx->msgCtx.choiceIndex == 0) ? 2 : 1; + this->actor.textId = (play->msgCtx.choiceIndex == 0) ? 0x10BA : 0x10B9; + return (play->msgCtx.choiceIndex == 0) ? 2 : 1; } return 1; } break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { return 3; } } @@ -660,7 +660,7 @@ s32 EnKo_IsWithinTalkAngle(EnKo* this) { return result; } -s32 func_80A97D68(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A97D68(EnKo* this, PlayState* play) { s16 arg3; if (this->unk_1E8.unk_00 != 0) { @@ -678,10 +678,10 @@ s32 func_80A97D68(EnKo* this, GlobalContext* globalCtx) { return EnKo_IsWithinTalkAngle(this); } -s32 func_80A97E18(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A97E18(EnKo* this, PlayState* play) { s16 arg3; - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); + func_80034F54(play, this->unk_2E4, this->unk_304, 16); if (EnKo_IsWithinTalkAngle(this) == true) { arg3 = 2; } else { @@ -696,31 +696,31 @@ s32 func_80A97E18(EnKo* this, GlobalContext* globalCtx) { return 1; } -s32 func_80A97EB0(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A97EB0(EnKo* this, PlayState* play) { s16 arg3; s32 result; - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); + func_80034F54(play, this->unk_2E4, this->unk_304, 16); result = EnKo_IsWithinTalkAngle(this); arg3 = (result == true) ? 2 : 1; func_80034A14(&this->actor, &this->unk_1E8, 2, arg3); return result; } -s32 func_80A97F20(EnKo* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); +s32 func_80A97F20(EnKo* this, PlayState* play) { + func_80034F54(play, this->unk_2E4, this->unk_304, 16); func_80034A14(&this->actor, &this->unk_1E8, 2, 4); return 1; } -s32 func_80A97F70(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A97F70(EnKo* this, PlayState* play) { s16 arg3; if (this->unk_1E8.unk_00 != 0) { if ((this->skelAnime.animation == &gObjOsAnim_8F6C) == false) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_29); } - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); + func_80034F54(play, this->unk_2E4, this->unk_304, 16); arg3 = 2; } else { if ((this->skelAnime.animation == &gObjOsAnim_7D94) == false) { @@ -732,7 +732,7 @@ s32 func_80A97F70(EnKo* this, GlobalContext* globalCtx) { return EnKo_IsWithinTalkAngle(this); } -s32 func_80A98034(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A98034(EnKo* this, PlayState* play) { s16 arg3; s32 result; @@ -740,7 +740,7 @@ s32 func_80A98034(EnKo* this, GlobalContext* globalCtx) { if ((this->skelAnime.animation == &gObjOsAnim_8F6C) == false) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_29); } - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); + func_80034F54(play, this->unk_2E4, this->unk_304, 16); result = EnKo_IsWithinTalkAngle(this); arg3 = (result == true) ? 2 : 1; } else { @@ -755,13 +755,13 @@ s32 func_80A98034(EnKo* this, GlobalContext* globalCtx) { } // Same as func_80A97F20 -s32 func_80A98124(EnKo* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); +s32 func_80A98124(EnKo* this, PlayState* play) { + func_80034F54(play, this->unk_2E4, this->unk_304, 16); func_80034A14(&this->actor, &this->unk_1E8, 2, 4); return 1; } -s32 func_80A98174(EnKo* this, GlobalContext* globalCtx) { +s32 func_80A98174(EnKo* this, PlayState* play) { if (this->unk_1E8.unk_00 != 0) { if (Animation_OnFrame(&this->skelAnime, 18.0f)) { this->skelAnime.playSpeed = 0.0f; @@ -770,171 +770,171 @@ s32 func_80A98174(EnKo* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = 1.0f; } if (this->skelAnime.playSpeed == 0.0f) { - func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); + func_80034F54(play, this->unk_2E4, this->unk_304, 16); } func_80034A14(&this->actor, &this->unk_1E8, 2, (this->skelAnime.playSpeed == 0.0f) ? 2 : 1); return EnKo_IsWithinTalkAngle(this); } -s32 EnKo_ChildStart(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_ChildStart(EnKo* this, PlayState* play) { switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_0: - return func_80A97D68(this, globalCtx); + return func_80A97D68(this, play); case ENKO_TYPE_CHILD_1: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_2: - return func_80A98034(this, globalCtx); + return func_80A98034(this, play); case ENKO_TYPE_CHILD_3: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_4: - return func_80A97F70(this, globalCtx); + return func_80A97F70(this, play); case ENKO_TYPE_CHILD_5: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_6: - return func_80A97F20(this, globalCtx); + return func_80A97F20(this, play); case ENKO_TYPE_CHILD_7: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_8: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_9: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_10: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_11: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_FADO: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); } } -s32 EnKo_ChildStone(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_ChildStone(EnKo* this, PlayState* play) { switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_0: - return func_80A98124(this, globalCtx); + return func_80A98124(this, play); case ENKO_TYPE_CHILD_1: - return func_80A98124(this, globalCtx); + return func_80A98124(this, play); case ENKO_TYPE_CHILD_2: - return func_80A98034(this, globalCtx); + return func_80A98034(this, play); case ENKO_TYPE_CHILD_3: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_4: - return func_80A97F70(this, globalCtx); + return func_80A97F70(this, play); case ENKO_TYPE_CHILD_5: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_6: - return func_80A97F20(this, globalCtx); + return func_80A97F20(this, play); case ENKO_TYPE_CHILD_7: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_8: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_9: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_10: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_11: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_FADO: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); } } -s32 EnKo_ChildSaria(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_ChildSaria(EnKo* this, PlayState* play) { switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_0: - return func_80A98124(this, globalCtx); + return func_80A98124(this, play); case ENKO_TYPE_CHILD_1: - return func_80A98124(this, globalCtx); + return func_80A98124(this, play); case ENKO_TYPE_CHILD_2: - return func_80A98034(this, globalCtx); + return func_80A98034(this, play); case ENKO_TYPE_CHILD_3: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_4: - return func_80A98174(this, globalCtx); + return func_80A98174(this, play); case ENKO_TYPE_CHILD_5: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_6: - return func_80A97F20(this, globalCtx); + return func_80A97F20(this, play); case ENKO_TYPE_CHILD_7: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_8: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_9: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_10: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_11: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_FADO: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); } } -s32 EnKo_AdultEnemy(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_AdultEnemy(EnKo* this, PlayState* play) { switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_0: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_1: - return func_80A98124(this, globalCtx); + return func_80A98124(this, play); case ENKO_TYPE_CHILD_2: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_3: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_4: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_5: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_6: - return func_80A97F20(this, globalCtx); + return func_80A97F20(this, play); case ENKO_TYPE_CHILD_7: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_8: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_9: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_10: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_11: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_FADO: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); } } -s32 EnKo_AdultSaved(EnKo* this, GlobalContext* globalCtx) { +s32 EnKo_AdultSaved(EnKo* this, PlayState* play) { switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_0: - return func_80A98034(this, globalCtx); + return func_80A98034(this, play); case ENKO_TYPE_CHILD_1: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_2: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_3: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_4: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_5: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_6: - return func_80A97F20(this, globalCtx); + return func_80A97F20(this, play); case ENKO_TYPE_CHILD_7: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_8: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_9: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_10: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); case ENKO_TYPE_CHILD_11: - return func_80A97EB0(this, globalCtx); + return func_80A97EB0(this, play); case ENKO_TYPE_CHILD_FADO: - return func_80A97E18(this, globalCtx); + return func_80A97E18(this, play); } } -void func_80A9877C(EnKo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A9877C(EnKo* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) { - this->unk_1E8.unk_18 = globalCtx->view.eye; + if ((play->csCtx.state != 0) || (gDbgCamEnabled != 0)) { + this->unk_1E8.unk_18 = play->view.eye; this->unk_1E8.unk_14 = 40.0f; if (ENKO_TYPE != ENKO_TYPE_CHILD_0) { func_80034A14(&this->actor, &this->unk_1E8, 2, 2); @@ -942,15 +942,15 @@ void func_80A9877C(EnKo* this, GlobalContext* globalCtx) { } else { this->unk_1E8.unk_18 = player->actor.world.pos; this->unk_1E8.unk_14 = func_80A97BC0(this); - if ((func_80A98ECC(this, globalCtx) == 0) && (this->unk_1E8.unk_00 == 0)) { + if ((func_80A98ECC(this, play) == 0) && (this->unk_1E8.unk_00 == 0)) { return; } } - if (func_800343CC(globalCtx, &this->actor, &this->unk_1E8.unk_00, this->lookDist, func_80A97610, func_80A97738) && - ENKO_TYPE == ENKO_TYPE_CHILD_FADO && globalCtx->sceneNum == SCENE_SPOT10) { + if (func_800343CC(play, &this->actor, &this->unk_1E8.unk_00, this->lookDist, func_80A97610, func_80A97738) && + ENKO_TYPE == ENKO_TYPE_CHILD_FADO && play->sceneNum == SCENE_SPOT10) { this->actor.textId = INV_CONTENT(ITEM_TRADE_ADULT) > ITEM_ODD_POTION ? 0x10B9 : 0x10DF; - if (func_8002F368(globalCtx) == ENKO_TYPE_CHILD_9) { + if (func_8002F368(play) == ENKO_TYPE_CHILD_9) { this->actor.textId = GET_INFTABLE(INFTABLE_BC) ? 0x10B8 : 0x10B7; this->unk_210 = 0; } @@ -959,8 +959,8 @@ void func_80A9877C(EnKo* this, GlobalContext* globalCtx) { } // Checks if the Kokiri should spawn based on quest progress -s32 EnKo_CanSpawn(EnKo* this, GlobalContext* globalCtx) { - switch (globalCtx->sceneNum) { +s32 EnKo_CanSpawn(EnKo* this, PlayState* play) { + switch (play->sceneNum) { case SCENE_SPOT04: if (ENKO_TYPE >= ENKO_TYPE_CHILD_7 && ENKO_TYPE != ENKO_TYPE_CHILD_FADO) { return false; @@ -1065,15 +1065,15 @@ s32 EnKo_GetForestQuestState2(EnKo* this) { return ENKO_FQS_CHILD_START; } -void func_80A98DB4(EnKo* this, GlobalContext* globalCtx) { +void func_80A98DB4(EnKo* this, PlayState* play) { f32 dist; - if (globalCtx->sceneNum != SCENE_SPOT10 && globalCtx->sceneNum != SCENE_SPOT04) { + if (play->sceneNum != SCENE_SPOT10 && play->sceneNum != SCENE_SPOT04) { this->modelAlpha = 255.0f; return; } - if (globalCtx->csCtx.state != 0 || gDbgCamEnabled != 0) { - dist = Math_Vec3f_DistXYZ(&this->actor.world.pos, &globalCtx->view.eye) * 0.25f; + if (play->csCtx.state != 0 || gDbgCamEnabled != 0) { + dist = Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->view.eye) * 0.25f; } else { dist = this->actor.xzDistToPlayer; } @@ -1086,53 +1086,53 @@ void func_80A98DB4(EnKo* this, GlobalContext* globalCtx) { } } -s32 func_80A98ECC(EnKo* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT10 && ENKO_TYPE == ENKO_TYPE_CHILD_FADO) { - return func_80A97E18(this, globalCtx); +s32 func_80A98ECC(EnKo* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT10 && ENKO_TYPE == ENKO_TYPE_CHILD_FADO) { + return func_80A97E18(this, play); } switch (EnKo_GetForestQuestState(this)) { case ENKO_FQS_CHILD_START: - return EnKo_ChildStart(this, globalCtx); + return EnKo_ChildStart(this, play); case ENKO_FQS_CHILD_STONE: - return EnKo_ChildStone(this, globalCtx); + return EnKo_ChildStone(this, play); case ENKO_FQS_CHILD_SARIA: - return EnKo_ChildSaria(this, globalCtx); + return EnKo_ChildSaria(this, play); case ENKO_FQS_ADULT_ENEMY: - return EnKo_AdultEnemy(this, globalCtx); + return EnKo_AdultEnemy(this, play); case ENKO_FQS_ADULT_SAVED: - return EnKo_AdultSaved(this, globalCtx); + return EnKo_AdultSaved(this, play); } } -void EnKo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKo_Init(Actor* thisx, PlayState* play) { EnKo* this = (EnKo*)thisx; - if (ENKO_TYPE >= ENKO_TYPE_CHILD_MAX || !EnKo_IsOsAnimeAvailable(this, globalCtx) || - !EnKo_AreObjectsAvailable(this, globalCtx)) { + if (ENKO_TYPE >= ENKO_TYPE_CHILD_MAX || !EnKo_IsOsAnimeAvailable(this, play) || + !EnKo_AreObjectsAvailable(this, play)) { Actor_Kill(thisx); } - if (!EnKo_CanSpawn(this, globalCtx)) { + if (!EnKo_CanSpawn(this, play)) { Actor_Kill(thisx); } this->actionFunc = func_80A99048; } -void EnKo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKo_Destroy(Actor* thisx, PlayState* play) { EnKo* this = (EnKo*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80A99048(EnKo* this, GlobalContext* globalCtx) { - if (EnKo_IsOsAnimeLoaded(this, globalCtx) && EnKo_AreObjectsLoaded(this, globalCtx)) { +void func_80A99048(EnKo* this, PlayState* play) { + if (EnKo_IsOsAnimeLoaded(this, play) && EnKo_AreObjectsLoaded(this, play)) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.objBankIndex = this->legsObjectBankIdx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->actor.objBankIndex].segment); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, sSkeleton[sModelInfo[ENKO_TYPE].legsId].flexSkeletonHeader, - NULL, this->jointTable, this->morphTable, 16); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->actor.objBankIndex].segment); + SkelAnime_InitFlex(play, &this->skelAnime, sSkeleton[sModelInfo[ENKO_TYPE].legsId].flexSkeletonHeader, NULL, + this->jointTable, this->morphTable, 16); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->osAnimeBankIndex].segment); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (ENKO_TYPE == ENKO_TYPE_CHILD_7) { // "Angle Z" @@ -1155,8 +1155,8 @@ void func_80A99048(EnKo* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); func_80A98CD8(this); this->modelAlpha = 0.0f; - this->path = Path_GetByIndex(globalCtx, ENKO_PATH, 0xFF); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + this->path = Path_GetByIndex(play, ENKO_PATH, 0xFF); + 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, 3); if (ENKO_TYPE == ENKO_TYPE_CHILD_3) { if (!CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) { @@ -1170,50 +1170,50 @@ void func_80A99048(EnKo* this, GlobalContext* globalCtx) { } } -void func_80A99384(EnKo* this, GlobalContext* globalCtx) { +void func_80A99384(EnKo* this, PlayState* play) { if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 != 0 && this->actor.textId == 0x10B9) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_7); this->actionFunc = func_80A99438; } else if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 == 2) { this->actionFunc = func_80A99504; - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } } -void func_80A99438(EnKo* this, GlobalContext* globalCtx) { +void func_80A99438(EnKo* this, PlayState* play) { if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 == 2) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_6); this->actionFunc = func_80A99504; - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } else if (this->unk_1E8.unk_00 == 0 || this->actor.textId != 0x10B9) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_6); this->actionFunc = func_80A99384; } } -void func_80A99504(EnKo* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A99504(EnKo* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80A99560; } else { - func_8002F434(&this->actor, globalCtx, GI_SAW, 120.0f, 10.0f); + func_8002F434(&this->actor, play, GI_SAW, 120.0f, 10.0f); } } -void func_80A99560(EnKo* this, GlobalContext* globalCtx) { +void func_80A99560(EnKo* this, PlayState* play) { if (this->unk_1E8.unk_00 == 3) { this->actor.textId = 0x10B9; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E8.unk_00 = 1; SET_ITEMGETINF(ITEMGETINF_31); this->actionFunc = func_80A99384; } } -void func_80A995CC(EnKo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A995CC(EnKo* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp_f2; f32 phi_f0; s16 homeYawToPlayer = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); @@ -1237,39 +1237,38 @@ void func_80A995CC(EnKo* this, GlobalContext* globalCtx) { } } -void EnKo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKo_Update(Actor* thisx, PlayState* play) { ColliderCylinder* collider; EnKo* this = (EnKo*)thisx; s32 pad; if (this->actionFunc != func_80A99048) { if ((s32)this->modelAlpha != 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->osAnimeBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment); SkelAnime_Update(&this->skelAnime); - func_80A98DB4(this, globalCtx); + func_80A98DB4(this, play); EnKo_Blink(this); } else { - func_80A98DB4(this, globalCtx); + func_80A98DB4(this, play); } } if (this->unk_1E8.unk_00 == 0) { Actor_MoveForward(&this->actor); } if (func_80A97C7C(this)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); this->actor.gravity = -1.0f; } else { this->actor.gravity = 0.0f; } - this->actionFunc(this, globalCtx); - func_80A9877C(this, globalCtx); + this->actionFunc(this, play); + func_80A9877C(this, play); collider = &this->collider; Collider_UpdateCylinder(&this->actor, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetOC(play, &play->colChkCtx, &collider->base); } -s32 EnKo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { +s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnKo* this = (EnKo*)thisx; void* eyeTexture; Vec3s sp40; @@ -1277,8 +1276,8 @@ s32 EnKo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, s32 pad; if (limbIndex == 15) { - gSPSegment((*gfx)++, 0x06, globalCtx->objectCtx.status[this->headObjectBankIdx].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->headObjectBankIdx].segment); + gSPSegment((*gfx)++, 0x06, play->objectCtx.status[this->headObjectBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->headObjectBankIdx].segment); headId = sModelInfo[ENKO_TYPE].headId; *dList = sHead[headId].dList; @@ -1286,7 +1285,7 @@ s32 EnKo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, eyeTexture = sHead[headId].eyeTextures[this->eyeTextureIndex]; gSPSegment((*gfx)++, 0x0A, SEGMENTED_TO_VIRTUAL(eyeTexture)); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->legsObjectBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->legsObjectBankIdx].segment); } if (limbIndex == 8) { sp40 = this->unk_1E8.unk_0E; @@ -1307,14 +1306,14 @@ s32 EnKo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnKo_PostLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { - GlobalContext* globalCtx = globalCtx2; +void EnKo_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { + PlayState* play = play2; EnKo* this = (EnKo*)thisx; Vec3f D_80A9A774 = { 0.0f, 0.0f, 0.0f }; if (limbIndex == 7) { - gSPSegment((*gfx)++, 0x06, globalCtx->objectCtx.status[this->bodyObjectBankIdx].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->bodyObjectBankIdx].segment); + gSPSegment((*gfx)++, 0x06, play->objectCtx.status[this->bodyObjectBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->bodyObjectBankIdx].segment); } if (limbIndex == 15) { Matrix_MultVec3f(&D_80A9A774, &this->actor.focus.pos); @@ -1329,30 +1328,28 @@ Gfx* EnKo_SetEnvColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { return dList; } -void EnKo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKo_Draw(Actor* thisx, PlayState* play) { EnKo* this = (EnKo*)thisx; Color_RGBA8 tunicColor = sModelInfo[ENKO_TYPE].tunicColor; Color_RGBA8 bootsColor = sModelInfo[ENKO_TYPE].bootsColor; this->actor.shape.shadowAlpha = this->modelAlpha; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ko.c", 2095); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ko.c", 2095); if ((s16)this->modelAlpha == 255) { gSPSegment(POLY_OPA_DISP++, 0x08, - EnKo_SetEnvColor(globalCtx->state.gfxCtx, tunicColor.r, tunicColor.g, tunicColor.b, 255)); + EnKo_SetEnvColor(play->state.gfxCtx, tunicColor.r, tunicColor.g, tunicColor.b, 255)); gSPSegment(POLY_OPA_DISP++, 0x09, - EnKo_SetEnvColor(globalCtx->state.gfxCtx, bootsColor.r, bootsColor.g, bootsColor.b, 255)); - func_80034BA0(globalCtx, &this->skelAnime, EnKo_OverrideLimbDraw, EnKo_PostLimbDraw, &this->actor, - this->modelAlpha); + EnKo_SetEnvColor(play->state.gfxCtx, bootsColor.r, bootsColor.g, bootsColor.b, 255)); + func_80034BA0(play, &this->skelAnime, EnKo_OverrideLimbDraw, EnKo_PostLimbDraw, &this->actor, this->modelAlpha); } else if ((s16)this->modelAlpha != 0) { tunicColor.a = this->modelAlpha; bootsColor.a = this->modelAlpha; gSPSegment(POLY_XLU_DISP++, 0x08, - EnKo_SetEnvColor(globalCtx->state.gfxCtx, tunicColor.r, tunicColor.g, tunicColor.b, tunicColor.a)); + EnKo_SetEnvColor(play->state.gfxCtx, tunicColor.r, tunicColor.g, tunicColor.b, tunicColor.a)); gSPSegment(POLY_XLU_DISP++, 0x09, - EnKo_SetEnvColor(globalCtx->state.gfxCtx, bootsColor.r, bootsColor.g, bootsColor.b, bootsColor.a)); - func_80034CC4(globalCtx, &this->skelAnime, EnKo_OverrideLimbDraw, EnKo_PostLimbDraw, &this->actor, - this->modelAlpha); + EnKo_SetEnvColor(play->state.gfxCtx, bootsColor.r, bootsColor.g, bootsColor.b, bootsColor.a)); + func_80034CC4(play, &this->skelAnime, EnKo_OverrideLimbDraw, EnKo_PostLimbDraw, &this->actor, this->modelAlpha); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ko.c", 2136); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ko.c", 2136); } diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.h b/src/overlays/actors/ovl_En_Ko/z_en_ko.h index b7a60dd056..efce571d09 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.h +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.h @@ -6,7 +6,7 @@ struct EnKo; -typedef void (*EnKoActionFunc)(struct EnKo*, GlobalContext*); +typedef void (*EnKoActionFunc)(struct EnKo*, PlayState*); typedef struct EnKo { /* 0x0000 */ Actor 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 a3e358762d..ebccfefcbe 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -14,10 +14,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23) -void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKusa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKusa_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKusa_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKusa_Init(Actor* thisx, PlayState* play); +void EnKusa_Destroy(Actor* thisx, PlayState* play); +void EnKusa_Update(Actor* thisx, PlayState* play); +void EnKusa_Draw(Actor* thisx, PlayState* play); void EnKusa_SetupLiftedUp(EnKusa* this); void EnKusa_SetupWaitObject(EnKusa* this); @@ -27,14 +27,14 @@ void EnKusa_SetupCut(EnKusa* this); void EnKusa_SetupUprootedWaitRegrow(EnKusa* this); void EnKusa_SetupRegrow(EnKusa* this); -void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_WaitObject(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_Main(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_CutWaitRegrow(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_DoNothing(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_UprootedWaitRegrow(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_Regrow(EnKusa* this, GlobalContext* globalCtx); +void EnKusa_Fall(EnKusa* this, PlayState* play); +void EnKusa_WaitObject(EnKusa* this, PlayState* play); +void EnKusa_Main(EnKusa* this, PlayState* play); +void EnKusa_LiftedUp(EnKusa* this, PlayState* play); +void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play); +void EnKusa_DoNothing(EnKusa* this, PlayState* play); +void EnKusa_UprootedWaitRegrow(EnKusa* this, PlayState* play); +void EnKusa_Regrow(EnKusa* this, PlayState* play); static s16 rotSpeedXtarget = 0; static s16 rotSpeedX = 0; @@ -97,7 +97,7 @@ void EnKusa_SetupAction(EnKusa* this, EnKusaActionFunc actionFunc) { this->actionFunc = actionFunc; } -s32 EnKusa_SnapToFloor(EnKusa* this, GlobalContext* globalCtx, f32 yOffset) { +s32 EnKusa_SnapToFloor(EnKusa* this, PlayState* play, f32 yOffset) { s32 pad; CollisionPoly* poly; Vec3f pos; @@ -108,7 +108,7 @@ s32 EnKusa_SnapToFloor(EnKusa* this, GlobalContext* globalCtx, f32 yOffset) { pos.y = this->actor.world.pos.y + 30.0f; pos.z = this->actor.world.pos.z; - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &poly, &bgId, &this->actor, &pos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &poly, &bgId, &this->actor, &pos); if (floorY > BGCHECK_Y_MIN) { this->actor.world.pos.y = floorY + yOffset; @@ -123,7 +123,7 @@ s32 EnKusa_SnapToFloor(EnKusa* this, GlobalContext* globalCtx, f32 yOffset) { } } -void EnKusa_DropCollectible(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_DropCollectible(EnKusa* this, PlayState* play) { s16 dropParams; switch (this->actor.params & 3) { @@ -134,13 +134,13 @@ void EnKusa_DropCollectible(EnKusa* this, GlobalContext* globalCtx) { if (dropParams >= 0xD) { dropParams = 0; } - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, dropParams << 4); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, dropParams << 4); break; case ENKUSA_TYPE_1: if (Rand_ZeroOne() < 0.5f) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_SEEDS); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_SEEDS); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_HEART); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_HEART); } break; } @@ -167,7 +167,7 @@ void EnKusa_SetScaleSmall(EnKusa* this) { this->actor.scale.z = 0.120000005f; } -void EnKusa_SpawnFragments(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_SpawnFragments(EnKusa* this, PlayState* play) { Vec3f velocity; Vec3f pos; s32 i; @@ -188,8 +188,8 @@ void EnKusa_SpawnFragments(EnKusa* this, GlobalContext* globalCtx) { scaleIndex = (s32)(Rand_ZeroOne() * 111.1f) & 7; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, - 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, gCuttableShrubStalkDL); + 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; @@ -201,18 +201,18 @@ void EnKusa_SpawnFragments(EnKusa* this, GlobalContext* globalCtx) { scaleIndex = (s32)(Rand_ZeroOne() * 111.1f) % 7; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, - 80, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, gCuttableShrubTipDL); + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, 80, + KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, gCuttableShrubTipDL); } } -void EnKusa_SpawnBugs(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_SpawnBugs(EnKusa* this, PlayState* play) { s32 i; for (i = 0; i < 3; i++) { - Actor* bug = Actor_Spawn(&globalCtx->actorCtx, globalCtx, 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); + 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); if (bug == NULL) { break; @@ -220,24 +220,24 @@ void EnKusa_SpawnBugs(EnKusa* this, GlobalContext* globalCtx) { } } -void EnKusa_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa_InitCollider(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); } -void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa_Init(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.uncullZoneForward += 1000.0f; } - EnKusa_InitCollider(thisx, globalCtx); + EnKusa_InitCollider(thisx, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (this->actor.shape.rot.y == 0) { @@ -248,12 +248,12 @@ void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.y = rand; } - if (!EnKusa_SnapToFloor(this, globalCtx, 0.0f)) { + if (!EnKusa_SnapToFloor(this, play, 0.0f)) { Actor_Kill(&this->actor); return; } - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[thisx->params & 3]); + this->objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[thisx->params & 3]); if (this->objBankIndex < 0) { // "Bank danger!" @@ -265,19 +265,19 @@ void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) { EnKusa_SetupWaitObject(this); } -void EnKusa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnKusa_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnKusa* this = (EnKusa*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnKusa_SetupWaitObject(EnKusa* this) { EnKusa_SetupAction(this, EnKusa_WaitObject); } -void EnKusa_WaitObject(EnKusa* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { +void EnKusa_WaitObject(EnKusa* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { if (this->actor.flags & ACTOR_FLAG_ENKUSA_CUT) { EnKusa_SetupCut(this); } else { @@ -295,20 +295,20 @@ void EnKusa_SetupMain(EnKusa* this) { this->actor.flags &= ~ACTOR_FLAG_4; } -void EnKusa_Main(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_Main(EnKusa* this, PlayState* play) { s32 pad; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { EnKusa_SetupLiftedUp(this); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT); + SoundSource_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, globalCtx); - EnKusa_DropCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); + EnKusa_SpawnFragments(this, play); + EnKusa_DropCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); if ((this->actor.params >> 4) & 1) { - EnKusa_SpawnBugs(this, globalCtx); + EnKusa_SpawnBugs(this, play); } if ((this->actor.params & 3) == ENKUSA_TYPE_0) { @@ -325,12 +325,12 @@ void EnKusa_Main(EnKusa* this, GlobalContext* globalCtx) { if (this->actor.xzDistToPlayer < 600.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 400.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } } } @@ -343,9 +343,9 @@ void EnKusa_SetupLiftedUp(EnKusa* this) { this->actor.flags |= ACTOR_FLAG_4; } -void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.curRoom.num; +void EnKusa_LiftedUp(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.speedXZ * Math_SinS(this->actor.world.rot.y); this->actor.velocity.z = this->actor.speedXZ * Math_CosS(this->actor.world.rot.y); @@ -354,7 +354,7 @@ void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx) { EnKusa_UpdateVelY(this); EnKusa_RandScaleVecToZero(&this->actor.velocity, 0.005f); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_6 | UPDBGCHECKINFO_FLAG_7); this->actor.gravity = -3.2f; @@ -369,16 +369,16 @@ void EnKusa_SetupFall(EnKusa* this) { rotSpeedY = 0; } -void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_Fall(EnKusa* this, PlayState* play) { s32 pad; Vec3f contactPos; if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); } - EnKusa_SpawnFragments(this, globalCtx); - EnKusa_DropCollectible(this, globalCtx); + EnKusa_SpawnFragments(this, play); + EnKusa_DropCollectible(this, play); switch (this->actor.params & 3) { case ENKUSA_TYPE_0: case ENKUSA_TYPE_2: @@ -396,17 +396,17 @@ void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { contactPos.x = this->actor.world.pos.x; contactPos.y = this->actor.world.pos.y + this->actor.yDistToWater; contactPos.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &contactPos, NULL, NULL, 0, 400); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 150, 650, 0); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 400, 800, 4); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 500, 1100, 8); + 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); this->actor.minVelocityY = -3.0f; rotSpeedX >>= 1; rotSpeedXtarget >>= 1; rotSpeedY >>= 1; rotSpeedYtarget >>= 1; this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); } EnKusa_UpdateVelY(this); @@ -416,11 +416,11 @@ void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { this->actor.shape.rot.y += rotSpeedY; EnKusa_RandScaleVecToZero(&this->actor.velocity, 0.05f); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, + 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(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } void EnKusa_SetupCut(EnKusa* this) { @@ -434,13 +434,13 @@ void EnKusa_SetupCut(EnKusa* this) { } } -void EnKusa_CutWaitRegrow(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play) { if (this->timer >= 120) { EnKusa_SetupRegrow(this); } } -void EnKusa_DoNothing(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_DoNothing(EnKusa* this, PlayState* play) { } void EnKusa_SetupUprootedWaitRegrow(EnKusa* this) { @@ -452,7 +452,7 @@ void EnKusa_SetupUprootedWaitRegrow(EnKusa* this) { EnKusa_SetupAction(this, EnKusa_UprootedWaitRegrow); } -void EnKusa_UprootedWaitRegrow(EnKusa* this, GlobalContext* globalCtx) { +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) { @@ -469,7 +469,7 @@ void EnKusa_SetupRegrow(EnKusa* this) { this->actor.flags &= ~ACTOR_FLAG_ENKUSA_CUT; } -void EnKusa_Regrow(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_Regrow(EnKusa* this, PlayState* play) { s32 isFullyGrown = true; isFullyGrown &= Math_StepToF(&this->actor.scale.y, 0.4f, 0.014f); @@ -483,12 +483,12 @@ void EnKusa_Regrow(EnKusa* this, GlobalContext* globalCtx) { } } -void EnKusa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa_Update(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; this->timer++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.flags & ACTOR_FLAG_ENKUSA_CUT) { this->actor.shape.yOffset = -6.25f; @@ -497,13 +497,13 @@ void EnKusa_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKusa_Draw(Actor* thisx, GlobalContext* globalCtx) { +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_ENKUSA_CUT) { - Gfx_DrawDListOpa(globalCtx, object_kusa_DL_0002E0); + Gfx_DrawDListOpa(play, object_kusa_DL_0002E0); } else { - Gfx_DrawDListOpa(globalCtx, dLists[thisx->params & 3]); + Gfx_DrawDListOpa(play, dLists[thisx->params & 3]); } } 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 a5ef48687e..3a922ebce8 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -6,7 +6,7 @@ struct EnKusa; -typedef void (*EnKusaActionFunc)(struct EnKusa*, GlobalContext*); +typedef void (*EnKusaActionFunc)(struct EnKusa*, PlayState*); typedef enum { /* 0 */ ENKUSA_TYPE_0, 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 58534a81b8..551c982a06 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -9,18 +9,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnKz_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKz_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKz_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKz_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKz_Init(Actor* thisx, PlayState* play); +void EnKz_Destroy(Actor* thisx, PlayState* play); +void EnKz_Update(Actor* thisx, PlayState* play); +void EnKz_Draw(Actor* thisx, PlayState* play); -void EnKz_PreMweepWait(EnKz* this, GlobalContext* globalCtx); -void EnKz_SetupMweep(EnKz* this, GlobalContext* globalCtx); -void EnKz_Mweep(EnKz* this, GlobalContext* globalCtx); -void EnKz_StopMweep(EnKz* this, GlobalContext* globalCtx); -void EnKz_Wait(EnKz* this, GlobalContext* globalCtx); -void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx); -void EnKz_StartTimer(EnKz* this, GlobalContext* globalCtx); +void EnKz_PreMweepWait(EnKz* this, PlayState* play); +void EnKz_SetupMweep(EnKz* this, PlayState* play); +void EnKz_Mweep(EnKz* this, PlayState* play); +void EnKz_StopMweep(EnKz* this, PlayState* play); +void EnKz_Wait(EnKz* this, PlayState* play); +void EnKz_SetupGetItem(EnKz* this, PlayState* play); +void EnKz_StartTimer(EnKz* this, PlayState* play); const ActorInit En_Kz_InitVars = { ACTOR_EN_KZ, @@ -68,8 +68,8 @@ static AnimationInfo sAnimationInfo[] = { { &gKzMweepAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, }; -u16 EnKz_GetTextNoMaskChild(GlobalContext* globalCtx, EnKz* this) { - Player* player = GET_PLAYER(globalCtx); +u16 EnKz_GetTextNoMaskChild(PlayState* play, EnKz* this) { + Player* player = GET_PLAYER(play); if (CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) { return 0x402B; @@ -81,8 +81,8 @@ u16 EnKz_GetTextNoMaskChild(GlobalContext* globalCtx, EnKz* this) { } } -u16 EnKz_GetTextNoMaskAdult(GlobalContext* globalCtx, EnKz* this) { - Player* player = GET_PLAYER(globalCtx); +u16 EnKz_GetTextNoMaskAdult(PlayState* play, EnKz* this) { + Player* player = GET_PLAYER(play); if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_FROG) { if (!GET_INFTABLE(INFTABLE_139)) { @@ -100,26 +100,26 @@ u16 EnKz_GetTextNoMaskAdult(GlobalContext* globalCtx, EnKz* this) { } } -u16 EnKz_GetText(GlobalContext* globalCtx, Actor* thisx) { +u16 EnKz_GetText(PlayState* play, Actor* thisx) { EnKz* this = (EnKz*)thisx; - u16 reactionText = Text_GetFaceReaction(globalCtx, 0x1E); + u16 reactionText = Text_GetFaceReaction(play, 0x1E); if (reactionText != 0) { return reactionText; } if (LINK_IS_ADULT) { - return EnKz_GetTextNoMaskAdult(globalCtx, this); + return EnKz_GetTextNoMaskAdult(play, this); } else { - return EnKz_GetTextNoMaskChild(globalCtx, this); + return EnKz_GetTextNoMaskChild(play, this); } } -s16 func_80A9C6C0(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80A9C6C0(PlayState* play, Actor* thisx) { EnKz* this = (EnKz*)thisx; s16 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_DONE: ret = 0; switch (this->actor.textId) { @@ -128,7 +128,7 @@ s16 func_80A9C6C0(GlobalContext* globalCtx, Actor* thisx) { ret = 2; break; case 0x401B: - ret = !Message_ShouldAdvance(globalCtx) ? 1 : 2; + ret = !Message_ShouldAdvance(play) ? 1 : 2; break; case 0x401F: SET_INFTABLE(INFTABLE_139); @@ -149,21 +149,21 @@ s16 func_80A9C6C0(GlobalContext* globalCtx, Actor* thisx) { } break; case TEXT_STATE_CHOICE: - if (!Message_ShouldAdvance(globalCtx)) { + if (!Message_ShouldAdvance(play)) { break; } if (this->actor.textId == 0x4014) { - if (globalCtx->msgCtx.choiceIndex == 0) { - EnKz_SetupGetItem(this, globalCtx); + if (play->msgCtx.choiceIndex == 0) { + EnKz_SetupGetItem(this, play); ret = 2; } else { this->actor.textId = 0x4016; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 2; } break; @@ -188,21 +188,21 @@ void EnKz_UpdateEyes(EnKz* this) { } } -s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, callback1_800343CC callback1, +s32 func_80A9C95C(PlayState* play, EnKz* this, s16* arg2, f32 unkf, callback1_800343CC callback1, callback2_800343CC callback2) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 sp32; s16 sp30; f32 xzDistToPlayer; f32 yaw; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { *arg2 = 1; return 1; } if (*arg2 != 0) { - *arg2 = callback2(globalCtx, &this->actor); + *arg2 = callback2(play, &this->actor); return 0; } @@ -215,29 +215,29 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal this->actor.flags |= ACTOR_FLAG_0; - Actor_GetScreenPos(globalCtx, &this->actor, &sp32, &sp30); + Actor_GetScreenPos(play, &this->actor, &sp32, &sp30); if (!((sp32 >= -30) && (sp32 < 361) && (sp30 >= -10) && (sp30 < 241))) { return 0; } xzDistToPlayer = this->actor.xzDistToPlayer; this->actor.xzDistToPlayer = Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos); - if (func_8002F2CC(&this->actor, globalCtx, unkf) == 0) { + if (func_8002F2CC(&this->actor, play, unkf) == 0) { this->actor.xzDistToPlayer = xzDistToPlayer; return 0; } this->actor.xzDistToPlayer = xzDistToPlayer; - this->actor.textId = callback1(globalCtx, &this->actor); + this->actor.textId = callback1(play, &this->actor); return 0; } -void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A9CB18(EnKz* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (func_80A9C95C(globalCtx, this, &this->unk_1E0.unk_00, 340.0f, EnKz_GetText, func_80A9C6C0)) { + if (func_80A9C95C(play, this, &this->unk_1E0.unk_00, 340.0f, EnKz_GetText, func_80A9C6C0)) { if ((this->actor.textId == 0x401A) && !GET_EVENTCHKINF(EVENTCHKINF_33)) { - if (func_8002F368(globalCtx) == EXCH_ITEM_LETTER_RUTO) { + if (func_8002F368(play) == EXCH_ITEM_LETTER_RUTO) { this->actor.textId = 0x401B; this->sfxPlayed = false; } else { @@ -249,7 +249,7 @@ void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) { if (LINK_IS_ADULT) { if ((INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_PRESCRIPTION) && - (func_8002F368(globalCtx) == EXCH_ITEM_PRESCRIPTION)) { + (func_8002F368(play) == EXCH_ITEM_PRESCRIPTION)) { this->actor.textId = 0x4014; this->sfxPlayed = false; player->actor.textId = this->actor.textId; @@ -269,7 +269,7 @@ void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) { } } -s32 EnKz_FollowPath(EnKz* this, GlobalContext* globalCtx) { +s32 EnKz_FollowPath(EnKz* this, PlayState* play) { Path* path; Vec3s* pointPos; f32 pathDiffX; @@ -279,7 +279,7 @@ s32 EnKz_FollowPath(EnKz* this, GlobalContext* globalCtx) { return 0; } - path = &globalCtx->setupPathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->setupPathList[(this->actor.params & 0xFF00) >> 8]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->waypoint; @@ -297,7 +297,7 @@ s32 EnKz_FollowPath(EnKz* this, GlobalContext* globalCtx) { return 0; } -s32 EnKz_SetMovedPos(EnKz* this, GlobalContext* globalCtx) { +s32 EnKz_SetMovedPos(EnKz* this, PlayState* play) { Path* path; Vec3s* lastPointPos; @@ -305,7 +305,7 @@ s32 EnKz_SetMovedPos(EnKz* this, GlobalContext* globalCtx) { return 0; } - path = &globalCtx->setupPathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->setupPathList[(this->actor.params & 0xFF00) >> 8]; lastPointPos = SEGMENTED_TO_VIRTUAL(path->points); lastPointPos += path->count - 1; @@ -316,14 +316,14 @@ s32 EnKz_SetMovedPos(EnKz* this, GlobalContext* globalCtx) { return 1; } -void EnKz_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKz_Init(Actor* thisx, PlayState* play) { EnKz* this = (EnKz*)thisx; s32 pad; - SkelAnime_InitFlex(globalCtx, &this->skelanime, &gKzSkel, NULL, this->jointTable, this->morphTable, 12); + SkelAnime_InitFlex(play, &this->skelanime, &gKzSkel, NULL, this->jointTable, this->morphTable, 12); ActorShape_Init(&this->actor.shape, 0.0, NULL, 0.0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01); this->actor.targetMode = 3; @@ -331,14 +331,13 @@ void EnKz_Init(Actor* thisx, GlobalContext* globalCtx) { Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_0); if (GET_EVENTCHKINF(EVENTCHKINF_33)) { - EnKz_SetMovedPos(this, globalCtx); + EnKz_SetMovedPos(this, play); } if (LINK_IS_ADULT) { if (!GET_INFTABLE(INFTABLE_138)) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BG_ICE_SHELTER, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, - 0x04FF); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BG_ICE_SHELTER, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x04FF); } this->actionFunc = EnKz_Wait; } else { @@ -346,43 +345,43 @@ void EnKz_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKz_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKz_Destroy(Actor* thisx, PlayState* play) { EnKz* this = (EnKz*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnKz_PreMweepWait(EnKz* this, GlobalContext* globalCtx) { +void EnKz_PreMweepWait(EnKz* this, PlayState* play) { if (this->unk_1E0.unk_00 == 2) { Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_2); this->unk_1E0.unk_00 = 0; this->actionFunc = EnKz_SetupMweep; } else { - func_80034F54(globalCtx, this->unk_2A6, this->unk_2BE, 12); + func_80034F54(play, this->unk_2A6, this->unk_2BE, 12); } } -void EnKz_SetupMweep(EnKz* this, GlobalContext* globalCtx) { +void EnKz_SetupMweep(EnKz* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; // unused Vec3f subCamAt; Vec3f subCamEye; - this->subCamId = Play_CreateSubCamera(globalCtx); - this->returnToCamId = globalCtx->activeCamId; - Play_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamId = Play_CreateSubCamera(play); + this->returnToCamId = play->activeCamId; + Play_ChangeCameraStatus(play, this->returnToCamId, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); subCamAt = this->actor.world.pos; subCamEye = this->actor.home.pos; subCamAt.y += 60.0f; subCamEye.y += -100.0f; subCamEye.z += 260.0f; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); - func_8002DF54(globalCtx, &this->actor, 8); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + func_8002DF54(play, &this->actor, 8); this->actor.speedXZ = 0.1f; this->actionFunc = EnKz_Mweep; } -void EnKz_Mweep(EnKz* this, GlobalContext* globalCtx) { +void EnKz_Mweep(EnKz* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; // unused Vec3f subCamAt; Vec3f subCamEye; @@ -392,11 +391,11 @@ void EnKz_Mweep(EnKz* this, GlobalContext* globalCtx) { subCamAt.y += 60.0f; subCamEye.y += -100.0f; subCamEye.z += 260.0f; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); - if ((EnKz_FollowPath(this, globalCtx) == 1) && (this->waypoint == 0)) { + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + if ((EnKz_FollowPath(this, play) == 1) && (this->waypoint == 0)) { Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_1); - Inventory_ReplaceItem(globalCtx, ITEM_LETTER_RUTO, ITEM_BOTTLE); - EnKz_SetMovedPos(this, globalCtx); + Inventory_ReplaceItem(play, ITEM_LETTER_RUTO, ITEM_BOTTLE); + EnKz_SetMovedPos(this, play); SET_EVENTCHKINF(EVENTCHKINF_33); this->actor.speedXZ = 0.0; this->actionFunc = EnKz_StopMweep; @@ -406,28 +405,28 @@ void EnKz_Mweep(EnKz* this, GlobalContext* globalCtx) { } } -void EnKz_StopMweep(EnKz* this, GlobalContext* globalCtx) { - Play_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_ACTIVE); - Play_ClearCamera(globalCtx, this->subCamId); - func_8002DF54(globalCtx, &this->actor, 7); +void EnKz_StopMweep(EnKz* this, PlayState* play) { + Play_ChangeCameraStatus(play, this->returnToCamId, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->subCamId); + func_8002DF54(play, &this->actor, 7); this->actionFunc = EnKz_Wait; } -void EnKz_Wait(EnKz* this, GlobalContext* globalCtx) { +void EnKz_Wait(EnKz* this, PlayState* play) { if (this->unk_1E0.unk_00 == 2) { this->actionFunc = EnKz_SetupGetItem; - EnKz_SetupGetItem(this, globalCtx); + EnKz_SetupGetItem(this, play); } else { - func_80034F54(globalCtx, this->unk_2A6, this->unk_2BE, 12); + func_80034F54(play, this->unk_2A6, this->unk_2BE, 12); } } -void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx) { +void EnKz_SetupGetItem(EnKz* this, PlayState* play) { s32 getItemId; f32 xzRange; f32 yRange; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->unk_1E0.unk_00 = 1; this->actionFunc = EnKz_StartTimer; @@ -435,12 +434,12 @@ void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx) { getItemId = this->isTrading == true ? GI_FROG : GI_TUNIC_ZORA; yRange = fabsf(this->actor.yDistToPlayer) + 1.0f; xzRange = this->actor.xzDistToPlayer + 1.0f; - func_8002F434(&this->actor, globalCtx, getItemId, xzRange, yRange); + func_8002F434(&this->actor, play, getItemId, xzRange, yRange); } } -void EnKz_StartTimer(EnKz* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnKz_StartTimer(EnKz* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_FROG) { func_80088AA0(180); // start timer2 with 3 minutes CLEAR_EVENTINF(EVENTINF_10); @@ -450,7 +449,7 @@ void EnKz_StartTimer(EnKz* this, GlobalContext* globalCtx) { } } -void EnKz_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKz_Update(Actor* thisx, PlayState* play) { EnKz* this = (EnKz*)thisx; s32 pad; @@ -458,17 +457,17 @@ void EnKz_Update(Actor* thisx, GlobalContext* globalCtx) { SET_INFTABLE(INFTABLE_138); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelanime); EnKz_UpdateEyes(this); Actor_MoveForward(&this->actor); if (this->actionFunc != EnKz_StartTimer) { - func_80A9CB18(this, globalCtx); + func_80A9CB18(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnKz_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnKz_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnKz* this = (EnKz*)thisx; if (limbIndex == 8 || limbIndex == 9 || limbIndex == 10) { @@ -479,7 +478,7 @@ s32 EnKz_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnKz_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnKz_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnKz* this = (EnKz*)thisx; Vec3f mult = { 2600.0f, 0.0f, 0.0f }; @@ -488,7 +487,7 @@ void EnKz_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnKz_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKz_Draw(Actor* thisx, PlayState* play) { static void* sEyeSegments[] = { gKzEyeOpenTex, gKzEyeHalfTex, @@ -496,12 +495,12 @@ void EnKz_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnKz* this = (EnKz*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_kz.c", 1259); + OPEN_DISPS(play->state.gfxCtx, "../z_en_kz.c", 1259); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeSegments[this->eyeIdx])); - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, EnKz_OverrideLimbDraw, EnKz_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_kz.c", 1281); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_kz.c", 1281); } diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.h b/src/overlays/actors/ovl_En_Kz/z_en_kz.h index 2497608143..bd773b4799 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.h +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.h @@ -6,7 +6,7 @@ struct EnKz; -typedef void (*EnKzActionFunc)(struct EnKz*, GlobalContext*); +typedef void (*EnKzActionFunc)(struct EnKz*, PlayState*); typedef struct EnKz { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index 4de749d163..ff3f13ec2b 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -10,11 +10,11 @@ #define FLAGS 0 -void EnLight_Init(Actor* thisx, GlobalContext* globalCtx); -void EnLight_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnLight_Update(Actor* thisx, GlobalContext* globalCtx); -void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx); +void EnLight_Init(Actor* thisx, PlayState* play); +void EnLight_Destroy(Actor* thisx, PlayState* play); +void EnLight_Update(Actor* thisx, PlayState* play); +void EnLight_Draw(Actor* thisx, PlayState* play); +void EnLight_UpdateSwitch(Actor* thisx, PlayState* play); const ActorInit En_Light_InitVars = { ACTOR_EN_LIGHT, @@ -45,7 +45,7 @@ static FlameParams D_80A9E840[] = { { { 170, 255, 255, 255 }, { 0, 0, 255 }, 75 }, { { 170, 255, 255, 255 }, { 0, 150, 255 }, 75 }, }; -void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_Init(Actor* thisx, PlayState* play) { EnLight* this = (EnLight*)thisx; s16 yOffset; @@ -60,7 +60,7 @@ void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.z, 255, 255, 180, -1); } - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Actor_SetScale(&this->actor, D_80A9E840[this->actor.params & 0xF].scale * 0.0001f); this->timer = (s32)(Rand_ZeroOne() * 255.0f); @@ -69,15 +69,15 @@ void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnLight_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_Destroy(Actor* thisx, PlayState* play) { EnLight* this = (EnLight*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void EnLight_UpdatePosRot(EnLight* this, GlobalContext* globalCtx) { +void EnLight_UpdatePosRot(EnLight* this, PlayState* play) { // update yaw for billboard effect - this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000; + this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000; if (this->actor.parent != NULL) { Math_Vec3f_Copy(&this->actor.world.pos, &(this->actor.parent)->world.pos); @@ -87,7 +87,7 @@ void EnLight_UpdatePosRot(EnLight* this, GlobalContext* globalCtx) { this->timer++; } -void EnLight_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_Update(Actor* thisx, PlayState* play) { f32 intensity; FlameParams* flameParams; s16 radius; @@ -99,14 +99,14 @@ void EnLight_Update(Actor* thisx, GlobalContext* globalCtx) { Lights_PointSetColorAndRadius(&this->lightInfo, (flameParams->primColor.r * intensity), (flameParams->primColor.g * intensity), (flameParams->primColor.b * intensity), radius); - EnLight_UpdatePosRot(this, globalCtx); + EnLight_UpdatePosRot(this, play); if (this->actor.params >= 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } } -void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_UpdateSwitch(Actor* thisx, PlayState* play) { f32 intensity; FlameParams* flameParams; EnLight* this = (EnLight*)thisx; @@ -116,7 +116,7 @@ void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) { scale = this->actor.scale.x / ((f32)flameParams->scale * 0.0001); if ((this->actor.params & 0x800) != 0) { - if (Flags_GetSwitch(globalCtx, (this->actor.params & 0x3F0) >> 4)) { + if (Flags_GetSwitch(play, (this->actor.params & 0x3F0) >> 4)) { Math_StepToF(&scale, 1.0f, 0.05f); } else { if (scale < 0.1f) { @@ -126,7 +126,7 @@ void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) { Math_StepToF(&scale, 0.0f, 0.05f); } } else { - if (Flags_GetSwitch(globalCtx, (this->actor.params & 0x3F0) >> 4)) { + if (Flags_GetSwitch(play, (this->actor.params & 0x3F0) >> 4)) { if (scale < 0.1f) { Actor_SetScale(&this->actor, 0.0f); return; @@ -142,14 +142,14 @@ void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) { Lights_PointSetColorAndRadius(&this->lightInfo, (flameParams->primColor.r * intensity), (flameParams->primColor.g * intensity), (flameParams->primColor.b * intensity), 300.0f * scale); - EnLight_UpdatePosRot(this, globalCtx); + EnLight_UpdatePosRot(this, play); if (this->actor.params >= 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } } -void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_Draw(Actor* thisx, PlayState* play) { EnLight* this = (EnLight*)thisx; s32 pad; FlameParams* flameParams; @@ -159,14 +159,13 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { flameParams = &D_80A9E840[this->actor.params & 0xF]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_light.c", 441); + OPEN_DISPS(play->state.gfxCtx, "../z_en_light.c", 441); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->actor.params >= 0) { - gSPSegment( - POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (this->timer * -20) & 511, 32, 128)); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (this->timer * -20) & 511, 32, 128)); dList = gEffFire1DL; gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, flameParams->primColor.r, flameParams->primColor.g, @@ -174,7 +173,7 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, flameParams->envColor.r, flameParams->envColor.g, flameParams->envColor.b, 0); } else { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 32, 1, ((this->timer * 2) & 63), + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 16, 32, 1, ((this->timer * 2) & 63), (this->timer * -6) & 127 * 1, 16, 32)); dList = gUnusedCandleDL; @@ -182,18 +181,17 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); } - Matrix_RotateY( - BINANG_TO_RAD((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y) + 0x8000)), - MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y) + 0x8000)), + MTXMODE_APPLY); if (this->actor.params & 1) { Matrix_RotateY(M_PI, MTXMODE_APPLY); } Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_light.c", 488), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_light.c", 488), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, dList); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_light.c", 491); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_light.c", 491); } diff --git a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c index 6bff41d398..7a7aee10c5 100644 --- a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c +++ b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c @@ -9,10 +9,10 @@ #define FLAGS ACTOR_FLAG_4 -void EnLightbox_Init(Actor* thisx, GlobalContext* globalCtx); -void EnLightbox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnLightbox_Update(Actor* thisx, GlobalContext* globalCtx); -void EnLightbox_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnLightbox_Init(Actor* thisx, PlayState* play); +void EnLightbox_Destroy(Actor* thisx, PlayState* play); +void EnLightbox_Update(Actor* thisx, PlayState* play); +void EnLightbox_Draw(Actor* thisx, PlayState* play); const ActorInit En_Lightbox_InitVars = { ACTOR_EN_LIGHTBOX, @@ -26,7 +26,7 @@ const ActorInit En_Lightbox_InitVars = { (ActorFunc)EnLightbox_Draw, }; -void EnLightbox_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnLightbox_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; EnLightbox* this = (EnLightbox*)thisx; s32 pad[4]; @@ -56,24 +56,24 @@ void EnLightbox_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->targetMode = 0; thisx->gravity = -2.0f; CollisionHeader_GetVirtual(&object_lightbox_Col_001F10, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } -void EnLightbox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnLightbox_Destroy(Actor* thisx, PlayState* play) { EnLightbox* this = (EnLightbox*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void EnLightbox_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnLightbox_Update(Actor* thisx, PlayState* play) { EnLightbox* this = (EnLightbox*)thisx; if (this->dyna.unk_162 != 0) { - if (Actor_HasNoParent(thisx, globalCtx)) { + if (Actor_HasNoParent(thisx, play)) { this->dyna.unk_162 = 0; } } else { - if (Actor_HasParent(thisx, globalCtx)) { + if (Actor_HasParent(thisx, play)) { this->dyna.unk_162++; } else { if (thisx->speedXZ) { @@ -96,18 +96,18 @@ void EnLightbox_Update(Actor* thisx, GlobalContext* globalCtx) { thisx->velocity.y *= IREG(60) / 100.0f; thisx->bgCheckFlags &= ~BGCHECKFLAG_GROUND; } else { - func_8002F580(thisx, globalCtx); + func_8002F580(thisx, play); } } } } Actor_MoveForward(thisx); Actor_UpdateBgCheckInfo( - globalCtx, thisx, thisx->colChkInfo.cylHeight, thisx->colChkInfo.cylRadius, thisx->colChkInfo.cylRadius, + play, thisx, thisx->colChkInfo.cylHeight, thisx->colChkInfo.cylRadius, thisx->colChkInfo.cylRadius, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); thisx->focus.pos = thisx->world.pos; } -void EnLightbox_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_lightbox_DL_000B70); +void EnLightbox_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_lightbox_DL_000B70); } diff --git a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c index 49edf4ff10..989103908d 100644 --- a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c +++ b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c @@ -8,9 +8,9 @@ #define FLAGS 0 -void EnMFire1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMFire1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMFire1_Update(Actor* thisx, GlobalContext* globalCtx); +void EnMFire1_Init(Actor* thisx, PlayState* play); +void EnMFire1_Destroy(Actor* thisx, PlayState* play); +void EnMFire1_Update(Actor* thisx, PlayState* play); const ActorInit En_M_Fire1_InitVars = { ACTOR_EN_M_FIRE1, @@ -44,25 +44,25 @@ static ColliderCylinderInit sCylinderInit = { { 200, 200, 0, { 0 } }, }; -void EnMFire1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMFire1_Init(Actor* thisx, PlayState* play) { EnMFire1* this = (EnMFire1*)thisx; s32 pad; if (this->actor.params < 0) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION); } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } -void EnMFire1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMFire1_Destroy(Actor* thisx, PlayState* play) { EnMFire1* this = (EnMFire1*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnMFire1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMFire1_Update(Actor* thisx, PlayState* play) { EnMFire1* this = (EnMFire1*)thisx; s32 pad; @@ -70,6 +70,6 @@ void EnMFire1_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } else { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } 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 07e1bbbcb9..6812b65ea7 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 @@ -3,14 +3,14 @@ #define FLAGS 0 -void EnMThunder_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMThunder_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMThunder_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx); +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* play); -void func_80A9F314(GlobalContext* globalCtx, f32 arg1); -void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx); -void func_80A9F9B4(EnMThunder* this, GlobalContext* globalCtx); +void func_80A9F314(PlayState* play, f32 arg1); +void func_80A9F408(EnMThunder* this, PlayState* play); +void func_80A9F9B4(EnMThunder* this, PlayState* play); const ActorInit En_M_Thunder_InitVars = { ACTOR_EN_M_THUNDER, @@ -59,17 +59,17 @@ void func_80A9EFE0(EnMThunder* this, EnMThunderActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnMThunder_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnMThunder_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnMThunder* this = (EnMThunder*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80AA0420); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &D_80AA0420); this->unk_1C7 = (this->actor.params & 0xFF) - 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(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); this->collider.dim.radius = 0; this->collider.dim.height = 40; this->collider.dim.yShift = -20; @@ -85,8 +85,7 @@ void EnMThunder_Init(Actor* thisx, GlobalContext* globalCtx2) { if (player->stateFlags2 & PLAYER_STATE2_17) { if (!gSaveContext.magicAcquired || gSaveContext.unk_13F0 || - (((this->actor.params & 0xFF00) >> 8) && - !(func_80087708(globalCtx, (this->actor.params & 0xFF00) >> 8, 0)))) { + (((this->actor.params & 0xFF00) >> 8) && !(func_80087708(play, (this->actor.params & 0xFF00) >> 8, 0)))) { Audio_PlaySoundGeneral(NA_SE_IT_ROLLING_CUT, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); Audio_PlaySoundGeneral(NA_SE_IT_SWORD_SWING_HARD, &player->actor.projectedPos, 4, @@ -111,24 +110,24 @@ void EnMThunder_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.child = NULL; } -void EnMThunder_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMThunder_Destroy(Actor* thisx, PlayState* play) { EnMThunder* this = (EnMThunder*)thisx; if (this->unk_1CA != 0) { - func_800876C8(globalCtx); + func_800876C8(play); } - Collider_DestroyCylinder(globalCtx, &this->collider); - func_80A9F314(globalCtx, 0.0f); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); + func_80A9F314(play, 0.0f); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void func_80A9F314(GlobalContext* globalCtx, f32 arg1) { - Environment_AdjustLights(globalCtx, arg1, 850.0f, 0.2f, 0.0f); +void func_80A9F314(PlayState* play, f32 arg1) { + Environment_AdjustLights(play, arg1, 850.0f, 0.2f, 0.0f); } -void func_80A9F350(EnMThunder* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A9F350(EnMThunder* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags2 & PLAYER_STATE2_17) { if (player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) { @@ -147,8 +146,8 @@ void func_80A9F350(EnMThunder* this, GlobalContext* globalCtx) { } } -void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A9F408(EnMThunder* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* child = this->actor.child; this->unk_1B8 = player->unk_858; @@ -158,8 +157,8 @@ void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx) { if (this->unk_1CA == 0) { if (player->unk_858 >= 0.1f) { if ((gSaveContext.unk_13F0) || (((this->actor.params & 0xFF00) >> 8) && - !(func_80087708(globalCtx, (this->actor.params & 0xFF00) >> 8, 4)))) { - func_80A9F350(this, globalCtx); + !(func_80087708(play, (this->actor.params & 0xFF00) >> 8, 4)))) { + func_80A9F350(this, play); func_80A9EFE0(this, func_80A9F350); this->unk_1C8 = 0; this->unk_1BC = 0.0; @@ -224,7 +223,7 @@ void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx) { if (player->unk_858 > 0.15f) { this->unk_1C8 = 255; if (this->actor.child == NULL) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EFF_DUST, this->actor.world.pos.x, + 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->unk_1C7 + 2); } @@ -245,12 +244,12 @@ void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx) { func_800F4254(&player->actor.projectedPos, 0); } - if (Play_InCsMode(globalCtx)) { + if (Play_InCsMode(play)) { Actor_Kill(&this->actor); } } -void func_80A9F938(EnMThunder* this, GlobalContext* globalCtx) { +void func_80A9F938(EnMThunder* this, PlayState* play) { if (this->unk_1C4 < 2) { if (this->unk_1C8 < 40) { this->unk_1C8 = 0; @@ -268,8 +267,8 @@ void func_80A9F938(EnMThunder* this, GlobalContext* globalCtx) { } } -void func_80A9F9B4(EnMThunder* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A9F9B4(EnMThunder* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Math_StepToF(&this->unk_1AC, 0.0f, 1 / 16.0f)) { Actor_Kill(&this->actor); @@ -278,7 +277,7 @@ void func_80A9F9B4(EnMThunder* this, GlobalContext* globalCtx) { 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(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->unk_1C4 > 0) { @@ -293,20 +292,20 @@ void func_80A9F9B4(EnMThunder* this, GlobalContext* globalCtx) { this->unk_1B0 = this->unk_1AC * (5.0f / 3.0f); } - func_80A9F938(this, globalCtx); + func_80A9F938(this, play); - if (Play_InCsMode(globalCtx)) { + if (Play_InCsMode(play)) { Actor_Kill(&this->actor); } } -void EnMThunder_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMThunder_Update(Actor* thisx, PlayState* play) { EnMThunder* this = (EnMThunder*)thisx; f32 blueRadius; s32 redGreen; - this->actionFunc(this, globalCtx); - func_80A9F314(globalCtx, this->unk_1BC); + this->actionFunc(this, play); + func_80A9F314(play, this->unk_1BC); blueRadius = this->unk_1AC; redGreen = (u32)(blueRadius * 255.0f) & 0xFF; Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, @@ -314,26 +313,26 @@ void EnMThunder_Update(Actor* thisx, GlobalContext* globalCtx) { (s32)(blueRadius * 800.0f)); } -void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnMThunder_Draw(Actor* thisx, PlayState* play2) { static f32 D_80AA046C[] = { 0.1f, 0.15f, 0.2f, 0.25f, 0.3f, 0.25f, 0.2f, 0.15f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnMThunder* this = (EnMThunder*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 phi_f14; s32 phi_t1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_m_thunder.c", 844); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_m_thunder.c", 844); + func_80093D84(play->state.gfxCtx); Matrix_Scale(0.02f, 0.02f, 0.02f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_m_thunder.c", 853), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_m_thunder.c", 853), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); switch (this->unk_1C6) { case 0: case 1: gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0xFF - ((u8)(s32)(this->unk_1B4 * 30) & 0xFF), 0, - 0x40, 0x20, 1, 0xFF - ((u8)(s32)(this->unk_1B4 * 20) & 0xFF), 0, 8, 8)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0xFF - ((u8)(s32)(this->unk_1B4 * 30) & 0xFF), 0, 0x40, + 0x20, 1, 0xFF - ((u8)(s32)(this->unk_1B4 * 20) & 0xFF), 0, 8, 8)); break; } @@ -371,26 +370,25 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) { } if (this->unk_1B8 >= 0.85f) { - phi_f14 = (D_80AA046C[(globalCtx->gameplayFrames & 7)] * 6.0f) + 1.0f; + phi_f14 = (D_80AA046C[(play->gameplayFrames & 7)] * 6.0f) + 1.0f; gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, this->unk_1C8); gDPSetEnvColor(POLY_XLU_DISP++, 255, 100, 0, 128); phi_t1 = 0x28; } else { - phi_f14 = (D_80AA046C[globalCtx->gameplayFrames & 7] * 2.0f) + 1.0f; + phi_f14 = (D_80AA046C[play->gameplayFrames & 7] * 2.0f) + 1.0f; gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, this->unk_1C8); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 128); phi_t1 = 0x14; } Matrix_Scale(1.0f, phi_f14, phi_f14, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_m_thunder.c", 960), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_m_thunder.c", 960), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->gameplayFrames * 5) & 0xFF, 0, 0x20, 0x20, 1, - (globalCtx->gameplayFrames * 20) & 0xFF, (globalCtx->gameplayFrames * phi_t1) & 0xFF, 8, - 8)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (play->gameplayFrames * 5) & 0xFF, 0, 0x20, 0x20, 1, + (play->gameplayFrames * 20) & 0xFF, (play->gameplayFrames * phi_t1) & 0xFF, 8, 8)); gSPDisplayList(POLY_XLU_DISP++, gSpinAttackChargingDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_m_thunder.c", 1031); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_m_thunder.c", 1031); } 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 92f1bdbf45..4cb7ad215c 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 @@ -6,7 +6,7 @@ struct EnMThunder; -typedef void (*EnMThunderActionFunc)(struct EnMThunder*, GlobalContext*); +typedef void (*EnMThunderActionFunc)(struct EnMThunder*, PlayState*); typedef struct EnMThunder { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index ccf1e4dd0f..dcfdbd1f81 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -9,22 +9,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) -void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMa1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMa1_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMa1_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMa1_Init(Actor* thisx, PlayState* play); +void EnMa1_Destroy(Actor* thisx, PlayState* play); +void EnMa1_Update(Actor* thisx, PlayState* play); +void EnMa1_Draw(Actor* thisx, PlayState* play); -u16 EnMa1_GetText(GlobalContext* globalCtx, Actor* this); -s16 func_80AA0778(GlobalContext* globalCtx, Actor* this); +u16 EnMa1_GetText(PlayState* play, Actor* this); +s16 func_80AA0778(PlayState* play, Actor* this); -void func_80AA0D88(EnMa1* this, GlobalContext* globalCtx); -void func_80AA0EA0(EnMa1* this, GlobalContext* globalCtx); -void func_80AA0EFC(EnMa1* this, GlobalContext* globalCtx); -void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx); -void func_80AA106C(EnMa1* this, GlobalContext* globalCtx); -void func_80AA10EC(EnMa1* this, GlobalContext* globalCtx); -void func_80AA1150(EnMa1* this, GlobalContext* globalCtx); -void EnMa1_DoNothing(EnMa1* this, GlobalContext* globalCtx); +void func_80AA0D88(EnMa1* this, PlayState* play); +void func_80AA0EA0(EnMa1* this, PlayState* play); +void func_80AA0EFC(EnMa1* this, PlayState* play); +void func_80AA0F44(EnMa1* this, PlayState* play); +void func_80AA106C(EnMa1* this, PlayState* play); +void func_80AA10EC(EnMa1* this, PlayState* play); +void func_80AA1150(EnMa1* this, PlayState* play); +void EnMa1_DoNothing(EnMa1* this, PlayState* play); const ActorInit En_Ma1_InitVars = { ACTOR_EN_MA1, @@ -88,8 +88,8 @@ static void* sEyeTextures[] = { gMalonChildEyeClosedTex, }; -u16 EnMa1_GetText(GlobalContext* globalCtx, Actor* thisx) { - u16 faceReaction = Text_GetFaceReaction(globalCtx, 0x17); +u16 EnMa1_GetText(PlayState* play, Actor* thisx) { + u16 faceReaction = Text_GetFaceReaction(play, 0x17); if (faceReaction != 0) { return faceReaction; @@ -123,10 +123,10 @@ u16 EnMa1_GetText(GlobalContext* globalCtx, Actor* thisx) { return 0x2041; } -s16 func_80AA0778(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80AA0778(PlayState* play, Actor* thisx) { s16 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: switch (thisx->textId) { case 0x2041: @@ -159,12 +159,12 @@ s16 func_80AA0778(GlobalContext* globalCtx, Actor* thisx) { break; case TEXT_STATE_CHOICE: case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 2; } break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 3; } break; @@ -180,18 +180,18 @@ s16 func_80AA0778(GlobalContext* globalCtx, Actor* thisx) { return ret; } -s32 func_80AA08C4(EnMa1* this, GlobalContext* globalCtx) { +s32 func_80AA08C4(EnMa1* this, PlayState* play) { if ((this->actor.shape.rot.z == 3) && (gSaveContext.sceneSetupIndex == 5)) { return 1; } if (!LINK_IS_CHILD) { return 0; } - if (((globalCtx->sceneNum == SCENE_MARKET_NIGHT) || (globalCtx->sceneNum == SCENE_MARKET_DAY)) && + if (((play->sceneNum == SCENE_MARKET_NIGHT) || (play->sceneNum == SCENE_MARKET_DAY)) && !GET_EVENTCHKINF(EVENTCHKINF_14) && !GET_INFTABLE(INFTABLE_8B)) { return 1; } - if ((globalCtx->sceneNum == SCENE_SPOT15) && !GET_EVENTCHKINF(EVENTCHKINF_14)) { + if ((play->sceneNum == SCENE_SPOT15) && !GET_EVENTCHKINF(EVENTCHKINF_14)) { if (GET_INFTABLE(INFTABLE_8B)) { return 1; } else { @@ -199,10 +199,10 @@ s32 func_80AA08C4(EnMa1* this, GlobalContext* globalCtx) { return 0; } } - if ((globalCtx->sceneNum == SCENE_SOUKO) && IS_NIGHT && GET_EVENTCHKINF(EVENTCHKINF_14)) { + if ((play->sceneNum == SCENE_SOUKO) && IS_NIGHT && GET_EVENTCHKINF(EVENTCHKINF_14)) { return 1; } - if (globalCtx->sceneNum != SCENE_SPOT20) { + if (play->sceneNum != SCENE_SPOT20) { return 0; } if ((this->actor.shape.rot.z == 3) && IS_DAY && GET_EVENTCHKINF(EVENTCHKINF_14)) { @@ -228,8 +228,8 @@ void EnMa1_ChangeAnim(EnMa1* this, s32 index) { sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } -void func_80AA0AF4(EnMa1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA0AF4(EnMa1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3; if ((this->unk_1E8.unk_00 == 0) && (this->skelAnime.animation == &gMalonChildSingAnim)) { @@ -260,22 +260,22 @@ void func_80AA0B74(EnMa1* this) { } } -void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMa1_Init(Actor* thisx, PlayState* play) { EnMa1* this = (EnMa1*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gMalonChildSkel, NULL, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gMalonChildSkel, NULL, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(22), &sColChkInfoInit); - if (!func_80AA08C4(this, globalCtx)) { + if (!func_80AA08C4(this, play)) { Actor_Kill(&this->actor); return; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->unk_1E8.unk_00 = 0; @@ -289,14 +289,14 @@ void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnMa1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMa1_Destroy(Actor* thisx, PlayState* play) { EnMa1* this = (EnMa1*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AA0D88(EnMa1* this, GlobalContext* globalCtx) { +void func_80AA0D88(EnMa1* this, PlayState* play) { if (this->unk_1E8.unk_00 != 0) { if (this->skelAnime.animation != &gMalonChildIdleAnim) { EnMa1_ChangeAnim(this, ENMA1_ANIM_1); @@ -307,37 +307,37 @@ void func_80AA0D88(EnMa1* this, GlobalContext* globalCtx) { } } - if ((globalCtx->sceneNum == SCENE_SPOT15) && GET_EVENTCHKINF(EVENTCHKINF_14)) { + if ((play->sceneNum == SCENE_SPOT15) && GET_EVENTCHKINF(EVENTCHKINF_14)) { Actor_Kill(&this->actor); } else if (!GET_EVENTCHKINF(EVENTCHKINF_14) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { if (this->unk_1E8.unk_00 == 2) { this->actionFunc = func_80AA0EA0; - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } } } -void func_80AA0EA0(EnMa1* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80AA0EA0(EnMa1* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80AA0EFC; } else { - func_8002F434(&this->actor, globalCtx, GI_WEIRD_EGG, 120.0f, 10.0f); + func_8002F434(&this->actor, play, GI_WEIRD_EGG, 120.0f, 10.0f); } } -void func_80AA0EFC(EnMa1* this, GlobalContext* globalCtx) { +void func_80AA0EFC(EnMa1* this, PlayState* play) { if (this->unk_1E8.unk_00 == 3) { this->unk_1E8.unk_00 = 0; this->actionFunc = func_80AA0D88; SET_EVENTCHKINF(EVENTCHKINF_12); - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } } -void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA0F44(EnMa1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_1E8.unk_00 != 0) { if (this->skelAnime.animation != &gMalonChildIdleAnim) { @@ -354,7 +354,7 @@ void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) { player->stateFlags2 |= PLAYER_STATE2_25; player->unk_6A8 = &this->actor; this->actor.textId = 0x2061; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_1E8.unk_00 = 1; this->actor.flags |= ACTOR_FLAG_16; this->actionFunc = func_80AA106C; @@ -364,56 +364,56 @@ void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) { } } -void func_80AA106C(EnMa1* this, GlobalContext* globalCtx) { - GET_PLAYER(globalCtx)->stateFlags2 |= PLAYER_STATE2_23; +void func_80AA106C(EnMa1* this, PlayState* play) { + GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23; if (this->unk_1E8.unk_00 == 2) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_MALON); - func_8010BD58(globalCtx, OCARINA_ACTION_TEACH_EPONA); + func_8010BD58(play, OCARINA_ACTION_TEACH_EPONA); this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = func_80AA10EC; } } -void func_80AA10EC(EnMa1* this, GlobalContext* globalCtx) { - GET_PLAYER(globalCtx)->stateFlags2 |= PLAYER_STATE2_23; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) { - func_8010BD58(globalCtx, OCARINA_ACTION_PLAYBACK_EPONA); +void func_80AA10EC(EnMa1* this, PlayState* play) { + GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23; + if (Message_GetState(&play->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) { + func_8010BD58(play, OCARINA_ACTION_PLAYBACK_EPONA); this->actionFunc = func_80AA1150; } } -void func_80AA1150(EnMa1* this, GlobalContext* globalCtx) { - GET_PLAYER(globalCtx)->stateFlags2 |= PLAYER_STATE2_23; - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { - globalCtx->nextEntranceIndex = ENTR_SPOT20_0; +void func_80AA1150(EnMa1* this, PlayState* play) { + GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { + play->nextEntranceIndex = ENTR_SPOT20_0; gSaveContext.nextCutsceneIndex = 0xFFF1; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_WHITE, TCS_FAST); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_WHITE, TCS_FAST); + play->transitionTrigger = TRANS_TRIGGER_START; this->actionFunc = EnMa1_DoNothing; } } -void EnMa1_DoNothing(EnMa1* this, GlobalContext* globalCtx) { +void EnMa1_DoNothing(EnMa1* this, PlayState* play) { } -void EnMa1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMa1_Update(Actor* thisx, PlayState* play) { EnMa1* this = (EnMa1*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); EnMa1_UpdateEyes(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != EnMa1_DoNothing) { - func_800343CC(globalCtx, &this->actor, &this->unk_1E8.unk_00, (f32)this->collider.dim.radius + 30.0f, - EnMa1_GetText, func_80AA0778); + func_800343CC(play, &this->actor, &this->unk_1E8.unk_00, (f32)this->collider.dim.radius + 30.0f, EnMa1_GetText, + func_80AA0778); } func_80AA0B74(this); - func_80AA0AF4(this, globalCtx); + func_80AA0AF4(this, play); } -s32 EnMa1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMa1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMa1* this = (EnMa1*)thisx; Vec3s vec; @@ -435,7 +435,7 @@ s32 EnMa1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMa1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMa1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnMa1* this = (EnMa1*)thisx; Vec3f vec = D_80AA16B8; @@ -444,24 +444,24 @@ void EnMa1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnMa1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMa1_Draw(Actor* thisx, PlayState* play) { EnMa1* this = (EnMa1*)thisx; Camera* activeCam; f32 distFromCamera; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma1.c", 1226); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ma1.c", 1226); - activeCam = GET_ACTIVE_CAM(globalCtx); + activeCam = GET_ACTIVE_CAM(play); distFromCamera = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye); func_800F6268(distFromCamera, NA_BGM_LONLON); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex])); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMa1_OverrideLimbDraw, EnMa1_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma1.c", 1261); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ma1.c", 1261); } diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h index ee68c0b882..078a0ed117 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h @@ -6,7 +6,7 @@ struct EnMa1; -typedef void (*EnMa1ActionFunc)(struct EnMa1*, GlobalContext*); +typedef void (*EnMa1ActionFunc)(struct EnMa1*, PlayState*); typedef struct EnMa1 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 9a9dd5eefb..e45f9ed9eb 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -3,22 +3,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) -void EnMa2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMa2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMa2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMa2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMa2_Init(Actor* thisx, PlayState* play); +void EnMa2_Destroy(Actor* thisx, PlayState* play); +void EnMa2_Update(Actor* thisx, PlayState* play); +void EnMa2_Draw(Actor* thisx, PlayState* play); -u16 func_80AA19A0(GlobalContext* globalCtx, Actor* this); -s16 func_80AA1A38(GlobalContext* globalCtx, Actor* this); +u16 func_80AA19A0(PlayState* play, Actor* this); +s16 func_80AA1A38(PlayState* play, Actor* this); -void func_80AA1AE4(EnMa2* this, GlobalContext* globalCtx); +void func_80AA1AE4(EnMa2* this, PlayState* play); s32 func_80AA1C68(EnMa2* this); void EnMa2_UpdateEyes(EnMa2* this); -void func_80AA1DB4(EnMa2* this, GlobalContext* globalCtx); -void func_80AA2018(EnMa2* this, GlobalContext* globalCtx); -void func_80AA204C(EnMa2* this, GlobalContext* globalCtx); -void func_80AA20E4(EnMa2* this, GlobalContext* globalCtx); -void func_80AA21C8(EnMa2* this, GlobalContext* globalCtx); +void func_80AA1DB4(EnMa2* this, PlayState* play); +void func_80AA2018(EnMa2* this, PlayState* play); +void func_80AA204C(EnMa2* this, PlayState* play); +void func_80AA20E4(EnMa2* this, PlayState* play); +void func_80AA21C8(EnMa2* this, PlayState* play); const ActorInit En_Ma2_InitVars = { ACTOR_EN_MA2, @@ -68,8 +68,8 @@ static AnimationFrameCountInfo sAnimationInfo[] = { { &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, }; -u16 func_80AA19A0(GlobalContext* globalCtx, Actor* thisx) { - u16 faceReaction = Text_GetFaceReaction(globalCtx, 23); +u16 func_80AA19A0(PlayState* play, Actor* thisx) { + u16 faceReaction = Text_GetFaceReaction(play, 23); if (faceReaction != 0) { return faceReaction; @@ -89,10 +89,10 @@ u16 func_80AA19A0(GlobalContext* globalCtx, Actor* thisx) { return 0x204C; } -s16 func_80AA1A38(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80AA1A38(PlayState* play, Actor* thisx) { s16 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: switch (thisx->textId) { case 0x2051: @@ -121,8 +121,8 @@ s16 func_80AA1A38(GlobalContext* globalCtx, Actor* thisx) { return ret; } -void func_80AA1AE4(EnMa2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA1AE4(EnMa2* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3; if ((this->unk_1E0.unk_00 == 0) && (this->skelAnime.animation == &gMalonAdultSingAnim)) { @@ -137,19 +137,19 @@ void func_80AA1AE4(EnMa2* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_1E0, 0, phi_a3); } -u16 func_80AA1B58(EnMa2* this, GlobalContext* globalCtx) { +u16 func_80AA1B58(EnMa2* this, PlayState* play) { if (LINK_IS_CHILD) { return 0; } - if (!GET_EVENTCHKINF(EVENTCHKINF_18) && (globalCtx->sceneNum == SCENE_MALON_STABLE) && IS_DAY && + if (!GET_EVENTCHKINF(EVENTCHKINF_18) && (play->sceneNum == SCENE_MALON_STABLE) && IS_DAY && (this->actor.shape.rot.z == 5)) { return 1; } - if (!GET_EVENTCHKINF(EVENTCHKINF_18) && (globalCtx->sceneNum == SCENE_SPOT20) && IS_NIGHT && + if (!GET_EVENTCHKINF(EVENTCHKINF_18) && (play->sceneNum == SCENE_SPOT20) && IS_NIGHT && (this->actor.shape.rot.z == 6)) { return 2; } - if (!GET_EVENTCHKINF(EVENTCHKINF_18) || (globalCtx->sceneNum != SCENE_SPOT20)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_18) || (play->sceneNum != SCENE_SPOT20)) { return 0; } if ((this->actor.shape.rot.z == 7) && IS_DAY) { @@ -193,7 +193,7 @@ void EnMa2_ChangeAnim(EnMa2* this, s32 index) { sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } -void func_80AA1DB4(EnMa2* this, GlobalContext* globalCtx) { +void func_80AA1DB4(EnMa2* this, PlayState* play) { if (this->skelAnime.animation == &gMalonAdultSingAnim) { if (this->unk_1E0.unk_00 == 0) { if (this->unk_20A != 0) { @@ -209,17 +209,17 @@ void func_80AA1DB4(EnMa2* this, GlobalContext* globalCtx) { } } -void EnMa2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMa2_Init(Actor* thisx, PlayState* play) { EnMa2* this = (EnMa2*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gMalonAdultSkel, NULL, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gMalonAdultSkel, NULL, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(22), &sColChkInfoInit); - switch (func_80AA1B58(this, globalCtx)) { + switch (func_80AA1B58(this, play)) { case 1: EnMa2_ChangeAnim(this, ENMA2_ANIM_2); this->actionFunc = func_80AA2018; @@ -241,66 +241,66 @@ void EnMa2_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->unk_1E0.unk_00 = 0; } -void EnMa2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMa2_Destroy(Actor* thisx, PlayState* play) { EnMa2* this = (EnMa2*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AA2018(EnMa2* this, GlobalContext* globalCtx) { +void func_80AA2018(EnMa2* this, PlayState* play) { if (this->unk_1E0.unk_00 == 2) { this->actor.flags &= ~ACTOR_FLAG_16; this->unk_1E0.unk_00 = 0; } } -void func_80AA204C(EnMa2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA204C(EnMa2* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags2 & PLAYER_STATE2_24) { player->unk_6A8 = &this->actor; player->stateFlags2 |= PLAYER_STATE2_25; - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_EPONA); + func_8010BD58(play, OCARINA_ACTION_CHECK_EPONA); this->actionFunc = func_80AA20E4; } else if (this->actor.xzDistToPlayer < 30.0f + (f32)this->collider.dim.radius) { player->stateFlags2 |= PLAYER_STATE2_23; } } -void func_80AA20E4(EnMa2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA20E4(EnMa2* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_04) { + if (play->msgCtx.ocarinaMode >= OCARINA_MODE_04) { this->actionFunc = func_80AA204C; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->unk_208 = 0x1E; SET_INFTABLE(INFTABLE_8E); this->actionFunc = func_80AA21C8; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { player->stateFlags2 |= PLAYER_STATE2_23; } } -void func_80AA21C8(EnMa2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA21C8(EnMa2* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (DECR(this->unk_208)) { player->stateFlags2 |= PLAYER_STATE2_23; } else { if (this->unk_1E0.unk_00 == 0) { this->actor.flags |= ACTOR_FLAG_16; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } else { this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = func_80AA2018; @@ -308,24 +308,24 @@ void func_80AA21C8(EnMa2* this, GlobalContext* globalCtx) { } } -void EnMa2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMa2_Update(Actor* thisx, PlayState* play) { EnMa2* this = (EnMa2*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); EnMa2_UpdateEyes(this); - this->actionFunc(this, globalCtx); - func_80AA1DB4(this, globalCtx); - func_80AA1AE4(this, globalCtx); + this->actionFunc(this, play); + func_80AA1DB4(this, play); + func_80AA1AE4(this, play); if (this->actionFunc != func_80AA20E4) { - func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 30.0f, - func_80AA19A0, func_80AA1A38); + func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 30.0f, func_80AA19A0, + func_80AA1A38); } } -s32 EnMa2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMa2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMa2* this = (EnMa2*)thisx; Vec3s vec; @@ -352,11 +352,11 @@ s32 EnMa2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMa2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMa2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnMa2* this = (EnMa2*)thisx; Vec3f vec = { 900.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma2.c", 904); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ma2.c", 904); if (limbIndex == MALON_ADULT_HEAD_LIMB) { Matrix_MultVec3f(&vec, &this->actor.focus.pos); @@ -365,10 +365,10 @@ void EnMa2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve gSPDisplayList(POLY_OPA_DISP++, gMalonAdultBasketDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma2.c", 927); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ma2.c", 927); } -void EnMa2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMa2_Draw(Actor* thisx, PlayState* play) { static void* sMouthTextures[] = { gMalonAdultMouthNeutralTex, gMalonAdultMouthSadTex, gMalonAdultMouthHappyTex }; static void* sEyeTextures[] = { gMalonAdultEyeOpenTex, gMalonAdultEyeHalfTex, gMalonAdultEyeClosedTex }; @@ -377,18 +377,18 @@ void EnMa2_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 someFloat; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma2.c", 955); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ma2.c", 955); - activeCam = GET_ACTIVE_CAM(globalCtx); + activeCam = GET_ACTIVE_CAM(play); someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye); func_800F6268(someFloat, NA_BGM_LONLON); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex])); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMa2_OverrideLimbDraw, EnMa2_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma2.c", 990); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ma2.c", 990); } diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h index 6d95e2f905..249bb55741 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h @@ -6,7 +6,7 @@ struct EnMa2; -typedef void (*EnMa2ActionFunc)(struct EnMa2*, GlobalContext*); +typedef void (*EnMa2ActionFunc)(struct EnMa2*, PlayState*); typedef enum { /* 0x00 */ MALON_ADULT_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index 43d03a7084..a1e830f381 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -9,19 +9,19 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnMa3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMa3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMa3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMa3_Init(Actor* thisx, PlayState* play); +void EnMa3_Destroy(Actor* thisx, PlayState* play); +void EnMa3_Update(Actor* thisx, PlayState* play); +void EnMa3_Draw(Actor* thisx, PlayState* play); -u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* this); -s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* this); +u16 func_80AA2AA0(PlayState* play, Actor* this); +s16 func_80AA2BD4(PlayState* play, Actor* this); -void func_80AA2E54(EnMa3* this, GlobalContext* globalCtx); -s32 func_80AA2EC8(EnMa3* this, GlobalContext* globalCtx); +void func_80AA2E54(EnMa3* this, PlayState* play); +s32 func_80AA2EC8(EnMa3* this, PlayState* play); s32 func_80AA2F28(EnMa3* this); void EnMa3_UpdateEyes(EnMa3* this); -void func_80AA3200(EnMa3* this, GlobalContext* globalCtx); +void func_80AA3200(EnMa3* this, PlayState* play); const ActorInit En_Ma3_InitVars = { ACTOR_EN_MA3, @@ -71,8 +71,8 @@ static AnimationFrameCountInfo sAnimationInfo[] = { { &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, }; -u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) { - Player* player = GET_PLAYER(globalCtx); +u16 func_80AA2AA0(PlayState* play, Actor* thisx) { + Player* player = GET_PLAYER(play); s16* timer1ValuePtr; // weirdness with this necessary to match if (!GET_INFTABLE(INFTABLE_B8)) { @@ -98,7 +98,7 @@ u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) { } } if (!(player->stateFlags1 & PLAYER_STATE1_23) && - (Actor_FindNearby(globalCtx, thisx, ACTOR_EN_HORSE, 1, 1200.0f) == NULL)) { + (Actor_FindNearby(play, thisx, ACTOR_EN_HORSE, 1, 1200.0f) == NULL)) { return 0x2001; } if (!GET_INFTABLE(INFTABLE_B9)) { @@ -108,30 +108,30 @@ u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) { } } -s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80AA2BD4(PlayState* play, Actor* thisx) { s16 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { - globalCtx->nextEntranceIndex = ENTR_SPOT20_0; + if (Message_ShouldAdvance(play)) { + play->nextEntranceIndex = ENTR_SPOT20_0; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); + play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_0A); gSaveContext.timer1State = 0xF; } break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { SET_INFTABLE(INFTABLE_B9); - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (GET_EVENTCHKINF(EVENTCHKINF_1E)) { - Message_ContinueTextbox(globalCtx, 0x2091); + Message_ContinueTextbox(play, 0x2091); } else if (HIGH_SCORE(HS_HORSE_RACE) == 0) { - Message_ContinueTextbox(globalCtx, 0x2092); + Message_ContinueTextbox(play, 0x2092); } else { - Message_ContinueTextbox(globalCtx, 0x2090); + Message_ContinueTextbox(play, 0x2090); } } } @@ -178,8 +178,8 @@ s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) { return ret; } -void func_80AA2E54(EnMa3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA2E54(EnMa3* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3; if ((this->unk_1E0.unk_00 == 0) && (this->skelAnime.animation == &gMalonAdultSingAnim)) { @@ -193,7 +193,7 @@ void func_80AA2E54(EnMa3* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_1E0, 0, phi_a3); } -s32 func_80AA2EC8(EnMa3* this, GlobalContext* globalCtx) { +s32 func_80AA2EC8(EnMa3* this, PlayState* play) { if (LINK_IS_CHILD) { return 2; } @@ -238,17 +238,17 @@ void EnMa3_ChangeAnim(EnMa3* this, s32 index) { sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } -void EnMa3_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMa3_Init(Actor* thisx, PlayState* play) { EnMa3* this = (EnMa3*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gMalonAdultSkel, NULL, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gMalonAdultSkel, NULL, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(22), &sColChkInfoInit); - switch (func_80AA2EC8(this, globalCtx)) { + switch (func_80AA2EC8(this, play)) { case 0: EnMa3_ChangeAnim(this, ENMA3_ANIM_0); this->actionFunc = func_80AA3200; @@ -262,37 +262,37 @@ void EnMa3_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); Actor_SetScale(&this->actor, 0.01f); this->unk_1E0.unk_00 = (u16)0; } -void EnMa3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMa3_Destroy(Actor* thisx, PlayState* play) { EnMa3* this = (EnMa3*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AA3200(EnMa3* this, GlobalContext* globalCtx) { +void func_80AA3200(EnMa3* this, PlayState* play) { if (this->unk_1E0.unk_00 == 2) { this->actor.flags &= ~ACTOR_FLAG_16; this->unk_1E0.unk_00 = 0; } } -void EnMa3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMa3_Update(Actor* thisx, PlayState* play) { EnMa3* this = (EnMa3*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); EnMa3_UpdateEyes(this); - this->actionFunc(this, globalCtx); - func_80AA2E54(this, globalCtx); - func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 150.0f, - func_80AA2AA0, func_80AA2BD4); + this->actionFunc(this, play); + func_80AA2E54(this, play); + func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 150.0f, func_80AA2AA0, + func_80AA2BD4); if (this->unk_1E0.unk_00 == 0) { if (this->unk_20A != 0) { func_800F6584(0); @@ -304,7 +304,7 @@ void EnMa3_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnMa3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMa3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMa3* this = (EnMa3*)thisx; Vec3s vec; @@ -331,11 +331,11 @@ s32 EnMa3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMa3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMa3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnMa3* this = (EnMa3*)thisx; Vec3f vec = { 900.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 927); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ma3.c", 927); if (limbIndex == MALON_ADULT_LIMB_HEAD) { Matrix_MultVec3f(&vec, &this->actor.focus.pos); @@ -345,10 +345,10 @@ void EnMa3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve gSPDisplayList(POLY_OPA_DISP++, gMalonAdultBasketDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 950); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ma3.c", 950); } -void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMa3_Draw(Actor* thisx, PlayState* play) { static void* sMouthTextures[] = { gMalonAdultMouthNeutralTex, gMalonAdultMouthSadTex, gMalonAdultMouthHappyTex }; static void* sEyeTextures[] = { gMalonAdultEyeOpenTex, gMalonAdultEyeHalfTex, gMalonAdultEyeClosedTex }; EnMa3* this = (EnMa3*)thisx; @@ -356,18 +356,18 @@ void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 someFloat; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 978); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ma3.c", 978); - activeCam = GET_ACTIVE_CAM(globalCtx); + activeCam = GET_ACTIVE_CAM(play); someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye); func_800F6268(someFloat, NA_BGM_LONLON); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex])); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMa3_OverrideLimbDraw, EnMa3_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 1013); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ma3.c", 1013); } diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h index 9d4d248b0f..549d60c975 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h @@ -6,7 +6,7 @@ struct EnMa3; -typedef void (*EnMa3ActionFunc)(struct EnMa3*, GlobalContext*); +typedef void (*EnMa3ActionFunc)(struct EnMa3*, PlayState*); typedef enum { /* 0x00 */ MALON_ADULT_LIMB_NONE, 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 1bb7b538c0..78d639ae35 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnMag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMag_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMag_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMag_Init(Actor* thisx, PlayState* play); +void EnMag_Destroy(Actor* thisx, PlayState* play); +void EnMag_Update(Actor* thisx, PlayState* play); +void EnMag_Draw(Actor* thisx, PlayState* play); const ActorInit En_Mag_InitVars = { ACTOR_EN_MAG, @@ -28,7 +28,7 @@ const ActorInit En_Mag_InitVars = { static s16 sDelayTimer = 0; -void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_Init(Actor* thisx, PlayState* play) { EnMag* this = (EnMag*)thisx; YREG(1) = 63; @@ -98,18 +98,18 @@ void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_E320 = 0; } -void EnMag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_Destroy(Actor* thisx, PlayState* play) { } -void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_Update(Actor* thisx, PlayState* play) { s32 pad[2]; EnMag* this = (EnMag*)thisx; if (gSaveContext.fileNum != 0xFEDC) { if (this->globalState < MAG_STATE_DISPLAY) { - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -135,19 +135,19 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { } } else if (this->globalState >= MAG_STATE_DISPLAY) { if (sDelayTimer == 0) { - if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) || - CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { - if (globalCtx->transitionTrigger != TRANS_TRIGGER_START) { + if (play->transitionTrigger != TRANS_TRIGGER_START) { Audio_SetCutsceneFlag(0); Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); gSaveContext.gameMode = 2; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_BLACK; } this->copyrightAlphaStep = 15; @@ -251,12 +251,12 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->globalState == MAG_STATE_INITIAL) { - if (Flags_GetEnv(globalCtx, 3)) { + if (Flags_GetEnv(play, 3)) { this->effectFadeInTimer = 40; this->globalState = MAG_STATE_FADE_IN; } } else if (this->globalState == MAG_STATE_DISPLAY) { - if (Flags_GetEnv(globalCtx, 4)) { + if (Flags_GetEnv(play, 4)) { this->globalState = MAG_STATE_FADE_OUT; } } @@ -370,7 +370,7 @@ void EnMag_DrawCharTexture(Gfx** gfxp, u8* texture, s32 rectLeft, s32 rectTop) { *gfxp = gfx; } -void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) { +void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { static s16 textAlpha = 0; static s16 textFadeDirection = 0; static s16 textFadeTimer = 0; @@ -393,7 +393,7 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) { u16 rectLeft; u16 rectTop; - gSPSegment(gfx++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(gfx++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); func_8009457C(&gfx); @@ -561,22 +561,22 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) { *gfxp = gfx; } -void EnMag_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_Draw(Actor* thisx, PlayState* play) { s32 pad; Gfx* gfx; Gfx* gfxRef; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_mag.c", 1151); + OPEN_DISPS(play->state.gfxCtx, "../z_en_mag.c", 1151); gfxRef = POLY_OPA_DISP; gfx = Graph_GfxPlusOne(gfxRef); gSPDisplayList(OVERLAY_DISP++, gfx); - EnMag_DrawInner(thisx, globalCtx, &gfx); + EnMag_DrawInner(thisx, play, &gfx); gSPEndDisplayList(gfx++); Graph_BranchDlist(gfxRef, gfx); POLY_OPA_DISP = gfx; - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_mag.c", 1161); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_mag.c", 1161); } 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 eefeed0230..267a6b64da 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -48,10 +48,10 @@ typedef enum { /* 27 */ ENMB_LIMB_RFOOT } EnMbLimb; -void EnMb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMb_Init(Actor* thisx, PlayState* play); +void EnMb_Destroy(Actor* thisx, PlayState* play); +void EnMb_Update(Actor* thisx, PlayState* play); +void EnMb_Draw(Actor* thisx, PlayState* play); const ActorInit En_Mb_InitVars = { ACTOR_EN_MB, @@ -65,29 +65,29 @@ const ActorInit En_Mb_InitVars = { (ActorFunc)EnMb_Draw, }; -void EnMb_SetupSpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx); +void EnMb_SetupSpearPatrolTurnTowardsWaypoint(EnMb* this, PlayState* play); void EnMb_SetupClubWaitPlayerNear(EnMb* this); -void EnMb_SpearGuardLookAround(EnMb* this, GlobalContext* globalCtx); +void EnMb_SpearGuardLookAround(EnMb* this, PlayState* play); void EnMb_SetupSpearGuardLookAround(EnMb* this); void EnMb_SetupSpearDamaged(EnMb* this); -void EnMb_SpearGuardWalk(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearGuardPrepareAndCharge(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearEndChargeQuick(EnMb* this, GlobalContext* globalCtx); -void EnMb_Stunned(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubDead(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubDamagedWhileKneeling(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubWaitPlayerNear(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearDead(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearDamaged(EnMb* this, GlobalContext* globalCtx); +void EnMb_SpearGuardWalk(EnMb* this, PlayState* play); +void EnMb_SpearGuardPrepareAndCharge(EnMb* this, PlayState* play); +void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play); +void EnMb_SpearEndChargeQuick(EnMb* this, PlayState* play); +void EnMb_Stunned(EnMb* this, PlayState* play); +void EnMb_ClubDead(EnMb* this, PlayState* play); +void EnMb_ClubDamagedWhileKneeling(EnMb* this, PlayState* play); +void EnMb_ClubWaitPlayerNear(EnMb* this, PlayState* play); +void EnMb_ClubAttack(EnMb* this, PlayState* play); +void EnMb_SpearDead(EnMb* this, PlayState* play); +void EnMb_SpearDamaged(EnMb* this, PlayState* play); void EnMb_SetupSpearDead(EnMb* this); -void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx); -void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubWaitAfterAttack(EnMb* this, GlobalContext* globalCtx); -void EnMb_ClubDamaged(EnMb* this, GlobalContext* globalCtx); +void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, PlayState* play); +void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, PlayState* play); +void EnMb_SpearPatrolEndCharge(EnMb* this, PlayState* play); +void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play); +void EnMb_ClubWaitAfterAttack(EnMb* this, PlayState* play); +void EnMb_ClubDamaged(EnMb* this, PlayState* play); static ColliderCylinderInit sHitboxInit = { { @@ -255,27 +255,27 @@ void EnMb_SetupAction(EnMb* this, EnMbActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnMb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_Init(Actor* thisx, PlayState* play) { EnMb* this = (EnMb*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 relYawFromPlayer; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 46.0f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.damageTable = &sSpearMoblinDamageTable; - Collider_InitCylinder(globalCtx, &this->hitbox); - Collider_SetCylinder(globalCtx, &this->hitbox, &this->actor, &sHitboxInit); - Collider_InitTris(globalCtx, &this->frontShielding); - Collider_SetTris(globalCtx, &this->frontShielding, &this->actor, &sFrontShieldingInit, this->frontShieldingTris); - Collider_InitQuad(globalCtx, &this->attackCollider); - Collider_SetQuad(globalCtx, &this->attackCollider, &this->actor, &sAttackColliderInit); + Collider_InitCylinder(play, &this->hitbox); + Collider_SetCylinder(play, &this->hitbox, &this->actor, &sHitboxInit); + Collider_InitTris(play, &this->frontShielding); + Collider_SetTris(play, &this->frontShielding, &this->actor, &sFrontShieldingInit, this->frontShieldingTris); + Collider_InitQuad(play, &this->attackCollider); + Collider_SetQuad(play, &this->attackCollider, &this->actor, &sAttackColliderInit); switch (this->actor.params) { case ENMB_TYPE_SPEAR_GUARD: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gEnMbSpearSkel, &gEnMbSpearStandStillAnim, - this->jointTable, this->morphTable, 28); + SkelAnime_InitFlex(play, &this->skelAnime, &gEnMbSpearSkel, &gEnMbSpearStandStillAnim, this->jointTable, + this->morphTable, 28); this->actor.colChkInfo.health = 2; this->actor.colChkInfo.mass = MASS_HEAVY; this->maxHomeDist = 1000.0f; @@ -283,7 +283,7 @@ void EnMb_Init(Actor* thisx, GlobalContext* globalCtx) { EnMb_SetupSpearGuardLookAround(this); break; case ENMB_TYPE_CLUB: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gEnMbClubSkel, &gEnMbClubStandStillClubDownAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gEnMbClubSkel, &gEnMbClubStandStillClubDownAnim, this->jointTable, this->morphTable, 28); this->actor.colChkInfo.health = 6; @@ -312,8 +312,8 @@ void EnMb_Init(Actor* thisx, GlobalContext* globalCtx) { EnMb_SetupClubWaitPlayerNear(this); break; default: /* Spear Patrol */ - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gEnMbSpearSkel, &gEnMbSpearStandStillAnim, - this->jointTable, this->morphTable, 28); + SkelAnime_InitFlex(play, &this->skelAnime, &gEnMbSpearSkel, &gEnMbSpearStandStillAnim, this->jointTable, + this->morphTable, 28); Actor_SetScale(&this->actor, 0.014f); this->path = (thisx->params & 0xFF00) >> 8; @@ -324,31 +324,31 @@ void EnMb_Init(Actor* thisx, GlobalContext* globalCtx) { this->maxHomeDist = 350.0f; this->playerDetectionRange = 1750.0f; this->actor.flags &= ~ACTOR_FLAG_0; - EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, globalCtx); + EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, play); break; } } -void EnMb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_Destroy(Actor* thisx, PlayState* play) { EnMb* this = (EnMb*)thisx; - Collider_DestroyTris(globalCtx, &this->frontShielding); - Collider_DestroyCylinder(globalCtx, &this->hitbox); - Collider_DestroyQuad(globalCtx, &this->attackCollider); + Collider_DestroyTris(play, &this->frontShielding); + Collider_DestroyCylinder(play, &this->hitbox); + Collider_DestroyQuad(play, &this->attackCollider); } -void EnMb_FaceWaypoint(EnMb* this, GlobalContext* globalCtx) { +void EnMb_FaceWaypoint(EnMb* this, PlayState* play) { s16 yawToWaypoint = Math_Vec3f_Yaw(&this->actor.world.pos, &this->waypointPos); this->actor.shape.rot.y = yawToWaypoint; this->actor.world.rot.y = yawToWaypoint; } -void EnMb_NextWaypoint(EnMb* this, GlobalContext* globalCtx) { +void EnMb_NextWaypoint(EnMb* this, PlayState* play) { Path* path; Vec3s* waypointPos; - path = &globalCtx->setupPathList[this->path]; + path = &play->setupPathList[this->path]; if (this->waypoint == 0) { this->direction = 1; @@ -369,8 +369,8 @@ void EnMb_NextWaypoint(EnMb* this, GlobalContext* globalCtx) { * Note: the longest corridor in Sacred Forest Meadows is 800 units long, * and they all are 100 units wide. */ -s32 EnMb_IsPlayerInCorridor(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnMb_IsPlayerInCorridor(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 xFromPlayer; f32 zFromPlayer; f32 cos; @@ -403,8 +403,8 @@ s32 EnMb_IsPlayerInCorridor(EnMb* this, GlobalContext* globalCtx) { return false; } -void EnMb_FindWaypointTowardsPlayer(EnMb* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->path]; +void EnMb_FindWaypointTowardsPlayer(EnMb* this, PlayState* play) { + Path* path = &play->setupPathList[this->path]; s16 yawToWaypoint; Vec3f waypointPosF; Vec3s* waypointPosS; @@ -447,12 +447,12 @@ void EnMb_SetupClubWaitPlayerNear(EnMb* this) { EnMb_SetupAction(this, EnMb_ClubWaitPlayerNear); } -void EnMb_SetupSpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SetupSpearPatrolTurnTowardsWaypoint(EnMb* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gEnMbSpearLookLeftAndRightAnim, -4.0f); this->actor.speedXZ = 0.0f; this->timer1 = Rand_S16Offset(40, 80); this->state = ENMB_STATE_IDLE; - EnMb_NextWaypoint(this, globalCtx); + EnMb_NextWaypoint(this, play); EnMb_SetupAction(this, EnMb_SpearPatrolTurnTowardsWaypoint); } @@ -598,14 +598,14 @@ void EnMb_SetupStunned(EnMb* this) { EnMb_SetupAction(this, EnMb_Stunned); } -void EnMb_Stunned(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_Stunned(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((player->stateFlags2 & PLAYER_STATE2_7) && player->actor.parent == &this->actor) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); this->attack = ENMB_ATTACK_NONE; } @@ -629,7 +629,7 @@ void EnMb_Stunned(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_SpearGuardLookAround(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearGuardLookAround(EnMb* this, PlayState* play) { s16 timer1; SkelAnime_Update(&this->skelAnime); @@ -644,7 +644,7 @@ void EnMb_SpearGuardLookAround(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, PlayState* play) { s16 relYawFromPlayer; SkelAnime_Update(&this->skelAnime); @@ -660,10 +660,10 @@ void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 0x3E8, 0); } - if (ABS(this->actor.yDistToPlayer) <= 20.0f && EnMb_IsPlayerInCorridor(this, globalCtx)) { + 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(globalCtx) && this->actor.xzDistToPlayer < 160.0f)) { - EnMb_FindWaypointTowardsPlayer(this, globalCtx); + if (ABS(relYawFromPlayer) <= 0x4000 || (func_8002DDE4(play) && this->actor.xzDistToPlayer < 160.0f)) { + EnMb_FindWaypointTowardsPlayer(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE); EnMb_SetupSpearPrepareAndCharge(this); } @@ -673,12 +673,12 @@ void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { /** * Slow down and resume walking. */ -void EnMb_SpearEndChargeQuick(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearEndChargeQuick(EnMb* this, PlayState* play) { s32 pad; Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.5f, 1.0f, 0.0f); if (this->actor.speedXZ > 1.0f) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); } if (SkelAnime_Update(&this->skelAnime)) { if (this->timer1 == 0) { @@ -696,13 +696,13 @@ void EnMb_SpearEndChargeQuick(EnMb* this, GlobalContext* globalCtx) { EnMb_SetupSpearGuardWalk(this); this->timer1 = this->timer2 = this->timer3 = 80; } else { - EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, globalCtx); + EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, play); } } } } -void EnMb_ClubWaitAfterAttack(EnMb* this, GlobalContext* globalCtx) { +void EnMb_ClubWaitAfterAttack(EnMb* this, PlayState* play) { this->attack = ENMB_ATTACK_NONE; if (SkelAnime_Update(&this->skelAnime)) { EnMb_SetupClubWaitPlayerNear(this); @@ -712,8 +712,8 @@ void EnMb_ClubWaitAfterAttack(EnMb* this, GlobalContext* globalCtx) { /** * Slow down, charge again if the player is near, or resume walking. */ -void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_SpearPatrolEndCharge(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 lastFrame; s16 relYawFromPlayer; s16 yawPlayerToWaypoint; @@ -722,14 +722,14 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.5f, 0.0f); if (this->actor.speedXZ > 1.0f) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); } if (this->timer1 != 0) { @@ -737,7 +737,7 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { if (this->timer3 == 0) { relYawFromPlayer = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; - if (ABS(this->actor.yDistToPlayer) <= 20.0f && EnMb_IsPlayerInCorridor(this, globalCtx) && + if (ABS(this->actor.yDistToPlayer) <= 20.0f && EnMb_IsPlayerInCorridor(this, play) && ABS(relYawFromPlayer) <= 0x4000 && this->actor.xzDistToPlayer <= 200.0f) { EnMb_SetupSpearPrepareAndCharge(this); } else { @@ -768,7 +768,7 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { Math_Vec3f_Yaw(&this->actor.world.pos, &this->waypointPos) - this->actor.yawTowardsPlayer; if (ABS(yawPlayerToWaypoint) <= 0x4000) { - EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, globalCtx); + EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, play); } else { EnMb_SetupSpearPatrolWalkTowardsWaypoint(this); } @@ -780,7 +780,7 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { /** * Prepare charge (animation), then charge until the player isn't in front. */ -void EnMb_SpearGuardPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearGuardPrepareAndCharge(EnMb* this, PlayState* play) { s32 prevFrame; s16 relYawTowardsPlayerAbs = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; @@ -801,7 +801,7 @@ void EnMb_SpearGuardPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { } else { this->actor.speedXZ = 10.0f; this->attack = ENMB_ATTACK_SPEAR; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); if (prevFrame != (s32)this->skelAnime.curFrame && ((s32)this->skelAnime.curFrame == 2 || (s32)this->skelAnime.curFrame == 6)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_DASH); @@ -814,8 +814,8 @@ void EnMb_SpearGuardPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_ClubAttack(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; Vec3f effSpawnPos; Vec3f effWhiteShockwaveDynamics = { 0.0f, 0.0f, 0.0f }; @@ -835,11 +835,11 @@ void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } } - func_8002F71C(globalCtx, &this->actor, (650.0f - this->actor.xzDistToPlayer) * 0.04f + 4.0f, + func_8002F71C(play, &this->actor, (650.0f - this->actor.xzDistToPlayer) * 0.04f + 4.0f, this->actor.world.rot.y, 8.0f); player->invincibilityTimer = prevPlayerInvincibilityTimer; @@ -859,12 +859,12 @@ void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx) { effSpawnPos.y = this->actor.floorHeight; Audio_PlayActorSound2(&this->actor, NA_SE_EN_MONBLIN_HAM_LAND); func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); - EffectSsBlast_SpawnWhiteShockwave(globalCtx, &effSpawnPos, &effWhiteShockwaveDynamics, + EffectSsBlast_SpawnWhiteShockwave(play, &effSpawnPos, &effWhiteShockwaveDynamics, &effWhiteShockwaveDynamics); - func_80033480(globalCtx, &effSpawnPos, 2.0f, 3, 0x12C, 0xB4, 1); - Camera_AddQuake(&globalCtx->mainCamera, 2, 0x19, 5); - func_800358DC(&this->actor, &effSpawnPos, &this->actor.world.rot, flamesParams, 20, flamesUnused, globalCtx, - -1, 0); + func_80033480(play, &effSpawnPos, 2.0f, 3, 0x12C, 0xB4, 1); + Camera_AddQuake(&play->mainCamera, 2, 0x19, 5); + func_800358DC(&this->actor, &effSpawnPos, &this->actor.world.rot, flamesParams, 20, flamesUnused, play, -1, + 0); EnMb_SetupClubWaitAfterAttack(this); } } else { @@ -880,11 +880,11 @@ void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx) { /** * Prepare charge (animation), then charge to the end of the floor collision. */ -void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 prevFrame; s32 hasHitPlayer = false; - s32 endCharge = !Actor_TestFloorInDirection(&this->actor, globalCtx, 110.0f, this->actor.world.rot.y); + s32 endCharge = !Actor_TestFloorInDirection(&this->actor, play, 110.0f, this->actor.world.rot.y); prevFrame = (s32)this->skelAnime.curFrame; if (SkelAnime_Update(&this->skelAnime)) { @@ -899,7 +899,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { } else { this->actor.speedXZ = 10.0f; this->attack = ENMB_ATTACK_SPEAR; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); if (prevFrame != (s32)this->skelAnime.curFrame && ((s32)this->skelAnime.curFrame == 2 || (s32)this->skelAnime.curFrame == 6)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_DASH); @@ -914,13 +914,13 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } } if (!(this->attackCollider.base.atFlags & AT_BOUNCED)) { Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; } } @@ -948,7 +948,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } } this->attack = ENMB_ATTACK_NONE; @@ -960,16 +960,16 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { /** * Charge and follow the path, until hitting the player or, after some time, reaching home. */ -void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 prevFrame; s32 hasHitPlayer = false; - s32 endCharge = !Actor_TestFloorInDirection(&this->actor, globalCtx, 110.0f, this->actor.world.rot.y); + s32 endCharge = !Actor_TestFloorInDirection(&this->actor, play, 110.0f, this->actor.world.rot.y); prevFrame = (s32)this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 5.0f, 3, 4.0f, 100, 15, false); if (prevFrame != (s32)this->skelAnime.curFrame && ((s32)this->skelAnime.curFrame == 2 || (s32)this->skelAnime.curFrame == 6)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_DASH); @@ -983,13 +983,13 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } } if (!(this->attackCollider.base.atFlags & AT_BOUNCED)) { Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; } } @@ -1017,7 +1017,7 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } this->attack = ENMB_ATTACK_NONE; this->actor.speedXZ = -10.0f; @@ -1025,11 +1025,11 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx) { this->timer3 = 1; } else { this->timer3--; - EnMb_NextWaypoint(this, globalCtx); + EnMb_NextWaypoint(this, play); } } - EnMb_FaceWaypoint(this, globalCtx); + EnMb_FaceWaypoint(this, play); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->timer3 == 0 && Math_Vec3f_DistXZ(&this->actor.home.pos, &this->actor.world.pos) < 80.0f) { @@ -1038,20 +1038,20 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_ClubDamaged(EnMb* this, GlobalContext* globalCtx) { +void EnMb_ClubDamaged(EnMb* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->timer3 != 0) { Animation_PlayOnce(&this->skelAnime, &gEnMbClubStandUpAnim); this->timer3 = 0; func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); - Camera_AddQuake(&globalCtx->mainCamera, 2, 25, 5); + Camera_AddQuake(&play->mainCamera, 2, 25, 5); } else { EnMb_SetupClubWaitPlayerNear(this); } } } -void EnMb_ClubDamagedWhileKneeling(EnMb* this, GlobalContext* globalCtx) { +void EnMb_ClubDamagedWhileKneeling(EnMb* this, PlayState* play) { s32 pad; if (SkelAnime_Update(&this->skelAnime)) { @@ -1074,7 +1074,7 @@ void EnMb_ClubDamagedWhileKneeling(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_ClubDead(EnMb* this, GlobalContext* globalCtx) { +void EnMb_ClubDead(EnMb* this, PlayState* play) { Vec3f effPos; Vec3f effPosBase; @@ -1094,30 +1094,30 @@ void EnMb_ClubDead(EnMb* this, GlobalContext* globalCtx) { effPos.x = Rand_CenteredFloat(240.0f) + effPosBase.x; effPos.y = Rand_CenteredFloat(15.0f) + (effPosBase.y + 20.0f); effPos.z = Rand_CenteredFloat(240.0f) + effPosBase.z; - EffectSsDeadDb_Spawn(globalCtx, &effPos, &effZeroVec, &effZeroVec, 230, 7, 255, 255, 255, 255, 0, 255, - 0, 1, 9, true); + EffectSsDeadDb_Spawn(play, &effPos, &effZeroVec, &effZeroVec, 230, 7, 255, 255, 255, 255, 0, 255, 0, 1, + 9, true); } } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &effPos, 0xC0); + Item_DropCollectibleRandom(play, &this->actor, &effPos, 0xC0); Actor_Kill(&this->actor); } } else if ((s32)this->skelAnime.curFrame == 15 || (s32)this->skelAnime.curFrame == 22) { func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &effPos, 50.0f, 10, 3.0f, 400, 60, false); + Actor_SpawnFloorDustRing(play, &this->actor, &effPos, 50.0f, 10, 3.0f, 400, 60, false); Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DOWN); - Camera_AddQuake(&globalCtx->mainCamera, 2, 25, 5); + Camera_AddQuake(&play->mainCamera, 2, 25, 5); } } /** * Walk around the home point, face and charge the player if close. */ -void EnMb_SpearGuardWalk(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearGuardWalk(EnMb* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 pad1; s32 pad2; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; s16 yawTowardsHome; f32 playSpeedAbs; @@ -1174,7 +1174,7 @@ void EnMb_SpearGuardWalk(EnMb* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s16 relYawTowardsPlayer; @@ -1183,7 +1183,7 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { 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)) { - EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, globalCtx); + EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, play); } else { Math_SmoothStepToF(&this->actor.speedXZ, 0.59999996f, 0.1f, 1.0f, 0.0f); this->skelAnime.playSpeed = 2.0f * this->actor.speedXZ; @@ -1193,10 +1193,10 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.y, this->yawToWaypoint, 1, 0x5DC, 0); yDistToPlayerAbs = (this->actor.yDistToPlayer >= 0.0f) ? this->actor.yDistToPlayer : -this->actor.yDistToPlayer; - if (yDistToPlayerAbs <= 20.0f && EnMb_IsPlayerInCorridor(this, globalCtx)) { + if (yDistToPlayerAbs <= 20.0f && EnMb_IsPlayerInCorridor(this, play)) { relYawTowardsPlayer = (this->actor.shape.rot.y - this->actor.yawTowardsPlayer); - if (ABS(relYawTowardsPlayer) <= 0x4000 || (func_8002DDE4(globalCtx) && this->actor.xzDistToPlayer < 160.0f)) { - EnMb_FindWaypointTowardsPlayer(this, globalCtx); + if (ABS(relYawTowardsPlayer) <= 0x4000 || (func_8002DDE4(play) && this->actor.xzDistToPlayer < 160.0f)) { + EnMb_FindWaypointTowardsPlayer(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE); EnMb_SetupSpearPrepareAndCharge(this); return; @@ -1229,8 +1229,8 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnMb_ClubWaitPlayerNear(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_ClubWaitPlayerNear(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 relYawFromPlayer = this->actor.world.rot.y - this->actor.yawTowardsPlayer; @@ -1259,7 +1259,7 @@ void EnMb_SetupSpearDamaged(EnMb* this) { EnMb_SetupAction(this, EnMb_SpearDamaged); } -void EnMb_SpearDamaged(EnMb* this, GlobalContext* globalCtx) { +void EnMb_SpearDamaged(EnMb* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.params <= ENMB_TYPE_SPEAR_GUARD) { @@ -1290,8 +1290,8 @@ void EnMb_SetupSpearDead(EnMb* this) { EnMb_SetupAction(this, EnMb_SpearDead); } -void EnMb_SpearDead(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_SpearDead(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); @@ -1299,7 +1299,7 @@ void EnMb_SpearDead(EnMb* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); this->attack = ENMB_ATTACK_NONE; } @@ -1316,17 +1316,17 @@ void EnMb_SpearDead(EnMb* this, GlobalContext* globalCtx) { effPos.y = Rand_CenteredFloat(15.0f) + (this->actor.world.pos.y + 20.0f); effPos.z = Rand_CenteredFloat(110.0f) + this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &effPos, &zeroVec, &zeroVec, 100, 7, 255, 255, 255, 255, 0, 255, 0, 1, - 9, true); + EffectSsDeadDb_Spawn(play, &effPos, &zeroVec, &zeroVec, 100, 7, 255, 255, 255, 255, 0, 255, 0, 1, 9, + true); } } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); Actor_Kill(&this->actor); } } } -void EnMb_SpearUpdateAttackCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_SpearUpdateAttackCollider(Actor* thisx, PlayState* play) { Vec3f quadModel0 = { 1000.0f, 1500.0f, 0.0f }; Vec3f quadModel1 = { -1000.0f, 1500.0f, 0.0f }; Vec3f quadModel2 = { 1000.0f, 1500.0f, 4500.0f }; @@ -1352,7 +1352,7 @@ void EnMb_SpearUpdateAttackCollider(Actor* thisx, GlobalContext* globalCtx) { &this->attackCollider.dim.quad[3]); } -void EnMb_ClubUpdateAttackCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_ClubUpdateAttackCollider(Actor* thisx, PlayState* play) { static Vec3f quadModel[] = { { 1000.0f, 0.0f, 0.0f }, { 1000.0f, 0.0f, 0.0f }, { 1000.0f, -8000.0f, -1500.0f }, @@ -1368,8 +1368,8 @@ void EnMb_ClubUpdateAttackCollider(Actor* thisx, GlobalContext* globalCtx) { &this->attackCollider.dim.quad[3]); } -void EnMb_CheckColliding(EnMb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMb_CheckColliding(EnMb* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->frontShielding.base.acFlags & AC_HIT) { this->frontShielding.base.acFlags &= ~(AC_HIT | AC_BOUNCED); @@ -1382,7 +1382,7 @@ void EnMb_CheckColliding(EnMb* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->unk_850 = 200; - func_8002F71C(globalCtx, &this->actor, 6.0f, this->actor.world.rot.y, 6.0f); + func_8002F71C(play, &this->actor, 6.0f, this->actor.world.rot.y, 6.0f); } this->damageEffect = this->actor.colChkInfo.damageEffect; this->attack = ENMB_ATTACK_NONE; @@ -1414,15 +1414,15 @@ void EnMb_CheckColliding(EnMb* this, GlobalContext* globalCtx) { } } -void EnMb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_Update(Actor* thisx, PlayState* play) { EnMb* this = (EnMb*)thisx; s32 pad; - EnMb_CheckColliding(this, globalCtx); + EnMb_CheckColliding(this, play); if (thisx->colChkInfo.damageEffect != ENMB_DMGEFF_FREEZE) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 40.0f, 40.0f, 70.0f, + Actor_UpdateBgCheckInfo(play, thisx, 40.0f, 40.0f, 70.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Actor_SetFocus(thisx, thisx->scale.x * 4500.0f); @@ -1431,21 +1431,21 @@ void EnMb_Update(Actor* thisx, GlobalContext* globalCtx) { this->hitbox.dim.pos.x += Math_SinS(thisx->shape.rot.y) * (-4400.0f * thisx->scale.y); this->hitbox.dim.pos.z += Math_CosS(thisx->shape.rot.y) * (-4400.0f * thisx->scale.y); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->hitbox.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->hitbox.base); if (this->state >= ENMB_STATE_STUNNED && (thisx->params == ENMB_TYPE_CLUB || this->state != ENMB_STATE_ATTACK)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->hitbox.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->hitbox.base); } if (this->state >= ENMB_STATE_IDLE) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->frontShielding.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->frontShielding.base); } if (this->attack > ENMB_ATTACK_NONE) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->attackCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->attackCollider.base); } } } -void EnMb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f unused = { 1100.0f, -700.0f, 0.0f }; static Vec3f feetPos = { 0.0f, 0.0f, 0.0f }; static Vec3f effSpawnModelPos = { 0.0f, -8000.0f, 0.0f }; @@ -1458,7 +1458,7 @@ void EnMb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec if (limbIndex == ENMB_LIMB_LHAND) { Matrix_MultVec3f(&effSpawnModelPos, &this->effSpawnPos); if (this->attack > ENMB_ATTACK_NONE) { - EnMb_ClubUpdateAttackCollider(&this->actor, globalCtx); + EnMb_ClubUpdateAttackCollider(&this->actor, play); } } Actor_SetFeetPos(&this->actor, limbIndex, ENMB_LIMB_LFOOT, &feetPos, ENMB_LIMB_RFOOT, &feetPos); @@ -1506,7 +1506,7 @@ void EnMb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnMb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMb_Draw(Actor* thisx, PlayState* play) { static Vec3f frontShieldingTriModel0[] = { { 4000.0f, 7000.0f, 3500.0f }, { 4000.0f, 0.0f, 3500.0f }, @@ -1524,13 +1524,13 @@ void EnMb_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 bodyPartIdx; EnMb* this = (EnMb*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnMb_PostLimbDraw, thisx); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnMb_PostLimbDraw, thisx); if (thisx->params != ENMB_TYPE_CLUB) { if (this->attack > ENMB_ATTACK_NONE) { - EnMb_SpearUpdateAttackCollider(thisx, globalCtx); + EnMb_SpearUpdateAttackCollider(thisx, play); } for (i = 0; i < 3; i++) { Matrix_MultVec3f(&frontShieldingTriModel0[i], &frontShieldingTri0[i]); @@ -1553,8 +1553,8 @@ void EnMb_Draw(Actor* thisx, GlobalContext* globalCtx) { scale = 4.0f; } bodyPartIdx = this->iceEffectTimer >> 2; - EffectSsEnIce_SpawnFlyingVec3s(globalCtx, thisx, &this->bodyPartsPos[bodyPartIdx], 150, 150, 150, 250, 235, - 245, 255, scale); + EffectSsEnIce_SpawnFlyingVec3s(play, thisx, &this->bodyPartsPos[bodyPartIdx], 150, 150, 150, 250, 235, 245, + 255, scale); } } } diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.h b/src/overlays/actors/ovl_En_Mb/z_en_mb.h index 5ddb628fca..ac20ceede2 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.h +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.h @@ -6,7 +6,7 @@ struct EnMb; -typedef void (*EnMbActionFunc)(struct EnMb*, GlobalContext*); +typedef void (*EnMbActionFunc)(struct EnMb*, PlayState*); typedef enum { /* 0 */ ENMB_STATE_SPEAR_SPEARPATH_DAMAGED, diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 778cd136ed..5318126987 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -10,16 +10,16 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnMd_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMd_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMd_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMd_Init(Actor* thisx, PlayState* play); +void EnMd_Destroy(Actor* thisx, PlayState* play); +void EnMd_Update(Actor* thisx, PlayState* play); +void EnMd_Draw(Actor* thisx, PlayState* play); -void func_80AAB874(EnMd* this, GlobalContext* globalCtx); -void func_80AAB8F8(EnMd* this, GlobalContext* globalCtx); -void func_80AAB948(EnMd* this, GlobalContext* globalCtx); -void func_80AABC10(EnMd* this, GlobalContext* globalCtx); -void func_80AABD0C(EnMd* this, GlobalContext* globalCtx); +void func_80AAB874(EnMd* this, PlayState* play); +void func_80AAB8F8(EnMd* this, PlayState* play); +void func_80AAB948(EnMd* this, PlayState* play); +void func_80AABC10(EnMd* this, PlayState* play); +void func_80AABD0C(EnMd* this, PlayState* play); const ActorInit En_Md_InitVars = { ACTOR_EN_MD, @@ -347,8 +347,8 @@ void func_80AAAA24(EnMd* this) { func_80AAA93C(this); } -s16 func_80AAAC78(EnMd* this, GlobalContext* globalCtx) { - s16 dialogState = Message_GetState(&globalCtx->msgCtx); +s16 func_80AAAC78(EnMd* this, PlayState* play) { + s16 dialogState = Message_GetState(&play->msgCtx); if ((this->unk_209 == TEXT_STATE_AWAITING_NEXT) || (this->unk_209 == TEXT_STATE_EVENT) || (this->unk_209 == TEXT_STATE_CLOSING) || (this->unk_209 == TEXT_STATE_DONE_HAS_NEXT)) { @@ -361,8 +361,8 @@ s16 func_80AAAC78(EnMd* this, GlobalContext* globalCtx) { return dialogState; } -u16 EnMd_GetTextKokiriForest(GlobalContext* globalCtx, EnMd* this) { - u16 reactionText = Text_GetFaceReaction(globalCtx, 0x11); +u16 EnMd_GetTextKokiriForest(PlayState* play, EnMd* this) { + u16 reactionText = Text_GetFaceReaction(play, 0x11); if (reactionText != 0) { return reactionText; @@ -391,7 +391,7 @@ u16 EnMd_GetTextKokiriForest(GlobalContext* globalCtx, EnMd* this) { return 0x102F; } -u16 EnMd_GetTextKokiriHome(GlobalContext* globalCtx, EnMd* this) { +u16 EnMd_GetTextKokiriHome(PlayState* play, EnMd* this) { this->unk_208 = 0; this->unk_209 = TEXT_STATE_NONE; @@ -402,7 +402,7 @@ u16 EnMd_GetTextKokiriHome(GlobalContext* globalCtx, EnMd* this) { return 0x1046; } -u16 EnMd_GetTextLostWoods(GlobalContext* globalCtx, EnMd* this) { +u16 EnMd_GetTextLostWoods(PlayState* play, EnMd* this) { this->unk_208 = 0; this->unk_209 = TEXT_STATE_NONE; @@ -424,24 +424,24 @@ u16 EnMd_GetTextLostWoods(GlobalContext* globalCtx, EnMd* this) { return 0x1060; } -u16 EnMd_GetText(GlobalContext* globalCtx, Actor* thisx) { +u16 EnMd_GetText(PlayState* play, Actor* thisx) { EnMd* this = (EnMd*)thisx; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT04: - return EnMd_GetTextKokiriForest(globalCtx, this); + return EnMd_GetTextKokiriForest(play, this); case SCENE_KOKIRI_HOME4: - return EnMd_GetTextKokiriHome(globalCtx, this); + return EnMd_GetTextKokiriHome(play, this); case SCENE_SPOT10: - return EnMd_GetTextLostWoods(globalCtx, this); + return EnMd_GetTextLostWoods(play, this); default: return 0; } } -s16 func_80AAAF04(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80AAAF04(PlayState* play, Actor* thisx) { EnMd* this = (EnMd*)thisx; - switch (func_80AAAC78(this, globalCtx)) { + switch (func_80AAAC78(this, play)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_FADING: @@ -472,7 +472,7 @@ s16 func_80AAAF04(GlobalContext* globalCtx, Actor* thisx) { } return 0; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { return 2; } default: @@ -480,14 +480,14 @@ s16 func_80AAAF04(GlobalContext* globalCtx, Actor* thisx) { } } -u8 EnMd_ShouldSpawn(EnMd* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT04) { +u8 EnMd_ShouldSpawn(EnMd* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT04) { if (!GET_EVENTCHKINF(EVENTCHKINF_1C) && !GET_EVENTCHKINF(EVENTCHKINF_40)) { return 1; } } - if (globalCtx->sceneNum == SCENE_KOKIRI_HOME4) { + if (play->sceneNum == SCENE_KOKIRI_HOME4) { if (GET_EVENTCHKINF(EVENTCHKINF_1C) || GET_EVENTCHKINF(EVENTCHKINF_40)) { if (!LINK_IS_ADULT) { return 1; @@ -495,7 +495,7 @@ u8 EnMd_ShouldSpawn(EnMd* this, GlobalContext* globalCtx) { } } - if (globalCtx->sceneNum == SCENE_SPOT10) { + if (play->sceneNum == SCENE_SPOT10) { return 1; } @@ -512,8 +512,8 @@ void EnMd_UpdateEyes(EnMd* this) { } } -void func_80AAB158(EnMd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AAB158(EnMd* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 absYawDiff; s16 temp; s16 temp2; @@ -543,8 +543,8 @@ void func_80AAB158(EnMd* this, GlobalContext* globalCtx) { temp2 = 1; } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) { - this->unk_1E0.unk_18 = globalCtx->view.eye; + if ((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) { + this->unk_1E0.unk_18 = play->view.eye; this->unk_1E0.unk_14 = 40.0f; temp = 2; } else { @@ -555,13 +555,13 @@ void func_80AAB158(EnMd* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_1E0, 2, temp); if (this->actionFunc != func_80AABC10) { if (temp2) { - func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 30.0f, - EnMd_GetText, func_80AAAF04); + func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 30.0f, EnMd_GetText, + func_80AAAF04); } } } -u8 EnMd_FollowPath(EnMd* this, GlobalContext* globalCtx) { +u8 EnMd_FollowPath(EnMd* this, PlayState* play) { Path* path; Vec3s* pointPos; f32 pathDiffX; @@ -571,7 +571,7 @@ u8 EnMd_FollowPath(EnMd* this, GlobalContext* globalCtx) { return 0; } - path = &globalCtx->setupPathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->setupPathList[(this->actor.params & 0xFF00) >> 8]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->waypoint; @@ -590,7 +590,7 @@ u8 EnMd_FollowPath(EnMd* this, GlobalContext* globalCtx) { return 0; } -u8 EnMd_SetMovedPos(EnMd* this, GlobalContext* globalCtx) { +u8 EnMd_SetMovedPos(EnMd* this, PlayState* play) { Path* path; Vec3s* lastPointPos; @@ -598,7 +598,7 @@ u8 EnMd_SetMovedPos(EnMd* this, GlobalContext* globalCtx) { return 0; } - path = &globalCtx->setupPathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->setupPathList[(this->actor.params & 0xFF00) >> 8]; lastPointPos = SEGMENTED_TO_VIRTUAL(path->points); lastPointPos += path->count - 1; @@ -609,15 +609,15 @@ u8 EnMd_SetMovedPos(EnMd* this, GlobalContext* globalCtx) { return 1; } -void func_80AAB5A4(EnMd* this, GlobalContext* globalCtx) { +void func_80AAB5A4(EnMd* this, PlayState* play) { f32 temp; - if (globalCtx->sceneNum != SCENE_KOKIRI_HOME4) { + if (play->sceneNum != SCENE_KOKIRI_HOME4) { temp = (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && - (globalCtx->sceneNum == SCENE_SPOT04)) + (play->sceneNum == SCENE_SPOT04)) ? 100.0f : 400.0f; - this->alpha = func_80034DD4(&this->actor, globalCtx, this->alpha, temp); + this->alpha = func_80034DD4(&this->actor, play, this->alpha, temp); this->actor.shape.shadowAlpha = this->alpha; } else { this->alpha = 255; @@ -625,17 +625,17 @@ void func_80AAB5A4(EnMd* this, GlobalContext* globalCtx) { } } -void EnMd_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMd_Init(Actor* thisx, PlayState* play) { EnMd* this = (EnMd*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gMidoSkel, NULL, this->jointTable, this->morphTable, 17); + SkelAnime_InitFlex(play, &this->skelAnime, &gMidoSkel, NULL, this->jointTable, this->morphTable, 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (!EnMd_ShouldSpawn(this, globalCtx)) { + if (!EnMd_ShouldSpawn(this, play)) { Actor_Kill(&this->actor); return; } @@ -644,33 +644,33 @@ void EnMd_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->alpha = 255; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + 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 (((globalCtx->sceneNum == SCENE_SPOT04) && !GET_EVENTCHKINF(EVENTCHKINF_04)) || - ((globalCtx->sceneNum == SCENE_SPOT04) && GET_EVENTCHKINF(EVENTCHKINF_04) && + if (((play->sceneNum == SCENE_SPOT04) && !GET_EVENTCHKINF(EVENTCHKINF_04)) || + ((play->sceneNum == SCENE_SPOT04) && GET_EVENTCHKINF(EVENTCHKINF_04) && CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) || - ((globalCtx->sceneNum == SCENE_SPOT10) && !GET_EVENTCHKINF(EVENTCHKINF_0A))) { + ((play->sceneNum == SCENE_SPOT10) && !GET_EVENTCHKINF(EVENTCHKINF_0A))) { this->actor.home.pos = this->actor.world.pos; this->actionFunc = func_80AAB948; return; } - if (globalCtx->sceneNum != SCENE_KOKIRI_HOME4) { - EnMd_SetMovedPos(this, globalCtx); + if (play->sceneNum != SCENE_KOKIRI_HOME4) { + EnMd_SetMovedPos(this, play); } this->actionFunc = func_80AAB874; } -void EnMd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMd_Destroy(Actor* thisx, PlayState* play) { EnMd* this = (EnMd*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AAB874(EnMd* this, GlobalContext* globalCtx) { +void func_80AAB874(EnMd* this, PlayState* play) { if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { - func_80034F54(globalCtx, this->unk_214, this->unk_236, 17); + func_80034F54(play, this->unk_214, this->unk_236, 17); } else if ((this->unk_1E0.unk_00 == 0) && (this->unk_20B != 7)) { func_80AAA92C(this, 7); } @@ -678,17 +678,17 @@ void func_80AAB874(EnMd* this, GlobalContext* globalCtx) { func_80AAAA24(this); } -void func_80AAB8F8(EnMd* this, GlobalContext* globalCtx) { +void func_80AAB8F8(EnMd* this, PlayState* play) { if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { - func_80034F54(globalCtx, this->unk_214, this->unk_236, 17); + func_80034F54(play, this->unk_214, this->unk_236, 17); } func_80AAA93C(this); } -void func_80AAB948(EnMd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AAB948(EnMd* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp; - Actor* actorToBlock = &GET_PLAYER(globalCtx)->actor; + Actor* actorToBlock = &GET_PLAYER(play)->actor; s16 yaw; func_80AAAA24(this); @@ -711,14 +711,14 @@ void func_80AAB948(EnMd* this, GlobalContext* globalCtx) { if (this->unk_1E0.unk_00 == 2) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && - (globalCtx->sceneNum == SCENE_SPOT04)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + (play->sceneNum == SCENE_SPOT04)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; } - if (globalCtx->sceneNum == SCENE_SPOT04) { + if (play->sceneNum == SCENE_SPOT04) { SET_EVENTCHKINF(EVENTCHKINF_04); } - if (globalCtx->sceneNum == SCENE_SPOT10) { + if (play->sceneNum == SCENE_SPOT10) { SET_EVENTCHKINF(EVENTCHKINF_0A); } @@ -732,14 +732,14 @@ void func_80AAB948(EnMd* this, GlobalContext* globalCtx) { } if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { - func_80034F54(globalCtx, this->unk_214, this->unk_236, 17); + func_80034F54(play, this->unk_214, this->unk_236, 17); } - if ((this->unk_1E0.unk_00 == 0) && (globalCtx->sceneNum == SCENE_SPOT10)) { + if ((this->unk_1E0.unk_00 == 0) && (play->sceneNum == SCENE_SPOT10)) { if (player->stateFlags2 & PLAYER_STATE2_24) { player->stateFlags2 |= PLAYER_STATE2_25; player->unk_6A8 = &this->actor; - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_SARIA); + func_8010BD58(play, OCARINA_ACTION_CHECK_SARIA); this->actionFunc = func_80AABC10; return; } @@ -750,37 +750,37 @@ void func_80AAB948(EnMd* this, GlobalContext* globalCtx) { } } -void func_80AABC10(EnMd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AABC10(EnMd* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_04) { + if (play->msgCtx.ocarinaMode >= OCARINA_MODE_04) { this->actionFunc = func_80AAB948; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->actor.textId = 0x1067; - func_8002F2CC(&this->actor, globalCtx, this->collider.dim.radius + 30.0f); + func_8002F2CC(&this->actor, play, this->collider.dim.radius + 30.0f); this->actionFunc = func_80AAB948; - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { player->stateFlags2 |= PLAYER_STATE2_23; } } -void func_80AABD0C(EnMd* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_214, this->unk_236, 17); +void func_80AABD0C(EnMd* this, PlayState* play) { + func_80034F54(play, this->unk_214, this->unk_236, 17); func_80AAA93C(this); - if (!(EnMd_FollowPath(this, globalCtx)) || (this->waypoint != 0)) { + if (!(EnMd_FollowPath(this, play)) || (this->waypoint != 0)) { this->actor.shape.rot = this->actor.world.rot; return; } if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && - (globalCtx->sceneNum == SCENE_SPOT04)) { - Message_CloseTextbox(globalCtx); + (play->sceneNum == SCENE_SPOT04)) { + Message_CloseTextbox(play); SET_EVENTCHKINF(EVENTCHKINF_1C); Actor_Kill(&this->actor); return; @@ -794,23 +794,22 @@ void func_80AABD0C(EnMd* this, GlobalContext* globalCtx) { this->actionFunc = func_80AAB8F8; } -void EnMd_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMd_Update(Actor* thisx, PlayState* play) { EnMd* this = (EnMd*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); EnMd_UpdateEyes(this); - func_80AAB5A4(this, globalCtx); + func_80AAB5A4(this, play); Actor_MoveForward(&this->actor); - func_80AAB158(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); + func_80AAB158(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + this->actionFunc(this, play); } -s32 EnMd_OverrideLimbDraw(GlobalContext* globalCtx, 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 vec; @@ -835,7 +834,7 @@ s32 EnMd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMd_PostLimbDraw(GlobalContext* globalCtx, 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 vec = { 400.0f, 0.0f, 0.0f }; @@ -844,7 +843,7 @@ void EnMd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnMd_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMd_Draw(Actor* thisx, PlayState* play) { static void* sEyeTextures[] = { gMidoEyeOpenTex, gMidoEyeHalfTex, @@ -852,15 +851,15 @@ void EnMd_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnMd* this = (EnMd*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_md.c", 1280); + OPEN_DISPS(play->state.gfxCtx, "../z_en_md.c", 1280); if (this->alpha == 255) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIdx])); - func_80034BA0(globalCtx, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); + 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->eyeIdx])); - func_80034CC4(globalCtx, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); + func_80034CC4(play, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_md.c", 1317); + 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 064cc61efe..415d15e501 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.h +++ b/src/overlays/actors/ovl_En_Md/z_en_md.h @@ -6,7 +6,7 @@ struct EnMd; -typedef void (*EnMdActionFunc)(struct EnMd*, GlobalContext*); +typedef void (*EnMdActionFunc)(struct EnMd*, PlayState*); typedef struct EnMd { /* 0x0000 */ Actor actor; 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 6824e7fed8..1d3a7ba65f 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnMk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMk_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMk_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMk_Init(Actor* thisx, PlayState* play); +void EnMk_Destroy(Actor* thisx, PlayState* play); +void EnMk_Update(Actor* thisx, PlayState* play); +void EnMk_Draw(Actor* thisx, PlayState* play); -void EnMk_Wait(EnMk* this, GlobalContext* globalCtx); +void EnMk_Wait(EnMk* this, PlayState* play); const ActorInit En_Mk_InitVars = { ACTOR_EN_MK, @@ -48,18 +48,18 @@ static ColliderCylinderInit sCylinderInit = { { 30, 40, 0, { 0, 0, 0 } }, }; -void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMk_Init(Actor* thisx, PlayState* play) { EnMk* this = (EnMk*)thisx; s32 swimFlag; this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_mk_Skel_005DF0, &object_mk_Anim_000D88, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_mk_Skel_005DF0, &object_mk_Anim_000D88, this->jointTable, this->morphTable, 13); Animation_PlayLoop(&this->skelAnime, &object_mk_Anim_000D88); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = 0xFF; Actor_SetScale(&this->actor, 0.01f); @@ -73,14 +73,14 @@ void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnMk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMk_Destroy(Actor* thisx, PlayState* play) { EnMk* this = (EnMk*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AACA40(EnMk* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80AACA40(EnMk* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = EnMk_Wait; } @@ -88,43 +88,43 @@ void func_80AACA40(EnMk* this, GlobalContext* globalCtx) { this->flags |= 1; } -void func_80AACA94(EnMk* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx) != 0) { +void func_80AACA94(EnMk* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play) != 0) { this->actor.parent = NULL; this->actionFunc = func_80AACA40; func_80088AA0(240); CLEAR_EVENTINF(EVENTINF_10); } else { - func_8002F434(&this->actor, globalCtx, GI_EYEDROPS, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_EYEDROPS, 10000.0f, 50.0f); } } -void func_80AACB14(EnMk* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80AACB14(EnMk* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = func_80AACA94; - func_8002F434(&this->actor, globalCtx, GI_EYEDROPS, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_EYEDROPS, 10000.0f, 50.0f); } } -void func_80AACB6C(EnMk* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80AACB6C(EnMk* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80AACB14; } this->flags |= 1; } -void func_80AACBAC(EnMk* this, GlobalContext* globalCtx) { +void func_80AACBAC(EnMk* this, PlayState* play) { if (this->timer > 0) { this->timer--; this->actor.shape.rot.y -= 0x800; } else { this->actionFunc = func_80AACB6C; - Message_ContinueTextbox(globalCtx, 0x4030); + Message_ContinueTextbox(play, 0x4030); } } -void func_80AACC04(EnMk* this, GlobalContext* globalCtx) { +void func_80AACC04(EnMk* this, PlayState* play) { if (this->timer > 0) { this->timer--; } else { @@ -136,7 +136,7 @@ void func_80AACC04(EnMk* this, GlobalContext* globalCtx) { } } -void func_80AACCA0(EnMk* this, GlobalContext* globalCtx) { +void func_80AACCA0(EnMk* this, PlayState* play) { if (this->timer > 0) { this->timer--; this->actor.shape.rot.y += 0x800; @@ -149,13 +149,13 @@ void func_80AACCA0(EnMk* this, GlobalContext* globalCtx) { } } -void func_80AACD48(EnMk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AACD48(EnMk* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = func_80AACCA0; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; player->exchangeItemId = EXCH_ITEM_NONE; this->timer = 16; Animation_Change(&this->skelAnime, &object_mk_Anim_000D88, 1.0f, 0.0f, @@ -166,9 +166,9 @@ void func_80AACD48(EnMk* this, GlobalContext* globalCtx) { this->flags |= 1; } -void func_80AACE2C(EnMk* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x4001); +void func_80AACE2C(EnMk* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x4001); Animation_Change(&this->skelAnime, &object_mk_Anim_000AC0, 1.0f, 0.0f, Animation_GetLastFrame(&object_mk_Anim_000AC0), ANIMMODE_ONCE, -4.0f); this->flags &= ~2; @@ -178,9 +178,9 @@ void func_80AACE2C(EnMk* this, GlobalContext* globalCtx) { this->flags |= 1; } -void func_80AACEE8(EnMk* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x4000); +void func_80AACEE8(EnMk* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x4000); Animation_Change(&this->skelAnime, &object_mk_Anim_000AC0, 1.0f, 0.0f, Animation_GetLastFrame(&object_mk_Anim_000AC0), ANIMMODE_LOOP, -4.0f); this->flags &= ~2; @@ -190,33 +190,33 @@ void func_80AACEE8(EnMk* this, GlobalContext* globalCtx) { this->flags |= 1; } -void func_80AACFA0(EnMk* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80AACFA0(EnMk* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80AACA40; SET_ITEMGETINF(ITEMGETINF_10); } else { - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f); } } -void func_80AAD014(EnMk* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80AAD014(EnMk* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = func_80AACFA0; - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f); } this->flags |= 1; } -void EnMk_Wait(EnMk* this, GlobalContext* globalCtx) { +void EnMk_Wait(EnMk* this, PlayState* play) { s16 angle; s32 swimFlag; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 playerExchangeItem; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - playerExchangeItem = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + playerExchangeItem = func_8002F368(play); if (this->actor.textId != 0x4018) { player->actor.textId = this->actor.textId; @@ -264,7 +264,7 @@ void EnMk_Wait(EnMk* this, GlobalContext* globalCtx) { } } } else { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x1A); + this->actor.textId = Text_GetFaceReaction(play, 0x1A); if (this->actor.textId == 0) { this->actor.textId = 0x4018; @@ -273,13 +273,13 @@ void EnMk_Wait(EnMk* this, GlobalContext* globalCtx) { angle = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(angle) < 0x2151) && (this->actor.xzDistToPlayer < 100.0f)) { - func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_FROG); + func_8002F298(&this->actor, play, 100.0f, EXCH_ITEM_FROG); this->flags |= 1; } } } -void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMk_Update(Actor* thisx, PlayState* play) { EnMk* this = (EnMk*)thisx; s32 pad; Vec3s vec; @@ -287,24 +287,24 @@ void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) { s16 swimFlag; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (!(this->flags & 2) && SkelAnime_Update(&this->skelAnime)) { this->flags |= 2; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->flags & 1) { - func_80038290(globalCtx, &this->actor, &this->headRotation, &vec, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRotation, &vec, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->headRotation.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->headRotation.y, 0, 6, 6200, 100); } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (this->flags & 8) { if (!(player->stateFlags2 & PLAYER_STATE2_10)) { @@ -342,7 +342,7 @@ void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMk* this = (EnMk*)thisx; if (limbIndex == 11) { @@ -353,7 +353,7 @@ s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +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; @@ -362,10 +362,10 @@ void EnMk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnMk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMk_Draw(Actor* thisx, PlayState* play) { EnMk* this = (EnMk*)thisx; - func_800943C8(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_800943C8(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMk_OverrideLimbDraw, EnMk_PostLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.h b/src/overlays/actors/ovl_En_Mk/z_en_mk.h index 6c8ba12ca2..5b8a438a00 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.h +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.h @@ -6,7 +6,7 @@ struct EnMk; -typedef void (*EnMkActionFunc)(struct EnMk*, GlobalContext*); +typedef void (*EnMkActionFunc)(struct EnMk*, PlayState*); typedef struct EnMk { /* 0x0000 */ Actor actor; 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 92bad0bcef..6c056f0805 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -25,19 +25,19 @@ typedef enum { /* 1 */ RM_MOUTH_OPEN } RunningManMouthTex; -void EnMm_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMm_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMm_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMm_Init(Actor* thisx, PlayState* play); +void EnMm_Destroy(Actor* thisx, PlayState* play); +void EnMm_Update(Actor* thisx, PlayState* play); +void EnMm_Draw(Actor* thisx, PlayState* play); -void func_80AAE598(EnMm* this, GlobalContext* globalCtx); -void func_80AAE294(EnMm* this, GlobalContext* globalCtx); -void func_80AAE50C(EnMm* this, GlobalContext* globalCtx); -void func_80AAE224(EnMm* this, GlobalContext* globalCtx); +void func_80AAE598(EnMm* this, PlayState* play); +void func_80AAE294(EnMm* this, PlayState* play); +void func_80AAE50C(EnMm* this, PlayState* play); +void func_80AAE224(EnMm* this, PlayState* play); s32 func_80AADA70(void); -s32 EnMm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -void EnMm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void*); +s32 EnMm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); +void EnMm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*); const ActorInit En_Mm_InitVars = { ACTOR_EN_MM, @@ -155,20 +155,20 @@ void EnMm_ChangeAnim(EnMm* this, s32 index, s32* currentIndex) { *currentIndex = index; } -void EnMm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Init(Actor* thisx, PlayState* play) { s32 pad; EnMm* this = (EnMm*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 21.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRunningManSkel, NULL, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gRunningManSkel, NULL, this->jointTable, this->morphTable, 16); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, sColChkInfoInit); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); Animation_Change(&this->skelAnime, sAnimationInfo[RM_ANIM_RUN].animation, 1.0f, 0.0f, Animation_GetLastFrame(sAnimationInfo[RM_ANIM_RUN].animation), sAnimationInfo[RM_ANIM_RUN].mode, sAnimationInfo[RM_ANIM_RUN].morphFrames); @@ -192,11 +192,11 @@ void EnMm_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnMm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnMm* this = (EnMm*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 func_80AADA70(void) { @@ -209,20 +209,20 @@ s32 func_80AADA70(void) { return isDay; } -s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { +s32 func_80AADAA0(EnMm* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 sp1C = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_CLOSING: case TEXT_STATE_DONE_FADING: break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { player->actor.textId = 0x202D; this->unk_254 &= ~1; EnMm_ChangeAnim(this, RM_ANIM_HAPPY, &this->curAnimIndex); @@ -234,9 +234,9 @@ s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx)) { - Player_UnsetMask(globalCtx); - Item_Give(globalCtx, ITEM_SOLD_OUT); + if (Message_ShouldAdvance(play)) { + Player_UnsetMask(play); + Item_Give(play, ITEM_SOLD_OUT); SET_ITEMGETINF(ITEMGETINF_3B); Rupees_ChangeBy(500); player->actor.textId = 0x202E; @@ -244,7 +244,7 @@ s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { } break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if ((player->actor.textId == 0x202E) || (player->actor.textId == 0x202C)) { this->unk_254 |= 1; EnMm_ChangeAnim(this, RM_ANIM_SIT_WAIT, &this->curAnimIndex); @@ -257,11 +257,11 @@ s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { return sp1C; } -s32 EnMm_GetTextId(EnMm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnMm_GetTextId(EnMm* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 textId; - textId = Text_GetFaceReaction(globalCtx, 0x1C); + textId = Text_GetFaceReaction(play, 0x1C); if (GET_ITEMGETINF(ITEMGETINF_3B)) { if (textId == 0) { @@ -276,19 +276,19 @@ s32 EnMm_GetTextId(EnMm* this, GlobalContext* globalCtx) { return textId; } -void func_80AADCD0(EnMm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AADCD0(EnMm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 yawDiff; s16 sp26; s16 sp24; if (this->unk_1E0 == 2) { - Message_ContinueTextbox(globalCtx, player->actor.textId); + Message_ContinueTextbox(play, player->actor.textId); this->unk_1E0 = 1; } else if (this->unk_1E0 == 1) { - this->unk_1E0 = func_80AADAA0(this, globalCtx); + this->unk_1E0 = func_80AADAA0(this, play); } else { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_1E0 = 1; if (this->curAnimIndex != 5) { @@ -298,12 +298,12 @@ void func_80AADCD0(EnMm* this, GlobalContext* globalCtx) { } } } else { - Actor_GetScreenPos(globalCtx, &this->actor, &sp26, &sp24); + Actor_GetScreenPos(play, &this->actor, &sp26, &sp24); yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if ((sp26 >= 0) && (sp26 <= 0x140) && (sp24 >= 0) && (sp24 <= 0xF0) && (yawDiff <= 17152.0f) && - (this->unk_1E0 != 3) && func_8002F2CC(&this->actor, globalCtx, 100.0f)) { - this->actor.textId = EnMm_GetTextId(this, globalCtx); + (this->unk_1E0 != 3) && func_8002F2CC(&this->actor, play, 100.0f)) { + this->actor.textId = EnMm_GetTextId(this, play); } } } @@ -324,14 +324,14 @@ s32 func_80AADE60(Path* pathList, Vec3f* pos, s32 pathNum, s32 waypoint) { return 0; } -s32 func_80AADEF0(EnMm* this, GlobalContext* globalCtx) { +s32 func_80AADEF0(EnMm* this, PlayState* play) { f32 xDiff; f32 zDiff; Vec3f waypointPos; s32 phi_a2; s32 phi_v1; - func_80AADE60(globalCtx->setupPathList, &waypointPos, this->path, this->waypoint); + func_80AADE60(play->setupPathList, &waypointPos, this->path, this->waypoint); xDiff = waypointPos.x - this->actor.world.pos.x; zDiff = waypointPos.z - this->actor.world.pos.z; @@ -349,7 +349,7 @@ s32 func_80AADEF0(EnMm* this, GlobalContext* globalCtx) { phi_a2 = 0; break; case 1: - phi_a2 = EnMm_GetPointCount(globalCtx->setupPathList, this->path) - 1; + phi_a2 = EnMm_GetPointCount(play->setupPathList, this->path) - 1; break; case 2: phi_a2 = this->unk_1F0; @@ -363,7 +363,7 @@ s32 func_80AADEF0(EnMm* this, GlobalContext* globalCtx) { phi_v1 = 0; break; case 1: - phi_v1 = EnMm_GetPointCount(globalCtx->setupPathList, this->path) - 1; + phi_v1 = EnMm_GetPointCount(play->setupPathList, this->path) - 1; break; case 2: phi_v1 = this->unk_1F0; @@ -376,7 +376,7 @@ s32 func_80AADEF0(EnMm* this, GlobalContext* globalCtx) { this->waypoint = sPathInfo[this->unk_1E8].unk_08; } - func_80AADE60(globalCtx->setupPathList, &waypointPos, this->path, this->waypoint); + func_80AADE60(play->setupPathList, &waypointPos, this->path, this->waypoint); xDiff = waypointPos.x - this->actor.world.pos.x; zDiff = waypointPos.z - this->actor.world.pos.z; @@ -389,12 +389,12 @@ s32 func_80AADEF0(EnMm* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; Math_SmoothStepToF(&this->actor.speedXZ, this->speedXZ, 0.6f, this->distToWaypoint, 0.0f); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); return 0; } -void func_80AAE224(EnMm* this, GlobalContext* globalCtx) { +void func_80AAE224(EnMm* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->actionFunc = func_80AAE598; this->unk_1E8 = 0; @@ -406,11 +406,11 @@ void func_80AAE224(EnMm* this, GlobalContext* globalCtx) { } } -void func_80AAE294(EnMm* this, GlobalContext* globalCtx) { +void func_80AAE294(EnMm* this, PlayState* play) { f32 floorPolyNormalY; Vec3f dustPos; - if (!Player_InCsMode(globalCtx)) { + if (!Player_InCsMode(play)) { SkelAnime_Update(&this->skelAnime); if (this->curAnimIndex == 0) { @@ -435,7 +435,7 @@ void func_80AAE294(EnMm* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = 1.0f; } - func_80AADEF0(this, globalCtx); + func_80AADEF0(this, play); if (func_80AADA70() == 0) { if (this->actor.floorPoly != NULL) { @@ -460,17 +460,17 @@ void func_80AAE294(EnMm* this, GlobalContext* globalCtx) { dustPos.z = this->actor.world.pos.z; if (gSaveContext.gameMode != 3) { - func_80033480(globalCtx, &dustPos, 50.0f, 2, 350, 20, 0); + func_80033480(play, &dustPos, 50.0f, 2, 350, 20, 0); } if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { - func_8002F71C(globalCtx, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 4.0f); + func_8002F71C(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 4.0f); } } } } -void func_80AAE50C(EnMm* this, GlobalContext* globalCtx) { +void func_80AAE50C(EnMm* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->sitTimer = 0; this->actionFunc = func_80AAE294; @@ -487,8 +487,8 @@ void func_80AAE50C(EnMm* this, GlobalContext* globalCtx) { } } -void func_80AAE598(EnMm* this, GlobalContext* globalCtx) { - func_80038290(globalCtx, &this->actor, &this->unk_248, &this->unk_24E, this->actor.focus.pos); +void func_80AAE598(EnMm* this, PlayState* play) { + func_80038290(play, &this->actor, &this->unk_248, &this->unk_24E, this->actor.focus.pos); SkelAnime_Update(&this->skelAnime); if ((func_80AADA70() != 0) && (this->unk_1E0 == 0)) { @@ -499,44 +499,44 @@ void func_80AAE598(EnMm* this, GlobalContext* globalCtx) { } } -void EnMm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Update(Actor* thisx, PlayState* play) { s32 pad; EnMm* this = (EnMm*)thisx; - this->actionFunc(this, globalCtx); - func_80AADCD0(this, globalCtx); + this->actionFunc(this, play); + func_80AADCD0(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnMm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Draw(Actor* thisx, PlayState* play) { static void* mouthTextures[] = { gRunningManMouthOpenTex, gRunningManMouthClosedTex }; s32 pad; EnMm* this = (EnMm*)thisx; if (0) {} - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_mm.c", 1065); + OPEN_DISPS(play->state.gfxCtx, "../z_en_mm.c", 1065); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMm_OverrideLimbDraw, EnMm_PostLimbDraw, this); if (GET_ITEMGETINF(ITEMGETINF_3B)) { - s32 linkChildObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_LINK_CHILD); + s32 linkChildObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD); if (linkChildObjBankIndex >= 0) { Mtx* mtx; Vec3s sp50; Mtx* mtx2; - mtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx) * 2); + mtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 2); Matrix_Put(&this->unk_208); - mtx2 = Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_mm.c", 1111); + mtx2 = Matrix_NewMtx(play->state.gfxCtx, "../z_en_mm.c", 1111); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[linkChildObjBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[linkChildObjBankIndex].segment); gSPSegment(POLY_OPA_DISP++, 0x0B, mtx); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx2 - 7); @@ -555,14 +555,14 @@ void EnMm_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_ToMtx(mtx, "../z_en_mm.c", 1131); gSPDisplayList(POLY_OPA_DISP++, gLinkChildBunnyHoodDL); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_mm.c", 1141); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_mm.c", 1141); } -s32 EnMm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMm* this = (EnMm*)thisx; if (this->unk_254 & 1) { @@ -583,7 +583,7 @@ s32 EnMm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnMm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f headOffset = { 200.0f, 800.0f, 0.0f }; EnMm* this = (EnMm*)thisx; diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.h b/src/overlays/actors/ovl_En_Mm/z_en_mm.h index 5dec76bb0a..7646e1f044 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.h +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.h @@ -6,7 +6,7 @@ struct EnMm; -typedef void (*EnMmActionFunc)(struct EnMm*, GlobalContext*); +typedef void (*EnMmActionFunc)(struct EnMm*, PlayState*); typedef struct EnMm { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index 9ed89f7991..fcdeea8bd2 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -25,15 +25,15 @@ typedef enum { /* 1 */ RM2_MOUTH_OPEN } RunningManMouthTex; -void EnMm2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMm2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMm2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMm2_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80AAF3C0(EnMm2* this, GlobalContext* globalCtx); -void func_80AAF57C(EnMm2* this, GlobalContext* globalCtx); -void func_80AAF668(EnMm2* this, GlobalContext* globalCtx); -s32 EnMm2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -void EnMm2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); +void EnMm2_Init(Actor* thisx, PlayState* play); +void EnMm2_Destroy(Actor* thisx, PlayState* play); +void EnMm2_Update(Actor* thisx, PlayState* play); +void EnMm2_Draw(Actor* thisx, PlayState* play); +void func_80AAF3C0(EnMm2* this, PlayState* play); +void func_80AAF57C(EnMm2* this, PlayState* play); +void func_80AAF668(EnMm2* this, PlayState* play); +s32 EnMm2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); +void EnMm2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); const ActorInit En_Mm2_InitVars = { ACTOR_EN_MM2, @@ -99,7 +99,7 @@ void EnMm2_ChangeAnim(EnMm2* this, s32 index, s32* currentIndex) { *currentIndex = index; } -void func_80AAEF70(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAEF70(EnMm2* this, PlayState* play) { if (!GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { this->actor.textId = 0x6086; } else if (GET_INFTABLE(INFTABLE_17F)) { @@ -121,19 +121,19 @@ void func_80AAEF70(EnMm2* this, GlobalContext* globalCtx) { } } -void EnMm2_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnMm2_Init(Actor* thisx, PlayState* play2) { EnMm2* this = (EnMm2*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 21.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRunningManSkel, NULL, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gRunningManSkel, NULL, this->jointTable, this->morphTable, 16); Animation_Change(&this->skelAnime, sAnimationInfo[RM2_ANIM_SIT_WAIT].animation, 1.0f, 0.0f, Animation_GetLastFrame(sAnimationInfo[RM2_ANIM_SIT_WAIT].animation), sAnimationInfo[RM2_ANIM_SIT_WAIT].mode, sAnimationInfo[RM2_ANIM_SIT_WAIT].morphFrames); this->previousAnimation = RM2_ANIM_SIT_WAIT; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->mouthTexIndex = RM2_MOUTH_CLOSED; this->actor.targetMode = 6; @@ -142,7 +142,7 @@ void EnMm2_Init(Actor* thisx, GlobalContext* globalCtx2) { if (this->actor.params == 1) { this->actionFunc = func_80AAF668; } else { - func_80AAEF70(this, globalCtx); + func_80AAEF70(this, play); this->actionFunc = func_80AAF57C; } if (!LINK_IS_ADULT) { @@ -156,27 +156,27 @@ void EnMm2_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnMm2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMm2_Destroy(Actor* thisx, PlayState* play) { EnMm2* this = (EnMm2*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80AAF224(EnMm2* this, GlobalContext* globalCtx, EnMm2ActionFunc actionFunc) { +s32 func_80AAF224(EnMm2* this, PlayState* play, EnMm2ActionFunc actionFunc) { s16 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = actionFunc; return 1; } yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(yawDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } return 0; } -void func_80AAF2BC(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF2BC(EnMm2* this, PlayState* play) { if (this->unk_1F6 > 60) { Actor_Kill(&this->actor); } @@ -185,34 +185,34 @@ void func_80AAF2BC(EnMm2* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.speedXZ, 10.0f, 0.6f, 2.0f, 0.0f); } -void func_80AAF330(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF330(EnMm2* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->actionFunc = func_80AAF2BC; EnMm2_ChangeAnim(this, RM2_ANIM_RUN, &this->previousAnimation); this->mouthTexIndex = RM2_MOUTH_OPEN; if (!(this->unk_1F4 & 2)) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } gSaveContext.timer2State = 0; CLEAR_EVENTINF(EVENTINF_10); } } -void func_80AAF3C0(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF3C0(EnMm2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); switch (this->actor.textId) { case 0x607D: case 0x607E: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - Message_ContinueTextbox(globalCtx, 0x607F); + Message_ContinueTextbox(play, 0x607F); this->actor.textId = 0x607F; SET_EVENTINF(EVENTINF_10); break; case 1: - Message_ContinueTextbox(globalCtx, 0x6080); + Message_ContinueTextbox(play, 0x6080); this->actor.textId = 0x6080; break; }; @@ -224,16 +224,16 @@ void func_80AAF3C0(EnMm2* this, GlobalContext* globalCtx) { } return; case 0x6081: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_1F4 |= 4; HIGH_SCORE(HS_MARATHON) -= 1; - Message_ContinueTextbox(globalCtx, 0x607E); + Message_ContinueTextbox(play, 0x607E); this->actor.textId = 0x607E; } return; } - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x607F) { func_80088AA0(0); this->actionFunc = func_80AAF57C; @@ -241,28 +241,28 @@ void func_80AAF3C0(EnMm2* this, GlobalContext* globalCtx) { this->actionFunc = func_80AAF57C; } this->actionFunc = func_80AAF57C; - func_80AAEF70(this, globalCtx); + func_80AAEF70(this, play); } } -void func_80AAF57C(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF57C(EnMm2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - func_80AAEF70(this, globalCtx); - if ((func_80AAF224(this, globalCtx, func_80AAF3C0)) && (this->actor.textId == 0x607D)) { + func_80AAEF70(this, play); + if ((func_80AAF224(this, play, func_80AAF3C0)) && (this->actor.textId == 0x607D)) { SET_INFTABLE(INFTABLE_17F); } } -void func_80AAF5EC(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF5EC(EnMm2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_1F4 &= ~1; EnMm2_ChangeAnim(this, RM2_ANIM_STAND, &this->previousAnimation); this->actionFunc = func_80AAF330; } } -void func_80AAF668(EnMm2* this, GlobalContext* globalCtx) { +void func_80AAF668(EnMm2* this, PlayState* play) { this->actor.world.rot.y = -0x3E80; this->actor.shape.rot.y = this->actor.world.rot.y; SkelAnime_Update(&this->skelAnime); @@ -271,7 +271,7 @@ void func_80AAF668(EnMm2* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x6084; } - if (func_80AAF224(this, globalCtx, func_80AAF5EC)) { + if (func_80AAF224(this, play, func_80AAF5EC)) { this->unk_1F6 = 0; if (((void)0, gSaveContext.timer2Value) < HIGH_SCORE(HS_MARATHON)) { HIGH_SCORE(HS_MARATHON) = gSaveContext.timer2Value; @@ -287,38 +287,38 @@ void func_80AAF668(EnMm2* this, GlobalContext* globalCtx) { } } -void EnMm2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMm2_Update(Actor* thisx, PlayState* play) { EnMm2* this = (EnMm2*)thisx; s32 pad; if (this->unk_1F4 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_1E8, &this->unk_1EE, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_1E8, &this->unk_1EE, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_1E8.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_1E8.y, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_1EE.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_1EE.y, 0, 6, 6200, 100); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); } -void EnMm2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMm2_Draw(Actor* thisx, PlayState* play) { static void* mouthTextures[] = { gRunningManMouthOpenTex, gRunningManMouthClosedTex }; EnMm2* this = (EnMm2*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_mm2.c", 634); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_mm2.c", 634); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMm2_OverrideLimbDraw, EnMm2_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_mm2.c", 654); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_mm2.c", 654); } -s32 EnMm2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMm2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMm2* this = (EnMm2*)thisx; switch (limbIndex) { @@ -335,7 +335,7 @@ s32 EnMm2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnMm2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMm2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f headOffset = { 200.0f, 800.0f, 0.0f }; EnMm2* this = (EnMm2*)thisx; diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h index 9fb3df3e82..a5edeb9cb5 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h @@ -6,7 +6,7 @@ struct EnMm2; -typedef void (*EnMm2ActionFunc)(struct EnMm2*, GlobalContext*); +typedef void (*EnMm2ActionFunc)(struct EnMm2*, PlayState*); typedef struct EnMm2 { /* 0x0000 */ Actor actor; 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 ffd12f7053..e3635842a0 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -9,16 +9,16 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnMs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMs_Init(Actor* thisx, PlayState* play); +void EnMs_Destroy(Actor* thisx, PlayState* play); +void EnMs_Update(Actor* thisx, PlayState* play); +void EnMs_Draw(Actor* thisx, PlayState* play); -void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx); -void EnMs_Wait(EnMs* this, GlobalContext* globalCtx); -void EnMs_Talk(EnMs* this, GlobalContext* globalCtx); -void EnMs_Sell(EnMs* this, GlobalContext* globalCtx); -void EnMs_TalkAfterPurchase(EnMs* this, GlobalContext* globalCtx); +void EnMs_SetOfferText(EnMs* this, PlayState* play); +void EnMs_Wait(EnMs* this, PlayState* play); +void EnMs_Talk(EnMs* this, PlayState* play); +void EnMs_Sell(EnMs* this, PlayState* play); +void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play); const ActorInit En_Ms_InitVars = { ACTOR_EN_MS, @@ -57,8 +57,8 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; -void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x1B); +void EnMs_SetOfferText(EnMs* this, PlayState* play) { + this->actor.textId = Text_GetFaceReaction(play, 0x1B); if (this->actor.textId == 0) { if (BEANS_BOUGHT >= 10) { this->actor.textId = 0x406B; @@ -68,7 +68,7 @@ void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx) { } } -void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Init(Actor* thisx, PlayState* play) { EnMs* this = (EnMs*)thisx; s32 pad; @@ -77,10 +77,10 @@ void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { return; } Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBeanSalesmanSkel, &gBeanSalesmanEatingAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gBeanSalesmanSkel, &gBeanSalesmanEatingAnim, this->jointTable, this->morphTable, 9); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); Actor_SetScale(&this->actor, 0.015f); @@ -89,75 +89,75 @@ void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; - EnMs_SetOfferText(this, globalCtx); + EnMs_SetOfferText(this, play); this->actionFunc = EnMs_Wait; } -void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Destroy(Actor* thisx, PlayState* play) { EnMs* this = (EnMs*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) { +void EnMs_Wait(EnMs* this, PlayState* play) { s16 yawDiff; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - EnMs_SetOfferText(this, globalCtx); + EnMs_SetOfferText(this, play); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { // if talk is initiated + if (Actor_ProcessTalkRequest(&this->actor, play)) { // if talk is initiated this->actionFunc = EnMs_Talk; } else if ((this->actor.xzDistToPlayer < 90.0f) && (ABS(yawDiff) < 0x2000)) { // talk range - func_8002F2CC(&this->actor, globalCtx, 90.0f); + func_8002F2CC(&this->actor, play, 90.0f); } } -void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) { +void EnMs_Talk(EnMs* this, PlayState* play) { u8 dialogState; - dialogState = Message_GetState(&globalCtx->msgCtx); + dialogState = Message_GetState(&play->msgCtx); if (dialogState != TEXT_STATE_CHOICE) { - if ((dialogState == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { // advanced final textbox + if ((dialogState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // advanced final textbox this->actionFunc = EnMs_Wait; } - } else if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + } else if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes if (gSaveContext.rupees < sPrices[BEANS_BOUGHT]) { - Message_ContinueTextbox(globalCtx, 0x4069); // not enough rupees text + Message_ContinueTextbox(play, 0x4069); // not enough rupees text return; } - func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f); + func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f); this->actionFunc = EnMs_Sell; return; case 1: // no - Message_ContinueTextbox(globalCtx, 0x4068); + Message_ContinueTextbox(play, 0x4068); default: return; } } } -void EnMs_Sell(EnMs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnMs_Sell(EnMs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { Rupees_ChangeBy(-sPrices[BEANS_BOUGHT]); this->actor.parent = NULL; this->actionFunc = EnMs_TalkAfterPurchase; } else { - func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f); + func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f); } } -void EnMs_TalkAfterPurchase(EnMs* this, GlobalContext* globalCtx) { +void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) { // if dialog state is 6 and player responded to textbox - if ((Message_GetState(&globalCtx->msgCtx)) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x406C); + if ((Message_GetState(&play->msgCtx)) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x406C); this->actionFunc = EnMs_Talk; } } -void EnMs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Update(Actor* thisx, PlayState* play) { EnMs* this = (EnMs*)thisx; s32 pad; @@ -166,21 +166,21 @@ void EnMs_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetArrowOffset = 500.0f; Actor_SetScale(&this->actor, 0.015f); SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (gSaveContext.entranceIndex == ENTR_SPOT20_0 && gSaveContext.sceneSetupIndex == 8) { // ride carpet if in credits Actor_MoveForward(&this->actor); osSyncPrintf("OOOHHHHHH %f\n", this->actor.velocity.y); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnMs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Draw(Actor* thisx, PlayState* play) { EnMs* this = (EnMs*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, this); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, this); } diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.h b/src/overlays/actors/ovl_En_Ms/z_en_ms.h index a3d3dc7d58..53c6bbeaca 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.h +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.h @@ -6,7 +6,7 @@ struct EnMs; -typedef void (*EnMsActionFunc)(struct EnMs*, GlobalContext*); +typedef void (*EnMsActionFunc)(struct EnMs*, PlayState*); typedef struct EnMs { /* 0x0000 */ Actor 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 0197e2384d..25b395d96a 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -9,13 +9,13 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnMu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMu_Init(Actor* thisx, PlayState* play); +void EnMu_Destroy(Actor* thisx, PlayState* play); +void EnMu_Update(Actor* thisx, PlayState* play); +void EnMu_Draw(Actor* thisx, PlayState* play); -void EnMu_Pose(EnMu* this, GlobalContext* globalCtx); -s16 EnMu_CheckDialogState(GlobalContext* globalCtx, Actor* thisx); +void EnMu_Pose(EnMu* this, PlayState* play); +s16 EnMu_CheckDialogState(PlayState* play, Actor* thisx); static ColliderCylinderInit D_80AB0BD0 = { { @@ -55,7 +55,7 @@ void EnMu_SetupAction(EnMu* this, EnMuActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnMu_Interact(EnMu* this, GlobalContext* globalCtx) { +void EnMu_Interact(EnMu* this, PlayState* play) { u8 textIdOffset[] = { 0x42, 0x43, 0x3F, 0x41, 0x3E }; u8 bitmask[] = { EVENTINF_20_MASK, EVENTINF_21_MASK, EVENTINF_22_MASK, EVENTINF_23_MASK, EVENTINF_24_MASK, @@ -68,7 +68,7 @@ void EnMu_Interact(EnMu* this, GlobalContext* globalCtx) { (EVENTINF_20_MASK | EVENTINF_21_MASK | EVENTINF_22_MASK | EVENTINF_23_MASK | EVENTINF_24_MASK); gSaveContext.eventInf[EVENTINF_20_21_22_23_24_INDEX] &= ~(EVENTINF_20_MASK | EVENTINF_21_MASK | EVENTINF_22_MASK | EVENTINF_23_MASK | EVENTINF_24_MASK); - randomIndex = (globalCtx->state.frames + (s32)(Rand_ZeroOne() * 5.0f)) % 5; + randomIndex = (play->state.frames + (s32)(Rand_ZeroOne() * 5.0f)) % 5; for (i = 0; i < 5; i++) { @@ -98,9 +98,9 @@ void EnMu_Interact(EnMu* this, GlobalContext* globalCtx) { gSaveContext.eventInf[EVENTINF_20_21_22_23_24_INDEX] |= textFlags; } -u16 EnMu_GetFaceReaction(GlobalContext* globalCtx, Actor* thisx) { +u16 EnMu_GetFaceReaction(PlayState* play, Actor* thisx) { EnMu* this = (EnMu*)thisx; - u16 faceReaction = Text_GetFaceReaction(globalCtx, this->actor.params + 0x3A); + u16 faceReaction = Text_GetFaceReaction(play, this->actor.params + 0x3A); if (faceReaction != 0) { return faceReaction; @@ -108,10 +108,10 @@ u16 EnMu_GetFaceReaction(GlobalContext* globalCtx, Actor* thisx) { return this->defFaceReaction; } -s16 EnMu_CheckDialogState(GlobalContext* globalCtx, Actor* thisx) { +s16 EnMu_CheckDialogState(PlayState* play, Actor* thisx) { EnMu* this = (EnMu*)thisx; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_FADING: @@ -123,39 +123,39 @@ s16 EnMu_CheckDialogState(GlobalContext* globalCtx, Actor* thisx) { case TEXT_STATE_9: return 1; case TEXT_STATE_CLOSING: - EnMu_Interact(this, globalCtx); + EnMu_Interact(this, play); return 0; default: return 1; } } -void EnMu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMu_Init(Actor* thisx, PlayState* play) { EnMu* this = (EnMu*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 160.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_mu_Skel_004F70, &object_mu_Anim_0003F4, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80AB0BD0); + 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); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AB0BFC); this->actor.targetMode = 6; Actor_SetScale(&this->actor, 0.01f); - EnMu_Interact(this, globalCtx); + EnMu_Interact(this, play); EnMu_SetupAction(this, EnMu_Pose); } -void EnMu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMu_Destroy(Actor* thisx, PlayState* play) { EnMu* this = (EnMu*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } -void EnMu_Pose(EnMu* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_20A, this->unk_22A, 16); +void EnMu_Pose(EnMu* this, PlayState* play) { + func_80034F54(play, this->unk_20A, this->unk_22A, 16); } -void EnMu_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMu_Update(Actor* thisx, PlayState* play) { EnMu* this = (EnMu*)thisx; s32 pad; f32 talkDist; @@ -167,19 +167,18 @@ void EnMu_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.pos = pos; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + this->actionFunc(this, play); talkDist = this->collider.dim.radius + 30.0f; - func_800343CC(globalCtx, &this->actor, &this->npcInfo.unk_00, talkDist, EnMu_GetFaceReaction, - EnMu_CheckDialogState); + func_800343CC(play, &this->actor, &this->npcInfo.unk_00, talkDist, EnMu_GetFaceReaction, EnMu_CheckDialogState); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 60.0f; } -s32 EnMu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnMu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMu* this = (EnMu*)thisx; if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 11) || (limbIndex == 12) || @@ -190,7 +189,7 @@ s32 EnMu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnMu_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { } Gfx* EnMu_DisplayListSetColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { @@ -202,7 +201,7 @@ Gfx* EnMu_DisplayListSetColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { return dlist; } -void EnMu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMu_Draw(Actor* thisx, PlayState* play) { EnMu* this = (EnMu*)thisx; Color_RGBA8 colors[2][5] = { { { 100, 130, 235, 0 }, { 160, 250, 60, 0 }, { 90, 60, 20, 0 }, { 30, 240, 200, 0 }, { 140, 70, 20, 0 } }, @@ -211,15 +210,15 @@ void EnMu_Draw(Actor* thisx, GlobalContext* globalCtx) { u8 segmentId[] = { 0x08, 0x09, 0x0A, 0x0B, 0x0C }; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_mu.c", 514); + OPEN_DISPS(play->state.gfxCtx, "../z_en_mu.c", 514); Matrix_Translate(-1200.0f, 0.0f, -1400.0f, MTXMODE_APPLY); for (i = 0; i < 5; i++) { gSPSegment(POLY_OPA_DISP++, segmentId[i], - EnMu_DisplayListSetColor(globalCtx->state.gfxCtx, colors[this->actor.params][i].r, + EnMu_DisplayListSetColor(play->state.gfxCtx, colors[this->actor.params][i].r, colors[this->actor.params][i].g, colors[this->actor.params][i].b, colors[this->actor.params][i].a)); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMu_OverrideLimbDraw, EnMu_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_mu.c", 534); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_mu.c", 534); } diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.h b/src/overlays/actors/ovl_En_Mu/z_en_mu.h index 089045ebf8..1f2bf0f328 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.h +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.h @@ -6,7 +6,7 @@ struct EnMu; -typedef void (*EnMuActionFunc)(struct EnMu*, struct GlobalContext*); +typedef void (*EnMuActionFunc)(struct EnMu*, struct PlayState*); typedef struct EnMu { /* 0x0000 */ Actor actor; 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 c1a2eb8e30..8f848926b8 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -53,10 +53,10 @@ typedef enum { /* 0x04 */ NB_DRAW_LOOK_DIRECTION } EnNbDrawMode; -void EnNb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNb_Init(Actor* thisx, PlayState* play); +void EnNb_Destroy(Actor* thisx, PlayState* play); +void EnNb_Update(Actor* thisx, PlayState* play); +void EnNb_Draw(Actor* thisx, PlayState* play); static ColliderCylinderInitType1 sCylinderInit = { { @@ -99,13 +99,13 @@ s32 EnNb_GetType(EnNb* this) { return type & 0xFF; } -void EnNb_UpdatePath(EnNb* this, GlobalContext* globalCtx) { +void EnNb_UpdatePath(EnNb* this, PlayState* play) { Vec3s* pointPos; Path* pathList; s32 pad; s32 path; - pathList = globalCtx->setupPathList; + pathList = play->setupPathList; if (pathList != NULL) { path = EnNb_GetPath(this); @@ -127,37 +127,37 @@ void EnNb_UpdatePath(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_SetupCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnNb_SetupCollider(Actor* thisx, PlayState* play) { EnNb* this = (EnNb*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, thisx, &sCylinderInit); } -void EnNb_UpdateCollider(EnNb* this, GlobalContext* globalCtx) { +void EnNb_UpdateCollider(EnNb* this, PlayState* play) { s32 pad[4]; ColliderCylinder* collider = &this->collider; Collider_UpdateCylinder(&this->actor, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetOC(play, &play->colChkCtx, &collider->base); } -void EnNb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNb_Destroy(Actor* thisx, PlayState* play) { EnNb* this = (EnNb*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AB0FBC(EnNb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AB0FBC(EnNb* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_300.unk_18 = player->actor.world.pos; this->unk_300.unk_14 = kREG(16) + 9.0f; func_80034A14(&this->actor, &this->unk_300, kREG(17) + 0xC, 2); } -void func_80AB1040(EnNb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AB1040(EnNb* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_300.unk_18 = player->actor.world.pos; this->unk_300.unk_14 = kREG(16) + 9.0f; @@ -201,10 +201,10 @@ void func_80AB11EC(EnNb* this) { this->alphaTimer = 0.0f; } -void func_80AB1210(EnNb* this, GlobalContext* globalCtx) { +void func_80AB1210(EnNb* this, PlayState* play) { s32 one; // required to match - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (D_80AB4318) { if (this->actor.params == NB_TYPE_DEMO02) { func_80AB11EC(this); @@ -220,23 +220,23 @@ void func_80AB1210(EnNb* this, GlobalContext* globalCtx) { } } -void func_80AB1284(EnNb* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2); +void func_80AB1284(EnNb* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2); } s32 EnNb_UpdateSkelAnime(EnNb* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnNb_GetNpcCsAction(GlobalContext* globalCtx, s32 npcActionIdx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[npcActionIdx]; +CsCmdActorAction* EnNb_GetNpcCsAction(PlayState* play, s32 npcActionIdx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[npcActionIdx]; } return NULL; } -void EnNb_SetupCsPosRot(EnNb* this, GlobalContext* globalCtx, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, npcActionIdx); +void EnNb_SetupCsPosRot(EnNb* this, PlayState* play, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, npcActionIdx); s16 newRotY; Actor* thisx = &this->actor; @@ -248,30 +248,30 @@ void EnNb_SetupCsPosRot(EnNb* this, GlobalContext* globalCtx, s32 npcActionIdx) } } -s32 func_80AB1390(EnNb* this, GlobalContext* globalCtx, u16 arg2, s32 npcActionIdx) { +s32 func_80AB1390(EnNb* this, PlayState* play, u16 arg2, s32 npcActionIdx) { CsCmdActorAction* csCmdNPCAction; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && - (csCmdNPCAction = globalCtx->csCtx.npcActions[npcActionIdx], csCmdNPCAction != NULL) && + if ((play->csCtx.state != CS_STATE_IDLE) && + (csCmdNPCAction = play->csCtx.npcActions[npcActionIdx], csCmdNPCAction != NULL) && (csCmdNPCAction->action == arg2)) { return true; } return false; } -s32 func_80AB13D8(EnNb* this, GlobalContext* globalCtx, u16 arg2, s32 npcActionIdx) { +s32 func_80AB13D8(EnNb* this, PlayState* play, u16 arg2, s32 npcActionIdx) { CsCmdActorAction* csCmdNPCAction; - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && - (csCmdNPCAction = globalCtx->csCtx.npcActions[npcActionIdx], csCmdNPCAction != NULL) && + if ((play->csCtx.state != CS_STATE_IDLE) && + (csCmdNPCAction = play->csCtx.npcActions[npcActionIdx], csCmdNPCAction != NULL) && (csCmdNPCAction->action != arg2)) { return true; } return false; } -void EnNb_SetInitialCsPosRot(EnNb* this, GlobalContext* globalCtx, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, npcActionIdx); +void EnNb_SetInitialCsPosRot(EnNb* this, PlayState* play, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, npcActionIdx); Actor* thisx = &this->actor; if (csCmdNPCAction != NULL) { @@ -301,51 +301,49 @@ void EnNb_SetCurrentAnim(EnNb* this, AnimationHeader* animation, u8 mode, f32 mo Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, mode, morphFrames); } -void EnNb_SetChamberAnim(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetChamberAnim(EnNb* this, PlayState* play) { EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsChamberOfSagesAnim, 0, 0, 0); this->actor.shape.yOffset = -10000.0f; } -void EnNb_SpawnBlueWarp(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SpawnBlueWarp(EnNb* this, PlayState* play) { f32 posX = this->actor.world.pos.x; f32 posY = this->actor.world.pos.y; f32 posZ = this->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, - WARP_SAGES); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_SAGES); } -void EnNb_GiveMedallion(EnNb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnNb_GiveMedallion(EnNb* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 50.0f; f32 posZ = player->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, - 0xC); - Item_Give(globalCtx, ITEM_MEDALLION_SPIRIT); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 0xC); + Item_Give(play, ITEM_MEDALLION_SPIRIT); } -void EnNb_ComeUpImpl(EnNb* this, GlobalContext* globalCtx) { +void EnNb_ComeUpImpl(EnNb* this, PlayState* play) { this->actor.shape.yOffset += 250.0f / 3.0f; } -void EnNb_SetupChamberCsImpl(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupChamberCsImpl(EnNb* this, PlayState* play) { s32 pad[2]; Player* player; if ((gSaveContext.chamberCutsceneNum == 3) && (gSaveContext.sceneSetupIndex < 4)) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->action = NB_CHAMBER_UNDERGROUND; - globalCtx->csCtx.segment = &D_80AB431C; + play->csCtx.segment = &D_80AB431C; gSaveContext.cutsceneTrigger = 2; - Item_Give(globalCtx, ITEM_MEDALLION_SPIRIT); + Item_Give(play, ITEM_MEDALLION_SPIRIT); player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; } } -void EnNb_SetupChamberWarpImpl(EnNb* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void EnNb_SetupChamberWarpImpl(EnNb* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; CsCmdActorAction* csCmdNPCAction; if (csCtx->state != CS_STATE_IDLE) { @@ -353,7 +351,7 @@ void EnNb_SetupChamberWarpImpl(EnNb* this, GlobalContext* globalCtx) { if (csCmdNPCAction != NULL && csCmdNPCAction->action == 2) { this->action = NB_CHAMBER_APPEAR; this->drawMode = NB_DRAW_DEFAULT; - EnNb_SpawnBlueWarp(this, globalCtx); + EnNb_SpawnBlueWarp(this, play); } } } @@ -365,12 +363,12 @@ void EnNb_SetupDefaultChamberIdle(EnNb* this) { } } -void EnNb_SetupArmRaise(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupArmRaise(EnNb* this, PlayState* play) { AnimationHeader* animation = &gNabooruRaisingArmsGivingMedallionAnim; CsCmdActorAction* csCmdNPCAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdNPCAction = globalCtx->csCtx.npcActions[1]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdNPCAction = play->csCtx.npcActions[1]; if (csCmdNPCAction != NULL && csCmdNPCAction->action == 3) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); @@ -389,64 +387,64 @@ void EnNb_SetupRaisedArmTransition(EnNb* this, s32 animFinished) { } } -void EnNb_SetupMedallion(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupMedallion(EnNb* this, PlayState* play) { CsCmdActorAction* csCmdNPCAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdNPCAction = globalCtx->csCtx.npcActions[6]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdNPCAction = play->csCtx.npcActions[6]; if (csCmdNPCAction != NULL && csCmdNPCAction->action == 2) { this->action = NB_GIVE_MEDALLION; - EnNb_GiveMedallion(this, globalCtx); + EnNb_GiveMedallion(this, play); } } } // Action func is never explicitly set to this, but it runs when the memory gets zero cleared -void EnNb_SetupChamberCs(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetupChamberCsImpl(this, globalCtx); +void EnNb_SetupChamberCs(EnNb* this, PlayState* play) { + EnNb_SetupChamberCsImpl(this, play); } -void EnNb_SetupChamberWarp(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetupChamberWarpImpl(this, globalCtx); +void EnNb_SetupChamberWarp(EnNb* this, PlayState* play) { + EnNb_SetupChamberWarpImpl(this, play); } -void EnNb_ComeUp(EnNb* this, GlobalContext* globalCtx) { - EnNb_ComeUpImpl(this, globalCtx); +void EnNb_ComeUp(EnNb* this, PlayState* play) { + EnNb_ComeUpImpl(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetupDefaultChamberIdle(this); } -void func_80AB193C(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void func_80AB193C(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_SetupArmRaise(this, globalCtx); + EnNb_SetupArmRaise(this, play); } -void EnNb_RaiseArm(EnNb* this, GlobalContext* globalCtx) { +void EnNb_RaiseArm(EnNb* this, PlayState* play) { s32 animFinished; - func_80AB1284(this, globalCtx); + func_80AB1284(this, play); animFinished = EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetupRaisedArmTransition(this, animFinished); } -void func_80AB19BC(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void func_80AB19BC(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_SetupMedallion(this, globalCtx); + EnNb_SetupMedallion(this, play); } -void func_80AB19FC(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void func_80AB19FC(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); } -void EnNb_SetupLightArrowOrSealingCs(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupLightArrowOrSealingCs(EnNb* this, PlayState* play) { EnNb_SetCurrentAnim(this, &gNabooruPuttingHandsTogetherCastingMagicAnim, 2, 0.0f, 0); this->action = NB_ACTION_7; this->actor.shape.shadowAlpha = 0; @@ -456,13 +454,13 @@ void EnNb_PlaySealingSound(void) { func_800788CC(NA_SE_SY_WHITE_OUT_T); } -void EnNb_InitializeDemo6K(EnNb* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void EnNb_InitializeDemo6K(EnNb* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, kREG(21) + 22.0f + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 7); } -void EnNb_SetupHide(EnNb* this, GlobalContext* globalCtx) { - if (func_80AB1390(this, globalCtx, 4, 1)) { +void EnNb_SetupHide(EnNb* this, PlayState* play) { + if (func_80AB1390(this, play, 4, 1)) { this->action = NB_SEAL_HIDE; this->drawMode = NB_DRAW_HIDE; this->alpha = 0; @@ -472,11 +470,11 @@ void EnNb_SetupHide(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_CheckToFade(EnNb* this, GlobalContext* globalCtx) { +void EnNb_CheckToFade(EnNb* this, PlayState* play) { f32* alphaTimer = &this->alphaTimer; s32 alpha; - if (func_80AB1390(this, globalCtx, 4, 1)) { + if (func_80AB1390(this, play, 4, 1)) { *alphaTimer += 1.0f; if (*alphaTimer >= kREG(5) + 10.0f) { this->action = NB_ACTION_9; @@ -503,15 +501,15 @@ void EnNb_CheckToFade(EnNb* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = alpha; } -void EnNb_SetupLightOrb(EnNb* this, GlobalContext* globalCtx) { - if (func_80AB13D8(this, globalCtx, 4, 1)) { +void EnNb_SetupLightOrb(EnNb* this, PlayState* play) { + if (func_80AB13D8(this, play, 4, 1)) { this->action = NB_SEAL_HIDE; this->drawMode = NB_DRAW_HIDE; this->alphaTimer = kREG(5) + 10.0f; this->alpha = 255; if (this->flag == 0) { - EnNb_InitializeDemo6K(this, globalCtx); + EnNb_InitializeDemo6K(this, play); this->flag = 1; } @@ -519,67 +517,67 @@ void EnNb_SetupLightOrb(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_Hide(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetupHide(this, globalCtx); - func_80AB1210(this, globalCtx); +void EnNb_Hide(EnNb* this, PlayState* play) { + EnNb_SetupHide(this, play); + func_80AB1210(this, play); } -void EnNb_Fade(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void EnNb_Fade(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_CheckToFade(this, globalCtx); - func_80AB1210(this, globalCtx); + EnNb_CheckToFade(this, play); + func_80AB1210(this, play); } -void EnNb_CreateLightOrb(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void EnNb_CreateLightOrb(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_SetupLightOrb(this, globalCtx); - func_80AB1210(this, globalCtx); + EnNb_SetupLightOrb(this, play); + func_80AB1210(this, play); } -void EnNb_DrawTransparency(EnNb* this, GlobalContext* globalCtx) { +void EnNb_DrawTransparency(EnNb* this, PlayState* play) { s32 pad[2]; s16 eyeSegIdx = this->eyeIdx; void* eyeTex = sEyeTextures[eyeSegIdx]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_nb_inKenjyanomaDemo02.c", 263); + OPEN_DISPS(play->state.gfxCtx, "../z_en_nb_inKenjyanomaDemo02.c", 263); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, - NULL, NULL, NULL, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, + NULL, NULL, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_nb_inKenjyanomaDemo02.c", 290); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_nb_inKenjyanomaDemo02.c", 290); } -void EnNb_InitKidnap(EnNb* this, GlobalContext* globalCtx) { +void EnNb_InitKidnap(EnNb* this, PlayState* play) { EnNb_SetCurrentAnim(this, &gNabooruTrappedInVortexPushingGroundAnim, 0, 0.0f, 0); this->action = NB_KIDNAPPED; this->actor.shape.shadowAlpha = 0; SET_EVENTCHKINF(EVENTCHKINF_95); } -void EnNb_PlayCrySFX(EnNb* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 3) { +void EnNb_PlayCrySFX(EnNb* this, PlayState* play) { + if (play->csCtx.frames == 3) { func_80078914(&this->actor.projectedPos, NA_SE_VO_NB_CRY_0); } } -void EnNb_PlayAgonySFX(EnNb* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 420) { +void EnNb_PlayAgonySFX(EnNb* this, PlayState* play) { + if (play->csCtx.frames == 420) { func_80078914(&this->actor.projectedPos, NA_SE_VO_NB_AGONY); } } -void EnNb_SetPosInPortal(EnNb* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, 1); +void EnNb_SetPosInPortal(EnNb* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); Vec3f* pos = &this->actor.world.pos; f32 f0; s32 pad; @@ -587,8 +585,8 @@ void EnNb_SetPosInPortal(EnNb* this, GlobalContext* globalCtx) { Vec3f endPos; if (csCmdNPCAction != NULL) { - f0 = Environment_LerpWeightAccelDecel(csCmdNPCAction->endFrame, csCmdNPCAction->startFrame, - globalCtx->csCtx.frames, 4, 4); + f0 = Environment_LerpWeightAccelDecel(csCmdNPCAction->endFrame, csCmdNPCAction->startFrame, play->csCtx.frames, + 4, 4); startPos.x = csCmdNPCAction->startPos.x; startPos.y = csCmdNPCAction->startPos.y; startPos.z = csCmdNPCAction->startPos.z; @@ -601,8 +599,8 @@ void EnNb_SetPosInPortal(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_SetupCaptureCutsceneState(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetupCsPosRot(this, globalCtx, 1); +void EnNb_SetupCaptureCutsceneState(EnNb* this, PlayState* play) { + EnNb_SetupCsPosRot(this, play, 1); this->action = NB_KIDNAPPED; this->drawMode = NB_DRAW_NOTHING; this->actor.shape.shadowAlpha = 0; @@ -633,8 +631,8 @@ void EnNb_SetupKidnap(EnNb* this) { this->drawMode = NB_DRAW_DEFAULT; } -void EnNb_CheckKidnapCsMode(EnNb* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, 1); +void EnNb_CheckKidnapCsMode(EnNb* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); s32 action; s32 previousCsAction; @@ -644,7 +642,7 @@ void EnNb_CheckKidnapCsMode(EnNb* this, GlobalContext* globalCtx) { if (action != previousCsAction) { switch (action) { case 1: - EnNb_SetupCaptureCutsceneState(this, globalCtx); + EnNb_SetupCaptureCutsceneState(this, play); break; case 7: EnNb_SetupLookAroundInKidnap(this); @@ -665,30 +663,30 @@ void EnNb_CheckKidnapCsMode(EnNb* this, GlobalContext* globalCtx) { } } -void func_80AB23A8(EnNb* this, GlobalContext* globalCtx) { - EnNb_PlayCrySFX(this, globalCtx); - EnNb_CheckKidnapCsMode(this, globalCtx); +void func_80AB23A8(EnNb* this, PlayState* play) { + EnNb_PlayCrySFX(this, play); + EnNb_CheckKidnapCsMode(this, play); } -void EnNb_MovingInPortal(EnNb* this, GlobalContext* globalCtx) { - EnNb_PlayCrySFX(this, globalCtx); - EnNb_PlayAgonySFX(this, globalCtx); +void EnNb_MovingInPortal(EnNb* this, PlayState* play) { + EnNb_PlayCrySFX(this, play); + EnNb_PlayAgonySFX(this, play); EnNb_UpdateEyes(this); EnNb_UpdateSkelAnime(this); - EnNb_CheckKidnapCsMode(this, globalCtx); + EnNb_CheckKidnapCsMode(this, play); } -void EnNb_SuckedInByPortal(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SuckedInByPortal(EnNb* this, PlayState* play) { s32 animFinished; EnNb_UpdateEyes(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_SetRaisedArmCaptureAnim(this, animFinished); - EnNb_SetPosInPortal(this, globalCtx); - EnNb_CheckKidnapCsMode(this, globalCtx); + EnNb_SetPosInPortal(this, play); + EnNb_CheckKidnapCsMode(this, play); } -void EnNb_SetupConfrontation(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupConfrontation(EnNb* this, PlayState* play) { AnimationHeader* animation = &gNabooruCollapseFromStandingToKneelingTransitionAnim; EnNb_SetCurrentAnim(this, animation, 0, 0.0f, 0); @@ -696,10 +694,10 @@ void EnNb_SetupConfrontation(EnNb* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = 0; } -void EnNb_PlayKnuckleDefeatSFX(EnNb* this, GlobalContext* globalCtx) { +void EnNb_PlayKnuckleDefeatSFX(EnNb* this, PlayState* play) { s32 pad[2]; - if (globalCtx->csCtx.frames == 548) { + if (play->csCtx.frames == 548) { func_80078914(&this->actor.projectedPos, NA_SE_VO_NB_CRY_0); func_80078914(&this->actor.projectedPos, NA_SE_EN_FANTOM_HIT_THUNDER); } @@ -730,14 +728,14 @@ void EnNb_PlayLookLeftSFX(EnNb* this) { } } -void EnNb_InitDemo6KInConfrontation(EnNb* this, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void EnNb_InitDemo6KInConfrontation(EnNb* this, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_6K, this->actor.world.pos.x, kREG(21) + 22.0f + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xB); } -void func_80AB2688(EnNb* this, GlobalContext* globalCtx) { +void func_80AB2688(EnNb* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_80AB26C8(EnNb* this) { @@ -746,12 +744,12 @@ void func_80AB26C8(EnNb* this) { this->actor.shape.shadowAlpha = 0; } -void func_80AB26DC(EnNb* this, GlobalContext* globalCtx) { +void func_80AB26DC(EnNb* this, PlayState* play) { s32 pad; AnimationHeader* animation = &gNabooruCollapseFromStandingToKneelingTransitionAnim; f32 lastFrame = Animation_GetLastFrame(animation); - EnNb_SetupCsPosRot(this, globalCtx, 1); + EnNb_SetupCsPosRot(this, play, 1); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, 0.0f); this->action = NB_ACTION_14; this->drawMode = NB_DRAW_KNEEL; @@ -817,9 +815,9 @@ void EnNb_CheckIfLookLeft(EnNb* this, s32 animFinished) { } } -void EnNb_SetupDemo6KInConfrontation(EnNb* this, GlobalContext* globalCtx, s32 animFinished) { +void EnNb_SetupDemo6KInConfrontation(EnNb* this, PlayState* play, s32 animFinished) { if (!this->flag && animFinished) { - EnNb_InitDemo6KInConfrontation(this, globalCtx); + EnNb_InitDemo6KInConfrontation(this, play); this->flag = 1; } } @@ -840,12 +838,12 @@ void EnNb_SetupConfrontationDestroy(EnNb* this) { this->actor.shape.shadowAlpha = 0; } -void EnNb_CheckConfrontationCsMode(EnNb* this, GlobalContext* globalCtx) { +void EnNb_CheckConfrontationCsMode(EnNb* this, PlayState* play) { CsCmdActorAction* csCmdNPCAction; s32 csAction; s32 previousCsAction; - csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, 1); + csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); if (csCmdNPCAction != NULL) { csAction = csCmdNPCAction->action; previousCsAction = this->previousCsAction; @@ -856,7 +854,7 @@ void EnNb_CheckConfrontationCsMode(EnNb* this, GlobalContext* globalCtx) { func_80AB26C8(this); break; case 10: - func_80AB26DC(this, globalCtx); + func_80AB26DC(this, play); break; case 11: EnNb_SetupKneel(this); @@ -883,66 +881,66 @@ void EnNb_CheckConfrontationCsMode(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_CheckConfrontationCsModeWrapper(EnNb* this, GlobalContext* globalCtx) { - EnNb_CheckConfrontationCsMode(this, globalCtx); +void EnNb_CheckConfrontationCsModeWrapper(EnNb* this, PlayState* play) { + EnNb_CheckConfrontationCsMode(this, play); } -void func_80AB2C18(EnNb* this, GlobalContext* globalCtx) { +void func_80AB2C18(EnNb* this, PlayState* play) { EnNb_UpdateEyes(this); - func_80AB2688(this, globalCtx); - func_80AB1284(this, globalCtx); - EnNb_CheckConfrontationCsMode(this, globalCtx); + func_80AB2688(this, play); + func_80AB1284(this, play); + EnNb_CheckConfrontationCsMode(this, play); } -void EnNb_Kneel(EnNb* this, GlobalContext* globalCtx) { +void EnNb_Kneel(EnNb* this, PlayState* play) { s32 animFinished; EnNb_UpdateEyes(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_CheckIfKneeling(this, animFinished); EnNb_PlayKneelingOnGroundSFX(this); - func_80AB2688(this, globalCtx); - func_80AB1284(this, globalCtx); - EnNb_CheckConfrontationCsMode(this, globalCtx); + func_80AB2688(this, play); + func_80AB1284(this, play); + EnNb_CheckConfrontationCsMode(this, play); } -void EnNb_LookRight(EnNb* this, GlobalContext* globalCtx) { +void EnNb_LookRight(EnNb* this, PlayState* play) { s32 animFinished; EnNb_UpdateEyes(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_CheckIfLookingRight(this, animFinished); EnNb_PlayLookRightSFX(this); - func_80AB2688(this, globalCtx); - func_80AB1284(this, globalCtx); - EnNb_CheckConfrontationCsMode(this, globalCtx); + func_80AB2688(this, play); + func_80AB1284(this, play); + EnNb_CheckConfrontationCsMode(this, play); } -void EnNb_LookLeft(EnNb* this, GlobalContext* globalCtx) { +void EnNb_LookLeft(EnNb* this, PlayState* play) { s32 animFinished; EnNb_UpdateEyes(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_CheckIfLookLeft(this, animFinished); - func_80AB2688(this, globalCtx); - func_80AB1284(this, globalCtx); - EnNb_CheckConfrontationCsMode(this, globalCtx); + func_80AB2688(this, play); + func_80AB1284(this, play); + EnNb_CheckConfrontationCsMode(this, play); } -void EnNb_Run(EnNb* this, GlobalContext* globalCtx) { +void EnNb_Run(EnNb* this, PlayState* play) { s32 animFinished; - EnNb_PlayKnuckleDefeatSFX(this, globalCtx); + EnNb_PlayKnuckleDefeatSFX(this, play); EnNb_UpdateEyes(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_PlayLookLeftSFX(this); - func_80AB2688(this, globalCtx); - func_80AB1284(this, globalCtx); - EnNb_SetupDemo6KInConfrontation(this, globalCtx, animFinished); - EnNb_CheckConfrontationCsMode(this, globalCtx); + func_80AB2688(this, play); + func_80AB1284(this, play); + EnNb_SetupDemo6KInConfrontation(this, play, animFinished); + EnNb_CheckConfrontationCsMode(this, play); } -void EnNb_ConfrontationDestroy(EnNb* this, GlobalContext* globalCtx) { +void EnNb_ConfrontationDestroy(EnNb* this, PlayState* play) { this->timer++; if (this->timer > 60.0f) { @@ -950,24 +948,24 @@ void EnNb_ConfrontationDestroy(EnNb* this, GlobalContext* globalCtx) { } } -void func_80AB2E70(EnNb* this, GlobalContext* globalCtx) { +void func_80AB2E70(EnNb* this, PlayState* play) { s32 pad; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_nb_inConfrontion.c", 572); + OPEN_DISPS(play->state.gfxCtx, "../z_en_nb_inConfrontion.c", 572); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gNabooruEyeWideTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gNabooruEyeWideTex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_nb_inConfrontion.c", 593); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_nb_inConfrontion.c", 593); } -s32 func_80AB2FC0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_80AB2FC0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNb* this = (EnNb*)thisx; if (limbIndex == NB_LIMB_HEAD) { @@ -977,27 +975,27 @@ s32 func_80AB2FC0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return 0; } -void func_80AB2FE4(EnNb* this, GlobalContext* globalCtx) { +void func_80AB2FE4(EnNb* this, PlayState* play) { s32 pad; s16 eyeIdx = this->eyeIdx; SkelAnime* skelAnime = &this->skelAnime; void* eyeTexture = sEyeTextures[eyeIdx]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_nb_inConfrontion.c", 623); + OPEN_DISPS(play->state.gfxCtx, "../z_en_nb_inConfrontion.c", 623); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTexture)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, func_80AB2FC0, - NULL, &this->actor); + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, func_80AB2FC0, NULL, + &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_nb_inConfrontion.c", 644); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_nb_inConfrontion.c", 644); } -void EnNb_SetupCreditsSpawn(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupCreditsSpawn(EnNb* this, PlayState* play) { EnNb_SetCurrentAnim(this, &gNabooruSittingCrossLeggedAnim, 0, 0.0f, 0); this->action = NB_CREDITS_INIT; this->drawMode = NB_DRAW_NOTHING; @@ -1020,8 +1018,8 @@ void EnNb_SetAlphaInCredits(EnNb* this) { } } -void EnNb_SetupCreditsFadeIn(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetInitialCsPosRot(this, globalCtx, 1); +void EnNb_SetupCreditsFadeIn(EnNb* this, PlayState* play) { + EnNb_SetInitialCsPosRot(this, play, 1); this->action = NB_CREDITS_FADEIN; this->drawMode = NB_DRAW_HIDE; } @@ -1044,8 +1042,8 @@ void EnNb_CheckIfLookingUp(EnNb* this, s32 animFinished) { } } -void EnNb_CheckCreditsCsModeImpl(EnNb* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(globalCtx, 1); +void EnNb_CheckCreditsCsModeImpl(EnNb* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); s32 action; s32 previousCsAction; @@ -1055,7 +1053,7 @@ void EnNb_CheckCreditsCsModeImpl(EnNb* this, GlobalContext* globalCtx) { if (action != previousCsAction) { switch (action) { case 15: - EnNb_SetupCreditsFadeIn(this, globalCtx); + EnNb_SetupCreditsFadeIn(this, play); break; case 16: EnNb_SetupCreditsHeadTurn(this); @@ -1070,37 +1068,37 @@ void EnNb_CheckCreditsCsModeImpl(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_CheckCreditsCsMode(EnNb* this, GlobalContext* globalCtx) { - EnNb_CheckCreditsCsModeImpl(this, globalCtx); +void EnNb_CheckCreditsCsMode(EnNb* this, PlayState* play) { + EnNb_CheckCreditsCsModeImpl(this, play); } -void EnNb_CreditsFade(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void EnNb_CreditsFade(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetAlphaInCredits(this); EnNb_SetupCreditsSit(this); } -void func_80AB3428(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); +void func_80AB3428(EnNb* this, PlayState* play) { + func_80AB1284(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_CheckCreditsCsModeImpl(this, globalCtx); + EnNb_CheckCreditsCsModeImpl(this, play); } -void EnNb_LookUp(EnNb* this, GlobalContext* globalCtx) { +void EnNb_LookUp(EnNb* this, PlayState* play) { s32 animFinished; - func_80AB1284(this, globalCtx); + func_80AB1284(this, play); animFinished = EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_CheckIfLookingUp(this, animFinished); } -void EnNb_CrawlspaceSpawnCheck(EnNb* this, GlobalContext* globalCtx) { +void EnNb_CrawlspaceSpawnCheck(EnNb* this, PlayState* play) { if (!GET_EVENTCHKINF(EVENTCHKINF_95) && LINK_IS_CHILD) { - EnNb_UpdatePath(this, globalCtx); + EnNb_UpdatePath(this, play); // looking into crawlspace if (!GET_EVENTCHKINF(EVENTCHKINF_94)) { @@ -1145,8 +1143,8 @@ void EnNb_SetNoticeSFX(EnNb* this) { func_80078914(&this->actor.projectedPos, NA_SE_VO_NB_NOTICE); } -s32 EnNb_GetNoticedStatus(EnNb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnNb_GetNoticedStatus(EnNb* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 playerX = player->actor.world.pos.x; f32 playerZ = player->actor.world.pos.z; f32 thisX = this->actor.world.pos.x; @@ -1159,7 +1157,7 @@ s32 EnNb_GetNoticedStatus(EnNb* this, GlobalContext* globalCtx) { } } -void func_80AB36DC(EnNb* this, GlobalContext* globalCtx) { +void func_80AB36DC(EnNb* this, PlayState* play) { u16 moveTime = this->movementTimer; if ((((u16)((u16)(kREG(17) + 25) - 4))) > moveTime) { @@ -1177,8 +1175,8 @@ void func_80AB36DC(EnNb* this, GlobalContext* globalCtx) { } } -void EnNb_CheckNoticed(EnNb* this, GlobalContext* globalCtx) { - if (EnNb_GetNoticedStatus(this, globalCtx)) { +void EnNb_CheckNoticed(EnNb* this, PlayState* play) { + if (EnNb_GetNoticedStatus(this, play)) { EnNb_SetCurrentAnim(this, &gNabooruStandingToWalkingTransitionAnim, 2, -8.0f, 0); this->action = NB_NOTICE_PLAYER; EnNb_SetNoticeSFX(this); @@ -1194,8 +1192,8 @@ void EnNb_SetupIdleCrawlspace(EnNb* this, s32 animFinished) { } } -void func_80AB3838(EnNb* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80AB3838(EnNb* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = NB_IN_DIALOG; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -1206,18 +1204,18 @@ void func_80AB3838(EnNb* this, GlobalContext* globalCtx) { this->actor.textId = 0x6024; } - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } -void EnNb_SetupPathMovement(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetupPathMovement(EnNb* this, PlayState* play) { EnNb_SetCurrentAnim(this, &gNabooruStandingToWalkingTransitionAnim, 2, -8.0f, 0); SET_EVENTCHKINF(EVENTCHKINF_94); this->action = NB_IN_PATH; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); } -void EnNb_SetTextIdAsChild(EnNb* this, GlobalContext* globalCtx) { +void EnNb_SetTextIdAsChild(EnNb* this, PlayState* play) { s32 pad; u8 choiceIndex; s32 pad1; @@ -1225,9 +1223,9 @@ void EnNb_SetTextIdAsChild(EnNb* this, GlobalContext* globalCtx) { textId = this->actor.textId; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (textId == 0x6025) { - EnNb_SetupPathMovement(this, globalCtx); + EnNb_SetupPathMovement(this, play); } else { if (textId == 0x6027) { SET_INFTABLE(INFTABLE_16C); @@ -1235,8 +1233,8 @@ void EnNb_SetTextIdAsChild(EnNb* this, GlobalContext* globalCtx) { this->action = NB_IDLE_CRAWLSPACE; } this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); - } else if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - choiceIndex = globalCtx->msgCtx.choiceIndex; + } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + choiceIndex = play->msgCtx.choiceIndex; if (textId == 0x601D) { switch (choiceIndex) { @@ -1269,11 +1267,11 @@ void EnNb_SetTextIdAsChild(EnNb* this, GlobalContext* globalCtx) { } } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } -void func_80AB3A7C(EnNb* this, GlobalContext* globalCtx, s32 animFinished) { +void func_80AB3A7C(EnNb* this, PlayState* play, s32 animFinished) { u16 movementTimer = this->movementTimer; if ((u16)(kREG(17) + 25) > movementTimer) { @@ -1286,93 +1284,93 @@ void func_80AB3A7C(EnNb* this, GlobalContext* globalCtx, s32 animFinished) { } } -void func_80AB3B04(EnNb* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80AB3B04(EnNb* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = NB_ACTION_30; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x23); + this->actor.textId = Text_GetFaceReaction(play, 0x23); if ((this->actor.textId) == 0) { this->actor.textId = 0x6026; } - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } -void func_80AB3B7C(EnNb* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void func_80AB3B7C(EnNb* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->action = NB_IDLE_AFTER_TALK; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); } } -void EnNb_WaitForNotice(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); +void EnNb_WaitForNotice(EnNb* this, PlayState* play) { + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_CheckNoticed(this, globalCtx); + EnNb_CheckNoticed(this, play); } -void EnNb_StandUpAfterNotice(EnNb* this, GlobalContext* globalCtx) { +void EnNb_StandUpAfterNotice(EnNb* this, PlayState* play) { s32 animFinished; - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); animFinished = EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetupIdleCrawlspace(this, animFinished); } -void EnNb_BlockCrawlspace(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); - func_80AB0FBC(this, globalCtx); +void EnNb_BlockCrawlspace(EnNb* this, PlayState* play) { + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); + func_80AB0FBC(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - func_80AB3838(this, globalCtx); + func_80AB3838(this, play); } -void EnNb_InitCrawlspaceDialogue(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); - func_80AB0FBC(this, globalCtx); +void EnNb_InitCrawlspaceDialogue(EnNb* this, PlayState* play) { + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); + func_80AB0FBC(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - EnNb_SetTextIdAsChild(this, globalCtx); + EnNb_SetTextIdAsChild(this, play); } -void EnNb_FollowPath(EnNb* this, GlobalContext* globalCtx) { +void EnNb_FollowPath(EnNb* this, PlayState* play) { s32 animFinished; func_80AB359C(this); - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); - func_80AB36DC(this, globalCtx); + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); + func_80AB36DC(this, play); func_80AB10C4(this); animFinished = EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - func_80AB3A7C(this, globalCtx, animFinished); + func_80AB3A7C(this, play, animFinished); } -void func_80AB3DB0(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); - func_80AB0FBC(this, globalCtx); +void func_80AB3DB0(EnNb* this, PlayState* play) { + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); + func_80AB0FBC(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - func_80AB3B04(this, globalCtx); + func_80AB3B04(this, play); } -void func_80AB3E10(EnNb* this, GlobalContext* globalCtx) { - func_80AB1284(this, globalCtx); - EnNb_UpdateCollider(this, globalCtx); - func_80AB1040(this, globalCtx); +void func_80AB3E10(EnNb* this, PlayState* play) { + func_80AB1284(this, play); + EnNb_UpdateCollider(this, play); + func_80AB1040(this, play); EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); - func_80AB3B7C(this, globalCtx); + func_80AB3B7C(this, play); } static EnNbActionFunc sActionFuncs[] = { @@ -1409,7 +1407,7 @@ static EnNbActionFunc sActionFuncs[] = { func_80AB3E10, }; -void EnNb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNb_Update(Actor* thisx, PlayState* play) { EnNb* this = (EnNb*)thisx; if (this->action < 0 || this->action > 30 || sActionFuncs[this->action] == NULL) { @@ -1418,41 +1416,40 @@ void EnNb_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnNb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNb_Init(Actor* thisx, PlayState* play) { s32 pad; EnNb* this = (EnNb*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - EnNb_SetupCollider(thisx, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gNabooruSkel, NULL, this->jointTable, this->morphTable, - NB_LIMB_MAX); + EnNb_SetupCollider(thisx, play); + SkelAnime_InitFlex(play, &this->skelAnime, &gNabooruSkel, NULL, this->jointTable, this->morphTable, NB_LIMB_MAX); switch (EnNb_GetType(this)) { case NB_TYPE_DEMO02: - EnNb_SetupLightArrowOrSealingCs(this, globalCtx); + EnNb_SetupLightArrowOrSealingCs(this, play); break; case NB_TYPE_KIDNAPPED: - EnNb_InitKidnap(this, globalCtx); + EnNb_InitKidnap(this, play); break; case NB_TYPE_KNUCKLE: - EnNb_SetupConfrontation(this, globalCtx); + EnNb_SetupConfrontation(this, play); break; case NB_TYPE_CREDITS: - EnNb_SetupCreditsSpawn(this, globalCtx); + EnNb_SetupCreditsSpawn(this, play); break; case NB_TYPE_CRAWLSPACE: - EnNb_CrawlspaceSpawnCheck(this, globalCtx); + EnNb_CrawlspaceSpawnCheck(this, play); break; default: // giving medallion - EnNb_SetChamberAnim(this, globalCtx); + EnNb_SetChamberAnim(this, play); break; } } -s32 EnNb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnNb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNb* this = (EnNb*)thisx; struct_80034A14_arg1* unk_300 = &this->unk_300; s32 ret = false; @@ -1472,7 +1469,7 @@ s32 EnNb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return ret; } -void EnNb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnNb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnNb* this = (EnNb*)thisx; if (limbIndex == NB_LIMB_HEAD) { @@ -1489,34 +1486,34 @@ void EnNb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnNb_DrawNothing(EnNb* this, GlobalContext* globalCtx) { +void EnNb_DrawNothing(EnNb* this, PlayState* play) { } -void EnNb_DrawDefault(EnNb* this, GlobalContext* globalCtx) { +void EnNb_DrawDefault(EnNb* this, PlayState* play) { s32 pad; s16 eyeIdx = this->eyeIdx; SkelAnime* skelAnime = &this->skelAnime; void* eyeTexture = sEyeTextures[eyeIdx]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_nb.c", 992); + OPEN_DISPS(play->state.gfxCtx, "../z_en_nb.c", 992); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTexture)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnNb_OverrideLimbDraw, EnNb_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_nb.c", 1013); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_nb.c", 1013); } static EnNbDrawFunc sDrawFuncs[] = { EnNb_DrawNothing, EnNb_DrawDefault, EnNb_DrawTransparency, func_80AB2E70, func_80AB2FE4, }; -void EnNb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNb_Draw(Actor* thisx, PlayState* play) { EnNb* this = (EnNb*)thisx; if (this->drawMode < 0 || this->drawMode >= 5 || sDrawFuncs[this->drawMode] == NULL) { @@ -1525,7 +1522,7 @@ void EnNb_Draw(Actor* thisx, GlobalContext* globalCtx) { return; } - sDrawFuncs[this->drawMode](this, globalCtx); + sDrawFuncs[this->drawMode](this, play); } const ActorInit En_Nb_InitVars = { 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 f0e66ac4ec..89f49fc76e 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.h +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.h @@ -29,8 +29,8 @@ typedef enum { /* 0x13 */ NB_LIMB_MAX } EnNbLimb; -typedef void (*EnNbActionFunc)(struct EnNb*, GlobalContext*); -typedef void (*EnNbDrawFunc)(struct EnNb*, GlobalContext*); +typedef void (*EnNbActionFunc)(struct EnNb*, PlayState*); +typedef void (*EnNbDrawFunc)(struct EnNb*, PlayState*); typedef struct EnNb { /* 0x0000 */ Actor actor; 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 a011626965..766f11b026 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -11,28 +11,28 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23) -void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNiw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNiw_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNiw_Init(Actor* thisx, PlayState* play); +void EnNiw_Destroy(Actor* thisx, PlayState* play); +void EnNiw_Update(Actor* thisx, PlayState* play); +void EnNiw_Draw(Actor* thisx, PlayState* play); -void EnNiw_ResetAction(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6324(EnNiw* this, GlobalContext* globalCtx); -void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6450(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6570(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6BF8(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx); -void func_80AB6EB4(EnNiw* this, GlobalContext* globalCtx); -void func_80AB70F8(EnNiw* this, GlobalContext* globalCtx); -void func_80AB714C(EnNiw* this, GlobalContext* globalCtx); -void func_80AB7204(EnNiw* this, GlobalContext* globalCtx); -void func_80AB7290(EnNiw* this, GlobalContext* globalCtx); -void func_80AB7328(EnNiw* this, GlobalContext* globalCtx); +void EnNiw_ResetAction(EnNiw* this, PlayState* play); +void func_80AB6324(EnNiw* this, PlayState* play); +void func_80AB63A8(EnNiw* this, PlayState* play); +void func_80AB6450(EnNiw* this, PlayState* play); +void func_80AB6570(EnNiw* this, PlayState* play); +void func_80AB6A38(EnNiw* this, PlayState* play); +void func_80AB6BF8(EnNiw* this, PlayState* play); +void func_80AB6D08(EnNiw* this, PlayState* play); +void func_80AB6EB4(EnNiw* this, PlayState* play); +void func_80AB70F8(EnNiw* this, PlayState* play); +void func_80AB714C(EnNiw* this, PlayState* play); +void func_80AB7204(EnNiw* this, PlayState* play); +void func_80AB7290(EnNiw* this, PlayState* play); +void func_80AB7328(EnNiw* this, PlayState* play); void EnNiw_SpawnFeather(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale); -void EnNiw_UpdateEffects(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_DrawEffects(EnNiw* this, GlobalContext* globalCtx); +void EnNiw_UpdateEffects(EnNiw* this, PlayState* play); +void EnNiw_DrawEffects(EnNiw* this, PlayState* play); static s16 D_80AB85E0 = 0; @@ -119,7 +119,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNiw_Init(Actor* thisx, PlayState* play) { EnNiw* this = (EnNiw*)thisx; s32 pad; s32 i; @@ -153,9 +153,9 @@ void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.flags |= ACTOR_FLAG_0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); - if (globalCtx->sceneNum == SCENE_SPOT01) { + if (play->sceneNum == SCENE_SPOT01) { for (i = 0; i < ARRAY_COUNT(sKakarikoPosList); i++) { if (fabsf(this->actor.world.pos.x - sKakarikoPosList[i].x) < 40.0f && fabsf(this->actor.world.pos.z - sKakarikoPosList[i].z) < 40.0f) { @@ -218,20 +218,20 @@ void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { break; } - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); switch (this->actor.params) { case 0xA: this->actor.colChkInfo.mass = MASS_IMMOVABLE; case 0xD: case 0xE: - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit2); - if (globalCtx->sceneNum == SCENE_LINK_HOME && !GET_EVENTCHKINF(EVENTCHKINF_1E)) { + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit2); + if (play->sceneNum == SCENE_LINK_HOME && !GET_EVENTCHKINF(EVENTCHKINF_1E)) { Actor_Kill(&this->actor); } break; default: - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit1); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit1); break; } @@ -240,13 +240,13 @@ void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnNiw_ResetAction; } -void EnNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNiw_Destroy(Actor* thisx, PlayState* play) { EnNiw* this = (EnNiw*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AB5BF8(EnNiw* this, GlobalContext* globalCtx, s16 arg2) { +void func_80AB5BF8(EnNiw* this, PlayState* play, s16 arg2) { f32 factor = 1.0f; if (this->actor.params == 0xD) { @@ -340,7 +340,7 @@ void func_80AB5BF8(EnNiw* this, GlobalContext* globalCtx, s16 arg2) { } } -void EnNiw_SpawnAttackCucco(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_SpawnAttackCucco(EnNiw* this, PlayState* play) { f32 viewX; f32 viewY; f32 viewZ; @@ -348,14 +348,14 @@ void EnNiw_SpawnAttackCucco(EnNiw* this, GlobalContext* globalCtx) { Actor* attackCucco; if ((this->timer5 == 0) && (this->unk_296 < 7)) { - viewX = globalCtx->view.at.x - globalCtx->view.eye.x; - viewY = globalCtx->view.at.y - globalCtx->view.eye.y; - viewZ = globalCtx->view.at.z - globalCtx->view.eye.z; - attackCuccoPos.x = ((Rand_ZeroOne() - 0.5f) * viewX) + globalCtx->view.eye.x; - attackCuccoPos.y = Rand_CenteredFloat(0.3f) + ((globalCtx->view.eye.y + 50.0f) + (viewY * 0.5f)); - attackCuccoPos.z = ((Rand_ZeroOne() - 0.5f) * viewZ) + globalCtx->view.eye.z; - attackCucco = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ATTACK_NIW, - attackCuccoPos.x, attackCuccoPos.y, attackCuccoPos.z, 0, 0, 0, 0); + 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++; @@ -367,7 +367,7 @@ void EnNiw_SpawnAttackCucco(EnNiw* this, GlobalContext* globalCtx) { } } -void func_80AB6100(EnNiw* this, GlobalContext* globalCtx, s32 arg2) { +void func_80AB6100(EnNiw* this, PlayState* play, s32 arg2) { f32 factor; f32 targetRotY; @@ -400,10 +400,10 @@ void func_80AB6100(EnNiw* this, GlobalContext* globalCtx, s32 arg2) { targetRotY = this->unk_2E4 + factor; Math_SmoothStepToS(&this->actor.world.rot.y, targetRotY, 3, this->unk_2FC, 0); Math_ApproachF(&this->unk_2FC, 3000.0f, 1.0f, 500.0f); - func_80AB5BF8(this, globalCtx, 5); + func_80AB5BF8(this, play, 5); } -void EnNiw_ResetAction(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_ResetAction(EnNiw* this, PlayState* play) { Animation_Change(&this->skelAnime, &gCuccoAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCuccoAnim), ANIMMODE_LOOP, -10.0f); @@ -420,16 +420,16 @@ void EnNiw_ResetAction(EnNiw* this, GlobalContext* globalCtx) { } } -void func_80AB6324(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6324(EnNiw* this, PlayState* play) { if (this->unk_308 != 0) { this->actor.velocity.y = Rand_ZeroFloat(2.0f) + 4.0f; this->actor.speedXZ = Rand_ZeroFloat(2.0f) + 3.0f; this->actionFunc = func_80AB63A8; } - func_80AB5BF8(this, globalCtx, 1); + func_80AB5BF8(this, play, 1); } -void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB63A8(EnNiw* this, PlayState* play) { 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; @@ -441,18 +441,18 @@ void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB6570; } else { - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } } -void func_80AB6450(EnNiw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AB6450(EnNiw* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 30.0f && fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 5.0f) { this->timer6 = 100; this->actor.gravity = -2.0f; this->actionFunc = func_80AB7290; - } else if (Actor_HasParent(&this->actor, globalCtx)) { + } else if (Actor_HasParent(&this->actor, play)) { this->actor.gravity = -2.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHICKEN_CRY_M); this->sfxTimer1 = 30; @@ -463,19 +463,19 @@ void func_80AB6450(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB6BF8; } else { // GI_NONE in this case allows the player to lift the actor - func_8002F434(&this->actor, globalCtx, GI_NONE, 25.0f, 10.0f); - func_80AB5BF8(this, globalCtx, 1); + func_8002F434(&this->actor, play, GI_NONE, 25.0f, 10.0f); + func_80AB5BF8(this, play, 1); } } -void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6570(EnNiw* this, PlayState* play) { s32 pad[2]; f32 posY = Rand_CenteredFloat(100.0f); f32 posZ = Rand_CenteredFloat(100.0f); s16 tmp; if (this->actor.params != 0xA) { - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHICKEN_CRY_M); this->sfxTimer1 = 30; this->path = 0; @@ -485,7 +485,7 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB6BF8; return; } - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } else { if (this->path != 0) { this->unk_2A6 = 1; @@ -582,10 +582,10 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_300, 10000.0f, 1.0f, 1000.0f); } - func_80AB5BF8(this, globalCtx, tmp); + func_80AB5BF8(this, play, tmp); } -void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6A38(EnNiw* this, PlayState* play) { Path* path; Vec3s* pointPos; f32 pathDiffX; @@ -601,13 +601,13 @@ void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx) { this->unk_2FC = this->unk_300 = 0.0f; this->actionFunc = EnNiw_ResetAction; } else { - path = &globalCtx->setupPathList[pathIndex]; + path = &play->setupPathList[pathIndex]; 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; this->unk_2E4 = RAD_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)); - func_80AB6100(this, globalCtx, 2); + func_80AB6100(this, play, 2); if (fabsf(pathDiffX) < 30.0f && fabsf(pathDiffZ) < 30.0f) { this->waypoint++; @@ -616,11 +616,11 @@ void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx) { } } - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } } -void func_80AB6BF8(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6BF8(EnNiw* this, PlayState* play) { if (this->timer4 == 0) { this->unk_2A6 = 2; this->timer4 = 10; @@ -630,7 +630,7 @@ void func_80AB6BF8(EnNiw* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = Rand_CenteredFloat(5000.0f); this->actor.shape.rot.z = Rand_CenteredFloat(5000.0f); - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { if (this->actor.params == 0xD) { this->sfxTimer1 = 0; this->unk_2A6 = 1; @@ -644,10 +644,10 @@ void func_80AB6BF8(EnNiw* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_0; this->actionFunc = func_80AB6D08; } - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } -void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6D08(EnNiw* this, PlayState* play) { if (this->path == 0) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { return; @@ -684,7 +684,7 @@ void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx) { } } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHICKEN_CRY_M); this->sfxTimer1 = 30; this->path = 0; @@ -694,25 +694,25 @@ void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB6BF8; } else { if (this->timer5 >= 6) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } } -void func_80AB6EB4(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6EB4(EnNiw* this, PlayState* play) { if (this->actor.world.pos.y > 400.0f) { Actor_Kill(&this->actor); } - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } -void func_80AB6F04(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB6F04(EnNiw* this, PlayState* play) { Vec3f pos; if (this->unk_2A8 != 0) { - EnNiw_SpawnAttackCucco(this, globalCtx); + EnNiw_SpawnAttackCucco(this, play); } this->actor.speedXZ = 2.0f; @@ -727,7 +727,7 @@ void func_80AB6F04(EnNiw* this, GlobalContext* globalCtx) { this->timer4 = 30; Math_Vec3f_Copy(&pos, &this->actor.world.pos); pos.y += this->actor.yDistToWater; - EffectSsGRipple_Spawn(globalCtx, &pos, 100, 500, 30); + EffectSsGRipple_Spawn(play, &pos, 100, 500, 30); } if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y = 10.0f; @@ -756,17 +756,17 @@ void func_80AB6F04(EnNiw* this, GlobalContext* globalCtx) { } } - func_80AB5BF8(this, globalCtx, 2); + func_80AB5BF8(this, play, 2); } -void func_80AB70A0(EnNiw* this, GlobalContext* globalCtx) { - OnePointCutscene_Init(globalCtx, 2290, -99, &this->actor, CAM_ID_MAIN); +void func_80AB70A0(EnNiw* this, PlayState* play) { + OnePointCutscene_Init(play, 2290, -99, &this->actor, CAM_ID_MAIN); this->timer5 = 100; this->unk_2A2 = 1; this->actionFunc = func_80AB70F8; } -void func_80AB70F8(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB70F8(EnNiw* this, PlayState* play) { this->sfxTimer1 = 100; if (this->timer5 == 0) { @@ -776,10 +776,10 @@ void func_80AB70F8(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB714C; } - func_80AB5BF8(this, globalCtx, this->unk_2A2); + func_80AB5BF8(this, play, this->unk_2A2); } -void func_80AB714C(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB714C(EnNiw* this, PlayState* play) { this->sfxTimer1 = 100; if (this->timer5 == 40) { @@ -800,11 +800,11 @@ void func_80AB714C(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB7204; } - func_80AB5BF8(this, globalCtx, this->unk_2A2); + func_80AB5BF8(this, play, this->unk_2A2); } -void func_80AB7204(EnNiw* this, GlobalContext* globalCtx) { - EnNiw_SpawnAttackCucco(this, globalCtx); +void func_80AB7204(EnNiw* this, PlayState* play) { + EnNiw_SpawnAttackCucco(this, play); if (this->timer7 < 2) { if (this->timer7 == 1) { @@ -812,12 +812,12 @@ void func_80AB7204(EnNiw* this, GlobalContext* globalCtx) { this->unk_2A0 = Rand_ZeroFloat(1.99f); this->timer1 = this->timer2 = this->timer3 = this->timer4 = 0; } else { - func_80AB6100(this, globalCtx, 1); + func_80AB6100(this, play, 1); } } } -void func_80AB7290(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB7290(EnNiw* this, PlayState* play) { Animation_Change(&this->skelAnime, &gCuccoAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCuccoAnim), ANIMMODE_LOOP, -10.0f); this->unk_2A0 = Rand_ZeroFloat(1.99f); @@ -825,8 +825,8 @@ void func_80AB7290(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB7328; } -void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AB7328(EnNiw* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->timer6 == 0) { this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; @@ -842,19 +842,19 @@ void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) { } else { this->unk_2E4 = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.x - player->actor.world.pos.x, this->actor.world.pos.z - player->actor.world.pos.z)); - func_80AB6100(this, globalCtx, 0); - func_80AB5BF8(this, globalCtx, 2); + func_80AB6100(this, play, 0); + func_80AB5BF8(this, play, 2); } } -void func_80AB7420(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB7420(EnNiw* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_2A4 = (s16)Rand_ZeroFloat(3.99f) + 5; this->actionFunc = EnNiw_ResetAction; } } -void func_80AB747C(EnNiw* this, GlobalContext* globalCtx) { +void func_80AB747C(EnNiw* this, PlayState* play) { if (this->unk_2A8 == 0 && this->actor.params != 0xA && this->actionFunc != func_80AB6450 && this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; @@ -870,10 +870,10 @@ void func_80AB747C(EnNiw* this, GlobalContext* globalCtx) { } } -void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNiw_Update(Actor* thisx, PlayState* play) { s32 pad1; EnNiw* this = (EnNiw*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 i; s16 featherCount; Vec3f zeroVec1 = { 0.0f, 0.0f, 0.0f }; @@ -929,7 +929,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_2A6 = 0; } - EnNiw_UpdateEffects(this, globalCtx); + EnNiw_UpdateEffects(this, play); if (this->timer1 != 0) { this->timer1--; } @@ -968,25 +968,25 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { } thisx->shape.rot = thisx->world.rot; thisx->shape.shadowScale = 15.0f; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, this->unk_304); Actor_MoveForward(&this->actor); - if (this->actionFunc != func_80AB6EB4 && this->actionFunc != func_80AB6450 && globalCtx->sceneNum != SCENE_SPOT03) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, + if (this->actionFunc != func_80AB6EB4 && this->actionFunc != func_80AB6450 && play->sceneNum != SCENE_SPOT03) { + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } - if (globalCtx->sceneNum == SCENE_SPOT03) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, + if (play->sceneNum == SCENE_SPOT03) { + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } if (thisx->floorHeight <= BGCHECK_Y_MIN || thisx->floorHeight >= 32000.0f) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 上下? ☆☆☆☆☆ %f\n" VT_RST, thisx->floorHeight); - cam.x = globalCtx->view.at.x - globalCtx->view.eye.x; - cam.y = globalCtx->view.at.y - globalCtx->view.eye.y; - cam.z = globalCtx->view.at.z - globalCtx->view.eye.z; + cam.x = play->view.at.x - play->view.eye.x; + cam.y = play->view.at.y - play->view.eye.y; + cam.z = play->view.at.z - play->view.eye.z; camResult = cam.y / sqrtf(SQ(cam.x) + SQ(cam.y) + SQ(cam.z)); osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外X! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.x); osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外Y! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.y); @@ -996,7 +996,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ セットZ! ☆☆☆☆☆ %f\n" VT_RST, thisx->home.pos.z); thisx->world.pos.x = thisx->home.pos.x; thisx->world.pos.z = thisx->home.pos.z; - thisx->world.pos.y = ((thisx->home.pos.y + globalCtx->view.eye.y) + (camResult * 160.0f)); + thisx->world.pos.y = ((thisx->home.pos.y + play->view.eye.y) + (camResult * 160.0f)); if (thisx->world.pos.y < thisx->home.pos.y) { thisx->world.pos.y = thisx->home.pos.y + 300.0f; @@ -1042,7 +1042,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { Math_Vec3f_Copy(&pos, &thisx->world.pos); pos.y += thisx->yDistToWater; this->timer4 = 30; - EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 400); + EffectSsGSplash_Spawn(play, &pos, 0, 0, 0, 400); this->timer5 = 0; osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ ぶくぶく ☆☆☆☆☆ \n" VT_RST); @@ -1077,10 +1077,10 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { dist = 20.0f; if (this->unk_2A8 != 0 && thisx->xyzDistToPlayerSq < SQ(dist) && player->invincibilityTimer == 0) { - func_8002F6D4(globalCtx, &this->actor, 2.0f, thisx->world.rot.y, 0.0f, 0x10); + func_8002F6D4(play, &this->actor, 2.0f, thisx->world.rot.y, 0.0f, 0x10); } - func_80AB747C(this, globalCtx); + func_80AB747C(this, play); if (this->sfxTimer2 == 0 && this->actionFunc == func_80AB6BF8) { this->sfxTimer2 = 7; @@ -1099,17 +1099,17 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider); if (thisx->params != 0xA && thisx->params != 0xD && thisx->params != 0xE && thisx->params != 4) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != func_80AB6BF8 && this->actionFunc != func_80AB6D08 && this->actionFunc != func_80AB6324 && this->actionFunc != func_80AB63A8 && this->actionFunc != func_80AB6450) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } -s32 EnNiw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnNiw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNiw* this = (EnNiw*)thisx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -1133,20 +1133,20 @@ s32 EnNiw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnNiw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNiw_Draw(Actor* thisx, PlayState* play) { EnNiw* this = (EnNiw*)thisx; Vec3f scale = { 0.15f, 0.15f, 0.15f }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnNiw_OverrideLimbDraw, NULL, this); if (this->actionFunc == func_80AB6450) { - func_80033C30(&this->actor.world.pos, &scale, 255, globalCtx); + func_80033C30(&this->actor.world.pos, &scale, 255, play); } - EnNiw_DrawEffects(this, globalCtx); + EnNiw_DrawEffects(this, play); } void EnNiw_SpawnFeather(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale) { @@ -1168,7 +1168,7 @@ void EnNiw_SpawnFeather(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 s } } -void EnNiw_UpdateEffects(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_UpdateEffects(EnNiw* this, PlayState* play) { s16 i; EnNiwEffect* effect = this->effects; @@ -1199,16 +1199,16 @@ void EnNiw_UpdateEffects(EnNiw* this, GlobalContext* globalCtx) { } } -void EnNiw_DrawEffects(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_DrawEffects(EnNiw* this, PlayState* play) { u8 materialFlag = 0; s16 i; s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; EnNiwEffect* effect = &this->effects[0]; OPEN_DISPS(gfxCtx, "../z_en_niw.c", 1897); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < EN_NIW_EFFECT_COUNT; i++, effect++) { if (effect->type == 1) { @@ -1217,7 +1217,7 @@ void EnNiw_DrawEffects(EnNiw* this, GlobalContext* globalCtx) { materialFlag++; } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(effect->unk_30, MTXMODE_APPLY); Matrix_Translate(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/src/overlays/actors/ovl_En_Niw/z_en_niw.h index 87707c0c06..5f1ab9c809 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -6,7 +6,7 @@ struct EnNiw; -typedef void (*EnNiwActionFunc)(struct EnNiw*, GlobalContext*); +typedef void (*EnNiwActionFunc)(struct EnNiw*, PlayState*); typedef struct { /* 0x0000 */ u8 type; 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 4bacf57b44..28aee3372c 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 @@ -10,14 +10,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnNiwGirl_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNiwGirl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNiwGirl_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNiwGirl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNiwGirl_Init(Actor* thisx, PlayState* play); +void EnNiwGirl_Destroy(Actor* thisx, PlayState* play); +void EnNiwGirl_Update(Actor* thisx, PlayState* play); +void EnNiwGirl_Draw(Actor* thisx, PlayState* play); -void EnNiwGirl_Talk(EnNiwGirl* this, GlobalContext* globalCtx); -void func_80AB94D0(EnNiwGirl* this, GlobalContext* globalCtx); -void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx); +void EnNiwGirl_Talk(EnNiwGirl* this, PlayState* play); +void func_80AB94D0(EnNiwGirl* this, PlayState* play); +void func_80AB9210(EnNiwGirl* this, PlayState* play); const ActorInit En_Niw_Girl_InitVars = { ACTOR_EN_NIW_GIRL, @@ -51,17 +51,16 @@ static ColliderCylinderInit sCylinderInit = { { 10, 30, 0, { 0, 0, 0 } }, }; -void EnNiwGirl_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwGirl_Init(Actor* thisx, PlayState* play) { EnNiwGirl* this = (EnNiwGirl*)thisx; s32 pad; Vec3f vec1; Vec3f vec2; s32 pad2; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gNiwGirlSkel, &gNiwGirlRunAnim, this->jointTable, this->morphTable, - 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gNiwGirlSkel, &gNiwGirlRunAnim, this->jointTable, this->morphTable, 17); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.targetMode = 6; if (this->actor.params < 0) { this->actor.params = 0; @@ -74,7 +73,7 @@ void EnNiwGirl_Init(Actor* thisx, GlobalContext* globalCtx) { vec1.z = 50.0; Matrix_MultVec3f(&vec1, &vec2); this->chasedEnNiw = (EnNiw*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_NIW, this->actor.world.pos.x + vec2.x, + &play->actorCtx, &this->actor, play, ACTOR_EN_NIW, this->actor.world.pos.x + vec2.x, this->actor.world.pos.y + vec2.y, this->actor.world.pos.z + vec2.z, 0, this->actor.world.rot.y, 0, 0xA); if (this->chasedEnNiw != NULL) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ シツレイしちゃうわね!プンプン ☆☆☆☆☆ %d\n" VT_RST, this->actor.params); @@ -91,18 +90,18 @@ void EnNiwGirl_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnNiwGirl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwGirl_Destroy(Actor* thisx, PlayState* play) { } -void EnNiwGirl_Jump(EnNiwGirl* this, GlobalContext* globalCtx) { +void EnNiwGirl_Jump(EnNiwGirl* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gNiwGirlRunAnim); Animation_Change(&this->skelAnime, &gNiwGirlRunAnim, 1.0f, 0.0f, frameCount, 0, -10.0f); this->actor.flags &= ~ACTOR_FLAG_0; this->actionFunc = func_80AB9210; } -void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->path]; +void func_80AB9210(EnNiwGirl* this, PlayState* play) { + Path* path = &play->setupPathList[this->path]; f32 xDistBetween; f32 zDistBetween; @@ -112,7 +111,7 @@ void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) { // Find the X and Z distance between the girl and the cuckoo she is chasing xDistBetween = this->chasedEnNiw->actor.world.pos.x - this->actor.world.pos.x; zDistBetween = this->chasedEnNiw->actor.world.pos.z - this->actor.world.pos.z; - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { this->chasedEnNiw->path = 0; } if (sqrtf(SQ(xDistBetween) + SQ(zDistBetween)) < 70.0f) { @@ -129,13 +128,13 @@ void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; // Only allow Link to talk to her when she is playing the jumping animation - if ((this->jumpTimer == 0) || (Player_GetMask(globalCtx) != PLAYER_MASK_NONE)) { + if ((this->jumpTimer == 0) || (Player_GetMask(play) != PLAYER_MASK_NONE)) { this->jumpTimer = 60; this->actionFunc = EnNiwGirl_Talk; } } -void EnNiwGirl_Talk(EnNiwGirl* this, GlobalContext* globalCtx) { +void EnNiwGirl_Talk(EnNiwGirl* this, PlayState* play) { Animation_Change(&this->skelAnime, &gNiwGirlJumpAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwGirlJumpAnim), 0, -10.0f); this->actor.flags |= ACTOR_FLAG_0; @@ -143,7 +142,7 @@ void EnNiwGirl_Talk(EnNiwGirl* this, GlobalContext* globalCtx) { if (GET_EVENTCHKINF(EVENTCHKINF_80) && (this->unk_27A == 0)) { this->actor.textId = 0x70EA; } - switch (Player_GetMask(globalCtx)) { + switch (Player_GetMask(play)) { case PLAYER_MASK_KEATON: this->actor.textId = 0x7118; break; @@ -165,30 +164,30 @@ void EnNiwGirl_Talk(EnNiwGirl* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB94D0; } -void func_80AB94D0(EnNiwGirl* this, GlobalContext* globalCtx) { +void func_80AB94D0(EnNiwGirl* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { this->chasedEnNiw->path = 0; } Math_ApproachZeroF(&this->actor.speedXZ, 0.8f, 0.2f); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->actor.textId == 0x70EA) { this->unk_27A = 1; } } else { - if ((this->jumpTimer == 0) && Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { + if ((this->jumpTimer == 0) && Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { this->jumpTimer = Rand_ZeroFloat(100.0f) + 250.0f; this->actionFunc = EnNiwGirl_Jump; } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } -void EnNiwGirl_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwGirl_Update(Actor* thisx, PlayState* play) { EnNiwGirl* this = (EnNiwGirl*)thisx; EnNiwGirlActionFunc tempActionFunc; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor_SetScale(&this->actor, 0.013f); this->unkUpTimer++; @@ -221,16 +220,15 @@ void EnNiwGirl_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->jumpTimer != 0) { this->jumpTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 100.0f, 100.0f, 200.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 100.0f, 100.0f, 200.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnNiwGirlOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnNiwGirlOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNiwGirl* this = (EnNiwGirl*)thisx; if (limbIndex == 3) { @@ -245,19 +243,19 @@ s32 EnNiwGirlOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi static Vec3f sConstVec3f = { 0.2f, 0.2f, 0.2f }; -void EnNiwGirl_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwGirl_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gNiwGirlEyeOpenTex, gNiwGirlEyeHalfTex, gNiwGirlEyeClosedTex }; EnNiwGirl* this = (EnNiwGirl*)thisx; s32 pad; Vec3f sp4C = sConstVec3f; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_niw_girl.c", 573); + OPEN_DISPS(play->state.gfxCtx, "../z_en_niw_girl.c", 573); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnNiwGirlOverrideLimbDraw, NULL, this); - func_80033C30(&this->actor.world.pos, &sp4C, 255, globalCtx); + func_80033C30(&this->actor.world.pos, &sp4C, 255, play); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_niw_girl.c", 592); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_niw_girl.c", 592); } diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h index d931973c37..e9ef3b081c 100644 --- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h +++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h @@ -7,7 +7,7 @@ struct EnNiwGirl; -typedef void (*EnNiwGirlActionFunc)(struct EnNiwGirl*, GlobalContext*); +typedef void (*EnNiwGirlActionFunc)(struct EnNiwGirl*, PlayState*); typedef struct EnNiwGirl { /* 0x0000 */ Actor actor; 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 5e4ea39479..0d845de414 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 @@ -6,24 +6,24 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnNiwLady_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNiwLady_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNiwLady_Update(Actor* thisx, GlobalContext* globalCtx); +void EnNiwLady_Init(Actor* thisx, PlayState* play); +void EnNiwLady_Destroy(Actor* thisx, PlayState* play); +void EnNiwLady_Update(Actor* thisx, PlayState* play); -void func_80AB9F24(EnNiwLady* this, GlobalContext* globalCtx); -void EnNiwLady_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80ABA21C(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAD38(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABA778(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABA878(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABA9B8(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAB08(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAC00(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAA9C(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAC84(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABA654(EnNiwLady* this, GlobalContext* globalCtx); -void func_80ABAD7C(EnNiwLady* this, GlobalContext* globalCtx); +void func_80AB9F24(EnNiwLady* this, PlayState* play); +void EnNiwLady_Draw(Actor* thisx, PlayState* play); +void func_80ABA21C(EnNiwLady* this, PlayState* play); +void func_80ABAD38(EnNiwLady* this, PlayState* play); +void func_80ABA778(EnNiwLady* this, PlayState* play); +void func_80ABA878(EnNiwLady* this, PlayState* play); +void func_80ABA9B8(EnNiwLady* this, PlayState* play); +void func_80ABAB08(EnNiwLady* this, PlayState* play); +void func_80ABAC00(EnNiwLady* this, PlayState* play); +void func_80ABAA9C(EnNiwLady* this, PlayState* play); +void func_80ABAC84(EnNiwLady* this, PlayState* play); +void func_80ABA244(EnNiwLady* this, PlayState* play); +void func_80ABA654(EnNiwLady* this, PlayState* play); +void func_80ABAD7C(EnNiwLady* this, PlayState* play); const ActorInit En_Niw_Lady_InitVars = { ACTOR_EN_NIW_LADY, @@ -66,18 +66,18 @@ static ColliderCylinderInit sCylinderInit = { { 10, 10, 0, { 0, 0, 0 } }, }; -void EnNiwLady_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwLady_Init(Actor* thisx, PlayState* play) { s32 pad; EnNiwLady* this = (EnNiwLady*)thisx; - this->objectAneIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_ANE); - this->objectOsAnimeIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_OS_ANIME); + this->objectAneIndex = Object_GetIndex(&play->objectCtx, OBJECT_ANE); + this->objectOsAnimeIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME); if ((this->objectOsAnimeIndex < 0) || (this->objectAneIndex < 0)) { Actor_Kill(thisx); return; } this->unk_278 = 0; - if (globalCtx->sceneNum == SCENE_LABO) { + if (play->sceneNum == SCENE_LABO) { this->unk_278 = 1; } if ((this->unk_278 != 0) && IS_DAY) { @@ -90,16 +90,16 @@ void EnNiwLady_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->uncullZoneForward = 600.0f; } -void EnNiwLady_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwLady_Destroy(Actor* thisx, PlayState* play) { EnNiwLady* this = (EnNiwLady*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnNiwLady_ChoseAnimation(EnNiwLady* this, GlobalContext* globalCtx, s32 arg2) { +void EnNiwLady_ChoseAnimation(EnNiwLady* this, PlayState* play, s32 arg2) { f32 frames; - if (Text_GetFaceReaction(globalCtx, 8) != 0) { + if (Text_GetFaceReaction(play, 8) != 0) { arg2 = 8; } if (arg2 != this->unk_270) { @@ -148,21 +148,21 @@ void EnNiwLady_ChoseAnimation(EnNiwLady* this, GlobalContext* globalCtx, s32 arg } } -void func_80AB9F24(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80AB9F24(EnNiwLady* this, PlayState* play) { f32 frames; s32 pad; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objectAneIndex) && - Object_IsLoaded(&globalCtx->objectCtx, this->objectOsAnimeIndex)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objectAneIndex].segment); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCuccoLadySkel, NULL, this->jointTable, this->morphTable, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objectOsAnimeIndex].segment); + if (Object_IsLoaded(&play->objectCtx, this->objectAneIndex) && + Object_IsLoaded(&play->objectCtx, this->objectOsAnimeIndex)) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectAneIndex].segment); + SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoLadySkel, NULL, this->jointTable, this->morphTable, 16); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectOsAnimeIndex].segment); this->unk_27E = 1; this->actor.gravity = -3.0f; Actor_SetScale(&this->actor, 0.01f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_272 = 0; this->actor.targetMode = 6; this->actor.draw = EnNiwLady_Draw; @@ -190,18 +190,18 @@ void func_80AB9F24(EnNiwLady* this, GlobalContext* globalCtx) { } } -void func_80ABA21C(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABA21C(EnNiwLady* this, PlayState* play) { this->actor.textId = sMissingCuccoTextIds[0]; this->unk_262 = TEXT_STATE_DONE; this->actionFunc = func_80ABA244; } -void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABA244(EnNiwLady* this, PlayState* play) { EnNiw* currentCucco; s32 phi_s1; this->cuccosInPen = 0; - currentCucco = (EnNiw*)globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + currentCucco = (EnNiw*)play->actorCtx.actorLists[ACTORCAT_PROP].head; while (currentCucco != NULL) { if (currentCucco->actor.id == ACTOR_EN_NIW) { if ((fabsf(currentCucco->actor.world.pos.x - 330.0f) < 90.0f) && @@ -226,8 +226,7 @@ void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx) { this->cuccosInPen = BREG(7) - 1; } phi_s1 = this->cuccosInPen; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE)) { this->unk_26E = 101; } if (this->cuccosInPen >= 7) { @@ -240,15 +239,15 @@ void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx) { phi_s1 = 9; } this->actor.textId = sMissingCuccoTextIds[phi_s1]; - if (Text_GetFaceReaction(globalCtx, 8) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 8); + if (Text_GetFaceReaction(play, 8) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 8); this->unk_262 = TEXT_STATE_DONE; } if ((this->unk_26C != 0) && (phi_s1 != 9)) { phi_s1 = 10; this->unk_26E = 11; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ ねぇちゃん選択\t ☆☆☆☆ %d\n" VT_RST, phi_s1); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ ねぇちゃんハート ☆☆☆☆ %d\n" VT_RST, this->unk_26C); @@ -257,7 +256,7 @@ void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ this->actor.talk_message ☆☆ %x\n" VT_RST, this->actor.textId); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ this->message_end_code ☆☆ %d\n" VT_RST, this->unk_262); osSyncPrintf("\n\n"); - if (Text_GetFaceReaction(globalCtx, 8) == 0) { + if (Text_GetFaceReaction(play, 8) == 0) { if (this->actor.textId == 0x503C) { func_80078884(NA_SE_SY_ERROR); this->unk_26C = 2; @@ -295,13 +294,13 @@ void func_80ABA244(EnNiwLady* this, GlobalContext* globalCtx) { } } } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } -void func_80ABA654(EnNiwLady* this, GlobalContext* globalCtx) { - if (this->unk_262 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void func_80ABA654(EnNiwLady* this, PlayState* play) { + if (this->unk_262 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ハート ☆☆☆☆☆ %d\n" VT_RST, this->unk_26C); osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 爆弾 ☆☆☆☆☆ %d\n" VT_RST, this->unk_272); osSyncPrintf("\n\n"); @@ -309,13 +308,13 @@ void func_80ABA654(EnNiwLady* this, GlobalContext* globalCtx) { if (!GET_ITEMGETINF(ITEMGETINF_0C)) { this->actor.parent = NULL; this->getItemId = GI_BOTTLE; - func_8002F434(&this->actor, globalCtx, GI_BOTTLE, 100.0f, 50.0f); + func_8002F434(&this->actor, play, GI_BOTTLE, 100.0f, 50.0f); this->actionFunc = func_80ABAC00; return; } if (this->unk_26C == 1) { this->getItemId = GI_RUPEE_PURPLE; - func_8002F434(&this->actor, globalCtx, GI_RUPEE_PURPLE, 100.0f, 50.0f); + func_8002F434(&this->actor, play, GI_RUPEE_PURPLE, 100.0f, 50.0f); this->actionFunc = func_80ABAC00; } this->actionFunc = func_80ABA244; @@ -325,7 +324,7 @@ void func_80ABA654(EnNiwLady* this, GlobalContext* globalCtx) { static s16 sTradeItemTextIds[] = { 0x503E, 0x503F, 0x5047, 0x5040, 0x5042, 0x5043, 0x5044, 0x00CF, 0x5045, 0x5042, 0x5027 }; -void func_80ABA778(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABA778(EnNiwLady* this, PlayState* play) { // "☆☆☆☆☆ Adult message check ☆☆☆☆☆" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ アダルトメッセージチェック ☆☆☆☆☆ \n" VT_RST); this->unk_262 = TEXT_STATE_DONE; @@ -356,16 +355,15 @@ void func_80ABA778(EnNiwLady* this, GlobalContext* globalCtx) { this->actionFunc = func_80ABA878; } -void func_80ABA878(EnNiwLady* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ABA878(EnNiwLady* this, PlayState* play) { + Player* player = GET_PLAYER(play); s8 playerExchangeItemId; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE)) { this->unk_26E = 11; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - playerExchangeItemId = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + playerExchangeItemId = func_8002F368(play); if ((playerExchangeItemId == 6) && GET_EVENTCHKINF(EVENTCHKINF_6A)) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); player->actor.textId = sTradeItemTextIds[5]; @@ -381,23 +379,23 @@ void func_80ABA878(EnNiwLady* this, GlobalContext* globalCtx) { this->actionFunc = !this->unk_273 ? func_80ABA778 : func_80ABA9B8; } } else { - func_8002F298(&this->actor, globalCtx, 50.0f, 6); + func_8002F298(&this->actor, play, 50.0f, 6); } } -void func_80ABA9B8(EnNiwLady* this, GlobalContext* globalCtx) { - if ((this->unk_262 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80ABA9B8(EnNiwLady* this, PlayState* play) { + if ((this->unk_262 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.parent = NULL; - func_8002F434(&this->actor, globalCtx, GI_POCKET_EGG, 200.0f, 100.0f); + func_8002F434(&this->actor, play, GI_POCKET_EGG, 200.0f, 100.0f); this->actionFunc = func_80ABAC00; break; case 1: this->actor.textId = sTradeItemTextIds[3]; this->unk_26E = this->unk_27A + 21; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_262 = TEXT_STATE_EVENT; this->actionFunc = func_80ABAA9C; break; @@ -405,29 +403,29 @@ void func_80ABA9B8(EnNiwLady* this, GlobalContext* globalCtx) { } } -void func_80ABAA9C(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABAA9C(EnNiwLady* this, PlayState* play) { this->unk_26E = 11; - if ((this->unk_262 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((this->unk_262 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = func_80ABA778; } } -void func_80ABAB08(EnNiwLady* this, GlobalContext* globalCtx) { - if ((this->unk_262 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80ABAB08(EnNiwLady* this, PlayState* play) { + if ((this->unk_262 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.parent = NULL; - func_8002F434(&this->actor, globalCtx, GI_COJIRO, 200.0f, 100.0f); + func_8002F434(&this->actor, play, GI_COJIRO, 200.0f, 100.0f); this->actionFunc = func_80ABAC00; break; case 1: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->unk_277 = 1; this->actor.textId = sTradeItemTextIds[8]; this->unk_26E = this->unk_27A + 21; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_262 = TEXT_STATE_EVENT; this->actionFunc = func_80ABAA9C; break; @@ -435,22 +433,22 @@ void func_80ABAB08(EnNiwLady* this, GlobalContext* globalCtx) { } } -void func_80ABAC00(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABAC00(EnNiwLady* this, PlayState* play) { s32 getItemId; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_80ABAC84; } else { getItemId = this->getItemId; if (LINK_IS_ADULT) { getItemId = !GET_ITEMGETINF(ITEMGETINF_2C) ? GI_POCKET_EGG : GI_COJIRO; } - func_8002F434(&this->actor, globalCtx, getItemId, 200.0f, 100.0f); + func_8002F434(&this->actor, play, getItemId, 200.0f, 100.0f); } } -void func_80ABAC84(EnNiwLady* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_DONE) || !Message_ShouldAdvance(globalCtx)) { +void func_80ABAC84(EnNiwLady* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) != TEXT_STATE_DONE) || !Message_ShouldAdvance(play)) { return; } osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); @@ -468,34 +466,33 @@ void func_80ABAC84(EnNiwLady* this, GlobalContext* globalCtx) { } } -void func_80ABAD38(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABAD38(EnNiwLady* this, PlayState* play) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 通常メッセージチェック ☆☆☆☆☆ \n" VT_RST); this->unk_262 = TEXT_STATE_DONE; this->actionFunc = func_80ABAD7C; } -void func_80ABAD7C(EnNiwLady* this, GlobalContext* globalCtx) { +void func_80ABAD7C(EnNiwLady* this, PlayState* play) { this->actor.textId = 0x503D; - if (Text_GetFaceReaction(globalCtx, 8) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 8); + if (Text_GetFaceReaction(play, 8) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 8); } - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE)) { this->unk_26E = 8; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_274 = 1; this->unk_26E = this->unk_27A + 9; this->actionFunc = func_80ABAD38; } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } -void EnNiwLady_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwLady_Update(Actor* thisx, PlayState* play) { s32 pad; EnNiwLady* this = (EnNiwLady*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor_SetFocus(thisx, 60.0f); this->unk_288.unk_18 = player->actor.world.pos; @@ -508,19 +505,19 @@ void EnNiwLady_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_276 == 0) { Math_SmoothStepToS(&this->unk_254.y, 0, 5, 3000, 0); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objectOsAnimeIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectOsAnimeIndex].segment); if (this->objectOsAnimeIndex >= 0) { if (this->unk_27E != 0) { if (this->unk_26E != 0) { this->unk_26E--; - EnNiwLady_ChoseAnimation(this, globalCtx, this->unk_26E); + EnNiwLady_ChoseAnimation(this, play, this->unk_26E); this->unk_26E = 0; } SkelAnime_Update(&this->skelAnime); } - this->objectAneIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_ANE); + this->objectAneIndex = Object_GetIndex(&play->objectCtx, OBJECT_ANE); if (this->objectAneIndex >= 0) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unusedTimer2 != 0) { this->unusedTimer2--; } @@ -535,12 +532,12 @@ void EnNiwLady_Update(Actor* thisx, GlobalContext* globalCtx) { this->unusedRandomTimer = ((s16)Rand_ZeroFloat(60.0f) + 0x14); } } - Actor_UpdateBgCheckInfo(globalCtx, thisx, 20.0f, 20.0f, 60.0f, + Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(thisx, &this->collider); if (1) {} - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } @@ -553,8 +550,7 @@ Gfx* EnNiwLady_EmptyDList(GraphicsContext* gfxCtx) { return dList; } -s32 EnNiwLady_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNiwLady* this = (EnNiwLady*)thisx; s32 pad; @@ -567,26 +563,26 @@ s32 EnNiwLady_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL } if (this->unk_275 != 0) { if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { - rot->y += (Math_SinS((globalCtx->state.frames * ((limbIndex * 0x32) + 0x814))) * 200.0f); - rot->z += (Math_CosS((globalCtx->state.frames * ((limbIndex * 0x32) + 0x940))) * 200.0f); + rot->y += (Math_SinS((play->state.frames * ((limbIndex * 0x32) + 0x814))) * 200.0f); + rot->z += (Math_CosS((play->state.frames * ((limbIndex * 0x32) + 0x940))) * 200.0f); } } return false; } -void EnNiwLady_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNiwLady_Draw(Actor* thisx, PlayState* play) { static void* sEyeTextures[] = { gCuccoLadyEyeOpenTex, gCuccoLadyEyeHalfTex, gCuccoLadyEyeClosedTex }; EnNiwLady* this = (EnNiwLady*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_niw_lady.c", 1347); + OPEN_DISPS(play->state.gfxCtx, "../z_en_niw_lady.c", 1347); if (this->unk_27E != 0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->faceState])); - gSPSegment(POLY_OPA_DISP++, 0x0C, EnNiwLady_EmptyDList(globalCtx->state.gfxCtx)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnNiwLady_OverrideLimbDraw, NULL, this); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnNiwLady_EmptyDList(play->state.gfxCtx)); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnNiwLady_OverrideLimbDraw, NULL, this); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_niw_lady.c", 1370); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_niw_lady.c", 1370); } 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 57ba86f2d7..e408028efa 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 @@ -6,7 +6,7 @@ struct EnNiwLady; -typedef void (*EnNiwLadyActionFunc)(struct EnNiwLady*, GlobalContext*); +typedef void (*EnNiwLadyActionFunc)(struct EnNiwLady*, PlayState*); typedef struct EnNiwLady { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index f529463abd..1410df35a4 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -14,13 +14,13 @@ #define FLAGS ACTOR_FLAG_4 -void EnNutsball_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNutsball_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNutsball_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNutsball_Init(Actor* thisx, PlayState* play); +void EnNutsball_Destroy(Actor* thisx, PlayState* play); +void EnNutsball_Update(Actor* thisx, PlayState* play); +void EnNutsball_Draw(Actor* thisx, PlayState* play); -void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx); -void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx); +void func_80ABBB34(EnNutsball* this, PlayState* play); +void func_80ABBBA8(EnNutsball* this, PlayState* play); const ActorInit En_Nutsball_InitVars = { ACTOR_EN_NUTSBALL, @@ -62,14 +62,14 @@ static Gfx* sDLists[] = { gDekuNutsDekuNutDL, gHintNutsNutDL, gBusinessScrubDekuNutDL, gDntJijiNutDL, gDntStageNutDL, }; -void EnNutsball_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNutsball_Init(Actor* thisx, PlayState* play) { EnNutsball* this = (EnNutsball*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 400.0f, ActorShadow_DrawCircle, 13.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIDs[this->actor.params]); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + this->objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIDs[this->actor.params]); if (this->objBankIndex < 0) { Actor_Kill(&this->actor); @@ -78,14 +78,14 @@ void EnNutsball_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnNutsball_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNutsball_Destroy(Actor* thisx, PlayState* play) { EnNutsball* this = (EnNutsball*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { +void func_80ABBB34(EnNutsball* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.objBankIndex = this->objBankIndex; this->actor.draw = EnNutsball_Draw; this->actor.shape.rot.y = 0; @@ -95,8 +95,8 @@ void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx) { } } -void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ABBBA8(EnNutsball* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3s sp4C; Vec3f sp40; @@ -132,8 +132,8 @@ void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) { sp40.y = this->actor.world.pos.y + 4; sp40.z = this->actor.world.pos.z; - EffectSsHahen_SpawnBurst(globalCtx, &sp40, 6.0f, 0, 7, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK); + EffectSsHahen_SpawnBurst(play, &sp40, 6.0f, 0, 7, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK); Actor_Kill(&this->actor); } else { if (this->timer == -300) { @@ -142,39 +142,39 @@ void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) { } } -void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNutsball_Update(Actor* thisx, PlayState* play) { EnNutsball* this = (EnNutsball*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29)) || (this->actionFunc == func_80ABBB34)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10, sCylinderInit.dim.radius, sCylinderInit.dim.height, + Actor_UpdateBgCheckInfo(play, &this->actor, 10, sCylinderInit.dim.radius, sCylinderInit.dim.height, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void EnNutsball_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNutsball_Draw(Actor* thisx, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 327); + OPEN_DISPS(play->state.gfxCtx, "../z_en_nutsball.c", 327); - func_80093D18(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_80093D18(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(thisx->home.rot.z * 9.58738e-05f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 333), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_nutsball.c", 333), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, sDLists[thisx->params]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 337); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_nutsball.c", 337); } diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h index 5c4c099284..5a59e27d96 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h @@ -6,7 +6,7 @@ struct EnNutsball; -typedef void (*EnNutsballActionFunc)(struct EnNutsball*, GlobalContext*); +typedef void (*EnNutsballActionFunc)(struct EnNutsball*, PlayState*); typedef struct EnNutsball { /* 0x0000 */ Actor actor; 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 0e5777584d..e5e03d6e2b 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -9,18 +9,18 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNwc_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNwc_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNwc_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNwc_Init(Actor* thisx, PlayState* play); +void EnNwc_Destroy(Actor* thisx, PlayState* play); +void EnNwc_Update(Actor* thisx, PlayState* play); +void EnNwc_Draw(Actor* thisx, PlayState* play); void EnNwc_SetUpdate(EnNwc* this, EnNwcUpdateFunc updateFunc); -void EnNwc_ChickNoop(EnNwcChick* chick, EnNwc* this, GlobalContext* globalCtx); -void EnNwc_ChickBgCheck(EnNwcChick* chick, GlobalContext* globalCtx); -void EnNwc_ChickFall(EnNwcChick* chick, EnNwc* this, GlobalContext* globalCtx); -void EnNwc_UpdateChicks(EnNwc* this, GlobalContext* globalCtx); -void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx); -void EnNwc_Idle(EnNwc* this, GlobalContext* globalCtx); +void EnNwc_ChickNoop(EnNwcChick* chick, EnNwc* this, PlayState* play); +void EnNwc_ChickBgCheck(EnNwcChick* chick, PlayState* play); +void EnNwc_ChickFall(EnNwcChick* chick, EnNwc* this, PlayState* play); +void EnNwc_UpdateChicks(EnNwc* this, PlayState* play); +void EnNwc_DrawChicks(EnNwc* this, PlayState* play); +void EnNwc_Idle(EnNwc* this, PlayState* play); #define CHICK_BG_FLOOR (1 << 0) #define CHICK_BG_WALL (1 << 1) @@ -70,10 +70,10 @@ void EnNwc_SetUpdate(EnNwc* this, EnNwcUpdateFunc updateFunc) { this->updateFunc = updateFunc; } -void EnNwc_ChickNoop(EnNwcChick* chick, EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_ChickNoop(EnNwcChick* chick, EnNwc* this, PlayState* play) { } -void EnNwc_ChickBgCheck(EnNwcChick* chick, GlobalContext* globalCtx) { +void EnNwc_ChickBgCheck(EnNwcChick* chick, PlayState* play) { CollisionPoly* outPoly; s32 bgId; Vec3f outPos; @@ -83,14 +83,14 @@ void EnNwc_ChickBgCheck(EnNwcChick* chick, GlobalContext* globalCtx) { outPos.x = chick->pos.x; outPos.y = chick->pos.y; outPos.z = chick->pos.z; - if (BgCheck_EntitySphVsWall1(&globalCtx->colCtx, &outPos, &chick->pos, &chick->lastPos, 10.0f, &chick->floorPoly, + if (BgCheck_EntitySphVsWall1(&play->colCtx, &outPos, &chick->pos, &chick->lastPos, 10.0f, &chick->floorPoly, 20.0f)) { chick->bgFlags |= CHICK_BG_WALL; } //! @bug The use of outPos here is totally wrong. Even if it didn't get overwritten // by the wall check, it should add an offset to the y-value so the raycast // doesn't go through the floor and cause the chicks to ignore all floors. - chick->floorY = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &outPoly, &bgId, &outPos); + chick->floorY = BgCheck_EntityRaycastFloor3(&play->colCtx, &outPoly, &bgId, &outPos); dy = chick->floorY - chick->pos.y; if ((0.0f <= dy) && (dy < 40.0f)) { chick->pos.y = chick->floorY; @@ -98,17 +98,17 @@ void EnNwc_ChickBgCheck(EnNwcChick* chick, GlobalContext* globalCtx) { } } -void EnNwc_ChickFall(EnNwcChick* chick, EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_ChickFall(EnNwcChick* chick, EnNwc* this, PlayState* play) { chick->velY -= 0.1f; if (chick->velY < -10.0f) { chick->velY = -10.0f; } chick->pos.y += chick->velY; - EnNwc_ChickBgCheck(chick, globalCtx); + EnNwc_ChickBgCheck(chick, play); if (chick) {} // Needed for matching. Possibly from remnant of unfinished code? } -void EnNwc_UpdateChicks(EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_UpdateChicks(EnNwc* this, PlayState* play) { static EnNwcChickFunc chickActionFuncs[] = { EnNwc_ChickNoop, EnNwc_ChickFall }; EnNwcChick* chick = this->chicks; ColliderJntSphElement* element = this->collider.elements; @@ -120,7 +120,7 @@ void EnNwc_UpdateChicks(EnNwc* this, GlobalContext* globalCtx) { for (i = 0; i < this->count; i++, prevChickPos = chick->pos, chick++, element++) { Math_Vec3f_Copy(&chick->lastPos, &chick->pos); - chickActionFuncs[chick->type](chick, this, globalCtx); + chickActionFuncs[chick->type](chick, this, play); element->dim.worldSphere.center.x = chick->pos.x; element->dim.worldSphere.center.y = chick->pos.y; @@ -145,7 +145,7 @@ void EnNwc_UpdateChicks(EnNwc* this, GlobalContext* globalCtx) { } } -void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_DrawChicks(EnNwc* this, PlayState* play) { s32 i; Gfx* dList1; Gfx* dList2; @@ -153,8 +153,8 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { MtxF floorMat; EnNwcChick* chick; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_nwc.c", 316); - func_80093C80(globalCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_nwc.c", 316); + func_80093C80(play); dList1 = POLY_XLU_DISP; dList2 = dList1 + 3 * this->count + 1; @@ -171,7 +171,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(chick->pos.x, chick->pos.y + chick->height, chick->pos.z, &chick->rot); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - mtx = Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nwc.c", 346); + mtx = Matrix_NewMtx(play->state.gfxCtx, "../z_en_nwc.c", 346); gDPSetEnvColor(dList1++, 0, 100, 255, 255); gSPMatrix(dList1++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(dList1++, gCuccoChickBodyDL); @@ -184,7 +184,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { chick = this->chicks; POLY_XLU_DISP = dList3; - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gCuccoChickSetupShadowDL); for (i = 0; i < this->count; i++, chick++) { @@ -193,15 +193,15 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { Matrix_Put(&floorMat); Matrix_RotateY(BINANG_TO_RAD(chick->rot.y), MTXMODE_APPLY); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nwc.c", 388), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_nwc.c", 388), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCuccoChickShadowDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_nwc.c", 395); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_nwc.c", 395); } -void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Init(Actor* thisx, PlayState* play) { s32 pad; EnNwc* this = (EnNwc*)thisx; ColliderJntSphElementInit elementInits[16]; @@ -214,8 +214,8 @@ void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { *element = sJntSphElementInit; } - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSphAllocType1(globalCtx, &this->collider, &this->actor, &sJntSphInit); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSphAllocType1(play, &this->collider, &this->actor, &sJntSphInit); this->count = 16; chick = this->chicks; for (i = 0; i < this->count; i++, chick++) { @@ -228,28 +228,28 @@ void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { EnNwc_SetUpdate(this, EnNwc_Idle); } -void EnNwc_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnNwc* this = (EnNwc*)thisx; - Collider_FreeJntSph(globalCtx, &this->collider); + Collider_FreeJntSph(play, &this->collider); } -void EnNwc_Idle(EnNwc* this, GlobalContext* globalCtx) { - EnNwc_UpdateChicks(this, globalCtx); +void EnNwc_Idle(EnNwc* this, PlayState* play) { + EnNwc_UpdateChicks(this, play); } -void EnNwc_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Update(Actor* thisx, PlayState* play) { s32 pad; EnNwc* this = (EnNwc*)thisx; - this->updateFunc(this, globalCtx); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + this->updateFunc(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void EnNwc_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Draw(Actor* thisx, PlayState* play) { s32 pad; EnNwc* this = (EnNwc*)thisx; - EnNwc_DrawChicks(this, globalCtx); + EnNwc_DrawChicks(this, play); } diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h index dc8fee3023..e927cb3b66 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h @@ -7,8 +7,8 @@ struct EnNwc; struct EnNwcChick; -typedef void (*EnNwcUpdateFunc)(struct EnNwc*, GlobalContext*); -typedef void (*EnNwcChickFunc)(struct EnNwcChick*, struct EnNwc*, GlobalContext*); +typedef void (*EnNwcUpdateFunc)(struct EnNwc*, PlayState*); +typedef void (*EnNwcChickFunc)(struct EnNwcChick*, struct EnNwc*, PlayState*); typedef struct EnNwcChick { /* 0x00 */ s8 type; diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/src/overlays/actors/ovl_En_Ny/z_en_ny.c index 428456afbb..4fa4512618 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -3,24 +3,24 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnNy_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNy_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNy_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNy_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNy_Init(Actor* thisx, PlayState* play); +void EnNy_Destroy(Actor* thisx, PlayState* play); +void EnNy_Update(Actor* thisx, PlayState* play); +void EnNy_Draw(Actor* thisx, PlayState* play); -void EnNy_UpdateUnused(Actor* thisx, GlobalContext* globalCtx); -void EnNy_Move(EnNy* this, GlobalContext* globalCtx); -void EnNy_Die(EnNy* this, GlobalContext* globalCtx); +void EnNy_UpdateUnused(Actor* thisx, PlayState* play); +void EnNy_Move(EnNy* this, PlayState* play); +void EnNy_Die(EnNy* this, PlayState* play); void func_80ABCD40(EnNy* this); void func_80ABCDBC(EnNy* this); -void EnNy_TurnToStone(EnNy* this, GlobalContext* globalCtx); -void func_80ABD11C(EnNy* this, GlobalContext* globalCtx); -void func_80ABCE50(EnNy* this, GlobalContext* globalCtx); -void func_80ABCE90(EnNy* this, GlobalContext* globalCtx); -void func_80ABCEEC(EnNy* this, GlobalContext* globalCtx); -void EnNy_UpdateDeath(Actor* thisx, GlobalContext* GlobalContext); -void EnNy_SetupDie(EnNy* this, GlobalContext* globalCtx); -void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* GlobalContext); +void EnNy_TurnToStone(EnNy* this, PlayState* play); +void func_80ABD11C(EnNy* this, PlayState* play); +void func_80ABCE50(EnNy* this, PlayState* play); +void func_80ABCE90(EnNy* this, PlayState* play); +void func_80ABCEEC(EnNy* this, PlayState* play); +void EnNy_UpdateDeath(Actor* thisx, PlayState* play); +void EnNy_SetupDie(EnNy* this, PlayState* play); +void EnNy_DrawDeathEffect(Actor* thisx, PlayState* play); void func_80ABD3B8(EnNy* this, f32, f32); const ActorInit En_Ny_InitVars = { @@ -103,14 +103,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void EnNy_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_Init(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 2; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderInit, this->elements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, this->elements); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); this->unk_1CA = 0; this->unk_1D0 = 0; @@ -144,9 +144,9 @@ void EnNy_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnNy_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_Destroy(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_80ABCD40(EnNy* this) { @@ -187,13 +187,13 @@ void func_80ABCE38(EnNy* this) { this->actionFunc = func_80ABD11C; } -void func_80ABCE50(EnNy* this, GlobalContext* globalCtx) { +void func_80ABCE50(EnNy* this, PlayState* play) { if (this->actor.xyzDistToPlayerSq <= SQ(160.0f)) { func_80ABCD94(this); } } -void func_80ABCE90(EnNy* this, GlobalContext* globalCtx) { +void func_80ABCE90(EnNy* this, PlayState* play) { s32 phi_v1; s32 phi_v0; @@ -208,7 +208,7 @@ void func_80ABCE90(EnNy* this, GlobalContext* globalCtx) { this->unk_1D8 = phi_v0; } -void func_80ABCEEC(EnNy* this, GlobalContext* globalCtx) { +void func_80ABCEEC(EnNy* this, PlayState* play) { f32 phi_f0; phi_f0 = this->unk_1E0; @@ -220,7 +220,7 @@ void func_80ABCEEC(EnNy* this, GlobalContext* globalCtx) { this->unk_1E0 = phi_f0; } -void EnNy_Move(EnNy* this, GlobalContext* globalCtx) { +void EnNy_Move(EnNy* this, PlayState* play) { f32 yawDiff; s32 stoneTimer; @@ -244,7 +244,7 @@ void EnNy_Move(EnNy* this, GlobalContext* globalCtx) { } } -void EnNy_TurnToStone(EnNy* this, GlobalContext* globalCtx) { +void EnNy_TurnToStone(EnNy* this, PlayState* play) { f32 phi_f0; phi_f0 = this->unk_1E0; @@ -264,7 +264,7 @@ void EnNy_TurnToStone(EnNy* this, GlobalContext* globalCtx) { this->unk_1E0 = phi_f0; } -void func_80ABD11C(EnNy* this, GlobalContext* globalCtx) { +void func_80ABD11C(EnNy* this, PlayState* play) { s32 phi_v0; s32 phi_v1; @@ -285,7 +285,7 @@ void func_80ABD11C(EnNy* this, GlobalContext* globalCtx) { this->unk_1D8 = phi_v1; } -s32 EnNy_CollisionCheck(EnNy* this, GlobalContext* globalCtx) { +s32 EnNy_CollisionCheck(EnNy* this, PlayState* play) { u8 sp3F; Vec3f effectPos; @@ -332,10 +332,10 @@ s32 EnNy_CollisionCheck(EnNy* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = 0; this->actor.flags &= ~ACTOR_FLAG_0; this->unk_1D0 = sp3F; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); return 1; } - EffectSsHitMark_SpawnFixedScale(globalCtx, 0, &effectPos); + EffectSsHitMark_SpawnFixedScale(play, 0, &effectPos); return 0; } } @@ -363,7 +363,7 @@ void func_80ABD3B8(EnNy* this, f32 arg1, f32 arg2) { } } -void EnNy_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_Update(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; f32 temp_f20; f32 temp_f22; @@ -382,14 +382,14 @@ void EnNy_Update(Actor* thisx, GlobalContext* globalCtx) { func_80ABD3B8(this, temp_f22 + 10.0f, temp_f22 - 10.0f); Actor_MoveForward(&this->actor); Math_StepToF(&this->unk_1E4, this->unk_1E8, 0.1f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.prevPos.y -= temp_f22; this->actor.world.pos.y -= temp_f22; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); this->unk_1F0 = temp_f22; this->actor.world.pos.y += temp_f22; - if (EnNy_CollisionCheck(this, globalCtx) != 0) { + if (EnNy_CollisionCheck(this, play) != 0) { for (i = 0; i < 8; i++) { this->unk_1F8[i].x = (Rand_CenteredFloat(20.0f) + this->actor.world.pos.x); this->unk_1F8[i].y = (Rand_CenteredFloat(20.0f) + this->actor.world.pos.y); @@ -402,13 +402,13 @@ void EnNy_Update(Actor* thisx, GlobalContext* globalCtx) { return; } if (this->unk_1E0 > 0.25f) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnNy_SetupDie(EnNy* this, GlobalContext* globalCtx) { +void EnNy_SetupDie(EnNy* this, PlayState* play) { s32 effectScale; s32 i; Vec3f effectPos; @@ -422,14 +422,14 @@ void EnNy_SetupDie(EnNy* this, GlobalContext* globalCtx) { effectPos.y = Rand_CenteredFloat(30.0f) + this->actor.world.pos.y; effectPos.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; effectScale = Rand_S16Offset(0x50, 0x64); - EffectSsDtBubble_SpawnColorProfile(globalCtx, &effectPos, &effectVelocity, &effectAccel, effectScale, - 25, 0, 1); + EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &effectAccel, effectScale, 25, 0, + 1); } for (i = 0; i < 0x14; i++) { effectPos.x = Rand_CenteredFloat(30.0f) + this->actor.world.pos.x; effectPos.y = Rand_CenteredFloat(30.0f) + this->actor.world.pos.y; effectPos.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; - EffectSsBubble_Spawn(globalCtx, &effectPos, 10.0f, 10.0f, 30.0f, 0.25f); + EffectSsBubble_Spawn(play, &effectPos, 10.0f, 10.0f, 30.0f, 0.25f); } } for (i = 0; i < 8; i++) { @@ -439,16 +439,16 @@ void EnNy_SetupDie(EnNy* this, GlobalContext* globalCtx) { } this->timer = 0; if (this->unk_1D0 == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xA0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xA0); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_ARROWS_SMALL); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_SMALL); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_NYU_DEAD); this->actionFunc = EnNy_Die; } } -void EnNy_Die(EnNy* this, GlobalContext* globalCtx) { +void EnNy_Die(EnNy* this, PlayState* play) { s32 i; if (this->actor.yDistToWater > 0.0f) { @@ -480,19 +480,19 @@ void EnNy_Die(EnNy* this, GlobalContext* globalCtx) { } } -void EnNy_UpdateDeath(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_UpdateDeath(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; this->timer++; if (this->unk_1CA != 0) { this->unk_1CA--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnNy_UpdateUnused(Actor* thisx, GlobalContext* globalCtx2) { +void EnNy_UpdateUnused(Actor* thisx, PlayState* play2) { EnNy* this = (EnNy*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 sp3C; f32 temp_f0; @@ -504,13 +504,13 @@ void EnNy_UpdateUnused(Actor* thisx, GlobalContext* globalCtx2) { this->actor.prevPos.y -= temp_f0; this->actor.world.pos.y -= temp_f0; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); this->unk_1F0 = temp_f0; this->actor.world.pos.y += temp_f0; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); Math_StepToF(&this->unk_1E4, this->unk_1E8, 0.1f); } @@ -521,15 +521,15 @@ static Vec3f sFireOffsets[] = { { 0.0f, 0.0f, -5.0f }, }; -void EnNy_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_Draw(Actor* thisx, PlayState* play) { s32 pad; EnNy* this = (EnNy*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ny.c", 837); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ny.c", 837); Collider_UpdateSpheres(0, &this->collider); - func_8002ED80(&this->actor, globalCtx, 1); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ny.c", 845), + func_8002ED80(&this->actor, play, 1); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ny.c", 845), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_XLU_DISP++); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2); @@ -541,13 +541,13 @@ void EnNy_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gEnNyRockBodyDL); if (this->unk_1E0 > 0.25f) { Matrix_Scale(this->unk_1E0, this->unk_1E0, this->unk_1E0, MTXMODE_APPLY); - func_8002EBCC(&this->actor, globalCtx, 1); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ny.c", 868), + func_8002EBCC(&this->actor, play, 1); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ny.c", 868), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gEnNySpikeDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ny.c", 872); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ny.c", 872); if (this->unk_1CA != 0) { Vec3f tempVec; Vec3f* fireOffset; @@ -560,19 +560,19 @@ void EnNy_Draw(Actor* thisx, GlobalContext* globalCtx) { tempVec.x = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.x + fireOffset->x); tempVec.y = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.y + fireOffset->y); tempVec.z = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.z + fireOffset->z); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &tempVec, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &tempVec, 100, 0, 0, -1); } } } -void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* globalCtx) { +void EnNy_DrawDeathEffect(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; Vec3f* temp; f32 scale; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ny.c", 900); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ny.c", 900); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0x00, 0x00, 0x00, 0xFF); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); gDPPipeSync(POLY_OPA_DISP++); @@ -582,12 +582,12 @@ void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(temp->x, temp->y, temp->z, MTXMODE_NEW); scale = this->actor.scale.x * 0.4f * (1.0f + (i * 0.04f)); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ny.c", 912), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ny.c", 912), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gEnNyRockBodyDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ny.c", 919); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ny.c", 919); if (this->unk_1CA != 0) { Vec3f tempVec; Vec3f* fireOffset; @@ -600,7 +600,7 @@ void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* globalCtx) { tempVec.x = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.x + fireOffset->x); tempVec.y = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.y + fireOffset->y); tempVec.z = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.z + fireOffset->z); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &tempVec, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &tempVec, 100, 0, 0, -1); } } } diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.h b/src/overlays/actors/ovl_En_Ny/z_en_ny.h index fd93efcdbf..18c109cc51 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.h +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.h @@ -6,7 +6,7 @@ struct EnNy; -typedef void (*EnNyActionFunc)(struct EnNy*, GlobalContext*); +typedef void (*EnNyActionFunc)(struct EnNy*, PlayState*); typedef struct EnNy { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_OE2/z_en_oe2.c b/src/overlays/actors/ovl_En_OE2/z_en_oe2.c index ef8b608b7d..9fb5598b95 100644 --- a/src/overlays/actors/ovl_En_OE2/z_en_oe2.c +++ b/src/overlays/actors/ovl_En_OE2/z_en_oe2.c @@ -8,12 +8,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnOE2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOE2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOE2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnOE2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnOE2_Init(Actor* thisx, PlayState* play); +void EnOE2_Destroy(Actor* thisx, PlayState* play); +void EnOE2_Update(Actor* thisx, PlayState* play); +void EnOE2_Draw(Actor* thisx, PlayState* play); -void EnOE2_DoNothing(EnOE2* this, GlobalContext* globalCtx); +void EnOE2_DoNothing(EnOE2* this, PlayState* play); const ActorInit En_OE2_InitVars = { ACTOR_EN_OE2, @@ -31,20 +31,20 @@ void EnOE2_SetupAction(EnOE2* this, EnOE2ActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnOE2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOE2_Init(Actor* thisx, PlayState* play) { EnOE2* this = (EnOE2*)thisx; EnOE2_SetupAction(this, EnOE2_DoNothing); } -void EnOE2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOE2_Destroy(Actor* thisx, PlayState* play) { } -void EnOE2_DoNothing(EnOE2* this, GlobalContext* globalCtx) { +void EnOE2_DoNothing(EnOE2* this, PlayState* play) { } -void EnOE2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOE2_Update(Actor* thisx, PlayState* play) { } -void EnOE2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOE2_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_OE2/z_en_oe2.h b/src/overlays/actors/ovl_En_OE2/z_en_oe2.h index b12b8a0a6f..635495bb7d 100644 --- a/src/overlays/actors/ovl_En_OE2/z_en_oe2.h +++ b/src/overlays/actors/ovl_En_OE2/z_en_oe2.h @@ -6,7 +6,7 @@ struct EnOE2; -typedef void (*EnOE2ActionFunc)(struct EnOE2*, GlobalContext*); +typedef void (*EnOE2ActionFunc)(struct EnOE2*, PlayState*); typedef struct EnOE2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 45684666b8..cf4fc653bb 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnOkarinaEffect_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOkarinaEffect_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOkarinaEffect_Update(Actor* thisx, GlobalContext* globalCtx); +void EnOkarinaEffect_Init(Actor* thisx, PlayState* play); +void EnOkarinaEffect_Destroy(Actor* thisx, PlayState* play); +void EnOkarinaEffect_Update(Actor* thisx, PlayState* play); -void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, GlobalContext* globalCtx); -void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx); +void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, PlayState* play); +void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, PlayState* play); const ActorInit En_Okarina_Effect_InitVars = { ACTOR_EN_OKARINA_EFFECT, @@ -32,56 +32,56 @@ void EnOkarinaEffect_SetupAction(EnOkarinaEffect* this, EnOkarinaEffectActionFun this->actionFunc = actionFunc; } -void EnOkarinaEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaEffect_Destroy(Actor* thisx, PlayState* play) { EnOkarinaEffect* this = (EnOkarinaEffect*)thisx; - globalCtx->envCtx.precipitation[PRECIP_SOS_MAX] = 0; + play->envCtx.precipitation[PRECIP_SOS_MAX] = 0; if ((gWeatherMode != WEATHER_MODE_RAIN) && (gWeatherMode != WEATHER_MODE_HEAVY_RAIN) && - (globalCtx->envCtx.stormRequest == STORM_REQUEST_START)) { - globalCtx->envCtx.stormRequest = STORM_REQUEST_STOP; - Environment_StopStormNatureAmbience(globalCtx); + (play->envCtx.stormRequest == STORM_REQUEST_START)) { + play->envCtx.stormRequest = STORM_REQUEST_STOP; + Environment_StopStormNatureAmbience(play); } - globalCtx->envCtx.lightningState = LIGHTNING_LAST; + play->envCtx.lightningState = LIGHTNING_LAST; } -void EnOkarinaEffect_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaEffect_Init(Actor* thisx, PlayState* play) { EnOkarinaEffect* this = (EnOkarinaEffect*)thisx; osSyncPrintf("\n\n"); // "Ocarina Storm Effect" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ オカリナあらし効果ビカビカビカ〜 ☆☆☆☆☆ \n" VT_RST); osSyncPrintf("\n\n"); - if (globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR] != 0) { + if (play->envCtx.precipitation[PRECIP_RAIN_CUR] != 0) { Actor_Kill(&this->actor); } EnOkarinaEffect_SetupAction(this, EnOkarinaEffect_TriggerStorm); } -void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, GlobalContext* globalCtx) { +void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, PlayState* play) { this->timer = 400; // 20 seconds - globalCtx->envCtx.precipitation[PRECIP_SOS_MAX] = 20; - globalCtx->envCtx.stormRequest = STORM_REQUEST_START; - if ((gWeatherMode != WEATHER_MODE_CLEAR) || globalCtx->envCtx.skyboxConfig != 0) { - globalCtx->envCtx.stormState = STORM_STATE_ON; + play->envCtx.precipitation[PRECIP_SOS_MAX] = 20; + play->envCtx.stormRequest = STORM_REQUEST_START; + if ((gWeatherMode != WEATHER_MODE_CLEAR) || play->envCtx.skyboxConfig != 0) { + play->envCtx.stormState = STORM_STATE_ON; } - globalCtx->envCtx.lightningState = LIGHTNING_ON; - Environment_PlayStormNatureAmbience(globalCtx); + play->envCtx.lightningState = LIGHTNING_ON; + Environment_PlayStormNatureAmbience(play); EnOkarinaEffect_SetupAction(this, EnOkarinaEffect_ManageStorm); } -void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx) { - Flags_UnsetEnv(globalCtx, 5); // clear storms env flag - if (((globalCtx->pauseCtx.state == 0) && (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && - (globalCtx->msgCtx.msgLength == 0) && (!FrameAdvance_IsEnabled(globalCtx)) && - ((globalCtx->transitionMode == TRANS_MODE_OFF) || (gSaveContext.gameMode != 0))) || +void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, PlayState* play) { + Flags_UnsetEnv(play, 5); // clear storms env flag + if (((play->pauseCtx.state == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + (play->msgCtx.msgLength == 0) && (!FrameAdvance_IsEnabled(play)) && + ((play->transitionMode == TRANS_MODE_OFF) || (gSaveContext.gameMode != 0))) || (this->timer >= 250)) { - if ((globalCtx->envCtx.lightMode != LIGHT_MODE_TIME) || globalCtx->envCtx.lightConfig != 1) { + if ((play->envCtx.lightMode != LIGHT_MODE_TIME) || play->envCtx.lightConfig != 1) { this->timer--; } osSyncPrintf("\nthis->timer=[%d]", this->timer); if (this->timer == 308) { osSyncPrintf("\n\n\n豆よ のびろ 指定\n\n\n"); // "Let's grow some beans" - Flags_SetEnv(globalCtx, 5); // set storms env flag + Flags_SetEnv(play, 5); // set storms env flag } } @@ -90,33 +90,33 @@ void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx } if (this->timer == 0) { - globalCtx->envCtx.precipitation[PRECIP_SOS_MAX] = 0; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { - Environment_StopStormNatureAmbience(globalCtx); + play->envCtx.precipitation[PRECIP_SOS_MAX] = 0; + if (play->csCtx.state == CS_STATE_IDLE) { + Environment_StopStormNatureAmbience(play); } else if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) { Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 0); Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0); } osSyncPrintf("\n\n\nE_wether_flg=[%d]", gWeatherMode); - osSyncPrintf("\nrain_evt_trg=[%d]\n\n", globalCtx->envCtx.stormRequest); - if (gWeatherMode == WEATHER_MODE_CLEAR && (globalCtx->envCtx.stormRequest == STORM_REQUEST_START)) { - globalCtx->envCtx.stormRequest = STORM_REQUEST_STOP; + osSyncPrintf("\nrain_evt_trg=[%d]\n\n", play->envCtx.stormRequest); + if (gWeatherMode == WEATHER_MODE_CLEAR && (play->envCtx.stormRequest == STORM_REQUEST_START)) { + play->envCtx.stormRequest = STORM_REQUEST_STOP; } else { - globalCtx->envCtx.stormRequest = STORM_REQUEST_NONE; - globalCtx->envCtx.stormState = STORM_STATE_OFF; + play->envCtx.stormRequest = STORM_REQUEST_NONE; + play->envCtx.stormState = STORM_STATE_OFF; } - globalCtx->envCtx.lightningState = LIGHTNING_LAST; + play->envCtx.lightningState = LIGHTNING_LAST; Actor_Kill(&this->actor); } } -void EnOkarinaEffect_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaEffect_Update(Actor* thisx, PlayState* play) { EnOkarinaEffect* this = (EnOkarinaEffect*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (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, 0xFF, 0, 0xFF, 0xFF, 4, globalCtx->state.gfxCtx); + 1.0f, 0xFF, 0, 0xFF, 0xFF, 4, play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h index 8320217117..f45c4a88ee 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h @@ -6,7 +6,7 @@ struct EnOkarinaEffect; -typedef void (*EnOkarinaEffectActionFunc)(struct EnOkarinaEffect*, GlobalContext*); +typedef void (*EnOkarinaEffectActionFunc)(struct EnOkarinaEffect*, PlayState*); typedef struct EnOkarinaEffect { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index fe040d2d40..dcc1747c75 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -11,16 +11,16 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnOkarinaTag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOkarinaTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOkarinaTag_Update(Actor* thisx, GlobalContext* globalCtx); +void EnOkarinaTag_Init(Actor* thisx, PlayState* play); +void EnOkarinaTag_Destroy(Actor* thisx, PlayState* play); +void EnOkarinaTag_Update(Actor* thisx, PlayState* play); -void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx); -void func_80ABF708(EnOkarinaTag* this, GlobalContext* globalCtx); -void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx); -void func_80ABF0CC(EnOkarinaTag* this, GlobalContext* globalCtx); -void func_80ABF4C8(EnOkarinaTag* this, GlobalContext* globalCtx); -void func_80ABF7CC(EnOkarinaTag* this, GlobalContext* globalCtx); +void func_80ABEF2C(EnOkarinaTag* this, PlayState* play); +void func_80ABF708(EnOkarinaTag* this, PlayState* play); +void func_80ABF28C(EnOkarinaTag* this, PlayState* play); +void func_80ABF0CC(EnOkarinaTag* this, PlayState* play); +void func_80ABF4C8(EnOkarinaTag* this, PlayState* play); +void func_80ABF7CC(EnOkarinaTag* this, PlayState* play); const ActorInit En_Okarina_Tag_InitVars = { ACTOR_EN_OKARINA_TAG, @@ -37,10 +37,10 @@ const ActorInit En_Okarina_Tag_InitVars = { extern CutsceneData D_80ABF9D0[]; extern CutsceneData D_80ABFB40[]; -void EnOkarinaTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaTag_Destroy(Actor* thisx, PlayState* play) { } -void EnOkarinaTag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaTag_Init(Actor* thisx, PlayState* play) { EnOkarinaTag* this = (EnOkarinaTag*)thisx; osSyncPrintf("\n\n"); @@ -76,7 +76,7 @@ void EnOkarinaTag_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 当り?\t\t ☆☆☆☆☆ %d\n" VT_RST, this->unk_158); osSyncPrintf("\n\n"); - if ((this->switchFlag >= 0) && (Flags_GetSwitch(globalCtx, this->switchFlag))) { + if ((this->switchFlag >= 0) && (Flags_GetSwitch(play, this->switchFlag))) { Actor_Kill(&this->actor); } else { switch (this->type) { @@ -104,13 +104,13 @@ void EnOkarinaTag_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx) { +void func_80ABEF2C(EnOkarinaTag* this, PlayState* play) { Player* player; u16 ocarinaSong; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->unk_15A++; - if ((this->switchFlag >= 0) && (Flags_GetSwitch(globalCtx, this->switchFlag))) { + if ((this->switchFlag >= 0) && (Flags_GetSwitch(play, this->switchFlag))) { this->actor.flags &= ~ACTOR_FLAG_0; } else { if ((this->ocarinaSong != 6) || (gSaveContext.scarecrowSpawnSongSet)) { @@ -126,7 +126,7 @@ void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx) { ocarinaSong = 0xA; } player->stateFlags2 |= PLAYER_STATE2_23; - func_8010BD58(globalCtx, ocarinaSong + OCARINA_ACTION_CHECK_SARIA); + func_8010BD58(play, ocarinaSong + OCARINA_ACTION_CHECK_SARIA); this->actionFunc = func_80ABF0CC; } else if ((this->actor.xzDistToPlayer < (50.0f + this->interactRange) && ((fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 40.0f)))) { @@ -138,58 +138,55 @@ void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx) { } } -void func_80ABF0CC(EnOkarinaTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ABF0CC(EnOkarinaTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { this->actionFunc = func_80ABEF2C; } else { - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } - if (globalCtx->sceneNum == SCENE_MIZUSIN) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if (play->sceneNum == SCENE_MIZUSIN) { + play->msgCtx.msgMode = MSGMODE_PAUSED; } - if ((globalCtx->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (globalCtx->sceneNum != SCENE_YOUSEI_IZUMI_YOKO)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + if ((play->sceneNum != SCENE_DAIYOUSEI_IZUMI) && (play->sceneNum != SCENE_YOUSEI_IZUMI_YOKO)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; } func_80078884(NA_SE_SY_CORRECT_CHIME); this->actionFunc = func_80ABEF2C; return; } if (this->unk_158 != 0) { - if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_05) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_06) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_07) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_08) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_09) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_0A) || - (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_0D)) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_05) || (play->msgCtx.ocarinaMode == OCARINA_MODE_06) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_07) || (play->msgCtx.ocarinaMode == OCARINA_MODE_08) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_09) || (play->msgCtx.ocarinaMode == OCARINA_MODE_0A) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_0D)) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; func_80078884(NA_SE_SY_CORRECT_CHIME); this->actionFunc = func_80ABEF2C; return; } } - if ((globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05) && (globalCtx->msgCtx.ocarinaMode < OCARINA_MODE_0E)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + if ((play->msgCtx.ocarinaMode >= OCARINA_MODE_05) && (play->msgCtx.ocarinaMode < OCARINA_MODE_0E)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; this->actionFunc = func_80ABEF2C; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { player->stateFlags2 |= PLAYER_STATE2_23; } } } -void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ABF28C(EnOkarinaTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_15A++; if ((this->ocarinaSong != 6) || (gSaveContext.scarecrowSpawnSongSet)) { - if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { this->actor.flags &= ~ACTOR_FLAG_0; } else if (((this->type != 4) || !GET_EVENTCHKINF(EVENTCHKINF_4B)) && ((this->type != 6) || !GET_EVENTCHKINF(EVENTCHKINF_1D)) && @@ -198,16 +195,16 @@ void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx) { if (player->stateFlags2 & PLAYER_STATE2_24) { switch (this->type) { case 1: - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_LULLABY); + func_8010BD58(play, OCARINA_ACTION_CHECK_LULLABY); break; case 2: - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_STORMS); + func_8010BD58(play, OCARINA_ACTION_CHECK_STORMS); break; case 4: - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_TIME); + func_8010BD58(play, OCARINA_ACTION_CHECK_TIME); break; case 6: - func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_LULLABY); + func_8010BD58(play, OCARINA_ACTION_CHECK_LULLABY); break; default: // "Ocarina Invisible-kun demo start check error source" @@ -227,33 +224,33 @@ void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx) { } } -void func_80ABF4C8(EnOkarinaTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ABF4C8(EnOkarinaTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { this->actionFunc = func_80ABF28C; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { func_80078884(NA_SE_SY_CORRECT_CHIME); if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } switch (this->type) { case 1: - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); SET_EVENTCHKINF(EVENTCHKINF_39); break; case 2: - globalCtx->csCtx.segment = D_80ABF9D0; + play->csCtx.segment = D_80ABF9D0; gSaveContext.cutsceneTrigger = 1; func_800F574C(1.18921f, 0x5A); break; case 4: - globalCtx->csCtx.segment = D_80ABFB40; + play->csCtx.segment = D_80ABFB40; gSaveContext.cutsceneTrigger = 1; break; case 6: - globalCtx->csCtx.segment = LINK_IS_ADULT ? SEGMENTED_TO_VIRTUAL(&spot02_scene_Cs_003C80) - : SEGMENTED_TO_VIRTUAL(&spot02_scene_Cs_005020); + play->csCtx.segment = LINK_IS_ADULT ? SEGMENTED_TO_VIRTUAL(&spot02_scene_Cs_003C80) + : SEGMENTED_TO_VIRTUAL(&spot02_scene_Cs_005020); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_1D); func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -261,27 +258,27 @@ void func_80ABF4C8(EnOkarinaTag* this, GlobalContext* globalCtx) { default: break; } - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; this->actionFunc = func_80ABF28C; } else { - if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05) { - if (globalCtx->msgCtx.ocarinaMode < OCARINA_MODE_0E) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + if (play->msgCtx.ocarinaMode >= OCARINA_MODE_05) { + if (play->msgCtx.ocarinaMode < OCARINA_MODE_0E) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; this->actionFunc = func_80ABF28C; return; } } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { player->stateFlags2 |= PLAYER_STATE2_23; } } } -void func_80ABF708(EnOkarinaTag* this, GlobalContext* globalCtx) { +void func_80ABF708(EnOkarinaTag* this, PlayState* play) { s16 yawDiff; s16 yawDiffNew; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80ABF7CC; } else { yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; @@ -293,41 +290,41 @@ void func_80ABF708(EnOkarinaTag* this, GlobalContext* globalCtx) { yawDiffNew = ABS(yawDiff); if (yawDiffNew < 0x4300) { this->unk_15A = 0; - func_8002F2CC(&this->actor, globalCtx, 70.0f); + func_8002F2CC(&this->actor, play, 70.0f); } } } } -void func_80ABF7CC(EnOkarinaTag* this, GlobalContext* globalCtx) { +void func_80ABF7CC(EnOkarinaTag* this, PlayState* play) { // "Open sesame sesame!" - osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 開けゴマゴマゴマ! ☆☆☆☆☆ %d\n" VT_RST, Message_GetState(&globalCtx->msgCtx)); + osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 開けゴマゴマゴマ! ☆☆☆☆☆ %d\n" VT_RST, Message_GetState(&play->msgCtx)); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); if (!CHECK_QUEST_ITEM(QUEST_SONG_SUN)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gSunSongGraveSunSongTeachCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gSunSongGraveSunSongTeachCs); gSaveContext.cutsceneTrigger = 1; } this->actionFunc = func_80ABF708; } } -void EnOkarinaTag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaTag_Update(Actor* thisx, PlayState* play) { EnOkarinaTag* this = (EnOkarinaTag*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (BREG(0) != 0) { if (this->unk_15A != 0) { if (!(this->unk_15A & 1)) { 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, 120, 120, 120, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 120, 120, 120, 255, 4, play->state.gfxCtx); } } else { 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, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } } } diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h index 5946f70231..1192d0cfce 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h @@ -6,7 +6,7 @@ struct EnOkarinaTag; -typedef void (*EnOkarinaTagActionFunc)(struct EnOkarinaTag*, GlobalContext*); +typedef void (*EnOkarinaTagActionFunc)(struct EnOkarinaTag*, PlayState*); typedef struct EnOkarinaTag { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 1b06a096b1..5e748a715f 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -3,21 +3,21 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOkuta_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx); -void EnOkuta_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnOkuta_Init(Actor* thisx, PlayState* play); +void EnOkuta_Destroy(Actor* thisx, PlayState* play); +void EnOkuta_Update(Actor* thisx, PlayState* play); +void EnOkuta_Draw(Actor* thisx, PlayState* play); void EnOkuta_SetupWaitToAppear(EnOkuta* this); -void EnOkuta_WaitToAppear(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_Appear(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_Hide(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_WaitToDie(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx); -void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx); +void EnOkuta_WaitToAppear(EnOkuta* this, PlayState* play); +void EnOkuta_Appear(EnOkuta* this, PlayState* play); +void EnOkuta_Hide(EnOkuta* this, PlayState* play); +void EnOkuta_WaitToShoot(EnOkuta* this, PlayState* play); +void EnOkuta_Shoot(EnOkuta* this, PlayState* play); +void EnOkuta_WaitToDie(EnOkuta* this, PlayState* play); +void EnOkuta_Die(EnOkuta* this, PlayState* play); +void EnOkuta_Freeze(EnOkuta* this, PlayState* play); +void EnOkuta_ProjectileFly(EnOkuta* this, PlayState* play); const ActorInit En_Okuta_InitVars = { ACTOR_EN_OKUTA, @@ -113,7 +113,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 6500, ICHAIN_STOP), }; -void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOkuta_Init(Actor* thisx, PlayState* play) { EnOkuta* this = (EnOkuta*)thisx; s32 pad; WaterBox* outWaterBox; @@ -124,18 +124,18 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { this->numShots = (thisx->params >> 8) & 0xFF; thisx->params &= 0xFF; if (thisx->params == 0) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gOctorokSkel, &gOctorokAppearAnim, this->jointTable, - this->morphTable, 38); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sOctorockColliderInit); + SkelAnime_Init(play, &this->skelAnime, &gOctorokSkel, &gOctorokAppearAnim, this->jointTable, this->morphTable, + 38); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sOctorockColliderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); if ((this->numShots == 0xFF) || (this->numShots == 0)) { this->numShots = 1; } thisx->floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &thisx->floorPoly, &floorBgId, thisx, &thisx->world.pos); + BgCheck_EntityRaycastFloor4(&play->colCtx, &thisx->floorPoly, &floorBgId, thisx, &thisx->world.pos); //! @bug calls WaterBox_GetSurfaceImpl directly - if (!WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, thisx->world.pos.x, thisx->world.pos.z, &ySurface, + if (!WaterBox_GetSurfaceImpl(play, &play->colCtx, thisx->world.pos.x, thisx->world.pos.z, &ySurface, &outWaterBox) || (ySurface <= thisx->floorHeight)) { Actor_Kill(thisx); @@ -147,9 +147,9 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&thisx->shape, 1100.0f, ActorShadow_DrawCircle, 18.0f); thisx->flags &= ~ACTOR_FLAG_0; thisx->flags |= ACTOR_FLAG_4; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sProjectileColliderInit); - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_PROP); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sProjectileColliderInit); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); this->timer = 30; thisx->shape.rot.y = 0; this->actionFunc = EnOkuta_ProjectileFly; @@ -157,41 +157,41 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnOkuta_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOkuta_Destroy(Actor* thisx, PlayState* play) { EnOkuta* this = (EnOkuta*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnOkuta_SpawnBubbles(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_SpawnBubbles(EnOkuta* this, PlayState* play) { s32 i; for (i = 0; i < 10; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, -10.0f, 10.0f, 30.0f, 0.25f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, -10.0f, 10.0f, 30.0f, 0.25f); } } -void EnOkuta_SpawnDust(Vec3f* pos, Vec3f* velocity, s16 scaleStep, GlobalContext* globalCtx) { +void EnOkuta_SpawnDust(Vec3f* pos, Vec3f* velocity, s16 scaleStep, PlayState* play) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 255 }; static Color_RGBA8 envColor = { 150, 150, 150, 255 }; - func_8002829C(globalCtx, pos, velocity, &accel, &primColor, &envColor, 0x190, scaleStep); + func_8002829C(play, pos, velocity, &accel, &primColor, &envColor, 0x190, scaleStep); } -void EnOkuta_SpawnSplash(EnOkuta* this, GlobalContext* globalCtx) { - EffectSsGSplash_Spawn(globalCtx, &this->actor.home.pos, NULL, NULL, 0, 1300); +void EnOkuta_SpawnSplash(EnOkuta* this, PlayState* play) { + EffectSsGSplash_Spawn(play, &this->actor.home.pos, NULL, NULL, 0, 1300); } -void EnOkuta_SpawnRipple(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_SpawnRipple(EnOkuta* this, PlayState* play) { Vec3f pos; pos.x = this->actor.world.pos.x; pos.y = this->actor.home.pos.y; pos.z = this->actor.world.pos.z; - if ((globalCtx->gameplayFrames % 7) == 0 && + if ((play->gameplayFrames % 7) == 0 && ((this->actionFunc != EnOkuta_Shoot) || ((this->actor.world.pos.y - this->actor.home.pos.y) < 50.0f))) { - EffectSsGRipple_Spawn(globalCtx, &pos, 250, 650, 0); + EffectSsGRipple_Spawn(play, &pos, 250, 650, 0); } } @@ -202,12 +202,12 @@ void EnOkuta_SetupWaitToAppear(EnOkuta* this) { this->actor.world.pos.y = this->actor.home.pos.y; } -void EnOkuta_SetupAppear(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_SetupAppear(EnOkuta* this, PlayState* play) { this->actor.draw = EnOkuta_Draw; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.flags |= ACTOR_FLAG_0; Animation_PlayOnce(&this->skelAnime, &gOctorokAppearAnim); - EnOkuta_SpawnBubbles(this, globalCtx); + EnOkuta_SpawnBubbles(this, play); this->actionFunc = EnOkuta_Appear; } @@ -222,7 +222,7 @@ void EnOkuta_SetupWaitToShoot(EnOkuta* this) { this->actionFunc = EnOkuta_WaitToShoot; } -void EnOkuta_SetupShoot(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_SetupShoot(EnOkuta* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gOctorokShootAnim); if (this->actionFunc != EnOkuta_Shoot) { this->timer = this->numShots; @@ -230,7 +230,7 @@ void EnOkuta_SetupShoot(EnOkuta* this, GlobalContext* globalCtx) { this->jumpHeight = this->actor.yDistToPlayer + 20.0f; this->jumpHeight = CLAMP_MIN(this->jumpHeight, 10.0f); if (this->jumpHeight > 50.0f) { - EnOkuta_SpawnSplash(this, globalCtx); + EnOkuta_SpawnSplash(this, play); } if (this->jumpHeight > 50.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_JUMP); @@ -259,7 +259,7 @@ void EnOkuta_SetupFreeze(EnOkuta* this) { this->actionFunc = EnOkuta_Freeze; } -void EnOkuta_SpawnProjectile(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_SpawnProjectile(EnOkuta* this, PlayState* play) { Vec3f pos; Vec3f velocity; f32 sinY = Math_SinS(this->actor.shape.rot.y); @@ -268,7 +268,7 @@ void EnOkuta_SpawnProjectile(EnOkuta* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + (25.0f * sinY); pos.y = this->actor.world.pos.y - 6.0f; pos.z = this->actor.world.pos.z + (25.0f * cosY); - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OKUTA, pos.x, pos.y, pos.z, this->actor.shape.rot.x, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OKUTA, pos.x, pos.y, pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 0x10) != NULL) { pos.x = this->actor.world.pos.x + (40.0f * sinY); pos.z = this->actor.world.pos.z + (40.0f * cosY); @@ -276,19 +276,19 @@ void EnOkuta_SpawnProjectile(EnOkuta* this, GlobalContext* globalCtx) { velocity.x = 1.5f * sinY; velocity.y = 0.0f; velocity.z = 1.5f * cosY; - EnOkuta_SpawnDust(&pos, &velocity, 20, globalCtx); + EnOkuta_SpawnDust(&pos, &velocity, 20, play); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW); } -void EnOkuta_WaitToAppear(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_WaitToAppear(EnOkuta* this, PlayState* play) { this->actor.world.pos.y = this->actor.home.pos.y; if ((this->actor.xzDistToPlayer < 480.0f) && (this->actor.xzDistToPlayer > 200.0f)) { - EnOkuta_SetupAppear(this, globalCtx); + EnOkuta_SetupAppear(this, play); } } -void EnOkuta_Appear(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_Appear(EnOkuta* this, PlayState* play) { s32 pad; if (SkelAnime_Update(&this->skelAnime)) { @@ -309,17 +309,17 @@ void EnOkuta_Appear(EnOkuta* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_LAND); } if (Animation_OnFrame(&this->skelAnime, 3.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { - EnOkuta_SpawnSplash(this, globalCtx); + EnOkuta_SpawnSplash(this, play); } } -void EnOkuta_Hide(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_Hide(EnOkuta* this, PlayState* play) { s32 pad; Math_ApproachF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 30.0f); if (SkelAnime_Update(&this->skelAnime)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_BUBLE); - EnOkuta_SpawnBubbles(this, globalCtx); + EnOkuta_SpawnBubbles(this, play); EnOkuta_SetupWaitToAppear(this); } else if (this->skelAnime.curFrame >= 4.0f) { Actor_SetScale(&this->actor, (6.0f - this->skelAnime.curFrame) * 0.5f * 0.01f); @@ -328,11 +328,11 @@ void EnOkuta_Hide(EnOkuta* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_SINK); } if (Animation_OnFrame(&this->skelAnime, 4.0f)) { - EnOkuta_SpawnSplash(this, globalCtx); + EnOkuta_SpawnSplash(this, play); } } -void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_WaitToShoot(EnOkuta* this, PlayState* play) { s16 yawDiff; s32 absYawDiff; @@ -352,12 +352,12 @@ void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx) { yawDiff = Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x71C, 0x38E); absYawDiff = ABS(yawDiff); if ((absYawDiff < 0x38E) && (this->timer == 0) && (this->actor.yDistToPlayer < 200.0f)) { - EnOkuta_SetupShoot(this, globalCtx); + EnOkuta_SetupShoot(this, play); } } } -void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_Shoot(EnOkuta* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x71C); if (SkelAnime_Update(&this->skelAnime)) { if (this->timer != 0) { @@ -366,7 +366,7 @@ void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) { if (this->timer == 0) { EnOkuta_SetupWaitToShoot(this); } else { - EnOkuta_SetupShoot(this, globalCtx); + EnOkuta_SetupShoot(this, play); } } else { f32 curFrame = this->skelAnime.curFrame; @@ -375,10 +375,10 @@ void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) { this->actor.world.pos.y = (sinf((0.08333f * M_PI) * curFrame) * this->jumpHeight) + this->actor.home.pos.y; } if (Animation_OnFrame(&this->skelAnime, 6.0f)) { - EnOkuta_SpawnProjectile(this, globalCtx); + EnOkuta_SpawnProjectile(this, play); } if ((this->jumpHeight > 50.0f) && Animation_OnFrame(&this->skelAnime, 13.0f)) { - EnOkuta_SpawnSplash(this, globalCtx); + EnOkuta_SpawnSplash(this, play); } if ((this->jumpHeight > 50.0f) && Animation_OnFrame(&this->skelAnime, 13.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_LAND); @@ -389,14 +389,14 @@ void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) { } } -void EnOkuta_WaitToDie(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_WaitToDie(EnOkuta* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnOkuta_SetupDie(this); } Math_ApproachF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 5.0f); } -void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_Die(EnOkuta* this, PlayState* play) { static Vec3f accel = { 0.0f, -0.5f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 255 }; static Color_RGBA8 envColor = { 150, 150, 150, 0 }; @@ -415,11 +415,11 @@ void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) { velocity.x = 0.0f; velocity.y = -0.5f; velocity.z = 0.0f; - EnOkuta_SpawnDust(&pos, &velocity, -0x14, globalCtx); + EnOkuta_SpawnDust(&pos, &velocity, -0x14, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_DEAD2); } if (Animation_OnFrame(&this->skelAnime, 15.0f)) { - EnOkuta_SpawnSplash(this, globalCtx); + EnOkuta_SpawnSplash(this, play); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_LAND); } if (this->timer < 3) { @@ -430,13 +430,13 @@ void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, (((this->timer - 5) * 0.04f) + 0.8f) * 0.01f); } else { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0005f)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_BUBLE); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x70); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_BUBLE); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x70); for (i = 0; i < 20; i++) { velocity.x = (Rand_ZeroOne() - 0.5f) * 7.0f; velocity.y = Rand_ZeroOne() * 7.0f; velocity.z = (Rand_ZeroOne() - 0.5f) * 7.0f; - EffectSsDtBubble_SpawnCustomColor(globalCtx, &this->actor.world.pos, &velocity, &accel, &primColor, + EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &velocity, &accel, &primColor, &envColor, Rand_S16Offset(100, 50), 25, 0); } Actor_Kill(&this->actor); @@ -445,7 +445,7 @@ void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) { } } -void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_Freeze(EnOkuta* this, PlayState* play) { Vec3f pos; s16 posParam; @@ -460,15 +460,15 @@ void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx) { pos.y = (this->actor.world.pos.y - 32.0f) + (8.0f * (8 - posParam)); pos.x = this->actor.world.pos.x + ((posParam & 2) ? 10.0f : -10.0f); pos.z = this->actor.world.pos.z + ((posParam & 1) ? 10.0f : -10.0f); - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.2f) + 1.9f); } Math_ApproachF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 5.0f); } -void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_ProjectileFly(EnOkuta* this, PlayState* play) { Vec3f pos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3s shieldRot; this->timer--; @@ -498,8 +498,8 @@ void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 11.0f; pos.z = this->actor.world.pos.z; - EffectSsHahen_SpawnBurst(globalCtx, &pos, 6.0f, 0, 1, 2, 15, 7, 10, gOctorokProjectileDL); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK); + EffectSsHahen_SpawnBurst(play, &pos, 6.0f, 0, 1, 2, 15, 7, 10, gOctorokProjectileDL); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK); Actor_Kill(&this->actor); } } else if (this->timer == -300) { @@ -552,12 +552,12 @@ void EnOkuta_UpdateHeadScale(EnOkuta* this) { } } -void EnOkuta_ColliderCheck(EnOkuta* this, GlobalContext* globalCtx) { +void EnOkuta_ColliderCheck(EnOkuta* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, true); if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.colChkInfo.health = 0; this->actor.flags &= ~ACTOR_FLAG_0; if (this->actor.colChkInfo.damageEffect == 3) { @@ -569,10 +569,10 @@ void EnOkuta_ColliderCheck(EnOkuta* this, GlobalContext* globalCtx) { } } -void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnOkuta_Update(Actor* thisx, PlayState* play2) { EnOkuta* this = (EnOkuta*)thisx; - GlobalContext* globalCtx = globalCtx2; - Player* player = GET_PLAYER(globalCtx); + PlayState* play = play2; + Player* player = GET_PLAYER(play); WaterBox* outWaterBox; f32 ySurface; Vec3f prevPos; @@ -580,9 +580,9 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29))) { if (this->actor.params == 0) { - EnOkuta_ColliderCheck(this, globalCtx); - if (!WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, - this->actor.world.pos.z, &ySurface, &outWaterBox) || + EnOkuta_ColliderCheck(this, play); + if (!WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + &ySurface, &outWaterBox) || (ySurface < this->actor.floorHeight)) { if (this->actor.colChkInfo.health != 0) { Actor_Kill(&this->actor); @@ -592,7 +592,7 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.home.pos.y = ySurface; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params == 0) { EnOkuta_UpdateHeadScale(this); this->collider.dim.height = @@ -602,15 +602,15 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { canRestorePrevPos = false; Actor_MoveForward(&this->actor); Math_Vec3f_Copy(&prevPos, &this->actor.world.pos); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 30.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && - SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { + SurfaceType_IsIgnoredByProjectiles(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { canRestorePrevPos = true; this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { + SurfaceType_IsIgnoredByProjectiles(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { canRestorePrevPos = true; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } @@ -625,18 +625,18 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { } if (this->actor.params == 0x10) { this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnOkuta_WaitToAppear) { if ((this->actionFunc != EnOkuta_Die) && (this->actionFunc != EnOkuta_WaitToDie) && (this->actionFunc != EnOkuta_Freeze)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, 15.0f); if ((this->actor.params == 0) && (this->actor.draw != NULL)) { - EnOkuta_SpawnRipple(this, globalCtx); + EnOkuta_SpawnRipple(this, play); } } } @@ -677,8 +677,7 @@ s32 EnOkuta_GetSnoutScale(EnOkuta* this, f32 curFrame, Vec3f* scale) { return true; } -s32 EnOkuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnOkuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnOkuta* this = (EnOkuta*)thisx; f32 curFrame = this->skelAnime.curFrame; Vec3f scale; @@ -701,24 +700,24 @@ s32 EnOkuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnOkuta_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOkuta_Draw(Actor* thisx, PlayState* play) { EnOkuta* this = (EnOkuta*)thisx; s32 pad; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->actor.params == 0) { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnOkuta_OverrideLimbDraw, - NULL, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnOkuta_OverrideLimbDraw, NULL, + this); } else { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_okuta.c", 1653); + OPEN_DISPS(play->state.gfxCtx, "../z_en_okuta.c", 1653); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD(this->actor.home.rot.z), MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_okuta.c", 1657), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_okuta.c", 1657), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gOctorokProjectileDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_okuta.c", 1662); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_okuta.c", 1662); } } diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h index 88beeaa1aa..01c2ba1140 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h @@ -6,7 +6,7 @@ struct EnOkuta; -typedef void (*EnOkutaActionFunc)(struct EnOkuta*, GlobalContext*); +typedef void (*EnOkutaActionFunc)(struct EnOkuta*, PlayState*); typedef struct EnOkuta { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index c1c3000c69..0bf26c1852 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -16,29 +16,29 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawKokiriShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawPotionShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawBombchuShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawBazaarShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawZoraShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawGoronShopkeeper(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_DrawHappyMaskShopkeeper(Actor* thisx, GlobalContext* globalCtx); +void EnOssan_Init(Actor* thisx, PlayState* play); +void EnOssan_Destroy(Actor* thisx, PlayState* play); +void EnOssan_Update(Actor* thisx, PlayState* play); +void EnOssan_DrawKokiriShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawPotionShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawBombchuShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawBazaarShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawZoraShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawGoronShopkeeper(Actor* thisx, PlayState* play); +void EnOssan_DrawHappyMaskShopkeeper(Actor* thisx, PlayState* play); -void EnOssan_InitActionFunc(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_MainActionFunc(EnOssan* this, GlobalContext* globalCtx); +void EnOssan_InitActionFunc(EnOssan* this, PlayState* play); +void EnOssan_MainActionFunc(EnOssan* this, PlayState* play); -void EnOssan_TalkDefaultShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkKokiriShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkKakarikoPotionShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkBombchuShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkMarketPotionShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkBazaarShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkZoraShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkGoronShopkeeper(GlobalContext* globalCtx); -void EnOssan_TalkHappyMaskShopkeeper(GlobalContext* globalCtx); +void EnOssan_TalkDefaultShopkeeper(PlayState* play); +void EnOssan_TalkKokiriShopkeeper(PlayState* play); +void EnOssan_TalkKakarikoPotionShopkeeper(PlayState* play); +void EnOssan_TalkBombchuShopkeeper(PlayState* play); +void EnOssan_TalkMarketPotionShopkeeper(PlayState* play); +void EnOssan_TalkBazaarShopkeeper(PlayState* play); +void EnOssan_TalkZoraShopkeeper(PlayState* play); +void EnOssan_TalkGoronShopkeeper(PlayState* play); +void EnOssan_TalkHappyMaskShopkeeper(PlayState* play); s16 ShopItemDisp_Default(s16 v); s16 ShopItemDisp_SpookyMask(s16 v); @@ -48,45 +48,45 @@ s16 ShopItemDisp_ZoraMask(s16 v); s16 ShopItemDisp_GoronMask(s16 v); s16 ShopItemDisp_GerudoMask(s16 v); -void EnOssan_InitKokiriShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitPotionShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitBombchuShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitBazaarShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitZoraShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitGoronShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_InitHappyMaskShopkeeper(EnOssan* this, GlobalContext* globalCtx); +void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitPotionShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitBombchuShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitBazaarShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitZoraShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_InitHappyMaskShopkeeper(EnOssan* this, PlayState* play); -void EnOssan_State_Idle(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_StartConversation(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_TalkingToShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_LookToLeftShelf(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_LookToRightShelf(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_LookFromShelfToShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_ItemSelected(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_SelectMilkBottle(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_SelectWeirdEgg(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_SelectUnimplementedItem(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_SelectBombs(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_CantGetItem(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_GiveItemWithFanfare(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_ItemPurchased(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_GiveLonLonMilk(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_DisplayOnlyBombDialog(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_WaitForDisplayOnlyBombDialog(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_21(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_22(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_QuickBuyDialog(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_SelectMaskItem(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_LendMaskOfTruth(EnOssan* this, GlobalContext* globalCtx, Player* player); -void EnOssan_State_GiveDiscountDialog(EnOssan* this, GlobalContext* globalCtx, Player* player); +void EnOssan_State_Idle(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_StartConversation(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_FacingShopkeeper(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_TalkingToShopkeeper(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_LookToLeftShelf(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_LookToRightShelf(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_BrowseLeftShelf(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_BrowseRightShelf(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_LookFromShelfToShopkeeper(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_ItemSelected(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_SelectMilkBottle(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_SelectWeirdEgg(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_SelectUnimplementedItem(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_SelectBombs(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_CantGetItem(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_GiveItemWithFanfare(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_ItemPurchased(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_GiveLonLonMilk(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_DisplayOnlyBombDialog(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_WaitForDisplayOnlyBombDialog(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_21(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_22(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_QuickBuyDialog(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_SelectMaskItem(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_LendMaskOfTruth(EnOssan* this, PlayState* play, Player* player); +void EnOssan_State_GiveDiscountDialog(EnOssan* this, PlayState* play, Player* player); -void EnOssan_Obj3ToSeg6(EnOssan* this, GlobalContext* globalCtx); +void EnOssan_Obj3ToSeg6(EnOssan* this, PlayState* play); -void EnOssan_StartShopping(GlobalContext* globalCtx, EnOssan* this); +void EnOssan_StartShopping(PlayState* play, EnOssan* this); void EnOssan_WaitForBlink(EnOssan* this); void EnOssan_Blink(EnOssan* this); @@ -96,7 +96,7 @@ u16 EnOssan_SetupHelloDialog(EnOssan* this); s32 EnOssan_TakeItemOffShelf(EnOssan* this); s32 EnOssan_ReturnItemToShelf(EnOssan* this); void EnOssan_ResetItemPosition(EnOssan* this); -void EnOssan_SetStateGiveDiscountDialog(GlobalContext* globalCtx, EnOssan* this); +void EnOssan_SetStateGiveDiscountDialog(PlayState* play, EnOssan* this); #define CURSOR_INVALID 0xFF @@ -416,7 +416,7 @@ s16 ShopItemDisp_GerudoMask(s16 v) { return -1; } -void EnOssan_SpawnItemsOnShelves(EnOssan* this, GlobalContext* globalCtx, ShopItem* shopItems) { +void EnOssan_SpawnItemsOnShelves(EnOssan* this, PlayState* play, ShopItem* shopItems) { EnTana* shelves; s16 itemParams; s32 i; @@ -432,7 +432,7 @@ void EnOssan_SpawnItemsOnShelves(EnOssan* this, GlobalContext* globalCtx, ShopIt } else { shelves = this->shelves; this->shelfSlots[i] = (EnGirlA*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_GIRLA, shelves->actor.world.pos.x + shopItems->xOffset, + &play->actorCtx, play, ACTOR_EN_GIRLA, shelves->actor.world.pos.x + shopItems->xOffset, shelves->actor.world.pos.y + shopItems->yOffset, shelves->actor.world.pos.z + shopItems->zOffset, shelves->actor.shape.rot.x, shelves->actor.shape.rot.y + sItemShelfRot[i], shelves->actor.shape.rot.z, itemParams); @@ -441,7 +441,7 @@ void EnOssan_SpawnItemsOnShelves(EnOssan* this, GlobalContext* globalCtx, ShopIt } } -void EnOssan_UpdateShopOfferings(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_UpdateShopOfferings(EnOssan* this, PlayState* play) { s32 i; ShopItem* storeItems; ShopItem* shopItem; @@ -456,8 +456,7 @@ void EnOssan_UpdateShopOfferings(EnOssan* this, GlobalContext* globalCtx) { if (params >= 0) { this->shelfSlots[i] = (EnGirlA*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_GIRLA, - this->shelves->actor.world.pos.x + shopItem->xOffset, + &play->actorCtx, play, ACTOR_EN_GIRLA, this->shelves->actor.world.pos.x + shopItem->xOffset, this->shelves->actor.world.pos.y + shopItem->yOffset, this->shelves->actor.world.pos.z + shopItem->zOffset, this->shelves->actor.shape.rot.x, this->shelves->actor.shape.rot.y + sItemShelfRot[i], this->shelves->actor.shape.rot.z, params); @@ -467,90 +466,90 @@ void EnOssan_UpdateShopOfferings(EnOssan* this, GlobalContext* globalCtx) { } } -void EnOssan_TalkDefaultShopkeeper(GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x9E); +void EnOssan_TalkDefaultShopkeeper(PlayState* play) { + Message_ContinueTextbox(play, 0x9E); } -void EnOssan_TalkKakarikoPotionShopkeeper(GlobalContext* globalCtx) { - if (globalCtx->curSpawn == 0) { - Message_ContinueTextbox(globalCtx, 0x5046); +void EnOssan_TalkKakarikoPotionShopkeeper(PlayState* play) { + if (play->curSpawn == 0) { + Message_ContinueTextbox(play, 0x5046); } else { - Message_ContinueTextbox(globalCtx, 0x504E); + Message_ContinueTextbox(play, 0x504E); } } -void EnOssan_TalkMarketPotionShopkeeper(GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x504E); +void EnOssan_TalkMarketPotionShopkeeper(PlayState* play) { + Message_ContinueTextbox(play, 0x504E); } -void EnOssan_TalkKokiriShopkeeper(GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x10BA); +void EnOssan_TalkKokiriShopkeeper(PlayState* play) { + Message_ContinueTextbox(play, 0x10BA); } -void EnOssan_TalkBazaarShopkeeper(GlobalContext* globalCtx) { - if (globalCtx->curSpawn == 0) { - Message_ContinueTextbox(globalCtx, 0x9D); +void EnOssan_TalkBazaarShopkeeper(PlayState* play) { + if (play->curSpawn == 0) { + Message_ContinueTextbox(play, 0x9D); } else { - Message_ContinueTextbox(globalCtx, 0x9C); + Message_ContinueTextbox(play, 0x9C); } } -void EnOssan_TalkBombchuShopkeeper(GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x7076); +void EnOssan_TalkBombchuShopkeeper(PlayState* play) { + Message_ContinueTextbox(play, 0x7076); } -void EnOssan_TalkZoraShopkeeper(GlobalContext* globalCtx) { +void EnOssan_TalkZoraShopkeeper(PlayState* play) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { - Message_ContinueTextbox(globalCtx, 0x403A); + Message_ContinueTextbox(play, 0x403A); } else { - Message_ContinueTextbox(globalCtx, 0x403B); + Message_ContinueTextbox(play, 0x403B); } } // Goron City, Goron -void EnOssan_TalkGoronShopkeeper(GlobalContext* globalCtx) { +void EnOssan_TalkGoronShopkeeper(PlayState* play) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { if (GET_EVENTCHKINF(EVENTCHKINF_25)) { - Message_ContinueTextbox(globalCtx, 0x3028); + Message_ContinueTextbox(play, 0x3028); } else if (CUR_UPG_VALUE(UPG_STRENGTH) != 0) { - Message_ContinueTextbox(globalCtx, 0x302D); + Message_ContinueTextbox(play, 0x302D); } else { - Message_ContinueTextbox(globalCtx, 0x300F); + Message_ContinueTextbox(play, 0x300F); } } else if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE)) { - Message_ContinueTextbox(globalCtx, 0x3057); + Message_ContinueTextbox(play, 0x3057); } else { - Message_ContinueTextbox(globalCtx, 0x305B); + Message_ContinueTextbox(play, 0x305B); } } // Happy Mask Shop -void EnOssan_TalkHappyMaskShopkeeper(GlobalContext* globalCtx) { +void EnOssan_TalkHappyMaskShopkeeper(PlayState* play) { if (GET_ITEMGETINF(ITEMGETINF_38) // Sold Keaton Mask && GET_ITEMGETINF(ITEMGETINF_39) // Sold Skull Mask && GET_ITEMGETINF(ITEMGETINF_3A) // Sold Spooky Mask && GET_ITEMGETINF(ITEMGETINF_3B)) { // Sold Bunny Hood - Message_ContinueTextbox(globalCtx, 0x70AE); + Message_ContinueTextbox(play, 0x70AE); } else { - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 1: - Message_ContinueTextbox(globalCtx, 0x70A4); + Message_ContinueTextbox(play, 0x70A4); break; case 0: - Message_ContinueTextbox(globalCtx, 0x70A3); + Message_ContinueTextbox(play, 0x70A3); break; } } } -void EnOssan_UpdateCameraDirection(EnOssan* this, GlobalContext* globalCtx, f32 cameraFaceAngle) { +void EnOssan_UpdateCameraDirection(EnOssan* this, PlayState* play, f32 cameraFaceAngle) { this->cameraFaceAngle = cameraFaceAngle; - Camera_SetCameraData(GET_ACTIVE_CAM(globalCtx), 0xC, NULL, NULL, cameraFaceAngle, 0, 0); + Camera_SetCameraData(GET_ACTIVE_CAM(play), 0xC, NULL, NULL, cameraFaceAngle, 0, 0); } -s32 EnOssan_TryGetObjBankIndices(EnOssan* this, GlobalContext* globalCtx, s16* objectIds) { +s32 EnOssan_TryGetObjBankIndices(EnOssan* this, PlayState* play, s16* objectIds) { if (objectIds[1] != OBJECT_ID_MAX) { - this->objBankIndex2 = Object_GetIndex(&globalCtx->objectCtx, objectIds[1]); + this->objBankIndex2 = Object_GetIndex(&play->objectCtx, objectIds[1]); if (this->objBankIndex2 < 0) { return false; } @@ -558,7 +557,7 @@ s32 EnOssan_TryGetObjBankIndices(EnOssan* this, GlobalContext* globalCtx, s16* o this->objBankIndex2 = -1; } if (objectIds[2] != OBJECT_ID_MAX) { - this->objBankIndex3 = Object_GetIndex(&globalCtx->objectCtx, objectIds[2]); + this->objBankIndex3 = Object_GetIndex(&play->objectCtx, objectIds[2]); if (this->objBankIndex3 < 0) { return false; } @@ -568,7 +567,7 @@ s32 EnOssan_TryGetObjBankIndices(EnOssan* this, GlobalContext* globalCtx, s16* o return true; } -void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_Init(Actor* thisx, PlayState* play) { EnOssan* this = (EnOssan*)thisx; s32 pad; s16* objectIds; @@ -605,7 +604,7 @@ void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) { } objectIds = sShopkeeperObjectIds[this->actor.params]; - this->objBankIndex1 = Object_GetIndex(&globalCtx->objectCtx, objectIds[0]); + this->objBankIndex1 = Object_GetIndex(&play->objectCtx, objectIds[0]); if (this->objBankIndex1 < 0) { Actor_Kill(&this->actor); @@ -616,7 +615,7 @@ void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - if (EnOssan_TryGetObjBankIndices(this, globalCtx, objectIds) == 0) { + if (EnOssan_TryGetObjBankIndices(this, play, objectIds) == 0) { Actor_Kill(&this->actor); osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("予備バンクが無いよ!!(%s)\n", sShopkeeperPrintName[this->actor.params]); @@ -629,124 +628,124 @@ void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) { EnOssan_SetupAction(this, EnOssan_InitActionFunc); } -void EnOssan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_Destroy(Actor* thisx, PlayState* play) { EnOssan* this = (EnOssan*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void EnOssan_UpdateCursorPos(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_UpdateCursorPos(PlayState* play, EnOssan* this) { s16 x; s16 y; - Actor_GetScreenPos(globalCtx, &this->shelfSlots[this->cursorIndex]->actor, &x, &y); + Actor_GetScreenPos(play, &this->shelfSlots[this->cursorIndex]->actor, &x, &y); this->cursorX = x; this->cursorY = y; } -void EnOssan_EndInteraction(GlobalContext* globalCtx, EnOssan* this) { - Player* player = GET_PLAYER(globalCtx); +void EnOssan_EndInteraction(PlayState* play, EnOssan* this) { + Player* player = GET_PLAYER(play); // "End of conversation!" osSyncPrintf(VT_FGCOL(YELLOW) "%s[%d]:★★★ 会話終了!! ★★★" VT_RST "\n", "../z_en_oB1.c", 1337); YREG(31) = 0; - Actor_ProcessTalkRequest(&this->actor, globalCtx); - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; - globalCtx->msgCtx.stateTimer = 4; + Actor_ProcessTalkRequest(&this->actor, play); + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~PLAYER_STATE2_29; - func_800BC490(globalCtx, 1); + func_800BC490(play, 1); Interface_ChangeAlpha(50); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; - EnOssan_UpdateCameraDirection(this, globalCtx, 0.0f); + EnOssan_UpdateCameraDirection(this, play, 0.0f); this->actor.textId = EnOssan_SetupHelloDialog(this); this->stateFlag = OSSAN_STATE_IDLE; } -s32 EnOssan_TestEndInteraction(EnOssan* this, GlobalContext* globalCtx, Input* input) { +s32 EnOssan_TestEndInteraction(EnOssan* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); return true; } else { return false; } } -s32 EnOssan_TestCancelOption(EnOssan* this, GlobalContext* globalCtx, Input* input) { +s32 EnOssan_TestCancelOption(EnOssan* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); return true; } else { return false; } } -void EnOssan_SetStateStartShopping(GlobalContext* globalCtx, EnOssan* this, u8 skipHelloState) { +void EnOssan_SetStateStartShopping(PlayState* play, EnOssan* this, u8 skipHelloState) { YREG(31) = 1; this->headRot = this->headTargetRot = 0; - Interface_SetDoAction(globalCtx, DO_ACTION_NEXT); - EnOssan_UpdateCameraDirection(this, globalCtx, 0); + Interface_SetDoAction(play, DO_ACTION_NEXT); + EnOssan_UpdateCameraDirection(this, play, 0); if (!skipHelloState) { this->stateFlag = OSSAN_STATE_START_CONVERSATION; } else { - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); } } -void EnOssan_StartShopping(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_StartShopping(PlayState* play, EnOssan* this) { this->stateFlag = OSSAN_STATE_FACING_SHOPKEEPER; if (this->actor.params == OSSAN_TYPE_MASK) { // if all masks have been sold, give the option to ask about the mask of truth if (GET_ITEMGETINF(ITEMGETINF_38) && GET_ITEMGETINF(ITEMGETINF_39) && GET_ITEMGETINF(ITEMGETINF_3A) && GET_ITEMGETINF(ITEMGETINF_3B)) { - Message_ContinueTextbox(globalCtx, 0x70AD); + Message_ContinueTextbox(play, 0x70AD); } else { - Message_ContinueTextbox(globalCtx, 0x70A2); + Message_ContinueTextbox(play, 0x70A2); } } else { - Message_ContinueTextbox(globalCtx, 0x83); + Message_ContinueTextbox(play, 0x83); } - Interface_SetDoAction(globalCtx, DO_ACTION_DECIDE); + Interface_SetDoAction(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = true; this->stickLeftPrompt.isEnabled = true; - EnOssan_UpdateCameraDirection(this, globalCtx, 0.0f); + EnOssan_UpdateCameraDirection(this, play, 0.0f); } -void EnOssan_ChooseTalkToOwner(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_ChooseTalkToOwner(PlayState* play, EnOssan* this) { this->stateFlag = OSSAN_STATE_TALKING_TO_SHOPKEEPER; - sShopkeeperTalkOwner[this->actor.params](globalCtx); - Interface_SetDoAction(globalCtx, DO_ACTION_DECIDE); + sShopkeeperTalkOwner[this->actor.params](play); + Interface_SetDoAction(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; } -void EnOssan_SetLookToShopkeeperFromShelf(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_SetLookToShopkeeperFromShelf(PlayState* play, EnOssan* this) { func_80078884(NA_SE_SY_CURSOR); this->drawCursor = 0; this->stateFlag = OSSAN_STATE_LOOK_SHOPKEEPER; } -void EnOssan_State_Idle(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_Idle(EnOssan* this, PlayState* play, Player* player) { this->headTargetRot = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { // "Start conversation!!" osSyncPrintf(VT_FGCOL(YELLOW) "★★★ 会話開始!! ★★★" VT_RST "\n"); player->stateFlags2 |= PLAYER_STATE2_29; - func_800BC590(globalCtx); - EnOssan_SetStateStartShopping(globalCtx, this, false); + func_800BC590(play); + EnOssan_SetStateStartShopping(play, this, false); } else if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100); + func_8002F2CC(&this->actor, play, 100); } } -void EnOssan_UpdateJoystickInputState(GlobalContext* globalCtx, EnOssan* this) { - Input* input = &globalCtx->state.input[0]; +void EnOssan_UpdateJoystickInputState(PlayState* play, EnOssan* this) { + Input* input = &play->state.input[0]; s8 stickX = input->rel.stick_x; s8 stickY = input->rel.stick_y; @@ -853,11 +852,11 @@ u8 EnOssan_CursorLeft(EnOssan* this, u8 cursorIndex, u8 shelfSlotMax) { } // pay salesman back -void EnOssan_TryPaybackMask(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_TryPaybackMask(EnOssan* this, PlayState* play) { s16 price = sMaskPaymentPrice[this->happyMaskShopState]; if (gSaveContext.rupees < price) { - Message_ContinueTextbox(globalCtx, 0x70A8); + Message_ContinueTextbox(play, 0x70A8); this->happyMaskShopkeeperEyeIdx = 1; this->happyMaskShopState = OSSAN_HAPPY_STATE_ANGRY; } else { @@ -865,7 +864,7 @@ void EnOssan_TryPaybackMask(EnOssan* this, GlobalContext* globalCtx) { if (this->happyMaskShopState == OSSAN_HAPPY_STATE_REQUEST_PAYMENT_BUNNY_HOOD) { SET_EVENTCHKINF(EVENTCHKINF_8F); - Message_ContinueTextbox(globalCtx, 0x70A9); + Message_ContinueTextbox(play, 0x70A9); this->happyMaskShopState = OSSAN_HAPPY_STATE_ALL_MASKS_SOLD; return; } @@ -878,80 +877,79 @@ void EnOssan_TryPaybackMask(EnOssan* this, GlobalContext* globalCtx) { SET_EVENTCHKINF(EVENTCHKINF_8D); } - Message_ContinueTextbox(globalCtx, 0x70A7); + Message_ContinueTextbox(play, 0x70A7); this->happyMaskShopState = OSSAN_HAPPY_STATE_NONE; } this->stateFlag = OSSAN_STATE_START_CONVERSATION; } -void EnOssan_State_StartConversation(EnOssan* this, GlobalContext* globalCtx, Player* player) { - u8 dialogState = Message_GetState(&globalCtx->msgCtx); +void EnOssan_State_StartConversation(EnOssan* this, PlayState* play, Player* player) { + u8 dialogState = Message_GetState(&play->msgCtx); if (this->actor.params == OSSAN_TYPE_MASK && dialogState == TEXT_STATE_CHOICE) { - if (!EnOssan_TestEndInteraction(this, globalCtx, &globalCtx->state.input[0]) && - Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (!EnOssan_TestEndInteraction(this, play, &play->state.input[0]) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); break; case 1: - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); break; } } - } else if (dialogState == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { + } else if (dialogState == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { func_80078884(NA_SE_SY_MESSAGE_PASS); switch (this->happyMaskShopState) { case OSSAN_HAPPY_STATE_ALL_MASKS_SOLD: - Message_ContinueTextbox(globalCtx, 0x70AA); + Message_ContinueTextbox(play, 0x70AA); this->stateFlag = OSSAN_STATE_LEND_MASK_OF_TRUTH; return; case OSSAN_HAPPY_STATE_BORROWED_FIRST_MASK: - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); return; case OSSAN_HAPPY_STATE_REQUEST_PAYMENT_KEATON_MASK: case OSSAN_HAPPY_STATE_REQUEST_PAYMENT_SPOOKY_MASK: case OSSAN_HAPPY_STATE_REQUEST_PAYMENT_SKULL_MASK: case OSSAN_HAPPY_STATE_REQUEST_PAYMENT_BUNNY_HOOD: - EnOssan_TryPaybackMask(this, globalCtx); + EnOssan_TryPaybackMask(this, play); return; case OSSAN_HAPPY_STATE_ANGRY: - globalCtx->nextEntranceIndex = ENTR_MARKET_DAY_9; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); + play->nextEntranceIndex = ENTR_MARKET_DAY_9; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); return; } - if (!EnOssan_TestEndInteraction(this, globalCtx, &globalCtx->state.input[0])) { + if (!EnOssan_TestEndInteraction(this, play, &play->state.input[0])) { // "Shop around by moving the stick left and right" osSyncPrintf("「スティック左右で品物みてくれ!」\n"); - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); } } if (1) {} } -s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, GlobalContext* globalCtx) { - switch (globalCtx->msgCtx.choiceIndex) { +s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, PlayState* play) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_ChooseTalkToOwner(globalCtx, this); + EnOssan_ChooseTalkToOwner(play, this); return true; case 1: - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); return true; default: return false; } } -void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_FacingShopkeeper(EnOssan* this, PlayState* play, Player* player) { u8 nextIndex; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && - !EnOssan_TestEndInteraction(this, globalCtx, &globalCtx->state.input[0])) { - if (Message_ShouldAdvance(globalCtx) && EnOssan_FacingShopkeeperDialogResult(this, globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && + !EnOssan_TestEndInteraction(this, play, &play->state.input[0])) { + if (Message_ShouldAdvance(play) && EnOssan_FacingShopkeeperDialogResult(this, play)) { func_80078884(NA_SE_SY_DECIDE); return; } @@ -961,7 +959,7 @@ void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Pla if (nextIndex != CURSOR_INVALID) { this->cursorIndex = nextIndex; this->stateFlag = OSSAN_STATE_LOOK_SHELF_LEFT; - Interface_SetDoAction(globalCtx, DO_ACTION_DECIDE); + Interface_SetDoAction(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; func_80078884(NA_SE_SY_CURSOR); } @@ -970,7 +968,7 @@ void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Pla if (nextIndex != CURSOR_INVALID) { this->cursorIndex = nextIndex; this->stateFlag = OSSAN_STATE_LOOK_SHELF_RIGHT; - Interface_SetDoAction(globalCtx, DO_ACTION_DECIDE); + Interface_SetDoAction(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = false; func_80078884(NA_SE_SY_CURSOR); } @@ -978,45 +976,45 @@ void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Pla } } -void EnOssan_State_TalkingToShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnOssan_StartShopping(globalCtx, this); +void EnOssan_State_TalkingToShopkeeper(EnOssan* this, PlayState* play, Player* player) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnOssan_StartShopping(play, this); } } -void EnOssan_State_LookToLeftShelf(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_LookToLeftShelf(EnOssan* this, PlayState* play, Player* player) { Math_ApproachF(&this->cameraFaceAngle, 30.0f, 0.5f, 10.0f); if (this->cameraFaceAngle > 29.5f) { - EnOssan_UpdateCameraDirection(this, globalCtx, 30.0f); + EnOssan_UpdateCameraDirection(this, play, 30.0f); } - EnOssan_UpdateCameraDirection(this, globalCtx, this->cameraFaceAngle); + EnOssan_UpdateCameraDirection(this, play, this->cameraFaceAngle); if (this->cameraFaceAngle >= 30.0f) { - EnOssan_UpdateCameraDirection(this, globalCtx, 30.0f); - EnOssan_UpdateCursorPos(globalCtx, this); + EnOssan_UpdateCameraDirection(this, play, 30.0f); + EnOssan_UpdateCursorPos(play, this); this->stateFlag = OSSAN_STATE_BROWSE_LEFT_SHELF; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } else { this->stickAccumX = 0; } } -void EnOssan_State_LookToRightShelf(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_LookToRightShelf(EnOssan* this, PlayState* play, Player* player) { Math_ApproachF(&this->cameraFaceAngle, -30.0f, 0.5f, 10.0f); if (this->cameraFaceAngle < -29.5f) { - EnOssan_UpdateCameraDirection(this, globalCtx, -30.0f); + EnOssan_UpdateCameraDirection(this, play, -30.0f); } - EnOssan_UpdateCameraDirection(this, globalCtx, this->cameraFaceAngle); + EnOssan_UpdateCameraDirection(this, play, this->cameraFaceAngle); if (this->cameraFaceAngle <= -30.0f) { - EnOssan_UpdateCameraDirection(this, globalCtx, -30.0f); - EnOssan_UpdateCursorPos(globalCtx, this); + EnOssan_UpdateCameraDirection(this, play, -30.0f); + EnOssan_UpdateCursorPos(play, this); this->stateFlag = OSSAN_STATE_BROWSE_RIGHT_SHELF; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } else { this->stickAccumX = 0; } @@ -1107,16 +1105,16 @@ void EnOssan_CursorUpDown(EnOssan* this) { } } -s32 EnOssan_HasPlayerSelectedItem(GlobalContext* globalCtx, EnOssan* this, Input* input) { +s32 EnOssan_HasPlayerSelectedItem(PlayState* play, EnOssan* this, Input* input) { EnGirlA* selectedItem = this->shelfSlots[this->cursorIndex]; - if (EnOssan_TestEndInteraction(this, globalCtx, input)) { + if (EnOssan_TestEndInteraction(this, play, input)) { return true; } - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (selectedItem->actor.params != SI_SOLD_OUT && selectedItem->isInvisible == 0) { this->tempStateFlag = this->stateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->itemBuyPromptTextId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->itemBuyPromptTextId); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; switch (selectedItem->actor.params) { @@ -1170,7 +1168,7 @@ s32 EnOssan_HasPlayerSelectedItem(GlobalContext* globalCtx, EnOssan* this, Input return false; } -void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_BrowseLeftShelf(EnOssan* this, PlayState* play, Player* player) { s32 a; s32 b; u8 prevIndex = this->cursorIndex; @@ -1188,16 +1186,16 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Play } this->drawCursor = 0xFF; this->stickRightPrompt.isEnabled = true; - EnOssan_UpdateCursorPos(globalCtx, this); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && - !EnOssan_HasPlayerSelectedItem(globalCtx, this, &globalCtx->state.input[0])) { + EnOssan_UpdateCursorPos(play, this); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && + !EnOssan_HasPlayerSelectedItem(play, this, &play->state.input[0])) { if (this->moveHorizontal) { if (this->stickAccumX > 0) { a = EnOssan_CursorRight(this, this->cursorIndex, 4); if (a != CURSOR_INVALID) { this->cursorIndex = a; } else { - EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetLookToShopkeeperFromShelf(play, this); return; } } else if (this->stickAccumX < 0) { @@ -1212,7 +1210,7 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Play if (c != CURSOR_INVALID) { this->cursorIndex = c; } else { - EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetLookToShopkeeperFromShelf(play, this); return; } } else if (this->stickAccumX < 0 && this->stickAccumX < -500) { @@ -1224,13 +1222,13 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Play } EnOssan_CursorUpDown(this); if (this->cursorIndex != prevIndex) { - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); func_80078884(NA_SE_SY_CURSOR); } } } -void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_BrowseRightShelf(EnOssan* this, PlayState* play, Player* player) { s32 pad[2]; u8 prevIndex; u8 nextIndex; @@ -1247,16 +1245,16 @@ void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Pla } this->drawCursor = 0xFF; this->stickLeftPrompt.isEnabled = true; - EnOssan_UpdateCursorPos(globalCtx, this); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && - !EnOssan_HasPlayerSelectedItem(globalCtx, this, &globalCtx->state.input[0])) { + EnOssan_UpdateCursorPos(play, this); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && + !EnOssan_HasPlayerSelectedItem(play, this, &play->state.input[0])) { if (this->moveHorizontal) { if (this->stickAccumX < 0) { nextIndex = EnOssan_CursorRight(this, this->cursorIndex, 0); if (nextIndex != CURSOR_INVALID) { this->cursorIndex = nextIndex; } else { - EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetLookToShopkeeperFromShelf(play, this); return; } } else if (this->stickAccumX > 0) { @@ -1271,7 +1269,7 @@ void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Pla if (nextIndex != CURSOR_INVALID) { this->cursorIndex = nextIndex; } else { - EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetLookToShopkeeperFromShelf(play, this); return; } } else if (this->stickAccumX > 0 && this->stickAccumX > 500) { @@ -1283,186 +1281,186 @@ void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Pla } EnOssan_CursorUpDown(this); if (this->cursorIndex != prevIndex) { - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); func_80078884(NA_SE_SY_CURSOR); } } } -void EnOssan_State_LookFromShelfToShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_LookFromShelfToShopkeeper(EnOssan* this, PlayState* play, Player* player) { Math_ApproachF(&this->cameraFaceAngle, 0.0f, 0.5f, 10.0f); if ((this->cameraFaceAngle < 0.5f) && (this->cameraFaceAngle > -0.5f)) { - EnOssan_UpdateCameraDirection(this, globalCtx, 0.0f); + EnOssan_UpdateCameraDirection(this, play, 0.0f); } - EnOssan_UpdateCameraDirection(this, globalCtx, this->cameraFaceAngle); + EnOssan_UpdateCameraDirection(this, play, this->cameraFaceAngle); if (this->cameraFaceAngle == 0.0f) { - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); } } -void EnOssan_State_DisplayOnlyBombDialog(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_DisplayOnlyBombDialog(EnOssan* this, PlayState* play, Player* player) { if (!EnOssan_ReturnItemToShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", "../z_en_oB1.c", 2355); return; } Math_ApproachF(&this->cameraFaceAngle, 0.0f, 0.5f, 10.0f); if (this->cameraFaceAngle < 0.5f && this->cameraFaceAngle > -0.5f) { - EnOssan_UpdateCameraDirection(this, globalCtx, 0.0f); + EnOssan_UpdateCameraDirection(this, play, 0.0f); } - EnOssan_UpdateCameraDirection(this, globalCtx, this->cameraFaceAngle); + EnOssan_UpdateCameraDirection(this, play, this->cameraFaceAngle); if (this->cameraFaceAngle == 0.0f) { - Message_ContinueTextbox(globalCtx, 0x3010); + Message_ContinueTextbox(play, 0x3010); this->stateFlag = OSSAN_STATE_WAIT_FOR_DISPLAY_ONLY_BOMB_DIALOG; } } -void EnOssan_GiveItemWithFanfare(GlobalContext* globalCtx, EnOssan* this) { - Player* player = GET_PLAYER(globalCtx); +void EnOssan_GiveItemWithFanfare(PlayState* play, EnOssan* this) { + Player* player = GET_PLAYER(play); osSyncPrintf("\n" VT_FGCOL(YELLOW) "初めて手にいれた!!" VT_RST "\n\n"); - func_8002F434(&this->actor, globalCtx, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; - globalCtx->msgCtx.stateTimer = 4; + func_8002F434(&this->actor, play, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~PLAYER_STATE2_29; - func_800BC490(globalCtx, 1); + func_800BC490(play, 1); Interface_ChangeAlpha(50); this->drawCursor = 0; - EnOssan_UpdateCameraDirection(this, globalCtx, 0.0f); + EnOssan_UpdateCameraDirection(this, play, 0.0f); this->stateFlag = OSSAN_STATE_GIVE_ITEM_FANFARE; osSyncPrintf(VT_FGCOL(YELLOW) "持ち上げ開始!!" VT_RST "\n\n"); } -void EnOssan_SetStateCantGetItem(GlobalContext* globalCtx, EnOssan* this, u16 textId) { - Message_ContinueTextbox(globalCtx, textId); +void EnOssan_SetStateCantGetItem(PlayState* play, EnOssan* this, u16 textId) { + Message_ContinueTextbox(play, textId); this->stateFlag = OSSAN_STATE_CANT_GET_ITEM; } -void EnOssan_SetStateQuickBuyDialog(GlobalContext* globalCtx, EnOssan* this, u16 textId) { - Message_ContinueTextbox(globalCtx, textId); +void EnOssan_SetStateQuickBuyDialog(PlayState* play, EnOssan* this, u16 textId) { + Message_ContinueTextbox(play, textId); this->stateFlag = OSSAN_STATE_QUICK_BUY; } -void EnOssan_HandleCanBuyItem(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_HandleCanBuyItem(PlayState* play, EnOssan* this) { EnGirlA* selectedItem = this->shelfSlots[this->cursorIndex]; - switch (selectedItem->canBuyFunc(globalCtx, selectedItem)) { + switch (selectedItem->canBuyFunc(play, selectedItem)) { case CANBUY_RESULT_SUCCESS_FANFARE: if (selectedItem->actor.params == SI_HYLIAN_SHIELD && GET_INFTABLE(INFTABLE_76)) { - EnOssan_SetStateGiveDiscountDialog(globalCtx, this); + EnOssan_SetStateGiveDiscountDialog(play, this); } else { - EnOssan_GiveItemWithFanfare(globalCtx, this); + EnOssan_GiveItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - selectedItem->setOutOfStockFunc(globalCtx, selectedItem); + selectedItem->setOutOfStockFunc(play, selectedItem); } break; case CANBUY_RESULT_SUCCESS: - selectedItem->itemGiveFunc(globalCtx, selectedItem); - EnOssan_SetStateQuickBuyDialog(globalCtx, this, 0x84); + selectedItem->itemGiveFunc(play, selectedItem); + EnOssan_SetStateQuickBuyDialog(play, this, 0x84); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - selectedItem->setOutOfStockFunc(globalCtx, selectedItem); + selectedItem->setOutOfStockFunc(play, selectedItem); break; case CANBUY_RESULT_CANT_GET_NOW: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x86); + EnOssan_SetStateCantGetItem(play, this, 0x86); break; case CANBUY_RESULT_NEED_BOTTLE: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x96); + EnOssan_SetStateCantGetItem(play, this, 0x96); break; case CANBUY_RESULT_NEED_RUPEES: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x85); + EnOssan_SetStateCantGetItem(play, this, 0x85); break; case CANBUY_RESULT_CANT_GET_NOW_5: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x86); + EnOssan_SetStateCantGetItem(play, this, 0x86); break; } } -void EnOssan_HandleCanBuyLonLonMilk(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_HandleCanBuyLonLonMilk(PlayState* play, EnOssan* this) { EnGirlA* item = this->shelfSlots[this->cursorIndex]; - switch (item->canBuyFunc(globalCtx, item)) { + switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_FANFARE: - Message_ContinueTextbox(globalCtx, 0x9C); + Message_ContinueTextbox(play, 0x9C); this->stateFlag = OSSAN_STATE_GIVE_LON_LON_MILK; this->drawCursor = 0; break; case CANBUY_RESULT_SUCCESS: - item->itemGiveFunc(globalCtx, item); - EnOssan_SetStateQuickBuyDialog(globalCtx, this, 0x98); + item->itemGiveFunc(play, item); + EnOssan_SetStateQuickBuyDialog(play, this, 0x98); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->setOutOfStockFunc(globalCtx, item); + item->setOutOfStockFunc(play, item); break; case CANBUY_RESULT_NEED_BOTTLE: - EnOssan_SetStateCantGetItem(globalCtx, this, 0x96); + EnOssan_SetStateCantGetItem(play, this, 0x96); break; case CANBUY_RESULT_NEED_RUPEES: - EnOssan_SetStateCantGetItem(globalCtx, this, 0x85); + EnOssan_SetStateCantGetItem(play, this, 0x85); break; } } -void EnOssan_HandleCanBuyWeirdEgg(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_HandleCanBuyWeirdEgg(PlayState* play, EnOssan* this) { EnGirlA* item = this->shelfSlots[this->cursorIndex]; - switch (item->canBuyFunc(globalCtx, item)) { + switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_FANFARE: - EnOssan_GiveItemWithFanfare(globalCtx, this); + EnOssan_GiveItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->setOutOfStockFunc(globalCtx, item); + item->setOutOfStockFunc(play, item); break; case CANBUY_RESULT_SUCCESS: - item->itemGiveFunc(globalCtx, item); - EnOssan_SetStateQuickBuyDialog(globalCtx, this, 0x9A); + item->itemGiveFunc(play, item); + EnOssan_SetStateQuickBuyDialog(play, this, 0x9A); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->setOutOfStockFunc(globalCtx, item); + item->setOutOfStockFunc(play, item); break; case CANBUY_RESULT_CANT_GET_NOW: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x9D); + EnOssan_SetStateCantGetItem(play, this, 0x9D); break; case CANBUY_RESULT_NEED_RUPEES: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x85); + EnOssan_SetStateCantGetItem(play, this, 0x85); break; } } -void EnOssan_HandleCanBuyBombs(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_HandleCanBuyBombs(PlayState* play, EnOssan* this) { EnGirlA* item = this->shelfSlots[this->cursorIndex]; - switch (item->canBuyFunc(globalCtx, item)) { + switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_FANFARE: case CANBUY_RESULT_SUCCESS: - item->itemGiveFunc(globalCtx, item); - EnOssan_SetStateQuickBuyDialog(globalCtx, this, 0x84); + item->itemGiveFunc(play, item); + EnOssan_SetStateQuickBuyDialog(play, this, 0x84); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->setOutOfStockFunc(globalCtx, item); + item->setOutOfStockFunc(play, item); break; case CANBUY_RESULT_CANT_GET_NOW: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x86); + EnOssan_SetStateCantGetItem(play, this, 0x86); break; case CANBUY_RESULT_NEED_RUPEES: func_80078884(NA_SE_SY_ERROR); - EnOssan_SetStateCantGetItem(globalCtx, this, 0x85); + EnOssan_SetStateCantGetItem(play, this, 0x85); break; } } -void EnOssan_BuyGoronCityBombs(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_BuyGoronCityBombs(PlayState* play, EnOssan* this) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { if (!GET_EVENTCHKINF(EVENTCHKINF_25)) { if (GET_INFTABLE(INFTABLE_FC)) { - EnOssan_SetStateCantGetItem(globalCtx, this, 0x302E); + EnOssan_SetStateCantGetItem(play, this, 0x302E); } else { this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -1470,113 +1468,113 @@ void EnOssan_BuyGoronCityBombs(GlobalContext* globalCtx, EnOssan* this) { this->stateFlag = OSSAN_STATE_DISPLAY_ONLY_BOMB_DIALOG; } } else { - EnOssan_HandleCanBuyBombs(globalCtx, this); + EnOssan_HandleCanBuyBombs(play, this); } } else { - EnOssan_HandleCanBuyBombs(globalCtx, this); + EnOssan_HandleCanBuyBombs(play, this); } } -void EnOssan_State_ItemSelected(EnOssan* this, GlobalContext* globalCtx2, Player* player) { - GlobalContext* globalCtx = globalCtx2; // Necessary for OKs +void EnOssan_State_ItemSelected(EnOssan* this, PlayState* play2, Player* player) { + PlayState* play = play2; // Necessary for OKs if (!EnOssan_TakeItemOffShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", "../z_en_oB1.c", 2654); return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && - !EnOssan_TestCancelOption(this, globalCtx, &globalCtx->state.input[0]) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && + !EnOssan_TestCancelOption(this, play, &play->state.input[0]) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_HandleCanBuyItem(globalCtx, this); + EnOssan_HandleCanBuyItem(play, this); break; case 1: this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); break; } } } -void EnOssan_State_SelectMilkBottle(EnOssan* this, GlobalContext* globalCtx2, Player* player) { - GlobalContext* globalCtx = globalCtx2; // Need for OK +void EnOssan_State_SelectMilkBottle(EnOssan* this, PlayState* play2, Player* player) { + PlayState* play = play2; // Need for OK if (!EnOssan_TakeItemOffShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", "../z_en_oB1.c", 2693); return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && - !EnOssan_TestCancelOption(this, globalCtx, &globalCtx->state.input[0]) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && + !EnOssan_TestCancelOption(this, play, &play->state.input[0]) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_HandleCanBuyLonLonMilk(globalCtx, this); + EnOssan_HandleCanBuyLonLonMilk(play, this); break; case 1: this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); break; } } } -void EnOssan_State_SelectWeirdEgg(EnOssan* this, GlobalContext* globalCtx2, Player* player) { - GlobalContext* globalCtx = globalCtx2; // Needed for OK +void EnOssan_State_SelectWeirdEgg(EnOssan* this, PlayState* play2, Player* player) { + PlayState* play = play2; // Needed for OK if (!EnOssan_TakeItemOffShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", "../z_en_oB1.c", 2732); return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && - !EnOssan_TestCancelOption(this, globalCtx, &globalCtx->state.input[0]) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && + !EnOssan_TestCancelOption(this, play, &play->state.input[0]) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_HandleCanBuyWeirdEgg(globalCtx, this); + EnOssan_HandleCanBuyWeirdEgg(play, this); break; case 1: this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); break; } } } -void EnOssan_State_SelectUnimplementedItem(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_SelectUnimplementedItem(EnOssan* this, PlayState* play, Player* player) { if (!EnOssan_TakeItemOffShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", "../z_en_oB1.c", 2771); return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } } -void EnOssan_State_SelectBombs(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_SelectBombs(EnOssan* this, PlayState* play, Player* player) { if (!EnOssan_TakeItemOffShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", "../z_en_oB1.c", 2798); return; } osSyncPrintf("店主の依頼 ( %d )\n", GET_INFTABLE(INFTABLE_FC)); if (this->actor.params != OSSAN_TYPE_GORON) { - EnOssan_State_ItemSelected(this, globalCtx, player); + EnOssan_State_ItemSelected(this, play, player); return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && - !EnOssan_TestCancelOption(this, globalCtx, &globalCtx->state.input[0]) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && + !EnOssan_TestCancelOption(this, play, &play->state.input[0]) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_BuyGoronCityBombs(globalCtx, this); + EnOssan_BuyGoronCityBombs(play, this); break; case 1: this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); break; } } } -void EnOssan_State_SelectMaskItem(EnOssan* this, GlobalContext* globalCtx, Player* player) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnOssan_State_SelectMaskItem(EnOssan* this, PlayState* play, Player* player) { + u8 talkState = Message_GetState(&play->msgCtx); EnGirlA* item = this->shelfSlots[this->cursorIndex]; if (!EnOssan_TakeItemOffShelf(this)) { @@ -1584,14 +1582,13 @@ void EnOssan_State_SelectMaskItem(EnOssan* this, GlobalContext* globalCtx, Playe return; } if (talkState == TEXT_STATE_EVENT) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } - } else if (talkState == TEXT_STATE_CHOICE && - !EnOssan_TestCancelOption(this, globalCtx, &globalCtx->state.input[0]) && - Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + } else if (talkState == TEXT_STATE_CHOICE && !EnOssan_TestCancelOption(this, play, &play->state.input[0]) && + Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: switch (item->actor.params) { case SI_KEATON_MASK: @@ -1612,172 +1609,172 @@ void EnOssan_State_SelectMaskItem(EnOssan* this, GlobalContext* globalCtx, Playe case SI_GERUDO_MASK: break; } - EnOssan_GiveItemWithFanfare(globalCtx, this); + EnOssan_GiveItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->setOutOfStockFunc(globalCtx, item); + item->setOutOfStockFunc(play, item); break; case 1: this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); break; } } } -void EnOssan_State_CantGetItem(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { +void EnOssan_State_CantGetItem(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } } -void EnOssan_State_QuickBuyDialog(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_QuickBuyDialog(EnOssan* this, PlayState* play, Player* player) { EnGirlA* item; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { this->shopItemSelectedTween = 0.0f; EnOssan_ResetItemPosition(this); item = this->shelfSlots[this->cursorIndex]; - item->updateStockedItemFunc(globalCtx, item); + item->updateStockedItemFunc(play, item); this->stateFlag = this->tempStateFlag; - Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->shelfSlots[this->cursorIndex]->actor.textId); } } -void EnOssan_State_GiveItemWithFanfare(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_GiveItemWithFanfare(EnOssan* this, PlayState* play, Player* player) { // The player sets itself as the parent actor to signal that it has obtained the give item request - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->stateFlag = OSSAN_STATE_ITEM_PURCHASED; return; } - func_8002F434(&this->actor, globalCtx, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); + func_8002F434(&this->actor, play, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); } -void EnOssan_State_ItemPurchased(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_ItemPurchased(EnOssan* this, PlayState* play, Player* player) { EnGirlA* item; EnGirlA* itemTemp; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (this->actor.params == OSSAN_TYPE_MASK) { itemTemp = this->shelfSlots[this->cursorIndex]; EnOssan_ResetItemPosition(this); item = this->shelfSlots[this->cursorIndex]; - item->updateStockedItemFunc(globalCtx, item); + item->updateStockedItemFunc(play, item); if (itemTemp->actor.params == SI_MASK_OF_TRUTH && !GET_ITEMGETINF(ITEMGETINF_3F)) { SET_ITEMGETINF(ITEMGETINF_3F); - Message_ContinueTextbox(globalCtx, 0x70AB); + Message_ContinueTextbox(play, 0x70AB); this->happyMaskShopState = OSSAN_HAPPY_STATE_BORROWED_FIRST_MASK; - EnOssan_UpdateShopOfferings(this, globalCtx); + EnOssan_UpdateShopOfferings(this, play); this->stateFlag = OSSAN_STATE_START_CONVERSATION; return; } else { - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); return; } } item = this->shelfSlots[this->cursorIndex]; - item->buyEventFunc(globalCtx, item); + item->buyEventFunc(play, item); this->stateFlag = OSSAN_STATE_CONTINUE_SHOPPING_PROMPT; - Message_ContinueTextbox(globalCtx, 0x6B); + Message_ContinueTextbox(play, 0x6B); } } -void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, PlayState* play, Player* player) { EnGirlA* selectedItem; - u8 talkState = Message_GetState(&globalCtx->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); if (talkState == TEXT_STATE_CHOICE) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { EnOssan_ResetItemPosition(this); selectedItem = this->shelfSlots[this->cursorIndex]; - selectedItem->updateStockedItemFunc(globalCtx, selectedItem); - if (!EnOssan_TestEndInteraction(this, globalCtx, &globalCtx->state.input[0])) { - switch (globalCtx->msgCtx.choiceIndex) { + selectedItem->updateStockedItemFunc(play, selectedItem); + if (!EnOssan_TestEndInteraction(this, play, &play->state.input[0])) { + switch (play->msgCtx.choiceIndex) { case 0: osSyncPrintf(VT_FGCOL(YELLOW) "★★★ 続けるよ!! ★★★" VT_RST "\n"); player->actor.shape.rot.y += 0x8000; player->stateFlags2 |= PLAYER_STATE2_29; - func_800BC490(globalCtx, 2); - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); - EnOssan_SetStateStartShopping(globalCtx, this, true); - func_8002F298(&this->actor, globalCtx, 100.0f, -1); + func_800BC490(play, 2); + Message_StartTextbox(play, this->actor.textId, &this->actor); + EnOssan_SetStateStartShopping(play, this, true); + func_8002F298(&this->actor, play, 100.0f, -1); break; case 1: default: osSyncPrintf(VT_FGCOL(YELLOW) "★★★ やめるよ!! ★★★" VT_RST "\n"); - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); break; } } } - } else if (talkState == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { + } else if (talkState == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { EnOssan_ResetItemPosition(this); selectedItem = this->shelfSlots[this->cursorIndex]; - selectedItem->updateStockedItemFunc(globalCtx, selectedItem); + selectedItem->updateStockedItemFunc(play, selectedItem); player->actor.shape.rot.y += 0x8000; player->stateFlags2 |= PLAYER_STATE2_29; - func_800BC490(globalCtx, 2); - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); - EnOssan_SetStateStartShopping(globalCtx, this, true); - func_8002F298(&this->actor, globalCtx, 100.0f, -1); + func_800BC490(play, 2); + Message_StartTextbox(play, this->actor.textId, &this->actor); + EnOssan_SetStateStartShopping(play, this, true); + func_8002F298(&this->actor, play, 100.0f, -1); } } -void EnOssan_State_WaitForDisplayOnlyBombDialog(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { +void EnOssan_State_WaitForDisplayOnlyBombDialog(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { SET_INFTABLE(INFTABLE_FC); - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); } } // Unreachable -void EnOssan_State_21(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE_HAS_NEXT && Message_ShouldAdvance(globalCtx)) { +void EnOssan_State_21(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE_HAS_NEXT && Message_ShouldAdvance(play)) { this->stateFlag = OSSAN_STATE_22; - Message_ContinueTextbox(globalCtx, 0x3012); + Message_ContinueTextbox(play, 0x3012); SET_INFTABLE(INFTABLE_FC); } } // Unreachable -void EnOssan_State_22(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - EnOssan_StartShopping(globalCtx, this); +void EnOssan_State_22(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + EnOssan_StartShopping(play, this); } } -void EnOssan_State_GiveLonLonMilk(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - EnOssan_GiveItemWithFanfare(globalCtx, this); +void EnOssan_State_GiveLonLonMilk(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + EnOssan_GiveItemWithFanfare(play, this); } } // For giving Mask of Truth when you first sell all masks -void EnOssan_State_LendMaskOfTruth(EnOssan* this, GlobalContext* globalCtx, Player* player) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { +void EnOssan_State_LendMaskOfTruth(EnOssan* this, PlayState* play, Player* player) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { SET_ITEMGETINF(ITEMGETINF_2A); this->cursorIndex = 2; - EnOssan_GiveItemWithFanfare(globalCtx, this); + EnOssan_GiveItemWithFanfare(play, this); } } // Hylian Shield discount dialog -void EnOssan_SetStateGiveDiscountDialog(GlobalContext* globalCtx, EnOssan* this) { - Message_ContinueTextbox(globalCtx, 0x71B2); +void EnOssan_SetStateGiveDiscountDialog(PlayState* play, EnOssan* this) { + Message_ContinueTextbox(play, 0x71B2); this->stateFlag = OSSAN_STATE_DISCOUNT_DIALOG; } -void EnOssan_State_GiveDiscountDialog(EnOssan* this, GlobalContext* globalCtx, Player* player) { +void EnOssan_State_GiveDiscountDialog(EnOssan* this, PlayState* play, Player* player) { EnGirlA* selectedItem; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { selectedItem = this->shelfSlots[this->cursorIndex]; - EnOssan_GiveItemWithFanfare(globalCtx, this); + EnOssan_GiveItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - selectedItem->setOutOfStockFunc(globalCtx, selectedItem); + selectedItem->setOutOfStockFunc(play, selectedItem); } } @@ -1971,12 +1968,12 @@ void EnOssan_Blink(EnOssan* this) { } } -s32 EnOssan_AreShopkeeperObjectsLoaded(EnOssan* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex1)) { - if (this->objBankIndex2 >= 0 && !Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex2)) { +s32 EnOssan_AreShopkeeperObjectsLoaded(EnOssan* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex1)) { + if (this->objBankIndex2 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objBankIndex2)) { return false; } - if (this->objBankIndex3 >= 0 && !Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex3)) { + if (this->objBankIndex3 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objBankIndex3)) { return false; } return true; @@ -1984,55 +1981,55 @@ s32 EnOssan_AreShopkeeperObjectsLoaded(EnOssan* this, GlobalContext* globalCtx) return false; } -void EnOssan_InitBazaarShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gObjectOssanSkel, &gObjectOssanAnim_000338, NULL, NULL, 0); +void EnOssan_InitBazaarShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gObjectOssanSkel, &gObjectOssanAnim_000338, NULL, NULL, 0); this->actor.draw = EnOssan_DrawBazaarShopkeeper; this->obj3ToSeg6Func = NULL; } -void EnOssan_InitKokiriShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gKm1Skel, NULL, NULL, NULL, 0); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objBankIndex3].segment); +void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gKm1Skel, NULL, NULL, NULL, 0); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objBankIndex3].segment); Animation_Change(&this->skelAnime, &object_masterkokiri_Anim_0004A8, 1.0f, 0.0f, Animation_GetLastFrame(&object_masterkokiri_Anim_0004A8), 0, 0.0f); this->actor.draw = EnOssan_DrawKokiriShopkeeper; this->obj3ToSeg6Func = EnOssan_Obj3ToSeg6; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + 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); } -void EnOssan_InitGoronShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objBankIndex3].segment); +void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objBankIndex3].segment); Animation_Change(&this->skelAnime, &gGoronShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGoronShopkeeperAnim), 0, 0.0f); this->actor.draw = EnOssan_DrawGoronShopkeeper; this->obj3ToSeg6Func = EnOssan_Obj3ToSeg6; } -void EnOssan_InitZoraShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, NULL, NULL, NULL, 0); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objBankIndex3].segment); +void EnOssan_InitZoraShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, NULL, NULL, 0); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objBankIndex3].segment); Animation_Change(&this->skelAnime, &gZoraShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZoraShopkeeperAnim), 0, 0.0f); this->actor.draw = EnOssan_DrawZoraShopkeeper; this->obj3ToSeg6Func = EnOssan_Obj3ToSeg6; } -void EnOssan_InitPotionShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ds2_Skel_004258, &object_ds2_Anim_0002E4, 0, 0, 0); +void EnOssan_InitPotionShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_ds2_Skel_004258, &object_ds2_Anim_0002E4, 0, 0, 0); this->actor.draw = EnOssan_DrawPotionShopkeeper; this->obj3ToSeg6Func = NULL; } -void EnOssan_InitHappyMaskShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_os_Skel_004658, &object_os_Anim_0002E4, NULL, NULL, 0); +void EnOssan_InitHappyMaskShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_os_Skel_004658, &object_os_Anim_0002E4, NULL, NULL, 0); this->actor.draw = EnOssan_DrawHappyMaskShopkeeper; this->obj3ToSeg6Func = NULL; } -void EnOssan_InitBombchuShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_rs_Skel_004868, &object_rs_Anim_00065C, 0, 0, 0); +void EnOssan_InitBombchuShopkeeper(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_rs_Skel_004868, &object_rs_Anim_00065C, 0, 0, 0); this->actor.draw = EnOssan_DrawBombchuShopkeeper; this->obj3ToSeg6Func = NULL; } @@ -2100,15 +2097,15 @@ u16 EnOssan_SetupHelloDialog(EnOssan* this) { return 0x9E; } -void EnOssan_InitActionFunc(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_InitActionFunc(EnOssan* this, PlayState* play) { ShopItem* items; - if (EnOssan_AreShopkeeperObjectsLoaded(this, globalCtx)) { + if (EnOssan_AreShopkeeperObjectsLoaded(this, play)) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.objBankIndex = this->objBankIndex1; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); - this->shelves = (EnTana*)Actor_Find(&globalCtx->actorCtx, ACTOR_EN_TANA, ACTORCAT_PROP); + this->shelves = (EnTana*)Actor_Find(&play->actorCtx, ACTOR_EN_TANA, ACTORCAT_PROP); if (this->shelves == NULL) { osSyncPrintf(VT_COL(RED, WHITE)); @@ -2128,7 +2125,7 @@ void EnOssan_InitActionFunc(EnOssan* this, GlobalContext* globalCtx) { items = sShopkeeperStores[this->actor.params]; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - sInitFuncs[this->actor.params](this, globalCtx); + sInitFuncs[this->actor.params](this, play); this->actor.textId = EnOssan_SetupHelloDialog(this); this->cursorY = this->cursorX = 100.0f; this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -2184,7 +2181,7 @@ void EnOssan_InitActionFunc(EnOssan* this, GlobalContext* globalCtx) { this->stickAnimTween = 0; this->shopItemSelectedTween = 0; Actor_SetScale(&this->actor, sShopkeeperScale[this->actor.params]); - EnOssan_SpawnItemsOnShelves(this, globalCtx, items); + EnOssan_SpawnItemsOnShelves(this, play, items); this->headRot = this->headTargetRot = 0; this->blinkTimer = 20; this->eyeTextureIdx = 0; @@ -2194,46 +2191,46 @@ void EnOssan_InitActionFunc(EnOssan* this, GlobalContext* globalCtx) { } } -void EnOssan_Obj3ToSeg6(EnOssan* this, GlobalContext* globalCtx) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndex3].segment); +void EnOssan_Obj3ToSeg6(EnOssan* this, PlayState* play) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment); } -void EnOssan_MainActionFunc(EnOssan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnOssan_MainActionFunc(EnOssan* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->blinkFunc(this); - EnOssan_UpdateJoystickInputState(globalCtx, this); + EnOssan_UpdateJoystickInputState(play, this); EnOssan_UpdateItemSelectedProperty(this); EnOssan_UpdateStickDirectionPromptAnim(this); EnOssan_UpdateCursorAnim(this); Math_StepToS(&this->headRot, this->headTargetRot, 0x190); if (player != NULL) { - sStateFunc[this->stateFlag](this, globalCtx, player); + sStateFunc[this->stateFlag](this, play, player); } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 26.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); Actor_SetFocus(&this->actor, 90.0f); Actor_SetScale(&this->actor, sShopkeeperScale[this->actor.params]); // use animation object if needed if (this->obj3ToSeg6Func != NULL) { - this->obj3ToSeg6Func(this, globalCtx); + this->obj3ToSeg6Func(this, play); } SkelAnime_Update(&this->skelAnime); } -void EnOssan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_Update(Actor* thisx, PlayState* play) { EnOssan* this = (EnOssan*)thisx; this->timer++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnOssan_OverrideLimbDrawDefaultShopkeeper(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, - Vec3s* rot, void* thisx) { +s32 EnOssan_OverrideLimbDrawDefaultShopkeeper(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + void* thisx) { EnOssan* this = (EnOssan*)thisx; if (limbIndex == 8) { @@ -2242,14 +2239,14 @@ s32 EnOssan_OverrideLimbDrawDefaultShopkeeper(GlobalContext* globalCtx, s32 limb return 0; } -void EnOssan_DrawCursor(GlobalContext* globalCtx, EnOssan* this, f32 x, f32 y, f32 z, u8 drawCursor) { +void EnOssan_DrawCursor(PlayState* play, EnOssan* this, f32 x, f32 y, f32 z, u8 drawCursor) { s32 ulx, uly, lrx, lry; f32 w; s32 dsdx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4192); + OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4192); if (drawCursor != 0) { - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColorR, this->cursorColorG, this->cursorColorB, this->cursorColorA); gDPLoadTextureBlock_4b(OVERLAY_DISP++, gSelectionCursorTex, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP, @@ -2262,17 +2259,17 @@ void EnOssan_DrawCursor(GlobalContext* globalCtx, EnOssan* this, f32 x, f32 y, f dsdx = (1.0f / z) * 1024.0f; gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, dsdx, dsdx); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4215); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4215); } -void EnOssan_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y, f32 z, s32 s, s32 t, - f32 dx, f32 dy) { +void EnOssan_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y, f32 z, s32 s, s32 t, f32 dx, + f32 dy) { f32 unk; s32 ulx, uly, lrx, lry; f32 w, h; s32 dsdx, dtdy; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4228); + OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4228); gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a); @@ -2287,28 +2284,28 @@ void EnOssan_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f lrx = (x + w) * 4.0f; lry = (y + h) * 4.0f; gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4242); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4242); } -void EnOssan_DrawStickDirectionPrompts(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_DrawStickDirectionPrompts(PlayState* play, EnOssan* this) { s32 drawStickLeftPrompt = this->stickLeftPrompt.isEnabled; s32 drawStickRightPrompt = this->stickRightPrompt.isEnabled; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4252); + OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4252); if (drawStickLeftPrompt || drawStickRightPrompt) { - func_80094520(globalCtx->state.gfxCtx); + func_80094520(play->state.gfxCtx); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPLoadTextureBlock(OVERLAY_DISP++, gArrowCursorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); if (drawStickLeftPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColorR, this->stickLeftPrompt.arrowColorG, + EnOssan_DrawTextRec(play, this->stickLeftPrompt.arrowColorR, this->stickLeftPrompt.arrowColorG, this->stickLeftPrompt.arrowColorB, this->stickLeftPrompt.arrowColorA, this->stickLeftPrompt.arrowTexX, this->stickLeftPrompt.arrowTexY, this->stickLeftPrompt.z, 0, 0, -1.0f, 1.0f); } if (drawStickRightPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColorR, this->stickRightPrompt.arrowColorG, + EnOssan_DrawTextRec(play, this->stickRightPrompt.arrowColorR, this->stickRightPrompt.arrowColorG, this->stickRightPrompt.arrowColorB, this->stickRightPrompt.arrowColorA, this->stickRightPrompt.arrowTexX, this->stickRightPrompt.arrowTexY, this->stickRightPrompt.z, 0, 0, 1.0f, 1.0f); @@ -2317,40 +2314,40 @@ void EnOssan_DrawStickDirectionPrompts(GlobalContext* globalCtx, EnOssan* this) G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); if (drawStickLeftPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColorR, this->stickLeftPrompt.stickColorG, + EnOssan_DrawTextRec(play, this->stickLeftPrompt.stickColorR, this->stickLeftPrompt.stickColorG, this->stickLeftPrompt.stickColorB, this->stickLeftPrompt.stickColorA, this->stickLeftPrompt.stickTexX, this->stickLeftPrompt.stickTexY, this->stickLeftPrompt.z, 0, 0, -1.0f, 1.0f); } if (drawStickRightPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickRightPrompt.stickColorR, this->stickRightPrompt.stickColorG, + EnOssan_DrawTextRec(play, this->stickRightPrompt.stickColorR, this->stickRightPrompt.stickColorG, this->stickRightPrompt.stickColorB, this->stickRightPrompt.stickColorA, this->stickRightPrompt.stickTexX, this->stickRightPrompt.stickTexY, this->stickRightPrompt.z, 0, 0, 1.0f, 1.0f); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4300); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4300); } -void EnOssan_DrawBazaarShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawBazaarShopkeeper(Actor* thisx, PlayState* play) { static void* sBazaarShopkeeperEyeTextures[] = { gOssanEyeOpenTex, gOssanEyeHalfTex, gOssanEyeClosedTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4320); + OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4320); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sBazaarShopkeeperEyeTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnOssan_OverrideLimbDrawDefaultShopkeeper, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4340); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4340); } -s32 EnOssan_OverrideLimbDrawKokiriShopkeeper(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, - Vec3s* rot, void* thisx) { +s32 EnOssan_OverrideLimbDrawKokiriShopkeeper(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + void* thisx) { static void* sKokiriShopkeeperEyeTextures[] = { gKokiriShopkeeperEyeDefaultTex, gKokiriShopkeeperEyeHalfTex, @@ -2359,16 +2356,16 @@ s32 EnOssan_OverrideLimbDrawKokiriShopkeeper(GlobalContext* globalCtx, s32 limbI EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4354); + OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4354); if (limbIndex == 15) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->objBankIndex2].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndex2].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndex2].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex2].segment); *dList = gKokiriShopkeeperHeadDL; gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sKokiriShopkeeperEyeTextures[this->eyeTextureIdx])); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4374); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4374); return 0; } @@ -2388,45 +2385,45 @@ Gfx* EnOssan_SetEnvColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { return disp; } -void EnOssan_DrawKokiriShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawKokiriShopkeeper(Actor* thisx, PlayState* play) { EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4409); + OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4409); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0x08, EnOssan_SetEnvColor(globalCtx->state.gfxCtx, 0, 130, 70, 255)); - gSPSegment(POLY_OPA_DISP++, 0x09, EnOssan_SetEnvColor(globalCtx->state.gfxCtx, 110, 170, 20, 255)); - gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EmptyDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, EnOssan_SetEnvColor(play->state.gfxCtx, 0, 130, 70, 255)); + gSPSegment(POLY_OPA_DISP++, 0x09, EnOssan_SetEnvColor(play->state.gfxCtx, 110, 170, 20, 255)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EmptyDList(play->state.gfxCtx)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnOssan_OverrideLimbDrawKokiriShopkeeper, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4434); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4434); } -void EnOssan_DrawGoronShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawGoronShopkeeper(Actor* thisx, PlayState* play) { static void* sGoronShopkeeperEyeTextures[] = { gGoronCsEyeOpenTex, gGoronCsEyeHalfTex, gGoronCsEyeClosedTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4455); + OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4455); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sGoronShopkeeperEyeTextures[this->eyeTextureIdx])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGoronCsMouthNeutralTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4476); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4476); } -s32 EnOssan_OverrideLimbDrawZoraShopkeeper(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnOssan_OverrideLimbDrawZoraShopkeeper(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnOssan* this = (EnOssan*)thisx; @@ -2436,78 +2433,78 @@ s32 EnOssan_OverrideLimbDrawZoraShopkeeper(GlobalContext* globalCtx, s32 limbInd return 0; } -void EnOssan_DrawZoraShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawZoraShopkeeper(Actor* thisx, PlayState* play) { static void* sZoraShopkeeperEyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4506); + OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4506); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EmptyDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EmptyDList(play->state.gfxCtx)); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sZoraShopkeeperEyeTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnOssan_OverrideLimbDrawZoraShopkeeper, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4531); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4531); } -void EnOssan_DrawPotionShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawPotionShopkeeper(Actor* thisx, PlayState* play) { static void* sPotionShopkeeperEyeTextures[] = { gPotionShopkeeperEyeOpenTex, gPotionShopkeeperEyeHalfTex, gPotionShopkeeperEyeClosedTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4544); + OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4544); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sPotionShopkeeperEyeTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4564); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4564); } -void EnOssan_DrawHappyMaskShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawHappyMaskShopkeeper(Actor* thisx, PlayState* play) { static void* sHappyMaskShopkeeperEyeTextures[] = { gOsEyeClosedTex, gOsEyeOpenTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4578); + OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4578); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sHappyMaskShopkeeperEyeTextures[this->happyMaskShopkeeperEyeIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4598); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4598); } -void EnOssan_DrawBombchuShopkeeper(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_DrawBombchuShopkeeper(Actor* thisx, PlayState* play) { static void* sBombchuShopkeeperEyeTextures[] = { gBombchuShopkeeperEyeOpenTex, gBombchuShopkeeperEyeHalfTex, gBombchuShopkeeperEyeClosedTex }; EnOssan* this = (EnOssan*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4611); + OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4611); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sBombchuShopkeeperEyeTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, this); - EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, this); + EnOssan_DrawCursor(play, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_oB1.c", 4631); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4631); } diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h index 1dddce504f..f59a7943b0 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h @@ -8,11 +8,11 @@ struct EnOssan; -typedef void (*EnOssanActionFunc)(struct EnOssan*, GlobalContext*); -typedef void (*EnOssanTalkOwnerFunc)(GlobalContext*); -typedef void (*EnOssanInitFunc)(struct EnOssan*, GlobalContext*); +typedef void (*EnOssanActionFunc)(struct EnOssan*, PlayState*); +typedef void (*EnOssanTalkOwnerFunc)(PlayState*); +typedef void (*EnOssanInitFunc)(struct EnOssan*, PlayState*); typedef s16 (*EnOssanGetGirlAParamsFunc)(s16); -typedef void (*EnOssanStateFunc)(struct EnOssan*, GlobalContext*, Player*); +typedef void (*EnOssanStateFunc)(struct EnOssan*, PlayState*, Player*); typedef struct { /* 0x00 */ u32 stickColorR; @@ -37,7 +37,7 @@ typedef struct EnOssan { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnOssanActionFunc actionFunc; - /* 0x0194 */ void (*obj3ToSeg6Func)(struct EnOssan*, GlobalContext*); + /* 0x0194 */ void (*obj3ToSeg6Func)(struct EnOssan*, PlayState*); /* 0x0198 */ ColliderCylinder collider; // unused /* 0x01E4 */ s16 timer; /* 0x01E6 */ s16 delayTimer; diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index d43781b4cb..9bac3025b3 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -12,37 +12,37 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOwl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOwl_Update(Actor* thisx, GlobalContext* globalCtx); -void EnOwl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnOwl_Init(Actor* thisx, PlayState* play); +void EnOwl_Destroy(Actor* thisx, PlayState* play); +void EnOwl_Update(Actor* thisx, PlayState* play); +void EnOwl_Draw(Actor* thisx, PlayState* play); void EnOwl_ChangeMode(EnOwl* this, EnOwlActionFunc, OwlFunc, SkelAnime*, AnimationHeader*, f32); -void EnOwl_WaitDefault(EnOwl* this, GlobalContext* globalCtx); +void EnOwl_WaitDefault(EnOwl* this, PlayState* play); void func_80ACC540(EnOwl* this); -void EnOwl_WaitOutsideKokiri(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitHyruleCastle(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitKakariko(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitGerudo(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitLakeHylia(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitZoraRiver(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitHyliaShortcut(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitDeathMountainShortcut(EnOwl* this, GlobalContext* globalCtx); -void func_80ACB3E0(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitLWPreSaria(EnOwl* this, GlobalContext* globalCtx); -void EnOwl_WaitLWPostSaria(EnOwl* this, GlobalContext* globalCtx); -void func_80ACD4D4(EnOwl* this, GlobalContext* globalCtx); -void func_80ACD130(EnOwl* this, GlobalContext* globalCtx, s32 arg2); -void func_80ACBAB8(EnOwl* this, GlobalContext* globalCtx); -void func_80ACD2CC(EnOwl* this, GlobalContext* globalCtx); -void func_80ACAA54(EnOwl* this, GlobalContext* globalCtx); -void func_80ACAC6C(EnOwl* this, GlobalContext* globalCtx); -void func_80ACADF0(EnOwl* this, GlobalContext* globalCtx); -void func_80ACAF74(EnOwl* this, GlobalContext* globalCtx); -void func_80ACC30C(EnOwl* this, GlobalContext* globalCtx); -void func_80ACB4FC(EnOwl* this, GlobalContext* globalCtx); -void func_80ACB680(EnOwl* this, GlobalContext* globalCtx); +void EnOwl_WaitOutsideKokiri(EnOwl* this, PlayState* play); +void EnOwl_WaitHyruleCastle(EnOwl* this, PlayState* play); +void EnOwl_WaitKakariko(EnOwl* this, PlayState* play); +void EnOwl_WaitGerudo(EnOwl* this, PlayState* play); +void EnOwl_WaitLakeHylia(EnOwl* this, PlayState* play); +void EnOwl_WaitZoraRiver(EnOwl* this, PlayState* play); +void EnOwl_WaitHyliaShortcut(EnOwl* this, PlayState* play); +void EnOwl_WaitDeathMountainShortcut(EnOwl* this, PlayState* play); +void func_80ACB3E0(EnOwl* this, PlayState* play); +void EnOwl_WaitLWPreSaria(EnOwl* this, PlayState* play); +void EnOwl_WaitLWPostSaria(EnOwl* this, PlayState* play); +void func_80ACD4D4(EnOwl* this, PlayState* play); +void func_80ACD130(EnOwl* this, PlayState* play, s32 arg2); +void func_80ACBAB8(EnOwl* this, PlayState* play); +void func_80ACD2CC(EnOwl* this, PlayState* play); +void func_80ACAA54(EnOwl* this, PlayState* play); +void func_80ACAC6C(EnOwl* this, PlayState* play); +void func_80ACADF0(EnOwl* this, PlayState* play); +void func_80ACAF74(EnOwl* this, PlayState* play); +void func_80ACC30C(EnOwl* this, PlayState* play); +void func_80ACB4FC(EnOwl* this, PlayState* play); +void func_80ACB680(EnOwl* this, PlayState* play); void func_80ACC460(EnOwl* this); -void func_80ACBEA0(EnOwl*, GlobalContext*); +void func_80ACBEA0(EnOwl*, PlayState*); typedef enum { /* 0x00 */ OWL_DEFAULT, @@ -104,7 +104,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 2400, ICHAIN_STOP), }; -void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Init(Actor* thisx, PlayState* play) { EnOwl* this = (EnOwl*)thisx; ColliderCylinder* collider; s32 owlType; @@ -112,12 +112,11 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gOwlFlyingSkel, &gOwlFlyAnim, this->jointTable, this->morphTable, - 21); - SkelAnime_InitFlex(globalCtx, &this->skelAnime2, &gOwlPerchingSkel, &gOwlPerchAnim, this->jointTable2, - this->morphTable2, 16); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sOwlCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gOwlFlyingSkel, &gOwlFlyAnim, this->jointTable, this->morphTable, 21); + SkelAnime_InitFlex(play, &this->skelAnime2, &gOwlPerchingSkel, &gOwlPerchAnim, this->jointTable2, this->morphTable2, + 16); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sOwlCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.minVelocityY = -10.0f; this->actor.targetArrowOffset = 500.0f; @@ -135,7 +134,7 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { // "conversation owl %4x no = %d, sv = %d" osSyncPrintf(VT_FGCOL(CYAN) " 会話フクロウ %4x no = %d, sv = %d\n" VT_RST, this->actor.params, owlType, switchFlag); - if ((owlType != OWL_DEFAULT) && (switchFlag < 0x20) && Flags_GetSwitch(globalCtx, switchFlag)) { + if ((owlType != OWL_DEFAULT) && (switchFlag < 0x20) && Flags_GetSwitch(play, switchFlag)) { osSyncPrintf("savebitでフクロウ退避\n"); // "Save owl with savebit" Actor_Kill(&this->actor); return; @@ -192,7 +191,7 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { break; case OWL_HYLIA_SHORTCUT: this->actionFunc = EnOwl_WaitHyliaShortcut; - Flags_UnsetSwitch(globalCtx, 0x23); + Flags_UnsetSwitch(play, 0x23); return; case OWL_DEATH_MOUNTAIN: this->actionFunc = EnOwl_WaitDeathMountainShortcut; @@ -233,17 +232,17 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnOwl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Destroy(Actor* thisx, PlayState* play) { EnOwl* this = (EnOwl*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } /** * Rotates this to the player instance */ -void EnOwl_LookAtLink(EnOwl* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnOwl_LookAtLink(EnOwl* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.shape.rot.y = this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &player->actor.world.pos); @@ -254,11 +253,11 @@ void EnOwl_LookAtLink(EnOwl* this, GlobalContext* globalCtx) { * returns 0 if the link is not within `targetDistance`, returns 1 once link is within * the distance, and the camera has been initalized. */ -s32 EnOwl_CheckInitTalk(EnOwl* this, GlobalContext* globalCtx, u16 textId, f32 targetDist, u16 flags) { +s32 EnOwl_CheckInitTalk(EnOwl* this, PlayState* play, u16 textId, f32 targetDist, u16 flags) { s32 timer; f32 distCheck; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->actor.params == 0xFFF) { this->actionFlags |= 0x40; timer = -100; @@ -271,26 +270,26 @@ s32 EnOwl_CheckInitTalk(EnOwl* this, GlobalContext* globalCtx, u16 textId, f32 t this->actionFlags &= ~0x40; } } - this->subCamId = OnePointCutscene_Init(globalCtx, 8700, timer, &this->actor, CAM_ID_MAIN); + this->subCamId = OnePointCutscene_Init(play, 8700, timer, &this->actor, CAM_ID_MAIN); return true; } else { this->actor.textId = textId; distCheck = (flags & 2) ? 200.0f : 1000.0f; if (this->actor.xzDistToPlayer < targetDist) { this->actor.flags |= ACTOR_FLAG_16; - func_8002F1C4(&this->actor, globalCtx, targetDist, distCheck, 0); + func_8002F1C4(&this->actor, play, targetDist, distCheck, 0); } return false; } } -s32 func_80ACA558(EnOwl* this, GlobalContext* globalCtx, u16 textId) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80ACA558(EnOwl* this, PlayState* play, u16 textId) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { return true; } else { this->actor.textId = textId; if (this->actor.xzDistToPlayer < 120.0f) { - func_8002F1C4(&this->actor, globalCtx, 350.0f, 1000.0f, 0); + func_8002F1C4(&this->actor, play, 350.0f, 1000.0f, 0); } return false; } @@ -302,19 +301,19 @@ void func_80ACA5C8(EnOwl* this) { this->blinkTimer = Rand_S16Offset(60, 60); } -void func_80ACA62C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACA62C(EnOwl* this, PlayState* play) { s32 switchFlag = this->actor.params & 0x3F; if (switchFlag < 0x20) { - Flags_SetSwitch(globalCtx, switchFlag); - osSyncPrintf(VT_FGCOL(CYAN) " Actor_Environment_sw = %d\n" VT_RST, Flags_GetSwitch(globalCtx, switchFlag)); + Flags_SetSwitch(play, switchFlag); + osSyncPrintf(VT_FGCOL(CYAN) " Actor_Environment_sw = %d\n" VT_RST, Flags_GetSwitch(play, switchFlag)); } func_80ACA5C8(this); } -void func_80ACA690(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACA690(EnOwl* this, PlayState* play) { if ((this->unk_3EE & 0x3F) == 0) { - func_80ACA62C(this, globalCtx); + func_80ACA62C(this, play); } } @@ -337,23 +336,23 @@ void func_80ACA71C(EnOwl* this) { this->unk_407 = this->unk_3F2; } -void func_80ACA76C(EnOwl* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 8); +void func_80ACA76C(EnOwl* this, PlayState* play) { + func_8002DF54(play, &this->actor, 8); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); - func_80ACA62C(this, globalCtx); + func_80ACA62C(this, play); this->actor.flags &= ~ACTOR_FLAG_16; } } -void func_80ACA7E0(EnOwl* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 8); +void func_80ACA7E0(EnOwl* this, PlayState* play) { + func_8002DF54(play, &this->actor, 8); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); if ((this->unk_3EE & 0x3F) == 0) { - func_80ACA62C(this, globalCtx); + func_80ACA62C(this, play); } else { this->actionFlags &= ~2; func_80ACA71C(this); @@ -363,24 +362,24 @@ void func_80ACA7E0(EnOwl* this, GlobalContext* globalCtx) { } } -void EnOwl_ConfirmKokiriMessage(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void EnOwl_ConfirmKokiriMessage(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x2065); + Message_ContinueTextbox(play, 0x2065); break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x2067); + Message_ContinueTextbox(play, 0x2067); this->actionFunc = func_80ACA76C; break; } } } -void EnOwl_WaitOutsideKokiri(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitOutsideKokiri(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x2064, 360.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x2064, 360.0f, 0)) { // Sets BGM Audio_PlayFanfare(NA_BGM_OWL); @@ -390,15 +389,15 @@ void EnOwl_WaitOutsideKokiri(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACA998(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80ACA998(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x2069); + Message_ContinueTextbox(play, 0x2069); this->actionFunc = func_80ACAA54; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x206B); + Message_ContinueTextbox(play, 0x206B); this->actionFunc = func_80ACA7E0; break; } @@ -407,47 +406,47 @@ void func_80ACA998(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACAA54(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x206A); +void func_80ACAA54(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x206A); this->actionFunc = func_80ACA998; this->actionFlags |= 2; func_80ACA71C(this); } } -void func_80ACAAC0(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x2069); +void func_80ACAAC0(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x2069); this->actionFunc = func_80ACAA54; this->actionFlags &= ~2; func_80ACA71C(this); } } -void EnOwl_WaitHyruleCastle(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitHyruleCastle(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x2068, 540.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x2068, 540.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACAAC0; } } -void func_80ACAB88(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80ACAB88(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case OWL_REPEAT: // obtained zelda's letter if (GET_EVENTCHKINF(EVENTCHKINF_40)) { - Message_ContinueTextbox(globalCtx, 0x206D); + Message_ContinueTextbox(play, 0x206D); } else { - Message_ContinueTextbox(globalCtx, 0x206C); + Message_ContinueTextbox(play, 0x206C); } this->actionFunc = func_80ACAC6C; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x206E); + Message_ContinueTextbox(play, 0x206E); this->actionFunc = func_80ACA7E0; break; } @@ -457,33 +456,33 @@ void func_80ACAB88(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACAC6C(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x206A); +void func_80ACAC6C(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x206A); this->actionFunc = func_80ACAB88; this->actionFlags |= 2; func_80ACA71C(this); } } -void EnOwl_WaitKakariko(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitKakariko(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x206C, 480.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x206C, 480.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACAC6C; } } -void func_80ACAD34(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80ACAD34(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x206F); + Message_ContinueTextbox(play, 0x206F); this->actionFunc = func_80ACADF0; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x2070); + Message_ContinueTextbox(play, 0x2070); this->actionFunc = func_80ACA7E0; break; } @@ -493,33 +492,33 @@ void func_80ACAD34(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACADF0(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x206A); +void func_80ACADF0(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x206A); this->actionFunc = func_80ACAD34; this->actionFlags |= 2; func_80ACA71C(this); } } -void EnOwl_WaitGerudo(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitGerudo(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x206F, 360.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x206F, 360.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACADF0; } } -void func_80ACAEB8(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80ACAEB8(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x2071); + Message_ContinueTextbox(play, 0x2071); this->actionFunc = func_80ACAF74; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x2072); + Message_ContinueTextbox(play, 0x2072); this->actionFunc = func_80ACA7E0; break; } @@ -529,38 +528,38 @@ void func_80ACAEB8(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACAF74(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x206A); +void func_80ACAF74(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x206A); this->actionFunc = func_80ACAEB8; this->actionFlags |= 2; func_80ACA71C(this); } } -void EnOwl_WaitLakeHylia(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitLakeHylia(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x2071, 360.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x2071, 360.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACAF74; } } -void func_80ACB03C(EnOwl* this, GlobalContext* globalCtx) { - func_8002DF54(globalCtx, &this->actor, 8); +void func_80ACB03C(EnOwl* this, PlayState* play) { + func_8002DF54(play, &this->actor, 8); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); - func_80ACA62C(this, globalCtx); + func_80ACA62C(this, play); this->actor.flags &= ~ACTOR_FLAG_16; } } -void EnOwl_WaitZoraRiver(EnOwl* this, GlobalContext* globalCtx) { +void EnOwl_WaitZoraRiver(EnOwl* this, PlayState* play) { u16 textId; - EnOwl_LookAtLink(this, globalCtx); + EnOwl_LookAtLink(this, play); if (CHECK_QUEST_ITEM(QUEST_SONG_SARIA)) { if (CHECK_QUEST_ITEM(QUEST_SONG_LULLABY)) { @@ -572,97 +571,97 @@ void EnOwl_WaitZoraRiver(EnOwl* this, GlobalContext* globalCtx) { textId = 0x4002; } - if (EnOwl_CheckInitTalk(this, globalCtx, textId, 360.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, textId, 360.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB03C; } } -void func_80ACB148(EnOwl* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80ACB148(EnOwl* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); func_80ACA5C8(this); this->actionFunc = func_80ACC30C; - Flags_SetSwitch(globalCtx, 0x23); + Flags_SetSwitch(play, 0x23); } } -void EnOwl_WaitHyliaShortcut(EnOwl* this, GlobalContext* globalCtx) { +void EnOwl_WaitHyliaShortcut(EnOwl* this, PlayState* play) { u16 textId = GET_INFTABLE(INFTABLE_195) ? 0x4004 : 0x4003; // Spoke to Owl in Lake Hylia - EnOwl_LookAtLink(this, globalCtx); - if (func_80ACA558(this, globalCtx, textId)) { + EnOwl_LookAtLink(this, play); + if (func_80ACA558(this, play, textId)) { SET_INFTABLE(INFTABLE_195); Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB148; } } -void func_80ACB22C(EnOwl* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80ACB22C(EnOwl* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); func_80ACA5C8(this); this->actionFunc = func_80ACC30C; } } -void func_80ACB274(EnOwl* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80ACB274(EnOwl* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF); this->actionFunc = EnOwl_WaitDeathMountainShortcut; } } -void EnOwl_WaitDeathMountainShortcut(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitDeathMountainShortcut(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); if (!gSaveContext.magicAcquired) { - if (func_80ACA558(this, globalCtx, 0x3062)) { + if (func_80ACA558(this, play, 0x3062)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB274; return; } } else { - if (func_80ACA558(this, globalCtx, 0x3063)) { + if (func_80ACA558(this, play, 0x3063)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB22C; } } } -void func_80ACB344(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80ACB344(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x607A); + Message_ContinueTextbox(play, 0x607A); break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x607C); + Message_ContinueTextbox(play, 0x607C); this->actionFunc = func_80ACA7E0; break; } } } -void func_80ACB3E0(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void func_80ACB3E0(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x6079, 360.0f, 2)) { + if (EnOwl_CheckInitTalk(this, play, 0x6079, 360.0f, 2)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB344; } } -void func_80ACB440(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80ACB440(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x10C1); + Message_ContinueTextbox(play, 0x10C1); this->actionFunc = func_80ACB4FC; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x10C3); + Message_ContinueTextbox(play, 0x10C3); this->actionFunc = func_80ACA7E0; } @@ -671,33 +670,33 @@ void func_80ACB440(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACB4FC(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x10C2); +void func_80ACB4FC(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x10C2); this->actionFunc = func_80ACB440; this->actionFlags |= 2; func_80ACA71C(this); } } -void EnOwl_WaitLWPreSaria(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitLWPreSaria(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x10C0, 190.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x10C0, 190.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB4FC; } } -void func_80ACB5C4(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80ACB5C4(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case OWL_REPEAT: - Message_ContinueTextbox(globalCtx, 0x10C5); + Message_ContinueTextbox(play, 0x10C5); this->actionFunc = func_80ACB680; break; case OWL_OK: - Message_ContinueTextbox(globalCtx, 0x10C7); + Message_ContinueTextbox(play, 0x10C7); this->actionFunc = func_80ACA7E0; break; } @@ -707,34 +706,34 @@ void func_80ACB5C4(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACB680(EnOwl* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x10C6); +void func_80ACB680(EnOwl* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x10C6); this->actionFunc = func_80ACB5C4; this->actionFlags |= 2; func_80ACA71C(this); } } -void EnOwl_WaitLWPostSaria(EnOwl* this, GlobalContext* globalCtx) { - EnOwl_LookAtLink(this, globalCtx); +void EnOwl_WaitLWPostSaria(EnOwl* this, PlayState* play) { + EnOwl_LookAtLink(this, play); - if (EnOwl_CheckInitTalk(this, globalCtx, 0x10C4, 360.0f, 0)) { + if (EnOwl_CheckInitTalk(this, play, 0x10C4, 360.0f, 0)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_80ACB680; } } -void func_80ACB748(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACB748(EnOwl* this, PlayState* play) { static Vec3f D_80ACD62C = { 0.0f, 0.0f, 0.0f }; f32 dist; f32 weight; s32 owlType = (this->actor.params & 0xFC0) >> 6; - dist = Math3D_Vec3f_DistXYZ(&this->eye, &globalCtx->view.eye) / 45.0f; - this->eye.x = globalCtx->view.eye.x; - this->eye.y = globalCtx->view.eye.y; - this->eye.z = globalCtx->view.eye.z; + dist = Math3D_Vec3f_DistXYZ(&this->eye, &play->view.eye) / 45.0f; + this->eye.x = play->view.eye.x; + this->eye.y = play->view.eye.y; + this->eye.z = play->view.eye.z; weight = dist; if (weight > 1.0f) { @@ -744,74 +743,72 @@ void func_80ACB748(EnOwl* this, GlobalContext* globalCtx) { switch (owlType) { case 7: func_800F436C(&D_80ACD62C, NA_SE_EV_FLYING_AIR - SFX_FLAG, weight * 2.0f); - if ((globalCtx->csCtx.frames > 324) || - ((globalCtx->csCtx.frames >= 142 && (globalCtx->csCtx.frames <= 266)))) { + if ((play->csCtx.frames > 324) || ((play->csCtx.frames >= 142 && (play->csCtx.frames <= 266)))) { func_800F4414(&D_80ACD62C, NA_SE_EN_OWL_FLUTTER, weight * 2.0f); } - if (globalCtx->csCtx.frames == 85) { + if (play->csCtx.frames == 85) { func_800F436C(&D_80ACD62C, NA_SE_EV_PASS_AIR, weight * 2.0f); } break; case 8: case 9: func_800F436C(&D_80ACD62C, NA_SE_EV_FLYING_AIR - SFX_FLAG, weight * 2.0f); - if ((globalCtx->csCtx.frames >= 420) || - ((0xC1 < globalCtx->csCtx.frames && (globalCtx->csCtx.frames <= 280)))) { + if ((play->csCtx.frames >= 420) || ((0xC1 < play->csCtx.frames && (play->csCtx.frames <= 280)))) { func_800F4414(&D_80ACD62C, NA_SE_EN_OWL_FLUTTER, weight * 2.0f); } - if (globalCtx->csCtx.frames == 217) { + if (play->csCtx.frames == 217) { func_800F436C(&D_80ACD62C, NA_SE_EV_PASS_AIR, weight * 2.0f); } break; } } -void func_80ACB904(EnOwl* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && (globalCtx->csCtx.npcActions[7] != NULL)) { - if (this->unk_40A != globalCtx->csCtx.npcActions[7]->action) { - func_80ACD130(this, globalCtx, 7); - func_80ACBAB8(this, globalCtx); +void func_80ACB904(EnOwl* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE && (play->csCtx.npcActions[7] != NULL)) { + if (this->unk_40A != play->csCtx.npcActions[7]->action) { + func_80ACD130(this, play, 7); + func_80ACBAB8(this, play); } - func_80ACD2CC(this, globalCtx); + func_80ACD2CC(this, play); } if (this->actionFlags & 0x80) { - func_80ACB748(this, globalCtx); + func_80ACB748(this, play); } } -void func_80ACB994(EnOwl* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && (globalCtx->csCtx.npcActions[7] != NULL)) { - if (this->unk_40A != globalCtx->csCtx.npcActions[7]->action) { - func_80ACD130(this, globalCtx, 7); - func_80ACBAB8(this, globalCtx); +void func_80ACB994(EnOwl* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE && (play->csCtx.npcActions[7] != NULL)) { + if (this->unk_40A != play->csCtx.npcActions[7]->action) { + func_80ACD130(this, play, 7); + func_80ACBAB8(this, play); } - func_80ACD4D4(this, globalCtx); + func_80ACD4D4(this, play); } if (this->actionFlags & 0x80) { - func_80ACB748(this, globalCtx); + func_80ACB748(this, play); } } -void EnOwl_WaitDefault(EnOwl* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && (globalCtx->csCtx.npcActions[7] != NULL)) { - if (this->unk_40A != globalCtx->csCtx.npcActions[7]->action) { +void EnOwl_WaitDefault(EnOwl* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE && (play->csCtx.npcActions[7] != NULL)) { + if (this->unk_40A != play->csCtx.npcActions[7]->action) { this->actionFlags |= 4; - func_80ACD130(this, globalCtx, 7); - func_80ACBAB8(this, globalCtx); + func_80ACD130(this, play, 7); + func_80ACBAB8(this, play); } else { - this->actor.world.rot.z = globalCtx->csCtx.npcActions[7]->urot.y; + this->actor.world.rot.z = play->csCtx.npcActions[7]->urot.y; } } if (this->actionFlags & 0x80) { - func_80ACB748(this, globalCtx); + func_80ACB748(this, play); } } -void func_80ACBAB8(EnOwl* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.npcActions[7]->action - 1) { +void func_80ACBAB8(EnOwl* this, PlayState* play) { + switch (play->csCtx.npcActions[7]->action - 1) { case 0: EnOwl_ChangeMode(this, func_80ACB904, func_80ACC540, &this->skelAnime, &gOwlFlyAnim, 0.0f); break; @@ -832,10 +829,10 @@ void func_80ACBAB8(EnOwl* this, GlobalContext* globalCtx) { break; } - this->unk_40A = globalCtx->csCtx.npcActions[7]->action; + this->unk_40A = play->csCtx.npcActions[7]->action; } -void func_80ACBC0C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACBC0C(EnOwl* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_5; if (this->actor.xzDistToPlayer > 6000.0f && !(this->actionFlags & 0x80)) { @@ -860,7 +857,7 @@ void func_80ACBC0C(EnOwl* this, GlobalContext* globalCtx) { this->actionFlags |= 8; } -void func_80ACBD4C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACBD4C(EnOwl* this, PlayState* play) { if (this->skelAnime.curFrame > 10.0f) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_400, 2, 0x400, 0x40); this->actor.shape.rot.y = this->actor.world.rot.y; @@ -889,7 +886,7 @@ void func_80ACBD4C(EnOwl* this, GlobalContext* globalCtx) { this->actionFlags |= 8; } -void func_80ACBEA0(EnOwl* this, GlobalContext* GlobalContext) { +void func_80ACBEA0(EnOwl* this, PlayState* play) { if (this->actionFlags & 1) { this->unk_3FE = 3; EnOwl_ChangeMode(this, func_80ACBD4C, func_80ACC540, &this->skelAnime, &gOwlTakeoffAnim, 0.0f); @@ -905,7 +902,7 @@ void func_80ACBEA0(EnOwl* this, GlobalContext* GlobalContext) { this->actionFlags |= 8; } -void func_80ACBF50(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACBF50(EnOwl* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_400, 2, 0x384, 0x258); this->actor.shape.rot.y = this->actor.world.rot.y; @@ -919,7 +916,7 @@ void func_80ACBF50(EnOwl* this, GlobalContext* globalCtx) { this->actionFlags |= 8; } -void func_80ACC00C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACC00C(EnOwl* this, PlayState* play) { s32 owlType; s32 temp_v0; s32 temp_v0_2; @@ -928,7 +925,7 @@ void func_80ACC00C(EnOwl* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; if (this->actor.xzDistToPlayer < 50.0f) { - if (!Play_InCsMode(globalCtx)) { + if (!Play_InCsMode(play)) { owlType = (this->actor.params & 0xFC0) >> 6; osSyncPrintf(VT_FGCOL(CYAN)); osSyncPrintf("%dのフクロウ\n", owlType); // "%d owl" @@ -938,12 +935,12 @@ void func_80ACC00C(EnOwl* this, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(CYAN)); osSyncPrintf("SPOT 06 の デモがはしった\n"); // "Demo of SPOT 06 has been completed" osSyncPrintf(VT_RST); - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gLakeHyliaOwlCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gLakeHyliaOwlCs); this->actor.draw = NULL; break; case 8: case 9: - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gDMTOwlCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gDMTOwlCs); this->actor.draw = NULL; break; default: @@ -973,7 +970,7 @@ void func_80ACC00C(EnOwl* this, GlobalContext* globalCtx) { this->actionFlags |= 8; } -void func_80ACC23C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACC23C(EnOwl* this, PlayState* play) { if (this->skelAnime.curFrame < 20.0f) { this->actor.speedXZ = 1.5f; } else { @@ -994,7 +991,7 @@ void func_80ACC23C(EnOwl* this, GlobalContext* globalCtx) { this->actionFlags |= 8; } -void func_80ACC30C(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACC30C(EnOwl* this, PlayState* play) { if (this->actionFlags & 1) { this->unk_3FE = 3; EnOwl_ChangeMode(this, func_80ACC23C, func_80ACC540, &this->skelAnime, &gOwlTakeoffAnim, 0.0f); @@ -1059,41 +1056,40 @@ s32 func_80ACC5CC(EnOwl* this) { } } -s32 func_80ACC624(EnOwl* this, GlobalContext* globalCtx) { +s32 func_80ACC624(EnOwl* this, PlayState* play) { s32 switchFlag = (this->actor.params & 0xFC0) >> 6; - if (globalCtx->sceneNum != SCENE_SPOT11) { + if (play->sceneNum != SCENE_SPOT11) { return true; } else if (switchFlag == 0xA) { return true; - } else if (globalCtx->csCtx.frames >= 300 && globalCtx->csCtx.frames <= 430) { + } else if (play->csCtx.frames >= 300 && play->csCtx.frames <= 430) { return true; - } else if (globalCtx->csCtx.frames >= 1080 && globalCtx->csCtx.frames <= 1170) { + } else if (play->csCtx.frames >= 1080 && play->csCtx.frames <= 1170) { return true; } else { return false; } } -void EnOwl_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Update(Actor* thisx, PlayState* play) { s32 pad; EnOwl* this = (EnOwl*)thisx; s16 phi_a1; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); this->unk_410(this); this->actionFlags &= ~8; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update == NULL) { // "Owl disappears" osSyncPrintf("フクロウ消滅!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); return; } - if (!(this->actionFlags & 0x80) && func_80ACC624(this, globalCtx)) { + if (!(this->actionFlags & 0x80) && func_80ACC624(this, play)) { if ((this->skelAnime.animation == &gOwlTakeoffAnim && (this->skelAnime.curFrame == 2.0f || this->skelAnime.curFrame == 9.0f || this->skelAnime.curFrame == 23.0f || this->skelAnime.curFrame == 40.0f || @@ -1267,7 +1263,7 @@ void EnOwl_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnOwl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** gfx, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnOwl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** gfx, Vec3f* pos, Vec3s* rot, void* thisx) { EnOwl* this = (EnOwl*)thisx; switch (limbIndex) { @@ -1295,7 +1291,7 @@ s32 EnOwl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** gfx, V return false; } -void EnOwl_PostLimbUpdate(GlobalContext* globalCtx, s32 limbIndex, Gfx** gfx, Vec3s* rot, void* thisx) { +void EnOwl_PostLimbUpdate(PlayState* play, s32 limbIndex, Gfx** gfx, Vec3s* rot, void* thisx) { EnOwl* this = (EnOwl*)thisx; Vec3f vec; @@ -1312,19 +1308,19 @@ void EnOwl_PostLimbUpdate(GlobalContext* globalCtx, s32 limbIndex, Gfx** gfx, Ve } } -void EnOwl_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gObjOwlEyeOpenTex, gObjOwlEyeHalfTex, gObjOwlEyeClosedTex }; EnOwl* this = (EnOwl*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_owl.c", 2247); + OPEN_DISPS(play->state.gfxCtx, "../z_en_owl.c", 2247); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->curSkelAnime->skeleton, this->curSkelAnime->jointTable, + SkelAnime_DrawFlexOpa(play, this->curSkelAnime->skeleton, this->curSkelAnime->jointTable, this->curSkelAnime->dListCount, EnOwl_OverrideLimbDraw, EnOwl_PostLimbUpdate, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_owl.c", 2264); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_owl.c", 2264); } void EnOwl_ChangeMode(EnOwl* this, EnOwlActionFunc actionFunc, OwlFunc arg2, SkelAnime* skelAnime, @@ -1336,20 +1332,20 @@ void EnOwl_ChangeMode(EnOwl* this, EnOwlActionFunc actionFunc, OwlFunc arg2, Ske this->unk_410 = arg2; } -void func_80ACD130(EnOwl* this, GlobalContext* globalCtx, s32 idx) { +void func_80ACD130(EnOwl* this, PlayState* play, s32 idx) { Vec3f startPos; - startPos.x = globalCtx->csCtx.npcActions[idx]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[idx]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[idx]->startPos.z; + startPos.x = play->csCtx.npcActions[idx]->startPos.x; + startPos.y = play->csCtx.npcActions[idx]->startPos.y; + startPos.z = play->csCtx.npcActions[idx]->startPos.z; this->actor.world.pos = startPos; - this->actor.world.rot.y = this->actor.shape.rot.y = globalCtx->csCtx.npcActions[idx]->rot.y; - this->actor.shape.rot.z = globalCtx->csCtx.npcActions[idx]->urot.z; + this->actor.world.rot.y = this->actor.shape.rot.y = play->csCtx.npcActions[idx]->rot.y; + this->actor.shape.rot.z = play->csCtx.npcActions[idx]->urot.z; } -f32 func_80ACD1C4(GlobalContext* globalCtx, s32 idx) { - f32 ret = Environment_LerpWeight(globalCtx->csCtx.npcActions[idx]->endFrame, - globalCtx->csCtx.npcActions[idx]->startFrame, globalCtx->csCtx.frames); +f32 func_80ACD1C4(PlayState* play, s32 idx) { + f32 ret = Environment_LerpWeight(play->csCtx.npcActions[idx]->endFrame, play->csCtx.npcActions[idx]->startFrame, + play->csCtx.frames); ret = CLAMP_MAX(ret, 1.0f); return ret; @@ -1368,22 +1364,22 @@ void func_80ACD220(EnOwl* this, Vec3f* arg1, f32 arg2) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void func_80ACD2CC(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACD2CC(EnOwl* this, PlayState* play) { Vec3f pos; s32 angle; - f32 t = func_80ACD1C4(globalCtx, 7); + f32 t = func_80ACD1C4(play, 7); - pos.x = globalCtx->csCtx.npcActions[7]->startPos.x; - pos.y = globalCtx->csCtx.npcActions[7]->startPos.y; - pos.z = globalCtx->csCtx.npcActions[7]->startPos.z; - angle = (s16)globalCtx->csCtx.npcActions[7]->rot.y - this->actor.world.rot.z; + pos.x = play->csCtx.npcActions[7]->startPos.x; + pos.y = play->csCtx.npcActions[7]->startPos.y; + pos.z = play->csCtx.npcActions[7]->startPos.z; + angle = (s16)play->csCtx.npcActions[7]->rot.y - this->actor.world.rot.z; if (angle < 0) { angle += 0x10000; } angle = (s16)((t * angle) + this->actor.world.rot.z); angle = (u16)angle; if (this->actionFlags & 4) { - f32 phi_f2 = globalCtx->csCtx.npcActions[7]->urot.x; + f32 phi_f2 = play->csCtx.npcActions[7]->urot.x; phi_f2 *= 10.0f * (360.0f / 0x10000); if (phi_f2 < 0.0f) { @@ -1403,17 +1399,17 @@ void func_80ACD2CC(EnOwl* this, GlobalContext* globalCtx) { } } -void func_80ACD4D4(EnOwl* this, GlobalContext* globalCtx) { +void func_80ACD4D4(EnOwl* this, PlayState* play) { Vec3f pos; Vec3f endPosf; - f32 temp_ret = func_80ACD1C4(globalCtx, 7); + f32 temp_ret = func_80ACD1C4(play, 7); - pos.x = globalCtx->csCtx.npcActions[7]->startPos.x; - pos.y = globalCtx->csCtx.npcActions[7]->startPos.y; - pos.z = globalCtx->csCtx.npcActions[7]->startPos.z; - endPosf.x = globalCtx->csCtx.npcActions[7]->endPos.x; - endPosf.y = globalCtx->csCtx.npcActions[7]->endPos.y; - endPosf.z = globalCtx->csCtx.npcActions[7]->endPos.z; + pos.x = play->csCtx.npcActions[7]->startPos.x; + pos.y = play->csCtx.npcActions[7]->startPos.y; + pos.z = play->csCtx.npcActions[7]->startPos.z; + endPosf.x = play->csCtx.npcActions[7]->endPos.x; + endPosf.y = play->csCtx.npcActions[7]->endPos.y; + endPosf.z = play->csCtx.npcActions[7]->endPos.z; pos.x = (endPosf.x - pos.x) * temp_ret + pos.x; pos.y = (endPosf.y - pos.y) * temp_ret + pos.y; pos.z = (endPosf.z - pos.z) * temp_ret + pos.z; diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.h b/src/overlays/actors/ovl_En_Owl/z_en_owl.h index 4534c36385..4f92ef1b41 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.h +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.h @@ -6,7 +6,7 @@ struct EnOwl; -typedef void (*EnOwlActionFunc)(struct EnOwl*, GlobalContext*); +typedef void (*EnOwlActionFunc)(struct EnOwl*, PlayState*); typedef void (*OwlFunc)(struct EnOwl*); typedef struct EnOwl { diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c index a202e94eb5..57ebc46d8d 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -10,10 +10,10 @@ #define FLAGS ACTOR_FLAG_4 -void EnPart_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPart_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPart_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPart_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPart_Init(Actor* thisx, PlayState* play); +void EnPart_Destroy(Actor* thisx, PlayState* play); +void EnPart_Update(Actor* thisx, PlayState* play); +void EnPart_Draw(Actor* thisx, PlayState* play); const ActorInit En_Part_InitVars = { ACTOR_EN_PART, @@ -27,13 +27,13 @@ const ActorInit En_Part_InitVars = { (ActorFunc)EnPart_Draw, }; -void EnPart_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPart_Init(Actor* thisx, PlayState* play) { } -void EnPart_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPart_Destroy(Actor* thisx, PlayState* play) { } -void func_80ACDDE8(EnPart* this, GlobalContext* globalCtx) { +void func_80ACDDE8(EnPart* this, PlayState* play) { f32 sign = 1.0f; this->action = 1; @@ -58,7 +58,7 @@ void func_80ACDDE8(EnPart* this, GlobalContext* globalCtx) { this->rotZSpeed = 0.15f; break; case 14: - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &this->actor.world.pos, 40, 0x8001, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, 40, 0x8001, 0, -1); case 1: case 4: case 9: @@ -70,7 +70,7 @@ void func_80ACDDE8(EnPart* this, GlobalContext* globalCtx) { this->rotZSpeed = 0.15f; break; case 11: - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &this->actor.world.pos, 40, 0x8001, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, 40, 0x8001, 0, -1); case 3: this->actor.speedXZ = (Rand_ZeroOne() - 0.5f) * 3.0f; this->timer = (s16)(Rand_ZeroOne() * 17.0f) + 10; @@ -96,7 +96,7 @@ void func_80ACDDE8(EnPart* this, GlobalContext* globalCtx) { } } -void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { +void func_80ACE13C(EnPart* this, PlayState* play) { s32 i; Vec3f pos; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -104,7 +104,7 @@ void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; if ((this->actor.params == 12) || (this->actor.params == 13)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); @@ -124,13 +124,13 @@ void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { case 9: case 10: case 14: - EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &zeroVec, &zeroVec, + EffectSsDeadDb_Spawn(play, &this->actor.world.pos, &zeroVec, &zeroVec, (s16)(this->actor.scale.y * 100.0f) * 40, 7, 255, 255, 255, 255, 0, 255, 0, 1, 9, true); break; case 3: case 11: - EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &zeroVec, &zeroVec, + EffectSsDeadDb_Spawn(play, &this->actor.world.pos, &zeroVec, &zeroVec, (s16)(this->actor.scale.y * 100.0f) * 40, 7, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); break; @@ -141,8 +141,8 @@ void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { Rand_CenteredFloat(50.0f); pos.z = this->actor.world.pos.z + Rand_CenteredFloat(60.0f); velocity.y = Rand_ZeroOne() + 1.0f; - EffectSsDtBubble_SpawnColorProfile(globalCtx, &pos, &velocity, &accel, Rand_S16Offset(80, 100), 25, - 0, true); + EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, Rand_S16Offset(80, 100), 25, 0, + true); } break; case 5: @@ -153,8 +153,8 @@ void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + Rand_CenteredFloat(25.0f); pos.y = this->actor.world.pos.y + Rand_CenteredFloat(40.0f); pos.z = this->actor.world.pos.z + Rand_CenteredFloat(25.0f); - EffectSsDeadDb_Spawn(globalCtx, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 0, 0, 255, 1, - 9, true); + EffectSsDeadDb_Spawn(play, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 0, 0, 255, 1, 9, + true); } break; } @@ -167,12 +167,12 @@ void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { this->rotZ += this->rotZSpeed; } -void func_80ACE5B8(EnPart* this, GlobalContext* globalCtx) { +void func_80ACE5B8(EnPart* this, PlayState* play) { this->action = 3; } -void func_80ACE5C8(EnPart* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ACE5C8(EnPart* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->timer--; if (this->timer == 0) { @@ -189,29 +189,29 @@ void func_80ACE5C8(EnPart* this, GlobalContext* globalCtx) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); } } - func_8002F71C(globalCtx, this->actor.parent, (650.0f - this->actor.parent->xzDistToPlayer) * 0.04f + 4.0f, + func_8002F71C(play, this->actor.parent, (650.0f - this->actor.parent->xzDistToPlayer) * 0.04f + 4.0f, this->actor.parent->world.rot.y, 8.0f); player->invincibilityTimer = prevInvincibilityTimer; this->timer = 1; } - func_80033480(globalCtx, &this->actor.world.pos, 0.0f, 1, 300, 150, 1); + func_80033480(play, &this->actor.world.pos, 0.0f, 1, 300, 150, 1); velocity.x = Rand_CenteredFloat(16.0f); - EffectSsHahen_Spawn(globalCtx, &this->actor.world.pos, &velocity, &accel, 20, + EffectSsHahen_Spawn(play, &this->actor.world.pos, &velocity, &accel, 20, (s32)((Rand_ZeroOne() * 5.0f + 12.0f) * 2), -1, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MONBLIN_GNDWAVE - SFX_FLAG); } } -void func_80ACE7E8(EnPart* this, GlobalContext* globalCtx) { +void func_80ACE7E8(EnPart* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; if ((this->actor.parent == NULL) || (this->actor.parent->update == NULL)) { - EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &zeroVec, &zeroVec, - (s16)(this->actor.scale.y * 100.0f) * 40, 7, 255, 255, 255, 255, 0, 255, 0, 1, 9, true); + EffectSsDeadDb_Spawn(play, &this->actor.world.pos, &zeroVec, &zeroVec, (s16)(this->actor.scale.y * 100.0f) * 40, + 7, 255, 255, 255, 255, 0, 255, 0, 1, 9, true); Actor_Kill(&this->actor); return; } @@ -236,7 +236,7 @@ void func_80ACE7E8(EnPart* this, GlobalContext* globalCtx) { } } -void EnPart_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPart_Update(Actor* thisx, PlayState* play) { static EnPartActionFunc sActionFuncs[] = { func_80ACDDE8, func_80ACE13C, func_80ACE5B8, func_80ACE5C8, func_80ACE7E8, }; @@ -246,8 +246,7 @@ void EnPart_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if ((this->actor.params > 4 && this->actor.params < 9) || this->actor.params < 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if (this->actor.params >= 0) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); if (thisx->bgCheckFlags & BGCHECKFLAG_GROUND) { @@ -257,7 +256,7 @@ void EnPart_Update(Actor* thisx, GlobalContext* globalCtx) { } } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } Gfx* func_80ACEAC0(GraphicsContext* gfxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) { @@ -275,30 +274,30 @@ Gfx* func_80ACEAC0(GraphicsContext* gfxCtx, u8 primR, u8 primG, u8 primB, u8 env return dList; } -void EnPart_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPart_Draw(Actor* thisx, PlayState* play) { EnPart* this = (EnPart*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_part.c", 647); + OPEN_DISPS(play->state.gfxCtx, "../z_en_part.c", 647); if (thisx->params > 0) { Matrix_RotateZ(this->rotZ, MTXMODE_APPLY); } - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(thisx, globalCtx, 0); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(thisx, play, 0); if (thisx->params == 5) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(globalCtx->state.gfxCtx, 245, 255, 205, 30, 35, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(globalCtx->state.gfxCtx, 185, 135, 25, 20, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(globalCtx->state.gfxCtx, 255, 255, 255, 30, 40, 20)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(play->state.gfxCtx, 245, 255, 205, 30, 35, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(play->state.gfxCtx, 185, 135, 25, 20, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(play->state.gfxCtx, 255, 255, 255, 30, 40, 20)); } else if (thisx->params == 6) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(globalCtx->state.gfxCtx, 55, 65, 55, 0, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(globalCtx->state.gfxCtx, 205, 165, 75, 25, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(globalCtx->state.gfxCtx, 205, 165, 75, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(play->state.gfxCtx, 55, 65, 55, 0, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(play->state.gfxCtx, 205, 165, 75, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(play->state.gfxCtx, 205, 165, 75, 25, 20, 0)); } else if (thisx->params == 7) { - gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(globalCtx->state.gfxCtx, 255, 255, 255, 180, 180, 180)); - gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(globalCtx->state.gfxCtx, 225, 205, 115, 25, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(globalCtx->state.gfxCtx, 225, 205, 115, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80ACEAC0(play->state.gfxCtx, 255, 255, 255, 180, 180, 180)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(play->state.gfxCtx, 225, 205, 115, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(play->state.gfxCtx, 225, 205, 115, 25, 20, 0)); } else if ((thisx->params == 9) && (this->displayList == object_tite_DL_002FF0)) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(object_tite_Tex_001300)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(object_tite_Tex_001700)); @@ -310,10 +309,10 @@ void EnPart_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (this->displayList != NULL) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_part.c", 696), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_part.c", 696), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->displayList); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_part.c", 700); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_part.c", 700); } diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.h b/src/overlays/actors/ovl_En_Part/z_en_part.h index 8beb516a3b..3502d80a80 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.h +++ b/src/overlays/actors/ovl_En_Part/z_en_part.h @@ -6,7 +6,7 @@ struct EnPart; -typedef void (*EnPartActionFunc)(struct EnPart*, GlobalContext*); +typedef void (*EnPartActionFunc)(struct EnPart*, PlayState*); typedef struct EnPart { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 40840a85a4..7474c74f24 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -8,37 +8,37 @@ #define GROUND_HOVER_HEIGHT 75.0f #define MAX_LARVA 3 -void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPeehat_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPeehat_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPeehat_Init(Actor* thisx, PlayState* play); +void EnPeehat_Destroy(Actor* thisx, PlayState* play); +void EnPeehat_Update(Actor* thisx, PlayState* play); +void EnPeehat_Draw(Actor* thisx, PlayState* play); void EnPeehat_Ground_SetStateGround(EnPeehat* this); void EnPeehat_Flying_SetStateGround(EnPeehat* this); void EnPeehat_Larva_SetStateSeekPlayer(EnPeehat* this); -void EnPeehat_Ground_StateGround(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Ground_StateGround(EnPeehat* this, PlayState* play); void EnPeehat_Ground_SetStateRise(EnPeehat* this); -void EnPeehat_Flying_StateGrounded(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Flying_StateGrounded(EnPeehat* this, PlayState* play); void EnPeehat_Flying_SetStateRise(EnPeehat* this); -void EnPeehat_Flying_StateFly(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Flying_StateFly(EnPeehat* this, PlayState* play); void EnPeehat_Flying_SetStateLanding(EnPeehat* this); -void EnPeehat_Ground_StateRise(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Ground_StateRise(EnPeehat* this, PlayState* play); void EnPeehat_Ground_SetStateHover(EnPeehat* this); -void EnPeehat_Flying_StateRise(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Flying_StateRise(EnPeehat* this, PlayState* play); +void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, PlayState* play); void EnPeehat_Ground_SetStateReturnHome(EnPeehat* this); void EnPeehat_Ground_SetStateLanding(EnPeehat* this); -void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, PlayState* play); void EnPeehat_SetStateAttackRecoil(EnPeehat* this); -void EnPeehat_Ground_StateLanding(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_Flying_StateLanding(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_Ground_StateHover(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_Ground_StateReturnHome(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_StateAttackRecoil(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_StateBoomerangStunned(EnPeehat* this, GlobalContext* globalCtx); -void EnPeehat_Adult_StateDie(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_Ground_StateLanding(EnPeehat* this, PlayState* play); +void EnPeehat_Flying_StateLanding(EnPeehat* this, PlayState* play); +void EnPeehat_Ground_StateHover(EnPeehat* this, PlayState* play); +void EnPeehat_Ground_StateReturnHome(EnPeehat* this, PlayState* play); +void EnPeehat_StateAttackRecoil(EnPeehat* this, PlayState* play); +void EnPeehat_StateBoomerangStunned(EnPeehat* this, PlayState* play); +void EnPeehat_Adult_StateDie(EnPeehat* this, PlayState* play); void EnPeehat_SetStateExplode(EnPeehat* this); -void EnPeehat_StateExplode(EnPeehat* this, GlobalContext* globalCtx); +void EnPeehat_StateExplode(EnPeehat* this, PlayState* play); const ActorInit En_Peehat_InitVars = { ACTOR_EN_PEEHAT, @@ -187,13 +187,12 @@ void EnPeehat_SetupAction(EnPeehat* this, EnPeehatActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPeehat_Init(Actor* thisx, PlayState* play) { EnPeehat* this = (EnPeehat*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetScale(&this->actor, 36.0f * 0.001f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gPeehatSkel, &gPeehatRisingAnim, this->jointTable, this->morphTable, - 24); + SkelAnime_Init(play, &this->skelAnime, &gPeehatSkel, &gPeehatRisingAnim, this->jointTable, this->morphTable, 24); ActorShape_Init(&this->actor.shape, 100.0f, ActorShadow_DrawCircle, 27.0f); this->actor.focus.pos = this->actor.world.pos; this->unk_2D4 = 0; @@ -202,12 +201,12 @@ void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.health = 6; this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.floorHeight = this->actor.world.pos.y; - Collider_InitCylinder(globalCtx, &this->colCylinder); - Collider_SetCylinder(globalCtx, &this->colCylinder, &this->actor, &sCylinderInit); - Collider_InitQuad(globalCtx, &this->colQuad); - Collider_SetQuad(globalCtx, &this->colQuad, &this->actor, &sQuadInit); - Collider_InitJntSph(globalCtx, &this->colJntSph); - Collider_SetJntSph(globalCtx, &this->colJntSph, &this->actor, &sJntSphInit, this->colJntSphItemList); + Collider_InitCylinder(play, &this->colCylinder); + Collider_SetCylinder(play, &this->colCylinder, &this->actor, &sCylinderInit); + Collider_InitQuad(play, &this->colQuad); + Collider_SetQuad(play, &this->colQuad, &this->actor, &sQuadInit); + Collider_InitJntSph(play, &this->colJntSph); + Collider_SetJntSph(play, &this->colJntSph, &this->actor, &sJntSphInit, this->colJntSphItemList); this->actor.naviEnemyId = NAVI_ENEMY_PEAHAT; this->xzDistToRise = 740.0f; @@ -241,12 +240,12 @@ void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnPeehat_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPeehat_Destroy(Actor* thisx, PlayState* play) { EnPeehat* this = (EnPeehat*)thisx; EnPeehat* parent; - Collider_DestroyCylinder(globalCtx, &this->colCylinder); - Collider_DestroyJntSph(globalCtx, &this->colJntSph); + Collider_DestroyCylinder(play, &this->colCylinder); + Collider_DestroyJntSph(play, &this->colJntSph); // If PEAHAT_TYPE_LARVA, decrement total larva spawned if (this->actor.params > 0) { @@ -257,7 +256,7 @@ void EnPeehat_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void EnPeehat_SpawnDust(GlobalContext* globalCtx, EnPeehat* this, Vec3f* pos, f32 arg3, s32 arg4, f32 arg5, f32 arg6) { +void EnPeehat_SpawnDust(PlayState* play, EnPeehat* this, Vec3f* pos, f32 arg3, s32 arg4, f32 arg5, f32 arg6) { Vec3f dustPos; Vec3f dustVel = { 0.0f, 8.0f, 0.0f }; Vec3f dustAccel = { 0.0f, -1.5f, 0.0f }; @@ -272,21 +271,21 @@ void EnPeehat_SpawnDust(GlobalContext* globalCtx, EnPeehat* this, Vec3f* pos, f3 dustAccel.z = (Rand_ZeroOne() - 0.5f) * arg5; dustVel.y += (Rand_ZeroOne() - 0.5f) * 4.0f; pScale = (Rand_ZeroOne() * 5 + 12) * arg6; - EffectSsHahen_Spawn(globalCtx, &dustPos, &dustVel, &dustAccel, arg4, pScale, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_Spawn(play, &dustPos, &dustVel, &dustAccel, arg4, pScale, HAHEN_OBJECT_DEFAULT, 10, NULL); } /** * Handles being hit when on the ground */ -void EnPeehat_HitWhenGrounded(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_HitWhenGrounded(EnPeehat* this, PlayState* play) { this->colCylinder.base.acFlags &= ~AC_HIT; - if ((globalCtx->gameplayFrames & 0xF) == 0) { + if ((play->gameplayFrames & 0xF) == 0) { Vec3f itemDropPos = this->actor.world.pos; itemDropPos.y += 70.0f; - Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40); - Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40); - Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &itemDropPos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &itemDropPos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &itemDropPos, 0x40); this->unk_2D4 = 240; } else { s32 i; @@ -294,7 +293,7 @@ void EnPeehat_HitWhenGrounded(EnPeehat* this, GlobalContext* globalCtx) { this->colCylinder.base.acFlags &= ~AC_HIT; for (i = MAX_LARVA - this->unk_2FA; i > 0; i--) { Actor* larva = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PEEHAT, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PEEHAT, Rand_CenteredFloat(25.0f) + this->actor.world.pos.x, Rand_CenteredFloat(25.0f) + (this->actor.world.pos.y + 50.0f), Rand_CenteredFloat(25.0f) + this->actor.world.pos.z, 0, 0, 0, PEAHAT_TYPE_LARVA); @@ -321,7 +320,7 @@ void EnPeehat_Ground_SetStateGround(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateGround); } -void EnPeehat_Ground_StateGround(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Ground_StateGround(EnPeehat* this, PlayState* play) { if (IS_DAY) { this->actor.flags |= ACTOR_FLAG_0; if (this->riseDelayTimer == 0) { @@ -343,7 +342,7 @@ void EnPeehat_Ground_StateGround(EnPeehat* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.005f, 0.0f); } } else if (this->colCylinder.base.acFlags & AC_HIT) { - EnPeehat_HitWhenGrounded(this, globalCtx); + EnPeehat_HitWhenGrounded(this, play); } } } @@ -358,7 +357,7 @@ void EnPeehat_Flying_SetStateGround(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Flying_StateGrounded); } -void EnPeehat_Flying_StateGrounded(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Flying_StateGrounded(EnPeehat* this, PlayState* play) { if (IS_DAY) { if (this->actor.xzDistToPlayer < this->xzDistToRise) { EnPeehat_Flying_SetStateRise(this); @@ -373,7 +372,7 @@ void EnPeehat_Flying_StateGrounded(EnPeehat* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.005f, 0.0f); } } else if (this->colCylinder.base.acFlags & AC_HIT) { - EnPeehat_HitWhenGrounded(this, globalCtx); + EnPeehat_HitWhenGrounded(this, play); } } } @@ -384,14 +383,14 @@ void EnPeehat_Flying_SetStateFly(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Flying_StateFly); } -void EnPeehat_Flying_StateFly(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Flying_StateFly(EnPeehat* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); SkelAnime_Update(&this->skelAnime); if (!IS_DAY || this->xzDistToRise < this->actor.xzDistToPlayer) { EnPeehat_Flying_SetStateLanding(this); } else if (this->actor.xzDistToPlayer < this->xzDistMax) { - if (this->unk_2FA < MAX_LARVA && (globalCtx->gameplayFrames & 7) == 0) { - Actor* larva = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PEEHAT, + if (this->unk_2FA < MAX_LARVA && (play->gameplayFrames & 7) == 0) { + Actor* larva = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PEEHAT, Rand_CenteredFloat(25.0f) + this->actor.world.pos.x, Rand_CenteredFloat(5.0f) + this->actor.world.pos.y, Rand_CenteredFloat(25.0f) + this->actor.world.pos.z, 0, 0, 0, 1); @@ -416,7 +415,7 @@ void EnPeehat_Ground_SetStateRise(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateRise); } -void EnPeehat_Ground_StateRise(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Ground_StateRise(EnPeehat* this, PlayState* play) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 50.0f, 0.0f); if (Math_SmoothStepToS(&this->bladeRotVel, 4000, 1, 800, 0) == 0) { if (this->animTimer != 0) { @@ -436,10 +435,10 @@ void EnPeehat_Ground_StateRise(EnPeehat* this, GlobalContext* globalCtx) { if (this->actor.world.pos.y - this->actor.floorHeight < 80.0f) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight; - func_80033480(globalCtx, &pos, 90.0f, 1, 0x96, 100, 1); + func_80033480(play, &pos, 90.0f, 1, 0x96, 100, 1); } } - EnPeehat_SpawnDust(globalCtx, this, &this->actor.world.pos, 75.0f, 2, 1.05f, 2.0f); + EnPeehat_SpawnDust(play, this, &this->actor.world.pos, 75.0f, 2, 1.05f, 2.0f); Math_SmoothStepToF(&this->scaleShift, 0.075f, 1.0f, 0.005f, 0.0f); this->bladeRot += this->bladeRotVel; } @@ -457,7 +456,7 @@ void EnPeehat_Flying_SetStateRise(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Flying_StateRise); } -void EnPeehat_Flying_StateRise(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Flying_StateRise(EnPeehat* this, PlayState* play) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 50.0f, 0.0f); if (Math_SmoothStepToS(&this->bladeRotVel, 4000, 1, 800, 0) == 0) { if (this->animTimer != 0) { @@ -479,10 +478,10 @@ void EnPeehat_Flying_StateRise(EnPeehat* this, GlobalContext* globalCtx) { if (this->actor.world.pos.y - this->actor.floorHeight < 80.0f) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight; - func_80033480(globalCtx, &pos, 90.0f, 1, 0x96, 100, 1); + func_80033480(play, &pos, 90.0f, 1, 0x96, 100, 1); } } - EnPeehat_SpawnDust(globalCtx, this, &this->actor.world.pos, 75.0f, 2, 1.05f, 2.0f); + EnPeehat_SpawnDust(play, this, &this->actor.world.pos, 75.0f, 2, 1.05f, 2.0f); Math_SmoothStepToF(&this->scaleShift, 0.075f, 1.0f, 0.005f, 0.0f); this->bladeRot += this->bladeRotVel; } @@ -494,8 +493,8 @@ void EnPeehat_Ground_SetStateSeekPlayer(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateSeekPlayer); } -void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 3.0f, 1.0f, 0.25f, 0.0f); Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight + 80.0f, 1.0f, 3.0f, 0.0f); @@ -529,7 +528,7 @@ void EnPeehat_Larva_SetStateSeekPlayer(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Larva_StateSeekPlayer); } -void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, PlayState* play) { f32 speedXZ = 5.3f; if (this->actor.xzDistToPlayer <= 5.3f) { @@ -561,7 +560,7 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { EnPeehat_SetStateAttackRecoil(this); } else if ((this->colQuad.base.atFlags & AT_HIT) || (this->colCylinder.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->colQuad.base.atFlags &= ~AT_HIT; if (!(this->colCylinder.base.acFlags & AC_HIT) && &player->actor == this->colQuad.base.at) { if (Rand_ZeroOne() > 0.5f) { @@ -578,16 +577,14 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; pos.y = Rand_CenteredFloat(10.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 255, 0, 0, 1, 9, - 1); + EffectSsDeadDb_Spawn(play, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1); } } if (&player->actor != this->colQuad.base.at || this->colCylinder.base.acFlags & AC_HIT) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_PIHAT_SM_DEAD, 1, 1, - 40); + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_PIHAT_SM_DEAD, 1, 1, 40); } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x20); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x20); Actor_Kill(&this->actor); } } @@ -599,7 +596,7 @@ void EnPeehat_Ground_SetStateLanding(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateLanding); } -void EnPeehat_Ground_StateLanding(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Ground_StateLanding(EnPeehat* this, PlayState* play) { Math_SmoothStepToF(&this->actor.shape.yOffset, -1000.0f, 1.0f, 50.0f, 0.0f); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 50, 0); @@ -612,8 +609,8 @@ void EnPeehat_Ground_StateLanding(EnPeehat* this, GlobalContext* globalCtx) { if (this->actor.world.pos.y - this->actor.floorHeight < 60.0f) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight; - func_80033480(globalCtx, &pos, 80.0f, 1, 150, 100, 1); - EnPeehat_SpawnDust(globalCtx, this, &pos, 75.0f, 2, 1.05f, 2.0f); + func_80033480(play, &pos, 80.0f, 1, 150, 100, 1); + EnPeehat_SpawnDust(play, this, &pos, 75.0f, 2, 1.05f, 2.0f); } } Math_SmoothStepToS(&this->bladeRotVel, 0, 1, 100, 0); @@ -626,7 +623,7 @@ void EnPeehat_Flying_SetStateLanding(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Flying_StateLanding); } -void EnPeehat_Flying_StateLanding(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Flying_StateLanding(EnPeehat* this, PlayState* play) { Math_SmoothStepToF(&this->actor.shape.yOffset, -1000.0f, 1.0f, 50.0f, 0.0f); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 50, 0); @@ -639,8 +636,8 @@ void EnPeehat_Flying_StateLanding(EnPeehat* this, GlobalContext* globalCtx) { if (this->actor.world.pos.y - this->actor.floorHeight < 60.0f) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight; - func_80033480(globalCtx, &pos, 80.0f, 1, 150, 100, 1); - EnPeehat_SpawnDust(globalCtx, this, &pos, 75.0f, 2, 1.05f, 2.0f); + func_80033480(play, &pos, 80.0f, 1, 150, 100, 1); + EnPeehat_SpawnDust(play, this, &pos, 75.0f, 2, 1.05f, 2.0f); } } Math_SmoothStepToS(&this->bladeRotVel, 0, 1, 100, 0); @@ -655,9 +652,9 @@ void EnPeehat_Ground_SetStateHover(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateHover); } -void EnPeehat_Ground_StateHover(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Ground_StateHover(EnPeehat* this, PlayState* play) { f32 cos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); // hover but don't gain altitude if (this->actor.world.pos.y - this->actor.floorHeight > 75.0f) { @@ -685,7 +682,7 @@ void EnPeehat_Ground_StateHover(EnPeehat* this, GlobalContext* globalCtx) { if (IS_DAY && Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->xzDistMax) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnPeehat_Ground_SetStateSeekPlayer(this); - this->unk_2FA = globalCtx->gameplayFrames & 1; + this->unk_2FA = play->gameplayFrames & 1; } else { EnPeehat_Ground_SetStateReturnHome(this); } @@ -701,12 +698,12 @@ void EnPeehat_Ground_SetStateReturnHome(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Ground_StateReturnHome); } -void EnPeehat_Ground_StateReturnHome(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Ground_StateReturnHome(EnPeehat* this, PlayState* play) { f32 cos; s16 yRot; Player* player; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (this->actor.world.pos.y - this->actor.floorHeight > 75.0f) { this->actor.world.pos.y -= 1.0f; } else { @@ -727,7 +724,7 @@ void EnPeehat_Ground_StateReturnHome(EnPeehat* this, GlobalContext* globalCtx) { if (IS_DAY && Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->xzDistMax) { this->seekPlayerTimer = 400; EnPeehat_Ground_SetStateSeekPlayer(this); - this->unk_2FA = (globalCtx->gameplayFrames & 1); + this->unk_2FA = (play->gameplayFrames & 1); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); } @@ -740,7 +737,7 @@ void EnPeehat_SetStateAttackRecoil(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_StateAttackRecoil); } -void EnPeehat_StateAttackRecoil(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_StateAttackRecoil(EnPeehat* this, PlayState* play) { this->bladeRot += this->bladeRotVel; SkelAnime_Update(&this->skelAnime); this->actor.speedXZ += 0.5f; @@ -754,8 +751,7 @@ void EnPeehat_StateAttackRecoil(EnPeehat* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; pos.y = Rand_CenteredFloat(10.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 255, 0, 0, 1, 9, - 1); + EffectSsDeadDb_Spawn(play, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1); } Actor_Kill(&this->actor); } else { @@ -781,7 +777,7 @@ void EnPeehat_SetStateBoomerangStunned(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_StateBoomerangStunned); } -void EnPeehat_StateBoomerangStunned(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_StateBoomerangStunned(EnPeehat* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight, 1.0f, 8.0f, 0.0f); if (this->actor.colorFilterTimer == 0) { @@ -800,7 +796,7 @@ void EnPeehat_Adult_SetStateDie(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_Adult_StateDie); } -void EnPeehat_Adult_StateDie(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Adult_StateDie(EnPeehat* this, PlayState* play) { if (this->isStateDieFirstUpdate) { this->unk_2D4--; if (this->unk_2D4 <= 0 || this->actor.colChkInfo.health == 0) { @@ -828,8 +824,8 @@ void EnPeehat_Adult_StateDie(EnPeehat* this, GlobalContext* globalCtx) { this->actor.world.pos.y - this->actor.floorHeight < 59.0f) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight; - func_80033480(globalCtx, &pos, 80.0f, 1, 150, 100, 1); - EnPeehat_SpawnDust(globalCtx, this, &pos, 75.0f, 2, 1.05f, 2.0f); + func_80033480(play, &pos, 80.0f, 1, 150, 100, 1); + EnPeehat_SpawnDust(play, this, &pos, 75.0f, 2, 1.05f, 2.0f); } if (this->actor.speedXZ < 0) { this->actor.speedXZ += 0.25f; @@ -857,12 +853,12 @@ void EnPeehat_SetStateExplode(EnPeehat* this) { EnPeehat_SetupAction(this, EnPeehat_StateExplode); } -void EnPeehat_StateExplode(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_StateExplode(EnPeehat* this, PlayState* play) { EnBom* bomb; s32 pad[2]; if (this->animTimer == 5) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x602, 0); if (bomb != NULL) { bomb->timer = 0; @@ -870,14 +866,14 @@ void EnPeehat_StateExplode(EnPeehat* this, GlobalContext* globalCtx) { } this->animTimer--; if (this->animTimer == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x40); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x40); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x40); Actor_Kill(&this->actor); } } -void EnPeehat_Adult_CollisionCheck(EnPeehat* this, GlobalContext* globalCtx) { +void EnPeehat_Adult_CollisionCheck(EnPeehat* this, PlayState* play) { if ((this->colCylinder.base.acFlags & AC_BOUNCED) || (this->colQuad.base.acFlags & AC_BOUNCED)) { this->colQuad.base.acFlags &= ~AC_BOUNCED; this->colCylinder.base.acFlags &= ~AC_BOUNCED; @@ -909,7 +905,7 @@ void EnPeehat_Adult_CollisionCheck(EnPeehat* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; pos.y = Rand_ZeroOne() * 25.0f + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &pos, 70, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &pos, 70, 0, 0, -1); } Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, 100); } @@ -919,24 +915,23 @@ void EnPeehat_Adult_CollisionCheck(EnPeehat* this, GlobalContext* globalCtx) { } } -void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPeehat_Update(Actor* thisx, PlayState* play) { EnPeehat* this = (EnPeehat*)thisx; s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); // If Adult Peahat if (thisx->params <= 0) { - EnPeehat_Adult_CollisionCheck(this, globalCtx); + EnPeehat_Adult_CollisionCheck(this, play); } if (thisx->colChkInfo.damageEffect != PEAHAT_DMG_EFF_LIGHT_ICE_ARROW) { if (thisx->speedXZ != 0.0f || thisx->velocity.y != 0.0f) { Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 25.0f, 30.0f, 30.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, thisx, 25.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } - this->actionFunc(this, globalCtx); - if ((globalCtx->gameplayFrames & 0x7F) == 0) { + this->actionFunc(this, play); + if ((play->gameplayFrames & 0x7F) == 0) { this->jiggleRotInc = (Rand_ZeroOne() * 0.25f) + 0.5f; } this->jiggleRot += this->jiggleRotInc; @@ -959,11 +954,11 @@ void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx) { if (thisx->colChkInfo.health > 0) { // If Adult Peahat if (thisx->params <= 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colJntSph.base); if (thisx->colorFilterTimer == 0 || !(thisx->colorFilterParams & 0x4000)) { if (this->state != PEAHAT_STATE_EXPLODE) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colJntSph.base); } } } @@ -977,8 +972,8 @@ void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->state == PEAHAT_STATE_15 || this->state == PEAHAT_STATE_SEEK_PLAYER || this->state == PEAHAT_STATE_FLY || this->state == PEAHAT_STATE_RETURN_HOME || this->state == PEAHAT_STATE_EXPLODE) { if (thisx->params != PEAHAT_TYPE_FLYING) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colQuad.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colQuad.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colQuad.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colQuad.base); } // if PEAHAT_TYPE_GROUNDED if (thisx->params < 0 && (thisx->flags & ACTOR_FLAG_6)) { @@ -988,23 +983,22 @@ void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx) { s32 bgId; Vec3f* posB = &this->bladeTip[i]; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &thisx->world.pos, posB, &posResult, &poly, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &thisx->world.pos, posB, &posResult, &poly, true, true, false, true, &bgId) == true) { - func_80033480(globalCtx, &posResult, 0.0f, 1, 300, 150, 1); - EnPeehat_SpawnDust(globalCtx, this, &posResult, 0.0f, 3, 1.05f, 1.5f); + func_80033480(play, &posResult, 0.0f, 1, 300, 150, 1); + EnPeehat_SpawnDust(play, this, &posResult, 0.0f, 3, 1.05f, 1.5f); } } } else if (thisx->params != PEAHAT_TYPE_FLYING) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder.base); } } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder.base); } Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.001f, 0.0f); } -s32 EnPeehat_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnPeehat_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnPeehat* this = (EnPeehat*)thisx; if (limbIndex == 4) { @@ -1012,7 +1006,7 @@ s32 EnPeehat_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } if (limbIndex == 3 || (limbIndex == 23 && (this->state == PEAHAT_STATE_DYING || this->state == PEAHAT_STATE_3 || this->state == PEAHAT_STATE_4))) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_peehat.c", 1946); + OPEN_DISPS(play->state.gfxCtx, "../z_en_peehat.c", 1946); Matrix_Push(); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateX(this->jiggleRot * 0.115f, MTXMODE_APPLY); @@ -1022,17 +1016,17 @@ s32 EnPeehat_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi Matrix_RotateZ(-(this->jiggleRot * 0.1f), MTXMODE_APPLY); Matrix_RotateY(-(this->jiggleRot * 0.13f), MTXMODE_APPLY); Matrix_RotateX(-(this->jiggleRot * 0.115f), MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_peehat.c", 1959), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_peehat.c", 1959), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_peehat.c", 1963); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_peehat.c", 1963); return true; } return false; } -void EnPeehat_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnPeehat_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f peahatBladeTip[] = { { 0.0f, 0.0f, 5500.0f }, { 0.0f, 0.0f, -5500.0f } }; EnPeehat* this = (EnPeehat*)thisx; @@ -1046,7 +1040,7 @@ void EnPeehat_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, // is Adult Peahat if (limbIndex == 3 && this->actor.params <= 0) { damageYRot = 0.0f; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_peehat.c", 1981); + OPEN_DISPS(play->state.gfxCtx, "../z_en_peehat.c", 1981); Matrix_Push(); Matrix_Translate(-1000.0f, 0.0f, 0.0f, MTXMODE_APPLY); Collider_UpdateSpheres(0, &this->colJntSph); @@ -1056,22 +1050,22 @@ void EnPeehat_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } Matrix_RotateY(3.2f + damageYRot, MTXMODE_APPLY); Matrix_Scale(0.3f, 0.2f, 0.2f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_peehat.c", 1990), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_peehat.c", 1990), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_peehat.c", 1994); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_peehat.c", 1994); } } -void EnPeehat_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPeehat_Draw(Actor* thisx, PlayState* play) { static Vec3f D_80AD285C[] = { { 0.0f, 0.0f, -4500.0f }, { -4500.0f, 0.0f, 0.0f }, { 4500.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 4500.0f } }; EnPeehat* this = (EnPeehat*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPeehat_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPeehat_OverrideLimbDraw, EnPeehat_PostLimbDraw, this); if (this->actor.speedXZ != 0.0f || this->actor.velocity.y != 0.0f) { Matrix_MultVec3f(&D_80AD285C[0], &this->colQuad.dim.quad[1]); diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h index ffc7f265bd..706ec34bb1 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h @@ -12,7 +12,7 @@ typedef enum { struct EnPeehat; -typedef void (*EnPeehatActionFunc)(struct EnPeehat*, GlobalContext*); +typedef void (*EnPeehatActionFunc)(struct EnPeehat*, PlayState*); typedef struct EnPeehat { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c index 42ebc4eeeb..8e353c1753 100644 --- a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c +++ b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c @@ -9,15 +9,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_7 | ACTOR_FLAG_12) -void EnPoDesert_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoDesert_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoDesert_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPoDesert_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPoDesert_Init(Actor* thisx, PlayState* play); +void EnPoDesert_Destroy(Actor* thisx, PlayState* play); +void EnPoDesert_Update(Actor* thisx, PlayState* play); +void EnPoDesert_Draw(Actor* thisx, PlayState* play); -void EnPoDesert_SetNextPathPoint(EnPoDesert* this, GlobalContext* globalCtx); -void EnPoDesert_WaitForPlayer(EnPoDesert* this, GlobalContext* globalCtx); -void EnPoDesert_MoveToNextPoint(EnPoDesert* this, GlobalContext* globalCtx); -void EnPoDesert_Disappear(EnPoDesert* this, GlobalContext* globalCtx); +void EnPoDesert_SetNextPathPoint(EnPoDesert* this, PlayState* play); +void EnPoDesert_WaitForPlayer(EnPoDesert* this, PlayState* play); +void EnPoDesert_MoveToNextPoint(EnPoDesert* this, PlayState* play); +void EnPoDesert_Disappear(EnPoDesert* this, PlayState* play); const ActorInit En_Po_Desert_InitVars = { ACTOR_EN_PO_DESERT, @@ -57,38 +57,37 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 3200, ICHAIN_STOP), }; -void EnPoDesert_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoDesert_Init(Actor* thisx, PlayState* play) { s32 pad; EnPoDesert* this = (EnPoDesert*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gPoeFieldSkel, &gPoeFieldFloatAnim, this->jointTable, this->morphTable, - 10); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sColliderInit); + SkelAnime_Init(play, &this->skelAnime, &gPoeFieldSkel, &gPoeFieldFloatAnim, this->jointTable, this->morphTable, 10); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sColliderInit); this->lightColor.r = 255; this->lightColor.g = 255; this->lightColor.b = 210; this->lightColor.a = 255; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 255, 255, 255, 200); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 37.0f); this->currentPathPoint = 1; this->actor.params = (this->actor.params >> 8) & 0xFF; this->targetY = this->actor.world.pos.y; - EnPoDesert_SetNextPathPoint(this, globalCtx); + EnPoDesert_SetNextPathPoint(this, play); } -void EnPoDesert_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoDesert_Destroy(Actor* thisx, PlayState* play) { EnPoDesert* this = (EnPoDesert*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyCylinder(globalCtx, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); } -void EnPoDesert_SetNextPathPoint(EnPoDesert* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[this->actor.params]; +void EnPoDesert_SetNextPathPoint(EnPoDesert* this, PlayState* play) { + Path* path = &play->setupPathList[this->actor.params]; Vec3s* pathPoint; Animation_MorphToLoop(&this->skelAnime, &gPoeFieldDisappearAnim, -6.0f); @@ -130,15 +129,15 @@ void EnPoDesert_UpdateSpeedModifier(EnPoDesert* this) { this->actor.world.pos.y = Math_SinS(this->speedModifier * 0x800) * 13.0f + this->targetY; } -void EnPoDesert_WaitForPlayer(EnPoDesert* this, GlobalContext* globalCtx) { +void EnPoDesert_WaitForPlayer(EnPoDesert* this, PlayState* play) { func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); - if (this->actor.xzDistToPlayer < 200.0f && (this->currentPathPoint != 2 || globalCtx->actorCtx.lensActive)) { + if (this->actor.xzDistToPlayer < 200.0f && (this->currentPathPoint != 2 || play->actorCtx.lensActive)) { if (this->currentPathPoint == 2) { - if (Play_InCsMode(globalCtx)) { + if (Play_InCsMode(play)) { this->actor.shape.rot.y += 0x800; return; } - Message_StartTextbox(globalCtx, 0x600B, NULL); + Message_StartTextbox(play, 0x600B, NULL); } EnPoDesert_SetupMoveToNextPoint(this); } else { @@ -146,7 +145,7 @@ void EnPoDesert_WaitForPlayer(EnPoDesert* this, GlobalContext* globalCtx) { } } -void EnPoDesert_MoveToNextPoint(EnPoDesert* this, GlobalContext* globalCtx) { +void EnPoDesert_MoveToNextPoint(EnPoDesert* this, PlayState* play) { f32 temp_f20; if (this->actionTimer != 0) { @@ -166,14 +165,14 @@ void EnPoDesert_MoveToNextPoint(EnPoDesert* this, GlobalContext* globalCtx) { this->targetY = this->actor.home.pos.y - ((temp_f20 * this->yDiff) / this->initDistToNextPoint); if (temp_f20 < 40.0f) { if (this->currentPathPoint != 0) { - EnPoDesert_SetNextPathPoint(this, globalCtx); + EnPoDesert_SetNextPathPoint(this, play); } else { EnPoDesert_SetupDisappear(this); } } } -void EnPoDesert_Disappear(EnPoDesert* this, GlobalContext* globalCtx) { +void EnPoDesert_Disappear(EnPoDesert* this, PlayState* play) { if (this->actionTimer != 0) { this->actionTimer--; } @@ -185,19 +184,19 @@ void EnPoDesert_Disappear(EnPoDesert* this, GlobalContext* globalCtx) { } } -void EnPoDesert_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoDesert_Update(Actor* thisx, PlayState* play) { EnPoDesert* this = (EnPoDesert*)thisx; s32 pad; SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); EnPoDesert_UpdateSpeedModifier(this); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 27.0f, 60.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 27.0f, 60.0f, UPDBGCHECKINFO_FLAG_2); Actor_SetFocus(&this->actor, 42.0f); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - if (globalCtx->actorCtx.lensActive) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + if (play->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_7; this->actor.shape.shadowDraw = ActorShadow_DrawCircle; } else { @@ -206,8 +205,8 @@ void EnPoDesert_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnPoDesert_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx, Gfx** gfxP) { +s32 EnPoDesert_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, + Gfx** gfxP) { EnPoDesert* this = (EnPoDesert*)thisx; f32 mtxScale; @@ -221,8 +220,7 @@ s32 EnPoDesert_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnPoDesert_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, - Gfx** gfxP) { +void EnPoDesert_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { static Vec3f baseLightPos = { 0.0f, 1400.0f, 0.0f }; EnPoDesert* this = (EnPoDesert*)thisx; @@ -239,7 +237,7 @@ void EnPoDesert_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { gDPPipeSync((*gfxP)++); gDPSetEnvColor((*gfxP)++, color.r, color.g, color.b, 255); - gSPMatrix((*gfxP)++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_po_desert.c", 523), + gSPMatrix((*gfxP)++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_po_desert.c", 523), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfxP)++, gPoeFieldLanternDL); gSPDisplayList((*gfxP)++, gPoeFieldLanternTopDL); @@ -250,21 +248,21 @@ void EnPoDesert_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } -void EnPoDesert_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPoDesert_Draw(Actor* thisx, PlayState* play) { EnPoDesert* this = (EnPoDesert*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_po_desert.c", 559); - func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(POLY_XLU_DISP++, 0x0A, Gfx_EnvColor(globalCtx->state.gfxCtx, 255, 85, 0, 255)); + OPEN_DISPS(play->state.gfxCtx, "../z_en_po_desert.c", 559); + func_80093D84(play->state.gfxCtx); + gSPSegment(POLY_XLU_DISP++, 0x0A, Gfx_EnvColor(play->state.gfxCtx, 255, 85, 0, 255)); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a)); if (this->actionFunc == EnPoDesert_Disappear) { gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); } else { gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280 + 2); } - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoDesert_OverrideLimbDraw, EnPoDesert_PostLimbDraw, &this->actor, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_po_desert.c", 597); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_desert.c", 597); } diff --git a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h index a0c84fa21f..aeb2503edc 100644 --- a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h +++ b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h @@ -6,7 +6,7 @@ struct EnPoDesert; -typedef void (*EnPoDesertActionFunc)(struct EnPoDesert*, GlobalContext*); +typedef void (*EnPoDesertActionFunc)(struct EnPoDesert*, PlayState*); typedef struct EnPoDesert { /* 0x0000 */ Actor actor; 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 abb9e2780c..d01dcce1af 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 @@ -10,27 +10,27 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_12) -void EnPoField_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoField_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoField_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPoField_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPoField_Init(Actor* thisx, PlayState* play); +void EnPoField_Destroy(Actor* thisx, PlayState* play); +void EnPoField_Update(Actor* thisx, PlayState* play); +void EnPoField_Draw(Actor* thisx, PlayState* play); -void EnPoField_UpdateDead(Actor* thisx, GlobalContext* globalCtx); -void EnPoField_DrawSoul(Actor* thisx, GlobalContext* globalCtx); +void EnPoField_UpdateDead(Actor* thisx, PlayState* play); +void EnPoField_DrawSoul(Actor* thisx, PlayState* play); -void EnPoField_SetupWaitForSpawn(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_Appear(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_CirclePlayer(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_Damage(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_Flee(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_Death(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_Disappear(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_SoulIdle(EnPoField* this, GlobalContext* globalCtx); -void func_80AD587C(EnPoField* this, GlobalContext* globalCtx); -void func_80AD58D4(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_SoulDisappear(EnPoField* this, GlobalContext* globalCtx); -void EnPoField_SoulInteract(EnPoField* this, GlobalContext* globalCtx); +void EnPoField_SetupWaitForSpawn(EnPoField* this, PlayState* play); +void EnPoField_WaitForSpawn(EnPoField* this, PlayState* play); +void EnPoField_Appear(EnPoField* this, PlayState* play); +void EnPoField_CirclePlayer(EnPoField* this, PlayState* play); +void EnPoField_Damage(EnPoField* this, PlayState* play); +void EnPoField_Flee(EnPoField* this, PlayState* play); +void EnPoField_Death(EnPoField* this, PlayState* play); +void EnPoField_Disappear(EnPoField* this, PlayState* play); +void EnPoField_SoulIdle(EnPoField* this, PlayState* play); +void func_80AD587C(EnPoField* this, PlayState* play); +void func_80AD58D4(EnPoField* this, PlayState* play); +void EnPoField_SoulDisappear(EnPoField* this, PlayState* play); +void EnPoField_SoulInteract(EnPoField* this, PlayState* play); void EnPoField_SpawnFlame(EnPoField* this); const ActorInit En_Po_Field_InitVars = { @@ -145,7 +145,7 @@ static Vec3s sSpawnPositions[10]; static u8 sSpawnSwitchFlags[10]; static MtxF sLimb7Mtx; -void EnPoField_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_Init(Actor* thisx, PlayState* play) { EnPoField* this = (EnPoField*)thisx; s32 pad; @@ -162,33 +162,32 @@ void EnPoField_Init(Actor* thisx, GlobalContext* globalCtx) { return; } Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gPoeFieldSkel, &gPoeFieldFloatAnim, this->jointTable, this->morphTable, - 10); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80AD7080); - Collider_InitCylinder(globalCtx, &this->flameCollider); - Collider_SetCylinder(globalCtx, &this->flameCollider, &this->actor, &D_80AD70AC); + SkelAnime_Init(play, &this->skelAnime, &gPoeFieldSkel, &gPoeFieldFloatAnim, this->jointTable, this->morphTable, 10); + Collider_InitCylinder(play, &this->collider); + 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); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + 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); this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - EnPoField_SetupWaitForSpawn(this, globalCtx); + EnPoField_SetupWaitForSpawn(this, play); } -void EnPoField_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_Destroy(Actor* thisx, PlayState* play) { EnPoField* this = (EnPoField*)thisx; if (this->actor.params != 0xFF) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyCylinder(globalCtx, &this->flameCollider); - Collider_DestroyCylinder(globalCtx, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->flameCollider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnPoField_SetupWaitForSpawn(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_SetupWaitForSpawn(EnPoField* this, PlayState* play) { this->actor.update = EnPoField_Update; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); this->actor.shape.rot.x = 0; Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); this->actionTimer = 200; @@ -233,8 +232,8 @@ void EnPoField_SetupAppear(EnPoField* this) { this->actionFunc = EnPoField_Appear; } -void EnPoField_SetupCirclePlayer(EnPoField* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoField_SetupCirclePlayer(EnPoField* this, PlayState* play) { + Player* player = GET_PLAYER(play); Animation_PlayLoop(&this->skelAnime, &gPoeFieldFloatAnim); this->collider.base.acFlags |= AC_ON; @@ -297,7 +296,7 @@ void EnPoField_SetupDisappear(EnPoField* this) { this->actionFunc = EnPoField_Disappear; } -void EnPoField_SetupSoulIdle(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_SetupSoulIdle(EnPoField* this, PlayState* play) { this->actor.update = EnPoField_UpdateDead; this->actor.draw = EnPoField_DrawSoul; this->actor.shape.shadowDraw = NULL; @@ -307,7 +306,7 @@ void EnPoField_SetupSoulIdle(EnPoField* this, GlobalContext* globalCtx) { this->actor.shape.rot.x = -0x8000; this->actionTimer = 60; this->actor.world.pos.y -= 15.0f; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_MISC); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); this->actionFunc = EnPoField_SoulIdle; } @@ -356,8 +355,8 @@ void EnPoField_SetupInteractWithSoul(EnPoField* this) { this->actor.home.pos.y = this->actor.world.pos.y - 15.0f; } -void EnPoField_CorrectYPos(EnPoField* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoField_CorrectYPos(EnPoField* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_194 == 0) { this->unk_194 = 32; @@ -377,8 +376,8 @@ void EnPoField_CorrectYPos(EnPoField* this, GlobalContext* globalCtx) { this->actor.world.pos.y = Math_SinS(this->unk_194 * 0x800) * 13.0f + this->actor.home.pos.y; } -f32 EnPoField_SetFleeSpeed(EnPoField* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +f32 EnPoField_SetFleeSpeed(EnPoField* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 speed = ((player->stateFlags1 & PLAYER_STATE1_23) && player->rideActor != NULL) ? player->rideActor->speedXZ : 12.0f; @@ -394,8 +393,8 @@ f32 EnPoField_SetFleeSpeed(EnPoField* this, GlobalContext* globalCtx) { this->actor.speedXZ = CLAMP_MIN(this->actor.speedXZ, 12.0f); } -void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoField_WaitForSpawn(EnPoField* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 spawnDist; s32 i; s32 bgId; @@ -407,7 +406,7 @@ void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx) { for (i = 0; i < sNumSpawned; i++) { if (fabsf(sSpawnPositions[i].x - player->actor.world.pos.x) < 150.0f && fabsf(sSpawnPositions[i].z - player->actor.world.pos.z) < 150.0f) { - if (Flags_GetSwitch(globalCtx, sSpawnSwitchFlags[i])) { + if (Flags_GetSwitch(play, sSpawnSwitchFlags[i])) { if (player->stateFlags1 & PLAYER_STATE1_23) { // Player riding Epona return; } else { @@ -425,7 +424,7 @@ void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx) { this->actor.world.pos.x = Math_SinS(player->actor.shape.rot.y) * spawnDist + player->actor.world.pos.x; this->actor.world.pos.z = Math_CosS(player->actor.shape.rot.y) * spawnDist + player->actor.world.pos.z; this->actor.world.pos.y = player->actor.world.pos.y + 1000.0f; - this->actor.world.pos.y = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, + this->actor.world.pos.y = BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); if (this->actor.world.pos.y != BGCHECK_Y_MIN) { this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &player->actor); @@ -438,14 +437,14 @@ void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx) { } } -void EnPoField_Appear(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_Appear(EnPoField* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->lightColor.a = 255; Actor_SetScale(&this->actor, this->scaleModifier); if (this->actor.params == EN_PO_FIELD_BIG) { EnPoField_SetupFlee(this); } else { - EnPoField_SetupCirclePlayer(this, globalCtx); + EnPoField_SetupCirclePlayer(this, play); } } else if (this->skelAnime.curFrame > 10.0f) { this->lightColor.a = ((this->skelAnime.curFrame - 10.0f) * 0.05f) * 255.0f; @@ -458,12 +457,12 @@ void EnPoField_Appear(EnPoField* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; if (this->actor.params == EN_PO_FIELD_BIG) { this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; - EnPoField_SetFleeSpeed(this, globalCtx); + EnPoField_SetFleeSpeed(this, play); } } -void EnPoField_CirclePlayer(EnPoField* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoField_CirclePlayer(EnPoField* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 temp_v1 = 16 - this->unk_194; SkelAnime_Update(&this->skelAnime); @@ -494,11 +493,11 @@ void EnPoField_CirclePlayer(EnPoField* this, GlobalContext* globalCtx) { } else { EnPoField_SpawnFlame(this); } - EnPoField_CorrectYPos(this, globalCtx); + EnPoField_CorrectYPos(this, play); func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } -void EnPoField_Flee(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_Flee(EnPoField* this, PlayState* play) { f32 temp_f6; s16 phi_t0; @@ -513,7 +512,7 @@ void EnPoField_Flee(EnPoField* this, GlobalContext* globalCtx) { phi_t0 = 0; } Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer - phi_t0, 6, 0x400); - EnPoField_SetFleeSpeed(this, globalCtx); + EnPoField_SetFleeSpeed(this, play); this->actor.world.rot.y = this->actor.shape.rot.y + 0x8000; temp_f6 = Math_SinS(this->actionTimer * 0x800) * 3.0f; this->actor.world.pos.x -= temp_f6 * Math_CosS(this->actor.shape.rot.y); @@ -521,12 +520,12 @@ void EnPoField_Flee(EnPoField* this, GlobalContext* globalCtx) { if (this->actionTimer == 0 || this->actor.xzDistToPlayer > 1500.0f) { EnPoField_SetupDisappear(this); } else { - EnPoField_CorrectYPos(this, globalCtx); + EnPoField_CorrectYPos(this, play); } func_8002F974(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } -void EnPoField_Damage(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_Damage(EnPoField* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health == 0) { @@ -534,12 +533,12 @@ void EnPoField_Damage(EnPoField* this, GlobalContext* globalCtx) { } else if (this->actor.params == EN_PO_FIELD_BIG) { EnPoField_SetupFlee(this); } else { - EnPoField_SetupCirclePlayer(this, globalCtx); + EnPoField_SetupCirclePlayer(this, play); } } } -void EnPoField_Death(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_Death(EnPoField* this, PlayState* play) { Vec3f sp6C; f32 sp68; s32 pad; @@ -551,32 +550,28 @@ void EnPoField_Death(EnPoField* this, GlobalContext* globalCtx) { if (this->actionTimer < 5) { sp6C.y = Math_SinS(this->actionTimer * 0x1000 - 0x4000) * 23.0f + (this->actor.world.pos.y + 40.0f); sp68 = Math_CosS(this->actionTimer * 0x1000 - 0x4000) * 23.0f; - sp6C.x = - Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * sp68 + this->actor.world.pos.x; - sp6C.z = - Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * sp68 + this->actor.world.pos.z; + sp6C.x = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * sp68 + this->actor.world.pos.x; + sp6C.z = Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * sp68 + this->actor.world.pos.z; } else { sp6C.y = this->actor.world.pos.y + 40.0f + 15.0f * (this->actionTimer - 5); - sp6C.x = - Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.x; - sp6C.z = - Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.z; + sp6C.x = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f + this->actor.world.pos.x; + sp6C.z = Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f + this->actor.world.pos.z; } - EffectSsDeadDb_Spawn(globalCtx, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, - 255, 0, 0, 255, 1, 9, 1); + EffectSsDeadDb_Spawn(play, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, + 0, 0, 255, 1, 9, 1); sp6C.x = (this->actor.world.pos.x + this->actor.world.pos.x) - sp6C.x; sp6C.z = (this->actor.world.pos.z + this->actor.world.pos.z) - sp6C.z; - EffectSsDeadDb_Spawn(globalCtx, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, - 255, 0, 0, 255, 1, 9, 1); + EffectSsDeadDb_Spawn(play, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, + 0, 0, 255, 1, 9, 1); sp6C.x = this->actor.world.pos.x; sp6C.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, - 255, 0, 0, 255, 1, 9, 1); + EffectSsDeadDb_Spawn(play, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, + 0, 0, 255, 1, 9, 1); if (this->actionTimer == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_EXTINCT); } } else if (this->actionTimer == 28) { - EnPoField_SetupSoulIdle(this, globalCtx); + EnPoField_SetupSoulIdle(this, play); } else if (this->actionTimer >= 19) { temp_f0 = (28 - this->actionTimer) * 0.001f; this->actor.world.pos.y += 5.0f; @@ -589,7 +584,7 @@ void EnPoField_Death(EnPoField* this, GlobalContext* globalCtx) { } } -void EnPoField_Disappear(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_Disappear(EnPoField* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actionTimer != 0) { this->actionTimer--; @@ -598,23 +593,23 @@ void EnPoField_Disappear(EnPoField* this, GlobalContext* globalCtx) { this->lightColor.a = this->actionTimer * 15.9375f; this->actor.shape.shadowAlpha = this->lightColor.a; if (this->actionTimer == 0) { - EnPoField_SetupWaitForSpawn(this, globalCtx); + EnPoField_SetupWaitForSpawn(this, play); } } -void EnPoField_SoulIdle(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_SoulIdle(EnPoField* this, PlayState* play) { if (this->actionTimer != 0) { this->actionTimer--; } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_PO_FIELD, 10, + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_PO_FIELD, 10, gPoeFieldLanternDL); func_80AD42B0(this); } else if (this->actionTimer == 0) { - EnPoField_SetupWaitForSpawn(this, globalCtx); + EnPoField_SetupWaitForSpawn(this, play); } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_2); } void EnPoField_SoulUpdateProperties(EnPoField* this, s32 arg1) { @@ -639,7 +634,7 @@ void EnPoField_SoulUpdateProperties(EnPoField* this, s32 arg1) { this->lightColor.a * (200.0f / 255)); } -void func_80AD587C(EnPoField* this, GlobalContext* globalCtx) { +void func_80AD587C(EnPoField* this, PlayState* play) { this->actor.home.pos.y += 2.0f; EnPoField_SoulUpdateProperties(this, 20); if (this->lightColor.a == 255) { @@ -647,11 +642,11 @@ void func_80AD587C(EnPoField* this, GlobalContext* globalCtx) { } } -void func_80AD58D4(EnPoField* this, GlobalContext* globalCtx) { +void func_80AD58D4(EnPoField* this, PlayState* play) { if (this->actionTimer != 0) { this->actionTimer--; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { EnPoField_SetupInteractWithSoul(this); return; } @@ -663,10 +658,10 @@ void func_80AD58D4(EnPoField* this, GlobalContext* globalCtx) { } if (this->collider.base.ocFlags1 & OC1_HIT) { this->actor.flags |= ACTOR_FLAG_16; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else { this->actor.flags &= ~ACTOR_FLAG_16; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } this->actor.world.pos.y = Math_SinS(this->unk_194 * 0x800) * 5.0f + this->actor.home.pos.y; if (this->unk_194 != 0) { @@ -683,32 +678,32 @@ void func_80AD58D4(EnPoField* this, GlobalContext* globalCtx) { this->lightColor.a * (200.0f / 255)); } -void EnPoField_SoulDisappear(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_SoulDisappear(EnPoField* this, PlayState* play) { EnPoField_SoulUpdateProperties(this, -13); if (this->lightColor.a == 0) { - EnPoField_SetupWaitForSpawn(this, globalCtx); + EnPoField_SetupWaitForSpawn(this, play); } } -void EnPoField_SoulInteract(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_SoulInteract(EnPoField* this, PlayState* play) { if (this->actor.textId != 0x5005) { EnPoField_SoulUpdateProperties(this, -13); } else { func_8002F974(&this->actor, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) { + if (Message_ShouldAdvance(play)) { Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (Inventory_HasEmptyBottle()) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_BIG_GET); if (this->actor.params == 0) { - Item_Give(globalCtx, ITEM_POE); + Item_Give(play, ITEM_POE); this->actor.textId = 0x5008; } else { this->actor.textId = 0x508F; - Item_Give(globalCtx, ITEM_BIG_POE); - Flags_SetSwitch(globalCtx, sSpawnSwitchFlags[this->spawnFlagIndex]); + Item_Give(play, ITEM_BIG_POE); + Flags_SetSwitch(play, sSpawnSwitchFlags[this->spawnFlagIndex]); } } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); @@ -718,20 +713,20 @@ void EnPoField_SoulInteract(EnPoField* this, GlobalContext* globalCtx) { this->actor.textId = 0x5007; Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); return; } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { EnPoField_SetupSoulDisappear(this); } } -void EnPoField_TestForDamage(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_TestForDamage(EnPoField* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect != 0 || this->actor.colChkInfo.damage != 0) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DEAD); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DAMAGE); @@ -751,7 +746,7 @@ void EnPoField_SpawnFlame(EnPoField* this) { } } -void EnPoField_UpdateFlame(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_UpdateFlame(EnPoField* this, PlayState* play) { if (this->flameTimer != 0) { if (this->flameTimer != 0) { this->flameTimer--; @@ -771,24 +766,24 @@ void EnPoField_UpdateFlame(EnPoField* this, GlobalContext* globalCtx) { this->flameCollider.dim.pos.x = this->flamePosition.x; this->flameCollider.dim.pos.y = this->flamePosition.y; this->flameCollider.dim.pos.z = this->flamePosition.z; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->flameCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->flameCollider.base); } } -void EnPoField_DrawFlame(EnPoField* this, GlobalContext* globalCtx) { +void EnPoField_DrawFlame(EnPoField* this, PlayState* play) { f32 sp4C; s32 pad; if (this->flameTimer != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_po_field.c", 1669); - func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - (globalCtx->gameplayFrames * -20) % 512, 32, 128)); + OPEN_DISPS(play->state.gfxCtx, "../z_en_po_field.c", 1669); + func_80093D84(play->state.gfxCtx); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (play->gameplayFrames * -20) % 512, 32, 128)); sp4C = this->flameScale * 85000.0f; gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, sp4C); Matrix_Translate(this->flamePosition.x, this->flamePosition.y, this->flamePosition.z, MTXMODE_NEW); - Matrix_RotateY(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000)), MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000)), MTXMODE_APPLY); if (this->flameTimer >= 20) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Matrix_Scale(this->flameScale, this->flameScale, this->flameScale, MTXMODE_APPLY); @@ -797,10 +792,10 @@ void EnPoField_DrawFlame(EnPoField* this, GlobalContext* globalCtx) { Matrix_Scale((this->flameScale * 0.7f) + 0.00090000004f, (0.003f - this->flameScale) + 0.003f, 0.003f, MTXMODE_APPLY); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_po_field.c", 1709), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_po_field.c", 1709), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_po_field.c", 1712); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_field.c", 1712); } } @@ -850,32 +845,32 @@ void func_80AD6330(EnPoField* this) { } } -void EnPoField_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_Update(Actor* thisx, PlayState* play) { s32 pad; EnPoField* this = (EnPoField*)thisx; - EnPoField_TestForDamage(this, globalCtx); - this->actionFunc(this, globalCtx); - EnPoField_UpdateFlame(this, globalCtx); + EnPoField_TestForDamage(this, play); + this->actionFunc(this, play); + EnPoField_UpdateFlame(this, play); if (this->actionFunc == EnPoField_Flee || this->actionFunc == EnPoField_Damage || this->actionFunc == EnPoField_Appear) { Actor_MoveForward(&this->actor); } if (this->actionFunc != EnPoField_WaitForSpawn) { Actor_SetFocus(&this->actor, 42.0f); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 27.0f, 60.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 27.0f, 60.0f, UPDBGCHECKINFO_FLAG_2); func_80AD619C(this); func_80AD6330(this); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -s32 EnPoField_OverrideLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx, Gfx** gfxP) { +s32 EnPoField_OverrideLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, + Gfx** gfxP) { EnPoField* this = (EnPoField*)thisx; if (this->lightColor.a == 0 || limbIndex == 7 || (this->actionFunc == EnPoField_Death && this->actionTimer >= 2)) { @@ -895,11 +890,11 @@ s32 EnPoField_OverrideLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnPoField_PostLimDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { +void EnPoField_PostLimDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoField* this = (EnPoField*)thisx; if (this->actionFunc == EnPoField_Death && this->actionTimer >= 2 && limbIndex == 8) { - gSPMatrix((*gfxP)++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_po_field.c", 1916), + gSPMatrix((*gfxP)++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_po_field.c", 1916), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfxP)++, gPoeFieldBurnDL); } @@ -921,86 +916,86 @@ void EnPoField_PostLimDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnPoField_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_Draw(Actor* thisx, PlayState* play) { EnPoField* this = (EnPoField*)thisx; EnPoFieldInfo* info = &sPoFieldInfo[this->actor.params]; if (this->actionFunc != EnPoField_WaitForSpawn) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_po_field.c", 1976); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_po_field.c", 1976); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_EnvColor(globalCtx->state.gfxCtx, info->envColor.r, info->envColor.g, info->envColor.b, 255)); + Gfx_EnvColor(play->state.gfxCtx, info->envColor.r, info->envColor.g, info->envColor.b, 255)); if (this->lightColor.a == 255 || this->lightColor.a == 0) { gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a)); gSPSegment(POLY_OPA_DISP++, 0x0C, D_80116280 + 2); POLY_OPA_DISP = - SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - EnPoField_OverrideLimbDraw2, EnPoField_PostLimDraw2, &this->actor, POLY_OPA_DISP); + SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoField_OverrideLimbDraw2, + EnPoField_PostLimDraw2, &this->actor, POLY_OPA_DISP); } else { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a)); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); POLY_XLU_DISP = - SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - EnPoField_OverrideLimbDraw2, EnPoField_PostLimDraw2, &this->actor, POLY_XLU_DISP); + SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoField_OverrideLimbDraw2, + EnPoField_PostLimDraw2, &this->actor, POLY_XLU_DISP); } gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, this->soulColor.r, this->soulColor.g, this->soulColor.b, 255); Matrix_Put(&sLimb7Mtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_po_field.c", 2033), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_po_field.c", 2033), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gPoeFieldLanternDL); gSPDisplayList(POLY_OPA_DISP++, gPoeFieldLanternTopDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_po_field.c", 2039); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_field.c", 2039); } - EnPoField_DrawFlame(this, globalCtx); + EnPoField_DrawFlame(this, play); } -void EnPoField_UpdateDead(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_UpdateDead(Actor* thisx, PlayState* play) { EnPoField* this = (EnPoField*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc == EnPoField_SoulIdle) { func_80AD6330(this); } - EnPoField_UpdateFlame(this, globalCtx); + EnPoField_UpdateFlame(this, play); } -void EnPoField_DrawSoul(Actor* thisx, GlobalContext* globalCtx) { +void EnPoField_DrawSoul(Actor* thisx, PlayState* play) { EnPoField* this = (EnPoField*)thisx; s32 pad; EnPoFieldInfo* info = &sPoFieldInfo[this->actor.params]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_po_field.c", 2077); + OPEN_DISPS(play->state.gfxCtx, "../z_en_po_field.c", 2077); if (this->actionFunc == EnPoField_SoulIdle) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_EnvColor(globalCtx->state.gfxCtx, info->envColor.r, info->envColor.g, info->envColor.b, 255)); + Gfx_EnvColor(play->state.gfxCtx, info->envColor.r, info->envColor.g, info->envColor.b, 255)); Lights_PointGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->soulColor.r, this->soulColor.g, this->soulColor.b, 200); gDPSetEnvColor(POLY_OPA_DISP++, this->soulColor.r, this->soulColor.g, this->soulColor.b, 255); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_po_field.c", 2104), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_po_field.c", 2104), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gPoeFieldLanternDL); gSPDisplayList(POLY_OPA_DISP++, gPoeFieldLanternTopDL); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - (globalCtx->gameplayFrames * info->unk_9) & 0x1FF, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + (play->gameplayFrames * info->unk_9) & 0x1FF, 0x20, 0x80)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(info->soulTexture)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, info->primColor.r, info->primColor.g, info->primColor.b, this->lightColor.a); gDPSetEnvColor(POLY_XLU_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 255); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_po_field.c", 2143), + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_po_field.c", 2143), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPoeFieldSoulDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_po_field.c", 2149); - EnPoField_DrawFlame(this, globalCtx); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_field.c", 2149); + EnPoField_DrawFlame(this, play); } diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h index 384b1bbdcb..7f5273e744 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h @@ -6,7 +6,7 @@ struct EnPoField; -typedef void (*EnPoFieldActionFunc)(struct EnPoField*, GlobalContext*); +typedef void (*EnPoFieldActionFunc)(struct EnPoField*, PlayState*); typedef enum { EN_PO_FIELD_SMALL, diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index 1b7e8bafc8..e78c604053 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -10,17 +10,17 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_12 | ACTOR_FLAG_16) -void EnPoRelay_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoRelay_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoRelay_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPoRelay_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPoRelay_Init(Actor* thisx, PlayState* play); +void EnPoRelay_Destroy(Actor* thisx, PlayState* play); +void EnPoRelay_Update(Actor* thisx, PlayState* play); +void EnPoRelay_Draw(Actor* thisx, PlayState* play); -void EnPoRelay_Idle(EnPoRelay* this, GlobalContext* globalCtx); -void EnPoRelay_Race(EnPoRelay* this, GlobalContext* globalCtx); -void EnPoRelay_EndRace(EnPoRelay* this, GlobalContext* globalCtx); -void EnPoRelay_Talk(EnPoRelay* this, GlobalContext* globalCtx); -void EnPoRelay_Talk2(EnPoRelay* this, GlobalContext* globalCtx); -void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx); +void EnPoRelay_Idle(EnPoRelay* this, PlayState* play); +void EnPoRelay_Race(EnPoRelay* this, PlayState* play); +void EnPoRelay_EndRace(EnPoRelay* this, PlayState* play); +void EnPoRelay_Talk(EnPoRelay* this, PlayState* play); +void EnPoRelay_Talk2(EnPoRelay* this, PlayState* play); +void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play); void EnPoRelay_SetupIdle(EnPoRelay* this); static Vec3s D_80AD8C30[] = { @@ -84,17 +84,16 @@ static void* sEyesTextures[] = { gDampeEyeClosedTex, }; -void EnPoRelay_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoRelay_Init(Actor* thisx, PlayState* play) { EnPoRelay* this = (EnPoRelay*)thisx; s32 temp; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 42.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDampeSkel, &gDampeFloatAnim, this->jointTable, this->morphTable, - 18); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + SkelAnime_InitFlex(play, &this->skelAnime, &gDampeSkel, &gDampeFloatAnim, this->jointTable, this->morphTable, 18); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 255, 255, 255, 200); this->lightColor.a = 255; @@ -103,18 +102,18 @@ void EnPoRelay_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } else { D_80AD8D24 = temp; - Actor_SetTextWithPrefix(globalCtx, &this->actor, 65); + Actor_SetTextWithPrefix(play, &this->actor, 65); this->textId = this->actor.textId; EnPoRelay_SetupIdle(this); } this->actor.params &= 0x3F; } -void EnPoRelay_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoRelay_Destroy(Actor* thisx, PlayState* play) { EnPoRelay* this = (EnPoRelay*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyCylinder(globalCtx, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); } void EnPoRelay_SetupIdle(EnPoRelay* this) { @@ -158,31 +157,31 @@ void EnPoRelay_CorrectY(EnPoRelay* this) { this->actor.world.pos.y = Math_SinS(this->unk_195 * 0x800) * 8.0f + this->actor.home.pos.y; } -void EnPoRelay_Idle(EnPoRelay* this, GlobalContext* globalCtx) { +void EnPoRelay_Idle(EnPoRelay* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x100); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_16; this->actionFunc = EnPoRelay_Talk; } else if (this->actor.xzDistToPlayer < 250.0f) { this->actor.flags |= ACTOR_FLAG_16; this->actor.textId = this->textId; - func_8002F2CC(&this->actor, globalCtx, 250.0f); + func_8002F2CC(&this->actor, play, 250.0f); } func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } -void EnPoRelay_Talk(EnPoRelay* this, GlobalContext* globalCtx) { +void EnPoRelay_Talk(EnPoRelay* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x100); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { - Actor_SetTextWithPrefix(globalCtx, &this->actor, 0x2F); + if (Actor_TextboxIsClosing(&this->actor, play)) { + Actor_SetTextWithPrefix(play, &this->actor, 0x2F); this->textId = this->actor.textId; EnPoRelay_SetupRace(this); } func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } -void EnPoRelay_Race(EnPoRelay* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoRelay_Race(EnPoRelay* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f vec; f32 speed; f32 multiplier; @@ -202,7 +201,7 @@ void EnPoRelay_Race(EnPoRelay* this, GlobalContext* globalCtx) { multiplier = 0.0f; } speed = 30.0f * multiplier; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HONOTRAP, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HONOTRAP, Math_CosS(this->unk_19A) * speed + this->actor.world.pos.x, this->actor.world.pos.y, Math_SinS(this->unk_19A) * speed + this->actor.world.pos.z, 0, (this->unk_19A + 0x8000) - (0x2000 * multiplier), 0, HONOTRAP_FLAME_DROP); @@ -242,44 +241,44 @@ void EnPoRelay_Race(EnPoRelay* this, GlobalContext* globalCtx) { if (this->pathIndex == 28) { EnPoRelay_SetupEndRace(this); } else if (this->pathIndex == 9) { - Flags_SetSwitch(globalCtx, 0x35); + Flags_SetSwitch(play, 0x35); } else if (this->pathIndex == 17) { - Flags_SetSwitch(globalCtx, 0x36); + Flags_SetSwitch(play, 0x36); } else if (this->pathIndex == 25) { - Flags_SetSwitch(globalCtx, 0x37); + Flags_SetSwitch(play, 0x37); } } this->unk_19A = Actor_WorldYawTowardPoint(&this->actor, &vec); func_8002F974(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } -void EnPoRelay_EndRace(EnPoRelay* this, GlobalContext* globalCtx) { +void EnPoRelay_EndRace(EnPoRelay* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, -0x4000, 0x800); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnPoRelay_Talk2; - } else if (globalCtx->roomCtx.curRoom.num == 5) { + } else if (play->roomCtx.curRoom.num == 5) { Actor_Kill(&this->actor); gSaveContext.timer1State = 0; } else if (Actor_IsFacingAndNearPlayer(&this->actor, 150.0f, 0x3000)) { this->actor.textId = this->textId; - func_8002F2CC(&this->actor, globalCtx, 250.0f); + func_8002F2CC(&this->actor, play, 250.0f); } func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } -void EnPoRelay_Talk2(EnPoRelay* this, GlobalContext* globalCtx) { +void EnPoRelay_Talk2(EnPoRelay* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x100); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) { + if (Message_ShouldAdvance(play)) { if (this->hookshotSlotFull != 0) { - Actor_SetTextWithPrefix(globalCtx, &this->actor, 0x2E); + Actor_SetTextWithPrefix(play, &this->actor, 0x2E); } else { - Actor_SetTextWithPrefix(globalCtx, &this->actor, 0x2D); + Actor_SetTextWithPrefix(play, &this->actor, 0x2D); } this->textId = this->actor.textId; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { gSaveContext.timer1State = 0; this->actionTimer = 0; this->actionFunc = EnPoRelay_DisappearAndReward; @@ -287,7 +286,7 @@ void EnPoRelay_Talk2(EnPoRelay* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } -void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx) { +void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play) { Vec3f vec; f32 multiplier; s32 pad; @@ -299,27 +298,25 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx) { if (this->actionTimer < 5) { vec.y = Math_SinS((this->actionTimer * 0x1000) - 0x4000) * 23.0f + (this->actor.world.pos.y + 40.0f); multiplier = Math_CosS((this->actionTimer * 0x1000) - 0x4000) * 23.0f; - vec.x = (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier) + - this->actor.world.pos.x; - vec.z = (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier) + - this->actor.world.pos.z; + vec.x = + (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * multiplier) + this->actor.world.pos.x; + vec.z = + (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * multiplier) + this->actor.world.pos.z; } else { vec.y = this->actor.world.pos.y + 40.0f + 15.0f * (this->actionTimer - 5); - vec.x = - (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f) + this->actor.world.pos.x; - vec.z = - (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f) + this->actor.world.pos.z; + vec.x = (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f) + this->actor.world.pos.x; + vec.z = (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f) + this->actor.world.pos.z; } - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, - 255, 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, + 0, 0, 255, 1, 9, true); vec.x = (this->actor.world.pos.x + this->actor.world.pos.x) - vec.x; vec.z = (this->actor.world.pos.z + this->actor.world.pos.z) - vec.z; - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, - 255, 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, + 0, 0, 255, 1, 9, true); vec.x = this->actor.world.pos.x; vec.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, - 255, 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, + 0, 0, 255, 1, 9, true); if (this->actionTimer == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_EXTINCT); } @@ -332,13 +329,13 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx) { if (gSaveContext.timer1Value < HIGH_SCORE(HS_DAMPE_RACE)) { HIGH_SCORE(HS_DAMPE_RACE) = gSaveContext.timer1Value; } - if (Flags_GetCollectible(globalCtx, this->actor.params) == 0 && gSaveContext.timer1Value <= 60) { - Item_DropCollectible2(globalCtx, &sp60, (this->actor.params << 8) + (0x4000 | ITEM00_HEART_PIECE)); + if (Flags_GetCollectible(play, this->actor.params) == 0 && gSaveContext.timer1Value <= 60) { + Item_DropCollectible2(play, &sp60, (this->actor.params << 8) + (0x4000 | ITEM00_HEART_PIECE)); } else { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, sp60.x, sp60.y, sp60.z, 0, 0, 0, 2); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, sp60.x, sp60.y, sp60.z, 0, 0, 0, 2); } } else { - Flags_SetTempClear(globalCtx, 4); + Flags_SetTempClear(play, 4); HIGH_SCORE(HS_DAMPE_RACE) = gSaveContext.timer1Value; } Actor_Kill(&this->actor); @@ -348,17 +345,17 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx) { this->actor.world.pos.y += 10.0f; } -void EnPoRelay_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoRelay_Update(Actor* thisx, PlayState* play) { EnPoRelay* this = (EnPoRelay*)thisx; s32 pad; SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); EnPoRelay_CorrectY(this); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 27.0f, 60.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 27.0f, 60.0f, UPDBGCHECKINFO_FLAG_2); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_SetFocus(&this->actor, 50.0f); if (this->unk_195 != 0) { this->unk_195 -= 1; @@ -372,14 +369,14 @@ void EnPoRelay_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnPoRelay_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnPoRelay_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnPoRelay* this = (EnPoRelay*)thisx; if (limbIndex == 14) { f32 rand; Vec3f vec; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_po_relay.c", 885); + OPEN_DISPS(play->state.gfxCtx, "../z_en_po_relay.c", 885); rand = Rand_ZeroOne(); this->lightColor.r = (s16)(rand * 30.0f) + 225; this->lightColor.g = (s16)(rand * 100.0f) + 155; @@ -388,26 +385,26 @@ void EnPoRelay_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList gDPSetEnvColor(POLY_OPA_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 128); gSPDisplayList(POLY_OPA_DISP++, gDampeLanternDL); if (1) {} - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_po_relay.c", 901); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_relay.c", 901); Matrix_MultVec3f(&D_80AD8D48, &vec); Lights_PointNoGlowSetInfo(&this->lightInfo, vec.x, vec.y, vec.z, this->lightColor.r, this->lightColor.g, this->lightColor.b, 200); } else if (limbIndex == 8) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_po_relay.c", 916); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_po_relay.c", 918), + OPEN_DISPS(play->state.gfxCtx, "../z_en_po_relay.c", 916); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_po_relay.c", 918), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDampeHaloDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_po_relay.c", 922); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_relay.c", 922); } } -void EnPoRelay_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPoRelay_Draw(Actor* thisx, PlayState* play) { EnPoRelay* this = (EnPoRelay*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_po_relay.c", 940); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_po_relay.c", 940); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnPoRelay_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_po_relay.c", 954); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnPoRelay_PostLimbDraw, &this->actor); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_relay.c", 954); } diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h index 5f26aba8bb..70567ada79 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h @@ -6,7 +6,7 @@ struct EnPoRelay; -typedef void (*EnPoRelayActionFunc)(struct EnPoRelay*, GlobalContext*); +typedef void (*EnPoRelayActionFunc)(struct EnPoRelay*, PlayState*); typedef struct EnPoRelay { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index ac68fb7b3b..33348653f1 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -10,40 +10,40 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9 | ACTOR_FLAG_12 | ACTOR_FLAG_14) -void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoSisters_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPoSisters_Init(Actor* thisx, PlayState* play); +void EnPoSisters_Destroy(Actor* thisx, PlayState* play); +void EnPoSisters_Update(Actor* thisx, PlayState* play); +void EnPoSisters_Draw(Actor* thisx, PlayState* play); -void func_80ADA094(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA4A8(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA530(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA6A0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA7F0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA8C0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADA9E8(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADAAA4(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADAC70(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADAD54(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADAE6C(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADAFC0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB17C(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB2B8(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB338(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB9F0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB4B0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB51C(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADB770(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBB6C(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBBF4(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBC88(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBD38(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBD8C(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBEE8(EnPoSisters* this, GlobalContext* globalCtx); -void func_80ADBF58(EnPoSisters* this, GlobalContext* globalCtx); +void func_80ADA094(EnPoSisters* this, PlayState* play); +void func_80ADA4A8(EnPoSisters* this, PlayState* play); +void func_80ADA530(EnPoSisters* this, PlayState* play); +void func_80ADA6A0(EnPoSisters* this, PlayState* play); +void func_80ADA7F0(EnPoSisters* this, PlayState* play); +void func_80ADA8C0(EnPoSisters* this, PlayState* play); +void func_80ADA9E8(EnPoSisters* this, PlayState* play); +void func_80ADAAA4(EnPoSisters* this, PlayState* play); +void func_80ADAC70(EnPoSisters* this, PlayState* play); +void func_80ADAD54(EnPoSisters* this, PlayState* play); +void func_80ADAE6C(EnPoSisters* this, PlayState* play); +void func_80ADAFC0(EnPoSisters* this, PlayState* play); +void func_80ADB17C(EnPoSisters* this, PlayState* play); +void func_80ADB2B8(EnPoSisters* this, PlayState* play); +void func_80ADB338(EnPoSisters* this, PlayState* play); +void func_80ADB9F0(EnPoSisters* this, PlayState* play); +void func_80ADB4B0(EnPoSisters* this, PlayState* play); +void func_80ADB51C(EnPoSisters* this, PlayState* play); +void func_80ADB770(EnPoSisters* this, PlayState* play); +void func_80ADBB6C(EnPoSisters* this, PlayState* play); +void func_80ADBBF4(EnPoSisters* this, PlayState* play); +void func_80ADBC88(EnPoSisters* this, PlayState* play); +void func_80ADBD38(EnPoSisters* this, PlayState* play); +void func_80ADBD8C(EnPoSisters* this, PlayState* play); +void func_80ADBEE8(EnPoSisters* this, PlayState* play); +void func_80ADBF58(EnPoSisters* this, PlayState* play); -void func_80AD9AA8(EnPoSisters* this, GlobalContext* globalCtx); -void func_80AD9C24(EnPoSisters* this, GlobalContext* globalCtx); +void func_80AD9AA8(EnPoSisters* this, PlayState* play); +void func_80AD9C24(EnPoSisters* this, PlayState* play); void func_80AD9D44(EnPoSisters* this); @@ -173,23 +173,23 @@ static Color_RGBA8 D_80ADD7E8[4] = { static Vec3f D_80ADD7F8 = { 1000.0f, -1700.0f, 0.0f }; -void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoSisters_Init(Actor* thisx, PlayState* play) { EnPoSisters* this = (EnPoSisters*)thisx; s32 pad; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gPoeSistersSkel, &gPoeSistersSwayAnim, this->jointTable, - this->morphTable, 12); + SkelAnime_Init(play, &this->skelAnime, &gPoeSistersSkel, &gPoeSistersSwayAnim, this->jointTable, this->morphTable, + 12); this->unk_22E.r = 255; this->unk_22E.g = 255; this->unk_22E.b = 210; this->unk_22E.a = 255; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + 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, 0, 0, 0, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_194 = (thisx->params >> 8) & 3; this->actor.naviEnemyId = this->unk_194 + NAVI_ENEMY_POE_SISTER_MEG; @@ -202,11 +202,11 @@ void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_294 = 110.0f; this->actor.flags &= ~ACTOR_FLAG_0; if (this->actor.params & 0x1000) { - func_80ADA094(this, globalCtx); + func_80ADA094(this, play); } else if (this->unk_194 == 0) { if (this->unk_195 == 0) { this->collider.base.ocFlags1 = OC1_ON | OC1_TYPE_PLAYER; - func_80AD9AA8(this, globalCtx); + func_80AD9AA8(this, play); } else { this->actor.flags &= ~(ACTOR_FLAG_9 | ACTOR_FLAG_14); this->collider.info.elemType = ELEMTYPE_UNK4; @@ -220,14 +220,14 @@ void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.params &= 0x3F; } -void EnPoSisters_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoSisters_Destroy(Actor* thisx, PlayState* play) { EnPoSisters* this = (EnPoSisters*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); if (this->unk_194 == 0 && this->unk_195 == 0) { func_800F5B58(); } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80AD9240(EnPoSisters* this, s32 arg1, Vec3f* arg2) { @@ -334,8 +334,8 @@ void func_80AD9718(EnPoSisters* this) { this->actionFunc = func_80ADAD54; } -void func_80AD97C8(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AD97C8(EnPoSisters* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 sp20; if (this->unk_195 == 0 || this->actionFunc != func_80ADAAA4) { @@ -353,12 +353,12 @@ void func_80AD97C8(EnPoSisters* this, GlobalContext* globalCtx) { this->actor.world.pos.z = (Math_CosS(this->actor.shape.rot.y + 0x8000) * sp20) + player->actor.world.pos.z; } -void func_80AD98F4(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80AD98F4(EnPoSisters* this, PlayState* play) { Animation_Change(&this->skelAnime, &gPoeSistersAppearDisappearAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gPoeSistersAppearDisappearAnim), ANIMMODE_ONCE, -3.0f); if (this->unk_194 == 0) { this->unk_294 = 110.0f; - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); this->unk_22E.a = 0; this->actor.draw = EnPoSisters_Draw; } else { @@ -371,7 +371,7 @@ void func_80AD98F4(EnPoSisters* this, GlobalContext* globalCtx) { this->actionFunc = func_80ADAE6C; } -void func_80AD99D4(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80AD99D4(EnPoSisters* this, PlayState* play) { this->unk_19A = 0; this->actor.speedXZ = 0.0f; this->actor.world.pos.y += 42.0f; @@ -379,23 +379,23 @@ void func_80AD99D4(EnPoSisters* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; this->unk_199 = 0; this->actionFunc = func_80ADAFC0; - OnePointCutscene_Init(globalCtx, 3190, 999, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3190, 999, &this->actor, CAM_ID_MAIN); } -void func_80AD9A54(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80AD9A54(EnPoSisters* this, PlayState* play) { this->unk_19A = 0; this->actor.world.pos.y = this->unk_234[0].y; - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x80); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x80); this->actionFunc = func_80ADB17C; } // Meg spawning fakes -void func_80AD9AA8(EnPoSisters* this, GlobalContext* globalCtx) { - Actor* actor1 = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, +void func_80AD9AA8(EnPoSisters* this, PlayState* play) { + Actor* actor1 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x400); - Actor* actor2 = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, + Actor* actor2 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x800); - Actor* actor3 = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, + Actor* actor3 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xC00); s32 pad; s32 pad1; @@ -422,7 +422,7 @@ void func_80AD9AA8(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80AD9C24(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80AD9C24(EnPoSisters* this, PlayState* play) { Vec3f vec; this->actor.draw = NULL; @@ -431,12 +431,12 @@ void func_80AD9C24(EnPoSisters* this, GlobalContext* globalCtx) { this->unk_199 = 32; this->collider.base.colType = COLTYPE_HIT3; this->collider.base.acFlags &= ~AC_HARD; - if (globalCtx != NULL) { + if (play != NULL) { vec.x = this->actor.world.pos.x; vec.y = this->actor.world.pos.y + 45.0f; vec.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &vec, &sZeroVector, &sZeroVector, 150, 0, 255, 255, 255, 155, 150, 150, 150, 1, - 9, 0); + EffectSsDeadDb_Spawn(play, &vec, &sZeroVector, &sZeroVector, 150, 0, 255, 255, 255, 155, 150, 150, 150, 1, 9, + 0); } Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); this->actionFunc = func_80ADB338; @@ -455,12 +455,12 @@ void func_80AD9D44(EnPoSisters* this) { this->actionFunc = func_80ADB9F0; } -void func_80AD9DF0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80AD9DF0(EnPoSisters* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gPoeSistersAppearDisappearAnim, -5.0f); this->unk_198 = 1; this->unk_199 &= ~0x80; this->actionFunc = func_80ADB4B0; - OnePointCutscene_Init(globalCtx, 3180, 156, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3180, 156, &this->actor, CAM_ID_MAIN); } void func_80AD9E60(EnPoSisters* this) { @@ -512,13 +512,13 @@ void func_80ADA028(EnPoSisters* this) { this->actor.speedXZ = 0.0f; } -void func_80ADA094(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA094(EnPoSisters* this, PlayState* play) { D_80ADD784 = 0; this->unk_22E.a = 0; this->unk_199 = 128; this->unk_19A = 50; this->unk_234[0] = this->actor.home.pos; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actionFunc = func_80ADBC88; } @@ -553,7 +553,7 @@ void func_80ADA25C(EnPoSisters* this) { this->actionFunc = func_80ADBEE8; } -void func_80ADA2BC(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA2BC(EnPoSisters* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); this->unk_198 = 0; this->unk_199 = 40; @@ -562,15 +562,15 @@ void func_80ADA2BC(EnPoSisters* this, GlobalContext* globalCtx) { this->actor.world.rot.y = D_80ADD79C[this->unk_194]; this->actor.home.pos.y = this->actor.world.pos.y; if (this->unk_194 == 0) { - Flags_SetSwitch(globalCtx, 0x1B); + Flags_SetSwitch(play, 0x1B); } Audio_PlayActorSound2(&this->actor, NA_SE_EV_FLAME_IGNITION); this->actionFunc = func_80ADBF58; } -void func_80ADA35C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA35C(EnPoSisters* this, PlayState* play) { f32 targetY; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->actionFunc == func_80ADBF58) { targetY = this->actor.home.pos.y; @@ -596,7 +596,7 @@ void func_80ADA35C(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA4A8(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA4A8(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) { this->unk_19A--; @@ -606,7 +606,7 @@ void func_80ADA4A8(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA530(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA530(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speedXZ, 1.0f, 0.2f); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) { @@ -626,8 +626,8 @@ void func_80ADA530(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA6A0(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ADA6A0(EnPoSisters* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 temp_v0; SkelAnime_Update(&this->skelAnime); @@ -647,7 +647,7 @@ void func_80ADA6A0(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA7F0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA7F0(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_19A != 0) { this->unk_19A--; @@ -661,7 +661,7 @@ void func_80ADA7F0(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA8C0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA8C0(EnPoSisters* this, PlayState* play) { s32 pad; SkelAnime_Update(&this->skelAnime); @@ -676,7 +676,7 @@ void func_80ADA8C0(EnPoSisters* this, GlobalContext* globalCtx) { func_80AD93C4(this); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); } } if (Animation_OnFrame(&this->skelAnime, 1.0f)) { @@ -684,7 +684,7 @@ void func_80ADA8C0(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADA9E8(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADA9E8(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.shape.rot.y -= (this->actor.speedXZ * 10.0f) * 128.0f; if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f) != 0) { @@ -693,12 +693,12 @@ void func_80ADA9E8(EnPoSisters* this, GlobalContext* globalCtx) { func_80AD93C4(this); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); } } } -void func_80ADAAA4(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADAAA4(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && !(this->actor.flags & ACTOR_FLAG_15)) { if (this->actor.colChkInfo.health != 0) { if (this->unk_194 != 0) { @@ -706,10 +706,10 @@ void func_80ADAAA4(EnPoSisters* this, GlobalContext* globalCtx) { } else if (this->unk_195 != 0) { func_80AD9C24(this, NULL); } else { - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); } } else { - func_80AD99D4(this, globalCtx); + func_80AD99D4(this, play); } } if (this->unk_195 != 0) { @@ -717,13 +717,13 @@ void func_80ADAAA4(EnPoSisters* this, GlobalContext* globalCtx) { (this->unk_195 == 2) ? 0x800 : 0x400); this->unk_22E.a = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; this->actor.world.pos.y = this->actor.parent->world.pos.y; - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); } else if (this->unk_194 != 0) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); } } -void func_80ADAC70(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADAC70(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 1820); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) { @@ -739,7 +739,7 @@ void func_80ADAC70(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADAD54(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADAD54(EnPoSisters* this, PlayState* play) { s32 endFrame; if (SkelAnime_Update(&this->skelAnime)) { @@ -752,7 +752,7 @@ void func_80ADAD54(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADAE6C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADAE6C(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_22E.a = 255; if (this->unk_194 != 0) { @@ -771,12 +771,12 @@ void func_80ADAE6C(EnPoSisters* this, GlobalContext* globalCtx) { } else { this->unk_22E.a = (this->skelAnime.curFrame * 255.0f) / this->skelAnime.endFrame; if (this->unk_194 == 0) { - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); } } } -void func_80ADAFC0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADAFC0(EnPoSisters* this, PlayState* play) { s32 i; this->unk_19A++; @@ -796,7 +796,7 @@ void func_80ADAFC0(EnPoSisters* this, GlobalContext* globalCtx) { this->unk_234[0].y = this->unk_234[1].y + 2.0f; if (this->unk_19A >= 16) { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.001f) != 0) { - func_80AD9A54(this, globalCtx); + func_80AD9A54(this, play); } this->actor.scale.z = this->actor.scale.x; this->actor.scale.y = this->actor.scale.x; @@ -807,15 +807,15 @@ void func_80ADAFC0(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADB17C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB17C(EnPoSisters* this, PlayState* play) { this->unk_19A++; if (this->unk_19A == 64) { - Flags_SetSwitch(globalCtx, this->actor.params); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_FLAME_IGNITION); + Flags_SetSwitch(play, this->actor.params); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_FLAME_IGNITION); if (this->unk_194 == 0) { - Flags_UnsetSwitch(globalCtx, 0x1B); + Flags_UnsetSwitch(play, 0x1B); } - globalCtx->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; + play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; func_80078884(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->actor); } else if (this->unk_19A < 32) { @@ -830,10 +830,10 @@ void func_80ADB17C(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADB2B8(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB2B8(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.xzDistToPlayer < 130.0f) { - func_80AD9DF0(this, globalCtx); + func_80AD9DF0(this, play); } if (Animation_OnFrame(&this->skelAnime, 0.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_CRY); @@ -841,8 +841,8 @@ void func_80ADB2B8(EnPoSisters* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; } -void func_80ADB338(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ADB338(EnPoSisters* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnPoSisters* realMeg = (EnPoSisters*)this->actor.parent; if (this->unk_195 == 0) { @@ -856,7 +856,7 @@ void func_80ADB338(EnPoSisters* this, GlobalContext* globalCtx) { if (this->unk_19C == 0) { this->actor.shape.rot.y = (s32)(4.0f * Rand_ZeroOne()) * 0x4000 + this->actor.yawTowardsPlayer; this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; - func_80AD98F4(this, globalCtx); + func_80AD98F4(this, play); } } else { if (realMeg->actionFunc == func_80ADB51C) { @@ -865,23 +865,23 @@ void func_80ADB338(EnPoSisters* this, GlobalContext* globalCtx) { } else if (realMeg->actionFunc == func_80ADAE6C) { this->actor.shape.rot.y = this->actor.parent->shape.rot.y + this->unk_195 * 0x4000; this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; - func_80AD98F4(this, globalCtx); + func_80AD98F4(this, play); } else if (realMeg->actionFunc == func_80ADAFC0) { Actor_Kill(&this->actor); } } } -void func_80ADB4B0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB4B0(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { func_80AD9E60(this); } - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); this->actor.world.pos.y += 1.0f; Actor_SetFocus(&this->actor, 40.0f); } -void func_80ADB51C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB51C(EnPoSisters* this, PlayState* play) { f32 temp_f2; s16 phi_v0; s16 phi_a2; @@ -928,11 +928,11 @@ void func_80ADB51C(EnPoSisters* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); } } - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); Actor_SetFocus(&this->actor, 40.0f); } -void func_80ADB770(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB770(EnPoSisters* this, PlayState* play) { s32 temp_v0; s32 phi_a0; @@ -964,14 +964,14 @@ void func_80ADB770(EnPoSisters* this, GlobalContext* globalCtx) { this->unk_199 &= ~0x40; } } - if (Actor_WorldDistXZToPoint(&GET_PLAYER(globalCtx)->actor, &this->actor.home.pos) > 600.0f) { + if (Actor_WorldDistXZToPoint(&GET_PLAYER(play)->actor, &this->actor.home.pos) > 600.0f) { this->unk_199 &= ~0x40; - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); } else if (this->unk_19A == 0) { if (this->unk_195 == 0) { func_80AD94E0(this); } else { - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); } } else if (this->unk_195 != 0) { EnPoSisters* realMeg = (EnPoSisters*)this->actor.parent; @@ -987,10 +987,10 @@ void func_80ADB770(EnPoSisters* this, GlobalContext* globalCtx) { func_80AD94E0(this); } } - func_80AD97C8(this, globalCtx); + func_80AD97C8(this, play); } -void func_80ADB9F0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADB9F0(EnPoSisters* this, PlayState* play) { f32 div; if (SkelAnime_Update(&this->skelAnime)) { @@ -1014,7 +1014,7 @@ void func_80ADB9F0(EnPoSisters* this, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 40.0f); } -void func_80ADBB6C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBB6C(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 10.0f) { func_80ADA028(this); @@ -1024,7 +1024,7 @@ void func_80ADBB6C(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADBBF4(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBBF4(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1820); if (this->actor.xzDistToPlayer < 240.0f && fabsf(this->actor.yDistToPlayer + 5.0f) < 30.0f) { @@ -1032,14 +1032,14 @@ void func_80ADBBF4(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADBC88(EnPoSisters* this, GlobalContext* globalCtx) { - if (D_80ADD784 != 0 || !Player_InCsMode(globalCtx)) { +void func_80ADBC88(EnPoSisters* this, PlayState* play) { + if (D_80ADD784 != 0 || !Player_InCsMode(play)) { if (this->unk_19A != 0) { this->unk_19A--; } if (this->unk_19A == 30) { if (this->unk_194 == 0) { - OnePointCutscene_Init(globalCtx, 3140, 999, NULL, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3140, 999, NULL, CAM_ID_MAIN); } D_80ADD784 = 1; } @@ -1050,7 +1050,7 @@ void func_80ADBC88(EnPoSisters* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } -void func_80ADBD38(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBD38(EnPoSisters* this, PlayState* play) { this->unk_19A++; func_80AD9240(this, this->unk_19A, &this->actor.home.pos); if (this->unk_19A == 32) { @@ -1058,7 +1058,7 @@ void func_80ADBD38(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADBD8C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBD8C(EnPoSisters* this, PlayState* play) { this->unk_19A--; if (this->unk_19A == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_APPEAR); @@ -1077,36 +1077,36 @@ void func_80ADBD8C(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80ADBEE8(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBEE8(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_19A != 0) { this->unk_19A--; } func_80AD9240(this, this->unk_19A, &this->actor.home.pos); if (this->unk_19A == 0) { - func_80ADA2BC(this, globalCtx); + func_80ADA2BC(this, play); } } -void func_80ADBF58(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADBF58(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->unk_19A--; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 0x500); if (this->unk_19A == 0 && this->unk_194 == 0) { - globalCtx->envCtx.lightSettingOverride = 4; + play->envCtx.lightSettingOverride = 4; } if (this->unk_19A < 0) { Math_StepToF(&this->actor.speedXZ, 5.0f, 0.2f); } if (this->unk_19A == -70 && this->unk_194 == 1) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &D_80ADD7BC, 40, NA_SE_EN_PO_LAUGH); + SoundSource_PlaySfxAtFixedWorldPos(play, &D_80ADD7BC, 40, NA_SE_EN_PO_LAUGH); } if (this->unk_19A < -120) { Actor_Kill(&this->actor); } } -void func_80ADC034(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADC034(EnPoSisters* this, PlayState* play) { if (this->actor.isTargeted && this->unk_22E.a == 255) { if (this->unk_197 != 0) { this->unk_197--; @@ -1123,12 +1123,12 @@ void func_80ADC034(EnPoSisters* this, GlobalContext* globalCtx) { if (this->unk_197 == 0) { func_80AD9718(this); } else if (this->unk_19C == 0 && this->unk_22E.a == 0) { - func_80AD98F4(this, globalCtx); + func_80AD98F4(this, play); } } } -void func_80ADC10C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80ADC10C(EnPoSisters* this, PlayState* play) { Vec3f sp24; if (this->collider.base.acFlags & AC_HIT) { @@ -1137,12 +1137,12 @@ void func_80ADC10C(EnPoSisters* this, GlobalContext* globalCtx) { if (this->unk_195 != 0) { ((EnPoSisters*)this->actor.parent)->unk_19C--; Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80AD9C24(this, globalCtx); + func_80AD9C24(this, play); if (Rand_ZeroOne() < 0.2f) { sp24.x = this->actor.world.pos.x; sp24.y = this->actor.world.pos.y; sp24.z = this->actor.world.pos.z; - Item_DropCollectible(globalCtx, &sp24, ITEM00_ARROWS_SMALL); + Item_DropCollectible(play, &sp24, ITEM00_ARROWS_SMALL); } } else if (this->collider.base.colType == 9 || (this->actor.colChkInfo.damageEffect == 0 && this->actor.colChkInfo.damage == 0)) { @@ -1152,7 +1152,7 @@ void func_80ADC10C(EnPoSisters* this, GlobalContext* globalCtx) { } else if (this->actor.colChkInfo.damageEffect == 0xF) { this->actor.world.rot.y = this->actor.shape.rot.y; this->unk_199 |= 2; - func_80AD98F4(this, globalCtx); + func_80AD98F4(this, play); } else if (this->unk_194 == 0 && this->actor.colChkInfo.damageEffect == 0xE && this->actionFunc == func_80ADB770) { if (this->unk_19C == 0) { @@ -1162,7 +1162,7 @@ void func_80ADC10C(EnPoSisters* this, GlobalContext* globalCtx) { if (Actor_ApplyDamage(&this->actor) != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DAMAGE); } else { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_SISTER_DEAD); } func_80AD95D8(this); @@ -1170,7 +1170,7 @@ void func_80ADC10C(EnPoSisters* this, GlobalContext* globalCtx) { } } -void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoSisters_Update(Actor* thisx, PlayState* play) { s32 pad; EnPoSisters* this = (EnPoSisters*)thisx; s16 temp; @@ -1179,19 +1179,19 @@ void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.base.atFlags &= ~AT_HIT; func_80AD9568(this); } - func_80ADC10C(this, globalCtx); + func_80ADC10C(this, play); if (this->unk_199 & 4) { - func_80ADC034(this, globalCtx); + func_80ADC034(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_199 & 0x1F) { if (this->unk_199 & 8) { - func_80ADA35C(this, globalCtx); + func_80ADA35C(this, play); } Actor_MoveForward(&this->actor); if (this->unk_199 & 0x10) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } else { Vec3f vec; @@ -1201,7 +1201,7 @@ void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { vec.y = this->actor.world.pos.y + 10.0f; vec.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &sp34, &this->actor, &vec); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &sp34, &this->actor, &vec); } Collider_UpdateCylinder(&this->actor, &this->collider); @@ -1214,13 +1214,13 @@ void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionFunc == func_80ADA8C0) { this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->unk_199 & 1) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != func_80ADB338) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, 40.0f); if (this->actionFunc == func_80ADAC70) { @@ -1267,8 +1267,8 @@ void func_80ADC55C(EnPoSisters* this) { } } -s32 EnPoSisters_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx, Gfx** gfxP) { +s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, + Gfx** gfxP) { EnPoSisters* this = (EnPoSisters*)thisx; Color_RGBA8* color; @@ -1295,14 +1295,13 @@ s32 EnPoSisters_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnPoSisters_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, - Gfx** gfxP) { +void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoSisters* this = (EnPoSisters*)thisx; s32 i; s32 pad; if (this->actionFunc == func_80ADAFC0 && this->unk_19A >= 8 && limbIndex == 9) { - gSPMatrix((*gfxP)++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_po_sisters.c", 2876), + gSPMatrix((*gfxP)++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_po_sisters.c", 2876), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfxP)++, gPoSistersBurnDL); } @@ -1338,7 +1337,7 @@ void EnPoSisters_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } } -void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPoSisters_Draw(Actor* thisx, PlayState* play) { EnPoSisters* this = (EnPoSisters*)thisx; u8 phi_s5; f32 phi_f20; @@ -1348,32 +1347,32 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { Color_RGBA8* temp_s7 = &D_80ADD6F0[this->unk_194]; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_po_sisters.c", 2989); + OPEN_DISPS(play->state.gfxCtx, "../z_en_po_sisters.c", 2989); func_80ADC55C(this); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->unk_22E.a == 255 || this->unk_22E.a == 0) { gDPSetEnvColor(POLY_OPA_DISP++, this->unk_22E.r, this->unk_22E.g, this->unk_22E.b, this->unk_22E.a); gSPSegment(POLY_OPA_DISP++, 0x09, D_80116280 + 2); POLY_OPA_DISP = - SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - EnPoSisters_OverrideLimbDraw, EnPoSisters_PostLimbDraw, &this->actor, POLY_OPA_DISP); + SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoSisters_OverrideLimbDraw, + EnPoSisters_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->unk_22E.a); gSPSegment(POLY_XLU_DISP++, 0x09, D_80116280); POLY_XLU_DISP = - SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - EnPoSisters_OverrideLimbDraw, EnPoSisters_PostLimbDraw, &this->actor, POLY_XLU_DISP); + SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoSisters_OverrideLimbDraw, + EnPoSisters_PostLimbDraw, &this->actor, POLY_XLU_DISP); } if (!(this->unk_199 & 0x80)) { Matrix_Put(&this->unk_2F8); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_po_sisters.c", 3034), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_po_sisters.c", 3034), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gPoSistersTorchDL); } gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - (globalCtx->gameplayFrames * -20) % 512, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (play->gameplayFrames * -20) % 512, 0x20, + 0x80)); gDPSetEnvColor(POLY_XLU_DISP++, temp_s1->r, temp_s1->g, temp_s1->b, temp_s1->a); if (this->actionFunc == func_80ADB17C) { if (this->unk_19A < 32) { @@ -1405,15 +1404,15 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, temp_s7->r, temp_s7->g, temp_s7->b, phi_s5); Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); - Matrix_RotateZYX(0, (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000), 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000), 0, MTXMODE_APPLY); if (this->actionFunc == func_80ADAFC0) { phi_f20 = (this->unk_19A - i) * 0.025f + 0.5f; phi_f20 = CLAMP(phi_f20, 0.5f, 0.8f) * 0.007f; } Matrix_Scale(phi_f20, phi_f20, phi_f20, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_po_sisters.c", 3132), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_po_sisters.c", 3132), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_po_sisters.c", 3139); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_sisters.c", 3139); } diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h index 2b3b7446a9..524f8a867f 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h @@ -6,7 +6,7 @@ struct EnPoSisters; -typedef void (*EnPoSistersActionFunc)(struct EnPoSisters*, GlobalContext*); +typedef void (*EnPoSistersActionFunc)(struct EnPoSisters*, PlayState*); typedef struct EnPoSisters { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 5f9212ca7c..9958cd9f77 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -10,35 +10,35 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_12) -void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx); +void EnPoh_Init(Actor* thisx, PlayState* play); +void EnPoh_Destroy(Actor* thisx, PlayState* play); +void EnPoh_Update(Actor* thisx, PlayState* play); -void EnPoh_UpdateLiving(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_UpdateDead(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_DrawRegular(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_DrawComposer(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_DrawSoul(Actor* thisx, GlobalContext* globalCtx); +void EnPoh_UpdateLiving(Actor* thisx, PlayState* play); +void EnPoh_UpdateDead(Actor* thisx, PlayState* play); +void EnPoh_DrawRegular(Actor* thisx, PlayState* play); +void EnPoh_DrawComposer(Actor* thisx, PlayState* play); +void EnPoh_DrawSoul(Actor* thisx, PlayState* play); -void func_80ADEAC4(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_Idle(EnPoh* this, GlobalContext* globalCtx); -void func_80ADEC9C(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_Attack(EnPoh* this, GlobalContext* globalCtx); -void func_80ADEECC(EnPoh* this, GlobalContext* globalCtx); -void func_80ADF894(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_ComposerAppear(EnPoh* this, GlobalContext* globalCtx); -void func_80ADEF38(EnPoh* this, GlobalContext* globalCtx); -void func_80ADF15C(EnPoh* this, GlobalContext* globalCtx); -void func_80ADF574(EnPoh* this, GlobalContext* globalCtx); -void func_80ADF5E0(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_Disappear(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_Appear(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_Death(EnPoh* this, GlobalContext* globalCtx); -void func_80ADFE28(EnPoh* this, GlobalContext* globalCtx); -void func_80ADFE80(EnPoh* this, GlobalContext* globalCtx); -void func_80AE009C(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_TalkRegular(EnPoh* this, GlobalContext* globalCtx); -void EnPoh_TalkComposer(EnPoh* this, GlobalContext* globalCtx); +void func_80ADEAC4(EnPoh* this, PlayState* play); +void EnPoh_Idle(EnPoh* this, PlayState* play); +void func_80ADEC9C(EnPoh* this, PlayState* play); +void EnPoh_Attack(EnPoh* this, PlayState* play); +void func_80ADEECC(EnPoh* this, PlayState* play); +void func_80ADF894(EnPoh* this, PlayState* play); +void EnPoh_ComposerAppear(EnPoh* this, PlayState* play); +void func_80ADEF38(EnPoh* this, PlayState* play); +void func_80ADF15C(EnPoh* this, PlayState* play); +void func_80ADF574(EnPoh* this, PlayState* play); +void func_80ADF5E0(EnPoh* this, PlayState* play); +void EnPoh_Disappear(EnPoh* this, PlayState* play); +void EnPoh_Appear(EnPoh* this, PlayState* play); +void EnPoh_Death(EnPoh* this, PlayState* play); +void func_80ADFE28(EnPoh* this, PlayState* play); +void func_80ADFE80(EnPoh* this, PlayState* play); +void func_80AE009C(EnPoh* this, PlayState* play); +void EnPoh_TalkRegular(EnPoh* this, PlayState* play); +void EnPoh_TalkComposer(EnPoh* this, PlayState* play); static s16 D_80AE1A50 = 0; @@ -181,26 +181,26 @@ static InitChainEntry sInitChain[] = { static Vec3f D_80AE1B60 = { 0.0f, 3.0f, 0.0f }; static Vec3f D_80AE1B6C = { 0.0f, 0.0f, 0.0f }; -void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_Init(Actor* thisx, PlayState* play) { s32 pad; EnItem00* collectible; EnPoh* this = (EnPoh*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - Collider_InitJntSph(globalCtx, &this->colliderSph); - Collider_SetJntSph(globalCtx, &this->colliderSph, &this->actor, &sJntSphInit, &this->colliderSphItem); + Collider_InitJntSph(play, &this->colliderSph); + Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInit, &this->colliderSphItem); this->colliderSph.elements[0].dim.worldSphere.radius = 0; this->colliderSph.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; this->colliderSph.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y; this->colliderSph.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; - Collider_InitCylinder(globalCtx, &this->colliderCyl); - Collider_SetCylinder(globalCtx, &this->colliderCyl, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliderCyl); + Collider_SetCylinder(play, &this->colliderCyl, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_194 = 0; this->unk_195 = 32; this->visibilityTimer = Rand_S16Offset(700, 300); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + 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); if (this->actor.params >= 4) { @@ -211,30 +211,30 @@ void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx) { if (D_80AE1A50 >= 3) { Actor_Kill(&this->actor); } else { - collectible = Item_DropCollectible(globalCtx, &this->actor.world.pos, 0x4000 | ITEM00_RUPEE_BLUE); + collectible = Item_DropCollectible(play, &this->actor.world.pos, 0x4000 | ITEM00_RUPEE_BLUE); if (collectible != NULL) { collectible->actor.speedXZ = 0.0f; } } } else if (this->actor.params == EN_POH_FLAT) { - if (Flags_GetSwitch(globalCtx, 0x28) || Flags_GetSwitch(globalCtx, 0x9)) { + if (Flags_GetSwitch(play, 0x28) || Flags_GetSwitch(play, 0x9)) { Actor_Kill(&this->actor); } else { - Flags_SetSwitch(globalCtx, 0x28); + Flags_SetSwitch(play, 0x28); } } else if (this->actor.params == EN_POH_SHARP) { - if (Flags_GetSwitch(globalCtx, 0x29) || Flags_GetSwitch(globalCtx, 0x9)) { + if (Flags_GetSwitch(play, 0x29) || Flags_GetSwitch(play, 0x9)) { Actor_Kill(&this->actor); } else { - Flags_SetSwitch(globalCtx, 0x29); + Flags_SetSwitch(play, 0x29); } } if (this->actor.params < EN_POH_SHARP) { - this->objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_POH); + this->objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_POH); this->infoIdx = EN_POH_INFO_NORMAL; this->actor.naviEnemyId = NAVI_ENEMY_POE; } else { - this->objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_PO_COMPOSER); + this->objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_PO_COMPOSER); this->infoIdx = EN_POH_INFO_COMPOSER; this->actor.naviEnemyId = NAVI_ENEMY_POE_COMPOSER; } @@ -244,12 +244,12 @@ void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnPoh_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_Destroy(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyJntSph(globalCtx, &this->colliderSph); - Collider_DestroyCylinder(globalCtx, &this->colliderCyl); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyJntSph(play, &this->colliderSph); + Collider_DestroyCylinder(play, &this->colliderCyl); if (this->actor.params == EN_POH_RUPEE) { D_80AE1A50--; } @@ -367,7 +367,7 @@ void EnPoh_SetupAppear(EnPoh* this) { this->actionFunc = EnPoh_Appear; } -void EnPoh_SetupDeath(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_SetupDeath(EnPoh* this, PlayState* play) { this->actor.update = EnPoh_UpdateDead; this->actor.draw = EnPoh_DrawSoul; this->actor.shape.shadowDraw = NULL; @@ -379,7 +379,7 @@ void EnPoh_SetupDeath(EnPoh* this, GlobalContext* globalCtx) { if (this->infoIdx != EN_POH_INFO_COMPOSER) { this->actor.shape.rot.x = -0x8000; } - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, 8); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, 8); this->unk_198 = 60; this->actionFunc = EnPoh_Death; } @@ -409,7 +409,7 @@ void func_80ADE6D4(EnPoh* this) { this->actionFunc = func_80ADFE28; } -void EnPoh_Talk(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Talk(EnPoh* this, PlayState* play) { this->actor.home.pos.y = this->actor.world.pos.y; Actor_SetFocus(&this->actor, -10.0f); this->colliderCyl.dim.radius = 13; @@ -422,10 +422,10 @@ void EnPoh_Talk(EnPoh* this, GlobalContext* globalCtx) { if (this->actor.params == EN_POH_FLAT || this->actor.params == EN_POH_SHARP) { if (CHECK_QUEST_ITEM(QUEST_SONG_SUN)) { this->actor.textId = 0x5000; - } else if (!Flags_GetSwitch(globalCtx, 0xA) && !Flags_GetSwitch(globalCtx, 0xB)) { + } else if (!Flags_GetSwitch(play, 0xA) && !Flags_GetSwitch(play, 0xB)) { this->actor.textId = 0x500F; - } else if ((this->actor.params == EN_POH_FLAT && Flags_GetSwitch(globalCtx, 0xA)) || - (this->actor.params == EN_POH_SHARP && Flags_GetSwitch(globalCtx, 0xB))) { + } else if ((this->actor.params == EN_POH_FLAT && Flags_GetSwitch(play, 0xA)) || + (this->actor.params == EN_POH_SHARP && Flags_GetSwitch(play, 0xB))) { this->actor.textId = 0x5013; } else { this->actor.textId = 0x5012; @@ -456,8 +456,8 @@ void func_80ADE9BC(EnPoh* this) { this->actionFunc = EnPoh_TalkComposer; } -void EnPoh_MoveTowardsPlayerHeight(EnPoh* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnPoh_MoveTowardsPlayerHeight(EnPoh* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_StepToF(&this->actor.world.pos.y, player->actor.world.pos.y, 1.0f); this->actor.world.pos.y += 2.5f * Math_SinS(this->unk_195 * 0x800); @@ -476,12 +476,12 @@ void func_80ADEA5C(EnPoh* this) { Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_19C, 0x71C); } -void func_80ADEAC4(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADEAC4(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_198 != 0) { this->unk_198--; } - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); if (this->actor.xzDistToPlayer < 200.0f) { func_80ADE1BC(this); } else if (this->unk_198 == 0) { @@ -492,14 +492,14 @@ void func_80ADEAC4(EnPoh* this, GlobalContext* globalCtx) { } } -void EnPoh_Idle(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Idle(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speedXZ, 1.0f, 0.2f); if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_198 != 0) { this->unk_198--; } func_80ADEA5C(this); - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); if (this->actor.xzDistToPlayer < 200.0f && this->unk_198 < 19) { func_80ADE1BC(this); } else if (this->unk_198 == 0) { @@ -514,11 +514,11 @@ void EnPoh_Idle(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADEC9C(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADEC9C(EnPoh* this, PlayState* play) { Player* player; s16 facingDiff; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->unk_198 != 0) { this->unk_198--; @@ -531,11 +531,11 @@ void func_80ADEC9C(EnPoh* this, GlobalContext* globalCtx) { } else { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x71C); } - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); if (this->actor.xzDistToPlayer > 280.0f) { EnPoh_SetupIdle(this); } else if (this->unk_198 == 0 && this->actor.xzDistToPlayer < 140.0f && - !Player_IsFacingActor(&this->actor, 0x2AAA, globalCtx)) { + !Player_IsFacingActor(&this->actor, 0x2AAA, play)) { EnPoh_SetupAttack(this); } if (this->lightColor.a == 255) { @@ -543,7 +543,7 @@ void func_80ADEC9C(EnPoh* this, GlobalContext* globalCtx) { } } -void EnPoh_Attack(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Attack(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_KANTERA); @@ -551,7 +551,7 @@ void EnPoh_Attack(EnPoh* this, GlobalContext* globalCtx) { this->unk_198--; } } - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); if (this->unk_198 >= 10) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xE38); } else if (this->unk_198 == 9) { @@ -563,7 +563,7 @@ void EnPoh_Attack(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADEECC(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADEECC(EnPoh* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health != 0) { @@ -574,7 +574,7 @@ void func_80ADEECC(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADEF38(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADEF38(EnPoh* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->lightColor.a = 255; this->visibilityTimer = Rand_S16Offset(700, 300); @@ -589,7 +589,7 @@ void func_80ADEF38(EnPoh* this, GlobalContext* globalCtx) { } } -void EnPoh_ComposerAppear(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_ComposerAppear(EnPoh* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->lightColor.a = 255; this->visibilityTimer = Rand_S16Offset(700, 300); @@ -600,7 +600,7 @@ void EnPoh_ComposerAppear(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADF15C(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADF15C(EnPoh* this, PlayState* play) { Vec3f vec; f32 multiplier; f32 newScale; @@ -612,32 +612,30 @@ void func_80ADF15C(EnPoh* this, GlobalContext* globalCtx) { if (this->unk_198 < 5) { vec.y = Math_SinS((this->unk_198 * 0x1000) - 0x4000) * 23.0f + (this->actor.world.pos.y + 40.0f); multiplier = Math_CosS((this->unk_198 * 0x1000) - 0x4000) * 23.0f; - vec.x = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier + - this->actor.world.pos.x; - vec.z = Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier + - this->actor.world.pos.z; + vec.x = + Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * multiplier + this->actor.world.pos.x; + vec.z = + Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * multiplier + this->actor.world.pos.z; } else { vec.y = (this->actor.world.pos.y + 40.0f) + (15.0f * (this->unk_198 - 5)); - vec.x = - Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.x; - vec.z = - Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.z; + vec.x = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f + this->actor.world.pos.x; + vec.z = Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f + this->actor.world.pos.z; } - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, - 0, 0, 255, 1, 9, 1); + EffectSsDeadDb_Spawn(play, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, 0, 0, + 255, 1, 9, 1); vec.x = (this->actor.world.pos.x + this->actor.world.pos.x) - vec.x; vec.z = (this->actor.world.pos.z + this->actor.world.pos.z) - vec.z; - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, - 0, 0, 255, 1, 9, 1); + EffectSsDeadDb_Spawn(play, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, 0, 0, + 255, 1, 9, 1); vec.x = this->actor.world.pos.x; vec.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, - 0, 0, 255, 1, 9, 1); + EffectSsDeadDb_Spawn(play, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, 0, 0, + 255, 1, 9, 1); if (this->unk_198 == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_EXTINCT); } } else if (this->unk_198 == 28) { - EnPoh_SetupDeath(this, globalCtx); + EnPoh_SetupDeath(this, play); } else if (this->unk_198 >= 19) { newScale = (28 - this->unk_198) * 0.001f; this->actor.world.pos.y += 5.0f; @@ -650,7 +648,7 @@ void func_80ADF15C(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADF574(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADF574(EnPoh* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.world.rot.y = this->actor.shape.rot.y; EnPoh_SetupIdle(this); @@ -661,7 +659,7 @@ void func_80ADF574(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADF5E0(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADF5E0(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_19C, 1820) != 0) { EnPoh_SetupIdle(this); @@ -669,15 +667,15 @@ void func_80ADF5E0(EnPoh* this, GlobalContext* globalCtx) { if (this->actor.xzDistToPlayer < 200.0f) { func_80ADE1BC(this); } - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); } -void EnPoh_Disappear(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Disappear(EnPoh* this, PlayState* play) { if (this->unk_194 != 0) { this->unk_194--; } this->actor.world.rot.y += 0x1000; - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); this->lightColor.a = this->unk_194 * 7.96875f; if (this->unk_194 == 0) { this->visibilityTimer = Rand_S16Offset(100, 50); @@ -685,10 +683,10 @@ void EnPoh_Disappear(EnPoh* this, GlobalContext* globalCtx) { } } -void EnPoh_Appear(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Appear(EnPoh* this, PlayState* play) { this->unk_194++; this->actor.world.rot.y -= 0x1000; - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); this->lightColor.a = this->unk_194 * 7.96875f; if (this->unk_194 == 32) { this->visibilityTimer = Rand_S16Offset(700, 300); @@ -697,7 +695,7 @@ void EnPoh_Appear(EnPoh* this, GlobalContext* globalCtx) { } } -void func_80ADF894(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADF894(EnPoh* this, PlayState* play) { f32 multiplier; SkelAnime_Update(&this->skelAnime); @@ -705,7 +703,7 @@ void func_80ADF894(EnPoh* this, GlobalContext* globalCtx) { this->actor.world.pos.x -= multiplier * Math_CosS(this->actor.shape.rot.y); this->actor.world.pos.z += multiplier * Math_SinS(this->actor.shape.rot.y); Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 0x71C); - EnPoh_MoveTowardsPlayerHeight(this, globalCtx); + EnPoh_MoveTowardsPlayerHeight(this, play); if (this->unk_198 == 0 || this->actor.xzDistToPlayer > 250.0f) { this->actor.world.rot.y = this->actor.shape.rot.y; EnPoh_SetupIdle(this); @@ -713,7 +711,7 @@ void func_80ADF894(EnPoh* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } -void EnPoh_Death(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_Death(EnPoh* this, PlayState* play) { s32 objId; if (this->unk_198 != 0) { @@ -721,7 +719,7 @@ void EnPoh_Death(EnPoh* this, GlobalContext* globalCtx) { } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { objId = (this->infoIdx == EN_POH_INFO_COMPOSER) ? OBJECT_PO_COMPOSER : OBJECT_POH; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, objId, 10, + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, objId, 10, this->info->lanternDisplayList); func_80ADE6D4(this); } else if (this->unk_198 == 0) { @@ -729,7 +727,7 @@ void EnPoh_Death(EnPoh* this, GlobalContext* globalCtx) { return; } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_2); } void func_80ADFA90(EnPoh* this, s32 arg1) { @@ -753,19 +751,19 @@ void func_80ADFA90(EnPoh* this, s32 arg1) { this->info->lightColor.b, this->lightColor.a * (200.0f / 255)); } -void func_80ADFE28(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADFE28(EnPoh* this, PlayState* play) { this->actor.home.pos.y += 2.0f; func_80ADFA90(this, 20); if (this->lightColor.a == 255) { - EnPoh_Talk(this, globalCtx); + EnPoh_Talk(this, play); } } -void func_80ADFE80(EnPoh* this, GlobalContext* globalCtx) { +void func_80ADFE80(EnPoh* this, PlayState* play) { if (this->unk_198 != 0) { this->unk_198--; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (this->actor.params >= EN_POH_SHARP) { func_80ADE9BC(this); } else { @@ -780,10 +778,10 @@ void func_80ADFE80(EnPoh* this, GlobalContext* globalCtx) { } if (this->colliderCyl.base.ocFlags1 & OC1_HIT) { this->actor.flags |= ACTOR_FLAG_16; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else { this->actor.flags &= ~ACTOR_FLAG_16; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCyl.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCyl.base); } this->actor.world.pos.y = Math_SinS(this->unk_195 * 0x800) * 5.0f + this->actor.home.pos.y; if (this->unk_195 != 0) { @@ -799,26 +797,26 @@ void func_80ADFE80(EnPoh* this, GlobalContext* globalCtx) { this->info->lightColor.b, this->lightColor.a * (200.0f / 255)); } -void func_80AE009C(EnPoh* this, GlobalContext* globalCtx) { +void func_80AE009C(EnPoh* this, PlayState* play) { func_80ADFA90(this, -13); if (this->lightColor.a == 0) { Actor_Kill(&this->actor); } } -void EnPoh_TalkRegular(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_TalkRegular(EnPoh* this, PlayState* play) { if (this->actor.textId != 0x5005) { func_80ADFA90(this, -13); } else { func_8002F974(&this->actor, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) { + if (Message_ShouldAdvance(play)) { Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (Inventory_HasEmptyBottle()) { this->actor.textId = 0x5008; - Item_Give(globalCtx, ITEM_POE); + Item_Give(play, ITEM_POE); Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_BIG_GET); } else { this->actor.textId = 0x5006; @@ -828,47 +826,47 @@ void EnPoh_TalkRegular(EnPoh* this, GlobalContext* globalCtx) { this->actor.textId = 0x5007; Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { func_80ADE950(this, 0); } } -void EnPoh_TalkComposer(EnPoh* this, GlobalContext* globalCtx) { +void EnPoh_TalkComposer(EnPoh* this, PlayState* play) { func_8002F974(&this->actor, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) { - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { - if (!Flags_GetSwitch(globalCtx, 0xB) && !Flags_GetSwitch(globalCtx, 0xA)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { + if (!Flags_GetSwitch(play, 0xB) && !Flags_GetSwitch(play, 0xA)) { this->actor.textId = 0x5010; } else { this->actor.textId = 0x5014; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } else { if (this->actor.params == EN_POH_SHARP) { - Flags_SetSwitch(globalCtx, 0xB); + Flags_SetSwitch(play, 0xB); } else { - Flags_SetSwitch(globalCtx, 0xA); + Flags_SetSwitch(play, 0xA); } func_80ADE950(this, 1); } } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x5000) { - Flags_SetSwitch(globalCtx, 9); + Flags_SetSwitch(play, 9); } func_80ADE950(this, 1); } } -void func_80AE032C(EnPoh* this, GlobalContext* globalCtx) { +void func_80AE032C(EnPoh* this, PlayState* play) { if (this->colliderCyl.base.acFlags & AC_HIT) { this->colliderCyl.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect != 0 || this->actor.colChkInfo.damage != 0) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DEAD); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DAMAGE); @@ -905,19 +903,18 @@ void EnPoh_UpdateVisibility(EnPoh* this) { } } -void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_Update(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objectIdx)) { + if (Object_IsLoaded(&play->objectCtx, this->objectIdx)) { this->actor.objBankIndex = this->objectIdx; this->actor.update = EnPoh_UpdateLiving; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); if (this->infoIdx == EN_POH_INFO_NORMAL) { - SkelAnime_Init(globalCtx, &this->skelAnime, &gPoeSkel, &gPoeFloatAnim, this->jointTable, this->morphTable, - 21); + SkelAnime_Init(play, &this->skelAnime, &gPoeSkel, &gPoeFloatAnim, this->jointTable, this->morphTable, 21); this->actor.draw = EnPoh_DrawRegular; } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gPoeComposerSkel, &gPoeComposerFloatAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gPoeComposerSkel, &gPoeComposerFloatAnim, this->jointTable, this->morphTable, 12); this->actor.draw = EnPoh_DrawComposer; this->colliderSph.elements[0].dim.limb = 9; @@ -984,7 +981,7 @@ void func_80AE089C(EnPoh* this) { } } -void EnPoh_UpdateLiving(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_UpdateLiving(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; s32 pad; Vec3f vec; @@ -994,20 +991,20 @@ void EnPoh_UpdateLiving(Actor* thisx, GlobalContext* globalCtx) { this->colliderSph.base.atFlags &= ~AT_HIT; func_80ADE4C8(this); } - func_80AE032C(this, globalCtx); + func_80AE032C(this, play); EnPoh_UpdateVisibility(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); if (this->actionFunc == EnPoh_Attack && this->unk_198 < 10) { this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); } Collider_UpdateCylinder(&this->actor, &this->colliderCyl); if ((this->colliderCyl.base.acFlags & AC_ON) && this->lightColor.a == 255) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCyl.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCyl.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCyl.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCyl.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSph.base); Actor_SetFocus(&this->actor, 42.0f); if (this->actionFunc != func_80ADEECC && this->actionFunc != func_80ADF574) { if (this->actionFunc == func_80ADF894) { @@ -1020,12 +1017,12 @@ void EnPoh_UpdateLiving(Actor* thisx, GlobalContext* globalCtx) { vec.y = this->actor.world.pos.y + 20.0f; vec.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &sp38, &this->actor, &vec); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &sp38, &this->actor, &vec); func_80AE089C(this); this->actor.shape.shadowAlpha = this->lightColor.a; } -s32 EnPoh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnPoh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoh* this = (EnPoh*)thisx; @@ -1043,12 +1040,12 @@ s32 EnPoh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { +void EnPoh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoh* this = (EnPoh*)thisx; Collider_UpdateSpheres(limbIndex, &this->colliderSph); if (this->actionFunc == func_80ADF15C && this->unk_198 >= 2 && limbIndex == this->info->unk_7) { - gSPMatrix((*gfxP)++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_poh.c", 2460), + gSPMatrix((*gfxP)++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_poh.c", 2460), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfxP)++, this->info->burnDisplayList); } @@ -1070,39 +1067,39 @@ void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnPoh_DrawRegular(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_DrawRegular(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_poh.c", 2629); + OPEN_DISPS(play->state.gfxCtx, "../z_en_poh.c", 2629); func_80AE067C(this); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (this->lightColor.a == 255 || this->lightColor.a == 0) { gDPSetEnvColor(POLY_OPA_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a); gSPSegment(POLY_OPA_DISP++, 0x08, D_80116280 + 2); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->lightColor.a); gSPSegment(POLY_XLU_DISP++, 0x08, D_80116280); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, &this->actor, POLY_XLU_DISP); } gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, this->envColor.r, this->envColor.g, this->envColor.b, 255); Matrix_Put(&this->unk_368); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_poh.c", 2676), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_poh.c", 2676), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->info->lanternDisplayList); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_poh.c", 2681); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_poh.c", 2681); } -void EnPoh_DrawComposer(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_DrawComposer(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; Color_RGBA8* sp90; Color_RGBA8* phi_t0; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_poh.c", 2694); + OPEN_DISPS(play->state.gfxCtx, "../z_en_poh.c", 2694); func_80AE067C(this); if (this->actor.params == EN_POH_SHARP) { sp90 = &D_80AE1B4C; @@ -1112,67 +1109,67 @@ void EnPoh_DrawComposer(Actor* thisx, GlobalContext* globalCtx) { phi_t0 = &D_80AE1B58; } if (this->lightColor.a == 255 || this->lightColor.a == 0) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_EnvColor(globalCtx->state.gfxCtx, sp90->r, sp90->g, sp90->b, this->lightColor.a)); + Gfx_EnvColor(play->state.gfxCtx, sp90->r, sp90->g, sp90->b, this->lightColor.a)); gSPSegment(POLY_OPA_DISP++, 0x0B, - Gfx_EnvColor(globalCtx->state.gfxCtx, phi_t0->r, phi_t0->g, phi_t0->b, this->lightColor.a)); + Gfx_EnvColor(play->state.gfxCtx, phi_t0->r, phi_t0->g, phi_t0->b, this->lightColor.a)); gSPSegment(POLY_OPA_DISP++, 0x0C, D_80116280 + 2); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, - &this->actor, POLY_OPA_DISP); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->lightColor.r, this->lightColor.g, this->lightColor.b, this->lightColor.a)); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_EnvColor(globalCtx->state.gfxCtx, sp90->r, sp90->g, sp90->b, this->lightColor.a)); + Gfx_EnvColor(play->state.gfxCtx, sp90->r, sp90->g, sp90->b, this->lightColor.a)); gSPSegment(POLY_XLU_DISP++, 0x0B, - Gfx_EnvColor(globalCtx->state.gfxCtx, phi_t0->r, phi_t0->g, phi_t0->b, this->lightColor.a)); + Gfx_EnvColor(play->state.gfxCtx, phi_t0->r, phi_t0->g, phi_t0->b, this->lightColor.a)); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, - &this->actor, POLY_XLU_DISP); + POLY_XLU_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, &this->actor, POLY_XLU_DISP); } gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, this->envColor.r, this->envColor.g, this->envColor.b, 255); Matrix_Put(&this->unk_368); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_poh.c", 2787), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_poh.c", 2787), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->info->lanternDisplayList); gSPDisplayList(POLY_OPA_DISP++, gPoeComposerLanternBottomDL); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sp90->r, sp90->g, sp90->b, 255); gSPDisplayList(POLY_OPA_DISP++, gPoeComposerLanternTopDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_poh.c", 2802); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_poh.c", 2802); } -void EnPoh_UpdateDead(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_UpdateDead(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != EnPoh_Death) { this->visibilityTimer++; } func_80AE089C(this); } -void EnPoh_DrawSoul(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_DrawSoul(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_poh.c", 2833); + OPEN_DISPS(play->state.gfxCtx, "../z_en_poh.c", 2833); if (this->actionFunc == EnPoh_Death) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, this->envColor.r, this->envColor.g, this->envColor.b, 255); Lights_PointGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->envColor.r, this->envColor.g, this->envColor.b, 200); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_poh.c", 2854), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_poh.c", 2854), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->info->lanternDisplayList); if (this->infoIdx == EN_POH_INFO_COMPOSER) { @@ -1185,17 +1182,17 @@ void EnPoh_DrawSoul(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gPoeComposerLanternTopDL); } } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->visibilityTimer * this->info->unk_8) % 512U, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, this->info->primColor.r, this->info->primColor.g, this->info->primColor.b, this->lightColor.a); gDPSetEnvColor(POLY_XLU_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 255); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_poh.c", 2910), + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_poh.c", 2910), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, this->info->soulDisplayList); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_poh.c", 2916); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_poh.c", 2916); } diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.h b/src/overlays/actors/ovl_En_Poh/z_en_poh.h index 724ade9e1e..8c57fd5126 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.h +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.h @@ -6,7 +6,7 @@ struct EnPoh; -typedef void (*EnPohActionFunc)(struct EnPoh*, GlobalContext*); +typedef void (*EnPohActionFunc)(struct EnPoh*, PlayState*); typedef enum { EN_POH_NORMAL, diff --git a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c index ff1057c598..b21f3814d6 100644 --- a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c +++ b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c @@ -9,10 +9,10 @@ #define FLAGS ACTOR_FLAG_4 -void EnPubox_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPubox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPubox_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPubox_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPubox_Init(Actor* thisx, PlayState* play); +void EnPubox_Destroy(Actor* thisx, PlayState* play); +void EnPubox_Update(Actor* thisx, PlayState* play); +void EnPubox_Draw(Actor* thisx, PlayState* play); const ActorInit En_Pu_box_InitVars = { ACTOR_EN_PU_BOX, @@ -26,7 +26,7 @@ const ActorInit En_Pu_box_InitVars = { (ActorFunc)EnPubox_Draw, }; -void EnPubox_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPubox_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; EnPubox* this = (EnPubox*)thisx; @@ -56,16 +56,16 @@ void EnPubox_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->targetMode = 1; thisx->gravity = -2.0f; CollisionHeader_GetVirtual(&gBlockMediumCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } -void EnPubox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPubox_Destroy(Actor* thisx, PlayState* play) { EnPubox* this = (EnPubox*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void EnPubox_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPubox_Update(Actor* thisx, PlayState* play) { EnPubox* this = (EnPubox*)thisx; thisx->speedXZ += this->dyna.unk_150; @@ -80,11 +80,11 @@ void EnPubox_Update(Actor* thisx, GlobalContext* globalCtx) { this->dyna.unk_150 = 0.0f; Actor_MoveForward(thisx); Actor_UpdateBgCheckInfo( - globalCtx, thisx, thisx->colChkInfo.cylHeight, thisx->colChkInfo.cylRadius, thisx->colChkInfo.cylRadius, + play, thisx, thisx->colChkInfo.cylHeight, thisx->colChkInfo.cylRadius, thisx->colChkInfo.cylRadius, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); thisx->focus.pos = thisx->world.pos; } -void EnPubox_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gBlockMediumDL); +void EnPubox_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gBlockMediumDL); } diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 5b803767f8..8683742714 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -3,31 +3,31 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_10) -void EnRd_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRd_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRd_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRd_Init(Actor* thisx, PlayState* play); +void EnRd_Destroy(Actor* thisx, PlayState* play); +void EnRd_Update(Actor* thisx, PlayState* play); +void EnRd_Draw(Actor* thisx, PlayState* play); void EnRd_SetupIdle(EnRd* this); void EnRd_SetupRiseFromCoffin(EnRd* this); -void EnRd_SetupWalkToHome(EnRd* this, GlobalContext* globalCtx); +void EnRd_SetupWalkToHome(EnRd* this, PlayState* play); void EnRd_SetupWalkToParent(EnRd* this); void EnRd_SetupGrab(EnRd* this); void EnRd_SetupAttemptPlayerFreeze(EnRd* this); void EnRd_SetupStandUp(EnRd* this); void EnRd_SetupCrouch(EnRd* this); -void EnRd_Idle(EnRd* this, GlobalContext* globalCtx); -void EnRd_RiseFromCoffin(EnRd* this, GlobalContext* globalCtx); -void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx); -void EnRd_WalkToHome(EnRd* this, GlobalContext* globalCtx); -void EnRd_WalkToParent(EnRd* this, GlobalContext* globalCtx); -void EnRd_Grab(EnRd* this, GlobalContext* globalCtx); -void EnRd_AttemptPlayerFreeze(EnRd* this, GlobalContext* globalCtx); -void EnRd_StandUp(EnRd* this, GlobalContext* globalCtx); -void EnRd_Crouch(EnRd* this, GlobalContext* globalCtx); -void EnRd_Damaged(EnRd* this, GlobalContext* globalCtx); -void EnRd_Dead(EnRd* this, GlobalContext* globalCtx); -void EnRd_Stunned(EnRd* this, GlobalContext* globalCtx); +void EnRd_Idle(EnRd* this, PlayState* play); +void EnRd_RiseFromCoffin(EnRd* this, PlayState* play); +void EnRd_WalkToPlayer(EnRd* this, PlayState* play); +void EnRd_WalkToHome(EnRd* this, PlayState* play); +void EnRd_WalkToParent(EnRd* this, PlayState* play); +void EnRd_Grab(EnRd* this, PlayState* play); +void EnRd_AttemptPlayerFreeze(EnRd* this, PlayState* play); +void EnRd_StandUp(EnRd* this, PlayState* play); +void EnRd_Crouch(EnRd* this, PlayState* play); +void EnRd_Damaged(EnRd* this, PlayState* play); +void EnRd_Dead(EnRd* this, PlayState* play); +void EnRd_Stunned(EnRd* this, PlayState* play); typedef enum { /* 0 */ REDEAD_ACTION_IDLE, @@ -138,7 +138,7 @@ void EnRd_SetupAction(EnRd* this, EnRdActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRd_Init(Actor* thisx, PlayState* play) { EnRd* this = (EnRd*)thisx; Actor_ProcessInitChain(thisx, sInitChain); @@ -160,17 +160,17 @@ void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.params >= REDEAD_TYPE_DOES_NOT_MOURN) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRedeadSkel, &gGibdoRedeadIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gRedeadSkel, &gGibdoRedeadIdleAnim, this->jointTable, this->morphTable, REDEAD_GIBDO_LIMB_MAX); this->actor.naviEnemyId = NAVI_ENEMY_REDEAD; } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, this->jointTable, this->morphTable, REDEAD_GIBDO_LIMB_MAX); this->actor.naviEnemyId = NAVI_ENEMY_GIBDO; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); if (this->actor.params >= REDEAD_TYPE_GIBDO) { EnRd_SetupIdle(this); @@ -185,14 +185,14 @@ void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnRd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRd_Destroy(Actor* thisx, PlayState* play) { EnRd* this = (EnRd*)thisx; if (gSaveContext.sunsSongState != SUNSSONG_INACTIVE) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } /** @@ -205,8 +205,8 @@ void EnRd_Destroy(Actor* thisx, GlobalContext* globalCtx) { * If `shouldMourn` is false, the parent of all other Redeads is cleared so that * they stop mourning. This is done when the dead Redead starts fading away. */ -void EnRd_UpdateMourningTarget(GlobalContext* globalCtx, Actor* thisx, s32 shouldMourn) { - Actor* enemyIterator = globalCtx->actorCtx.actorLists[ACTORCAT_ENEMY].head; +void EnRd_UpdateMourningTarget(PlayState* play, Actor* thisx, s32 shouldMourn) { + Actor* enemyIterator = play->actorCtx.actorLists[ACTORCAT_ENEMY].head; while (enemyIterator != NULL) { if ((enemyIterator->id != ACTOR_EN_RD) || (enemyIterator == thisx) || @@ -239,7 +239,7 @@ void EnRd_SetupIdle(EnRd* this) { EnRd_SetupAction(this, EnRd_Idle); } -void EnRd_Idle(EnRd* this, GlobalContext* globalCtx) { +void EnRd_Idle(EnRd* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->headYRotation, 0, 1, 0x64, 0); Math_SmoothStepToS(&this->upperBodyYRotation, 0, 1, 0x64, 0); @@ -278,7 +278,7 @@ void EnRd_Idle(EnRd* this, GlobalContext* globalCtx) { } this->isMourning = false; - if ((this->actor.xzDistToPlayer <= 150.0f) && func_8002DDE4(globalCtx)) { + if ((this->actor.xzDistToPlayer <= 150.0f) && func_8002DDE4(play)) { if ((this->actor.params != REDEAD_TYPE_CRYING) && !this->isMourning) { EnRd_SetupAttemptPlayerFreeze(this); } else { @@ -287,7 +287,7 @@ void EnRd_Idle(EnRd* this, GlobalContext* globalCtx) { } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -304,7 +304,7 @@ void EnRd_SetupRiseFromCoffin(EnRd* this) { EnRd_SetupAction(this, EnRd_RiseFromCoffin); } -void EnRd_RiseFromCoffin(EnRd* this, GlobalContext* globalCtx) { +void EnRd_RiseFromCoffin(EnRd* this, PlayState* play) { if (this->actor.shape.rot.x != -0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x7D0, 0); if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.3f, 2.0f, 0.3f) == 0.0f) { @@ -327,7 +327,7 @@ void EnRd_RiseFromCoffin(EnRd* this, GlobalContext* globalCtx) { } } -void EnRd_SetupWalkToPlayer(EnRd* this, GlobalContext* globalCtx) { +void EnRd_SetupWalkToPlayer(EnRd* this, PlayState* play) { Animation_Change(&this->skelAnime, &gGibdoRedeadWalkAnim, 1.0f, 4.0f, Animation_GetLastFrame(&gGibdoRedeadWalkAnim), ANIMMODE_LOOP_INTERP, -4.0f); this->actor.speedXZ = 0.4f; @@ -335,11 +335,11 @@ void EnRd_SetupWalkToPlayer(EnRd* this, GlobalContext* globalCtx) { EnRd_SetupAction(this, EnRd_WalkToPlayer); } -void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx) { +void EnRd_WalkToPlayer(EnRd* this, PlayState* play) { Vec3f D_80AE4918 = { 0.0f, 0.0f, 0.0f }; Color_RGBA8 D_80AE4924 = { 200, 200, 255, 255 }; Color_RGBA8 D_80AE4928 = { 0, 0, 255, 0 }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; s16 yaw = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->headYRotation - this->upperBodyYRotation; @@ -351,7 +351,7 @@ void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { - EnRd_SetupWalkToHome(this, globalCtx); + EnRd_SetupWalkToHome(this, play); } if ((ABS(yaw) < 0x1554) && (Actor_WorldDistXYZToActor(&this->actor, &player->actor) <= 150.0f)) { @@ -361,8 +361,8 @@ void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx) { if (this->playerStunWaitTimer == 0) { if (!(this->rdFlags & 0x80)) { player->actor.freezeTimer = 40; - func_8008EEAC(globalCtx, &this->actor); - GET_PLAYER(globalCtx)->unk_684 = &this->actor; + func_8008EEAC(play, &this->actor); + GET_PLAYER(play)->unk_684 = &this->actor; func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); } @@ -370,7 +370,7 @@ void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_AIM); } } else { - EnRd_SetupWalkToHome(this, globalCtx); + EnRd_SetupWalkToHome(this, play); } } @@ -381,7 +381,7 @@ void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx) { if (!this->grabWaitTimer && (Actor_WorldDistXYZToActor(&this->actor, &player->actor) <= 45.0f) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { player->actor.freezeTimer = 0; - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { this->actor.flags &= ~ACTOR_FLAG_0; EnRd_SetupGrab(this); } @@ -395,20 +395,20 @@ void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx) { if ((this->skelAnime.curFrame == 10.0f) || (this->skelAnime.curFrame == 22.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK); - } else if ((globalCtx->gameplayFrames & 0x5F) == 0) { + } else if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY); } } -void EnRd_SetupWalkToHome(EnRd* this, GlobalContext* globalCtx) { +void EnRd_SetupWalkToHome(EnRd* this, PlayState* play) { Animation_Change(&this->skelAnime, &gGibdoRedeadWalkAnim, 0.5f, 0, Animation_GetLastFrame(&gGibdoRedeadWalkAnim), ANIMMODE_LOOP_INTERP, -4.0f); this->action = REDEAD_ACTION_WALK_TO_HOME; EnRd_SetupAction(this, EnRd_WalkToHome); } -void EnRd_WalkToHome(EnRd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRd_WalkToHome(EnRd* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 targetY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); @@ -435,7 +435,7 @@ void EnRd_WalkToHome(EnRd* this, GlobalContext* globalCtx) { !(player->stateFlags2 & PLAYER_STATE2_7) && (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 150.0f)) { this->actor.targetMode = 0; - EnRd_SetupWalkToPlayer(this, globalCtx); + EnRd_SetupWalkToPlayer(this, play); } else if (this->actor.params > REDEAD_TYPE_DOES_NOT_MOURN_IF_WALKING) { if (this->actor.parent != NULL) { EnRd_SetupWalkToParent(this); @@ -446,7 +446,7 @@ void EnRd_WalkToHome(EnRd* this, GlobalContext* globalCtx) { if (this->skelAnime.curFrame == 10.0f || this->skelAnime.curFrame == 22.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK); - } else if ((globalCtx->gameplayFrames & 0x5F) == 0) { + } else if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -465,7 +465,7 @@ void EnRd_SetupWalkToParent(EnRd* this) { * these Redeads walk over to the corpse and stand near until it begins to * fade away. */ -void EnRd_WalkToParent(EnRd* this, GlobalContext* globalCtx) { +void EnRd_WalkToParent(EnRd* this, PlayState* play) { if (this->actor.parent != NULL) { s32 pad; s16 targetY; @@ -490,7 +490,7 @@ void EnRd_WalkToParent(EnRd* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->headYRotation, 0, 1, 0x64, 0); Math_SmoothStepToS(&this->upperBodyYRotation, 0, 1, 0x64, 0); } else { - EnRd_SetupWalkToPlayer(this, globalCtx); + EnRd_SetupWalkToPlayer(this, play); } this->actor.world.rot.y = this->actor.shape.rot.y; @@ -498,7 +498,7 @@ void EnRd_WalkToParent(EnRd* this, GlobalContext* globalCtx) { if (this->skelAnime.curFrame == 10.0f || this->skelAnime.curFrame == 22.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK); - } else if ((globalCtx->gameplayFrames & 0x5F) == 0) { + } else if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -512,9 +512,9 @@ void EnRd_SetupGrab(EnRd* this) { EnRd_SetupAction(this, EnRd_Grab); } -void EnRd_Grab(EnRd* this, GlobalContext* globalCtx) { +void EnRd_Grab(EnRd* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (SkelAnime_Update(&this->skelAnime)) { this->grabState++; @@ -524,7 +524,7 @@ void EnRd_Grab(EnRd* this, GlobalContext* globalCtx) { case REDEAD_GRAB_INITIAL_DAMAGE: Animation_PlayLoop(&this->skelAnime, &gGibdoRedeadGrabAttackAnim); this->grabState++; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); func_800AA000(this->actor.xzDistToPlayer, 0xFF, 1, 0xC); this->grabDamageTimer = 20; // fallthrough @@ -560,7 +560,7 @@ void EnRd_Grab(EnRd* this, GlobalContext* globalCtx) { this->grabDamageTimer--; if (this->grabDamageTimer == 0) { - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); func_800AA000(this->actor.xzDistToPlayer, 0xF0, 1, 0xC); this->grabDamageTimer = 20; func_8002F7DC(&player->actor, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->unk_92); @@ -581,7 +581,7 @@ void EnRd_Grab(EnRd* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_0; this->playerStunWaitTimer = 0xA; this->grabWaitTimer = 0xF; - EnRd_SetupWalkToPlayer(this, globalCtx); + EnRd_SetupWalkToPlayer(this, play); break; } } @@ -593,22 +593,22 @@ void EnRd_SetupAttemptPlayerFreeze(EnRd* this) { EnRd_SetupAction(this, EnRd_AttemptPlayerFreeze); } -void EnRd_AttemptPlayerFreeze(EnRd* this, GlobalContext* globalCtx) { +void EnRd_AttemptPlayerFreeze(EnRd* this, PlayState* play) { Vec3f D_80AE492C = { 0.0f, 0.0f, 0.0f }; Color_RGBA8 D_80AE4938 = { 200, 200, 255, 255 }; Color_RGBA8 D_80AE493C = { 0, 0, 255, 0 }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 yaw = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->headYRotation - this->upperBodyYRotation; if (ABS(yaw) < 0x2008) { if (!(this->rdFlags & 0x80)) { player->actor.freezeTimer = 60; func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); - func_8008EEAC(globalCtx, &this->actor); + func_8008EEAC(play, &this->actor); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_AIM); - EnRd_SetupWalkToPlayer(this, globalCtx); + EnRd_SetupWalkToPlayer(this, play); } } @@ -618,7 +618,7 @@ void EnRd_SetupStandUp(EnRd* this) { EnRd_SetupAction(this, EnRd_StandUp); } -void EnRd_StandUp(EnRd* this, GlobalContext* globalCtx) { +void EnRd_StandUp(EnRd* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.parent != NULL) { EnRd_SetupWalkToParent(this); @@ -635,7 +635,7 @@ void EnRd_SetupCrouch(EnRd* this) { EnRd_SetupAction(this, EnRd_Crouch); } -void EnRd_Crouch(EnRd* this, GlobalContext* globalCtx) { +void EnRd_Crouch(EnRd* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnRd_SetupIdle(this); } @@ -654,8 +654,8 @@ void EnRd_SetupDamaged(EnRd* this) { EnRd_SetupAction(this, EnRd_Damaged); } -void EnRd_Damaged(EnRd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRd_Damaged(EnRd* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; @@ -670,9 +670,9 @@ void EnRd_Damaged(EnRd* this, GlobalContext* globalCtx) { if (this->actor.parent != NULL) { EnRd_SetupWalkToParent(this); } else if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { - EnRd_SetupWalkToHome(this, globalCtx); + EnRd_SetupWalkToHome(this, play); } else { - EnRd_SetupWalkToPlayer(this, globalCtx); + EnRd_SetupWalkToPlayer(this, play); } this->unk_31D = 0xFF; @@ -689,9 +689,9 @@ void EnRd_SetupDead(EnRd* this) { EnRd_SetupAction(this, EnRd_Dead); } -void EnRd_Dead(EnRd* this, GlobalContext* globalCtx) { +void EnRd_Dead(EnRd* this, PlayState* play) { if (this->actor.category != ACTORCAT_PROP) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } Math_SmoothStepToS(&this->headYRotation, 0, 1, 0x7D0, 0); @@ -699,13 +699,13 @@ void EnRd_Dead(EnRd* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { if (this->timer == 0) { - if (!Flags_GetSwitch(globalCtx, this->rdFlags & 0x7F)) { - Flags_SetSwitch(globalCtx, this->rdFlags & 0x7F); + if (!Flags_GetSwitch(play, this->rdFlags & 0x7F)) { + Flags_SetSwitch(play, this->rdFlags & 0x7F); } if (this->alpha != 0) { if (this->alpha == 180) { - EnRd_UpdateMourningTarget(globalCtx, &this->actor, false); + EnRd_UpdateMourningTarget(play, &this->actor, false); } this->actor.scale.y -= 0.000075f; @@ -740,7 +740,7 @@ void EnRd_SetupStunned(EnRd* this) { EnRd_SetupAction(this, EnRd_Stunned); } -void EnRd_Stunned(EnRd* this, GlobalContext* globalCtx) { +void EnRd_Stunned(EnRd* this, PlayState* play) { if (this->stunnedBySunsSong && (this->sunsSongStunTimer != 0)) { this->sunsSongStunTimer--; if (this->sunsSongStunTimer >= 255) { @@ -755,16 +755,16 @@ void EnRd_Stunned(EnRd* this, GlobalContext* globalCtx) { if (this->actor.colorFilterTimer == 0) { if (this->actor.colChkInfo.health == 0) { - EnRd_UpdateMourningTarget(globalCtx, &this->actor, true); + EnRd_UpdateMourningTarget(play, &this->actor, true); EnRd_SetupDead(this); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); } else { EnRd_SetupDamaged(this); } } } -void EnRd_TurnTowardsPlayer(EnRd* this, GlobalContext* globalCtx) { +void EnRd_TurnTowardsPlayer(EnRd* this, PlayState* play) { s16 headAngleTemp = this->actor.yawTowardsPlayer - (s16)(this->actor.shape.rot.y + this->upperBodyYRotation); s16 upperBodyAngle = CLAMP(headAngleTemp, -500, 500); s16 headAngle; @@ -784,9 +784,9 @@ void EnRd_TurnTowardsPlayer(EnRd* this, GlobalContext* globalCtx) { this->headYRotation = CLAMP(this->headYRotation, -0x256F, 0x256F); } -void EnRd_UpdateDamage(EnRd* this, GlobalContext* globalCtx) { +void EnRd_UpdateDamage(EnRd* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((gSaveContext.sunsSongState != SUNSSONG_INACTIVE) && (this->actor.shape.rot.x == 0) && !this->stunnedBySunsSong && (this->action != REDEAD_ACTION_DAMAGED) && (this->action != REDEAD_ACTION_DEAD) && @@ -826,9 +826,9 @@ void EnRd_UpdateDamage(EnRd* this, GlobalContext* globalCtx) { Actor_ApplyDamage(&this->actor); if (this->actor.colChkInfo.health == 0) { - EnRd_UpdateMourningTarget(globalCtx, &this->actor, true); + EnRd_UpdateMourningTarget(play, &this->actor, true); EnRd_SetupDead(this); - Item_DropCollectibleRandom(globalCtx, 0, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, 0, &this->actor.world.pos, 0x90); } else { EnRd_SetupDamaged(this); } @@ -837,13 +837,13 @@ void EnRd_UpdateDamage(EnRd* this, GlobalContext* globalCtx) { } } -void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRd_Update(Actor* thisx, PlayState* play) { s32 pad; EnRd* this = (EnRd*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; - EnRd_UpdateDamage(this, globalCtx); + EnRd_UpdateDamage(this, play); if (gSaveContext.sunsSongState != SUNSSONG_INACTIVE && !this->stunnedBySunsSong) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; @@ -855,19 +855,19 @@ void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) { this->playerStunWaitTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->action != REDEAD_ACTION_GRAB && this->actor.speedXZ != 0.0f) { Actor_MoveForward(&this->actor); } if ((this->actor.shape.rot.x == 0) && (this->action != REDEAD_ACTION_GRAB) && (this->actor.speedXZ != 0.0f)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 20.0f, 35.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } if (this->action == REDEAD_ACTION_ATTEMPT_PLAYER_FREEZE) { - EnRd_TurnTowardsPlayer(this, globalCtx); + EnRd_TurnTowardsPlayer(this, play); } } @@ -876,15 +876,14 @@ void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.health > 0) && (this->action != REDEAD_ACTION_GRAB)) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if ((this->action != REDEAD_ACTION_DAMAGED) || ((player->unk_844 != 0) && (player->unk_845 != this->unk_31D))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -s32 EnRd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { +s32 EnRd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnRd* this = (EnRd*)thisx; if (limbIndex == REDEAD_GIBDO_LIMB_HEAD_ROOT) { @@ -896,7 +895,7 @@ s32 EnRd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnRd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnRd_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { Vec3f D_80AE4940 = { 300.0f, 0.0f, 0.0f }; EnRd* this = (EnRd*)thisx; s32 idx = -1; @@ -954,43 +953,43 @@ void EnRd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnRd_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRd_Draw(Actor* thisx, PlayState* play) { static Vec3f D_80AE494C = { 300.0f, 0.0f, 0.0f }; static Vec3f sShadowScale = { 0.25f, 0.25f, 0.25f }; s32 pad; EnRd* this = (EnRd*)thisx; Vec3f thisPos = thisx->world.pos; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_rd.c", 1679); + OPEN_DISPS(play->state.gfxCtx, "../z_en_rd.c", 1679); if (this->alpha == 255) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_OPA_DISP++, 8, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnRd_OverrideLimbDraw, EnRd_PostLimbDraw, this, - POLY_OPA_DISP); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnRd_OverrideLimbDraw, EnRd_PostLimbDraw, this, POLY_OPA_DISP); - func_80033C30(&thisPos, &sShadowScale, 255, globalCtx); + func_80033C30(&thisPos, &sShadowScale, 255, play); if (this->fireTimer != 0) { thisx->colorFilterTimer++; this->fireTimer--; if (this->fireTimer % 4 == 0) { - EffectSsEnFire_SpawnVec3s(globalCtx, thisx, &this->firePos[this->fireTimer >> 2], 0x4B, 0, 0, + EffectSsEnFire_SpawnVec3s(play, thisx, &this->firePos[this->fireTimer >> 2], 0x4B, 0, 0, (this->fireTimer >> 2)); } } } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 8, &D_80116280[0]); POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnRd_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnRd_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - func_80033C30(&thisPos, &sShadowScale, this->alpha, globalCtx); + func_80033C30(&thisPos, &sShadowScale, this->alpha, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_rd.c", 1735); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_rd.c", 1735); } diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.h b/src/overlays/actors/ovl_En_Rd/z_en_rd.h index f05addce6c..864dc13a99 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.h +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.h @@ -6,7 +6,7 @@ struct EnRd; -typedef void (*EnRdActionFunc)(struct EnRd*, GlobalContext*); +typedef void (*EnRdActionFunc)(struct EnRd*, PlayState*); #define REDEAD_GET_FLAGS(thisx) (((thisx)->params & 0xFF00) >> 8) diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index 69966e2cb9..dbdb5e762f 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -12,23 +12,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_27) -void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx); -void EnReeba_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx); -void EnReeba_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnReeba_Init(Actor* thisx, PlayState* play); +void EnReeba_Destroy(Actor* thisx, PlayState* play); +void EnReeba_Update(Actor* thisx, PlayState* play); +void EnReeba_Draw(Actor* thisx, PlayState* play); -void func_80AE4F40(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5054(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5270(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5688(EnReeba* this, GlobalContext* globalCtx); -void func_80AE56E0(EnReeba* this, GlobalContext* globalCtx); -void func_80AE538C(EnReeba* this, GlobalContext* globalCtx); -void func_80AE53AC(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5E48(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5854(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5C38(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5938(EnReeba* this, GlobalContext* globalCtx); -void func_80AE5A9C(EnReeba* this, GlobalContext* globalCtx); +void func_80AE4F40(EnReeba* this, PlayState* play); +void func_80AE5054(EnReeba* this, PlayState* play); +void func_80AE5270(EnReeba* this, PlayState* play); +void func_80AE5688(EnReeba* this, PlayState* play); +void func_80AE56E0(EnReeba* this, PlayState* play); +void func_80AE538C(EnReeba* this, PlayState* play); +void func_80AE53AC(EnReeba* this, PlayState* play); +void func_80AE5E48(EnReeba* this, PlayState* play); +void func_80AE5854(EnReeba* this, PlayState* play); +void func_80AE5C38(EnReeba* this, PlayState* play); +void func_80AE5938(EnReeba* this, PlayState* play); +void func_80AE5A9C(EnReeba* this, PlayState* play); static DamageTable sDamageTable = { /* Deku nut */ DMG_ENTRY(0, 0x0), @@ -97,7 +97,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 40, 0, { 0, 0, 0 } }, }; -void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnReeba_Init(Actor* thisx, PlayState* play) { s32 pad; EnReeba* this = (EnReeba*)thisx; s32 surfaceType; @@ -106,12 +106,12 @@ void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 3; this->actor.gravity = -3.5f; this->actor.focus.pos = this->actor.world.pos; - SkelAnime_Init(globalCtx, &this->skelanime, &object_reeba_Skel_001EE8, &object_reeba_Anim_0001E4, this->jointTable, + SkelAnime_Init(play, &this->skelanime, &object_reeba_Skel_001EE8, &object_reeba_Anim_0001E4, this->jointTable, this->morphTable, 18); this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 4; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->isBig = this->actor.params; this->scale = 0.04f; @@ -123,17 +123,17 @@ void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.health = 20; this->collider.info.toucher.effect = 4; this->collider.info.toucher.damage = 16; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } this->actor.shape.yOffset = this->unk_284 = this->scale * -27500.0f; ActorShape_Init(&this->actor.shape, this->actor.shape.yOffset, ActorShadow_DrawCircle, 0.0f); this->actor.colChkInfo.damageTable = &sDamageTable; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 35.0f, 60.0f, 60.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - surfaceType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + surfaceType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((surfaceType != 4) && (surfaceType != 7)) { Actor_Kill(&this->actor); @@ -143,11 +143,11 @@ void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionfunc = func_80AE4F40; } -void EnReeba_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnReeba_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnReeba* this = (EnReeba*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); if (this->actor.parent != NULL) { EnEncount1* spawner = (EnEncount1*)this->actor.parent; @@ -164,9 +164,9 @@ void EnReeba_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80AE4F40(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE4F40(EnReeba* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&object_reeba_Anim_0001E4); - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 playerSpeed; Animation_Change(&this->skelanime, &object_reeba_Anim_0001E4, 2.0f, 0.0f, frames, ANIMMODE_LOOP, -10.0f); @@ -192,15 +192,15 @@ void func_80AE4F40(EnReeba* this, GlobalContext* globalCtx) { this->actionfunc = func_80AE5054; } -void func_80AE5054(EnReeba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AE5054(EnReeba* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 playerLinearVel; SkelAnime_Update(&this->skelanime); - if ((globalCtx->gameplayFrames % 4) == 0) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, - 8.0f, 500, 10, true); + if ((play->gameplayFrames % 4) == 0) { + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 8.0f, + 500, 10, true); } if (this->unk_278 == 0) { @@ -242,7 +242,7 @@ void func_80AE5054(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE5270(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5270(EnReeba* this, PlayState* play) { s32 surfaceType; SkelAnime_Update(&this->skelanime); @@ -251,7 +251,7 @@ void func_80AE5270(EnReeba* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.shape.shadowScale, 12.0f, 3.0f, 1.0f); } - surfaceType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + surfaceType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((surfaceType != 4) && (surfaceType != 7)) { this->actor.speedXZ = 0.0f; @@ -265,12 +265,12 @@ void func_80AE5270(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE538C(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE538C(EnReeba* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2; this->actionfunc = func_80AE53AC; } -void func_80AE53AC(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE53AC(EnReeba* this, PlayState* play) { f32 speed; s16 yawDiff; s16 yaw; @@ -282,7 +282,7 @@ void func_80AE53AC(EnReeba* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.shape.shadowScale, 12.0f, 3.0f, 1.0f); } - surfaceType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + surfaceType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if (((surfaceType != 4) && (surfaceType != 7)) || (this->actor.xzDistToPlayer > 400.0f) || (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { @@ -313,7 +313,7 @@ void func_80AE53AC(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE561C(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE561C(EnReeba* this, PlayState* play) { Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 0.3f); if (this->unk_272 == 0) { @@ -325,7 +325,7 @@ void func_80AE561C(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE5688(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5688(EnReeba* this, PlayState* play) { this->unk_27E = 0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actor.flags |= ACTOR_FLAG_27; @@ -333,15 +333,15 @@ void func_80AE5688(EnReeba* this, GlobalContext* globalCtx) { this->actionfunc = func_80AE56E0; } -void func_80AE56E0(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE56E0(EnReeba* this, PlayState* play) { Math_ApproachZeroF(&this->actor.shape.shadowScale, 1.0f, 0.3f); Math_ApproachZeroF(&this->actor.speedXZ, 0.1f, 0.3f); SkelAnime_Update(&this->skelanime); if ((this->unk_284 + 10.0f) <= this->actor.shape.yOffset) { - if ((globalCtx->gameplayFrames % 4) == 0) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, - 8.0f, 500, 10, true); + if ((play->gameplayFrames % 4) == 0) { + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 8.0f, + 500, 10, true); } Math_ApproachF(&this->actor.shape.yOffset, this->unk_284, 1.0f, this->unk_288); @@ -351,7 +351,7 @@ void func_80AE56E0(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE57F0(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE57F0(EnReeba* this, PlayState* play) { this->unk_276 = 14; this->actor.speedXZ = -8.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -359,7 +359,7 @@ void func_80AE57F0(EnReeba* this, GlobalContext* globalCtx) { this->actionfunc = func_80AE5854; } -void func_80AE5854(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5854(EnReeba* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actor.speedXZ < 0.0f) { @@ -376,7 +376,7 @@ void func_80AE5854(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE58EC(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE58EC(EnReeba* this, PlayState* play) { this->unk_278 = 14; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.speedXZ = -8.0f; @@ -385,7 +385,7 @@ void func_80AE58EC(EnReeba* this, GlobalContext* globalCtx) { this->actionfunc = func_80AE5938; } -void func_80AE5938(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5938(EnReeba* this, PlayState* play) { Vec3f pos; f32 scale; @@ -407,7 +407,7 @@ void func_80AE5938(EnReeba* this, GlobalContext* globalCtx) { scale = 6.0f; } - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, scale); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, scale); } this->unk_278 = 66; @@ -419,7 +419,7 @@ void func_80AE5938(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE5A9C(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5A9C(EnReeba* this, PlayState* play) { Vec3f pos; f32 scale; @@ -434,16 +434,16 @@ void func_80AE5A9C(EnReeba* this, GlobalContext* globalCtx) { scale = 6.0f; } - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, scale); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, scale); } } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actionfunc = func_80AE5C38; } } -void func_80AE5BC4(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5BC4(EnReeba* this, PlayState* play) { this->actor.speedXZ = -8.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); @@ -452,7 +452,7 @@ void func_80AE5BC4(EnReeba* this, GlobalContext* globalCtx) { this->actionfunc = func_80AE5C38; } -void func_80AE5C38(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5C38(EnReeba* this, PlayState* play) { Vec3f pos; Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -472,12 +472,12 @@ void func_80AE5C38(EnReeba* this, GlobalContext* globalCtx) { velocity.y = 4.0f; - EffectSsDeadDb_Spawn(globalCtx, &pos, &velocity, &accel, 120, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &velocity, &accel, 120, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); if (!this->isBig) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &pos, 0xE0); } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &pos, 0xC0); + Item_DropCollectibleRandom(play, &this->actor, &pos, 0xC0); } if (this->actor.parent != NULL) { @@ -499,7 +499,7 @@ void func_80AE5C38(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE5E48(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5E48(EnReeba* this, PlayState* play) { if (this->unk_278 < 37) { this->actor.shape.rot.x = Rand_CenteredFloat(3000.0f); this->actor.shape.rot.z = Rand_CenteredFloat(3000.0f); @@ -514,7 +514,7 @@ void func_80AE5E48(EnReeba* this, GlobalContext* globalCtx) { } } -void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) { +void func_80AE5EDC(EnReeba* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; @@ -545,7 +545,7 @@ void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) { Actor_ApplyDamage(&this->actor); if (this->actor.colChkInfo.health == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actionfunc = func_80AE5BC4; } else { if (this->actionfunc == func_80AE5E48) { @@ -574,13 +574,13 @@ void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) { } } -void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnReeba_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnReeba* this = (EnReeba*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_80AE5EDC(this, globalCtx); - this->actionfunc(this, globalCtx); + func_80AE5EDC(this, play); + this->actionfunc(this, play); Actor_SetScale(&this->actor, this->scale); if (this->unk_270 != 0) { @@ -604,7 +604,7 @@ void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx2) { } Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 35.0f, 60.0f, 60.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); @@ -639,25 +639,25 @@ void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((this->actor.shape.yOffset >= -700.0f) && (this->actor.colChkInfo.health > 0) && (this->actionfunc != func_80AE56E0)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (!(this->actor.shape.yOffset < 0.0f)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if ((this->actionfunc == func_80AE5270) || (this->actionfunc == func_80AE53AC)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } } -void EnReeba_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnReeba_Draw(Actor* thisx, PlayState* play) { s32 pad; EnReeba* this = (EnReeba*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_reeba.c", 1062); + OPEN_DISPS(play->state.gfxCtx, "../z_en_reeba.c", 1062); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->isBig) { gDPSetPrimColor(POLY_OPA_DISP++, 0x0, 0x01, 155, 55, 255, 255); @@ -665,9 +665,9 @@ void EnReeba_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0x0, 0x01, 255, 255, 255, 255); } - SkelAnime_DrawOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, NULL, NULL, this); + SkelAnime_DrawOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, NULL, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_reeba.c", 1088); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_reeba.c", 1088); if (BREG(0)) { Vec3f debugPos; @@ -676,6 +676,6 @@ void EnReeba_Draw(Actor* thisx, GlobalContext* globalCtx) { debugPos.y = this->actor.world.pos.y + 20.0f; debugPos.z = (Math_CosS(this->actor.world.rot.y) * 30.0f) + this->actor.world.pos.z; DebugDisplay_AddObject(debugPos.x, debugPos.y, debugPos.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, globalCtx->state.gfxCtx); + this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h index 397ff92f61..61ff9666c3 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h @@ -6,7 +6,7 @@ struct EnReeba; -typedef void (*EnReebaActionFunc)(struct EnReeba*, GlobalContext*); +typedef void (*EnReebaActionFunc)(struct EnReeba*, PlayState*); typedef struct EnReeba { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index d7e35c2647..302e2f6d99 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -8,10 +8,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnRiverSound_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRiverSound_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRiverSound_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRiverSound_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRiverSound_Init(Actor* thisx, PlayState* play); +void EnRiverSound_Destroy(Actor* thisx, PlayState* play); +void EnRiverSound_Update(Actor* thisx, PlayState* play); +void EnRiverSound_Draw(Actor* thisx, PlayState* play); const ActorInit En_River_Sound_InitVars = { ACTOR_EN_RIVER_SOUND, @@ -25,7 +25,7 @@ const ActorInit En_River_Sound_InitVars = { (ActorFunc)EnRiverSound_Draw, }; -void EnRiverSound_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRiverSound_Init(Actor* thisx, PlayState* play) { EnRiverSound* this = (EnRiverSound*)thisx; this->playSound = false; @@ -46,7 +46,7 @@ void EnRiverSound_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnRiverSound_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRiverSound_Destroy(Actor* thisx, PlayState* play) { EnRiverSound* this = (EnRiverSound*)thisx; if (this->actor.params == RS_LOST_WOODS_SARIAS_SONG) { @@ -191,23 +191,22 @@ s32 EnRiverSound_GetSoundPos(Vec3s* points, s32 numPoints, Vec3f* hearPos, Vec3f return true; } -void EnRiverSound_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRiverSound_Update(Actor* thisx, PlayState* play) { Path* path; Vec3f* pos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnRiverSound* this = (EnRiverSound*)thisx; s32 bgId; if ((thisx->params == RS_RIVER_DEFAULT_LOW_FREQ) || (thisx->params == RS_RIVER_DEFAULT_MEDIUM_FREQ) || (thisx->params == RS_RIVER_DEFAULT_HIGH_FREQ)) { - path = &globalCtx->setupPathList[this->pathIndex]; + path = &play->setupPathList[this->pathIndex]; pos = &thisx->world.pos; if (EnRiverSound_GetSoundPos(SEGMENTED_TO_VIRTUAL(path->points), path->count, &player->actor.world.pos, pos)) { - if (BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &thisx->floorPoly, &bgId, thisx, pos) != - BGCHECK_Y_MIN) { + if (BgCheck_EntityRaycastFloor4(&play->colCtx, &thisx->floorPoly, &bgId, thisx, pos) != BGCHECK_Y_MIN) { // Get the river sfx frequency based on the speed of the river current under the actor - this->soundFreqIndex = SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, thisx->floorPoly, bgId); + this->soundFreqIndex = SurfaceType_GetConveyorSpeed(&play->colCtx, thisx->floorPoly, bgId); } else { this->soundFreqIndex = 0; } @@ -228,12 +227,12 @@ void EnRiverSound_Update(Actor* thisx, GlobalContext* globalCtx) { } } else if ((thisx->params == RS_GORON_CITY_SARIAS_SONG) || (thisx->params == RS_GREAT_FAIRY)) { func_8002DBD0(&player->actor, &thisx->home.pos, &thisx->world.pos); - } else if (globalCtx->sceneNum == SCENE_DDAN_BOSS && Flags_GetClear(globalCtx, thisx->room)) { + } else if (play->sceneNum == SCENE_DDAN_BOSS && Flags_GetClear(play, thisx->room)) { Actor_Kill(thisx); } } -void EnRiverSound_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRiverSound_Draw(Actor* thisx, PlayState* play) { static s16 soundEffects[] = { 0, NA_SE_EV_WATER_WALL - SFX_FLAG, diff --git a/src/overlays/actors/ovl_En_Rl/z_en_rl.c b/src/overlays/actors/ovl_En_Rl/z_en_rl.c index cc79ff97fd..6938437ed2 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -10,29 +10,29 @@ #define FLAGS ACTOR_FLAG_4 -void EnRl_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRl_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRl_Init(Actor* thisx, PlayState* play); +void EnRl_Destroy(Actor* thisx, PlayState* play); +void EnRl_Update(Actor* thisx, PlayState* play); +void EnRl_Draw(Actor* thisx, PlayState* play); -void func_80AE7798(EnRl* this, GlobalContext* globalCtx); -void func_80AE77B8(EnRl* this, GlobalContext* globalCtx); -void func_80AE77F8(EnRl* this, GlobalContext* globalCtx); -void func_80AE7838(EnRl* this, GlobalContext* globalCtx); -void func_80AE7C64(EnRl* this, GlobalContext* globalCtx); -void func_80AE7C94(EnRl* this, GlobalContext* globalCtx); -void func_80AE7CE8(EnRl* this, GlobalContext* globalCtx); -void func_80AE7D40(EnRl* this, GlobalContext* globalCtx); -void func_80AE7FD0(EnRl* this, GlobalContext* globalCtx); -void func_80AE7FDC(EnRl* this, GlobalContext* globalCtx); -void func_80AE7D94(EnRl* this, GlobalContext* globalCtx); +void func_80AE7798(EnRl* this, PlayState* play); +void func_80AE77B8(EnRl* this, PlayState* play); +void func_80AE77F8(EnRl* this, PlayState* play); +void func_80AE7838(EnRl* this, PlayState* play); +void func_80AE7C64(EnRl* this, PlayState* play); +void func_80AE7C94(EnRl* this, PlayState* play); +void func_80AE7CE8(EnRl* this, PlayState* play); +void func_80AE7D40(EnRl* this, PlayState* play); +void func_80AE7FD0(EnRl* this, PlayState* play); +void func_80AE7FDC(EnRl* this, PlayState* play); +void func_80AE7D94(EnRl* this, PlayState* play); static void* D_80AE81A0[] = { object_rl_Tex_003620, object_rl_Tex_003960, object_rl_Tex_003B60 }; -void EnRl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRl_Destroy(Actor* thisx, PlayState* play) { EnRl* this = (EnRl*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } void func_80AE72D0(EnRl* this) { @@ -61,10 +61,10 @@ void func_80AE7358(EnRl* this) { this->unk_19C = 0.0f; } -void func_80AE73D8(EnRl* this, GlobalContext* globalCtx) { +void func_80AE73D8(EnRl* this, PlayState* play) { static s32 D_80AE81AC = 0; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (D_80AE81AC) { if (this->actor.params == 2) { func_80AE7358(this); @@ -76,20 +76,19 @@ void func_80AE73D8(EnRl* this, GlobalContext* globalCtx) { } } -void func_80AE744C(EnRl* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); +void func_80AE744C(EnRl* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } s32 func_80AE7494(EnRl* this) { return SkelAnime_Update(&this->skelAnime); } -s32 func_80AE74B4(EnRl* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { +s32 func_80AE74B4(EnRl* this, PlayState* play, u16 arg2, s32 arg3) { CsCmdActorAction* csCmdActorAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdActorAction = globalCtx->csCtx.npcActions[arg3]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdActorAction = play->csCtx.npcActions[arg3]; if (csCmdActorAction != NULL && csCmdActorAction->action == arg2) { return 1; } @@ -97,11 +96,11 @@ s32 func_80AE74B4(EnRl* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { return 0; } -s32 func_80AE74FC(EnRl* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { +s32 func_80AE74FC(EnRl* this, PlayState* play, u16 arg2, s32 arg3) { CsCmdActorAction* csCmdActorAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdActorAction = globalCtx->csCtx.npcActions[arg3]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdActorAction = play->csCtx.npcActions[arg3]; if (csCmdActorAction != NULL && csCmdActorAction->action != arg2) { return 1; } @@ -109,42 +108,41 @@ s32 func_80AE74FC(EnRl* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) { return 0; } -void func_80AE7544(EnRl* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_rl_Skel_007B38, &object_rl_Anim_000A3C, NULL, NULL, 0); +void func_80AE7544(EnRl* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_rl_Skel_007B38, &object_rl_Anim_000A3C, NULL, NULL, 0); } -void func_80AE7590(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7590(EnRl* this, PlayState* play) { s32 pad; Player* player; Vec3f pos; - s16 sceneNum = globalCtx->sceneNum; + s16 sceneNum = play->sceneNum; - if (gSaveContext.sceneSetupIndex == 4 && sceneNum == SCENE_KENJYANOMA && globalCtx->csCtx.state != CS_STATE_IDLE && - globalCtx->csCtx.npcActions[6] != NULL && globalCtx->csCtx.npcActions[6]->action == 2 && - !this->lightMedallionGiven) { - player = GET_PLAYER(globalCtx); + if (gSaveContext.sceneSetupIndex == 4 && sceneNum == SCENE_KENJYANOMA && play->csCtx.state != CS_STATE_IDLE && + play->csCtx.npcActions[6] != NULL && play->csCtx.npcActions[6]->action == 2 && !this->lightMedallionGiven) { + player = GET_PLAYER(play); pos.x = player->actor.world.pos.x; pos.y = player->actor.world.pos.y + 80.0f; pos.z = player->actor.world.pos.z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, pos.x, pos.y, pos.z, 0, 0, 0, 0xE); - Item_Give(globalCtx, ITEM_MEDALLION_LIGHT); + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, pos.x, pos.y, pos.z, 0, 0, 0, 0xE); + Item_Give(play, ITEM_MEDALLION_LIGHT); this->lightMedallionGiven = 1; } } -void func_80AE7668(EnRl* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AE7668(EnRl* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->drawConfig = 1; this->action = 1; player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; } -void func_80AE7698(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7698(EnRl* this, PlayState* play) { CsCmdActorAction* csCmdActorAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdActorAction = globalCtx->csCtx.npcActions[0]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdActorAction = play->csCtx.npcActions[0]; if (csCmdActorAction != NULL && csCmdActorAction->action == 3) { Animation_Change(&this->skelAnime, &object_rl_Anim_00040C, 1.0f, 0.0f, Animation_GetLastFrame(&object_rl_Anim_00040C), ANIMMODE_ONCE, 0.0f); @@ -161,46 +159,46 @@ void func_80AE772C(EnRl* this, s32 arg1) { } } -void func_80AE7798(EnRl* this, GlobalContext* globalCtx) { - func_80AE7668(this, globalCtx); +void func_80AE7798(EnRl* this, PlayState* play) { + func_80AE7668(this, play); } -void func_80AE77B8(EnRl* this, GlobalContext* globalCtx) { - func_80AE744C(this, globalCtx); +void func_80AE77B8(EnRl* this, PlayState* play) { + func_80AE744C(this, play); func_80AE7494(this); func_80AE72D0(this); - func_80AE7698(this, globalCtx); + func_80AE7698(this, play); } -void func_80AE77F8(EnRl* this, GlobalContext* globalCtx) { +void func_80AE77F8(EnRl* this, PlayState* play) { s32 temp; - func_80AE744C(this, globalCtx); + func_80AE744C(this, play); temp = func_80AE7494(this); func_80AE72D0(this); func_80AE772C(this, temp); } -void func_80AE7838(EnRl* this, GlobalContext* globalCtx) { - func_80AE744C(this, globalCtx); +void func_80AE7838(EnRl* this, PlayState* play) { + func_80AE744C(this, play); func_80AE7494(this); func_80AE72D0(this); - func_80AE7590(this, globalCtx); + func_80AE7590(this, play); } -void func_80AE7878(EnRl* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_rl_Skel_007B38, &object_rl_Anim_000A3C, NULL, NULL, 0); +void func_80AE7878(EnRl* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_rl_Skel_007B38, &object_rl_Anim_000A3C, NULL, NULL, 0); this->action = 4; this->actor.shape.shadowAlpha = 0; } -void func_80AE78D4(EnRl* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void func_80AE78D4(EnRl* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, kREG(18) + 22.0f + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 5); } -void func_80AE7954(EnRl* this, GlobalContext* globalCtx) { - if (func_80AE74B4(this, globalCtx, 4, 0)) { +void func_80AE7954(EnRl* this, PlayState* play) { + if (func_80AE74B4(this, play, 4, 0)) { this->action = 5; this->drawConfig = 2; this->alpha = 0; @@ -209,11 +207,11 @@ void func_80AE7954(EnRl* this, GlobalContext* globalCtx) { } } -void func_80AE79A4(EnRl* this, GlobalContext* globalCtx) { +void func_80AE79A4(EnRl* this, PlayState* play) { f32* unk_19C = &this->unk_19C; s32 alpha = 255; - if (func_80AE74B4(this, globalCtx, 4, 0)) { + if (func_80AE74B4(this, play, 4, 0)) { *unk_19C += 1.0f; if (*unk_19C >= kREG(5) + 10.0f) { this->action = 7; @@ -239,18 +237,18 @@ void func_80AE79A4(EnRl* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = alpha; } -void func_80AE7AF8(EnRl* this, GlobalContext* globalCtx) { - if (func_80AE74B4(this, globalCtx, 3, 0)) { +void func_80AE7AF8(EnRl* this, PlayState* play) { + if (func_80AE74B4(this, play, 3, 0)) { Animation_Change(&this->skelAnime, &object_rl_Anim_00040C, 1.0f, 0.0f, Animation_GetLastFrame(&object_rl_Anim_00040C), ANIMMODE_ONCE, -8.0f); this->action = 6; - } else if (func_80AE74FC(this, globalCtx, 4, 0)) { + } else if (func_80AE74FC(this, play, 4, 0)) { this->action = 5; this->drawConfig = 2; this->unk_19C = kREG(5) + 10.0f; this->alpha = 255; if (!this->lightBallSpawned) { - func_80AE78D4(this, globalCtx); + func_80AE78D4(this, play); this->lightBallSpawned = 1; } this->actor.shape.shadowAlpha = 0xFF; @@ -265,56 +263,56 @@ void func_80AE7BF8(EnRl* this, s32 arg1) { } } -void func_80AE7C64(EnRl* this, GlobalContext* globalCtx) { - func_80AE7954(this, globalCtx); - func_80AE73D8(this, globalCtx); +void func_80AE7C64(EnRl* this, PlayState* play) { + func_80AE7954(this, play); + func_80AE73D8(this, play); } -void func_80AE7C94(EnRl* this, GlobalContext* globalCtx) { - func_80AE744C(this, globalCtx); +void func_80AE7C94(EnRl* this, PlayState* play) { + func_80AE744C(this, play); func_80AE7494(this); func_80AE72D0(this); - func_80AE79A4(this, globalCtx); - func_80AE73D8(this, globalCtx); + func_80AE79A4(this, play); + func_80AE73D8(this, play); } -void func_80AE7CE8(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7CE8(EnRl* this, PlayState* play) { s32 temp; - func_80AE744C(this, globalCtx); + func_80AE744C(this, play); temp = func_80AE7494(this); func_80AE72D0(this); func_80AE7BF8(this, temp); - func_80AE73D8(this, globalCtx); + func_80AE73D8(this, play); } -void func_80AE7D40(EnRl* this, GlobalContext* globalCtx) { - func_80AE744C(this, globalCtx); +void func_80AE7D40(EnRl* this, PlayState* play) { + func_80AE744C(this, play); func_80AE7494(this); func_80AE72D0(this); - func_80AE7AF8(this, globalCtx); - func_80AE73D8(this, globalCtx); + func_80AE7AF8(this, play); + func_80AE73D8(this, play); } -void func_80AE7D94(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7D94(EnRl* this, PlayState* play) { s32 pad[2]; s16 temp = this->eyeTextureIndex; void* tex = D_80AE81A0[temp]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_rl_inKenjyanomaDemo02.c", 304); + OPEN_DISPS(play->state.gfxCtx, "../z_en_rl_inKenjyanomaDemo02.c", 304); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(tex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(tex)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, - NULL, NULL, NULL, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, + NULL, NULL, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_rl_inKenjyanomaDemo02.c", 331); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_rl_inKenjyanomaDemo02.c", 331); } static EnRlActionFunc sActionFuncs[] = { @@ -322,47 +320,47 @@ static EnRlActionFunc sActionFuncs[] = { func_80AE7C64, func_80AE7C94, func_80AE7CE8, func_80AE7D40, }; -void EnRl_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRl_Update(Actor* thisx, PlayState* play) { EnRl* this = (EnRl*)thisx; if ((this->action < 0) || (this->action > 7) || (sActionFuncs[this->action] == NULL)) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnRl_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRl_Init(Actor* thisx, PlayState* play) { EnRl* this = (EnRl*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); if (this->actor.params == 2) { - func_80AE7878(this, globalCtx); + func_80AE7878(this, play); } else { - func_80AE7544(this, globalCtx); + func_80AE7544(this, play); } } -void func_80AE7FD0(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7FD0(EnRl* this, PlayState* play) { } -void func_80AE7FDC(EnRl* this, GlobalContext* globalCtx) { +void func_80AE7FDC(EnRl* this, PlayState* play) { s32 pad[2]; s16 temp = this->eyeTextureIndex; void* tex = D_80AE81A0[temp]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_rl.c", 416); + OPEN_DISPS(play->state.gfxCtx, "../z_en_rl.c", 416); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(tex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(tex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_rl.c", 437); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_rl.c", 437); } static EnRlDrawFunc sDrawFuncs[] = { @@ -371,14 +369,14 @@ static EnRlDrawFunc sDrawFuncs[] = { func_80AE7D94, }; -void EnRl_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRl_Draw(Actor* thisx, PlayState* play) { EnRl* this = (EnRl*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } const ActorInit En_Rl_InitVars = { diff --git a/src/overlays/actors/ovl_En_Rl/z_en_rl.h b/src/overlays/actors/ovl_En_Rl/z_en_rl.h index 84a698dcda..9aa6b9ae6c 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.h +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.h @@ -6,8 +6,8 @@ struct EnRl; -typedef void (*EnRlActionFunc)(struct EnRl*, GlobalContext*); -typedef void (*EnRlDrawFunc)(struct EnRl*, GlobalContext*); +typedef void (*EnRlActionFunc)(struct EnRl*, PlayState*); +typedef void (*EnRlDrawFunc)(struct EnRl*, PlayState*); typedef struct EnRl { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index ab2b2fe397..9274bbd175 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -46,23 +46,23 @@ typedef enum { /* 5 */ RR_DROP_RUPEE_RED } EnRrDropType; -void EnRr_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRr_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRr_Init(Actor* thisx, PlayState* play); +void EnRr_Destroy(Actor* thisx, PlayState* play); +void EnRr_Update(Actor* thisx, PlayState* play); +void EnRr_Draw(Actor* thisx, PlayState* play); -void EnRr_InitBodySegments(EnRr* this, GlobalContext* globalCtx); +void EnRr_InitBodySegments(EnRr* this, PlayState* play); void EnRr_SetupDamage(EnRr* this); void EnRr_SetupDeath(EnRr* this); -void EnRr_Approach(EnRr* this, GlobalContext* globalCtx); -void EnRr_Reach(EnRr* this, GlobalContext* globalCtx); -void EnRr_GrabPlayer(EnRr* this, GlobalContext* globalCtx); -void EnRr_Damage(EnRr* this, GlobalContext* globalCtx); -void EnRr_Death(EnRr* this, GlobalContext* globalCtx); -void EnRr_Retreat(EnRr* this, GlobalContext* globalCtx); -void EnRr_Stunned(EnRr* this, GlobalContext* globalCtx); +void EnRr_Approach(EnRr* this, PlayState* play); +void EnRr_Reach(EnRr* this, PlayState* play); +void EnRr_GrabPlayer(EnRr* this, PlayState* play); +void EnRr_Damage(EnRr* this, PlayState* play); +void EnRr_Death(EnRr* this, PlayState* play); +void EnRr_Retreat(EnRr* this, PlayState* play); +void EnRr_Stunned(EnRr* this, PlayState* play); const ActorInit En_Rr_InitVars = { ACTOR_EN_RR, @@ -160,18 +160,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void EnRr_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnRr_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnRr* this = (EnRr*)thisx; s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 4; - Collider_InitCylinder(globalCtx, &this->collider1); - Collider_SetCylinderType1(globalCtx, &this->collider1, &this->actor, &sCylinderInit1); - Collider_InitCylinder(globalCtx, &this->collider2); - Collider_SetCylinderType1(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); + Collider_InitCylinder(play, &this->collider1); + Collider_SetCylinderType1(play, &this->collider1, &this->actor, &sCylinderInit1); + Collider_InitCylinder(play, &this->collider2); + Collider_SetCylinderType1(play, &this->collider2, &this->actor, &sCylinderInit2); Actor_SetFocus(&this->actor, 30.0f); this->actor.scale.y = 0.013f; this->actor.scale.x = this->actor.scale.z = 0.014f; @@ -194,15 +194,15 @@ void EnRr_Init(Actor* thisx, GlobalContext* globalCtx2) { this->bodySegs[i].height = this->bodySegs[i].heightTarget = this->bodySegs[i].scaleMod.x = this->bodySegs[i].scaleMod.y = this->bodySegs[i].scaleMod.z = 0.0f; } - EnRr_InitBodySegments(this, globalCtx); + EnRr_InitBodySegments(this, play); } -void EnRr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRr_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnRr* this = (EnRr*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); } void EnRr_SetSpeed(EnRr* this, f32 speed) { @@ -282,8 +282,8 @@ u8 EnRr_GetMessage(u8 shield, u8 tunic) { return messageIndex; } -void EnRr_SetupReleasePlayer(EnRr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRr_SetupReleasePlayer(EnRr* this, PlayState* play) { + Player* player = GET_PLAYER(play); u8 shield; u8 tunic; @@ -296,14 +296,14 @@ void EnRr_SetupReleasePlayer(EnRr* this, GlobalContext* globalCtx) { tunic = 0; shield = 0; if (CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) != EQUIP_VALUE_SHIELD_MIRROR) { - shield = Inventory_DeleteEquipment(globalCtx, EQUIP_TYPE_SHIELD); + shield = Inventory_DeleteEquipment(play, EQUIP_TYPE_SHIELD); if (shield != 0) { this->eatenShield = shield; this->retreat = true; } } if (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) != EQUIP_VALUE_TUNIC_KOKIRI) { - tunic = Inventory_DeleteEquipment(globalCtx, EQUIP_TYPE_TUNIC); + tunic = Inventory_DeleteEquipment(play, EQUIP_TYPE_TUNIC); if (tunic != 0) { this->eatenTunic = tunic; this->retreat = true; @@ -312,17 +312,17 @@ void EnRr_SetupReleasePlayer(EnRr* this, GlobalContext* globalCtx) { player->actor.parent = NULL; switch (EnRr_GetMessage(shield, tunic)) { case RR_MESSAGE_SHIELD: - Message_StartTextbox(globalCtx, 0x305F, NULL); + Message_StartTextbox(play, 0x305F, NULL); break; case RR_MESSAGE_TUNIC: - Message_StartTextbox(globalCtx, 0x3060, NULL); + Message_StartTextbox(play, 0x3060, NULL); break; case RR_MESSAGE_TUNIC | RR_MESSAGE_SHIELD: - Message_StartTextbox(globalCtx, 0x3061, NULL); + Message_StartTextbox(play, 0x3061, NULL); break; } osSyncPrintf(VT_FGCOL(YELLOW) "%s[%d] : Rr_Catch_Cancel" VT_RST "\n", "../z_en_rr.c", 650); - func_8002F6D4(globalCtx, &this->actor, 4.0f, this->actor.shape.rot.y, 12.0f, 8); + func_8002F6D4(play, &this->actor, 4.0f, this->actor.shape.rot.y, 12.0f, 8); if (this->actor.colorFilterTimer == 0) { this->actionFunc = EnRr_Approach; Audio_PlayActorSound2(&this->actor, NA_SE_EN_LIKE_THROW); @@ -409,9 +409,9 @@ void EnRr_SetupStunned(EnRr* this) { this->actionFunc = EnRr_Stunned; } -void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { +void EnRr_CollisionCheck(EnRr* this, PlayState* play) { Vec3f hitPos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->collider2.base.acFlags & AC_HIT) { this->collider2.base.acFlags &= ~AC_HIT; @@ -420,7 +420,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { hitPos.x = this->collider2.info.bumper.hitPos.x; hitPos.y = this->collider2.info.bumper.hitPos.y; hitPos.z = this->collider2.info.bumper.hitPos.z; - CollisionCheck_SpawnShieldParticlesMetal2(globalCtx, &hitPos); + CollisionCheck_SpawnShieldParticlesMetal2(play, &hitPos); } else { if (this->collider1.base.acFlags & AC_HIT) { u8 dropType = RR_DROP_RANDOM_RUPEE; @@ -430,7 +430,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { hitPos.x = this->collider1.info.bumper.hitPos.x; hitPos.y = this->collider1.info.bumper.hitPos.y; hitPos.z = this->collider1.info.bumper.hitPos.z; - CollisionCheck_BlueBlood(globalCtx, NULL, &hitPos); + CollisionCheck_BlueBlood(play, NULL, &hitPos); } switch (this->actor.colChkInfo.damageEffect) { case RR_DMG_LIGHT_ARROW: @@ -451,7 +451,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { this->invincibilityTimer = 40; Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, this->invincibilityTimer); if (this->hasPlayer) { - EnRr_SetupReleasePlayer(this, globalCtx); + EnRr_SetupReleasePlayer(this, play); } else if (this->actor.colChkInfo.health != 0) { EnRr_SetupDamage(this); } else { @@ -501,7 +501,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { this->collider2.base.ocFlags1 &= ~OC1_HIT; // "catch" osSyncPrintf(VT_FGCOL(GREEN) "キャッチ(%d)!!" VT_RST "\n", this->frameCount); - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; this->stopScroll = false; EnRr_SetupGrabPlayer(this, player); @@ -510,7 +510,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_InitBodySegments(EnRr* this, GlobalContext* globalCtx) { +void EnRr_InitBodySegments(EnRr* this, PlayState* play) { s32 i; this->segMovePhase = 0; @@ -543,7 +543,7 @@ void EnRr_InitBodySegments(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_UpdateBodySegments(EnRr* this, GlobalContext* globalCtx) { +void EnRr_UpdateBodySegments(EnRr* this, PlayState* play) { s32 i; s16 phase = this->segMovePhase; @@ -567,7 +567,7 @@ void EnRr_UpdateBodySegments(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Approach(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Approach(EnRr* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x1F4, 0); this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actionTimer == 0) && (this->actor.xzDistToPlayer < 160.0f)) { @@ -577,7 +577,7 @@ void EnRr_Approach(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Reach(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Reach(EnRr* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x1F4, 0); this->actor.world.rot.y = this->actor.shape.rot.y; switch (this->reachState) { @@ -615,8 +615,8 @@ void EnRr_Reach(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_GrabPlayer(EnRr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRr_GrabPlayer(EnRr* this, PlayState* play) { + Player* player = GET_PLAYER(play); func_800AA000(this->actor.xyzDistToPlayerSq, 120, 2, 120); if ((this->frameCount % 8) == 0) { @@ -624,7 +624,7 @@ void EnRr_GrabPlayer(EnRr* this, GlobalContext* globalCtx) { } this->ocTimer = 8; if ((this->grabTimer == 0) || !(player->stateFlags2 & PLAYER_STATE2_7)) { - EnRr_SetupReleasePlayer(this, globalCtx); + EnRr_SetupReleasePlayer(this, play); } else { Math_ApproachF(&player->actor.world.pos.x, this->mouthPos.x, 1.0f, 30.0f); Math_ApproachF(&player->actor.world.pos.y, this->mouthPos.y + this->swallowOffset, 1.0f, 30.0f); @@ -633,7 +633,7 @@ void EnRr_GrabPlayer(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Damage(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Damage(EnRr* this, PlayState* play) { s32 i; if (this->actor.colorFilterTimer == 0) { @@ -649,7 +649,7 @@ void EnRr_Damage(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Death(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Death(EnRr* this, PlayState* play) { s32 pad; s32 i; @@ -667,41 +667,41 @@ void EnRr_Death(EnRr* this, GlobalContext* globalCtx) { dropPos.z = this->actor.world.pos.z; switch (this->eatenShield) { case 1: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_SHIELD_DEKU); + Item_DropCollectible(play, &dropPos, ITEM00_SHIELD_DEKU); break; case 2: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_SHIELD_HYLIAN); + Item_DropCollectible(play, &dropPos, ITEM00_SHIELD_HYLIAN); break; } switch (this->eatenTunic) { case 2: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_TUNIC_GORON); + Item_DropCollectible(play, &dropPos, ITEM00_TUNIC_GORON); break; case 3: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_TUNIC_ZORA); + Item_DropCollectible(play, &dropPos, ITEM00_TUNIC_ZORA); break; } // "dropped" osSyncPrintf(VT_FGCOL(GREEN) "「%s」が出た!!" VT_RST "\n", sDropNames[this->dropType]); switch (this->dropType) { case RR_DROP_MAGIC: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_MAGIC_SMALL); + Item_DropCollectible(play, &dropPos, ITEM00_MAGIC_SMALL); break; case RR_DROP_ARROW: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_ARROWS_SINGLE); + Item_DropCollectible(play, &dropPos, ITEM00_ARROWS_SINGLE); break; case RR_DROP_FLEXIBLE: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_FLEXIBLE); + Item_DropCollectible(play, &dropPos, ITEM00_FLEXIBLE); break; case RR_DROP_RUPEE_PURPLE: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_RUPEE_PURPLE); + Item_DropCollectible(play, &dropPos, ITEM00_RUPEE_PURPLE); break; case RR_DROP_RUPEE_RED: - Item_DropCollectible(globalCtx, &dropPos, ITEM00_RUPEE_RED); + Item_DropCollectible(play, &dropPos, ITEM00_RUPEE_RED); break; case RR_DROP_RANDOM_RUPEE: default: - Item_DropCollectibleRandom(globalCtx, &this->actor, &dropPos, 12 << 4); + Item_DropCollectibleRandom(play, &this->actor, &dropPos, 12 << 4); break; } Actor_Kill(&this->actor); @@ -720,7 +720,7 @@ void EnRr_Death(EnRr* this, GlobalContext* globalCtx) { accel.y = 0.0f; accel.z = 0.0f; - EffectSsDeadDb_Spawn(globalCtx, &pos, &vel, &accel, 100, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); + EffectSsDeadDb_Spawn(play, &pos, &vel, &accel, 100, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); } else { Math_ApproachF(&this->actor.scale.x, 0.0f, 1.0f, this->shrinkRate); Math_ApproachF(&this->shrinkRate, 0.001f, 1.0f, 0.00001f); @@ -728,7 +728,7 @@ void EnRr_Death(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Retreat(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Retreat(EnRr* this, PlayState* play) { if (this->actionTimer == 0) { this->retreat = false; this->actionFunc = EnRr_Approach; @@ -741,11 +741,11 @@ void EnRr_Retreat(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Stunned(EnRr* this, GlobalContext* globalCtx) { +void EnRr_Stunned(EnRr* this, PlayState* play) { if (this->actor.colorFilterTimer == 0) { this->stopScroll = false; if (this->hasPlayer) { - EnRr_SetupReleasePlayer(this, globalCtx); + EnRr_SetupReleasePlayer(this, play); } else if (this->actor.colChkInfo.health != 0) { this->actionFunc = EnRr_Approach; } else { @@ -754,7 +754,7 @@ void EnRr_Stunned(EnRr* this, GlobalContext* globalCtx) { } } -void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRr_Update(Actor* thisx, PlayState* play) { s32 pad; EnRr* this = (EnRr*)thisx; s32 i; @@ -780,12 +780,12 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, 30.0f); - EnRr_UpdateBodySegments(this, globalCtx); + EnRr_UpdateBodySegments(this, play); if (!this->isDead && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { - EnRr_CollisionCheck(this, globalCtx); + EnRr_CollisionCheck(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->hasPlayer == 0x3F80) { // checks if 1.0f has been stored to hasPlayer's address ASSERT(0, "0", "../z_en_rr.c", 1355); } @@ -797,19 +797,19 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider2.dim.pos.y = this->mouthPos.y; this->collider2.dim.pos.z = this->mouthPos.z; if (!this->isDead && (this->invincibilityTimer == 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); if (this->ocTimer == 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } else { this->collider2.base.ocFlags1 &= ~OC1_HIT; this->collider2.base.acFlags &= ~AC_HIT; this->collider1.base.ocFlags1 &= ~OC1_HIT; this->collider1.base.acFlags &= ~AC_HIT; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 30.0f, 20.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 30.0f, 20.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); if (!this->stopScroll) { Math_ApproachF(&this->segPhaseVel, this->segPhaseVelTarget, 1.0f, 50.0f); @@ -838,27 +838,26 @@ static Vec3f sEffectOffsets[] = { { 0.0f, 0.0f, -25.0f }, }; -void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRr_Draw(Actor* thisx, PlayState* play) { s32 pad; Vec3f zeroVec; EnRr* this = (EnRr*)thisx; s32 i; - Mtx* segMtx = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Mtx)); + Mtx* segMtx = Graph_Alloc(play->state.gfxCtx, 4 * sizeof(Mtx)); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_rr.c", 1478); + OPEN_DISPS(play->state.gfxCtx, "../z_en_rr.c", 1478); if (1) {} - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x0C, segMtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (this->scrollTimer * 0) & 0x7F, - (this->scrollTimer * 0) & 0x3F, 32, 16, 1, (this->scrollTimer * 0) & 0x3F, - (this->scrollTimer * -6) & 0x7F, 32, 16)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (this->scrollTimer * 0) & 0x7F, (this->scrollTimer * 0) & 0x3F, + 32, 16, 1, (this->scrollTimer * 0) & 0x3F, (this->scrollTimer * -6) & 0x7F, 32, 16)); Matrix_Push(); Matrix_Scale((1.0f + this->bodySegs[RR_BASE].scaleMod.x) * this->bodySegs[RR_BASE].scale.x, (1.0f + this->bodySegs[RR_BASE].scaleMod.y) * this->bodySegs[RR_BASE].scale.y, (1.0f + this->bodySegs[RR_BASE].scaleMod.z) * this->bodySegs[RR_BASE].scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_rr.c", 1501), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_rr.c", 1501), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Matrix_Pop(); zeroVec.x = 0.0f; @@ -881,7 +880,7 @@ void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&zeroVec, &this->mouthPos); gSPDisplayList(POLY_XLU_DISP++, gLikeLikeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_rr.c", 1551); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_rr.c", 1551); if (this->effectTimer != 0) { Vec3f effectPos; s16 effectTimer = this->effectTimer - 1; @@ -895,10 +894,9 @@ void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx) { effectPos.y = this->effectPos[segIndex].y + sEffectOffsets[offIndex].y + Rand_CenteredFloat(10.0f); effectPos.z = this->effectPos[segIndex].z + sEffectOffsets[offIndex].z + Rand_CenteredFloat(10.0f); if (this->actor.colorFilterParams & 0x4000) { - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &effectPos, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &effectPos, 100, 0, 0, -1); } else { - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &effectPos, 150, 150, 150, 250, 235, 245, 255, - 3.0f); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &effectPos, 150, 150, 150, 250, 235, 245, 255, 3.0f); } } } diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.h b/src/overlays/actors/ovl_En_Rr/z_en_rr.h index 2991723a46..aa1f782073 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.h +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.h @@ -6,7 +6,7 @@ struct EnRr; -typedef void (*EnRrActionFunc)(struct EnRr*, GlobalContext*); +typedef void (*EnRrActionFunc)(struct EnRr*, PlayState*); typedef struct { /* 0x00 */ f32 height; 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 b317075944..361302804e 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -10,63 +10,63 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_26) -void EnRu1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRu1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRu1_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRu1_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRu1_Init(Actor* thisx, PlayState* play); +void EnRu1_Destroy(Actor* thisx, PlayState* play); +void EnRu1_Update(Actor* thisx, PlayState* play); +void EnRu1_Draw(Actor* thisx, PlayState* play); -void func_80AEC0B4(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC100(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC130(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC17C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC1D4(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC244(EnRu1* this, GlobalContext* globalCtx); -void func_80AEC2C0(EnRu1* this, GlobalContext* globalCtx); -void func_80AECA94(EnRu1* this, GlobalContext* globalCtx); -void func_80AECAB4(EnRu1* this, GlobalContext* globalCtx); -void func_80AECAD4(EnRu1* this, GlobalContext* globalCtx); -void func_80AECB18(EnRu1* this, GlobalContext* globalCtx); -void func_80AECB60(EnRu1* this, GlobalContext* globalCtx); -void func_80AECBB8(EnRu1* this, GlobalContext* globalCtx); -void func_80AECC1C(EnRu1* this, GlobalContext* globalCtx); -void func_80AECC84(EnRu1* this, GlobalContext* globalCtx); -void func_80AED304(EnRu1* this, GlobalContext* globalCtx); -void func_80AED324(EnRu1* this, GlobalContext* globalCtx); -void func_80AED344(EnRu1* this, GlobalContext* globalCtx); -void func_80AED374(EnRu1* this, GlobalContext* globalCtx); -void func_80AED3A4(EnRu1* this, GlobalContext* globalCtx); -void func_80AED3E0(EnRu1* this, GlobalContext* globalCtx); -void func_80AED414(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF29C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF2AC(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF2D0(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF354(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF3A8(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEBD4(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEC5C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEECF0(EnRu1* this, GlobalContext* globalCtx); -void func_80AEED58(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEDCC(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEE34(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEE9C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEF08(EnRu1* this, GlobalContext* globalCtx); -void func_80AEEF5C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEF9D8(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFA2C(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFAAC(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFB04(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFB68(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFCE8(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFBC8(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFC24(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFECC(EnRu1* this, GlobalContext* globalCtx); -void func_80AEFF40(EnRu1* this, GlobalContext* globalCtx); +void func_80AEC0B4(EnRu1* this, PlayState* play); +void func_80AEC100(EnRu1* this, PlayState* play); +void func_80AEC130(EnRu1* this, PlayState* play); +void func_80AEC17C(EnRu1* this, PlayState* play); +void func_80AEC1D4(EnRu1* this, PlayState* play); +void func_80AEC244(EnRu1* this, PlayState* play); +void func_80AEC2C0(EnRu1* this, PlayState* play); +void func_80AECA94(EnRu1* this, PlayState* play); +void func_80AECAB4(EnRu1* this, PlayState* play); +void func_80AECAD4(EnRu1* this, PlayState* play); +void func_80AECB18(EnRu1* this, PlayState* play); +void func_80AECB60(EnRu1* this, PlayState* play); +void func_80AECBB8(EnRu1* this, PlayState* play); +void func_80AECC1C(EnRu1* this, PlayState* play); +void func_80AECC84(EnRu1* this, PlayState* play); +void func_80AED304(EnRu1* this, PlayState* play); +void func_80AED324(EnRu1* this, PlayState* play); +void func_80AED344(EnRu1* this, PlayState* play); +void func_80AED374(EnRu1* this, PlayState* play); +void func_80AED3A4(EnRu1* this, PlayState* play); +void func_80AED3E0(EnRu1* this, PlayState* play); +void func_80AED414(EnRu1* this, PlayState* play); +void func_80AEF29C(EnRu1* this, PlayState* play); +void func_80AEF2AC(EnRu1* this, PlayState* play); +void func_80AEF2D0(EnRu1* this, PlayState* play); +void func_80AEF354(EnRu1* this, PlayState* play); +void func_80AEF3A8(EnRu1* this, PlayState* play); +void func_80AEEBD4(EnRu1* this, PlayState* play); +void func_80AEEC5C(EnRu1* this, PlayState* play); +void func_80AEECF0(EnRu1* this, PlayState* play); +void func_80AEED58(EnRu1* this, PlayState* play); +void func_80AEEDCC(EnRu1* this, PlayState* play); +void func_80AEEE34(EnRu1* this, PlayState* play); +void func_80AEEE9C(EnRu1* this, PlayState* play); +void func_80AEEF08(EnRu1* this, PlayState* play); +void func_80AEEF5C(EnRu1* this, PlayState* play); +void func_80AEF9D8(EnRu1* this, PlayState* play); +void func_80AEFA2C(EnRu1* this, PlayState* play); +void func_80AEFAAC(EnRu1* this, PlayState* play); +void func_80AEFB04(EnRu1* this, PlayState* play); +void func_80AEFB68(EnRu1* this, PlayState* play); +void func_80AEFCE8(EnRu1* this, PlayState* play); +void func_80AEFBC8(EnRu1* this, PlayState* play); +void func_80AEFC24(EnRu1* this, PlayState* play); +void func_80AEFECC(EnRu1* this, PlayState* play); +void func_80AEFF40(EnRu1* this, PlayState* play); -void func_80AF0278(EnRu1* this, GlobalContext* globalCtx, s32 limbIndex, Vec3s* rot); +void func_80AF0278(EnRu1* this, PlayState* play, s32 limbIndex, Vec3s* rot); -void EnRu1_DrawNothing(EnRu1* this, GlobalContext* globalCtx); -void EnRu1_DrawOpa(EnRu1* this, GlobalContext* globalCtx); -void EnRu1_DrawXlu(EnRu1* this, GlobalContext* globalCtx); +void EnRu1_DrawNothing(EnRu1* this, PlayState* play); +void EnRu1_DrawOpa(EnRu1* this, PlayState* play); +void EnRu1_DrawXlu(EnRu1* this, PlayState* play); static ColliderCylinderInitType1 sCylinderInit1 = { { @@ -143,44 +143,44 @@ const ActorInit En_Ru1_InitVars = { (ActorFunc)EnRu1_Draw, }; -void func_80AEAC10(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEAC10(EnRu1* this, PlayState* play) { s32 pad[5]; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void func_80AEAC54(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEAC54(EnRu1* this, PlayState* play) { s32 pad[5]; Collider_UpdateCylinder(&this->actor, &this->collider2); if (this->unk_34C != 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } else if (this->actor.xzDistToPlayer > 32.0f) { this->unk_34C = 1; } } -void func_80AEACDC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEACDC(EnRu1* this, PlayState* play) { s32 pad[5]; Collider_UpdateCylinder(&this->actor, &this->collider2); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } -void func_80AEAD20(Actor* thisx, GlobalContext* globalCtx) { +void func_80AEAD20(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit1); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit1); - Collider_InitCylinder(globalCtx, &this->collider2); - Collider_SetCylinderType1(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); + Collider_InitCylinder(play, &this->collider2); + Collider_SetCylinderType1(play, &this->collider2, &this->actor, &sCylinderInit2); } -void EnRu1_DestroyColliders(EnRu1* this, GlobalContext* globalCtx) { - Collider_DestroyCylinder(globalCtx, &this->collider); - Collider_DestroyCylinder(globalCtx, &this->collider2); +void EnRu1_DestroyColliders(EnRu1* this, PlayState* play) { + Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->collider2); } void func_80AEADD8(EnRu1* this) { @@ -199,10 +199,10 @@ u8 func_80AEADF0(EnRu1* this) { return params; } -void EnRu1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRu1_Destroy(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; - EnRu1_DestroyColliders(this, globalCtx); + EnRu1_DestroyColliders(this, play); } void EnRu1_UpdateEyes(EnRu1* this) { @@ -228,35 +228,35 @@ void EnRu1_SetMouthIndex(EnRu1* this, s16 mouthIndex) { this->mouthIndex = mouthIndex; } -void func_80AEAECC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEAECC(EnRu1* this, PlayState* play) { f32* velocityY = &this->actor.velocity.y; f32 velocityYHeld = *velocityY; *velocityY = -4.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 19.0f, 25.0f, 30.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 19.0f, 25.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); *velocityY = velocityYHeld; } -s32 EnRu1_IsCsStateIdle(GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +s32 EnRu1_IsCsStateIdle(PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { return true; } return false; } -CsCmdActorAction* func_80AEAF58(GlobalContext* globalCtx, s32 npcActionIdx) { +CsCmdActorAction* func_80AEAF58(PlayState* play, s32 npcActionIdx) { s32 pad[2]; CsCmdActorAction* ret = NULL; - if (!EnRu1_IsCsStateIdle(globalCtx)) { - ret = globalCtx->csCtx.npcActions[npcActionIdx]; + if (!EnRu1_IsCsStateIdle(play)) { + ret = play->csCtx.npcActions[npcActionIdx]; } return ret; } -s32 func_80AEAFA0(GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AEAF58(globalCtx, npcActionIdx); +s32 func_80AEAFA0(PlayState* play, u16 action, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = func_80AEAF58(play, npcActionIdx); if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == action)) { return true; @@ -264,8 +264,8 @@ s32 func_80AEAFA0(GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { return false; } -s32 func_80AEAFE0(GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AEAF58(globalCtx, npcActionIdx); +s32 func_80AEAFE0(PlayState* play, u16 action, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = func_80AEAF58(play, npcActionIdx); if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action != action)) { return true; @@ -273,8 +273,8 @@ s32 func_80AEAFE0(GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { return false; } -s32 func_80AEB020(EnRu1* this, GlobalContext* globalCtx) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; +s32 func_80AEB020(EnRu1* this, PlayState* play) { + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_NPC].head; EnRu1* someEnRu1; while (actorIt != NULL) { @@ -291,8 +291,8 @@ s32 func_80AEB020(EnRu1* this, GlobalContext* globalCtx) { return false; } -BgBdanObjects* EnRu1_FindSwitch(GlobalContext* globalCtx) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_BG].head; +BgBdanObjects* EnRu1_FindSwitch(PlayState* play) { + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_BG].head; while (actorIt != NULL) { if (actorIt->id == ACTOR_BG_BDAN_OBJECTS && actorIt->params == 0) { @@ -319,8 +319,8 @@ s32 func_80AEB104(EnRu1* this) { } } -Actor* func_80AEB124(GlobalContext* globalCtx) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].head; +Actor* func_80AEB124(PlayState* play) { + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_BOSS].head; while (actorIt != NULL) { if ((actorIt->id == ACTOR_DEMO_EFFECT) && ((actorIt->params & 0xFF) == 0x15)) { @@ -331,12 +331,12 @@ Actor* func_80AEB124(GlobalContext* globalCtx) { return NULL; } -s32 func_80AEB174(GlobalContext* globalCtx) { - return (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx); +s32 func_80AEB174(PlayState* play) { + return (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play); } -s32 func_80AEB1B4(GlobalContext* globalCtx) { - return Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING; +s32 func_80AEB1B4(PlayState* play) { + return Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING; } void func_80AEB1D8(EnRu1* this) { @@ -351,8 +351,8 @@ void func_80AEB1D8(EnRu1* this) { func_80AEB0EC(this, 0); } -void func_80AEB220(EnRu1* this, GlobalContext* globalCtx) { - if ((EnRu1_IsCsStateIdle(globalCtx)) && (this->actor.params == 0xA)) { +void func_80AEB220(EnRu1* this, PlayState* play) { + if ((EnRu1_IsCsStateIdle(play)) && (this->actor.params == 0xA)) { func_80AEB1D8(this); } } @@ -387,21 +387,21 @@ s32 EnRu1_UpdateSkelAnime(EnRu1* this) { } } -void func_80AEB364(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB364(EnRu1* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_80AEB3A4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB3A4(EnRu1* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - func_80AEB364(this, globalCtx); + func_80AEB364(this, play); } void func_80AEB3CC(EnRu1* this) { this->skelAnime.moveFlags &= ~0x1; } -void func_80AEB3DC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB3DC(EnRu1* this, PlayState* play) { func_80AEB264(this, &gRutoChildWaitHandsBehindBackAnim, 0, 0, 0); this->action = 0; this->drawConfig = 1; @@ -409,69 +409,69 @@ void func_80AEB3DC(EnRu1* this, GlobalContext* globalCtx) { EnRu1_SetMouthIndex(this, 0); } -CsCmdActorAction* func_80AEB438(GlobalContext* globalCtx) { - return func_80AEAF58(globalCtx, 3); +CsCmdActorAction* func_80AEB438(PlayState* play) { + return func_80AEAF58(play, 3); } -s32 func_80AEB458(GlobalContext* globalCtx, u16 action) { - return func_80AEAFA0(globalCtx, action, 3); +s32 func_80AEB458(PlayState* play, u16 action) { + return func_80AEAFA0(play, action, 3); } -s32 func_80AEB480(GlobalContext* globalCtx, u16 action) { - return func_80AEAFE0(globalCtx, action, 3); +s32 func_80AEB480(PlayState* play, u16 action) { + return func_80AEAFE0(play, action, 3); } -void EnRu1_SpawnRipple(EnRu1* this, GlobalContext* globalCtx, s16 radiusMax, s16 life) { +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.yDistToWater; pos.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &pos, 100, radiusMax, life); + EffectSsGRipple_Spawn(play, &pos, 100, radiusMax, life); } -void func_80AEB50C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB50C(EnRu1* this, PlayState* play) { this->unk_270 += 1.0f; if (this->unk_270 >= kREG(3) + 10.0f) { - EnRu1_SpawnRipple(this, globalCtx, kREG(1) + 500, 0); + EnRu1_SpawnRipple(this, play, kREG(1) + 500, 0); this->unk_270 = 0.0f; } } -void func_80AEB59C(EnRu1* this, GlobalContext* globalCtx) { - EnRu1_SpawnRipple(this, globalCtx, kREG(2) + 500, 0); - EnRu1_SpawnRipple(this, globalCtx, kREG(2) + 500, kREG(3) + 10.0f); - EnRu1_SpawnRipple(this, globalCtx, kREG(2) + 500, (kREG(3) + 10.0f) * 2.0f); +void func_80AEB59C(EnRu1* this, PlayState* play) { + EnRu1_SpawnRipple(this, play, kREG(2) + 500, 0); + EnRu1_SpawnRipple(this, play, kREG(2) + 500, kREG(3) + 10.0f); + EnRu1_SpawnRipple(this, play, kREG(2) + 500, (kREG(3) + 10.0f) * 2.0f); } -void EnRu1_SpawnSplash(EnRu1* this, GlobalContext* globalCtx) { +void EnRu1_SpawnSplash(EnRu1* this, PlayState* play) { Vec3f pos; pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + this->actor.yDistToWater; pos.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 1, 0); + EffectSsGSplash_Spawn(play, &pos, 0, 0, 1, 0); } -void func_80AEB6E0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB6E0(EnRu1* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { skelAnime->moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } -void func_80AEB738(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB738(EnRu1* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; skelAnime->baseTransl = skelAnime->jointTable[0]; skelAnime->prevTransl = skelAnime->jointTable[0]; if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { skelAnime->moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } @@ -479,8 +479,8 @@ void func_80AEB7D0(EnRu1* this) { this->skelAnime.moveFlags &= ~0x3; } -f32 func_80AEB7E0(CsCmdActorAction* csCmdNPCAction, GlobalContext* globalCtx) { - s32 csCtxFrames = globalCtx->csCtx.frames; +f32 func_80AEB7E0(CsCmdActorAction* csCmdNPCAction, PlayState* play) { + s32 csCtxFrames = play->csCtx.frames; if ((csCtxFrames < csCmdNPCAction->endFrame) && (csCmdNPCAction->endFrame - csCmdNPCAction->startFrame > 0)) { return (Math_CosS(((csCtxFrames - csCmdNPCAction->startFrame) / @@ -496,8 +496,8 @@ f32 func_80AEB87C(f32 arg0, s32 arg1, s32 arg2) { return (((f32)arg2 - arg1) * arg0) + arg1; } -void func_80AEB89C(EnRu1* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = func_80AEB438(globalCtx); +void func_80AEB89C(EnRu1* this, PlayState* play) { + CsCmdActorAction* npcAction = func_80AEB438(play); s16 npcActionRotY; if (npcAction != NULL) { @@ -510,26 +510,26 @@ void func_80AEB89C(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEB914(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB89C(this, globalCtx); +void func_80AEB914(EnRu1* this, PlayState* play) { + func_80AEB89C(this, play); } -void func_80AEB934(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB89C(this, globalCtx); +void func_80AEB934(EnRu1* this, PlayState* play) { + func_80AEB89C(this, play); } -void func_80AEB954(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB6E0(this, globalCtx); +void func_80AEB954(EnRu1* this, PlayState* play) { + func_80AEB6E0(this, play); } -void func_80AEB974(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEB974(EnRu1* this, PlayState* play) { Vec3f* thisPos; f32 sp30; - CsCmdActorAction* csCmdNPCAction = func_80AEB438(globalCtx); + CsCmdActorAction* csCmdNPCAction = func_80AEB438(play); s32 pad; if (csCmdNPCAction != NULL) { - sp30 = func_80AEB7E0(csCmdNPCAction, globalCtx); + sp30 = func_80AEB7E0(csCmdNPCAction, play); thisPos = &this->actor.world.pos; thisPos->x = func_80AEB87C(sp30, csCmdNPCAction->startPos.x, csCmdNPCAction->endPos.x); thisPos->y = func_80AEB87C(sp30, csCmdNPCAction->startPos.y, csCmdNPCAction->endPos.y); @@ -537,20 +537,20 @@ void func_80AEB974(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEBA0C(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB6E0(this, globalCtx); +void func_80AEBA0C(EnRu1* this, PlayState* play) { + func_80AEB6E0(this, play); } -void func_80AEBA2C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEBA2C(EnRu1* this, PlayState* play) { s32 pad; Vec3f* unk_364 = &this->unk_364; Vec3f* thisPos; f32 temp_ret_2; - CsCmdActorAction* csCmdNPCAction = func_80AEB438(globalCtx); + CsCmdActorAction* csCmdNPCAction = func_80AEB438(play); s32 pad2; if (csCmdNPCAction != NULL) { - temp_ret_2 = func_80AEB7E0(csCmdNPCAction, globalCtx); + temp_ret_2 = func_80AEB7E0(csCmdNPCAction, play); thisPos = &this->actor.world.pos; thisPos->x = func_80AEB87C(temp_ret_2, unk_364->x, csCmdNPCAction->endPos.x); thisPos->y = func_80AEB87C(temp_ret_2, unk_364->y, csCmdNPCAction->endPos.y); @@ -586,18 +586,18 @@ void func_80AEBBF4(EnRu1* this) { } } -void func_80AEBC30(GlobalContext* globalCtx) { +void func_80AEBC30(PlayState* play) { Player* player; - if (globalCtx->csCtx.frames == 0xCD) { - player = GET_PLAYER(globalCtx); + if (play->csCtx.frames == 0xCD) { + player = GET_PLAYER(play); Audio_PlaySoundGeneral(NA_SE_EV_DIVE_INTO_WATER, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } -void func_80AEBC84(EnRu1* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 0x82) { +void func_80AEBC84(EnRu1* this, PlayState* play) { + if (play->csCtx.frames == 0x82) { func_80078914(&this->actor.projectedPos, NA_SE_VO_RT_LAUGH_0); } } @@ -609,32 +609,32 @@ void func_80AEBCB8(EnRu1* this, UNK_TYPE arg1) { } } -void func_80AEBD1C(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEB480(globalCtx, 2)) { +void func_80AEBD1C(EnRu1* this, PlayState* play) { + if (func_80AEB480(play, 2)) { this->action = 1; this->drawConfig = 0; - func_80AEB914(this, globalCtx); - func_80AEAECC(this, globalCtx); - EnRu1_SpawnSplash(this, globalCtx); - func_80AEB59C(this, globalCtx); + func_80AEB914(this, play); + func_80AEAECC(this, play); + EnRu1_SpawnSplash(this, play); + func_80AEB59C(this, play); } } -void func_80AEBD94(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEBD94(EnRu1* this, PlayState* play) { s32 pad[2]; f32 frameCount; - if (func_80AEB480(globalCtx, 3)) { + if (func_80AEB480(play, 3)) { frameCount = Animation_GetLastFrame(&gRutoChildAnim_009060); - func_80AEB934(this, globalCtx); - func_80AEB738(this, globalCtx); + func_80AEB934(this, play); + func_80AEB738(this, play); Animation_Change(&this->skelAnime, &gRutoChildAnim_009060, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); this->action = 2; this->drawConfig = 1; } } -void func_80AEBE3C(EnRu1* this, GlobalContext* globalCtx, s32 arg2) { +void func_80AEBE3C(EnRu1* this, PlayState* play, s32 arg2) { s32 pad[2]; f32 frameCount; @@ -644,41 +644,41 @@ void func_80AEBE3C(EnRu1* this, GlobalContext* globalCtx, s32 arg2) { Animation_Change(&this->skelAnime, &gRutoChildTreadWaterAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); this->action = 3; } else { - func_80AEB954(this, globalCtx); + func_80AEB954(this, play); } } -void func_80AEBEC8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEBEC8(EnRu1* this, PlayState* play) { s32 pad[2]; f32 frameCount; - if (func_80AEB458(globalCtx, 6)) { + if (func_80AEB458(play, 6)) { frameCount = Animation_GetLastFrame(&gRutoChildTransitionToSwimOnBackAnim); - func_80AEB738(this, globalCtx); + func_80AEB738(this, play); Animation_Change(&this->skelAnime, &gRutoChildTransitionToSwimOnBackAnim, 1.0f, 0, frameCount, ANIMMODE_ONCE, -8.0f); this->action = 4; } } -void func_80AEBF60(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEB480(globalCtx, 6)) { +void func_80AEBF60(EnRu1* this, PlayState* play) { + if (func_80AEB480(play, 6)) { func_80AEB7D0(this); this->action = 5; this->unk_364 = this->actor.world.pos; } else { - func_80AEBA0C(this, globalCtx); + func_80AEBA0C(this, play); } } -void func_80AEBFD8(EnRu1* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = func_80AEB438(globalCtx); +void func_80AEBFD8(EnRu1* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = func_80AEB438(play); f32 frameCount; u16 csCtxFrames; u16 endFrame; if (csCmdNPCAction != NULL) { - csCtxFrames = globalCtx->csCtx.frames; + csCtxFrames = play->csCtx.frames; endFrame = csCmdNPCAction->endFrame; if (csCtxFrames >= endFrame - 2) { frameCount = Animation_GetLastFrame(&gRutoChildTransitionFromSwimOnBackAnim); @@ -689,77 +689,77 @@ void func_80AEBFD8(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEC070(EnRu1* this, GlobalContext* globalCtx, UNK_TYPE arg2) { - if ((func_80AEB458(globalCtx, 8)) && (arg2 != 0)) { +void func_80AEC070(EnRu1* this, PlayState* play, UNK_TYPE arg2) { + if ((func_80AEB458(play, 8)) && (arg2 != 0)) { Actor_Kill(&this->actor); } } -void func_80AEC0B4(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB89C(this, globalCtx); +void func_80AEC0B4(EnRu1* this, PlayState* play) { + func_80AEB89C(this, play); EnRu1_UpdateSkelAnime(this); - func_80AEBC84(this, globalCtx); - func_80AEBC30(globalCtx); - func_80AEBD1C(this, globalCtx); + func_80AEBC84(this, play); + func_80AEBC30(play); + func_80AEBD1C(this, play); } -void func_80AEC100(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC100(EnRu1* this, PlayState* play) { func_80AEBAFC(this); - func_80AEBD94(this, globalCtx); + func_80AEBD94(this, play); } -void func_80AEC130(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC130(EnRu1* this, PlayState* play) { s32 something = EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEBB3C(this); - func_80AEBE3C(this, globalCtx, something); + func_80AEBE3C(this, play, something); } -void func_80AEC17C(EnRu1* this, GlobalContext* globalCtx) { - func_80AEB974(this, globalCtx); - func_80AEAECC(this, globalCtx); +void func_80AEC17C(EnRu1* this, PlayState* play) { + func_80AEB974(this, play); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); - func_80AEB50C(this, globalCtx); - func_80AEBEC8(this, globalCtx); + func_80AEB50C(this, play); + func_80AEBEC8(this, play); } -void func_80AEC1D4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC1D4(EnRu1* this, PlayState* play) { s32 something; something = EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateEyes(this); - func_80AEB50C(this, globalCtx); + func_80AEB50C(this, play); func_80AEBCB8(this, something); func_80AEBBF4(this); - func_80AEBF60(this, globalCtx); + func_80AEBF60(this, play); } -void func_80AEC244(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC244(EnRu1* this, PlayState* play) { s32 something; something = EnRu1_UpdateSkelAnime(this); - func_80AEBA2C(this, globalCtx); - func_80AEAECC(this, globalCtx); + func_80AEBA2C(this, play); + func_80AEAECC(this, play); EnRu1_UpdateEyes(this); - func_80AEB50C(this, globalCtx); + func_80AEB50C(this, play); func_80AEBCB8(this, something); func_80AEBB78(this); - func_80AEBFD8(this, globalCtx); + func_80AEBFD8(this, play); } -void func_80AEC2C0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC2C0(EnRu1* this, PlayState* play) { s32 something; something = EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateEyes(this); - func_80AEB50C(this, globalCtx); - func_80AEC070(this, globalCtx, something); + func_80AEB50C(this, play); + func_80AEC070(this, play, something); } -void func_80AEC320(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC320(EnRu1* this, PlayState* play) { s8 actorRoom; if (!GET_INFTABLE(INFTABLE_141)) { @@ -767,7 +767,7 @@ void func_80AEC320(EnRu1* this, GlobalContext* globalCtx) { this->action = 7; EnRu1_SetMouthIndex(this, 1); } else if (GET_INFTABLE(INFTABLE_147) && !GET_INFTABLE(INFTABLE_140) && !GET_INFTABLE(INFTABLE_145)) { - if (!func_80AEB020(this, globalCtx)) { + if (!func_80AEB020(this, play)) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); actorRoom = this->actor.room; this->action = 22; @@ -816,8 +816,8 @@ void func_80AEC4F4(EnRu1* this) { Actor_MoveForward(&this->actor); } -s32 func_80AEC5FC(EnRu1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80AEC5FC(EnRu1* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 thisPosZ = this->actor.world.pos.z; f32 playerPosZ = player->actor.world.pos.z; @@ -842,8 +842,8 @@ void func_80AEC6B0(EnRu1* this) { func_80078914(&this->actor.projectedPos, NA_SE_VO_RT_FALL); } -void func_80AEC6E4(EnRu1* this, GlobalContext* globalCtx) { - if ((func_80AEAFA0(globalCtx, 4, 3)) && (this->unk_280 == 0)) { +void func_80AEC6E4(EnRu1* this, PlayState* play) { + if ((func_80AEAFA0(play, 4, 3)) && (this->unk_280 == 0)) { Animation_Change(&this->skelAnime, &gRutoChildBringArmsUpAnim, 1.0f, 0, Animation_GetLastFrame(&gRutoChildBringArmsUpAnim), ANIMMODE_ONCE, -8.0f); this->unk_280 = 1; @@ -851,27 +851,27 @@ void func_80AEC6E4(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEC780(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC780(EnRu1* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if ((func_80AEC5FC(this, globalCtx)) && (!Play_InCsMode(globalCtx)) && + if ((func_80AEC5FC(this, play)) && (!Play_InCsMode(play)) && (!(player->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21))) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - globalCtx->csCtx.segment = &D_80AF0880; + play->csCtx.segment = &D_80AF0880; gSaveContext.cutsceneTrigger = 1; player->linearVelocity = 0.0f; this->action = 8; } } -void func_80AEC81C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEC81C(EnRu1* this, PlayState* play) { CsCmdActorAction* csCmdNPCAction; s16 newRotY; - if (func_80AEAFE0(globalCtx, 1, 3)) { - csCmdNPCAction = globalCtx->csCtx.npcActions[3]; + if (func_80AEAFE0(play, 1, 3)) { + csCmdNPCAction = play->csCtx.npcActions[3]; this->actor.world.pos.x = csCmdNPCAction->startPos.x; this->actor.world.pos.y = csCmdNPCAction->startPos.y; this->actor.world.pos.z = csCmdNPCAction->startPos.z; @@ -883,8 +883,8 @@ void func_80AEC81C(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEC8B8(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEAFA0(globalCtx, 3, 3)) { +void func_80AEC8B8(EnRu1* this, PlayState* play) { + if (func_80AEAFA0(play, 3, 3)) { Animation_Change(&this->skelAnime, &gRutoChildTurnAroundAnim, 1.0f, 0, Animation_GetLastFrame(&gRutoChildTurnAroundAnim), ANIMMODE_ONCE, -8.0f); this->action = 10; @@ -918,73 +918,73 @@ void func_80AECA18(EnRu1* this) { } } -void func_80AECA44(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEAFA0(globalCtx, 5, 3)) { +void func_80AECA44(EnRu1* this, PlayState* play) { + if (func_80AEAFA0(play, 5, 3)) { SET_INFTABLE(INFTABLE_141); this->action = 14; } } -void func_80AECA94(EnRu1* this, GlobalContext* globalCtx) { - func_80AEC780(this, globalCtx); +void func_80AECA94(EnRu1* this, PlayState* play) { + func_80AEC780(this, play); } -void func_80AECAB4(EnRu1* this, GlobalContext* globalCtx) { - func_80AEC81C(this, globalCtx); +void func_80AECAB4(EnRu1* this, PlayState* play) { + func_80AEC81C(this, play); } -void func_80AECAD4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECAD4(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); - func_80AEC8B8(this, globalCtx); + func_80AEAECC(this, play); + func_80AEC8B8(this, play); } -void func_80AECB18(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECB18(EnRu1* this, PlayState* play) { s32 something; something = EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEC93C(this, something); } -void func_80AECB60(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECB60(EnRu1* this, PlayState* play) { func_80AEC40C(this); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEC650(this); func_80AEC9C4(this); } -void func_80AECBB8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECBB8(EnRu1* this, PlayState* play) { func_80AEC4CC(this); - func_80AEC6E4(this, globalCtx); + func_80AEC6E4(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEC650(this); func_80AECA18(this); } -void func_80AECC1C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECC1C(EnRu1* this, PlayState* play) { func_80AEC4F4(this); - func_80AEC6E4(this, globalCtx); + func_80AEC6E4(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEC650(this); - func_80AECA44(this, globalCtx); + func_80AECA44(this, play); } -void func_80AECC84(EnRu1* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == CS_STATE_IDLE) { +void func_80AECC84(EnRu1* this, PlayState* play) { + if (play->csCtx.state == CS_STATE_IDLE) { Actor_Kill(&this->actor); } } -void func_80AECCB0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECCB0(EnRu1* this, PlayState* play) { s32 pad; Vec3f* pos; s16 yawTowardsPlayer; @@ -998,11 +998,11 @@ void func_80AECCB0(EnRu1* this, GlobalContext* globalCtx) { spawnX = ((kREG(1) + 12.0f) * Math_SinS(yawTowardsPlayer)) + pos->x; spawnY = pos->y; spawnZ = ((kREG(1) + 12.0f) * Math_CosS(yawTowardsPlayer)) + pos->z; - this->blueWarp = (DoorWarp1*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, - spawnX, spawnY, spawnZ, 0, yawTowardsPlayer, 0, WARP_BLUE_RUTO); + this->blueWarp = (DoorWarp1*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, spawnX, + spawnY, spawnZ, 0, yawTowardsPlayer, 0, WARP_BLUE_RUTO); } -void func_80AECDA0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECDA0(EnRu1* this, PlayState* play) { func_80AEB264(this, &gRutoChildWaitHandsOnHipsAnim, 0, 0, 0); this->action = 15; this->actor.shape.yOffset = -10000.0f; @@ -1010,13 +1010,13 @@ void func_80AECDA0(EnRu1* this, GlobalContext* globalCtx) { EnRu1_SetMouthIndex(this, 2); } -void func_80AECE04(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECE04(EnRu1* this, PlayState* play) { this->actor.shape.yOffset += (250.0f / 3.0f); } -void func_80AECE20(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECE20(EnRu1* this, PlayState* play) { s32 pad2; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* playerPos = &player->actor.world.pos; s16 shapeRotY = player->actor.shape.rot.y; s32 pad; @@ -1028,9 +1028,9 @@ void func_80AECE20(EnRu1* this, GlobalContext* globalCtx) { pos->z = (Math_CosS(shapeRotY) * unk_27C) + playerPos->z; } -void func_80AECEB4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AECEB4(EnRu1* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + 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; @@ -1039,9 +1039,9 @@ void func_80AECEB4(EnRu1* this, GlobalContext* globalCtx) { player_unk_450->z = ((kREG(2) + 30.0f) * Math_CosS(shapeRotY)) + pos->z; } -s32 func_80AECF6C(EnRu1* this, GlobalContext* globalCtx) { +s32 func_80AECF6C(EnRu1* this, PlayState* play) { s16* shapeRotY; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Player* otherPlayer; s16 temp_f16; f32 temp1; @@ -1050,7 +1050,7 @@ s32 func_80AECF6C(EnRu1* this, GlobalContext* globalCtx) { this->unk_26C += 1.0f; if ((player->actor.speedXZ == 0.0f) && (this->unk_26C >= 3.0f)) { - otherPlayer = GET_PLAYER(globalCtx); + otherPlayer = GET_PLAYER(play); player->actor.world.pos.x = otherPlayer->unk_450.x; player->actor.world.pos.y = otherPlayer->unk_450.y; player->actor.world.pos.z = otherPlayer->unk_450.z; @@ -1081,16 +1081,16 @@ void func_80AED0B0(EnRu1* this, s32 state) { } } -void func_80AED0C8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED0C8(EnRu1* this, PlayState* play) { this->action = 16; } -void func_80AED0D8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED0D8(EnRu1* this, PlayState* play) { this->action = 17; this->drawConfig = 1; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - func_80AECCB0(this, globalCtx); + func_80AECCB0(this, play); } void func_80AED110(EnRu1* this) { @@ -1101,11 +1101,11 @@ void func_80AED110(EnRu1* this) { } } -void func_80AED154(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED154(EnRu1* this, PlayState* play) { if (func_80AED084(this, WARP_BLUE_RUTO_STATE_ENTERED)) { this->action = 0x13; this->unk_26C = 0.0f; - func_80AECEB4(this, globalCtx); + func_80AECEB4(this, play); } } @@ -1133,47 +1133,47 @@ void func_80AED218(EnRu1* this, UNK_TYPE arg1) { } } -void func_80AED304(EnRu1* this, GlobalContext* globalCtx) { - func_80AED0C8(this, globalCtx); +void func_80AED304(EnRu1* this, PlayState* play) { + func_80AED0C8(this, play); } -void func_80AED324(EnRu1* this, GlobalContext* globalCtx) { - func_80AED0D8(this, globalCtx); +void func_80AED324(EnRu1* this, PlayState* play) { + func_80AED0D8(this, play); } -void func_80AED344(EnRu1* this, GlobalContext* globalCtx) { - func_80AECE04(this, globalCtx); +void func_80AED344(EnRu1* this, PlayState* play) { + func_80AECE04(this, play); EnRu1_UpdateSkelAnime(this); func_80AED110(this); } -void func_80AED374(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED374(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); - func_80AED154(this, globalCtx); + func_80AED154(this, play); } -void func_80AED3A4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED3A4(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); - func_80AED19C(this, func_80AECF6C(this, globalCtx)); + func_80AED19C(this, func_80AECF6C(this, play)); } -void func_80AED3E0(EnRu1* this, GlobalContext* globalCtx) { - func_80AEAECC(this, globalCtx); +void func_80AED3E0(EnRu1* this, PlayState* play) { + func_80AEAECC(this, play); func_80AED218(this, EnRu1_UpdateSkelAnime(this)); } -void func_80AED414(EnRu1* this, GlobalContext* globalCtx) { - func_80AECE20(this, globalCtx); - func_80AEAECC(this, globalCtx); +void func_80AED414(EnRu1* this, PlayState* play) { + func_80AECE20(this, play); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); } -void func_80AED44C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED44C(EnRu1* this, PlayState* play) { s8 actorRoom; if (GET_INFTABLE(INFTABLE_141) && !GET_INFTABLE(INFTABLE_145) && !GET_INFTABLE(INFTABLE_140) && !GET_INFTABLE(INFTABLE_147)) { - if (!func_80AEB020(this, globalCtx)) { + if (!func_80AEB020(this, play)) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); actorRoom = this->actor.room; this->action = 22; @@ -1193,8 +1193,8 @@ void func_80AED4FC(EnRu1* this) { func_80078914(&this->actor.projectedPos, NA_SE_EV_LAND_DIRT); } -void func_80AED520(EnRu1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AED520(EnRu1* this, PlayState* play) { + Player* player = GET_PLAYER(play); Audio_PlaySoundGeneral(NA_SE_PL_PULL_UP_RUTO, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1219,8 +1219,8 @@ void func_80AED600(EnRu1* this) { func_80078914(&this->actor.projectedPos, NA_SE_VO_RT_DISCOVER); } -s32 func_80AED624(EnRu1* this, GlobalContext* globalCtx) { - s8 curRoomNum = globalCtx->roomCtx.curRoom.num; +s32 func_80AED624(EnRu1* this, PlayState* play) { + s8 curRoomNum = play->roomCtx.curRoom.num; if (this->roomNum2 != curRoomNum) { Actor_Kill(&this->actor); @@ -1235,28 +1235,28 @@ s32 func_80AED624(EnRu1* this, GlobalContext* globalCtx) { return true; } -void func_80AED6DC(EnRu1* this, GlobalContext* globalCtx) { - s8 curRoomNum = globalCtx->roomCtx.curRoom.num; +void func_80AED6DC(EnRu1* this, PlayState* play) { + s8 curRoomNum = play->roomCtx.curRoom.num; this->roomNum2 = curRoomNum; this->unk_288 = 0.0f; } -void func_80AED6F8(GlobalContext* globalCtx) { +void func_80AED6F8(PlayState* play) { s8 curRoomNum; if (!GET_INFTABLE(INFTABLE_147)) { - curRoomNum = globalCtx->roomCtx.curRoom.num; + curRoomNum = play->roomCtx.curRoom.num; if (curRoomNum == 2) { SET_INFTABLE(INFTABLE_147); } } } -void func_80AED738(EnRu1* this, GlobalContext* globalCtx) { +void func_80AED738(EnRu1* this, PlayState* play) { u32 temp_v0; - if (func_80AED624(this, globalCtx)) { + if (func_80AED624(this, play)) { this->unk_2A4 += 1.0f; if (this->unk_2A4 < 20.0f) { temp_v0 = ((20.0f - this->unk_2A4) * 255.0f) / 20.0f; @@ -1313,15 +1313,15 @@ void func_80AED8DC(EnRu1* this) { } } -void func_80AEDAE0(EnRu1* this, GlobalContext* globalCtx) { - DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); +void func_80AEDAE0(EnRu1* this, PlayState* play) { + DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); if (dynaPolyActor == NULL || dynaPolyActor->actor.id == ACTOR_EN_BOX) { this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING); } } -void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEDB30(EnRu1* this, PlayState* play) { DynaPolyActor* dynaPolyActor; f32* velocityY; f32* speedXZ; @@ -1334,7 +1334,7 @@ void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { velocityY = &this->actor.velocity.y; - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); if (*velocityY <= 0.0f) { speedXZ = &this->actor.speedXZ; if (dynaPolyActor != NULL) { @@ -1407,9 +1407,9 @@ void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEDEF4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEDEF4(EnRu1* this, PlayState* play) { f32* speedXZ = &this->actor.speedXZ; - DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); + DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_EN_BOX) { if (*speedXZ != 0.0f) { @@ -1425,9 +1425,9 @@ void func_80AEDEF4(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEDFF4(EnRu1* this, GlobalContext* globalCtx) { - func_80AEDB30(this, globalCtx); - func_80AEDEF4(this, globalCtx); +void func_80AEDFF4(EnRu1* this, PlayState* play) { + func_80AEDB30(this, play); + func_80AEDEF4(this, play); Actor_MoveForward(&this->actor); } @@ -1493,31 +1493,31 @@ void func_80AEE050(EnRu1* this) { } } -s32 func_80AEE264(EnRu1* this, GlobalContext* globalCtx) { - if (!Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80AEE264(EnRu1* this, PlayState* play) { + if (!Actor_ProcessTalkRequest(&this->actor, play)) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; if (GET_INFTABLE(INFTABLE_143)) { this->actor.textId = 0x404E; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else if (GET_INFTABLE(INFTABLE_142)) { this->actor.textId = 0x404D; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else { this->actor.textId = 0x404C; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } return false; } return true; } -void func_80AEE2F8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEE2F8(EnRu1* this, PlayState* play) { DynaPolyActor* dynaPolyActor; s32 floorBgId; if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.floorBgId != BGCHECK_SCENE)) { floorBgId = this->actor.floorBgId; - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, floorBgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, floorBgId); if ((dynaPolyActor != NULL) && (dynaPolyActor->actor.id == ACTOR_BG_BDAN_SWITCH)) { if (((dynaPolyActor->actor.params >> 8) & 0x3F) == 0x38) { SET_INFTABLE(INFTABLE_140); @@ -1528,20 +1528,20 @@ void func_80AEE2F8(EnRu1* this, GlobalContext* globalCtx) { CLEAR_INFTABLE(INFTABLE_140); } -s32 func_80AEE394(EnRu1* this, GlobalContext* globalCtx) { +s32 func_80AEE394(EnRu1* this, PlayState* play) { s32 pad[2]; CollisionContext* colCtx; DynaPolyActor* dynaPolyActor; s32 floorBgId; if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && this->actor.floorBgId != BGCHECK_SCENE) { - colCtx = &globalCtx->colCtx; + 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(globalCtx) && globalCtx->msgCtx.msgLength == 0) { + dynaPolyActor->actor.params == 0 && !Player_InCsMode(play) && play->msgCtx.msgLength == 0) { func_80AEE02C(this); - globalCtx->csCtx.segment = &D_80AF10A4; + play->csCtx.segment = &D_80AF10A4; gSaveContext.cutsceneTrigger = 1; this->action = 36; this->drawConfig = 0; @@ -1553,27 +1553,27 @@ s32 func_80AEE394(EnRu1* this, GlobalContext* globalCtx) { return false; } -void func_80AEE488(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEE488(EnRu1* this, PlayState* play) { s8 curRoomNum; - if (Actor_HasParent(&this->actor, globalCtx)) { - curRoomNum = globalCtx->roomCtx.curRoom.num; + if (Actor_HasParent(&this->actor, play)) { + curRoomNum = play->roomCtx.curRoom.num; this->roomNum3 = curRoomNum; this->action = 31; - func_80AED520(this, globalCtx); - } else if (!func_80AEE394(this, globalCtx) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + func_80AED520(this, play); + } else if (!func_80AEE394(this, play) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.minVelocityY = -((kREG(24) * 0.01f) + 6.8f); this->actor.gravity = -((kREG(23) * 0.01f) + 1.3f); this->action = 28; } } -void func_80AEE568(EnRu1* this, GlobalContext* globalCtx) { - if (!func_80AEE394(this, globalCtx)) { +void func_80AEE568(EnRu1* this, PlayState* play) { + if (!func_80AEE394(this, play)) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speedXZ == 0.0f) && (this->actor.minVelocityY == 0.0f)) { func_80AEE02C(this); - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); this->action = 27; func_80AEADD8(this); } else if (this->actor.yDistToWater > 0.0f) { @@ -1583,11 +1583,11 @@ void func_80AEE568(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEE628(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEE628(EnRu1* this, PlayState* play) { s32 pad[2]; - s8 curRoomNum = globalCtx->roomCtx.curRoom.num; + s8 curRoomNum = play->roomCtx.curRoom.num; - if (EnRu1_IsCsStateIdle(globalCtx)) { + if (EnRu1_IsCsStateIdle(play)) { Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, Animation_GetLastFrame(&gRutoChildSittingAnim), ANIMMODE_LOOP, -8.0f); SET_INFTABLE(INFTABLE_144); @@ -1596,18 +1596,18 @@ void func_80AEE628(EnRu1* this, GlobalContext* globalCtx) { this->roomNum3 = curRoomNum; } -s32 func_80AEE6D0(EnRu1* this, GlobalContext* globalCtx) { +s32 func_80AEE6D0(EnRu1* this, PlayState* play) { s32 pad; - s8 curRoomNum = globalCtx->roomCtx.curRoom.num; + s8 curRoomNum = play->roomCtx.curRoom.num; - if (!GET_INFTABLE(INFTABLE_144) && (func_80AEB124(globalCtx) != 0)) { - if (!Player_InCsMode(globalCtx)) { + if (!GET_INFTABLE(INFTABLE_144) && (func_80AEB124(play) != 0)) { + if (!Player_InCsMode(play)) { Animation_Change(&this->skelAnime, &gRutoChildSeesSapphireAnim, 1.0f, 0, Animation_GetLastFrame(&gRutoChildSquirmAnim), ANIMMODE_LOOP, -8.0f); func_80AED600(this); this->action = 34; this->unk_26C = 0.0f; - globalCtx->csCtx.segment = &D_80AF1728; + play->csCtx.segment = &D_80AF1728; gSaveContext.cutsceneTrigger = 1; } this->roomNum3 = curRoomNum; @@ -1617,16 +1617,16 @@ s32 func_80AEE6D0(EnRu1* this, GlobalContext* globalCtx) { return false; } -void func_80AEE7C4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEE7C4(EnRu1* this, PlayState* play) { f32 frameCount; s32 pad[13]; Player* player; f32* unk_370 = &this->unk_370; - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); - func_80AED6DC(this, globalCtx); + func_80AED6DC(this, play); this->actor.speedXZ *= (kREG(25) * 0.01f) + 1.0f; this->actor.velocity.y *= (kREG(26) * 0.01f) + 1.0f; this->actor.minVelocityY = -((kREG(24) * 0.01f) + 6.8f); @@ -1637,12 +1637,12 @@ void func_80AEE7C4(EnRu1* this, GlobalContext* globalCtx) { return; } - if (func_80AEE6D0(this, globalCtx)) { + if (func_80AEE6D0(this, play)) { *unk_370 = 0.0f; return; } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (player->stateFlags2 & PLAYER_STATE2_28) { this->unk_370 += 1.0f; if (this->action != 32) { @@ -1671,10 +1671,10 @@ void func_80AEE7C4(EnRu1* this, GlobalContext* globalCtx) { } } -s32 func_80AEEAC8(EnRu1* this, GlobalContext* globalCtx) { +s32 func_80AEEAC8(EnRu1* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80AEE02C(this); - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); this->action = 27; func_80AEADD8(this); return true; @@ -1682,8 +1682,8 @@ s32 func_80AEEAC8(EnRu1* this, GlobalContext* globalCtx) { return false; } -void func_80AEEB24(EnRu1* this, GlobalContext* globalCtx) { - if ((func_80AEEAC8(this, globalCtx) == 0) && (this->unk_350 == 3)) { +void func_80AEEB24(EnRu1* this, PlayState* play) { + if ((func_80AEEAC8(this, play) == 0) && (this->unk_350 == 3)) { this->action = 30; func_80AEE02C(this); this->actor.gravity = -0.1f; @@ -1691,99 +1691,99 @@ void func_80AEEB24(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEEBB4(EnRu1* this, GlobalContext* globalCtx) { - func_8002F580(&this->actor, globalCtx); +void func_80AEEBB4(EnRu1* this, PlayState* play) { + func_8002F580(&this->actor, play); } -void func_80AEEBD4(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEBD4(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAC54(this, globalCtx); - func_80AEAECC(this, globalCtx); + func_80AEAC54(this, play); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEEBB4(this, globalCtx); - func_80AEE488(this, globalCtx); - func_80AED624(this, globalCtx); - func_80AEDAE0(this, globalCtx); + func_80AEEBB4(this, play); + func_80AEE488(this, play); + func_80AED624(this, play); + func_80AEDAE0(this, play); } -void func_80AEEC5C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEC5C(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEACDC(this, globalCtx); - func_80AEAECC(this, globalCtx); - func_80AEE2F8(this, globalCtx); - func_80AEDFF4(this, globalCtx); + func_80AEACDC(this, play); + func_80AEAECC(this, play); + func_80AEE2F8(this, play); + func_80AEDFF4(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEE568(this, globalCtx); - func_80AED624(this, globalCtx); - func_80AEDAE0(this, globalCtx); + func_80AEE568(this, play); + func_80AED624(this, play); + func_80AEDAE0(this, play); } -void func_80AEECF0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEECF0(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); func_80AEE050(this); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEEB24(this, globalCtx); - func_80AED624(this, globalCtx); + func_80AEEB24(this, play); + func_80AED624(this, play); } -void func_80AEED58(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEED58(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); Actor_MoveForward(&this->actor); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEEAC8(this, globalCtx); - func_80AED624(this, globalCtx); - func_80AEDAE0(this, globalCtx); + func_80AEEAC8(this, play); + func_80AED624(this, play); + func_80AEDAE0(this, play); } -void func_80AEEDCC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEDCC(EnRu1* this, PlayState* play) { func_80AED8DC(this); EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); - func_80AEE2F8(this, globalCtx); + func_80AEAECC(this, play); + func_80AEE2F8(this, play); EnRu1_UpdateEyes(this); - func_80AED6F8(globalCtx); - func_80AEE7C4(this, globalCtx); + func_80AED6F8(play); + func_80AEE7C4(this, play); } -void func_80AEEE34(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEE34(EnRu1* this, PlayState* play) { func_80AED83C(this); EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); - func_80AEE2F8(this, globalCtx); + func_80AEAECC(this, play); + func_80AEE2F8(this, play); EnRu1_UpdateEyes(this); - func_80AED6F8(globalCtx); - func_80AEE7C4(this, globalCtx); + func_80AED6F8(play); + func_80AEE7C4(this, play); } -void func_80AEEE9C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEE9C(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); - func_80AEDFF4(this, globalCtx); + func_80AEAECC(this, play); + func_80AEDFF4(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AED738(this, globalCtx); - func_80AED624(this, globalCtx); + func_80AED738(this, play); + func_80AED624(this, play); } -void func_80AEEF08(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEF08(EnRu1* this, PlayState* play) { func_80AED83C(this); EnRu1_UpdateSkelAnime(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateEyes(this); - func_80AEE628(this, globalCtx); + func_80AEE628(this, play); } -void func_80AEEF5C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEEF5C(EnRu1* this, PlayState* play) { } -void func_80AEEF68(EnRu1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AEEF68(EnRu1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 something; this->unk_374.unk_18 = player->actor.world.pos; @@ -1792,8 +1792,8 @@ void func_80AEEF68(EnRu1* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->unk_374, something, 2); } -void func_80AEEFEC(EnRu1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AEEFEC(EnRu1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 something; this->unk_374.unk_18 = player->actor.world.pos; @@ -1809,13 +1809,13 @@ void func_80AEF080(EnRu1* this) { } } -s32 func_80AEF0BC(EnRu1* this, GlobalContext* globalCtx) { +s32 func_80AEF0BC(EnRu1* this, PlayState* play) { s32 frameCount; if (GET_INFTABLE(INFTABLE_142)) { frameCount = Animation_GetLastFrame(&gRutoChildSitAnim); Animation_Change(&this->skelAnime, &gRutoChildSitAnim, 1.0f, 0, frameCount, ANIMMODE_ONCE, -8.0f); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->action = 26; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); return true; @@ -1823,73 +1823,73 @@ s32 func_80AEF0BC(EnRu1* this, GlobalContext* globalCtx) { return false; } -void func_80AEF170(EnRu1* this, GlobalContext* globalCtx, s32 cond) { +void func_80AEF170(EnRu1* this, PlayState* play, s32 cond) { if (cond) { this->action = 25; } } -void func_80AEF188(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEB174(globalCtx) && !func_80AEF0BC(this, globalCtx)) { - Message_CloseTextbox(globalCtx); +void func_80AEF188(EnRu1* this, PlayState* play) { + if (func_80AEB174(play) && !func_80AEF0BC(this, play)) { + Message_CloseTextbox(play); SET_INFTABLE(INFTABLE_142); this->action = 24; } } -void func_80AEF1F0(EnRu1* this, GlobalContext* globalCtx, UNK_TYPE arg2) { +void func_80AEF1F0(EnRu1* this, PlayState* play, UNK_TYPE arg2) { if (arg2 != 0) { Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gRutoChildSittingAnim), ANIMMODE_LOOP, 0.0f); - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); SET_INFTABLE(INFTABLE_143); - func_80AED6DC(this, globalCtx); - func_8002F580(&this->actor, globalCtx); + func_80AED6DC(this, play); + func_8002F580(&this->actor, play); this->action = 27; func_80AEADD8(this); } } -void func_80AEF29C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF29C(EnRu1* this, PlayState* play) { this->action = 23; } -void func_80AEF2AC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF2AC(EnRu1* this, PlayState* play) { this->action = 24; this->drawConfig = 1; this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; } -void func_80AEF2D0(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF2D0(EnRu1* this, PlayState* play) { s32 cond; - func_80AEEF68(this, globalCtx); + func_80AEEF68(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAC10(this, globalCtx); - func_80AEAECC(this, globalCtx); - cond = func_80AEE264(this, globalCtx); - func_80AED624(this, globalCtx); - func_80AEF170(this, globalCtx, cond); + func_80AEAC10(this, play); + func_80AEAECC(this, play); + cond = func_80AEE264(this, play); + func_80AED624(this, play); + func_80AEF170(this, play, cond); } -void func_80AEF354(EnRu1* this, GlobalContext* globalCtx) { - func_80AEEFEC(this, globalCtx); +void func_80AEF354(EnRu1* this, PlayState* play) { + func_80AEEFEC(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); - func_80AEF188(this, globalCtx); + func_80AEAECC(this, play); + func_80AEF188(this, play); } -void func_80AEF3A8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF3A8(EnRu1* this, PlayState* play) { s32 something; func_80AED83C(this); something = EnRu1_UpdateSkelAnime(this); func_80AEF080(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); - func_80AEF1F0(this, globalCtx, something); + func_80AEAECC(this, play); + func_80AEF1F0(this, play, something); } void func_80AEF40C(EnRu1* this) { @@ -1902,8 +1902,8 @@ void func_80AEF40C(EnRu1* this) { } } -void func_80AEF4A8(EnRu1* this, GlobalContext* globalCtx) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.projectedPos, 20, NA_SE_VO_RT_FALL); +void func_80AEF4A8(EnRu1* this, PlayState* play) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.projectedPos, 20, NA_SE_VO_RT_FALL); } void func_80AEF4E0(EnRu1* this) { @@ -1941,16 +1941,16 @@ void func_80AEF5B8(EnRu1* this) { } } -void func_80AEF624(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF624(EnRu1* this, PlayState* play) { f32 frameCount; CsCmdActorAction* csCmdNPCAction; CsCmdActorAction* csCmdNPCAction2; s16 newRotTmp; - if (func_80AEAFE0(globalCtx, 1, 3)) { + if (func_80AEAFE0(play, 1, 3)) { frameCount = Animation_GetLastFrame(&gRutoChildWalkToAndHoldUpSapphireAnim); // this weird part with the redundant variable is necessary to match for some reason - csCmdNPCAction2 = globalCtx->csCtx.npcActions[3]; + csCmdNPCAction2 = play->csCtx.npcActions[3]; csCmdNPCAction = csCmdNPCAction2; this->actor.world.pos.x = csCmdNPCAction->startPos.x; this->actor.world.pos.y = csCmdNPCAction->startPos.y; @@ -1966,7 +1966,7 @@ void func_80AEF624(EnRu1* this, GlobalContext* globalCtx) { this->actor.world.rot.z = newRotTmp; Animation_Change(&this->skelAnime, &gRutoChildWalkToAndHoldUpSapphireAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); - func_80AEB3A4(this, globalCtx); + func_80AEB3A4(this, play); this->action = 37; this->drawConfig = 1; this->actor.shape.shadowAlpha = 0xFF; @@ -1982,8 +1982,8 @@ void func_80AEF728(EnRu1* this, UNK_TYPE arg1) { } } -void func_80AEF79C(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEAFE0(globalCtx, 2, 3)) { +void func_80AEF79C(EnRu1* this, PlayState* play) { + if (func_80AEAFE0(play, 2, 3)) { Animation_Change(&this->skelAnime, &gRutoChildBringHandsDownAnim, 1.0f, 0, Animation_GetLastFrame(&gRutoChildBringHandsDownAnim), ANIMMODE_ONCE, -8.0f); this->action = 39; @@ -1998,107 +1998,107 @@ void func_80AEF820(EnRu1* this, UNK_TYPE arg1) { } } -void func_80AEF890(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF890(EnRu1* this, PlayState* play) { s32 pad[2]; s8 curRoomNum; - if ((gSaveContext.sceneSetupIndex < 4) && (EnRu1_IsCsStateIdle(globalCtx))) { - curRoomNum = globalCtx->roomCtx.curRoom.num; + if ((gSaveContext.sceneSetupIndex < 4) && (EnRu1_IsCsStateIdle(play))) { + curRoomNum = play->roomCtx.curRoom.num; SET_INFTABLE(INFTABLE_145); - Flags_SetSwitch(globalCtx, func_80AEADE0(this)); + Flags_SetSwitch(play, func_80AEADE0(this)); func_80AEB0EC(this, 1); this->action = 42; this->actor.room = curRoomNum; } } -void func_80AEF930(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF930(EnRu1* this, PlayState* play) { if (func_80AEB104(this) == 3) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; this->actor.textId = 0x4048; - Message_ContinueTextbox(globalCtx, this->actor.textId); - func_80AEF4A8(this, globalCtx); + Message_ContinueTextbox(play, this->actor.textId); + func_80AEF4A8(this, play); this->action = 43; this->drawConfig = 0; } } -void func_80AEF99C(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEB1B4(globalCtx) != 0) { +void func_80AEF99C(EnRu1* this, PlayState* play) { + if (func_80AEB1B4(play) != 0) { func_80AEB0EC(this, 4); Actor_Kill(&this->actor); } } -void func_80AEF9D8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEF9D8(EnRu1* this, PlayState* play) { func_80AED83C(this); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEF624(this, globalCtx); - func_80AEB220(this, globalCtx); + func_80AEF624(this, play); + func_80AEB220(this, play); } -void func_80AEFA2C(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFA2C(EnRu1* this, PlayState* play) { s32 something; func_80AED83C(this); - func_80AEB364(this, globalCtx); - func_80AEAECC(this, globalCtx); + func_80AEB364(this, play); + func_80AEAECC(this, play); something = EnRu1_UpdateSkelAnime(this); func_80AEF4E0(this); func_80AEF5B8(this); func_80AEF40C(this); func_80AEF728(this, something); - func_80AEB220(this, globalCtx); + func_80AEB220(this, play); } -void func_80AEFAAC(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFAAC(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); - func_80AEF79C(this, globalCtx); - func_80AEB220(this, globalCtx); + func_80AEF79C(this, play); + func_80AEB220(this, play); } -void func_80AEFB04(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFB04(EnRu1* this, PlayState* play) { s32 something; func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); something = EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF820(this, something); - func_80AEB220(this, globalCtx); + func_80AEB220(this, play); } -void func_80AEFB68(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFB68(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEF890(this, globalCtx); - func_80AEB220(this, globalCtx); + func_80AEF890(this, play); + func_80AEB220(this, play); } -void func_80AEFBC8(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFBC8(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEAECC(this, globalCtx); + func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF540(this); - func_80AEF930(this, globalCtx); + func_80AEF930(this, play); } -void func_80AEFC24(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFC24(EnRu1* this, PlayState* play) { func_80AED83C(this); - func_80AEF99C(this, globalCtx); + func_80AEF99C(this, play); } -void func_80AEFC54(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFC54(EnRu1* this, PlayState* play) { if (GET_INFTABLE(INFTABLE_145) && !GET_INFTABLE(INFTABLE_146)) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->action = 41; - this->unk_28C = EnRu1_FindSwitch(globalCtx); + this->unk_28C = EnRu1_FindSwitch(play); func_80AEB0EC(this, 1); this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); } else { @@ -2106,8 +2106,8 @@ void func_80AEFC54(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEFCE8(EnRu1* this, GlobalContext* globalCtx) { - this->unk_28C = EnRu1_FindSwitch(globalCtx); +void func_80AEFCE8(EnRu1* this, PlayState* play) { + this->unk_28C = EnRu1_FindSwitch(play); if (this->unk_28C != NULL) { this->action = 42; this->drawConfig = 1; @@ -2115,7 +2115,7 @@ void func_80AEFCE8(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEFD38(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFD38(EnRu1* this, PlayState* play) { if (GET_EVENTCHKINF(EVENTCHKINF_37) && LINK_IS_CHILD) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->actor.flags &= ~ACTOR_FLAG_4; @@ -2126,61 +2126,61 @@ void func_80AEFD38(EnRu1* this, GlobalContext* globalCtx) { } } -s32 func_80AEFDC0(EnRu1* this, GlobalContext* globalCtx) { - if (!Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80AEFDC0(EnRu1* this, PlayState* play) { + if (!Actor_ProcessTalkRequest(&this->actor, play)) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x1F); + this->actor.textId = Text_GetFaceReaction(play, 0x1F); if (this->actor.textId == 0) { this->actor.textId = 0x402C; } - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); return false; } return true; } -s32 func_80AEFE38(EnRu1* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s32 func_80AEFE38(EnRu1* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); return true; } return false; } -void func_80AEFE84(EnRu1* this, GlobalContext* globalCtx, s32 cond) { +void func_80AEFE84(EnRu1* this, PlayState* play, s32 cond) { if (cond) { this->action = 45; } } -void func_80AEFE9C(EnRu1* this, GlobalContext* globalCtx) { - if (func_80AEFE38(this, globalCtx)) { +void func_80AEFE9C(EnRu1* this, PlayState* play) { + if (func_80AEFE38(this, play)) { this->action = 44; } } -void func_80AEFECC(EnRu1* this, GlobalContext* globalCtx) { - func_80AEEF68(this, globalCtx); +void func_80AEFECC(EnRu1* this, PlayState* play) { + func_80AEEF68(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAC10(this, globalCtx); - func_80AEAECC(this, globalCtx); - func_80AEFE84(this, globalCtx, func_80AEFDC0(this, globalCtx)); + func_80AEAC10(this, play); + func_80AEAECC(this, play); + func_80AEFE84(this, play, func_80AEFDC0(this, play)); } -void func_80AEFF40(EnRu1* this, GlobalContext* globalCtx) { - func_80AEEFEC(this, globalCtx); +void func_80AEFF40(EnRu1* this, PlayState* play) { + func_80AEEFEC(this, play); EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); - func_80AEAECC(this, globalCtx); - func_80AEFE9C(this, globalCtx); + func_80AEAECC(this, play); + func_80AEFE9C(this, play); } -void func_80AEFF94(EnRu1* this, GlobalContext* globalCtx) { +void func_80AEFF94(EnRu1* this, PlayState* play) { s8 actorRoom; if (GET_INFTABLE(INFTABLE_141) && GET_INFTABLE(INFTABLE_140) && !GET_INFTABLE(INFTABLE_145) && - (!(func_80AEB020(this, globalCtx)))) { + (!(func_80AEB020(this, play)))) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); actorRoom = this->actor.room; this->action = 22; @@ -2198,15 +2198,15 @@ void func_80AEFF94(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AF0050(EnRu1* this, GlobalContext* globalCtx) { +void func_80AF0050(EnRu1* this, PlayState* play) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->action = 36; this->roomNum1 = this->actor.room; - this->unk_28C = EnRu1_FindSwitch(globalCtx); + this->unk_28C = EnRu1_FindSwitch(play); this->actor.room = -1; } -void EnRu1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRu1_Update(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; if (this->action < 0 || this->action >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->action] == NULL) { @@ -2215,40 +2215,40 @@ void EnRu1_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnRu1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRu1_Init(Actor* thisx, PlayState* play) { s32 pad; EnRu1* this = (EnRu1*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRutoChildSkel, NULL, this->jointTable, this->morphTable, 17); - func_80AEAD20(&this->actor, globalCtx); + SkelAnime_InitFlex(play, &this->skelAnime, &gRutoChildSkel, NULL, this->jointTable, this->morphTable, 17); + func_80AEAD20(&this->actor, play); switch (func_80AEADF0(this)) { case 0: - func_80AECDA0(this, globalCtx); + func_80AECDA0(this, play); break; case 1: - func_80AEB3DC(this, globalCtx); + func_80AEB3DC(this, play); break; case 2: - func_80AEC320(this, globalCtx); + func_80AEC320(this, play); break; case 3: - func_80AED44C(this, globalCtx); + func_80AED44C(this, play); break; case 4: - func_80AEFC54(this, globalCtx); + func_80AEFC54(this, play); break; case 5: - func_80AEFD38(this, globalCtx); + func_80AEFD38(this, play); break; case 6: - func_80AEFF94(this, globalCtx); + func_80AEFF94(this, play); break; case 10: - func_80AF0050(this, globalCtx); + func_80AF0050(this, play); break; default: Actor_Kill(&this->actor); @@ -2258,7 +2258,7 @@ void EnRu1_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80AF0278(EnRu1* this, GlobalContext* globalCtx, s32 limbIndex, Vec3s* rot) { +void func_80AF0278(EnRu1* this, PlayState* play, s32 limbIndex, Vec3s* rot) { Vec3s* vec1 = &this->unk_374.unk_0E; Vec3s* vec2 = &this->unk_374.unk_08; @@ -2274,7 +2274,7 @@ void func_80AF0278(EnRu1* this, GlobalContext* globalCtx, s32 limbIndex, Vec3s* } } -s32 EnRu1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnRu1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnRu1* this = (EnRu1*)thisx; @@ -2282,12 +2282,12 @@ s32 EnRu1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, // "Neck rotation mode is improper!" osSyncPrintf(VT_FGCOL(RED) "首回しモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sPreLimbDrawFuncs[this->unk_290](this, globalCtx, limbIndex, rot); + sPreLimbDrawFuncs[this->unk_290](this, play, limbIndex, rot); } return false; } -void EnRu1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnRu1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnRu1* this = (EnRu1*)thisx; Vec3f vec1; Vec3f vec2; @@ -2304,10 +2304,10 @@ void EnRu1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnRu1_DrawNothing(EnRu1* this, GlobalContext* globalCtx) { +void EnRu1_DrawNothing(EnRu1* this, PlayState* play) { } -void EnRu1_DrawOpa(EnRu1* this, GlobalContext* globalCtx) { +void EnRu1_DrawOpa(EnRu1* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* eyeTex = sEyeTextures[eyeIndex]; @@ -2316,9 +2316,9 @@ void EnRu1_DrawOpa(EnRu1* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthIndex]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ru1.c", 1282); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ru1.c", 1282); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -2326,13 +2326,13 @@ void EnRu1_DrawOpa(EnRu1* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnRu1_OverrideLimbDraw, EnRu1_PostLimbDraw, this, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ru1.c", 1309); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ru1.c", 1309); } -void EnRu1_DrawXlu(EnRu1* this, GlobalContext* globalCtx) { +void EnRu1_DrawXlu(EnRu1* this, PlayState* play) { s32 pad[2]; s16 eyeIndex = this->eyeIndex; void* eyeTex = sEyeTextures[eyeIndex]; @@ -2341,9 +2341,9 @@ void EnRu1_DrawXlu(EnRu1* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthIndex]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ru1.c", 1324); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ru1.c", 1324); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -2351,13 +2351,13 @@ void EnRu1_DrawXlu(EnRu1* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnRu1_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ru1.c", 1353); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ru1.c", 1353); } -void EnRu1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRu1_Draw(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; if (this->drawConfig < 0 || this->drawConfig >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawConfig] == 0) { @@ -2365,5 +2365,5 @@ void EnRu1_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } 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 7d6ed62699..d5ed7b3a61 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h @@ -9,9 +9,9 @@ struct EnRu1; -typedef void (*EnRu1ActionFunc)(struct EnRu1*, GlobalContext*); -typedef void (*EnRu1DrawFunc)(struct EnRu1*, GlobalContext*); -typedef void (*EnRu1PreLimbDrawFunc)(struct EnRu1*, GlobalContext*, s32, Vec3s*); +typedef void (*EnRu1ActionFunc)(struct EnRu1*, PlayState*); +typedef void (*EnRu1DrawFunc)(struct EnRu1*, PlayState*); +typedef void (*EnRu1PreLimbDrawFunc)(struct EnRu1*, PlayState*, s32, Vec3s*); typedef struct EnRu1 { /* 0x0000 */ Actor actor; 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 312552aea5..c53f4d905d 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -11,37 +11,37 @@ #define FLAGS ACTOR_FLAG_4 -void EnRu2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRu2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRu2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRu2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRu2_Init(Actor* thisx, PlayState* play); +void EnRu2_Destroy(Actor* thisx, PlayState* play); +void EnRu2_Update(Actor* thisx, PlayState* play); +void EnRu2_Draw(Actor* thisx, PlayState* play); -void func_80AF2CB4(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2CD4(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2CF4(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2D2C(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2D6C(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2DAC(EnRu2* this, GlobalContext* globalCtx); -void func_80AF2DEC(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3144(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3174(EnRu2* this, GlobalContext* globalCtx); -void func_80AF31C8(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3604(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3624(EnRu2* this, GlobalContext* globalCtx); -void func_80AF366C(EnRu2* this, GlobalContext* globalCtx); -void func_80AF36AC(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3BC8(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3C04(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3C64(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3CB8(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3D0C(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3D60(EnRu2* this, GlobalContext* globalCtx); +void func_80AF2CB4(EnRu2* this, PlayState* play); +void func_80AF2CD4(EnRu2* this, PlayState* play); +void func_80AF2CF4(EnRu2* this, PlayState* play); +void func_80AF2D2C(EnRu2* this, PlayState* play); +void func_80AF2D6C(EnRu2* this, PlayState* play); +void func_80AF2DAC(EnRu2* this, PlayState* play); +void func_80AF2DEC(EnRu2* this, PlayState* play); +void func_80AF3144(EnRu2* this, PlayState* play); +void func_80AF3174(EnRu2* this, PlayState* play); +void func_80AF31C8(EnRu2* this, PlayState* play); +void func_80AF3604(EnRu2* this, PlayState* play); +void func_80AF3624(EnRu2* this, PlayState* play); +void func_80AF366C(EnRu2* this, PlayState* play); +void func_80AF36AC(EnRu2* this, PlayState* play); +void func_80AF3BC8(EnRu2* this, PlayState* play); +void func_80AF3C04(EnRu2* this, PlayState* play); +void func_80AF3C64(EnRu2* this, PlayState* play); +void func_80AF3CB8(EnRu2* this, PlayState* play); +void func_80AF3D0C(EnRu2* this, PlayState* play); +void func_80AF3D60(EnRu2* this, PlayState* play); -void func_80AF3F14(EnRu2* this, GlobalContext* globalCtx); -void func_80AF3F20(EnRu2* this, GlobalContext* globalCtx); -void func_80AF321C(EnRu2* this, GlobalContext* globalCtx); +void func_80AF3F14(EnRu2* this, PlayState* play); +void func_80AF3F20(EnRu2* this, PlayState* play); +void func_80AF321C(EnRu2* this, PlayState* play); -void func_80AF2AB4(EnRu2* this, GlobalContext* globalCtx); +void func_80AF2AB4(EnRu2* this, PlayState* play); static ColliderCylinderInitType1 sCylinderInit = { { @@ -89,24 +89,24 @@ const ActorInit En_Ru2_InitVars = { (ActorFunc)EnRu2_Draw, }; -void func_80AF2550(Actor* thisx, GlobalContext* globalCtx) { +void func_80AF2550(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); } -void func_80AF259C(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF259C(EnRu2* this, PlayState* play) { s32 pad[5]; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void EnRu2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRu2_Destroy(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80AF2608(EnRu2* this) { @@ -145,10 +145,10 @@ void func_80AF26AC(EnRu2* this) { this->unk_2B0 = 0.0f; } -void func_80AF26D0(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF26D0(EnRu2* this, PlayState* play) { s32 one; // Needed to match - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { if (D_80AF4118 != 0) { if (this->actor.params == 2) { func_80AF26AC(this); @@ -164,23 +164,23 @@ void func_80AF26D0(EnRu2* this, GlobalContext* globalCtx) { } } -void func_80AF2744(EnRu2* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2); +void func_80AF2744(EnRu2* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2); } s32 EnRu2_UpdateSkelAnime(EnRu2* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* func_80AF27AC(GlobalContext* globalCtx, s32 npcActionIdx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[npcActionIdx]; +CsCmdActorAction* func_80AF27AC(PlayState* play, s32 npcActionIdx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[npcActionIdx]; } return NULL; } -s32 func_80AF27D0(EnRu2* this, GlobalContext* globalCtx, u16 arg2, s32 npcActionIdx) { - CsCmdActorAction* csCmdActorAction = func_80AF27AC(globalCtx, npcActionIdx); +s32 func_80AF27D0(EnRu2* this, PlayState* play, u16 arg2, s32 npcActionIdx) { + CsCmdActorAction* csCmdActorAction = func_80AF27AC(play, npcActionIdx); if ((csCmdActorAction != NULL) && (csCmdActorAction->action == arg2)) { return true; @@ -188,8 +188,8 @@ s32 func_80AF27D0(EnRu2* this, GlobalContext* globalCtx, u16 arg2, s32 npcAction return false; } -s32 func_80AF281C(EnRu2* this, GlobalContext* globalCtx, u16 arg2, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AF27AC(globalCtx, npcActionIdx); +s32 func_80AF281C(EnRu2* this, PlayState* play, u16 arg2, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = func_80AF27AC(play, npcActionIdx); if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action != arg2)) { return true; @@ -197,8 +197,8 @@ s32 func_80AF281C(EnRu2* this, GlobalContext* globalCtx, u16 arg2, s32 npcAction return false; } -void func_80AF2868(EnRu2* this, GlobalContext* globalCtx, u32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AF27AC(globalCtx, npcActionIdx); +void func_80AF2868(EnRu2* this, PlayState* play, u32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = func_80AF27AC(play, npcActionIdx); s16 newRotY; Actor* thisx = &this->actor; @@ -231,54 +231,53 @@ void func_80AF28E8(EnRu2* this, AnimationHeader* animation, u8 arg2, f32 morphFr Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, morphFrames); } -void func_80AF2978(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2978(EnRu2* this, PlayState* play) { this->actor.shape.yOffset += 250.0f / 3.0f; } -void func_80AF2994(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2994(EnRu2* this, PlayState* play) { func_80AF28E8(this, &gAdultRutoIdleAnim, 0, 0.0f, 0); this->actor.shape.yOffset = -10000.0f; } -void func_80AF29DC(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF29DC(EnRu2* this, PlayState* play) { Actor* thisx = &this->actor; f32 posX = thisx->world.pos.x; f32 posY = thisx->world.pos.y; f32 posZ = thisx->world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, - WARP_SAGES); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_SAGES); } -void func_80AF2A38(EnRu2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AF2A38(EnRu2* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 50.0f; f32 posZ = player->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 10); - Item_Give(globalCtx, ITEM_MEDALLION_WATER); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 10); + Item_Give(play, ITEM_MEDALLION_WATER); } -void func_80AF2AB4(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2AB4(EnRu2* this, PlayState* play) { s32 pad[2]; Player* player; s16 temp; if ((gSaveContext.chamberCutsceneNum == 2) && (gSaveContext.sceneSetupIndex < 4)) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->action = 1; - globalCtx->csCtx.segment = &D_80AF411C; + play->csCtx.segment = &D_80AF411C; gSaveContext.cutsceneTrigger = 2; - Item_Give(globalCtx, ITEM_MEDALLION_WATER); + Item_Give(play, ITEM_MEDALLION_WATER); temp = this->actor.world.rot.y + 0x8000; player->actor.shape.rot.y = temp; player->actor.world.rot.y = temp; } } -void func_80AF2B44(EnRu2* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80AF2B44(EnRu2* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; CsCmdActorAction* csCmdNPCAction; if (csCtx->state != CS_STATE_IDLE) { @@ -286,7 +285,7 @@ void func_80AF2B44(EnRu2* this, GlobalContext* globalCtx) { if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == 2)) { this->action = 2; this->drawConfig = 1; - func_80AF29DC(this, globalCtx); + func_80AF29DC(this, play); } } } @@ -298,12 +297,12 @@ void func_80AF2B94(EnRu2* this) { } } -void func_80AF2BC0(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2BC0(EnRu2* this, PlayState* play) { AnimationHeader* animation = &gAdultRutoRaisingArmsUpAnim; CsCmdActorAction* csCmdNPCAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdNPCAction = globalCtx->csCtx.npcActions[3]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdNPCAction = play->csCtx.npcActions[3]; if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == 3)) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); @@ -318,63 +317,63 @@ void func_80AF2C54(EnRu2* this, s32 arg1) { } } -void func_80AF2C68(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2C68(EnRu2* this, PlayState* play) { CsCmdActorAction* csCmdNPCAction; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - csCmdNPCAction = globalCtx->csCtx.npcActions[6]; + if (play->csCtx.state != CS_STATE_IDLE) { + csCmdNPCAction = play->csCtx.npcActions[6]; if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == 2)) { this->action = 6; - func_80AF2A38(this, globalCtx); + func_80AF2A38(this, play); } } } -void func_80AF2CB4(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2AB4(this, globalCtx); +void func_80AF2CB4(EnRu2* this, PlayState* play) { + func_80AF2AB4(this, play); } -void func_80AF2CD4(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2B44(this, globalCtx); +void func_80AF2CD4(EnRu2* this, PlayState* play) { + func_80AF2B44(this, play); } -void func_80AF2CF4(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2978(this, globalCtx); +void func_80AF2CF4(EnRu2* this, PlayState* play) { + func_80AF2978(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF2B94(this); } -void func_80AF2D2C(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF2D2C(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); - func_80AF2BC0(this, globalCtx); + func_80AF2BC0(this, play); } -void func_80AF2D6C(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2D6C(EnRu2* this, PlayState* play) { s32 something; - func_80AF2744(this, globalCtx); + func_80AF2744(this, play); something = EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF2C54(this, something); } -void func_80AF2DAC(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF2DAC(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); - func_80AF2C68(this, globalCtx); + func_80AF2C68(this, play); } -void func_80AF2DEC(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF2DEC(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); } -void func_80AF2E1C(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2E1C(EnRu2* this, PlayState* play) { func_80AF28E8(this, &gAdultRutoCrossingArmsAnim, 2, 0.0f, 0); this->action = 7; this->actor.shape.shadowAlpha = 0; @@ -384,13 +383,13 @@ void func_80AF2E64() { func_800788CC(NA_SE_SY_WHITE_OUT_T); } -void func_80AF2E84(EnRu2* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.world.pos.x, +void func_80AF2E84(EnRu2* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, kREG(19) + 24.0f + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 8); } -void func_80AF2F04(EnRu2* this, GlobalContext* globalCtx) { - if (func_80AF27D0(this, globalCtx, 4, 3)) { +void func_80AF2F04(EnRu2* this, PlayState* play) { + if (func_80AF27D0(this, play, 4, 3)) { this->action = 8; this->drawConfig = 2; this->alpha = 0; @@ -400,11 +399,11 @@ void func_80AF2F04(EnRu2* this, GlobalContext* globalCtx) { } } -void func_80AF2F58(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF2F58(EnRu2* this, PlayState* play) { f32* unk_2B0 = &this->unk_2B0; s32 alpha; - if (func_80AF27D0(this, globalCtx, 4, 3)) { + if (func_80AF27D0(this, play, 4, 3)) { *unk_2B0 += 1.0f; if (*unk_2B0 >= kREG(5) + 10.0f) { this->action = 9; @@ -430,63 +429,63 @@ void func_80AF2F58(EnRu2* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = alpha; } -void func_80AF30AC(EnRu2* this, GlobalContext* globalCtx) { - if (func_80AF281C(this, globalCtx, 4, 3)) { +void func_80AF30AC(EnRu2* this, PlayState* play) { + if (func_80AF281C(this, play, 4, 3)) { this->action = 8; this->drawConfig = 2; this->unk_2B0 = kREG(5) + 10.0f; this->alpha = 255; if (this->unk_2B8 == 0) { - func_80AF2E84(this, globalCtx); + func_80AF2E84(this, play); this->unk_2B8 = 1; } this->actor.shape.shadowAlpha = 0xFF; } } -void func_80AF3144(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2F04(this, globalCtx); - func_80AF26D0(this, globalCtx); +void func_80AF3144(EnRu2* this, PlayState* play) { + func_80AF2F04(this, play); + func_80AF26D0(this, play); } -void func_80AF3174(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF3174(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); - func_80AF2F58(this, globalCtx); - func_80AF26D0(this, globalCtx); + func_80AF2F58(this, play); + func_80AF26D0(this, play); } -void func_80AF31C8(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF31C8(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); - func_80AF30AC(this, globalCtx); - func_80AF26D0(this, globalCtx); + func_80AF30AC(this, play); + func_80AF26D0(this, play); } -void func_80AF321C(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF321C(EnRu2* this, PlayState* play) { s32 pad[2]; s16 temp = this->unk_2A4; void* tex = sEyeTextures[temp]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ru2_inKenjyanomaDemo02.c", 264); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ru2_inKenjyanomaDemo02.c", 264); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(tex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(tex)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0C, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, - NULL, NULL, NULL, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, + NULL, NULL, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ru2_inKenjyanomaDemo02.c", 291); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ru2_inKenjyanomaDemo02.c", 291); } -void func_80AF3394(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3394(EnRu2* this, PlayState* play) { func_80AF28E8(this, &gAdultRutoIdleHandsOnHipsAnim, 0, 0.0f, 0); this->action = 10; this->drawConfig = 0; @@ -511,8 +510,8 @@ void func_80AF33E0(EnRu2* this) { } } -void func_80AF346C(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2868(this, globalCtx, 3); +void func_80AF346C(EnRu2* this, PlayState* play) { + func_80AF2868(this, play, 3); this->action = 11; this->drawConfig = 2; } @@ -535,8 +534,8 @@ void func_80AF3530(EnRu2* this, s32 arg1) { } } -void func_80AF3564(EnRu2* this, GlobalContext* globalCtx) { - CsCmdActorAction* csCmdNPCAction = func_80AF27AC(globalCtx, 3); +void func_80AF3564(EnRu2* this, PlayState* play) { + CsCmdActorAction* csCmdNPCAction = func_80AF27AC(play, 3); s32 action; s32 unk_2BC; @@ -546,7 +545,7 @@ void func_80AF3564(EnRu2* this, GlobalContext* globalCtx) { if (action != unk_2BC) { switch (action) { case 7: - func_80AF346C(this, globalCtx); + func_80AF346C(this, play); break; case 8: func_80AF34F0(this); @@ -561,44 +560,44 @@ void func_80AF3564(EnRu2* this, GlobalContext* globalCtx) { } } -void func_80AF3604(EnRu2* this, GlobalContext* globalCtx) { - func_80AF3564(this, globalCtx); +void func_80AF3604(EnRu2* this, PlayState* play) { + func_80AF3564(this, play); } -void func_80AF3624(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF3624(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF33E0(this); func_80AF34A4(this); } -void func_80AF366C(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF366C(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); - func_80AF3564(this, globalCtx); + func_80AF3564(this, play); } -void func_80AF36AC(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF36AC(EnRu2* this, PlayState* play) { s32 something; - func_80AF2744(this, globalCtx); + func_80AF2744(this, play); something = EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF3530(this, something); } -void func_80AF36EC(EnRu2* this, GlobalContext* globalCtx) { - Flags_SetSwitch(globalCtx, func_80AF2690(this)); +void func_80AF36EC(EnRu2* this, PlayState* play) { + Flags_SetSwitch(play, func_80AF2690(this)); } -s32 func_80AF3718(EnRu2* this, GlobalContext* globalCtx) { - return Flags_GetSwitch(globalCtx, func_80AF2690(this)); +s32 func_80AF3718(EnRu2* this, PlayState* play) { + return Flags_GetSwitch(play, func_80AF2690(this)); } -void func_80AF3744(EnRu2* this, GlobalContext* globalCtx) { - if (func_80AF3718(this, globalCtx)) { +void func_80AF3744(EnRu2* this, PlayState* play) { + if (func_80AF3718(this, play)) { Actor_Kill(&this->actor); } else { func_80AF28E8(this, &gAdultRutoIdleAnim, 0, 0.0f, 0); @@ -619,8 +618,8 @@ void func_80AF37CC(EnRu2* this) { this->actor.world.pos.y = this->actor.home.pos.y + (300.0f * funcFloat); } -s32 func_80AF383C(EnRu2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80AF383C(EnRu2* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 thisPosX = this->actor.world.pos.x; f32 playerPosX = player->actor.world.pos.x; @@ -630,19 +629,19 @@ s32 func_80AF383C(EnRu2* this, GlobalContext* globalCtx) { return 0; } -void func_80AF3878(EnRu2* this, GlobalContext* globalCtx) { - if (func_80AF383C(this, globalCtx) && !Play_InCsMode(globalCtx)) { +void func_80AF3878(EnRu2* this, PlayState* play) { + if (func_80AF383C(this, play) && !Play_InCsMode(play)) { this->action = 16; - OnePointCutscene_Init(globalCtx, 3130, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3130, -99, &this->actor, CAM_ID_MAIN); } } -void func_80AF38D0(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF38D0(EnRu2* this, PlayState* play) { this->action = 16; - OnePointCutscene_Init(globalCtx, 3130, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 3130, -99, &this->actor, CAM_ID_MAIN); } -void func_80AF390C(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF390C(EnRu2* this, PlayState* play) { f32* unk_2C4 = &this->unk_2C4; *unk_2C4 += 1.0f; @@ -650,12 +649,12 @@ void func_80AF390C(EnRu2* this, GlobalContext* globalCtx) { func_80AF37AC(); } else if (*unk_2C4 > kREG(4) + 50.0f) { this->actor.textId = 0x403E; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->action = 17; } } -void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF39DC(EnRu2* this, PlayState* play) { s32 pad; MessageContext* msgCtx; s32 pad2; @@ -663,7 +662,7 @@ void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) { Player* player; s32 pad3; - msgCtx = &globalCtx->msgCtx; + msgCtx = &play->msgCtx; dialogState = Message_GetState(msgCtx); if (dialogState == TEXT_STATE_DONE_FADING) { @@ -672,10 +671,10 @@ void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) { osSyncPrintf("おれが小松だ! \n"); this->unk_2C2++; if (this->unk_2C2 % 6 == 3) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); // "uorya-!" (screeming sound) osSyncPrintf("うおりゃー! \n"); - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); player->actor.world.pos.x = 820.0f; player->actor.world.pos.y = 0.0f; player->actor.world.pos.z = 180.0f; @@ -686,74 +685,74 @@ void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) { this->unk_2C3 = dialogState; if (Message_GetState(msgCtx) == TEXT_STATE_CLOSING) { this->action = 18; - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); } } -void func_80AF3ADC(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3ADC(EnRu2* this, PlayState* play) { this->unk_2C4 += 1.0f; if (this->unk_2C4 > kREG(5) + 100.0f) { func_80AF28E8(this, &gAdultRutoSwimmingUpAnim, 0, -12.0f, 0); this->action = 19; - func_80AF36EC(this, globalCtx); + func_80AF36EC(this, play); } } -void func_80AF3B74(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3B74(EnRu2* this, PlayState* play) { if (this->unk_2C0 > ((((u16)(kREG(3) + 0x28)) + ((u16)(kREG(2) + 0x96))) & 0xFFFF)) { Actor_Kill(&this->actor); } } -void func_80AF3BC8(EnRu2* this, GlobalContext* globalCtx) { - func_80AF3878(this, globalCtx); +void func_80AF3BC8(EnRu2* this, PlayState* play) { + func_80AF3878(this, play); Actor_SetFocus(&this->actor, 50.0f); - func_80AF259C(this, globalCtx); + func_80AF259C(this, play); } -void func_80AF3C04(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); - func_80AF259C(this, globalCtx); +void func_80AF3C04(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); + func_80AF259C(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); Actor_SetFocus(&this->actor, 50.0f); - func_80AF38D0(this, globalCtx); + func_80AF38D0(this, play); } -void func_80AF3C64(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF3C64(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); Actor_SetFocus(&this->actor, 50.0f); - func_80AF390C(this, globalCtx); + func_80AF390C(this, play); } -void func_80AF3CB8(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF3CB8(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); Actor_SetFocus(&this->actor, 50.0f); - func_80AF39DC(this, globalCtx); + func_80AF39DC(this, play); } -void func_80AF3D0C(EnRu2* this, GlobalContext* globalCtx) { - func_80AF2744(this, globalCtx); +void func_80AF3D0C(EnRu2* this, PlayState* play) { + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); Actor_SetFocus(&this->actor, 50.0f); - func_80AF3ADC(this, globalCtx); + func_80AF3ADC(this, play); } -void func_80AF3D60(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3D60(EnRu2* this, PlayState* play) { func_80AF37CC(this); - func_80AF2744(this, globalCtx); + func_80AF2744(this, play); EnRu2_UpdateSkelAnime(this); func_80AF2608(this); Actor_SetFocus(&this->actor, 50.0f); - func_80AF3B74(this, globalCtx); + func_80AF3B74(this, play); } -void EnRu2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRu2_Update(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; if ((this->action < 0) || (this->action >= ARRAY_COUNT(sActionFuncs)) || (sActionFuncs[this->action] == NULL)) { @@ -761,28 +760,28 @@ void EnRu2_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnRu2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRu2_Init(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - func_80AF2550(thisx, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gAdultRutoSkel, NULL, this->jointTable, this->morphTable, 23); + func_80AF2550(thisx, play); + SkelAnime_InitFlex(play, &this->skelAnime, &gAdultRutoSkel, NULL, this->jointTable, this->morphTable, 23); switch (func_80AF26A0(this)) { case 2: - func_80AF2E1C(this, globalCtx); + func_80AF2E1C(this, play); break; case 3: - func_80AF3394(this, globalCtx); + func_80AF3394(this, play); break; case 4: - func_80AF3744(this, globalCtx); + func_80AF3744(this, play); break; default: - func_80AF2994(this, globalCtx); + func_80AF2994(this, play); break; } @@ -790,31 +789,30 @@ void EnRu2_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_2C3 = TEXT_STATE_DONE_FADING; } -void func_80AF3F14(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3F14(EnRu2* this, PlayState* play) { } -void func_80AF3F20(EnRu2* this, GlobalContext* globalCtx) { +void func_80AF3F20(EnRu2* this, PlayState* play) { s32 pad[2]; s16 temp = this->unk_2A4; void* tex = sEyeTextures[temp]; SkelAnime* skelAnime = &this->skelAnime; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ru2.c", 642); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ru2.c", 642); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(tex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(tex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, - this); + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ru2.c", 663); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ru2.c", 663); } -void EnRu2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRu2_Draw(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; if ((this->drawConfig < 0) || (this->drawConfig >= ARRAY_COUNT(sDrawFuncs)) || @@ -823,5 +821,5 @@ void EnRu2_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h index bb3865ce65..cf2e894ced 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h @@ -6,8 +6,8 @@ struct EnRu2; -typedef void (*EnRu2ActionFunc)(struct EnRu2*, GlobalContext*); -typedef void (*EnRu2DrawFunc)(struct EnRu2*, GlobalContext*); +typedef void (*EnRu2ActionFunc)(struct EnRu2*, PlayState*); +typedef void (*EnRu2DrawFunc)(struct EnRu2*, PlayState*); typedef struct EnRu2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 55bda07a80..776c3dbfa3 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -6,16 +6,16 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnSa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSa_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSa_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSa_Init(Actor* thisx, PlayState* play); +void EnSa_Destroy(Actor* thisx, PlayState* play); +void EnSa_Update(Actor* thisx, PlayState* play); +void EnSa_Draw(Actor* thisx, PlayState* play); -void func_80AF6448(EnSa* this, GlobalContext* globalCtx); -void func_80AF67D0(EnSa* this, GlobalContext* globalCtx); -void func_80AF683C(EnSa* this, GlobalContext* globalCtx); -void func_80AF68E4(EnSa* this, GlobalContext* globalCtx); -void func_80AF6B20(EnSa* this, GlobalContext* globalCtx); +void func_80AF6448(EnSa* this, PlayState* play); +void func_80AF67D0(EnSa* this, PlayState* play); +void func_80AF683C(EnSa* this, PlayState* play); +void func_80AF68E4(EnSa* this, PlayState* play); +void func_80AF6B20(EnSa* this, PlayState* play); typedef enum { /* 0 */ SARIA_EYE_OPEN, @@ -125,8 +125,8 @@ static AnimationInfo sAnimationInfo2[] = { { &gSariaWaitArmsToSideAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, }; -s16 func_80AF5560(EnSa* this, GlobalContext* globalCtx) { - s16 textState = Message_GetState(&globalCtx->msgCtx); +s16 func_80AF5560(EnSa* this, PlayState* play) { + s16 textState = Message_GetState(&play->msgCtx); if (this->unk_209 == TEXT_STATE_AWAITING_NEXT || this->unk_209 == TEXT_STATE_EVENT || this->unk_209 == TEXT_STATE_CLOSING || this->unk_209 == TEXT_STATE_DONE_HAS_NEXT) { @@ -138,9 +138,9 @@ s16 func_80AF5560(EnSa* this, GlobalContext* globalCtx) { return textState; } -u16 func_80AF55E0(GlobalContext* globalCtx, Actor* thisx) { +u16 func_80AF55E0(PlayState* play, Actor* thisx) { EnSa* this = (EnSa*)thisx; - u16 reaction = Text_GetFaceReaction(globalCtx, 0x10); + u16 reaction = Text_GetFaceReaction(play, 0x10); if (reaction != 0) { return reaction; @@ -178,11 +178,11 @@ u16 func_80AF55E0(GlobalContext* globalCtx, Actor* thisx) { return 0x1001; } -s16 func_80AF56F4(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80AF56F4(PlayState* play, Actor* thisx) { s16 ret = 1; EnSa* this = (EnSa*)thisx; - switch (func_80AF5560(this, globalCtx)) { + switch (func_80AF5560(this, play)) { case TEXT_STATE_CLOSING: switch (this->actor.textId) { case 0x1002: @@ -216,10 +216,10 @@ s16 func_80AF56F4(GlobalContext* globalCtx, Actor* thisx) { return ret; } -void func_80AF57D8(EnSa* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum != SCENE_SPOT05 || - ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x1555 || this->unk_1E0.unk_00 != 0) { - func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 30.0f, func_80AF55E0, +void func_80AF57D8(EnSa* this, PlayState* play) { + if (play->sceneNum != SCENE_SPOT05 || ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x1555 || + this->unk_1E0.unk_00 != 0) { + func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 30.0f, func_80AF55E0, func_80AF56F4); } } @@ -372,23 +372,23 @@ void EnSa_ChangeAnim(EnSa* this, s32 index) { sAnimationInfo1[index].morphFrames); } -s32 func_80AF5DFC(EnSa* this, GlobalContext* globalCtx) { +s32 func_80AF5DFC(EnSa* this, PlayState* play) { if (gSaveContext.cutsceneIndex >= 0xFFF0 && gSaveContext.cutsceneIndex != 0xFFFD) { - if (globalCtx->sceneNum == SCENE_SPOT04) { + if (play->sceneNum == SCENE_SPOT04) { return 4; } - if (globalCtx->sceneNum == SCENE_SPOT05) { + if (play->sceneNum == SCENE_SPOT05) { return 5; } } - if (globalCtx->sceneNum == SCENE_KOKIRI_HOME5 && !LINK_IS_ADULT && + if (play->sceneNum == SCENE_KOKIRI_HOME5 && !LINK_IS_ADULT && INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY && !GET_EVENTCHKINF(EVENTCHKINF_40)) { return 1; } - if (globalCtx->sceneNum == SCENE_SPOT05 && GET_EVENTCHKINF(EVENTCHKINF_40)) { + if (play->sceneNum == SCENE_SPOT05 && GET_EVENTCHKINF(EVENTCHKINF_40)) { return CHECK_QUEST_ITEM(QUEST_SONG_SARIA) ? 2 : 5; } - if (globalCtx->sceneNum == SCENE_SPOT04 && !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) { + if (play->sceneNum == SCENE_SPOT04 && !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) { if (GET_INFTABLE(INFTABLE_00)) { return 1; } @@ -397,21 +397,21 @@ s32 func_80AF5DFC(EnSa* this, GlobalContext* globalCtx) { return 0; } -void func_80AF5F34(EnSa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AF5F34(EnSa* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a3 = 0; - if (globalCtx->sceneNum == SCENE_SPOT04) { + if (play->sceneNum == SCENE_SPOT04) { phi_a3 = (this->actionFunc == func_80AF68E4) ? 1 : 4; } - if (globalCtx->sceneNum == SCENE_SPOT05) { + if (play->sceneNum == SCENE_SPOT05) { phi_a3 = (this->skelAnime.animation == &gSariaPlayingOcarinaAnim) ? 1 : 3; } - if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF6448 && + if (play->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF6448 && this->skelAnime.animation == &gSariaStopPlayingOcarinaAnim) { phi_a3 = 1; } - if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF68E4 && + if (play->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF68E4 && this->skelAnime.animation == &gSariaOcarinaToMouthAnim) { phi_a3 = 1; } @@ -470,17 +470,17 @@ void func_80AF6170(CsCmdActorAction* csAction, Vec3f* dst) { dst->z = csAction->endPos.z; } -void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSa_Init(Actor* thisx, PlayState* play) { EnSa* this = (EnSa*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 12.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, NULL, this->jointTable, this->morphTable, 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gSariaSkel, NULL, this->jointTable, this->morphTable, 17); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - switch (func_80AF5DFC(this, globalCtx)) { + switch (func_80AF5DFC(this, play)) { case 2: EnSa_ChangeAnim(this, ENSA_ANIM1_11); this->actionFunc = func_80AF6448; @@ -497,7 +497,7 @@ void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) { case 4: this->unk_210 = 0; this->actor.gravity = -1.0f; - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gSpot04Cs_10E20); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gSpot04Cs_10E20); gSaveContext.cutsceneTrigger = 1; EnSa_ChangeAnim(this, ENSA_ANIM1_4); this->actionFunc = func_80AF68E4; @@ -520,18 +520,18 @@ void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) { this->alpha = 255; this->unk_21A = this->actor.shape.rot; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + 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); } -void EnSa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSa_Destroy(Actor* thisx, PlayState* play) { EnSa* this = (EnSa*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AF6448(EnSa* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT04) { +void func_80AF6448(EnSa* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT04) { if (this->unk_1E0.unk_00 != 0) { switch (this->actor.textId) { case 0x1002: @@ -600,30 +600,30 @@ void func_80AF6448(EnSa* this, GlobalContext* globalCtx) { EnSa_ChangeAnim(this, ENSA_ANIM1_6); } } - if (this->unk_1E0.unk_00 != 0 && globalCtx->sceneNum == SCENE_SPOT05) { + if (this->unk_1E0.unk_00 != 0 && play->sceneNum == SCENE_SPOT05) { Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f); this->actionFunc = func_80AF67D0; } } -void func_80AF67D0(EnSa* this, GlobalContext* globalCtx) { +void func_80AF67D0(EnSa* this, PlayState* play) { if (this->unk_1E0.unk_00 == 0) { Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 0.0f, 10.0f, 0.0f, ANIMMODE_ONCE, -10.0f); this->actionFunc = func_80AF6448; } } -void func_80AF683C(EnSa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AF683C(EnSa* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (!(player->actor.world.pos.z >= -2220.0f) && !Play_InCsMode(globalCtx)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(spot05_scene_Cs_005730); + if (!(player->actor.world.pos.z >= -2220.0f) && !Play_InCsMode(play)) { + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(spot05_scene_Cs_005730); gSaveContext.cutsceneTrigger = 1; this->actionFunc = func_80AF68E4; } } -void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { +void func_80AF68E4(EnSa* this, PlayState* play) { s16 phi_v0; Vec3f startPos; Vec3f endPos; @@ -632,11 +632,11 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { f32 temp_f0; f32 gravity; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { this->actionFunc = func_80AF6B20; return; } - csAction = globalCtx->csCtx.npcActions[1]; + csAction = play->csCtx.npcActions[1]; if (csAction != NULL) { func_80AF6130(csAction, &startPos); func_80AF6170(csAction, &endPos); @@ -678,12 +678,12 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { this->actor.shape.rot.z = csAction->urot.z; this->actor.velocity = D_80AF7448; - if (globalCtx->csCtx.frames < csAction->endFrame) { + if (play->csCtx.frames < csAction->endFrame) { temp_f0 = csAction->endFrame - csAction->startFrame; this->actor.velocity.x = (endPos.x - startPos.x) / temp_f0; this->actor.velocity.y = (endPos.y - startPos.y) / temp_f0; gravity = this->actor.gravity; - if (globalCtx->sceneNum == SCENE_SPOT05) { + if (play->sceneNum == SCENE_SPOT05) { gravity = 0.0f; } this->actor.velocity.y += gravity; @@ -695,13 +695,13 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { } } -void func_80AF6B20(EnSa* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SPOT05) { - Item_Give(globalCtx, ITEM_SONG_SARIA); +void func_80AF6B20(EnSa* this, PlayState* play) { + if (play->sceneNum == SCENE_SPOT05) { + Item_Give(play, ITEM_SONG_SARIA); EnSa_ChangeAnim(this, ENSA_ANIM1_6); } - if (globalCtx->sceneNum == SCENE_SPOT04) { + if (play->sceneNum == SCENE_SPOT04) { EnSa_ChangeAnim(this, ENSA_ANIM1_4); this->actor.world.pos = this->actor.home.pos; this->actor.world.rot = this->unk_21A; @@ -712,12 +712,12 @@ void func_80AF6B20(EnSa* this, GlobalContext* globalCtx) { this->actionFunc = func_80AF6448; } -void EnSa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSa_Update(Actor* thisx, PlayState* play) { EnSa* this = (EnSa*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); if (this->skelAnime.animation == &gSariaOcarinaToMouthAnim && @@ -726,7 +726,7 @@ void EnSa_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionFunc != func_80AF68E4) { - this->alpha = func_80034DD4(&this->actor, globalCtx, this->alpha, 400.0f); + this->alpha = func_80034DD4(&this->actor, play, this->alpha, 400.0f); } else { this->alpha = 255; } @@ -741,18 +741,17 @@ void EnSa_Update(Actor* thisx, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); } - if (globalCtx->sceneNum != SCENE_SPOT05) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + if (play->sceneNum != SCENE_SPOT05) { + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); } func_80AF609C(this); - this->actionFunc(this, globalCtx); - func_80AF57D8(this, globalCtx); - func_80AF5F34(this, globalCtx); + this->actionFunc(this, play); + func_80AF57D8(this, play); + func_80AF5F34(this, play); } -s32 EnSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { +s32 EnSa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnSa* this = (EnSa*)thisx; s32 pad; Vec3s sp18; @@ -771,14 +770,14 @@ s32 EnSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Matrix_RotateX(BINANG_TO_RAD_ALT(sp18.x), MTXMODE_APPLY); } - if (globalCtx->sceneNum == SCENE_SPOT05 && limbIndex == 15) { + if (play->sceneNum == SCENE_SPOT05 && limbIndex == 15) { *dList = gSariaRightHandAndOcarinaDL; } return 0; } -void EnSa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnSa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnSa* this = (EnSa*)thisx; Vec3f D_80AF7454 = { 400.0, 0.0f, 0.0f }; @@ -787,7 +786,7 @@ void EnSa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnSa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSa_Draw(Actor* thisx, PlayState* play) { static void* mouthTextures[] = { gSariaMouthClosed2Tex, gSariaMouthSmilingOpenTex, gSariaMouthFrowningTex, gSariaMouthSuprisedTex, gSariaMouthClosedTex, @@ -797,19 +796,19 @@ void EnSa_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnSa* this = (EnSa*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_sa.c", 1444); + OPEN_DISPS(play->state.gfxCtx, "../z_en_sa.c", 1444); if (this->alpha == 255) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->rightEyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTextures[this->leftEyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthIndex])); - func_80034BA0(globalCtx, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); + func_80034BA0(play, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); } else if (this->alpha != 0) { gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->rightEyeIndex])); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTextures[this->leftEyeIndex])); gSPSegment(POLY_XLU_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthIndex])); - func_80034CC4(globalCtx, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); + func_80034CC4(play, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_sa.c", 1497); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_sa.c", 1497); } diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.h b/src/overlays/actors/ovl_En_Sa/z_en_sa.h index 872b50f820..3fc8e3d6d0 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.h +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.h @@ -6,7 +6,7 @@ struct EnSa; -typedef void (*EnSaActionFunc)(struct EnSa*, GlobalContext*); +typedef void (*EnSaActionFunc)(struct EnSa*, PlayState*); typedef struct EnSa { /* 0x0000 */ Actor 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 d069a40a9a..23f531cd86 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -10,20 +10,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnSb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSb_Init(Actor* thisx, PlayState* play); +void EnSb_Destroy(Actor* thisx, PlayState* play); +void EnSb_Update(Actor* thisx, PlayState* play); +void EnSb_Draw(Actor* thisx, PlayState* play); void EnSb_SetupWaitClosed(EnSb* this); -void EnSb_WaitClosed(EnSb* this, GlobalContext* globalCtx); -void EnSb_Open(EnSb* this, GlobalContext* globalCtx); -void EnSb_WaitOpen(EnSb* this, GlobalContext* globalCtx); -void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx); -void EnSb_Lunge(EnSb* this, GlobalContext* globalCtx); -void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx); -void EnSb_Cooldown(EnSb* this, GlobalContext* globalCtx); +void EnSb_WaitClosed(EnSb* this, PlayState* play); +void EnSb_Open(EnSb* this, PlayState* play); +void EnSb_WaitOpen(EnSb* this, PlayState* play); +void EnSb_TurnAround(EnSb* this, PlayState* play); +void EnSb_Lunge(EnSb* this, PlayState* play); +void EnSb_Bounce(EnSb* this, PlayState* play); +void EnSb_Cooldown(EnSb* this, PlayState* play); const ActorInit En_Sb_InitVars = { ACTOR_EN_SB, @@ -105,15 +105,15 @@ typedef enum { /* 0x04 */ SHELLBLADE_BOUNCE } ShellbladeBehavior; -void EnSb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSb_Init(Actor* thisx, PlayState* play) { EnSb* this = (EnSb*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = sDamageTable; this->actor.colChkInfo.health = 2; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_sb_Skel_002BF0, &object_sb_Anim_000194, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_sb_Skel_002BF0, &object_sb_Anim_000194, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); this->isDead = false; this->actor.colChkInfo.mass = 0; Actor_SetScale(&this->actor, 0.006f); @@ -126,18 +126,18 @@ void EnSb_Init(Actor* thisx, GlobalContext* globalCtx) { EnSb_SetupWaitClosed(this); } -void EnSb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSb_Destroy(Actor* thisx, PlayState* play) { EnSb* this = (EnSb*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void EnSb_SpawnBubbles(GlobalContext* globalCtx, EnSb* this) { +void EnSb_SpawnBubbles(PlayState* play, EnSb* this) { s32 i; if (this->actor.yDistToWater > 0) { for (i = 0; i < 10; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 10.0f, 10.0f, 30.0f, 0.25f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 10.0f, 10.0f, 30.0f, 0.25f); } } } @@ -205,7 +205,7 @@ void EnSb_SetupCooldown(EnSb* this, s32 changeSpeed) { this->actionFunc = EnSb_Cooldown; } -void EnSb_WaitClosed(EnSb* this, GlobalContext* globalCtx) { +void EnSb_WaitClosed(EnSb* this, PlayState* play) { // always face toward link Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x7D0, 0x0); @@ -214,7 +214,7 @@ void EnSb_WaitClosed(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_Open(EnSb* this, GlobalContext* globalCtx) { +void EnSb_Open(EnSb* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; if (Animation_GetLastFrame(&object_sb_Anim_000194) <= currentFrame) { @@ -228,7 +228,7 @@ void EnSb_Open(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_WaitOpen(EnSb* this, GlobalContext* globalCtx) { +void EnSb_WaitOpen(EnSb* this, PlayState* play) { s16 timer = this->timer; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x7D0, 0x0); @@ -246,7 +246,7 @@ void EnSb_WaitOpen(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) { +void EnSb_TurnAround(EnSb* this, PlayState* play) { s16 invertedYaw; invertedYaw = this->attackYaw + 0x8000; @@ -263,7 +263,7 @@ void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) { this->actor.speedXZ = 6.0f; this->actor.gravity = -2.0f; } - EnSb_SpawnBubbles(globalCtx, this); + EnSb_SpawnBubbles(play, this); this->bouncesLeft = 3; EnSb_SetupLunge(this); // "Attack!!" @@ -271,7 +271,7 @@ void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_Lunge(EnSb* this, GlobalContext* globalCtx) { +void EnSb_Lunge(EnSb* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); if ((this->actor.velocity.y <= -0.1f) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH)) { if (!(this->actor.yDistToWater > 0.0f)) { @@ -282,7 +282,7 @@ void EnSb_Lunge(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) { +void EnSb_Bounce(EnSb* this, PlayState* play) { s32 pad; f32 currentFrame; f32 frameCount; @@ -304,7 +304,7 @@ void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) { this->actor.speedXZ = 6.0f; this->actor.gravity = -2.0f; } - EnSb_SpawnBubbles(globalCtx, this); + EnSb_SpawnBubbles(play, this); EnSb_SetupLunge(this); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; @@ -316,7 +316,7 @@ void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_Cooldown(EnSb* this, GlobalContext* globalCtx) { +void EnSb_Cooldown(EnSb* this, PlayState* play) { if (this->timer != 0) { this->timer--; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { @@ -363,7 +363,7 @@ s32 EnSb_IsVulnerable(EnSb* this) { return false; } -s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { +s32 EnSb_UpdateDamage(EnSb* this, PlayState* play) { Vec3f hitPoint; f32 hitY; s16 yawDiff; @@ -420,10 +420,10 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { } if (this->actor.colChkInfo.health == 0) { this->hitByWindArrow = hitByWindArrow; - BodyBreak_Alloc(&this->bodyBreak, 8, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 8, play); this->isDead = true; - Enemy_StartFinishingBlow(globalCtx, &this->actor); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_SHELL_DEAD); + Enemy_StartFinishingBlow(play, &this->actor); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_SHELL_DEAD); return 1; } @@ -432,14 +432,14 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { hitPoint.x = this->collider.info.bumper.hitPos.x; hitPoint.y = this->collider.info.bumper.hitPos.y; hitPoint.z = this->collider.info.bumper.hitPos.z; - CollisionCheck_SpawnShieldParticlesMetal2(globalCtx, &hitPoint); + CollisionCheck_SpawnShieldParticlesMetal2(play, &hitPoint); } } return 0; } -void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSb_Update(Actor* thisx, PlayState* play) { EnSb* this = (EnSb*)thisx; s32 pad; @@ -449,11 +449,11 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { } else { this->actor.params = 1; } - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params)) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, this->actor.params)) { if (!this->hitByWindArrow) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x80); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x80); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_ARROWS_SMALL); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_SMALL); } Actor_Kill(&this->actor); } @@ -461,33 +461,32 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 20.0f); Actor_SetScale(&this->actor, 0.006f); Actor_MoveForward(&this->actor); - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - EnSb_UpdateDamage(this, globalCtx); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + EnSb_UpdateDamage(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); } } -void EnSb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnSb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSb* this = (EnSb*)thisx; BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 6, 8, dList, BODYBREAK_OBJECT_DEFAULT); } -void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSb_Draw(Actor* thisx, PlayState* play) { EnSb* this = (EnSb*)thisx; Vec3f flamePos; Vec3f* offset; s16 fireDecr; - func_8002EBCC(&this->actor, globalCtx, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnSb_PostLimbDraw, this); + func_8002EBCC(&this->actor, play, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnSb_PostLimbDraw, this); if (this->fire != 0) { this->actor.colorFilterTimer++; fireDecr = this->fire - 1; @@ -498,7 +497,7 @@ void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx) { flamePos.x = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.x + offset->x); flamePos.y = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.y + offset->y); flamePos.z = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.z + offset->z); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, 100, 0, 0, -1); } } } diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.h b/src/overlays/actors/ovl_En_Sb/z_en_sb.h index 587474395f..a6dbd2cdf8 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.h +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.h @@ -6,7 +6,7 @@ struct EnSb; -typedef void (*EnSbActionFunc)(struct EnSb*, GlobalContext*); +typedef void (*EnSbActionFunc)(struct EnSb*, PlayState*); typedef struct EnSb { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c index 6b4f4d2e36..84df4562fd 100644 --- a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c +++ b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c @@ -8,12 +8,12 @@ #define FLAGS 0 -void EnSceneChange_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSceneChange_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSceneChange_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSceneChange_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSceneChange_Init(Actor* thisx, PlayState* play); +void EnSceneChange_Destroy(Actor* thisx, PlayState* play); +void EnSceneChange_Update(Actor* thisx, PlayState* play); +void EnSceneChange_Draw(Actor* thisx, PlayState* play); -void EnSceneChange_DoNothing(EnSceneChange* this, GlobalContext* globalCtx); +void EnSceneChange_DoNothing(EnSceneChange* this, PlayState* play); const ActorInit En_Scene_Change_InitVars = { ACTOR_EN_SCENE_CHANGE, @@ -31,38 +31,38 @@ void EnSceneChange_SetupAction(EnSceneChange* this, EnSceneChangeActionFunc acti this->actionFunc = actionFunc; } -void EnSceneChange_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSceneChange_Init(Actor* thisx, PlayState* play) { EnSceneChange* this = (EnSceneChange*)thisx; EnSceneChange_SetupAction(this, EnSceneChange_DoNothing); } -void EnSceneChange_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSceneChange_Destroy(Actor* thisx, PlayState* play) { } -void EnSceneChange_DoNothing(EnSceneChange* this, GlobalContext* globalCtx) { +void EnSceneChange_DoNothing(EnSceneChange* this, PlayState* play) { } -void EnSceneChange_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSceneChange_Update(Actor* thisx, PlayState* play) { EnSceneChange* this = (EnSceneChange*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnSceneChange_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSceneChange_Draw(Actor* thisx, PlayState* play) { s32 pad[2]; Gfx* displayList; s32 pad2[2]; Gfx* displayListHead; - displayList = Graph_Alloc(globalCtx->state.gfxCtx, 0x3C0); + displayList = Graph_Alloc(play->state.gfxCtx, 0x3C0); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_scene_change.c", 290); + OPEN_DISPS(play->state.gfxCtx, "../z_en_scene_change.c", 290); displayListHead = displayList; gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_scene_change.c", 386); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_scene_change.c", 386); } diff --git a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h index d0b53e008d..4add7d11ee 100644 --- a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h +++ b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h @@ -6,7 +6,7 @@ struct EnSceneChange; -typedef void (*EnSceneChangeActionFunc)(struct EnSceneChange*, GlobalContext*); +typedef void (*EnSceneChangeActionFunc)(struct EnSceneChange*, PlayState*); typedef struct EnSceneChange { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Sda/z_en_sda.c b/src/overlays/actors/ovl_En_Sda/z_en_sda.c index c1781f3ddc..c7845ef563 100644 --- a/src/overlays/actors/ovl_En_Sda/z_en_sda.c +++ b/src/overlays/actors/ovl_En_Sda/z_en_sda.c @@ -8,13 +8,13 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnSda_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSda_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSda_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSda_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSda_Init(Actor* thisx, PlayState* play); +void EnSda_Destroy(Actor* thisx, PlayState* play); +void EnSda_Update(Actor* thisx, PlayState* play); +void EnSda_Draw(Actor* thisx, PlayState* play); -void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, GlobalContext* globalCtx); -void func_80AF9C70(u8* shadowTexture, Player* player, GlobalContext* globalCtx); +void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, PlayState* play); +void func_80AF9C70(u8* shadowTexture, Player* player, PlayState* play); void func_80AF8F60(Player* player, u8* shadowTexture, f32 arg2); const ActorInit En_Sda_InitVars = { @@ -88,13 +88,13 @@ static u32 D_80AFA390[] = { 0, 0 }; static Vec3f D_80AFA660[16]; -void EnSda_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSda_Init(Actor* thisx, PlayState* play) { } -void EnSda_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSda_Destroy(Actor* thisx, PlayState* play) { } -void EnSda_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSda_Update(Actor* thisx, PlayState* play) { s32 pad; EnSda* this = (EnSda*)thisx; Player* player; @@ -104,7 +104,7 @@ void EnSda_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == 1) { player = (Player*)this->actor.parent; } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); } this->actor.world.pos = player->actor.world.pos; @@ -112,24 +112,24 @@ void EnSda_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("SDA MOVE END\n"); } -void EnSda_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSda_Draw(Actor* thisx, PlayState* play) { EnSda* this = (EnSda*)thisx; Player* player; - u8* shadowTexture = Graph_Alloc(globalCtx->state.gfxCtx, 0x1000); + u8* shadowTexture = Graph_Alloc(play->state.gfxCtx, 0x1000); osSyncPrintf("SDA DRAW \n"); if (this->actor.params == 1) { player = (Player*)this->actor.parent; } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); } player->actor.shape.shadowAlpha = 0; - func_80AF95C4(this, shadowTexture, player, globalCtx); + func_80AF95C4(this, shadowTexture, player, play); if (KREG(0) < 5) { - func_80AF9C70(shadowTexture, player, globalCtx); + func_80AF9C70(shadowTexture, player, play); } osSyncPrintf("SDA DRAW END\n"); @@ -234,7 +234,7 @@ void func_80AF8F60(Player* player, u8* shadowTexture, f32 arg2) { } } -void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, GlobalContext* globalCtx) { +void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, PlayState* play) { s16 temp_t0; s16 temp_t1; s16 temp_v0; @@ -332,17 +332,17 @@ void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, GlobalContext osSyncPrintf("SDA CONT 4\n"); } -void func_80AF9C70(u8* shadowTexture, Player* player, GlobalContext* globalCtx) { +void func_80AF9C70(u8* shadowTexture, Player* player, PlayState* play) { s32 pad; f32 tempx; f32 tempz; s16 phi_s1; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_en_sda.c", 826); osSyncPrintf("SDA D 1\n"); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 0, 0, 0, (BREG(52) + 50)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); Matrix_Translate(player->actor.world.pos.x, player->actor.floorHeight, player->actor.world.pos.z, MTXMODE_NEW); @@ -353,7 +353,7 @@ void func_80AF9C70(u8* shadowTexture, Player* player, GlobalContext* globalCtx) 20.0f; Matrix_Translate(tempx, 0.0f, tempz, MTXMODE_APPLY); Matrix_Scale(((BREG(56) - 250) / 1000.0f) + 0.6f, 1.0f, ((BREG(59) - 250) / 1000.0f) + 0.6f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_sda.c", 860), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_sda.c", 860), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_80AFA3D8); gDPLoadTextureBlock(POLY_XLU_DISP++, shadowTexture, G_IM_FMT_I, G_IM_SIZ_8b, 0x40, 0x40, 0, @@ -362,7 +362,7 @@ void func_80AF9C70(u8* shadowTexture, Player* player, GlobalContext* globalCtx) for (phi_s1 = 0; phi_s1 < KREG(78); phi_s1++) { Matrix_Scale((KREG(79) / 100.0f) + 1.0f, 1.0f, (KREG(79) / 100.0f) + 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_sda.c", 877), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_sda.c", 877), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_80AFA3F8); } diff --git a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c index 973023d47f..ea3dfa2b07 100644 --- a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c +++ b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c @@ -3,18 +3,18 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnShopnuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnShopnuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnShopnuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnShopnuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnShopnuts_Init(Actor* thisx, PlayState* play); +void EnShopnuts_Destroy(Actor* thisx, PlayState* play); +void EnShopnuts_Update(Actor* thisx, PlayState* play); +void EnShopnuts_Draw(Actor* thisx, PlayState* play); void EnShopnuts_SetupWait(EnShopnuts* this); -void EnShopnuts_Wait(EnShopnuts* this, GlobalContext* globalCtx); -void EnShopnuts_LookAround(EnShopnuts* this, GlobalContext* globalCtx); -void EnShopnuts_Stand(EnShopnuts* this, GlobalContext* globalCtx); -void EnShopnuts_ThrowNut(EnShopnuts* this, GlobalContext* globalCtx); -void EnShopnuts_Burrow(EnShopnuts* this, GlobalContext* globalCtx); -void EnShopnuts_SpawnSalesman(EnShopnuts* this, GlobalContext* globalCtx); +void EnShopnuts_Wait(EnShopnuts* this, PlayState* play); +void EnShopnuts_LookAround(EnShopnuts* this, PlayState* play); +void EnShopnuts_Stand(EnShopnuts* this, PlayState* play); +void EnShopnuts_ThrowNut(EnShopnuts* this, PlayState* play); +void EnShopnuts_Burrow(EnShopnuts* this, PlayState* play); +void EnShopnuts_SpawnSalesman(EnShopnuts* this, PlayState* play); const ActorInit En_Shopnuts_InitVars = { ACTOR_EN_SHOPNUTS, @@ -56,15 +56,15 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2600, ICHAIN_STOP), }; -void EnShopnuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnShopnuts_Init(Actor* thisx, PlayState* play) { EnShopnuts* this = (EnShopnuts*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubAnim_4574, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubAnim_4574, this->jointTable, this->morphTable, 18); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Collider_UpdateCylinder(&this->actor, &this->collider); @@ -77,10 +77,10 @@ void EnShopnuts_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnShopnuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnShopnuts_Destroy(Actor* thisx, PlayState* play) { EnShopnuts* this = (EnShopnuts*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnShopnuts_SetupWait(EnShopnuts* this) { @@ -125,7 +125,7 @@ void EnShopnuts_SetupSpawnSalesman(EnShopnuts* this) { this->actionFunc = EnShopnuts_SpawnSalesman; } -void EnShopnuts_Wait(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_Wait(EnShopnuts* this, PlayState* play) { s32 hasSlowPlaybackSpeed = false; if (this->skelAnime.playSpeed < 0.5f) { @@ -159,7 +159,7 @@ void EnShopnuts_Wait(EnShopnuts* this, GlobalContext* globalCtx) { } } -void EnShopnuts_LookAround(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_LookAround(EnShopnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; @@ -169,7 +169,7 @@ void EnShopnuts_LookAround(EnShopnuts* this, GlobalContext* globalCtx) { } } -void EnShopnuts_Stand(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_Stand(EnShopnuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) { this->animFlagAndTimer--; @@ -184,7 +184,7 @@ void EnShopnuts_Stand(EnShopnuts* this, GlobalContext* globalCtx) { } } -void EnShopnuts_ThrowNut(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_ThrowNut(EnShopnuts* this, PlayState* play) { Vec3f spawnPos; Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); @@ -196,14 +196,14 @@ void EnShopnuts_ThrowNut(EnShopnuts* this, GlobalContext* globalCtx) { spawnPos.x = this->actor.world.pos.x + (Math_SinS(this->actor.shape.rot.y) * 23.0f); spawnPos.y = this->actor.world.pos.y + 12.0f; spawnPos.z = this->actor.world.pos.z + (Math_CosS(this->actor.shape.rot.y) * 23.0f); - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NUTSBALL, spawnPos.x, spawnPos.y, spawnPos.z, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, spawnPos.x, spawnPos.y, spawnPos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 2) != NULL) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW); } } } -void EnShopnuts_Burrow(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_Burrow(EnShopnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnShopnuts_SetupWait(this); } else { @@ -214,9 +214,9 @@ void EnShopnuts_Burrow(EnShopnuts* this, GlobalContext* globalCtx) { } } -void EnShopnuts_SpawnSalesman(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_SpawnSalesman(EnShopnuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_DNS, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DNS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, this->actor.params); Actor_Kill(&this->actor); @@ -225,27 +225,27 @@ void EnShopnuts_SpawnSalesman(EnShopnuts* this, GlobalContext* globalCtx) { } } -void EnShopnuts_ColliderCheck(EnShopnuts* this, GlobalContext* globalCtx) { +void EnShopnuts_ColliderCheck(EnShopnuts* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, true); EnShopnuts_SetupSpawnSalesman(this); - } else if (globalCtx->actorCtx.unk_02 != 0) { + } else if (play->actorCtx.unk_02 != 0) { EnShopnuts_SetupSpawnSalesman(this); } } -void EnShopnuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnShopnuts_Update(Actor* thisx, PlayState* play) { EnShopnuts* this = (EnShopnuts*)thisx; - EnShopnuts_ColliderCheck(this, globalCtx); - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, + EnShopnuts_ColliderCheck(this, play); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, UPDBGCHECKINFO_FLAG_2); if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actionFunc == EnShopnuts_Wait) { Actor_SetFocus(&this->actor, this->skelAnime.curFrame); } else if (this->actionFunc == EnShopnuts_Burrow) { @@ -256,8 +256,7 @@ void EnShopnuts_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnShopnuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnShopnuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnShopnuts* this = (EnShopnuts*)thisx; if ((limbIndex == 9) && (this->actionFunc == EnShopnuts_ThrowNut)) { @@ -266,7 +265,7 @@ s32 EnShopnuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return 0; } -void EnShopnuts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnShopnuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnShopnuts* this = (EnShopnuts*)thisx; f32 curFrame; @@ -275,7 +274,7 @@ void EnShopnuts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis f32 z; if ((limbIndex == 9) && (this->actionFunc == EnShopnuts_ThrowNut)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_shopnuts.c", 682); + OPEN_DISPS(play->state.gfxCtx, "../z_en_shopnuts.c", 682); curFrame = this->skelAnime.curFrame; if (curFrame <= 6.0f) { y = 1.0f - (curFrame * 0.0833f); @@ -293,16 +292,16 @@ void EnShopnuts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis Matrix_Scale(x, y, z, MTXMODE_APPLY); if (1) {} - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_shopnuts.c", 714), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_shopnuts.c", 714), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBusinessScrubNoseDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_shopnuts.c", 717); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_shopnuts.c", 717); } } -void EnShopnuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnShopnuts_Draw(Actor* thisx, PlayState* play) { EnShopnuts* this = (EnShopnuts*)thisx; - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnShopnuts_OverrideLimbDraw, EnShopnuts_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h index 0b314e0cf9..6ebfeabf3e 100644 --- a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h +++ b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h @@ -6,7 +6,7 @@ struct EnShopnuts; -typedef void (*EnShopnutsActionFunc)(struct EnShopnuts*, GlobalContext*); +typedef void (*EnShopnutsActionFunc)(struct EnShopnuts*, PlayState*); typedef struct EnShopnuts { /* 0x0000 */ Actor actor; 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 6f12459900..e73a9de021 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -8,15 +8,15 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_9) -void EnSi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSi_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSi_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSi_Init(Actor* thisx, PlayState* play); +void EnSi_Destroy(Actor* thisx, PlayState* play); +void EnSi_Update(Actor* thisx, PlayState* play); +void EnSi_Draw(Actor* thisx, PlayState* play); -s32 func_80AFB748(EnSi* this, GlobalContext* globalCtx); -void func_80AFB768(EnSi* this, GlobalContext* globalCtx); -void func_80AFB89C(EnSi* this, GlobalContext* globalCtx); -void func_80AFB950(EnSi* this, GlobalContext* globalCtx); +s32 func_80AFB748(EnSi* this, PlayState* play); +void func_80AFB768(EnSi* this, PlayState* play); +void func_80AFB89C(EnSi* this, PlayState* play); +void func_80AFB950(EnSi* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -52,11 +52,11 @@ const ActorInit En_Si_InitVars = { (ActorFunc)EnSi_Draw, }; -void EnSi_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSi_Init(Actor* thisx, PlayState* play) { EnSi* this = (EnSi*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AFBADC); Actor_SetScale(&this->actor, 0.025f); this->unk_19C = 0; @@ -64,21 +64,21 @@ void EnSi_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 42.0f; } -void EnSi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSi_Destroy(Actor* thisx, PlayState* play) { EnSi* this = (EnSi*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80AFB748(EnSi* this, GlobalContext* globalCtx) { +s32 func_80AFB748(EnSi* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; } return 0; } -void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AFB768(EnSi* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { this->actionFunc = func_80AFB89C; @@ -87,45 +87,45 @@ void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.scale.x); this->actor.shape.rot.y += 0x400; - if (!Player_InCsMode(globalCtx)) { - func_80AFB748(this, globalCtx); + if (!Player_InCsMode(play)) { + func_80AFB748(this, play); if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; - Item_Give(globalCtx, ITEM_SKULL_TOKEN); + Item_Give(play, ITEM_SKULL_TOKEN); player->actor.freezeTimer = 10; - Message_StartTextbox(globalCtx, 0xB4, NULL); + Message_StartTextbox(play, 0xB4, NULL); Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); this->actionFunc = func_80AFB950; } else { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } } -void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AFB89C(EnSi* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.scale.x, 0.25f, 0.4f, 1.0f, 0.0f); Actor_SetScale(&this->actor, this->actor.scale.x); this->actor.shape.rot.y += 0x400; if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { - Item_Give(globalCtx, ITEM_SKULL_TOKEN); + Item_Give(play, ITEM_SKULL_TOKEN); player->actor.freezeTimer = 10; - Message_StartTextbox(globalCtx, 0xB4, NULL); + Message_StartTextbox(play, 0xB4, NULL); Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); this->actionFunc = func_80AFB950; } } -void func_80AFB950(EnSi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AFB950(EnSi* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_CLOSING) { player->actor.freezeTimer = 10; } else { SET_GS_FLAGS((this->actor.params & 0x1F00) >> 8, this->actor.params & 0xFF); @@ -133,21 +133,21 @@ void func_80AFB950(EnSi* this, GlobalContext* globalCtx) { } } -void EnSi_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSi_Update(Actor* thisx, PlayState* play) { EnSi* this = (EnSi*)thisx; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 16.0f); } -void EnSi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSi_Draw(Actor* thisx, PlayState* play) { EnSi* this = (EnSi*)thisx; if (this->actionFunc != func_80AFB950) { - func_8002ED80(&this->actor, globalCtx, 0); - func_8002EBCC(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, GID_SKULL_TOKEN_2); + func_8002ED80(&this->actor, play, 0); + func_8002EBCC(&this->actor, play, 0); + GetItem_Draw(play, GID_SKULL_TOKEN_2); } } diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.h b/src/overlays/actors/ovl_En_Si/z_en_si.h index b6dec1237c..b52e831a30 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.h +++ b/src/overlays/actors/ovl_En_Si/z_en_si.h @@ -6,7 +6,7 @@ struct EnSi; -typedef void (*EnSiActionFunc)(struct EnSi*, GlobalContext*); +typedef void (*EnSiActionFunc)(struct EnSi*, PlayState*); typedef struct EnSi { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c index 4846016b5e..99661b7021 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnSiofuki_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSiofuki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSiofuki_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSiofuki_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSiofuki_Init(Actor* thisx, PlayState* play); +void EnSiofuki_Destroy(Actor* thisx, PlayState* play); +void EnSiofuki_Update(Actor* thisx, PlayState* play); +void EnSiofuki_Draw(Actor* thisx, PlayState* play); -void func_80AFC34C(EnSiofuki* this, GlobalContext* globalCtx); -void func_80AFC544(EnSiofuki* this, GlobalContext* globalCtx); -void func_80AFC478(EnSiofuki* this, GlobalContext* globalCtx); +void func_80AFC34C(EnSiofuki* this, PlayState* play); +void func_80AFC544(EnSiofuki* this, PlayState* play); +void func_80AFC478(EnSiofuki* this, PlayState* play); const ActorInit En_Siofuki_InitVars = { ACTOR_EN_SIOFUKI, @@ -34,13 +34,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void EnSiofuki_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSiofuki_Init(Actor* thisx, PlayState* play) { EnSiofuki* this = (EnSiofuki*)thisx; s32 type; CollisionHeader* colHeader = NULL; s32 pad; - if ((thisx->room == 10) && Flags_GetSwitch(globalCtx, 0x1E)) { + if ((thisx->room == 10) && Flags_GetSwitch(play, 0x1E)) { Actor_Kill(thisx); return; } @@ -48,7 +48,7 @@ void EnSiofuki_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&object_siofuki_Col_000D78, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->sfxFlags |= 1; type = ((u16)thisx->params >> 0xC) & 0xF; @@ -87,7 +87,7 @@ void EnSiofuki_Init(Actor* thisx, GlobalContext* globalCtx) { this->targetHeight = 10.0f; this->actionFunc = func_80AFC34C; } else if (type == EN_SIOFUKI_LOWERING) { - if (Flags_GetTreasure(globalCtx, (u16)thisx->params & 0x3F)) { + if (Flags_GetTreasure(play, (u16)thisx->params & 0x3F)) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; this->actionFunc = func_80AFC544; @@ -98,21 +98,21 @@ void EnSiofuki_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnSiofuki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSiofuki_Destroy(Actor* thisx, PlayState* play) { EnSiofuki* this = (EnSiofuki*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80AFBDC8(EnSiofuki* this, GlobalContext* globalCtx) { - this->oscillation = sinf((globalCtx->gameplayFrames & 0x1F) / 32.0f * M_PI * 2.0f) * 4.0f; +void func_80AFBDC8(EnSiofuki* this, PlayState* play) { + this->oscillation = sinf((play->gameplayFrames & 0x1F) / 32.0f * M_PI * 2.0f) * 4.0f; this->unk_170 = this->unk_174 * 10.0f + -6058.0f - this->oscillation * 10.0f; this->unk_174 = 35.0f; this->dyna.actor.world.pos.y = this->initPosY + this->currentHeight + this->oscillation; } -void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AFBE8C(EnSiofuki* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 dX; f32 dY; f32 dZ; @@ -129,7 +129,7 @@ void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) { (dZ > (this->dyna.actor.scale.z * -400.0f)) && (dZ < (this->dyna.actor.scale.z * 400.0f)) && (dY < 0.0f)) { if (func_8004356C(&this->dyna)) { if (this->splashTimer <= 0) { - EffectSsGSplash_Spawn(globalCtx, &player->actor.world.pos, NULL, NULL, 1, 1); + EffectSsGSplash_Spawn(play, &player->actor.world.pos, NULL, NULL, 1, 1); this->splashTimer = 10; } else { this->splashTimer--; @@ -178,18 +178,18 @@ void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) { } } -void func_80AFC1D0(EnSiofuki* this, GlobalContext* globalCtx) { +void func_80AFC1D0(EnSiofuki* this, PlayState* play) { Math_SmoothStepToF(&this->currentHeight, this->targetHeight, 0.8f, 3.0f, 0.01f); } -void func_80AFC218(EnSiofuki* this, GlobalContext* globalCtx) { - func_80AFBDC8(this, globalCtx); - func_80AFBE8C(this, globalCtx); - func_80AFC1D0(this, globalCtx); +void func_80AFC218(EnSiofuki* this, PlayState* play) { + func_80AFBDC8(this, play); + func_80AFBE8C(this, play); + func_80AFC1D0(this, play); this->timer--; if (this->timer < 0) { - Flags_UnsetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 6) & 0x3F); + Flags_UnsetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F); switch (((u16)this->dyna.actor.params >> 0xC) & 0xF) { case EN_SIOFUKI_RAISING: this->targetHeight = 10.0f; @@ -205,30 +205,30 @@ void func_80AFC218(EnSiofuki* this, GlobalContext* globalCtx) { } if (((((u16)this->dyna.actor.params >> 0xC) & 0xF) == EN_SIOFUKI_LOWERING) && - Flags_GetTreasure(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { + Flags_GetTreasure(play, (u16)this->dyna.actor.params & 0x3F)) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; - Flags_UnsetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 6) & 0x3F); + Flags_UnsetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F); this->actionFunc = func_80AFC544; } } -void func_80AFC34C(EnSiofuki* this, GlobalContext* globalCtx) { - func_80AFBDC8(this, globalCtx); - func_80AFBE8C(this, globalCtx); - func_80AFC1D0(this, globalCtx); +void func_80AFC34C(EnSiofuki* this, PlayState* play) { + func_80AFBDC8(this, play); + func_80AFBE8C(this, play); + func_80AFC1D0(this, play); - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 6) & 0x3F)) { + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F)) { this->targetHeight = 400.0f; this->timer = 300; this->actionFunc = func_80AFC218; } } -void func_80AFC3C8(EnSiofuki* this, GlobalContext* globalCtx) { - func_80AFBDC8(this, globalCtx); - func_80AFBE8C(this, globalCtx); - func_80AFC1D0(this, globalCtx); +void func_80AFC3C8(EnSiofuki* this, PlayState* play) { + func_80AFBDC8(this, play); + func_80AFBE8C(this, play); + func_80AFC1D0(this, play); this->timer--; if (this->timer < 0) { @@ -237,26 +237,26 @@ void func_80AFC3C8(EnSiofuki* this, GlobalContext* globalCtx) { this->actionFunc = func_80AFC218; } - if (Flags_GetTreasure(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { + if (Flags_GetTreasure(play, (u16)this->dyna.actor.params & 0x3F)) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; this->actionFunc = func_80AFC544; } } -void func_80AFC478(EnSiofuki* this, GlobalContext* globalCtx) { - func_80AFBDC8(this, globalCtx); - func_80AFBE8C(this, globalCtx); - func_80AFC1D0(this, globalCtx); +void func_80AFC478(EnSiofuki* this, PlayState* play) { + func_80AFBDC8(this, play); + func_80AFBE8C(this, play); + func_80AFC1D0(this, play); if (((u16)this->dyna.actor.params >> 0xC & 0xF) == EN_SIOFUKI_LOWERING) { - if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 6) & 0x3F)) { + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F)) { this->timer = 20; this->actionFunc = func_80AFC3C8; - OnePointCutscene_Init(globalCtx, 5010, 40, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 5010, 40, &this->dyna.actor, CAM_ID_MAIN); } - if (Flags_GetTreasure(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { + if (Flags_GetTreasure(play, (u16)this->dyna.actor.params & 0x3F)) { this->currentHeight = -45.0f; this->targetHeight = -45.0f; this->actionFunc = func_80AFC544; @@ -264,34 +264,34 @@ void func_80AFC478(EnSiofuki* this, GlobalContext* globalCtx) { } } -void func_80AFC544(EnSiofuki* this, GlobalContext* globalCtx) { - func_80AFBDC8(this, globalCtx); - func_80AFC1D0(this, globalCtx); +void func_80AFC544(EnSiofuki* this, PlayState* play) { + func_80AFBDC8(this, play); + func_80AFC1D0(this, play); } -void EnSiofuki_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSiofuki_Update(Actor* thisx, PlayState* play) { EnSiofuki* this = (EnSiofuki*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnSiofuki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSiofuki_Draw(Actor* thisx, PlayState* play) { EnSiofuki* this = (EnSiofuki*)thisx; u32 x; u32 y; - u32 gameplayFrames = globalCtx->gameplayFrames; + u32 gameplayFrames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_siofuki.c", 654); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_siofuki.c", 654); + func_80093D84(play->state.gfxCtx); Matrix_Translate(0.0f, this->unk_170, 0.0f, MTXMODE_APPLY); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_siofuki.c", 662), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_siofuki.c", 662), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); x = gameplayFrames * 15; y = gameplayFrames * -15; - gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, x, y, 64, 64, 1, x, y, 64, 64)); + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, x, y, 64, 64, 1, x, y, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, object_siofuki_DL_000B70); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_siofuki.c", 674); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_siofuki.c", 674); if (this->sfxFlags & 1) { f32 heightRatio; diff --git a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h index 32bad16b76..b291c5cd2a 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h @@ -11,7 +11,7 @@ typedef enum { struct EnSiofuki; -typedef void (*EnSiofukiActionFunc)(struct EnSiofuki*, GlobalContext*); +typedef void (*EnSiofukiActionFunc)(struct EnSiofuki*, PlayState*); typedef struct EnSiofuki { /* 0x0000 */ DynaPolyActor dyna; 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 c3eb4d76c8..d2527b0f52 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -4,28 +4,28 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSkb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSkb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSkb_Init(Actor* thisx, PlayState* play); +void EnSkb_Destroy(Actor* thisx, PlayState* play); +void EnSkb_Update(Actor* thisx, PlayState* play); +void EnSkb_Draw(Actor* thisx, PlayState* play); void func_80AFCD60(EnSkb* this); void func_80AFCDF8(EnSkb* this); -void func_80AFCE5C(EnSkb* this, GlobalContext* globalCtx); +void func_80AFCE5C(EnSkb* this, PlayState* play); void func_80AFCF48(EnSkb* this); -void func_80AFCFF0(EnSkb* this, GlobalContext* globalCtx); +void func_80AFCFF0(EnSkb* this, PlayState* play); void func_80AFD0A4(EnSkb* this); -void EnSkb_Advance(EnSkb* this, GlobalContext* globalCtx); +void EnSkb_Advance(EnSkb* this, PlayState* play); void func_80AFD33C(EnSkb* this); -void EnSkb_SetupAttack(EnSkb* this, GlobalContext* globalCtx); +void EnSkb_SetupAttack(EnSkb* this, PlayState* play); void func_80AFD47C(EnSkb* this); -void func_80AFD508(EnSkb* this, GlobalContext* globalCtx); +void func_80AFD508(EnSkb* this, PlayState* play); void EnSkb_SetupStunned(EnSkb* this); -void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx); -void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx); -void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx); -void func_80AFD880(EnSkb* this, GlobalContext* globalCtx); -void func_80AFD968(EnSkb* this, GlobalContext* globalCtx); +void func_80AFD59C(EnSkb* this, PlayState* play); +void func_80AFD6CC(EnSkb* this, PlayState* play); +void func_80AFD7B4(EnSkb* this, PlayState* play); +void func_80AFD880(EnSkb* this, PlayState* play); +void func_80AFD968(EnSkb* this, PlayState* play); static ColliderJntSphElementInit sJntSphElementsInit[2] = { { @@ -116,7 +116,7 @@ void EnSkb_SetupAction(EnSkb* this, EnSkbActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnSkb_SpawnDebris(GlobalContext* globalCtx, EnSkb* this, Vec3f* spawnPos) { +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 }; @@ -131,8 +131,8 @@ void EnSkb_SpawnDebris(GlobalContext* globalCtx, EnSkb* this, Vec3f* spawnPos) { accel.z = Rand_CenteredFloat(1.0f); vel.y += (Rand_ZeroOne() - 0.5f) * 4.0f; scale = (Rand_ZeroOne() * 5.0f) + 12.0f; - EffectSsHahen_Spawn(globalCtx, &pos, &vel, &accel, 2, scale * 0.8f, -1, 10, 0); - func_80033480(globalCtx, &pos, 10.0f, 1, 150, 0, 1); + EffectSsHahen_Spawn(play, &pos, &vel, &accel, 2, scale * 0.8f, -1, 10, 0); + func_80033480(play, &pos, 10.0f, 1, 150, 0, 1); } static InitChainEntry sInitChain[] = { @@ -140,7 +140,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; -void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSkb_Init(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; s16 paramOffsetBody; s16 paramOffsetArm; @@ -152,12 +152,12 @@ void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = 0xFE; this->actor.colChkInfo.health = 2; this->actor.shape.yOffset = -8000.0f; - SkelAnime_Init(globalCtx, &this->skelAnime, &gStalchildSkel, &gStalchildUncurlingAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildUncurlingAnim, this->jointTable, this->morphTable, 20); this->actor.naviEnemyId = NAVI_ENEMY_STALCHILD; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItem); Actor_SetScale(&this->actor, ((this->actor.params * 0.1f) + 1.0f) * 0.01f); paramOffsetBody = this->actor.params + 0xA; @@ -172,7 +172,7 @@ void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) { func_80AFCDF8(this); } -void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSkb_Destroy(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; if (this->actor.parent != NULL) { @@ -184,7 +184,7 @@ void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } } - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_80AFCD60(EnSkb* this) { @@ -206,7 +206,7 @@ void func_80AFCDF8(EnSkb* this) { EnSkb_SetupAction(this, func_80AFCE5C); } -void func_80AFCE5C(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFCE5C(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; @@ -215,8 +215,8 @@ void func_80AFCE5C(EnSkb* this, GlobalContext* globalCtx) { } 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 ((globalCtx->gameplayFrames & 1) != 0) { - EnSkb_SpawnDebris(globalCtx, this, &this->actor.world.pos); + if ((play->gameplayFrames & 1) != 0) { + EnSkb_SpawnDebris(play, this, &this->actor.world.pos); } if ((SkelAnime_Update(&this->skelAnime) != 0) && (0.0f == this->actor.shape.yOffset)) { func_80AFCD60(this); @@ -234,10 +234,10 @@ void func_80AFCF48(EnSkb* this) { EnSkb_SetupAction(this, func_80AFCFF0); } -void func_80AFCFF0(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFCFF0(EnSkb* this, PlayState* play) { if ((Math_SmoothStepToF(&this->actor.shape.yOffset, -8000.0f, 1.0f, 500.0f, 0.0f) != 0.0f) && - (globalCtx->gameplayFrames & 1)) { - EnSkb_SpawnDebris(globalCtx, this, &this->actor.world.pos); + (play->gameplayFrames & 1)) { + EnSkb_SpawnDebris(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) != 0) { @@ -254,13 +254,13 @@ void func_80AFD0A4(EnSkb* this) { EnSkb_SetupAction(this, EnSkb_Advance); } -void EnSkb_Advance(EnSkb* this, GlobalContext* globalCtx) { +void EnSkb_Advance(EnSkb* this, PlayState* play) { s32 thisKeyFrame; s32 prevKeyFrame; f32 playSpeed; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if ((this->unk_283 != 0) && ((globalCtx->gameplayFrames & 0xF) == 0)) { + if ((this->unk_283 != 0) && ((play->gameplayFrames & 0xF) == 0)) { this->unk_288 = Rand_CenteredFloat(50000.0f); } Math_SmoothStepToS(&this->actor.shape.rot.y, (this->actor.yawTowardsPlayer + this->unk_288), 1, 0x2EE, 0); @@ -302,7 +302,7 @@ void func_80AFD33C(EnSkb* this) { EnSkb_SetupAction(this, EnSkb_SetupAttack); } -void EnSkb_SetupAttack(EnSkb* this, GlobalContext* globalCtx) { +void EnSkb_SetupAttack(EnSkb* this, PlayState* play) { s32 frameData; frameData = this->skelAnime.curFrame; @@ -329,7 +329,7 @@ void func_80AFD47C(EnSkb* this) { EnSkb_SetupAction(this, func_80AFD508); } -void func_80AFD508(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFD508(EnSkb* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { func_80AFCD60(this); } @@ -345,7 +345,7 @@ void EnSkb_SetupStunned(EnSkb* this) { EnSkb_SetupAction(this, func_80AFD59C); } -void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFD59C(EnSkb* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } @@ -356,7 +356,7 @@ void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx) { } if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { - func_80AFD7B4(this, globalCtx); + func_80AFD7B4(this, play); } else { func_80AFCD60(this); } @@ -374,12 +374,12 @@ void func_80AFD644(EnSkb* this) { EnSkb_SetupAction(this, func_80AFD6CC); } -void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFD6CC(EnSkb* this, PlayState* play) { // this cast is likely not real, but allows for a match u8* new_var; new_var = &this->unk_283; - if ((this->unk_283 != 1) || BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, 1)) { + if ((this->unk_283 != 1) || BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, 1)) { if ((*new_var) != 0) { this->unk_283 = (*new_var) | 2; } @@ -399,7 +399,7 @@ void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx) { } } -void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFD7B4(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; @@ -408,22 +408,22 @@ void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx) { } this->unk_280 = 1; this->actor.flags &= ~ACTOR_FLAG_0; - BodyBreak_Alloc(&this->bodyBreak, 18, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 18, play); this->unk_283 |= 4; - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_STALKID_DEAD, 1, 1, 0x28); + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_STALKID_DEAD, 1, 1, 0x28); EnSkb_SetupAction(this, func_80AFD880); } -void func_80AFD880(EnSkb* this, GlobalContext* globalCtx) { - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, 1)) { +void func_80AFD880(EnSkb* this, PlayState* play) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, 1)) { if (this->actor.scale.x == 0.01f) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x10); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x10); } else if (this->actor.scale.x <= 0.015f) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_BLUE); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_BLUE); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); - Item_DropCollectible(globalCtx, &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, ITEM00_RUPEE_RED); } this->unk_283 |= 8; @@ -431,7 +431,7 @@ void func_80AFD880(EnSkb* this, GlobalContext* globalCtx) { } } -void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { +void func_80AFD968(EnSkb* this, PlayState* play) { s16 pad; s32 i; Vec3f flamePos; @@ -443,7 +443,7 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { (this->actor.yDistToWater >= 40.0f)) { this->actor.colChkInfo.health = 0; this->unk_281 = 0; - func_80AFD7B4(this, globalCtx); + func_80AFD7B4(this, play); } else if (this->unk_280 >= 3) { if ((this->collider.base.acFlags & 2) != 0) { this->collider.base.acFlags &= ~2; @@ -466,16 +466,16 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { flamePos.x += Rand_CenteredFloat(20.0f); flamePos.z += Rand_CenteredFloat(20.0f); flamePos.y += (Rand_ZeroOne() * 25.0f); - EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, scale, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, scale, 0, 0, -1); } phi_v1 = 25; } Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, phi_v1); if (!Actor_ApplyDamage(&this->actor)) { - func_80AFD7B4(this, globalCtx); + func_80AFD7B4(this, play); return; } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (this->unk_283 == 0) { if ((this->actor.colChkInfo.damageEffect == 0xD) || ((this->actor.colChkInfo.damageEffect == 0xE) && @@ -483,7 +483,7 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { player->meleeWeaponAnimation <= PLAYER_MWA_LEFT_COMBO_2H) || (player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_RIGHT || player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_LEFT)))) { - BodyBreak_Alloc(&this->bodyBreak, 2, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 2, play); this->unk_283 = 1; } } @@ -494,43 +494,43 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { } } -void EnSkb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSkb_Update(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; s32 pad; - func_80AFD968(this, globalCtx); + func_80AFD968(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 60.0f, + 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, globalCtx); + 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->unk_281 != 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->unk_280 >= 3) { if ((this->actor.colorFilterTimer == 0) || ((this->actor.colorFilterParams & 0x4000) == 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSkb* this = (EnSkb*)thisx; s16 color; s16 pad[2]; if (limbIndex == 11) { if ((this->unk_283 & 2) == 0) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_skb.c", 972); - color = ABS((s16)(Math_SinS(globalCtx->gameplayFrames * 0x1770) * 95.0f)) + 160; + OPEN_DISPS(play->state.gfxCtx, "../z_en_skb.c", 972); + color = ABS((s16)(Math_SinS(play->gameplayFrames * 0x1770) * 95.0f)) + 160; gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, color, color, color, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_skb.c", 978); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_skb.c", 978); } else { *dList = NULL; } @@ -540,7 +540,7 @@ s32 EnSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSkb* this = (EnSkb*)thisx; Collider_UpdateSpheres(limbIndex, &this->collider); @@ -552,9 +552,9 @@ void EnSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnSkb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSkb_Draw(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw, EnSkb_PostLimbDraw, &this->actor); } 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 9f4559a4ac..f57aa1b1d8 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -6,7 +6,7 @@ struct EnSkb; -typedef void (*EnSkbActionFunc)(struct EnSkb*, GlobalContext*); +typedef void (*EnSkbActionFunc)(struct EnSkb*, PlayState*); typedef struct EnSkb { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 44c16c0ec2..552a4e2463 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -4,13 +4,13 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_25) -void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSkj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSkj_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSkj_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSkj_Init(Actor* thisx, PlayState* play); +void EnSkj_Destroy(Actor* thisx, PlayState* play); +void EnSkj_Update(Actor* thisx, PlayState* play); +void EnSkj_Draw(Actor* thisx, PlayState* play); -void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, GlobalContext* globalCtx); -void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, GlobalContext* globalCtx); +void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, PlayState* play); +void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, PlayState* play); void func_80AFF2A0(EnSkj* this); void func_80AFF334(EnSkj* this); @@ -38,58 +38,58 @@ void EnSkj_SetupWaitForMaskTextClear(EnSkj* this); void EnSkj_SetupWaitForTextClear(EnSkj* this); void EnSkj_SetupDie(EnSkj* this); void func_80AFF1F0(EnSkj* this); -void EnSkj_OfferNextRound(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SetupAskForMask(EnSkj* this, GlobalContext* globalCtx); +void EnSkj_OfferNextRound(EnSkj* this, PlayState* play); +void EnSkj_SetupAskForMask(EnSkj* this, PlayState* play); f32 EnSkj_GetItemXzRange(EnSkj* this); -s32 EnSkj_CollisionCheck(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SetupTakeMask(EnSkj* this, GlobalContext* globalCtx); +s32 EnSkj_CollisionCheck(EnSkj* this, PlayState* play); +void EnSkj_SetupTakeMask(EnSkj* this, PlayState* play); void EnSkj_TurnPlayer(EnSkj* this, Player* player); -void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_StartOcarinaMinigame(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForOcarina(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_FailedMiniGame(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WonOcarinaMiniGame(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitToGiveReward(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_GiveOcarinaGameReward(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_FinishOcarinaGameRound(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForNextRound(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForOfferResponse(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_CleanupOcarinaGame(EnSkj* this, GlobalContext* globalCtx); +void EnSkj_SetupWaitForOcarina(EnSkj* this, PlayState* play); +void EnSkj_StartOcarinaMinigame(EnSkj* this, PlayState* play); +void EnSkj_WaitForOcarina(EnSkj* this, PlayState* play); +void EnSkj_WaitForPlayback(EnSkj* this, PlayState* play); +void EnSkj_FailedMiniGame(EnSkj* this, PlayState* play); +void EnSkj_WonOcarinaMiniGame(EnSkj* this, PlayState* play); +void EnSkj_WaitToGiveReward(EnSkj* this, PlayState* play); +void EnSkj_GiveOcarinaGameReward(EnSkj* this, PlayState* play); +void EnSkj_FinishOcarinaGameRound(EnSkj* this, PlayState* play); +void EnSkj_WaitForNextRound(EnSkj* this, PlayState* play); +void EnSkj_WaitForOfferResponse(EnSkj* this, PlayState* play); +void EnSkj_SetupWaitForOcarina(EnSkj* this, PlayState* play); +void EnSkj_CleanupOcarinaGame(EnSkj* this, PlayState* play); -void EnSkj_Fade(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitToShootNeedle(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SariasSongKidIdle(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForDeathAnim(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_PickNextFightAction(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForLandAnim(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_ResetFight(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_Fight(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_NeedleRecover(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SpawnDeathEffect(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitInRange(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForSong(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_AfterSong(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SariaSongTalk(EnSkj* this, GlobalContext* globalCtx); -void func_80AFFE44(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_ChangeModeAfterSong(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_StartMaskTrade(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForLanding(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForLandAnimFinish(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WalkToPlayer(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_AskForMask(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_TakeMask(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WaitForMaskTextClear(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_WrongSong(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_SariasSongWaitForTextClear(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_OcarinaGameWaitForPlayer(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_OcarinaGameIdle(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_PlayOcarinaGame(EnSkj* this, GlobalContext* globalCtx); -void EnSkj_LeaveOcarinaGame(EnSkj* this, GlobalContext* globalCtx); +void EnSkj_Fade(EnSkj* this, PlayState* play); +void EnSkj_WaitToShootNeedle(EnSkj* this, PlayState* play); +void EnSkj_SariasSongKidIdle(EnSkj* this, PlayState* play); +void EnSkj_WaitForDeathAnim(EnSkj* this, PlayState* play); +void EnSkj_PickNextFightAction(EnSkj* this, PlayState* play); +void EnSkj_WaitForLandAnim(EnSkj* this, PlayState* play); +void EnSkj_ResetFight(EnSkj* this, PlayState* play); +void EnSkj_Fight(EnSkj* this, PlayState* play); +void EnSkj_NeedleRecover(EnSkj* this, PlayState* play); +void EnSkj_SpawnDeathEffect(EnSkj* this, PlayState* play); +void EnSkj_WaitInRange(EnSkj* this, PlayState* play); +void EnSkj_WaitForSong(EnSkj* this, PlayState* play); +void EnSkj_AfterSong(EnSkj* this, PlayState* play); +void EnSkj_SariaSongTalk(EnSkj* this, PlayState* play); +void func_80AFFE44(EnSkj* this, PlayState* play); +void EnSkj_ChangeModeAfterSong(EnSkj* this, PlayState* play); +void EnSkj_StartMaskTrade(EnSkj* this, PlayState* play); +void EnSkj_WaitForLanding(EnSkj* this, PlayState* play); +void EnSkj_WaitForLandAnimFinish(EnSkj* this, PlayState* play); +void EnSkj_WalkToPlayer(EnSkj* this, PlayState* play); +void EnSkj_AskForMask(EnSkj* this, PlayState* play); +void EnSkj_TakeMask(EnSkj* this, PlayState* play); +void EnSkj_WaitForMaskTextClear(EnSkj* this, PlayState* play); +void EnSkj_WrongSong(EnSkj* this, PlayState* play); +void EnSkj_SariasSongWaitForTextClear(EnSkj* this, PlayState* play); +void EnSkj_OcarinaGameWaitForPlayer(EnSkj* this, PlayState* play); +void EnSkj_OcarinaGameIdle(EnSkj* this, PlayState* play); +void EnSkj_PlayOcarinaGame(EnSkj* this, PlayState* play); +void EnSkj_LeaveOcarinaGame(EnSkj* this, PlayState* play); -void EnSkj_SpawnBlood(GlobalContext* globalCtx, Vec3f* pos); +void EnSkj_SpawnBlood(PlayState* play, Vec3f* pos); void EnSkj_SetupWaitInRange(EnSkj* this); @@ -360,10 +360,10 @@ void EnSkj_SetNaviId(EnSkj* this) { } } -void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnSkj_Init(Actor* thisx, PlayState* play2) { s16 type = (thisx->params >> 0xA) & 0x3F; EnSkj* this = (EnSkj*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 pad; Player* player; @@ -377,7 +377,7 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.update = EnSkj_SariasSongShortStumpUpdate; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actor.flags |= 0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); break; case 6: // Invisible on the short stump (ocarina game) @@ -388,7 +388,7 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.update = EnSkj_OcarinaMinigameShortStumpUpdate; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actor.flags |= 0; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); this->actor.focus.pos.x = 1230.0f; this->actor.focus.pos.y = -90.0f; this->actor.focus.pos.z = 450.0f; @@ -405,12 +405,12 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { } EnSkj_SetNaviId(this); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSkullKidSkel, &gSkullKidPlayFluteAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gSkullKidSkel, &gSkullKidPlayFluteAnim, this->jointTable, this->morphTable, 19); if ((type >= 0) && (type < 3)) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_NPC); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); } if ((type < 0) || (type >= 7)) { @@ -432,8 +432,8 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 10; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &D_80B01678); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &D_80B01678); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); Actor_SetScale(thisx, 0.01f); this->actor.textId = this->textId = 0; @@ -446,7 +446,7 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.gravity = -1.0f; EnSkj_CalculateCenter(this); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); osSyncPrintf("Player_X : %f\n", player->actor.world.pos.x); osSyncPrintf("Player_Z : %f\n", player->actor.world.pos.z); osSyncPrintf("World_X : %f\n", this->actor.world.pos.x); @@ -458,11 +458,11 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnSkj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSkj_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnSkj* this = (EnSkj*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 EnSkj_RangeCheck(Player* player, EnSkj* this) { @@ -488,7 +488,7 @@ f32 EnSkj_GetItemYRange(EnSkj* this) { return fabsf(sSmallStumpSkullKid.skullkid->actor.world.pos.y - this->actor.world.pos.y) + 10.0f; } -s32 EnSkj_ShootNeedle(EnSkj* this, GlobalContext* globalCtx) { +s32 EnSkj_ShootNeedle(EnSkj* this, PlayState* play) { s32 pad; Vec3f pos; Vec3f pos2; @@ -505,7 +505,7 @@ s32 EnSkj_ShootNeedle(EnSkj* this, GlobalContext* globalCtx) { pos2.z += this->actor.world.pos.z; pos2.y = this->actor.world.pos.y + 27.0f; - needle = (EnSkjneedle*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SKJNEEDLE, pos2.x, pos2.y, pos2.z, + needle = (EnSkjneedle*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SKJNEEDLE, pos2.x, pos2.y, pos2.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 0); if (needle != NULL) { needle->killTimer = 100; @@ -515,7 +515,7 @@ s32 EnSkj_ShootNeedle(EnSkj* this, GlobalContext* globalCtx) { return 0; } -void EnSkj_SpawnBlood(GlobalContext* globalCtx, Vec3f* pos) { +void EnSkj_SpawnBlood(PlayState* play, Vec3f* pos) { EffectSparkInit effect; s32 sp20; @@ -571,10 +571,10 @@ void EnSkj_SpawnBlood(GlobalContext* globalCtx, Vec3f* pos) { effect.timer = 0; effect.duration = 8; - Effect_Add(globalCtx, &sp20, EFFECT_SPARK, 0, 1, &effect); + Effect_Add(play, &sp20, EFFECT_SPARK, 0, 1, &effect); } -s32 EnSkj_CollisionCheck(EnSkj* this, GlobalContext* globalCtx) { +s32 EnSkj_CollisionCheck(EnSkj* this, PlayState* play) { s16 yawDiff; Vec3f effectPos; @@ -586,8 +586,8 @@ s32 EnSkj_CollisionCheck(EnSkj* this, GlobalContext* globalCtx) { effectPos.y = this->collider.info.bumper.hitPos.y; effectPos.z = this->collider.info.bumper.hitPos.z; - EnSkj_SpawnBlood(globalCtx, &effectPos); - EffectSsHitMark_SpawnFixedScale(globalCtx, 1, &effectPos); + EnSkj_SpawnBlood(play, &effectPos); + EffectSsHitMark_SpawnFixedScale(play, 1, &effectPos); yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; if ((this->action == 2) || (this->action == 6)) { @@ -623,12 +623,12 @@ s32 EnSkj_CollisionCheck(EnSkj* this, GlobalContext* globalCtx) { return 0; } -s32 func_80AFEDF8(EnSkj* this, GlobalContext* globalCtx) { +s32 func_80AFEDF8(EnSkj* this, PlayState* play) { s16 yawDiff; if (this->actor.xzDistToPlayer < this->unk_2EC) { this = this; - if (func_8002DDE4(globalCtx) != 0) { + if (func_8002DDE4(play) != 0) { return 1; } } @@ -650,11 +650,11 @@ void EnSkj_Backflip(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_FADE); } -void EnSkj_Fade(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_Fade(EnSkj* this, PlayState* play) { u32 alpha = this->alpha; if (this->unk_2D6 == 2) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + play->msgCtx.ocarinaMode = OCARINA_MODE_00; this->unk_2D6 = 0; } @@ -684,14 +684,14 @@ void EnSkj_SetupWaitToShootNeedle(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_WAIT_TO_SHOOT_NEEDLE); } -void EnSkj_WaitToShootNeedle(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitToShootNeedle(EnSkj* this, PlayState* play) { u8 val; s16 lastFrame = Animation_GetLastFrame(&gSkullKidShootNeedleAnim); if ((this->skelAnime.curFrame == lastFrame) && (this->needleShootTimer == 0)) { val = this->needlesToShoot; if (this->needlesToShoot != 0) { - EnSkj_ShootNeedle(this, globalCtx); + EnSkj_ShootNeedle(this, play); this->needleShootTimer = 4; val--; this->needlesToShoot = val; @@ -709,13 +709,13 @@ void EnSkj_SetupResetFight(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_IDLE); } -void EnSkj_SariasSongKidIdle(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_SariasSongKidIdle(EnSkj* this, PlayState* play) { if (this->actor.params == 0) { if (!GET_ITEMGETINF(ITEMGETINF_16) && (this->actor.xzDistToPlayer < 200.0f)) { this->backflipFlag = 1; EnSkj_Backflip(this); } else if (sSmallStumpSkullKid.unk_0 != 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (EnSkj_RangeCheck(player, sSmallStumpSkullKid.skullkid)) { EnSkj_SetupWaitInRange(this); player->stateFlags2 |= PLAYER_STATE2_23; @@ -723,7 +723,7 @@ void EnSkj_SariasSongKidIdle(EnSkj* this, GlobalContext* globalCtx) { } } } else { - if (func_80AFEDF8(this, globalCtx) != 0) { + if (func_80AFEDF8(this, play) != 0) { func_80AFF334(this); } } @@ -734,7 +734,7 @@ void EnSkj_SetupDie(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_WAIT_FOR_DEATH_ANIM); } -void EnSkj_WaitForDeathAnim(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitForDeathAnim(EnSkj* this, PlayState* play) { s16 lastFrame = Animation_GetLastFrame(&gSkullKidDieAnim); if (this->skelAnime.curFrame == lastFrame) { @@ -747,7 +747,7 @@ void func_80AFF1F0(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_PICK_NEXT_FIHGT_ACTION); } -void EnSkj_PickNextFightAction(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_PickNextFightAction(EnSkj* this, PlayState* play) { s16 lastFrame = Animation_GetLastFrame(&gSkullKidHitAnim); if (this->skelAnime.curFrame == lastFrame) { @@ -767,7 +767,7 @@ void func_80AFF2A0(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_WAIT_FOR_LAND_ANIM); } -void EnSkj_WaitForLandAnim(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitForLandAnim(EnSkj* this, PlayState* play) { s16 lastFrame = Animation_GetLastFrame(&gSkullKidLandAnim); if (this->skelAnime.curFrame == lastFrame) { @@ -783,10 +783,10 @@ void func_80AFF334(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_RESET_FIGHT); } -void EnSkj_ResetFight(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_ResetFight(EnSkj* this, PlayState* play) { if (this->battleExitTimer == 0) { EnSkj_SetupResetFight(this); - } else if (func_80AFEDF8(this, globalCtx) != 0) { + } else if (func_80AFEDF8(this, play) != 0) { this->battleExitTimer = 600; EnSkj_SetupStand(this); } @@ -801,7 +801,7 @@ void EnSkj_SetupStand(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_FIGHT); } -void EnSkj_Fight(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_Fight(EnSkj* this, PlayState* play) { Vec3f pos1; Vec3f pos2; s32 pad[3]; @@ -836,7 +836,7 @@ void EnSkj_Fight(EnSkj* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = (yawDistToPlayer < 0) ? -(1.0f + phi_f14) : (1.0f + phi_f14); - } else if (func_80AFEDF8(this, globalCtx) != 0) { + } else if (func_80AFEDF8(this, play) != 0) { this->backflipFlag = 1; EnSkj_Backflip(this); } else { @@ -849,7 +849,7 @@ void EnSkj_SetupNeedleRecover(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_NEEDLE_RECOVER); } -void EnSkj_NeedleRecover(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_NeedleRecover(EnSkj* this, PlayState* play) { if (this->skelAnime.curFrame == 0.0f) { EnSkj_SetupStand(this); } @@ -860,7 +860,7 @@ void EnSkj_SetupSpawnDeathEffect(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SPAWN_DEATH_EFFECT); } -void EnSkj_SpawnDeathEffect(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_SpawnDeathEffect(EnSkj* this, PlayState* play) { Vec3f effectPos; Vec3f effectVel; Vec3f effectAccel; @@ -886,8 +886,7 @@ void EnSkj_SpawnDeathEffect(EnSkj* this, GlobalContext* globalCtx) { effectVel.y = 0.0f; effectVel.x = 0.0f; - EffectSsDeadDb_Spawn(globalCtx, &effectPos, &effectVel, &effectAccel, 100, 10, 255, 255, 255, 255, 0, 0, 255, 1, 9, - 1); + EffectSsDeadDb_Spawn(play, &effectPos, &effectVel, &effectAccel, 100, 10, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); } void EnSkj_SetupWaitInRange(EnSkj* this) { @@ -897,8 +896,8 @@ void EnSkj_SetupWaitInRange(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_IN_RANGE); } -void EnSkj_WaitInRange(EnSkj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSkj_WaitInRange(EnSkj* this, PlayState* play) { + Player* player = GET_PLAYER(play); // When link pulls out the Ocarina center him on the stump // Link was probably supposed to be pointed towards skull kid as well @@ -909,13 +908,13 @@ void EnSkj_WaitInRange(EnSkj* this, GlobalContext* globalCtx) { player->actor.world.pos.y = sSmallStumpSkullKid.skullkid->actor.world.pos.y; player->actor.world.pos.z = sSmallStumpSkullKid.skullkid->actor.world.pos.z; EnSkj_TurnPlayer(sSmallStumpSkullKid.skullkid, player); - func_8010BD88(globalCtx, OCARINA_ACTION_CHECK_SARIA); + func_8010BD88(play, OCARINA_ACTION_CHECK_SARIA); EnSkj_SetupWaitForSong(this); } else if (D_80B01EA0 != 0) { player->actor.world.pos.x = sSmallStumpSkullKid.skullkid->actor.world.pos.x; player->actor.world.pos.y = sSmallStumpSkullKid.skullkid->actor.world.pos.y; player->actor.world.pos.z = sSmallStumpSkullKid.skullkid->actor.world.pos.z; - if ((Player_GetMask(globalCtx) == PLAYER_MASK_SKULL) && !GET_ITEMGETINF(ITEMGETINF_39)) { + if ((Player_GetMask(play) == PLAYER_MASK_SKULL) && !GET_ITEMGETINF(ITEMGETINF_39)) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); EnSkj_SetupMaskTrade(this); } else { @@ -927,18 +926,18 @@ void EnSkj_WaitInRange(EnSkj* this, GlobalContext* globalCtx) { player->stateFlags2 |= PLAYER_STATE2_23; if (GET_ITEMGETINF(ITEMGETINF_16)) { if (GET_ITEMGETINF(ITEMGETINF_39)) { - this->textId = Text_GetFaceReaction(globalCtx, 0x15); + this->textId = Text_GetFaceReaction(play, 0x15); if (this->textId == 0) { this->textId = 0x1020; } - } else if (Player_GetMask(globalCtx) == PLAYER_MASK_NONE) { + } else if (Player_GetMask(play) == PLAYER_MASK_NONE) { this->textId = 0x10BC; - } else if (Player_GetMask(globalCtx) == PLAYER_MASK_SKULL) { + } else if (Player_GetMask(play) == PLAYER_MASK_SKULL) { this->textId = 0x101B; } else { - this->textId = Text_GetFaceReaction(globalCtx, 0x15); + this->textId = Text_GetFaceReaction(play, 0x15); } - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); } } } @@ -948,60 +947,60 @@ void EnSkj_SetupWaitForSong(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_FOR_SONG); } -void EnSkj_WaitForSong(EnSkj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSkj_WaitForSong(EnSkj* this, PlayState* play) { + Player* player = GET_PLAYER(play); // Played a song thats not Saria's song - if (!GET_ITEMGETINF(ITEMGETINF_16) && ((globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_FAIL) || - (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_FAIL_NO_TEXT))) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; - Message_CloseTextbox(globalCtx); + if (!GET_ITEMGETINF(ITEMGETINF_16) && + ((play->msgCtx.msgMode == MSGMODE_OCARINA_FAIL) || (play->msgCtx.msgMode == MSGMODE_OCARINA_FAIL_NO_TEXT))) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); EnSkj_SetupWrongSong(this); } else { - if ((globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) && (this->unk_2D6 == 0)) { + if ((play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) && (this->unk_2D6 == 0)) { this->unk_2D6 = 1; EnSkj_ChangeAnim(this, SKJ_ANIM_PLAY_FLUTE); - } else if ((this->unk_2D6 != 0) && (globalCtx->msgCtx.msgMode == MSGMODE_SONG_DEMONSTRATION_DONE)) { + } else if ((this->unk_2D6 != 0) && (play->msgCtx.msgMode == MSGMODE_SONG_DEMONSTRATION_DONE)) { this->unk_2D6 = 0; EnSkj_ChangeAnim(this, SKJ_ANIM_WAIT); } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + play->msgCtx.ocarinaMode = OCARINA_MODE_00; this->unk_2D6 = 0; EnSkj_ChangeAnim(this, SKJ_ANIM_WAIT); EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_IN_RANGE); - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { if (!GET_ITEMGETINF(ITEMGETINF_16)) { // Saria's song has been played for the first titme - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; func_80078884(NA_SE_SY_CORRECT_CHIME); player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); this->textId = 0x10BB; EnSkj_SetupAfterSong(this); } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_05; + play->msgCtx.ocarinaMode = OCARINA_MODE_05; } - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_02) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_02) { player->stateFlags2 &= ~PLAYER_STATE2_24; Actor_Kill(&this->actor); - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { player->stateFlags2 |= PLAYER_STATE2_23; } else { - if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05) { + if (play->msgCtx.ocarinaMode >= OCARINA_MODE_05) { gSaveContext.sunsSongState = 0; if (GET_ITEMGETINF(ITEMGETINF_16)) { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); this->textId = 0x10BD; EnSkj_SetupAfterSong(this); } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); EnSkj_SetupWrongSong(this); } } @@ -1015,11 +1014,11 @@ void EnSkj_SetupAfterSong(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_AFTER_SONG); } -void EnSkj_AfterSong(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_AfterSong(EnSkj* this, PlayState* play) { if (D_80B01EA0 != 0) { EnSkj_SetupTalk(this); } else { - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); } } @@ -1027,16 +1026,15 @@ void EnSkj_SetupTalk(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_TALK); } -void EnSkj_SariaSongTalk(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_SariaSongTalk(EnSkj* this, PlayState* play) { s32 pad; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (GET_ITEMGETINF(ITEMGETINF_16)) { EnSkj_SetupWaitInRange(this); } else { func_80AFFE24(this); - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, EnSkj_GetItemXzRange(this), - EnSkj_GetItemYRange(this)); + func_8002F434(&this->actor, play, GI_HEART_PIECE, EnSkj_GetItemXzRange(this), EnSkj_GetItemYRange(this)); } } } @@ -1045,12 +1043,12 @@ void func_80AFFE24(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_UNK14); } -void func_80AFFE44(EnSkj* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80AFFE44(EnSkj* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; EnSkj_SetupPostSariasSong(this); } else { - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, EnSkj_GetItemXzRange(this), EnSkj_GetItemYRange(this)); + func_8002F434(&this->actor, play, GI_HEART_PIECE, EnSkj_GetItemXzRange(this), EnSkj_GetItemYRange(this)); } } @@ -1058,8 +1056,8 @@ void EnSkj_SetupPostSariasSong(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_CHANGE_MODE); } -void EnSkj_ChangeModeAfterSong(EnSkj* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnSkj_ChangeModeAfterSong(EnSkj* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { SET_ITEMGETINF(ITEMGETINF_16); EnSkj_SetNaviId(this); EnSkj_SetupWaitInRange(this); @@ -1070,11 +1068,11 @@ void EnSkj_SetupMaskTrade(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_START_TRADE); } -void EnSkj_StartMaskTrade(EnSkj* this, GlobalContext* globalCtx) { - u8 sp1F = Message_GetState(&globalCtx->msgCtx); +void EnSkj_StartMaskTrade(EnSkj* this, PlayState* play) { + u8 sp1F = Message_GetState(&play->msgCtx); - func_8002DF54(globalCtx, &this->actor, 1); - if ((sp1F == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + func_8002DF54(play, &this->actor, 1); + if ((sp1F == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { EnSkj_JumpFromStump(this); } } @@ -1088,7 +1086,7 @@ void EnSkj_JumpFromStump(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_FOR_LANDING); } -void EnSkj_WaitForLanding(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitForLanding(EnSkj* this, PlayState* play) { if (this->actor.velocity.y <= 0.0f) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; @@ -1103,7 +1101,7 @@ void EnSkj_SetupWaitForLandAnimFinish(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_FOR_LANDING_ANIM); } -void EnSkj_WaitForLandAnimFinish(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitForLandAnimFinish(EnSkj* this, PlayState* play) { s16 lastFrame = Animation_GetLastFrame(&gSkullKidLandAnim); if (this->skelAnime.curFrame == lastFrame) { @@ -1118,49 +1116,49 @@ void EnSkj_SetupWalkToPlayer(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WALK_TO_PLAYER); } -void EnSkj_WalkToPlayer(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WalkToPlayer(EnSkj* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, this->unk_2F0, 0); Math_ApproachF(&this->unk_2F0, 2000.0f, 1.0f, 100.0f); this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.xzDistToPlayer < 120.0f) { this->actor.speedXZ = 0.0f; - EnSkj_SetupAskForMask(this, globalCtx); + EnSkj_SetupAskForMask(this, play); } } -void EnSkj_SetupAskForMask(EnSkj* this, GlobalContext* globalCtx) { - Message_StartTextbox(globalCtx, 0x101C, &this->actor); +void EnSkj_SetupAskForMask(EnSkj* this, PlayState* play) { + Message_StartTextbox(play, 0x101C, &this->actor); EnSkj_ChangeAnim(this, SKJ_ANIM_WAIT); EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_ASK_FOR_MASK); } -void EnSkj_AskForMask(EnSkj* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void EnSkj_AskForMask(EnSkj* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // Yes - EnSkj_SetupTakeMask(this, globalCtx); + EnSkj_SetupTakeMask(this, play); break; case 1: // No - Message_ContinueTextbox(globalCtx, 0x101D); + Message_ContinueTextbox(play, 0x101D); EnSkj_SetupWaitForMaskTextClear(this); break; } } } -void EnSkj_SetupTakeMask(EnSkj* this, GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x101E); +void EnSkj_SetupTakeMask(EnSkj* this, PlayState* play) { + Message_ContinueTextbox(play, 0x101E); EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_TAKE_MASK); } -void EnSkj_TakeMask(EnSkj* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnSkj_TakeMask(EnSkj* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { Rupees_ChangeBy(10); SET_ITEMGETINF(ITEMGETINF_39); EnSkj_SetNaviId(this); - Player_UnsetMask(globalCtx); - Item_Give(globalCtx, ITEM_SOLD_OUT); - Message_ContinueTextbox(globalCtx, 0x101F); + Player_UnsetMask(play); + Item_Give(play, ITEM_SOLD_OUT); + Message_ContinueTextbox(play, 0x101F); EnSkj_SetupWaitForMaskTextClear(this); } } @@ -1169,9 +1167,9 @@ void EnSkj_SetupWaitForMaskTextClear(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_MASK_TEXT); } -void EnSkj_WaitForMaskTextClear(EnSkj* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { - func_8002DF54(globalCtx, &this->actor, 7); +void EnSkj_WaitForMaskTextClear(EnSkj* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { + func_8002DF54(play, &this->actor, 7); this->backflipFlag = 1; EnSkj_Backflip(this); } @@ -1183,11 +1181,11 @@ void EnSkj_SetupWrongSong(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WRONG_SONG); } -void EnSkj_WrongSong(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WrongSong(EnSkj* this, PlayState* play) { if (D_80B01EA0 != 0) { EnSkj_SetupWaitForTextClear(this); } else { - func_8002F2CC(&this->actor, globalCtx, EnSkj_GetItemXzRange(this)); + func_8002F2CC(&this->actor, play, EnSkj_GetItemXzRange(this)); } } @@ -1195,11 +1193,11 @@ void EnSkj_SetupWaitForTextClear(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_SARIA_SONG_WAIT_FOR_TEXT); } -void EnSkj_SariasSongWaitForTextClear(EnSkj* this, GlobalContext* globalCtx) { - u8 state = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void EnSkj_SariasSongWaitForTextClear(EnSkj* this, PlayState* play) { + u8 state = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); - if (state == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { + if (state == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { EnSkj_SetupWaitInRange(this); player->stateFlags2 |= PLAYER_STATE2_23; player->unk_6A8 = (Actor*)sSmallStumpSkullKid.skullkid; @@ -1212,7 +1210,7 @@ void EnSkj_OcarinaGameSetupWaitForPlayer(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_OCARINA_GAME_WAIT_FOR_PLAYER); } -void EnSkj_OcarinaGameWaitForPlayer(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_OcarinaGameWaitForPlayer(EnSkj* this, PlayState* play) { if (this->playerInRange) { this->actor.flags |= ACTOR_FLAG_0; EnSkj_SetupAction(this, SKJ_ACTION_OCARINA_GAME_IDLE); @@ -1244,7 +1242,7 @@ void EnSkj_Appear(EnSkj* this) { } } -void EnSkj_OcarinaGameIdle(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_OcarinaGameIdle(EnSkj* this, PlayState* play) { EnSkj_Appear(this); if ((EnSkj_IsLeavingGame(this) == false) && (this->minigameState != 0)) { @@ -1257,7 +1255,7 @@ void EnSkj_SetupPlayOcarinaGame(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_OCARINA_GAME_PLAY); } -void EnSkj_PlayOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_PlayOcarinaGame(EnSkj* this, PlayState* play) { EnSkj_Appear(this); if (!EnSkj_IsLeavingGame(this) && (this->minigameState == 0)) { @@ -1272,7 +1270,7 @@ void EnSkj_SetupLeaveOcarinaGame(EnSkj* this) { EnSkj_SetupAction(this, SKJ_ACTION_OCARINA_GAME_LEAVE); } -void EnSkj_LeaveOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_LeaveOcarinaGame(EnSkj* this, PlayState* play) { s32 paramsDecr = this->actor.params - 1; sOcarinaMinigameSkullKids[paramsDecr].unk_0 = 0; @@ -1281,12 +1279,12 @@ void EnSkj_LeaveOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { EnSkj_Backflip(this); } -void EnSkj_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSkj_Update(Actor* thisx, PlayState* play) { Vec3f dropPos; s32 pad; EnSkj* this = (EnSkj*)thisx; - D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, globalCtx); + D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, play); this->timer++; @@ -1312,7 +1310,7 @@ void EnSkj_Update(Actor* thisx, GlobalContext* globalCtx) { dropPos.y = this->actor.world.pos.y; dropPos.z = this->actor.world.pos.z; - Item_DropCollectible(globalCtx, &dropPos, ITEM00_RUPEE_ORANGE); + Item_DropCollectible(play, &dropPos, ITEM00_RUPEE_ORANGE); } Actor_Kill(&this->actor); return; @@ -1320,35 +1318,35 @@ void EnSkj_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 30.0f); Actor_SetScale(&this->actor, 0.01f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.textId = this->textId; - EnSkj_CollisionCheck(this, globalCtx); + EnSkj_CollisionCheck(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); if ((this->unk_2D3 != 0) && (D_80B01EA0 == 0)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); if (this->actor.colorFilterTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); } -void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, GlobalContext* globalCtx) { +void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, PlayState* play) { EnSkj* this = (EnSkj*)thisx; - D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, globalCtx); + D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, play); if (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, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } } @@ -1358,8 +1356,8 @@ void EnSkj_TurnPlayer(EnSkj* this, Player* player) { player->currentYaw = player->actor.shape.rot.y; } -void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSkj_SetupWaitForOcarina(EnSkj* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (EnSkj_RangeCheck(player, this)) { sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->playerInRange = true; @@ -1370,7 +1368,7 @@ void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { func_800F5BF0(NATURE_ID_KOKIRI_REGION); EnSkj_TurnPlayer(this, player); player->unk_6A8 = &this->actor; - Message_StartTextbox(globalCtx, 0x10BE, &this->actor); + Message_StartTextbox(play, 0x10BE, &this->actor); this->actionFunc = EnSkj_StartOcarinaMinigame; } else { this->actionFunc = EnSkj_WaitForOcarina; @@ -1378,29 +1376,29 @@ void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { } } -void EnSkj_WaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSkj_WaitForOcarina(EnSkj* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags2 & PLAYER_STATE2_24) { player->stateFlags2 |= PLAYER_STATE2_25; func_800F5BF0(NATURE_ID_KOKIRI_REGION); EnSkj_TurnPlayer(this, player); player->unk_6A8 = &this->actor; - Message_StartTextbox(globalCtx, 0x10BE, &this->actor); + Message_StartTextbox(play, 0x10BE, &this->actor); this->actionFunc = EnSkj_StartOcarinaMinigame; } else if (EnSkj_RangeCheck(player, this)) { player->stateFlags2 |= PLAYER_STATE2_23; } } -void EnSkj_StartOcarinaMinigame(EnSkj* this, GlobalContext* globalCtx) { - u8 dialogState = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void EnSkj_StartOcarinaMinigame(EnSkj* this, PlayState* play) { + u8 dialogState = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); EnSkj_TurnPlayer(this, player); if (dialogState == TEXT_STATE_CLOSING) { - func_8010BD58(globalCtx, OCARINA_ACTION_MEMORY_GAME); + func_8010BD58(play, OCARINA_ACTION_MEMORY_GAME); if (sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid != NULL) { sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->minigameState = SKULL_KID_OCARINA_PLAY_NOTES; } @@ -1409,28 +1407,28 @@ void EnSkj_StartOcarinaMinigame(EnSkj* this, GlobalContext* globalCtx) { } } -void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSkj_WaitForPlayback(EnSkj* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnSkj_TurnPlayer(this, player); - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) { // failed the game - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { // failed the game + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, 26.0f); + func_8002F2CC(&this->actor, play, 26.0f); this->textId = 0x102D; this->actionFunc = EnSkj_FailedMiniGame; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_0F) { // completed the game + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_0F) { // completed the game func_80078884(NA_SE_SY_CORRECT_CHIME); - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, 26.0f); + func_8002F2CC(&this->actor, play, 26.0f); this->textId = 0x10BF; this->actionFunc = EnSkj_WonOcarinaMiniGame; } else { // playing the game - switch (globalCtx->msgCtx.msgMode) { + switch (play->msgCtx.msgMode) { case MSGMODE_MEMORY_GAME_LEFT_SKULLKID_WAIT: if (sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid != NULL) { sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->minigameState = SKULL_KID_OCARINA_WAIT; @@ -1440,7 +1438,7 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid->minigameState = SKULL_KID_OCARINA_PLAY_NOTES; } - Message_UpdateOcarinaMemoryGame(globalCtx); + Message_UpdateOcarinaMemoryGame(play); } break; case MSGMODE_MEMORY_GAME_RIGHT_SKULLKID_WAIT: @@ -1448,7 +1446,7 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid->minigameState = SKULL_KID_OCARINA_WAIT; } if (!Audio_IsSfxPlaying(NA_SE_SY_METRONOME)) { - Message_UpdateOcarinaMemoryGame(globalCtx); + Message_UpdateOcarinaMemoryGame(play); this->songFailTimer = 160; } break; @@ -1457,10 +1455,10 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { this->songFailTimer--; } else { // took too long, game failed func_80078884(NA_SE_SY_OCARINA_ERROR); - Message_CloseTextbox(globalCtx); - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + Message_CloseTextbox(play); + play->msgCtx.ocarinaMode = OCARINA_MODE_04; player->unk_6A8 = &this->actor; - func_8002F2CC(&this->actor, globalCtx, 26.0f); + func_8002F2CC(&this->actor, play, 26.0f); this->textId = 0x102D; this->actionFunc = EnSkj_FailedMiniGame; } @@ -1474,40 +1472,40 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { this->songFailTimer = 160; AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_FLUTE); AudioOcarina_SetPlaybackSong(OCARINA_SONG_MEMORY_GAME + 1, 1); - globalCtx->msgCtx.msgMode = MSGMODE_MEMORY_GAME_LEFT_SKULLKID_PLAYING; - globalCtx->msgCtx.stateTimer = 2; + play->msgCtx.msgMode = MSGMODE_MEMORY_GAME_LEFT_SKULLKID_PLAYING; + play->msgCtx.stateTimer = 2; } break; } } } -void EnSkj_FailedMiniGame(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_FailedMiniGame(EnSkj* this, PlayState* play) { if (D_80B01EA0) { this->actionFunc = EnSkj_WaitForNextRound; } else { - func_8002F2CC(&this->actor, globalCtx, 26.0f); + func_8002F2CC(&this->actor, play, 26.0f); } } -void EnSkj_WaitForNextRound(EnSkj* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { - EnSkj_OfferNextRound(this, globalCtx); +void EnSkj_WaitForNextRound(EnSkj* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { + EnSkj_OfferNextRound(this, play); } } -void EnSkj_OfferNextRound(EnSkj* this, GlobalContext* globalCtx) { - Message_ContinueTextbox(globalCtx, 0x102E); +void EnSkj_OfferNextRound(EnSkj* this, PlayState* play) { + Message_ContinueTextbox(play, 0x102E); this->actionFunc = EnSkj_WaitForOfferResponse; } -void EnSkj_WaitForOfferResponse(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WaitForOfferResponse(EnSkj* this, PlayState* play) { Player* player; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); player->stateFlags3 |= PLAYER_STATE3_5; // makes player take ocarina out right away after closing box this->actionFunc = EnSkj_SetupWaitForOcarina; break; @@ -1518,32 +1516,32 @@ void EnSkj_WaitForOfferResponse(EnSkj* this, GlobalContext* globalCtx) { } } -void EnSkj_WonOcarinaMiniGame(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_WonOcarinaMiniGame(EnSkj* this, PlayState* play) { if (D_80B01EA0) { this->actionFunc = EnSkj_WaitToGiveReward; } else { - func_8002F2CC(&this->actor, globalCtx, 26.0f); + func_8002F2CC(&this->actor, play, 26.0f); } } -void EnSkj_WaitToGiveReward(EnSkj* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { - func_8002F434(&this->actor, globalCtx, sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f); +void EnSkj_WaitToGiveReward(EnSkj* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { + func_8002F434(&this->actor, play, sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f); this->actionFunc = EnSkj_GiveOcarinaGameReward; } } -void EnSkj_GiveOcarinaGameReward(EnSkj* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnSkj_GiveOcarinaGameReward(EnSkj* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnSkj_FinishOcarinaGameRound; } else { - func_8002F434(&this->actor, globalCtx, sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f); + func_8002F434(&this->actor, play, sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f); } } -void EnSkj_FinishOcarinaGameRound(EnSkj* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { +void EnSkj_FinishOcarinaGameRound(EnSkj* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { s32 ocarinaGameRoundNum = gSaveContext.ocarinaGameRoundNum; if (gSaveContext.ocarinaGameRoundNum < 3) { @@ -1554,12 +1552,12 @@ void EnSkj_FinishOcarinaGameRound(EnSkj* this, GlobalContext* globalCtx) { SET_ITEMGETINF(ITEMGETINF_17); this->actionFunc = EnSkj_CleanupOcarinaGame; } else { - EnSkj_OfferNextRound(this, globalCtx); + EnSkj_OfferNextRound(this, play); } } } -void EnSkj_CleanupOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { +void EnSkj_CleanupOcarinaGame(EnSkj* this, PlayState* play) { if (sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid != NULL) { sOcarinaMinigameSkullKids[SKULL_KID_LEFT].unk_0 = 2; } @@ -1575,10 +1573,10 @@ void EnSkj_CleanupOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { } } -void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, GlobalContext* globalCtx) { +void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, PlayState* play) { EnSkj* this = (EnSkj*)thisx; - D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, globalCtx); + D_80B01EA0 = Actor_ProcessTalkRequest(&this->actor, play); this->timer++; this->actor.focus.pos.x = 1230.0f; @@ -1588,33 +1586,33 @@ void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, GlobalContext* globalCt if (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, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.textId = this->textId; this->actor.xzDistToPlayer = 50.0; } -s32 EnSkj_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSkj_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { return 0; } -void EnSkj_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_skj.c", 2417); +void EnSkj_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { + OPEN_DISPS(play->state.gfxCtx, "../z_en_skj.c", 2417); if ((limbIndex == 11) && GET_ITEMGETINF(ITEMGETINF_39)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Push(); Matrix_RotateZYX(-0x4000, 0, 0, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_skj.c", 2430), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_skj.c", 2430), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gSkullKidSkullMaskDL); Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_skj.c", 2437); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_skj.c", 2437); } Gfx* EnSkj_TranslucentDL(GraphicsContext* gfxCtx, u32 alpha) { @@ -1642,22 +1640,22 @@ Gfx* EnSkj_OpaqueDL(GraphicsContext* gfxCtx, u32 alpha) { return dList; } -void EnSkj_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSkj_Draw(Actor* thisx, PlayState* play) { s32 pad; EnSkj* this = (EnSkj*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_skj.c", 2475); + OPEN_DISPS(play->state.gfxCtx, "../z_en_skj.c", 2475); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->alpha < 255) { - gSPSegment(POLY_OPA_DISP++, 0x0C, EnSkj_TranslucentDL(globalCtx->state.gfxCtx, this->alpha)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnSkj_TranslucentDL(play->state.gfxCtx, this->alpha)); } else { - gSPSegment(POLY_OPA_DISP++, 0x0C, EnSkj_OpaqueDL(globalCtx->state.gfxCtx, this->alpha)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnSkj_OpaqueDL(play->state.gfxCtx, this->alpha)); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnSkj_OverrideLimbDraw, EnSkj_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_skj.c", 2495); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_skj.c", 2495); } diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.h b/src/overlays/actors/ovl_En_Skj/z_en_skj.h index 09b806de66..dc0f97cc92 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.h +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.h @@ -6,7 +6,7 @@ struct EnSkj; -typedef void (*EnSkjActionFunc)(struct EnSkj*, GlobalContext*); +typedef void (*EnSkjActionFunc)(struct EnSkj*, PlayState*); typedef struct EnSkj { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c index 6c4fc77321..58c66df266 100644 --- a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c +++ b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_9) -void EnSkjneedle_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSkjneedle_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSkjneedle_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSkjneedle_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSkjneedle_Init(Actor* thisx, PlayState* play); +void EnSkjneedle_Destroy(Actor* thisx, PlayState* play); +void EnSkjneedle_Update(Actor* thisx, PlayState* play); +void EnSkjneedle_Draw(Actor* thisx, PlayState* play); s32 EnSkjNeedle_CollisionCheck(EnSkjneedle* this); @@ -52,21 +52,21 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void EnSkjneedle_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSkjneedle_Init(Actor* thisx, PlayState* play) { EnSkjneedle* this = (EnSkjneedle*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 20.0f); thisx->flags &= ~ACTOR_FLAG_0; Actor_SetScale(&this->actor, 0.01f); } -void EnSkjneedle_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSkjneedle_Destroy(Actor* thisx, PlayState* play) { EnSkjneedle* this = (EnSkjneedle*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 EnSkjNeedle_CollisionCheck(EnSkjneedle* this) { @@ -77,9 +77,9 @@ s32 EnSkjNeedle_CollisionCheck(EnSkjneedle* this) { return 0; } -void EnSkjneedle_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnSkjneedle_Update(Actor* thisx, PlayState* play2) { EnSkjneedle* this = (EnSkjneedle*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; this->unusedTimer1++; if (this->killTimer != 0) { @@ -90,23 +90,23 @@ void EnSkjneedle_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { Actor_SetScale(&this->actor, 0.01f); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); } } -void EnSkjneedle_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSkjneedle_Draw(Actor* thisx, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 200); + OPEN_DISPS(play->state.gfxCtx, "../z_en_skj_needle.c", 200); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 205), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_skj_needle.c", 205), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gSkullKidNeedleDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 210); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_skj_needle.c", 210); } diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 980ebc2de9..4123ba75c0 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -18,15 +18,15 @@ typedef enum { SSH_ANIM_UNK6 // Faster repeating version of ANIM_UNK0 } EnSshAnimation; -void EnSsh_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSsh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSsh_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSsh_Init(Actor* thisx, PlayState* play); +void EnSsh_Destroy(Actor* thisx, PlayState* play); +void EnSsh_Update(Actor* thisx, PlayState* play); +void EnSsh_Draw(Actor* thisx, PlayState* play); -void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx); -void EnSsh_Drop(EnSsh* this, GlobalContext* globalCtx); -void EnSsh_Return(EnSsh* this, GlobalContext* globalCtx); -void EnSsh_Start(EnSsh* this, GlobalContext* globalCtx); +void EnSsh_Idle(EnSsh* this, PlayState* play); +void EnSsh_Drop(EnSsh* this, PlayState* play); +void EnSsh_Return(EnSsh* this, PlayState* play); +void EnSsh_Start(EnSsh* this, PlayState* play); #include "overlays/ovl_En_Ssh/ovl_En_Ssh.c" @@ -115,17 +115,17 @@ void EnSsh_SetupAction(EnSsh* this, EnSshActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnSsh_SpawnShockwave(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_SpawnShockwave(EnSsh* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f pos; pos.x = this->actor.world.pos.x; pos.y = this->actor.floorHeight; pos.z = this->actor.world.pos.z; - EffectSsBlast_SpawnWhiteCustomScale(globalCtx, &pos, &zeroVec, &zeroVec, 100, 220, 8); + EffectSsBlast_SpawnWhiteCustomScale(play, &pos, &zeroVec, &zeroVec, 100, 220, 8); } -s32 EnSsh_CreateBlureEffect(GlobalContext* globalCtx) { +s32 EnSsh_CreateBlureEffect(PlayState* play) { EffectBlureInit1 blureInit; u8 p1StartColor[] = { 255, 255, 255, 75 }; u8 p2StartColor[] = { 255, 255, 255, 75 }; @@ -145,11 +145,11 @@ s32 EnSsh_CreateBlureEffect(GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 3; - Effect_Add(globalCtx, &blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); return blureIdx; } -s32 EnSsh_CheckCeilingPos(EnSsh* this, GlobalContext* globalCtx) { +s32 EnSsh_CheckCeilingPos(EnSsh* this, PlayState* play) { CollisionPoly* poly; s32 bgId; Vec3f posB; @@ -157,8 +157,8 @@ s32 EnSsh_CheckCeilingPos(EnSsh* this, GlobalContext* globalCtx) { posB.x = this->actor.world.pos.x; posB.y = this->actor.world.pos.y + 1000.0f; posB.z = this->actor.world.pos.z; - if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &posB, &this->ceilingPos, &poly, false, - false, true, true, &bgId)) { + if (!BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &posB, &this->ceilingPos, &poly, false, false, + true, true, &bgId)) { return false; } else { return true; @@ -188,7 +188,7 @@ void EnSsh_AddBlureSpace(EnSsh* this) { EffectBlure_AddSpace(Effect_GetByIndex(this->blureIdx)); } -void EnSsh_InitColliders(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_InitColliders(EnSsh* this, PlayState* play) { ColliderCylinderInit* cylinders[6] = { &sCylinderInit1, &sCylinderInit1, &sCylinderInit1, &sCylinderInit2, &sCylinderInit2, &sCylinderInit2, }; @@ -196,8 +196,8 @@ void EnSsh_InitColliders(EnSsh* this, GlobalContext* globalCtx) { s32 pad; for (i = 0; i < ARRAY_COUNT(cylinders); i++) { - Collider_InitCylinder(globalCtx, &this->colCylinder[i]); - Collider_SetCylinder(globalCtx, &this->colCylinder[i], &this->actor, cylinders[i]); + Collider_InitCylinder(play, &this->colCylinder[i]); + Collider_SetCylinder(play, &this->colCylinder[i], &this->actor, cylinders[i]); } this->colCylinder[0].info.bumper.dmgFlags = 0x0003F8E9; @@ -209,8 +209,8 @@ void EnSsh_InitColliders(EnSsh* this, GlobalContext* globalCtx) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(2), &sColChkInfoInit); - Collider_InitJntSph(globalCtx, &this->colSph); - Collider_SetJntSph(globalCtx, &this->colSph, &this->actor, &sJntSphInit, this->colSphElements); + Collider_InitJntSph(play, &this->colSph); + Collider_SetJntSph(play, &this->colSph, &this->actor, &sJntSphInit, this->colSphElements); } f32 EnSsh_SetAnimation(EnSsh* this, s32 animIndex) { @@ -305,7 +305,7 @@ s32 EnSsh_Damaged(EnSsh* this) { } } -void EnSsh_Turn(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Turn(EnSsh* this, PlayState* play) { if (this->hitTimer != 0) { this->hitTimer--; } @@ -317,7 +317,7 @@ void EnSsh_Turn(EnSsh* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnSsh_Stunned(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Stunned(EnSsh* this, PlayState* play) { if ((this->swayTimer == 0) && (this->stunTimer == 0)) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer ^ 0x8000, 4, this->maxTurnRate, 1); } @@ -331,25 +331,25 @@ void EnSsh_Stunned(EnSsh* this, GlobalContext* globalCtx) { } } -void EnSsh_UpdateYaw(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_UpdateYaw(EnSsh* this, PlayState* play) { if (this->stunTimer != 0) { - EnSsh_Stunned(this, globalCtx); + EnSsh_Stunned(this, play); } else { - EnSsh_Turn(this, globalCtx); + EnSsh_Turn(this, play); } } -void EnSsh_Bob(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Bob(EnSsh* this, PlayState* play) { f32 bobVel = 0.5f; - if ((globalCtx->state.frames & 8) != 0) { + if ((play->state.frames & 8) != 0) { bobVel *= -1.0f; } Math_SmoothStepToF(&this->actor.velocity.y, bobVel, 0.4f, 1000.0f, 0.0f); } -s32 EnSsh_IsCloseToLink(EnSsh* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnSsh_IsCloseToLink(EnSsh* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 yDist; if (this->stateFlags & SSH_STATE_GROUND_START) { @@ -429,9 +429,9 @@ void EnSsh_Sway(EnSsh* this) { } } -void EnSsh_CheckBodyStickHit(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_CheckBodyStickHit(EnSsh* this, PlayState* play) { ColliderInfo* info = &this->colCylinder[0].info; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->unk_860 != 0) { info->bumper.dmgFlags |= 2; @@ -444,7 +444,7 @@ void EnSsh_CheckBodyStickHit(EnSsh* this, GlobalContext* globalCtx) { } } -s32 EnSsh_CheckHitPlayer(EnSsh* this, GlobalContext* globalCtx) { +s32 EnSsh_CheckHitPlayer(EnSsh* this, PlayState* play) { s32 i; s32 hit = false; @@ -466,8 +466,8 @@ s32 EnSsh_CheckHitPlayer(EnSsh* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_ROLL); Audio_PlayActorSound2(&this->actor, NA_SE_VO_ST_ATTACK); - globalCtx->damagePlayer(globalCtx, -8); - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); + play->damagePlayer(play, -8); + func_8002F71C(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); this->hitCount--; return true; } @@ -490,7 +490,7 @@ s32 EnSsh_CheckHitFront(EnSsh* this) { } } -s32 EnSsh_CheckHitBack(EnSsh* this, GlobalContext* globalCtx) { +s32 EnSsh_CheckHitBack(EnSsh* this, PlayState* play) { ColliderCylinder* cyl = &this->colCylinder[0]; s32 hit = false; @@ -519,13 +519,13 @@ s32 EnSsh_CheckHitBack(EnSsh* this, GlobalContext* globalCtx) { return false; } -s32 EnSsh_CollisionCheck(EnSsh* this, GlobalContext* globalCtx) { +s32 EnSsh_CollisionCheck(EnSsh* this, PlayState* play) { if (this->stunTimer == 0) { - EnSsh_CheckHitPlayer(this, globalCtx); + EnSsh_CheckHitPlayer(this, play); } if (EnSsh_CheckHitFront(this)) { return false; - } else if (globalCtx->actorCtx.unk_02 != 0) { + } else if (play->actorCtx.unk_02 != 0) { this->invincibilityTimer = 8; if (this->stunTimer == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); @@ -535,29 +535,29 @@ s32 EnSsh_CollisionCheck(EnSsh* this, GlobalContext* globalCtx) { this->stateFlags |= SSH_STATE_STUNNED; return false; } else { - return EnSsh_CheckHitBack(this, globalCtx); + return EnSsh_CheckHitBack(this, play); // Always returns false } } -void EnSsh_SetBodyCylinderAC(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_SetBodyCylinderAC(EnSsh* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->colCylinder[0]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[0].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[0].base); } -void EnSsh_SetLegsCylinderAC(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_SetLegsCylinderAC(EnSsh* this, PlayState* play) { s16 angleTowardsLink = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if (angleTowardsLink < 90 * (0x10000 / 360)) { Collider_UpdateCylinder(&this->actor, &this->colCylinder[2]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[2].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[2].base); } else { Collider_UpdateCylinder(&this->actor, &this->colCylinder[1]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[1].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[1].base); } } -s32 EnSsh_SetCylinderOC(EnSsh* this, GlobalContext* globalCtx) { +s32 EnSsh_SetCylinderOC(EnSsh* this, PlayState* play) { Vec3f cyloffsets[] = { { 40.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, @@ -579,27 +579,27 @@ s32 EnSsh_SetCylinderOC(EnSsh* this, GlobalContext* globalCtx) { this->colCylinder[i + 3].dim.pos.x = cylPos.x; this->colCylinder[i + 3].dim.pos.y = cylPos.y; this->colCylinder[i + 3].dim.pos.z = cylPos.z; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[i + 3].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCylinder[i + 3].base); } return 1; } -void EnSsh_SetColliders(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_SetColliders(EnSsh* this, PlayState* play) { if (this->actor.colChkInfo.health == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colSph.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colSph.base); } else { if (this->hitTimer == 0) { - EnSsh_SetCylinderOC(this, globalCtx); + EnSsh_SetCylinderOC(this, play); } if (DECR(this->invincibilityTimer) == 0) { - EnSsh_SetBodyCylinderAC(this, globalCtx); - EnSsh_SetLegsCylinderAC(this, globalCtx); + EnSsh_SetBodyCylinderAC(this, play); + EnSsh_SetLegsCylinderAC(this, play); } } } -void EnSsh_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSsh_Init(Actor* thisx, PlayState* play) { f32 frameCount; s32 pad; EnSsh* this = (EnSsh*)thisx; @@ -615,13 +615,13 @@ void EnSsh_Init(Actor* thisx, GlobalContext* globalCtx) { return; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_ssh_Skel_0052E0, NULL, this->jointTable, this->morphTable, 30); + SkelAnime_Init(play, &this->skelAnime, &object_ssh_Skel_0052E0, NULL, this->jointTable, this->morphTable, 30); Animation_Change(&this->skelAnime, &object_ssh_Anim_000304, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP_INTERP, 0.0f); - this->blureIdx = EnSsh_CreateBlureEffect(globalCtx); - EnSsh_InitColliders(this, globalCtx); + this->blureIdx = EnSsh_CreateBlureEffect(play); + EnSsh_InitColliders(this, play); this->stateFlags = 0; this->hitCount = 0; - EnSsh_CheckCeilingPos(this, globalCtx); + EnSsh_CheckCeilingPos(this, play); if (this->actor.params != ENSSH_FATHER) { EnSsh_SetColliderScale(this, 0.5f, 1.0f); } else { @@ -632,37 +632,37 @@ void EnSsh_Init(Actor* thisx, GlobalContext* globalCtx) { EnSsh_SetupAction(this, EnSsh_Start); } -void EnSsh_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSsh_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnSsh* this = (EnSsh*)thisx; s32 i; - Effect_Delete(globalCtx, this->blureIdx); + Effect_Delete(play, this->blureIdx); for (i = 0; i < 6; i++) { - Collider_DestroyCylinder(globalCtx, &this->colCylinder[i]); + Collider_DestroyCylinder(play, &this->colCylinder[i]); } - Collider_DestroyJntSph(globalCtx, &this->colSph); + Collider_DestroyJntSph(play, &this->colSph); } -void EnSsh_Wait(EnSsh* this, GlobalContext* globalCtx) { - if (EnSsh_IsCloseToLink(this, globalCtx)) { +void EnSsh_Wait(EnSsh* this, PlayState* play) { + if (EnSsh_IsCloseToLink(this, play)) { EnSsh_SetDropAnimation(this); EnSsh_SetupAction(this, EnSsh_Drop); } else { - EnSsh_Bob(this, globalCtx); + EnSsh_Bob(this, play); } } -void EnSsh_Talk(EnSsh* this, GlobalContext* globalCtx) { - EnSsh_Bob(this, globalCtx); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnSsh_Talk(EnSsh* this, PlayState* play) { + EnSsh_Bob(this, play); + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnSsh_Idle; } } -void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Idle(EnSsh* this, PlayState* play) { if (1) {} - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnSsh_Talk; if (this->actor.params == ENSSH_FATHER) { SET_EVENTCHKINF(EVENTCHKINF_96); @@ -680,7 +680,7 @@ void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx) { if ((this->animTimer != 0) && (DECR(this->animTimer) == 0)) { EnSsh_SetAnimation(this, SSH_ANIM_WAIT); } - if (!EnSsh_IsCloseToLink(this, globalCtx)) { + if (!EnSsh_IsCloseToLink(this, play)) { EnSsh_SetReturnAnimation(this); EnSsh_SetupAction(this, EnSsh_Return); } else { @@ -688,9 +688,9 @@ void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_LAUGH); this->sfxTimer = 64; } - EnSsh_Bob(this, globalCtx); + EnSsh_Bob(this, play); if ((this->unkTimer == 0) && (this->animTimer == 0)) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0xD); + this->actor.textId = Text_GetFaceReaction(play, 0xD); if (this->actor.textId == 0) { if (this->actor.params == ENSSH_FATHER) { if (gSaveContext.inventory.gsTokens >= 50) { @@ -712,13 +712,13 @@ void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx) { this->actor.textId = 0x22; } } - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } } -void EnSsh_Land(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Land(EnSsh* this, PlayState* play) { if ((this->unkTimer != 0) && (DECR(this->unkTimer) == 0)) { EnSsh_SetAnimation(this, SSH_ANIM_WAIT); } @@ -732,15 +732,15 @@ void EnSsh_Land(EnSsh* this, GlobalContext* globalCtx) { } } -void EnSsh_Drop(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Drop(EnSsh* this, PlayState* play) { if ((this->unkTimer != 0) && (DECR(this->unkTimer) == 0)) { EnSsh_SetAnimation(this, SSH_ANIM_DROP); } - if (!EnSsh_IsCloseToLink(this, globalCtx)) { + if (!EnSsh_IsCloseToLink(this, play)) { EnSsh_SetReturnAnimation(this); EnSsh_SetupAction(this, EnSsh_Return); } else if (EnSsh_IsCloseToGround(this)) { - EnSsh_SpawnShockwave(this, globalCtx); + EnSsh_SpawnShockwave(this, play); EnSsh_SetLandAnimation(this); EnSsh_SetupAction(this, EnSsh_Land); } else if (DECR(this->sfxTimer) == 0) { @@ -749,13 +749,13 @@ void EnSsh_Drop(EnSsh* this, GlobalContext* globalCtx) { } } -void EnSsh_Return(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Return(EnSsh* this, PlayState* play) { f32 frameRatio = this->skelAnime.curFrame / (this->skelAnime.animLength - 1.0f); if (frameRatio == 1.0f) { EnSsh_SetReturnAnimation(this); } - if (EnSsh_IsCloseToLink(this, globalCtx)) { + if (EnSsh_IsCloseToLink(this, play)) { EnSsh_SetDropAnimation(this); EnSsh_SetupAction(this, EnSsh_Drop); } else if (EnSsh_IsCloseToHome(this)) { @@ -788,24 +788,24 @@ void EnSsh_UpdateColliderScale(EnSsh* this) { } } -void EnSsh_Start(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Start(EnSsh* this, PlayState* play) { if (!EnSsh_IsCloseToGround(this)) { EnSsh_SetupAction(this, EnSsh_Wait); - EnSsh_Wait(this, globalCtx); + EnSsh_Wait(this, play); } else { EnSsh_SetLandAnimation(this); this->stateFlags |= 4; EnSsh_SetupAction(this, EnSsh_Land); - EnSsh_Land(this, globalCtx); + EnSsh_Land(this, play); } } -void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSsh_Update(Actor* thisx, PlayState* play) { s32 pad; EnSsh* this = (EnSsh*)thisx; EnSsh_UpdateColliderScale(this); - if (EnSsh_CollisionCheck(this, globalCtx)) { + if (EnSsh_CollisionCheck(this, play)) { return; // EnSsh_CollisionCheck always returns false, so this never happens } if (this->stunTimer != 0) { @@ -813,10 +813,10 @@ void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx) { } else { SkelAnime_Update(&this->skelAnime); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + this->actionFunc(this, play); } - EnSsh_UpdateYaw(this, globalCtx); + EnSsh_UpdateYaw(this, play); if (DECR(this->blinkTimer) == 0) { this->blinkTimer = Rand_S16Offset(60, 60); } @@ -824,11 +824,11 @@ void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->blinkState >= 3) { this->blinkState = 0; } - EnSsh_SetColliders(this, globalCtx); + EnSsh_SetColliders(this, play); Actor_SetFocus(&this->actor, 0.0f); } -s32 EnSsh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSsh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSsh* this = (EnSsh*)thisx; switch (limbIndex) { @@ -860,13 +860,13 @@ s32 EnSsh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnSsh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnSsh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSsh* this = (EnSsh*)thisx; Collider_UpdateSpheres(limbIndex, &this->colSph); } -void EnSsh_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSsh_Draw(Actor* thisx, PlayState* play) { static void* blinkTex[] = { object_ssh_Tex_0007E0, object_ssh_Tex_000C60, @@ -875,11 +875,11 @@ void EnSsh_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnSsh* this = (EnSsh*)thisx; - EnSsh_CheckBodyStickHit(this, globalCtx); + EnSsh_CheckBodyStickHit(this, play); EnSsh_Sway(this); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ssh.c", 2333); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ssh.c", 2333); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(blinkTex[this->blinkState])); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ssh.c", 2336); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSsh_OverrideLimbDraw, + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ssh.c", 2336); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSsh_OverrideLimbDraw, EnSsh_PostLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h index 1cb04e59ce..3060fb6fb7 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h @@ -6,7 +6,7 @@ struct EnSsh; -typedef void (*EnSshActionFunc)(struct EnSsh*, GlobalContext*); +typedef void (*EnSshActionFunc)(struct EnSsh*, PlayState*); typedef struct EnSsh { /* 0x0000 */ Actor actor; 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 17a3737f49..d51f260470 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -9,17 +9,17 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnSt_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSt_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSt_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnSt_ReturnToCeiling(EnSt* this, GlobalContext* globalCtx); -void EnSt_MoveToGround(EnSt* this, GlobalContext* globalCtx); -void EnSt_StartOnCeilingOrGround(EnSt* this, GlobalContext* globalCtx); -void EnSt_WaitOnGround(EnSt* this, GlobalContext* globalCtx); -void EnSt_Die(EnSt* this, GlobalContext* globalCtx); -void EnSt_BounceAround(EnSt* this, GlobalContext* globalCtx); -void EnSt_FinishBouncing(EnSt* this, GlobalContext* globalCtx); +void EnSt_Init(Actor* thisx, PlayState* play); +void EnSt_Destroy(Actor* thisx, PlayState* play); +void EnSt_Update(Actor* thisx, PlayState* play); +void EnSt_Draw(Actor* thisx, PlayState* play); +void EnSt_ReturnToCeiling(EnSt* this, PlayState* play); +void EnSt_MoveToGround(EnSt* this, PlayState* play); +void EnSt_StartOnCeilingOrGround(EnSt* this, PlayState* play); +void EnSt_WaitOnGround(EnSt* this, PlayState* play); +void EnSt_Die(EnSt* this, PlayState* play); +void EnSt_BounceAround(EnSt* this, PlayState* play); +void EnSt_FinishBouncing(EnSt* this, PlayState* play); #include "overlays/ovl_En_St/ovl_En_St.c" @@ -133,7 +133,7 @@ void EnSt_SetupAction(EnSt* this, EnStActionFunc actionFunc) { /** * Spawns `dustCnt` dust particles in a random pattern around the Skulltula */ -void EnSt_SpawnDust(EnSt* this, GlobalContext* globalCtx, s32 dustCnt) { +void EnSt_SpawnDust(EnSt* this, PlayState* play, s32 dustCnt) { Color_RGBA8 primColor = { 170, 130, 90, 255 }; Color_RGBA8 envColor = { 100, 60, 20, 0 }; Vec3f dustVel = { 0.0f, 0.0f, 0.0f }; @@ -149,11 +149,11 @@ void EnSt_SpawnDust(EnSt* this, GlobalContext* globalCtx, s32 dustCnt) { dustAccel.z = (Rand_ZeroOne() - 0.5f) * 4.0f; dustPos.x = this->actor.world.pos.x + (Math_SinS(yAngle) * 22.0f); dustPos.z = this->actor.world.pos.z + (Math_CosS(yAngle) * 22.0f); - func_8002836C(globalCtx, &dustPos, &dustVel, &dustAccel, &primColor, &envColor, 120, 40, 10); + func_8002836C(play, &dustPos, &dustVel, &dustAccel, &primColor, &envColor, 120, 40, 10); } } -void EnSt_SpawnBlastEffect(EnSt* this, GlobalContext* globalCtx) { +void EnSt_SpawnBlastEffect(EnSt* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f blastPos; @@ -161,20 +161,20 @@ void EnSt_SpawnBlastEffect(EnSt* this, GlobalContext* globalCtx) { blastPos.y = this->actor.floorHeight; blastPos.z = this->actor.world.pos.z; - EffectSsBlast_SpawnWhiteCustomScale(globalCtx, &blastPos, &zeroVec, &zeroVec, 100, 220, 8); + EffectSsBlast_SpawnWhiteCustomScale(play, &blastPos, &zeroVec, &zeroVec, 100, 220, 8); } -void EnSt_SpawnDeadEffect(EnSt* this, GlobalContext* globalCtx) { +void EnSt_SpawnDeadEffect(EnSt* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f firePos; firePos.x = this->actor.world.pos.x + ((Rand_ZeroOne() - 0.5f) * 60.0f); firePos.y = (this->actor.world.pos.y + 10.0f) + ((Rand_ZeroOne() - 0.5f) * 45.0f); firePos.z = this->actor.world.pos.z + ((Rand_ZeroOne() - 0.5f) * 60.0f); - EffectSsDeadDb_Spawn(globalCtx, &firePos, &zeroVec, &zeroVec, 100, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); + EffectSsDeadDb_Spawn(play, &firePos, &zeroVec, &zeroVec, 100, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); } -s32 EnSt_CreateBlureEffect(GlobalContext* globalCtx) { +s32 EnSt_CreateBlureEffect(PlayState* play) { EffectBlureInit1 blureInit; u8 p1StartColor[] = { 255, 255, 255, 75 }; u8 p2StartColor[] = { 255, 255, 255, 75 }; @@ -194,7 +194,7 @@ s32 EnSt_CreateBlureEffect(GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 3; - Effect_Add(globalCtx, &blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); return blureIdx; } @@ -202,7 +202,7 @@ s32 EnSt_CreateBlureEffect(GlobalContext* globalCtx) { * Checks for the position of the ceiling above the Skulltula. * If no ceiling is found it is set to 1000 units above the Skulltula */ -s32 EnSt_CheckCeilingPos(EnSt* this, GlobalContext* globalCtx) { +s32 EnSt_CheckCeilingPos(EnSt* this, PlayState* play) { CollisionPoly* poly; s32 bgId; Vec3f checkPos; @@ -210,7 +210,7 @@ s32 EnSt_CheckCeilingPos(EnSt* this, GlobalContext* globalCtx) { checkPos.x = this->actor.world.pos.x; checkPos.y = this->actor.world.pos.y + 1000.0f; checkPos.z = this->actor.world.pos.z; - if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &checkPos, &this->ceilingPos, &poly, false, + if (!BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &checkPos, &this->ceilingPos, &poly, false, false, true, true, &bgId)) { return false; } @@ -272,7 +272,7 @@ void EnSt_SetDropAnimAndVel(EnSt* this) { /** * Initalizes the Skulltula's 6 cylinders, and sphere collider. */ -void EnSt_InitColliders(EnSt* this, GlobalContext* globalCtx) { +void EnSt_InitColliders(EnSt* this, PlayState* play) { ColliderCylinderInit* cylinders[6] = { &sCylinderInit, &sCylinderInit, &sCylinderInit, &sCylinderInit2, &sCylinderInit2, &sCylinderInit2, }; @@ -281,8 +281,8 @@ void EnSt_InitColliders(EnSt* this, GlobalContext* globalCtx) { s32 pad; for (i = 0; i < ARRAY_COUNT(cylinders); i++) { - Collider_InitCylinder(globalCtx, &this->colCylinder[i]); - Collider_SetCylinder(globalCtx, &this->colCylinder[i], &this->actor, cylinders[i]); + Collider_InitCylinder(play, &this->colCylinder[i]); + Collider_SetCylinder(play, &this->colCylinder[i], &this->actor, cylinders[i]); } this->colCylinder[0].info.bumper.dmgFlags = 0x0003F8F9; @@ -294,13 +294,13 @@ void EnSt_InitColliders(EnSt* this, GlobalContext* globalCtx) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(2), &sColChkInit); - Collider_InitJntSph(globalCtx, &this->colSph); - Collider_SetJntSph(globalCtx, &this->colSph, &this->actor, &sJntSphInit, this->colSphItems); + Collider_InitJntSph(play, &this->colSph); + Collider_SetJntSph(play, &this->colSph, &this->actor, &sJntSphInit, this->colSphItems); } -void EnSt_CheckBodyStickHit(EnSt* this, GlobalContext* globalCtx) { +void EnSt_CheckBodyStickHit(EnSt* this, PlayState* play) { ColliderInfo* body = &this->colCylinder[0].info; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->unk_860 != 0) { body->bumper.dmgFlags |= 2; @@ -313,24 +313,24 @@ void EnSt_CheckBodyStickHit(EnSt* this, GlobalContext* globalCtx) { } } -void EnSt_SetBodyCylinderAC(EnSt* this, GlobalContext* globalCtx) { +void EnSt_SetBodyCylinderAC(EnSt* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->colCylinder[0]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[0].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[0].base); } -void EnSt_SetLegsCylinderAC(EnSt* this, GlobalContext* globalCtx) { +void EnSt_SetLegsCylinderAC(EnSt* this, PlayState* play) { s16 angleTowardsLink = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if (angleTowardsLink < 0x3FFC) { Collider_UpdateCylinder(&this->actor, &this->colCylinder[2]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[2].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[2].base); } else { Collider_UpdateCylinder(&this->actor, &this->colCylinder[1]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[1].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[1].base); } } -s32 EnSt_SetCylinderOC(EnSt* this, GlobalContext* globalCtx) { +s32 EnSt_SetCylinderOC(EnSt* this, PlayState* play) { Vec3f cyloffsets[] = { { 40.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, @@ -352,30 +352,30 @@ s32 EnSt_SetCylinderOC(EnSt* this, GlobalContext* globalCtx) { this->colCylinder[i + 3].dim.pos.x = cylPos.x; this->colCylinder[i + 3].dim.pos.y = cylPos.y; this->colCylinder[i + 3].dim.pos.z = cylPos.z; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[i + 3].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCylinder[i + 3].base); } return true; } -void EnSt_UpdateCylinders(EnSt* this, GlobalContext* globalCtx) { +void EnSt_UpdateCylinders(EnSt* this, PlayState* play) { if ((this->actor.colChkInfo.health != 0) || (this->actionFunc == EnSt_FinishBouncing)) { if (DECR(this->gaveDamageSpinTimer) == 0) { - EnSt_SetCylinderOC(this, globalCtx); + EnSt_SetCylinderOC(this, play); } DECR(this->invulnerableTimer); DECR(this->takeDamageSpinTimer); if (this->invulnerableTimer == 0 && this->takeDamageSpinTimer == 0) { - EnSt_SetBodyCylinderAC(this, globalCtx); - EnSt_SetLegsCylinderAC(this, globalCtx); + EnSt_SetBodyCylinderAC(this, play); + EnSt_SetLegsCylinderAC(this, play); } } } -s32 EnSt_CheckHitLink(EnSt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnSt_CheckHitLink(EnSt* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 hit; s32 i; @@ -396,9 +396,9 @@ s32 EnSt_CheckHitLink(EnSt* this, GlobalContext* globalCtx) { } this->gaveDamageSpinTimer = 30; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); - func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); + func_8002F71C(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); return true; } @@ -417,7 +417,7 @@ s32 EnSt_CheckHitFrontside(EnSt* this) { } } -s32 EnSt_CheckHitBackside(EnSt* this, GlobalContext* globalCtx) { +s32 EnSt_CheckHitBackside(EnSt* this, PlayState* play) { ColliderCylinder* cyl = &this->colCylinder[0]; s32 flags = 0; // ac hit flags from colliders 0 and 1 s32 hit = false; @@ -458,7 +458,7 @@ s32 EnSt_CheckHitBackside(EnSt* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_DAMAGE); return false; } - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_0; this->groundBounces = 3; this->deathTimer = 20; @@ -480,24 +480,24 @@ s32 EnSt_CheckHitBackside(EnSt* this, GlobalContext* globalCtx) { /** * Checks if the Skulltula's colliders have been hit, returns true if the hit has dealt damage to the Skulltula */ -s32 EnSt_CheckColliders(EnSt* this, GlobalContext* globalCtx) { +s32 EnSt_CheckColliders(EnSt* this, PlayState* play) { if (EnSt_CheckHitFrontside(this)) { // player has hit the front shield area of the Skulltula return false; } - if (globalCtx->actorCtx.unk_02 != 0) { + if (play->actorCtx.unk_02 != 0) { return true; } - if (EnSt_CheckHitBackside(this, globalCtx)) { + if (EnSt_CheckHitBackside(this, play)) { // player has hit the backside of the Skulltula return true; } if (this->stunTimer == 0 && this->takeDamageSpinTimer == 0) { // check if the Skulltula has hit link. - EnSt_CheckHitLink(this, globalCtx); + EnSt_CheckHitLink(this, play); } return false; } @@ -565,7 +565,7 @@ s32 EnSt_DecrStunTimer(EnSt* this) { * turning, and the actual turning to face away from the player, and then back to * face the player */ -void EnSt_UpdateYaw(EnSt* this, GlobalContext* globalCtx) { +void EnSt_UpdateYaw(EnSt* this, PlayState* play) { u16 yawDir = 0; Vec3s rot; s16 yawDiff; @@ -648,7 +648,7 @@ void EnSt_UpdateYaw(EnSt* this, GlobalContext* globalCtx) { * Checks to see if the Skulltula is done bouncing on the ground, * spawns dust particles as the Skulltula hits the ground */ -s32 EnSt_IsDoneBouncing(EnSt* this, GlobalContext* globalCtx) { +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 return false; @@ -660,7 +660,7 @@ s32 EnSt_IsDoneBouncing(EnSt* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); - EnSt_SpawnDust(this, globalCtx, 10); + EnSt_SpawnDust(this, play, 10); // creates an elastic bouncing effect, boucing up less for each hit on the ground. this->actor.velocity.y = 6.0f / (4 - this->groundBounces); this->groundBounces--; @@ -673,17 +673,17 @@ s32 EnSt_IsDoneBouncing(EnSt* this, GlobalContext* globalCtx) { return true; } -void EnSt_Bob(EnSt* this, GlobalContext* globalCtx) { +void EnSt_Bob(EnSt* this, PlayState* play) { f32 ySpeedTarget = 0.5f; - if ((globalCtx->state.frames & 8) != 0) { + if ((play->state.frames & 8) != 0) { ySpeedTarget *= -1.0f; } Math_SmoothStepToF(&this->actor.velocity.y, ySpeedTarget, 0.4f, 1000.0f, 0.0f); } -s32 EnSt_IsCloseToPlayer(EnSt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnSt_IsCloseToPlayer(EnSt* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 yDist; if (this->takeDamageSpinTimer != 0) { @@ -774,15 +774,15 @@ void EnSt_Sway(EnSt* this) { } } -void EnSt_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSt_Init(Actor* thisx, PlayState* play) { EnSt* this = (EnSt*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 14.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); + SkelAnime_Init(play, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_0); - this->blureIdx = EnSt_CreateBlureEffect(globalCtx); - EnSt_InitColliders(this, globalCtx); + this->blureIdx = EnSt_CreateBlureEffect(play); + EnSt_InitColliders(this, play); if (thisx->params == 2) { this->actor.flags |= ACTOR_FLAG_7; } @@ -791,7 +791,7 @@ void EnSt_Init(Actor* thisx, GlobalContext* globalCtx) { } else { this->actor.naviEnemyId = NAVI_ENEMY_SKULLTULA; } - EnSt_CheckCeilingPos(this, globalCtx); + EnSt_CheckCeilingPos(this, play); this->actor.flags |= ACTOR_FLAG_14; this->actor.flags |= ACTOR_FLAG_24; EnSt_SetColliderScale(this); @@ -800,23 +800,23 @@ void EnSt_Init(Actor* thisx, GlobalContext* globalCtx) { EnSt_SetupAction(this, EnSt_StartOnCeilingOrGround); } -void EnSt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSt_Destroy(Actor* thisx, PlayState* play) { EnSt* this = (EnSt*)thisx; s32 i; - Effect_Delete(globalCtx, this->blureIdx); + Effect_Delete(play, this->blureIdx); for (i = 0; i < 6; i++) { - Collider_DestroyCylinder(globalCtx, &this->colCylinder[i]); + Collider_DestroyCylinder(play, &this->colCylinder[i]); } - Collider_DestroyJntSph(globalCtx, &this->colSph); + Collider_DestroyJntSph(play, &this->colSph); } -void EnSt_WaitOnCeiling(EnSt* this, GlobalContext* globalCtx) { - if (EnSt_IsCloseToPlayer(this, globalCtx)) { +void EnSt_WaitOnCeiling(EnSt* this, PlayState* play) { + if (EnSt_IsCloseToPlayer(this, play)) { EnSt_SetDropAnimAndVel(this); EnSt_SetupAction(this, EnSt_MoveToGround); } else { - EnSt_Bob(this, globalCtx); + EnSt_Bob(this, play); } } @@ -824,7 +824,7 @@ void EnSt_WaitOnCeiling(EnSt* this, GlobalContext* globalCtx) { * Skulltula is waiting on the ground for the player to move away, or for * a collider to have contact */ -void EnSt_WaitOnGround(EnSt* this, GlobalContext* globalCtx) { +void EnSt_WaitOnGround(EnSt* this, PlayState* play) { if (this->takeDamageSpinTimer != 0) { this->takeDamageSpinTimer--; if (this->takeDamageSpinTimer == 0) { @@ -839,7 +839,7 @@ void EnSt_WaitOnGround(EnSt* this, GlobalContext* globalCtx) { } } - if (!EnSt_IsCloseToPlayer(this, globalCtx)) { + if (!EnSt_IsCloseToPlayer(this, play)) { // Player is no longer within range, return to ceiling. EnSt_SetReturnToCeilingAnimation(this); EnSt_SetupAction(this, EnSt_ReturnToCeiling); @@ -853,10 +853,10 @@ void EnSt_WaitOnGround(EnSt* this, GlobalContext* globalCtx) { } // simply bob up and down. - EnSt_Bob(this, globalCtx); + EnSt_Bob(this, play); } -void EnSt_LandOnGround(EnSt* this, GlobalContext* globalCtx) { +void EnSt_LandOnGround(EnSt* this, PlayState* play) { if (this->animFrames != 0) { this->animFrames--; if (this->animFrames == 0) { @@ -886,7 +886,7 @@ void EnSt_LandOnGround(EnSt* this, GlobalContext* globalCtx) { } } -void EnSt_MoveToGround(EnSt* this, GlobalContext* globalCtx) { +void EnSt_MoveToGround(EnSt* this, PlayState* play) { if (this->takeDamageSpinTimer != 0) { this->takeDamageSpinTimer--; if (this->takeDamageSpinTimer == 0) { @@ -894,13 +894,13 @@ void EnSt_MoveToGround(EnSt* this, GlobalContext* globalCtx) { } } - if (!EnSt_IsCloseToPlayer(this, globalCtx)) { + if (!EnSt_IsCloseToPlayer(this, play)) { // the player moved out of range, return to the ceiling. EnSt_SetReturnToCeilingAnimation(this); EnSt_SetupAction(this, EnSt_ReturnToCeiling); } else if (EnSt_IsCloseToGround(this)) { // The Skulltula has become close to the ground. - EnSt_SpawnBlastEffect(this, globalCtx); + EnSt_SpawnBlastEffect(this, play); EnSt_SetLandAnimation(this); EnSt_SetupAction(this, EnSt_LandOnGround); } else if (DECR(this->sfxTimer) == 0) { @@ -909,14 +909,14 @@ void EnSt_MoveToGround(EnSt* this, GlobalContext* globalCtx) { } } -void EnSt_ReturnToCeiling(EnSt* this, GlobalContext* globalCtx) { +void EnSt_ReturnToCeiling(EnSt* this, PlayState* play) { f32 animPctDone = this->skelAnime.curFrame / (this->skelAnime.animLength - 1.0f); if (animPctDone == 1.0f) { EnSt_SetReturnToCeilingAnimation(this); } - if (EnSt_IsCloseToPlayer(this, globalCtx)) { + if (EnSt_IsCloseToPlayer(this, play)) { // player came back into range EnSt_SetDropAnimAndVel(this); EnSt_SetupAction(this, EnSt_MoveToGround); @@ -933,13 +933,13 @@ void EnSt_ReturnToCeiling(EnSt* this, GlobalContext* globalCtx) { /** * The Skulltula has been killed, bounce around */ -void EnSt_BounceAround(EnSt* this, GlobalContext* globalCtx) { +void EnSt_BounceAround(EnSt* this, PlayState* play) { this->actor.colorFilterTimer = this->deathTimer; func_8002D868(&this->actor); this->actor.world.rot.x += 0x800; this->actor.world.rot.z -= 0x800; this->actor.shape.rot = this->actor.world.rot; - if (EnSt_IsDoneBouncing(this, globalCtx)) { + if (EnSt_IsDoneBouncing(this, play)) { this->actor.shape.yOffset = 400.0f; this->actor.speedXZ = 1.0f; this->actor.gravity = -2.0f; @@ -952,7 +952,7 @@ void EnSt_BounceAround(EnSt* this, GlobalContext* globalCtx) { /** * Finish up the bouncing animation, and rotate towards the final position */ -void EnSt_FinishBouncing(EnSt* this, GlobalContext* globalCtx) { +void EnSt_FinishBouncing(EnSt* this, PlayState* play) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; if (DECR(this->deathTimer) == 0) { @@ -975,41 +975,41 @@ void EnSt_FinishBouncing(EnSt* this, GlobalContext* globalCtx) { func_8002D868(&this->actor); this->groundBounces = 2; - EnSt_IsDoneBouncing(this, globalCtx); + EnSt_IsDoneBouncing(this, play); } /** * Spawn the enemy dying effects, and drop a random item */ -void EnSt_Die(EnSt* this, GlobalContext* globalCtx) { +void EnSt_Die(EnSt* this, PlayState* play) { if (DECR(this->finishDeathTimer) != 0) { - EnSt_SpawnDeadEffect(this, globalCtx); + EnSt_SpawnDeadEffect(this, play); } else { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0xE0); Actor_Kill(&this->actor); } } -void EnSt_StartOnCeilingOrGround(EnSt* this, GlobalContext* globalCtx) { +void EnSt_StartOnCeilingOrGround(EnSt* this, PlayState* play) { if (!EnSt_IsCloseToGround(this)) { this->rotAwayTimer = 60; EnSt_SetupAction(this, EnSt_WaitOnCeiling); - EnSt_WaitOnCeiling(this, globalCtx); + EnSt_WaitOnCeiling(this, play); } else { EnSt_SetLandAnimation(this); EnSt_SetupAction(this, EnSt_LandOnGround); - EnSt_LandOnGround(this, globalCtx); + EnSt_LandOnGround(this, play); } } -void EnSt_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSt_Update(Actor* thisx, PlayState* play) { EnSt* this = (EnSt*)thisx; s32 pad; Color_RGBA8 color = { 0, 0, 0, 0 }; if (this->actor.flags & ACTOR_FLAG_15) { SkelAnime_Update(&this->skelAnime); - } else if (!EnSt_CheckColliders(this, globalCtx)) { + } else if (!EnSt_CheckColliders(this, play)) { // no collision has been detected. if (this->stunTimer == 0) { @@ -1020,12 +1020,12 @@ void EnSt_Update(Actor* thisx, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + 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 // or swaying. - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } else if (this->stunTimer != 0) { // decrement the stun timer. EnSt_DecrStunTimer(this); @@ -1034,24 +1034,24 @@ void EnSt_Update(Actor* thisx, GlobalContext* globalCtx) { EnSt_Sway(this); } - EnSt_UpdateYaw(this, globalCtx); + EnSt_UpdateYaw(this, play); if (this->actionFunc == EnSt_WaitOnGround) { - if ((globalCtx->state.frames & 0x10) != 0) { + if ((play->state.frames & 0x10) != 0) { color.r = 255; } } EnSt_SetTeethColor(this, color.r, color.g, color.b, 8); - EnSt_UpdateCylinders(this, globalCtx); + EnSt_UpdateCylinders(this, play); Actor_SetFocus(&this->actor, 0.0f); } } -s32 EnSt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dListP, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dListP, Vec3f* pos, Vec3s* rot, void* thisx) { EnSt* this = (EnSt*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_st.c", 2260); + OPEN_DISPS(play->state.gfxCtx, "../z_en_st.c", 2260); switch (limbIndex) { case 1: if (this->gaveDamageSpinTimer != 0 && this->swayTimer == 0) { @@ -1068,21 +1068,21 @@ s32 EnSt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dListP, gDPSetEnvColor(POLY_OPA_DISP++, this->teethR, this->teethG, this->teethB, 0); break; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_st.c", 2295); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_st.c", 2295); return false; } -void EnSt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dListP, Vec3s* rot, void* thisx) { +void EnSt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dListP, Vec3s* rot, void* thisx) { EnSt* this = (EnSt*)thisx; Collider_UpdateSpheres(limbIndex, &this->colSph); } -void EnSt_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSt_Draw(Actor* thisx, PlayState* play) { EnSt* this = (EnSt*)thisx; - EnSt_CheckBodyStickHit(this, globalCtx); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSt_OverrideLimbDraw, + EnSt_CheckBodyStickHit(this, play); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSt_OverrideLimbDraw, EnSt_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_St/z_en_st.h b/src/overlays/actors/ovl_En_St/z_en_st.h index d6feb1106a..5b65c82e42 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.h +++ b/src/overlays/actors/ovl_En_St/z_en_st.h @@ -6,7 +6,7 @@ struct EnSt; -typedef void (*EnStActionFunc)(struct EnSt* this, GlobalContext* globalCtx); +typedef void (*EnStActionFunc)(struct EnSt* this, PlayState* play); typedef struct EnSt { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 84ec5d0ce8..2a25fb961e 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -11,16 +11,16 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnSth_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSth_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSth_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSth_Update2(Actor* thisx, GlobalContext* globalCtx); -void EnSth_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSth_Init(Actor* thisx, PlayState* play); +void EnSth_Destroy(Actor* thisx, PlayState* play); +void EnSth_Update(Actor* thisx, PlayState* play); +void EnSth_Update2(Actor* thisx, PlayState* play); +void EnSth_Draw(Actor* thisx, PlayState* play); -void EnSth_WaitForObjectLoaded(EnSth* this, GlobalContext* globalCtx); -void EnSth_ParentRewardObtainedWait(EnSth* this, GlobalContext* globalCtx); -void EnSth_RewardUnobtainedWait(EnSth* this, GlobalContext* globalCtx); -void EnSth_ChildRewardObtainedWait(EnSth* this, GlobalContext* globalCtx); +void EnSth_WaitForObjectLoaded(EnSth* this, PlayState* play); +void EnSth_ParentRewardObtainedWait(EnSth* this, PlayState* play); +void EnSth_RewardUnobtainedWait(EnSth* this, PlayState* play); +void EnSth_ChildRewardObtainedWait(EnSth* this, PlayState* play); const ActorInit En_Sth_InitVars = { ACTOR_EN_STH, @@ -92,7 +92,7 @@ void EnSth_SetupAction(EnSth* this, EnSthActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Init(Actor* thisx, PlayState* play) { EnSth* this = (EnSth*)thisx; s16 objectId; @@ -116,7 +116,7 @@ void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { objectId = sObjectIds[params]; if (objectId != 1) { - objectBankIdx = Object_GetIndex(&globalCtx->objectCtx, objectId); + objectBankIdx = Object_GetIndex(&play->objectCtx, objectId); } else { objectBankIdx = 0; } @@ -134,25 +134,25 @@ void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; } -void EnSth_SetupShapeColliderUpdate2AndDraw(EnSth* this, GlobalContext* globalCtx) { +void EnSth_SetupShapeColliderUpdate2AndDraw(EnSth* this, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.update = EnSth_Update2; this->actor.draw = this->drawFunc; } -void EnSth_SetupAfterObjectLoaded(EnSth* this, GlobalContext* globalCtx) { +void EnSth_SetupAfterObjectLoaded(EnSth* this, PlayState* play) { s32 pad; s16* params; - EnSth_SetupShapeColliderUpdate2AndDraw(this, globalCtx); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objectBankIdx].segment); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, sSkeletons[this->actor.params], NULL, this->jointTable, - this->morphTable, 16); + EnSth_SetupShapeColliderUpdate2AndDraw(this, play); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectBankIdx].segment); + SkelAnime_InitFlex(play, &this->skelAnime, sSkeletons[this->actor.params], NULL, this->jointTable, this->morphTable, + 16); Animation_PlayLoop(&this->skelAnime, sAnimations[this->actor.params]); this->eventFlag = sEventFlags[this->actor.params]; @@ -164,27 +164,27 @@ void EnSth_SetupAfterObjectLoaded(EnSth* this, GlobalContext* globalCtx) { } } -void EnSth_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Destroy(Actor* thisx, PlayState* play) { EnSth* this = (EnSth*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnSth_WaitForObjectLoaded(EnSth* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objectBankIdx)) { +void EnSth_WaitForObjectLoaded(EnSth* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objectBankIdx)) { this->actor.objBankIndex = this->objectBankIdx; this->actionFunc = EnSth_SetupAfterObjectLoaded; } } -void EnSth_FacePlayer(EnSth* this, GlobalContext* globalCtx) { +void EnSth_FacePlayer(EnSth* this, PlayState* play) { s32 pad; s16 diffRot = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS(diffRot) <= 0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos); } else { if (diffRot < 0) { Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 0x1838, 0x100); @@ -196,11 +196,11 @@ void EnSth_FacePlayer(EnSth* this, GlobalContext* globalCtx) { } } -void EnSth_LookAtPlayer(EnSth* this, GlobalContext* globalCtx) { +void EnSth_LookAtPlayer(EnSth* this, PlayState* play) { s16 diffRot = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(diffRot) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->headRot.x, 0, 6, 0x1838, 0x64); Math_SmoothStepToS(&this->headRot.y, 0, 6, 0x1838, 0x64); @@ -209,30 +209,30 @@ void EnSth_LookAtPlayer(EnSth* this, GlobalContext* globalCtx) { } } -void EnSth_RewardObtainedTalk(EnSth* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnSth_RewardObtainedTalk(EnSth* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.params == 0) { EnSth_SetupAction(this, EnSth_ParentRewardObtainedWait); } else { EnSth_SetupAction(this, EnSth_ChildRewardObtainedWait); } } - EnSth_FacePlayer(this, globalCtx); + EnSth_FacePlayer(this, play); } -void EnSth_ParentRewardObtainedWait(EnSth* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnSth_ParentRewardObtainedWait(EnSth* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { EnSth_SetupAction(this, EnSth_RewardObtainedTalk); } else { this->actor.textId = 0x23; if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } - EnSth_LookAtPlayer(this, globalCtx); + EnSth_LookAtPlayer(this, play); } -void EnSth_GivePlayerItem(EnSth* this, GlobalContext* globalCtx) { +void EnSth_GivePlayerItem(EnSth* this, PlayState* play) { u16 getItemId = sGetItemIds[this->actor.params]; switch (this->actor.params) { @@ -250,31 +250,31 @@ void EnSth_GivePlayerItem(EnSth* this, GlobalContext* globalCtx) { break; } - func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, getItemId, 10000.0f, 50.0f); } -void EnSth_GiveReward(EnSth* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnSth_GiveReward(EnSth* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; EnSth_SetupAction(this, EnSth_RewardObtainedTalk); gSaveContext.eventChkInf[EVENTCHKINF_DA_DB_DC_DD_DE_INDEX] |= this->eventFlag; } else { - EnSth_GivePlayerItem(this, globalCtx); + EnSth_GivePlayerItem(this, play); } - EnSth_FacePlayer(this, globalCtx); + EnSth_FacePlayer(this, play); } -void EnSth_RewardUnobtainedTalk(EnSth* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void EnSth_RewardUnobtainedTalk(EnSth* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); EnSth_SetupAction(this, EnSth_GiveReward); - EnSth_GivePlayerItem(this, globalCtx); + EnSth_GivePlayerItem(this, play); } - EnSth_FacePlayer(this, globalCtx); + EnSth_FacePlayer(this, play); } -void EnSth_RewardUnobtainedWait(EnSth* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnSth_RewardUnobtainedWait(EnSth* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { EnSth_SetupAction(this, EnSth_RewardUnobtainedTalk); } else { if (this->actor.params == 0) { @@ -283,14 +283,14 @@ void EnSth_RewardUnobtainedWait(EnSth* this, GlobalContext* globalCtx) { this->actor.textId = 0x21; } if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } - EnSth_LookAtPlayer(this, globalCtx); + EnSth_LookAtPlayer(this, play); } -void EnSth_ChildRewardObtainedWait(EnSth* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnSth_ChildRewardObtainedWait(EnSth* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { EnSth_SetupAction(this, EnSth_RewardObtainedTalk); } else { if (gSaveContext.inventory.gsTokens < 50) { @@ -299,30 +299,30 @@ void EnSth_ChildRewardObtainedWait(EnSth* this, GlobalContext* globalCtx) { this->actor.textId = 0x1F; } if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } - EnSth_LookAtPlayer(this, globalCtx); + EnSth_LookAtPlayer(this, play); } -void EnSth_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Update(Actor* thisx, PlayState* play) { EnSth* this = (EnSth*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnSth_Update2(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Update2(Actor* thisx, PlayState* play) { EnSth* this = (EnSth*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (SkelAnime_Update(&this->skelAnime)) { this->skelAnime.curFrame = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); // Likely an unused blink timer and eye index if (DECR(this->unk_2B6) == 0) { @@ -334,7 +334,7 @@ void EnSth_Update2(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnSth_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSth_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSth* this = (EnSth*)thisx; s32 temp_v1; @@ -352,57 +352,57 @@ s32 EnSth_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { temp_v1 = limbIndex * 0x32; - rot->y += (Math_SinS(globalCtx->state.frames * (temp_v1 + 0x814)) * 200.0f); - rot->z += (Math_CosS(globalCtx->state.frames * (temp_v1 + 0x940)) * 200.0f); + rot->y += (Math_SinS(play->state.frames * (temp_v1 + 0x814)) * 200.0f); + rot->z += (Math_CosS(play->state.frames * (temp_v1 + 0x940)) * 200.0f); } return 0; } -void EnSth_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnSth_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSth* this = (EnSth*)thisx; if (limbIndex == 15) { Matrix_MultVec3f(&D_80B0B49C, &this->actor.focus.pos); if (this->actor.params != 0) { // Children - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_sth.c", 2079); + OPEN_DISPS(play->state.gfxCtx, "../z_en_sth.c", 2079); gSPDisplayList(POLY_OPA_DISP++, D_80B0A3C0); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_sth.c", 2081); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_sth.c", 2081); } } } -Gfx* EnSth_AllocColorDList(GraphicsContext* globalCtx, u8 envR, u8 envG, u8 envB, u8 envA) { +Gfx* EnSth_AllocColorDList(GraphicsContext* play, u8 envR, u8 envG, u8 envB, u8 envA) { Gfx* dList; - dList = Graph_Alloc(globalCtx, 2 * sizeof(Gfx)); + dList = Graph_Alloc(play, 2 * sizeof(Gfx)); gDPSetEnvColor(dList, envR, envG, envB, envA); gSPEndDisplayList(dList + 1); return dList; } -void EnSth_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Draw(Actor* thisx, PlayState* play) { EnSth* this = (EnSth*)thisx; Color_RGB8* envColor1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_sth.c", 2133); + OPEN_DISPS(play->state.gfxCtx, "../z_en_sth.c", 2133); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objectBankIdx].segment); - func_800943C8(globalCtx->state.gfxCtx); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectBankIdx].segment); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - EnSth_AllocColorDList(globalCtx->state.gfxCtx, sTunicColors[this->actor.params].r, + EnSth_AllocColorDList(play->state.gfxCtx, sTunicColors[this->actor.params].r, sTunicColors[this->actor.params].g, sTunicColors[this->actor.params].b, 255)); if (this->actor.params == 0) { - gSPSegment(POLY_OPA_DISP++, 0x09, EnSth_AllocColorDList(globalCtx->state.gfxCtx, 190, 110, 0, 255)); + gSPSegment(POLY_OPA_DISP++, 0x09, EnSth_AllocColorDList(play->state.gfxCtx, 190, 110, 0, 255)); } else { - gSPSegment(POLY_OPA_DISP++, 0x09, EnSth_AllocColorDList(globalCtx->state.gfxCtx, 90, 110, 130, 255)); + gSPSegment(POLY_OPA_DISP++, 0x09, EnSth_AllocColorDList(play->state.gfxCtx, 90, 110, 130, 255)); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnSth_OverrideLimbDraw, EnSth_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_sth.c", 2176); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_sth.c", 2176); } diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.h b/src/overlays/actors/ovl_En_Sth/z_en_sth.h index ce90fbfdd1..dec16c4e1e 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.h +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.h @@ -6,7 +6,7 @@ struct EnSth; -typedef void (*EnSthActionFunc)(struct EnSth*, GlobalContext*); +typedef void (*EnSthActionFunc)(struct EnSth*, PlayState*); typedef struct EnSth { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Stream/z_en_stream.c b/src/overlays/actors/ovl_En_Stream/z_en_stream.c index f346d3a923..b46f392d54 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.c +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.c @@ -9,11 +9,11 @@ #define FLAGS ACTOR_FLAG_4 -void EnStream_Init(Actor* thisx, GlobalContext* globalCtx); -void EnStream_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnStream_Update(Actor* thisx, GlobalContext* globalCtx); -void EnStream_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnStream_WaitForPlayer(EnStream* this, GlobalContext* globalCtx); +void EnStream_Init(Actor* thisx, PlayState* play); +void EnStream_Destroy(Actor* thisx, PlayState* play); +void EnStream_Update(Actor* thisx, PlayState* play); +void EnStream_Draw(Actor* thisx, PlayState* play); +void EnStream_WaitForPlayer(EnStream* this, PlayState* play); const ActorInit En_Stream_InitVars = { ACTOR_EN_STREAM, @@ -35,7 +35,7 @@ void EnStream_SetupAction(EnStream* this, EnStreamActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnStream_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnStream_Init(Actor* thisx, PlayState* play) { EnStream* this = (EnStream*)thisx; this->unk_150 = thisx->params & 0xFF; @@ -46,7 +46,7 @@ void EnStream_Init(Actor* thisx, GlobalContext* globalCtx) { EnStream_SetupAction(this, EnStream_WaitForPlayer); } -void EnStream_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnStream_Destroy(Actor* thisx, PlayState* play) { } // Checks if the player is in range of the vortex @@ -79,8 +79,8 @@ s32 func_80B0B81C(Vec3f* vortexPosRot, Vec3f* playerPosRot, Vec3f* posDifference return ret; } -void EnStream_SuckPlayer(EnStream* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnStream_SuckPlayer(EnStream* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad48; Vec3f posDifference; f32 xzDist; @@ -110,8 +110,8 @@ void EnStream_SuckPlayer(EnStream* this, GlobalContext* globalCtx) { } } -void EnStream_WaitForPlayer(EnStream* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnStream_WaitForPlayer(EnStream* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 pad; Vec3f temp; @@ -120,25 +120,25 @@ void EnStream_WaitForPlayer(EnStream* this, GlobalContext* globalCtx) { } } -void EnStream_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnStream_Update(Actor* thisx, PlayState* play) { EnStream* this = (EnStream*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_8002F948(thisx, NA_SE_EV_WHIRLPOOL - SFX_FLAG); } -void EnStream_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnStream_Draw(Actor* thisx, PlayState* play) { u32 multipliedFrames; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_stream.c", 295); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_stream.c", 299), + OPEN_DISPS(play->state.gfxCtx, "../z_en_stream.c", 295); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_stream.c", 299), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); multipliedFrames = frames * 20; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 30, -multipliedFrames, 0x40, 0x40, 1, - multipliedFrames, -multipliedFrames, 0x40, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 30, -multipliedFrames, 0x40, 0x40, 1, multipliedFrames, + -multipliedFrames, 0x40, 0x40)); gSPDisplayList(POLY_XLU_DISP++, object_stream_DL_000950); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_stream.c", 310); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_stream.c", 310); } diff --git a/src/overlays/actors/ovl_En_Stream/z_en_stream.h b/src/overlays/actors/ovl_En_Stream/z_en_stream.h index 228fff4de0..199d1c6797 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.h +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.h @@ -6,7 +6,7 @@ struct EnStream; -typedef void (*EnStreamActionFunc)(struct EnStream*, GlobalContext*); +typedef void (*EnStreamActionFunc)(struct EnStream*, PlayState*); typedef struct EnStream { /* 0x0000 */ Actor actor; 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 1bf1f8a8f2..2baff8c04c 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -3,22 +3,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnSw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSw_Draw(Actor* thisx, GlobalContext* globalCtx); -s32 func_80B0DFFC(EnSw* this, GlobalContext* globalCtx); -void func_80B0D364(EnSw* this, GlobalContext* globalCtx); -void func_80B0E5E0(EnSw* this, GlobalContext* globalCtx); -void func_80B0D590(EnSw* this, GlobalContext* globalCtx); -void func_80B0E90C(EnSw* this, GlobalContext* globalCtx); -void func_80B0E9BC(EnSw* this, GlobalContext* globalCtx); -void func_80B0E728(EnSw* this, GlobalContext* globalCtx); -void func_80B0DC7C(EnSw* this, GlobalContext* globalCtx); -s32 func_80B0C0CC(EnSw* this, GlobalContext* globalCtx, s32); -void func_80B0D3AC(EnSw* this, GlobalContext* globalCtx); -void func_80B0DB00(EnSw* this, GlobalContext* globalCtx); -void func_80B0D878(EnSw* this, GlobalContext* globalCtx); +void EnSw_Init(Actor* thisx, PlayState* play); +void EnSw_Destroy(Actor* thisx, PlayState* play); +void EnSw_Update(Actor* thisx, PlayState* play); +void EnSw_Draw(Actor* thisx, PlayState* play); +s32 func_80B0DFFC(EnSw* this, PlayState* play); +void func_80B0D364(EnSw* this, PlayState* play); +void func_80B0E5E0(EnSw* this, PlayState* play); +void func_80B0D590(EnSw* this, PlayState* play); +void func_80B0E90C(EnSw* this, PlayState* play); +void func_80B0E9BC(EnSw* this, PlayState* play); +void func_80B0E728(EnSw* this, PlayState* play); +void func_80B0DC7C(EnSw* this, PlayState* play); +s32 func_80B0C0CC(EnSw* this, PlayState* play, s32); +void func_80B0D3AC(EnSw* this, PlayState* play); +void func_80B0DB00(EnSw* this, PlayState* play); +void func_80B0D878(EnSw* this, PlayState* play); const ActorInit En_Sw_InitVars = { ACTOR_EN_SW, @@ -114,26 +114,26 @@ s32 func_80B0BE20(EnSw* this, CollisionPoly* poly) { //! @bug: Does not return. } -CollisionPoly* func_80B0C020(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32* arg4) { +CollisionPoly* func_80B0C020(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32* arg4) { CollisionPoly* sp3C; s32 pad; - if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, arg1, arg2, arg3, &sp3C, true, true, true, false, arg4)) { + if (!BgCheck_EntityLineTest1(&play->colCtx, arg1, arg2, arg3, &sp3C, true, true, true, false, arg4)) { return NULL; } - if (func_80041DB8(&globalCtx->colCtx, sp3C, *arg4) & 0x30) { + if (func_80041DB8(&play->colCtx, sp3C, *arg4) & 0x30) { return NULL; } - if (SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, sp3C, *arg4)) { + if (SurfaceType_IsIgnoredByProjectiles(&play->colCtx, sp3C, *arg4)) { return NULL; } return sp3C; } -s32 func_80B0C0CC(EnSw* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_80B0C0CC(EnSw* this, PlayState* play, s32 arg2) { CollisionPoly* temp_v0_2; CollisionPoly* temp_s1; Vec3f sp9C; @@ -155,13 +155,13 @@ s32 func_80B0C0CC(EnSw* this, GlobalContext* globalCtx, s32 arg2) { sp78.x -= this->unk_364.x * 18.0f; sp78.y -= this->unk_364.y * 18.0f; sp78.z -= this->unk_364.z * 18.0f; - temp_s1 = func_80B0C020(globalCtx, &sp84, &sp78, &sp90, &sp70); + temp_s1 = func_80B0C020(play, &sp84, &sp78, &sp90, &sp70); if ((temp_s1 != NULL) && (this->unk_360 == 0)) { sp78.x = sp84.x + (this->unk_37C.x * 24); sp78.y = sp84.y + (this->unk_37C.y * 24); sp78.z = sp84.z + (this->unk_37C.z * 24); - temp_v0_2 = func_80B0C020(globalCtx, &sp84, &sp78, &sp9C, &sp6C); + temp_v0_2 = func_80B0C020(play, &sp84, &sp78, &sp9C, &sp6C); if (temp_v0_2 != NULL) { if (arg2 == 1) { func_80B0BE20(this, temp_v0_2); @@ -193,7 +193,7 @@ s32 func_80B0C0CC(EnSw* this, GlobalContext* globalCtx, s32 arg2) { sp78.y = sp84.y - (this->unk_370.y * 24.0f); sp78.z = sp84.z - (this->unk_370.z * 24.0f); } - temp_v0_2 = func_80B0C020(globalCtx, &sp84, &sp78, &sp9C, &sp6C); + temp_v0_2 = func_80B0C020(play, &sp84, &sp78, &sp9C, &sp6C); if (temp_v0_2 != NULL) { if (arg2 == 1) { func_80B0BE20(this, temp_v0_2); @@ -213,7 +213,7 @@ s32 func_80B0C0CC(EnSw* this, GlobalContext* globalCtx, s32 arg2) { return sp64; } -void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Init(Actor* thisx, PlayState* play) { EnSw* this = (EnSw*)thisx; s32 phi_v0; Vec3f sp4C = { 0.0f, 0.0f, 0.0f }; @@ -235,11 +235,11 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - SkelAnime_Init(globalCtx, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); + SkelAnime_Init(play, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENSW_ANIM_0); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->sphs); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->sphs); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0xE), &D_80B0F074); this->actor.scale.x = 0.02f; @@ -250,7 +250,7 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_484.y = this->actor.world.pos.y; this->unk_484.x = this->actor.world.pos.x + (Math_SinS(this->actor.world.rot.y) * -60.0f); this->unk_484.z = this->actor.world.pos.z + (Math_CosS(this->actor.world.rot.y) * -60.0f); - func_80B0DFFC(this, globalCtx); + func_80B0DFFC(this, play); this->actor.home.pos = this->actor.world.pos; } else { this->unk_370.x = Math_SinS(thisx->shape.rot.y + 0x4000); @@ -262,7 +262,7 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_37C.x = Math_SinS(thisx->shape.rot.y); this->unk_37C.y = 0.0f; this->unk_37C.z = Math_CosS(thisx->shape.rot.y); - func_80B0C0CC(this, globalCtx, 1); + func_80B0C0CC(this, play, 1); } if (((thisx->params & 0xE000) >> 0xD) >= 3) { @@ -286,7 +286,7 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; break; default: - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); this->actor.naviEnemyId = NAVI_ENEMY_SKULLWALLTULA; break; } @@ -307,17 +307,17 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnSw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Destroy(Actor* thisx, PlayState* play) { EnSw* this = (EnSw*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -s32 func_80B0C9F0(EnSw* this, GlobalContext* globalCtx) { +s32 func_80B0C9F0(EnSw* this, PlayState* play) { s32 phi_v1 = false; if (this->actor.xyzDistToPlayerSq < SQ(400.0f) && ((this->actor.params & 0xE000) >> 0xD) == 0 && - globalCtx->actorCtx.unk_02 != 0) { + play->actorCtx.unk_02 != 0) { this->actor.colChkInfo.damage = this->actor.colChkInfo.health; phi_v1 = true; @@ -332,10 +332,10 @@ s32 func_80B0C9F0(EnSw* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_DAMAGE); return true; } - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); if (((this->actor.params & 0xE000) >> 0xD) != 0) { this->skelAnime.playSpeed = 8.0f; - if ((globalCtx->state.frames & 1) == 0) { + if ((play->state.frames & 1) == 0) { this->unk_420 = 0.1f; } else { this->unk_420 = -0.1f; @@ -366,21 +366,21 @@ s32 func_80B0C9F0(EnSw* this, GlobalContext* globalCtx) { return false; } -void func_80B0CBE8(EnSw* this, GlobalContext* globalCtx) { +void func_80B0CBE8(EnSw* this, PlayState* play) { if ((((this->actor.params & 0xE000) >> 0xD) > 0) && (this->actionFunc != func_80B0D590)) { if (this->unk_392 != 0) { this->unk_392--; } } else { if ((DECR(this->unk_390) == 0) && (this->actor.colChkInfo.health != 0)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((DECR(this->unk_392) == 0) && (this->actor.colChkInfo.health != 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -430,9 +430,9 @@ s32 func_80B0CCF4(EnSw* this, f32* arg1) { return true; } -void func_80B0CEA8(EnSw* this, GlobalContext* globalCtx) { +void func_80B0CEA8(EnSw* this, PlayState* play) { if (!(this->actor.scale.x < 0.0139999995f)) { - Camera* activeCam = GET_ACTIVE_CAM(globalCtx); + Camera* activeCam = GET_ACTIVE_CAM(play); if (!(Math_Vec3f_DistXYZ(&this->actor.world.pos, &activeCam->eye) >= 380.0f)) { Audio_PlayActorSound2(&this->actor, ((this->actor.params & 0xE000) >> 0xD) > 0 ? NA_SE_EN_STALGOLD_ROLL @@ -441,7 +441,7 @@ void func_80B0CEA8(EnSw* this, GlobalContext* globalCtx) { } } -void func_80B0CF44(EnSw* this, GlobalContext* globalCtx, s32 cnt) { +void func_80B0CF44(EnSw* this, PlayState* play, s32 cnt) { Color_RGBA8 primColor = { 80, 80, 50, 255 }; Color_RGBA8 envColor = { 100, 100, 80, 0 }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -456,11 +456,11 @@ void func_80B0CF44(EnSw* this, GlobalContext* globalCtx, s32 cnt) { pos.x = this->actor.world.pos.x + (Math_SinS(angle) * 2.0f); pos.y = this->actor.world.pos.y; pos.z = this->actor.world.pos.z + (Math_CosS(angle) * 2.0f); - func_8002836C(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 20, 30, 12); + func_8002836C(play, &pos, &velocity, &accel, &primColor, &envColor, 20, 30, 12); } } -void func_80B0D14C(EnSw* this, GlobalContext* globalCtx, s32 cnt) { +void func_80B0D14C(EnSw* this, PlayState* play, s32 cnt) { Color_RGBA8 primColor = { 80, 80, 50, 255 }; Color_RGBA8 envColor = { 100, 100, 80, 0 }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -475,11 +475,11 @@ void func_80B0D14C(EnSw* this, GlobalContext* globalCtx, s32 cnt) { pos.x = this->actor.world.pos.x + (Math_SinS(angle) * 14.0f); pos.y = this->actor.world.pos.y; pos.z = this->actor.world.pos.z + (Math_CosS(angle) * 14.0f); - func_8002836C(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 20, 40, 10); + func_8002836C(play, &pos, &velocity, &accel, &primColor, &envColor, 20, 40, 10); } } -void func_80B0D364(EnSw* this, GlobalContext* globalCtx) { +void func_80B0D364(EnSw* this, PlayState* play) { if (((this->actor.params & 0xE000) >> 0xD) == 4) { this->unk_38C = 0; this->actionFunc = func_80B0D3AC; @@ -489,15 +489,15 @@ void func_80B0D364(EnSw* this, GlobalContext* globalCtx) { } } -void func_80B0D3AC(EnSw* this, GlobalContext* globalCtx) { +void func_80B0D3AC(EnSw* this, PlayState* play) { if (this->unk_38C != 0) { if ((this->unk_38C & 4) != 0) { - func_80B0CF44(this, globalCtx, 5); + func_80B0CF44(this, play, 5); } this->unk_38C--; if (this->unk_38C == 0) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALGOLD_UP_CRY); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_DODO_M_UP); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALGOLD_UP_CRY); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_DODO_M_UP); } else { return; } @@ -518,9 +518,9 @@ void func_80B0D3AC(EnSw* this, GlobalContext* globalCtx) { this->unk_360 = 0; } - if (func_80B0C0CC(this, globalCtx, 1) == 1) { + if (func_80B0C0CC(this, play, 1) == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); - func_80B0D14C(this, globalCtx, 8); + func_80B0D14C(this, play, 8); this->actor.scale.x = 0.02f; Actor_SetScale(&this->actor, 0.02f); this->actionFunc = func_80B0D590; @@ -530,7 +530,7 @@ void func_80B0D3AC(EnSw* this, GlobalContext* globalCtx) { } } -void func_80B0D590(EnSw* this, GlobalContext* globalCtx) { +void func_80B0D590(EnSw* this, PlayState* play) { f32 sp2C; if (((this->actor.params & 0xE000) >> 0xD) == 2) { @@ -553,8 +553,8 @@ void func_80B0D590(EnSw* this, GlobalContext* globalCtx) { if (this->unk_38E != 0) { this->unk_38E--; if (this->unk_38E == 0) { - func_80B0CEA8(this, globalCtx); - this->unk_420 = ((globalCtx->state.frames % 2) == 0) ? 0.1f : -0.1f; + func_80B0CEA8(this, play); + this->unk_420 = ((play->state.frames % 2) == 0) ? 0.1f : -0.1f; this->unk_38A = 1; this->unk_38C = Rand_S16Offset(30, 60); if (((this->actor.params & 0xE000) >> 0xD) != 0) { @@ -576,7 +576,7 @@ void func_80B0D590(EnSw* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = (this->unk_38A == 0) ? 4.0f : 0.0f; if (this->skelAnime.playSpeed > 0.0f) { - func_80B0CEA8(this, globalCtx); + func_80B0CEA8(this, play); } if (((this->actor.params & 0xE000) >> 0xD) != 0) { this->skelAnime.playSpeed *= 2.0f; @@ -594,7 +594,7 @@ void func_80B0D590(EnSw* this, GlobalContext* globalCtx) { } } -void func_80B0D878(EnSw* this, GlobalContext* globalCtx) { +void func_80B0D878(EnSw* this, PlayState* play) { Actor* temp_v0; Vec3f pos; Vec3f velAndAccel = { 0.0f, 0.5f, 0.0f }; @@ -603,7 +603,7 @@ void func_80B0D878(EnSw* this, GlobalContext* globalCtx) { f32 z; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) == 1) { - func_80B0CEA8(this, globalCtx); + func_80B0CEA8(this, play); } func_80B0CCF4(this, &this->unk_420); @@ -616,7 +616,7 @@ void func_80B0D878(EnSw* this, GlobalContext* globalCtx) { y = (this->unk_364.y * 10.0f); z = (this->unk_364.z * 10.0f); temp_v0 = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_SI, this->actor.world.pos.x + x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_SI, this->actor.world.pos.x + x, this->actor.world.pos.y + y, this->actor.world.pos.z + z, 0, 0, 0, this->actor.params); if (temp_v0 != NULL) { temp_v0->parent = NULL; @@ -630,16 +630,15 @@ void func_80B0D878(EnSw* this, GlobalContext* globalCtx) { pos.y += 10.0f + ((Rand_ZeroOne() - 0.5f) * 6.0f); pos.x += (Rand_ZeroOne() - 0.5f) * 32.0f; pos.z += (Rand_ZeroOne() - 0.5f) * 32.0f; - EffectSsDeadDb_Spawn(globalCtx, &pos, &velAndAccel, &velAndAccel, 42, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, - true); + EffectSsDeadDb_Spawn(play, &pos, &velAndAccel, &velAndAccel, 42, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); } } -void func_80B0DB00(EnSw* this, GlobalContext* globalCtx) { +void func_80B0DB00(EnSw* this, PlayState* play) { Actor_MoveForward(&this->actor); this->actor.shape.rot.x += 0x1000; this->actor.shape.rot.z += 0x1000; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(0.0f <= this->actor.velocity.y)) { if (this->actor.floorHeight <= BGCHECK_Y_MIN || this->actor.floorHeight >= 32000.0f) { @@ -657,11 +656,11 @@ void func_80B0DB00(EnSw* this, GlobalContext* globalCtx) { } Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 16.0f, 12, 2.0f, 120, 10, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 16.0f, 12, 2.0f, 120, 10, false); } } -void func_80B0DC7C(EnSw* this, GlobalContext* globalCtx) { +void func_80B0DC7C(EnSw* this, PlayState* play) { Vec3f velAndAccel = { 0.0f, 0.5f, 0.0f }; Vec3f pos = { 0.0f, 0.0f, 0.0f }; @@ -669,12 +668,11 @@ void func_80B0DC7C(EnSw* this, GlobalContext* globalCtx) { pos.y = ((Rand_ZeroOne() - 0.5f) * 6.0f) + (this->actor.world.pos.y + 10.0f); pos.x = ((Rand_ZeroOne() - 0.5f) * 32.0f) + this->actor.world.pos.x; pos.z = ((Rand_ZeroOne() - 0.5f) * 32.0f) + this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &pos, &velAndAccel, &velAndAccel, 42, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, - 1); + EffectSsDeadDb_Spawn(play, &pos, &velAndAccel, &velAndAccel, 42, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1); this->actor.shape.rot.x += 0x1000; this->actor.shape.rot.z += 0x1000; } else { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x30); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x30); Actor_Kill(&this->actor); } } @@ -688,29 +686,29 @@ s16 func_80B0DE34(EnSw* this, Vec3f* arg1) { return pitch * (yaw >= 0 ? -1 : 1); } -s32 func_80B0DEA8(EnSw* this, GlobalContext* globalCtx, s32 arg2) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B0DEA8(EnSw* this, PlayState* play, s32 arg2) { + Player* player = GET_PLAYER(play); CollisionPoly* sp58; s32 sp54; Vec3f sp48; if (!(player->stateFlags1 & PLAYER_STATE1_21) && arg2) { return false; - } else if (func_8002DDF4(globalCtx) && arg2) { + } else if (func_8002DDF4(play) && arg2) { return false; } else if (ABS(func_80B0DE34(this, &player->actor.world.pos) - this->actor.shape.rot.z) >= 0x1FC2) { return false; } else if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &player->actor.world.pos) >= 130.0f) { return false; - } else if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &player->actor.world.pos, &sp48, - &sp58, true, false, false, true, &sp54)) { + } else if (!BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &player->actor.world.pos, &sp48, &sp58, + true, false, false, true, &sp54)) { return true; } else { return false; } } -s32 func_80B0DFFC(EnSw* this, GlobalContext* globalCtx) { +s32 func_80B0DFFC(EnSw* this, PlayState* play) { s32 pad; CollisionPoly* sp60; s32 sp5C; @@ -720,26 +718,26 @@ s32 func_80B0DFFC(EnSw* this, GlobalContext* globalCtx) { if (this->collider.base.ocFlags1 & OC1_HIT) { this->collider.base.acFlags &= ~AC_HIT; sp4C = false; - } else if (((globalCtx->state.frames % 4) == 0) && - !BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_454, &sp50, &sp60, true, + } else if (((play->state.frames % 4) == 0) && + !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_454, &sp50, &sp60, true, false, false, true, &sp5C)) { sp4C = false; - } else if (((globalCtx->state.frames % 4) == 1) && - BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_460, &sp50, &sp60, true, - false, false, true, &sp5C)) { + } else if (((play->state.frames % 4) == 1) && + BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_460, &sp50, &sp60, true, false, + false, true, &sp5C)) { sp4C = false; - } else if (((globalCtx->state.frames % 4) == 2) && - !BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_46C, &sp50, &sp60, true, + } else if (((play->state.frames % 4) == 2) && + !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_46C, &sp50, &sp60, true, false, false, true, &sp5C)) { if (0) {} sp4C = false; - } else if (((globalCtx->state.frames % 4) == 3) && - BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_478, &sp50, &sp60, true, - false, false, true, &sp5C)) { + } else if (((play->state.frames % 4) == 3) && + BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_478, &sp50, &sp60, true, false, + false, true, &sp5C)) { sp4C = false; } - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_484, &sp50, &this->unk_430, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_484, &sp50, &this->unk_430, true, false, false, true, &sp5C)) { this->actor.wallYaw = RAD_TO_BINANG(Math_FAtan2F(this->unk_430->normal.x, this->unk_430->normal.z)); this->actor.world.pos = sp50; @@ -782,7 +780,7 @@ void func_80B0E314(EnSw* this, Vec3f arg1, f32 arg4) { this->actor.world.pos.z += zDist; } -s32 func_80B0E430(EnSw* this, f32 arg1, s16 arg2, s32 arg3, GlobalContext* globalCtx) { +s32 func_80B0E430(EnSw* this, f32 arg1, s16 arg2, s32 arg3, PlayState* play) { Camera* activeCam; f32 lastFrame = Animation_GetLastFrame(&object_st_Anim_000304); @@ -797,7 +795,7 @@ s32 func_80B0E430(EnSw* this, f32 arg1, s16 arg2, s32 arg3, GlobalContext* globa return 0; } - activeCam = GET_ACTIVE_CAM(globalCtx); + activeCam = GET_ACTIVE_CAM(play); if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &activeCam->eye) < 380.0f) { if (DECR(this->unk_440) == 0) { @@ -815,39 +813,39 @@ s32 func_80B0E430(EnSw* this, f32 arg1, s16 arg2, s32 arg3, GlobalContext* globa return 0; } -void func_80B0E5E0(EnSw* this, GlobalContext* globalCtx) { +void func_80B0E5E0(EnSw* this, PlayState* play) { s32 pad[2]; f32 rand; - if (func_80B0E430(this, 6.0f, 0x3E8, 1, globalCtx)) { + if (func_80B0E430(this, 6.0f, 0x3E8, 1, play)) { rand = Rand_ZeroOne(); this->unk_444 = ((s16)(20000.0f * rand) + 0x2EE0) * (Rand_ZeroOne() >= 0.5f ? 1.0f : -1.0f) + this->actor.world.rot.z; this->unk_388 = Rand_S16Offset(10, 30); } - if ((DECR(this->unk_442) == 0) && (func_80B0DEA8(this, globalCtx, 1))) { + if ((DECR(this->unk_442) == 0) && (func_80B0DEA8(this, play, 1))) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_LAUGH); this->unk_442 = 20; this->actionFunc = func_80B0E728; } } -void func_80B0E728(EnSw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B0E728(EnSw* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; if (DECR(this->unk_442) != 0) { - if (func_80B0DEA8(this, globalCtx, 1)) { + if (func_80B0DEA8(this, play, 1)) { this->unk_448 = player->actor.world.pos; this->unk_448.y += 30.0f; this->unk_444 = func_80B0DE34(this, &this->unk_448); - func_80B0E430(this, 6.0f, (u16)0xFA0, 0, globalCtx); + func_80B0E430(this, 6.0f, (u16)0xFA0, 0, play); } else { this->actionFunc = func_80B0E5E0; } } else { - if (!func_80B0DFFC(this, globalCtx)) { + if (!func_80B0DFFC(this, play)) { this->unk_442 = Rand_S16Offset(20, 10); this->unk_444 = func_80B0DE34(this, &this->actor.home.pos); this->unk_448 = this->actor.home.pos; @@ -860,14 +858,14 @@ void func_80B0E728(EnSw* this, GlobalContext* globalCtx) { this->unk_440 = 4; } - if (!(Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_448) > 13.0f) || func_8002DDF4(globalCtx)) { + if (!(Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_448) > 13.0f) || func_8002DDF4(play)) { this->actionFunc = func_80B0E90C; } } } } -void func_80B0E90C(EnSw* this, GlobalContext* globalCtx) { +void func_80B0E90C(EnSw* this, PlayState* play) { s32 pad; func_80B0E314(this, this->unk_448, 0.0f); @@ -878,10 +876,10 @@ void func_80B0E90C(EnSw* this, GlobalContext* globalCtx) { } } -void func_80B0E9BC(EnSw* this, GlobalContext* globalCtx) { +void func_80B0E9BC(EnSw* this, PlayState* play) { s32 pad; - if (func_80B0E430(this, 6.0f, 0x3E8, 0, globalCtx)) { + if (func_80B0E430(this, 6.0f, 0x3E8, 0, play)) { func_80B0E314(this, this->unk_448, 2.0f); if (!(Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_448) > 4.0f)) { this->actionFunc = func_80B0E5E0; @@ -889,16 +887,16 @@ void func_80B0E9BC(EnSw* this, GlobalContext* globalCtx) { } } -void EnSw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Update(Actor* thisx, PlayState* play) { EnSw* this = (EnSw*)thisx; SkelAnime_Update(&this->skelAnime); - func_80B0C9F0(this, globalCtx); - this->actionFunc(this, globalCtx); - func_80B0CBE8(this, globalCtx); + func_80B0C9F0(this, play); + this->actionFunc(this, play); + func_80B0CBE8(this, play); } -s32 EnSw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Vec3f sp7C = { 1400.0f, -2600.0f, -800.0f }; Vec3f sp70 = { 1400.0f, -1600.0f, 0.0f }; Vec3f sp64 = { -1400.0f, -2600.0f, -800.0f }; @@ -907,7 +905,7 @@ s32 EnSw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, EnSw* this = (EnSw*)thisx; Vec3f sp3C = { 0.0f, 0.0f, 0.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_sw.c", 2084); + OPEN_DISPS(play->state.gfxCtx, "../z_en_sw.c", 2084); if (((this->actor.params & 0xE000) >> 0xD) != 0) { switch (limbIndex) { @@ -962,18 +960,18 @@ s32 EnSw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Collider_UpdateSpheres(limbIndex, &this->collider); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_sw.c", 2145); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_sw.c", 2145); return false; } -void EnSw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnSw_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { } -void func_80B0EDB8(GlobalContext* globalCtx, Color_RGBA8* arg1, s16 arg2, s16 arg3) { +void func_80B0EDB8(PlayState* play, Color_RGBA8* arg1, s16 arg2, s16 arg3) { f32 temp_f2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_sw.c", 2181); + OPEN_DISPS(play->state.gfxCtx, "../z_en_sw.c", 2181); temp_f2 = (11500.0f / arg3) * (arg3 - arg2); @@ -983,20 +981,20 @@ void func_80B0EDB8(GlobalContext* globalCtx, Color_RGBA8* arg1, s16 arg2, s16 ar POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP, arg1->r, arg1->g, arg1->b, arg1->a, 0, (s16)temp_f2); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_sw.c", 2197); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_sw.c", 2197); } -void func_80B0EEA4(GlobalContext* globalCtx) { +void func_80B0EEA4(PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_sw.c", 2205); + OPEN_DISPS(play->state.gfxCtx, "../z_en_sw.c", 2205); - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_sw.c", 2207); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_sw.c", 2207); } -void EnSw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Draw(Actor* thisx, PlayState* play) { EnSw* this = (EnSw*)thisx; Color_RGBA8 sp30 = { 184, 0, 228, 255 }; @@ -1005,15 +1003,15 @@ void EnSw_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.colChkInfo.health != 0) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); } - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); } else if (this->actionFunc == func_80B0E728) { - func_80B0EDB8(globalCtx, &sp30, 0x14, 0x1E); + func_80B0EDB8(play, &sp30, 0x14, 0x1E); } - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSw_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSw_OverrideLimbDraw, EnSw_PostLimbDraw, this); if (this->actionFunc == func_80B0E728) { - func_80B0EEA4(globalCtx); + func_80B0EEA4(play); } } diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.h b/src/overlays/actors/ovl_En_Sw/z_en_sw.h index 452fc5e758..c766e9f9e9 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.h +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.h @@ -6,7 +6,7 @@ struct EnSw; -typedef void (*EnSwActionFunc)(struct EnSw* this, GlobalContext* globalCtx); +typedef void (*EnSwActionFunc)(struct EnSw* this, PlayState* play); typedef struct EnSw { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index fc55ac2df8..0557c30207 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -16,16 +16,16 @@ typedef enum { SYATEKI_ROUND_MAX } EnSyatekItemRound; -void EnSyatekiItm_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiItm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiItm_Update(Actor* thisx, GlobalContext* globalCtx); +void EnSyatekiItm_Init(Actor* thisx, PlayState* play); +void EnSyatekiItm_Destroy(Actor* thisx, PlayState* play); +void EnSyatekiItm_Update(Actor* thisx, PlayState* play); -void EnSyatekiItm_Idle(EnSyatekiItm* this, GlobalContext* globalCtx); -void EnSyatekiItm_StartRound(EnSyatekiItm* this, GlobalContext* globalCtx); -void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, GlobalContext* globalCtx); -void EnSyatekiItm_CheckTargets(EnSyatekiItm* this, GlobalContext* globalCtx); -void EnSyatekiItm_CleanupGame(EnSyatekiItm* this, GlobalContext* globalCtx); -void EnSyatekiItm_EndGame(EnSyatekiItm* this, GlobalContext* globalCtx); +void EnSyatekiItm_Idle(EnSyatekiItm* this, PlayState* play); +void EnSyatekiItm_StartRound(EnSyatekiItm* this, PlayState* play); +void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, PlayState* play); +void EnSyatekiItm_CheckTargets(EnSyatekiItm* this, PlayState* play); +void EnSyatekiItm_CleanupGame(EnSyatekiItm* this, PlayState* play); +void EnSyatekiItm_EndGame(EnSyatekiItm* this, PlayState* play); const ActorInit En_Syateki_Itm_InitVars = { ACTOR_EN_SYATEKI_ITM, @@ -67,13 +67,13 @@ static Vec3f sRupeePos[] = { { 20.0f, 0.0f, -60.0f }, { 40.0f, 0.0f, -60.0f }, }; -void EnSyatekiItm_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnSyatekiItm_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnSyatekiItm* this = (EnSyatekiItm*)thisx; s32 i; - this->man = (EnSyatekiMan*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_SYATEKI_MAN, - 140.0f, 0.0f, 255.0f, 0, -0x4000, 0, 0); + this->man = (EnSyatekiMan*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_SYATEKI_MAN, 140.0f, + 0.0f, 255.0f, 0, -0x4000, 0, 0); if (this->man == NULL) { // "Spawn error" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ エラー原 ☆☆☆☆ \n" VT_RST); @@ -81,9 +81,8 @@ void EnSyatekiItm_Init(Actor* thisx, GlobalContext* globalCtx2) { return; } for (i = 0; i < 10; i++) { - this->markers[i] = - (EnExRuppy*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_RUPPY, - sRupeePos[i].x, sRupeePos[i].y, sRupeePos[i].z, 0, 0, 0, 4); + this->markers[i] = (EnExRuppy*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_RUPPY, + sRupeePos[i].x, sRupeePos[i].y, sRupeePos[i].z, 0, 0, 0, 4); if (this->markers[i] == NULL) { // "Second spawn error" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ エラー原セカンド ☆☆☆☆ \n" VT_RST); @@ -95,12 +94,12 @@ void EnSyatekiItm_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc = EnSyatekiItm_Idle; } -void EnSyatekiItm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiItm_Destroy(Actor* thisx, PlayState* play) { } -void EnSyatekiItm_Idle(EnSyatekiItm* this, GlobalContext* globalCtx) { +void EnSyatekiItm_Idle(EnSyatekiItm* this, PlayState* play) { s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->signal == ENSYATEKI_START) { player->actor.world.pos.x = -12.0f; @@ -109,7 +108,7 @@ void EnSyatekiItm_Idle(EnSyatekiItm* this, GlobalContext* globalCtx) { player->currentYaw = player->actor.world.rot.y = player->actor.shape.rot.y = 0x7F03; player->actor.world.rot.x = player->actor.shape.rot.x = player->actor.world.rot.z = player->actor.shape.rot.z = 0; - func_8008EF44(globalCtx, 15); + func_8008EF44(play, 15); this->roundNum = this->hitCount = 0; for (i = 0; i < 6; i++) { this->roundFlags[i] = false; @@ -121,10 +120,10 @@ void EnSyatekiItm_Idle(EnSyatekiItm* this, GlobalContext* globalCtx) { } } -void EnSyatekiItm_StartRound(EnSyatekiItm* this, GlobalContext* globalCtx) { +void EnSyatekiItm_StartRound(EnSyatekiItm* this, PlayState* play) { s32 i; s32 j; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->unkTimer == 0) { if (LINK_IS_ADULT) { @@ -163,13 +162,13 @@ void EnSyatekiItm_StartRound(EnSyatekiItm* this, GlobalContext* globalCtx) { } } -void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 i; s32 roundIdx; - if (globalCtx->shootingGalleryStatus == -1) { + if (play->shootingGalleryStatus == -1) { player->actor.freezeTimer = 10; this->signal = ENSYATEKI_END; this->actionFunc = EnSyatekiItm_CleanupGame; @@ -234,8 +233,8 @@ void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { for (i = 0; i < this->numTargets; i++) { this->targets[i] = (EnGSwitch*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_G_SWITCH, this->targetHome[i].x, - this->targetHome[i].y, this->targetHome[i].z, 0, 0, 0, (ENGSWITCH_TARGET_RUPEE << 0xC) | 0x3F); + &play->actorCtx, &this->actor, play, ACTOR_EN_G_SWITCH, this->targetHome[i].x, this->targetHome[i].y, + this->targetHome[i].z, 0, 0, 0, (ENGSWITCH_TARGET_RUPEE << 0xC) | 0x3F); if (this->targets[i] == NULL) { // "Rupee spawn error" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ルピーでエラー原 ☆☆☆☆ \n" VT_RST); @@ -271,12 +270,12 @@ void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { } } -void EnSyatekiItm_CheckTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSyatekiItm_CheckTargets(EnSyatekiItm* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; s16 j; - if (globalCtx->shootingGalleryStatus == -1) { + if (play->shootingGalleryStatus == -1) { player->actor.freezeTimer = 10; this->signal = ENSYATEKI_END; this->actionFunc = EnSyatekiItm_CleanupGame; @@ -295,7 +294,7 @@ void EnSyatekiItm_CheckTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { } } -void EnSyatekiItm_CleanupGame(EnSyatekiItm* this, GlobalContext* globalCtx) { +void EnSyatekiItm_CleanupGame(EnSyatekiItm* this, PlayState* play) { s32 i; for (i = 0; i < 2; i++) { @@ -306,8 +305,8 @@ void EnSyatekiItm_CleanupGame(EnSyatekiItm* this, GlobalContext* globalCtx) { this->actionFunc = EnSyatekiItm_EndGame; } -void EnSyatekiItm_EndGame(EnSyatekiItm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSyatekiItm_EndGame(EnSyatekiItm* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.freezeTimer = 10; if (this->signal == ENSYATEKI_RESULTS) { @@ -331,11 +330,11 @@ void EnSyatekiItm_EndGame(EnSyatekiItm* this, GlobalContext* globalCtx) { } } -void EnSyatekiItm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiItm_Update(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiItm* this = (EnSyatekiItm*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->timer != 0) { this->timer--; @@ -346,6 +345,6 @@ void EnSyatekiItm_Update(Actor* thisx, GlobalContext* globalCtx) { if (BREG(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, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h index 11657fdb03..c7e01a776b 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h @@ -6,7 +6,7 @@ struct EnSyatekiItm; -typedef void (*EnSyatekiItmActionFunc)(struct EnSyatekiItm*, GlobalContext*); +typedef void (*EnSyatekiItmActionFunc)(struct EnSyatekiItm*, PlayState*); typedef enum { /* 0 */ ENSYATEKI_NONE, 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 91599e0ed2..8a1c56e800 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 @@ -20,22 +20,22 @@ typedef enum { /* 3 */ SYATEKI_TEXT_REFUSE } EnSyatekiManTextIdx; -void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiMan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiMan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiMan_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSyatekiMan_Init(Actor* thisx, PlayState* play); +void EnSyatekiMan_Destroy(Actor* thisx, PlayState* play); +void EnSyatekiMan_Update(Actor* thisx, PlayState* play); +void EnSyatekiMan_Draw(Actor* thisx, PlayState* play); -void EnSyatekiMan_Start(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_Idle(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_Talk(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_StopTalk(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_StartGame(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_GivePrize(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, GlobalContext* globalCtx); -void EnSyatekiMan_RestartGame(EnSyatekiMan* this, GlobalContext* globalCtx); +void EnSyatekiMan_Start(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Idle(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Talk(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_StopTalk(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_StartGame(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_EndGame(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_GivePrize(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_RestartGame(EnSyatekiMan* this, PlayState* play); void EnSyatekiMan_BlinkWait(EnSyatekiMan* this); void EnSyatekiMan_Blink(EnSyatekiMan* this); @@ -149,7 +149,7 @@ static s16 sTextIds[] = { 0x2B, 0x2E, 0xC8, 0x2D }; static s16 sTextBoxCount[] = { TEXT_STATE_CHOICE, TEXT_STATE_EVENT, TEXT_STATE_EVENT, TEXT_STATE_EVENT }; -void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiMan* this = (EnSyatekiMan*)thisx; @@ -158,7 +158,7 @@ void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 親父登場!!むほほほほほほほーん ☆☆☆☆☆ \n" VT_RST); this->actor.targetMode = 1; Actor_SetScale(&this->actor, 0.01f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gObjectOssanSkel, &gObjectOssanAnim_000338, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gObjectOssanSkel, &gObjectOssanAnim_000338, this->jointTable, this->morphTable, 9); if (!LINK_IS_ADULT) { this->headRot.z = 20; @@ -170,17 +170,17 @@ void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnSyatekiMan_Start; } -void EnSyatekiMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Destroy(Actor* thisx, PlayState* play) { } -void EnSyatekiMan_Start(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_Start(EnSyatekiMan* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gObjectOssanAnim_000338); Animation_Change(&this->skelAnime, &gObjectOssanAnim_000338, 1.0f, 0.0f, (s16)lastFrame, ANIMMODE_LOOP, -10.0f); this->actionFunc = EnSyatekiMan_SetupIdle; } -void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, PlayState* play) { if (this->gameResult == SYATEKI_RESULT_REFUSE) { this->textIdx = SYATEKI_TEXT_REFUSE; } @@ -190,25 +190,25 @@ void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, GlobalContext* globalCtx) { this->actionFunc = EnSyatekiMan_Idle; } -void EnSyatekiMan_Idle(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_Idle(EnSyatekiMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnSyatekiMan_Talk; } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } -void EnSyatekiMan_Talk(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_Talk(EnSyatekiMan* this, PlayState* play) { s16 nextState = 0; SkelAnime_Update(&this->skelAnime); if (this->cameraHold) { - globalCtx->shootingGalleryStatus = -2; + play->shootingGalleryStatus = -2; } - if ((this->numTextBox == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { + if ((this->numTextBox == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { if (this->textIdx == SYATEKI_TEXT_CHOICE) { - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees >= 20) { Rupees_ChangeBy(-20); @@ -227,9 +227,9 @@ void EnSyatekiMan_Talk(EnSyatekiMan* this, GlobalContext* globalCtx) { nextState = 2; break; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } else { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } switch (nextState) { case 0: @@ -245,36 +245,36 @@ void EnSyatekiMan_Talk(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void EnSyatekiMan_StopTalk(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_StopTalk(EnSyatekiMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->cameraHold) { - globalCtx->shootingGalleryStatus = -2; + play->shootingGalleryStatus = -2; } - if ((this->numTextBox == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { + if ((this->numTextBox == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { if (this->cameraHold) { - OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + OnePointCutscene_EndCutscene(play, this->subCamId); this->subCamId = CAM_ID_NONE; this->cameraHold = false; } - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = EnSyatekiMan_SetupIdle; } } -void EnSyatekiMan_StartGame(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_StartGame(EnSyatekiMan* this, PlayState* play) { EnSyatekiItm* gallery; SkelAnime_Update(&this->skelAnime); if (this->cameraHold) { - globalCtx->shootingGalleryStatus = -2; + play->shootingGalleryStatus = -2; } - if ((this->numTextBox == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { + if ((this->numTextBox == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { if (this->cameraHold) { - OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + OnePointCutscene_EndCutscene(play, this->subCamId); this->subCamId = CAM_ID_NONE; this->cameraHold = false; } - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); gallery = ((EnSyatekiItm*)this->actor.parent); if (gallery->actor.update != NULL) { gallery->signal = ENSYATEKI_START; @@ -283,14 +283,14 @@ void EnSyatekiMan_StartGame(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, PlayState* play) { EnSyatekiItm* gallery; SkelAnime_Update(&this->skelAnime); if (1) {} gallery = ((EnSyatekiItm*)this->actor.parent); if ((gallery->actor.update != NULL) && (gallery->signal == ENSYATEKI_END)) { - this->subCamId = OnePointCutscene_Init(globalCtx, 8002, -99, &this->actor, CAM_ID_MAIN); + this->subCamId = OnePointCutscene_Init(play, 8002, -99, &this->actor, CAM_ID_MAIN); switch (gallery->hitCount) { case 10: this->gameResult = SYATEKI_RESULT_WINNER; @@ -304,28 +304,28 @@ void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, GlobalContext* globalCtx) { default: this->gameResult = SYATEKI_RESULT_FAILURE; this->actor.textId = 0x71AD; - if (globalCtx->shootingGalleryStatus == 15 + 1) { + if (play->shootingGalleryStatus == 15 + 1) { this->gameResult = SYATEKI_RESULT_REFUSE; this->actor.textId = 0x2D; } break; } - globalCtx->shootingGalleryStatus = -2; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + play->shootingGalleryStatus = -2; + Message_StartTextbox(play, this->actor.textId, NULL); this->actionFunc = EnSyatekiMan_EndGame; } } -void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_EndGame(EnSyatekiMan* this, PlayState* play) { EnSyatekiItm* gallery; SkelAnime_Update(&this->skelAnime); - if ((this->numTextBox == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { + if ((this->numTextBox == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { if (this->gameResult != SYATEKI_RESULT_FAILURE) { - OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + OnePointCutscene_EndCutscene(play, this->subCamId); this->subCamId = CAM_ID_NONE; } - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); gallery = ((EnSyatekiItm*)this->actor.parent); if (gallery->actor.update != NULL) { gallery->signal = ENSYATEKI_RESULTS; @@ -365,12 +365,12 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) { this->getItemId = GI_RUPEE_PURPLE; } } - func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); this->actionFunc = EnSyatekiMan_GivePrize; break; case SYATEKI_RESULT_ALMOST: this->timer = 20; - func_8008EF44(globalCtx, 15); + func_8008EF44(play, 15); this->actionFunc = EnSyatekiMan_RestartGame; break; default: @@ -380,7 +380,7 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) { this->cameraHold = true; this->actor.textId = sTextIds[this->textIdx]; this->numTextBox = sTextBoxCount[this->textIdx]; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->actionFunc = EnSyatekiMan_Talk; } break; @@ -389,18 +389,18 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void EnSyatekiMan_GivePrize(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_GivePrize(EnSyatekiMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = EnSyatekiMan_FinishPrize; } else { - func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); } } -void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // "Successful completion" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); if (!LINK_IS_ADULT) { @@ -415,7 +415,7 @@ void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void EnSyatekiMan_RestartGame(EnSyatekiMan* this, GlobalContext* globalCtx) { +void EnSyatekiMan_RestartGame(EnSyatekiMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer == 0) { EnSyatekiItm* gallery = ((EnSyatekiItm*)this->actor.parent); @@ -459,23 +459,22 @@ void EnSyatekiMan_Blink(EnSyatekiMan* this) { } } -void EnSyatekiMan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Update(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiMan* this = (EnSyatekiMan*)thisx; if (this->timer != 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); EnSyatekiMan_SetBgm(); this->blinkFunc(this); this->actor.focus.pos.y = 70.0f; Actor_SetFocus(&this->actor, 70.0f); - func_80038290(globalCtx, &this->actor, &this->headRot, &this->bodyRot, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->headRot, &this->bodyRot, this->actor.focus.pos); } -s32 EnSyatekiMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnSyatekiMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSyatekiMan* this = (EnSyatekiMan*)thisx; s32 turnDirection; @@ -494,12 +493,12 @@ s32 EnSyatekiMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void EnSyatekiMan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Draw(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiMan* this = (EnSyatekiMan*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnSyatekiMan_OverrideLimbDraw, NULL, this); } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h index 3cb8d4f055..eea46817ff 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h @@ -6,7 +6,7 @@ struct EnSyatekiMan; -typedef void (*EnSyatekiManActionFunc) (struct EnSyatekiMan*, GlobalContext*); +typedef void (*EnSyatekiManActionFunc) (struct EnSyatekiMan*, PlayState*); typedef void (*EnSyatekiManOtherFunc) (struct EnSyatekiMan*); typedef struct EnSyatekiMan { diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index 5b0c3c3e42..4c6830274f 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -10,19 +10,19 @@ #define FLAGS ACTOR_FLAG_4 -void EnSyatekiNiw_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiNiw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiNiw_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSyatekiNiw_Init(Actor* thisx, PlayState* play); +void EnSyatekiNiw_Destroy(Actor* thisx, PlayState* play); +void EnSyatekiNiw_Update(Actor* thisx, PlayState* play); +void EnSyatekiNiw_Draw(Actor* thisx, PlayState* play); -void func_80B11DEC(EnSyatekiNiw* this, GlobalContext* globalCtx); -void EnSyatekiNiw_UpdateEffects(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B129EC(EnSyatekiNiw* this, GlobalContext* globalCtx); -void EnSyatekiNiw_DrawEffects(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B123A8(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx); -void func_80B128D8(EnSyatekiNiw* this, GlobalContext* globalCtx); +void func_80B11DEC(EnSyatekiNiw* this, PlayState* play); +void EnSyatekiNiw_UpdateEffects(EnSyatekiNiw* this, PlayState* play); +void func_80B129EC(EnSyatekiNiw* this, PlayState* play); +void EnSyatekiNiw_DrawEffects(EnSyatekiNiw* this, PlayState* play); +void func_80B123A8(EnSyatekiNiw* this, PlayState* play); +void func_80B11E78(EnSyatekiNiw* this, PlayState* play); +void func_80B12460(EnSyatekiNiw* this, PlayState* play); +void func_80B128D8(EnSyatekiNiw* this, PlayState* play); void EnSyatekiNiw_SpawnFeather(EnSyatekiNiw* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4); @@ -64,21 +64,21 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void EnSyatekiNiw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiNiw_Init(Actor* thisx, PlayState* play) { EnSyatekiNiw* this = (EnSyatekiNiw*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.flags &= ~ACTOR_FLAG_0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoSkel, &gCuccoAnim, this->jointTable, this->morphTable, 16); this->unk_29E = this->actor.params; if (this->unk_29E < 0) { this->unk_29E = 0; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); if (this->unk_29E == 0) { osSyncPrintf("\n\n"); // "Archery range chicken" @@ -97,13 +97,13 @@ void EnSyatekiNiw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B11DEC; } -void EnSyatekiNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiNiw_Destroy(Actor* thisx, PlayState* play) { EnSyatekiNiw* this = (EnSyatekiNiw*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80B11A94(EnSyatekiNiw* this, GlobalContext* globalCtx, s16 arg2) { +void func_80B11A94(EnSyatekiNiw* this, PlayState* play, s16 arg2) { if (this->unk_254 == 0) { if (arg2 == 0) { this->unk_264 = 0.0f; @@ -206,7 +206,7 @@ void func_80B11A94(EnSyatekiNiw* this, GlobalContext* globalCtx, s16 arg2) { } } -void func_80B11DEC(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B11DEC(EnSyatekiNiw* this, PlayState* play) { Animation_Change(&this->skelAnime, &gCuccoAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCuccoAnim), ANIMMODE_LOOP, -10.0f); if (this->unk_29E != 0) { @@ -216,7 +216,7 @@ void func_80B11DEC(EnSyatekiNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80B11E78; } -void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B11E78(EnSyatekiNiw* this, PlayState* play) { Vec3f dustVelocity = { 0.0f, 0.0f, 0.0f }; Vec3f dustAccel = { 0.0f, 0.2f, 0.0f }; Color_RGBA8 dustPrimColor = { 0, 0, 0, 255 }; @@ -333,19 +333,19 @@ void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx) { } if (this->unk_260 == 0) { - func_80B11A94(this, globalCtx, sp4A); + func_80B11A94(this, play, sp4A); return; } - if ((globalCtx->gameplayFrames % 4) == 0) { + if ((play->gameplayFrames % 4) == 0) { dustVelocity.y = Rand_CenteredFloat(5.0f); dustAccel.y = 0.2f; dustPos = this->actor.world.pos; - func_8002836C(globalCtx, &dustPos, &dustVelocity, &dustAccel, &dustPrimColor, &dustEnvColor, 600, 40, 30); + func_8002836C(play, &dustPos, &dustVelocity, &dustAccel, &dustPrimColor, &dustEnvColor, 600, 40, 30); } } -void func_80B123A8(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B123A8(EnSyatekiNiw* this, PlayState* play) { Animation_Change(&this->skelAnime, &gCuccoAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCuccoAnim), ANIMMODE_LOOP, -10.0f); this->unk_27C = 6000.0f; @@ -362,8 +362,8 @@ void func_80B123A8(EnSyatekiNiw* this, GlobalContext* globalCtx) { this->unk_26C = -10000.0f; } -void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B12460(EnSyatekiNiw* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 phi_f16 = 0.0f; player->actor.freezeTimer = 10; @@ -463,9 +463,9 @@ void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) { case 6: if (this->unk_25E == 1) { - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->nextEntranceIndex = gSaveContext.entranceIndex; - globalCtx->shootingGalleryStatus = 0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = gSaveContext.entranceIndex; + play->shootingGalleryStatus = 0; player->actor.freezeTimer = 20; this->unk_25E = 0x14; this->actionFunc = func_80B128D8; @@ -484,21 +484,21 @@ void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) { this->unk_254 = this->unk_256; } - func_80B11A94(this, globalCtx, this->unk_296); + func_80B11A94(this, play, this->unk_296); } -void func_80B128D8(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B128D8(EnSyatekiNiw* this, PlayState* play) { if (this->unk_25E == 1) { gSaveContext.timer1State = 0; } } -void func_80B128F8(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B128F8(EnSyatekiNiw* this, PlayState* play) { s16 sp26; s16 sp24; Actor_SetFocus(&this->actor, this->unk_2D4); - Actor_GetScreenPos(globalCtx, &this->actor, &sp26, &sp24); + Actor_GetScreenPos(play, &this->actor, &sp26, &sp24); if ((this->actor.projectedPos.z > 200.0f) && (this->actor.projectedPos.z < 800.0f) && (sp26 > 0) && (sp26 < SCREEN_WIDTH) && (sp24 > 0) && (sp24 < SCREEN_HEIGHT)) { this->actor.speedXZ = 5.0f; @@ -510,7 +510,7 @@ void func_80B128F8(EnSyatekiNiw* this, GlobalContext* globalCtx) { } } -void func_80B129EC(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B129EC(EnSyatekiNiw* this, PlayState* play) { s32 pad; f32 phi_f2; s16 sp2E; @@ -518,7 +518,7 @@ void func_80B129EC(EnSyatekiNiw* this, GlobalContext* globalCtx) { f32 tmpf2; Actor_SetFocus(&this->actor, this->unk_2D4); - Actor_GetScreenPos(globalCtx, &this->actor, &sp2E, &sp2C); + Actor_GetScreenPos(play, &this->actor, &sp2E, &sp2C); if ((this->unk_25E == 0) || (this->actor.projectedPos.z < -70.0f) || (sp2E < 0) || (sp2E > SCREEN_WIDTH) || (sp2C < 0) || (sp2C > SCREEN_HEIGHT)) { Actor_Kill(&this->actor); @@ -539,10 +539,10 @@ void func_80B129EC(EnSyatekiNiw* this, GlobalContext* globalCtx) { tmpf2 = this->unk_2D8 + phi_f2; Math_SmoothStepToS(&this->actor.world.rot.y, tmpf2, 3, this->unk_2C8.y, 0); Math_ApproachF(&this->unk_2C8.y, 3000.0f, 1.0f, 500.0f); - func_80B11A94(this, globalCtx, 2); + func_80B11A94(this, play, 2); } -void func_80B12BA4(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void func_80B12BA4(EnSyatekiNiw* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; switch (this->unk_29E) { @@ -569,7 +569,7 @@ void func_80B12BA4(EnSyatekiNiw* this, GlobalContext* globalCtx) { } } -void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiNiw_Update(Actor* thisx, PlayState* play) { EnSyatekiNiw* this = (EnSyatekiNiw*)thisx; s32 pad; s16 i; @@ -583,7 +583,7 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { if (1) {} if (1) {} - EnSyatekiNiw_UpdateEffects(this, globalCtx); + EnSyatekiNiw_UpdateEffects(this, play); this->unk_28C++; if (this->unk_254 != 0) { this->unk_254--; @@ -616,9 +616,9 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot = this->actor.world.rot; this->actor.shape.shadowScale = 15.0f; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); @@ -638,7 +638,7 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_2A0 = 0; } - func_80B12BA4(this, globalCtx); + func_80B12BA4(this, play); if (this->unk_262 == 0) { if (this->actionFunc == func_80B11E78) { this->unk_262 = 0x12C; @@ -652,7 +652,7 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { i = 0; switch (this->unk_29E) { case 0: - if (globalCtx->shootingGalleryStatus != 0) { + if (play->shootingGalleryStatus != 0) { i = 1; } break; @@ -664,13 +664,12 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) { if (i != 0) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -s32 SyatekiNiw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 SyatekiNiw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSyatekiNiw* this = (EnSyatekiNiw*)thisx; Vec3f sp0 = { 0.0f, 0.0f, 0.0f }; @@ -693,20 +692,20 @@ s32 SyatekiNiw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnSyatekiNiw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiNiw_Draw(Actor* thisx, PlayState* play) { EnSyatekiNiw* this = (EnSyatekiNiw*)thisx; Color_RGBA8 sp30 = { 0, 0, 0, 255 }; if (this->actionFunc != func_80B128F8) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->unk_260 != 0) { - func_80026230(globalCtx, &sp30, 0, 0x14); + func_80026230(play, &sp30, 0, 0x14); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, SyatekiNiw_OverrideLimbDraw, NULL, this); - func_80026608(globalCtx); - EnSyatekiNiw_DrawEffects(this, globalCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SyatekiNiw_OverrideLimbDraw, NULL, this); + func_80026608(play); + EnSyatekiNiw_DrawEffects(this, play); } } @@ -729,7 +728,7 @@ void EnSyatekiNiw_SpawnFeather(EnSyatekiNiw* this, Vec3f* arg1, Vec3f* arg2, Vec } } -void EnSyatekiNiw_UpdateEffects(EnSyatekiNiw* this, GlobalContext* globalCtx) { +void EnSyatekiNiw_UpdateEffects(EnSyatekiNiw* this, PlayState* play) { s16 i; EnSyatekiNiwEffect* effect = &this->effects[0]; @@ -759,15 +758,15 @@ void EnSyatekiNiw_UpdateEffects(EnSyatekiNiw* this, GlobalContext* globalCtx) { } } -void EnSyatekiNiw_DrawEffects(EnSyatekiNiw* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EnSyatekiNiw_DrawEffects(EnSyatekiNiw* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; EnSyatekiNiwEffect* effect = &this->effects[0]; u8 materialFlag = 0; OPEN_DISPS(gfxCtx, "../z_en_syateki_niw.c", 1234); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < EN_SYATEKI_NIW_EFFECT_COUNT; i++, effect++) { if (effect->unk_00 == 1) { @@ -777,7 +776,7 @@ void EnSyatekiNiw_DrawEffects(EnSyatekiNiw* this, GlobalContext* globalCtx) { } Matrix_Translate(effect->unk_04.x, effect->unk_04.y, effect->unk_04.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->unk_2C, effect->unk_2C, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(effect->unk_30, MTXMODE_APPLY); Matrix_Translate(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h index 829d67fa25..26e6449aab 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h @@ -6,7 +6,7 @@ struct EnSyatekiNiw; -typedef void (*EnSyatekiNiwActionFunc)(struct EnSyatekiNiw*, GlobalContext*); +typedef void (*EnSyatekiNiwActionFunc)(struct EnSyatekiNiw*, PlayState*); typedef struct { /* 0x00 */ u8 unk_00; diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index ae0422dac3..8eeaa718b4 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -10,20 +10,20 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnTa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTa_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTa_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTa_Init(Actor* thisx, PlayState* play); +void EnTa_Destroy(Actor* thisx, PlayState* play); +void EnTa_Update(Actor* thisx, PlayState* play); +void EnTa_Draw(Actor* thisx, PlayState* play); -void func_80B14634(EnTa* this, GlobalContext* globalCtx); -void func_80B146F8(EnTa* this, GlobalContext* globalCtx); -void func_80B14754(EnTa* this, GlobalContext* globalCtx); -void func_80B14C18(EnTa* this, GlobalContext* globalCtx); -void func_80B14CAC(EnTa* this, GlobalContext* globalCtx); -void func_80B14D98(EnTa* this, GlobalContext* globalCtx); -void func_80B154FC(EnTa* this, GlobalContext* globalCtx); -void func_80B16504(EnTa* this, GlobalContext* globalCtx); -void func_80B16608(EnTa* this, GlobalContext* globalCtx); +void func_80B14634(EnTa* this, PlayState* play); +void func_80B146F8(EnTa* this, PlayState* play); +void func_80B14754(EnTa* this, PlayState* play); +void func_80B14C18(EnTa* this, PlayState* play); +void func_80B14CAC(EnTa* this, PlayState* play); +void func_80B14D98(EnTa* this, PlayState* play); +void func_80B154FC(EnTa* this, PlayState* play); +void func_80B16504(EnTa* this, PlayState* play); +void func_80B16608(EnTa* this, PlayState* play); void func_80B166CC(EnTa* this); void func_80B16700(EnTa* this); void func_80B167C0(EnTa* this); @@ -68,8 +68,8 @@ void func_80B13AA0(EnTa* this, EnTaActionFunc arg1, EnTaUnkFunc arg2) { this->unk_260 = arg2; } -void func_80B13AAC(EnTa* this, GlobalContext* globalCtx) { - u16 faceReaction = Text_GetFaceReaction(globalCtx, 24); +void func_80B13AAC(EnTa* this, PlayState* play) { + u16 faceReaction = Text_GetFaceReaction(play, 24); if (GET_EVENTINF(EVENTINF_HORSES_0A)) { if (GET_EVENTINF(EVENTINF_HORSES_08)) { @@ -97,15 +97,14 @@ void func_80B13AAC(EnTa* this, GlobalContext* globalCtx) { } } -void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnTa_Init(Actor* thisx, PlayState* play2) { EnTa* this = (EnTa*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gTalonSkel, &gTalonStandAnim, this->jointTable, this->morphTable, - 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gTalonSkel, &gTalonStandAnim, this->jointTable, this->morphTable, 17); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk_2E0 = 0; @@ -145,7 +144,7 @@ void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_Kill(&this->actor); } else if (!LINK_IS_ADULT) { Actor_Kill(&this->actor); - } else if (globalCtx->sceneNum == SCENE_MALON_STABLE && !IS_DAY) { + } else if (play->sceneNum == SCENE_MALON_STABLE && !IS_DAY) { Actor_Kill(&this->actor); osSyncPrintf(VT_FGCOL(CYAN) " 夜はいない \n" VT_RST); } else { @@ -157,7 +156,7 @@ void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) { break; default: osSyncPrintf(VT_FGCOL(CYAN) " その他のタロン \n" VT_RST); - if (globalCtx->sceneNum == SCENE_SPOT15) { + if (play->sceneNum == SCENE_SPOT15) { if (GET_EVENTCHKINF(EVENTCHKINF_14)) { Actor_Kill(&this->actor); } else if (GET_EVENTCHKINF(EVENTCHKINF_13)) { @@ -172,7 +171,7 @@ void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) { this->currentAnimation = &gTalonSleepAnim; this->actor.shape.shadowScale = 54.0f; } - } else if (globalCtx->sceneNum == SCENE_SOUKO) { + } else if (play->sceneNum == SCENE_SOUKO) { osSyncPrintf(VT_FGCOL(CYAN) " ロンロン牧場の倉庫 の タロン\n" VT_RST); if (!GET_EVENTCHKINF(EVENTCHKINF_14)) { Actor_Kill(&this->actor); @@ -183,15 +182,15 @@ void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.flags |= ACTOR_FLAG_4; this->unk_2C4[0] = this->unk_2C4[1] = this->unk_2C4[2] = 7; this->superCuccos[0] = (EnNiw*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_NIW, this->actor.world.pos.x + 5.0f, + &play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 5.0f, this->actor.world.pos.y + 3.0f, this->actor.world.pos.z + 26.0f, 0, 0, 0, 0xD); this->superCuccos[1] = (EnNiw*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_NIW, this->actor.world.pos.x - 20.0f, + &play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x - 20.0f, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z - 30.0f, 0, 0, 0, 0xD); this->superCuccos[2] = (EnNiw*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_NIW, this->actor.world.pos.x + 20.0f, + &play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 20.0f, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z - 30.0f, 0, 0, 0, 0xD); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); if (GET_EVENTINF(EVENTINF_HORSES_0A)) { func_80B13AA0(this, func_80B16608, func_80B16938); @@ -230,12 +229,12 @@ void func_80B14248(EnTa* this) { } } -void EnTa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTa_Destroy(Actor* thisx, PlayState* play) { EnTa* this = (EnTa*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); - if (this->actor.params != 1 && this->actor.params != 2 && globalCtx->sceneNum == SCENE_SOUKO) { + if (this->actor.params != 1 && this->actor.params != 2 && play->sceneNum == SCENE_SOUKO) { gSaveContext.timer1State = 0; } @@ -244,8 +243,8 @@ void EnTa_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -s32 func_80B142F4(EnTa* this, GlobalContext* globalCtx, u16 textId) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80B142F4(EnTa* this, PlayState* play, u16 textId) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { return true; } @@ -254,19 +253,19 @@ s32 func_80B142F4(EnTa* this, GlobalContext* globalCtx, u16 textId) { if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { this->unk_2E0 |= 1; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } return false; } -void func_80B14398(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B14398(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B13AA0(this, func_80B14754, func_80B167FC); } } -void func_80B143D4(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B143D4(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B13AA0(this, func_80B146F8, func_80B167FC); } } @@ -281,22 +280,22 @@ void func_80B14410(EnTa* this) { } } -void func_80B1448C(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B1448C(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B14410(this); } func_80B14248(this); this->unk_2E0 |= 0x4; } -void func_80B144D8(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B144D8(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B14410(this); this->blinkTimer = 1; this->unk_2B0 = func_80B16700; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) { this->eyeIndex = 1; func_80B13AA0(this, func_80B1448C, func_80B167C0); } @@ -304,7 +303,7 @@ void func_80B144D8(EnTa* this, GlobalContext* globalCtx) { this->unk_2E0 |= 4; } -void func_80B14570(EnTa* this, GlobalContext* globalCtx) { +void func_80B14570(EnTa* this, PlayState* play) { this->unk_2E0 |= 4; if (this->unk_2CC == 0) { @@ -317,17 +316,17 @@ void func_80B14570(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B145F8(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B145F8(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B13AA0(this, func_80B14634, func_80B167FC); } } -void func_80B14634(EnTa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B14634(EnTa* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - s32 exchangeItemId = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + s32 exchangeItemId = func_8002F368(play); switch (exchangeItemId) { case EXCH_ITEM_CHICKEN: @@ -344,23 +343,23 @@ void func_80B14634(EnTa* this, GlobalContext* globalCtx) { } } else { this->actor.textId = 0x702A; - func_8002F298(&this->actor, globalCtx, 100.0f, 3); + func_8002F298(&this->actor, play, 100.0f, 3); } } -void func_80B146F8(EnTa* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B146F8(EnTa* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { func_80B13AA0(this, func_80B143D4, func_80B167FC); } this->actor.textId = 0x204B; - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } -void func_80B14754(EnTa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B14754(EnTa* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - s32 exchangeItemId = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + s32 exchangeItemId = func_8002F368(play); switch (exchangeItemId) { case EXCH_ITEM_POCKET_CUCCO: @@ -377,12 +376,12 @@ void func_80B14754(EnTa* this, GlobalContext* globalCtx) { } } else { this->actor.textId = 0x5015; - func_8002F298(&this->actor, globalCtx, 100.0f, 6); + func_8002F298(&this->actor, play, 100.0f, 6); } } -void func_80B14818(EnTa* this, GlobalContext* globalCtx) { - s32 framesMod12 = (s32)globalCtx->state.frames % 12; +void func_80B14818(EnTa* this, PlayState* play) { + s32 framesMod12 = (s32)play->state.frames % 12; if (framesMod12 == 0 || framesMod12 == 6) { Audio_PlayActorSound2(&this->actor, NA_SE_PL_WALK_GROUND); @@ -393,16 +392,16 @@ void func_80B14818(EnTa* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } -void func_80B14898(EnTa* this, GlobalContext* globalCtx) { - func_80033480(globalCtx, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); - func_80B14818(this, globalCtx); +void func_80B14898(EnTa* this, PlayState* play) { + func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); + func_80B14818(this, play); if (this->unk_2CC == 0) { Actor_Kill(&this->actor); } } -void func_80B1490C(EnTa* this, GlobalContext* globalCtx) { +void func_80B1490C(EnTa* this, PlayState* play) { this->actor.world.rot.y += 0xC00; this->actor.shape.rot.y += 0xC00; @@ -412,9 +411,9 @@ void func_80B1490C(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B1496C(EnTa* this, GlobalContext* globalCtx) { - func_80033480(globalCtx, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); - func_80B14818(this, globalCtx); +void func_80B1496C(EnTa* this, PlayState* play) { + func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); + func_80B14818(this, play); if (this->unk_2CC == 0) { func_80B13AA0(this, func_80B1490C, func_80B167C0); @@ -422,7 +421,7 @@ void func_80B1496C(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B149F4(EnTa* this, GlobalContext* globalCtx) { +void func_80B149F4(EnTa* this, PlayState* play) { this->actor.world.rot.y -= 0xD00; this->actor.shape.rot.y -= 0xD00; @@ -432,12 +431,12 @@ void func_80B149F4(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B14A54(EnTa* this, GlobalContext* globalCtx) { - func_80033480(globalCtx, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); - func_80B14818(this, globalCtx); +void func_80B14A54(EnTa* this, PlayState* play) { + func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); + func_80B14818(this, play); if (this->unk_2CC == 20) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } if (this->unk_2CC == 0) { this->unk_2CC = 5; @@ -445,7 +444,7 @@ void func_80B14A54(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B14AF4(EnTa* this, GlobalContext* globalCtx) { +void func_80B14AF4(EnTa* this, PlayState* play) { this->actor.world.rot.y -= 0xC00; this->actor.shape.rot.y -= 0xC00; @@ -457,9 +456,9 @@ void func_80B14AF4(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B14B6C(EnTa* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) { - OnePointCutscene_Init(globalCtx, 4175, -99, &this->actor, CAM_ID_MAIN); +void func_80B14B6C(EnTa* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) { + OnePointCutscene_Init(play, 4175, -99, &this->actor, CAM_ID_MAIN); func_80B13AA0(this, func_80B14AF4, func_80B167C0); this->unk_2CC = 5; SET_EVENTCHKINF(EVENTCHKINF_14); @@ -469,41 +468,41 @@ void func_80B14B6C(EnTa* this, GlobalContext* globalCtx) { this->unk_2E0 |= 1; } -void func_80B14C18(EnTa* this, GlobalContext* globalCtx) { - if (func_80B142F4(this, globalCtx, 0x702C)) { +void func_80B14C18(EnTa* this, PlayState* play) { + if (func_80B142F4(this, play, 0x702C)) { func_80B13AA0(this, func_80B14B6C, func_80B167C0); } func_80B14248(this); } -void func_80B14C60(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B14C60(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B13AA0(this, func_80B14CAC, func_80B167C0); } this->unk_2E0 |= 1; } -void func_80B14CAC(EnTa* this, GlobalContext* globalCtx) { +void func_80B14CAC(EnTa* this, PlayState* play) { if (GET_EVENTCHKINF(EVENTCHKINF_18)) { - if (func_80B142F4(this, globalCtx, 0x5017)) { + if (func_80B142F4(this, play, 0x5017)) { func_80B13AA0(this, func_80B14C60, func_80B167C0); SET_EVENTCHKINF(EVENTCHKINF_6B); } - } else if (func_80B142F4(this, globalCtx, 0x5016)) { + } else if (func_80B142F4(this, play, 0x5016)) { func_80B13AA0(this, func_80B14C60, func_80B167C0); } func_80B14248(this); } -void func_80B14D4C(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B14D4C(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B13AA0(this, func_80B14D98, func_80B167C0); } this->unk_2E0 |= 1; } -void func_80B14D98(EnTa* this, GlobalContext* globalCtx) { - if (func_80B142F4(this, globalCtx, 0x2055)) { +void func_80B14D98(EnTa* this, PlayState* play) { + if (func_80B142F4(this, play, 0x2055)) { func_80B13AA0(this, func_80B14D4C, func_80B167C0); } } @@ -518,14 +517,14 @@ s32 func_80B14DD8(void) { } } -void func_80B14E28(EnTa* this, GlobalContext* globalCtx) { +void func_80B14E28(EnTa* this, PlayState* play) { Vec3f subCamEye; Vec3f subCamAt; - this->subCamId = Play_CreateSubCamera(globalCtx); - this->returnToCamId = globalCtx->activeCamId; - Play_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamId = Play_CreateSubCamera(play); + this->returnToCamId = play->activeCamId; + Play_ChangeCameraStatus(play, this->returnToCamId, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); subCamEye.x = 1053.0f; subCamEye.y = 11.0f; @@ -535,12 +534,12 @@ void func_80B14E28(EnTa* this, GlobalContext* globalCtx) { subCamAt.y = 45.0f; subCamAt.z = -40.0f; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); } -void func_80B14EDC(EnTa* this, GlobalContext* globalCtx) { - Play_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_ACTIVE); - Play_ClearCamera(globalCtx, this->subCamId); +void func_80B14EDC(EnTa* this, PlayState* play) { + Play_ChangeCameraStatus(play, this->returnToCamId, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->subCamId); } void func_80B14F20(EnTa* this, EnTaActionFunc arg1) { @@ -560,17 +559,17 @@ void func_80B14FAC(EnTa* this, EnTaActionFunc arg1) { ANIMMODE_ONCE, -5.0f); } -void func_80B15034(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void func_80B15034(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); func_80B14F20(this, func_80B16504); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); } this->unk_2E0 |= 1; } -s32 func_80B150AC(EnTa* this, GlobalContext* globalCtx, s32 idx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B150AC(EnTa* this, PlayState* play, s32 idx) { + Player* player = GET_PLAYER(play); Actor* interactRangeActor; if (player->stateFlags1 & PLAYER_STATE1_11) { @@ -583,17 +582,17 @@ s32 func_80B150AC(EnTa* this, GlobalContext* globalCtx, s32 idx) { return false; } -void func_80B15100(EnTa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B15100(EnTa* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { s32 unk_2CA; Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 10.0f); this->unk_2E0 &= ~0x10; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); unk_2CA = this->unk_2CA; this->actionFunc = func_80B154FC; this->superCuccos[unk_2CA]->actor.gravity = 0.1f; @@ -613,17 +612,17 @@ void func_80B15100(EnTa* this, GlobalContext* globalCtx) { this->unk_2E0 |= 1; } -void func_80B15260(EnTa* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B15260(EnTa* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = func_80B15100; this->actor.flags &= ~ACTOR_FLAG_16; } else { - func_8002F2CC(&this->actor, globalCtx, 1000.0f); + func_8002F2CC(&this->actor, play, 1000.0f); } this->unk_2E0 |= 1; } -s32 EnTa_GetSuperCuccosCount(EnTa* this, GlobalContext* globalCtx) { +s32 EnTa_GetSuperCuccosCount(EnTa* this, PlayState* play) { s32 count; s32 i; @@ -648,39 +647,39 @@ void func_80B15308(EnTa* this) { } } -void func_80B153D4(EnTa* this, GlobalContext* globalCtx) { +void func_80B153D4(EnTa* this, PlayState* play) { func_80B15308(this); if (this->unk_2CC == 0) { if (this->unk_2E0 & 0x80) { this->unk_2E0 &= ~0x80; - func_80B14EDC(this, globalCtx); + func_80B14EDC(this, play); } } } -void func_80B15424(EnTa* this, GlobalContext* globalCtx) { +void func_80B15424(EnTa* this, PlayState* play) { func_80B15308(this); - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->nextEntranceIndex = ENTR_SOUKO_2; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->nextEntranceIndex = ENTR_SOUKO_2; if (GET_EVENTINF(EVENTINF_HORSES_08)) { - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; } else { - globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); + play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; } - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_0A); this->actionFunc = func_80B153D4; this->unk_2CC = 22; } } -void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { +void func_80B154FC(EnTa* this, PlayState* play) { s32 i; for (i = 0; i < ARRAY_COUNT(this->superCuccos); i++) { @@ -689,7 +688,7 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { this->superCuccos[i]->actor.gravity -= 0.03f; } - if (func_80B150AC(this, globalCtx, i)) { + if (func_80B150AC(this, play, i)) { if (this->unk_2C4[i] > 0) { this->unk_2C4[i]--; } else { @@ -697,12 +696,12 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); this->unk_2E0 &= ~0x10; - switch (EnTa_GetSuperCuccosCount(this, globalCtx)) { + switch (EnTa_GetSuperCuccosCount(this, play)) { case 1: gSaveContext.timer1State = 0; - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); - Message_StartTextbox(globalCtx, 0x2084, &this->actor); + Message_StartTextbox(play, 0x2084, &this->actor); this->actionFunc = func_80B15424; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); @@ -724,7 +723,7 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { } this->actionFunc = func_80B15260; this->actor.flags |= ACTOR_FLAG_16; - func_8002F2CC(&this->actor, globalCtx, 1000.0f); + func_8002F2CC(&this->actor, play, 1000.0f); return; } } else { @@ -737,15 +736,15 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { func_800F5918(); } - if (gSaveContext.timer1Value == 0 && !Play_InCsMode(globalCtx)) { + if (gSaveContext.timer1Value == 0 && !Play_InCsMode(play)) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP); this->unk_2E0 &= ~0x200; func_80078884(NA_SE_SY_FOUND); gSaveContext.timer1State = 0; - func_8002DF54(globalCtx, &this->actor, 1); - Message_StartTextbox(globalCtx, 0x2081, &this->actor); + func_8002DF54(play, &this->actor, 1); + Message_StartTextbox(play, 0x2081, &this->actor); this->actionFunc = func_80B15424; - func_80B14E28(this, globalCtx); + func_80B14E28(this, play); CLEAR_EVENTINF(EVENTINF_HORSES_08); this->unk_2E0 |= 0x80; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); @@ -756,7 +755,7 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) { this->unk_2E0 |= 1; } -void func_80B1585C(EnTa* this, GlobalContext* globalCtx) { +void func_80B1585C(EnTa* this, PlayState* play) { s32 i; if (this->unk_2CC > 35) { @@ -795,11 +794,11 @@ void func_80B1585C(EnTa* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 10.0f); - func_8002DF54(globalCtx, &this->actor, 7); + func_8002DF54(play, &this->actor, 7); } } -void func_80B15AD4(EnTa* this, GlobalContext* globalCtx) { +void func_80B15AD4(EnTa* this, PlayState* play) { if (this->unk_2CC == 0 && this->unk_2E0 & 0x20) { func_80B13AA0(this, func_80B1585C, func_80B16938); this->unk_2E0 &= ~0x10; @@ -809,60 +808,60 @@ void func_80B15AD4(EnTa* this, GlobalContext* globalCtx) { func_80088B34(0x1E); func_800F5ACC(NA_BGM_TIMED_MINI_GAME); this->unk_2E0 |= 0x200; - Message_CloseTextbox(globalCtx); - func_8002DF54(globalCtx, &this->actor, 1); + Message_CloseTextbox(play); + func_8002DF54(play, &this->actor, 1); } - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_2E0 |= 0x20; } this->unk_2E0 |= 1; } -void func_80B15BF8(EnTa* this, GlobalContext* globalCtx) { +void func_80B15BF8(EnTa* this, PlayState* play) { if (this->unk_2E0 & 0x10) { func_80B13AA0(this, func_80B15AD4, func_80B16938); this->unk_2E0 &= ~0x10; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 0.0f, 1.0f, ANIMMODE_ONCE, 0.0f); this->unk_2CC = 5; } - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_2E0 |= 0x20; } this->unk_2E0 |= 1; } -void func_80B15CC8(EnTa* this, GlobalContext* globalCtx) { +void func_80B15CC8(EnTa* this, PlayState* play) { if (this->unk_2E0 & 0x10) { func_80B13AA0(this, func_80B15BF8, func_80B16938); this->unk_2E0 &= ~0x10; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, -1.0f, 29.0f, 0.0f, ANIMMODE_ONCE, 10.0f); } - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_2E0 |= 0x20; } this->unk_2E0 |= 1; } -void func_80B15D90(EnTa* this, GlobalContext* globalCtx) { +void func_80B15D90(EnTa* this, PlayState* play) { func_80B13AA0(this, func_80B15CC8, func_80B16938); this->unk_2E0 &= ~0x10; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); - Message_ContinueTextbox(globalCtx, 0x2080); + Message_ContinueTextbox(play, 0x2080); this->unk_2E0 &= ~0x20; } -void func_80B15E28(EnTa* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80B15E28(EnTa* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B14F20(this, func_80B16504); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); } this->unk_2E0 |= 1; } -void func_80B15E80(EnTa* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B15E80(EnTa* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80B15E28; if (!(this->unk_2E0 & 0x2)) { @@ -870,55 +869,55 @@ void func_80B15E80(EnTa* this, GlobalContext* globalCtx) { } this->unk_2E0 &= ~0x2; } else if (this->unk_2E0 & 2) { - func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f); } else { - func_8002F434(&this->actor, globalCtx, GI_MILK_BOTTLE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_MILK_BOTTLE, 10000.0f, 50.0f); } this->unk_2E0 |= 1; } -void func_80B15F54(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void func_80B15F54(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->unk_2E0 &= ~0x2; func_80B13AA0(this, func_80B15E80, func_80B16938); - func_8002F434(&this->actor, globalCtx, GI_MILK_BOTTLE, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_MILK_BOTTLE, 10000.0f, 50.0f); } } -void func_80B15FE8(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80B15FE8(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: switch (func_80B14DD8()) { case 0: - Message_ContinueTextbox(globalCtx, 0x85); + Message_ContinueTextbox(play, 0x85); func_80B13AA0(this, func_80B15034, func_80B16938); break; case 1: - Message_ContinueTextbox(globalCtx, 0x208A); + Message_ContinueTextbox(play, 0x208A); func_80B13AA0(this, func_80B15E28, func_80B16938); break; case 2: this->unk_2E0 |= 2; func_80B13AA0(this, func_80B15E80, func_80B16938); Rupees_ChangeBy(-30); - func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f); break; } break; case 1: if (gSaveContext.rupees < 10) { - Message_ContinueTextbox(globalCtx, 0x85); + Message_ContinueTextbox(play, 0x85); func_80B13AA0(this, func_80B15034, func_80B16938); } else { Rupees_ChangeBy(-10); - func_80B15D90(this, globalCtx); + func_80B15D90(this, play); } break; case 2: func_80B14F20(this, func_80B16504); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); break; } } @@ -928,7 +927,7 @@ void func_80B15FE8(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B161C0(EnTa* this, GlobalContext* globalCtx) { +void func_80B161C0(EnTa* this, PlayState* play) { s32 price; if (this->actor.textId == 0x2085) { @@ -937,20 +936,20 @@ void func_80B161C0(EnTa* this, GlobalContext* globalCtx) { price = 10; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees < price) { - Message_ContinueTextbox(globalCtx, 0x85); + Message_ContinueTextbox(play, 0x85); func_80B13AA0(this, func_80B15034, func_80B16938); } else { Rupees_ChangeBy(-price); - func_80B15D90(this, globalCtx); + func_80B15D90(this, play); } break; case 1: func_80B14F20(this, func_80B16504); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); break; } } @@ -960,9 +959,9 @@ void func_80B161C0(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B162E8(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_ContinueTextbox(globalCtx, 0x2087); +void func_80B162E8(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_ContinueTextbox(play, 0x2087); func_80B13AA0(this, func_80B15F54, func_80B16938); } @@ -971,14 +970,14 @@ void func_80B162E8(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B16364(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void func_80B16364(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { SET_INFTABLE(INFTABLE_7E); if (GET_ITEMGETINF(ITEMGETINF_02)) { - Message_ContinueTextbox(globalCtx, 0x208B); + Message_ContinueTextbox(play, 0x208B); func_80B13AA0(this, func_80B15FE8, func_80B16938); } else { - Message_ContinueTextbox(globalCtx, 0x207F); + Message_ContinueTextbox(play, 0x207F); func_80B13AA0(this, func_80B161C0, func_80B16938); } } @@ -988,26 +987,26 @@ void func_80B16364(EnTa* this, GlobalContext* globalCtx) { } } -void func_80B1642C(EnTa* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { +void func_80B1642C(EnTa* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { if (Inventory_HasEmptyBottle()) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->unk_2E0 |= 2; func_80B13AA0(this, func_80B15E80, func_80B16938); - func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 50.0f); + func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f); } else { - Message_ContinueTextbox(globalCtx, 0x208A); + Message_ContinueTextbox(play, 0x208A); func_80B13AA0(this, func_80B15E28, func_80B16938); } } } -void func_80B16504(EnTa* this, GlobalContext* globalCtx) { - u16 faceReaction = Text_GetFaceReaction(globalCtx, 0x18); +void func_80B16504(EnTa* this, PlayState* play) { + u16 faceReaction = Text_GetFaceReaction(play, 0x18); - func_80B13AAC(this, globalCtx); + func_80B13AAC(this, play); - if (func_80B142F4(this, globalCtx, this->actor.textId)) { + if (func_80B142F4(this, play, this->actor.textId)) { Audio_PlayActorSound2(&this->actor, NA_SE_VO_TA_SURPRISE); if (faceReaction != 0) { @@ -1032,8 +1031,8 @@ void func_80B16504(EnTa* this, GlobalContext* globalCtx) { this->unk_2E0 &= ~1; } -void func_80B16608(EnTa* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B16608(EnTa* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { switch (this->actor.textId) { case 0x2085: this->actionFunc = func_80B161C0; @@ -1048,7 +1047,7 @@ void func_80B16608(EnTa* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_16; } else { this->actor.flags |= ACTOR_FLAG_16; - func_8002F2CC(&this->actor, globalCtx, 1000.0f); + func_8002F2CC(&this->actor, play, 1000.0f); } this->unk_2E0 |= 1; } @@ -1131,23 +1130,23 @@ void func_80B16938(EnTa* this) { } } -void EnTa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTa_Update(Actor* thisx, PlayState* play) { EnTa* this = (EnTa*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); this->unk_260(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (!(this->unk_2E0 & 4)) { this->unk_2B0(this); } if (this->unk_2E0 & 1) { - func_80038290(globalCtx, &this->actor, &this->unk_2D4, &this->unk_2DA, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_2D4, &this->unk_2DA, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_2D4.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_2D4.y, 0, 6, 6200, 100); @@ -1162,7 +1161,7 @@ void EnTa_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnTa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnTa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnTa* this = (EnTa*)thisx; switch (limbIndex) { @@ -1181,14 +1180,14 @@ s32 EnTa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } else if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { s32 limbIdx50 = limbIndex * 50; - rot->y += Math_SinS(globalCtx->state.frames * (limbIdx50 + 0x814)) * 200.0f; - rot->z += Math_CosS(globalCtx->state.frames * (limbIdx50 + 0x940)) * 200.0f; + rot->y += Math_SinS(play->state.frames * (limbIdx50 + 0x814)) * 200.0f; + rot->z += Math_CosS(play->state.frames * (limbIdx50 + 0x940)) * 200.0f; } return false; } -void EnTa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnTa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80B16E7C = { 1100.0f, 1000.0f, @@ -1201,7 +1200,7 @@ void EnTa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnTa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTa_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { gTalonEyeOpenTex, gTalonEyeHalfTex, @@ -1210,15 +1209,15 @@ void EnTa_Draw(Actor* thisx, GlobalContext* globalCtx) { EnTa* this = (EnTa*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ta.c", 2381); + OPEN_DISPS(play->state.gfxCtx, "../z_en_ta.c", 2381); - func_800943C8(globalCtx->state.gfxCtx); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x9, SEGMENTED_TO_VIRTUAL(gTalonHeadSkinTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTa_OverrideLimbDraw, EnTa_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ta.c", 2400); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_ta.c", 2400); } diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.h b/src/overlays/actors/ovl_En_Ta/z_en_ta.h index 18e3f849d7..ebb3823b5a 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.h +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.h @@ -8,7 +8,7 @@ struct EnTa; -typedef void (*EnTaActionFunc)(struct EnTa*, GlobalContext*); +typedef void (*EnTaActionFunc)(struct EnTa*, PlayState*); typedef void (*EnTaUnkFunc)(struct EnTa*); typedef struct EnTa { diff --git a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c index 2977137224..ff08ba0c68 100644 --- a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c +++ b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c @@ -10,17 +10,17 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_27) -void EnTakaraMan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTakaraMan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTakaraMan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTakaraMan_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTakaraMan_Init(Actor* thisx, PlayState* play); +void EnTakaraMan_Destroy(Actor* thisx, PlayState* play); +void EnTakaraMan_Update(Actor* thisx, PlayState* play); +void EnTakaraMan_Draw(Actor* thisx, PlayState* play); -void func_80B176E0(EnTakaraMan* this, GlobalContext* globalCtx); -void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx); -void func_80B17B14(EnTakaraMan* this, GlobalContext* globalCtx); -void func_80B17934(EnTakaraMan* this, GlobalContext* globalCtx); -void func_80B17A6C(EnTakaraMan* this, GlobalContext* globalCtx); -void func_80B17AC4(EnTakaraMan* this, GlobalContext* globalCtx); +void func_80B176E0(EnTakaraMan* this, PlayState* play); +void func_80B1778C(EnTakaraMan* this, PlayState* play); +void func_80B17B14(EnTakaraMan* this, PlayState* play); +void func_80B17934(EnTakaraMan* this, PlayState* play); +void func_80B17A6C(EnTakaraMan* this, PlayState* play); +void func_80B17AC4(EnTakaraMan* this, PlayState* play); const ActorInit En_Takara_Man_InitVars = { ACTOR_EN_TAKARA_MAN, @@ -36,10 +36,10 @@ const ActorInit En_Takara_Man_InitVars = { static u8 sTakaraIsInitialized = false; -void EnTakaraMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTakaraMan_Destroy(Actor* thisx, PlayState* play) { } -void EnTakaraMan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTakaraMan_Init(Actor* thisx, PlayState* play) { EnTakaraMan* this = (EnTakaraMan*)thisx; if (sTakaraIsInitialized) { @@ -51,10 +51,10 @@ void EnTakaraMan_Init(Actor* thisx, GlobalContext* globalCtx) { sTakaraIsInitialized = true; osSyncPrintf("\n\n"); // "Bun! %x" (needs a better translation) - osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ ばぅん! ☆☆☆☆☆ %x\n" VT_RST, globalCtx->actorCtx.flags.chest); - globalCtx->actorCtx.flags.chest = 0; + osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ ばぅん! ☆☆☆☆☆ %x\n" VT_RST, play->actorCtx.flags.chest); + play->actorCtx.flags.chest = 0; gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = -1; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ts_Skel_004FE0, &object_ts_Anim_000498, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ts_Skel_004FE0, &object_ts_Anim_000498, this->jointTable, this->morphTable, 10); thisx->focus.pos = thisx->world.pos; this->pos = thisx->world.pos; @@ -70,7 +70,7 @@ void EnTakaraMan_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B176E0; } -void func_80B176E0(EnTakaraMan* this, GlobalContext* globalCtx) { +void func_80B176E0(EnTakaraMan* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&object_ts_Anim_000498); Animation_Change(&this->skelAnime, &object_ts_Anim_000498, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); @@ -81,12 +81,12 @@ void func_80B176E0(EnTakaraMan* this, GlobalContext* globalCtx) { this->actionFunc = func_80B1778C; } -void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx) { +void func_80B1778C(EnTakaraMan* this, PlayState* play) { s16 absYawDiff; s16 yawDiff; SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, globalCtx) && this->dialogState != TEXT_STATE_DONE) { + if (Actor_ProcessTalkRequest(&this->actor, play) && this->dialogState != TEXT_STATE_DONE) { if (!this->unk_214) { this->actionFunc = func_80B17934; } else { @@ -94,14 +94,14 @@ void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx) { } } else { yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (globalCtx->roomCtx.curRoom.num == 6 && !this->unk_21A) { + if (play->roomCtx.curRoom.num == 6 && !this->unk_21A) { this->actor.textId = 0x6E; this->unk_21A = 1; this->dialogState = TEXT_STATE_DONE; } if (!this->unk_21A && this->unk_214) { - if (Flags_GetSwitch(globalCtx, 0x32)) { + if (Flags_GetSwitch(play, 0x32)) { this->actor.textId = 0x84; this->dialogState = TEXT_STATE_EVENT; } else { @@ -112,7 +112,7 @@ void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx) { absYawDiff = ABS(yawDiff); if (absYawDiff < 0x4300) { - if (globalCtx->roomCtx.curRoom.num != this->originalRoomNum) { + if (play->roomCtx.curRoom.num != this->originalRoomNum) { this->actor.flags &= ~ACTOR_FLAG_0; this->unk_218 = 0; } else { @@ -120,35 +120,35 @@ void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_0; this->unk_218 = 1; } - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } } } } -void func_80B17934(EnTakaraMan* this, GlobalContext* globalCtx) { - if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80B17934(EnTakaraMan* this, PlayState* play) { + if (this->dialogState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // Yes if (gSaveContext.rupees >= 10) { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); Rupees_ChangeBy(-10); this->unk_214 = 1; this->actor.parent = NULL; - func_8002F434(&this->actor, globalCtx, GI_DOOR_KEY, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, GI_DOOR_KEY, 2000.0f, 1000.0f); this->actionFunc = func_80B17A6C; } else { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.textId = 0x85; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; this->actionFunc = func_80B17B14; } break; case 1: // No - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actor.textId = 0x2D; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; this->actionFunc = func_80B17B14; break; @@ -156,28 +156,28 @@ void func_80B17934(EnTakaraMan* this, GlobalContext* globalCtx) { } } -void func_80B17A6C(EnTakaraMan* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B17A6C(EnTakaraMan* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_80B17AC4; } else { - func_8002F434(&this->actor, globalCtx, GI_DOOR_KEY, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, GI_DOOR_KEY, 2000.0f, 1000.0f); } } -void func_80B17AC4(EnTakaraMan* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(globalCtx)) { +void func_80B17AC4(EnTakaraMan* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { this->actionFunc = func_80B176E0; } } -void func_80B17B14(EnTakaraMan* this, GlobalContext* globalCtx) { - if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); +void func_80B17B14(EnTakaraMan* this, PlayState* play) { + if (this->dialogState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->actionFunc = func_80B176E0; } } -void EnTakaraMan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTakaraMan_Update(Actor* thisx, PlayState* play) { EnTakaraMan* this = (EnTakaraMan*)thisx; if (this->eyeTimer != 0) { @@ -185,7 +185,7 @@ void EnTakaraMan_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, this->height); - func_80038290(globalCtx, &this->actor, &this->unk_22C, &this->unk_232, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_22C, &this->unk_232, this->actor.focus.pos); if (this->eyeTimer == 0) { this->eyeTextureIdx++; if (this->eyeTextureIdx >= 2) { @@ -194,11 +194,10 @@ void EnTakaraMan_Update(Actor* thisx, GlobalContext* globalCtx) { } } this->unk_212++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnTakaraMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnTakaraMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnTakaraMan* this = (EnTakaraMan*)thisx; if (limbIndex == 1) { @@ -211,19 +210,19 @@ s32 EnTakaraMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnTakaraMan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTakaraMan_Draw(Actor* thisx, PlayState* play) { static void* eyeTextures[] = { object_ts_Tex_000970, object_ts_Tex_000D70, }; EnTakaraMan* this = (EnTakaraMan*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_takara_man.c", 528); + OPEN_DISPS(play->state.gfxCtx, "../z_en_takara_man.c", 528); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTakaraMan_OverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_takara_man.c", 544); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_takara_man.c", 544); } diff --git a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h index dc48850e86..48898909bc 100644 --- a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h +++ b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h @@ -6,7 +6,7 @@ struct EnTakaraMan; -typedef void (*EnTakaraManActionFunc)(struct EnTakaraMan*, GlobalContext*); +typedef void (*EnTakaraManActionFunc)(struct EnTakaraMan*, PlayState*); typedef struct EnTakaraMan { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Tana/z_en_tana.c b/src/overlays/actors/ovl_En_Tana/z_en_tana.c index 81b21f44c2..e39cee812f 100644 --- a/src/overlays/actors/ovl_En_Tana/z_en_tana.c +++ b/src/overlays/actors/ovl_En_Tana/z_en_tana.c @@ -9,11 +9,11 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnTana_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTana_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTana_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTana_DrawWoodenShelves(Actor* thisx, GlobalContext* globalCtx); -void EnTana_DrawStoneShelves(Actor* thisx, GlobalContext* globalCtx); +void EnTana_Init(Actor* thisx, PlayState* play); +void EnTana_Destroy(Actor* thisx, PlayState* play); +void EnTana_Update(Actor* thisx, PlayState* play); +void EnTana_DrawWoodenShelves(Actor* thisx, PlayState* play); +void EnTana_DrawStoneShelves(Actor* thisx, PlayState* play); const ActorInit En_Tana_InitVars = { ACTOR_EN_TANA, @@ -56,7 +56,7 @@ static void* sStoneTextures[] = { gShopDungenStone2Tex, }; -void EnTana_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTana_Init(Actor* thisx, PlayState* play) { EnTana* this = (EnTana*)thisx; osSyncPrintf("☆☆☆ %s ☆☆☆\n", sShelfTypes[thisx->params]); @@ -65,35 +65,35 @@ void EnTana_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->draw = sDrawFuncs[thisx->params]; } -void EnTana_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTana_Destroy(Actor* thisx, PlayState* play) { } -void EnTana_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTana_Update(Actor* thisx, PlayState* play) { } -void EnTana_DrawWoodenShelves(Actor* thisx, GlobalContext* globalCtx) { +void EnTana_DrawWoodenShelves(Actor* thisx, PlayState* play) { EnTana* this = (EnTana*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tana.c", 148); + OPEN_DISPS(play->state.gfxCtx, "../z_en_tana.c", 148); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tana.c", 152), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_tana.c", 152), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sShelfDLists[thisx->params]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tana.c", 157); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_tana.c", 157); } -void EnTana_DrawStoneShelves(Actor* thisx, GlobalContext* globalCtx) { +void EnTana_DrawStoneShelves(Actor* thisx, PlayState* play) { EnTana* this = (EnTana*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tana.c", 163); + OPEN_DISPS(play->state.gfxCtx, "../z_en_tana.c", 163); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sStoneTextures[thisx->params])); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tana.c", 169), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_tana.c", 169), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sShelfDLists[thisx->params]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tana.c", 174); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_tana.c", 174); } 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 7028257b11..a8f4f36226 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnTest_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTest_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTest_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTest_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTest_Init(Actor* thisx, PlayState* play); +void EnTest_Destroy(Actor* thisx, PlayState* play); +void EnTest_Update(Actor* thisx, PlayState* play); +void EnTest_Draw(Actor* thisx, PlayState* play); void EnTest_SetupWaitGround(EnTest* this); void EnTest_SetupWaitAbove(EnTest* this); @@ -29,37 +29,37 @@ void EnTest_SetupRecoil(EnTest* this); void func_80862398(EnTest* this); void func_80862154(EnTest* this); void EnTest_SetupStopAndBlock(EnTest* this); -void func_808627C4(EnTest* this, GlobalContext* globalCtx); +void func_808627C4(EnTest* this, PlayState* play); -void EnTest_WaitGround(EnTest* this, GlobalContext* globalCtx); -void EnTest_WaitAbove(EnTest* this, GlobalContext* globalCtx); -void EnTest_Fall(EnTest* this, GlobalContext* globalCtx); -void EnTest_Land(EnTest* this, GlobalContext* globalCtx); -void EnTest_Rise(EnTest* this, GlobalContext* globalCtx); -void EnTest_Idle(EnTest* this, GlobalContext* globalCtx); -void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx); -void func_80860C24(EnTest* this, GlobalContext* globalCtx); -void func_80860F84(EnTest* this, GlobalContext* globalCtx); -void EnTest_SlashDown(EnTest* this, GlobalContext* globalCtx); -void EnTest_SlashDownEnd(EnTest* this, GlobalContext* globalCtx); -void EnTest_SlashUp(EnTest* this, GlobalContext* globalCtx); -void EnTest_JumpBack(EnTest* this, GlobalContext* globalCtx); -void EnTest_Jumpslash(EnTest* this, GlobalContext* globalCtx); -void EnTest_JumpUp(EnTest* this, GlobalContext* globalCtx); -void EnTest_StopAndBlock(EnTest* this, GlobalContext* globalCtx); -void EnTest_IdleFromBlock(EnTest* this, GlobalContext* globalCtx); -void func_808621D4(EnTest* this, GlobalContext* globalCtx); -void func_80862418(EnTest* this, GlobalContext* globalCtx); -void EnTest_Stunned(EnTest* this, GlobalContext* globalCtx); -void func_808628C8(EnTest* this, GlobalContext* globalCtx); -void func_80862E6C(EnTest* this, GlobalContext* globalCtx); -void func_80863044(EnTest* this, GlobalContext* globalCtx); -void func_8086318C(EnTest* this, GlobalContext* globalCtx); -void EnTest_Recoil(EnTest* this, GlobalContext* globalCtx); -void func_808633E8(EnTest* this, GlobalContext* globalCtx); -void func_80862FA8(EnTest* this, GlobalContext* globalCtx); +void EnTest_WaitGround(EnTest* this, PlayState* play); +void EnTest_WaitAbove(EnTest* this, PlayState* play); +void EnTest_Fall(EnTest* this, PlayState* play); +void EnTest_Land(EnTest* this, PlayState* play); +void EnTest_Rise(EnTest* this, PlayState* play); +void EnTest_Idle(EnTest* this, PlayState* play); +void EnTest_WalkAndBlock(EnTest* this, PlayState* play); +void func_80860C24(EnTest* this, PlayState* play); +void func_80860F84(EnTest* this, PlayState* play); +void EnTest_SlashDown(EnTest* this, PlayState* play); +void EnTest_SlashDownEnd(EnTest* this, PlayState* play); +void EnTest_SlashUp(EnTest* this, PlayState* play); +void EnTest_JumpBack(EnTest* this, PlayState* play); +void EnTest_Jumpslash(EnTest* this, PlayState* play); +void EnTest_JumpUp(EnTest* this, PlayState* play); +void EnTest_StopAndBlock(EnTest* this, PlayState* play); +void EnTest_IdleFromBlock(EnTest* this, PlayState* play); +void func_808621D4(EnTest* this, PlayState* play); +void func_80862418(EnTest* this, PlayState* play); +void EnTest_Stunned(EnTest* this, PlayState* play); +void func_808628C8(EnTest* this, PlayState* play); +void func_80862E6C(EnTest* this, PlayState* play); +void func_80863044(EnTest* this, PlayState* play); +void func_8086318C(EnTest* this, PlayState* play); +void EnTest_Recoil(EnTest* this, PlayState* play); +void func_808633E8(EnTest* this, PlayState* play); +void func_80862FA8(EnTest* this, PlayState* play); -s32 EnTest_ReactToProjectile(GlobalContext* globalCtx, EnTest* this); +s32 EnTest_ReactToProjectile(PlayState* play, EnTest* this); static u8 sJointCopyFlags[] = { false, // STALFOS_LIMB_NONE @@ -253,15 +253,15 @@ void EnTest_SetupAction(EnTest* this, EnTestActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnTest_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTest_Init(Actor* thisx, PlayState* play) { EffectBlureInit1 slashBlure; EnTest* this = (EnTest*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gStalfosSkel, &gStalfosMiddleGuardAnim, this->jointTable, - this->morphTable, STALFOS_LIMB_MAX); - SkelAnime_Init(globalCtx, &this->upperSkelanime, &gStalfosSkel, &gStalfosMiddleGuardAnim, this->upperJointTable, + 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); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, 90.0f); @@ -272,14 +272,14 @@ void EnTest_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos.y += 45.0f; this->actor.colChkInfo.damageTable = &sDamageTable; - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sBodyColliderInit); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyColliderInit); - Collider_InitCylinder(globalCtx, &this->shieldCollider); - Collider_SetCylinder(globalCtx, &this->shieldCollider, &this->actor, &sShieldColliderInit); + Collider_InitCylinder(play, &this->shieldCollider); + Collider_SetCylinder(play, &this->shieldCollider, &this->actor, &sShieldColliderInit); - Collider_InitQuad(globalCtx, &this->swordCollider); - Collider_SetQuad(globalCtx, &this->swordCollider, &this->actor, &sSwordColliderInit); + Collider_InitQuad(play, &this->swordCollider); + Collider_SetQuad(play, &this->swordCollider, &this->actor, &sSwordColliderInit); this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 10; @@ -297,7 +297,7 @@ void EnTest_Init(Actor* thisx, GlobalContext* globalCtx) { slashBlure.unkFlag = 0; slashBlure.calcMode = 2; - Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE1, 0, 0, &slashBlure); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE1, 0, 0, &slashBlure); if (this->actor.params != STALFOS_TYPE_CEILING) { EnTest_SetupWaitGround(this); @@ -310,32 +310,32 @@ void EnTest_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTest_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTest_Destroy(Actor* thisx, PlayState* play) { EnTest* this = (EnTest*)thisx; if ((this->actor.params != STALFOS_TYPE_2) && - !Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f)) { + !Actor_FindNearby(play, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f)) { func_800F5B58(); } - Effect_Delete(globalCtx, this->effectIndex); - Collider_DestroyCylinder(globalCtx, &this->shieldCollider); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyQuad(globalCtx, &this->swordCollider); + Effect_Delete(play, this->effectIndex); + Collider_DestroyCylinder(play, &this->shieldCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->swordCollider); } /** * If EnTest_ChooseAction failed to pick a new action, this function will unconditionally pick * a new action as a last resort */ -void EnTest_ChooseRandomAction(EnTest* this, GlobalContext* globalCtx) { +void EnTest_ChooseRandomAction(EnTest* this, PlayState* play) { switch ((u32)(Rand_ZeroOne() * 10.0f)) { case 0: case 1: case 5: case 6: if ((this->actor.xzDistToPlayer < 220.0f) && (this->actor.xzDistToPlayer > 170.0f) && - Actor_IsFacingPlayer(&this->actor, 0x71C) && Actor_IsTargeted(globalCtx, &this->actor)) { + Actor_IsFacingPlayer(&this->actor, 0x71C) && Actor_IsTargeted(play, &this->actor)) { EnTest_SetupJumpslash(this); break; } @@ -347,7 +347,7 @@ void EnTest_ChooseRandomAction(EnTest* this, GlobalContext* globalCtx) { case 3: case 4: case 7: - func_808627C4(this, globalCtx); + func_808627C4(this, play); break; case 2: @@ -358,9 +358,9 @@ void EnTest_ChooseRandomAction(EnTest* this, GlobalContext* globalCtx) { } } -void EnTest_ChooseAction(EnTest* this, GlobalContext* globalCtx) { +void EnTest_ChooseAction(EnTest* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; yawDiff = ABS(yawDiff); @@ -377,7 +377,7 @@ void EnTest_ChooseAction(EnTest* this, GlobalContext* globalCtx) { case 5: case 6: case 8: - func_808627C4(this, globalCtx); + func_808627C4(this, play); break; case 2: @@ -391,11 +391,11 @@ void EnTest_ChooseAction(EnTest* this, GlobalContext* globalCtx) { } } else if (yawDiff <= 0x3E80) { if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) > 0x3E80) { - if (((globalCtx->gameplayFrames % 2) != 0) && (this->actor.params != STALFOS_TYPE_CEILING)) { + if (((play->gameplayFrames % 2) != 0) && (this->actor.params != STALFOS_TYPE_CEILING)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnTest_SetupJumpBack(this); } else if ((this->actor.xzDistToPlayer < 220.0f) && (this->actor.xzDistToPlayer > 170.0f)) { - if (Actor_IsFacingPlayer(&this->actor, 0x71C) && !Actor_IsTargeted(globalCtx, &this->actor)) { + if (Actor_IsFacingPlayer(&this->actor, 0x71C) && !Actor_IsTargeted(play, &this->actor)) { EnTest_SetupJumpslash(this); } } else { @@ -408,18 +408,18 @@ void EnTest_ChooseAction(EnTest* this, GlobalContext* globalCtx) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } else { EnTest_SetupSlashDown(this); } } } else { - EnTest_ChooseRandomAction(this, globalCtx); + EnTest_ChooseRandomAction(this, play); } } } else { - EnTest_ChooseRandomAction(this, globalCtx); + EnTest_ChooseRandomAction(this, play); } } @@ -433,7 +433,7 @@ void EnTest_SetupWaitGround(EnTest* this) { EnTest_SetupAction(this, EnTest_WaitGround); } -void EnTest_WaitGround(EnTest* this, GlobalContext* globalCtx) { +void EnTest_WaitGround(EnTest* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->timer == 0) && (ABS(this->actor.yDistToPlayer) < 150.0f)) { @@ -463,7 +463,7 @@ void EnTest_SetupWaitAbove(EnTest* this) { EnTest_SetupAction(this, EnTest_WaitAbove); } -void EnTest_WaitAbove(EnTest* this, GlobalContext* globalCtx) { +void EnTest_WaitAbove(EnTest* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; @@ -484,13 +484,13 @@ void EnTest_SetupIdle(EnTest* this) { EnTest_SetupAction(this, EnTest_Idle); } -void EnTest_Idle(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTest_Idle(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; SkelAnime_Update(&this->skelAnime); - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; if (this->actor.xzDistToPlayer < 100.0f) { @@ -500,7 +500,7 @@ void EnTest_Idle(EnTest* this, GlobalContext* globalCtx) { if (Rand_ZeroOne() > 0.7f && player->meleeWeaponAnimation != PLAYER_MWA_JUMPSLASH_START) { EnTest_SetupJumpBack(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } return; } @@ -512,30 +512,30 @@ void EnTest_Idle(EnTest* this, GlobalContext* globalCtx) { if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if ((this->actor.xzDistToPlayer < 220.0f) && (this->actor.xzDistToPlayer > 160.0f) && (Rand_ZeroOne() < 0.3f)) { - if (Actor_IsTargeted(globalCtx, &this->actor)) { + if (Actor_IsTargeted(play, &this->actor)) { EnTest_SetupJumpslash(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } else { if (Rand_ZeroOne() > 0.3f) { EnTest_SetupWalkAndBlock(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } } else { if (Rand_ZeroOne() > 0.7f) { func_80860BDC(this); } else { - EnTest_ChooseAction(this, globalCtx); + EnTest_ChooseAction(this, play); } } } } } -void EnTest_Fall(EnTest* this, GlobalContext* globalCtx) { +void EnTest_Fall(EnTest* this, PlayState* play) { Animation_PlayOnceSetSpeed(&this->skelAnime, &gStalfosLandFromLeapAnim, 0.0f); SkelAnime_Update(&this->skelAnime); @@ -548,7 +548,7 @@ void EnTest_Fall(EnTest* this, GlobalContext* globalCtx) { } } -void EnTest_Land(EnTest* this, GlobalContext* globalCtx) { +void EnTest_Land(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnTest_SetupIdle(this); this->timer = (Rand_ZeroOne() * 10.0f) + 5.0f; @@ -565,21 +565,21 @@ void EnTest_SetupWalkAndBlock(EnTest* this) { EnTest_SetupAction(this, EnTest_WalkAndBlock); } -void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) { +void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { s32 pad; f32 checkDist = 0.0f; s32 pad1; s32 prevFrame; s32 beforeCurFrame; f32 playSpeed; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 absPlaySpeed; s16 yawDiff; - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { this->timer++; - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { checkDist = 150.0f; } @@ -596,7 +596,7 @@ void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) { } if ((this->actor.params == STALFOS_TYPE_CEILING) && - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.world.rot.y)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.world.rot.y)) { this->actor.speedXZ *= -1.0f; } @@ -658,19 +658,19 @@ void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer < 220.0f) && (this->actor.xzDistToPlayer > 160.0f) && (Actor_IsFacingPlayer(&this->actor, 0x71C))) { - if (Actor_IsTargeted(globalCtx, &this->actor)) { + if (Actor_IsTargeted(play, &this->actor)) { if (Rand_ZeroOne() < 0.1f) { EnTest_SetupJumpslash(this); return; } } else if (player->heldItemActionParam != PLAYER_AP_NONE) { if (this->actor.isTargeted) { - if ((globalCtx->gameplayFrames % 2) != 0) { - func_808627C4(this, globalCtx); + if ((play->gameplayFrames % 2) != 0) { + func_808627C4(this, play); return; } - EnTest_ChooseAction(this, globalCtx); + EnTest_ChooseAction(this, play); } else { func_80860EC0(this); } @@ -693,7 +693,7 @@ void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } else { EnTest_SetupSlashDown(this); @@ -715,7 +715,7 @@ void func_80860BDC(EnTest* this) { } // a variation of sidestep -void func_80860C24(EnTest* this, GlobalContext* globalCtx) { +void func_80860C24(EnTest* this, PlayState* play) { s16 yawDiff; s16 yawChange; f32 playSpeed; @@ -724,7 +724,7 @@ void func_80860C24(EnTest* this, GlobalContext* globalCtx) { s32 afterPrevFrame; s32 absPlaySpeed; - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { yawDiff = this->actor.yawTowardsPlayer; yawDiff -= this->actor.shape.rot.y; @@ -766,7 +766,7 @@ void func_80860C24(EnTest* this, GlobalContext* globalCtx) { if ((Rand_ZeroOne() > 0.7f)) { func_80860EC0(this); } else { - EnTest_ChooseAction(this, globalCtx); + EnTest_ChooseAction(this, play); } } else { EnTest_SetupWalkAndBlock(this); @@ -787,18 +787,18 @@ void func_80860EC0(EnTest* this) { } // a variation of sidestep -void func_80860F84(EnTest* this, GlobalContext* globalCtx) { +void func_80860F84(EnTest* this, PlayState* play) { s16 playerYaw180; s32 pad; s32 prevFrame; s32 beforeCurFrame; s16 yawDiff; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 checkDist = 0.0f; s16 newYaw; s32 absPlaySpeed; - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); this->actor.world.rot.y = this->actor.shape.rot.y + 0x3E80; playerYaw180 = player->actor.shape.rot.y + 0x8000; @@ -819,7 +819,7 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || ((this->actor.params == STALFOS_TYPE_CEILING) && - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.world.rot.y))) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.world.rot.y))) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { newYaw = this->actor.shape.rot.y + 0x3FFF; @@ -844,7 +844,7 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) { } } - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { checkDist = 200.0f; } @@ -876,7 +876,7 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) { } } - if ((globalCtx->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_WARAU); } @@ -884,7 +884,7 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) { yawDiff = ABS(yawDiff); if ((yawDiff > 0x6800) || (this->timer == 0)) { - EnTest_ChooseAction(this, globalCtx); + EnTest_ChooseAction(this, play); } else if (this->timer != 0) { this->timer--; } @@ -905,7 +905,7 @@ void EnTest_SetupSlashDown(EnTest* this) { } } -void EnTest_SlashDown(EnTest* this, GlobalContext* globalCtx) { +void EnTest_SlashDown(EnTest* this, PlayState* play) { this->actor.speedXZ = 0.0f; if ((s32)this->skelAnime.curFrame < 4) { @@ -923,7 +923,7 @@ void EnTest_SlashDown(EnTest* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skelAnime)) { - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { EnTest_SetupSlashDownEnd(this); } else { EnTest_SetupSlashUp(this); @@ -938,8 +938,8 @@ void EnTest_SetupSlashDownEnd(EnTest* this) { EnTest_SetupAction(this, EnTest_SlashDownEnd); } -void EnTest_SlashDownEnd(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTest_SlashDownEnd(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; if (SkelAnime_Update(&this->skelAnime)) { @@ -977,8 +977,8 @@ void EnTest_SlashDownEnd(EnTest* this, GlobalContext* globalCtx) { } else if (player->stateFlags1 & PLAYER_STATE1_4) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); - } else if ((globalCtx->gameplayFrames % 2) != 0) { - func_808627C4(this, globalCtx); + } else if ((play->gameplayFrames % 2) != 0) { + func_808627C4(this, play); } else { EnTest_SetupJumpBack(this); } @@ -986,7 +986,7 @@ void EnTest_SlashDownEnd(EnTest* this, GlobalContext* globalCtx) { EnTest_SetupSlashDown(this); } } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } } @@ -1004,7 +1004,7 @@ void EnTest_SetupSlashUp(EnTest* this) { } } -void EnTest_SlashUp(EnTest* this, GlobalContext* globalCtx) { +void EnTest_SlashUp(EnTest* this, PlayState* play) { this->actor.speedXZ = 0.0f; if ((s32)this->skelAnime.curFrame == 2) { @@ -1040,7 +1040,7 @@ void EnTest_SetupJumpBack(EnTest* this) { } } -void EnTest_JumpBack(EnTest* this, GlobalContext* globalCtx) { +void EnTest_JumpBack(EnTest* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 1); if (this->timer == 0) { @@ -1050,7 +1050,7 @@ void EnTest_JumpBack(EnTest* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skelAnime)) { - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { if (this->actor.xzDistToPlayer <= 100.0f) { if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { EnTest_SetupSlashDown(this); @@ -1091,7 +1091,7 @@ void EnTest_SetupJumpslash(EnTest* this) { } } -void EnTest_Jumpslash(EnTest* this, GlobalContext* globalCtx) { +void EnTest_Jumpslash(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->timer == 0) { Animation_PlayOnce(&this->skelAnime, &gStalfosJumpslashAnim); @@ -1131,7 +1131,7 @@ void EnTest_SetupJumpUp(EnTest* this) { EnTest_SetupAction(this, EnTest_JumpUp); } -void EnTest_JumpUp(EnTest* this, GlobalContext* globalCtx) { +void EnTest_JumpUp(EnTest* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); SkelAnime_Update(&this->skelAnime); @@ -1165,12 +1165,12 @@ void EnTest_SetupStopAndBlock(EnTest* this) { EnTest_SetupAction(this, EnTest_StopAndBlock); } -void EnTest_StopAndBlock(EnTest* this, GlobalContext* globalCtx) { +void EnTest_StopAndBlock(EnTest* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); SkelAnime_Update(&this->skelAnime); if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) > 0x3E80) && - (this->actor.params != STALFOS_TYPE_CEILING) && ((globalCtx->gameplayFrames % 2) != 0)) { + (this->actor.params != STALFOS_TYPE_CEILING) && ((play->gameplayFrames % 2) != 0)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnTest_SetupJumpBack(this); } @@ -1188,7 +1188,7 @@ void EnTest_SetupIdleFromBlock(EnTest* this) { EnTest_SetupAction(this, EnTest_IdleFromBlock); } -void EnTest_IdleFromBlock(EnTest* this, GlobalContext* globalCtx) { +void EnTest_IdleFromBlock(EnTest* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.5f, 0.0f); SkelAnime_Update(&this->skelAnime); @@ -1196,11 +1196,11 @@ void EnTest_IdleFromBlock(EnTest* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->unk_7DE = 0; - if (!EnTest_ReactToProjectile(globalCtx, this)) { + if (!EnTest_ReactToProjectile(play, this)) { if (this->actor.xzDistToPlayer < 500.0f) { - EnTest_ChooseAction(this, globalCtx); + EnTest_ChooseAction(this, play); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } } @@ -1215,8 +1215,8 @@ void func_80862154(EnTest* this) { EnTest_SetupAction(this, func_808621D4); } -void func_808621D4(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808621D4(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.1f, 0.0f); @@ -1227,8 +1227,8 @@ void func_808621D4(EnTest* this, GlobalContext* globalCtx) { ((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) && (this->actor.xzDistToPlayer < 80.0f))) { EnTest_SetupJumpUp(this); - } else if (!EnTest_ReactToProjectile(globalCtx, this)) { - EnTest_ChooseAction(this, globalCtx); + } else if (!EnTest_ReactToProjectile(play, this)) { + EnTest_ChooseAction(this, play); } else { return; } @@ -1259,16 +1259,16 @@ void func_80862398(EnTest* this) { EnTest_SetupAction(this, func_80862418); } -void func_80862418(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80862418(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.1f, 0.0f); if (SkelAnime_Update(&this->skelAnime)) { this->actor.speedXZ = 0.0f; - if (!EnTest_ReactToProjectile(globalCtx, this)) { - EnTest_ChooseAction(this, globalCtx); + if (!EnTest_ReactToProjectile(play, this)) { + EnTest_ChooseAction(this, play); } else { return; } @@ -1313,14 +1313,14 @@ void EnTest_SetupStunned(EnTest* this) { EnTest_SetupAction(this, EnTest_Stunned); } -void EnTest_Stunned(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTest_Stunned(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); if (this->actor.colorFilterTimer == 0) { if (this->actor.colChkInfo.health == 0) { - func_80862FA8(this, globalCtx); + func_80862FA8(this, play); } else if (player->meleeWeaponState != 0) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && ((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) && @@ -1335,23 +1335,23 @@ void EnTest_Stunned(EnTest* this, GlobalContext* globalCtx) { this->unk_7C8 = 8; } else { this->actor.speedXZ = 0.0f; - if (!EnTest_ReactToProjectile(globalCtx, this)) { - EnTest_ChooseAction(this, globalCtx); + if (!EnTest_ReactToProjectile(play, this)) { + EnTest_ChooseAction(this, play); } } } } // a variation of sidestep -void func_808627C4(EnTest* this, GlobalContext* globalCtx) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { +void func_808627C4(EnTest* this, PlayState* play) { + if (Actor_OtherIsTargeted(play, &this->actor)) { func_80860EC0(this); return; } Animation_MorphToLoop(&this->skelAnime, &gStalfosSidestepAnim, -2.0f); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); - this->actor.speedXZ = ((globalCtx->gameplayFrames % 2) != 0) ? -4.0f : 4.0f; + this->actor.speedXZ = ((play->gameplayFrames % 2) != 0) ? -4.0f : 4.0f; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; this->timer = (Rand_ZeroOne() * 20.0f) + 20.0f; this->unk_7C8 = 0x18; @@ -1360,9 +1360,9 @@ void func_808627C4(EnTest* this, GlobalContext* globalCtx) { } // a variation of sidestep -void func_808628C8(EnTest* this, GlobalContext* globalCtx) { +void func_808628C8(EnTest* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad1; s32 prevFrame; s32 beforeCurFrame; @@ -1393,7 +1393,7 @@ void func_808628C8(EnTest* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || ((this->actor.params == STALFOS_TYPE_CEILING) && - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3FFF))) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3FFF))) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { newYaw = (this->actor.shape.rot.y + 0x3FFF); @@ -1420,7 +1420,7 @@ void func_808628C8(EnTest* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { checkDist = 200.0f; } @@ -1456,14 +1456,14 @@ void func_808628C8(EnTest* this, GlobalContext* globalCtx) { } if (this->timer == 0) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { EnTest_SetupIdle(this); - } else if (Actor_IsTargeted(globalCtx, &this->actor)) { - if (!EnTest_ReactToProjectile(globalCtx, this)) { - EnTest_ChooseAction(this, globalCtx); + } else if (Actor_IsTargeted(play, &this->actor)) { + if (!EnTest_ReactToProjectile(play, this)) { + EnTest_ChooseAction(this, play); } } else if (player->heldItemActionParam != PLAYER_AP_NONE) { - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { EnTest_SetupIdle(this); } else { EnTest_SetupWalkAndBlock(this); @@ -1477,10 +1477,10 @@ void func_808628C8(EnTest* this, GlobalContext* globalCtx) { } } -void func_80862DBC(EnTest* this, GlobalContext* globalCtx) { +void func_80862DBC(EnTest* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_DAMAGE); this->unk_7C8 = 2; - BodyBreak_Alloc(&this->bodyBreak, 60, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 60, play); this->actor.home.rot.x = 0; if (this->swordState >= 0) { @@ -1491,19 +1491,19 @@ void func_80862DBC(EnTest* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; if (this->actor.params == STALFOS_TYPE_5) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } EnTest_SetupAction(this, func_80862E6C); } -void func_80862E6C(EnTest* this, GlobalContext* globalCtx) { +void func_80862E6C(EnTest* this, PlayState* play) { if (this->actor.child == NULL) { if (this->actor.home.rot.x == 0) { this->actor.home.rot.x = this->bodyBreak.count; } - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params + 8)) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, this->actor.params + 8)) { this->actor.child = &this->actor; } } else { @@ -1513,15 +1513,15 @@ void func_80862E6C(EnTest* this, GlobalContext* globalCtx) { if (this->actor.params == STALFOS_TYPE_4) { this->actor.params = -1; } else { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } this->actor.child = NULL; this->actor.flags |= ACTOR_FLAG_0; EnTest_SetupJumpBack(this); } else if ((this->actor.params == STALFOS_TYPE_5) && - !Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f)) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xD0); + !Actor_FindNearby(play, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f)) { + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xD0); if (this->actor.parent != NULL) { this->actor.parent->home.rot.z--; @@ -1532,7 +1532,7 @@ void func_80862E6C(EnTest* this, GlobalContext* globalCtx) { } } -void func_80862FA8(EnTest* this, GlobalContext* globalCtx) { +void func_80862FA8(EnTest* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gStalfosFallOverBackwardsAnim); Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_DEAD); this->unk_7DE = 0; @@ -1544,16 +1544,16 @@ void func_80862FA8(EnTest* this, GlobalContext* globalCtx) { this->unk_7C8 = 5; EnTest_SetupAction(this, func_80863044); } else { - func_80862DBC(this, globalCtx); + func_80862DBC(this, play); } } -void func_80863044(EnTest* this, GlobalContext* globalCtx) { +void func_80863044(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->timer = (Rand_ZeroOne() * 10.0f) + 10.0f; this->unk_7C8 = 7; EnTest_SetupAction(this, func_808633E8); - BodyBreak_Alloc(&this->bodyBreak, 60, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 60, play); } if ((s32)this->skelAnime.curFrame == 15) { @@ -1561,7 +1561,7 @@ void func_80863044(EnTest* this, GlobalContext* globalCtx) { } } -void func_808630F0(EnTest* this, GlobalContext* globalCtx) { +void func_808630F0(EnTest* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gStalfosFallOverForwardsAnim); Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_DEAD); this->unk_7C8 = 6; @@ -1573,16 +1573,16 @@ void func_808630F0(EnTest* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; EnTest_SetupAction(this, func_8086318C); } else { - func_80862DBC(this, globalCtx); + func_80862DBC(this, play); } } -void func_8086318C(EnTest* this, GlobalContext* globalCtx) { +void func_8086318C(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->timer = (Rand_ZeroOne() * 10.0f) + 10.0f; this->unk_7C8 = 7; EnTest_SetupAction(this, func_808633E8); - BodyBreak_Alloc(&this->bodyBreak, 60, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 60, play); } if (((s32)this->skelAnime.curFrame == 10) || ((s32)this->skelAnime.curFrame == 25)) { @@ -1600,20 +1600,20 @@ void EnTest_SetupRecoil(EnTest* this) { EnTest_SetupAction(this, EnTest_Recoil); } -void EnTest_Recoil(EnTest* this, GlobalContext* globalCtx) { +void EnTest_Recoil(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (Rand_ZeroOne() > 0.7f) { EnTest_SetupIdle(this); this->timer = (Rand_ZeroOne() * 5.0f) + 5.0f; - } else if (((globalCtx->gameplayFrames % 2) != 0) && (this->actor.params != STALFOS_TYPE_CEILING)) { + } else if (((play->gameplayFrames % 2) != 0) && (this->actor.params != STALFOS_TYPE_CEILING)) { EnTest_SetupJumpBack(this); } else { - func_808627C4(this, globalCtx); + func_808627C4(this, play); } } } -void EnTest_Rise(EnTest* this, GlobalContext* globalCtx) { +void EnTest_Rise(EnTest* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.scale.y < 0.015f) { @@ -1625,11 +1625,11 @@ void EnTest_Rise(EnTest* this, GlobalContext* globalCtx) { } } -void func_808633E8(EnTest* this, GlobalContext* globalCtx) { +void func_808633E8(EnTest* this, PlayState* play) { this->actor.params = STALFOS_TYPE_1; - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params)) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xD0); + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, this->actor.params)) { + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xD0); if (this->actor.parent != NULL) { this->actor.parent->home.rot.z--; @@ -1639,7 +1639,7 @@ void func_808633E8(EnTest* this, GlobalContext* globalCtx) { } } -void EnTest_UpdateHeadRot(EnTest* this, GlobalContext* globalCtx) { +void EnTest_UpdateHeadRot(EnTest* this, PlayState* play) { s16 lookAngle = this->actor.yawTowardsPlayer; lookAngle -= (s16)(this->headRot.y + this->actor.shape.rot.y); @@ -1649,8 +1649,8 @@ void EnTest_UpdateHeadRot(EnTest* this, GlobalContext* globalCtx) { this->headRot.y = CLAMP(this->headRot.y, -0x382F, 0x382F); } -void EnTest_UpdateDamage(EnTest* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTest_UpdateDamage(EnTest* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->shieldCollider.base.acFlags & AC_BOUNCED) { this->shieldCollider.base.acFlags &= ~AC_BOUNCED; @@ -1683,14 +1683,14 @@ void EnTest_UpdateDamage(EnTest* this, GlobalContext* globalCtx) { } else { if (Actor_IsFacingPlayer(&this->actor, 0x4000)) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); - func_80862FA8(this, globalCtx); + Enemy_StartFinishingBlow(play, &this->actor); + func_80862FA8(this, play); } else { func_80862154(this); } } else if (Actor_ApplyDamage(&this->actor) == 0) { - func_808630F0(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + func_808630F0(this, play); + Enemy_StartFinishingBlow(play, &this->actor); } else { func_80862398(this); } @@ -1699,17 +1699,17 @@ void EnTest_UpdateDamage(EnTest* this, GlobalContext* globalCtx) { } } -void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTest_Update(Actor* thisx, PlayState* play) { EnTest* this = (EnTest*)thisx; f32 oldWeight; u32 floorProperty; s32 pad; - EnTest_UpdateDamage(this, globalCtx); + EnTest_UpdateDamage(this, play); if (this->actor.colChkInfo.damageEffect != STALFOS_DMGEFF_FIREMAGIC) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); @@ -1723,16 +1723,16 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.floorHeight = this->actor.home.pos.y; } } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { - floorProperty = func_80041EA4(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + floorProperty = func_80041EA4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorProperty == 5) || (floorProperty == 0xC) || - func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 9) { + func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 9) { Actor_Kill(&this->actor); return; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); switch (this->unk_7DE) { case 0: @@ -1741,7 +1741,7 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { case 1: Animation_Change(&this->upperSkelanime, &gStalfosBlockWithShieldAnim, 2.0f, 0.0f, Animation_GetLastFrame(&gStalfosBlockWithShieldAnim), 2, 2.0f); - AnimationContext_SetCopyTrue(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->upperSkelanime.jointTable, sJointCopyFlags); this->unk_7DE++; break; @@ -1774,7 +1774,7 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.colorFilterTimer == 0) && (this->actor.colChkInfo.health != 0)) { if ((this->unk_7C8 != 0x10) && (this->unk_7C8 != 0x17)) { - EnTest_UpdateHeadRot(this, globalCtx); + EnTest_UpdateHeadRot(this, play); } else { Math_SmoothStepToS(&this->headRot.y, 0, 1, 0x3E8, 0); } @@ -1787,21 +1787,21 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos.y += 45.0f; if ((this->actor.colChkInfo.health > 0) || (this->actor.colorFilterTimer != 0)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if ((this->unk_7C8 >= 0xA) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if (this->unk_7DE != 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->shieldCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->shieldCollider.base); } } if (this->swordState >= 1) { if (!(this->swordCollider.base.atFlags & AT_BOUNCED)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->swordCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->swordCollider.base); } else { this->swordCollider.base.atFlags &= ~AT_BOUNCED; EnTest_SetupRecoil(this); @@ -1809,7 +1809,7 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.params == STALFOS_TYPE_INVISIBLE) { - if (globalCtx->actorCtx.lensActive) { + if (play->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_7; this->actor.shape.shadowDraw = ActorShadow_DrawFeet; } else { @@ -1819,7 +1819,7 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnTest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnTest_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnTest* this = (EnTest*)thisx; s32 pad; @@ -1828,13 +1828,12 @@ s32 EnTest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList rot->y -= this->headRot.x; rot->z += this->headRot.z; } else if (limbIndex == STALFOS_LIMB_HEAD) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_test.c", 3582); + OPEN_DISPS(play->state.gfxCtx, "../z_en_test.c", 3582); gDPPipeSync(POLY_OPA_DISP++); - gDPSetEnvColor(POLY_OPA_DISP++, 80 + ABS((s16)(Math_SinS(globalCtx->gameplayFrames * 2000) * 175.0f)), 0, 0, - 255); + gDPSetEnvColor(POLY_OPA_DISP++, 80 + ABS((s16)(Math_SinS(play->gameplayFrames * 2000) * 175.0f)), 0, 0, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_test.c", 3587); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_test.c", 3587); } if ((this->actor.params == STALFOS_TYPE_INVISIBLE) && !CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_7)) { @@ -1844,7 +1843,7 @@ s32 EnTest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnTest_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnTest_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f unused1 = { 1100.0f, -700.0f, 0.0f }; static Vec3f D_80864658 = { 300.0f, 0.0f, 0.0f }; static Vec3f D_80864664 = { 3400.0f, 0.0f, 0.0f }; @@ -1881,8 +1880,7 @@ void EnTest_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V Matrix_MultVec3f(&D_80864664, &sp70); Matrix_MultVec3f(&D_80864670, &sp64); - if ((this->swordState >= 1) && - ((this->actor.params != STALFOS_TYPE_INVISIBLE) || globalCtx->actorCtx.lensActive)) { + if ((this->swordState >= 1) && ((this->actor.params != STALFOS_TYPE_INVISIBLE) || play->actorCtx.lensActive)) { EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &sp70, &sp64); } else if (this->swordState >= 0) { EffectBlure_AddSpace(Effect_GetByIndex(this->effectIndex)); @@ -1902,7 +1900,7 @@ void EnTest_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V if ((this->unk_7C8 == 0x15) || (this->unk_7C8 == 0x16)) { if (this->actor.speedXZ != 0.0f) { Matrix_MultVec3f(&D_80864658, &sp64); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &sp64, 10.0f, 1, 8.0f, 100, 15, false); + Actor_SpawnFloorDustRing(play, &this->actor, &sp64, 10.0f, 1, 8.0f, 100, 15, false); } } } @@ -1949,14 +1947,14 @@ void EnTest_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void EnTest_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTest_Draw(Actor* thisx, PlayState* play) { EnTest* this = (EnTest*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 1); + func_80093D18(play->state.gfxCtx); + func_8002EBCC(&this->actor, play, 1); if ((thisx->params <= STALFOS_TYPE_CEILING) || (thisx->child == NULL)) { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnTest_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnTest_OverrideLimbDraw, EnTest_PostLimbDraw, this); } @@ -1967,8 +1965,8 @@ void EnTest_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->iceTimer % 4) == 0) { s32 iceIndex = this->iceTimer >> 2; - EffectSsEnIce_SpawnFlyingVec3s(globalCtx, thisx, &this->bodyPartsPos[iceIndex], 150, 150, 150, 250, 235, - 245, 255, 1.5f); + EffectSsEnIce_SpawnFlyingVec3s(play, thisx, &this->bodyPartsPos[iceIndex], 150, 150, 150, 250, 235, 245, + 255, 1.5f); } } } @@ -1987,14 +1985,14 @@ void func_80864158(EnTest* this, f32 xzSpeed) { * Check if a projectile actor is within 300 units and react accordingly. * Returns true if the projectile test passes and a new action is performed. */ -s32 EnTest_ReactToProjectile(GlobalContext* globalCtx, EnTest* this) { +s32 EnTest_ReactToProjectile(PlayState* play, EnTest* this) { Actor* projectileActor; s16 yawToProjectile; s16 wallYawDiff; s16 touchingWall; s16 directionFlag; - projectileActor = Actor_GetProjectileActor(globalCtx, &this->actor, 300.0f); + projectileActor = Actor_GetProjectileActor(play, &this->actor, 300.0f); if (projectileActor != NULL) { yawToProjectile = Actor_WorldYawTowardActor(&this->actor, projectileActor) - (u16)this->actor.shape.rot.y; @@ -2007,7 +2005,7 @@ s32 EnTest_ReactToProjectile(GlobalContext* globalCtx, EnTest* this) { } if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &projectileActor->world.pos) < 200.0f) { - if (Actor_IsTargeted(globalCtx, &this->actor) && (projectileActor->id == ACTOR_ARMS_HOOK)) { + if (Actor_IsTargeted(play, &this->actor) && (projectileActor->id == ACTOR_ARMS_HOOK)) { EnTest_SetupJumpUp(this); } else if (ABS(yawToProjectile) < 0x2000) { EnTest_SetupStopAndBlock(this); @@ -2020,13 +2018,13 @@ s32 EnTest_ReactToProjectile(GlobalContext* globalCtx, EnTest* this) { return true; } - if (Actor_IsTargeted(globalCtx, &this->actor) && (projectileActor->id == ACTOR_ARMS_HOOK)) { + if (Actor_IsTargeted(play, &this->actor) && (projectileActor->id == ACTOR_ARMS_HOOK)) { EnTest_SetupJumpUp(this); return true; } if ((ABS(yawToProjectile) < 0x2000) || (ABS(yawToProjectile) > 0x6000)) { - directionFlag = globalCtx->gameplayFrames % 2; + directionFlag = play->gameplayFrames % 2; if (touchingWall && (wallYawDiff > 0x2000) && (wallYawDiff < 0x6000)) { directionFlag = false; @@ -2040,7 +2038,7 @@ s32 EnTest_ReactToProjectile(GlobalContext* globalCtx, EnTest* this) { func_80864158(this, -4.0f); } } else if (ABS(yawToProjectile) < 0x6000) { - directionFlag = globalCtx->gameplayFrames % 2; + directionFlag = play->gameplayFrames % 2; if (touchingWall && (ABS(wallYawDiff) > 0x6000)) { directionFlag = false; 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 93263e2367..3ddf9f7238 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.h +++ b/src/overlays/actors/ovl_En_Test/z_en_test.h @@ -6,7 +6,7 @@ struct EnTest; -typedef void (*EnTestActionFunc)(struct EnTest*, GlobalContext*); +typedef void (*EnTestActionFunc)(struct EnTest*, PlayState*); typedef enum { /* 0x00 */ STALFOS_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c index 9b0d753217..29bd66bb98 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnTg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTg_Init(Actor* thisx, PlayState* play); +void EnTg_Destroy(Actor* thisx, PlayState* play); +void EnTg_Update(Actor* thisx, PlayState* play); +void EnTg_Draw(Actor* thisx, PlayState* play); -void EnTg_SpinIfNotTalking(EnTg* this, GlobalContext* globalCtx); +void EnTg_SpinIfNotTalking(EnTg* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -50,18 +50,18 @@ const ActorInit En_Tg_InitVars = { (ActorFunc)EnTg_Draw, }; -u16 EnTg_GetTextId(GlobalContext* globalCtx, Actor* thisx) { +u16 EnTg_GetTextId(PlayState* play, Actor* thisx) { EnTg* this = (EnTg*)thisx; u16 temp; u32 phi; // If the player is wearing a mask, return a special reaction text - temp = Text_GetFaceReaction(globalCtx, 0x24); + temp = Text_GetFaceReaction(play, 0x24); if (temp != 0) { return temp; } // Use a different set of dialogue in Kakariko Village (Adult) - if (globalCtx->sceneNum == SCENE_SPOT01) { + if (play->sceneNum == SCENE_SPOT01) { if (this->nextDialogue % 2 != 0) { phi = 0x5089; } else { @@ -78,10 +78,10 @@ u16 EnTg_GetTextId(GlobalContext* globalCtx, Actor* thisx) { } } -s16 EnTg_OnTextComplete(GlobalContext* globalCtx, Actor* thisx) { +s16 EnTg_OnTextComplete(PlayState* play, Actor* thisx) { EnTg* this = (EnTg*)thisx; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_FADING: @@ -110,34 +110,34 @@ s16 EnTg_OnTextComplete(GlobalContext* globalCtx, Actor* thisx) { } } -void EnTg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTg_Init(Actor* thisx, PlayState* play) { EnTg* this = (EnTg*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDancingCoupleSkel, &gDancingCoupleAnim, NULL, NULL, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gDancingCoupleSkel, &gDancingCoupleAnim, NULL, NULL, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->actor.targetMode = 6; Actor_SetScale(&this->actor, 0.01f); - this->nextDialogue = globalCtx->state.frames % 2; + this->nextDialogue = play->state.frames % 2; this->actionFunc = EnTg_SpinIfNotTalking; } -void EnTg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTg_Destroy(Actor* thisx, PlayState* play) { EnTg* this = (EnTg*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void EnTg_SpinIfNotTalking(EnTg* this, GlobalContext* globalCtx) { +void EnTg_SpinIfNotTalking(EnTg* this, PlayState* play) { if (!this->isTalking) { this->actor.shape.rot.y += 0x800; } } -void EnTg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTg_Update(Actor* thisx, PlayState* play) { EnTg* this = (EnTg*)thisx; s32 pad; f32 temp; @@ -147,19 +147,19 @@ void EnTg_Update(Actor* thisx, GlobalContext* globalCtx) { sp2C.y = this->actor.world.pos.y; sp2C.z = (s16)this->actor.world.pos.z + 3; this->collider.dim.pos = sp2C; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + this->actionFunc(this, play); temp = this->collider.dim.radius + 30.0f; - func_800343CC(globalCtx, &this->actor, &this->isTalking, temp, EnTg_GetTextId, EnTg_OnTextComplete); + func_800343CC(play, &this->actor, &this->isTalking, temp, EnTg_GetTextId, EnTg_OnTextComplete); } -s32 EnTg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnTg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { return false; } -void EnTg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnTg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnTg* this = (EnTg*)thisx; Vec3f targetOffset = { 0.0f, 800.0f, 0.0f }; @@ -177,19 +177,19 @@ Gfx* EnTg_SetColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { return displayList; } -void EnTg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTg_Draw(Actor* thisx, PlayState* play) { EnTg* this = (EnTg*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tg.c", 462); + OPEN_DISPS(play->state.gfxCtx, "../z_en_tg.c", 462); Matrix_Translate(0.0f, 0.0f, -560.0f, MTXMODE_APPLY); // Set the guy's shoes and shirt to royal blue - gSPSegment(POLY_OPA_DISP++, 0x08, EnTg_SetColor(globalCtx->state.gfxCtx, 0, 50, 160, 0)); + gSPSegment(POLY_OPA_DISP++, 0x08, EnTg_SetColor(play->state.gfxCtx, 0, 50, 160, 0)); // Set the girl's shirt to white - gSPSegment(POLY_OPA_DISP++, 0x09, EnTg_SetColor(globalCtx->state.gfxCtx, 255, 255, 255, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, EnTg_SetColor(play->state.gfxCtx, 255, 255, 255, 0)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTg_OverrideLimbDraw, EnTg_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tg.c", 480); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_tg.c", 480); } diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.h b/src/overlays/actors/ovl_En_Tg/z_en_tg.h index fc6ff7f496..4ba4e5034e 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.h +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.h @@ -6,7 +6,7 @@ struct EnTg; -typedef void (*EnTgActionFunc)(struct EnTg*, GlobalContext*); +typedef void (*EnTgActionFunc)(struct EnTg*, PlayState*); typedef struct EnTg { /* 0x0000 */ Actor actor; 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 40a12e6df9..6a1c7f9b6c 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -52,10 +52,10 @@ typedef enum { /* 0x2 */ TEKTITE_FLIPPED } EnTiteFlipState; -void EnTite_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTite_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTite_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTite_Init(Actor* thisx, PlayState* play); +void EnTite_Destroy(Actor* thisx, PlayState* play); +void EnTite_Update(Actor* thisx, PlayState* play); +void EnTite_Draw(Actor* thisx, PlayState* play); void EnTite_SetupIdle(EnTite* this); void EnTite_SetupTurnTowardPlayer(EnTite* this); @@ -63,16 +63,16 @@ void EnTite_SetupMoveTowardPlayer(EnTite* this); void EnTite_SetupDeathCry(EnTite* this); void EnTite_SetupFlipUpright(EnTite* this); -void EnTite_Idle(EnTite* this, GlobalContext* globalCtx); -void EnTite_Attack(EnTite* this, GlobalContext* globalCtx); -void EnTite_TurnTowardPlayer(EnTite* this, GlobalContext* globalCtx); -void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx); -void EnTite_Recoil(EnTite* this, GlobalContext* globalCtx); -void EnTite_Stunned(EnTite* this, GlobalContext* globalCtx); -void EnTite_DeathCry(EnTite* this, GlobalContext* globalCtx); -void EnTite_FallApart(EnTite* this, GlobalContext* globalCtx); -void EnTite_FlipOnBack(EnTite* this, GlobalContext* globalCtx); -void EnTite_FlipUpright(EnTite* this, GlobalContext* globalCtx); +void EnTite_Idle(EnTite* this, PlayState* play); +void EnTite_Attack(EnTite* this, PlayState* play); +void EnTite_TurnTowardPlayer(EnTite* this, PlayState* play); +void EnTite_MoveTowardPlayer(EnTite* this, PlayState* play); +void EnTite_Recoil(EnTite* this, PlayState* play); +void EnTite_Stunned(EnTite* this, PlayState* play); +void EnTite_DeathCry(EnTite* this, PlayState* play); +void EnTite_FallApart(EnTite* this, PlayState* play); +void EnTite_FlipOnBack(EnTite* this, PlayState* play); +void EnTite_FlipUpright(EnTite* this, PlayState* play); const ActorInit En_Tite_InitVars = { ACTOR_EN_TITE, @@ -173,13 +173,13 @@ void EnTite_SetupAction(EnTite* this, EnTiteActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnTite_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Init(Actor* thisx, PlayState* play) { EnTite* this = (EnTite*)thisx; Actor_ProcessInitChain(thisx, sInitChain); thisx->targetMode = 3; Actor_SetScale(thisx, 0.01f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_tite_Skel_003A20, &object_tite_Anim_0012E4, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_tite_Skel_003A20, &object_tite_Anim_0012E4, this->jointTable, this->morphTable, 25); ActorShape_Init(&thisx->shape, -200.0f, ActorShadow_DrawCircle, 70.0f); this->flipState = TEKTITE_INITIAL; @@ -190,8 +190,8 @@ void EnTite_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->focus.pos.y += 20.0f; thisx->colChkInfo.health = 2; thisx->colChkInfo.mass = MASS_HEAVY; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, thisx, &sJntSphInit, &this->colliderItem); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, &this->colliderItem); this->unk_2DC = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4; if (this->actor.params == TEKTITE_BLUE) { this->unk_2DC |= UPDBGCHECKINFO_FLAG_6; // Don't use the actor engine's ripple spawning code @@ -201,7 +201,7 @@ void EnTite_Init(Actor* thisx, GlobalContext* globalCtx) { EnTite_SetupIdle(this); } -void EnTite_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Destroy(Actor* thisx, PlayState* play) { EnTite* this = (EnTite*)thisx; EnEncount1* spawner; @@ -215,7 +215,7 @@ void EnTite_Destroy(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 同時発生数 ☆☆☆☆☆%d\n" VT_RST, spawner->curNumSpawn); osSyncPrintf("\n\n"); } - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnTite_SetupIdle(EnTite* this) { @@ -226,7 +226,7 @@ void EnTite_SetupIdle(EnTite* this) { EnTite_SetupAction(this, EnTite_Idle); } -void EnTite_Idle(EnTite* this, GlobalContext* globalCtx) { +void EnTite_Idle(EnTite* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); if (this->actor.params == TEKTITE_BLUE) { @@ -262,7 +262,7 @@ void EnTite_SetupAttack(EnTite* this) { EnTite_SetupAction(this, EnTite_Attack); } -void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { +void EnTite_Attack(EnTite* this, PlayState* play) { s16 angleToPlayer; s32 attackState; Vec3f ripplePos; @@ -308,7 +308,7 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { this->vAttackState++; // TEKTITE_SUBMERGED this->actor.velocity.y *= 0.75f; attackState = this->vAttackState; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 0, 500, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 0, 500, 0); } else { this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; @@ -358,16 +358,16 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { // Generate sparkles at feet upon landing, set jumping animation and hurtbox and check if hit player if (this->actor.velocity.y >= 5.0f) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_800355B8(globalCtx, &this->frontLeftFootPos); - func_800355B8(globalCtx, &this->frontRightFootPos); - func_800355B8(globalCtx, &this->backRightFootPos); - func_800355B8(globalCtx, &this->backLeftFootPos); + func_800355B8(play, &this->frontLeftFootPos); + func_800355B8(play, &this->frontRightFootPos); + func_800355B8(play, &this->backRightFootPos); + func_800355B8(play, &this->backLeftFootPos); } } if (!(this->collider.base.atFlags & AT_HIT) && (this->actor.flags & ACTOR_FLAG_6)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->collider.base.atFlags &= ~AT_HIT; Animation_MorphToLoop(&this->skelAnime, &object_tite_Anim_0012E4, 4.0f); this->actor.speedXZ = -6.0f; @@ -395,10 +395,10 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { // Create ripples on water surface where tektite feet landed if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { - func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); } } // if landed, kill XZ speed and play appropriate sounds @@ -434,7 +434,7 @@ void EnTite_SetupTurnTowardPlayer(EnTite* this) { EnTite_SetupAction(this, EnTite_TurnTowardPlayer); } -void EnTite_TurnTowardPlayer(EnTite* this, GlobalContext* globalCtx) { +void EnTite_TurnTowardPlayer(EnTite* this, PlayState* play) { s16 angleToPlayer; s16 turnVelocity; @@ -449,7 +449,7 @@ void EnTite_TurnTowardPlayer(EnTite* this, GlobalContext* globalCtx) { if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { this->actor.world.pos.y += this->actor.yDistToWater; } - angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if (angleToPlayer > 0) { turnVelocity = (angleToPlayer / 42.0f) + 10.0f; this->actor.world.rot.y += (turnVelocity * 2); @@ -506,16 +506,16 @@ void EnTite_SetupMoveTowardPlayer(EnTite* this) { /** * Jumping toward player as a method of travel (different from attacking, has no hitbox) */ -void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { +void EnTite_MoveTowardPlayer(EnTite* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.1f, 1.0f, 0.0f); SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WATER_TOUCH)) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { - func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_LAND_WATER); @@ -549,7 +549,7 @@ void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { ripplePos.y += this->actor.yDistToWater; this->actor.gravity = 0.0f; this->actor.velocity.y *= 0.75f; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 0, 500, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 0, 500, 0); return; } else { // If submerged, float to surface @@ -597,10 +597,10 @@ void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 1000, 0); if (this->actor.velocity.y >= 6.0f) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_800355B8(globalCtx, &this->frontLeftFootPos); - func_800355B8(globalCtx, &this->frontRightFootPos); - func_800355B8(globalCtx, &this->backRightFootPos); - func_800355B8(globalCtx, &this->backLeftFootPos); + func_800355B8(play, &this->frontLeftFootPos); + func_800355B8(play, &this->frontRightFootPos); + func_800355B8(play, &this->backRightFootPos); + func_800355B8(play, &this->backLeftFootPos); } } } @@ -618,7 +618,7 @@ void EnTite_SetupRecoil(EnTite* this) { /** * After tektite hits or gets hit, recoils backwards and slides a bit upon landing */ -void EnTite_Recoil(EnTite* this, GlobalContext* globalCtx) { +void EnTite_Recoil(EnTite* this, PlayState* play) { s16 angleToPlayer; // Snap to ground or water surface upon landing @@ -640,10 +640,10 @@ void EnTite_Recoil(EnTite* this, GlobalContext* globalCtx) { // play sound and generate ripples if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WATER_TOUCH)) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { - func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } else { this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; @@ -689,7 +689,7 @@ void EnTite_SetupStunned(EnTite* this) { /** * stunned or frozen */ -void EnTite_Stunned(EnTite* this, GlobalContext* globalCtx) { +void EnTite_Stunned(EnTite* this, PlayState* play) { s16 angleToPlayer; Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); @@ -710,10 +710,10 @@ void EnTite_Stunned(EnTite* this, GlobalContext* globalCtx) { // Play sounds and spawn dirt effects upon landing if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WATER_TOUCH)) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { - func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } else { this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; @@ -755,23 +755,23 @@ void EnTite_SetupDeathCry(EnTite* this) { /** * First frame of death. Scream in pain and allocate memory for EnPart data */ -void EnTite_DeathCry(EnTite* this, GlobalContext* globalCtx) { - EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_TEKU_DEAD, true, +void EnTite_DeathCry(EnTite* this, PlayState* play) { + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_TEKU_DEAD, true, DEADSOUND_REPEAT_MODE_OFF, 40); this->action = TEKTITE_FALL_APART; EnTite_SetupAction(this, EnTite_FallApart); - BodyBreak_Alloc(&this->bodyBreak, 24, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 24, play); } /** * Spawn EnPart and drop items */ -void EnTite_FallApart(EnTite* this, GlobalContext* globalCtx) { - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params + 0xB)) { +void EnTite_FallApart(EnTite* this, PlayState* play) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, this->actor.params + 0xB)) { if (this->actor.params == TEKTITE_BLUE) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x40); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x40); } Actor_Kill(&this->actor); } @@ -793,7 +793,7 @@ void EnTite_SetupFlipOnBack(EnTite* this) { /** * During the flip animation and also while idling on back */ -void EnTite_FlipOnBack(EnTite* this, GlobalContext* globalCtx) { +void EnTite_FlipOnBack(EnTite* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0x7FFF, 1, 4000, 0); // randomly reset the leg wiggling animation whenever timer reaches 0 to give illusion of twitching legs this->vLegTwitchTimer--; @@ -805,7 +805,7 @@ void EnTite_FlipOnBack(EnTite* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { // Upon landing, spawn dust and make noise if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 11, 4.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 11, 4.0f, 0, 0, false); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } this->vOnBackTimer--; @@ -829,15 +829,15 @@ void EnTite_SetupFlipUpright(EnTite* this) { EnTite_SetupAction(this, EnTite_FlipUpright); } -void EnTite_FlipUpright(EnTite* this, GlobalContext* globalCtx) { +void EnTite_FlipUpright(EnTite* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 0xFA0, 0); SkelAnime_Update(&this->skelAnime); //! @bug flying tektite: the following condition is never met and tektite stays stuck in this action forever if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { - func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); - func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); + func_80033480(play, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); this->actor.shape.yOffset = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); @@ -845,7 +845,7 @@ void EnTite_FlipUpright(EnTite* this, GlobalContext* globalCtx) { } } -void EnTite_CheckDamage(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_CheckDamage(Actor* thisx, PlayState* play) { EnTite* this = (EnTite*)thisx; if ((this->collider.base.acFlags & AC_HIT) && (this->action >= TEKTITE_IDLE)) { @@ -880,8 +880,8 @@ void EnTite_CheckDamage(Actor* thisx, GlobalContext* globalCtx) { } } // If hammer has recently hit the floor and player is close to tektite, flip over - } else if ((thisx->colChkInfo.health != 0) && (globalCtx->actorCtx.unk_02 != 0) && - (thisx->xzDistToPlayer <= 400.0f) && (thisx->bgCheckFlags & BGCHECKFLAG_GROUND)) { + } else if ((thisx->colChkInfo.health != 0) && (play->actorCtx.unk_02 != 0) && (thisx->xzDistToPlayer <= 400.0f) && + (thisx->bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->flipState == TEKTITE_FLIPPED) { EnTite_SetupFlipUpright(this); } else if ((this->action >= TEKTITE_IDLE) || (this->action >= TEKTITE_IDLE)) { @@ -891,49 +891,49 @@ void EnTite_CheckDamage(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTite_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Update(Actor* thisx, PlayState* play) { EnTite* this = (EnTite*)thisx; char pad[0x4]; CollisionPoly* floorPoly; WaterBox* waterBox; f32 waterSurfaceY; - EnTite_CheckDamage(thisx, globalCtx); + EnTite_CheckDamage(thisx, play); // Stay still if hit by immunity damage type this frame if (thisx->colChkInfo.damageEffect != 0xE) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 25.0f, 40.0f, 20.0f, this->unk_2DC); + Actor_UpdateBgCheckInfo(play, thisx, 25.0f, 40.0f, 20.0f, this->unk_2DC); // If on water, snap feet to surface and spawn ripples if ((this->actor.params == TEKTITE_BLUE) && (thisx->bgCheckFlags & BGCHECKFLAG_WATER)) { floorPoly = thisx->floorPoly; - if ((((globalCtx->gameplayFrames % 8) == 0) || (thisx->velocity.y < 0.0f)) && - (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->backRightFootPos.x, - this->backRightFootPos.z, &waterSurfaceY, &waterBox)) && + if ((((play->gameplayFrames % 8) == 0) || (thisx->velocity.y < 0.0f)) && + (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->backRightFootPos.x, this->backRightFootPos.z, + &waterSurfaceY, &waterBox)) && (this->backRightFootPos.y <= waterSurfaceY)) { this->backRightFootPos.y = waterSurfaceY; - EffectSsGRipple_Spawn(globalCtx, &this->backRightFootPos, 0, 220, 0); + EffectSsGRipple_Spawn(play, &this->backRightFootPos, 0, 220, 0); } - if (((((globalCtx->gameplayFrames + 2) % 8) == 0) || (thisx->velocity.y < 0.0f)) && - (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->backLeftFootPos.x, - this->backLeftFootPos.z, &waterSurfaceY, &waterBox)) && + if (((((play->gameplayFrames + 2) % 8) == 0) || (thisx->velocity.y < 0.0f)) && + (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->backLeftFootPos.x, this->backLeftFootPos.z, + &waterSurfaceY, &waterBox)) && (this->backLeftFootPos.y <= waterSurfaceY)) { this->backLeftFootPos.y = waterSurfaceY; - EffectSsGRipple_Spawn(globalCtx, &this->backLeftFootPos, 0, 220, 0); + EffectSsGRipple_Spawn(play, &this->backLeftFootPos, 0, 220, 0); } - if (((((globalCtx->gameplayFrames + 4) % 8) == 0) || (thisx->velocity.y < 0.0f)) && - (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->frontLeftFootPos.x, - this->frontLeftFootPos.z, &waterSurfaceY, &waterBox)) && + if (((((play->gameplayFrames + 4) % 8) == 0) || (thisx->velocity.y < 0.0f)) && + (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->frontLeftFootPos.x, this->frontLeftFootPos.z, + &waterSurfaceY, &waterBox)) && (this->frontLeftFootPos.y <= waterSurfaceY)) { this->frontLeftFootPos.y = waterSurfaceY; - EffectSsGRipple_Spawn(globalCtx, &this->frontLeftFootPos, 0, 220, 0); + EffectSsGRipple_Spawn(play, &this->frontLeftFootPos, 0, 220, 0); } - if (((((globalCtx->gameplayFrames + 1) % 8) == 0) || (thisx->velocity.y < 0.0f)) && - (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->frontRightFootPos.x, - this->frontRightFootPos.z, &waterSurfaceY, &waterBox)) && + if (((((play->gameplayFrames + 1) % 8) == 0) || (thisx->velocity.y < 0.0f)) && + (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->frontRightFootPos.x, this->frontRightFootPos.z, + &waterSurfaceY, &waterBox)) && (this->frontRightFootPos.y <= waterSurfaceY)) { this->frontRightFootPos.y = waterSurfaceY; - EffectSsGRipple_Spawn(globalCtx, &this->frontRightFootPos, 0, 220, 0); + EffectSsGRipple_Spawn(play, &this->frontRightFootPos, 0, 220, 0); } thisx->floorPoly = floorPoly; } @@ -958,11 +958,11 @@ void EnTite_Update(Actor* thisx, GlobalContext* globalCtx) { thisx->focus.pos = thisx->world.pos; thisx->focus.pos.y += 20.0f; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnTite_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** limbDList, Vec3s* rot, void* thisx) { +void EnTite_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** limbDList, Vec3s* rot, void* thisx) { EnTite* this = (EnTite*)thisx; switch (limbIndex) { @@ -983,11 +983,11 @@ void EnTite_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** limbDLis BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 24, 24, limbDList, BODYBREAK_OBJECT_DEFAULT); } -void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Draw(Actor* thisx, PlayState* play) { EnTite* this = (EnTite*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tite.c", 1704); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_tite.c", 1704); + func_80093D18(play->state.gfxCtx); Collider_UpdateSpheres(0, &this->collider); if (this->actor.params == TEKTITE_BLUE) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(object_tite_Tex_001300)); @@ -998,9 +998,8 @@ void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(object_tite_Tex_001F00)); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(object_tite_Tex_002100)); } - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnTite_PostLimbDraw, - thisx); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tite.c", 1735); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnTite_PostLimbDraw, thisx); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_tite.c", 1735); if (this->spawnIceTimer != 0) { // Spawn chunks of ice all over the tektite's body @@ -1013,7 +1012,7 @@ void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx) { iceChunk.x = thisx->world.pos.x + sIceChunks[idx].x; iceChunk.y = thisx->world.pos.y + sIceChunks[idx].y; iceChunk.z = thisx->world.pos.z + sIceChunks[idx].z; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &iceChunk, 150, 150, 150, 250, 235, 245, 255, 1.0f); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &iceChunk, 150, 150, 150, 250, 235, 245, 255, 1.0f); } } } diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.h b/src/overlays/actors/ovl_En_Tite/z_en_tite.h index 308d0b4c31..2faaadf9cb 100755 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.h +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.h @@ -6,7 +6,7 @@ struct EnTite; -typedef void (*EnTiteActionFunc)(struct EnTite*, GlobalContext*); +typedef void (*EnTiteActionFunc)(struct EnTite*, PlayState*); typedef enum { /* -2 */ TEKTITE_BLUE = -2, diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 4e5388e621..2876858d57 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -10,15 +10,15 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnTk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTk_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTk_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTk_Init(Actor* thisx, PlayState* play); +void EnTk_Destroy(Actor* thisx, PlayState* play); +void EnTk_Update(Actor* thisx, PlayState* play); +void EnTk_Draw(Actor* thisx, PlayState* play); -s32 EnTk_CheckNextSpot(EnTk* this, GlobalContext* globalCtx); -void EnTk_Rest(EnTk* this, GlobalContext* globalCtx); -void EnTk_Walk(EnTk* this, GlobalContext* globalCtx); -void EnTk_Dig(EnTk* this, GlobalContext* globalCtx); +s32 EnTk_CheckNextSpot(EnTk* this, PlayState* play); +void EnTk_Rest(EnTk* this, PlayState* play); +void EnTk_Walk(EnTk* this, PlayState* play); +void EnTk_Dig(EnTk* this, PlayState* play); const ActorInit En_Tk_InitVars = { ACTOR_EN_TK, @@ -76,7 +76,7 @@ void EnTkEff_Update(EnTk* this) { } } -void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { +void EnTkEff_Draw(EnTk* this, PlayState* play) { static void* dustTextures[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; @@ -87,11 +87,11 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { s16 alpha; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 114); + OPEN_DISPS(play->state.gfxCtx, "../z_en_tk_eff.c", 114); gfxSetup = 0; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (1) {} @@ -109,9 +109,9 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(eff->size, eff->size, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 140), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_tk_eff.c", 140), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); imageIdx = eff->timeLeft * ((f32)ARRAY_COUNT(dustTextures) / eff->timeTotal); @@ -122,7 +122,7 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { eff++; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 154); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_tk_eff.c", 154); } s32 EnTkEff_CreateDflt(EnTk* this, Vec3f* pos, u8 duration, f32 size, f32 growth, f32 yAccelMax) { @@ -160,7 +160,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -void EnTk_RestAnim(EnTk* this, GlobalContext* globalCtx) { +void EnTk_RestAnim(EnTk* this, PlayState* play) { AnimationHeader* anim = &gDampeRestAnim; Animation_Change(&this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(&gDampeRestAnim), ANIMMODE_LOOP, @@ -170,7 +170,7 @@ void EnTk_RestAnim(EnTk* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; } -void EnTk_WalkAnim(EnTk* this, GlobalContext* globalCtx) { +void EnTk_WalkAnim(EnTk* this, PlayState* play) { AnimationHeader* anim = &gDampeWalkAnim; Animation_Change(&this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(&gDampeRestAnim), ANIMMODE_LOOP, @@ -179,12 +179,12 @@ void EnTk_WalkAnim(EnTk* this, GlobalContext* globalCtx) { this->actionCountdown = Rand_S16Offset(240, 240); } -void EnTk_DigAnim(EnTk* this, GlobalContext* globalCtx) { +void EnTk_DigAnim(EnTk* this, PlayState* play) { AnimationHeader* anim = &gDampeDigAnim; Animation_Change(&this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(&gDampeDigAnim), ANIMMODE_LOOP, -10.0f); - if (EnTk_CheckNextSpot(this, globalCtx) >= 0) { + if (EnTk_CheckNextSpot(this, play) >= 0) { this->validDigHere = 1; } } @@ -226,12 +226,12 @@ s32 EnTk_CheckFacingPlayer(EnTk* this) { } } -s32 EnTk_CheckNextSpot(EnTk* this, GlobalContext* globalCtx) { +s32 EnTk_CheckNextSpot(EnTk* this, PlayState* play) { Actor* prop; f32 dxz; f32 dy; - prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + prop = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (prop != NULL) { if (prop->id != ACTOR_EN_IT) { @@ -271,7 +271,7 @@ void EnTk_CheckCurrentSpot(EnTk* this) { } } -f32 EnTk_Step(EnTk* this, GlobalContext* globalCtx) { +f32 EnTk_Step(EnTk* this, PlayState* play) { f32 stepFrames[] = { 36.0f, 10.0f }; f32 a1_; s32 i; @@ -298,7 +298,7 @@ f32 EnTk_Step(EnTk* this, GlobalContext* globalCtx) { } } -s32 EnTk_Orient(EnTk* this, GlobalContext* globalCtx) { +s32 EnTk_Orient(EnTk* this, PlayState* play) { Path* path; Vec3s* point; f32 dx; @@ -308,7 +308,7 @@ s32 EnTk_Orient(EnTk* this, GlobalContext* globalCtx) { return 1; } - path = &globalCtx->setupPathList[0]; + path = &play->setupPathList[0]; point = SEGMENTED_TO_VIRTUAL(path->points); point += this->currentWaypoint; @@ -330,10 +330,10 @@ s32 EnTk_Orient(EnTk* this, GlobalContext* globalCtx) { } } -u16 func_80B1C54C(GlobalContext* globalCtx, Actor* thisx) { +u16 func_80B1C54C(PlayState* play, Actor* thisx) { u16 ret; - ret = Text_GetFaceReaction(globalCtx, 14); + ret = Text_GetFaceReaction(play, 14); if (ret != 0) { return ret; } @@ -347,10 +347,10 @@ u16 func_80B1C54C(GlobalContext* globalCtx, Actor* thisx) { } } -s16 func_80B1C5A0(GlobalContext* globalCtx, Actor* thisx) { +s16 func_80B1C5A0(PlayState* play, Actor* thisx) { s32 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: break; @@ -364,26 +364,26 @@ s16 func_80B1C5A0(GlobalContext* globalCtx, Actor* thisx) { case TEXT_STATE_DONE_FADING: break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx) && (thisx->textId == 0x5018 || thisx->textId == 0x5019)) { - if (globalCtx->msgCtx.choiceIndex == 1) { + if (Message_ShouldAdvance(play) && (thisx->textId == 0x5018 || thisx->textId == 0x5019)) { + if (play->msgCtx.choiceIndex == 1) { /* "Thanks a lot!" */ thisx->textId = 0x0084; } else if (gSaveContext.rupees < 10) { /* "You don't have enough Rupees!" */ thisx->textId = 0x0085; } else { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; Rupees_ChangeBy(-10); SET_INFTABLE(INFTABLE_D9); return 2; } - Message_ContinueTextbox(globalCtx, thisx->textId); + Message_ContinueTextbox(play, thisx->textId); SET_INFTABLE(INFTABLE_D9); } break; case TEXT_STATE_EVENT: - if (Message_ShouldAdvance(globalCtx) && (thisx->textId == 0x0084 || thisx->textId == 0x0085)) { - Message_CloseTextbox(globalCtx); + if (Message_ShouldAdvance(play) && (thisx->textId == 0x0084 || thisx->textId == 0x0085)) { + Message_CloseTextbox(play); ret = 0; } break; @@ -476,23 +476,23 @@ void EnTk_DigEff(EnTk* this) { } } -void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Init(Actor* thisx, PlayState* play) { EnTk* this = (EnTk*)thisx; s32 pad; ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDampeSkel, NULL, this->jointTable, this->morphTable, 18); + SkelAnime_InitFlex(play, &this->skelAnime, &gDampeSkel, NULL, this->jointTable, this->morphTable, 18); Animation_Change(&this->skelAnime, &gDampeRestAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gDampeRestAnim), ANIMMODE_LOOP, 0.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (gSaveContext.dayTime <= CLOCK_TIME(18, 0) || gSaveContext.dayTime >= CLOCK_TIME(21, 0) || !!LINK_IS_ADULT || - globalCtx->sceneNum != SCENE_SPOT02) { + play->sceneNum != SCENE_SPOT02) { Actor_Kill(&this->actor); return; } @@ -506,13 +506,13 @@ void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnTk_Rest; } -void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Destroy(Actor* thisx, PlayState* play) { EnTk* this = (EnTk*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { +void EnTk_Rest(EnTk* this, PlayState* play) { s16 v1; s16 a1_; @@ -522,13 +522,13 @@ void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { v1 = this->actor.yawTowardsPlayer - v1; if (this->h_1E0 == 2) { - EnTk_DigAnim(this, globalCtx); + EnTk_DigAnim(this, play); this->h_1E0 = 0; this->actionFunc = EnTk_Dig; return; } - func_800343CC(globalCtx, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.0f, func_80B1C54C, + func_800343CC(play, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.0f, func_80B1C54C, func_80B1C5A0); } else if (EnTk_CheckFacingPlayer(this)) { v1 = this->actor.shape.rot.y; @@ -536,9 +536,9 @@ void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { v1 = this->actor.yawTowardsPlayer - v1; this->actionCountdown = 0; - func_800343CC(globalCtx, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.0f, func_80B1C54C, + func_800343CC(play, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.0f, func_80B1C54C, func_80B1C5A0); - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { v1 = this->actor.shape.rot.y; v1 -= this->h_21E; v1 = this->actor.yawTowardsPlayer - v1; @@ -546,7 +546,7 @@ void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { this->actionCountdown = 0; this->h_1E0 = 1; } else if (DECR(this->actionCountdown) == 0) { - EnTk_WalkAnim(this, globalCtx); + EnTk_WalkAnim(this, play); this->actionFunc = EnTk_Walk; /*! @bug v1 is uninitialized past this branch */ @@ -558,26 +558,26 @@ void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->headRot, a1_, 6, 1000, 1); } -void EnTk_Walk(EnTk* this, GlobalContext* globalCtx) { +void EnTk_Walk(EnTk* this, PlayState* play) { if (this->h_1E0 == 2) { - EnTk_DigAnim(this, globalCtx); + EnTk_DigAnim(this, play); this->h_1E0 = 0; this->actionFunc = EnTk_Dig; } else { - this->actor.speedXZ = EnTk_Step(this, globalCtx); - EnTk_Orient(this, globalCtx); + this->actor.speedXZ = EnTk_Step(this, play); + EnTk_Orient(this, play); Math_SmoothStepToS(&this->headRot, 0, 6, 1000, 1); EnTk_CheckCurrentSpot(this); DECR(this->actionCountdown); if (EnTk_CheckFacingPlayer(this) || this->actionCountdown == 0) { - EnTk_RestAnim(this, globalCtx); + EnTk_RestAnim(this, play); this->actionFunc = EnTk_Rest; } } } -void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { +void EnTk_Dig(EnTk* this, PlayState* play) { Vec3f rewardOrigin; Vec3f rewardPos; s32 rewardParams[] = { @@ -616,7 +616,7 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { } } - Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]); + Item_DropCollectible(play, &rewardPos, rewardParams[this->currentReward]); } } @@ -639,12 +639,12 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (this->currentReward < 0) { /* "Nope, nothing here!" */ - Message_StartTextbox(globalCtx, 0x501A, NULL); + Message_StartTextbox(play, 0x501A, NULL); } else { - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } - EnTk_RestAnim(this, globalCtx); + EnTk_RestAnim(this, play); this->currentReward = -1; this->validDigHere = 0; @@ -652,35 +652,35 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { } } -void EnTk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Update(Actor* thisx, PlayState* play) { EnTk* this = (EnTk*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); EnTkEff_Update(this); EnTk_UpdateEyes(this); } -void func_80B1D200(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tk.c", 1188); +void func_80B1D200(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_en_tk.c", 1188); gSPDisplayList(POLY_OPA_DISP++, gDampeShovelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tk.c", 1190); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_tk.c", 1190); } -s32 EnTk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnTk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnTk* this = (EnTk*)thisx; switch (limbIndex) { @@ -698,7 +698,7 @@ s32 EnTk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnTk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnTk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnTk* this = (EnTk*)thisx; Vec3f sp28 = { 0.0f, 0.0f, 4600.0f }; Vec3f sp1C = { 0.0f, 0.0f, 0.0f }; @@ -711,11 +711,11 @@ void EnTk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec /* Limb 14 - Neck */ if (limbIndex == 14) { Matrix_MultVec3f(&sp28, &this->v3f_304); - func_80B1D200(globalCtx); + func_80B1D200(play); } } -void EnTk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Draw(Actor* thisx, PlayState* play) { static void* sEyesSegments[] = { gDampeEyeOpenTex, gDampeEyeHalfTex, @@ -724,17 +724,17 @@ void EnTk_Draw(Actor* thisx, GlobalContext* globalCtx) { EnTk* this = (EnTk*)thisx; Matrix_Push(); - EnTkEff_Draw(this, globalCtx); + EnTkEff_Draw(this, play); Matrix_Pop(); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tk.c", 1294); + OPEN_DISPS(play->state.gfxCtx, "../z_en_tk.c", 1294); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->eyeTextureIdx])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTk_OverrideLimbDraw, EnTk_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tk.c", 1312); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_tk.c", 1312); } diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/src/overlays/actors/ovl_En_Tk/z_en_tk.h index cf871ce3b4..b9e38cab5a 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -21,7 +21,7 @@ typedef struct EnTkEff { struct EnTk; -typedef void (*EnTkActionFunc)(struct EnTk*, GlobalContext*); +typedef void (*EnTkActionFunc)(struct EnTk*, PlayState*); typedef struct EnTk { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Torch/z_en_torch.c b/src/overlays/actors/ovl_En_Torch/z_en_torch.c index 8b64418afc..3461d67fe8 100644 --- a/src/overlays/actors/ovl_En_Torch/z_en_torch.c +++ b/src/overlays/actors/ovl_En_Torch/z_en_torch.c @@ -8,7 +8,7 @@ #define FLAGS 0 -void EnTorch_Init(Actor* thisx, GlobalContext* globalCtx); +void EnTorch_Init(Actor* thisx, PlayState* play); const ActorInit En_Torch_InitVars = { ACTOR_EN_TORCH, @@ -26,13 +26,13 @@ static u8 sChestContents[] = { GI_RUPEE_BLUE, GI_RUPEE_RED, GI_RUPEE_GOLD, GI_BOMBS_20, GI_BOMBS_1, GI_BOMBS_1, GI_BOMBS_1, GI_BOMBS_1, }; -void EnTorch_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTorch_Init(Actor* thisx, PlayState* play) { EnTorch* this = (EnTorch*)thisx; s8 returnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data; /* Spawn chest with desired contents. Contents are passed to en_torch from grotto params via Save Context. */ - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOX, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOX, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, (sChestContents[(returnData >> 0x5) & 0x7] << 0x5) | 0x5000 | (returnData & 0x1F)); diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 6653e93a3e..0cd1bb50b7 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -16,10 +16,10 @@ typedef enum { /* 3 */ ENTORCH2_DAMAGE } EnTorch2ActionStates; -void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTorch2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTorch2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTorch2_Init(Actor* thisx, PlayState* play); +void EnTorch2_Destroy(Actor* thisx, PlayState* play); +void EnTorch2_Update(Actor* thisx, PlayState* play); +void EnTorch2_Draw(Actor* thisx, PlayState* play); const ActorInit En_Torch2_InitVars = { ACTOR_EN_TORCH2, @@ -89,8 +89,8 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTorch2_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Player* this = (Player*)thisx; sInput.cur.button = sInput.press.button = sInput.rel.button = 0; @@ -98,7 +98,7 @@ void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx2) { this->currentShield = PLAYER_SHIELD_HYLIAN; this->heldItemActionParam = this->heldItemId = PLAYER_AP_SWORD_MASTER; Player_SetModelGroup(this, PLAYER_MODELGROUP_SWORD); - globalCtx->playerInit(this, globalCtx, &gDarkLinkSkel); + play->playerInit(this, play, &gDarkLinkSkel); this->actor.naviEnemyId = NAVI_ENEMY_DARK_LINK; this->cylinder.base.acFlags = AC_ON | AC_TYPE_PLAYER; this->meleeWeaponQuads[0].base.atFlags = this->meleeWeaponQuads[1].base.atFlags = AT_ON | AT_TYPE_ENEMY; @@ -112,7 +112,7 @@ void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.colChkInfo.health = gSaveContext.healthCapacity >> 3; this->actor.colChkInfo.cylRadius = 60; this->actor.colChkInfo.cylHeight = 100; - globalCtx->func_11D54(this, globalCtx); + play->func_11D54(this, play); sActionState = ENTORCH2_WAIT; sDodgeRollState = 0; @@ -126,32 +126,32 @@ void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx2) { sSpawnPoint = this->actor.home.pos; } -void EnTorch2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTorch2_Destroy(Actor* thisx, PlayState* play) { s32 pad; Player* this = (Player*)thisx; - Effect_Delete(globalCtx, this->meleeWeaponEffectIndex); + Effect_Delete(play, this->meleeWeaponEffectIndex); func_800F5B58(); - Collider_DestroyCylinder(globalCtx, &this->cylinder); - Collider_DestroyQuad(globalCtx, &this->meleeWeaponQuads[0]); - Collider_DestroyQuad(globalCtx, &this->meleeWeaponQuads[1]); - Collider_DestroyQuad(globalCtx, &this->shieldQuad); + Collider_DestroyCylinder(play, &this->cylinder); + Collider_DestroyQuad(play, &this->meleeWeaponQuads[0]); + Collider_DestroyQuad(play, &this->meleeWeaponQuads[1]); + Collider_DestroyQuad(play, &this->shieldQuad); } -Actor* EnTorch2_GetAttackItem(GlobalContext* globalCtx, Player* this) { - Actor* rangedItem = Actor_GetProjectileActor(globalCtx, &this->actor, 4000.0f); +Actor* EnTorch2_GetAttackItem(PlayState* play, Player* this) { + Actor* rangedItem = Actor_GetProjectileActor(play, &this->actor, 4000.0f); if (rangedItem != NULL) { return rangedItem; } else { - return func_80033684(globalCtx, &this->actor); + return func_80033684(play, &this->actor); } } -s32 EnTorch2_SwingSword(GlobalContext* globalCtx, Input* input, Player* this) { +s32 EnTorch2_SwingSword(PlayState* play, Input* input, Player* this) { f32 noAttackChance = 0.0f; s32 attackDelay = 7; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->linearVelocity < 0.0f) || (player->linearVelocity < 0.0f)) { return 0; @@ -163,8 +163,7 @@ s32 EnTorch2_SwingSword(GlobalContext* globalCtx, Input* input, Player* this) { if (sAlpha != 255) { noAttackChance += 2.0f; } - if ((((globalCtx->gameplayFrames & attackDelay) == 0) || (sSwordJumpState != 0)) && - (noAttackChance <= Rand_ZeroOne())) { + if ((((play->gameplayFrames & attackDelay) == 0) || (sSwordJumpState != 0)) && (noAttackChance <= Rand_ZeroOne())) { if (sSwordJumpState == 0) { switch ((s32)(Rand_ZeroOne() * 7.0f)) { case 1: @@ -195,9 +194,9 @@ void EnTorch2_Backflip(Player* this, Input* input, Actor* thisx) { sCounterState = 0; } -void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; - Player* player2 = GET_PLAYER(globalCtx2); +void EnTorch2_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + Player* player2 = GET_PLAYER(play2); Player* player = player2; Player* this = (Player*)thisx; Input* input = &sInput; @@ -215,8 +214,8 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { sp5A = player->actor.shape.rot.y - this->actor.shape.rot.y; input->cur.button = 0; - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); - attackItem = EnTorch2_GetAttackItem(globalCtx, this); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); + attackItem = EnTorch2_GetAttackItem(play, this); switch (sActionState) { case ENTORCH2_WAIT: this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -224,7 +223,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->skelAnime.playSpeed = 0.0f; this->actor.world.pos.x = (Math_SinS(this->actor.world.rot.y) * 25.0f) + sSpawnPoint.x; this->actor.world.pos.z = (Math_CosS(this->actor.world.rot.y) * 25.0f) + sSpawnPoint.z; - if ((this->actor.xzDistToPlayer <= 120.0f) || Actor_IsTargeted(globalCtx, &this->actor) || + if ((this->actor.xzDistToPlayer <= 120.0f) || Actor_IsTargeted(play, &this->actor) || (attackItem != NULL)) { if (attackItem != NULL) { sDodgeRollState = 1; @@ -273,8 +272,8 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { } } if ((sCounterState != 0) && (this->meleeWeaponState != 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->meleeWeaponQuads[0].base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->meleeWeaponQuads[1].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->meleeWeaponQuads[0].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->meleeWeaponQuads[1].base); } // Ignores hits when jumping on Link's sword @@ -300,7 +299,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START)) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - if (globalCtx->gameplayFrames % 2) { + if (play->gameplayFrames % 2) { sStickAngle = this->actor.yawTowardsPlayer + 0x4000; } else { sStickAngle = this->actor.yawTowardsPlayer - 0x4000; @@ -336,7 +335,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.flags |= ACTOR_FLAG_0; } else if (sSwordJumpState == 1) { if (sSwordJumpTimer < 16) { - EnTorch2_SwingSword(globalCtx, input, this); + EnTorch2_SwingSword(play, input, this); sSwordJumpState++; } else if (sSwordJumpTimer == 19) { func_800F4190(&this->actor.projectedPos, NA_SE_VO_LI_AUTO_JUMP); @@ -351,7 +350,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { // Handles Dark Link's reaction to sword attack other than jumpslashes - if (func_800354B4(globalCtx, &this->actor, 120.0f, 0x7FFF, 0x7FFF, this->actor.world.rot.y)) { + if (func_800354B4(play, &this->actor, 120.0f, 0x7FFF, 0x7FFF, this->actor.world.rot.y)) { if ((player->meleeWeaponAnimation == PLAYER_MWA_STAB_1H) && (this->actor.xzDistToPlayer < 90.0f)) { @@ -361,7 +360,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((this->meleeWeaponState == 0) && (sCounterState == 0) && (player->invincibilityTimer == 0) && (player->meleeWeaponAnimation == PLAYER_MWA_STAB_1H) && - (this->actor.xzDistToPlayer <= 85.0f) && Actor_IsTargeted(globalCtx, &this->actor)) { + (this->actor.xzDistToPlayer <= 85.0f) && Actor_IsTargeted(play, &this->actor)) { sStickTilt = 0.0f; sSwordJumpState = 1; @@ -373,7 +372,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->invincibilityTimer = -7; this->linearVelocity = 0.0f; player->skelAnime.curFrame = 2.0f; - LinkAnimation_Update(globalCtx, &player->skelAnime); + LinkAnimation_Update(play, &player->skelAnime); sHoldShieldTimer = 0; input->cur.button = BTN_A; } else { @@ -415,12 +414,12 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((90.0f >= this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 70.0f) && (ABS(sp5A) >= 0x7800) && (this->actor.isTargeted || !(player->stateFlags1 & PLAYER_STATE1_22))) { - EnTorch2_SwingSword(globalCtx, input, this); + EnTorch2_SwingSword(play, input, this); } else if (((this->actor.xzDistToPlayer <= 70.0f) || ((this->actor.xzDistToPlayer <= 80.0f + sp50) && (player->meleeWeaponState != 0))) && (this->meleeWeaponState == 0)) { - if (!EnTorch2_SwingSword(globalCtx, input, this) && (this->meleeWeaponState == 0) && + if (!EnTorch2_SwingSword(play, input, this) && (this->meleeWeaponState == 0) && (sCounterState == 0)) { EnTorch2_Backflip(this, input, &this->actor); } @@ -444,7 +443,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { EnTorch2_Backflip(this, input, &this->actor); } } else if (((ABS(sp5A) < 0x7800) && (ABS(sp5A) >= 0x3000)) || - !EnTorch2_SwingSword(globalCtx, input, this)) { + !EnTorch2_SwingSword(play, input, this)) { sStickAngle = this->actor.yawTowardsPlayer; sStickTilt = 127.0f; if (!this->actor.isTargeted) { @@ -479,7 +478,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { if (sAlpha) {} sInput.cur.stick_y = stickY; - if ((sAlpha != 255) && ((globalCtx->gameplayFrames % 8) == 0)) { + if ((sAlpha != 255) && ((play->gameplayFrames % 8) == 0)) { sAlpha++; } break; @@ -509,7 +508,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.world.pos.y = this->actor.floorHeight; } Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); - globalCtx->func_11D54(this, globalCtx); + play->func_11D54(this, play); sActionState = ENTORCH2_ATTACK; sStickTilt = 0.0f; if (sAlpha != 255) { @@ -582,8 +581,8 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_8A2 = this->actor.yawTowardsPlayer + 0x8000; sDeathFlag++; sActionState = ENTORCH2_DEATH; - Enemy_StartFinishingBlow(globalCtx, &this->actor); - Item_DropCollectibleRandom(globalCtx, &this->actor, &thisx->world.pos, 0xC0); + Enemy_StartFinishingBlow(play, &this->actor); + Item_DropCollectibleRandom(play, &this->actor, &thisx->world.pos, 0xC0); this->stateFlags3 &= ~PLAYER_STATE3_2; } else { func_800F5ACC(NA_BGM_MINI_BOSS); @@ -634,7 +633,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->linearVelocity = 0.0f; } - globalCtx->playerUpdate(this, globalCtx, input); + play->playerUpdate(this, play, input); /* * Handles sword clanks and removes their recoil for both Links. Dark Link staggers @@ -679,9 +678,9 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->meleeWeaponState = 1; this->skelAnime.curFrame = player->skelAnime.curFrame - player->skelAnime.playSpeed; this->skelAnime.playSpeed = player->skelAnime.playSpeed; - LinkAnimation_Update(globalCtx, &this->skelAnime); - Collider_ResetQuadAT(globalCtx, &this->meleeWeaponQuads[0].base); - Collider_ResetQuadAT(globalCtx, &this->meleeWeaponQuads[1].base); + LinkAnimation_Update(play, &this->skelAnime); + Collider_ResetQuadAT(play, &this->meleeWeaponQuads[0].base); + Collider_ResetQuadAT(play, &this->meleeWeaponQuads[1].base); } } if (sStaggerTimer != 0) { @@ -729,43 +728,43 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.shape.yOffset = sSwordJumpHeight; } -s32 EnTorch2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnTorch2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { Player* this = (Player*)thisx; - return Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, &this->actor); + return Player_OverrideLimbDrawGameplayCommon(play, limbIndex, dList, pos, rot, &this->actor); } -void EnTorch2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnTorch2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { Player* this = (Player*)thisx; - Player_PostLimbDrawGameplay(globalCtx, limbIndex, dList, rot, &this->actor); + Player_PostLimbDrawGameplay(play, limbIndex, dList, rot, &this->actor); } -void EnTorch2_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTorch2_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Player* this = (Player*)thisx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_torch2.c", 1050); - func_80093C80(globalCtx); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_torch2.c", 1050); + func_80093C80(play); + func_80093D84(play->state.gfxCtx); if (sAlpha == 255) { gDPSetEnvColor(POLY_OPA_DISP++, 255, 0, 0, sAlpha); gSPSegment(POLY_OPA_DISP++, 0x0C, D_80116280 + 2); - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnTorch2_OverrideLimbDraw, EnTorch2_PostLimbDraw, - this, POLY_OPA_DISP); + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnTorch2_OverrideLimbDraw, EnTorch2_PostLimbDraw, this, POLY_OPA_DISP); } else { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, sAlpha); gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280); - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnTorch2_OverrideLimbDraw, EnTorch2_PostLimbDraw, - this, POLY_XLU_DISP); + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); + POLY_XLU_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnTorch2_OverrideLimbDraw, EnTorch2_PostLimbDraw, this, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_torch2.c", 1114); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_torch2.c", 1114); } diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c index a606b526ff..8d9387699e 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void EnToryo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnToryo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnToryo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnToryo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnToryo_Init(Actor* thisx, PlayState* play); +void EnToryo_Destroy(Actor* thisx, PlayState* play); +void EnToryo_Update(Actor* thisx, PlayState* play); +void EnToryo_Draw(Actor* thisx, PlayState* play); -void func_80B20914(EnToryo* this, GlobalContext* globalCtx); -s32 EnToryo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -void EnToryo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); +void func_80B20914(EnToryo* this, PlayState* play); +s32 EnToryo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); +void EnToryo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); const ActorInit En_Toryo_InitVars = { ACTOR_EN_TORYO, @@ -91,11 +91,11 @@ static AnimationSpeedInfo sEnToryoAnimation = { &object_toryo_Anim_000E50, 1.0f, static Vec3f sMultVec = { 800.0f, 1000.0f, 0.0f }; -void EnToryo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnToryo_Init(Actor* thisx, PlayState* play) { EnToryo* this = (EnToryo*)thisx; s32 pad; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_SPOT09: if (LINK_AGE_IN_YEARS == YEARS_ADULT) { this->stateFlags |= 1; @@ -118,12 +118,11 @@ void EnToryo_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 42.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_toryo_Skel_007150, NULL, this->jointTable, this->morphTable, - 17); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_toryo_Skel_007150, NULL, this->jointTable, this->morphTable, 17); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); Animation_Change(&this->skelAnime, sEnToryoAnimation.animation, 1.0f, 0.0f, Animation_GetLastFrame(sEnToryoAnimation.animation), sEnToryoAnimation.mode, sEnToryoAnimation.morphFrames); @@ -132,18 +131,18 @@ void EnToryo_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B20914; } -void EnToryo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnToryo_Destroy(Actor* thisx, PlayState* play) { EnToryo* this = (EnToryo*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { +s32 func_80B203D8(EnToryo* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 ret = 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_CLOSING: @@ -152,12 +151,12 @@ s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { ret = 1; break; case TEXT_STATE_CHOICE: - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { - Message_CloseTextbox(globalCtx); + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { + Message_CloseTextbox(play); this->actor.parent = NULL; player->exchangeItemId = EXCH_ITEM_NONE; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actor.textId = 0x601B; ret = 3; } else { @@ -170,27 +169,27 @@ s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { switch (this->actor.textId) { case 0x5028: ret = 1; - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { SET_INFTABLE(INFTABLE_172); ret = 0; } break; case 0x601B: ret = 1; - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 4; } break; case 0x606F: ret = 1; - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { SET_INFTABLE(INFTABLE_171); ret = 0; } break; case 0x606A: ret = 1; - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { SET_INFTABLE(INFTABLE_170); ret = 0; } @@ -201,7 +200,7 @@ s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { case 0x606E: default: ret = 1; - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 0; } break; @@ -211,12 +210,12 @@ s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { return ret; } -s32 func_80B205CC(EnToryo* this, GlobalContext* globalCtx) { +s32 func_80B205CC(EnToryo* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 ret = 5; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_CLOSING: @@ -226,7 +225,7 @@ s32 func_80B205CC(EnToryo* this, GlobalContext* globalCtx) { ret = 5; break; case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { ret = 0; } break; @@ -234,7 +233,7 @@ s32 func_80B205CC(EnToryo* this, GlobalContext* globalCtx) { return ret; } -u32 func_80B20634(EnToryo* this, GlobalContext* globalCtx) { +u32 func_80B20634(EnToryo* this, PlayState* play) { u32 ret; if (this->unk_1E0 != 0) { @@ -253,8 +252,8 @@ u32 func_80B20634(EnToryo* this, GlobalContext* globalCtx) { return ret; } -s32 func_80B206A0(EnToryo* this, GlobalContext* globalCtx) { - s32 textId = Text_GetFaceReaction(globalCtx, 0); +s32 func_80B206A0(EnToryo* this, PlayState* play) { + s32 textId = Text_GetFaceReaction(play, 0); s32 ret = textId; if (textId == 0) { @@ -282,63 +281,63 @@ s32 func_80B206A0(EnToryo* this, GlobalContext* globalCtx) { return ret; } -void func_80B20768(EnToryo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B20768(EnToryo* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp32; s16 sp30; if (this->unk_1E4 == 3) { - Actor_ProcessTalkRequest(&this->actor, globalCtx); - Message_ContinueTextbox(globalCtx, this->actor.textId); + Actor_ProcessTalkRequest(&this->actor, play); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E4 = 1; } if (this->unk_1E4 == 1) { - this->unk_1E4 = func_80B203D8(this, globalCtx); + this->unk_1E4 = func_80B203D8(this, play); } if (this->unk_1E4 == 5) { - this->unk_1E4 = func_80B205CC(this, globalCtx); + this->unk_1E4 = func_80B205CC(this, play); return; } if (this->unk_1E4 == 2) { - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E4 = 1; } if (this->unk_1E4 == 4) { - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->unk_1E4 = 5; } else { - func_8002F434(&this->actor, globalCtx, GI_SWORD_BROKEN, 100.0f, 10.0f); + func_8002F434(&this->actor, play, GI_SWORD_BROKEN, 100.0f, 10.0f); } return; } if (this->unk_1E4 == 0) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { - this->unk_1E0 = func_8002F368(globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, play)) { + this->unk_1E0 = func_8002F368(play); if (this->unk_1E0 != 0) { - player->actor.textId = func_80B20634(this, globalCtx); + player->actor.textId = func_80B20634(this, play); this->actor.textId = player->actor.textId; } this->unk_1E4 = 1; return; } - Actor_GetScreenPos(globalCtx, &this->actor, &sp32, &sp30); + Actor_GetScreenPos(play, &this->actor, &sp32, &sp30); if ((sp32 >= 0) && (sp32 < 0x141) && (sp30 >= 0) && (sp30 < 0xF1)) { - this->actor.textId = func_80B206A0(this, globalCtx); - func_8002F298(&this->actor, globalCtx, 100.0f, 10); + this->actor.textId = func_80B206A0(this, play); + func_8002F298(&this->actor, play, 100.0f, 10); } } } -void func_80B20914(EnToryo* this, GlobalContext* globalCtx) { +void func_80B20914(EnToryo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - func_80B20768(this, globalCtx); + func_80B20768(this, play); if (this->unk_1E4 != 0) { this->stateFlags |= 0x10; } else { @@ -346,16 +345,16 @@ void func_80B20914(EnToryo* this, GlobalContext* globalCtx) { } } -void EnToryo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnToryo_Update(Actor* thisx, PlayState* play) { EnToryo* this = (EnToryo*)thisx; ColliderCylinder* collider = &this->collider; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 rot; Collider_UpdateCylinder(thisx, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, (Collider*)collider); + CollisionCheck_SetOC(play, &play->colChkCtx, (Collider*)collider); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->stateFlags & 8) { this->unk_1EC.unk_18.x = player->actor.focus.pos.x; @@ -376,16 +375,15 @@ void EnToryo_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnToryo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnToryo_Draw(Actor* thisx, PlayState* play) { EnToryo* this = (EnToryo*)thisx; - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnToryo_OverrideLimbDraw, EnToryo_PostLimbDraw, this); } -s32 EnToryo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnToryo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnToryo* this = (EnToryo*)thisx; if (this->stateFlags & 8) { @@ -403,7 +401,7 @@ s32 EnToryo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return 0; } -void EnToryo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnToryo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnToryo* this = (EnToryo*)thisx; switch (limbIndex) { diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h index b6963f5016..c82f7aec2d 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h @@ -6,7 +6,7 @@ struct EnToryo; -typedef void (*EnToryoActionFunc)(struct EnToryo* this, GlobalContext* globalCtx); +typedef void (*EnToryoActionFunc)(struct EnToryo* this, PlayState* play); typedef struct EnToryo { /* 0x0000 */ Actor actor; 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 04b97be72c..07847ea4bc 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -9,25 +9,25 @@ #define FLAGS 0 -void EnTp_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTp_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTp_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTp_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTp_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); +void EnTp_Tail_FollowHead(EnTp* this, PlayState* play); void EnTp_Head_SetupApproachPlayer(EnTp* this); -void EnTp_Head_ApproachPlayer(EnTp* this, GlobalContext* globalCtx); +void EnTp_Head_ApproachPlayer(EnTp* this, PlayState* play); void EnTp_SetupDie(EnTp* this); -void EnTp_Die(EnTp* this, GlobalContext* globalCtx); +void EnTp_Die(EnTp* this, PlayState* play); void EnTp_Fragment_SetupFade(EnTp* this); -void EnTp_Fragment_Fade(EnTp* this, GlobalContext* globalCtx); +void EnTp_Fragment_Fade(EnTp* this, PlayState* play); void EnTp_Head_SetupTakeOff(EnTp* this); -void EnTp_Head_TakeOff(EnTp* this, GlobalContext* globalCtx); +void EnTp_Head_TakeOff(EnTp* this, PlayState* play); void EnTp_Head_SetupWait(EnTp* this); -void EnTp_Head_Wait(EnTp* this, GlobalContext* globalCtx); +void EnTp_Head_Wait(EnTp* this, PlayState* play); void EnTp_Head_SetupBurrowReturnHome(EnTp* this); -void EnTp_Head_BurrowReturnHome(EnTp* this, GlobalContext* globalCtx); +void EnTp_Head_BurrowReturnHome(EnTp* this, PlayState* play); typedef enum { /* 0 */ TAILPASARAN_ACTION_FRAGMENT_FADE, @@ -128,8 +128,8 @@ void EnTp_SetupAction(EnTp* this, EnTpActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnTp_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTp_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnTp* this = (EnTp*)thisx; EnTp* now; EnTp* next; @@ -143,8 +143,8 @@ void EnTp_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.colChkInfo.health = 1; now = this; this->alpha = 255; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); if (this->actor.params <= TAILPASARAN_HEAD) { this->actor.naviEnemyId = NAVI_ENEMY_TAILPASARAN; @@ -157,7 +157,7 @@ void EnTp_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetScale(&this->actor, 1.5f); for (i = 0; i <= 6; i++) { - next = (EnTp*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TP, this->actor.world.pos.x, + 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) {} // Very fake, but needed to get the s registers right @@ -186,10 +186,10 @@ void EnTp_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnTp_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTp_Destroy(Actor* thisx, PlayState* play) { EnTp* this = (EnTp*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnTp_Tail_SetupFollowHead(EnTp* this) { @@ -197,7 +197,7 @@ void EnTp_Tail_SetupFollowHead(EnTp* this) { EnTp_SetupAction(this, EnTp_Tail_FollowHead); } -void EnTp_Tail_FollowHead(EnTp* this, GlobalContext* globalCtx) { +void EnTp_Tail_FollowHead(EnTp* this, PlayState* play) { s16 angle; s16 phase; @@ -237,8 +237,8 @@ void EnTp_Head_SetupApproachPlayer(EnTp* this) { EnTp_SetupAction(this, EnTp_Head_ApproachPlayer); } -void EnTp_Head_ApproachPlayer(EnTp* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTp_Head_ApproachPlayer(EnTp* this, PlayState* play) { + 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); Audio_PlaySoundGeneral(NA_SE_EN_TAIL_FLY - SFX_FLAG, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, @@ -293,7 +293,7 @@ void EnTp_SetupDie(EnTp* this) { /** * Spawns effects and smaller tail segment-like fragments */ -void EnTp_Die(EnTp* this, GlobalContext* globalCtx) { +void EnTp_Die(EnTp* this, PlayState* play) { EnTp* now; s16 i; s32 pad; @@ -307,19 +307,19 @@ void EnTp_Die(EnTp* this, GlobalContext* globalCtx) { 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(globalCtx, &effectPos, &effectVelAccel, &effectVelAccel, 100, 0, 255, 255, 255, 255, 0, - 0, 255, 1, 9, 1); + 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(globalCtx, &effectPos, &effectVelAccel, &effectVelAccel, 100, 0, 255, 255, 255, 255, 0, - 0, 255, 1, 9, 1); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x50); + EffectSsDeadDb_Spawn(play, &effectPos, &effectVelAccel, &effectVelAccel, 100, 0, 255, 255, 255, 255, 0, 0, + 255, 1, 9, 1); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x50); } else { for (i = 0; i < 1; i++) { now = - (EnTp*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TP, this->actor.world.pos.x, + (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) { @@ -352,7 +352,7 @@ void EnTp_Fragment_SetupFade(EnTp* this) { EnTp_SetupAction(this, EnTp_Fragment_Fade); } -void EnTp_Fragment_Fade(EnTp* this, GlobalContext* globalCtx) { +void EnTp_Fragment_Fade(EnTp* this, PlayState* play) { func_8002D7EC(&this->actor); this->alpha -= 20; @@ -371,9 +371,9 @@ void EnTp_Head_SetupTakeOff(EnTp* this) { /** * Flies up and loops around until it makes for Player */ -void EnTp_Head_TakeOff(EnTp* this, GlobalContext* globalCtx) { +void EnTp_Head_TakeOff(EnTp* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speedXZ, 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, @@ -428,8 +428,8 @@ void EnTp_Head_SetupWait(EnTp* this) { /** * Awaken and rise from the ground when Player is closer than 200 */ -void EnTp_Head_Wait(EnTp* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTp_Head_Wait(EnTp* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yaw; this->unk_15C--; @@ -487,7 +487,7 @@ void EnTp_Head_SetupBurrowReturnHome(EnTp* this) { EnTp_SetupAction(this, EnTp_Head_BurrowReturnHome); } -void EnTp_Head_BurrowReturnHome(EnTp* this, GlobalContext* globalCtx) { +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 }; @@ -550,7 +550,7 @@ void EnTp_Head_BurrowReturnHome(EnTp* this, GlobalContext* globalCtx) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - if (closeToFloor && ((globalCtx->gameplayFrames & 1) != 0)) { + if (closeToFloor && ((play->gameplayFrames & 1) != 0)) { bubblePos = this->actor.world.pos; bubblePos.y = this->actor.floorHeight; @@ -558,13 +558,13 @@ void EnTp_Head_BurrowReturnHome(EnTp* this, GlobalContext* globalCtx) { bubbleVelocity.y = (Rand_ZeroOne() * 3.5f) + 1.5f; bubbleVelocity.z = Rand_CenteredFloat(5.0f); - EffectSsDtBubble_SpawnCustomColor(globalCtx, &bubblePos, &bubbleVelocity, &bubbleAccel, &bubblePrimColor, + EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &bubbleVelocity, &bubbleAccel, &bubblePrimColor, &bubbleEnvColor, Rand_S16Offset(100, 50), 20, 0); } } } -void EnTp_UpdateDamage(EnTp* this, GlobalContext* globalCtx) { +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 @@ -643,7 +643,7 @@ void EnTp_UpdateDamage(EnTp* this, GlobalContext* globalCtx) { } } -void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTp_Update(Actor* thisx, PlayState* play) { s32 pad; EnTp* this = (EnTp*)thisx; Vec3f kiraVelocity = { 0.0f, 0.0f, 0.0f }; @@ -651,7 +651,7 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { Vec3f kiraPos; Color_RGBA8 kiraPrimColor = { 0, 0, 255, 255 }; Color_RGBA8 kiraEnvColor = { 0, 0, 0, 0 }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 yawToWall; if (player->stateFlags1 & PLAYER_STATE1_26) { // Shielding @@ -659,16 +659,16 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.colChkInfo.health != 0) { - EnTp_UpdateDamage(this, globalCtx); + EnTp_UpdateDamage(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params <= TAILPASARAN_HEAD) { Actor_MoveForward(&this->actor); if (this->actionIndex != TAILPASARAN_ACTION_HEAD_BURROWRETURNHOME) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 15.0f, 10.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 15.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } @@ -695,7 +695,7 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionIndex >= TAILPASARAN_ACTION_TAIL_FOLLOWHEAD) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } @@ -707,7 +707,7 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; if (this->damageEffect == TAILPASARAN_DMGEFF_SHOCKING) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->kiraSpawnTimer & 7) == 0) { @@ -718,32 +718,32 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { 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(globalCtx, &kiraPos, &kiraVelocity, &kiraAccel, &kiraPrimColor, &kiraEnvColor); + EffectSsKiraKira_SpawnSmall(play, &kiraPos, &kiraVelocity, &kiraAccel, &kiraPrimColor, &kiraEnvColor); } if ((this->actionIndex >= TAILPASARAN_ACTION_TAIL_FOLLOWHEAD) && (this->actor.colChkInfo.health != 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void EnTp_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTp_Draw(Actor* thisx, PlayState* play) { s32 pad; EnTp* this = (EnTp*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tp.c", 1451); + 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)) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tp.c", 1459), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_tp.c", 1459), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gTailpasaranHeadDL); Matrix_Translate(0.0f, 0.0f, 8.0f, MTXMODE_APPLY); } else { - func_80093D84(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + func_80093D84(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->red, 0, 255, this->alpha); gDPPipeSync(POLY_XLU_DISP++); @@ -753,13 +753,13 @@ void EnTp_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gTailpasaranTailSegmentTex)); gDPPipeSync(POLY_XLU_DISP++); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tp.c", 1480), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_tp.c", 1480), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gTailpasaranTailSegmentDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tp.c", 1495); + 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); 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 3c60b02df2..03ae0d9fd8 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.h +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.h @@ -6,7 +6,7 @@ struct EnTp; -typedef void (*EnTpActionFunc)(struct EnTp*, GlobalContext*); +typedef void (*EnTpActionFunc)(struct EnTp*, PlayState*); typedef struct EnTp { /* 0x0000 */ Actor actor; 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 5816590b5a..68c97e7220 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -9,19 +9,19 @@ #define FLAGS ACTOR_FLAG_4 -void EnTr_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTr_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTr_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTr_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); -void EnTr_ShrinkVanish(EnTr* this, GlobalContext* globalCtx); -void EnTr_WaitToReappear(EnTr* this, GlobalContext* globalCtx); -void EnTr_ChooseAction1(EnTr* this, GlobalContext* globalCtx); +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_UpdateRotation(EnTr* this, GlobalContext* globalCtx, s32 actionIndex); -void func_80B24038(EnTr* this, GlobalContext* globalCtx, s32 actionIndex); -void EnTr_SetStartPosRot(EnTr* this, GlobalContext* globalCtx, s32 actionIndex); +void EnTr_UpdateRotation(EnTr* this, PlayState* play, s32 actionIndex); +void func_80B24038(EnTr* this, PlayState* play, s32 actionIndex); +void EnTr_SetStartPosRot(EnTr* this, PlayState* play, s32 actionIndex); const ActorInit En_Tr_InitVars = { ACTOR_EN_TR, @@ -84,7 +84,7 @@ void EnTr_SetupAction(EnTr* this, EnTrActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnTr_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTr_Init(Actor* thisx, PlayState* play) { EnTr* this = (EnTr*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); @@ -95,8 +95,8 @@ void EnTr_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params) { case TR_KOUME: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tr_Skel_011688, &object_tr_Anim_003FC8, - this->jointTable, this->morphTable, 27); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tr_Skel_011688, &object_tr_Anim_003FC8, this->jointTable, + this->morphTable, 27); Animation_PlayOnce(&this->skelAnime, &object_tr_Anim_003FC8); this->animation = NULL; EnTr_SetupAction(this, EnTr_ChooseAction1); @@ -104,8 +104,8 @@ void EnTr_Init(Actor* thisx, GlobalContext* globalCtx) { break; case TR_KOTAKE: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tr_Skel_00C530, &object_tr_Anim_001CDC, - this->jointTable, this->morphTable, 27); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tr_Skel_00C530, &object_tr_Anim_001CDC, this->jointTable, + this->morphTable, 27); Animation_PlayOnce(&this->skelAnime, &object_tr_Anim_001CDC); this->animation = NULL; EnTr_SetupAction(this, EnTr_ChooseAction1); @@ -118,10 +118,10 @@ void EnTr_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTr_Destroy(Actor* thisx, PlayState* play) { } -void EnTr_CrySpellcast(EnTr* this, GlobalContext* globalCtx) { +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.sceneSetupIndex == 6)) { @@ -138,13 +138,13 @@ void EnTr_CrySpellcast(EnTr* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_TWINROBA_FLY_DEMO - SFX_FLAG); } -void EnTr_DoNothing(EnTr* this, GlobalContext* globalCtx) { +void EnTr_DoNothing(EnTr* this, PlayState* play) { } -void EnTr_ChooseAction2(EnTr* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[this->actionIndex] != NULL) { - switch (globalCtx->csCtx.npcActions[this->actionIndex]->action) { +void EnTr_ChooseAction2(EnTr* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[this->actionIndex] != NULL) { + switch (play->csCtx.npcActions[this->actionIndex]->action) { case 4: Actor_SetScale(&this->actor, 0.01f); @@ -159,15 +159,15 @@ void EnTr_ChooseAction2(EnTr* this, GlobalContext* globalCtx) { EnTr_SetupAction(this, EnTr_CrySpellcast); this->animation = D_80B24378[this->actor.params]; this->timer = 39; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, 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); + 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); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_MASIC1); break; default: - func_80B24038(this, globalCtx, this->actionIndex); - EnTr_UpdateRotation(this, globalCtx, this->actionIndex); + func_80B24038(this, play, this->actionIndex); + EnTr_UpdateRotation(this, play, this->actionIndex); break; } func_8002F974(&this->actor, NA_SE_EN_TWINROBA_FLY_DEMO - SFX_FLAG); @@ -175,18 +175,18 @@ void EnTr_ChooseAction2(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_FlyKidnapCutscene(EnTr* this, GlobalContext* globalCtx) { +void EnTr_FlyKidnapCutscene(EnTr* this, PlayState* play) { Vec3f originalPos = this->actor.world.pos; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[this->actionIndex] != NULL) { - if (globalCtx->csCtx.npcActions[this->actionIndex]->action == 8) { - func_80B24038(this, globalCtx, this->actionIndex); + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[this->actionIndex] != NULL) { + if (play->csCtx.npcActions[this->actionIndex]->action == 8) { + func_80B24038(this, play, this->actionIndex); 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); this->actor.world.rot.y = this->actor.shape.rot.y; } else { - EnTr_SetStartPosRot(this, globalCtx, this->actionIndex); + EnTr_SetStartPosRot(this, play, this->actionIndex); this->actor.world.pos.x += Math_SinS(this->timer) * 150.0f; this->actor.world.pos.y += -100.0f; this->actor.world.pos.z += Math_CosS(this->timer) * 150.0f; @@ -199,21 +199,21 @@ void EnTr_FlyKidnapCutscene(EnTr* this, GlobalContext* globalCtx) { this->actor.velocity.z = this->actor.world.pos.z - originalPos.z; } - if (globalCtx->csCtx.frames < 670) { + if (play->csCtx.frames < 670) { func_8002F974(&this->actor, NA_SE_EN_TWINROBA_FLY_DEMO - SFX_FLAG); } } } } -void func_80B23254(EnTr* this, GlobalContext* globalCtx, s32 arg2, f32 arg3, f32 scale) { +void func_80B23254(EnTr* this, PlayState* play, s32 arg2, f32 arg3, f32 scale) { Vec3f pos; Vec3f velocity; Vec3f accel; Vec3f sp58; Color_RGBA8* primColor; Color_RGBA8* envColor; - Vec3f cameraEye = GET_ACTIVE_CAM(globalCtx)->eye; + 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; @@ -237,10 +237,10 @@ void func_80B23254(EnTr* this, GlobalContext* globalCtx, s32 arg2, f32 arg3, f32 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(globalCtx, &pos, &velocity, &accel, primColor, envColor, (s32)(800.0f * scale), (s32)(80.0f * scale)); + func_8002829C(play, &pos, &velocity, &accel, primColor, envColor, (s32)(800.0f * scale), (s32)(80.0f * scale)); } -void EnTr_ShrinkVanish(EnTr* this, GlobalContext* globalCtx) { +void EnTr_ShrinkVanish(EnTr* this, PlayState* play) { if (this->timer >= 17) { this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->timer * 0x28F)) + 0x3D68; } else { @@ -250,8 +250,8 @@ void EnTr_ShrinkVanish(EnTr* this, GlobalContext* globalCtx) { } else if (this->timer > 0) { s32 temp_hi = (this->timer * 2) % 7; - func_80B23254(this, globalCtx, temp_hi, 5.0f, 0.2f); - func_80B23254(this, globalCtx, (temp_hi + 1) % 7, 5.0f, 0.2f); + 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 { @@ -269,12 +269,12 @@ void EnTr_ShrinkVanish(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_Reappear(EnTr* this, GlobalContext* globalCtx) { +void EnTr_Reappear(EnTr* this, PlayState* play) { if (this->timer >= 31) { s32 temp_hi = (this->timer * 2) % 7; - func_80B23254(this, globalCtx, temp_hi, 5.0f, 1.0f); - func_80B23254(this, globalCtx, (temp_hi + 1) % 7, 5.0f, 1.0f); + 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) { this->actor.draw = EnTr_Draw; this->actor.shape.rot.y += this->timer * 0x1A6; @@ -292,14 +292,14 @@ void EnTr_Reappear(EnTr* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_TWINROBA_FLY_DEMO - SFX_FLAG); } -void EnTr_WaitToReappear(EnTr* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if ((globalCtx->csCtx.npcActions[this->actionIndex] != NULL) && - ((globalCtx->csCtx.npcActions[this->actionIndex]->action == 3) || - (globalCtx->csCtx.npcActions[this->actionIndex]->action == 5))) { +void EnTr_WaitToReappear(EnTr* this, PlayState* play) { + if (play->csCtx.state != CS_STATE_IDLE) { + if ((play->csCtx.npcActions[this->actionIndex] != NULL) && + ((play->csCtx.npcActions[this->actionIndex]->action == 3) || + (play->csCtx.npcActions[this->actionIndex]->action == 5))) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_TRANSFORM); this->timer = 34; - EnTr_SetStartPosRot(this, globalCtx, this->actionIndex); + EnTr_SetStartPosRot(this, play, this->actionIndex); EnTr_SetupAction(this, EnTr_Reappear); Animation_PlayLoop(&this->skelAnime, &object_tr_Anim_0049C8); this->animation = NULL; @@ -308,12 +308,12 @@ void EnTr_WaitToReappear(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_TakeOff(EnTr* this, GlobalContext* globalCtx) { +void EnTr_TakeOff(EnTr* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(D_80B24378[this->actor.params]); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if ((globalCtx->csCtx.npcActions[this->actionIndex] != NULL) && - (globalCtx->csCtx.npcActions[this->actionIndex]->action == 3)) { + if (play->csCtx.state != CS_STATE_IDLE) { + if ((play->csCtx.npcActions[this->actionIndex] != NULL) && + (play->csCtx.npcActions[this->actionIndex]->action == 3)) { Animation_Change(&this->skelAnime, D_80B24378[this->actor.params], 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP, -10.0f); this->animation = NULL; @@ -322,12 +322,12 @@ void EnTr_TakeOff(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_TurnLookOverShoulder(EnTr* this, GlobalContext* globalCtx) { +void EnTr_TurnLookOverShoulder(EnTr* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(D_80B24368[this->actor.params]); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if ((globalCtx->csCtx.npcActions[this->actionIndex] != NULL) && - (globalCtx->csCtx.npcActions[this->actionIndex]->action == 2)) { + if (play->csCtx.state != CS_STATE_IDLE) { + if ((play->csCtx.npcActions[this->actionIndex] != NULL) && + (play->csCtx.npcActions[this->actionIndex]->action == 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]; @@ -336,19 +336,19 @@ void EnTr_TurnLookOverShoulder(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_ChooseAction1(EnTr* this, GlobalContext* globalCtx) { - u32 frames = globalCtx->gameplayFrames; +void EnTr_ChooseAction1(EnTr* this, PlayState* play) { + u32 frames = play->gameplayFrames; - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[this->actionIndex] != NULL) { - switch (globalCtx->csCtx.npcActions[this->actionIndex]->action) { + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[this->actionIndex] != NULL) { + switch (play->csCtx.npcActions[this->actionIndex]->action) { case 1: - EnTr_SetStartPosRot(this, globalCtx, this->actionIndex); + EnTr_SetStartPosRot(this, play, this->actionIndex); EnTr_SetupAction(this, EnTr_TurnLookOverShoulder); break; case 3: - EnTr_SetStartPosRot(this, globalCtx, this->actionIndex); + EnTr_SetStartPosRot(this, play, this->actionIndex); EnTr_SetupAction(this, EnTr_ChooseAction2); Animation_PlayLoop(&this->skelAnime, &object_tr_Anim_0049C8); this->animation = NULL; @@ -371,12 +371,12 @@ void EnTr_ChooseAction1(EnTr* this, GlobalContext* globalCtx) { } } -void EnTr_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTr_Update(Actor* thisx, PlayState* play) { s32 pad; EnTr* this = (EnTr*)thisx; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); + 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) != 0) { if (this->animation != NULL) { @@ -410,7 +410,7 @@ void EnTr_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnTr_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +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; @@ -418,57 +418,57 @@ s32 EnTr_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, if ((child != NULL) && (limbIndex == 19)) { Matrix_MultVec3f(&src, &dest); - dest.x -= (10.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)))); - dest.z -= (10.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)))); + 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; } return 0; } -void EnTr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTr_Draw(Actor* thisx, PlayState* play) { s32 pad; EnTr* this = (EnTr*)thisx; if (1) {} - if ((globalCtx->csCtx.state == CS_STATE_IDLE) || (globalCtx->csCtx.npcActions[this->actionIndex] == 0)) { + if ((play->csCtx.state == CS_STATE_IDLE) || (play->csCtx.npcActions[this->actionIndex] == 0)) { this->actor.shape.shadowDraw = NULL; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tr.c", 840); - func_800943C8(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_tr.c", 840); + func_800943C8(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); - func_8002EBCC(&this->actor, globalCtx, 0); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnTr_OverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tr.c", 854); + func_8002EBCC(&this->actor, play, 0); + 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); } } -f32 func_80B23FDC(GlobalContext* globalCtx, s32 actionIndex) { - f32 phi_f2 = Environment_LerpWeight(globalCtx->csCtx.npcActions[actionIndex]->endFrame, - globalCtx->csCtx.npcActions[actionIndex]->startFrame, globalCtx->csCtx.frames); +f32 func_80B23FDC(PlayState* play, s32 actionIndex) { + f32 phi_f2 = Environment_LerpWeight(play->csCtx.npcActions[actionIndex]->endFrame, + play->csCtx.npcActions[actionIndex]->startFrame, play->csCtx.frames); phi_f2 = CLAMP_MAX(phi_f2, 1.0f); return phi_f2; } -void func_80B24038(EnTr* this, GlobalContext* globalCtx, s32 actionIndex) { +void func_80B24038(EnTr* this, PlayState* play, s32 actionIndex) { Vec3f startPos; Vec3f endPos; f32 temp_f0; f32 temp_f0_2; f32 phi_f12; - startPos.x = globalCtx->csCtx.npcActions[actionIndex]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[actionIndex]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[actionIndex]->startPos.z; + startPos.x = play->csCtx.npcActions[actionIndex]->startPos.x; + startPos.y = play->csCtx.npcActions[actionIndex]->startPos.y; + startPos.z = play->csCtx.npcActions[actionIndex]->startPos.z; - endPos.x = globalCtx->csCtx.npcActions[actionIndex]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[actionIndex]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[actionIndex]->endPos.z; + endPos.x = play->csCtx.npcActions[actionIndex]->endPos.x; + endPos.y = play->csCtx.npcActions[actionIndex]->endPos.y; + endPos.z = play->csCtx.npcActions[actionIndex]->endPos.z; - temp_f0 = func_80B23FDC(globalCtx, actionIndex); + temp_f0 = func_80B23FDC(play, actionIndex); startPos.x = ((endPos.x - startPos.x) * temp_f0) + startPos.x; startPos.y = ((endPos.y - startPos.y) * temp_f0) + startPos.y; @@ -493,8 +493,8 @@ void func_80B24038(EnTr* this, GlobalContext* globalCtx, s32 actionIndex) { func_8002D7EC(&this->actor); } -void EnTr_UpdateRotation(EnTr* this, GlobalContext* globalCtx, s32 actionIndex) { - s16 rotY = globalCtx->csCtx.npcActions[actionIndex]->rot.y; +void EnTr_UpdateRotation(EnTr* this, PlayState* play, s32 actionIndex) { + s16 rotY = play->csCtx.npcActions[actionIndex]->rot.y; s32 rotDiff = this->actor.world.rot.y - rotY; s32 rotSign; @@ -516,13 +516,13 @@ void EnTr_UpdateRotation(EnTr* this, GlobalContext* globalCtx, s32 actionIndex) this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnTr_SetStartPosRot(EnTr* this, GlobalContext* globalCtx, s32 actionIndex) { +void EnTr_SetStartPosRot(EnTr* this, PlayState* play, s32 actionIndex) { Vec3f startPos; - startPos.x = globalCtx->csCtx.npcActions[actionIndex]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[actionIndex]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[actionIndex]->startPos.z; + startPos.x = play->csCtx.npcActions[actionIndex]->startPos.x; + startPos.y = play->csCtx.npcActions[actionIndex]->startPos.y; + startPos.z = play->csCtx.npcActions[actionIndex]->startPos.z; this->actor.world.pos = startPos; - this->actor.world.rot.y = this->actor.shape.rot.y = globalCtx->csCtx.npcActions[actionIndex]->rot.y; + this->actor.world.rot.y = this->actor.shape.rot.y = play->csCtx.npcActions[actionIndex]->rot.y; } 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 4e890b3fb2..57dbf78ec5 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.h +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.h @@ -6,7 +6,7 @@ struct EnTr; -typedef void (*EnTrActionFunc)(struct EnTr*, GlobalContext*); +typedef void (*EnTrActionFunc)(struct EnTr*, PlayState*); typedef struct EnTr { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Trap/z_en_trap.c b/src/overlays/actors/ovl_En_Trap/z_en_trap.c index b4e1e2191c..94e5cd5285 100644 --- a/src/overlays/actors/ovl_En_Trap/z_en_trap.c +++ b/src/overlays/actors/ovl_En_Trap/z_en_trap.c @@ -29,10 +29,10 @@ #define vClosestDirection genericVar1 // relative to spike trap's facing angle if moving out, absolute if moving in #define vMovementMetric genericVar2 -void EnTrap_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTrap_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTrap_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTrap_Init(Actor* thisx, PlayState* play); +void EnTrap_Destroy(Actor* thisx, PlayState* play); +void EnTrap_Update(Actor* thisx, PlayState* play); +void EnTrap_Draw(Actor* thisx, PlayState* play); const ActorInit En_Trap_InitVars = { ACTOR_EN_TRAP, @@ -59,7 +59,7 @@ static ColliderCylinderInit sCylinderInit = { { 30, 20, 0, { 0, 0, 0 } }, }; -void EnTrap_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTrap_Init(Actor* thisx, PlayState* play) { f32 trapDist; f32 trapSpeed; s16 zSpeed; @@ -88,7 +88,7 @@ void EnTrap_Init(Actor* thisx, GlobalContext* globalCtx) { trapSpeed = 10.0f; thisx->params = 0xF; } - Actor_UpdateBgCheckInfo(globalCtx, thisx, 10.0f, 20.0f, 20.0f, + Actor_UpdateBgCheckInfo(play, thisx, 10.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); thisx->home.pos = thisx->world.pos; @@ -109,19 +109,19 @@ void EnTrap_Init(Actor* thisx, GlobalContext* globalCtx) { this->moveSpeedLeftRight.z = this->moveSpeedForwardBack.x = xSpeed; } thisx->focus.pos = thisx->world.pos; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 0.0f); thisx->targetMode = 3; thisx->colChkInfo.mass = 0xFF; } -void EnTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTrap_Destroy(Actor* thisx, PlayState* play) { EnTrap* this = (EnTrap*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTrap_Update(Actor* thisx, PlayState* play) { EnTrap* this = (EnTrap*)thisx; Vec3f posTemp; s16 angleToKnockPlayer; @@ -153,12 +153,12 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetColorFilter(thisx, 0, 250, 0, 250); icePos.y += 10.0f; icePos.z += 10.0f; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); + EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); icePos.x += 10.0f; icePos.z -= 20.0f; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); + EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); icePos.x -= 20.0f; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); + EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f); } // If not frozen: if (thisx->colorFilterTimer == 0) { @@ -175,8 +175,8 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { } else { angleToKnockPlayer = thisx->yawTowardsPlayer; } - globalCtx->damagePlayer(globalCtx, -4); - func_8002F7A0(globalCtx, thisx, 6.0f, angleToKnockPlayer, 6.0f); + play->damagePlayer(play, -4); + func_8002F7A0(play, thisx, 6.0f, angleToKnockPlayer, 6.0f); this->playerDmgTimer = 15; } if (thisx->params & SPIKETRAP_MODE_LINEAR) { @@ -190,7 +190,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { posAhead.x = (Math_SinS(thisx->world.rot.y) * 30.0f) + thisx->world.pos.x; posAhead.z = (Math_CosS(thisx->world.rot.y) * 30.0f) + thisx->world.pos.z; posAhead.y = thisx->world.pos.y; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &thisx->world.pos, &posAhead, &colPoint, &colPoly, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &thisx->world.pos, &posAhead, &colPoint, &colPoly, true, true, false, true, &bgId) == true) { this->vContinue = 0.0f; } @@ -310,7 +310,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { } break; } - if (!Actor_TestFloorInDirection(thisx, globalCtx, 50.0f, this->vClosestDirection)) { + if (!Actor_TestFloorInDirection(thisx, play, 50.0f, this->vClosestDirection)) { this->vMovementMetric = 0.0f; } // if in initial position: @@ -377,7 +377,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { if (thisx->params & SPIKETRAP_MODE_LINEAR) { posTemp = thisx->world.pos; } - Actor_UpdateBgCheckInfo(globalCtx, thisx, 25.0f, 20.0f, 20.0f, + Actor_UpdateBgCheckInfo(play, thisx, 25.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); if (thisx->params & SPIKETRAP_MODE_LINEAR) { @@ -386,13 +386,13 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { } } Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (thisx->colorFilterTimer == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void EnTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { - func_8002EBCC(thisx, globalCtx, 1); - Gfx_DrawDListOpa(globalCtx, gSlidingBladeTrapDL); +void EnTrap_Draw(Actor* thisx, PlayState* play) { + func_8002EBCC(thisx, play, 1); + Gfx_DrawDListOpa(play, gSlidingBladeTrapDL); } diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 9f9b53b39b..4d025aa4cb 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -11,14 +11,14 @@ #define FLAGS ACTOR_FLAG_4 -void EnTuboTrap_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTuboTrap_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTuboTrap_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTuboTrap_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTuboTrap_Init(Actor* thisx, PlayState* play); +void EnTuboTrap_Destroy(Actor* thisx, PlayState* play); +void EnTuboTrap_Update(Actor* thisx, PlayState* play); +void EnTuboTrap_Draw(Actor* thisx, PlayState* play); -void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx); -void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx); -void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx); +void EnTuboTrap_WaitForProximity(EnTuboTrap* this, PlayState* play); +void EnTuboTrap_Levitate(EnTuboTrap* this, PlayState* play); +void EnTuboTrap_Fly(EnTuboTrap* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -52,34 +52,34 @@ const ActorInit En_Tubo_Trap_InitVars = { (ActorFunc)EnTuboTrap_Draw, }; -void EnTuboTrap_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTuboTrap_Init(Actor* thisx, PlayState* play) { EnTuboTrap* this = (EnTuboTrap*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 2.0f); osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 壷トラップ ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); // "Urn Trap" - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, 0.1f); this->actionFunc = EnTuboTrap_WaitForProximity; } -void EnTuboTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTuboTrap_Destroy(Actor* thisx, PlayState* play) { EnTuboTrap* this = (EnTuboTrap*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnTuboTrap_DropCollectible(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_DropCollectible(EnTuboTrap* this, PlayState* play) { s16 params = this->actor.params; s16 dropType = (params >> 6) & 0x3FF; if (dropType >= 0 && dropType < ITEM00_MAX) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, dropType | ((params & 0x3F) << 8)); + Item_DropCollectible(play, &this->actor.world.pos, dropType | ((params & 0x3F) << 8)); } } -void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, PlayState* play) { f32 rand; f32 cos; f32 sin; @@ -114,15 +114,14 @@ void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, GlobalContext* globalCtx) { arg5 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, actorPos, -240, arg5, 10, 10, 0, - (Rand_ZeroOne() * 65.0f) + 15.0f, 0, 32, 60, KAKERA_COLOR_NONE, - OBJECT_GAMEPLAY_DANGEON_KEEP, gPotFragmentDL); + EffectSsKakera_Spawn(play, &pos, &velocity, actorPos, -240, arg5, 10, 10, 0, (Rand_ZeroOne() * 65.0f) + 15.0f, + 0, 32, 60, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gPotFragmentDL); } - func_80033480(globalCtx, actorPos, 30.0f, 4, 20, 50, 0); + func_80033480(play, actorPos, 30.0f, 4, 20, 50, 0); } -void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, PlayState* play) { f32 rand; f32 cos; f32 sin; @@ -136,7 +135,7 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) pos = *actorPos; pos.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 400); + EffectSsGSplash_Spawn(play, &pos, 0, 0, 0, 400); for (i = 0, var = 0; i < 15; i++, var += 20000) { sin = Math_SinS(var); @@ -160,40 +159,39 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) arg5 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, actorPos, -180, arg5, 30, 30, 0, - (Rand_ZeroOne() * 65.0f) + 15.0f, 0, 32, 70, KAKERA_COLOR_NONE, - OBJECT_GAMEPLAY_DANGEON_KEEP, gPotFragmentDL); + EffectSsKakera_Spawn(play, &pos, &velocity, actorPos, -180, arg5, 30, 30, 0, (Rand_ZeroOne() * 65.0f) + 15.0f, + 0, 32, 70, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gPotFragmentDL); } } -void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Player* player2 = GET_PLAYER(globalCtx); +void EnTuboTrap_HandleImpact(EnTuboTrap* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Player* player2 = GET_PLAYER(play); if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.yDistToWater > 15.0f)) { - EnTuboTrap_SpawnEffectsInWater(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_BOMB_DROP_WATER); - EnTuboTrap_DropCollectible(this, globalCtx); + EnTuboTrap_SpawnEffectsInWater(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_BOMB_DROP_WATER); + EnTuboTrap_DropCollectible(this, play); Actor_Kill(&this->actor); return; } if (this->collider.base.atFlags & AT_BOUNCED) { this->collider.base.atFlags &= ~AT_BOUNCED; - EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_IT_SHIELD_REFLECT_SW); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); - EnTuboTrap_DropCollectible(this, globalCtx); + EnTuboTrap_SpawnEffectsOnLand(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_IT_SHIELD_REFLECT_SW); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); + EnTuboTrap_DropCollectible(this, play); Actor_Kill(&this->actor); return; } if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); - EnTuboTrap_DropCollectible(this, globalCtx); + EnTuboTrap_SpawnEffectsOnLand(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); + EnTuboTrap_DropCollectible(this, play); Actor_Kill(&this->actor); return; } @@ -201,26 +199,26 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if (this->collider.base.at == &player->actor) { - EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &player2->actor.world.pos, 40, NA_SE_PL_BODY_HIT); - EnTuboTrap_DropCollectible(this, globalCtx); + EnTuboTrap_SpawnEffectsOnLand(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &player2->actor.world.pos, 40, NA_SE_PL_BODY_HIT); + EnTuboTrap_DropCollectible(this, play); Actor_Kill(&this->actor); return; } } if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); - EnTuboTrap_DropCollectible(this, globalCtx); + EnTuboTrap_SpawnEffectsOnLand(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); + EnTuboTrap_DropCollectible(this, play); Actor_Kill(&this->actor); return; } } -void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTuboTrap_WaitForProximity(EnTuboTrap* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 targetHeight; if (BREG(2) != 0) { @@ -230,7 +228,7 @@ void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) { } if (this->actor.xzDistToPlayer < 200.0f && this->actor.world.pos.y <= player->actor.world.pos.y) { - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); this->actor.flags |= ACTOR_FLAG_0; targetHeight = 40.0f + -10.0f * gSaveContext.linkAge; @@ -245,7 +243,7 @@ void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) { } } -void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_Levitate(EnTuboTrap* this, PlayState* play) { this->actor.shape.rot.y += 5000; Math_ApproachF(&this->actor.world.pos.y, this->targetY, 0.8f, 3.0f); @@ -256,7 +254,7 @@ void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx) { } } -void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_Fly(EnTuboTrap* this, PlayState* play) { f32 dx = this->originPos.x - this->actor.world.pos.x; f32 dy = this->originPos.y - this->actor.world.pos.y; f32 dz = this->originPos.z - this->actor.world.pos.z; @@ -268,24 +266,24 @@ void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y += 5000; - EnTuboTrap_HandleImpact(this, globalCtx); + EnTuboTrap_HandleImpact(this, play); } -void EnTuboTrap_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTuboTrap_Update(Actor* thisx, PlayState* play) { EnTuboTrap* this = (EnTuboTrap*)thisx; s32 pad; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 20.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 20.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); Actor_SetFocus(&this->actor, 0.0f); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } -void EnTuboTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gPotDL); +void EnTuboTrap_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gPotDL); } diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h index d15ab4816f..17dc2f2054 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h @@ -6,7 +6,7 @@ struct EnTuboTrap; -typedef void (*EnTuboTrapActionFunc)(struct EnTuboTrap*, GlobalContext*); +typedef void (*EnTuboTrapActionFunc)(struct EnTuboTrap*, PlayState*); typedef struct EnTuboTrap { /* 0x0000 */ Actor actor; 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 3a0c4b104f..00bb1b6b12 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -9,25 +9,25 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_12) -void EnVali_Init(Actor* thisx, GlobalContext* globalCtx); -void EnVali_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnVali_Update(Actor* thisx, GlobalContext* globalCtx); -void EnVali_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnVali_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); -void EnVali_DropAppear(EnVali* this, GlobalContext* globalCtx); -void EnVali_FloatIdle(EnVali* this, GlobalContext* globalCtx); -void EnVali_Attacked(EnVali* this, GlobalContext* globalCtx); -void EnVali_Retaliate(EnVali* this, GlobalContext* globalCtx); -void EnVali_MoveArmsDown(EnVali* this, GlobalContext* globalCtx); -void EnVali_Burnt(EnVali* this, GlobalContext* globalCtx); -void EnVali_DivideAndDie(EnVali* this, GlobalContext* globalCtx); -void EnVali_Stunned(EnVali* this, GlobalContext* globalCtx); -void EnVali_Frozen(EnVali* this, GlobalContext* globalCtx); -void EnVali_ReturnToLurk(EnVali* this, GlobalContext* globalCtx); +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); const ActorInit En_Vali_InitVars = { ACTOR_EN_VALI, @@ -133,7 +133,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 5000, ICHAIN_STOP), }; -void EnVali_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnVali_Init(Actor* thisx, PlayState* play) { s32 pad; EnVali* this = (EnVali*)thisx; s32 bgId; @@ -141,22 +141,22 @@ void EnVali_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 27.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(globalCtx, &this->skelAnime, &gBariSkel, &gBariLurkingAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gBariSkel, &gBariLurkingAnim, this->jointTable, this->morphTable, EN_VALI_LIMB_MAX); - Collider_InitQuad(globalCtx, &this->leftArmCollider); - Collider_SetQuad(globalCtx, &this->leftArmCollider, &this->actor, &sQuadInit); - Collider_InitQuad(globalCtx, &this->rightArmCollider); - Collider_SetQuad(globalCtx, &this->rightArmCollider, &this->actor, &sQuadInit); - Collider_InitCylinder(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sCylinderInit); + 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); this->actor.flags &= ~ACTOR_FLAG_0; - this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, - &this->actor, &this->actor.world.pos); + this->actor.floorHeight = + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); this->actor.params = BARI_TYPE_NORMAL; if (this->actor.floorHeight == BGCHECK_Y_MIN) { @@ -164,12 +164,12 @@ void EnVali_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnVali_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnVali_Destroy(Actor* thisx, PlayState* play) { EnVali* this = (EnVali*)thisx; - Collider_DestroyQuad(globalCtx, &this->leftArmCollider); - Collider_DestroyQuad(globalCtx, &this->rightArmCollider); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); + Collider_DestroyQuad(play, &this->leftArmCollider); + Collider_DestroyQuad(play, &this->rightArmCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); } void EnVali_SetupLurk(EnVali* this) { @@ -234,20 +234,20 @@ void EnVali_SetupBurnt(EnVali* this) { this->actionFunc = EnVali_Burnt; } -void EnVali_SetupDivideAndDie(EnVali* this, GlobalContext* globalCtx) { +void EnVali_SetupDivideAndDie(EnVali* this, PlayState* play) { s32 i; for (i = 0; i < 3; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BILI, this->actor.world.pos.x, this->actor.world.pos.y, + 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; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x50); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x50); this->timer = Rand_S16Offset(10, 10); this->bodyCollider.base.acFlags &= ~AC_ON; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_BARI_SPLIT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BARI_SPLIT); this->actor.flags &= ~ACTOR_FLAG_0; this->actor.draw = NULL; this->actionFunc = EnVali_DivideAndDie; @@ -279,7 +279,7 @@ void EnVali_SetupReturnToLurk(EnVali* this) { this->actionFunc = EnVali_ReturnToLurk; } -void EnVali_DischargeLightning(EnVali* this, GlobalContext* globalCtx) { +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; @@ -289,28 +289,28 @@ void EnVali_DischargeLightning(EnVali* this, GlobalContext* globalCtx) { s16 yaw; for (i = 0; i < 4; i++) { - cos = -Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); - sin = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); + 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(globalCtx, &pos, &primColor, &envColor, 17, yaw, 6, 2); + EffectSsLightning_Spawn(play, &pos, &primColor, &envColor, 17, yaw, 6, 2); } } func_8002F974(&this->actor, NA_SE_EN_BIRI_SPARK - SFX_FLAG); } -void EnVali_Lurk(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Lurk(EnVali* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f) { EnVali_SetupDropAppear(this); } } -void EnVali_DropAppear(EnVali* this, GlobalContext* globalCtx) { +void EnVali_DropAppear(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); @@ -321,7 +321,7 @@ void EnVali_DropAppear(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_FloatIdle(EnVali* this, GlobalContext* globalCtx) { +void EnVali_FloatIdle(EnVali* this, PlayState* play) { s32 curFrame; SkelAnime_Update(&this->skelAnime); @@ -353,12 +353,12 @@ void EnVali_FloatIdle(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_Attacked(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Attacked(EnVali* this, PlayState* play) { if (this->lightningTimer != 0) { this->lightningTimer--; } - EnVali_DischargeLightning(this, globalCtx); + EnVali_DischargeLightning(this, play); if (this->lightningTimer == 0) { this->actor.flags |= ACTOR_FLAG_0; @@ -375,33 +375,33 @@ void EnVali_Attacked(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_Retaliate(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Retaliate(EnVali* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health != 0) { EnVali_SetupMoveArmsDown(this); } else { - EnVali_SetupDivideAndDie(this, globalCtx); + EnVali_SetupDivideAndDie(this, play); } } } -void EnVali_MoveArmsDown(EnVali* this, GlobalContext* globalCtx) { +void EnVali_MoveArmsDown(EnVali* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnVali_SetupFloatIdle(this); } } -void EnVali_Burnt(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Burnt(EnVali* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { - EnVali_SetupDivideAndDie(this, globalCtx); + EnVali_SetupDivideAndDie(this, play); } } -void EnVali_DivideAndDie(EnVali* this, GlobalContext* globalCtx) { +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; @@ -420,9 +420,9 @@ void EnVali_DivideAndDie(EnVali* this, GlobalContext* globalCtx) { scale = Rand_S16Offset(40, 40); if (Rand_ZeroOne() < 0.7f) { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &pos, &velocity, &accel, scale, 25, 2, 1); + EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, scale, 25, 2, 1); } else { - EffectSsDtBubble_SpawnColorProfile(globalCtx, &pos, &velocity, &accel, scale, 25, 0, 1); + EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, scale, 25, 0, 1); } } @@ -431,7 +431,7 @@ void EnVali_DivideAndDie(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_Stunned(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Stunned(EnVali* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -453,7 +453,7 @@ void EnVali_Stunned(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_Frozen(EnVali* this, GlobalContext* globalCtx) { +void EnVali_Frozen(EnVali* this, PlayState* play) { Vec3f pos; s32 temp_v0; s32 temp_v1; @@ -473,19 +473,19 @@ void EnVali_Frozen(EnVali* this, GlobalContext* globalCtx) { 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(globalCtx, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.2f) + 1.3f); } } 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)) { - EnVali_SetupDivideAndDie(this, globalCtx); + EnVali_SetupDivideAndDie(this, play); this->actor.colorFilterTimer = 0; } } } -void EnVali_ReturnToLurk(EnVali* this, GlobalContext* globalCtx) { +void EnVali_ReturnToLurk(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) { @@ -493,7 +493,7 @@ void EnVali_ReturnToLurk(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_UpdateDamage(EnVali* this, GlobalContext* globalCtx) { +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.info, true); @@ -501,7 +501,7 @@ void EnVali_UpdateDamage(EnVali* this, GlobalContext* globalCtx) { if ((this->actor.colChkInfo.damageEffect != BARI_DMGEFF_NONE) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BARI_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_0; } else if ((this->actor.colChkInfo.damageEffect != BARI_DMGEFF_STUN) && (this->actor.colChkInfo.damageEffect != BARI_DMGEFF_SLINGSHOT)) { @@ -535,7 +535,7 @@ void EnVali_UpdateDamage(EnVali* this, GlobalContext* globalCtx) { } } -void EnVali_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnVali_Update(Actor* thisx, PlayState* play) { s32 pad; EnVali* this = (EnVali*)thisx; @@ -547,23 +547,23 @@ void EnVali_Update(Actor* thisx, GlobalContext* globalCtx) { EnVali_SetupAttacked(this); } - EnVali_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + 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(globalCtx, &globalCtx->colChkCtx, &this->leftArmCollider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->rightArmCollider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + 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->bodyCollider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); Actor_SetFocus(&this->actor, 0.0f); } } @@ -670,7 +670,7 @@ s32 EnVali_SetArmLength(EnVali* this, f32 curFrame) { } } -s32 EnVali_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnVali_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnVali* this = (EnVali*)thisx; f32 curFrame; @@ -692,7 +692,7 @@ s32 EnVali_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnVali_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +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 sp3C; @@ -715,21 +715,21 @@ void EnVali_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void EnVali_DrawBody(EnVali* this, GlobalContext* globalCtx) { +void EnVali_DrawBody(EnVali* this, PlayState* play) { MtxF mtx; f32 cos; f32 sin; f32 curFrame; Vec3f scale = { 1.0f, 1.0f, 1.0f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_vali.c", 1428); + 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); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vali.c", 1436), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_vali.c", 1436), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBariInnerHoodDL); @@ -739,19 +739,19 @@ void EnVali_DrawBody(EnVali* this, GlobalContext* globalCtx) { cos = Math_CosS(this->actor.shape.rot.y); sin = Math_SinS(this->actor.shape.rot.y); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vali.c", 1446), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_vali.c", 1446), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); Matrix_Translate((506.0f * cos) + (372.0f * sin), 1114.0f, (372.0f * cos) - (506.0f * sin), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vali.c", 1455), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_vali.c", 1455), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); Matrix_Translate((-964.0f * cos) - (804.0f * sin), -108.0f, (-804.0f * cos) + (964.0f * sin), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vali.c", 1463), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_vali.c", 1463), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); @@ -762,13 +762,13 @@ void EnVali_DrawBody(EnVali* this, GlobalContext* globalCtx) { EnVali_PulseOutside(this, curFrame, &scale); Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vali.c", 1471), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_vali.c", 1471), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBariOuterHoodDL); Matrix_Put(&mtx); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_vali.c", 1477); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1477); } static Gfx D_80B28998[] = { @@ -783,15 +783,15 @@ static Gfx D_80B289A8[] = { gsSPEndDisplayList(), }; -void EnVali_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnVali_Draw(Actor* thisx, PlayState* play) { s32 pad; EnVali* this = (EnVali*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_vali.c", 1505); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1505); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (127 - (globalCtx->gameplayFrames * 12)) % 128, 32, 32)); + 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); @@ -799,10 +799,10 @@ void EnVali_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x09, D_80B289A8); } - EnVali_DrawBody(this, globalCtx); + EnVali_DrawBody(this, play); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - EnVali_OverrideLimbDraw, EnVali_PostLimbDraw, this, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnVali_OverrideLimbDraw, + EnVali_PostLimbDraw, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_vali.c", 1538); + 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 9c98ca3fc6..0c94d92288 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.h +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.h @@ -6,7 +6,7 @@ struct EnVali; -typedef void (*EnValiActionFunc)(struct EnVali*, GlobalContext*); +typedef void (*EnValiActionFunc)(struct EnVali*, PlayState*); typedef enum { /* 0x00 */ EN_VALI_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Vase/z_en_vase.c b/src/overlays/actors/ovl_En_Vase/z_en_vase.c index ac59a8852e..40c0c27060 100644 --- a/src/overlays/actors/ovl_En_Vase/z_en_vase.c +++ b/src/overlays/actors/ovl_En_Vase/z_en_vase.c @@ -9,9 +9,9 @@ #define FLAGS ACTOR_FLAG_4 -void EnVase_Init(Actor* thisx, GlobalContext* globalCtx); -void EnVase_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnVase_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnVase_Init(Actor* thisx, PlayState* play); +void EnVase_Destroy(Actor* thisx, PlayState* play); +void EnVase_Draw(Actor* thisx, PlayState* play); const ActorInit En_Vase_InitVars = { ACTOR_EN_VASE, @@ -25,7 +25,7 @@ const ActorInit En_Vase_InitVars = { (ActorFunc)EnVase_Draw, }; -void EnVase_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnVase_Init(Actor* thisx, PlayState* play) { EnVase* this = (EnVase*)thisx; Actor_SetScale(&this->actor, 0.01f); @@ -33,9 +33,9 @@ void EnVase_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 6.0f); } -void EnVase_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnVase_Destroy(Actor* thisx, PlayState* play) { } -void EnVase_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gUnusedVaseDL); +void EnVase_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gUnusedVaseDL); } diff --git a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c index 5d2588b610..b8b8183968 100644 --- a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c +++ b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c @@ -11,10 +11,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EnVbBall_Init(Actor* thisx, GlobalContext* globalCtx); -void EnVbBall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx); -void EnVbBall_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnVbBall_Init(Actor* thisx, PlayState* play); +void EnVbBall_Destroy(Actor* thisx, PlayState* play); +void EnVbBall_Update(Actor* thisx, PlayState* play); +void EnVbBall_Draw(Actor* thisx, PlayState* play); const ActorInit En_Vb_Ball_InitVars = { 0, @@ -48,7 +48,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 30, 10, { 0, 0, 0 } }, }; -void EnVbBall_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnVbBall_Init(Actor* thisx, PlayState* play) { s32 pad; EnVbBall* this = (EnVbBall*)thisx; s32 pad2; @@ -63,8 +63,8 @@ void EnVbBall_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.velocity.z = 2.0f * cosf(angle); this->actor.gravity = -0.8f; } else { // Volvagia's rocks - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, this->actor.world.rot.z / 10000.0f); this->collider.dim.radius = this->actor.scale.y * 3000.0f; this->collider.dim.height = this->actor.scale.y * 5000.0f; @@ -75,17 +75,17 @@ void EnVbBall_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnVbBall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnVbBall_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnVbBall* this = (EnVbBall*)thisx; if (this->actor.params < 200) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnVbBall_SpawnDebris(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, - Vec3f* acceleration, f32 scale) { +void EnVbBall_SpawnDebris(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, + f32 scale) { s16 i; for (i = 0; i < 180; i++, effect++) { @@ -102,8 +102,8 @@ void EnVbBall_SpawnDebris(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* } } -void EnVbBall_SpawnDust(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, - Vec3f* acceleration, f32 scale) { +void EnVbBall_SpawnDust(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, + f32 scale) { s16 i; for (i = 0; i < 180; i++, effect++) { @@ -119,14 +119,14 @@ void EnVbBall_SpawnDust(GlobalContext* globalCtx, BossFdEffect* effect, Vec3f* p } } -void EnVbBall_UpdateBones(EnVbBall* this, GlobalContext* globalCtx) { +void EnVbBall_UpdateBones(EnVbBall* this, PlayState* play) { BossFd* bossFd = (BossFd*)this->actor.parent; f32 pad2; f32 pad1; f32 angle; s16 i; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y <= 0.0f)) { this->xRotVel = Rand_CenteredFloat((f32)0x4000); this->yRotVel = Rand_CenteredFloat((f32)0x4000); @@ -153,8 +153,7 @@ void EnVbBall_UpdateBones(EnVbBall* this, GlobalContext* globalCtx) { dustPos.y = this->actor.floorHeight + 10.0f; dustPos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - EnVbBall_SpawnDust(globalCtx, bossFd->effects, &dustPos, &dustVel, &dustAcc, - Rand_ZeroFloat(80.0f) + 200.0f); + EnVbBall_SpawnDust(play, bossFd->effects, &dustPos, &dustVel, &dustAcc, Rand_ZeroFloat(80.0f) + 200.0f); } } if (this->actor.world.pos.y < 50.0f) { @@ -162,8 +161,8 @@ void EnVbBall_UpdateBones(EnVbBall* this, GlobalContext* globalCtx) { } } -void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnVbBall_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnVbBall* this = (EnVbBall*)thisx; BossFd* bossFd = (BossFd*)this->actor.parent; f32 radius; @@ -181,18 +180,18 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.gravity = -1.0f; func_8002D7EC(&this->actor); if (this->actor.params >= 200) { - EnVbBall_UpdateBones(this, globalCtx); + EnVbBall_UpdateBones(this, play); } else { Math_ApproachF(&this->shadowOpacity, 175.0f, 1.0f, 40.0f); radius = this->actor.scale.y * 1700.0f; this->actor.world.pos.y -= radius; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, UPDBGCHECKINFO_FLAG_2); this->actor.world.pos.y += radius; if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y <= 0.0f)) { if ((this->actor.params == 100) || (this->actor.params == 101)) { Actor_Kill(&this->actor); if (this->actor.params == 100) { - func_80033E88(&this->actor, globalCtx, 5, 0xA); + func_80033E88(&this->actor, play, 5, 0xA); } if (this->actor.params == 100) { spawnNum = 2; @@ -213,11 +212,10 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { spawnOffset.y = Rand_ZeroFloat(3.0f) + 4.0f; spawnOffset.z = Rand_CenteredFloat(10.0f); } - newActor = (EnVbBall*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, - ACTOR_EN_VB_BALL, this->actor.world.pos.x + spawnOffset.x, - this->actor.world.pos.y + spawnOffset.y, - this->actor.world.pos.z + spawnOffset.z, 0, 0, - this->actor.world.rot.z * 0.5f, this->actor.params + 1); + newActor = (EnVbBall*)Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_EN_VB_BALL, this->actor.world.pos.x + spawnOffset.x, + this->actor.world.pos.y + spawnOffset.y, this->actor.world.pos.z + spawnOffset.z, 0, 0, + this->actor.world.rot.z * 0.5f, this->actor.params + 1); if (newActor != NULL) { if ((i == 0) && (this->actor.params == 100)) { Audio_PlaySoundGeneral(NA_SE_EN_VALVAISA_ROCK, &newActor->actor.projectedPos, 4, @@ -246,7 +244,7 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { debrisPos1.y = Rand_CenteredFloat(10.0f) + this->actor.world.pos.y; debrisPos1.z = Rand_CenteredFloat(10.0f) + this->actor.world.pos.z; - EnVbBall_SpawnDebris(globalCtx, bossFd->effects, &debrisPos1, &debrisVel1, &debrisAcc1, + EnVbBall_SpawnDebris(play, bossFd->effects, &debrisPos1, &debrisVel1, &debrisAcc1, (s16)Rand_ZeroFloat(12.0f) + 15); } for (i = 0; i < 10; i++) { @@ -264,7 +262,7 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { dustPos.y = Rand_CenteredFloat(30.0f) + this->actor.world.pos.y; dustPos.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; - EnVbBall_SpawnDust(globalCtx, bossFd->effects, &dustPos, &dustVel, &dustAcc, + EnVbBall_SpawnDust(play, bossFd->effects, &dustPos, &dustVel, &dustAcc, Rand_ZeroFloat(100.0f) + 350.0f); } } else { @@ -281,46 +279,46 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { debrisPos2.y = Rand_CenteredFloat(5.0f) + this->actor.world.pos.y; debrisPos2.z = Rand_CenteredFloat(5.0f) + this->actor.world.pos.z; - EnVbBall_SpawnDebris(globalCtx, bossFd->effects, &debrisPos2, &debrisVel2, &debrisAcc2, + EnVbBall_SpawnDebris(play, bossFd->effects, &debrisPos2, &debrisVel2, &debrisAcc2, (s16)Rand_ZeroFloat(12.0f) + 15); } Actor_Kill(&this->actor); } } if (this->collider.base.atFlags & AT_HIT) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->collider.base.atFlags &= ~AT_HIT; Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } -void EnVbBall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnVbBall_Draw(Actor* thisx, PlayState* play) { s32 pad; EnVbBall* this = (EnVbBall*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_vb_ball.c", 604); + OPEN_DISPS(play->state.gfxCtx, "../z_en_vb_ball.c", 604); if (1) {} // needed for match - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vb_ball.c", 607), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_vb_ball.c", 607), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params >= 200) { gSPDisplayList(POLY_OPA_DISP++, SEGMENTED_TO_VIRTUAL(gVolvagiaRibsDL)); } else { gSPDisplayList(POLY_OPA_DISP++, SEGMENTED_TO_VIRTUAL(gVolvagiaRockDL)); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, (s8)this->shadowOpacity); Matrix_Translate(this->actor.world.pos.x, 100.0f, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->shadowSize, 1.0f, this->shadowSize, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vb_ball.c", 626), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_vb_ball.c", 626), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gCircleShadowDL)); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_vb_ball.c", 632); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_vb_ball.c", 632); } 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 28b24419f4..f2460376ff 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -17,16 +17,16 @@ #define FLAGS ACTOR_FLAG_4 -void EnViewer_Init(Actor* thisx, GlobalContext* globalCtx); -void EnViewer_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnViewer_Update(Actor* thisx, GlobalContext* globalCtx); -void EnViewer_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnViewer_Init(Actor* thisx, PlayState* play); +void EnViewer_Destroy(Actor* thisx, PlayState* play); +void EnViewer_Update(Actor* thisx, PlayState* play); +void EnViewer_Draw(Actor* thisx, PlayState* play); -void EnViewer_UpdatePosition(EnViewer* this, GlobalContext* globalCtx); -void EnViewer_DrawFireEffects(EnViewer* this2, GlobalContext* globalCtx); -void EnViewer_UpdateGanondorfCape(GlobalContext* globalCtx, EnViewer* this); -void EnViewer_InitImpl(EnViewer* this, GlobalContext* globalCtx); -void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx); +void EnViewer_UpdatePosition(EnViewer* this, PlayState* play); +void EnViewer_DrawFireEffects(EnViewer* this2, PlayState* play); +void EnViewer_UpdateGanondorfCape(PlayState* play, EnViewer* this); +void EnViewer_InitImpl(EnViewer* this, PlayState* play); +void EnViewer_UpdateImpl(EnViewer* this, PlayState* play); static u8 sHorseSfxPlayed = false; @@ -87,7 +87,7 @@ void EnViewer_SetupAction(EnViewer* this, EnViewerActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnViewer_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnViewer_Init(Actor* thisx, PlayState* play) { EnViewer* this = (EnViewer*)thisx; u8 type; @@ -100,29 +100,29 @@ void EnViewer_Init(Actor* thisx, GlobalContext* globalCtx) { this->isVisible = false; if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || type == ENVIEWER_TYPE_9_GANONDORF) { - sGanondorfCape = (EnGanonMant*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, - ACTOR_EN_GANON_MANT, 0.0f, 0.0f, 0.0f, 0, 0, 0, 35); + sGanondorfCape = (EnGanonMant*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_GANON_MANT, + 0.0f, 0.0f, 0.0f, 0, 0, 0, 35); } } -void EnViewer_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnViewer_Destroy(Actor* thisx, PlayState* play) { EnViewer* this = (EnViewer*)thisx; - Skin_Free(globalCtx, &this->skin); + Skin_Free(play, &this->skin); } -void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, GlobalContext* globalCtx, void* skeletonHeaderSeg, +void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, PlayState* play, void* skeletonHeaderSeg, AnimationHeader* anim) { s16 type = this->actor.params >> 8; if (type == ENVIEWER_TYPE_2_ZELDA || type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || type == ENVIEWER_TYPE_9_GANONDORF) { - SkelAnime_InitFlex(globalCtx, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); } else { - SkelAnime_Init(globalCtx, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); + SkelAnime_Init(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animObjBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animObjBankIndex].segment); if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || type == ENVIEWER_TYPE_9_GANONDORF) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, anim, 1.0f); @@ -131,16 +131,16 @@ void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, GlobalContext* globalCtx, } } -void EnViewer_InitAnimImpa(EnViewer* this, GlobalContext* globalCtx, void* skeletonHeaderSeg, AnimationHeader* anim) { - SkelAnime_InitFlex(globalCtx, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animObjBankIndex].segment); +void EnViewer_InitAnimImpa(EnViewer* this, PlayState* play, void* skeletonHeaderSeg, AnimationHeader* anim) { + SkelAnime_InitFlex(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animObjBankIndex].segment); Animation_PlayLoopSetSpeed(&this->skin.skelAnime, anim, 3.0f); } -void EnViewer_InitAnimHorse(EnViewer* this, GlobalContext* globalCtx, void* skeletonHeaderSeg, AnimationHeader* anim) { +void EnViewer_InitAnimHorse(EnViewer* this, PlayState* play, void* skeletonHeaderSeg, AnimationHeader* anim) { u8 type; - Skin_Init(globalCtx, &this->skin, skeletonHeaderSeg, anim); + Skin_Init(play, &this->skin, skeletonHeaderSeg, anim); type = this->actor.params >> 8; if (!(type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_4_HORSE_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || @@ -164,42 +164,42 @@ static ActorShadowFunc sShadowDrawFuncs[] = { ActorShadow_DrawHorse, }; -void EnViewer_InitImpl(EnViewer* this, GlobalContext* globalCtx) { +void EnViewer_InitImpl(EnViewer* this, PlayState* play) { EnViewerInitData* initData = &sInitData[this->actor.params >> 8]; - s32 skelObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, initData->skeletonObject); + s32 skelObjBankIndex = Object_GetIndex(&play->objectCtx, initData->skeletonObject); ASSERT(skelObjBankIndex >= 0, "bank_ID >= 0", "../z_en_viewer.c", 576); - this->animObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, initData->animObject); + this->animObjBankIndex = Object_GetIndex(&play->objectCtx, initData->animObject); ASSERT(this->animObjBankIndex >= 0, "this->anime_bank_ID >= 0", "../z_en_viewer.c", 579); - if (!Object_IsLoaded(&globalCtx->objectCtx, skelObjBankIndex) || - !Object_IsLoaded(&globalCtx->objectCtx, this->animObjBankIndex)) { + if (!Object_IsLoaded(&play->objectCtx, skelObjBankIndex) || + !Object_IsLoaded(&play->objectCtx, this->animObjBankIndex)) { this->actor.flags &= ~ACTOR_FLAG_6; return; } this->isVisible = true; this->actor.objBankIndex = skelObjBankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, initData->scale / 100.0f); ActorShape_Init(&this->actor.shape, initData->yOffset * 100, sShadowDrawFuncs[initData->shadowType], initData->shadowScale); this->drawFuncIndex = initData->drawType; - sInitAnimFuncs[this->drawFuncIndex](this, globalCtx, initData->skeletonHeaderSeg, initData->anim); + sInitAnimFuncs[this->drawFuncIndex](this, play, initData->skeletonHeaderSeg, initData->anim); EnViewer_SetupAction(this, EnViewer_UpdateImpl); } static s16 sTimer = 0; -void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { +void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { u8 type = this->actor.params >> 8; u16 csFrames; s32 animationEnded; if (type == ENVIEWER_TYPE_2_ZELDA) { if (gSaveContext.sceneSetupIndex == 5) { - csFrames = globalCtx->csCtx.frames; + csFrames = play->csCtx.frames; if (csFrames == 792) { Audio_PlayActorSound2(&this->actor, NA_SE_VO_Z0_SURPRISE); } else if (csFrames == 845) { @@ -213,7 +213,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { this->actor.uncullZoneDownward = 10000.0f; } else if (type == ENVIEWER_TYPE_3_GANONDORF) { if (gSaveContext.sceneSetupIndex == 4) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 20: case 59: case 71: @@ -231,18 +231,18 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } } if (gSaveContext.sceneSetupIndex == 5) { - if (globalCtx->csCtx.frames == 1508) { + if (play->csCtx.frames == 1508) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_ST_LAUGH); } - if (globalCtx->csCtx.frames == 1545) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, 32.0f, 101.0f, 1226.0f, - 0, 0, 0, 0xC); + if (play->csCtx.frames == 1545) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, 32.0f, 101.0f, 1226.0f, 0, 0, 0, + 0xC); } } - if (globalCtx->csCtx.frames == 1020) { + if (play->csCtx.frames == 1020) { Audio_QueueSeqCmd(SEQ_PLAYER_FANFARE << 24 | NA_BGM_OPENING_GANON); } - if (globalCtx->csCtx.frames == 960) { + if (play->csCtx.frames == 960) { Audio_PlaySoundGeneral(NA_SE_EV_HORSE_GROAN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } @@ -273,13 +273,13 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { sTimer--; } - EnViewer_UpdatePosition(this, globalCtx); + EnViewer_UpdatePosition(this, play); Actor_MoveForward(&this->actor); // has no effect, speed/velocity and gravity are 0 animationEnded = SkelAnime_Update(&this->skin.skelAnime); if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_4_HORSE_GANONDORF) { - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[1] != NULL) { - if (globalCtx->csCtx.npcActions[1]->action == 2 && sTimer == 0) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[1] != NULL) { + if (play->csCtx.npcActions[1]->action == 2 && sTimer == 0) { if (type == ENVIEWER_TYPE_3_GANONDORF) { if (this->skin.skelAnime.animation != &object_gndd_Anim_002928) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_gndd_Anim_002928, 1.0f); @@ -287,7 +287,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } else if (this->skin.skelAnime.animation != &gHorseGanonIdleAnim) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &gHorseGanonIdleAnim, 1.0f); } - } else if (globalCtx->csCtx.npcActions[1]->action == 1) { + } else if (play->csCtx.npcActions[1]->action == 1) { sTimer = 100; if (type == ENVIEWER_TYPE_3_GANONDORF) { if (this->skin.skelAnime.animation != &object_gndd_Anim_001D28) { @@ -299,7 +299,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } else if (type == ENVIEWER_TYPE_3_GANONDORF) { switch (this->state) { case 0: - if (globalCtx->csCtx.npcActions[1]->action == 4) { + if (play->csCtx.npcActions[1]->action == 4) { Animation_MorphToPlayOnce(&this->skin.skelAnime, &object_gndd_Anim_000F54, -5.0f); this->state++; } @@ -311,7 +311,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } break; case 2: - if (globalCtx->csCtx.npcActions[1]->action == 5) { + if (play->csCtx.npcActions[1]->action == 5) { Animation_MorphToPlayOnce(&this->skin.skelAnime, &object_gndd_Anim_0008A0, -5.0f); this->state++; } @@ -323,19 +323,19 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } break; case 4: - if (globalCtx->csCtx.npcActions[1]->action == 11) { + if (play->csCtx.npcActions[1]->action == 11) { Animation_MorphToLoop(&this->skin.skelAnime, &object_gndd_Anim_0014F4, -20.0f); this->state++; } break; case 5: - if (globalCtx->csCtx.npcActions[1]->action == 8) { + if (play->csCtx.npcActions[1]->action == 8) { Animation_MorphToLoop(&this->skin.skelAnime, &object_gndd_Anim_002928, -15.0f); this->state++; } break; case 6: - if (globalCtx->csCtx.npcActions[1]->action == 12) { + if (play->csCtx.npcActions[1]->action == 12) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_VOICE_DEMO); Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_gndd_Anim_0005B4, 3.0f); this->state++; @@ -346,34 +346,34 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { break; } } else if (this->skin.skelAnime.animation != &gHorseGanonGallopingAnim && - globalCtx->csCtx.npcActions[1]->action == 12) { + play->csCtx.npcActions[1]->action == 12) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &gHorseGanonGallopingAnim, 3.0f); } } } else if (type == ENVIEWER_TYPE_1_IMPA) { if (gSaveContext.sceneSetupIndex == 5) { - if (globalCtx->csCtx.frames == 845) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, - 2600.0f, 0, 0, 0, 0); + if (play->csCtx.frames == 845) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, 2600.0f, 0, 0, + 0, 0); } } else { - if (globalCtx->csCtx.frames == 195) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, - 2035.0f, 0, 0, 0, 1); + if (play->csCtx.frames == 195) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, 2035.0f, 0, 0, + 0, 1); } } switch (this->state) { case 0: - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[0] != NULL && - globalCtx->csCtx.npcActions[0]->action == 6 && + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[0] != NULL && + play->csCtx.npcActions[0]->action == 6 && this->skin.skelAnime.animation != &object_opening_demo1_Anim_002574) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_opening_demo1_Anim_002574, 1.5f); this->state++; } break; case 1: - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[0] != NULL && - globalCtx->csCtx.npcActions[0]->action == 2 && + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[0] != NULL && + play->csCtx.npcActions[0]->action == 2 && this->skin.skelAnime.animation != &object_opening_demo1_Anim_0029CC) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_opening_demo1_Anim_0029CC, 3.0f); this->state++; @@ -381,11 +381,11 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { break; } } else if (type == ENVIEWER_TYPE_2_ZELDA) { - if (globalCtx->sceneNum == SCENE_SPOT00) { // Hyrule Field + if (play->sceneNum == SCENE_SPOT00) { // Hyrule Field switch (this->state) { case 0: - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[0] != NULL && globalCtx->csCtx.npcActions[0]->action == 6 && + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[0] != NULL && play->csCtx.npcActions[0]->action == 6 && this->skin.skelAnime.animation != &object_opening_demo1_Anim_001410) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_opening_demo1_Anim_001410, 1.5f); this->state++; @@ -393,8 +393,8 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } break; case 1: - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[0] != NULL && globalCtx->csCtx.npcActions[0]->action == 2 && + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[0] != NULL && play->csCtx.npcActions[0]->action == 2 && this->skin.skelAnime.animation != &object_opening_demo1_Anim_000450) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_opening_demo1_Anim_000450, 3.0f); this->state++; @@ -410,7 +410,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { this->state++; break; case 1: - if (globalCtx->csCtx.npcActions[0]->action == 11) { + if (play->csCtx.npcActions[0]->action == 11) { Animation_MorphToPlayOnce(&this->skin.skelAnime, &object_opening_demo1_Anim_00420C, -5.0f); this->state++; } @@ -428,8 +428,8 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } else if (type == ENVIEWER_TYPE_7_GANONDORF) { switch (this->state) { case 0: - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[1] != NULL && - globalCtx->csCtx.npcActions[1]->action == 7) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[1] != NULL && + play->csCtx.npcActions[1]->action == 7) { Audio_PlaySoundGeneral(NA_SE_EN_GANON_LAUGH, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); Animation_MorphToPlayOnce(&this->skin.skelAnime, &object_gndd_Anim_004534, -5.0f); @@ -446,15 +446,15 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } else if (type == ENVIEWER_TYPE_8_GANONDORF) { switch (this->state) { case 0: - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.npcActions[1] != NULL && globalCtx->csCtx.npcActions[1]->action == 9) { + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.npcActions[1] != NULL && play->csCtx.npcActions[1]->action == 9) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_gndd_Anim_0050A8, 1.0f); this->state++; } } break; case 1: - if (globalCtx->csCtx.npcActions[1]->action == 10) { + if (play->csCtx.npcActions[1]->action == 10) { Animation_MorphToPlayOnce(&this->skin.skelAnime, &object_gndd_Anim_003284, -10.0f); this->state++; } @@ -466,7 +466,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } break; case 3: - if (globalCtx->csCtx.npcActions[1]->action == 4) { + if (play->csCtx.npcActions[1]->action == 4) { Animation_MorphToPlayOnce(&this->skin.skelAnime, &object_gndd_Anim_003428, -5.0f); this->state++; } @@ -478,23 +478,23 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) { } } -void EnViewer_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnViewer_Update(Actor* thisx, PlayState* play) { EnViewer* this = (EnViewer*)thisx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animObjBankIndex].segment); - this->actionFunc(this, globalCtx); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animObjBankIndex].segment); + this->actionFunc(this, play); } -s32 EnViewer_Ganondorf3OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnViewer_Ganondorf3OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { if (gSaveContext.sceneSetupIndex == 4) { - if (globalCtx->csCtx.frames >= 400) { + if (play->csCtx.frames >= 400) { if (limbIndex == 5) { *dList = object_gndd_DL_00E1A8; } } } else { - if (globalCtx->csCtx.frames >= 1510 && globalCtx->csCtx.frames <= 1650) { + if (play->csCtx.frames >= 1510 && play->csCtx.frames <= 1650) { if (limbIndex == 5) { *dList = object_gndd_DL_00E1A8; } @@ -503,19 +503,18 @@ s32 EnViewer_Ganondorf3OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, return false; } -void EnViewer_Ganondorf9PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnViewer_Ganondorf9PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { if (limbIndex == 11) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1365); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1370), + OPEN_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1365); + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_viewer.c", 1370), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_ganon_DL_00BE90)); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1372); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1372); } } -void EnViewer_GanondorfPostLimbDrawUpdateCapeVec(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, - void* thisx) { +void EnViewer_GanondorfPostLimbDrawUpdateCapeVec(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; if (limbIndex == 15) { @@ -523,11 +522,11 @@ void EnViewer_GanondorfPostLimbDrawUpdateCapeVec(GlobalContext* globalCtx, s32 l } } -void EnViewer_DrawGanondorf(EnViewer* this, GlobalContext* globalCtx) { +void EnViewer_DrawGanondorf(EnViewer* this, PlayState* play) { s16 frames = 0; s16 type; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1405); + OPEN_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1405); type = this->actor.params >> 8; if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF) { @@ -535,15 +534,15 @@ void EnViewer_DrawGanondorf(EnViewer* this, GlobalContext* globalCtx) { frames = 149; } - if (frames + 1127 >= globalCtx->csCtx.frames) { + if (frames + 1127 >= play->csCtx.frames) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&object_gndd_Tex_00F178)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(&object_gndd_Tex_00F178)); - } else if (frames + 1128 >= globalCtx->csCtx.frames) { + } else if (frames + 1128 >= play->csCtx.frames) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&object_gndd_Tex_00F378)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(&object_gndd_Tex_00F378)); - } else if (frames + 1129 >= globalCtx->csCtx.frames) { + } else if (frames + 1129 >= play->csCtx.frames) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&object_gndd_Tex_00F578)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(&object_gndd_Tex_00F578)); @@ -556,34 +555,33 @@ void EnViewer_DrawGanondorf(EnViewer* this, GlobalContext* globalCtx) { } if (type == ENVIEWER_TYPE_9_GANONDORF) { - SkelAnime_DrawFlexOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, this->skin.skelAnime.dListCount, NULL, EnViewer_Ganondorf9PostLimbDraw, this); } else if (type == ENVIEWER_TYPE_3_GANONDORF) { - SkelAnime_DrawFlexOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, this->skin.skelAnime.dListCount, EnViewer_Ganondorf3OverrideLimbDraw, EnViewer_GanondorfPostLimbDrawUpdateCapeVec, this); - EnViewer_UpdateGanondorfCape(globalCtx, this); + EnViewer_UpdateGanondorfCape(play, this); } else if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[1] != NULL)) { - SkelAnime_DrawFlexOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[1] != NULL)) { + SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, this->skin.skelAnime.dListCount, NULL, EnViewer_GanondorfPostLimbDrawUpdateCapeVec, this); - EnViewer_UpdateGanondorfCape(globalCtx, this); + EnViewer_UpdateGanondorfCape(play, this); } } else { - SkelAnime_DrawOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, NULL, NULL, this); + SkelAnime_DrawOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, NULL, NULL, this); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1511); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1511); } -void EnViewer_DrawHorse(EnViewer* this, GlobalContext* globalCtx) { - func_800A6330(&this->actor, globalCtx, &this->skin, NULL, true); +void EnViewer_DrawHorse(EnViewer* this, PlayState* play) { + func_800A6330(&this->actor, play, &this->skin, NULL, true); } -s32 EnViewer_ZeldaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { - if (globalCtx->sceneNum == SCENE_SPOT00) { // Hyrule Field +s32 EnViewer_ZeldaOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { + if (play->sceneNum == SCENE_SPOT00) { // Hyrule Field if (limbIndex == 2) { *dList = gChildZeldaCutsceneDressDL; } @@ -606,37 +604,37 @@ s32 EnViewer_ZeldaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx* return false; } -void EnViewer_ZeldaPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnViewer_ZeldaPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { s32 pad; - if (globalCtx->sceneNum == SCENE_TOKINOMA) { + if (play->sceneNum == SCENE_TOKINOMA) { if (limbIndex == 16) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1568); + OPEN_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1568); gSPDisplayList(POLY_OPA_DISP++, gChildZeldaOcarinaOfTimeDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1570); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1570); } } } -void EnViewer_DrawZelda(EnViewer* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1583); - if (globalCtx->sceneNum == SCENE_SPOT00) { // Hyrule Field - if (globalCtx->csCtx.frames < 771) { +void EnViewer_DrawZelda(EnViewer* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1583); + if (play->sceneNum == SCENE_SPOT00) { // Hyrule Field + if (play->csCtx.frames < 771) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeInTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeOutTex)); - } else if (globalCtx->csCtx.frames < 772) { + } else if (play->csCtx.frames < 772) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeBlinkTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeBlinkTex)); - } else if (globalCtx->csCtx.frames < 773) { + } else if (play->csCtx.frames < 773) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeShutTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeShutTex)); - } else if (globalCtx->csCtx.frames < 791) { + } else if (play->csCtx.frames < 791) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeWideTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeWideTex)); - } else if (globalCtx->csCtx.frames < 792) { + } else if (play->csCtx.frames < 792) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeBlinkTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeBlinkTex)); - } else if (globalCtx->csCtx.frames < 793) { + } else if (play->csCtx.frames < 793) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeShutTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeShutTex)); } else { @@ -647,9 +645,9 @@ void EnViewer_DrawZelda(EnViewer* this, GlobalContext* globalCtx) { if (gSaveContext.sceneSetupIndex == 6) { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthSurprisedTex)); } else { - if (globalCtx->csCtx.frames < 758) { + if (play->csCtx.frames < 758) { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthWorriedTex)); - } else if (globalCtx->csCtx.frames < 848) { + } else if (play->csCtx.frames < 848) { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthSurprisedTex)); } else { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthWorriedTex)); @@ -660,29 +658,28 @@ void EnViewer_DrawZelda(EnViewer* this, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeShutTex)); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthWorriedTex)); } - SkelAnime_DrawFlexOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, this->skin.skelAnime.dListCount, EnViewer_ZeldaOverrideLimbDraw, EnViewer_ZeldaPostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1690); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1690); } -s32 EnViewer_ImpaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnViewer_ImpaOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { if (limbIndex == 16) { *dList = gImpaHeadMaskedDL; } return false; } -void EnViewer_DrawImpa(EnViewer* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1717); +void EnViewer_DrawImpa(EnViewer* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1717); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gImpaEyeOpenTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gImpaEyeOpenTex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, this->skin.skelAnime.dListCount, EnViewer_ImpaOverrideLimbDraw, NULL, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1740); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1740); } static EnViewerDrawFunc sDrawFuncs[] = { @@ -692,37 +689,37 @@ static EnViewerDrawFunc sDrawFuncs[] = { EnViewer_DrawImpa, }; -void EnViewer_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnViewer_Draw(Actor* thisx, PlayState* play) { EnViewer* this = (EnViewer*)thisx; s32 pad; s16 type; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1760); + OPEN_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1760); if (this->isVisible) { type = this->actor.params >> 8; if (type <= ENVIEWER_TYPE_2_ZELDA) { // zelda's horse, impa and zelda - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[0] != NULL) { - func_80093D18(globalCtx->state.gfxCtx); - sDrawFuncs[this->drawFuncIndex](this, globalCtx); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[0] != NULL) { + func_80093D18(play->state.gfxCtx); + sDrawFuncs[this->drawFuncIndex](this, play); } - } else if ((globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[1] != NULL) || + } else if ((play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[1] != NULL) || type == ENVIEWER_TYPE_9_GANONDORF) { - func_80093D18(globalCtx->state.gfxCtx); - sDrawFuncs[this->drawFuncIndex](this, globalCtx); + func_80093D18(play->state.gfxCtx); + sDrawFuncs[this->drawFuncIndex](this, play); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1784); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1784); } -void EnViewer_UpdatePosition(EnViewer* this, GlobalContext* globalCtx) { +void EnViewer_UpdatePosition(EnViewer* this, PlayState* play) { Vec3f startPos; Vec3f endPos; f32 lerpFactor; s16 type = this->actor.params >> 8; if (type <= ENVIEWER_TYPE_2_ZELDA) { // zelda's horse, impa and zelda - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[0] != NULL && - globalCtx->csCtx.frames < globalCtx->csCtx.npcActions[0]->endFrame) { + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[0] != NULL && + play->csCtx.frames < play->csCtx.npcActions[0]->endFrame) { if (type == ENVIEWER_TYPE_0_HORSE_ZELDA) { if (!sHorseSfxPlayed) { sHorseSfxPlayed = true; @@ -733,34 +730,34 @@ void EnViewer_UpdatePosition(EnViewer* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_HORSE_RUN_LEVEL - SFX_FLAG); } - startPos.x = globalCtx->csCtx.npcActions[0]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[0]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[0]->startPos.z; - endPos.x = globalCtx->csCtx.npcActions[0]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[0]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[0]->endPos.z; - lerpFactor = Environment_LerpWeight(globalCtx->csCtx.npcActions[0]->endFrame, - globalCtx->csCtx.npcActions[0]->startFrame, globalCtx->csCtx.frames); + startPos.x = play->csCtx.npcActions[0]->startPos.x; + startPos.y = play->csCtx.npcActions[0]->startPos.y; + startPos.z = play->csCtx.npcActions[0]->startPos.z; + endPos.x = play->csCtx.npcActions[0]->endPos.x; + endPos.y = play->csCtx.npcActions[0]->endPos.y; + endPos.z = play->csCtx.npcActions[0]->endPos.z; + lerpFactor = Environment_LerpWeight(play->csCtx.npcActions[0]->endFrame, + play->csCtx.npcActions[0]->startFrame, play->csCtx.frames); this->actor.world.pos.x = (endPos.x - startPos.x) * lerpFactor + startPos.x; this->actor.world.pos.y = (endPos.y - startPos.y) * lerpFactor + startPos.y; this->actor.world.pos.z = (endPos.z - startPos.z) * lerpFactor + startPos.z; } } else { // ganondorf and ganondorf's horse - if (globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[1] != NULL && - globalCtx->csCtx.frames < globalCtx->csCtx.npcActions[1]->endFrame) { - startPos.x = globalCtx->csCtx.npcActions[1]->startPos.x; - startPos.y = globalCtx->csCtx.npcActions[1]->startPos.y; - startPos.z = globalCtx->csCtx.npcActions[1]->startPos.z; - endPos.x = globalCtx->csCtx.npcActions[1]->endPos.x; - endPos.y = globalCtx->csCtx.npcActions[1]->endPos.y; - endPos.z = globalCtx->csCtx.npcActions[1]->endPos.z; - lerpFactor = Environment_LerpWeight(globalCtx->csCtx.npcActions[1]->endFrame, - globalCtx->csCtx.npcActions[1]->startFrame, globalCtx->csCtx.frames); + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[1] != NULL && + play->csCtx.frames < play->csCtx.npcActions[1]->endFrame) { + startPos.x = play->csCtx.npcActions[1]->startPos.x; + startPos.y = play->csCtx.npcActions[1]->startPos.y; + startPos.z = play->csCtx.npcActions[1]->startPos.z; + endPos.x = play->csCtx.npcActions[1]->endPos.x; + endPos.y = play->csCtx.npcActions[1]->endPos.y; + endPos.z = play->csCtx.npcActions[1]->endPos.z; + lerpFactor = Environment_LerpWeight(play->csCtx.npcActions[1]->endFrame, + play->csCtx.npcActions[1]->startFrame, play->csCtx.frames); this->actor.world.pos.x = (endPos.x - startPos.x) * lerpFactor + startPos.x; this->actor.world.pos.y = (endPos.y - startPos.y) * lerpFactor + startPos.y; this->actor.world.pos.z = (endPos.z - startPos.z) * lerpFactor + startPos.z; - if (globalCtx->csCtx.npcActions[1]->action == 12) { + if (play->csCtx.npcActions[1]->action == 12) { s16 yaw = Math_Vec3f_Yaw(&startPos, &endPos); Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 0xA, 0x3E8, 1); @@ -768,23 +765,23 @@ void EnViewer_UpdatePosition(EnViewer* this, GlobalContext* globalCtx) { } if (type == ENVIEWER_TYPE_9_GANONDORF) { - this->actor.world.rot.x = globalCtx->csCtx.npcActions[1]->urot.x; - this->actor.world.rot.y = globalCtx->csCtx.npcActions[1]->urot.y; - this->actor.world.rot.z = globalCtx->csCtx.npcActions[1]->urot.z; - this->actor.shape.rot.x = globalCtx->csCtx.npcActions[1]->urot.x; - this->actor.shape.rot.y = globalCtx->csCtx.npcActions[1]->urot.y; - this->actor.shape.rot.z = globalCtx->csCtx.npcActions[1]->urot.z; + this->actor.world.rot.x = play->csCtx.npcActions[1]->urot.x; + this->actor.world.rot.y = play->csCtx.npcActions[1]->urot.y; + this->actor.world.rot.z = play->csCtx.npcActions[1]->urot.z; + this->actor.shape.rot.x = play->csCtx.npcActions[1]->urot.x; + this->actor.shape.rot.y = play->csCtx.npcActions[1]->urot.y; + this->actor.shape.rot.z = play->csCtx.npcActions[1]->urot.z; } } if (type == ENVIEWER_TYPE_5_GANONDORF) { Audio_PlaySoundGeneral(NA_SE_EV_BURNING - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - EnViewer_DrawFireEffects(this, globalCtx); + EnViewer_DrawFireEffects(this, play); } } } -void EnViewer_InitFireEffect(EnViewer* this, GlobalContext* globalCtx, s16 i) { +void EnViewer_InitFireEffect(EnViewer* this, PlayState* play, s16 i) { EnViewerFireEffect* eff; if ((i % 2) == 0) { @@ -809,15 +806,15 @@ void EnViewer_InitFireEffect(EnViewer* this, GlobalContext* globalCtx, s16 i) { if (this) {} } -void EnViewer_DrawFireEffects(EnViewer* this2, GlobalContext* globalCtx) { +void EnViewer_DrawFireEffects(EnViewer* this2, PlayState* play) { EnViewer* this = this2; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 1941); + OPEN_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1941); for (i = 0; i < ARRAY_COUNT(this->fireEffects); i++) { switch (this->fireEffects[i].state) { case 0: - EnViewer_InitFireEffect(this, globalCtx, i); + EnViewer_InitFireEffect(this, play, i); this->fireEffects[i].lerpFactor = (i >> 1) * 0.1f; this->fireEffects[i].lerpFactorSpeed = 0.01f; this->fireEffects[i].state++; @@ -839,31 +836,31 @@ void EnViewer_DrawFireEffects(EnViewer* this2, GlobalContext* globalCtx) { } break; case 2: - EnViewer_InitFireEffect(this, globalCtx, i); + EnViewer_InitFireEffect(this, play, i); this->fireEffects[i].lerpFactor = 0.0f; this->fireEffects[i].lerpFactorSpeed = 0.01f; this->fireEffects[i].state--; break; } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(this->fireEffects[i].pos.x, this->fireEffects[i].pos.y, this->fireEffects[i].pos.z, MTXMODE_NEW); Matrix_Scale(this->fireEffects[i].scale, this->fireEffects[i].scale, this->fireEffects[i].scale, MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - (10 * i - 20 * globalCtx->state.frames) % 512, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (10 * i - 20 * play->state.frames) % 512, + 32, 128)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 00, 255); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_viewer.c", 2027), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_viewer.c", 2027), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(POLY_XLU_DISP++, &D_01000000, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_viewer.c", 2034); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 2034); } -void EnViewer_UpdateGanondorfCape(GlobalContext* globalCtx, EnViewer* this) { +void EnViewer_UpdateGanondorfCape(PlayState* play, EnViewer* this) { static s16 yOscillationPhase = 0; Vec3f forearmModelOffset; Vec3f forearmWorldOffset; diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h index 6d797cb348..6d4cf91200 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h @@ -6,9 +6,9 @@ struct EnViewer; -typedef void (*EnViewerActionFunc)(struct EnViewer*, GlobalContext*); -typedef void (*EnViewerDrawFunc)(struct EnViewer*, GlobalContext*); -typedef void (*EnViewerInitAnimFunc)(struct EnViewer*, GlobalContext*, void*, AnimationHeader*); +typedef void (*EnViewerActionFunc)(struct EnViewer*, PlayState*); +typedef void (*EnViewerDrawFunc)(struct EnViewer*, PlayState*); +typedef void (*EnViewerInitAnimFunc)(struct EnViewer*, PlayState*, void*, AnimationHeader*); typedef enum { /* 0 */ ENVIEWER_TYPE_0_HORSE_ZELDA, diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index cde8a60ed5..712eca3629 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -11,17 +11,17 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4) -void EnVm_Init(Actor* thisx, GlobalContext* globalCtx); -void EnVm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnVm_Update(Actor* thisx, GlobalContext* globalCtx); -void EnVm_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnVm_Init(Actor* thisx, PlayState* play); +void EnVm_Destroy(Actor* thisx, PlayState* play); +void EnVm_Update(Actor* thisx, PlayState* play); +void EnVm_Draw(Actor* thisx, PlayState* play); void EnVm_SetupWait(EnVm* this); -void EnVm_Wait(EnVm* this, GlobalContext* globalCtx); +void EnVm_Wait(EnVm* this, PlayState* play); void EnVm_SetupAttack(EnVm* this); -void EnVm_Attack(EnVm* this, GlobalContext* globalCtx); -void EnVm_Stun(EnVm* this, GlobalContext* globalCtx); -void EnVm_Die(EnVm* this, GlobalContext* globalCtx); +void EnVm_Attack(EnVm* this, PlayState* play); +void EnVm_Stun(EnVm* this, PlayState* play); +void EnVm_Die(EnVm* this, PlayState* play); const ActorInit En_Vm_InitVars = { ACTOR_EN_VM, @@ -131,17 +131,17 @@ void EnVm_SetupAction(EnVm* this, EnVmActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnVm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnVm_Init(Actor* thisx, PlayState* play) { EnVm* this = (EnVm*)thisx; - SkelAnime_Init(globalCtx, &this->skelAnime, &gBeamosSkel, &gBeamosAnim, this->jointTable, this->morphTable, 11); + SkelAnime_Init(play, &this->skelAnime, &gBeamosSkel, &gBeamosAnim, this->jointTable, this->morphTable, 11); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinder(globalCtx, &this->colliderCylinder, thisx, &sCylinderInit); - Collider_InitQuad(globalCtx, &this->colliderQuad1); - Collider_SetQuad(globalCtx, &this->colliderQuad1, thisx, &sQuadInit1); - Collider_InitQuad(globalCtx, &this->colliderQuad2); - Collider_SetQuad(globalCtx, &this->colliderQuad2, thisx, &sQuadInit2); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, thisx, &sCylinderInit); + Collider_InitQuad(play, &this->colliderQuad1); + Collider_SetQuad(play, &this->colliderQuad1, thisx, &sQuadInit1); + Collider_InitQuad(play, &this->colliderQuad2); + Collider_SetQuad(play, &this->colliderQuad2, thisx, &sQuadInit2); this->beamSightRange = (thisx->params >> 8) * 40.0f; thisx->params &= 0xFF; thisx->naviEnemyId = NAVI_ENEMY_BEAMOS; @@ -157,10 +157,10 @@ void EnVm_Init(Actor* thisx, GlobalContext* globalCtx) { EnVm_SetupWait(this); } -void EnVm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnVm_Destroy(Actor* thisx, PlayState* play) { EnVm* this = (EnVm*)thisx; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); + Collider_DestroyCylinder(play, &this->colliderCylinder); } void EnVm_SetupWait(EnVm* this) { @@ -173,8 +173,8 @@ void EnVm_SetupWait(EnVm* this) { EnVm_SetupAction(this, EnVm_Wait); } -void EnVm_Wait(EnVm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnVm_Wait(EnVm* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 dist; s16 headRot; s16 pad; @@ -240,8 +240,8 @@ void EnVm_Wait(EnVm* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = 1.0f; } else { this->skelAnime.curFrame = 6.0f; - EffectSsDeadDd_Spawn(globalCtx, &this->beamPos2, &D_80B2EAEC, &D_80B2EAEC, 150, -25, 0, 0, 255, 0, 255, 255, - 255, 16, 20); + EffectSsDeadDd_Spawn(play, &this->beamPos2, &D_80B2EAEC, &D_80B2EAEC, 150, -25, 0, 0, 255, 0, 255, 255, 255, + 16, 20); EnVm_SetupAttack(this); } } @@ -257,8 +257,8 @@ void EnVm_SetupAttack(EnVm* this) { EnVm_SetupAction(this, EnVm_Attack); } -void EnVm_Attack(EnVm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnVm_Attack(EnVm* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 pitch = Math_Vec3f_Pitch(&this->beamPos1, &player->actor.world.pos); f32 dist; Vec3f playerPos; @@ -304,7 +304,7 @@ void EnVm_Attack(EnVm* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BIMOS_LAZER - SFX_FLAG); if (this->unk_260 > 2) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderQuad1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderQuad1.base); } this->unk_260 = 3; @@ -328,7 +328,7 @@ void EnVm_SetupStun(EnVm* this) { EnVm_SetupAction(this, EnVm_Stun); } -void EnVm_Stun(EnVm* this, GlobalContext* globalCtx) { +void EnVm_Stun(EnVm* this, PlayState* play) { if (this->timer == 0) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_25E++; @@ -367,7 +367,7 @@ void EnVm_SetupDie(EnVm* this) { EnVm_SetupAction(this, EnVm_Die); } -void EnVm_Die(EnVm* this, GlobalContext* globalCtx) { +void EnVm_Die(EnVm* this, PlayState* play) { EnBom* bomb; this->beamRot.x += 0x5DC; @@ -375,22 +375,22 @@ void EnVm_Die(EnVm* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if (--this->timer == 0) { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x6FF, BOMB_BODY); if (bomb != NULL) { bomb->timer = 0; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xA0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xA0); Actor_Kill(&this->actor); } } -void EnVm_CheckHealth(EnVm* this, GlobalContext* globalCtx) { +void EnVm_CheckHealth(EnVm* this, PlayState* play) { EnBom* bomb; - if (Actor_GetCollidedExplosive(globalCtx, &this->colliderCylinder.base) != NULL) { + if (Actor_GetCollidedExplosive(play, &this->colliderCylinder.base) != NULL) { this->actor.colChkInfo.health--; osSyncPrintf("hp down %d\n", this->actor.colChkInfo.health); } else { @@ -404,7 +404,7 @@ void EnVm_CheckHealth(EnVm* this, GlobalContext* globalCtx) { Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); EnVm_SetupStun(this); } else { - bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y + 20.0f, this->actor.world.pos.z, 0, 0, 0x601, BOMB_BODY); if (bomb != NULL) { @@ -415,21 +415,21 @@ void EnVm_CheckHealth(EnVm* this, GlobalContext* globalCtx) { } } -void EnVm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnVm_Update(Actor* thisx, PlayState* play) { EnVm* this = (EnVm*)thisx; - CollisionCheckContext* colChkCtx = &globalCtx->colChkCtx; + CollisionCheckContext* colChkCtx = &play->colChkCtx; if (this->actor.colChkInfo.health != 0) { - EnVm_CheckHealth(this, globalCtx); + EnVm_CheckHealth(this, play); } if (this->unk_260 == 4) { - EffectSsDeadDs_SpawnStationary(globalCtx, &this->beamPos3, 20, -1, 255, 20); - func_80033480(globalCtx, &this->beamPos3, 6.0f, 1, 120, 20, 1); + EffectSsDeadDs_SpawnStationary(play, &this->beamPos3, 20, -1, 255, 20); + func_80033480(play, &this->beamPos3, 6.0f, 1, 120, 20, 1); Audio_PlayActorSound2(&this->actor, NA_SE_EN_BIMOS_LAZER_GND - SFX_FLAG); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->beamTexScroll += 0xC; if (this->actor.colChkInfo.health != 0 && this->unk_21C != 2) { @@ -437,18 +437,18 @@ void EnVm_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetOC(globalCtx, colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, colChkCtx, &this->colliderCylinder.base); if (this->actor.colorFilterTimer == 0 && this->actor.colChkInfo.health != 0) { - CollisionCheck_SetAC(globalCtx, colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, colChkCtx, &this->colliderCylinder.base); } - CollisionCheck_SetAC(globalCtx, colChkCtx, &this->colliderQuad2.base); + CollisionCheck_SetAC(play, colChkCtx, &this->colliderQuad2.base); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += (6500.0f + this->actor.shape.yOffset) * this->actor.scale.y; } -s32 EnVm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnVm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnVm* this = (EnVm*)thisx; if (limbIndex == 2) { @@ -463,7 +463,7 @@ s32 EnVm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnVm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnVm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnVm* this = (EnVm*)thisx; Vec3f sp80 = D_80B2EAF8; Vec3f sp74 = D_80B2EB04; @@ -483,8 +483,8 @@ void EnVm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec sp80.z = (this->beamScale.z + 500.0f) * (this->actor.scale.y * 10000.0f); Matrix_MultVec3f(&sp80, &this->beamPos3); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->beamPos1, &this->beamPos3, &posResult, &poly, true, - true, false, true, &bgId) == true) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->beamPos1, &this->beamPos3, &posResult, &poly, true, true, + false, true, &bgId) == true) { this->beamScale.z = Math_Vec3f_DistXYZ(&this->beamPos1, &posResult) - 5.0f; this->unk_260 = 4; this->beamPos3 = posResult; @@ -514,43 +514,43 @@ void EnVm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnVm_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void EnVm_Draw(Actor* thisx, PlayState* play2) { EnVm* this = (EnVm*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Vec3f actorPos; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_vm.c", 1014); + OPEN_DISPS(play->state.gfxCtx, "../z_en_vm.c", 1014); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnVm_OverrideLimbDraw, + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnVm_OverrideLimbDraw, EnVm_PostLimbDraw, this); actorPos = this->actor.world.pos; - func_80033C30(&actorPos, &D_80B2EB7C, 255, globalCtx); + func_80033C30(&actorPos, &D_80B2EB7C, 255, play); if (this->unk_260 >= 3) { Matrix_Translate(this->beamPos3.x, this->beamPos3.y + 10.0f, this->beamPos3.z, MTXMODE_NEW); Matrix_Scale(0.8f, 0.8f, 0.8f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vm.c", 1033), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_vm.c", 1033), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 168); - func_80094BC4(globalCtx->state.gfxCtx); + func_80094BC4(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 0); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B2EB88[globalCtx->gameplayFrames % 8])); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B2EB88[play->gameplayFrames % 8])); gSPDisplayList(POLY_XLU_DISP++, gEffEnemyDeathFlameDL); Matrix_RotateY(32767.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vm.c", 1044), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_vm.c", 1044), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B2EB88[(globalCtx->gameplayFrames + 4) % 8])); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B2EB88[(play->gameplayFrames + 4) % 8])); gSPDisplayList(POLY_XLU_DISP++, gEffEnemyDeathFlameDL); } - gSPSegment(POLY_OPA_DISP++, 0x08, func_80094E78(globalCtx->state.gfxCtx, 0, this->beamTexScroll)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80094E78(play->state.gfxCtx, 0, this->beamTexScroll)); Matrix_Translate(this->beamPos1.x, this->beamPos1.y, this->beamPos1.z, MTXMODE_NEW); Matrix_RotateZYX(this->beamRot.x, this->beamRot.y, this->beamRot.z, MTXMODE_APPLY); Matrix_Scale(this->beamScale.x * 0.1f, this->beamScale.x * 0.1f, this->beamScale.z * 0.0015f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vm.c", 1063), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_vm.c", 1063), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBeamosLaserDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_vm.c", 1068); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_vm.c", 1068); } diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.h b/src/overlays/actors/ovl_En_Vm/z_en_vm.h index b7bd00e8c7..2be67637c5 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.h +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.h @@ -6,7 +6,7 @@ struct EnVm; -typedef void (*EnVmActionFunc)(struct EnVm*, GlobalContext*); +typedef void (*EnVmActionFunc)(struct EnVm*, PlayState*); typedef struct EnVm { /* 0x0000 */ Actor 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 be4ffce2d6..58eef0e15d 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 @@ -12,13 +12,13 @@ #define FLAGS ACTOR_FLAG_4 -void EnWallTubo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWallTubo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWallTubo_Update(Actor* thisx, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); -void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx); -void EnWallTubo_SetWallFall(EnWallTubo* this, GlobalContext* globalCtx); +void EnWallTubo_FindGirl(EnWallTubo* this, PlayState* play); +void EnWallTubo_DetectChu(EnWallTubo* this, PlayState* play); +void EnWallTubo_SetWallFall(EnWallTubo* this, PlayState* play); const ActorInit En_Wall_Tubo_InitVars = { ACTOR_EN_WALL_TUBO, @@ -32,7 +32,7 @@ const ActorInit En_Wall_Tubo_InitVars = { NULL, }; -void EnWallTubo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWallTubo_Init(Actor* thisx, PlayState* play) { EnWallTubo* this = (EnWallTubo*)thisx; osSyncPrintf("\n\n"); @@ -42,13 +42,13 @@ void EnWallTubo_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnWallTubo_FindGirl; } -void EnWallTubo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWallTubo_Destroy(Actor* thisx, PlayState* play) { } -void EnWallTubo_FindGirl(EnWallTubo* this, GlobalContext* globalCtx) { +void EnWallTubo_FindGirl(EnWallTubo* this, PlayState* play) { Actor* lookForGirl; - lookForGirl = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + lookForGirl = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (lookForGirl != NULL) { if (lookForGirl->id != ACTOR_EN_BOM_BOWL_MAN) { @@ -62,7 +62,7 @@ void EnWallTubo_FindGirl(EnWallTubo* this, GlobalContext* globalCtx) { this->actionFunc = EnWallTubo_DetectChu; } -void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx) { +void EnWallTubo_DetectChu(EnWallTubo* this, PlayState* play) { EnBomChu* chu; s32 pad; Vec3f effAccel = { 0.0f, 0.1f, 0.0f }; @@ -71,8 +71,8 @@ void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx) { s16 quakeIndex; if (this->chuGirl->minigamePlayStatus != 0) { - if (globalCtx->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING) { - chu = (EnBomChu*)globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + 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)) { @@ -90,8 +90,8 @@ void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx) { chu->timer = 2; func_80078884(NA_SE_SY_TRE_BOX_APPEAR); this->timer = 60; - EffectSsBomb2_SpawnLayered(globalCtx, &this->explosionCenter, &effVelocity, &effAccel, 200, 40); - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); + EffectSsBomb2_SpawnLayered(play, &this->explosionCenter, &effVelocity, &effAccel, 200, 40); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1); Quake_SetSpeed(quakeIndex, 0x7FFF); Quake_SetQuakeValues(quakeIndex, 100, 0, 0, 0); Quake_SetCountdown(quakeIndex, 100); @@ -105,18 +105,18 @@ void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx) { } } -void EnWallTubo_SetWallFall(EnWallTubo* this, GlobalContext* globalCtx) { +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 ((globalCtx->gameplayFrames & 1) == 0) { + 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(globalCtx, &effPos, &effVelocity, &effAccel, 100, 30); - EffectSsHahen_SpawnBurst(globalCtx, &effPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsBomb2_SpawnLayered(play, &effPos, &effVelocity, &effAccel, 100, 30); + EffectSsHahen_SpawnBurst(play, &effPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); } @@ -137,18 +137,18 @@ void EnWallTubo_SetWallFall(EnWallTubo* this, GlobalContext* globalCtx) { } } -void EnWallTubo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWallTubo_Update(Actor* thisx, PlayState* play) { EnWallTubo* this = (EnWallTubo*)thisx; if (this->timer != 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (BREG(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, globalCtx->state.gfxCtx); + 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 e1de7c8818..1e7eead00b 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 @@ -7,7 +7,7 @@ struct EnWallTubo; -typedef void (*EnWallTuboActionFunc)(struct EnWallTubo*, GlobalContext*); +typedef void (*EnWallTuboActionFunc)(struct EnWallTubo*, PlayState*); typedef struct EnWallTubo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 0bbda6c5b0..b50e243de8 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -16,27 +16,27 @@ #define DAMAGE_EFFECT_STUN_WHITE 4 #define DAMAGE_EFFECT_STUN_BLUE 1 -void EnWallmas_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWallmas_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWallmas_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWallmas_Init(Actor* thisx, PlayState* play); +void EnWallmas_Destroy(Actor* thisx, PlayState* play); +void EnWallmas_Update(Actor* thisx, PlayState* play); +void EnWallmas_Draw(Actor* thisx, PlayState* play); -void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx); +void EnWallmas_TimerInit(EnWallmas* this, PlayState* play); void EnWallmas_ProximityOrSwitchInit(EnWallmas* this); -void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Drop(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Land(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Stand(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_JumpToCeiling(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_TakeDamage(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Cooldown(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Die(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_WaitForProximity(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_WaitForSwitchFlag(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx); +void EnWallmas_WaitToDrop(EnWallmas* this, PlayState* play); +void EnWallmas_Drop(EnWallmas* this, PlayState* play); +void EnWallmas_Land(EnWallmas* this, PlayState* play); +void EnWallmas_Stand(EnWallmas* this, PlayState* play); +void EnWallmas_JumpToCeiling(EnWallmas* this, PlayState* play); +void EnWallmas_ReturnToCeiling(EnWallmas* this, PlayState* play); +void EnWallmas_TakeDamage(EnWallmas* this, PlayState* play); +void EnWallmas_Cooldown(EnWallmas* this, PlayState* play); +void EnWallmas_Die(EnWallmas* this, PlayState* play); +void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play); +void EnWallmas_WaitForProximity(EnWallmas* this, PlayState* play); +void EnWallmas_WaitForSwitchFlag(EnWallmas* this, PlayState* play); +void EnWallmas_Stun(EnWallmas* this, PlayState* play); +void EnWallmas_Walk(EnWallmas* this, PlayState* play); const ActorInit En_Wallmas_InitVars = { ACTOR_EN_WALLMAS, @@ -113,22 +113,22 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1500, ICHAIN_STOP), }; -void EnWallmas_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWallmas_Init(Actor* thisx, PlayState* play) { EnWallmas* this = (EnWallmas*)thisx; Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0, NULL, 0.5f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWallmasterSkel, &gWallmasterWaitAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWallmasterSkel, &gWallmasterWaitAnim, this->jointTable, this->morphTable, 25); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); this->switchFlag = (u8)(thisx->params >> 0x8); thisx->params = thisx->params & 0xFF; if (thisx->params == WMT_FLAG) { - if (Flags_GetSwitch(globalCtx, this->switchFlag) != 0) { + if (Flags_GetSwitch(play, this->switchFlag) != 0) { Actor_Kill(thisx); return; } @@ -137,18 +137,18 @@ void EnWallmas_Init(Actor* thisx, GlobalContext* globalCtx) { } else if (thisx->params == WMT_PROXIMITY) { EnWallmas_ProximityOrSwitchInit(this); } else { - EnWallmas_TimerInit(this, globalCtx); + EnWallmas_TimerInit(this, play); } } -void EnWallmas_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWallmas_Destroy(Actor* thisx, PlayState* play) { EnWallmas* this = (EnWallmas*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_TimerInit(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.flags &= ~ACTOR_FLAG_0; this->actor.flags |= ACTOR_FLAG_5; @@ -160,8 +160,8 @@ void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx) { this->actionFunc = EnWallmas_WaitToDrop; } -void EnWallmas_SetupDrop(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_SetupDrop(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); AnimationHeader* objSegChangee = &gWallmasterLungeAnim; Animation_Change(&this->skelAnime, objSegChangee, 0.0f, 20.0f, Animation_GetLastFrame(&gWallmasterLungeAnim), @@ -176,14 +176,14 @@ void EnWallmas_SetupDrop(EnWallmas* this, GlobalContext* globalCtx) { this->actionFunc = EnWallmas_Drop; } -void EnWallmas_SetupLand(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_SetupLand(EnWallmas* this, PlayState* play) { AnimationHeader* objSegFrameCount = &gWallmasterJumpAnim; AnimationHeader* objSegChangee = &gWallmasterJumpAnim; Animation_Change(&this->skelAnime, objSegChangee, 1.0f, 41.0f, Animation_GetLastFrame(objSegFrameCount), ANIMMODE_ONCE, -3.0f); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, true); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_LAND); this->actionFunc = EnWallmas_Land; } @@ -239,19 +239,19 @@ void EnWallmas_SetupCooldown(EnWallmas* this) { this->actionFunc = EnWallmas_Cooldown; } -void EnWallmas_SetupDie(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_SetupDie(EnWallmas* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; - EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &zeroVec, &zeroVec, 250, -10, 255, 255, 255, 255, 0, 0, 255, - 1, 9, true); + EffectSsDeadDb_Spawn(play, &this->actor.world.pos, &zeroVec, &zeroVec, 250, -10, 255, 255, 255, 255, 0, 0, 255, 1, + 9, true); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xC0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xC0); this->actionFunc = EnWallmas_Die; } -void EnWallmas_SetupTakePlayer(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_SetupTakePlayer(EnWallmas* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gWallmasterHoverAnim, -5.0f); this->timer = -0x1E; this->actionFunc = EnWallmas_TakePlayer; @@ -259,8 +259,8 @@ void EnWallmas_SetupTakePlayer(EnWallmas* this, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; this->yTarget = this->actor.yDistToPlayer; - func_8002DF38(globalCtx, &this->actor, 0x25); - OnePointCutscene_Init(globalCtx, 9500, 9999, &this->actor, CAM_ID_MAIN); + func_8002DF38(play, &this->actor, 0x25); + OnePointCutscene_Init(play, 9500, 9999, &this->actor, CAM_ID_MAIN); } void EnWallmas_ProximityOrSwitchInit(EnWallmas* this) { @@ -289,8 +289,8 @@ void EnWallmas_SetupStun(EnWallmas* this) { this->actionFunc = EnWallmas_Stun; } -void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_WaitToDrop(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f* playerPos = &player->actor.world.pos; this->actor.world.pos = *playerPos; @@ -313,27 +313,27 @@ void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) { } if (this->timer == 0) { - EnWallmas_SetupDrop(this, globalCtx); + EnWallmas_SetupDrop(this, play); } } -void EnWallmas_Drop(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_Drop(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (!Player_InCsMode(globalCtx) && !(player->stateFlags2 & PLAYER_STATE2_4) && (player->invincibilityTimer >= 0) && + if (!Player_InCsMode(play) && !(player->stateFlags2 & PLAYER_STATE2_4) && (player->invincibilityTimer >= 0) && (this->actor.xzDistToPlayer < 30.0f) && (this->actor.yDistToPlayer < -5.0f) && (-(f32)(player->cylinder.dim.height + 10) < this->actor.yDistToPlayer)) { - EnWallmas_SetupTakePlayer(this, globalCtx); + EnWallmas_SetupTakePlayer(this, play); } } -void EnWallmas_Land(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Land(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnWallmas_SetupStand(this); } } -void EnWallmas_Stand(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Stand(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnWallmas_SetupWalk(this); } @@ -341,7 +341,7 @@ void EnWallmas_Stand(EnWallmas* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 0xB6); } -void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Walk(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnWallmas_SetupJumpToCeiling(this); } @@ -354,14 +354,14 @@ void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx) { } } -void EnWallmas_JumpToCeiling(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_JumpToCeiling(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnWallmas_SetupReturnToCeiling(this); } } -void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_ReturnToCeiling(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->skelAnime.curFrame > 20.0f) { this->timer += 9; @@ -380,17 +380,17 @@ void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx) { if (this->actor.params == WMT_TIMER || Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 200.0f) { - EnWallmas_TimerInit(this, globalCtx); + EnWallmas_TimerInit(this, play); } else { EnWallmas_ProximityOrSwitchInit(this); } } } -void EnWallmas_TakeDamage(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_TakeDamage(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->actor.colChkInfo.health == 0) { - EnWallmas_SetupDie(this, globalCtx); + EnWallmas_SetupDie(this, play); } else { EnWallmas_SetupCooldown(this); } @@ -402,24 +402,24 @@ void EnWallmas_TakeDamage(EnWallmas* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); } -void EnWallmas_Cooldown(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Cooldown(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { EnWallmas_SetupReturnToCeiling(this); } } -void EnWallmas_Die(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Die(EnWallmas* this, PlayState* play) { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0015) != 0) { Actor_SetScale(&this->actor, 0.01f); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xC0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xC0); Actor_Kill(&this->actor); } this->actor.scale.z = this->actor.scale.x; this->actor.scale.y = this->actor.scale.x; } -void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Animation_OnFrame(&this->skelAnime, 1.0f) != 0) { if (!LINK_IS_ADULT) { @@ -467,25 +467,25 @@ void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) { if (this->timer == 0x1E) { func_80078884(NA_SE_OC_ABYSS); - Play_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); } } -void EnWallmas_WaitForProximity(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_WaitForProximity(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 200.0f) { - EnWallmas_TimerInit(this, globalCtx); + EnWallmas_TimerInit(this, play); } } -void EnWallmas_WaitForSwitchFlag(EnWallmas* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag) != 0) { - EnWallmas_TimerInit(this, globalCtx); +void EnWallmas_WaitForSwitchFlag(EnWallmas* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag) != 0) { + EnWallmas_TimerInit(this, play); this->timer = 0x51; } } -void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Stun(EnWallmas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -493,20 +493,20 @@ void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx) { if (this->timer == 0) { if (this->actor.colChkInfo.health == 0) { - EnWallmas_SetupDie(this, globalCtx); + EnWallmas_SetupDie(this, play); } else { EnWallmas_SetupReturnToCeiling(this); } } } -void EnWallmas_ColUpdate(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_ColUpdate(EnWallmas* this, PlayState* play) { if ((this->collider.base.acFlags & AC_HIT) != 0) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, true); if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_DEAD); this->actor.flags &= ~ACTOR_FLAG_0; } else { @@ -522,7 +522,7 @@ void EnWallmas_ColUpdate(EnWallmas* this, GlobalContext* globalCtx) { } } else { if (this->actor.colChkInfo.damageEffect == DAMAGE_EFFECT_BURN) { - EffectSsFCircle_Spawn(globalCtx, &this->actor, &this->actor.world.pos, 40, 40); + EffectSsFCircle_Spawn(play, &this->actor, &this->actor.world.pos, 40, 40); } EnWallmas_SetupTakeDamage(this); @@ -531,12 +531,12 @@ void EnWallmas_ColUpdate(EnWallmas* this, GlobalContext* globalCtx) { } } -void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWallmas_Update(Actor* thisx, PlayState* play) { EnWallmas* this = (EnWallmas*)thisx; char pad[4]; - EnWallmas_ColUpdate(this, globalCtx); - this->actionFunc(this, globalCtx); + EnWallmas_ColUpdate(this, play); + this->actionFunc(this, play); if ((this->actionFunc == EnWallmas_WaitToDrop) || (this->actionFunc == EnWallmas_WaitForProximity) || (this->actionFunc == EnWallmas_TakePlayer) || (this->actionFunc == EnWallmas_WaitForSwitchFlag)) { @@ -548,22 +548,22 @@ void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionFunc != EnWallmas_Drop) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 25.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 25.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } else if (this->actor.world.pos.y <= this->yTarget) { this->actor.world.pos.y = this->yTarget; this->actor.velocity.y = 0.0f; - EnWallmas_SetupLand(this, globalCtx); + EnWallmas_SetupLand(this, play); } if ((this->actionFunc != EnWallmas_Die) && (this->actionFunc != EnWallmas_Drop)) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if ((this->actionFunc != EnWallmas_TakeDamage) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.freezeTimer == 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -576,7 +576,7 @@ void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnWallmas_DrawXlu(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_DrawXlu(EnWallmas* this, PlayState* play) { s32 pad; f32 xzScale; MtxF mf; @@ -585,9 +585,9 @@ void EnWallmas_DrawXlu(EnWallmas* this, GlobalContext* globalCtx) { return; } - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1386); + OPEN_DISPS(play->state.gfxCtx, "../z_en_wallmas.c", 1386); - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); func_80038A28(this->actor.floorPoly, this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, @@ -602,14 +602,13 @@ void EnWallmas_DrawXlu(EnWallmas* this, GlobalContext* globalCtx) { } Matrix_Scale(xzScale, 1.0f, xzScale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1421), G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_wallmas.c", 1421), G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1426); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_wallmas.c", 1426); } -s32 EnWallMas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnWallMas_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnWallmas* this = (EnWallmas*)thisx; if (limbIndex == 1) { @@ -622,9 +621,9 @@ s32 EnWallMas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnWallMas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnWallMas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { if (limbIndex == 2) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1478); + OPEN_DISPS(play->state.gfxCtx, "../z_en_wallmas.c", 1478); Matrix_Push(); Matrix_Translate(1600.0f, -700.0f, -1700.0f, MTXMODE_APPLY); @@ -632,23 +631,23 @@ void EnWallMas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList Matrix_RotateZ(DEG_TO_RAD(15), MTXMODE_APPLY); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1489), G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_wallmas.c", 1489), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gWallmasterFingerDL); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1495); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_wallmas.c", 1495); } } -void EnWallmas_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnWallmas_Draw(Actor* thisx, PlayState* play) { EnWallmas* this = (EnWallmas*)thisx; if (this->actionFunc != EnWallmas_WaitToDrop) { - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnWallMas_OverrideLimbDraw, EnWallMas_PostLimbDraw, this); + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnWallMas_OverrideLimbDraw, EnWallMas_PostLimbDraw, this); } - EnWallmas_DrawXlu(this, globalCtx); + EnWallmas_DrawXlu(this, play); } diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h index fde6f4bb48..8b2f8d7ba9 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h @@ -12,7 +12,7 @@ typedef enum { struct EnWallmas; -typedef void (*EnWallmasActionFunc)(struct EnWallmas*, GlobalContext*); +typedef void (*EnWallmasActionFunc)(struct EnWallmas*, PlayState*); typedef struct EnWallmas { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 3d904c28f9..9d03e485d2 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -9,25 +9,25 @@ #define FLAGS ACTOR_FLAG_4 -void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWeatherTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx); +void EnWeatherTag_Init(Actor* thisx, PlayState* play); +void EnWeatherTag_Destroy(Actor* thisx, PlayState* play); +void EnWeatherTag_Update(Actor* thisx, PlayState* play); -void EnWeatherTag_DisabledCloudyHyruleMarket(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledCloudyHyruleMarket(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledCloudyLonLonRanch(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledCloudyLonLonRanch(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledCloudySnow(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledCloudySnow(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledRainLakeHylia(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledRainLakeHylia(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledCloudyDeathMountain(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledCloudyDeathMountain(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_SetSandstormIntensity(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DisabledRainThunder(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_EnabledRainThunder(EnWeatherTag* this, GlobalContext* globalCtx); +void EnWeatherTag_DisabledCloudyHyruleMarket(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledCloudyHyruleMarket(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledCloudyLonLonRanch(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledCloudyLonLonRanch(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledCloudySnow(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledCloudySnow(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledRainLakeHylia(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledRainLakeHylia(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledCloudyDeathMountain(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledCloudyDeathMountain(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledCloudyRainThunderKakariko(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledCloudyRainThunderKakariko(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_SetSandstormIntensity(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DisabledRainThunder(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_EnabledRainThunder(EnWeatherTag* this, PlayState* play); #define WEATHER_TAG_RANGE100(x) ((x >> 8) * 100.0f) @@ -47,10 +47,10 @@ void EnWeatherTag_SetupAction(EnWeatherTag* this, EnWeatherTagActionFunc actionF this->actionFunc = actionFunc; } -void EnWeatherTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWeatherTag_Destroy(Actor* thisx, PlayState* play) { } -void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWeatherTag_Init(Actor* thisx, PlayState* play) { EnWeatherTag* this = (EnWeatherTag*)thisx; this->actor.flags &= ~ACTOR_FLAG_0; @@ -127,35 +127,33 @@ void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx) { } } -u8 WeatherTag_CheckEnableWeatherEffect(EnWeatherTag* this, GlobalContext* globalCtx, u8 skyboxConfig, - u8 changeSkyboxNextConfig, u8 lightConfig, u8 changeLightNextConfig, - u16 changeDuration, u8 weatherMode) { +u8 WeatherTag_CheckEnableWeatherEffect(EnWeatherTag* this, PlayState* play, u8 skyboxConfig, u8 changeSkyboxNextConfig, + u8 lightConfig, u8 changeLightNextConfig, u16 changeDuration, u8 weatherMode) { s32 pad; u8 ret = false; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this->actor.params)) { - if ((globalCtx->envCtx.lightMode != LIGHT_MODE_TIME) || !gSkyboxIsChanging || - (globalCtx->skyboxId != SKYBOX_NORMAL_SKY && - globalCtx->envCtx.lightConfig == globalCtx->envCtx.changeLightNextConfig)) { + if ((play->envCtx.lightMode != LIGHT_MODE_TIME) || !gSkyboxIsChanging || + (play->skyboxId != SKYBOX_NORMAL_SKY && play->envCtx.lightConfig == play->envCtx.changeLightNextConfig)) { gInterruptSongOfStorms = true; - if (globalCtx->envCtx.stormRequest == STORM_REQUEST_NONE && - ((globalCtx->envCtx.lightMode != LIGHT_MODE_TIME) || - (globalCtx->envCtx.lightConfig != 1 && !globalCtx->envCtx.changeLightEnabled))) { + if (play->envCtx.stormRequest == STORM_REQUEST_NONE && + ((play->envCtx.lightMode != LIGHT_MODE_TIME) || + (play->envCtx.lightConfig != 1 && !play->envCtx.changeLightEnabled))) { gInterruptSongOfStorms = false; if (gWeatherMode != weatherMode) { gWeatherMode = weatherMode; - if (globalCtx->envCtx.stormRequest == STORM_REQUEST_NONE) { - globalCtx->envCtx.changeSkyboxState = CHANGE_SKYBOX_REQUESTED; - globalCtx->envCtx.skyboxConfig = skyboxConfig; - globalCtx->envCtx.changeSkyboxNextConfig = changeSkyboxNextConfig; - globalCtx->envCtx.changeSkyboxTimer = changeDuration; - globalCtx->envCtx.changeLightEnabled = true; - globalCtx->envCtx.lightConfig = lightConfig; - globalCtx->envCtx.changeLightNextConfig = changeLightNextConfig; + if (play->envCtx.stormRequest == STORM_REQUEST_NONE) { + play->envCtx.changeSkyboxState = CHANGE_SKYBOX_REQUESTED; + play->envCtx.skyboxConfig = skyboxConfig; + play->envCtx.changeSkyboxNextConfig = changeSkyboxNextConfig; + play->envCtx.changeSkyboxTimer = changeDuration; + play->envCtx.changeLightEnabled = true; + play->envCtx.lightConfig = lightConfig; + play->envCtx.changeLightNextConfig = changeLightNextConfig; gLightConfigAfterUnderwater = changeLightNextConfig; - globalCtx->envCtx.changeDuration = changeDuration; - globalCtx->envCtx.changeLightTimer = globalCtx->envCtx.changeDuration; + play->envCtx.changeDuration = changeDuration; + play->envCtx.changeLightTimer = play->envCtx.changeDuration; } } ret = true; @@ -170,33 +168,31 @@ u8 WeatherTag_CheckEnableWeatherEffect(EnWeatherTag* this, GlobalContext* global return ret; } -u8 WeatherTag_CheckRestoreWeather(EnWeatherTag* this, GlobalContext* globalCtx, u8 skyboxConfig, - u8 changeSkyboxNextConfig, u8 lightConfig, u8 changeLightNextConfig, - u16 changeDuration) { +u8 WeatherTag_CheckRestoreWeather(EnWeatherTag* this, PlayState* play, u8 skyboxConfig, u8 changeSkyboxNextConfig, + u8 lightConfig, u8 changeLightNextConfig, u16 changeDuration) { s32 pad; u8 ret = false; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((WEATHER_TAG_RANGE100(this->actor.params) + 100.0f) < Actor_WorldDistXZToActor(&player->actor, &this->actor)) { - if ((globalCtx->envCtx.lightMode != LIGHT_MODE_TIME) || !gSkyboxIsChanging || - (globalCtx->skyboxId != SKYBOX_NORMAL_SKY && - globalCtx->envCtx.lightConfig == globalCtx->envCtx.changeLightNextConfig)) { + if ((play->envCtx.lightMode != LIGHT_MODE_TIME) || !gSkyboxIsChanging || + (play->skyboxId != SKYBOX_NORMAL_SKY && play->envCtx.lightConfig == play->envCtx.changeLightNextConfig)) { gInterruptSongOfStorms = true; - if ((globalCtx->envCtx.stormRequest == STORM_REQUEST_NONE) && - ((globalCtx->envCtx.lightMode != LIGHT_MODE_TIME) || - (globalCtx->envCtx.lightConfig != 1 && !globalCtx->envCtx.changeLightEnabled))) { + if ((play->envCtx.stormRequest == STORM_REQUEST_NONE) && + ((play->envCtx.lightMode != LIGHT_MODE_TIME) || + (play->envCtx.lightConfig != 1 && !play->envCtx.changeLightEnabled))) { gInterruptSongOfStorms = false; gWeatherMode = WEATHER_MODE_CLEAR; - globalCtx->envCtx.changeSkyboxState = CHANGE_SKYBOX_REQUESTED; - globalCtx->envCtx.skyboxConfig = skyboxConfig; - globalCtx->envCtx.changeSkyboxNextConfig = changeSkyboxNextConfig; - globalCtx->envCtx.changeSkyboxTimer = changeDuration; - globalCtx->envCtx.changeLightEnabled = true; - globalCtx->envCtx.lightConfig = lightConfig; - globalCtx->envCtx.changeLightNextConfig = changeLightNextConfig; + play->envCtx.changeSkyboxState = CHANGE_SKYBOX_REQUESTED; + play->envCtx.skyboxConfig = skyboxConfig; + play->envCtx.changeSkyboxNextConfig = changeSkyboxNextConfig; + play->envCtx.changeSkyboxTimer = changeDuration; + play->envCtx.changeLightEnabled = true; + play->envCtx.lightConfig = lightConfig; + play->envCtx.changeLightNextConfig = changeLightNextConfig; gLightConfigAfterUnderwater = changeLightNextConfig; - globalCtx->envCtx.changeDuration = changeDuration; - globalCtx->envCtx.changeLightTimer = globalCtx->envCtx.changeDuration; + play->envCtx.changeDuration = changeDuration; + play->envCtx.changeLightTimer = play->envCtx.changeDuration; ret = true; } @@ -207,132 +203,132 @@ u8 WeatherTag_CheckRestoreWeather(EnWeatherTag* this, GlobalContext* globalCtx, return ret; } -void EnWeatherTag_DisabledCloudyHyruleMarket(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 3, 60, WEATHER_MODE_CLOUDY_CONFIG3)) { +void EnWeatherTag_DisabledCloudyHyruleMarket(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 3, 60, WEATHER_MODE_CLOUDY_CONFIG3)) { EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledCloudyHyruleMarket); } } -void EnWeatherTag_EnabledCloudyHyruleMarket(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 3, 0, 60)) { +void EnWeatherTag_EnabledCloudyHyruleMarket(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 3, 0, 60)) { EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudyHyruleMarket); } } -void EnWeatherTag_DisabledCloudyLonLonRanch(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 2, 100, WEATHER_MODE_CLOUDY_CONFIG2)) { +void EnWeatherTag_DisabledCloudyLonLonRanch(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 2, 100, WEATHER_MODE_CLOUDY_CONFIG2)) { EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledCloudyLonLonRanch); } } -void EnWeatherTag_EnabledCloudyLonLonRanch(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 2, 0, 100)) { +void EnWeatherTag_EnabledCloudyLonLonRanch(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 2, 0, 100)) { EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudyLonLonRanch); } } -void EnWeatherTag_DisabledCloudyDeathMountain(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 2, 60, WEATHER_MODE_CLOUDY_CONFIG2)) { +void EnWeatherTag_DisabledCloudyDeathMountain(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 2, 60, WEATHER_MODE_CLOUDY_CONFIG2)) { EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledCloudyDeathMountain); } } -void EnWeatherTag_EnabledCloudyDeathMountain(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 2, 0, 60)) { +void EnWeatherTag_EnabledCloudyDeathMountain(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 2, 0, 60)) { EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudyLonLonRanch); } } -void EnWeatherTag_DisabledCloudySnow(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 2, 60, WEATHER_MODE_SNOW)) { - globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX] = 64; +void EnWeatherTag_DisabledCloudySnow(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 2, 60, WEATHER_MODE_SNOW)) { + play->envCtx.precipitation[PRECIP_SNOW_MAX] = 64; EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledCloudySnow); } } -void EnWeatherTag_EnabledCloudySnow(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 2, 0, 60)) { - globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; +void EnWeatherTag_EnabledCloudySnow(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 2, 0, 60)) { + play->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudySnow); } } -void EnWeatherTag_DisabledRainLakeHylia(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 2, 100, WEATHER_MODE_RAIN)) { - Environment_PlayStormNatureAmbience(globalCtx); - globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] = 25; +void EnWeatherTag_DisabledRainLakeHylia(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 2, 100, WEATHER_MODE_RAIN)) { + Environment_PlayStormNatureAmbience(play); + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 25; EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledRainLakeHylia); } } -void EnWeatherTag_EnabledRainLakeHylia(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 2, 0, 100)) { - Environment_StopStormNatureAmbience(globalCtx); - globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; +void EnWeatherTag_EnabledRainLakeHylia(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 2, 0, 100)) { + Environment_StopStormNatureAmbience(play); + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledRainLakeHylia); } } -void EnWeatherTag_DisabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 4, 100, WEATHER_MODE_HEAVY_RAIN)) { - Environment_PlayStormNatureAmbience(globalCtx); - globalCtx->envCtx.lightningState = LIGHTNING_ON; - globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] = 30; +void EnWeatherTag_DisabledCloudyRainThunderKakariko(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckEnableWeatherEffect(this, play, 0, 1, 0, 4, 100, WEATHER_MODE_HEAVY_RAIN)) { + Environment_PlayStormNatureAmbience(play); + play->envCtx.lightningState = LIGHTNING_ON; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 30; EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledCloudyRainThunderKakariko); } } -void EnWeatherTag_EnabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalContext* globalCtx) { - if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 4, 0, 100)) { - Environment_StopStormNatureAmbience(globalCtx); - globalCtx->envCtx.lightningState = LIGHTNING_LAST; - globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; +void EnWeatherTag_EnabledCloudyRainThunderKakariko(EnWeatherTag* this, PlayState* play) { + if (WeatherTag_CheckRestoreWeather(this, play, 1, 0, 4, 0, 100)) { + Environment_StopStormNatureAmbience(play); + play->envCtx.lightningState = LIGHTNING_LAST; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudyRainThunderKakariko); } } -void EnWeatherTag_SetSandstormIntensity(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWeatherTag_SetSandstormIntensity(EnWeatherTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this->actor.params)) { - Math_SmoothStepToS(&globalCtx->envCtx.adjFogNear, -0x50, 1, 2, 1); - Math_SmoothStepToS(&globalCtx->envCtx.adjFogFar, -0x7D0, 1, 50, 1); + Math_SmoothStepToS(&play->envCtx.adjFogNear, -0x50, 1, 2, 1); + Math_SmoothStepToS(&play->envCtx.adjFogFar, -0x7D0, 1, 50, 1); } else { - Math_SmoothStepToS(&globalCtx->envCtx.adjFogNear, 0, 1, 1, 1); - Math_SmoothStepToS(&globalCtx->envCtx.adjFogFar, 0, 1, 25, 1); + Math_SmoothStepToS(&play->envCtx.adjFogNear, 0, 1, 1, 1); + Math_SmoothStepToS(&play->envCtx.adjFogFar, 0, 1, 25, 1); } } -void EnWeatherTag_DisabledRainThunder(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWeatherTag_DisabledRainThunder(EnWeatherTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this->actor.params)) { - Environment_PlayStormNatureAmbience(globalCtx); - globalCtx->envCtx.lightningState = LIGHTNING_ON; - globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] = 25; + Environment_PlayStormNatureAmbience(play); + play->envCtx.lightningState = LIGHTNING_ON; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 25; EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledRainThunder); } } -void EnWeatherTag_EnabledRainThunder(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWeatherTag_EnabledRainThunder(EnWeatherTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((WEATHER_TAG_RANGE100(this->actor.params) + 10.0f) < Actor_WorldDistXZToActor(&player->actor, &this->actor)) { - Environment_StopStormNatureAmbience(globalCtx); - globalCtx->envCtx.lightningState = LIGHTNING_LAST; - globalCtx->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; - globalCtx->envCtx.precipitation[PRECIP_RAIN_CUR] = 10; + Environment_StopStormNatureAmbience(play); + play->envCtx.lightningState = LIGHTNING_LAST; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; + play->envCtx.precipitation[PRECIP_RAIN_CUR] = 10; EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledRainThunder); } } -void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWeatherTag_Update(Actor* thisx, PlayState* play) { EnWeatherTag* this = (EnWeatherTag*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (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, globalCtx->state.gfxCtx); + 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h index 791bf67f9c..ec7c177341 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h @@ -6,7 +6,7 @@ struct EnWeatherTag; -typedef void (*EnWeatherTagActionFunc)(struct EnWeatherTag*, GlobalContext*); +typedef void (*EnWeatherTagActionFunc)(struct EnWeatherTag*, PlayState*); typedef struct EnWeatherTag { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c index 0ea7f4c185..2a133831dc 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c @@ -9,22 +9,22 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) -void EnWeiyer_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWeiyer_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWeiyer_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWeiyer_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWeiyer_Init(Actor* thisx, PlayState* play); +void EnWeiyer_Destroy(Actor* thisx, PlayState* play); +void EnWeiyer_Update(Actor* thisx, PlayState* play); +void EnWeiyer_Draw(Actor* thisx, PlayState* play); -void func_80B32804(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B32C2C(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B32D30(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B32E34(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B33018(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B331CC(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B333B8(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B332B4(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B33338(EnWeiyer* this, GlobalContext* globalCtx); -void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx); +void func_80B32804(EnWeiyer* this, PlayState* play); +void func_80B328E8(EnWeiyer* this, PlayState* play); +void func_80B32C2C(EnWeiyer* this, PlayState* play); +void func_80B32D30(EnWeiyer* this, PlayState* play); +void func_80B32E34(EnWeiyer* this, PlayState* play); +void func_80B33018(EnWeiyer* this, PlayState* play); +void func_80B331CC(EnWeiyer* this, PlayState* play); +void func_80B333B8(EnWeiyer* this, PlayState* play); +void func_80B332B4(EnWeiyer* this, PlayState* play); +void func_80B33338(EnWeiyer* this, PlayState* play); +void func_80B3349C(EnWeiyer* this, PlayState* play); const ActorInit En_Weiyer_InitVars = { ACTOR_EN_WEIYER, @@ -101,23 +101,22 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2500, ICHAIN_STOP), }; -void EnWeiyer_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWeiyer_Init(Actor* thisx, PlayState* play) { EnWeiyer* this = (EnWeiyer*)thisx; Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&this->actor.shape, 1000.0f, ActorShadow_DrawCircle, 65.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gStingerSkel, &gStingerIdleAnim, this->jointTable, this->morphTable, - 19); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_Init(play, &this->skelAnime, &gStingerSkel, &gStingerIdleAnim, this->jointTable, this->morphTable, 19); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->actionFunc = func_80B32804; } -void EnWeiyer_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWeiyer_Destroy(Actor* thisx, PlayState* play) { EnWeiyer* this = (EnWeiyer*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80B32384(EnWeiyer* this) { @@ -213,15 +212,15 @@ void func_80B327D8(EnWeiyer* this) { this->actionFunc = func_80B3349C; } -void func_80B32804(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B32804(EnWeiyer* this, PlayState* play) { WaterBox* waterBox; s32 bgId; this->actor.world.pos.y += 0.5f; - this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, - &this->actor, &this->actor.world.pos); + this->actor.floorHeight = + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); - if (!WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + if (!WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->actor.home.pos.y, &waterBox) || ((this->actor.home.pos.y - 5.0f) <= this->actor.floorHeight)) { Actor_Kill(&this->actor); @@ -232,7 +231,7 @@ void func_80B32804(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B328E8(EnWeiyer* this, PlayState* play) { s32 sp34; f32 curFrame; @@ -279,7 +278,7 @@ void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx) { Rand_ZeroOne() * ((this->actor.home.pos.y - this->actor.floorHeight) / 2.0f) + this->actor.floorHeight; } } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_280 = @@ -296,7 +295,7 @@ void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B32C2C(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B32C2C(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_194 == 0) { @@ -312,7 +311,7 @@ void func_80B32C2C(EnWeiyer* this, GlobalContext* globalCtx) { if (this->actor.world.pos.y < this->actor.home.pos.y) { if (this->actor.shape.rot.x > 0) { - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 400); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 400); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_SINK); } @@ -323,7 +322,7 @@ void func_80B32C2C(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B32D30(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B32D30(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { @@ -344,8 +343,8 @@ void func_80B32D30(EnWeiyer* this, GlobalContext* globalCtx) { } } -s16 func_80B32DEC(EnWeiyer* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s16 func_80B32DEC(EnWeiyer* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f vec; vec.x = player->actor.world.pos.x; @@ -355,8 +354,8 @@ s16 func_80B32DEC(EnWeiyer* this, GlobalContext* globalCtx) { return Actor_WorldPitchTowardPoint(&this->actor, &vec); } -void func_80B32E34(EnWeiyer* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B32E34(EnWeiyer* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); @@ -384,7 +383,7 @@ void func_80B32E34(EnWeiyer* this, GlobalContext* globalCtx) { this->actor.world.pos.y = this->actor.home.pos.y; Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1000, 2, 0x100, 0x40); } else { - Math_SmoothStepToS(&this->actor.shape.rot.x, func_80B32DEC(this, globalCtx), 2, 0x100, 0x40); + Math_SmoothStepToS(&this->actor.shape.rot.x, func_80B32DEC(this, play), 2, 0x100, 0x40); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x200, 0x80); @@ -396,7 +395,7 @@ void func_80B32E34(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B33018(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B33018(EnWeiyer* this, PlayState* play) { f32 curFrame; SkelAnime_Update(&this->skelAnime); @@ -437,7 +436,7 @@ void func_80B33018(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B331CC(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B331CC(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_194 != 0) { @@ -461,7 +460,7 @@ void func_80B331CC(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B332B4(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B332B4(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x400); this->actor.shape.rot.z += 0x1000; @@ -475,17 +474,17 @@ void func_80B332B4(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B33338(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B33338(EnWeiyer* this, PlayState* play) { this->actor.shape.shadowAlpha = CLAMP_MIN((s16)(this->actor.shape.shadowAlpha - 5), 0); this->actor.world.pos.y -= 2.0f; if (this->actor.shape.shadowAlpha == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); Actor_Kill(&this->actor); } } -void func_80B333B8(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B333B8(EnWeiyer* this, PlayState* play) { if (this->unk_194 != 0) { this->unk_194--; } @@ -512,8 +511,8 @@ void func_80B333B8(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B3349C(EnWeiyer* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a1; s32 phi_a0; @@ -526,7 +525,7 @@ void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { func_80B32538(this); } else if (this->actor.yDistToWater < 0.0f) { this->unk_194 = 10; - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 400); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 400); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_JUMP); } } else { @@ -539,7 +538,7 @@ void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { if (this->unk_194 == 0) { phi_a1 = 0x1800; } else { - phi_a1 = func_80B32DEC(this, globalCtx); + phi_a1 = func_80B32DEC(this, play); phi_a1 = CLAMP_MIN(phi_a1, 0); } @@ -550,7 +549,7 @@ void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80B32434(this); } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.shape.rot.x > 0)) { - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 400); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 400); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_SINK); func_80B32538(this); } else { @@ -559,7 +558,7 @@ void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { } } -void func_80B3368C(EnWeiyer* this, GlobalContext* globalCtx) { +void func_80B3368C(EnWeiyer* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info, true); @@ -570,7 +569,7 @@ void func_80B3368C(EnWeiyer* this, GlobalContext* globalCtx) { func_80B32660(this); } } else if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_EIER_DEAD); this->actor.flags &= ~ACTOR_FLAG_0; func_80B32724(this); @@ -581,13 +580,13 @@ void func_80B3368C(EnWeiyer* this, GlobalContext* globalCtx) { } } -void EnWeiyer_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWeiyer_Update(Actor* thisx, PlayState* play) { EnWeiyer* this = (EnWeiyer*)thisx; s32 pad; this->actor.home.pos.y = this->actor.yDistToWater + this->actor.world.pos.y - 5.0f; - func_80B3368C(this, globalCtx); - this->actionFunc(this, globalCtx); + func_80B3368C(this, play); + this->actionFunc(this, play); this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.world.rot.x = -this->actor.shape.rot.x; @@ -597,7 +596,7 @@ void EnWeiyer_Update(Actor* thisx, GlobalContext* globalCtx) { func_8002D97C(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 30.0f, 45.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 30.0f, 45.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); Actor_SetFocus(&this->actor, 0.0f); @@ -609,17 +608,17 @@ void EnWeiyer_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider); if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->collider.base.acFlags & AT_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnWeiyer_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnWeiyer_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { if (limbIndex == 1) { pos->z += 2000.0f; @@ -628,24 +627,24 @@ s32 EnWeiyer_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return 0; } -void EnWeiyer_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnWeiyer_Draw(Actor* thisx, PlayState* play) { EnWeiyer* this = (EnWeiyer*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_weiyer.c", 1193); + OPEN_DISPS(play->state.gfxCtx, "../z_en_weiyer.c", 1193); if (this->actionFunc != func_80B33338) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnWeiyer_OverrideLimbDraw, NULL, &this->actor, POLY_OPA_DISP); } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, &D_80116280[0]); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->actor.shape.shadowAlpha); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnWeiyer_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_weiyer.c", 1240); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_weiyer.c", 1240); } diff --git a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h index 77874b31ec..fbaefbd9a5 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h @@ -6,7 +6,7 @@ struct EnWeiyer; -typedef void (*EnWeiyerActionFunc)(struct EnWeiyer*, GlobalContext*); +typedef void (*EnWeiyerActionFunc)(struct EnWeiyer*, PlayState*); typedef struct EnWeiyer { /* 0x0000 */ Actor actor; 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 66f88bf256..37cc784447 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -11,37 +11,37 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnWf_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWf_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWf_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWf_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWf_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); +void EnWf_WaitToAppear(EnWf* this, PlayState* play); void EnWf_SetupWait(EnWf* this); -void EnWf_Wait(EnWf* this, GlobalContext* globalCtx); -void EnWf_SetupRunAtPlayer(EnWf* this, GlobalContext* globalCtx); -void EnWf_RunAtPlayer(EnWf* this, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); +void EnWf_SearchForPlayer(EnWf* this, PlayState* play); void EnWf_SetupRunAroundPlayer(EnWf* this); -void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx); +void EnWf_RunAroundPlayer(EnWf* this, PlayState* play); void EnWf_SetupSlash(EnWf* this); -void EnWf_Slash(EnWf* this, GlobalContext* globalCtx); -void EnWf_RecoilFromBlockedSlash(EnWf* this, GlobalContext* globalCtx); +void EnWf_Slash(EnWf* this, PlayState* play); +void EnWf_RecoilFromBlockedSlash(EnWf* this, PlayState* play); void EnWf_SetupBackflipAway(EnWf* this); -void EnWf_BackflipAway(EnWf* this, GlobalContext* globalCtx); -void EnWf_Stunned(EnWf* this, GlobalContext* globalCtx); -void EnWf_Damaged(EnWf* this, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); +void EnWf_SomersaultAndAttack(EnWf* this, PlayState* play); void EnWf_SetupBlocking(EnWf* this); -void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx); -void EnWf_SetupSidestep(EnWf* this, GlobalContext* globalCtx); -void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); -s32 EnWf_DodgeRanged(GlobalContext* globalCtx, EnWf* this); +void EnWf_Die(EnWf* this, PlayState* play); +s32 EnWf_DodgeRanged(PlayState* play, EnWf* this); static ColliderJntSphElementInit sJntSphItemsInit[4] = { { @@ -208,7 +208,7 @@ void EnWf_SetupAction(EnWf* this, EnWfActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Init(Actor* thisx, PlayState* play) { s32 pad; EnWf* this = (EnWf*)thisx; @@ -225,20 +225,20 @@ void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { this->eyeIndex = 0; this->unk_2F4 = 10.0f; // Set and not used - Collider_InitJntSph(globalCtx, &this->colliderSpheres); - Collider_SetJntSph(globalCtx, &this->colliderSpheres, thisx, &sJntSphInit, this->colliderSpheresElements); - Collider_InitCylinder(globalCtx, &this->colliderCylinderBody); - Collider_SetCylinder(globalCtx, &this->colliderCylinderBody, thisx, &sBodyCylinderInit); - Collider_InitCylinder(globalCtx, &this->colliderCylinderTail); - Collider_SetCylinder(globalCtx, &this->colliderCylinderTail, thisx, &sTailCylinderInit); + Collider_InitJntSph(play, &this->colliderSpheres); + Collider_SetJntSph(play, &this->colliderSpheres, thisx, &sJntSphInit, this->colliderSpheresElements); + Collider_InitCylinder(play, &this->colliderCylinderBody); + Collider_SetCylinder(play, &this->colliderCylinderBody, thisx, &sBodyCylinderInit); + Collider_InitCylinder(play, &this->colliderCylinderTail); + Collider_SetCylinder(play, &this->colliderCylinderTail, thisx, &sTailCylinderInit); if (thisx->params == WOLFOS_NORMAL) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitingAnim, this->jointTable, + 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(globalCtx, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosWaitingAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosWaitingAnim, this->jointTable, this->morphTable, WOLFOS_LIMB_MAX); Actor_SetScale(thisx, 0.01f); this->colliderSpheres.elements[0].info.toucher.damage = this->colliderSpheres.elements[1].info.toucher.damage = @@ -248,17 +248,17 @@ void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { EnWf_SetupWaitToAppear(this); - if ((this->switchFlag != 0xFF) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->switchFlag != 0xFF) && Flags_GetSwitch(play, this->switchFlag)) { Actor_Kill(thisx); } } -void EnWf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Destroy(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; - Collider_DestroyJntSph(globalCtx, &this->colliderSpheres); - Collider_DestroyCylinder(globalCtx, &this->colliderCylinderBody); - Collider_DestroyCylinder(globalCtx, &this->colliderCylinderTail); + Collider_DestroyJntSph(play, &this->colliderSpheres); + Collider_DestroyCylinder(play, &this->colliderCylinderBody); + Collider_DestroyCylinder(play, &this->colliderCylinderTail); if ((this->actor.params != WOLFOS_NORMAL) && (this->switchFlag != 0xFF)) { func_800F5B58(); @@ -280,8 +280,8 @@ void EnWf_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { - Player* player = GET_PLAYER(globalCtx); +s32 EnWf_ChangeAction(PlayState* play, EnWf* this, s16 mustChoose) { + Player* player = GET_PLAYER(play); s32 pad; s16 wallYawDiff; s16 playerYawDiff; @@ -292,19 +292,19 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { playerYawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; playerYawDiff = ABS(playerYawDiff); - if (func_800354B4(globalCtx, &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)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { EnWf_SetupBlocking(this); return true; } - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { EnWf_SetupBlocking(this); return true; } } - if (func_800354B4(globalCtx, &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)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(wallYawDiff) < 0x2EE0) && @@ -314,7 +314,7 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { } else if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { EnWf_SetupBlocking(this); return true; - } else if ((this->actor.xzDistToPlayer < 80.0f) && (globalCtx->gameplayFrames % 2) != 0) { + } else if ((this->actor.xzDistToPlayer < 80.0f) && (play->gameplayFrames % 2) != 0) { EnWf_SetupBlocking(this); return true; } else { @@ -323,7 +323,7 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { } } - explosive = Actor_FindNearby(globalCtx, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + 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; @@ -335,7 +335,7 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { EnWf_SetupSomersaultAndAttack(this); return true; } else { - EnWf_SetupSidestep(this, globalCtx); + EnWf_SetupSidestep(this, play); return true; } } else { @@ -348,14 +348,14 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { s16 playerFacingAngleDiff; if (playerYawDiff >= 0x1B58) { - EnWf_SetupSidestep(this, globalCtx); + EnWf_SetupSidestep(this, play); return true; } playerFacingAngleDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && - (((globalCtx->gameplayFrames % 8) != 0) || (ABS(playerFacingAngleDiff) < 0x38E0))) { + if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + (((play->gameplayFrames % 8) != 0) || (ABS(playerFacingAngleDiff) < 0x38E0))) { EnWf_SetupSlash(this); return true; } @@ -378,7 +378,7 @@ void EnWf_SetupWaitToAppear(EnWf* this) { EnWf_SetupAction(this, EnWf_WaitToAppear); } -void EnWf_WaitToAppear(EnWf* this, GlobalContext* globalCtx) { +void EnWf_WaitToAppear(EnWf* this, PlayState* play) { if (this->actionTimer >= 6) { this->actor.world.pos.y = this->actor.home.pos.y - 5.0f; @@ -417,12 +417,12 @@ void EnWf_SetupWait(EnWf* this) { EnWf_SetupAction(this, EnWf_Wait); } -void EnWf_Wait(EnWf* this, GlobalContext* globalCtx) { +void EnWf_Wait(EnWf* this, PlayState* play) { Player* player; s32 pad; s16 angle; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->unk_2E2 != 0) { @@ -439,7 +439,7 @@ void EnWf_Wait(EnWf* this, GlobalContext* globalCtx) { angle = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; angle = ABS(angle); - if (!EnWf_DodgeRanged(globalCtx, this)) { + 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--; @@ -449,7 +449,7 @@ void EnWf_Wait(EnWf* this, GlobalContext* globalCtx) { } this->unk_2E0 = 0; } else { - if (EnWf_ChangeAction(globalCtx, this, false)) { + if (EnWf_ChangeAction(play, this, false)) { return; } } @@ -466,14 +466,14 @@ void EnWf_Wait(EnWf* this, GlobalContext* globalCtx) { if (this->actionTimer == 0) { if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if (Rand_ZeroOne() > 0.3f) { - EnWf_SetupRunAtPlayer(this, globalCtx); + EnWf_SetupRunAtPlayer(this, play); } else { EnWf_SetupRunAroundPlayer(this); } } else { EnWf_SetupSearchForPlayer(this); } - if ((globalCtx->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } } @@ -481,7 +481,7 @@ void EnWf_Wait(EnWf* this, GlobalContext* globalCtx) { } } -void EnWf_SetupRunAtPlayer(EnWf* this, GlobalContext* globalCtx) { +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); @@ -489,20 +489,20 @@ void EnWf_SetupRunAtPlayer(EnWf* this, GlobalContext* globalCtx) { EnWf_SetupAction(this, EnWf_RunAtPlayer); } -void EnWf_RunAtPlayer(EnWf* this, GlobalContext* globalCtx) { +void EnWf_RunAtPlayer(EnWf* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 pad; f32 baseRange = 0.0f; s16 playerFacingAngleDiff; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 absPlaySpeed; - if (!EnWf_DodgeRanged(globalCtx, this)) { + if (!EnWf_DodgeRanged(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_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { baseRange = 150.0f; } @@ -542,24 +542,24 @@ void EnWf_RunAtPlayer(EnWf* this, GlobalContext* globalCtx) { } else if (this->actor.xzDistToPlayer < (90.0f + baseRange)) { s16 temp_v1 = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && + if (!Actor_OtherIsTargeted(play, &this->actor) && ((Rand_ZeroOne() > 0.03f) || ((this->actor.xzDistToPlayer <= 80.0f) && (ABS(temp_v1) < 0x38E0)))) { EnWf_SetupSlash(this); - } else if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) { + } else if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { EnWf_SetupBackflipAway(this); } else { EnWf_SetupRunAroundPlayer(this); } } - if (!EnWf_ChangeAction(globalCtx, this, false)) { - if ((globalCtx->gameplayFrames & 95) == 0) { + if (!EnWf_ChangeAction(play, this, false)) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } if ((prevFrame != (s32)this->skelAnime.curFrame) && (beforeCurFrame <= 0) && ((absPlaySpeed + prevFrame) > 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } } } @@ -571,12 +571,12 @@ void EnWf_SetupSearchForPlayer(EnWf* this) { EnWf_SetupAction(this, EnWf_SearchForPlayer); } -void EnWf_SearchForPlayer(EnWf* this, GlobalContext* globalCtx) { +void EnWf_SearchForPlayer(EnWf* this, PlayState* play) { s16 yawDiff; s16 phi_v1; f32 phi_f2; - if (!EnWf_DodgeRanged(globalCtx, this) && !EnWf_ChangeAction(globalCtx, this, false)) { + 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; @@ -597,11 +597,11 @@ void EnWf_SearchForPlayer(EnWf* this, GlobalContext* globalCtx) { if (Rand_ZeroOne() > 0.8f) { EnWf_SetupRunAroundPlayer(this); } else { - EnWf_SetupRunAtPlayer(this, globalCtx); + EnWf_SetupRunAtPlayer(this, play); } } - if ((globalCtx->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } } @@ -628,7 +628,7 @@ void EnWf_SetupRunAroundPlayer(EnWf* this) { EnWf_SetupAction(this, EnWf_RunAroundPlayer); } -void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx) { +void EnWf_RunAroundPlayer(EnWf* this, PlayState* play) { s16 angle1; s16 angle2; s32 pad; @@ -636,17 +636,17 @@ void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx) { s32 prevFrame; s32 beforeCurFrame; s32 absPlaySpeed; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->runAngle, 1, 4000, 1); - if (!EnWf_DodgeRanged(globalCtx, this) && !EnWf_ChangeAction(globalCtx, this, false)) { + if (!EnWf_DodgeRanged(play, this) && !EnWf_ChangeAction(play, this, false)) { 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) if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y)) { angle2 = (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) ? (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->runAngle : 0; @@ -658,7 +658,7 @@ void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx) { } } - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { baseRange = 150.0f; } @@ -689,21 +689,21 @@ void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx) { if ((prevFrame != (s32)this->skelAnime.curFrame) && (beforeCurFrame <= 0) && (absPlaySpeed + prevFrame > 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } - if ((globalCtx->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } - if ((Math_CosS(angle1 - this->actor.shape.rot.y) < -0.85f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && + if ((Math_CosS(angle1 - this->actor.shape.rot.y) < -0.85f) && !Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer <= 80.0f)) { EnWf_SetupSlash(this); } else { this->actionTimer--; if (this->actionTimer == 0) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) { + if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { EnWf_SetupBackflipAway(this); } else { EnWf_SetupWait(this); @@ -727,8 +727,8 @@ void EnWf_SetupSlash(EnWf* this) { EnWf_SetupAction(this, EnWf_Slash); } -void EnWf_Slash(EnWf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWf_Slash(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; @@ -747,12 +747,12 @@ void EnWf_Slash(EnWf* this, GlobalContext* globalCtx) { this->slashStatus = 0; } - if (((curFrame == 15) && !Actor_IsTargeted(globalCtx, &this->actor) && + if (((curFrame == 15) && !Actor_IsTargeted(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)); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 1, 2.0f, 50, 50, true); + 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); @@ -768,13 +768,13 @@ void EnWf_Slash(EnWf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnWf_SetupSidestep(this, globalCtx); + EnWf_SetupSidestep(this, play); } else if (shapeAngleDiff <= 10000) { if (yawAngleDiff > 16000) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnWf_SetupRunAroundPlayer(this); } else { - EnWf_ChangeAction(globalCtx, this, true); + EnWf_ChangeAction(play, this, true); } } else { EnWf_SetupRunAroundPlayer(this); @@ -797,8 +797,8 @@ void EnWf_SetupRecoilFromBlockedSlash(EnWf* this) { EnWf_SetupAction(this, EnWf_RecoilFromBlockedSlash); } -void EnWf_RecoilFromBlockedSlash(EnWf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWf_RecoilFromBlockedSlash(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; @@ -821,13 +821,13 @@ void EnWf_RecoilFromBlockedSlash(EnWf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnWf_SetupSidestep(this, globalCtx); + 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(globalCtx, this, true); + EnWf_ChangeAction(play, this, true); } } else { EnWf_SetupRunAroundPlayer(this); @@ -848,18 +848,18 @@ void EnWf_SetupBackflipAway(EnWf* this) { EnWf_SetupAction(this, EnWf_BackflipAway); } -void EnWf_BackflipAway(EnWf* this, GlobalContext* globalCtx) { +void EnWf_BackflipAway(EnWf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && + if (!Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && (this->actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { - EnWf_SetupRunAtPlayer(this, globalCtx); - } else if ((globalCtx->gameplayFrames % 2) != 0) { - EnWf_SetupSidestep(this, globalCtx); + EnWf_SetupRunAtPlayer(this, play); + } else if ((play->gameplayFrames % 2) != 0) { + EnWf_SetupSidestep(this, play); } else { EnWf_SetupWait(this); } } - if ((globalCtx->state.frames & 95) == 0) { + if ((play->state.frames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } } @@ -875,7 +875,7 @@ void EnWf_SetupStunned(EnWf* this) { EnWf_SetupAction(this, EnWf_Stunned); } -void EnWf_Stunned(EnWf* this, GlobalContext* globalCtx) { +void EnWf_Stunned(EnWf* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } @@ -892,7 +892,7 @@ void EnWf_Stunned(EnWf* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.health == 0) { EnWf_SetupDie(this); } else { - EnWf_ChangeAction(globalCtx, this, true); + EnWf_ChangeAction(play, this, true); } } } @@ -914,7 +914,7 @@ void EnWf_SetupDamaged(EnWf* this) { EnWf_SetupAction(this, EnWf_Damaged); } -void EnWf_Damaged(EnWf* this, GlobalContext* globalCtx) { +void EnWf_Damaged(EnWf* this, PlayState* play) { s16 angleToWall; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { @@ -931,7 +931,7 @@ void EnWf_Damaged(EnWf* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4500, 0); - if (!EnWf_ChangeAction(globalCtx, this, false) && SkelAnime_Update(&this->skelAnime)) { + 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); @@ -939,9 +939,9 @@ void EnWf_Damaged(EnWf* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 12000) && (this->actor.xzDistToPlayer < 120.0f)) { EnWf_SetupSomersaultAndAttack(this); - } else if (!EnWf_DodgeRanged(globalCtx, this)) { - if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && - ((globalCtx->gameplayFrames % 8) != 0)) { + } else if (!EnWf_DodgeRanged(play, this)) { + if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + ((play->gameplayFrames % 8) != 0)) { EnWf_SetupSlash(this); } else if (Rand_ZeroOne() > 0.5f) { EnWf_SetupWait(this); @@ -969,13 +969,13 @@ void EnWf_SetupSomersaultAndAttack(EnWf* this) { EnWf_SetupAction(this, EnWf_SomersaultAndAttack); } -void EnWf_SomersaultAndAttack(EnWf* this, GlobalContext* globalCtx) { +void EnWf_SomersaultAndAttack(EnWf* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 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(globalCtx, &this->unk_4C8); - func_800355B8(globalCtx, &this->unk_4BC); + func_800355B8(play, &this->unk_4C8); + func_800355B8(play, &this->unk_4BC); } if (SkelAnime_Update(&this->skelAnime) && @@ -985,7 +985,7 @@ void EnWf_SomersaultAndAttack(EnWf* this, GlobalContext* globalCtx) { this->actor.speedXZ = this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (!Actor_OtherIsTargeted(play, &this->actor)) { EnWf_SetupSlash(this); } else { EnWf_SetupWait(this); @@ -1008,8 +1008,8 @@ void EnWf_SetupBlocking(EnWf* this) { EnWf_SetupAction(this, EnWf_Blocking); } -void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWf_Blocking(EnWf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; if (this->actionTimer != 0) { @@ -1023,10 +1023,10 @@ void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) { if ((ABS(yawDiff) <= 0x4000) && (this->actor.xzDistToPlayer < 60.0f) && (ABS(this->actor.yDistToPlayer) < 50.0f)) { - if (func_800354B4(globalCtx, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) { + 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 ((globalCtx->gameplayFrames % 2) != 0) { + } else if ((play->gameplayFrames % 2) != 0) { EnWf_SetupBlocking(this); } else { EnWf_SetupBackflipAway(this); @@ -1035,8 +1035,8 @@ void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) { } else { s16 angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && - (((globalCtx->gameplayFrames % 2) != 0) || (ABS(angleFacingLink) < 0x38E0))) { + if (!Actor_OtherIsTargeted(play, &this->actor) && + (((play->gameplayFrames % 2) != 0) || (ABS(angleFacingLink) < 0x38E0))) { EnWf_SetupSlash(this); } else { EnWf_SetupRunAroundPlayer(this); @@ -1046,10 +1046,10 @@ void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) { EnWf_SetupRunAroundPlayer(this); } } else if (this->actionTimer == 0) { - if (func_800354B4(globalCtx, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) { + 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 ((globalCtx->gameplayFrames % 2) != 0) { + } else if ((play->gameplayFrames % 2) != 0) { EnWf_SetupBlocking(this); } else { EnWf_SetupBackflipAway(this); @@ -1058,14 +1058,14 @@ void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) { } } -void EnWf_SetupSidestep(EnWf* this, GlobalContext* globalCtx) { +void EnWf_SetupSidestep(EnWf* this, PlayState* play) { s16 angle; Player* player; f32 lastFrame = Animation_GetLastFrame(&gWolfosRunningAnim); Animation_Change(&this->skelAnime, &gWolfosRunningAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, -4.0f); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); angle = player->actor.shape.rot.y + this->runAngle; if (Math_SinS(angle - this->actor.yawTowardsPlayer) > 0.0f) { @@ -1088,9 +1088,9 @@ void EnWf_SetupSidestep(EnWf* this, GlobalContext* globalCtx) { EnWf_SetupAction(this, EnWf_Sidestep); } -void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { +void EnWf_Sidestep(EnWf* this, PlayState* play) { s16 angleDiff1; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 prevFrame; s32 beforeCurFrame; s32 absPlaySpeed; @@ -1100,7 +1100,7 @@ void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { // Actor_TestFloorInDirection is useless here (see comment below) if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y)) { s16 angle = (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) ? (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->runAngle : 0; @@ -1114,7 +1114,7 @@ void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { baseRange = 150.0f; } @@ -1143,7 +1143,7 @@ void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = (s32)(f32)ABS(this->skelAnime.playSpeed); - if (!EnWf_ChangeAction(globalCtx, this, false)) { + if (!EnWf_ChangeAction(play, this, false)) { this->actionTimer--; if (this->actionTimer == 0) { @@ -1154,26 +1154,26 @@ void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { EnWf_SetupWait(this); this->actionTimer = (Rand_ZeroOne() * 3.0f) + 1.0f; } else { - Player* player2 = GET_PLAYER(globalCtx); + Player* player2 = GET_PLAYER(play); s16 angleDiff2 = 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_OtherIsTargeted(globalCtx, &this->actor) && - (((globalCtx->gameplayFrames % 4) == 0) || (ABS(angleDiff2) < 0x38E0))) { + if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + (((play->gameplayFrames % 4) == 0) || (ABS(angleDiff2) < 0x38E0))) { EnWf_SetupSlash(this); } else { - EnWf_SetupRunAtPlayer(this, globalCtx); + EnWf_SetupRunAtPlayer(this, play); } } } if ((prevFrame != (s32)this->skelAnime.curFrame) && (beforeCurFrame <= 0) && ((absPlaySpeed + prevFrame) > 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } - if ((globalCtx->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 95) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_WOLFOS_CRY); } } @@ -1197,7 +1197,7 @@ void EnWf_SetupDie(EnWf* this) { EnWf_SetupAction(this, EnWf_Die); } -void EnWf_Die(EnWf* this, GlobalContext* globalCtx) { +void EnWf_Die(EnWf* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } @@ -1208,10 +1208,10 @@ void EnWf_Die(EnWf* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skelAnime)) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xD0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xD0); if (this->switchFlag != 0xFF) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } Actor_Kill(&this->actor); @@ -1226,13 +1226,13 @@ void EnWf_Die(EnWf* this, GlobalContext* globalCtx) { 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(globalCtx, &pos, &velAndAccel, &velAndAccel, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, - 9, true); + EffectSsDeadDb_Spawn(play, &pos, &velAndAccel, &velAndAccel, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, + true); } } } -void func_80B36F40(EnWf* this, GlobalContext* globalCtx) { +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) { @@ -1245,7 +1245,7 @@ void func_80B36F40(EnWf* this, GlobalContext* globalCtx) { } } -void EnWf_UpdateDamage(EnWf* this, GlobalContext* globalCtx) { +void EnWf_UpdateDamage(EnWf* this, PlayState* play) { if (this->colliderSpheres.base.acFlags & AC_BOUNCED) { this->colliderSpheres.base.acFlags &= ~(AC_HIT | AC_BOUNCED); this->colliderCylinderBody.base.acFlags &= ~AC_HIT; @@ -1285,7 +1285,7 @@ void EnWf_UpdateDamage(EnWf* this, GlobalContext* globalCtx) { if (Actor_ApplyDamage(&this->actor) == 0) { EnWf_SetupDie(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { EnWf_SetupDamaged(this); } @@ -1295,19 +1295,19 @@ void EnWf_UpdateDamage(EnWf* this, GlobalContext* globalCtx) { } } -void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Update(Actor* thisx, PlayState* play) { s32 pad; EnWf* this = (EnWf*)thisx; - EnWf_UpdateDamage(this, globalCtx); + EnWf_UpdateDamage(this, play); if (this->actor.colChkInfo.damageEffect != ENWF_DMGEFF_ICE_MAGIC) { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 32.0f, 30.0f, 60.0f, + 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, globalCtx); - func_80B36F40(this, globalCtx); + this->actionFunc(this, play); + func_80B36F40(this, play); } if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { @@ -1317,23 +1317,23 @@ void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 1000, 0); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSpheres.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSpheres.base); if (this->action >= WOLFOS_ACTION_WAIT) { if ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) { Collider_UpdateCylinder(&this->actor, &this->colliderCylinderBody); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinderTail.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinderTail.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinderBody.base); } } if (this->action == WOLFOS_ACTION_BLOCKING) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSpheres.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSpheres.base); } if (this->slashStatus > 0) { if (!(this->colliderSpheres.base.atFlags & AT_BOUNCED)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSpheres.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSpheres.base); } else { EnWf_SetupRecoilFromBlockedSlash(this); } @@ -1343,7 +1343,7 @@ void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos.y += 25.0f; if (this->eyeIndex == 0) { - if ((Rand_ZeroOne() < 0.2f) && ((globalCtx->gameplayFrames % 4) == 0) && (this->actor.colorFilterTimer == 0)) { + if ((Rand_ZeroOne() < 0.2f) && ((play->gameplayFrames % 4) == 0) && (this->actor.colorFilterTimer == 0)) { this->eyeIndex++; } } else { @@ -1351,7 +1351,7 @@ void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnWf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnWf* this = (EnWf*)thisx; if ((limbIndex == WOLFOS_LIMB_HEAD) || (limbIndex == WOLFOS_LIMB_EYES)) { @@ -1361,7 +1361,7 @@ s32 EnWf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnWf_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +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; @@ -1431,15 +1431,15 @@ static void* sWolfosNormalEyeTextures[] = { gWolfosNormalEyeOpenTex, gWolfosNorm static void* sWolfosWhiteEyeTextures[] = { gWolfosWhiteEyeOpenTex, gWolfosWhiteEyeHalfTex, gWolfosWhiteEyeNarrowTex, gWolfosWhiteEyeHalfTex }; -void EnWf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Draw(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_wf.c", 2157); + 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) { - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (this->actor.params == WOLFOS_NORMAL) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sWolfosNormalEyeTextures[this->eyeIndex])); @@ -1447,8 +1447,8 @@ void EnWf_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sWolfosWhiteEyeTextures[this->eyeIndex])); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnWf_OverrideLimbDraw, EnWf_PostLimbDraw, &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnWf_OverrideLimbDraw, EnWf_PostLimbDraw, &this->actor); if (this->fireTimer != 0) { this->actor.colorFilterTimer++; @@ -1458,16 +1458,16 @@ void EnWf_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->fireTimer % 4) == 0) { s32 fireIndex = this->fireTimer >> 2; - EffectSsEnFire_SpawnVec3s(globalCtx, &this->actor, &this->bodyPartsPos[fireIndex], 75, 0, 0, fireIndex); + EffectSsEnFire_SpawnVec3s(play, &this->actor, &this->bodyPartsPos[fireIndex], 75, 0, 0, fireIndex); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_wf.c", 2190); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_wf.c", 2190); } -s32 EnWf_DodgeRanged(GlobalContext* globalCtx, EnWf* this) { - Actor* actor = Actor_GetProjectileActor(globalCtx, &this->actor, 600.0f); +s32 EnWf_DodgeRanged(PlayState* play, EnWf* this) { + Actor* actor = Actor_GetProjectileActor(play, &this->actor, 600.0f); if (actor != NULL) { s16 angleToFacing; @@ -1483,7 +1483,7 @@ s32 EnWf_DodgeRanged(GlobalContext* globalCtx, EnWf* this) { } else { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; if ((ABS(angleToFacing) < 0x2000) || (ABS(angleToFacing) > 0x5FFF)) { - EnWf_SetupSidestep(this, globalCtx); + EnWf_SetupSidestep(this, play); this->actor.speedXZ *= 2.0f; } else if (ABS(angleToFacing) < 0x5FFF) { EnWf_SetupBackflipAway(this); 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 b99bb8092b..36afdccf5e 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -6,7 +6,7 @@ struct EnWf; -typedef void (*EnWfActionFunc)(struct EnWf*, GlobalContext*); +typedef void (*EnWfActionFunc)(struct EnWf*, PlayState*); typedef enum { /* 0 */ WOLFOS_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c index 8dd064f6e3..ea37184d20 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c @@ -9,17 +9,17 @@ #define FLAGS 0 -void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWonderItem_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWonderItem_Update(Actor* thisx, GlobalContext* globalCtx); +void EnWonderItem_Init(Actor* thisx, PlayState* play); +void EnWonderItem_Destroy(Actor* thisx, PlayState* play); +void EnWonderItem_Update(Actor* thisx, PlayState* play); -void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_ProximityDrop(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_InteractSwitch(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_ProximitySwitch(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_MultitagOrdered(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_BombSoldier(EnWonderItem* this, GlobalContext* globalCtx); -void EnWonderItem_RollDrop(EnWonderItem* this, GlobalContext* globalCtx); +void EnWonderItem_MultitagFree(EnWonderItem* this, PlayState* play); +void EnWonderItem_ProximityDrop(EnWonderItem* this, PlayState* play); +void EnWonderItem_InteractSwitch(EnWonderItem* this, PlayState* play); +void EnWonderItem_ProximitySwitch(EnWonderItem* this, PlayState* play); +void EnWonderItem_MultitagOrdered(EnWonderItem* this, PlayState* play); +void EnWonderItem_BombSoldier(EnWonderItem* this, PlayState* play); +void EnWonderItem_RollDrop(EnWonderItem* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -56,16 +56,16 @@ const ActorInit En_Wonder_Item_InitVars = { static Vec3f sTagPointsFree[9]; static Vec3f sTagPointsOrdered[9]; -void EnWonderItem_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderItem_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnWonderItem* this = (EnWonderItem*)thisx; if ((this->collider.dim.radius != 0) || (this->collider.dim.height != 0)) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnWonderItem_DropCollectible(EnWonderItem* this, GlobalContext* globalCtx, s32 autoCollect) { +void EnWonderItem_DropCollectible(EnWonderItem* this, PlayState* play, s32 autoCollect) { static s16 dropTable[] = { ITEM00_NUTS, ITEM00_HEART_PIECE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_SMALL, ITEM00_HEART, ITEM00_ARROWS_SMALL, ITEM00_ARROWS_MEDIUM, ITEM00_ARROWS_LARGE, @@ -82,26 +82,26 @@ void EnWonderItem_DropCollectible(EnWonderItem* this, GlobalContext* globalCtx, for (i = this->dropCount; i > 0; i--) { if (this->itemDrop < WONDERITEM_DROP_RANDOM) { if ((this->itemDrop == WONDERITEM_DROP_FLEXIBLE) || !autoCollect) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, dropTable[this->itemDrop]); + Item_DropCollectible(play, &this->actor.world.pos, dropTable[this->itemDrop]); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, dropTable[this->itemDrop] | 0x8000); + Item_DropCollectible(play, &this->actor.world.pos, dropTable[this->itemDrop] | 0x8000); } } else { randomDrop = this->itemDrop - WONDERITEM_DROP_RANDOM; if (!autoCollect) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, randomDrop); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, randomDrop); } else { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, randomDrop | 0x8000); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, randomDrop | 0x8000); } } } if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } Actor_Kill(&this->actor); } -void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderItem_Init(Actor* thisx, PlayState* play) { static u32 collisionTypes[] = { 0x00000702 /* sword slash */, 0x0001F820 /* arrow */, 0x00000040 /* hammer */, 0x00000008 /* bomb */, 0x00000004 /* slingshot */, 0x00000010 /* boomerang */, 0x00000080 /* hookshot */, @@ -124,7 +124,7 @@ void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) { this->switchFlag = -1; } this->actor.targetMode = 1; - if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); Actor_Kill(&this->actor); return; @@ -152,8 +152,8 @@ void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) { break; case WONDERITEM_INTERACT_SWITCH: colTypeIndex = this->actor.world.rot.z & 0xFF; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->collider.info.bumper.dmgFlags = collisionTypes[colTypeIndex]; this->collider.dim.radius = 20; this->collider.dim.height = 30; @@ -181,8 +181,8 @@ void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) { this->updateFunc = EnWonderItem_ProximitySwitch; break; case WONDERITEM_BOMB_SOLDIER: - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->collider.info.bumper.dmgFlags = 0x00000004; // slingshot this->unkPos = this->actor.world.pos; this->collider.dim.radius = 35; @@ -199,8 +199,8 @@ void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWonderItem_MultitagFree(EnWonderItem* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 prevTagFlags = this->tagFlags; s32 i; s32 mask; @@ -220,7 +220,7 @@ void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx) { if (BREG(0) != 0) { DebugDisplay_AddObject(sTagPointsFree[i].x, sTagPointsFree[i].y, sTagPointsFree[i].z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 0, 255, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); } } } @@ -230,40 +230,40 @@ void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx) { } if (this->tagCount == this->numTagPoints) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } - EnWonderItem_DropCollectible(this, globalCtx, true); + EnWonderItem_DropCollectible(this, play, true); } } -void EnWonderItem_ProximityDrop(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWonderItem_ProximityDrop(EnWonderItem* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actor.xzDistToPlayer < 50.0f) && (fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 30.0f)) { - EnWonderItem_DropCollectible(this, globalCtx, true); + EnWonderItem_DropCollectible(this, play, true); } } -void EnWonderItem_InteractSwitch(EnWonderItem* this, GlobalContext* globalCtx) { +void EnWonderItem_InteractSwitch(EnWonderItem* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - EnWonderItem_DropCollectible(this, globalCtx, false); + EnWonderItem_DropCollectible(this, play, false); } } -void EnWonderItem_ProximitySwitch(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWonderItem_ProximitySwitch(EnWonderItem* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actor.xzDistToPlayer < 50.0f) && (fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 30.0f)) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } Actor_Kill(&this->actor); } } -void EnWonderItem_MultitagOrdered(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWonderItem_MultitagOrdered(EnWonderItem* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 prevTagFlags = this->tagFlags; s32 i; s32 mask; @@ -290,7 +290,7 @@ void EnWonderItem_MultitagOrdered(EnWonderItem* this, GlobalContext* globalCtx) } else if (BREG(0) != 0) { DebugDisplay_AddObject(sTagPointsOrdered[i].x, sTagPointsOrdered[i].y, sTagPointsOrdered[i].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, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); } } } @@ -299,36 +299,35 @@ void EnWonderItem_MultitagOrdered(EnWonderItem* this, GlobalContext* globalCtx) return; } if (this->tagCount == this->numTagPoints) { - EnWonderItem_DropCollectible(this, globalCtx, true); + EnWonderItem_DropCollectible(this, play, true); } } -void EnWonderItem_BombSoldier(EnWonderItem* this, GlobalContext* globalCtx) { +void EnWonderItem_BombSoldier(EnWonderItem* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HEISHI2, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.yawTowardsPlayer, 0, - 9) != NULL) { + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HEISHI2, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, this->actor.yawTowardsPlayer, 0, 9) != NULL) { // "Careless soldier spawned" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ うっかり兵セット完了 ☆☆☆☆☆ \n" VT_RST); } if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } Actor_Kill(&this->actor); } } -void EnWonderItem_RollDrop(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWonderItem_RollDrop(EnWonderItem* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actor.xzDistToPlayer < 50.0f) && (player->invincibilityTimer < 0) && (fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 30.0f)) { - EnWonderItem_DropCollectible(this, globalCtx, true); + EnWonderItem_DropCollectible(this, play, true); } } -void EnWonderItem_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderItem_Update(Actor* thisx, PlayState* play) { static s16 debugArrowColors[] = { 255, 255, 0, 255, 0, 255, 0, 255, 255, 255, 0, 0, 0, 255, 0, 0, 0, 255, 128, 128, 128, 128, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 0, 0, 128, 0, 0, 0, 128, @@ -340,14 +339,14 @@ void EnWonderItem_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->timer != 0) { this->timer--; } - this->updateFunc(this, globalCtx); + this->updateFunc(this, play); if (this->wonderMode == WONDERITEM_UNUSED) { Actor_SetFocus(&this->actor, this->unkHeight); } if ((this->wonderMode == WONDERITEM_INTERACT_SWITCH) || (this->wonderMode == WONDERITEM_BOMB_SOLDIER)) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } colorIndex = this->wonderMode; @@ -358,6 +357,6 @@ void EnWonderItem_Update(Actor* thisx, GlobalContext* globalCtx) { 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, debugArrowColors[colorIndex], debugArrowColors[colorIndex + 1], - debugArrowColors[colorIndex + 2], 255, 4, globalCtx->state.gfxCtx); + debugArrowColors[colorIndex + 2], 255, 4, play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h index 182c4ca2f1..398977d116 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h @@ -6,7 +6,7 @@ struct EnWonderItem; -typedef void (*EnWonderItemUpdateFunc)(struct EnWonderItem*, GlobalContext*); +typedef void (*EnWonderItemUpdateFunc)(struct EnWonderItem*, PlayState*); typedef struct EnWonderItem { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c index 7b16d0f8bf..c470558feb 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c @@ -9,13 +9,13 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_27) -void EnWonderTalk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWonderTalk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWonderTalk_Update(Actor* thisx, GlobalContext* globalCtx); +void EnWonderTalk_Init(Actor* thisx, PlayState* play); +void EnWonderTalk_Destroy(Actor* thisx, PlayState* play); +void EnWonderTalk_Update(Actor* thisx, PlayState* play); -void func_80B391CC(EnWonderTalk* this, GlobalContext* globalCtx); -void func_80B395F0(EnWonderTalk* this, GlobalContext* globalCtx); -void func_80B3943C(EnWonderTalk* this, GlobalContext* globalCtx); +void func_80B391CC(EnWonderTalk* this, PlayState* play); +void func_80B395F0(EnWonderTalk* this, PlayState* play); +void func_80B3943C(EnWonderTalk* this, PlayState* play); const ActorInit En_Wonder_Talk_InitVars = { ACTOR_EN_WONDER_TALK, @@ -29,10 +29,10 @@ const ActorInit En_Wonder_Talk_InitVars = { NULL, }; -void EnWonderTalk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk_Destroy(Actor* thisx, PlayState* play) { } -void EnWonderTalk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk_Init(Actor* thisx, PlayState* play) { EnWonderTalk* this = (EnWonderTalk*)thisx; osSyncPrintf("\n\n"); @@ -47,7 +47,7 @@ void EnWonderTalk_Init(Actor* thisx, GlobalContext* globalCtx) { } this->actor.targetMode = 1; if (this->switchFlag >= 0) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); Actor_Kill(&this->actor); return; @@ -57,8 +57,8 @@ void EnWonderTalk_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_15C = 40.0f; } -void func_80B391CC(EnWonderTalk* this, GlobalContext* globalCtx) { - if (this->switchFlag < 0 || !Flags_GetSwitch(globalCtx, this->switchFlag)) { +void func_80B391CC(EnWonderTalk* this, PlayState* play) { + if (this->switchFlag < 0 || !Flags_GetSwitch(play, this->switchFlag)) { switch (this->unk_150) { case 1: // "Slate GO!" @@ -128,7 +128,7 @@ void func_80B391CC(EnWonderTalk* this, GlobalContext* globalCtx) { } } -void func_80B3943C(EnWonderTalk* this, GlobalContext* globalCtx) { +void func_80B3943C(EnWonderTalk* this, PlayState* play) { s16 yawDiff; s16 yawDiffTemp; @@ -137,14 +137,14 @@ void func_80B3943C(EnWonderTalk* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); return; } - if (this->switchFlag < 0 || !Flags_GetSwitch(globalCtx, this->switchFlag)) { - if ((Actor_ProcessTalkRequest(&this->actor, globalCtx))) { + if (this->switchFlag < 0 || !Flags_GetSwitch(play, this->switchFlag)) { + if ((Actor_ProcessTalkRequest(&this->actor, play))) { if (this->unk_156 != TEXT_STATE_DONE) { this->actionFunc = func_80B395F0; } else { if (this->switchFlag >= 0) { this->actor.flags &= ~ACTOR_FLAG_0; - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } this->actionFunc = func_80B391CC; } @@ -166,25 +166,25 @@ void func_80B3943C(EnWonderTalk* this, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); } this->unk_15A = 0; - func_8002F2CC(&this->actor, globalCtx, this->unk_15C); + func_8002F2CC(&this->actor, play, this->unk_15C); } } } } -void func_80B395F0(EnWonderTalk* this, GlobalContext* globalCtx) { - if (this->unk_156 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { +void func_80B395F0(EnWonderTalk* this, PlayState* play) { + if (this->unk_156 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { if (this->switchFlag >= 0) { this->actor.flags &= ~ACTOR_FLAG_0; - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } switch (this->unk_150) { case 1: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); this->actionFunc = func_80B391CC; break; case 2: - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (!LINK_IS_ADULT) { // "I'm still a child!" @@ -204,24 +204,24 @@ void func_80B395F0(EnWonderTalk* this, GlobalContext* globalCtx) { } this->unk_156 = TEXT_STATE_DONE; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = func_80B391CC; break; case 3: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); if (this->unk_164 == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_POH, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 2); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_POH, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 2); this->unk_164 = 1; } this->actionFunc = func_80B391CC; break; case 5: - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); if (this->unk_164 == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_POH, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 3); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_POH, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 3); this->unk_164 = 1; } this->actionFunc = func_80B391CC; @@ -230,13 +230,13 @@ void func_80B395F0(EnWonderTalk* this, GlobalContext* globalCtx) { } } -void EnWonderTalk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk_Update(Actor* thisx, PlayState* play) { EnWonderTalk* this = (EnWonderTalk*)thisx; if (this->unk_158 != 0) { this->unk_158--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, this->height); if (BREG(0) != 0) { @@ -244,12 +244,12 @@ void EnWonderTalk_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->unk_15A & 1) == 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, 10, 10, 10, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 10, 10, 10, 255, 4, play->state.gfxCtx); } } else { 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, 255, 0, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); } } } diff --git a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h index 50b370b31d..ae21c5b41f 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h +++ b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h @@ -6,7 +6,7 @@ struct EnWonderTalk; -typedef void (*EnWonderTalkFunc)(struct EnWonderTalk*, GlobalContext*); +typedef void (*EnWonderTalkFunc)(struct EnWonderTalk*, PlayState*); typedef struct EnWonderTalk { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c index 5a91fa7486..f3f9ba5788 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c @@ -9,15 +9,15 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_27) -void EnWonderTalk2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWonderTalk2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWonderTalk2_Update(Actor* thisx, GlobalContext* globalCtx); +void EnWonderTalk2_Init(Actor* thisx, PlayState* play); +void EnWonderTalk2_Destroy(Actor* thisx, PlayState* play); +void EnWonderTalk2_Update(Actor* thisx, PlayState* play); -void func_80B3A10C(EnWonderTalk2* this, GlobalContext* globalCtx); -void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx); -void func_80B3A15C(EnWonderTalk2* this, GlobalContext* globalCtx); -void func_80B3A3D4(EnWonderTalk2* this, GlobalContext* globalCtx); -void EnWonderTalk2_DoNothing(EnWonderTalk2* this, GlobalContext* globalCtx); +void func_80B3A10C(EnWonderTalk2* this, PlayState* play); +void func_80B3A4F8(EnWonderTalk2* this, PlayState* play); +void func_80B3A15C(EnWonderTalk2* this, PlayState* play); +void func_80B3A3D4(EnWonderTalk2* this, PlayState* play); +void EnWonderTalk2_DoNothing(EnWonderTalk2* this, PlayState* play); const ActorInit En_Wonder_Talk2_InitVars = { ACTOR_EN_WONDER_TALK2, @@ -33,10 +33,10 @@ const ActorInit En_Wonder_Talk2_InitVars = { static s16 D_80B3A8E0[] = { 6, 0, 1, 2, 3, 4, 5 }; -void EnWonderTalk2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk2_Destroy(Actor* thisx, PlayState* play) { } -void EnWonderTalk2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk2_Init(Actor* thisx, PlayState* play) { s32 pad; EnWonderTalk2* this = (EnWonderTalk2*)thisx; @@ -79,12 +79,12 @@ void EnWonderTalk2_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->switchFlag == 0x3F) { this->switchFlag = -1; } - if (this->switchFlag >= 0 && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (this->switchFlag >= 0 && Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); Actor_Kill(&this->actor); return; } - if ((this->talkMode == 1) && (globalCtx->sceneNum == SCENE_MEN) && (this->switchFlag != 0x08) && + if ((this->talkMode == 1) && (play->sceneNum == SCENE_MEN) && (this->switchFlag != 0x08) && (this->switchFlag != 0x16) && (this->switchFlag != 0x2F)) { this->unk_15A = false; @@ -98,7 +98,7 @@ void EnWonderTalk2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B3A10C(EnWonderTalk2* this, GlobalContext* globalCtx) { +void func_80B3A10C(EnWonderTalk2* this, PlayState* play) { this->actor.textId = 0x200; this->actor.textId |= this->baseMsgId; if (this->talkMode == 1 || this->talkMode == 4) { @@ -108,18 +108,18 @@ void func_80B3A10C(EnWonderTalk2* this, GlobalContext* globalCtx) { } } -void func_80B3A15C(EnWonderTalk2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B3A15C(EnWonderTalk2* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_158++; - if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { if (!this->unk_15A) { this->actor.flags &= ~ACTOR_FLAG_0; this->unk_15A = true; } - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { if ((this->switchFlag >= 0) && (this->talkMode != 2)) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); // "I saved it! All of it!" osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ セーブしたよ!おもいっきり! %x\n" VT_RST, this->switchFlag); } @@ -161,30 +161,30 @@ void func_80B3A15C(EnWonderTalk2* this, GlobalContext* globalCtx) { } this->unk_158 = 0; - func_8002F1C4(&this->actor, globalCtx, this->triggerRange + 50.0f, 100.0f, EXCH_ITEM_NONE); + func_8002F1C4(&this->actor, play, this->triggerRange + 50.0f, 100.0f, EXCH_ITEM_NONE); } } } -void func_80B3A3D4(EnWonderTalk2* this, GlobalContext* globalCtx) { +void func_80B3A3D4(EnWonderTalk2* this, PlayState* play) { if (BREG(2) != 0) { // "Oh" - osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ わー %d\n" VT_RST, Message_GetState(&globalCtx->msgCtx)); + osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ わー %d\n" VT_RST, Message_GetState(&play->msgCtx)); } - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_EVENT: case TEXT_STATE_DONE: - if (Message_ShouldAdvance(globalCtx)) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) { - Message_CloseTextbox(globalCtx); + if (Message_ShouldAdvance(play)) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) { + Message_CloseTextbox(play); } } else { break; } case TEXT_STATE_NONE: if ((this->switchFlag >= 0) && (this->talkMode != 4)) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); // "(Forced) I saved it! All of it!" osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ (強制)セーブしたよ!おもいっきり! %x\n" VT_RST, this->switchFlag); @@ -194,19 +194,19 @@ void func_80B3A3D4(EnWonderTalk2* this, GlobalContext* globalCtx) { this->unk_15A = true; } this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_4); - func_8002DF54(globalCtx, NULL, 7); + func_8002DF54(play, NULL, 7); this->unk_156 = true; this->actionFunc = func_80B3A4F8; break; } } -void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx) { +void func_80B3A4F8(EnWonderTalk2* this, PlayState* play) { Player* player; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); this->unk_158++; - if (this->switchFlag >= 0 && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (this->switchFlag >= 0 && Flags_GetSwitch(play, this->switchFlag)) { if (!this->unk_15A) { this->actor.flags &= ~ACTOR_FLAG_0; this->unk_15A = true; @@ -218,7 +218,7 @@ void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx) { } if (((this->actor.xzDistToPlayer < (40.0f + this->triggerRange)) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 100.0f)) && - !Play_InCsMode(globalCtx)) { + !Play_InCsMode(play)) { if (this->unk_158 >= 2) { osSyncPrintf("\n\n"); // "Transparent Message Kimi Seto" @@ -252,8 +252,8 @@ void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx) { } this->unk_158 = 0; if (!this->unk_156) { - Message_StartTextbox(globalCtx, this->actor.textId, NULL); - func_8002DF54(globalCtx, NULL, 8); + Message_StartTextbox(play, this->actor.textId, NULL); + func_8002DF54(play, NULL, 8); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_4; this->actionFunc = func_80B3A3D4; } @@ -264,14 +264,14 @@ void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx) { } } -void EnWonderTalk2_DoNothing(EnWonderTalk2* this, GlobalContext* globalCtx) { +void EnWonderTalk2_DoNothing(EnWonderTalk2* this, PlayState* play) { } -void EnWonderTalk2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWonderTalk2_Update(Actor* thisx, PlayState* play) { s32 pad; EnWonderTalk2* this = (EnWonderTalk2*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.world.pos.y = this->initPos.y; Actor_SetFocus(&this->actor, this->height); @@ -281,12 +281,12 @@ void EnWonderTalk2_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->unk_158 & 1) == 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, 70, 70, 70, 255, 4, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 70, 70, 70, 255, 4, play->state.gfxCtx); } } else { 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, globalCtx->state.gfxCtx); + 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); } } } diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h index 5e450998ea..f58775426f 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h @@ -6,7 +6,7 @@ struct EnWonderTalk2; -typedef void (*EnWonderTalk2Func)(struct EnWonderTalk2*, GlobalContext*); +typedef void (*EnWonderTalk2Func)(struct EnWonderTalk2*, PlayState*); typedef struct EnWonderTalk2 { /* 0x0000 */ Actor actor; 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 7b72d5444d..bb6ab7f98e 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWood02_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWood02_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWood02_Init(Actor* thisx, PlayState* play); +void EnWood02_Destroy(Actor* thisx, PlayState* play); +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 @@ -97,11 +97,10 @@ static f32 sSpawnCos; static f32 sSpawnSin; -s32 EnWood02_SpawnZoneCheck(EnWood02* this, GlobalContext* globalCtx, Vec3f* pos) { +s32 EnWood02_SpawnZoneCheck(EnWood02* this, PlayState* play, Vec3f* pos) { f32 phi_f12; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, pos, &this->actor.projectedPos, - &this->actor.projectedW); + 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)); @@ -117,7 +116,7 @@ s32 EnWood02_SpawnZoneCheck(EnWood02* this, GlobalContext* globalCtx, Vec3f* pos /** 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, GlobalContext* globalCtx) { +void EnWood02_SpawnOffspring(EnWood02* this, PlayState* play) { EnWood02* childWood; s16* childSpawnAngle; Vec3f childPos; @@ -137,15 +136,15 @@ void EnWood02_SpawnOffspring(EnWood02* this, GlobalContext* globalCtx) { 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, globalCtx, &childPos)) { + if (EnWood02_SpawnZoneCheck(this, play, &childPos)) { if ((this->unk_14E[i] & 0x80) != 0) { childParams = (0xFF00 | (this->actor.params + 1)); } else { childParams = (((this->drawType & 0xF0) << 4) | (this->actor.params + 1)); } - childWood = (EnWood02*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, - ACTOR_EN_WOOD02, childPos.x, childPos.y, childPos.z, - this->actor.world.rot.x, *childSpawnAngle, 0, childParams); + 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; @@ -158,10 +157,10 @@ void EnWood02_SpawnOffspring(EnWood02* this, GlobalContext* globalCtx) { } } -void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnWood02_Init(Actor* thisx, PlayState* play2) { s16 spawnType; f32 actorScale; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnWood02* this = (EnWood02*)thisx; CollisionPoly* outPoly; s32 bgId; @@ -184,8 +183,8 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_ProcessInitChain(&this->actor, sInitChain); if (this->actor.params <= WOOD_TREE_KAKARIKO_ADULT) { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } switch (this->actor.params) { @@ -265,7 +264,7 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx2) { if (spawnType == WOOD_SPAWN_SPAWNER) { this->drawType |= this->unk_14C << 4; - EnWood02_SpawnOffspring(this, globalCtx); + 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]); @@ -276,7 +275,7 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx2) { // Snap to floor, or remove if over void this->actor.world.pos.y += 200.0f; - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &outPoly, &bgId, &this->actor, &this->actor.world.pos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &outPoly, &bgId, &this->actor, &this->actor.world.pos); if (floorY > BGCHECK_Y_MIN) { this->actor.world.pos.y = floorY; @@ -290,16 +289,16 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; } -void EnWood02_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWood02_Destroy(Actor* thisx, PlayState* play) { EnWood02* this = (EnWood02*)thisx; if (this->actor.params <= WOOD_TREE_KAKARIKO_ADULT) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnWood02_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnWood02* this = (EnWood02*)thisx; f32 wobbleAmplitude; u8 new_var; @@ -324,7 +323,7 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { return; } } else if (this->spawnType == WOOD_SPAWN_SPAWNER) { - EnWood02_SpawnOffspring(this, globalCtx); + EnWood02_SpawnOffspring(this, play); } if (this->actor.params <= WOOD_TREE_KAKARIKO_ADULT) { @@ -338,13 +337,13 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { dropsSpawnPt.y += 200.0f; if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &dropsSpawnPt, this->unk_14C << 4); + Item_DropCollectibleRandom(play, &this->actor, &dropsSpawnPt, this->unk_14C << 4); } else { if (this->actor.home.rot.z != 0) { this->actor.home.rot.z &= 0x1FFF; this->actor.home.rot.z |= 0xE000; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SW, dropsSpawnPt.x, dropsSpawnPt.y, - dropsSpawnPt.z, 0, this->actor.world.rot.y, 0, this->actor.home.rot.z); + 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; } } @@ -360,8 +359,8 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_TREE_SWING); for (i = 3; i >= 0; i--) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WOOD02, dropsSpawnPt.x, dropsSpawnPt.y, - dropsSpawnPt.z, 0, Rand_CenteredFloat(65535.0f), 0, leavesParams); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WOOD02, dropsSpawnPt.x, dropsSpawnPt.y, dropsSpawnPt.z, + 0, Rand_CenteredFloat(65535.0f), 0, leavesParams); } } this->unk_14C = -0x15; @@ -370,11 +369,11 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->actor.xzDistToPlayer < 600.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } else if (this->actor.params < 0x17) { // Bush - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->unk_14C >= -1) { if (((player->rideActor == NULL) && (sqrt(this->actor.xyzDistToPlayerSq) < 20.0) && @@ -382,7 +381,7 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { ((player->rideActor != NULL) && (sqrt(this->actor.xyzDistToPlayerSq) < 60.0) && (player->rideActor->speedXZ != 0.0f))) { if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, ((this->unk_14C << 4) | 0x8000)); } this->unk_14C = -0x15; @@ -411,10 +410,10 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnWood02_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnWood02_Draw(Actor* thisx, PlayState* play) { EnWood02* this = (EnWood02*)thisx; s16 type; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 red; u8 green; u8 blue; @@ -441,9 +440,9 @@ void EnWood02_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.params == WOOD_LEAF_GREEN) || (this->actor.params == WOOD_LEAF_YELLOW)) { func_80093D18(gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, red, green, blue, 127); - Gfx_DrawDListOpa(globalCtx, object_wood02_DL_000700); + Gfx_DrawDListOpa(play, object_wood02_DL_000700); } else if (D_80B3BF70[this->drawType & 0xF] != NULL) { - Gfx_DrawDListOpa(globalCtx, D_80B3BF54[this->drawType & 0xF]); + Gfx_DrawDListOpa(play, D_80B3BF54[this->drawType & 0xF]); gDPSetEnvColor(POLY_XLU_DISP++, red, green, blue, 0); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_wood02.c", 808), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); 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 f6f1109448..4dd4e6d0ab 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -16,17 +16,17 @@ #define FLAGS ACTOR_FLAG_4 -void EnXc_Init(Actor* thisx, GlobalContext* globalCtx); -void EnXc_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnXc_Update(Actor* thisx, GlobalContext* globalCtx); -void EnXc_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnXc_Init(Actor* thisx, PlayState* play); +void EnXc_Destroy(Actor* thisx, PlayState* play); +void EnXc_Update(Actor* thisx, PlayState* play); +void EnXc_Draw(Actor* thisx, PlayState* play); -void EnXc_DrawNothing(Actor* thisx, GlobalContext* globalCtx); -void EnXc_DrawDefault(Actor* thisx, GlobalContext* globalCtx); -void EnXc_DrawPullingOutHarp(Actor* thisx, GlobalContext* globalCtx); -void EnXc_DrawHarp(Actor* thisx, GlobalContext* globalCtx); -void EnXc_DrawTriforce(Actor* thisx, GlobalContext* globalCtx); -void EnXc_DrawSquintingEyes(Actor* thisx, GlobalContext* globalCtx); +void EnXc_DrawNothing(Actor* thisx, PlayState* play); +void EnXc_DrawDefault(Actor* thisx, PlayState* play); +void EnXc_DrawPullingOutHarp(Actor* thisx, PlayState* play); +void EnXc_DrawHarp(Actor* thisx, PlayState* play); +void EnXc_DrawTriforce(Actor* thisx, PlayState* play); +void EnXc_DrawSquintingEyes(Actor* thisx, PlayState* play); static ColliderCylinderInitType1 sCylinderInit = { { @@ -53,30 +53,30 @@ static void* sEyeTextures[] = { gSheikEyeShutTex, }; -void EnXc_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_InitCollider(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); } -void EnXc_UpdateCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_UpdateCollider(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; Collider* colliderBase = &this->collider.base; s32 pad[3]; Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, colliderBase); + CollisionCheck_SetOC(play, &play->colChkCtx, colliderBase); } -void EnXc_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_Destroy(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnXc_CalculateHeadTurn(EnXc* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnXc_CalculateHeadTurn(EnXc* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->npcInfo.unk_18 = player->actor.world.pos; this->npcInfo.unk_14 = kREG(16) - 3.0f; @@ -98,7 +98,7 @@ void EnXc_SetEyePattern(EnXc* this) { } } -void EnXc_SpawnNut(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SpawnNut(EnXc* this, PlayState* play) { s32 pad; Vec3f* pos = &this->actor.world.pos; s16 angle = this->actor.shape.rot.y; @@ -106,29 +106,28 @@ void EnXc_SpawnNut(EnXc* this, GlobalContext* globalCtx) { f32 y = pos->y + 3.0f; f32 z = (Math_CosS(angle) * 30.0f) + pos->z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, x, y, z, 0xFA0, this->actor.shape.rot.y, 0, - ARROW_CS_NUT); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, x, y, z, 0xFA0, this->actor.shape.rot.y, 0, ARROW_CS_NUT); } -void EnXc_BgCheck(EnXc* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2); +void EnXc_BgCheck(EnXc* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2); } s32 EnXc_AnimIsFinished(EnXc* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnXc_GetCsCmd(GlobalContext* globalCtx, s32 npcActionIdx) { +CsCmdActorAction* EnXc_GetCsCmd(PlayState* play, s32 npcActionIdx) { CsCmdActorAction* action = NULL; - if (globalCtx->csCtx.state != 0) { - action = globalCtx->csCtx.npcActions[npcActionIdx]; + if (play->csCtx.state != 0) { + action = play->csCtx.npcActions[npcActionIdx]; } return action; } -s32 EnXc_CompareCsAction(EnXc* this, GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdActorAction = EnXc_GetCsCmd(globalCtx, npcActionIdx); +s32 EnXc_CompareCsAction(EnXc* this, PlayState* play, u16 action, s32 npcActionIdx) { + CsCmdActorAction* csCmdActorAction = EnXc_GetCsCmd(play, npcActionIdx); if (csCmdActorAction != NULL && csCmdActorAction->action == action) { return true; @@ -136,8 +135,8 @@ s32 EnXc_CompareCsAction(EnXc* this, GlobalContext* globalCtx, u16 action, s32 n return false; } -s32 EnXc_CsActionsAreNotEqual(EnXc* this, GlobalContext* globalCtx, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnXc_GetCsCmd(globalCtx, npcActionIdx); +s32 EnXc_CsActionsAreNotEqual(EnXc* this, PlayState* play, u16 action, s32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = EnXc_GetCsCmd(play, npcActionIdx); if (csCmdNPCAction && csCmdNPCAction->action != action) { return true; @@ -145,8 +144,8 @@ s32 EnXc_CsActionsAreNotEqual(EnXc* this, GlobalContext* globalCtx, u16 action, return false; } -void func_80B3C588(EnXc* this, GlobalContext* globalCtx, u32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnXc_GetCsCmd(globalCtx, npcActionIdx); +void func_80B3C588(EnXc* this, PlayState* play, u32 npcActionIdx) { + CsCmdActorAction* csCmdNPCAction = EnXc_GetCsCmd(play, npcActionIdx); Actor* thisx = &this->actor; if (csCmdNPCAction != NULL) { @@ -159,8 +158,8 @@ void func_80B3C588(EnXc* this, GlobalContext* globalCtx, u32 npcActionIdx) { } } -void func_80B3C620(EnXc* this, GlobalContext* globalCtx, s32 npcActionIdx) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, npcActionIdx); +void func_80B3C620(EnXc* this, PlayState* play, s32 npcActionIdx) { + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, npcActionIdx); Vec3f* xcPos = &this->actor.world.pos; f32 startX; f32 startY; @@ -171,8 +170,7 @@ void func_80B3C620(EnXc* this, GlobalContext* globalCtx, s32 npcActionIdx) { f32 unk; if (npcAction != NULL) { - unk = - Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames, 0, 0); + unk = Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames, 0, 0); startX = npcAction->startPos.x; startY = npcAction->startPos.y; startZ = npcAction->startPos.z; @@ -222,8 +220,8 @@ void func_80B3C7D4(EnXc* this, s32 action1, s32 action2, s32 action3) { } } -s32 EnXc_NoCutscenePlaying(GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == 0) { +s32 EnXc_NoCutscenePlaying(PlayState* play) { + if (play->csCtx.state == 0) { return true; } return false; @@ -235,31 +233,31 @@ void func_80B3C820(EnXc* this) { this->action = SHEIK_ACTION_53; } -void func_80B3C888(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_NoCutscenePlaying(globalCtx) && this->actor.params == SHEIK_TYPE_4) { +void func_80B3C888(EnXc* this, PlayState* play) { + if (EnXc_NoCutscenePlaying(play) && this->actor.params == SHEIK_TYPE_4) { func_80B3C820(this); } } -void func_80B3C8CC(EnXc* this, GlobalContext* globalCtx) { +void func_80B3C8CC(EnXc* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; if (skelAnime->jointTable[0].y >= skelAnime->baseTransl.y) { skelAnime->moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } -void func_80B3C924(EnXc* this, GlobalContext* globalCtx) { +void func_80B3C924(EnXc* this, PlayState* play) { this->skelAnime.moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_80B3C964(EnXc* this, GlobalContext* globalCtx) { +void func_80B3C964(EnXc* this, PlayState* play) { this->skelAnime.baseTransl = this->skelAnime.jointTable[0]; this->skelAnime.prevTransl = this->skelAnime.jointTable[0]; this->skelAnime.moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_80B3C9DC(EnXc* this) { @@ -273,7 +271,7 @@ void func_80B3C9EC(EnXc* this) { this->unk_30C = 1; } -void func_80B3CA38(EnXc* this, GlobalContext* globalCtx) { +void func_80B3CA38(EnXc* this, PlayState* play) { // If Player is adult but hasn't learned Minuet of Forest if (!GET_EVENTCHKINF(EVENTCHKINF_50) && LINK_IS_ADULT) { this->action = SHEIK_ACTION_INIT; @@ -282,17 +280,17 @@ void func_80B3CA38(EnXc* this, GlobalContext* globalCtx) { } } -s32 EnXc_MinuetCS(EnXc* this, GlobalContext* globalCtx) { +s32 EnXc_MinuetCS(EnXc* this, PlayState* play) { if (this->actor.params == SHEIK_TYPE_MINUET) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 z = player->actor.world.pos.z; if (z < -2225.0f) { - if (!Play_InCsMode(globalCtx)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gMinuetCs); + if (!Play_InCsMode(play)) { + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gMinuetCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_50); - Item_Give(globalCtx, ITEM_SONG_MINUET); + Item_Give(play, ITEM_SONG_MINUET); return true; } } @@ -301,7 +299,7 @@ s32 EnXc_MinuetCS(EnXc* this, GlobalContext* globalCtx) { return true; } -void func_80B3CB58(EnXc* this, GlobalContext* globalCtx) { +void func_80B3CB58(EnXc* this, PlayState* play) { // If hasn't learned Bolero and Player is Adult if (!GET_EVENTCHKINF(EVENTCHKINF_51) && LINK_IS_ADULT) { this->action = SHEIK_ACTION_INIT; @@ -310,20 +308,20 @@ void func_80B3CB58(EnXc* this, GlobalContext* globalCtx) { } } -s32 EnXc_BoleroCS(EnXc* this, GlobalContext* globalCtx) { +s32 EnXc_BoleroCS(EnXc* this, PlayState* play) { Player* player; PosRot* posRot; if (this->actor.params == SHEIK_TYPE_BOLERO) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); posRot = &player->actor.world; if ((posRot->pos.x > -784.0f) && (posRot->pos.x < -584.0f) && (posRot->pos.y > 447.0f) && (posRot->pos.y < 647.0f) && (posRot->pos.z > -446.0f) && (posRot->pos.z < -246.0f) && - !Play_InCsMode(globalCtx)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gDeathMountainCraterBoleroCs); + !Play_InCsMode(play)) { + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gDeathMountainCraterBoleroCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_51); - Item_Give(globalCtx, ITEM_SONG_BOLERO); + Item_Give(play, ITEM_SONG_BOLERO); return true; } return false; @@ -331,7 +329,7 @@ s32 EnXc_BoleroCS(EnXc* this, GlobalContext* globalCtx) { return true; } -void EnXc_SetupSerenadeAction(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupSerenadeAction(EnXc* this, PlayState* play) { // Player is adult and does not have iron boots and has not learned Serenade if (!CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && !GET_EVENTCHKINF(EVENTCHKINF_52) && LINK_IS_ADULT) { @@ -343,17 +341,17 @@ void EnXc_SetupSerenadeAction(EnXc* this, GlobalContext* globalCtx) { } } -s32 EnXc_SerenadeCS(EnXc* this, GlobalContext* globalCtx) { +s32 EnXc_SerenadeCS(EnXc* this, PlayState* play) { if (this->actor.params == SHEIK_TYPE_SERENADE) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 stateFlags = player->stateFlags1; if (CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && !GET_EVENTCHKINF(EVENTCHKINF_52) && - !(stateFlags & PLAYER_STATE1_29) && !Play_InCsMode(globalCtx)) { - Cutscene_SetSegment(globalCtx, &gIceCavernSerenadeCs); + !(stateFlags & PLAYER_STATE1_29) && !Play_InCsMode(play)) { + Cutscene_SetSegment(play, &gIceCavernSerenadeCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_52); // Learned Serenade of Water Flag - Item_Give(globalCtx, ITEM_SONG_SERENADE); + Item_Give(play, ITEM_SONG_SERENADE); osSyncPrintf("ブーツを取った!!!!!!!!!!!!!!!!!!\n"); return true; } @@ -363,10 +361,10 @@ s32 EnXc_SerenadeCS(EnXc* this, GlobalContext* globalCtx) { return true; } -void EnXc_DoNothing(EnXc* this, GlobalContext* globalCtx) { +void EnXc_DoNothing(EnXc* this, PlayState* play) { } -void EnXc_SetWalkingSFX(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetWalkingSFX(EnXc* this, PlayState* play) { s32 pad[2]; u32 sfxId; s32 pad2; @@ -374,13 +372,13 @@ void EnXc_SetWalkingSFX(EnXc* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 11.0f) || Animation_OnFrame(&this->skelAnime, 23.0f)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } } -void EnXc_SetNutThrowSFX(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetNutThrowSFX(EnXc* this, PlayState* play) { s32 pad[2]; u32 sfxId; s32 pad2; @@ -388,7 +386,7 @@ void EnXc_SetNutThrowSFX(EnXc* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } @@ -397,72 +395,72 @@ void EnXc_SetNutThrowSFX(EnXc* this, GlobalContext* globalCtx) { } } -void EnXc_SetLandingSFX(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetLandingSFX(EnXc* this, PlayState* play) { u32 sfxId; - s16 sceneNum = globalCtx->sceneNum; + s16 sceneNum = play->sceneNum; if ((gSaveContext.sceneSetupIndex != 4) || (sceneNum != SCENE_SPOT11)) { if (Animation_OnFrame(&this->skelAnime, 11.0f)) { sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } } -void EnXc_SetColossusAppearSFX(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetColossusAppearSFX(EnXc* this, PlayState* play) { static Vec3f sXyzDist; s16 sceneNum; if (gSaveContext.sceneSetupIndex == 4) { - sceneNum = globalCtx->sceneNum; + sceneNum = play->sceneNum; if (sceneNum == SCENE_SPOT11) { - CutsceneContext* csCtx = &globalCtx->csCtx; + CutsceneContext* csCtx = &play->csCtx; u16 frameCount = csCtx->frames; f32 wDest[2]; if (frameCount == 119) { Vec3f pos = { -611.0f, 728.0f, -2.0f }; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &pos, &sXyzDist, wDest); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &sXyzDist, wDest); func_80078914(&sXyzDist, NA_SE_EV_JUMP_CONC); } else if (frameCount == 164) { Vec3f pos = { -1069.0f, 38.0f, 0.0f }; s32 pad; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &pos, &sXyzDist, wDest); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &sXyzDist, wDest); func_80078914(&sXyzDist, NA_SE_PL_WALK_CONCRETE); } } } } -void func_80B3D118(GlobalContext* globalCtx) { +void func_80B3D118(PlayState* play) { s16 sceneNum; - if ((gSaveContext.sceneSetupIndex != 4) || (sceneNum = globalCtx->sceneNum, sceneNum != SCENE_SPOT11)) { + if ((gSaveContext.sceneSetupIndex != 4) || (sceneNum = play->sceneNum, sceneNum != SCENE_SPOT11)) { func_800788CC(NA_SE_PL_SKIP); } } static Vec3f D_80B42DA0; -void EnXc_SetColossusWindSFX(GlobalContext* globalCtx) { +void EnXc_SetColossusWindSFX(PlayState* play) { if (gSaveContext.sceneSetupIndex == 4) { static s32 D_80B41D90 = 0; static Vec3f sPos = { 0.0f, 0.0f, 0.0f }; static f32 sMaxSpeed = 0.0f; static Vec3f D_80B42DB0; s32 pad; - s16 sceneNum = globalCtx->sceneNum; + s16 sceneNum = play->sceneNum; if (sceneNum == SCENE_SPOT11) { - CutsceneContext* csCtx = &globalCtx->csCtx; + CutsceneContext* csCtx = &play->csCtx; u16 frameCount = csCtx->frames; if ((frameCount >= 120) && (frameCount < 164)) { s32 pad; - Vec3f* eye = &globalCtx->view.eye; + Vec3f* eye = &play->view.eye; if (D_80B41D90 != 0) { f32 speed = Math3D_Vec3f_DistXYZ(&D_80B42DB0, eye) / 7.058922f; @@ -484,23 +482,23 @@ void EnXc_SetColossusWindSFX(GlobalContext* globalCtx) { } } -void EnXc_SpawnFlame(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SpawnFlame(EnXc* this, PlayState* play) { static s32 sFlameSpawned = false; if (!sFlameSpawned) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0); + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); f32 xPos = npcAction->startPos.x; f32 yPos = npcAction->startPos.y; f32 zPos = npcAction->startPos.z; - this->flameActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_LIGHT, xPos, yPos, zPos, 0, 0, 0, 5); + this->flameActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_LIGHT, xPos, yPos, zPos, 0, 0, 0, 5); sFlameSpawned = true; } } -void EnXc_SetupFlamePos(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupFlamePos(EnXc* this, PlayState* play) { Vec3f* attachedPos; - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0); + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); if (this->flameActor != NULL) { attachedPos = &this->flameActor->world.pos; @@ -519,19 +517,19 @@ void EnXc_DestroyFlame(EnXc* this) { Actor_Kill(&this->actor); } -void EnXc_InitFlame(EnXc* this, GlobalContext* globalCtx) { +void EnXc_InitFlame(EnXc* this, PlayState* play) { static s32 D_80B41DA8 = 1; s32 pad; - s16 sceneNum = globalCtx->sceneNum; + s16 sceneNum = play->sceneNum; if (sceneNum == SCENE_SPOT17) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0); + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); if (npcAction != NULL) { s32 action = npcAction->action; if (D_80B41DA8 != action) { if (action != 1) { - EnXc_SpawnFlame(this, globalCtx); + EnXc_SpawnFlame(this, play); } if (action == 1) { @@ -541,29 +539,29 @@ void EnXc_InitFlame(EnXc* this, GlobalContext* globalCtx) { D_80B41DA8 = action; } - EnXc_SetupFlamePos(this, globalCtx); + EnXc_SetupFlamePos(this, play); } } } -void func_80B3D48C(EnXc* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80B3D48C(EnXc* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; CsCmdActorAction* linkAction = csCtx->linkAction; s16 yaw; if (linkAction != NULL) { yaw = linkAction->urot.y + 0x8000; } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); yaw = player->actor.world.rot.y + 0x8000; } this->actor.shape.rot.y = this->actor.world.rot.y = yaw; } -AnimationHeader* EnXc_GetCurrentHarpAnim(GlobalContext* globalCtx, s32 index) { +AnimationHeader* EnXc_GetCurrentHarpAnim(PlayState* play, s32 index) { AnimationHeader* animation = &gSheikPlayingHarp5Anim; - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, index); + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, index); if (npcAction != NULL) { u16 action = npcAction->action; @@ -626,15 +624,15 @@ void func_80B3D730(EnXc* this) { EnXc_CalcXZSpeed(this); } -void func_80B3D750(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_MinuetCS(this, globalCtx) && EnXc_BoleroCS(this, globalCtx)) { +void func_80B3D750(EnXc* this, PlayState* play) { + if (EnXc_MinuetCS(this, play) && EnXc_BoleroCS(this, play)) { this->action = SHEIK_ACTION_WAIT; } } -void EnXc_SetupFallFromSkyAction(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupFallFromSkyAction(EnXc* this, PlayState* play) { s32 pad; - CutsceneContext* csCtx = &globalCtx->csCtx; + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { CsCmdActorAction* npcAction = csCtx->npcActions[4]; @@ -652,15 +650,15 @@ void EnXc_SetupFallFromSkyAction(EnXc* this, GlobalContext* globalCtx) { pos->y = npcAction->startPos.y; pos->z = npcAction->startPos.z; - func_80B3D48C(this, globalCtx); - func_80B3C964(this, globalCtx); + func_80B3D48C(this, play); + func_80B3C964(this, play); Animation_Change(skelAnime, &gSheikFallingFromSkyAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); - func_80B3D118(globalCtx); + func_80B3D118(play); } } } -void func_80B3D8A4(EnXc* this, GlobalContext* globalCtx, s32 animFinished) { +void func_80B3D8A4(EnXc* this, PlayState* play, s32 animFinished) { if (animFinished) { SkelAnime* skelAnime = &this->skelAnime; f32 frameCount = Animation_GetLastFrame(&gSheikWalkingAnim); @@ -674,7 +672,7 @@ void func_80B3D8A4(EnXc* this, GlobalContext* globalCtx, s32 animFinished) { this->actor.gravity = -((kREG(1) * 0.01f) + 13.0f); this->actor.minVelocityY = -((kREG(1) * 0.01f) + 13.0f); } else { - func_80B3C8CC(this, globalCtx); + func_80B3C8CC(this, play); } } @@ -711,8 +709,8 @@ void EnXc_SetupStoppedAction(EnXc* this) { } } -void func_80B3DAF0(EnXc* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 4); +void func_80B3DAF0(EnXc* this, PlayState* play) { + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 4); u16 action; if (npcAction && @@ -739,7 +737,7 @@ void EnXc_SetupInitialHarpAction(EnXc* this, s32 animFinished) { } } -void EnXc_SetupPlayingHarpAction(EnXc* this, GlobalContext* globalCtx, s32 animFinished) { +void EnXc_SetupPlayingHarpAction(EnXc* this, PlayState* play, s32 animFinished) { s32 pad; SkelAnime* skelAnime; AnimationHeader* animation; @@ -747,7 +745,7 @@ void EnXc_SetupPlayingHarpAction(EnXc* this, GlobalContext* globalCtx, s32 animF if (animFinished) { skelAnime = &this->skelAnime; - animation = EnXc_GetCurrentHarpAnim(globalCtx, 4); + animation = EnXc_GetCurrentHarpAnim(play, 4); frameCount = Animation_GetLastFrame(animation); Animation_Change(skelAnime, animation, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, -8.0f); this->action = SHEIK_PLAYING_HARP; @@ -755,11 +753,11 @@ void EnXc_SetupPlayingHarpAction(EnXc* this, GlobalContext* globalCtx, s32 animF } } -void func_80B3DCA8(EnXc* this, GlobalContext* globalCtx) { +void func_80B3DCA8(EnXc* this, PlayState* play) { f32 frameCount; - if (globalCtx->csCtx.state != 0) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[4]; + if (play->csCtx.state != 0) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL && npcAction->action == 8) { frameCount = Animation_GetLastFrame(&gSheikInitialHarpAnim); @@ -770,11 +768,11 @@ void func_80B3DCA8(EnXc* this, GlobalContext* globalCtx) { } } -void EnXc_SetupHarpPutawayAction(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupHarpPutawayAction(EnXc* this, PlayState* play) { f32 curFrame; f32 animFrameCount; - if (EnXc_CompareCsAction(this, globalCtx, 5, 4)) { + if (EnXc_CompareCsAction(this, play, 5, 4)) { curFrame = this->skelAnime.curFrame; animFrameCount = this->skelAnime.endFrame; if (curFrame >= animFrameCount) { @@ -782,8 +780,8 @@ void EnXc_SetupHarpPutawayAction(EnXc* this, GlobalContext* globalCtx) { Animation_GetLastFrame(&gSheikInitialHarpAnim), 0.0f, ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_PUT_HARP_AWAY; } - } else if (EnXc_CsActionsAreNotEqual(this, globalCtx, 8, 4)) { - EnXc_SetupPlayingHarpAction(this, globalCtx, true); + } else if (EnXc_CsActionsAreNotEqual(this, play, 8, 4)) { + EnXc_SetupPlayingHarpAction(this, play, true); } } @@ -806,9 +804,9 @@ void func_80B3DE78(EnXc* this, s32 animFinished) { } } -void EnXc_SetupReverseAccel(EnXc* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[4]; +void EnXc_SetupReverseAccel(EnXc* this, PlayState* play) { + if (play->csCtx.state != 0) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL && npcAction->action == 4) { Animation_Change(&this->skelAnime, &gSheikWalkingAnim, -1.0f, Animation_GetLastFrame(&gSheikWalkingAnim), @@ -850,20 +848,20 @@ void EnXc_SetupNutThrow(EnXc* this) { } } -void func_80B3E164(EnXc* this, GlobalContext* globalCtx) { +void func_80B3E164(EnXc* this, PlayState* play) { this->timer++; if (this->timer >= 30.0f) { this->action = SHEIK_ACTION_DELETE; - EnXc_SpawnNut(this, globalCtx); + EnXc_SpawnNut(this, play); } } -void EnXc_SetupDisappear(EnXc* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[4]; +void EnXc_SetupDisappear(EnXc* this, PlayState* play) { + if (play->csCtx.state != 0) { + CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL && npcAction->action == 9) { - s16 sceneNum = globalCtx->sceneNum; + s16 sceneNum = play->sceneNum; // Sheik fades away if end of Bolero CS, kill actor otherwise if (sceneNum == SCENE_SPOT17) { @@ -877,166 +875,166 @@ void EnXc_SetupDisappear(EnXc* this, GlobalContext* globalCtx) { } } -void EnXc_ActionFunc0(EnXc* this, GlobalContext* globalCtx) { - EnXc_SetColossusAppearSFX(this, globalCtx); - EnXc_SetColossusWindSFX(globalCtx); - func_80B3D750(this, globalCtx); +void EnXc_ActionFunc0(EnXc* this, PlayState* play) { + EnXc_SetColossusAppearSFX(this, play); + EnXc_SetColossusWindSFX(play); + func_80B3D750(this, play); } -void EnXc_ActionFunc1(EnXc* this, GlobalContext* globalCtx) { - EnXc_SetColossusAppearSFX(this, globalCtx); - EnXc_SetColossusWindSFX(globalCtx); - EnXc_SetupFallFromSkyAction(this, globalCtx); +void EnXc_ActionFunc1(EnXc* this, PlayState* play) { + EnXc_SetColossusAppearSFX(this, play); + EnXc_SetColossusWindSFX(play); + EnXc_SetupFallFromSkyAction(this, play); } -void EnXc_GracefulFall(EnXc* this, GlobalContext* globalCtx) { +void EnXc_GracefulFall(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetLandingSFX(this, globalCtx); - EnXc_SetColossusAppearSFX(this, globalCtx); - EnXc_SetColossusWindSFX(globalCtx); - func_80B3D8A4(this, globalCtx, animFinished); + EnXc_SetLandingSFX(this, play); + EnXc_SetColossusAppearSFX(this, play); + EnXc_SetColossusWindSFX(play); + func_80B3D8A4(this, play, animFinished); } -void EnXc_Accelerate(EnXc* this, GlobalContext* globalCtx) { +void EnXc_Accelerate(EnXc* this, PlayState* play) { EnXc_CalcXZAccel(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); + EnXc_SetWalkingSFX(this, play); EnXc_SetupWalkAction(this); } -void EnXc_Walk(EnXc* this, GlobalContext* globalCtx) { +void EnXc_Walk(EnXc* this, PlayState* play) { func_80B3D644(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); + EnXc_SetWalkingSFX(this, play); EnXc_SetupHaltAction(this); } -void EnXc_Stopped(EnXc* this, GlobalContext* globalCtx) { +void EnXc_Stopped(EnXc* this, PlayState* play) { EnXc_CalcXZSpeed(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); + EnXc_SetWalkingSFX(this, play); EnXc_SetupStoppedAction(this); } -void EnXc_ActionFunc6(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc6(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - func_80B3DAF0(this, globalCtx); + func_80B3DAF0(this, play); } -void EnXc_ActionFunc7(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc7(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); EnXc_SetupInitialHarpAction(this, animFinished); } -void EnXc_ActionFunc8(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc8(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupPlayingHarpAction(this, globalCtx, animFinished); + EnXc_SetupPlayingHarpAction(this, play, animFinished); } -void EnXc_ActionFunc9(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc9(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - func_80B3DCA8(this, globalCtx); + func_80B3DCA8(this, play); } -void EnXc_ActionFunc10(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc10(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupHarpPutawayAction(this, globalCtx); + EnXc_SetupHarpPutawayAction(this, play); } -void EnXc_ActionFunc11(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc11(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); func_80B3DE00(this, animFinished); } -void EnXc_ActionFunc12(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc12(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); func_80B3DE78(this, animFinished); } -void EnXc_ActionFunc13(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc13(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_InitFlame(this, globalCtx); - EnXc_SetupReverseAccel(this, globalCtx); + EnXc_InitFlame(this, play); + EnXc_SetupReverseAccel(this, play); } -void EnXc_ReverseAccelerate(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ReverseAccelerate(EnXc* this, PlayState* play) { func_80B3D6F0(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); - EnXc_InitFlame(this, globalCtx); + EnXc_SetWalkingSFX(this, play); + EnXc_InitFlame(this, play); EnXc_SetupReverseWalkAction(this); } -void EnXc_ActionFunc15(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc15(EnXc* this, PlayState* play) { func_80B3D710(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); - EnXc_InitFlame(this, globalCtx); + EnXc_SetWalkingSFX(this, play); + EnXc_InitFlame(this, play); EnXc_SetupReverseHaltAction(this); } -void EnXc_HaltAndWaitToThrowNut(EnXc* this, GlobalContext* globalCtx) { +void EnXc_HaltAndWaitToThrowNut(EnXc* this, PlayState* play) { func_80B3D730(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); - EnXc_InitFlame(this, globalCtx); + EnXc_SetWalkingSFX(this, play); + EnXc_InitFlame(this, play); EnXc_SetupNutThrow(this); } -void EnXc_ThrowNut(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ThrowNut(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetNutThrowSFX(this, globalCtx); - EnXc_InitFlame(this, globalCtx); - func_80B3E164(this, globalCtx); + EnXc_SetNutThrowSFX(this, play); + EnXc_InitFlame(this, play); + func_80B3E164(this, play); } -void EnXc_Delete(EnXc* this, GlobalContext* globalCtx) { +void EnXc_Delete(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_InitFlame(this, globalCtx); - EnXc_SetupDisappear(this, globalCtx); + EnXc_InitFlame(this, play); + EnXc_SetupDisappear(this, play); } -void EnXc_Fade(EnXc* this, GlobalContext* globalCtx) { - EnXc_InitFlame(this, globalCtx); +void EnXc_Fade(EnXc* this, PlayState* play) { + EnXc_InitFlame(this, play); } void func_80B3E87C(Gfx** dList, EnXc* this) { @@ -1047,7 +1045,7 @@ void func_80B3E87C(Gfx** dList, EnXc* this) { } } -s32 EnXc_PullingOutHarpOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnXc_PullingOutHarpOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnXc* this = (EnXc*)thisx; @@ -1058,8 +1056,7 @@ s32 EnXc_PullingOutHarpOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, return 0; } -s32 EnXc_HarpOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnXc_HarpOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnXc* this = (EnXc*)thisx; if (limbIndex == 12) { @@ -1069,13 +1066,13 @@ s32 EnXc_HarpOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return 0; } -void EnXc_DrawPullingOutHarp(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawPullingOutHarp(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; s32 pad; s16 eyePattern = this->eyeIdx; void* eyeTexture = sEyeTextures[eyePattern]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad2; OPEN_DISPS(gfxCtx, "../z_en_oA2_inSpot05.c", 1444); @@ -1085,19 +1082,19 @@ void EnXc_DrawPullingOutHarp(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 60, 0, 0, 0); func_80093D18(gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + func_8002EBCC(&this->actor, play, 0); + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnXc_PullingOutHarpOverrideLimbDraw, NULL, this); CLOSE_DISPS(gfxCtx, "../z_en_oA2_inSpot05.c", 1497); } -void EnXc_DrawHarp(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawHarp(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; s32 pad; s16 eyePattern = this->eyeIdx; void* eyeTexture = sEyeTextures[eyePattern]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad2; OPEN_DISPS(gfxCtx, "../z_en_oA2_inSpot05.c", 1511); @@ -1108,13 +1105,13 @@ void EnXc_DrawHarp(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 60, 0, 0, 0); func_80093D18(gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + func_8002EBCC(&this->actor, play, 0); + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnXc_HarpOverrideLimbDraw, NULL, this); CLOSE_DISPS(gfxCtx, "../z_en_oA2_inSpot05.c", 1564); } -void func_80B3EBF0(EnXc* this, GlobalContext* globalCtx) { +void func_80B3EBF0(EnXc* this, PlayState* play) { this->action = SHEIK_ACTION_20; } @@ -1122,8 +1119,8 @@ void func_80B3EC00(EnXc* this) { this->action = SHEIK_ACTION_21; } -void func_80B3EC0C(EnXc* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80B3EC0C(EnXc* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { CsCmdActorAction* npcAction = csCtx->npcActions[4]; @@ -1145,8 +1142,8 @@ void func_80B3EC0C(EnXc* this, GlobalContext* globalCtx) { } } -void func_80B3EC90(EnXc* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80B3EC90(EnXc* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { CsCmdActorAction* npcAction = csCtx->npcActions[4]; @@ -1165,51 +1162,51 @@ void func_80B3ECD8(EnXc* this) { } } -void EnXc_ActionFunc20(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc20(EnXc* this, PlayState* play) { func_80B3EC00(this); } -void EnXc_ActionFunc21(EnXc* this, GlobalContext* globalCtx) { - func_80B3EC0C(this, globalCtx); +void EnXc_ActionFunc21(EnXc* this, PlayState* play) { + func_80B3EC0C(this, play); } -void EnXc_ActionFunc22(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc22(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - func_80B3EC90(this, globalCtx); + func_80B3EC90(this, play); } -void EnXc_ActionFunc23(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc23(EnXc* this, PlayState* play) { func_80B3D6F0(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); + EnXc_SetWalkingSFX(this, play); func_80B3ECD8(this); } -void EnXc_ActionFunc24(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc24(EnXc* this, PlayState* play) { } -void EnXc_ActionFunc25(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc25(EnXc* this, PlayState* play) { } -void EnXc_ActionFunc26(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc26(EnXc* this, PlayState* play) { } -void EnXc_ActionFunc27(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc27(EnXc* this, PlayState* play) { } -void EnXc_ActionFunc28(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc28(EnXc* this, PlayState* play) { } -void func_80B3EE64(EnXc* this, GlobalContext* globalCtx) { +void func_80B3EE64(EnXc* this, PlayState* play) { this->action = SHEIK_ACTION_SERENADE; } -void func_80B3EE74(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_SerenadeCS(this, globalCtx)) { +void func_80B3EE74(EnXc* this, PlayState* play) { + if (EnXc_SerenadeCS(this, play)) { this->action = SHEIK_ACTION_30; } } @@ -1277,89 +1274,89 @@ void func_80B3F100(EnXc* this) { EnXc_CheckAndSetAction(this, SHEIK_ACTION_43, SHEIK_ACTION_44); } -void EnXc_Serenade(EnXc* this, GlobalContext* globalCtx) { - func_80B3EE74(this, globalCtx); +void EnXc_Serenade(EnXc* this, PlayState* play) { + func_80B3EE74(this, play); } -void EnXc_ActionFunc30(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc21(this, globalCtx); +void EnXc_ActionFunc30(EnXc* this, PlayState* play) { + EnXc_ActionFunc21(this, play); func_80B3EEA4(this); } -void EnXc_ActionFunc31(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc6(this, globalCtx); - func_80B3C588(this, globalCtx, 4); +void EnXc_ActionFunc31(EnXc* this, PlayState* play) { + EnXc_ActionFunc6(this, play); + func_80B3C588(this, play, 4); func_80B3EEC8(this); } -void EnXc_ActionFunc32(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc7(this, globalCtx); +void EnXc_ActionFunc32(EnXc* this, PlayState* play) { + EnXc_ActionFunc7(this, play); func_80B3EEEC(this); } -void EnXc_ActionFunc33(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc8(this, globalCtx); +void EnXc_ActionFunc33(EnXc* this, PlayState* play) { + EnXc_ActionFunc8(this, play); func_80B3EF10(this); } -void EnXc_ActionFunc34(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc9(this, globalCtx); +void EnXc_ActionFunc34(EnXc* this, PlayState* play) { + EnXc_ActionFunc9(this, play); func_80B3EF34(this); } -void EnXc_ActionFunc35(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc10(this, globalCtx); +void EnXc_ActionFunc35(EnXc* this, PlayState* play) { + EnXc_ActionFunc10(this, play); func_80B3EF58(this); } -void EnXc_ActionFunc36(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc11(this, globalCtx); +void EnXc_ActionFunc36(EnXc* this, PlayState* play) { + EnXc_ActionFunc11(this, play); func_80B3EF80(this); } -void EnXc_ActionFunc37(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc12(this, globalCtx); +void EnXc_ActionFunc37(EnXc* this, PlayState* play) { + EnXc_ActionFunc12(this, play); func_80B3EFA4(this); } -void EnXc_ActionFunc38(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc13(this, globalCtx); +void EnXc_ActionFunc38(EnXc* this, PlayState* play) { + EnXc_ActionFunc13(this, play); func_80B3EFC8(this); } -void EnXc_ActionFunc39(EnXc* this, GlobalContext* globalCtx) { - EnXc_ReverseAccelerate(this, globalCtx); +void EnXc_ActionFunc39(EnXc* this, PlayState* play) { + EnXc_ReverseAccelerate(this, play); func_80B3EFEC(this); } -void EnXc_ActionFunc40(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc40(EnXc* this, PlayState* play) { func_80B3D710(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); + EnXc_SetWalkingSFX(this, play); func_80B3F010(this); } -void EnXc_ActionFunc41(EnXc* this, GlobalContext* globalCtx) { - EnXc_HaltAndWaitToThrowNut(this, globalCtx); +void EnXc_ActionFunc41(EnXc* this, PlayState* play) { + EnXc_HaltAndWaitToThrowNut(this, play); func_80B3F0B8(this); } -void EnXc_ActionFunc42(EnXc* this, GlobalContext* globalCtx) { - EnXc_ThrowNut(this, globalCtx); +void EnXc_ActionFunc42(EnXc* this, PlayState* play) { + EnXc_ThrowNut(this, play); func_80B3F0DC(this); } -void EnXc_ActionFunc43(EnXc* this, GlobalContext* globalCtx) { - EnXc_Delete(this, globalCtx); +void EnXc_ActionFunc43(EnXc* this, PlayState* play) { + EnXc_Delete(this, play); func_80B3F100(this); } -void EnXc_ActionFunc44(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc44(EnXc* this, PlayState* play) { } -void func_80B3F3C8(EnXc* this, GlobalContext* globalCtx) { +void func_80B3F3C8(EnXc* this, PlayState* play) { this->action = SHEIK_ACTION_45; } @@ -1367,15 +1364,15 @@ void func_80B3F3D8() { func_800788CC(NA_SE_PL_SKIP); } -void EnXc_PlayDiveSFX(Vec3f* src, GlobalContext* globalCtx) { +void EnXc_PlayDiveSFX(Vec3f* src, PlayState* play) { f32 wDest[2]; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, src, &D_80B42DA0, wDest); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, src, &D_80B42DA0, wDest); func_80078914(&D_80B42DA0, NA_SE_EV_DIVE_INTO_WATER); } -void EnXc_LakeHyliaDive(GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = npcAction = EnXc_GetCsCmd(globalCtx, 0); +void EnXc_LakeHyliaDive(PlayState* play) { + CsCmdActorAction* npcAction = npcAction = EnXc_GetCsCmd(play, 0); if (npcAction != NULL) { Vec3f startPos; @@ -1384,27 +1381,26 @@ void EnXc_LakeHyliaDive(GlobalContext* globalCtx) { startPos.y = npcAction->startPos.y; startPos.z = npcAction->startPos.z; - EffectSsGRipple_Spawn(globalCtx, &startPos, 100, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &startPos, 100, 500, 10); - EffectSsGRipple_Spawn(globalCtx, &startPos, 100, 500, 20); - EffectSsGSplash_Spawn(globalCtx, &startPos, NULL, NULL, 1, 0); - EnXc_PlayDiveSFX(&startPos, globalCtx); + EffectSsGRipple_Spawn(play, &startPos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &startPos, 100, 500, 10); + EffectSsGRipple_Spawn(play, &startPos, 100, 500, 20); + EffectSsGSplash_Spawn(play, &startPos, NULL, NULL, 1, 0); + EnXc_PlayDiveSFX(&startPos, play); } } -void func_80B3F534(GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80B3F534(PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; u16 frameCount = csCtx->frames; if (frameCount == 310) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, -1044.0f, -1243.0f, 7458.0f, 0, 0, 0, - WARP_DESTINATION); + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, -1044.0f, -1243.0f, 7458.0f, 0, 0, 0, WARP_DESTINATION); } } -void func_80B3F59C(EnXc* this, GlobalContext* globalCtx) { +void func_80B3F59C(EnXc* this, PlayState* play) { static s32 D_80B41DAC = 1; - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0); + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); if (npcAction != NULL) { s32 action = npcAction->action; @@ -1415,7 +1411,7 @@ void func_80B3F59C(EnXc* this, GlobalContext* globalCtx) { func_80B3F3D8(); break; case 3: - EnXc_LakeHyliaDive(globalCtx); + EnXc_LakeHyliaDive(play); break; default: break; @@ -1433,8 +1429,8 @@ void func_80B3F644(EnXc* this) { EnXc_CheckAndSetAction(this, SHEIK_ACTION_46, SHEIK_ACTION_47); } -void func_80B3F668(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 4, 4)) { +void func_80B3F668(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 4, 4)) { EnXc_ChangeAnimation(this, &gSheikWalkingAnim, ANIMMODE_LOOP, -12.0f, true); this->action = SHEIK_ACTION_48; this->actor.world.rot.y += 0x8000; @@ -1446,81 +1442,81 @@ void func_80B3F6DC(EnXc* this) { EnXc_CheckAndSetAction(this, SHEIK_ACTION_48, SHEIK_ACTION_49); } -void EnXc_SetupKneelAction(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 16, 4)) { +void EnXc_SetupKneelAction(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 16, 4)) { EnXc_ChangeAnimation(this, &gSheikKneelingAnim, ANIMMODE_LOOP, 0.0f, false); this->action = SHEIK_ACTION_KNEEL; } } -void func_80B3F754(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 22, 4)) { +void func_80B3F754(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 22, 4)) { EnXc_ChangeAnimation(this, &gSheikAnim_01A048, ANIMMODE_LOOP, 0.0f, false); this->action = SHEIK_ACTION_51; - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); } } -void func_80B3F7BC(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 9, 4)) { +void func_80B3F7BC(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 9, 4)) { this->action = SHEIK_ACTION_52; this->drawMode = SHEIK_DRAW_NOTHING; } } -void EnXc_ActionFunc45(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc20(this, globalCtx); +void EnXc_ActionFunc45(EnXc* this, PlayState* play) { + EnXc_ActionFunc20(this, play); func_80B3F620(this); } -void EnXc_ActionFunc46(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc21(this, globalCtx); +void EnXc_ActionFunc46(EnXc* this, PlayState* play) { + EnXc_ActionFunc21(this, play); func_80B3F644(this); } -void EnXc_ActionFunc47(EnXc* this, GlobalContext* globalCtx) { - func_80B3F534(globalCtx); +void EnXc_ActionFunc47(EnXc* this, PlayState* play) { + func_80B3F534(play); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); - func_80B3C588(this, globalCtx, 4); - func_80B3F668(this, globalCtx); + EnXc_BgCheck(this, play); + func_80B3C588(this, play, 4); + func_80B3F668(this, play); } -void EnXc_ActionFunc48(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc23(this, globalCtx); +void EnXc_ActionFunc48(EnXc* this, PlayState* play) { + EnXc_ActionFunc23(this, play); func_80B3F6DC(this); } -void EnXc_ActionFunc49(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc49(EnXc* this, PlayState* play) { func_80B3D710(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetWalkingSFX(this, globalCtx); - EnXc_SetupKneelAction(this, globalCtx); + EnXc_SetWalkingSFX(this, play); + EnXc_SetupKneelAction(this, play); } -void EnXc_Kneel(EnXc* this, GlobalContext* globalCtx) { +void EnXc_Kneel(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); - func_80B3F59C(this, globalCtx); - func_80B3C588(this, globalCtx, 4); - func_80B3F754(this, globalCtx); + EnXc_BgCheck(this, play); + func_80B3F59C(this, play); + func_80B3C588(this, play, 4); + func_80B3F754(this, play); } -void EnXc_ActionFunc51(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc51(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); - func_80B3F59C(this, globalCtx); - func_80B3C620(this, globalCtx, 4); - func_80B3F7BC(this, globalCtx); + EnXc_BgCheck(this, play); + func_80B3F59C(this, play); + func_80B3C620(this, play, 4); + func_80B3F7BC(this, play); } -void EnXc_ActionFunc52(EnXc* this, GlobalContext* globalCtx) { - func_80B3F59C(this, globalCtx); +void EnXc_ActionFunc52(EnXc* this, PlayState* play) { + func_80B3F59C(this, play); } -void func_80B3FA08(EnXc* this, GlobalContext* globalCtx) { +void func_80B3FA08(EnXc* this, PlayState* play) { this->action = SHEIK_ACTION_53; this->triforceAngle = kREG(24) + 0x53FC; } @@ -1529,7 +1525,7 @@ void func_80B3FA2C(void) { func_800F3F3C(1); } -void EnXc_PlayTriforceSFX(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_PlayTriforceSFX(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; if (this->unk_2A8) { @@ -1540,8 +1536,8 @@ void EnXc_PlayTriforceSFX(Actor* thisx, GlobalContext* globalCtx) { f32 wDest; Matrix_MultVec3f(&sp1C, &src); - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &src, &pos, &wDest); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &pos, 80, NA_SE_EV_TRIFORCE_MARK); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &src, &pos, &wDest); + SoundSource_PlaySfxAtFixedWorldPos(play, &pos, 80, NA_SE_EV_TRIFORCE_MARK); this->unk_2A8 = 0; } } @@ -1553,16 +1549,16 @@ void func_80B3FAE0(EnXc* this) { } } -void EnXc_CalcTriforce(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_CalcTriforce(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; - if (EnXc_CompareCsAction(this, globalCtx, 21, 4)) { + if (EnXc_CompareCsAction(this, play, 21, 4)) { this->unk_274 = 1; if (this->unk_2AC == 0) { this->unk_2AC = 1; this->unk_2A8 = 1; } - } else if (EnXc_CompareCsAction(this, globalCtx, 19, 4)) { + } else if (EnXc_CompareCsAction(this, play, 19, 4)) { this->unk_274 = 2; } if (this->unk_274 != 0) { @@ -1606,12 +1602,12 @@ void EnXc_CalcTriforce(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B3FF0C(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CsActionsAreNotEqual(this, globalCtx, 1, 4)) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void func_80B3FF0C(EnXc* this, PlayState* play) { + if (EnXc_CsActionsAreNotEqual(this, play, 1, 4)) { + CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { - CsCmdActorAction* npcAction = globalCtx->csCtx.npcActions[4]; + CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL) { PosRot* posRot = &this->actor.world; @@ -1631,8 +1627,8 @@ void func_80B3FF0C(EnXc* this, GlobalContext* globalCtx) { } } -void EnXc_SetupShowTriforceAction(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 10, 4)) { +void EnXc_SetupShowTriforceAction(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 10, 4)) { Animation_Change(&this->skelAnime, &gSheikShowingTriforceOnHandAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikShowingTriforceOnHandAnim), ANIMMODE_ONCE, -8.0f); this->action = SHEIK_ACTION_SHOW_TRIFORCE; @@ -1647,70 +1643,69 @@ void EnXc_SetupShowTriforceIdleAction(EnXc* this, s32 animFinished) { this->action = SHEIK_ACTION_SHOW_TRIFORCE_IDLE; } } -void func_80B400AC(EnXc* this, GlobalContext* globalCtx) { - if (EnXc_CompareCsAction(this, globalCtx, 9, 4)) { +void func_80B400AC(EnXc* this, PlayState* play) { + if (EnXc_CompareCsAction(this, play, 9, 4)) { Actor_Kill(&this->actor); } } -void EnXc_ActionFunc53(EnXc* this, GlobalContext* globalCtx) { - func_80B3FF0C(this, globalCtx); +void EnXc_ActionFunc53(EnXc* this, PlayState* play) { + func_80B3FF0C(this, play); } -void EnXc_ActionFunc54(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc54(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupShowTriforceAction(this, globalCtx); - func_80B3C888(this, globalCtx); + EnXc_SetupShowTriforceAction(this, play); + func_80B3C888(this, play); } -void EnXc_ShowTriforce(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ShowTriforce(EnXc* this, PlayState* play) { s32 animFinished = EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_CalcTriforce(&this->actor, globalCtx); + EnXc_CalcTriforce(&this->actor, play); func_80B3FAE0(this); EnXc_SetupShowTriforceIdleAction(this, animFinished); - func_80B3C888(this, globalCtx); + func_80B3C888(this, play); } -void EnXc_ShowTriforceIdle(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ShowTriforceIdle(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_CalcTriforce(&this->actor, globalCtx); - func_80B400AC(this, globalCtx); + EnXc_CalcTriforce(&this->actor, play); + func_80B400AC(this, play); } -s32 EnXc_TriforceOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 EnXc_TriforceOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { if (limbIndex == 15) { *dList = gSheikDL_011620; } return 0; } -void EnXc_TriforcePostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnXc_TriforcePostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { s32 pad[2]; EnXc* this = (EnXc*)thisx; if (limbIndex == 15) { Vec3f vec = { 0.0f, 0.0f, 0.0f }; - EnXc_PlayTriforceSFX(&this->actor, globalCtx); + EnXc_PlayTriforceSFX(&this->actor, play); Matrix_MultVec3f(&vec, &this->handPos); this->unk_2BC = 1; } } -void EnXc_DrawTriforce(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawTriforce(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; s32 pad; s16 eyeIdx = this->eyeIdx; void* eyeTexture = sEyeTextures[eyeIdx]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad2; OPEN_DISPS(gfxCtx, "../z_en_oA2_inMetamol.c", 565); @@ -1733,16 +1728,16 @@ void EnXc_DrawTriforce(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gSheikDL_012970); } - func_8002EBCC(thisx, globalCtx, 0); - func_80093D18(globalCtx->state.gfxCtx); + func_8002EBCC(thisx, play, 0); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTexture)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnXc_TriforceOverrideLimbDraw, EnXc_TriforcePostLimbDraw, this); CLOSE_DISPS(gfxCtx, "../z_en_oA2_inMetamol.c", 668); } -void func_80B40590(EnXc* this, GlobalContext* globalCtx) { +void func_80B40590(EnXc* this, PlayState* play) { this->action = SHEIK_ACTION_NOCTURNE_INIT; this->drawMode = SHEIK_DRAW_SQUINT; } @@ -1762,14 +1757,14 @@ void EnXc_SetThrownAroundSFX(EnXc* this) { } } -void EnXc_PlayLinkScreamSFX(EnXc* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 1455) { +void EnXc_PlayLinkScreamSFX(EnXc* this, PlayState* play) { + if (play->csCtx.frames == 1455) { func_800F3F3C(7); } } -void EnXc_SetCrySFX(EnXc* this, GlobalContext* globalCtx) { - CutsceneContext* csCtx = &globalCtx->csCtx; +void EnXc_SetCrySFX(EnXc* this, PlayState* play) { + CutsceneContext* csCtx = &play->csCtx; if (csCtx->frames == 869) { func_80078914(&this->actor.projectedPos, NA_SE_VO_SK_CRY_0); @@ -1786,14 +1781,14 @@ void func_80B406F8(Actor* thisx) { this->actor.shape.shadowAlpha = 0; } -void EnXc_SetupIdleInNocturne(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupIdleInNocturne(EnXc* this, PlayState* play) { s32 pad; ActorShape* actorShape = &this->actor.shape; SkelAnime* skelAnime = &this->skelAnime; f32 frameCount = Animation_GetLastFrame(&gSheikIdleAnim); func_80B3C9DC(this); - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); this->action = SHEIK_ACTION_NOCTURNE_IDLE; this->drawMode = SHEIK_DRAW_SQUINT; @@ -1810,14 +1805,14 @@ void EnXc_SetupDefenseStance(Actor* thisx) { this->drawMode = SHEIK_DRAW_DEFAULT; } -void EnXc_SetupContortions(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupContortions(EnXc* this, PlayState* play) { s32 pad; SkelAnime* skelAnime = &this->skelAnime; f32 frameCount = Animation_GetLastFrame(&gSheikIdleAnim); Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); - func_80B3C588(this, globalCtx, 4); - func_80B3C964(this, globalCtx); + func_80B3C588(this, play, 4); + func_80B3C964(this, play); Animation_Change(skelAnime, &gSheikContortionsAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikContortionsAnim), ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_CONTORT; @@ -1825,14 +1820,14 @@ void EnXc_SetupContortions(EnXc* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = 255; } -void EnXc_SetupFallInNocturne(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupFallInNocturne(EnXc* this, PlayState* play) { s32 pad; SkelAnime* skelAnime = &this->skelAnime; f32 frameCount = Animation_GetLastFrame(&gSheikIdleAnim); Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); - func_80B3C588(this, globalCtx, 4); - func_80B3C964(this, globalCtx); + func_80B3C588(this, play, 4); + func_80B3C964(this, play); Animation_Change(skelAnime, &gSheikFallingFromContortionsAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikFallingFromContortionsAnim), ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_NOCTURNE_FALL; @@ -1840,47 +1835,47 @@ void EnXc_SetupFallInNocturne(EnXc* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = 255; } -void EnXc_SetupHittingGroundInNocturne(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupHittingGroundInNocturne(EnXc* this, PlayState* play) { s32 pad[3]; f32 frameCount = Animation_GetLastFrame(&gSheikHittingGroundAnim); func_80B3C9DC(this); - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); Animation_Change(&this->skelAnime, &gSheikHittingGroundAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_NOCTURNE_HIT_GROUND; this->drawMode = SHEIK_DRAW_DEFAULT; this->actor.shape.shadowAlpha = 255; } -void func_80B40A78(EnXc* this, GlobalContext* globalCtx) { +void func_80B40A78(EnXc* this, PlayState* play) { s32 pad[3]; f32 frameCount = Animation_GetLastFrame(&gSheikHittingGroundAnim); func_80B3C9DC(this); - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); Animation_Change(&this->skelAnime, &gSheikHittingGroundAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_63; this->drawMode = SHEIK_DRAW_DEFAULT; this->actor.shape.shadowAlpha = 255; } -void EnXc_SetupKneelInNocturne(EnXc* this, GlobalContext* globalCtx) { +void EnXc_SetupKneelInNocturne(EnXc* this, PlayState* play) { s32 pad[3]; f32 frameCount = Animation_GetLastFrame(&gSheikKneelingAnim); func_80B3C9DC(this); - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); Animation_Change(&this->skelAnime, &gSheikKneelingAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); this->action = SHEIK_ACTION_NOCTURNE_KNEEL; this->drawMode = SHEIK_DRAW_DEFAULT; this->actor.shape.shadowAlpha = 255; } -void func_80B40BB4(EnXc* this, GlobalContext* globalCtx) { +void func_80B40BB4(EnXc* this, PlayState* play) { s32 pad[3]; f32 frameCount = Animation_GetLastFrame(&gSheikIdleAnim); func_80B3C9DC(this); - func_80B3C588(this, globalCtx, 4); + func_80B3C588(this, play, 4); Animation_Change(&this->skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); this->action = SHEIK_ACTION_65; this->drawMode = SHEIK_DRAW_DEFAULT; @@ -1946,8 +1941,8 @@ void func_80B40E88(EnXc* this) { EnXc_CheckAndSetAction(this, SHEIK_ACTION_77, SHEIK_ACTION_78); } -s32 EnXc_SetupNocturneState(Actor* thisx, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 4); +s32 EnXc_SetupNocturneState(Actor* thisx, PlayState* play) { + CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 4); if (npcAction != NULL) { s32 action = npcAction->action; @@ -1960,28 +1955,28 @@ s32 EnXc_SetupNocturneState(Actor* thisx, GlobalContext* globalCtx) { func_80B406F8(thisx); break; case 6: - EnXc_SetupIdleInNocturne(this, globalCtx); + EnXc_SetupIdleInNocturne(this, play); break; case 20: EnXc_SetupDefenseStance(thisx); break; case 18: - EnXc_SetupContortions(this, globalCtx); + EnXc_SetupContortions(this, play); break; case 14: - EnXc_SetupFallInNocturne(this, globalCtx); + EnXc_SetupFallInNocturne(this, play); break; case 19: - EnXc_SetupHittingGroundInNocturne(this, globalCtx); + EnXc_SetupHittingGroundInNocturne(this, play); break; case 15: - func_80B40A78(this, globalCtx); + func_80B40A78(this, play); break; case 16: - EnXc_SetupKneelInNocturne(this, globalCtx); + EnXc_SetupKneelInNocturne(this, play); break; case 17: - func_80B40BB4(this, globalCtx); + func_80B40BB4(this, play); break; case 9: Actor_Kill(thisx); @@ -1998,163 +1993,162 @@ s32 EnXc_SetupNocturneState(Actor* thisx, GlobalContext* globalCtx) { return 0; } -void EnXc_InitialNocturneAction(EnXc* this, GlobalContext* globalCtx) { - EnXc_SetupNocturneState(&this->actor, globalCtx); +void EnXc_InitialNocturneAction(EnXc* this, PlayState* play) { + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_IdleInNocturne(EnXc* this, GlobalContext* globalCtx) { - func_80B3C588(this, globalCtx, 4); +void EnXc_IdleInNocturne(EnXc* this, PlayState* play) { + func_80B3C588(this, play, 4); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); - EnXc_SetupNocturneState(&this->actor, globalCtx); + EnXc_BgCheck(this, play); + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_DefenseStance(EnXc* this, GlobalContext* globalCtx) { +void EnXc_DefenseStance(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupNocturneState(&this->actor, globalCtx); + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_Contort(EnXc* this, GlobalContext* globalCtx) { - EnXc_SetCrySFX(this, globalCtx); +void EnXc_Contort(EnXc* this, PlayState* play) { + EnXc_SetCrySFX(this, play); EnXc_AnimIsFinished(this); EnXc_SetEyePattern(this); - if (!EnXc_SetupNocturneState(&this->actor, globalCtx)) { - func_80B3C924(this, globalCtx); - EnXc_BgCheck(this, globalCtx); + if (!EnXc_SetupNocturneState(&this->actor, play)) { + func_80B3C924(this, play); + EnXc_BgCheck(this, play); } } -void EnXc_FallInNocturne(EnXc* this, GlobalContext* globalCtx) { +void EnXc_FallInNocturne(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); EnXc_SetEyePattern(this); EnXc_SetThrownAroundSFX(this); - if (!EnXc_SetupNocturneState(&this->actor, globalCtx)) { - func_80B3C8CC(this, globalCtx); - EnXc_BgCheck(this, globalCtx); + if (!EnXc_SetupNocturneState(&this->actor, play)) { + func_80B3C8CC(this, play); + EnXc_BgCheck(this, play); } } -void EnXc_HitGroundInNocturne(EnXc* this, GlobalContext* globalCtx) { - EnXc_BgCheck(this, globalCtx); +void EnXc_HitGroundInNocturne(EnXc* this, PlayState* play) { + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupNocturneState(&this->actor, globalCtx); + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_ActionFunc63(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ActionFunc63(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_PlayLinkScreamSFX(this, globalCtx); - EnXc_BgCheck(this, globalCtx); + EnXc_PlayLinkScreamSFX(this, play); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupNocturneState(&this->actor, globalCtx); + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_KneelInNocturneCS(EnXc* this, GlobalContext* globalCtx) { +void EnXc_KneelInNocturneCS(EnXc* this, PlayState* play) { EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); - EnXc_SetupNocturneState(&this->actor, globalCtx); + EnXc_SetupNocturneState(&this->actor, play); } -void EnXc_ActionFunc65(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc6(this, globalCtx); - func_80B3C588(this, globalCtx, 4); +void EnXc_ActionFunc65(EnXc* this, PlayState* play) { + EnXc_ActionFunc6(this, play); + func_80B3C588(this, play, 4); func_80B40C50(this); } -void EnXc_ActionFunc66(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc7(this, globalCtx); +void EnXc_ActionFunc66(EnXc* this, PlayState* play) { + EnXc_ActionFunc7(this, play); func_80B40C74(this); } -void EnXc_ActionFunc67(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc8(this, globalCtx); +void EnXc_ActionFunc67(EnXc* this, PlayState* play) { + EnXc_ActionFunc8(this, play); func_80B40C98(this); } -void EnXc_ActionFunc68(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc9(this, globalCtx); +void EnXc_ActionFunc68(EnXc* this, PlayState* play) { + EnXc_ActionFunc9(this, play); func_80B40CBC(this); } -void EnXc_ActionFunc69(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc10(this, globalCtx); +void EnXc_ActionFunc69(EnXc* this, PlayState* play) { + EnXc_ActionFunc10(this, play); func_80B40CE0(this); } -void EnXc_ActionFunc70(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc11(this, globalCtx); +void EnXc_ActionFunc70(EnXc* this, PlayState* play) { + EnXc_ActionFunc11(this, play); func_80B40D08(this); } -void EnXc_ActionFunc71(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc12(this, globalCtx); +void EnXc_ActionFunc71(EnXc* this, PlayState* play) { + EnXc_ActionFunc12(this, play); func_80B40D2C(this); } -void EnXc_ActionFunc72(EnXc* this, GlobalContext* globalCtx) { - EnXc_ActionFunc13(this, globalCtx); +void EnXc_ActionFunc72(EnXc* this, PlayState* play) { + EnXc_ActionFunc13(this, play); func_80B40D50(this); } -void EnXc_ReverseAccelInNocturneCS(EnXc* this, GlobalContext* globalCtx) { - EnXc_ReverseAccelerate(this, globalCtx); +void EnXc_ReverseAccelInNocturneCS(EnXc* this, PlayState* play) { + EnXc_ReverseAccelerate(this, play); func_80B40D74(this); } -void EnXc_ReverseWalkInNocturneCS(EnXc* this, GlobalContext* globalCtx) { +void EnXc_ReverseWalkInNocturneCS(EnXc* this, PlayState* play) { func_80B3D710(this); EnXc_AnimIsFinished(this); - EnXc_BgCheck(this, globalCtx); + EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); EnXc_SetupReverseHaltInNocturneCS(this); } -void EnXc_ReverseHaltInNocturneCS(EnXc* this, GlobalContext* globalCtx) { - EnXc_HaltAndWaitToThrowNut(this, globalCtx); +void EnXc_ReverseHaltInNocturneCS(EnXc* this, PlayState* play) { + EnXc_HaltAndWaitToThrowNut(this, play); func_80B40E40(this); } -void EnXc_ThrowNutInNocturneCS(EnXc* this, GlobalContext* globalCtx) { - EnXc_ThrowNut(this, globalCtx); +void EnXc_ThrowNutInNocturneCS(EnXc* this, PlayState* play) { + EnXc_ThrowNut(this, play); func_80B40E64(this); } -void EnXc_DeleteInNocturneCS(EnXc* this, GlobalContext* globalCtx) { - EnXc_Delete(this, globalCtx); +void EnXc_DeleteInNocturneCS(EnXc* this, PlayState* play) { + EnXc_Delete(this, play); func_80B40E88(this); } -void EnXc_KillInNocturneCS(EnXc* this, GlobalContext* globalCtx) { +void EnXc_KillInNocturneCS(EnXc* this, PlayState* play) { Actor_Kill(&this->actor); } -void EnXc_DrawSquintingEyes(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawSquintingEyes(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_en_oA2_inStalker.c", 839); func_80093D18(gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gSheikEyeSquintingTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gSheikEyeSquintingTex)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, - NULL); + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, NULL); CLOSE_DISPS(gfxCtx, "../z_en_oA2_inStalker.c", 854); } -void EnXc_InitTempleOfTime(EnXc* this, GlobalContext* globalCtx) { +void EnXc_InitTempleOfTime(EnXc* this, PlayState* play) { if (LINK_IS_ADULT) { if (!GET_EVENTCHKINF(EVENTCHKINF_C5)) { SET_EVENTCHKINF(EVENTCHKINF_C5); - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTempleOfTimeFirstAdultCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTempleOfTimeFirstAdultCs); gSaveContext.cutsceneTrigger = 1; - func_80B3EBF0(this, globalCtx); + func_80B3EBF0(this, play); } else if (!GET_EVENTCHKINF(EVENTCHKINF_55) && GET_EVENTCHKINF(EVENTCHKINF_48)) { SET_EVENTCHKINF(EVENTCHKINF_55); - Item_Give(globalCtx, ITEM_SONG_PRELUDE); - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTempleOfTimePreludeCs); + Item_Give(play, ITEM_SONG_PRELUDE); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gTempleOfTimePreludeCs); gSaveContext.cutsceneTrigger = 1; this->action = SHEIK_ACTION_30; } else if (!GET_EVENTCHKINF(EVENTCHKINF_55)) { @@ -2167,8 +2161,8 @@ void EnXc_InitTempleOfTime(EnXc* this, GlobalContext* globalCtx) { } } -void EnXc_SetupDialogueAction(EnXc* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void EnXc_SetupDialogueAction(EnXc* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = SHEIK_ACTION_IN_DIALOGUE; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -2177,33 +2171,33 @@ void EnXc_SetupDialogueAction(EnXc* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x700F; } - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } -void func_80B41798(EnXc* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void func_80B41798(EnXc* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->action = SHEIK_ACTION_BLOCK_PEDESTAL; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); } } -void EnXc_BlockingPedestalAction(EnXc* this, GlobalContext* globalCtx) { - EnXc_BgCheck(this, globalCtx); - EnXc_UpdateCollider(&this->actor, globalCtx); - EnXc_CalculateHeadTurn(this, globalCtx); +void EnXc_BlockingPedestalAction(EnXc* this, PlayState* play) { + EnXc_BgCheck(this, play); + EnXc_UpdateCollider(&this->actor, play); + EnXc_CalculateHeadTurn(this, play); EnXc_AnimIsFinished(this); EnXc_SetEyePattern(this); - EnXc_SetupDialogueAction(this, globalCtx); + EnXc_SetupDialogueAction(this, play); } -void EnXc_ActionFunc80(EnXc* this, GlobalContext* globalCtx) { - EnXc_BgCheck(this, globalCtx); - EnXc_UpdateCollider(&this->actor, globalCtx); - EnXc_CalculateHeadTurn(this, globalCtx); +void EnXc_ActionFunc80(EnXc* this, PlayState* play) { + EnXc_BgCheck(this, play); + EnXc_UpdateCollider(&this->actor, play); + EnXc_CalculateHeadTurn(this, play); EnXc_AnimIsFinished(this); EnXc_SetEyePattern(this); - func_80B41798(this, globalCtx); + func_80B41798(this, play); } static EnXcActionFunc sActionFuncs[] = { @@ -2290,63 +2284,63 @@ static EnXcActionFunc sActionFuncs[] = { EnXc_ActionFunc80, }; -void EnXc_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_Update(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; s32 action = this->action; if ((action < 0) || (action >= ARRAY_COUNT(sActionFuncs)) || (sActionFuncs[action] == NULL)) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sActionFuncs[action](this, globalCtx); + sActionFuncs[action](this, play); } } -void EnXc_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_Init(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSheikSkel, &gSheikIdleAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gSheikSkel, &gSheikIdleAnim, this->jointTable, this->morphTable, ARRAY_COUNT(this->jointTable)); - EnXc_InitCollider(thisx, globalCtx); + EnXc_InitCollider(thisx, play); switch (this->actor.params) { case SHEIK_TYPE_1: - func_80B3EBF0(this, globalCtx); + func_80B3EBF0(this, play); break; case SHEIK_TYPE_2: // Beta Serenade Cutscene or Learning Prelude - func_80B3EE64(this, globalCtx); + func_80B3EE64(this, play); break; case SHEIK_TYPE_3: - func_80B3F3C8(this, globalCtx); + func_80B3F3C8(this, play); break; case SHEIK_TYPE_4: - func_80B3FA08(this, globalCtx); + func_80B3FA08(this, play); break; case SHEIK_TYPE_5: - func_80B40590(this, globalCtx); + func_80B40590(this, play); break; case SHEIK_TYPE_MINUET: - func_80B3CA38(this, globalCtx); + func_80B3CA38(this, play); break; case SHEIK_TYPE_BOLERO: - func_80B3CB58(this, globalCtx); + func_80B3CB58(this, play); break; case SHEIK_TYPE_SERENADE: - EnXc_SetupSerenadeAction(this, globalCtx); + EnXc_SetupSerenadeAction(this, play); break; case SHEIK_TYPE_9: - EnXc_InitTempleOfTime(this, globalCtx); + EnXc_InitTempleOfTime(this, play); break; case SHEIK_TYPE_0: - EnXc_DoNothing(this, globalCtx); + EnXc_DoNothing(this, play); break; default: osSyncPrintf(VT_FGCOL(RED) " En_Oa2 の arg_data がおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); - EnXc_DoNothing(this, globalCtx); + EnXc_DoNothing(this, play); } } -s32 EnXc_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnXc_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnXc* this = (EnXc*)thisx; if (this->unk_30C != 0) { @@ -2361,7 +2355,7 @@ s32 EnXc_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnXc_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnXc_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { if (limbIndex == 16) { EnXc* this = (EnXc*)thisx; Vec3f src = { 0.0f, 10.0f, 0.0f }; @@ -2377,24 +2371,24 @@ void EnXc_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnXc_DrawNothing(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawNothing(Actor* thisx, PlayState* play) { } -void EnXc_DrawDefault(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_DrawDefault(Actor* thisx, PlayState* play) { s32 pad; EnXc* this = (EnXc*)thisx; s16 eyeIdx = this->eyeIdx; void* eyeSegment = sEyeTextures[eyeIdx]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* localGfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* localGfxCtx = play->state.gfxCtx; GraphicsContext* gfxCtx = localGfxCtx; OPEN_DISPS(gfxCtx, "../z_en_oA2.c", 1164); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); func_80093D18(gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeSegment)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeSegment)); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnXc_OverrideLimbDraw, EnXc_PostLimbDraw, this); CLOSE_DISPS(gfxCtx, "../z_en_oA2.c", 1207); } @@ -2404,14 +2398,14 @@ static EnXcDrawFunc sDrawFuncs[] = { EnXc_DrawHarp, EnXc_DrawTriforce, EnXc_DrawSquintingEyes, }; -void EnXc_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnXc_Draw(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; if (this->drawMode < 0 || this->drawMode > 5 || sDrawFuncs[this->drawMode] == NULL) { // "Draw mode is abnormal!!!!!!!!!!!!!!!!!!!!!!!!!" osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sDrawFuncs[this->drawMode](thisx, globalCtx); + sDrawFuncs[this->drawMode](thisx, play); } } diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.h b/src/overlays/actors/ovl_En_Xc/z_en_xc.h index 59813e733e..8a8dc48504 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.h +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.h @@ -6,8 +6,8 @@ struct EnXc; -typedef void (*EnXcActionFunc)(struct EnXc*, GlobalContext*); -typedef void (*EnXcDrawFunc)(struct Actor*, GlobalContext*); +typedef void (*EnXcActionFunc)(struct EnXc*, PlayState*); +typedef void (*EnXcDrawFunc)(struct Actor*, PlayState*); typedef enum { /* 0 */ SHEIK_TYPE_0, diff --git a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c index 88fac1426f..cbe955756c 100644 --- a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c +++ b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void EnYabusameMark_Init(Actor* thisx, GlobalContext* globalCtx); -void EnYabusameMark_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnYabusameMark_Update(Actor* thisx, GlobalContext* globalCtx); -void func_80B42F74(EnYabusameMark* this, GlobalContext* globalCtx); +void EnYabusameMark_Init(Actor* thisx, PlayState* play); +void EnYabusameMark_Destroy(Actor* thisx, PlayState* play); +void EnYabusameMark_Update(Actor* thisx, PlayState* play); +void func_80B42F74(EnYabusameMark* this, PlayState* play); static ColliderQuadInit sQuadInit = { { @@ -69,13 +69,13 @@ static f32 sRingDistance[] = { 40.0f, 120.0f, 160.0f, 777.0f, // large }; -void EnYabusameMark_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnYabusameMark_Destroy(Actor* thisx, PlayState* play) { EnYabusameMark* this = (EnYabusameMark*)thisx; - Collider_DestroyQuad(globalCtx, &this->collider); + Collider_DestroyQuad(play, &this->collider); } -void EnYabusameMark_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnYabusameMark_Init(Actor* thisx, PlayState* play) { EnYabusameMark* this = (EnYabusameMark*)thisx; osSyncPrintf("\n\n"); @@ -101,8 +101,8 @@ void EnYabusameMark_Init(Actor* thisx, GlobalContext* globalCtx) { this->subTypeIndex = 4; break; } - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->actor, &sQuadInit); this->worldPos = this->actor.world.pos; this->actor.flags |= ACTOR_FLAG_4; if (gSaveContext.sceneSetupIndex != 4) { @@ -114,7 +114,7 @@ void EnYabusameMark_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B42F74; } -void func_80B42F74(EnYabusameMark* this, GlobalContext* globalCtx) { +void func_80B42F74(EnYabusameMark* this, PlayState* play) { Vec3f effectAccel = { 0.0f, 0.0f, 0.0f }; Vec3f effectVelocity = { 0.0f, 0.0f, 0.0f }; Vec3f arrowHitPos; @@ -134,7 +134,7 @@ void func_80B42F74(EnYabusameMark* this, GlobalContext* globalCtx) { effectVelocity.y = 15.0f; - EffectSsHitMark_SpawnCustomScale(globalCtx, 0, 700, &arrowHitPos); + EffectSsHitMark_SpawnCustomScale(play, 0, 700, &arrowHitPos); scoreIndex = 2; @@ -181,16 +181,16 @@ void func_80B42F74(EnYabusameMark* this, GlobalContext* globalCtx) { if (scoreIndex == 0) { func_80078884(NA_SE_SY_DECIDE); } - EffectSsExtra_Spawn(globalCtx, &arrowHitPos, &effectVelocity, &effectAccel, 5, scoreIndex); + EffectSsExtra_Spawn(play, &arrowHitPos, &effectVelocity, &effectAccel, 5, scoreIndex); } } -void EnYabusameMark_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnYabusameMark_Update(Actor* thisx, PlayState* play) { EnYabusameMark* this = (EnYabusameMark*)thisx; Vec3f* vertexArray; u32 arrayIndex; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); arrayIndex = this->typeIndex * 4; vertexArray = &sCollisionVertices[arrayIndex]; @@ -211,10 +211,10 @@ void EnYabusameMark_Update(Actor* thisx, GlobalContext* globalCtx) { this->vertexD.z = vertexArray[3].z + this->actor.world.pos.z; Collider_SetQuadVertices(&this->collider, &this->vertexA, &this->vertexB, &this->vertexC, &this->vertexD); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (BREG(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, 0xFF, 0, 0xFF, 4, globalCtx->state.gfxCtx); + 1.0f, 0, 0xFF, 0, 0xFF, 4, play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h index 363fd9cc73..f4ec71bec5 100644 --- a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h +++ b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h @@ -6,7 +6,7 @@ struct EnYabusameMark; -typedef void (*EnYabusameMarkActionFunc)(struct EnYabusameMark*, GlobalContext*); +typedef void (*EnYabusameMarkActionFunc)(struct EnYabusameMark*, PlayState*); typedef struct EnYabusameMark { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c index ff6a8e87fa..2fc875a07d 100644 --- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c +++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c @@ -9,14 +9,14 @@ #define FLAGS ACTOR_FLAG_4 -void EnYukabyun_Init(Actor* thisx, GlobalContext* globalCtx); -void EnYukabyun_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnYukabyun_Update(Actor* thisx, GlobalContext* globalCtx); -void EnYukabyun_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnYukabyun_Init(Actor* thisx, PlayState* play); +void EnYukabyun_Destroy(Actor* thisx, PlayState* play); +void EnYukabyun_Update(Actor* thisx, PlayState* play); +void EnYukabyun_Draw(Actor* thisx, PlayState* play); -void func_80B43A94(EnYukabyun* this, GlobalContext* globalCtx); -void func_80B43AD4(EnYukabyun* this, GlobalContext* globalCtx); -void func_80B43B6C(EnYukabyun* this, GlobalContext* globalCtx); +void func_80B43A94(EnYukabyun* this, PlayState* play); +void func_80B43AD4(EnYukabyun* this, PlayState* play); +void func_80B43B6C(EnYukabyun* this, PlayState* play); const ActorInit En_Yukabyun_InitVars = { ACTOR_EN_YUKABYUN, @@ -57,25 +57,25 @@ static InitChainEntry sInitChain[] = { static void* D_80B43F64[] = { gFloorTileEnemyTopTex, gFloorTileEnemyBottomTex }; -void EnYukabyun_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnYukabyun_Init(Actor* thisx, PlayState* play) { EnYukabyun* this = (EnYukabyun*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.4f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.params++; this->unk_152 = 0; this->unk_150 = (u8)(this->actor.params) * 0xA + 0x14; this->actionfunc = func_80B43A94; } -void EnYukabyun_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnYukabyun_Destroy(Actor* thisx, PlayState* play) { EnYukabyun* this = (EnYukabyun*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80B43A94(EnYukabyun* this, GlobalContext* globalCtx) { +void func_80B43A94(EnYukabyun* this, PlayState* play) { if (this->unk_150 != 0) { this->unk_150--; } @@ -85,7 +85,7 @@ void func_80B43A94(EnYukabyun* this, GlobalContext* globalCtx) { } } -void func_80B43AD4(EnYukabyun* this, GlobalContext* globalCtx) { +void func_80B43AD4(EnYukabyun* this, PlayState* play) { this->unk_150 += 0xA0; this->actor.shape.rot.y += this->unk_150; if (this->unk_150 >= 0x2000) { @@ -97,7 +97,7 @@ void func_80B43AD4(EnYukabyun* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_YUKABYUN_FLY - SFX_FLAG); } -void func_80B43B6C(EnYukabyun* this, GlobalContext* globalCtx) { +void func_80B43B6C(EnYukabyun* this, PlayState* play) { this->actor.shape.rot.y += this->unk_150; if (this->actor.xzDistToPlayer > 5000.0f) { Actor_Kill(&this->actor); @@ -106,13 +106,13 @@ void func_80B43B6C(EnYukabyun* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_YUKABYUN_FLY - SFX_FLAG); } -void EnYukabyun_Break(EnYukabyun* this, GlobalContext* globalCtx) { - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 8.0f, 0, 1300, 300, 15, OBJECT_YUKABYUN, 10, +void EnYukabyun_Break(EnYukabyun* this, PlayState* play) { + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 8.0f, 0, 1300, 300, 15, OBJECT_YUKABYUN, 10, gFloorTileEnemyFragmentDL); Actor_Kill(&this->actor); } -void EnYukabyun_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnYukabyun_Update(Actor* thisx, PlayState* play) { EnYukabyun* this = (EnYukabyun*)thisx; s32 pad; @@ -123,37 +123,36 @@ void EnYukabyun_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.base.acFlags &= ~AC_HIT; this->collider.base.ocFlags1 &= ~OC1_HIT; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_ROCK); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_ROCK); this->actionfunc = EnYukabyun_Break; } - this->actionfunc(this, globalCtx); + this->actionfunc(this, play); Actor_MoveForward(&this->actor); if (!(this->actionfunc == func_80B43A94 || this->actionfunc == EnYukabyun_Break)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 20.0f, 8.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 20.0f, 8.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.flags |= ACTOR_FLAG_24; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, 4.0f); } -void EnYukabyun_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnYukabyun_Draw(Actor* thisx, PlayState* play) { EnYukabyun* this = (EnYukabyun*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 366); + OPEN_DISPS(play->state.gfxCtx, "../z_en_yukabyun.c", 366); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B43F64[this->unk_152])); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 373), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_yukabyun.c", 373), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFloorTileEnemyDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 378); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_yukabyun.c", 378); } diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h index c1e6b00aee..773237fbce 100644 --- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h +++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h @@ -6,7 +6,7 @@ struct EnYukabyun; -typedef void (*EnYukabyunActionFunc)(struct EnYukabyun*, GlobalContext*); +typedef void (*EnYukabyunActionFunc)(struct EnYukabyun*, PlayState*); typedef struct EnYukabyun { /* 0x0000 */ Actor actor; 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 acadf204c3..9d8bd2c9ea 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -9,46 +9,46 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) -void EnZf_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZf_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZf_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZf_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZf_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); +void EnZf_DropIn(EnZf* this, PlayState* play); void func_80B45384(EnZf* this); -void func_80B4543C(EnZf* this, GlobalContext* globalCtx); -void EnZf_SetupApproachPlayer(EnZf* this, GlobalContext* globalCtx); -void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); +void EnZf_JumpForward(EnZf* this, PlayState* play); void func_80B4604C(EnZf* this); -void func_80B46098(EnZf* this, GlobalContext* globalCtx); -void func_80B462E4(EnZf* this, GlobalContext* globalCtx); -void func_80B463E4(EnZf* this, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); -void EnZf_RecoilFromBlockedSlash(EnZf* this, GlobalContext* globalCtx); +void EnZf_Slash(EnZf* this, PlayState* play); +void EnZf_RecoilFromBlockedSlash(EnZf* this, PlayState* play); void EnZf_SetupJumpBack(EnZf* this); -void EnZf_JumpBack(EnZf* this, GlobalContext* globalCtx); -void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx); -void EnZf_SetupSheatheSword(EnZf* this, GlobalContext* globalCtx); -void EnZf_SheatheSword(EnZf* this, GlobalContext* globalCtx); -void EnZf_HopAndTaunt(EnZf* this, GlobalContext* globalCtx); -void EnZf_SetupHopAway(EnZf* this, GlobalContext* globalCtx); -void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx); -void EnZf_DrawSword(EnZf* this, GlobalContext* globalCtx); -void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); -void func_80B483E4(EnZf* this, GlobalContext* globalCtx); -void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx); +void EnZf_JumpUp(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, GlobalContext* globalCtx); +void EnZf_Die(EnZf* this, PlayState* play); void EnZf_SetupCircleAroundPlayer(EnZf* this, f32 speed); -s32 EnZf_DodgeRangedEngaging(GlobalContext* globalCtx, EnZf* this); -s32 EnZf_DodgeRangedWaiting(GlobalContext* globalCtx, EnZf* this); +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 @@ -212,7 +212,7 @@ void EnZf_SetupAction(EnZf* this, EnZfActionFunc actionFunc) { * 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, GlobalContext* globalCtx, f32 dist) { +s32 EnZf_PrimaryFloorCheck(EnZf* this, PlayState* play, f32 dist) { s16 ret; s16 curBgCheckFlags; f32 sin; @@ -234,7 +234,7 @@ s32 EnZf_PrimaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { this->actor.world.pos.x += sin; this->actor.world.pos.z += cos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, + 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); @@ -245,14 +245,14 @@ s32 EnZf_PrimaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { /** * Supplementary floor test. */ -s16 EnZf_SecondaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { +s16 EnZf_SecondaryFloorCheck(EnZf* this, PlayState* play, f32 dist) { s16 ret; s16 curBgCheckFlags; f32 sin; f32 cos; Vec3f curPos; - if ((this->actor.speedXZ != 0.0f) && EnZf_PrimaryFloorCheck(this, globalCtx, this->actor.speedXZ)) { + if ((this->actor.speedXZ != 0.0f) && EnZf_PrimaryFloorCheck(this, play, this->actor.speedXZ)) { return true; } @@ -266,7 +266,7 @@ s16 EnZf_SecondaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { this->actor.world.pos.x += sin; this->actor.world.pos.z += cos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, + 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); @@ -274,10 +274,10 @@ s16 EnZf_SecondaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { return ret; } -void EnZf_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZf_Init(Actor* thisx, PlayState* play) { s32 pad; EnZf* this = (EnZf*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EffectBlureInit1 blureInit; f32 posDiff; @@ -307,30 +307,30 @@ void EnZf_Init(Actor* thisx, GlobalContext* globalCtx) { blureInit.unkFlag = 0; blureInit.calcMode = 2; - Effect_Add(globalCtx, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); + Effect_Add(play, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 75.0f, 45.0f, 45.0f, + Actor_UpdateBgCheckInfo(play, thisx, 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(globalCtx, &this->bodyCollider); - Collider_SetCylinder(globalCtx, &this->bodyCollider, thisx, &sBodyCylinderInit); - Collider_InitQuad(globalCtx, &this->swordCollider); - Collider_SetQuad(globalCtx, &this->swordCollider, thisx, &sSwordQuadInit); + 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(globalCtx, &this->skelAnime, &gZfDinolfosSkel, &gZfCryingAnim, this->jointTable, - this->morphTable, ENZF_LIMB_MAX); + 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(globalCtx, &this->skelAnime, &gZfLizalfosSkel, &gZfCryingAnim, this->jointTable, - this->morphTable, ENZF_LIMB_MAX); + SkelAnime_Init(play, &this->skelAnime, &gZfLizalfosSkel, &gZfCryingAnim, this->jointTable, this->morphTable, + ENZF_LIMB_MAX); } if (thisx->params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // Not minibosses @@ -345,7 +345,7 @@ void EnZf_Init(Actor* thisx, GlobalContext* globalCtx) { } else { // Minibosses posDiff = player->actor.world.pos.y - thisx->world.pos.y; - if ((ABS(posDiff) <= 100.0f) && !Flags_GetSwitch(globalCtx, this->clearFlag)) { + if ((ABS(posDiff) <= 100.0f) && !Flags_GetSwitch(play, this->clearFlag)) { this->homePlatform = this->curPlatform = EnZf_FindPlatform(&thisx->world.pos, 0); EnZf_SetupDropIn(this); D_80B4A1B4 = 1; @@ -355,17 +355,17 @@ void EnZf_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZf_Destroy(Actor* thisx, PlayState* play) { EnZf* this = (EnZf*)thisx; if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* miniboss */ && - (Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_ZF, ACTORCAT_ENEMY, 10000.0f) == NULL)) { + (Actor_FindNearby(play, &this->actor, ACTOR_EN_ZF, ACTORCAT_ENEMY, 10000.0f) == NULL)) { func_800F5B58(); } - Effect_Delete(globalCtx, this->blureIndex); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); - Collider_DestroyQuad(globalCtx, &this->swordCollider); + Effect_Delete(play, this->blureIndex); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->swordCollider); } /** @@ -402,10 +402,10 @@ s16 EnZf_FindPlatform(Vec3f* pos, s16 preferredIndex) { return i; } -s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, GlobalContext* globalCtx) { +s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, PlayState* play) { f32 distToCurLoopPlatform; f32 platformMinDist = 585.0f; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 initialPlatform = curPlatform; f32 playerMaxDist = 400.0f; f32 smallMaxRange = 99998.0f; @@ -480,10 +480,10 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, G return nextPlatform; } -s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, GlobalContext* globalCtx) { +s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, PlayState* play) { s16 curLoopPlatform = PLATFORM_INDEX_DOWNSTAIRS_MAX; s16 minIndex = PLATFORM_INDEX_DOWNSTAIRS_MIN; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 nextPlatform = EnZf_FindPlatform(&player->actor.world.pos, -1); f32 minRange = 500.0f; f32 smallMaxRange = 99998.0f; @@ -531,9 +531,9 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Gl } // Player not targeting this or another EnZf? -s32 EnZf_CanAttack(GlobalContext* globalCtx, EnZf* this) { +s32 EnZf_CanAttack(PlayState* play, EnZf* this) { Actor* targetedActor; - Player* player = GET_PLAYER(globalCtx); + 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 @@ -542,7 +542,7 @@ s32 EnZf_CanAttack(GlobalContext* globalCtx, EnZf* this) { return true; } } else { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (!Actor_OtherIsTargeted(play, &this->actor)) { return true; } if (this->actor.params == ENZF_TYPE_DINOLFOS) { @@ -564,7 +564,7 @@ s32 EnZf_CanAttack(GlobalContext* globalCtx, EnZf* this) { return false; } -void func_80B44DC4(EnZf* this, GlobalContext* globalCtx) { +void func_80B44DC4(EnZf* this, PlayState* play) { s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (angleDiff < 0) { @@ -572,30 +572,30 @@ void func_80B44DC4(EnZf* this, GlobalContext* globalCtx) { } if (angleDiff >= 0x1B58) { - func_80B483E4(this, globalCtx); - } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 8) != 0) && - EnZf_CanAttack(globalCtx, this)) { + func_80B483E4(this, play); + } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 8) != 0) && + EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { func_80B45384(this); } } -s32 EnZf_ChooseAction(GlobalContext* globalCtx, EnZf* this) { +s32 EnZf_ChooseAction(PlayState* play, EnZf* this) { s16 angleToWall; Actor* explosive; angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; angleToWall = ABS(angleToWall); - if (func_800354B4(globalCtx, &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)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistToPlayer < 80.0f)) { EnZf_SetupJumpUp(this); return true; - } else if ((this->actor.xzDistToPlayer < 90.0f) && ((globalCtx->gameplayFrames % 2) != 0)) { + } else if ((this->actor.xzDistToPlayer < 90.0f) && ((play->gameplayFrames % 2) != 0)) { EnZf_SetupJumpUp(this); return true; } else { @@ -604,7 +604,7 @@ s32 EnZf_ChooseAction(GlobalContext* globalCtx, EnZf* this) { } } - explosive = Actor_FindNearby(globalCtx, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + 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; @@ -646,7 +646,7 @@ void EnZf_SetupDropIn(EnZf* this) { EnZf_SetupAction(this, EnZf_DropIn); } -void EnZf_DropIn(EnZf* this, GlobalContext* globalCtx) { +void EnZf_DropIn(EnZf* this, PlayState* play) { if (this->unk_3F0 == 1) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.flags |= ACTOR_FLAG_0; @@ -677,14 +677,14 @@ void EnZf_DropIn(EnZf* this, GlobalContext* globalCtx) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.world.pos.y = this->actor.floorHeight; this->actor.velocity.y = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(globalCtx, &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); + 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_MINIBOSS_A) { // Only miniboss B - EnZf_SetupSheatheSword(this, globalCtx); + EnZf_SetupSheatheSword(this, play); } else { func_80B45384(this); } @@ -703,15 +703,15 @@ void func_80B45384(EnZf* this) { EnZf_SetupAction(this, func_80B4543C); } -void func_80B4543C(EnZf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B4543C(EnZf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 angleToPlayer = (this->actor.yawTowardsPlayer - this->headRot) - this->actor.shape.rot.y; angleToPlayer = ABS(angleToPlayer); SkelAnime_Update(&this->skelAnime); - if (!EnZf_DodgeRangedEngaging(globalCtx, this)) { + if (!EnZf_DodgeRangedEngaging(play, this)) { if (this->actor.params == ENZF_TYPE_DINOLFOS) { if (this->unk_3F4 != 0) { this->unk_3F4--; @@ -720,7 +720,7 @@ void func_80B4543C(EnZf* this, GlobalContext* globalCtx) { } this->unk_3F4 = 0; - } else if (EnZf_ChooseAction(globalCtx, this)) { + } else if (EnZf_ChooseAction(play, this)) { return; } } @@ -729,7 +729,7 @@ void func_80B4543C(EnZf* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer < 100.0f) && (player->meleeWeaponState != 0) && (angleToPlayer >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } else if (this->unk_3F0 != 0) { this->unk_3F0--; } else { @@ -740,39 +740,39 @@ void func_80B4543C(EnZf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; EnZf_SetupJumpForward(this); } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } else if (Rand_ZeroOne() > 0.3f) { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } else { func_80B4604C(this); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } } } } -void EnZf_SetupApproachPlayer(EnZf* this, GlobalContext* globalCtx) { +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, globalCtx); + this->nextPlatform = + EnZf_FindNextPlatformTowardsPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); this->hopAnimIndex = 0; } this->actor.speedXZ = 0.0f; EnZf_SetupAction(this, EnZf_ApproachPlayer); } -void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { +void EnZf_ApproachPlayer(EnZf* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 afterPrevFrame; @@ -780,7 +780,7 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { s16 sp48 = -1; f32 sp44 = 350.0f; f32 sp40 = 0.0f; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 absPlaySpeed; if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss @@ -792,10 +792,10 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { } } - if (!EnZf_DodgeRangedEngaging(globalCtx, this)) { + if (!EnZf_DodgeRangedEngaging(play, this)) { if (sp48 != this->curPlatform) { - this->nextPlatform = EnZf_FindNextPlatformTowardsPlayer(&this->actor.world.pos, this->curPlatform, - this->homePlatform, globalCtx); + this->nextPlatform = + EnZf_FindNextPlatformTowardsPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); if ((sp48 < 0) && (this->nextPlatform == this->curPlatform)) { sp48 = this->curPlatform; @@ -810,7 +810,7 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { if ((this->unk_3F8 && (this->actor.speedXZ > 0.0f)) || ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (temp_v1 >= 0x5C19))) { if ((Actor_WorldDistXZToPoint(&this->actor, &sPlatformPositions[this->nextPlatform]) < sp44) && - !EnZf_PrimaryFloorCheck(this, globalCtx, 191.9956f)) { + !EnZf_PrimaryFloorCheck(this, play, 191.9956f)) { EnZf_SetupJumpForward(this); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { @@ -829,7 +829,7 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { } } - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { sp40 = 100.0f; } @@ -849,7 +849,7 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); return; } } @@ -862,21 +862,21 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { if (sp48 == this->curPlatform) { if (!Actor_IsFacingPlayer(&this->actor, 0x11C7)) { if (Rand_ZeroOne() > 0.5f) { - func_80B462E4(this, globalCtx); + func_80B462E4(this, play); } else { func_80B45384(this); } } else if (this->actor.xzDistToPlayer < 100.0f) { - if ((Rand_ZeroOne() > 0.05f) && EnZf_CanAttack(globalCtx, this)) { + if ((Rand_ZeroOne() > 0.05f) && EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else if (Rand_ZeroOne() > 0.5f) { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } else { func_80B45384(this); } } else { if (this->unk_3F8) { - func_80B462E4(this, globalCtx); + func_80B462E4(this, play); } else if (Rand_ZeroOne() < 0.1f) { func_80B45384(this); } @@ -884,26 +884,26 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { } if (this->actor.params == ENZF_TYPE_DINOLFOS) { - if (EnZf_ChooseAction(globalCtx, this)) { + if (EnZf_ChooseAction(play, this)) { return; } if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.xzDistToPlayer > 160.0f) && Actor_IsFacingPlayer(&this->actor, 0x71C)) { - if (Actor_IsTargeted(globalCtx, &this->actor)) { + if (Actor_IsTargeted(play, &this->actor)) { if (Rand_ZeroOne() < 0.1f) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; EnZf_SetupJumpForward(this); return; } } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); return; } } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } @@ -934,7 +934,7 @@ void EnZf_SetupJumpForward(EnZf* this) { EnZf_SetupAction(this, EnZf_JumpForward); } -void EnZf_JumpForward(EnZf* this, GlobalContext* globalCtx) { +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; @@ -950,19 +950,19 @@ void EnZf_JumpForward(EnZf* this, GlobalContext* globalCtx) { } else { this->actor.speedXZ = 0.0f; this->hopAnimIndex = 0; - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&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(globalCtx, this)) { + if (EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } } @@ -973,15 +973,15 @@ void func_80B4604C(EnZf* this) { EnZf_SetupAction(this, func_80B46098); } -void func_80B46098(EnZf* this, GlobalContext* globalCtx) { +void func_80B46098(EnZf* this, PlayState* play) { s32 pad; f32 phi_f2; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_v0; s16 phi_v1; - if (!EnZf_DodgeRangedEngaging(globalCtx, this)) { - if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(globalCtx, this)) { + 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) { @@ -1011,19 +1011,19 @@ void func_80B46098(EnZf* this, GlobalContext* globalCtx) { 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, globalCtx); + EnZf_SetupApproachPlayer(this, play); return; } } if (Actor_IsFacingPlayer(&this->actor, 30 * 0x10000 / 360)) { if (Rand_ZeroOne() > 0.8f) { - func_80B462E4(this, globalCtx); + func_80B462E4(this, play); } else { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } } @@ -1031,10 +1031,10 @@ void func_80B46098(EnZf* this, GlobalContext* globalCtx) { } // Conditional setup function -void func_80B462E4(EnZf* this, GlobalContext* globalCtx) { +void func_80B462E4(EnZf* this, PlayState* play) { if ((this->actor.params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* miniboss */ || - Actor_TestFloorInDirection(&this->actor, globalCtx, 40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF)) || - Actor_TestFloorInDirection(&this->actor, globalCtx, -40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF))) { + 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); this->actor.speedXZ = Rand_CenteredFloat(12.0f); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -1044,24 +1044,24 @@ void func_80B462E4(EnZf* this, GlobalContext* globalCtx) { this->unk_408 = 0.0f; EnZf_SetupAction(this, func_80B463E4); } else { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } } -void func_80B463E4(EnZf* this, GlobalContext* globalCtx) { +void func_80B463E4(EnZf* this, PlayState* play) { s16 angleBehindPlayer; s16 phi_v0_3; s32 pad; s32 prevFrame; s32 beforeCurFrame; s32 absPlaySpeed; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 baseRange = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 1); - if (!EnZf_DodgeRangedEngaging(globalCtx, this) && - ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(globalCtx, this))) { + if (!EnZf_DodgeRangedEngaging(play, this) && + ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this))) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3A98; angleBehindPlayer = player->actor.shape.rot.y + 0x8000; @@ -1082,7 +1082,7 @@ void func_80B463E4(EnZf* this, GlobalContext* globalCtx) { this->actor.speedXZ = -this->actor.speedXZ; } } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3FFF)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { @@ -1106,7 +1106,7 @@ void func_80B463E4(EnZf* this, GlobalContext* globalCtx) { } } - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { baseRange = 100.0f; } @@ -1118,7 +1118,7 @@ void func_80B463E4(EnZf* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->unk_408, 0.0f, 1.0f, 5.65f, 0.0f); } - if ((this->unk_408 != 0.0f) && !EnZf_SecondaryFloorCheck(this, globalCtx, this->unk_408)) { + 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; } @@ -1145,15 +1145,15 @@ void func_80B463E4(EnZf* this, GlobalContext* globalCtx) { } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } if ((Math_CosS(angleBehindPlayer - this->actor.shape.rot.y) < -0.85f) || (this->unk_3F0 == 0)) { this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) == 0) && - EnZf_CanAttack(globalCtx, this)) { + if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && + EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { func_80B45384(this); @@ -1179,8 +1179,8 @@ void EnZf_SetupSlash(EnZf* this) { EnZf_SetupAction(this, EnZf_Slash); } -void EnZf_Slash(EnZf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnZf_Slash(EnZf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 rotDiff; s16 yawDiff; @@ -1204,7 +1204,7 @@ void EnZf_Slash(EnZf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } else { rotDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; rotDiff = ABS(rotDiff); @@ -1215,18 +1215,18 @@ void EnZf_Slash(EnZf* this, GlobalContext* globalCtx) { if (yawDiff > 16000) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } else if (player->stateFlags1 & (PLAYER_STATE1_4 | PLAYER_STATE1_13 | PLAYER_STATE1_14)) { if (this->actor.isTargeted) { EnZf_SetupSlash(this); } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } else { EnZf_SetupSlash(this); } } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } } @@ -1241,14 +1241,14 @@ void EnZf_SetupRecoilFromBlockedSlash(EnZf* this) { EnZf_SetupAction(this, EnZf_RecoilFromBlockedSlash); } -void EnZf_RecoilFromBlockedSlash(EnZf* this, GlobalContext* globalCtx) { +void EnZf_RecoilFromBlockedSlash(EnZf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (Rand_ZeroOne() > 0.7f) { func_80B45384(this); - } else if ((Rand_ZeroOne() > 0.2f) && EnZf_CanAttack(globalCtx, this)) { + } else if ((Rand_ZeroOne() > 0.2f) && EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { - func_80B483E4(this, globalCtx); + func_80B483E4(this, play); } } } @@ -1264,7 +1264,7 @@ void EnZf_SetupJumpBack(EnZf* this) { EnZf_SetupAction(this, EnZf_JumpBack); } -void EnZf_JumpBack(EnZf* this, GlobalContext* globalCtx) { +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; @@ -1277,14 +1277,14 @@ void EnZf_JumpBack(EnZf* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &gZfLandingAnim, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); this->unk_3F0 = 10; Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_JUMP); - } else if ((globalCtx->gameplayFrames % 2) != 0) { - func_80B483E4(this, globalCtx); + } else if ((play->gameplayFrames % 2) != 0) { + func_80B483E4(this, play); } else { func_80B45384(this); } } - if ((globalCtx->state.frames & 0x5F) == 0) { + if ((play->state.frames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } } @@ -1309,7 +1309,7 @@ void EnZf_SetupStunned(EnZf* this) { EnZf_SetupAction(this, EnZf_Stunned); } -void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx) { +void EnZf_Stunned(EnZf* this, PlayState* play) { s16 angleToWall; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { @@ -1326,9 +1326,9 @@ void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx) { 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(globalCtx, this)) { + } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this)) { if (D_80B4A1B4 != -1) { - func_80B44DC4(this, globalCtx); + func_80B44DC4(this, play); } else { angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; angleToWall = ABS(angleToWall); @@ -1337,14 +1337,14 @@ void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx) { (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { this->actor.world.rot.y = this->actor.shape.rot.y; EnZf_SetupJumpUp(this); - } else if (!EnZf_DodgeRangedEngaging(globalCtx, this)) { + } else if (!EnZf_DodgeRangedEngaging(play, this)) { if (this->actor.params != ENZF_TYPE_DINOLFOS) { - func_80B44DC4(this, globalCtx); - } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) != 0) && - EnZf_CanAttack(globalCtx, this)) { + func_80B44DC4(this, play); + } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) != 0) && + EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { - func_80B44DC4(this, globalCtx); + func_80B44DC4(this, play); } } } @@ -1352,7 +1352,7 @@ void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx) { } } -void EnZf_SetupSheatheSword(EnZf* this, GlobalContext* globalCtx) { +void EnZf_SetupSheatheSword(EnZf* this, PlayState* play) { f32 morphFrames = 0.0f; f32 lastFrame = Animation_GetLastFrame(&gZfSheathingSwordAnim); @@ -1365,12 +1365,12 @@ void EnZf_SetupSheatheSword(EnZf* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); this->nextPlatform = - EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, globalCtx); + EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); this->actor.world.rot.y = this->actor.shape.rot.y; EnZf_SetupAction(this, EnZf_SheatheSword); } -void EnZf_SheatheSword(EnZf* this, GlobalContext* globalCtx) { +void EnZf_SheatheSword(EnZf* this, PlayState* play) { s16 yaw = Actor_WorldYawTowardPoint(&this->actor, &sPlatformPositions[this->nextPlatform]) + 0x8000; Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 1, 1000, 0); @@ -1378,7 +1378,7 @@ void EnZf_SheatheSword(EnZf* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.world.rot.y = yaw - 0x8000; - EnZf_SetupHopAway(this, globalCtx); + EnZf_SetupHopAway(this, play); this->swordSheathed = true; } } @@ -1393,7 +1393,7 @@ void EnZf_SetupHopAndTaunt(EnZf* this) { EnZf_SetupAction(this, EnZf_HopAndTaunt); } -void EnZf_HopAndTaunt(EnZf* this, GlobalContext* globalCtx) { +void EnZf_HopAndTaunt(EnZf* this, PlayState* play) { f32 lastFrame; f32 maxDist = 400.0f; @@ -1408,10 +1408,10 @@ void EnZf_HopAndTaunt(EnZf* this, GlobalContext* globalCtx) { // If player gets too close, run away if ((this->actor.xzDistToPlayer < maxDist) && (this->hopAnimIndex != 1)) { this->actor.shape.rot.y = this->actor.world.rot.y; - EnZf_SetupSheatheSword(this, globalCtx); + EnZf_SetupSheatheSword(this, play); } else { if (this->hopAnimIndex != 1) { - EnZf_DodgeRangedWaiting(globalCtx, this); + EnZf_DodgeRangedWaiting(play, this); } if (SkelAnime_Update(&this->skelAnime)) { @@ -1454,23 +1454,23 @@ void EnZf_HopAndTaunt(EnZf* this, GlobalContext* globalCtx) { 0.0f); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } } } -void EnZf_SetupHopAway(EnZf* this, GlobalContext* globalCtx) { +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, globalCtx); + EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); EnZf_SetupAction(this, EnZf_HopAway); } -void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { +void EnZf_HopAway(EnZf* this, PlayState* play) { f32 sp74; f32 sp70 = 1.0f; f32 phi_f20 = 550.0f; @@ -1486,7 +1486,7 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { sp74 = Actor_WorldDistXZToPoint(&this->actor, &sPlatformPositions[this->nextPlatform]); sp54 = this->hopAnimIndex; - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } @@ -1503,8 +1503,8 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = sp5A + 0x8000; D_80B4AB30 = 0; this->homePlatform = this->curPlatform; - temp_v1_2 = !EnZf_PrimaryFloorCheck(this, globalCtx, 107.0f); - temp_v1_2 |= !EnZf_PrimaryFloorCheck(this, globalCtx, 220.0f) << 1; + 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) { @@ -1531,7 +1531,7 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { for (phi_v1 = 20; phi_v1 >= 0; phi_v1--, phi_f20_2 += 10.0f, phi_f0 += 1.2f) { - if (!EnZf_PrimaryFloorCheck(this, globalCtx, phi_f20_2)) { + if (!EnZf_PrimaryFloorCheck(this, play, phi_f20_2)) { this->actor.speedXZ = phi_f0; this->actor.velocity.y = 12.0f; break; @@ -1550,15 +1550,15 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; this->actor.speedXZ = 0.0f; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(globalCtx, &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); + 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, globalCtx); + this->homePlatform, play); } this->hopAnimIndex = 0; @@ -1584,18 +1584,18 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } -void EnZf_SetupDrawSword(EnZf* this, GlobalContext* globalCtx) { +void EnZf_SetupDrawSword(EnZf* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gZfDrawingSwordAnim); this->actor.world.rot.y += 0x8000; this->action = ENZF_ACTION_DRAW_SWORD; this->actor.speedXZ = 0.0f; this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); this->nextPlatform = - EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, globalCtx); + EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); EnZf_SetupAction(this, EnZf_DrawSword); } -void EnZf_DrawSword(EnZf* this, GlobalContext* globalCtx) { +void EnZf_DrawSword(EnZf* this, PlayState* play) { s16 yawTowardsPlayer = this->actor.yawTowardsPlayer; if (this->skelAnime.curFrame >= 26.0f) { @@ -1639,7 +1639,7 @@ void EnZf_SetupDamaged(EnZf* this) { EnZf_SetupAction(this, EnZf_Damaged); } -void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx) { +void EnZf_Damaged(EnZf* this, PlayState* play) { s16 wallYawDiff; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { @@ -1655,7 +1655,7 @@ void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4500, 0); - if (((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(globalCtx, this)) && + if (((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this)) && SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (D_80B4A1B4 != -1) { @@ -1664,12 +1664,12 @@ void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx) { } else { this->actor.world.rot.y = this->actor.shape.rot.y; - if (!EnZf_PrimaryFloorCheck(this, globalCtx, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { + if (!EnZf_PrimaryFloorCheck(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { EnZf_SetupJumpUp(this); - } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) == 0)) { + } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { EnZf_SetupSlash(this); } else { - func_80B44DC4(this, globalCtx); + func_80B44DC4(this, play); } } } else { @@ -1680,22 +1680,22 @@ void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx) { 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(globalCtx, this)) { + } else if (!EnZf_DodgeRangedEngaging(play, this)) { if (this->actor.params != ENZF_TYPE_DINOLFOS) { this->actor.world.rot.y = this->actor.shape.rot.y; - if (!EnZf_PrimaryFloorCheck(this, globalCtx, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { + if (!EnZf_PrimaryFloorCheck(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { EnZf_SetupJumpUp(this); - } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) == 0)) { + } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { EnZf_SetupSlash(this); } else { - func_80B44DC4(this, globalCtx); + func_80B44DC4(this, play); } - } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) == 0) && - EnZf_CanAttack(globalCtx, this)) { + } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && + EnZf_CanAttack(play, this)) { EnZf_SetupSlash(this); } else { - func_80B44DC4(this, globalCtx); + func_80B44DC4(this, play); } } } @@ -1714,11 +1714,11 @@ void EnZf_SetupJumpUp(EnZf* this) { EnZf_SetupAction(this, EnZf_JumpUp); } -void EnZf_JumpUp(EnZf* this, GlobalContext* globalCtx) { +void EnZf_JumpUp(EnZf* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 1); if (this->actor.velocity.y >= 5.0f) { - func_800355B8(globalCtx, &this->leftFootPos); - func_800355B8(globalCtx, &this->rightFootPos); + func_800355B8(play, &this->leftFootPos); + func_800355B8(play, &this->rightFootPos); } if (SkelAnime_Update(&this->skelAnime)) { @@ -1738,15 +1738,15 @@ void EnZf_JumpUp(EnZf* this, GlobalContext* globalCtx) { } // Conditional setup function -void func_80B483E4(EnZf* this, GlobalContext* globalCtx) { +void func_80B483E4(EnZf* this, PlayState* play) { s16 playerRotY; Player* player; if ((this->actor.params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* not miniboss */ || - Actor_TestFloorInDirection(&this->actor, globalCtx, 40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF)) || - Actor_TestFloorInDirection(&this->actor, globalCtx, -40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF))) { + 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); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 1); playerRotY = player->actor.shape.rot.y; @@ -1763,14 +1763,14 @@ void func_80B483E4(EnZf* this, GlobalContext* globalCtx) { this->action = ENZF_ACTION_CIRCLE_AROUND_PLAYER; EnZf_SetupAction(this, EnZf_CircleAroundPlayer); } else { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } } -void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { +void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { s16 playerRot; s16 phi_v0_4; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 prevFrame; s32 beforeCurFrame; s32 absPlaySpeed; @@ -1784,8 +1784,7 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { this->actor.speedXZ = -this->actor.speedXZ; } } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, - this->actor.shape.rot.y + 0x3FFF)) { + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3FFF)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { phi_v0_4 = this->actor.shape.rot.y + 0x3FFF; @@ -1817,7 +1816,7 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x4000; - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { baseRange = 100.0f; } @@ -1829,7 +1828,7 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->unk_408, 0.0f, 1.0f, 5.65f, 0.0f); } - if ((this->unk_408 != 0.0f) && !EnZf_SecondaryFloorCheck(this, globalCtx, this->unk_408)) { + 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; } @@ -1856,9 +1855,9 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { (D_80B4A1B4 == this->actor.params)) { EnZf_SetupHopAndTaunt(this); } else { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } - } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(globalCtx, this)) { + } 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; @@ -1876,15 +1875,14 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { } else { this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 100.0f) && ((globalCtx->gameplayFrames % 4) == 0) && - EnZf_CanAttack(globalCtx, this)) { + 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, globalCtx, 191.9956f) && - ((globalCtx->gameplayFrames % 2) == 0)) { + !EnZf_PrimaryFloorCheck(this, play, 191.9956f) && ((play->gameplayFrames % 2) == 0)) { EnZf_SetupJumpForward(this); } else { - EnZf_SetupApproachPlayer(this, globalCtx); + EnZf_SetupApproachPlayer(this, play); } } } else { @@ -1898,7 +1896,7 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK); } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } } @@ -1940,7 +1938,7 @@ void EnZf_SetupDie(EnZf* this) { EnZf_SetupAction(this, EnZf_Die); } -void EnZf_Die(EnZf* this, GlobalContext* globalCtx) { +void EnZf_Die(EnZf* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; @@ -1954,12 +1952,12 @@ void EnZf_Die(EnZf* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.category != ACTORCAT_PROP) { if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* miniboss */ && (D_80B4A1B4 == -1)) { - Flags_SetSwitch(globalCtx, this->clearFlag); + Flags_SetSwitch(play, this->clearFlag); func_800F5B58(); } else { D_80B4A1B4 = -1; } - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } if (this->alpha != 0) { @@ -1977,7 +1975,7 @@ void EnZf_Die(EnZf* this, GlobalContext* globalCtx) { } } -void EnZf_UpdateHeadRotation(EnZf* this, GlobalContext* globalCtx) { +void EnZf_UpdateHeadRotation(EnZf* this, PlayState* play) { s16 angleTemp; if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->action == ENZF_ACTION_3) && (this->unk_3F4 != 0)) { @@ -1991,7 +1989,7 @@ void EnZf_UpdateHeadRotation(EnZf* this, GlobalContext* globalCtx) { } } -void EnZf_UpdateDamage(EnZf* this, GlobalContext* globalCtx) { +void EnZf_UpdateDamage(EnZf* this, PlayState* play) { s32 pad; s16 dropParams; @@ -2023,8 +2021,8 @@ void EnZf_UpdateDamage(EnZf* this, GlobalContext* globalCtx) { dropParams = 0xE0; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, dropParams); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, dropParams); + Enemy_StartFinishingBlow(play, &this->actor); } else { if ((D_80B4A1B4 != -1) && ((this->actor.colChkInfo.health + this->actor.colChkInfo.damage) >= 4) && (this->actor.colChkInfo.health < 4)) { @@ -2038,20 +2036,20 @@ void EnZf_UpdateDamage(EnZf* this, GlobalContext* globalCtx) { } } -void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZf_Update(Actor* thisx, PlayState* play) { s32 pad; EnZf* this = (EnZf*)thisx; s32 pad2; - EnZf_UpdateDamage(this, globalCtx); + EnZf_UpdateDamage(this, play); if (this->actor.colChkInfo.damageEffect != ENZF_DMGEFF_IMMUNE) { this->unk_3F8 = false; if ((this->hopAnimIndex != 1) && (this->action != ENZF_ACTION_HOP_AWAY)) { if (this->actor.speedXZ != 0.0f) { - this->unk_3F8 = EnZf_PrimaryFloorCheck(this, globalCtx, this->actor.speedXZ * 1.5f); + this->unk_3F8 = EnZf_PrimaryFloorCheck(this, play, this->actor.speedXZ * 1.5f); } if (!this->unk_3F8) { - this->unk_3F8 = EnZf_PrimaryFloorCheck(this, globalCtx, 0.0f); + this->unk_3F8 = EnZf_PrimaryFloorCheck(this, play, 0.0f); } } @@ -2059,7 +2057,7 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 25.0f, 30.0f, 60.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); @@ -2067,16 +2065,16 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { this->hopAnimIndex = 1; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } if (this->actor.colChkInfo.health > 0) { if ((this->action != ENZF_ACTION_SLASH) && (this->action != ENZF_ACTION_STUNNED)) { - EnZf_UpdateHeadRotation(this, globalCtx); + EnZf_UpdateHeadRotation(this, play); } if ((D_80B4A1B0 != 0) && (D_80B4A1B4 != this->actor.params)) { - EnZf_SetupSheatheSword(this, globalCtx); + EnZf_SetupSheatheSword(this, play); D_80B4A1B4 = this->actor.params; D_80B4A1B0 = 0; @@ -2094,7 +2092,7 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { 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, globalCtx); + EnZf_SetupDrawSword(this, play); } this->unk_3F4--; } @@ -2112,13 +2110,13 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->bodyCollider); if ((this->actor.world.pos.y == this->actor.floorHeight) && (this->action <= ENZF_ACTION_DAMAGED)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + 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(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } } } @@ -2126,7 +2124,7 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { 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(globalCtx, &globalCtx->colChkCtx, &this->swordCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->swordCollider.base); } else { this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->swordCollider.base.acFlags &= ~AC_HIT; @@ -2135,8 +2133,7 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnZf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { +s32 EnZf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnZf* this = (EnZf*)thisx; switch (limbIndex) { @@ -2160,7 +2157,7 @@ s32 EnZf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnZf_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +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? @@ -2249,25 +2246,25 @@ static Gfx D_80B4A2F8[] = { gsSPEndDisplayList(), }; -void EnZf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZf_Draw(Actor* thisx, PlayState* play) { s32 pad; EnZf* this = (EnZf*)thisx; ; // Extra ";" required for matching. Cannot be if (1) {} or the like. Typo? - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zf.c", 3533); + OPEN_DISPS(play->state.gfxCtx, "../z_en_zf.c", 3533); - func_8002EBCC(thisx, globalCtx, 1); + 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_80093D18(globalCtx->state.gfxCtx); + func_80093D18(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(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnZf_OverrideLimbDraw, EnZf_PostLimbDraw, this, POLY_OPA_DISP); if (this->iceTimer != 0) { @@ -2277,20 +2274,20 @@ void EnZf_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->iceTimer % 4) == 0) { s32 icePosIndex = this->iceTimer >> 2; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, thisx, &this->bodyPartsPos[icePosIndex], 150, 150, 150, 250, - 235, 245, 255, 1.4f); + EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &this->bodyPartsPos[icePosIndex], 150, 150, 150, 250, 235, + 245, 255, 1.4f); } if (1) {} } } else { // fades out when dead - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(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(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnZf_OverrideLimbDraw, EnZf_PostLimbDraw, this, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zf.c", 3601); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_zf.c", 3601); } void EnZf_SetupCircleAroundPlayer(EnZf* this, f32 speed) { @@ -2310,13 +2307,13 @@ void EnZf_SetupCircleAroundPlayer(EnZf* this, f32 speed) { EnZf_SetupAction(this, EnZf_CircleAroundPlayer); } -s32 EnZf_DodgeRangedEngaging(GlobalContext* globalCtx, EnZf* this) { +s32 EnZf_DodgeRangedEngaging(PlayState* play, EnZf* this) { Actor* projectileActor; s16 yawToProjectile; s16 phi_t0; s16 phi_v1; - projectileActor = Actor_GetProjectileActor(globalCtx, &this->actor, 600.0f); + projectileActor = Actor_GetProjectileActor(play, &this->actor, 600.0f); if (projectileActor != NULL) { yawToProjectile = @@ -2325,18 +2322,17 @@ s32 EnZf_DodgeRangedEngaging(GlobalContext* globalCtx, EnZf* this) { phi_t0 = 0; - if (EnZf_PrimaryFloorCheck(this, globalCtx, -8.0f)) { + if (EnZf_PrimaryFloorCheck(this, play, -8.0f)) { phi_t0 = 1; } - if (EnZf_PrimaryFloorCheck(this, globalCtx, 8.0f)) { + if (EnZf_PrimaryFloorCheck(this, play, 8.0f)) { phi_t0 |= 2; } this->actor.world.rot.y = this->actor.shape.rot.y; - if ((((this->actor.xzDistToPlayer < 90.0f) || (phi_t0 == 3)) && - !EnZf_PrimaryFloorCheck(this, globalCtx, 135.0f)) || + 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; @@ -2345,7 +2341,7 @@ s32 EnZf_DodgeRangedEngaging(GlobalContext* globalCtx, EnZf* this) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; if (phi_t0 == 0) { - phi_v1 = globalCtx->gameplayFrames % 2; + phi_v1 = play->gameplayFrames % 2; } else { phi_v1 = phi_t0; } @@ -2370,25 +2366,25 @@ s32 EnZf_DodgeRangedEngaging(GlobalContext* globalCtx, EnZf* this) { return false; } -s32 EnZf_DodgeRangedWaiting(GlobalContext* globalCtx, EnZf* this) { +s32 EnZf_DodgeRangedWaiting(PlayState* play, EnZf* this) { Actor* projectileActor; s16 yawToProjectile; s16 phi_t0; s16 sp1E; s16 sp1C = 0; - projectileActor = Actor_GetProjectileActor(globalCtx, &this->actor, 600.0f); + 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, globalCtx, -70.0f)) { + if (EnZf_PrimaryFloorCheck(this, play, -70.0f)) { phi_t0 = 1; } - if (EnZf_PrimaryFloorCheck(this, globalCtx, 70.0f)) { + if (EnZf_PrimaryFloorCheck(this, play, 70.0f)) { phi_t0 |= 2; } @@ -2396,7 +2392,7 @@ s32 EnZf_DodgeRangedWaiting(GlobalContext* globalCtx, EnZf* this) { if ((ABS(yawToProjectile) < 0x2000) || (ABS(yawToProjectile) >= 0x6000)) { if (phi_t0 == 0) { - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { sp1E = 6; } else { sp1E = -6; @@ -2417,7 +2413,7 @@ s32 EnZf_DodgeRangedWaiting(GlobalContext* globalCtx, EnZf* this) { } } else if (ABS(yawToProjectile) < 0x5FFF) { if (phi_t0 == 0) { - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { sp1E = 6; } else { sp1E = -6; 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 b9b5034681..b9bcea8000 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -6,7 +6,7 @@ struct EnZf; -typedef void (*EnZfActionFunc)(struct EnZf*, GlobalContext*); +typedef void (*EnZfActionFunc)(struct EnZf*, PlayState*); typedef enum { /* -2 */ ENZF_TYPE_DINOLFOS = -2, 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 4ee1e6e2b7..da8eef6176 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -9,19 +9,19 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -void EnZl1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZl1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZl1_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZl1_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZl1_Init(Actor* thisx, PlayState* play); +void EnZl1_Destroy(Actor* thisx, PlayState* play); +void EnZl1_Update(Actor* thisx, PlayState* play); +void EnZl1_Draw(Actor* thisx, PlayState* play); void func_80B4AE18(EnZl1* this); -void func_80B4AF18(EnZl1* this, GlobalContext* globalCtx); -void func_80B4B010(EnZl1* this, GlobalContext* globalCtx); -void func_80B4B240(EnZl1* this, GlobalContext* globalCtx); -void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx); -void func_80B4BBC4(EnZl1* this, GlobalContext* globalCtx); -void func_80B4BC78(EnZl1* this, GlobalContext* globalCtx); -void func_80B4BF2C(EnZl1* this, GlobalContext* globalCtx); +void func_80B4AF18(EnZl1* this, PlayState* play); +void func_80B4B010(EnZl1* this, PlayState* play); +void func_80B4B240(EnZl1* this, PlayState* play); +void func_80B4B8B4(EnZl1* this, PlayState* play); +void func_80B4BBC4(EnZl1* this, PlayState* play); +void func_80B4BC78(EnZl1* this, PlayState* play); +void func_80B4BF2C(EnZl1* this, PlayState* play); extern CutsceneData D_80B4C5D0[]; @@ -73,16 +73,16 @@ void func_80B4AB40(void) { void func_80B4AB48(void) { } -void EnZl1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Init(Actor* thisx, PlayState* play) { f32 frameCount; EnZl1* this = (EnZl1*)thisx; frameCount = Animation_GetLastFrame(&gChildZelda1Anim_12118); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gChildZelda1Skel, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gChildZelda1Skel, NULL, NULL, NULL, 0); Animation_Change(&this->skelAnime, &gChildZelda1Anim_12118, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, 0.01f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); this->actor.targetMode = 0; @@ -112,11 +112,11 @@ void EnZl1_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZl1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Destroy(Actor* thisx, PlayState* play) { EnZl1* this = (EnZl1*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } void func_80B4AE18(EnZl1* this) { @@ -136,28 +136,28 @@ void func_80B4AE18(EnZl1* this) { } } -void func_80B4AF18(EnZl1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B4AF18(EnZl1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; - func_80038290(globalCtx, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); if (this->unk_1E6 != 0) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->unk_1E6 = 0; } - } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + } else if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_1E6 = 1; } else if (this->actor.world.pos.y <= player->actor.world.pos.y) { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void func_80B4B010(EnZl1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B4B010(EnZl1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad2; s32 pad3; s32 pad; @@ -166,20 +166,20 @@ void func_80B4B010(EnZl1* this, GlobalContext* globalCtx) { Vec3f playerPos = { -398.0f, 84.0f, 0.0f }; s16 rotDiff; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { Animation_Change(&this->skelAnime, &gChildZelda1Anim_10B38, 1.0f, 0.0f, Animation_GetLastFrame(&gChildZelda1Anim_10B38), ANIMMODE_ONCE_INTERP, -10.0f); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); - func_800C0808(globalCtx, this->subCamId, player, CAM_SET_FREE0); - globalCtx->envCtx.screenFillColor[0] = 255; - globalCtx->envCtx.screenFillColor[1] = 255; - globalCtx->envCtx.screenFillColor[2] = 255; - globalCtx->envCtx.screenFillColor[3] = 24; - globalCtx->envCtx.fillScreen = true; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); - Play_CameraSetFov(globalCtx, this->subCamId, 30.0f); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); + func_800C0808(play, this->subCamId, player, CAM_SET_FREE0); + play->envCtx.screenFillColor[0] = 255; + play->envCtx.screenFillColor[1] = 255; + play->envCtx.screenFillColor[2] = 255; + play->envCtx.screenFillColor[3] = 24; + play->envCtx.fillScreen = true; + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_CameraSetFov(play, this->subCamId, 30.0f); ShrinkWindow_SetVal(0x20); Interface_ChangeAlpha(2); player->actor.world.pos = playerPos; @@ -191,21 +191,21 @@ void func_80B4B010(EnZl1* this, GlobalContext* globalCtx) { if (1) {} // necessary to match rotDiff = ABS(this->actor.yawTowardsPlayer - this->actor.shape.rot.y); if ((rotDiff < 0x238E) && !(player->actor.world.pos.y < this->actor.world.pos.y)) { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } } -void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4B240(EnZl1* this, PlayState* play) { Vec3f subCamAt = { -427.0f, 108.0, 26.0 }; Vec3f subCamEye = { -340.0f, 108.0f, 98.0f }; s32 pad; Vec3f sp58 = { -434.0f, 84.0f, 0.0f }; u8 sp54[] = { 0x00, 0x00, 0x02 }; s32 pad2; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); AnimationHeader* animHeaderSeg; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; f32 frameCount; s32 sp3C = 0; @@ -224,24 +224,24 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { animHeaderSeg = &gChildZelda1Anim_11348; sp3C = 1; this->actor.textId = 0x702E; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_1E2++; break; } break; case 1: - if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->envCtx.fillScreen = false; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); - Play_CameraSetFov(globalCtx, this->subCamId, 25.0f); + if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->envCtx.fillScreen = false; + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_CameraSetFov(play, this->subCamId, 25.0f); player->actor.world.pos = sp58; this->actor.textId = 0x702F; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } break; case 2: - if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { animHeaderSeg = &gChildZelda1Anim_13F10; sp3C = 2; @@ -259,27 +259,27 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { animHeaderSeg = &gChildZelda1Anim_143A8; sp3C = 1; this->actor.textId = 0x7032; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } break; case 4: - if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { animHeaderSeg = &gChildZelda1Anim_132D8; sp3C = 2; this->unk_1E2 = 9; } else { this->actor.textId = 0x7034; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } } break; case 5: - if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.textId = 0x7033; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2--; } break; @@ -289,26 +289,26 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { animHeaderSeg = &gChildZelda1Anim_12B88; sp3C = 1; this->actor.textId = 0x7031; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } break; case 7: - if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.textId = 0x7030; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } break; case 8: - if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { animHeaderSeg = &gChildZelda1Anim_138E0; sp3C = 2; this->unk_1E2 = 3; } else { this->actor.textId = 0x7031; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2--; } } @@ -318,7 +318,7 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { if (this->skelAnime.curFrame == frameCount) { animHeaderSeg = &gChildZelda1Anim_00438; sp3C = 1; - globalCtx->csCtx.segment = D_80B4C5D0; + play->csCtx.segment = D_80B4C5D0; gSaveContext.cutsceneTrigger = 1; this->actionFunc = func_80B4B8B4; this->unk_1E2++; @@ -329,7 +329,7 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { frameCount = Animation_GetLastFrame(animHeaderSeg); Animation_Change(&this->skelAnime, animHeaderSeg, 1.0f, 0.0f, frameCount, sp54[sp3C], -10.0f); } - func_80038290(globalCtx, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); } void func_80B4B7F4(CsCmdActorAction* npcAction, Vec3f* pos) { @@ -344,12 +344,12 @@ void func_80B4B834(CsCmdActorAction* npcAction, Vec3f* pos) { pos->z = npcAction->endPos.z; } -void func_80B4B874(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4B874(EnZl1* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4B8B4(EnZl1* this, PlayState* play) { AnimationHeader* spB0[] = { NULL, NULL, @@ -378,13 +378,13 @@ void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx) { Vec3f sp48; SkelAnime_Update(&this->skelAnime); - func_80B4B874(this, globalCtx); - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + func_80B4B874(this, play); + if (play->csCtx.state == CS_STATE_IDLE) { this->actionFunc = func_80B4BBC4; return; } - npcAction = globalCtx->csCtx.npcActions[0]; + npcAction = play->csCtx.npcActions[0]; if (npcAction != NULL) { func_80B4B7F4(npcAction, &sp74); func_80B4B834(npcAction, &sp68); @@ -400,7 +400,7 @@ void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx) { this->unk_1E6 = npcAction->action; } this->actor.velocity = velocity; - if (globalCtx->csCtx.frames < npcAction->endFrame) { + if (play->csCtx.frames < npcAction->endFrame) { actionLength = npcAction->endFrame - npcAction->startFrame; this->actor.velocity.x = (sp68.x - sp74.x) / actionLength; this->actor.velocity.y = (sp68.y - sp74.y) / actionLength; @@ -410,27 +410,27 @@ void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx) { } this->actor.velocity.z = (sp68.z - sp74.z) / actionLength; } - func_80038290(globalCtx, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); - Play_CameraSetFov(globalCtx, this->subCamId, 70.0f); + func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_CameraSetFov(play, this->subCamId, 70.0f); } } -void func_80B4BBC4(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4BBC4(EnZl1* this, PlayState* play) { s32 pad; f32 frameCount = Animation_GetLastFrame(&gChildZelda1Anim_00438); - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Animation_Change(&this->skelAnime, &gChildZelda1Anim_00438, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); func_8002F7DC(&player->actor, NA_SE_VO_LI_SURPRISE_KID); this->actor.textId = 0x7039; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); this->unk_1E2 = 0; this->actionFunc = func_80B4BF2C; } -void func_80B4BC78(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4BC78(EnZl1* this, PlayState* play) { AnimationHeader* sp90[] = { NULL, NULL, @@ -459,8 +459,8 @@ void func_80B4BC78(EnZl1* this, GlobalContext* globalCtx) { frameCount = Animation_GetLastFrame(&gChildZelda1Anim_11348); Animation_Change(&this->skelAnime, &gChildZelda1Anim_11348, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, -10.0f); } - func_80B4B874(this, globalCtx); - npcAction = globalCtx->csCtx.npcActions[0]; + func_80B4B874(this, play); + npcAction = play->csCtx.npcActions[0]; if (npcAction != NULL) { func_80B4B7F4(npcAction, &sp70); func_80B4B834(npcAction, &sp64); @@ -475,7 +475,7 @@ void func_80B4BC78(EnZl1* this, GlobalContext* globalCtx) { this->unk_1E6 = npcAction->action; } this->actor.velocity = velocity; - if (globalCtx->csCtx.frames < npcAction->endFrame) { + if (play->csCtx.frames < npcAction->endFrame) { actionLength = npcAction->endFrame - npcAction->startFrame; this->actor.velocity.x = (sp64.x - sp70.x) / actionLength; this->actor.velocity.y = (sp64.y - sp70.y) / actionLength; @@ -488,51 +488,51 @@ void func_80B4BC78(EnZl1* this, GlobalContext* globalCtx) { } } -void func_80B4BF2C(EnZl1* this, GlobalContext* globalCtx) { +void func_80B4BF2C(EnZl1* this, PlayState* play) { s32 pad; - MessageContext* msgCtx = &globalCtx->msgCtx; - Player* player = GET_PLAYER(globalCtx); + MessageContext* msgCtx = &play->msgCtx; + Player* player = GET_PLAYER(play); switch (this->unk_1E2) { case 0: - if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { this->actor.textId = 0x703B; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2++; } else { this->actor.textId = 0x703A; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_1E2 = 0; } } break; case 1: - if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->actor.textId = 0xFFFF; - globalCtx->talkWithPlayer(globalCtx, &this->actor); - func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, 120.0f, 10.0f); - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; - globalCtx->msgCtx.stateTimer = 4; + play->talkWithPlayer(play, &this->actor); + func_8002F434(&this->actor, play, GI_LETTER_ZELDA, 120.0f, 10.0f); + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; this->unk_1E2++; } else { break; } case 2: - if (Actor_HasParent(&this->actor, globalCtx)) { - Play_CopyCamera(globalCtx, CAM_ID_MAIN, this->subCamId); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); - Play_ClearCamera(globalCtx, this->subCamId); + if (Actor_HasParent(&this->actor, play)) { + Play_CopyCamera(play, CAM_ID_MAIN, this->subCamId); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Play_ClearCamera(play, this->subCamId); this->actor.parent = NULL; this->unk_1E2++; } else { - func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, 120.0f, 10.0f); + func_8002F434(&this->actor, play, GI_LETTER_ZELDA, 120.0f, 10.0f); } break; case 3: - if ((Message_GetState(msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->actor.textId = 0x703C; - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); Flags_SetEventChkInf(EVENTCHKINF_40); this->unk_1E2 = 6; } @@ -541,42 +541,42 @@ void func_80B4BF2C(EnZl1* this, GlobalContext* globalCtx) { if (player->actor.world.pos.y < this->actor.world.pos.y) { break; } else { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->unk_1E2++; } else { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } break; case 5: - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->unk_1E2--; } break; case 6: - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { - func_8002DF54(globalCtx, &this->actor, 7); + if (Actor_TextboxIsClosing(&this->actor, play)) { + func_8002DF54(play, &this->actor, 7); Interface_ChangeAlpha(50); this->actor.flags &= ~ACTOR_FLAG_8; this->unk_1E2 = 4; } break; } - func_80038290(globalCtx, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); + func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); } -void EnZl1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Update(Actor* thisx, PlayState* play) { s32 pad; EnZl1* this = (EnZl1*)thisx; if ((this->actionFunc != func_80B4B8B4) && (this->actionFunc != func_80B4BC78)) { SkelAnime_Update(&this->skelAnime); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + this->actionFunc(this, play); if (this->actionFunc != func_80B4B8B4) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x, 0xA, 0x3E8, 1); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 0xA, 0x3E8, 1); @@ -584,7 +584,7 @@ void EnZl1_Update(Actor* thisx, GlobalContext* globalCtx) { func_80B4AE18(this); } -s32 EnZl1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnZl1_OverrideLimbDraw(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)) { @@ -605,7 +605,7 @@ s32 EnZl1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnZl1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnZl1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Vec3f vec = { 0.0f, 0.0f, 0.0f }; EnZl1* this = (EnZl1*)thisx; @@ -614,18 +614,18 @@ void EnZl1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnZl1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Draw(Actor* thisx, PlayState* play) { EnZl1* this = (EnZl1*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_girlB.c", 2011); + OPEN_DISPS(play->state.gfxCtx, "../z_en_girlB.c", 2011); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(this->unk_1F4)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(this->unk_1F8)); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(this->unk_1EC)); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnZl1_OverrideLimbDraw, EnZl1_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_girlB.c", 2046); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_girlB.c", 2046); } diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h index a543883a12..4b9f2984e0 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h @@ -6,7 +6,7 @@ struct EnZl1; -typedef void (*EnZl1ActionFunc)(struct EnZl1*, GlobalContext*); +typedef void (*EnZl1ActionFunc)(struct EnZl1*, PlayState*); typedef struct EnZl1 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index bcab4040f5..097a925ec2 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -13,52 +13,52 @@ #define FLAGS ACTOR_FLAG_4 -void EnZl2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZl2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZl2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZl2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZl2_Init(Actor* thisx, PlayState* play); +void EnZl2_Destroy(Actor* thisx, PlayState* play); +void EnZl2_Update(Actor* thisx, PlayState* play); +void EnZl2_Draw(Actor* thisx, PlayState* play); -s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx); +s32 func_80B4F45C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx); -void func_80B50BBC(EnZl2* this, GlobalContext* globalCtx); -void func_80B50BEC(EnZl2* this, GlobalContext* globalCtx); -void func_80B50C40(EnZl2* this, GlobalContext* globalCtx); -void func_80B50CA8(EnZl2* this, GlobalContext* globalCtx); -void func_80B50CFC(EnZl2* this, GlobalContext* globalCtx); -void func_80B50D50(EnZl2* this, GlobalContext* globalCtx); -void func_80B50D94(EnZl2* this, GlobalContext* globalCtx); -void func_80B50DE8(EnZl2* this, GlobalContext* globalCtx); -void func_80B50E3C(EnZl2* this, GlobalContext* globalCtx); -void func_80B50E90(EnZl2* this, GlobalContext* globalCtx); -void func_80B50EE4(EnZl2* this, GlobalContext* globalCtx); -void func_80B50F38(EnZl2* this, GlobalContext* globalCtx); -void func_80B50F8C(EnZl2* this, GlobalContext* globalCtx); -void func_80B50FE8(EnZl2* this, GlobalContext* globalCtx); -void func_80B51034(EnZl2* this, GlobalContext* globalCtx); -void func_80B51080(EnZl2* this, GlobalContext* globalCtx); -void func_80B510CC(EnZl2* this, GlobalContext* globalCtx); -void func_80B51118(EnZl2* this, GlobalContext* globalCtx); -void func_80B51164(EnZl2* this, GlobalContext* globalCtx); -void func_80B511B0(EnZl2* this, GlobalContext* globalCtx); -void func_80B511FC(EnZl2* this, GlobalContext* globalCtx); -void func_80B51250(EnZl2* this, GlobalContext* globalCtx); -void func_80B512B8(EnZl2* this, GlobalContext* globalCtx); -void func_80B51310(EnZl2* this, GlobalContext* globalCtx); -void func_80B51A5C(EnZl2* this, GlobalContext* globalCtx); -void func_80B51A8C(EnZl2* this, GlobalContext* globalCtx); -void func_80B51AE4(EnZl2* this, GlobalContext* globalCtx); -void func_80B51B44(EnZl2* this, GlobalContext* globalCtx); -void func_80B51BA8(EnZl2* this, GlobalContext* globalCtx); -void func_80B51C0C(EnZl2* this, GlobalContext* globalCtx); -void func_80B51C64(EnZl2* this, GlobalContext* globalCtx); -void func_80B51CA8(EnZl2* this, GlobalContext* globalCtx); -void func_80B52068(EnZl2* this, GlobalContext* globalCtx); -void func_80B52098(EnZl2* this, GlobalContext* globalCtx); -void func_80B52108(EnZl2* this, GlobalContext* globalCtx); -void func_80B521A0(EnZl2* this, GlobalContext* globalCtx); -void func_80B523BC(EnZl2* this, GlobalContext* globalCtx); -void func_80B523C8(EnZl2* this, GlobalContext* globalCtx); -void func_80B525D4(EnZl2* this, GlobalContext* globalCtx); +void func_80B50BBC(EnZl2* this, PlayState* play); +void func_80B50BEC(EnZl2* this, PlayState* play); +void func_80B50C40(EnZl2* this, PlayState* play); +void func_80B50CA8(EnZl2* this, PlayState* play); +void func_80B50CFC(EnZl2* this, PlayState* play); +void func_80B50D50(EnZl2* this, PlayState* play); +void func_80B50D94(EnZl2* this, PlayState* play); +void func_80B50DE8(EnZl2* this, PlayState* play); +void func_80B50E3C(EnZl2* this, PlayState* play); +void func_80B50E90(EnZl2* this, PlayState* play); +void func_80B50EE4(EnZl2* this, PlayState* play); +void func_80B50F38(EnZl2* this, PlayState* play); +void func_80B50F8C(EnZl2* this, PlayState* play); +void func_80B50FE8(EnZl2* this, PlayState* play); +void func_80B51034(EnZl2* this, PlayState* play); +void func_80B51080(EnZl2* this, PlayState* play); +void func_80B510CC(EnZl2* this, PlayState* play); +void func_80B51118(EnZl2* this, PlayState* play); +void func_80B51164(EnZl2* this, PlayState* play); +void func_80B511B0(EnZl2* this, PlayState* play); +void func_80B511FC(EnZl2* this, PlayState* play); +void func_80B51250(EnZl2* this, PlayState* play); +void func_80B512B8(EnZl2* this, PlayState* play); +void func_80B51310(EnZl2* this, PlayState* play); +void func_80B51A5C(EnZl2* this, PlayState* play); +void func_80B51A8C(EnZl2* this, PlayState* play); +void func_80B51AE4(EnZl2* this, PlayState* play); +void func_80B51B44(EnZl2* this, PlayState* play); +void func_80B51BA8(EnZl2* this, PlayState* play); +void func_80B51C0C(EnZl2* this, PlayState* play); +void func_80B51C64(EnZl2* this, PlayState* play); +void func_80B51CA8(EnZl2* this, PlayState* play); +void func_80B52068(EnZl2* this, PlayState* play); +void func_80B52098(EnZl2* this, PlayState* play); +void func_80B52108(EnZl2* this, PlayState* play); +void func_80B521A0(EnZl2* this, PlayState* play); +void func_80B523BC(EnZl2* this, PlayState* play); +void func_80B523C8(EnZl2* this, PlayState* play); +void func_80B525D4(EnZl2* this, PlayState* play); static void* sEyeTextures[] = { gZelda2EyeOpenTex, gZelda2EyeHalfTex, gZelda2EyeShutTex, gZelda2Eye03Tex, gZelda2Eye04Tex, gZelda2Eye05Tex, @@ -97,10 +97,10 @@ const ActorInit En_Zl2_InitVars = { (ActorFunc)EnZl2_Draw, }; -void EnZl2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZl2_Destroy(Actor* thisx, PlayState* play) { EnZl2* this = (EnZl2*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } void EnZl2_UpdateEyes(EnZl2* this) { @@ -202,24 +202,23 @@ void EnZl2_setMouthIndex(EnZl2* this, s16 index) { this->mouthTexIndex = index; } -void func_80B4ED2C(EnZl2* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); +void func_80B4ED2C(EnZl2* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } s32 EnZl2_UpdateSkelAnime(EnZl2* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnZl2_GetNpcAction(GlobalContext* globalCtx, s32 idx) { - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - return globalCtx->csCtx.npcActions[idx]; +CsCmdActorAction* EnZl2_GetNpcAction(PlayState* play, s32 idx) { + if (play->csCtx.state != CS_STATE_IDLE) { + return play->csCtx.npcActions[idx]; } return NULL; } -void func_80B4EDB8(EnZl2* this, GlobalContext* globalCtx, s32 arg2) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, arg2); +void func_80B4EDB8(EnZl2* this, PlayState* play, s32 arg2) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, arg2); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -433,8 +432,7 @@ void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) { this->unk_20C[arg2] = arg1; } -s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { +s32 func_80B4F45C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { s32 pad; EnZl2* this = (EnZl2*)thisx; Mtx* sp74; @@ -444,7 +442,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p s16* unk_1DC = this->unk_1DC; if (limbIndex == 14) { - sp74 = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx) * 7); + sp74 = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7); gSPSegment((*gfx)++, 0x0C, sp74); Matrix_Push(); @@ -454,7 +452,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(362.0f, -133.0f, 0.0f, MTXMODE_APPLY); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 0); func_80B4F230(this, sp2C.x, 1); func_80B4EF64(this, sp2C.z, 2); @@ -464,7 +462,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_ToMtx(&sp74[0], "../z_en_zl2.c", 1056); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 3); func_80B4F230(this, sp2C.x, 4); } @@ -473,7 +471,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_ToMtx(&sp74[1], "../z_en_zl2.c", 1100); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 6); func_80B4F230(this, sp2C.x, 7); } @@ -485,7 +483,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(467.0f, 265.0f, 389.0f, MTXMODE_APPLY); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 9); func_80B4F230(this, sp2C.x, 10); func_80B4EF64(this, sp2C.z, 11); @@ -495,7 +493,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_ToMtx(&sp74[3], "../z_en_zl2.c", 1145); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 12); func_80B4F230(this, sp2C.x, 13); func_80B4EF64(this, sp2C.z, 14); @@ -508,7 +506,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(467.0f, 265.0f, -389.0f, MTXMODE_APPLY); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 15); func_80B4F230(this, sp2C.x, 16); func_80B4EF64(this, sp2C.z, 17); @@ -518,7 +516,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_ToMtx(&sp74[5], "../z_en_zl2.c", 1189); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 18); func_80B4F230(this, sp2C.x, 19); func_80B4EF64(this, sp2C.z, 20); @@ -533,24 +531,24 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void EnZl2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnZl2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnZl2* this = (EnZl2*)thisx; s32 pad[2]; if (limbIndex == 10) { - if ((this->unk_254 != 0) && (globalCtx->csCtx.frames >= 900)) { + if ((this->unk_254 != 0) && (play->csCtx.frames >= 900)) { gSPDisplayList((*gfx)++, gZelda2OcarinaDL); } { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Matrix_Push(); if (player->rightHandType == PLAYER_MODELTYPE_RH_FF) { Matrix_Put(&player->shieldMf); Matrix_Translate(180.0f, 979.0f, -375.0f, MTXMODE_APPLY); Matrix_RotateZYX(-0x5DE7, -0x53E9, 0x3333, MTXMODE_APPLY); Matrix_Scale(1.2f, 1.2f, 1.2f, MTXMODE_APPLY); - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_zl2.c", 1253), + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_zl2.c", 1253), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, gZelda2OcarinaDL); } @@ -559,10 +557,10 @@ void EnZl2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void func_80B4FCCC(EnZl2* this, GlobalContext* globalCtx) { +void func_80B4FCCC(EnZl2* this, PlayState* play) { s32 unk_274 = this->unk_274; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[unk_274].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[unk_274].segment); } void func_80B4FD00(EnZl2* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { @@ -584,7 +582,7 @@ void func_80B4FD00(EnZl2* this, AnimationHeader* animation, u8 arg2, f32 morphFr Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, morphFrames); } -void func_80B4FD90(EnZl2* this, GlobalContext* globalCtx) { +void func_80B4FD90(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00B5FC, 0, 0.0f, 0); this->action = 1; } @@ -595,8 +593,8 @@ void func_80B4FDD4(EnZl2* this) { } } -void func_80B4FE10(GlobalContext* globalCtx) { - if ((globalCtx->csCtx.frames >= 830) && (globalCtx->csCtx.frames < 1081)) { +void func_80B4FE10(PlayState* play) { + if ((play->csCtx.frames >= 830) && (play->csCtx.frames < 1081)) { func_800788CC(NA_SE_EV_EARTHQUAKE - SFX_FLAG); } } @@ -621,24 +619,24 @@ void func_80B4FED8(EnZl2* this) { func_80078914(&this->actor.projectedPos, NA_SE_VO_Z1_CRY_0); } -void EnZl2_GiveLightArrows(EnZl2* this, GlobalContext* globalCtx) { +void EnZl2_GiveLightArrows(EnZl2* this, PlayState* play) { Player* player; f32 posX; f32 posY; f32 posZ; if (this->unk_244 == 0) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); posX = player->actor.world.pos.x; posY = player->actor.world.pos.y + 80.0f; posZ = player->actor.world.pos.z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 0x17); - Item_Give(globalCtx, ITEM_ARROW_LIGHT); + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, posX, posY, posZ, 0, 0, 0, 0x17); + Item_Give(play, ITEM_ARROW_LIGHT); this->unk_244 = 1; } } -void func_80B4FF84(EnZl2* this, GlobalContext* globalCtx) { +void func_80B4FF84(EnZl2* this, PlayState* play) { f32 posX; f32 posY; f32 posZ; @@ -648,12 +646,12 @@ void func_80B4FF84(EnZl2* this, GlobalContext* globalCtx) { posY = this->actor.world.pos.y; posZ = this->actor.world.pos.z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_YELLOW); + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_YELLOW); this->unk_250 = 1; } } -void func_80B4FFF0(EnZl2* this, GlobalContext* globalCtx) { +void func_80B4FFF0(EnZl2* this, PlayState* play) { f32 posX; f32 posY; f32 posZ; @@ -663,8 +661,8 @@ void func_80B4FFF0(EnZl2* this, GlobalContext* globalCtx) { posY = this->actor.world.pos.y + (kREG(5) + -26.0f); posZ = this->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0x4000, - 0, WARP_PURPLE_CRYSTAL); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0x4000, 0, + WARP_PURPLE_CRYSTAL); this->unk_248 = 1; } } @@ -679,8 +677,8 @@ void func_80B5008C(EnZl2* this) { } } -void func_80B500E0(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B500E0(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); Vec3f* thisPos = &this->actor.world.pos; f32 startX; f32 startY; @@ -692,7 +690,7 @@ void func_80B500E0(EnZl2* this, GlobalContext* globalCtx) { if (npcAction != NULL) { someFloat = - Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames, 8, 8); + Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames, 8, 8); startX = npcAction->startPos.x; startY = npcAction->startPos.y; startZ = npcAction->startPos.z; @@ -711,25 +709,24 @@ void func_80B501C4(EnZl2* this, s32 alpha) { } } -void func_80B501E8(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B501E8(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); if (npcAction != NULL) { this->actor.shape.shadowAlpha = this->alpha = - (1.0f - Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames)) * - 255.0f; + (1.0f - Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames)) * 255.0f; func_80B501C4(this, this->alpha); } } -void func_80B50260(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50260(EnZl2* this, PlayState* play) { this->action = 1; this->drawConfig = 0; this->actor.shape.shadowAlpha = 0; } -void func_80B50278(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B50278(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); this->actor.world.pos.x = npcAction->startPos.x; this->actor.world.pos.y = npcAction->startPos.y; @@ -740,10 +737,10 @@ void func_80B50278(EnZl2* this, GlobalContext* globalCtx) { this->drawConfig = 1; } -void func_80B50304(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50304(EnZl2* this, PlayState* play) { s32 pad[2]; ActorShape* shape = &this->actor.shape; - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); f32 actionXDelta; f32 actionZDelta; @@ -757,15 +754,15 @@ void func_80B50304(EnZl2* this, GlobalContext* globalCtx) { this->actor.world.rot.y = shape->rot.y = RAD_TO_BINANG(Math_FAtan2F(actionXDelta, actionZDelta)); } -void func_80B503DC(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B503DC(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); - if ((npcAction != NULL) && (globalCtx->csCtx.frames >= npcAction->endFrame)) { + if ((npcAction != NULL) && (play->csCtx.frames >= npcAction->endFrame)) { this->action = 4; } } -void func_80B5042C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B5042C(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_0022D0, 2, -8.0f, 0); this->action = 5; this->drawConfig = 1; @@ -781,7 +778,7 @@ void func_80B50488(EnZl2* this, s32 arg1) { } } -void func_80B504D4(EnZl2* this, GlobalContext* globalCtx) { +void func_80B504D4(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00325C, 2, -8.0f, 0); this->action = 7; this->drawConfig = 1; @@ -797,7 +794,7 @@ void func_80B5053C(EnZl2* this, s32 arg1) { } } -void func_80B50580(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50580(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_000A50, 2, -8.0f, 0); this->action = 9; this->drawConfig = 1; @@ -811,24 +808,24 @@ void func_80B505D4(EnZl2* this, s32 arg1) { } } -void func_80B50618(EnZl2* this, GlobalContext* globalCtx) { - EnZl2_GiveLightArrows(this, globalCtx); +void func_80B50618(EnZl2* this, PlayState* play) { + EnZl2_GiveLightArrows(this, play); this->action = 11; } -void func_80B50644(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FF84(this, globalCtx); +void func_80B50644(EnZl2* this, PlayState* play) { + func_80B4FF84(this, play); this->action = 12; } -void func_80B50670(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50670(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00B5FC, 0, -8.0f, 0); this->action = 13; this->drawConfig = 1; this->actor.shape.shadowAlpha = 0xFF; } -void func_80B506C4(EnZl2* this, GlobalContext* globalCtx) { +void func_80B506C4(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00AAD4, 2, -8.0f, 0); this->action = 14; this->drawConfig = 1; @@ -845,12 +842,12 @@ void func_80B5073C(EnZl2* this, s32 arg1) { } } -void func_80B50780(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50780(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_001670, 2, -8.0f, 0); this->action = 16; this->drawConfig = 1; this->actor.shape.shadowAlpha = 0xFF; - func_80B4FFF0(this, globalCtx); + func_80B4FFF0(this, play); EnZl2_setEyesIndex(this, 3); } @@ -861,7 +858,7 @@ void func_80B507E8(EnZl2* this, s32 arg1) { } } -void func_80B5082C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B5082C(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_002B14, 2, -8.0f, 0); this->action = 18; this->drawConfig = 1; @@ -876,7 +873,7 @@ void func_80B50880(EnZl2* this, s32 arg1) { } } -void func_80B508C8(EnZl2* this, GlobalContext* globalCtx) { +void func_80B508C8(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_001010, 2, -8.0f, 0); this->action = 20; this->drawConfig = 1; @@ -892,21 +889,21 @@ void func_80B50928(EnZl2* this, s32 arg1) { } } -void func_80B50970(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50970(EnZl2* this, PlayState* play) { this->action = 22; } -void func_80B50980(EnZl2* this, GlobalContext* globalCtx) { +void func_80B50980(EnZl2* this, PlayState* play) { this->action = 23; this->drawConfig = 2; this->alpha = 255; } -void func_80B509A0(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B509A0(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); if (npcAction != NULL) { - if (globalCtx->csCtx.frames >= npcAction->endFrame) { + if (play->csCtx.frames >= npcAction->endFrame) { this->action = 24; this->drawConfig = 0; func_80B4FE6C(this); @@ -914,8 +911,8 @@ void func_80B509A0(EnZl2* this, GlobalContext* globalCtx) { } } -void func_80B50A04(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B50A04(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); s32 newAction; s32 unk_240; @@ -925,49 +922,49 @@ void func_80B50A04(EnZl2* this, GlobalContext* globalCtx) { if (newAction != unk_240) { switch (newAction) { case 1: - func_80B50260(this, globalCtx); + func_80B50260(this, play); break; case 2: - func_80B50278(this, globalCtx); + func_80B50278(this, play); break; case 3: - func_80B50304(this, globalCtx); + func_80B50304(this, play); break; case 4: - func_80B5042C(this, globalCtx); + func_80B5042C(this, play); break; case 5: - func_80B504D4(this, globalCtx); + func_80B504D4(this, play); break; case 6: - func_80B50580(this, globalCtx); + func_80B50580(this, play); break; case 7: - func_80B50618(this, globalCtx); + func_80B50618(this, play); break; case 8: - func_80B50670(this, globalCtx); + func_80B50670(this, play); break; case 9: - func_80B506C4(this, globalCtx); + func_80B506C4(this, play); break; case 10: - func_80B50780(this, globalCtx); + func_80B50780(this, play); break; case 11: - func_80B5082C(this, globalCtx); + func_80B5082C(this, play); break; case 12: - func_80B508C8(this, globalCtx); + func_80B508C8(this, play); break; case 13: - func_80B50970(this, globalCtx); + func_80B50970(this, play); break; case 14: - func_80B50980(this, globalCtx); + func_80B50980(this, play); break; case 15: - func_80B50644(this, globalCtx); + func_80B50644(this, play); break; default: osSyncPrintf("En_Zl2_inAgain_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); @@ -977,188 +974,188 @@ void func_80B50A04(EnZl2* this, GlobalContext* globalCtx) { } } -void func_80B50BBC(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B50A04(this, globalCtx); +void func_80B50BBC(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B50A04(this, play); } -void func_80B50BEC(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50BEC(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50C40(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); +void func_80B50C40(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); func_80B4FDD4(this); - func_80B4ED2C(this, globalCtx); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B500E0(this, globalCtx); - func_80B503DC(this, globalCtx); + func_80B500E0(this, play); + func_80B503DC(this, play); } -void func_80B50CA8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50CA8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50CFC(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50CFC(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); func_80B4EA40(this); func_80B50488(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B50D50(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50D50(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50D94(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50D94(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); func_80B4EAF4(this); func_80B5053C(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B50DE8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50DE8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50E3C(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50E3C(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); func_80B505D4(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B50E90(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50E90(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50EE4(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50EE4(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50F38(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50F38(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50F8C(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50F8C(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B50FE8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B50FE8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); func_80B5073C(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B51034(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51034(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B51080(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51080(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); func_80B507E8(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B510CC(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B510CC(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B51118(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51118(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); func_80B50880(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B51164(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51164(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B511B0(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4FE10(globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B511B0(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4FE10(play); + func_80B4ED2C(this, play); func_80B50928(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B511FC(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B511FC(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); func_80B5008C(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B51250(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); +void func_80B51250(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); func_80B4FE48(this); - func_80B4ED2C(this, globalCtx); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B500E0(this, globalCtx); + func_80B500E0(this, play); func_80B5008C(this); - func_80B50A04(this, globalCtx); + func_80B50A04(this, play); } -void func_80B512B8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B512B8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B501E8(this, globalCtx); - func_80B509A0(this, globalCtx); + func_80B501E8(this, play); + func_80B509A0(this, play); } -void func_80B51310(EnZl2* this, GlobalContext* globalCtx) { +void func_80B51310(EnZl2* this, PlayState* play) { Actor* child; - if (EnZl2_GetNpcAction(globalCtx, 0) == NULL) { + if (EnZl2_GetNpcAction(play, 0) == NULL) { child = this->actor.child; if (child != NULL) { Actor_Kill(child); @@ -1167,44 +1164,44 @@ void func_80B51310(EnZl2* this, GlobalContext* globalCtx) { } } -void func_80B5135C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B5135C(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00A15C, 0, 0.0f, 0); this->action = 25; this->unk_254 = 1; } -void func_80B513A8(EnZl2* this, GlobalContext* globalCtx) { +void func_80B513A8(EnZl2* this, PlayState* play) { Player* player; f32 posX; f32 posY; f32 posZ; if (this->unk_250 == 0) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); posX = player->actor.world.pos.x; posY = player->actor.world.pos.y; posZ = player->actor.world.pos.z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_UNK_7); + Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0, 0, WARP_UNK_7); this->unk_250 = 1; } } -void func_80B51418(EnZl2* this, GlobalContext* globalCtx) { +void func_80B51418(EnZl2* this, PlayState* play) { EnZl2_UpdateEyes(this); - if (globalCtx->csCtx.frames < 431) { + if (play->csCtx.frames < 431) { EnZl2_setMouthIndex(this, 1); } else { EnZl2_setMouthIndex(this, 0); } } -void func_80B5146C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B5146C(EnZl2* this, PlayState* play) { func_80B4EA40(this); EnZl2_setMouthIndex(this, 0); } -void func_80B5149C(EnZl2* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames < 988) { +void func_80B5149C(EnZl2* this, PlayState* play) { + if (play->csCtx.frames < 988) { EnZl2_setEyesIndex(this, 7); EnZl2_setEyeIndex2(this, 8); } else { @@ -1213,22 +1210,22 @@ void func_80B5149C(EnZl2* this, GlobalContext* globalCtx) { EnZl2_setMouthIndex(this, 0); } -void func_80B514F8(EnZl2* this, GlobalContext* globalCtx) { +void func_80B514F8(EnZl2* this, PlayState* play) { EnZl2_UpdateEyes(this); - if (globalCtx->csCtx.frames < 1190) { + if (play->csCtx.frames < 1190) { EnZl2_setMouthIndex(this, 1); } else { EnZl2_setMouthIndex(this, 0); } } -void func_80B5154C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B5154C(EnZl2* this, PlayState* play) { CutsceneContext* csCtx; if (this->skelAnime.mode != 0) { EnZl2_UpdateEyes(this); } else { - csCtx = &globalCtx->csCtx; + csCtx = &play->csCtx; if (csCtx->frames < 0x5F0) { func_80B4EBB8(this); } else if (csCtx->frames == 0x5F0) { @@ -1245,9 +1242,9 @@ void func_80B515C4(EnZl2* this) { this->actor.shape.shadowAlpha = 0; } -void func_80B515D8(EnZl2* this, GlobalContext* globalCtx) { +void func_80B515D8(EnZl2* this, PlayState* play) { func_80B4FD00(this, &gZelda2Anime1Anim_00A15C, 0, -8.0f, 0); - func_80B4EDB8(this, globalCtx, 0); + func_80B4EDB8(this, play, 0); this->action = 26; this->drawConfig = 1; this->actor.shape.shadowAlpha = 0xFF; @@ -1325,8 +1322,8 @@ void func_80B518C0(EnZl2* this) { this->unk_27C = 0.0f; } -void func_80B51948(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B51948(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); s32 newAction; s32 unk_240; @@ -1339,7 +1336,7 @@ void func_80B51948(EnZl2* this, GlobalContext* globalCtx) { func_80B515C4(this); break; case 2: - func_80B515D8(this, globalCtx); + func_80B515D8(this, play); break; case 16: func_80B51678(this); @@ -1357,7 +1354,7 @@ void func_80B51948(EnZl2* this, GlobalContext* globalCtx) { func_80B518C0(this); break; case 21: - func_80B513A8(this, globalCtx); + func_80B513A8(this, play); break; default: osSyncPrintf("En_Zl2_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); @@ -1367,72 +1364,72 @@ void func_80B51948(EnZl2* this, GlobalContext* globalCtx) { } } -void func_80B51A5C(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B51948(this, globalCtx); +void func_80B51A5C(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B51948(this, play); } -void func_80B51A8C(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); - func_80B51418(this, globalCtx); +void func_80B51A8C(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); + func_80B51418(this, play); EnZl2_UpdateSkelAnime(this); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51AE4(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51AE4(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); func_80B51644(this, EnZl2_UpdateSkelAnime(this)); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51B44(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); - func_80B5149C(this, globalCtx); +void func_80B51B44(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); + func_80B5149C(this, play); func_80B516D0(this, EnZl2_UpdateSkelAnime(this)); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51BA8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); - func_80B514F8(this, globalCtx); +void func_80B51BA8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); + func_80B514F8(this, play); func_80B5175C(this, EnZl2_UpdateSkelAnime(this)); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51C0C(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); - func_80B5146C(this, globalCtx); +void func_80B51C0C(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); + func_80B5146C(this, play); func_80B517E0(this, EnZl2_UpdateSkelAnime(this)); } -void func_80B51C64(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B51C64(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateSkelAnime(this); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51CA8(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); - func_80B5154C(this, globalCtx); +void func_80B51CA8(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); + func_80B5154C(this, play); func_80B5187C(this, EnZl2_UpdateSkelAnime(this)); - func_80B51948(this, globalCtx); + func_80B51948(this, play); } -void func_80B51D0C(EnZl2* this, GlobalContext* globalCtx) { +void func_80B51D0C(EnZl2* this, PlayState* play) { this->action = 33; this->drawConfig = 0; this->actor.shape.shadowAlpha = 0; } -void func_80B51D24(EnZl2* this, GlobalContext* globalCtx) { +void func_80B51D24(EnZl2* this, PlayState* play) { s32 pad[2]; u32 sfxId; SkelAnime* skelAnime = &this->skelAnime; @@ -1440,14 +1437,14 @@ void func_80B51D24(EnZl2* this, GlobalContext* globalCtx) { if (Animation_OnFrame(skelAnime, 6.0f) || Animation_OnFrame(skelAnime, 0.0f)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } } -void func_80B51DA4(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B51DA4(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); Vec3f* thisPos = &this->actor.world.pos; f32 startX; f32 startY; @@ -1459,7 +1456,7 @@ void func_80B51DA4(EnZl2* this, GlobalContext* globalCtx) { if (npcAction != NULL) { someFloat = - Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, globalCtx->csCtx.frames, 0, 8); + Environment_LerpWeightAccelDecel(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames, 0, 8); startX = npcAction->startPos.x; startY = npcAction->startPos.y; startZ = npcAction->startPos.z; @@ -1469,7 +1466,7 @@ void func_80B51DA4(EnZl2* this, GlobalContext* globalCtx) { thisPos->x = ((endX - startX) * someFloat) + startX; thisPos->y = ((endY - startY) * someFloat) + startY; thisPos->z = ((endZ - startZ) * someFloat) + startZ; - if (npcAction->endFrame < globalCtx->csCtx.frames) { + if (npcAction->endFrame < play->csCtx.frames) { Actor_Kill(&this->actor); } } @@ -1481,9 +1478,9 @@ void func_80B51EA8(EnZl2* this) { this->actor.shape.shadowAlpha = 0; } -void func_80B51EBC(EnZl2* this, GlobalContext* globalCtx) { +void func_80B51EBC(EnZl2* this, PlayState* play) { ActorShape* shape = &this->actor.shape; - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); s32 pad[2]; this->actor.world.rot.y = shape->rot.y = npcAction->rot.y; @@ -1493,19 +1490,19 @@ void func_80B51EBC(EnZl2* this, GlobalContext* globalCtx) { shape->shadowAlpha = 255; } -void func_80B51F38(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B51F38(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); if (npcAction != NULL) { - if (globalCtx->csCtx.frames - 8 >= npcAction->endFrame) { + if (play->csCtx.frames - 8 >= npcAction->endFrame) { func_80B4FD00(this, &gZelda2Anime1Anim_00B5FC, 0, -8.0f, 0); this->action = 35; } } } -void func_80B51FA8(EnZl2* this, GlobalContext* globalCtx) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(globalCtx, 0); +void func_80B51FA8(EnZl2* this, PlayState* play) { + CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); s32 action; s32 unk_240; @@ -1518,7 +1515,7 @@ void func_80B51FA8(EnZl2* this, GlobalContext* globalCtx) { func_80B51EA8(this); break; case 2: - func_80B51EBC(this, globalCtx); + func_80B51EBC(this, play); break; case 14: Actor_Kill(&this->actor); @@ -1532,44 +1529,44 @@ void func_80B51FA8(EnZl2* this, GlobalContext* globalCtx) { } } -void func_80B52068(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B51FA8(this, globalCtx); +void func_80B52068(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B51FA8(this, play); } -void func_80B52098(EnZl2* this, GlobalContext* globalCtx) { - func_80B4FCCC(this, globalCtx); - func_80B4ED2C(this, globalCtx); +void func_80B52098(EnZl2* this, PlayState* play) { + func_80B4FCCC(this, play); + func_80B4ED2C(this, play); EnZl2_UpdateEyes(this); EnZl2_UpdateSkelAnime(this); - func_80B51D24(this, globalCtx); - func_80B51F38(this, globalCtx); - func_80B51DA4(this, globalCtx); + func_80B51D24(this, play); + func_80B51F38(this, play); + func_80B51DA4(this, play); } -void func_80B52108(EnZl2* this, GlobalContext* globalCtx) { +void func_80B52108(EnZl2* this, PlayState* play) { } -void func_80B52114(EnZl2* this, GlobalContext* globalCtx) { +void func_80B52114(EnZl2* this, PlayState* play) { switch (this->actor.params) { case 1: - func_80B5135C(this, globalCtx); + func_80B5135C(this, play); break; case 4: - func_80B51D0C(this, globalCtx); + func_80B51D0C(this, play); break; case 0: - func_80B4FD90(this, globalCtx); + func_80B4FD90(this, play); break; default: osSyncPrintf(VT_FGCOL(RED) " En_Oa2 の arg_data がおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); - func_80B4FD90(this, globalCtx); + func_80B4FD90(this, play); } } -void func_80B521A0(EnZl2* this, GlobalContext* globalCtx) { +void func_80B521A0(EnZl2* this, PlayState* play) { s32 pad; - ObjectContext* objectCtx = &globalCtx->objectCtx; + ObjectContext* objectCtx = &play->objectCtx; s32 bankIndex = Object_GetIndex(objectCtx, OBJECT_ZL2_ANIME1); s32 pad2; @@ -1580,30 +1577,30 @@ void func_80B521A0(EnZl2* this, GlobalContext* globalCtx) { if (Object_IsLoaded(objectCtx, bankIndex)) { this->unk_274 = bankIndex; - func_80B4FCCC(this, globalCtx); + func_80B4FCCC(this, play); this->unk_278 = Animation_GetLastFrame(&gZelda2Anime1Anim_0022D0); - func_80B52114(this, globalCtx); + func_80B52114(this, play); } } -void EnZl2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZl2_Update(Actor* thisx, PlayState* play) { EnZl2* this = (EnZl2*)thisx; if (this->action < 0 || this->action >= 0x24 || sActionFuncs[this->action] == NULL) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnZl2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZl2_Init(Actor* thisx, PlayState* play) { EnZl2* this = (EnZl2*)thisx; ActorShape* shape = &thisx->shape; s32 pad; ActorShape_Init(shape, 0.0f, ActorShadow_DrawCircle, 30.0f); shape->shadowAlpha = 0; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZelda2Skel, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gZelda2Skel, NULL, NULL, NULL, 0); switch (thisx->params) { case 1: @@ -1615,7 +1612,7 @@ void EnZl2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnZl2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnZl2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnZl2* this = (EnZl2*)thisx; @@ -1624,13 +1621,13 @@ s32 EnZl2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, osSyncPrintf(VT_FGCOL(RED) "描画前処理モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return 0; } - return sOverrideLimbDrawFuncs[this->overrideLimbDrawConfig](globalCtx, limbIndex, dList, pos, rot, thisx, gfx); + return sOverrideLimbDrawFuncs[this->overrideLimbDrawConfig](play, limbIndex, dList, pos, rot, thisx, gfx); } -void func_80B523BC(EnZl2* this, GlobalContext* globalCtx) { +void func_80B523BC(EnZl2* this, PlayState* play) { } -void func_80B523C8(EnZl2* this, GlobalContext* globalCtx) { +void func_80B523C8(EnZl2* this, PlayState* play) { s32 pad[3]; s16 eyeTexIndex = this->eyeTexIndex; s16 eyeTexIndex2 = this->eyeTexIndex2; @@ -1641,9 +1638,9 @@ void func_80B523C8(EnZl2* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthTexIndex]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zl2.c", 1623); + OPEN_DISPS(play->state.gfxCtx, "../z_en_zl2.c", 1623); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex2)); @@ -1651,13 +1648,13 @@ void func_80B523C8(EnZl2* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0B, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnZl2_OverrideLimbDraw, EnZl2_PostLimbDraw, this, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zl2.c", 1648); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_zl2.c", 1648); } -void func_80B525D4(EnZl2* this, GlobalContext* globalCtx) { +void func_80B525D4(EnZl2* this, PlayState* play) { s32 pad[2]; s16 eyeTexIndex = this->eyeTexIndex; void* eyeTex = sEyeTextures[eyeTexIndex]; @@ -1666,9 +1663,9 @@ void func_80B525D4(EnZl2* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthTexIndex]; s32 pad1; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zl2.c", 1663); + OPEN_DISPS(play->state.gfxCtx, "../z_en_zl2.c", 1663); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -1676,18 +1673,18 @@ void func_80B525D4(EnZl2* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x0B, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnZl2_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zl2.c", 1692); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_zl2.c", 1692); } -void EnZl2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZl2_Draw(Actor* thisx, PlayState* play) { EnZl2* this = (EnZl2*)thisx; if ((this->drawConfig < 0) || (this->drawConfig >= 3) || (sDrawFuncs[this->drawConfig] == NULL)) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h index acc850b9fc..24ba154050 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h @@ -6,8 +6,8 @@ struct EnZl2; -typedef void (*EnZl2ActionFunc)(struct EnZl2*, GlobalContext*); -typedef void (*EnZl2DrawFunc)(struct EnZl2*, GlobalContext*); +typedef void (*EnZl2ActionFunc)(struct EnZl2*, PlayState*); +typedef void (*EnZl2DrawFunc)(struct EnZl2*, PlayState*); typedef struct EnZl2 { /* 0x0000 */ Actor actor; 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 dd9db387fb..7e67715852 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -14,11 +14,11 @@ #define FLAGS ACTOR_FLAG_4 -void EnZl3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZl3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZl3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZl3_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80B59AD0(EnZl3* this, GlobalContext* globalCtx); +void EnZl3_Init(Actor* thisx, PlayState* play); +void EnZl3_Destroy(Actor* thisx, PlayState* play); +void EnZl3_Update(Actor* thisx, PlayState* play); +void EnZl3_Draw(Actor* thisx, PlayState* play); +void func_80B59AD0(EnZl3* this, PlayState* play); static ColliderCylinderInitType1 sCylinderInit = { { @@ -64,34 +64,34 @@ static Vec3f D_80B5A4B0 = { 42.0f, 260.0f, 13.0f }; static u32 D_80B5A4BC = 0; -void func_80B533B0(Actor* thisx, GlobalContext* globalCtx) { +void func_80B533B0(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); } -void func_80B533FC(EnZl3* this, GlobalContext* globalCtx) { +void func_80B533FC(EnZl3* this, PlayState* play) { ColliderCylinder* collider = &this->collider; s32 pad[4]; Collider_UpdateCylinder(&this->actor, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetOC(play, &play->colChkCtx, &collider->base); } -void EnZl3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZl3_Destroy(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80B53468(void) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ESCAPE); } -BossGanon2* func_80B53488(EnZl3* this, GlobalContext* globalCtx) { +BossGanon2* func_80B53488(EnZl3* this, PlayState* play) { if (this->ganon == NULL) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].head; + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_BOSS].head; while (actorIt != NULL) { if (actorIt->id == ACTOR_BOSS_GANON2) { @@ -126,23 +126,22 @@ void EnZl3_setMouthIndex(EnZl3* this, s16 index) { this->mouthTexIndex = index; } -void func_80B5357C(EnZl3* this, GlobalContext* globalCtx) { +void func_80B5357C(EnZl3* this, PlayState* play) { Vec3f* thisPos = &this->actor.world.pos; Vec3f sp20; sp20.x = thisPos->x + ((Rand_ZeroOne() - 0.5f) * 10.0f); sp20.y = thisPos->y; sp20.z = thisPos->z + ((Rand_ZeroOne() - 0.5f) * 10.0f); - Item_DropCollectible(globalCtx, &sp20, ITEM00_HEART); + Item_DropCollectible(play, &sp20, ITEM00_HEART); } -void func_80B53614(EnZl3* this, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_RIVER_SOUND, -442.0f, 4102.0f, -371.0f, 0, 0, 0, 0x12); +void func_80B53614(EnZl3* this, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_RIVER_SOUND, -442.0f, 4102.0f, -371.0f, 0, 0, 0, 0x12); } -void func_80B5366C(EnZl3* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); +void func_80B5366C(EnZl3* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } void func_80B536B4(EnZl3* this) { @@ -160,8 +159,8 @@ void func_80B536C4(EnZl3* this) { Math_SmoothStepToS(&vec2->y, 0, 20, 6200, 100); } -void func_80B53764(EnZl3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B53764(EnZl3* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_3F8.unk_18 = player->actor.world.pos; this->unk_3F8.unk_14 = kREG(16) - 16.0f; @@ -596,8 +595,7 @@ void func_80B54360(EnZl3* this, s16 arg1, s32 arg2) { this->unk_2BC[arg2] = arg1; } -s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { +s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { s32 pad[3]; EnZl3* this = (EnZl3*)thisx; s16* unk_28C = this->unk_28C; @@ -608,7 +606,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Vec3s* unk_3F8_unk_0E = &this->unk_3F8.unk_0E; if (limbIndex == 14) { - sp78 = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx) * 7); + sp78 = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7); rot->x += unk_3F8_unk_08->y; rot->z += unk_3F8_unk_08->x; gSPSegment((*gfx)++, 0x0C, sp78); @@ -620,7 +618,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(362.0f, -133.0f, 0.0f, MTXMODE_APPLY); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 0); func_80B54360(this, sp30.x, 1); func_80B53B64(this, sp30.z, 2); @@ -630,7 +628,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_ToMtx(&sp78[0], "../z_en_zl3.c", 1490); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 3); } Matrix_RotateZYX(unk_28C[3] + kREG(34), unk_28C[4] + kREG(35), unk_28C[5] + kREG(36), MTXMODE_APPLY); @@ -638,7 +636,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_ToMtx(&sp78[1], "../z_en_zl3.c", 1534); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B54360(this, sp30.x, 7); } Matrix_RotateZYX(unk_28C[6] + kREG(37), unk_28C[7] + kREG(38), unk_28C[8] + kREG(39), MTXMODE_APPLY); @@ -649,7 +647,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(467.0f, 265.0f, 389.0f, MTXMODE_APPLY); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 9); func_80B54360(this, sp30.x, 10); func_80B53B64(this, sp30.z, 11); @@ -659,7 +657,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_ToMtx(&sp78[3], "../z_en_zl3.c", 1579); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 12); func_80B54360(this, sp30.x, 13); func_80B53B64(this, sp30.z, 14); @@ -672,7 +670,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Translate(467.0f, 265.0f, -389.0f, MTXMODE_APPLY); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 15); func_80B54360(this, sp30.x, 16); func_80B53B64(this, sp30.z, 17); @@ -682,7 +680,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_ToMtx(&sp78[5], "../z_en_zl3.c", 1623); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); - if (!FrameAdvance_IsEnabled(globalCtx)) { + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 18); func_80B54360(this, sp30.x, 19); func_80B53B64(this, sp30.z, 20); @@ -700,7 +698,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void EnZl3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnZl3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnZl3* this = (EnZl3*)thisx; s32 pad; Vec3f sp34; @@ -741,10 +739,10 @@ s32 func_80B54DD4(EnZl3* this) { return params & 0xF; } -void func_80B54DE0(EnZl3* this, GlobalContext* globalCtx) { +void func_80B54DE0(EnZl3* this, PlayState* play) { s32 idx = this->unk_318; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[idx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[idx].segment); } void func_80B54E14(EnZl3* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { @@ -766,38 +764,38 @@ void func_80B54E14(EnZl3* this, AnimationHeader* animation, u8 arg2, f32 morphFr Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, morphFrames); } -void func_80B54EA4(EnZl3* this, GlobalContext* globalCtx) { +void func_80B54EA4(EnZl3* this, PlayState* play) { f32 posX = this->actor.world.pos.x; f32 posY = this->actor.world.pos.y; f32 posZ = this->actor.world.pos.z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EG, posX, posY, posZ, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EG, posX, posY, posZ, 0, 0, 0, 0); } void func_80B54EF4(EnZl3* this) { func_80078914(&this->actor.projectedPos, NA_SE_VO_Z1_PAIN); } -void func_80B54F18(EnZl3* this, GlobalContext* globalCtx) { +void func_80B54F18(EnZl3* this, PlayState* play) { if (this->unk_2F8 == 0) { f32 posX = this->actor.world.pos.x; f32 posY = this->actor.world.pos.y + (kREG(5) + -26.0f); f32 posZ = this->actor.world.pos.z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0x4000, - 0, WARP_PURPLE_CRYSTAL); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, posX, posY, posZ, 0, 0x4000, 0, + WARP_PURPLE_CRYSTAL); this->unk_2F8 = 1; } } -void func_80B54FB4(EnZl3* this, GlobalContext* globalCtx) { +void func_80B54FB4(EnZl3* this, PlayState* play) { osSyncPrintf("ゼルダ姫のEn_Zl3_Actor_inFinal_Init通すよ!!!!!!!!!!!!!!!!!!!!!!!!!\n"); func_80B54E14(this, &gZelda2Anime2Anim_008AD0, 0, 0.0f, 0); EnZl3_setEyeIndex(this, 4); EnZl3_setMouthIndex(this, 2); this->action = 1; this->drawConfig = 1; - func_80B54F18(this, globalCtx); + func_80B54F18(this, play); this->actor.shape.rot.z = 0; this->unk_3C4 = this->actor.world.rot.z; this->actor.world.rot.z = this->actor.shape.rot.z; @@ -896,8 +894,8 @@ void func_80B553B4(EnZl3* this, s32 arg1) { } } -void func_80B553E8(EnZl3* this, GlobalContext* globalCtx) { - func_80B59AD0(this, globalCtx); +void func_80B553E8(EnZl3* this, PlayState* play) { + func_80B59AD0(this, play); } void func_80B55408(EnZl3* this) { @@ -909,7 +907,7 @@ void func_80B55408(EnZl3* this) { Actor_Kill(&this->actor); } -void func_80B55444(EnZl3* this, GlobalContext* globalCtx) { +void func_80B55444(EnZl3* this, PlayState* play) { s32 temp_v0 = func_80B5396C(this); if (temp_v0 >= 0) { @@ -937,7 +935,7 @@ void func_80B55444(EnZl3* this, GlobalContext* globalCtx) { func_80B55368(this); break; case 7: - func_80B553E8(this, globalCtx); + func_80B553E8(this, play); break; case 2: func_80B55408(this); @@ -952,57 +950,57 @@ void func_80B55444(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B55550(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B55550(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateSkelAnime(this); func_80B550F0(this); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B555A4(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B555A4(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_setEyeIndex(this, 2); func_80B550F0(this); func_80B55054(this); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B55604(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B55604(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); func_80B55144(this); func_80B552A8(this, EnZl3_UpdateSkelAnime(this)); func_80B55054(this); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B5566C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5566C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55334(this, EnZl3_UpdateSkelAnime(this)); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B556CC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B556CC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B553B4(this, EnZl3_UpdateSkelAnime(this)); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B5572C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5572C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B55444(this, globalCtx); + func_80B55444(this, play); } -void func_80B55780(EnZl3* this, GlobalContext* globalCtx) { +void func_80B55780(EnZl3* this, PlayState* play) { osSyncPrintf("ゼルダ姫のEn_Zl3_Actor_inFinal2_Init通すよ!!!!!!!!!!!!!!!!!!!!!!!!!\n"); func_80B54E14(this, &gZelda2Anime2Anim_005A0C, 0, 0.0f, 0); this->action = 7; @@ -1051,8 +1049,8 @@ void func_80B559C4(EnZl3* this) { thisPos->z = unk_32C->z + (temp_f0 * (unk_338->z - unk_32C->z)); } -void func_80B55A58(EnZl3* this, GlobalContext* globalCtx) { - if (globalCtx->activeCamId == CAM_ID_MAIN) { +void func_80B55A58(EnZl3* this, PlayState* play) { + if (play->activeCamId == CAM_ID_MAIN) { func_80B537E8(this); } } @@ -1116,22 +1114,22 @@ void func_80B55CCC(EnZl3* this, s32 arg1) { } } -void func_80B55D00(EnZl3* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B55D00(EnZl3* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = 13; } else if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; this->actor.flags |= ACTOR_FLAG_0; this->actor.textId = 0x70D5; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } else { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); this->actor.flags &= ~ACTOR_FLAG_0; } } -void func_80B55DB0(EnZl3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void func_80B55DB0(EnZl3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); this->actor.flags &= ~ACTOR_FLAG_0; this->action = 12; @@ -1172,17 +1170,17 @@ void func_80B55F38(EnZl3* this, s32 arg1) { } } -void func_80B55F6C(EnZl3* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B55F6C(EnZl3* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = 0x12; } else if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) { - BossGanon2* bossGanon2 = func_80B53488(this, globalCtx); + BossGanon2* bossGanon2 = func_80B53488(this, play); if ((bossGanon2 != NULL) && (bossGanon2->unk_324 <= (10.0f / 81.0f))) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; this->actor.flags |= ACTOR_FLAG_0; this->actor.textId = 0x7059; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } else { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); @@ -1209,8 +1207,8 @@ void func_80B56090(EnZl3* this, s32 arg1) { } } -void func_80B56108(EnZl3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void func_80B56108(EnZl3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); this->actor.flags &= ~ACTOR_FLAG_0; this->action = 16; @@ -1233,18 +1231,18 @@ void func_80B561E0(EnZl3* this, s32 arg1) { } } -void func_80B56214(EnZl3* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +void func_80B56214(EnZl3* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { this->action = 21; } else if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) { - BossGanon2* bossGanon2 = func_80B53488(this, globalCtx); + BossGanon2* bossGanon2 = func_80B53488(this, play); if (bossGanon2 != NULL) { if (bossGanon2->unk_324 <= (10.0f / 81.0f)) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; this->actor.flags |= ACTOR_FLAG_0; this->actor.textId = 0x7059; - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } } else { @@ -1253,8 +1251,8 @@ void func_80B56214(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B562F4(EnZl3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +void func_80B562F4(EnZl3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3); this->actor.flags &= ~ACTOR_FLAG_0; this->action = 20; @@ -1294,7 +1292,7 @@ void func_80B56474(EnZl3* this, s32 arg1) { } } -void func_80B564A8(EnZl3* this, GlobalContext* globalCtx) { +void func_80B564A8(EnZl3* this, PlayState* play) { s32 temp_v0; s32* val = &D_80B5A494; @@ -1367,171 +1365,171 @@ void func_80B564A8(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B56658(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56658(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B566AC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B566AC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55B04(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B5670C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5670C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55B78(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B5676C(EnZl3* this, GlobalContext* globalCtx) { +void func_80B5676C(EnZl3* this, PlayState* play) { s32 something; - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); something = EnZl3_UpdateSkelAnime(this); func_80B559C4(this); func_80B55C4C(this, something); } -void func_80B567CC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B567CC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B5682C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B55A58(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5682C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B55A58(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55CCC(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); - func_80B55D00(this, globalCtx); + func_80B564A8(this, play); + func_80B55D00(this, play); } -void func_80B568B4(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B568B4(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B537E8(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B55DB0(this, globalCtx); + func_80B55DB0(this, play); } -void func_80B5691C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5691C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55E48(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B5697C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B5697C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55EBC(this, EnZl3_UpdateSkelAnime(this)); func_80B5585C(this); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B569E4(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); +void func_80B569E4(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); func_80B537E8(this); - func_80B5366C(this, globalCtx); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55F38(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); - func_80B55F6C(this, globalCtx); + func_80B564A8(this, play); + func_80B55F6C(this, play); } -void func_80B56A68(EnZl3* this, GlobalContext* globalCtx) { +void func_80B56A68(EnZl3* this, PlayState* play) { s32 something; - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); + func_80B54DE0(this, play); + func_80B533FC(this, play); func_80B537E8(this); - func_80B5366C(this, globalCtx); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); something = EnZl3_UpdateSkelAnime(this); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); func_80B56090(this, something); } -void func_80B56AE0(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); +void func_80B56AE0(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); func_80B537E8(this); - func_80B5366C(this, globalCtx); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B55F38(this, EnZl3_UpdateSkelAnime(this)); - func_80B56108(this, globalCtx); + func_80B56108(this, play); } -void func_80B56B54(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56B54(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B56BA8(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56BA8(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B561E0(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); - func_80B56214(this, globalCtx); + func_80B564A8(this, play); + func_80B56214(this, play); } -void func_80B56C24(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56C24(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B562F4(this, globalCtx); + func_80B562F4(this, play); } -void func_80B56C84(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56C84(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B5638C(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B56CE4(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56CE4(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B56400(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } -void func_80B56D44(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B56D44(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B56474(this, EnZl3_UpdateSkelAnime(this)); - func_80B564A8(this, globalCtx); + func_80B564A8(this, play); } void func_80B56DA4(EnZl3* this) { @@ -1550,7 +1548,7 @@ void func_80B56DEC(EnZl3* this) { } } -void func_80B56E38(EnZl3* this, GlobalContext* globalCtx) { +void func_80B56E38(EnZl3* this, PlayState* play) { s32 pad[2]; s32 sfxId; SkelAnime* sp20 = &this->skelAnime; @@ -1558,22 +1556,22 @@ void func_80B56E38(EnZl3* this, GlobalContext* globalCtx) { if ((Animation_OnFrame(sp20, 6.0f) || Animation_OnFrame(sp20, 0.0f)) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { sfxId = 0x800; - sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } -void func_80B56EB8(EnZl3* this, GlobalContext* globalCtx) { - Flags_SetSwitch(globalCtx, func_80B54DB4(this)); +void func_80B56EB8(EnZl3* this, PlayState* play) { + Flags_SetSwitch(play, func_80B54DB4(this)); } -s32 func_80B56EE4(EnZl3* this, GlobalContext* globalCtx) { - return Flags_GetSwitch(globalCtx, func_80B54DB4(this)); +s32 func_80B56EE4(EnZl3* this, PlayState* play) { + return Flags_GetSwitch(play, func_80B54DB4(this)); } -void func_80B56F10(EnZl3* this, GlobalContext* globalCtx) { +void func_80B56F10(EnZl3* this, PlayState* play) { s32 waypoint; - Path* pathHead = globalCtx->setupPathList; + Path* pathHead = play->setupPathList; if (pathHead != NULL) { waypoint = func_80B54DC4(this); @@ -1672,8 +1670,8 @@ void func_80B57298(EnZl3* this) { this->actor.shape.rot.y = *rotY; } -u16 func_80B572F0(GlobalContext* globalCtx) { - s16 sceneNum = globalCtx->sceneNum; +u16 func_80B572F0(PlayState* play) { + s16 sceneNum = play->sceneNum; u16 ret; if (sceneNum == SCENE_GANON_SONOGO) { @@ -1686,32 +1684,32 @@ u16 func_80B572F0(GlobalContext* globalCtx) { return ret; } -s32 func_80B57324(EnZl3* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { +s32 func_80B57324(EnZl3* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { return 1; } return 0; } -void func_80B57350(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57350(EnZl3* this, PlayState* play) { s16 temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS(temp_v0) <= 0x4300) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - this->actor.textId = func_80B572F0(globalCtx); - func_8002F2F4(&this->actor, globalCtx); + this->actor.textId = func_80B572F0(play); + func_8002F2F4(&this->actor, play); } } -s32 func_80B573C8(EnZl3* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s32 func_80B573C8(EnZl3* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return 1; } return 0; } -s32 func_80B573FC(EnZl3* this, GlobalContext* globalCtx, f32 arg2) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B573FC(EnZl3* this, PlayState* play, f32 arg2) { + Player* player = GET_PLAYER(play); f32 playerX = player->actor.world.pos.x; f32 playerZ = player->actor.world.pos.z; f32 thisX = this->actor.world.pos.x; @@ -1723,11 +1721,11 @@ s32 func_80B573FC(EnZl3* this, GlobalContext* globalCtx, f32 arg2) { return 0; } -s32 func_80B57458(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B57458(EnZl3* this, PlayState* play) { Vec3f* thisPos = &this->actor.world.pos; f32 thisX = thisPos->x; f32 thisZ = thisPos->z; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* playerPos = &player->actor.world.pos; s32 pad; f32 playerX = playerPos->x; @@ -1745,30 +1743,30 @@ s32 func_80B57458(EnZl3* this, GlobalContext* globalCtx) { if (temp_v0 < 0x1555) { return 1; - } else if ((temp_v0 < 0x4000) && func_80B573FC(this, globalCtx, 150.0f)) { + } else if ((temp_v0 < 0x4000) && func_80B573FC(this, play, 150.0f)) { return 1; } else { return 0; } } -s32 func_80B57564(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B573FC(this, globalCtx, 50.0f) || func_80B57458(this, globalCtx)) { +s32 func_80B57564(EnZl3* this, PlayState* play) { + if (func_80B573FC(this, play, 50.0f) || func_80B57458(this, play)) { return 1; } return 0; } -s32 func_80B575B0(EnZl3* this, GlobalContext* globalCtx) { - return func_80B573FC(this, globalCtx, 150.0f); +s32 func_80B575B0(EnZl3* this, PlayState* play) { + return func_80B573FC(this, play, 150.0f); } -s32 func_80B575D0(EnZl3* this, GlobalContext* globalCtx) { - return func_80B573FC(this, globalCtx, 50.0f); +s32 func_80B575D0(EnZl3* this, PlayState* play) { + return func_80B573FC(this, play, 50.0f); } -s32 func_80B575F0(EnZl3* this, GlobalContext* globalCtx) { - s16 sceneNum = globalCtx->sceneNum; +s32 func_80B575F0(EnZl3* this, PlayState* play) { + s16 sceneNum = play->sceneNum; if ((sceneNum == SCENE_GANON_SONOGO) && (func_80B54DB4(this) == 0x26)) { s32 unk_314 = this->unk_314; @@ -1780,69 +1778,69 @@ s32 func_80B575F0(EnZl3* this, GlobalContext* globalCtx) { return 0; } -void func_80B5764C(EnZl3* this, GlobalContext* globalCtx) { - s16 sceneNum = globalCtx->sceneNum; +void func_80B5764C(EnZl3* this, PlayState* play) { + s16 sceneNum = play->sceneNum; if ((sceneNum == SCENE_GANON_SONOGO) && (func_80B54DB4(this) == 0x26)) { s32 unk_314 = this->unk_314 + 1; - if ((unk_314 == 1) && !Play_InCsMode(globalCtx)) { - OnePointCutscene_Init(globalCtx, 1000, 40, &this->actor, CAM_ID_MAIN); + if ((unk_314 == 1) && !Play_InCsMode(play)) { + OnePointCutscene_Init(play, 1000, 40, &this->actor, CAM_ID_MAIN); } } } -s32 func_80B576C8(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B575F0(this, globalCtx) && (this->unk_3D8 == 0)) { +s32 func_80B576C8(EnZl3* this, PlayState* play) { + if (func_80B575F0(this, play) && (this->unk_3D8 == 0)) { return 1; } return 0; } -void func_80B57704(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57704(EnZl3* this, PlayState* play) { s32 unk_3C4 = this->unk_3C4; - Flags_SetSwitch(globalCtx, unk_3C4); + Flags_SetSwitch(play, unk_3C4); } -void func_80B5772C(EnZl3* this, GlobalContext* globalCtx) { +void func_80B5772C(EnZl3* this, PlayState* play) { s32 unk_3C4 = this->unk_3C4; - Flags_UnsetSwitch(globalCtx, unk_3C4); + Flags_UnsetSwitch(play, unk_3C4); } -void func_80B57754(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57754(EnZl3* this, PlayState* play) { if (gSaveContext.unk_13F0 == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OCEFF_WIPE4, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1); + Actor_Spawn(&play->actorCtx, play, ACTOR_OCEFF_WIPE4, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 1); func_80B56DA4(this); } } -void func_80B577BC(GlobalContext* globalCtx, Vec3f* vec) { +void func_80B577BC(PlayState* play, Vec3f* vec) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* playerPos = &player->actor.world.pos; f32 posX = vec->x; f32 posY = vec->y; f32 posZ = vec->z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TEST, posX, posY, posZ, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TEST, posX, posY, posZ, 0, RAD_TO_BINANG(Math_FAtan2F(playerPos->x - posX, playerPos->z - posZ)), 0, 5); } -void func_80B57858(GlobalContext* globalCtx) { - func_80B577BC(globalCtx, &D_80B5A498); - func_80B577BC(globalCtx, &D_80B5A4A4); +void func_80B57858(PlayState* play) { + func_80B577BC(play, &D_80B5A498); + func_80B577BC(play, &D_80B5A4A4); } -s32 func_80B57890(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B57890(EnZl3* this, PlayState* play) { s8 pad[2]; - u8 curSpawn = globalCtx->curSpawn; - s16 sceneNum = globalCtx->sceneNum; + u8 curSpawn = play->curSpawn; + s16 sceneNum = play->sceneNum; s32 result = func_80B54DB4(this); - if (globalCtx) {} // Needed to match, this if can be almost anywhere and it still matches + if (play) {} // Needed to match, this if can be almost anywhere and it still matches if (sceneNum == SCENE_GANON_SONOGO) { if ((result == 0x24) && (curSpawn == 0)) { @@ -1861,9 +1859,9 @@ s32 func_80B57890(EnZl3* this, GlobalContext* globalCtx) { return 1; } } else if (sceneNum == SCENE_GANON_FINAL) { - if ((result == 0x20) && (curSpawn == 0) && Flags_GetSwitch(globalCtx, 0x37)) { - if ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)) { + if ((result == 0x20) && (curSpawn == 0) && Flags_GetSwitch(play, 0x37)) { + if ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)) { return 1; } } @@ -1887,8 +1885,8 @@ s32 func_80B57890(EnZl3* this, GlobalContext* globalCtx) { return 0; } -void func_80B57A74(GlobalContext* globalCtx) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; +void func_80B57A74(PlayState* play) { + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_PROP].head; //! @bug checks for encount2 in ACTORCAT_PROP but encount2 is in ACTORCAT_ENEMY so this condition is never met while (actorIt != NULL) { if (actorIt->id == ACTOR_EN_ENCOUNT2) { @@ -1904,7 +1902,7 @@ void func_80B57AAC(EnZl3* this, s32 arg1, AnimationHeader* arg2) { } } -void func_80B57AE0(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57AE0(EnZl3* this, PlayState* play) { s32 pad; s16 shapeRotY = this->actor.shape.rot.y; s32 pad2; @@ -1944,7 +1942,7 @@ s32 func_80B57C54(EnZl3* this) { return 0; } -s32 func_80B57C7C(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B57C7C(EnZl3* this, PlayState* play) { return 1; } @@ -1952,7 +1950,7 @@ s32 func_80B57C8C(EnZl3* this) { return !func_80B56F8C(this, this->unk_314 + 2); } -void func_80B57CB4(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57CB4(EnZl3* this, PlayState* play) { Vec3f* unk_348 = &this->unk_348; Vec3f* unk_354 = &this->unk_354; Vec3f* thisPos = &this->actor.world.pos; @@ -1965,15 +1963,15 @@ void func_80B57CB4(EnZl3* this, GlobalContext* globalCtx) { thisPos->z = unk_348->z + (temp_f0 * (unk_354->z - unk_348->z)); } -void func_80B57D60(EnZl3* this, GlobalContext* globalCtx) { +void func_80B57D60(EnZl3* this, PlayState* play) { func_80B57240(this); } -s32 func_80B57D80(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B57D80(EnZl3* this, PlayState* play) { s32 pad; s16* sp32 = &this->actor.shape.rot.y; struct_80034A14_arg1* unk_3F8 = &this->unk_3F8; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 unk_314 = this->unk_314; s16 temp_v0 = func_80B57104(this, unk_314); s32 pad2; @@ -1995,85 +1993,85 @@ s32 func_80B57D80(EnZl3* this, GlobalContext* globalCtx) { return phi_v1; } -void func_80B57EAC(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B57324(this, globalCtx)) { +void func_80B57EAC(EnZl3* this, PlayState* play) { + if (func_80B57324(this, play)) { this->action = 26; } else { - func_80B57350(this, globalCtx); + func_80B57350(this, play); } } -void func_80B57EEC(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B573C8(this, globalCtx)) { +void func_80B57EEC(EnZl3* this, PlayState* play) { + if (func_80B573C8(this, play)) { this->action = 27; } } -void func_80B57F1C(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B57D80(this, globalCtx) == 0) { +void func_80B57F1C(EnZl3* this, PlayState* play) { + if (func_80B57D80(this, play) == 0) { func_80B54E14(this, &gZelda2Anime2Anim_009BE4, 0, -8.0f, 0); this->action = 34; this->unk_314 -= 1; - func_80B57AE0(this, globalCtx); + func_80B57AE0(this, play); } } -s32 func_80B57F84(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B575D0(this, globalCtx) && func_80B57C7C(this, globalCtx) && !Play_InCsMode(globalCtx)) { +s32 func_80B57F84(EnZl3* this, PlayState* play) { + if (func_80B575D0(this, play) && func_80B57C7C(this, play) && !Play_InCsMode(play)) { func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, -8.0f, 0); this->action = 36; this->unk_2EC = 0.0f; - func_80B57A74(globalCtx); + func_80B57A74(play); return 1; } return 0; } -void func_80B58014(EnZl3* this, GlobalContext* globalCtx) { +void func_80B58014(EnZl3* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s8 invincibilityTimer = player->invincibilityTimer; - if (func_80B57324(this, globalCtx)) { + if (func_80B57324(this, play)) { func_80B54E14(this, &gZelda2Anime2Anim_003FF8, 0, -11.0f, 0); this->action = 29; func_80B538B0(this); - } else if (func_80B57C8C(this) && func_80B57F84(this, globalCtx)) { - OnePointCutscene_Init(globalCtx, 4000, -99, &this->actor, CAM_ID_MAIN); + } else if (func_80B57C8C(this) && func_80B57F84(this, play)) { + OnePointCutscene_Init(play, 4000, -99, &this->actor, CAM_ID_MAIN); this->unk_3D0 = 0; - } else if (func_80B576C8(this, globalCtx) && func_80B575B0(this, globalCtx) && !Play_InCsMode(globalCtx)) { + } else if (func_80B576C8(this, play) && func_80B575B0(this, play) && !Play_InCsMode(play)) { this->action = 0x1F; this->unk_3CC = 0.0f; func_80B537E8(this); this->unk_3D8 = 1; - OnePointCutscene_Init(globalCtx, 4010, -99, &this->actor, CAM_ID_MAIN); - } else if (!func_80B57C8C(this) && !func_80B576C8(this, globalCtx) && func_80B57564(this, globalCtx)) { + OnePointCutscene_Init(play, 4010, -99, &this->actor, CAM_ID_MAIN); + } else if (!func_80B57C8C(this) && !func_80B576C8(this, play) && func_80B57564(this, play)) { func_80B54E14(this, &gZelda2Anime2Anim_009BE4, 0, -8.0f, 0); - func_80B5764C(this, globalCtx); + func_80B5764C(this, play); this->action = 34; this->unk_3D0 = 0; - func_80B57AE0(this, globalCtx); + func_80B57AE0(this, play); } else if ((invincibilityTimer > 0) || (player->fallDistance >= 0x33)) { func_80B54E14(this, &gZelda2Anime2Anim_007664, 0, -11.0f, 0); this->action = 30; func_80B537E8(this); func_80B56DC8(this); } else { - func_80B57350(this, globalCtx); + func_80B57350(this, play); func_80B538B0(this); } } -void func_80B58214(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B573C8(this, globalCtx)) { +void func_80B58214(EnZl3* this, PlayState* play) { + if (func_80B573C8(this, play)) { func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, -11.0f, 0); this->action = 28; this->unk_3D0 = 0; } } -void func_80B58268(EnZl3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B58268(EnZl3* this, PlayState* play) { + Player* player = GET_PLAYER(play); s8 invincibilityTimer = player->invincibilityTimer; if ((invincibilityTimer <= 0) && (player->fallDistance <= 50)) { @@ -2083,23 +2081,23 @@ void func_80B58268(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B582C8(EnZl3* this, GlobalContext* globalCtx) { +void func_80B582C8(EnZl3* this, PlayState* play) { f32* unk_3CC = &this->unk_3CC; s32 pad; if (*unk_3CC == kREG(14) + 10.0f) { *unk_3CC += 1.0f; func_80B54E14(this, &gZelda2Anime2Anim_008050, 0, -12.0f, 0); - func_80B57704(this, globalCtx); + func_80B57704(this, play); } else if (*unk_3CC == kREG(15) + 20.0f) { *unk_3CC += 1.0f; func_80B56DC8(this); func_80B54E14(this, &gZelda2Anime2Anim_003FF8, 0, -12.0f, 0); } else if (*unk_3CC == kREG(16) + 30.0f) { *unk_3CC += 1.0f; - func_80B57858(globalCtx); + func_80B57858(play); } else if (*unk_3CC == kREG(17) + 40.0f) { - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); *unk_3CC += 1.0f; } else if (*unk_3CC >= ((kREG(17) + 40.0f) + 1.0f)) { this->action = 32; @@ -2109,27 +2107,27 @@ void func_80B582C8(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B584B4(EnZl3* this, GlobalContext* globalCtx) { +void func_80B584B4(EnZl3* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s8 invincibilityTimer = player->invincibilityTimer; - Actor* nearbyEnTest = Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f); + Actor* nearbyEnTest = Actor_FindNearby(play, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f); if (D_80B5A4BC == 0) { - if ((nearbyEnTest == NULL) && (!Play_InCsMode(globalCtx))) { + if ((nearbyEnTest == NULL) && (!Play_InCsMode(play))) { this->action = 33; - OnePointCutscene_Init(globalCtx, 4011, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4011, -99, &this->actor, CAM_ID_MAIN); } else if (invincibilityTimer > 0) { func_80B54E14(this, &gZelda2Anime2Anim_003FF8, 0, -12.0f, 0); D_80B5A4BC = 1; func_80B56DC8(this); } } else { - if ((nearbyEnTest == NULL) && (!Play_InCsMode(globalCtx))) { + if ((nearbyEnTest == NULL) && (!Play_InCsMode(play))) { func_80B54E14(this, &gZelda2Anime2Anim_007664, 0, -12.0f, 0); D_80B5A4BC = 0; this->action = 33; - OnePointCutscene_Init(globalCtx, 4011, -99, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4011, -99, &this->actor, CAM_ID_MAIN); } else if (invincibilityTimer <= 0) { func_80B54E14(this, &gZelda2Anime2Anim_007664, 0, -12.0f, 0); D_80B5A4BC = 0; @@ -2137,32 +2135,32 @@ void func_80B584B4(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B58624(EnZl3* this, GlobalContext* globalCtx) { +void func_80B58624(EnZl3* this, PlayState* play) { s32 pad[4]; f32* unk_3CC = &this->unk_3CC; if (*unk_3CC == (kREG(18) + 10.0f)) { *unk_3CC += 1.0f; func_80B54E14(this, &gZelda2Anime2Anim_008050, 0, -12.0f, 0); - func_80B5772C(this, globalCtx); + func_80B5772C(this, play); } else if (*unk_3CC == kREG(19) + 20.0f) { *unk_3CC += 1.0f; this->actor.textId = 0x71AC; - Message_StartTextbox(globalCtx, this->actor.textId, NULL); + Message_StartTextbox(play, this->actor.textId, NULL); func_80B54E14(this, &gZelda2Anime2Anim_003FF8, 0, -12.0f, 0); } else if (*unk_3CC == ((kREG(19) + 20.0f) + 1.0f)) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { *unk_3CC += 1.0f; - func_80B5357C(this, globalCtx); - func_80B5357C(this, globalCtx); - func_80B5357C(this, globalCtx); - func_80B5357C(this, globalCtx); - func_80B5357C(this, globalCtx); + func_80B5357C(this, play); + func_80B5357C(this, play); + func_80B5357C(this, play); + func_80B5357C(this, play); + func_80B5357C(this, play); } } else { if (*unk_3CC >= kREG(20) + 30.0f) { this->action = 28; - func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + func_8005B1A4(GET_ACTIVE_CAM(play)); func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, -12.0f, 0); *unk_3CC = 0.0f; } else { @@ -2171,25 +2169,25 @@ void func_80B58624(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B5884C(EnZl3* this, GlobalContext* globalCtx) { +void func_80B5884C(EnZl3* this, PlayState* play) { func_80B54E14(this, &gZelda2Anime2Anim_0038C0, 2, -8.0f, 0); this->action = 37; this->unk_36C = 1; } -void func_80B58898(EnZl3* this, GlobalContext* globalCtx) { +void func_80B58898(EnZl3* this, PlayState* play) { func_80B54E14(this, &gZelda2Anime2Anim_0038C0, 2, -8.0f, 1); this->action = 38; this->unk_374 = 1; } -void func_80B588E8(EnZl3* this, GlobalContext* globalCtx) { +void func_80B588E8(EnZl3* this, PlayState* play) { func_80B54E14(this, &gZelda2Anime2Anim_009BE4, 0, -8.0f, 0); - func_80B57AE0(this, globalCtx); + func_80B57AE0(this, play); this->action = 39; } -s32 func_80B58938(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B58938(EnZl3* this, PlayState* play) { if (func_80B57C54(this)) { func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, -8.0f, 0); this->action = 28; @@ -2199,9 +2197,9 @@ s32 func_80B58938(EnZl3* this, GlobalContext* globalCtx) { return 0; } -s32 func_80B5899C(EnZl3* this, GlobalContext* globalCtx) { +s32 func_80B5899C(EnZl3* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s8 invincibilityTimer = player->invincibilityTimer; if ((invincibilityTimer > 0) || (player->fallDistance >= 0x33)) { @@ -2214,14 +2212,14 @@ s32 func_80B5899C(EnZl3* this, GlobalContext* globalCtx) { return 0; } -void func_80B58A1C(EnZl3* this, GlobalContext* globalCtx) { - if (!func_80B58938(this, globalCtx)) { - func_80B5899C(this, globalCtx); +void func_80B58A1C(EnZl3* this, PlayState* play) { + if (!func_80B58938(this, play)) { + func_80B5899C(this, play); } } -void func_80B58A50(EnZl3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B58A50(EnZl3* this, PlayState* play) { + Player* player = GET_PLAYER(play); s8 invincibilityTimer = player->invincibilityTimer; if ((invincibilityTimer <= 0) && (player->fallDistance <= 50)) { @@ -2230,24 +2228,24 @@ void func_80B58A50(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B58AAC(EnZl3* this, GlobalContext* globalCtx) { +void func_80B58AAC(EnZl3* this, PlayState* play) { f32* unk_2EC = &this->unk_2EC; *unk_2EC += 1.0f; if ((*unk_2EC >= kREG(7) + 24.0f) && (this->unk_36C == 0)) { - func_80B57754(this, globalCtx); - func_80B5884C(this, globalCtx); + func_80B57754(this, play); + func_80B5884C(this, play); } else if ((*unk_2EC >= kREG(8) + 50.0f) && (this->unk_370 == 0)) { - func_80B56EB8(this, globalCtx); + func_80B56EB8(this, play); this->unk_370 = 1; } else if ((*unk_2EC >= kREG(9) + 56.0f) && (this->unk_374 == 0)) { - func_80B58898(this, globalCtx); + func_80B58898(this, play); } else if (*unk_2EC >= kREG(10) + 82.0f) { - func_80B588E8(this, globalCtx); + func_80B588E8(this, play); } } -void func_80B58C08(EnZl3* this, GlobalContext* globalCtx) { +void func_80B58C08(EnZl3* this, PlayState* play) { s32 pad[2]; Vec3f* unk_348 = &this->unk_348; Vec3f* unk_354 = &this->unk_354; @@ -2278,177 +2276,176 @@ void func_80B58C08(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B58D50(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B58D50(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B57EAC(this, globalCtx); + func_80B57EAC(this, play); } -void func_80B58DB0(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B58DB0(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B57EEC(this, globalCtx); + func_80B57EEC(this, play); } -void func_80B58E10(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B58E10(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); Actor_SetFocus(&this->actor, 60.0f); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B57F1C(this, globalCtx); + func_80B57F1C(this, play); } -void func_80B58E7C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); - func_80B53764(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); +void func_80B58E7C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); + func_80B53764(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58014(this, globalCtx); + func_80B58014(this, play); func_80B536B4(this); } -void func_80B58EF4(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B58EF4(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B538B0(this); - func_80B53764(this, globalCtx); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B53764(this, play); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58214(this, globalCtx); + func_80B58214(this, play); } -void func_80B58F6C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B58F6C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B537E8(this); func_80B536C4(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58268(this, globalCtx); + func_80B58268(this, play); } -void func_80B58FDC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B58FDC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B537E8(this); func_80B536C4(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B582C8(this, globalCtx); + func_80B582C8(this, play); } -void func_80B5904C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B5904C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B537E8(this); func_80B536C4(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B584B4(this, globalCtx); + func_80B584B4(this, play); } -void func_80B590BC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B590BC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B537E8(this); func_80B536C4(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58624(this, globalCtx); + func_80B58624(this, play); } -void func_80B5912C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B5912C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); - func_80B56E38(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); + func_80B56E38(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B57CB4(this, globalCtx); - func_80B57D60(this, globalCtx); - func_80B58A1C(this, globalCtx); + func_80B57CB4(this, play); + func_80B57D60(this, play); + func_80B58A1C(this, play); } -void func_80B591BC(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B591BC(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); func_80B538B0(this); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58A50(this, globalCtx); + func_80B58A50(this, play); } -void func_80B5922C(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B5922C(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); func_80B57298(this); Actor_SetFocus(&this->actor, 60.0f); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58AAC(this, globalCtx); + func_80B58AAC(this, play); } -void func_80B592A8(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B592A8(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); func_80B57298(this); Actor_SetFocus(&this->actor, 60.0f); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B57AAC(this, EnZl3_UpdateSkelAnime(this), &gZelda2Anime2Anim_003D20); func_80B56DEC(this); - func_80B58AAC(this, globalCtx); + func_80B58AAC(this, play); } -void func_80B59340(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B59340(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); func_80B57298(this); Actor_SetFocus(&this->actor, 60.0f); - func_80B533FC(this, globalCtx); - func_80B5366C(this, globalCtx); + func_80B533FC(this, play); + func_80B5366C(this, play); EnZl3_UpdateEyes(this); func_80B57AAC(this, EnZl3_UpdateSkelAnime(this), &gZelda2Anime2Anim_009FBC); - func_80B58AAC(this, globalCtx); + func_80B58AAC(this, play); } -void func_80B593D0(EnZl3* this, GlobalContext* globalCtx) { - func_80B54DE0(this, globalCtx); +void func_80B593D0(EnZl3* this, PlayState* play) { + func_80B54DE0(this, play); func_80B536C4(this); func_80B57298(this); - func_80B5366C(this, globalCtx); - func_80B56E38(this, globalCtx); + func_80B5366C(this, play); + func_80B56E38(this, play); Actor_SetFocus(&this->actor, 60.0f); EnZl3_UpdateEyes(this); EnZl3_UpdateSkelAnime(this); - func_80B58C08(this, globalCtx); + func_80B58C08(this, play); } -s32 func_80B5944C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { +s32 func_80B5944C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { if (limbIndex == 14) { - Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx) * 7); + Mtx* mtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7); EnZl3* this = (EnZl3*)thisx; Vec3s* vec = &this->unk_3F8.unk_08; @@ -2484,13 +2481,13 @@ s32 func_80B5944C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -s32 func_80B59698(EnZl3* this, GlobalContext* globalCtx) { - s32 cond = Flags_GetSwitch(globalCtx, 0x37) && - ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)); +s32 func_80B59698(EnZl3* this, PlayState* play) { + s32 cond = Flags_GetSwitch(play, 0x37) && + ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)); if (cond) { - u8 curSpawn = globalCtx->curSpawn; + u8 curSpawn = play->curSpawn; if ((func_80B54DB4(this) == 0x20) && (curSpawn == 0) && ((gSaveContext.timer2Value <= 0) || (gSaveContext.timer2State == 0))) { @@ -2500,13 +2497,13 @@ s32 func_80B59698(EnZl3* this, GlobalContext* globalCtx) { return 0; } -s32 func_80B59768(EnZl3* this, GlobalContext* globalCtx) { - s32 cond = Flags_GetSwitch(globalCtx, 0x37) && - ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)); +s32 func_80B59768(EnZl3* this, PlayState* play) { + s32 cond = Flags_GetSwitch(play, 0x37) && + ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)); if (cond) { - u8 curSpawn = globalCtx->curSpawn; + u8 curSpawn = play->curSpawn; if ((func_80B54DB4(this) == 0x20) && (curSpawn == 0) && (gSaveContext.timer2Value <= 0)) { return 1; @@ -2515,13 +2512,13 @@ s32 func_80B59768(EnZl3* this, GlobalContext* globalCtx) { return 0; } -void func_80B59828(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B59698(this, globalCtx) || (!func_80B56EE4(this, globalCtx) && func_80B57890(this, globalCtx))) { +void func_80B59828(EnZl3* this, PlayState* play) { + if (func_80B59698(this, play) || (!func_80B56EE4(this, play) && func_80B57890(this, play))) { s16 newRotY; func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, 0.0f, 0); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - func_80B56F10(this, globalCtx); + func_80B56F10(this, play); newRotY = func_80B571A8(this); this->actor.shape.rot.y = newRotY; this->actor.world.rot.y = newRotY; @@ -2534,64 +2531,64 @@ void func_80B59828(EnZl3* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } - if (func_80B59698(this, globalCtx) != 0) { + if (func_80B59698(this, play) != 0) { func_80088AA0(180); func_80B53468(); gSaveContext.healthAccumulator = 320; - Magic_Fill(globalCtx); - if (Flags_GetSwitch(globalCtx, 0x20)) { - Flags_UnsetSwitch(globalCtx, 0x20); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_ZG, -144.0f, 3544.0f, -43.0f, 0, 0x2000, 0, 0x2000); + Magic_Fill(play); + if (Flags_GetSwitch(play, 0x20)) { + Flags_UnsetSwitch(play, 0x20); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_ZG, -144.0f, 3544.0f, -43.0f, 0, 0x2000, 0, 0x2000); } - Flags_UnsetSwitch(globalCtx, 0x21); - Flags_UnsetSwitch(globalCtx, 0x22); - Flags_UnsetSwitch(globalCtx, 0x23); - Flags_UnsetSwitch(globalCtx, 0x24); - Flags_UnsetSwitch(globalCtx, 0x25); - Flags_UnsetSwitch(globalCtx, 0x26); - Flags_UnsetSwitch(globalCtx, 0x27); - Flags_UnsetSwitch(globalCtx, 0x28); - Flags_UnsetSwitch(globalCtx, 0x29); - Flags_UnsetSwitch(globalCtx, 0x2A); + Flags_UnsetSwitch(play, 0x21); + Flags_UnsetSwitch(play, 0x22); + Flags_UnsetSwitch(play, 0x23); + Flags_UnsetSwitch(play, 0x24); + Flags_UnsetSwitch(play, 0x25); + Flags_UnsetSwitch(play, 0x26); + Flags_UnsetSwitch(play, 0x27); + Flags_UnsetSwitch(play, 0x28); + Flags_UnsetSwitch(play, 0x29); + Flags_UnsetSwitch(play, 0x2A); } if (func_80B54DB4(this) == 0x20) { s32 cond; - func_80B54EA4(this, globalCtx); - cond = Flags_GetSwitch(globalCtx, 0x37) && - ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)); + func_80B54EA4(this, play); + cond = Flags_GetSwitch(play, 0x37) && + ((play->sceneNum == SCENE_GANON_DEMO) || (play->sceneNum == SCENE_GANON_FINAL) || + (play->sceneNum == SCENE_GANON_SONOGO) || (play->sceneNum == SCENE_GANONTIKA_SONOGO)); if (cond) { - func_80B53614(this, globalCtx); + func_80B53614(this, play); } } } -void func_80B59A80(EnZl3* this, GlobalContext* globalCtx) { - if (func_80B59768(this, globalCtx)) { +void func_80B59A80(EnZl3* this, PlayState* play) { + if (func_80B59768(this, play)) { Audio_PlaySoundGeneral(NA_SE_OC_REVENGE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } -void func_80B59AD0(EnZl3* this, GlobalContext* globalCtx) { +void func_80B59AD0(EnZl3* this, PlayState* play) { // todo look into Actor* thisx = &this->actor; // unused, necessary to use 'this' first to fix regalloc - Flags_SetSwitch(globalCtx, 0x36); + Flags_SetSwitch(play, 0x36); func_80088AA0(180); - func_80B54EA4(this, globalCtx); - func_80B53614(this, globalCtx); + func_80B54EA4(this, play); + func_80B53614(this, play); CLEAR_EVENTCHKINF(EVENTCHKINF_C7); - func_80B56F10(this, globalCtx); + func_80B56F10(this, play); gSaveContext.healthAccumulator = 320; - Magic_Fill(globalCtx); + Magic_Fill(play); this->action = 27; this->drawConfig = 1; } -void func_80B59B6C(EnZl3* this, GlobalContext* globalCtx) { +void func_80B59B6C(EnZl3* this, PlayState* play) { s32 sp2C = func_80B54DD4(this); this->unk_3DC = Animation_GetLastFrame(SEGMENTED_TO_VIRTUAL(&gZelda2Anime2Anim_0091D8)); @@ -2604,13 +2601,13 @@ void func_80B59B6C(EnZl3* this, GlobalContext* globalCtx) { switch (sp2C) { case 0: - func_80B54FB4(this, globalCtx); + func_80B54FB4(this, play); break; case 1: - func_80B55780(this, globalCtx); + func_80B55780(this, play); break; case 3: - func_80B59828(this, globalCtx); + func_80B59828(this, play); break; default: osSyncPrintf(VT_FGCOL(RED) " En_Oa3 の arg_data がおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); @@ -2618,9 +2615,9 @@ void func_80B59B6C(EnZl3* this, GlobalContext* globalCtx) { } } -void func_80B59DB8(EnZl3* this, GlobalContext* globalCtx) { +void func_80B59DB8(EnZl3* this, PlayState* play) { s32 pad; - ObjectContext* objCtx = &globalCtx->objectCtx; + ObjectContext* objCtx = &play->objectCtx; s32 objIndex = Object_GetIndex(objCtx, OBJECT_ZL2_ANIME2); s32 pad2; @@ -2631,8 +2628,8 @@ void func_80B59DB8(EnZl3* this, GlobalContext* globalCtx) { if (Object_IsLoaded(objCtx, objIndex)) { this->unk_318 = objIndex; - func_80B54DE0(this, globalCtx); - func_80B59B6C(this, globalCtx); + func_80B54DE0(this, play); + func_80B59B6C(this, play); } } @@ -2645,17 +2642,17 @@ static EnZl3ActionFunc sActionFuncs[] = { func_80B591BC, func_80B5922C, func_80B592A8, func_80B59340, func_80B593D0, }; -void EnZl3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZl3_Update(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; if (this->action < 0 || this->action >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->action] == NULL) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -void EnZl3_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZl3_Init(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; ActorShape* shape = &this->actor.shape; s32 pad; @@ -2663,15 +2660,15 @@ void EnZl3_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("ゼルダ姫のEn_Zl3_Actor_ct通すよ!!!!!!!!!!!!!!!!!!!!!!!!!\n"); ActorShape_Init(shape, 0.0f, ActorShadow_DrawCircle, 30.0f); shape->shadowAlpha = 0; - func_80B533B0(thisx, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZelda2Skel, NULL, this->jointTable, this->morphTable, 15); + func_80B533B0(thisx, play); + SkelAnime_InitFlex(play, &this->skelAnime, &gZelda2Skel, NULL, this->jointTable, this->morphTable, 15); switch (func_80B54DD4(this)) { case 1: gSaveContext.timer2State = 0; break; case 3: - func_80B59A80(this, globalCtx); + func_80B59A80(this, play); break; } @@ -2683,7 +2680,7 @@ static OverrideLimbDraw sOverrideLimbDrawFuncs[] = { func_80B5944C, }; -s32 EnZl3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, +s32 EnZl3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnZl3* this = (EnZl3*)thisx; @@ -2692,13 +2689,13 @@ s32 EnZl3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, osSyncPrintf(VT_FGCOL(RED) "描画前処理モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return 0; } - return sOverrideLimbDrawFuncs[this->unk_308](globalCtx, limbIndex, dList, pos, rot, thisx, gfx); + return sOverrideLimbDrawFuncs[this->unk_308](play, limbIndex, dList, pos, rot, thisx, gfx); } -void func_80B59FE8(EnZl3* this, GlobalContext* globalCtx) { +void func_80B59FE8(EnZl3* this, PlayState* play) { } -void func_80B59FF4(EnZl3* this, GlobalContext* globalCtx) { +void func_80B59FF4(EnZl3* this, PlayState* play) { s32 pad[2]; s16 eyeTexIndex = this->eyeTexIndex; void* eyeTex = sEyeTextures[eyeTexIndex]; @@ -2707,9 +2704,9 @@ void func_80B59FF4(EnZl3* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthTexIndex]; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zl3.c", 2165); + OPEN_DISPS(play->state.gfxCtx, "../z_en_zl3.c", 2165); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_OPA_DISP++, 0x9, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -2717,13 +2714,13 @@ void func_80B59FF4(EnZl3* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0xB, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnZl3_OverrideLimbDraw, EnZl3_PostLimbDraw, this, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zl3.c", 2190); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_zl3.c", 2190); } -void func_80B5A1D0(EnZl3* this, GlobalContext* globalCtx) { +void func_80B5A1D0(EnZl3* this, PlayState* play) { s32 pad[2]; s16 eyeTexIndex = this->eyeTexIndex; void* eyeTex = sEyeTextures[eyeTexIndex]; @@ -2732,9 +2729,9 @@ void func_80B5A1D0(EnZl3* this, GlobalContext* globalCtx) { void* mouthTex = sMouthTextures[mouthTexIndex]; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zl3.c", 2205); + OPEN_DISPS(play->state.gfxCtx, "../z_en_zl3.c", 2205); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(eyeTex)); gSPSegment(POLY_XLU_DISP++, 9, SEGMENTED_TO_VIRTUAL(eyeTex)); @@ -2742,10 +2739,10 @@ void func_80B5A1D0(EnZl3* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 11, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, + POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnZl3_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zl3.c", 2234); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_zl3.c", 2234); } static EnZl3DrawFunc sDrawFuncs[] = { @@ -2754,14 +2751,14 @@ static EnZl3DrawFunc sDrawFuncs[] = { func_80B5A1D0, }; -void EnZl3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZl3_Draw(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } - sDrawFuncs[this->drawConfig](this, globalCtx); + sDrawFuncs[this->drawConfig](this, play); } const ActorInit En_Zl3_InitVars = { diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h index cf30576c37..13b9a86dd5 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h @@ -8,8 +8,8 @@ struct EnZl3; -typedef void (*EnZl3ActionFunc)(struct EnZl3*, GlobalContext*); -typedef void (*EnZl3DrawFunc)(struct EnZl3*, GlobalContext*); +typedef void (*EnZl3ActionFunc)(struct EnZl3*, PlayState*); +typedef void (*EnZl3DrawFunc)(struct EnZl3*, PlayState*); typedef struct EnZl3 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 88028b5e32..a8798e8b77 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -49,14 +49,14 @@ typedef enum { /* 6 */ ZL4_EYE_LOOK_IN } EnZl4EyeState; -void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZl4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZl4_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZl4_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZl4_Init(Actor* thisx, PlayState* play); +void EnZl4_Destroy(Actor* thisx, PlayState* play); +void EnZl4_Update(Actor* thisx, PlayState* play); +void EnZl4_Draw(Actor* thisx, PlayState* play); -void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx); -void EnZl4_Idle(EnZl4* this, GlobalContext* globalCtx); -void EnZl4_TheEnd(EnZl4* this, GlobalContext* globalCtx); +void EnZl4_Cutscene(EnZl4* this, PlayState* play); +void EnZl4_Idle(EnZl4* this, PlayState* play); +void EnZl4_TheEnd(EnZl4* this, PlayState* play); const ActorInit En_Zl4_InitVars = { ACTOR_EN_ZL4, @@ -178,8 +178,8 @@ static AnimationInfo sAnimationInfo[] = { #include "z_en_zl4_cutscene_data.c" -void EnZl4_SetActiveCamDir(GlobalContext* globalCtx, s16 index) { - Camera* activeCam = GET_ACTIVE_CAM(globalCtx); +void EnZl4_SetActiveCamDir(PlayState* play, s16 index) { + Camera* activeCam = GET_ACTIVE_CAM(play); Camera_ChangeSetting(activeCam, CAM_SET_FREE0); activeCam->at = sCamDirections[index].at; @@ -188,9 +188,9 @@ void EnZl4_SetActiveCamDir(GlobalContext* globalCtx, s16 index) { activeCam->fov = sCamDirections[index].fov; } -void EnZl4_SetActiveCamMove(GlobalContext* globalCtx, s16 index) { - Camera* activeCam = GET_ACTIVE_CAM(globalCtx); - Player* player = GET_PLAYER(globalCtx); +void EnZl4_SetActiveCamMove(PlayState* play, s16 index) { + Camera* activeCam = GET_ACTIVE_CAM(play); + Player* player = GET_PLAYER(play); Camera_ChangeSetting(activeCam, CAM_SET_CS_0); Camera_ResetAnim(activeCam); @@ -198,8 +198,8 @@ void EnZl4_SetActiveCamMove(GlobalContext* globalCtx, s16 index) { sCamMove[index].relativeToPlayer); } -u16 EnZl4_GetText(GlobalContext* globalCtx, Actor* thisx) { - u16 faceReaction = Text_GetFaceReaction(globalCtx, 22); +u16 EnZl4_GetText(PlayState* play, Actor* thisx) { + u16 faceReaction = Text_GetFaceReaction(play, 22); u16 stoneCount; s16 ret; @@ -226,8 +226,8 @@ u16 EnZl4_GetText(GlobalContext* globalCtx, Actor* thisx) { return ret; } -s16 func_80B5B9B0(GlobalContext* globalCtx, Actor* thisx) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { +s16 func_80B5B9B0(PlayState* play, Actor* thisx) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return false; } return true; @@ -297,13 +297,13 @@ void EnZl4_UpdateFace(EnZl4* this) { } } -void EnZl4_SetMove(EnZl4* this, GlobalContext* globalCtx) { +void EnZl4_SetMove(EnZl4* this, PlayState* play) { this->skelAnime.moveFlags |= 1; - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } -void func_80B5BB78(EnZl4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B5BB78(EnZl4* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_1E0.unk_18 = player->actor.world.pos; func_80034A14(&this->actor, &this->unk_1E0, 2, 2); @@ -315,12 +315,12 @@ void EnZl4_GetActionStartPos(CsCmdActorAction* action, Vec3f* vec) { vec->z = action->startPos.z; } -s32 EnZl4_SetupFromLegendCs(EnZl4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Actor* playerx = &GET_PLAYER(globalCtx)->actor; +s32 EnZl4_SetupFromLegendCs(EnZl4* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Actor* playerx = &GET_PLAYER(play)->actor; s16 rotY; - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); playerx->world.pos = this->actor.world.pos; rotY = this->actor.shape.rot.y; playerx->world.pos.x += 56.0f * Math_SinS(rotY); @@ -328,7 +328,7 @@ s32 EnZl4_SetupFromLegendCs(EnZl4* this, GlobalContext* globalCtx) { player->linearVelocity = playerx->speedXZ = 0.0f; - EnZl4_SetActiveCamMove(globalCtx, 5); + EnZl4_SetActiveCamMove(play, 5); ShrinkWindow_SetVal(0x20); Interface_ChangeAlpha(2); this->talkTimer2 = 0; @@ -356,15 +356,15 @@ s32 EnZl4_InMovingAnim(EnZl4* this) { return false; } -void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZl4_Init(Actor* thisx, PlayState* play) { s32 pad; EnZl4* this = (EnZl4*)thisx; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gChildZeldaSkel, NULL, this->jointTable, this->morphTable, 18); + SkelAnime_InitFlex(play, &this->skelAnime, &gChildZeldaSkel, NULL, this->jointTable, this->morphTable, 18); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_21); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; @@ -383,7 +383,7 @@ void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx) { this->csState = ZL4_CS_WAIT; this->talkState = 0; } else { - EnZl4_SetupFromLegendCs(this, globalCtx); + EnZl4_SetupFromLegendCs(this, play); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->csState = ZL4_CS_LEGEND; this->talkState = 0; @@ -392,11 +392,11 @@ void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZl4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZl4_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnZl4* this = (EnZl4*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 EnZl4_SetNextAnim(EnZl4* this, s32 nextAnim) { @@ -416,20 +416,20 @@ void EnZl4_ReverseAnimation(EnZl4* this) { this->skelAnime.playSpeed = -1.0f; } -s32 EnZl4_CsWaitForPlayer(EnZl4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Actor* playerx = &GET_PLAYER(globalCtx)->actor; +s32 EnZl4_CsWaitForPlayer(EnZl4* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Actor* playerx = &GET_PLAYER(play)->actor; s16 rotY; s16 yawDiff; s16 absYawDiff; - if (!Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (!Actor_ProcessTalkRequest(&this->actor, play)) { yawDiff = (f32)this->actor.yawTowardsPlayer - this->actor.shape.rot.y; absYawDiff = ABS(yawDiff); if ((playerx->world.pos.y != this->actor.world.pos.y) || (absYawDiff >= 0x3FFC)) { return false; } else { - func_8002F2CC(&this->actor, globalCtx, this->collider.dim.radius + 60.0f); + func_8002F2CC(&this->actor, play, this->collider.dim.radius + 60.0f); return false; } } @@ -442,7 +442,7 @@ s32 EnZl4_CsWaitForPlayer(EnZl4* this, GlobalContext* globalCtx) { return true; } -s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { +s32 EnZl4_CsMeetPlayer(EnZl4* this, PlayState* play) { switch (this->talkState) { case 0: if (this->skelAnime.curFrame == 50.0f) { @@ -451,24 +451,24 @@ s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { if (!EnZl4_SetNextAnim(this, ZL4_ANIM_4)) { break; } else { - Message_StartTextbox(globalCtx, 0x702E, NULL); + Message_StartTextbox(play, 0x702E, NULL); this->talkState++; } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamDir(globalCtx, 1); - Message_StartTextbox(globalCtx, 0x702F, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamDir(play, 1); + Message_StartTextbox(play, 0x702F, NULL); this->talkTimer2 = 0; this->talkState++; } break; case 2: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardMeetCs); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardMeetCs); gSaveContext.cutsceneTrigger = 1; - EnZl4_SetActiveCamMove(globalCtx, 0); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + EnZl4_SetActiveCamMove(play, 0); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState++; } @@ -476,14 +476,14 @@ s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { case 3: this->talkTimer2++; if (this->talkTimer2 >= 45) { - Message_StartTextbox(globalCtx, 0x70F9, NULL); + Message_StartTextbox(play, 0x70F9, NULL); this->talkState++; } break; case 4: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamMove(globalCtx, 1); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamMove(play, 1); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState++; } @@ -491,60 +491,60 @@ s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { case 5: this->talkTimer2++; if (this->talkTimer2 >= 10) { - Message_StartTextbox(globalCtx, 0x70FA, NULL); + Message_StartTextbox(play, 0x70FA, NULL); this->talkState++; } break; case 6: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamDir(globalCtx, 2); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamDir(play, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_22); this->mouthExpression = ZL4_MOUTH_NEUTRAL; this->talkTimer2 = 0; this->talkState++; - Message_StartTextbox(globalCtx, 0x70FB, NULL); + Message_StartTextbox(play, 0x70FB, NULL); } break; } return (this->talkState == 7) ? 1 : 0; } -s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { +s32 EnZl4_CsAskStone(EnZl4* this, PlayState* play) { switch (this->talkState) { case 0: if (EnZl4_SetNextAnim(this, ZL4_ANIM_25)) { this->talkState++; } case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamDir(globalCtx, 3); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamDir(play, 3); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer1 = 40; this->talkState = 2; } break; case 2: if (DECR(this->talkTimer1) == 0) { - Message_StartTextbox(globalCtx, 0x7030, NULL); + Message_StartTextbox(play, 0x7030, NULL); this->talkState++; } break; case 3: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play))) { break; - } else if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetActiveCamDir(globalCtx, 4); + } else if (play->msgCtx.choiceIndex == 0) { + EnZl4_SetActiveCamDir(play, 4); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_28); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_HAPPY; - Message_StartTextbox(globalCtx, 0x7032, NULL); + Message_StartTextbox(play, 0x7032, NULL); this->talkState = 7; } else { - EnZl4_SetActiveCamDir(globalCtx, 2); + EnZl4_SetActiveCamDir(play, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_9); this->mouthExpression = ZL4_MOUTH_WORRIED; - Message_StartTextbox(globalCtx, 0x7031, NULL); + Message_StartTextbox(play, 0x7031, NULL); this->talkState++; } break; @@ -556,8 +556,8 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 5: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_9); this->mouthExpression = ZL4_MOUTH_WORRIED; EnZl4_ReverseAnimation(this); @@ -566,8 +566,8 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { break; case 6: this->mouthExpression = ZL4_MOUTH_NEUTRAL; - EnZl4_SetActiveCamDir(globalCtx, 3); - Message_StartTextbox(globalCtx, 0x7030, NULL); + EnZl4_SetActiveCamDir(play, 3); + Message_StartTextbox(play, 0x7030, NULL); this->talkState = 12; break; case 12: @@ -575,21 +575,21 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { this->talkState = 13; } case 13: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play))) { break; - } else if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetActiveCamDir(globalCtx, 4); + } else if (play->msgCtx.choiceIndex == 0) { + EnZl4_SetActiveCamDir(play, 4); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_28); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_HAPPY; - Message_StartTextbox(globalCtx, 0x7032, NULL); + Message_StartTextbox(play, 0x7032, NULL); this->talkState = 7; } else { - EnZl4_SetActiveCamDir(globalCtx, 2); + EnZl4_SetActiveCamDir(play, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_9); this->mouthExpression = ZL4_MOUTH_WORRIED; - Message_StartTextbox(globalCtx, 0x7031, NULL); + Message_StartTextbox(play, 0x7031, NULL); this->talkState = 4; } break; @@ -601,29 +601,29 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 8: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamMove(globalCtx, 2); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamMove(play, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_NEUTRAL; - Message_StartTextbox(globalCtx, 0x70FC, NULL); + Message_StartTextbox(play, 0x70FC, NULL); this->talkState = 9; } break; case 9: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamDir(globalCtx, 5); - Message_StartTextbox(globalCtx, 0x70FD, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamDir(play, 5); + Message_StartTextbox(play, 0x70FD, NULL); this->talkState++; } break; case 10: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_5); this->eyeExpression = ZL4_EYES_OPEN; this->mouthExpression = ZL4_MOUTH_SURPRISED; - Message_StartTextbox(globalCtx, 0x70FE, NULL); + Message_StartTextbox(play, 0x70FE, NULL); this->talkState++; } break; @@ -631,7 +631,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { return (this->talkState == 11) ? 1 : 0; } -s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { +s32 EnZl4_CsAskName(EnZl4* this, PlayState* play) { switch (this->talkState) { case 0: if (EnZl4_SetNextAnim(this, ZL4_ANIM_4)) { @@ -639,14 +639,14 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamDir(globalCtx, 6); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamDir(play, 6); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_1); this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_NEUTRAL; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - Message_StartTextbox(globalCtx, 0x70FF, NULL); + play->msgCtx.msgMode = MSGMODE_PAUSED; + Message_StartTextbox(play, 0x70FF, NULL); this->talkState++; } break; @@ -655,25 +655,25 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 3: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_16); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState = 4; } break; case 4: if (EnZl4_SetNextAnim(this, ZL4_ANIM_17)) { - Message_StartTextbox(globalCtx, 0x2073, NULL); + Message_StartTextbox(play, 0x2073, NULL); this->talkState++; } break; case 5: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamMove(globalCtx, 3); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamMove(play, 3); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState = 6; } @@ -681,15 +681,15 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { case 6: this->talkTimer2++; if (this->talkTimer2 >= 15) { - Message_StartTextbox(globalCtx, 0x2074, NULL); + Message_StartTextbox(play, 0x2074, NULL); this->talkState++; } break; case 7: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_6); this->mouthExpression = ZL4_MOUTH_HAPPY; - Message_StartTextbox(globalCtx, 0x2075, NULL); + Message_StartTextbox(play, 0x2075, NULL); this->talkState++; } break; @@ -698,23 +698,23 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 9: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x7033, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x7033, NULL); this->talkState = 10; } break; case 10: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetActiveCamMove(globalCtx, 4); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { + EnZl4_SetActiveCamMove(play, 4); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_33); this->mouthExpression = ZL4_MOUTH_NEUTRAL; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState = 15; } else { - EnZl4_SetActiveCamDir(globalCtx, 6); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + EnZl4_SetActiveCamDir(play, 6); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer1 = 20; this->talkState++; this->skelAnime.playSpeed = 0.0f; @@ -727,7 +727,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_LOOK_RIGHT; this->mouthExpression = ZL4_MOUTH_WORRIED; - Message_StartTextbox(globalCtx, 0x7034, NULL); + Message_StartTextbox(play, 0x7034, NULL); this->talkState++; } break; @@ -739,41 +739,41 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 13: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_6); this->blinkTimer = 3; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_HAPPY; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState = 14; } break; case 14: if (EnZl4_SetNextAnim(this, ZL4_ANIM_25)) { - Message_StartTextbox(globalCtx, 0x7033, NULL); + Message_StartTextbox(play, 0x7033, NULL); this->talkState = 10; } break; case 15: this->talkTimer2++; if (this->talkTimer2 >= 30) { - Message_StartTextbox(globalCtx, 0x7035, NULL); + Message_StartTextbox(play, 0x7035, NULL); this->talkState++; } break; case 16: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } case 17: this->talkTimer2++; if (this->talkTimer2 == 130) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - globalCtx->nextEntranceIndex = ENTR_HIRAL_DEMO_0; + play->msgCtx.msgMode = MSGMODE_PAUSED; + play->nextEntranceIndex = ENTR_HIRAL_DEMO_0; gSaveContext.nextCutsceneIndex = 0xFFF7; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; } break; } @@ -783,48 +783,48 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { return false; } -s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { - Camera* activeCam = GET_ACTIVE_CAM(globalCtx); +s32 EnZl4_CsTellLegend(EnZl4* this, PlayState* play) { + Camera* activeCam = GET_ACTIVE_CAM(play); switch (this->talkState) { case 0: this->talkTimer2++; if (this->talkTimer2 >= 60) { - Message_StartTextbox(globalCtx, 0x7037, NULL); + Message_StartTextbox(play, 0x7037, NULL); this->talkState++; } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamDir(globalCtx, 7); - Message_StartTextbox(globalCtx, 0x2076, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamDir(play, 7); + Message_StartTextbox(play, 0x2076, NULL); this->talkState++; } break; case 2: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamMove(globalCtx, 6); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamMove(play, 6); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } break; case 3: if (activeCam->animState == 2) { - Message_StartTextbox(globalCtx, 0x2077, NULL); + Message_StartTextbox(play, 0x2077, NULL); this->talkState++; } break; case 4: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play))) { break; - } else if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetActiveCamDir(globalCtx, 8); - Message_StartTextbox(globalCtx, 0x7005, NULL); + } else if (play->msgCtx.choiceIndex == 0) { + EnZl4_SetActiveCamDir(play, 8); + Message_StartTextbox(play, 0x7005, NULL); this->talkState = 9; } else { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_5); this->mouthExpression = ZL4_MOUTH_SURPRISED; - Message_StartTextbox(globalCtx, 0x7038, NULL); + Message_StartTextbox(play, 0x7038, NULL); this->talkState++; Audio_PlayActorSound2(&this->actor, NA_SE_VO_Z0_HURRY); } @@ -834,29 +834,29 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 6: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_33); this->mouthExpression = ZL4_MOUTH_NEUTRAL; - Message_StartTextbox(globalCtx, 0x7037, NULL); + Message_StartTextbox(play, 0x7037, NULL); this->talkState++; } break; case 7: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x2076, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x2076, NULL); this->talkState++; } break; case 8: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x2077, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x2077, NULL); this->talkState = 4; } break; case 9: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_26); - Message_StartTextbox(globalCtx, 0x2078, NULL); + Message_StartTextbox(play, 0x2078, NULL); this->talkState++; } break; @@ -865,19 +865,19 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 11: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play))) { break; - } else if (globalCtx->msgCtx.choiceIndex == 0) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + } else if (play->msgCtx.choiceIndex == 0) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState = 13; } else { - Message_StartTextbox(globalCtx, 0x700B, NULL); + Message_StartTextbox(play, 0x700B, NULL); this->talkState = 12; } break; case 12: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState = 13; } break; @@ -885,43 +885,43 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { return (this->talkState == 13) ? 1 : 0; } -s32 EnZl4_CsLookWindow(EnZl4* this, GlobalContext* globalCtx) { +s32 EnZl4_CsLookWindow(EnZl4* this, PlayState* play) { switch (this->talkState) { case 0: - EnZl4_SetActiveCamMove(globalCtx, 7); - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardWindowCs); + EnZl4_SetActiveCamMove(play, 7); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardWindowCs); gSaveContext.cutsceneTrigger = 1; this->talkState++; break; case 1: - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.frames == 90) { - globalCtx->csCtx.state = CS_STATE_UNSKIPPABLE_INIT; + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.frames == 90) { + play->csCtx.state = CS_STATE_UNSKIPPABLE_INIT; } } else { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardGanonCs); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardGanonCs); gSaveContext.cutsceneTrigger = 1; this->talkState++; - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); } break; case 2: - if (globalCtx->csCtx.state != CS_STATE_IDLE) { - if (globalCtx->csCtx.frames == 209) { - globalCtx->csCtx.state = CS_STATE_UNSKIPPABLE_INIT; + if (play->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.frames == 209) { + play->csCtx.state = CS_STATE_UNSKIPPABLE_INIT; } } else { func_800AA000(0.0f, 0xA0, 0xA, 0x28); - func_8002DF54(globalCtx, &this->actor, 1); + func_8002DF54(play, &this->actor, 1); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_30); - EnZl4_SetActiveCamDir(globalCtx, 11); - Message_StartTextbox(globalCtx, 0x7039, NULL); + EnZl4_SetActiveCamDir(play, 11); + Message_StartTextbox(play, 0x7039, NULL); this->talkState++; } break; case 3: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } break; @@ -929,8 +929,8 @@ s32 EnZl4_CsLookWindow(EnZl4* this, GlobalContext* globalCtx) { return (this->talkState == 4) ? 1 : 0; } -s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnZl4_CsWarnAboutGanon(EnZl4* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 rotY; switch (this->talkState) { @@ -939,13 +939,13 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { rotY = this->actor.shape.rot.y - 0x3FFC; player->actor.world.pos.x += 34.0f * Math_SinS(rotY); player->actor.world.pos.z += 34.0f * Math_CosS(rotY); - EnZl4_SetActiveCamMove(globalCtx, 8); + EnZl4_SetActiveCamMove(play, 8); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_WIDE; this->mouthExpression = ZL4_MOUTH_WORRIED; this->talkTimer2 = 0; this->talkState++; - Message_StartTextbox(globalCtx, 0x2079, NULL); + Message_StartTextbox(play, 0x2079, NULL); case 1: this->talkTimer2++; if (this->talkTimer2 >= 20) { @@ -953,9 +953,9 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { } break; case 2: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamMove(globalCtx, 9); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamMove(play, 9); + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState++; } @@ -963,49 +963,49 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { case 3: this->talkTimer2++; if (this->talkTimer2 >= 20) { - Message_StartTextbox(globalCtx, 0x207A, NULL); + Message_StartTextbox(play, 0x207A, NULL); this->talkState++; } break; case 4: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamDir(globalCtx, 12); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamDir(play, 12); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_23); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } break; case 5: if (EnZl4_SetNextAnim(this, ZL4_ANIM_24)) { - Message_StartTextbox(globalCtx, 0x207B, NULL); + Message_StartTextbox(play, 0x207B, NULL); this->talkState++; } break; case 6: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x703A, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x703A, NULL); this->talkState++; } break; case 7: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play))) { break; - } else if (globalCtx->msgCtx.choiceIndex == 0) { + } else if (play->msgCtx.choiceIndex == 0) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_31); this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_HAPPY; - Message_StartTextbox(globalCtx, 0x703B, NULL); + Message_StartTextbox(play, 0x703B, NULL); this->talkState = 11; } else { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_13); this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_LOOK_LEFT; this->mouthExpression = ZL4_MOUTH_WORRIED; - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } break; @@ -1014,20 +1014,20 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { this->blinkTimer = 3; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; - Message_StartTextbox(globalCtx, 0x7073, NULL); + Message_StartTextbox(play, 0x7073, NULL); this->talkState++; } break; case 9: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_14); - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } break; case 10: if (EnZl4_SetNextAnim(this, ZL4_ANIM_24)) { - Message_StartTextbox(globalCtx, 0x703A, NULL); + Message_StartTextbox(play, 0x703A, NULL); this->talkState = 7; } break; @@ -1036,8 +1036,8 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 12: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState = 13; } break; @@ -1045,31 +1045,31 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { return (this->talkState == 13) ? 1 : 0; } -s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { +s32 EnZl4_CsMakePlan(EnZl4* this, PlayState* play) { switch (this->talkState) { case 0: Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_18); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_WORRIED; - EnZl4_SetActiveCamMove(globalCtx, 10); + EnZl4_SetActiveCamMove(play, 10); this->talkTimer2 = 0; this->talkState++; case 1: this->talkTimer2++; if (this->talkTimer2 >= 10) { - Message_StartTextbox(globalCtx, 0x7123, NULL); + Message_StartTextbox(play, 0x7123, NULL); this->talkState++; } break; case 2: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetActiveCamDir(globalCtx, 13); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + EnZl4_SetActiveCamDir(play, 13); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_19); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; - Message_StartTextbox(globalCtx, 0x207C, NULL); + Message_StartTextbox(play, 0x207C, NULL); this->talkState++; } break; @@ -1078,8 +1078,8 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 4: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x207D, NULL); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x207D, NULL); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_7); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; @@ -1093,24 +1093,24 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { this->talkState++; } case 6: - if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx))) { + if (!((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play))) { break; } else { - Camera_ChangeSetting(GET_ACTIVE_CAM(globalCtx), CAM_SET_NORMAL0); + Camera_ChangeSetting(GET_ACTIVE_CAM(play), CAM_SET_NORMAL0); this->talkState = 7; - globalCtx->talkWithPlayer(globalCtx, &this->actor); - func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, fabsf(this->actor.xzDistToPlayer) + 1.0f, + play->talkWithPlayer(play, &this->actor); + func_8002F434(&this->actor, play, GI_LETTER_ZELDA, fabsf(this->actor.xzDistToPlayer) + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); - globalCtx->msgCtx.stateTimer = 4; - globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } break; case 7: - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->talkState++; } else { - func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, fabsf(this->actor.xzDistToPlayer) + 1.0f, + func_8002F434(&this->actor, play, GI_LETTER_ZELDA, fabsf(this->actor.xzDistToPlayer) + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } // no break here is required for matching @@ -1118,12 +1118,12 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { return (this->talkState == 8) ? 1 : 0; } -void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnZl4_Cutscene(EnZl4* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->csState) { case ZL4_CS_WAIT: - if (EnZl4_CsWaitForPlayer(this, globalCtx)) { + if (EnZl4_CsWaitForPlayer(this, play)) { this->talkState = 0; this->csState++; } @@ -1134,51 +1134,51 @@ void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx) { this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; Audio_PlayFanfare(NA_BGM_APPEAR); - EnZl4_SetActiveCamDir(globalCtx, 0); + EnZl4_SetActiveCamDir(play, 0); Interface_ChangeAlpha(2); ShrinkWindow_SetVal(0x20); this->talkState = 0; this->csState++; break; case ZL4_CS_MEET: - if (EnZl4_CsMeetPlayer(this, globalCtx)) { + if (EnZl4_CsMeetPlayer(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_STONE: - if (EnZl4_CsAskStone(this, globalCtx)) { + if (EnZl4_CsAskStone(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_NAMES: - if (EnZl4_CsAskName(this, globalCtx)) { + if (EnZl4_CsAskName(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_LEGEND: - if (EnZl4_CsTellLegend(this, globalCtx)) { + if (EnZl4_CsTellLegend(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_WINDOW: - if (EnZl4_CsLookWindow(this, globalCtx)) { + if (EnZl4_CsLookWindow(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_GANON: - if (EnZl4_CsWarnAboutGanon(this, globalCtx)) { + if (EnZl4_CsWarnAboutGanon(this, play)) { this->talkState = 0; this->csState++; } break; case ZL4_CS_PLAN: - if (EnZl4_CsMakePlan(this, globalCtx)) { - func_8002DF54(globalCtx, &this->actor, 7); + if (EnZl4_CsMakePlan(this, play)) { + func_8002DF54(play, &this->actor, 7); gSaveContext.unk_13EE = 0x32; SET_EVENTCHKINF(EVENTCHKINF_40); this->actionFunc = EnZl4_Idle; @@ -1188,17 +1188,17 @@ void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx) { this->unk_1E0.unk_18 = player->actor.world.pos; func_80034A14(&this->actor, &this->unk_1E0, 2, (this->csState == ZL4_CS_WINDOW) ? 2 : 1); if (EnZl4_InMovingAnim(this)) { - EnZl4_SetMove(this, globalCtx); + EnZl4_SetMove(this, play); } } -void EnZl4_Idle(EnZl4* this, GlobalContext* globalCtx) { - func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 60.0f, EnZl4_GetText, +void EnZl4_Idle(EnZl4* this, PlayState* play) { + func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 60.0f, EnZl4_GetText, func_80B5B9B0); - func_80B5BB78(this, globalCtx); + func_80B5BB78(this, play); } -void EnZl4_TheEnd(EnZl4* this, GlobalContext* globalCtx) { +void EnZl4_TheEnd(EnZl4* this, PlayState* play) { s32 animIndex[] = { ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_26, ZL4_ANIM_21, ZL4_ANIM_3 }; CsCmdActorAction* npcAction; @@ -1208,17 +1208,17 @@ void EnZl4_TheEnd(EnZl4* this, GlobalContext* globalCtx) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_4); } if (EnZl4_InMovingAnim(this)) { - EnZl4_SetMove(this, globalCtx); + EnZl4_SetMove(this, play); } - if (globalCtx->csCtx.frames == 100) { + if (play->csCtx.frames == 100) { this->eyeExpression = ZL4_EYES_LOOK_LEFT; } - if (globalCtx->csCtx.frames == 450) { + if (play->csCtx.frames == 450) { this->blinkTimer = 3; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; } - npcAction = globalCtx->csCtx.npcActions[0]; + npcAction = play->csCtx.npcActions[0]; if (npcAction != NULL) { EnZl4_GetActionStartPos(npcAction, &pos); if (this->lastAction == 0) { @@ -1234,7 +1234,7 @@ void EnZl4_TheEnd(EnZl4* this, GlobalContext* globalCtx) { } } -void EnZl4_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZl4_Update(Actor* thisx, PlayState* play) { s32 pad; EnZl4* this = (EnZl4*)thisx; @@ -1242,13 +1242,13 @@ void EnZl4_Update(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } EnZl4_UpdateFace(this); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + this->actionFunc(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnZl4_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnZl4_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnZl4* this = (EnZl4*)thisx; Vec3s sp1C; @@ -1270,7 +1270,7 @@ s32 EnZl4_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnZl4_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnZl4_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EnZl4* this = (EnZl4*)thisx; @@ -1279,7 +1279,7 @@ void EnZl4_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnZl4_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZl4_Draw(Actor* thisx, PlayState* play) { EnZl4* this = (EnZl4*)thisx; void* mouthTex[] = { gChildZeldaMouthNeutralTex, gChildZeldaMouthHappyTex, gChildZeldaMouthWorriedTex, gChildZeldaMouthSurprisedTex }; @@ -1288,12 +1288,12 @@ void EnZl4_Draw(Actor* thisx, GlobalContext* globalCtx) { gChildZeldaEyeSquintTex, gChildZeldaEyeOutTex, gChildZeldaEyeInTex, }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zl4.c", 2012); + OPEN_DISPS(play->state.gfxCtx, "../z_en_zl4.c", 2012); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex[this->rightEyeState])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex[this->leftEyeState])); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(mouthTex[this->mouthState])); - func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80093D18(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnZl4_OverrideLimbDraw, EnZl4_PostLimbDraw, this); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zl4.c", 2043); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_zl4.c", 2043); } diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h index ace675ddcd..05d6a26552 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h @@ -6,8 +6,8 @@ struct EnZl4; -typedef void (*EnZl4ActionFunc)(struct EnZl4*, GlobalContext*); -typedef void (*EnZl4DrawFunc)(struct EnZl4*, GlobalContext*); +typedef void (*EnZl4ActionFunc)(struct EnZl4*, PlayState*); +typedef void (*EnZl4DrawFunc)(struct EnZl4*, PlayState*); typedef struct EnZl4 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 9606bcead7..6a73faa241 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -16,17 +16,17 @@ typedef enum { /* 3 */ ENZO_EFFECT_BUBBLE } EnZoEffectType; -void EnZo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZo_Init(Actor* thisx, PlayState* play); +void EnZo_Destroy(Actor* thisx, PlayState* play); +void EnZo_Update(Actor* thisx, PlayState* play); +void EnZo_Draw(Actor* thisx, PlayState* play); // Actions -void EnZo_Standing(EnZo* this, GlobalContext* globalCtx); -void EnZo_Submerged(EnZo* this, GlobalContext* globalCtx); -void EnZo_Surface(EnZo* this, GlobalContext* globalCtx); -void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx); -void EnZo_Dive(EnZo* this, GlobalContext* globalCtx); +void EnZo_Standing(EnZo* this, PlayState* play); +void EnZo_Submerged(EnZo* this, PlayState* play); +void EnZo_Surface(EnZo* this, PlayState* play); +void EnZo_TreadWater(EnZo* this, PlayState* play); +void EnZo_Dive(EnZo* this, PlayState* play); void EnZo_SpawnRipple(EnZo* this, Vec3f* pos, f32 scale, f32 targetScale, u8 alpha) { EnZoEffect* effect; @@ -169,15 +169,15 @@ void EnZo_UpdateEffectsSplashes(EnZo* this) { } } -void EnZo_DrawEffectsRipples(EnZo* this, GlobalContext* globalCtx) { +void EnZo_DrawEffectsRipples(EnZo* this, PlayState* play) { EnZoEffect* effect; s16 i; u8 materialFlag; effect = this->effects; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 217); + OPEN_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 217); materialFlag = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) { if (effect->type == ENZO_EFFECT_RIPPLE) { if (!materialFlag) { @@ -191,23 +191,23 @@ void EnZo_DrawEffectsRipples(EnZo* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, effect->color.a); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, 1.0f, effect->scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 242), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_zo_eff.c", 242), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gZoraRipplesModelDL); } effect++; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 248); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 248); } -void EnZo_DrawEffectsBubbles(EnZo* this, GlobalContext* globalCtx) { +void EnZo_DrawEffectsBubbles(EnZo* this, PlayState* play) { EnZoEffect* effect = this->effects; s16 i; u8 materialFlag; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 260); + OPEN_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 260); materialFlag = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) { if (effect->type == ENZO_EFFECT_BUBBLE) { if (!materialFlag) { @@ -221,27 +221,27 @@ void EnZo_DrawEffectsBubbles(EnZo* this, GlobalContext* globalCtx) { } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 281), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_zo_eff.c", 281), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gZoraBubblesModelDL); } effect++; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 286); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 286); } -void EnZo_DrawEffectsSplashes(EnZo* this, GlobalContext* globalCtx) { +void EnZo_DrawEffectsSplashes(EnZo* this, PlayState* play) { EnZoEffect* effect; s16 i; u8 materialFlag; effect = this->effects; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 298); + OPEN_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 298); materialFlag = false; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) { if (effect->type == ENZO_EFFECT_SPLASH) { if (!materialFlag) { @@ -254,16 +254,16 @@ void EnZo_DrawEffectsSplashes(EnZo* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 180, 180, 180, effect->color.a); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 325), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_zo_eff.c", 325), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gZoraSplashesModelDL); } effect++; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 331); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_zo_eff.c", 331); } void EnZo_TreadWaterRipples(EnZo* this, f32 scale, f32 targetScale, u8 alpha) { @@ -354,10 +354,10 @@ void EnZo_SpawnSplashes(EnZo* this) { } } -u16 func_80B61024(GlobalContext* globalCtx, Actor* thisx) { +u16 func_80B61024(PlayState* play, Actor* thisx) { u16 textId; - textId = Text_GetFaceReaction(globalCtx, 29); + textId = Text_GetFaceReaction(play, 29); if (textId != 0) { return textId; } @@ -440,8 +440,8 @@ u16 func_80B61024(GlobalContext* globalCtx, Actor* thisx) { return 0x4006; } -s16 func_80B61298(GlobalContext* globalCtx, Actor* thisx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +s16 func_80B61298(PlayState* play, Actor* thisx) { + switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_FADING: @@ -467,20 +467,20 @@ s16 func_80B61298(GlobalContext* globalCtx, Actor* thisx) { return 0; case TEXT_STATE_CHOICE: - switch (Message_ShouldAdvance(globalCtx)) { + switch (Message_ShouldAdvance(play)) { case 0: return 1; default: if (thisx->textId == 0x400C) { - thisx->textId = (globalCtx->msgCtx.choiceIndex == 0) ? 0x400D : 0x400E; - Message_ContinueTextbox(globalCtx, thisx->textId); + thisx->textId = (play->msgCtx.choiceIndex == 0) ? 0x400D : 0x400E; + Message_ContinueTextbox(play, thisx->textId); } break; } return 1; case TEXT_STATE_EVENT: - switch (Message_ShouldAdvance(globalCtx)) { + switch (Message_ShouldAdvance(play)) { case 0: return 1; default: @@ -501,8 +501,8 @@ void EnZo_Blink(EnZo* this) { } } -void EnZo_Dialog(EnZo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnZo_Dialog(EnZo* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_194.unk_18 = player->actor.world.pos; if (this->actionFunc == EnZo_Standing) { @@ -513,12 +513,12 @@ void EnZo_Dialog(EnZo* this, GlobalContext* globalCtx) { } func_80034A14(&this->actor, &this->unk_194, 11, this->unk_64C); if (this->canSpeak == true) { - func_800343CC(globalCtx, &this->actor, &this->unk_194.unk_00, this->dialogRadius, func_80B61024, func_80B61298); + func_800343CC(play, &this->actor, &this->unk_194.unk_00, this->dialogRadius, func_80B61024, func_80B61298); } } -s32 EnZo_PlayerInProximity(EnZo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnZo_PlayerInProximity(EnZo* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f surfacePos; f32 yDist; f32 hDist; @@ -568,13 +568,13 @@ void EnZo_SetAnimation(EnZo* this) { } } -void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Init(Actor* thisx, PlayState* play) { EnZo* this = (EnZo*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, 20); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, 20); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInit); if (LINK_IS_ADULT && ((this->actor.params & 0x3F) == 8)) { @@ -589,7 +589,7 @@ void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_64C = 1; this->canSpeak = false; this->unk_194.unk_00 = 0; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, this->collider.dim.height * 0.5f, this->collider.dim.radius, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, this->collider.dim.height * 0.5f, this->collider.dim.radius, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if (this->actor.yDistToWater < 54.0f || (this->actor.params & 0x3F) == 8) { @@ -605,13 +605,13 @@ void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Destroy(Actor* thisx, PlayState* play) { } -void EnZo_Standing(EnZo* this, GlobalContext* globalCtx) { +void EnZo_Standing(EnZo* this, PlayState* play) { s16 angle; - func_80034F54(globalCtx, this->unk_656, this->unk_67E, 20); + func_80034F54(play, this->unk_656, this->unk_67E, 20); EnZo_SetAnimation(this); if (this->unk_194.unk_00 != 0) { this->unk_64C = 4; @@ -620,7 +620,7 @@ void EnZo_Standing(EnZo* this, GlobalContext* globalCtx) { angle = ABS((s16)((f32)this->actor.yawTowardsPlayer - (f32)this->actor.shape.rot.y)); if (angle < 0x4718) { - if (EnZo_PlayerInProximity(this, globalCtx)) { + if (EnZo_PlayerInProximity(this, play)) { this->unk_64C = 2; } else { this->unk_64C = 1; @@ -630,14 +630,14 @@ void EnZo_Standing(EnZo* this, GlobalContext* globalCtx) { } } -void EnZo_Submerged(EnZo* this, GlobalContext* globalCtx) { - if (EnZo_PlayerInProximity(this, globalCtx)) { +void EnZo_Submerged(EnZo* this, PlayState* play) { + if (EnZo_PlayerInProximity(this, play)) { this->actionFunc = EnZo_Surface; this->actor.velocity.y = 4.0f; } } -void EnZo_Surface(EnZo* this, GlobalContext* globalCtx) { +void EnZo_Surface(EnZo* this, PlayState* play) { if (this->actor.yDistToWater < 54.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_OUT_OF_WATER); EnZo_SpawnSplashes(this); @@ -652,8 +652,8 @@ void EnZo_Surface(EnZo* this, GlobalContext* globalCtx) { } } -void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx) { - func_80034F54(globalCtx, this->unk_656, this->unk_67E, 20); +void EnZo_TreadWater(EnZo* this, PlayState* play) { + func_80034F54(play, this->unk_656, this->unk_67E, 20); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->canSpeak = true; this->unk_64C = 4; @@ -672,7 +672,7 @@ void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx) { this->rippleTimer = 12; } - if (EnZo_PlayerInProximity(this, globalCtx) != 0) { + if (EnZo_PlayerInProximity(this, play) != 0) { this->timeToDive = Rand_S16Offset(40, 40); } else if (DECR(this->timeToDive) == 0) { f32 startFrame; @@ -688,7 +688,7 @@ void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx) { } } -void EnZo_Dive(EnZo* this, GlobalContext* globalCtx) { +void EnZo_Dive(EnZo* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_DIVE_WATER); EnZo_SpawnSplashes(this); @@ -714,7 +714,7 @@ void EnZo_Dive(EnZo* this, GlobalContext* globalCtx) { } } -void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Update(Actor* thisx, PlayState* play) { EnZo* this = (EnZo*)thisx; u32 pad; Vec3f pos; @@ -725,13 +725,13 @@ void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, this->collider.dim.radius, this->collider.dim.height * 0.25f, 0.0f, + Actor_UpdateBgCheckInfo(play, thisx, this->collider.dim.radius, this->collider.dim.height * 0.25f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, globalCtx); - EnZo_Dialog(this, globalCtx); + this->actionFunc(this, play); + EnZo_Dialog(this, play); // Spawn air bubbles - if (globalCtx->state.frames & 8) { + if (play->state.frames & 8) { pos = this->actor.world.pos; pos.y += (Rand_ZeroOne() - 0.5f) * 10.0f + 18.0f; @@ -742,7 +742,7 @@ void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) { if ((s32)this->alpha != 0) { Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } EnZo_UpdateEffectsRipples(this); @@ -750,8 +750,7 @@ void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) { EnZo_UpdateEffectsSplashes(this); } -s32 EnZo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { +s32 EnZo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnZo* this = (EnZo*)thisx; Vec3s vec; @@ -777,7 +776,7 @@ s32 EnZo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnZo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnZo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnZo* this = (EnZo*)thisx; Vec3f vec = { 0.0f, 600.0f, 0.0f }; @@ -786,27 +785,27 @@ void EnZo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Draw(Actor* thisx, PlayState* play) { EnZo* this = (EnZo*)thisx; void* eyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex }; Matrix_Push(); - EnZo_DrawEffectsRipples(this, globalCtx); - EnZo_DrawEffectsBubbles(this, globalCtx); - EnZo_DrawEffectsSplashes(this, globalCtx); + EnZo_DrawEffectsRipples(this, play); + EnZo_DrawEffectsBubbles(this, play); + EnZo_DrawEffectsSplashes(this, play); Matrix_Pop(); if ((s32)this->alpha != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zo.c", 1008); + OPEN_DISPS(play->state.gfxCtx, "../z_en_zo.c", 1008); if (this->alpha == 255.0f) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexture])); - func_80034BA0(globalCtx, &this->skelAnime, EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, thisx, this->alpha); + func_80034BA0(play, &this->skelAnime, EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, thisx, this->alpha); } else { gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexture])); - func_80034CC4(globalCtx, &this->skelAnime, EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, thisx, this->alpha); + func_80034CC4(play, &this->skelAnime, EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, thisx, this->alpha); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zo.c", 1025); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_zo.c", 1025); } } diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.h b/src/overlays/actors/ovl_En_Zo/z_en_zo.h index 87e0d474e8..afb739aa64 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -19,7 +19,7 @@ typedef struct { /* 0x2C */ Vec3f vec; // Usage specific } EnZoEffect; // size = 0x38 -typedef void (*EnZoActionFunc)(struct EnZo*, GlobalContext*); +typedef void (*EnZoActionFunc)(struct EnZo*, PlayState*); typedef struct EnZo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c index fb717a60e0..0f4eb17030 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -31,19 +31,19 @@ typedef enum { /* 15 */ INTRO_READY = 15 } EnfHGIntroState; -void EnfHG_Init(Actor* thisx, GlobalContext* globalCtx); -void EnfHG_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnfHG_Update(Actor* thisx, GlobalContext* globalCtx); -void EnfHG_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnfHG_Init(Actor* thisx, PlayState* play); +void EnfHG_Destroy(Actor* thisx, PlayState* play); +void EnfHG_Update(Actor* thisx, PlayState* play); +void EnfHG_Draw(Actor* thisx, PlayState* play); -void EnfHG_SetupIntro(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_SetupApproach(EnfHG* this, GlobalContext* globalCtx, s16 paintingIndex); -void EnfHG_Approach(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_Damage(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_Retreat(EnfHG* this, GlobalContext* globalCtx); -void EnfHG_Done(EnfHG* this, GlobalContext* globalCtx); +void EnfHG_SetupIntro(EnfHG* this, PlayState* play); +void EnfHG_Intro(EnfHG* this, PlayState* play); +void EnfHG_SetupApproach(EnfHG* this, PlayState* play, s16 paintingIndex); +void EnfHG_Approach(EnfHG* this, PlayState* play); +void EnfHG_Attack(EnfHG* this, PlayState* play); +void EnfHG_Damage(EnfHG* this, PlayState* play); +void EnfHG_Retreat(EnfHG* this, PlayState* play); +void EnfHG_Done(EnfHG* this, PlayState* play); const ActorInit En_fHG_InitVars = { ACTOR_EN_FHG, @@ -68,37 +68,37 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1200, ICHAIN_STOP), }; -void EnfHG_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnfHG_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnfHG* this = (EnfHG*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - Flags_SetSwitch(globalCtx, 0x14); + Flags_SetSwitch(play, 0x14); Actor_SetScale(&this->actor, 0.011499999f); this->actor.gravity = -3.5f; ActorShape_Init(&this->actor.shape, -2600.0f, NULL, 20.0f); this->actor.speedXZ = 0.0f; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; - Skin_Init(globalCtx, &this->skin, &gPhantomHorseSkel, &gPhantomHorseRunningAnim); + Skin_Init(play, &this->skin, &gPhantomHorseSkel, &gPhantomHorseRunningAnim); if (this->actor.params >= GND_FAKE_BOSS) { - EnfHG_SetupApproach(this, globalCtx, this->actor.params - GND_FAKE_BOSS); + EnfHG_SetupApproach(this, play, this->actor.params - GND_FAKE_BOSS); } else { - EnfHG_SetupIntro(this, globalCtx); + EnfHG_SetupIntro(this, play); } } -void EnfHG_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnfHG_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnfHG* this = (EnfHG*)thisx; osSyncPrintf("F DT1\n"); - Skin_Free(globalCtx, &this->skin); + Skin_Free(play, &this->skin); osSyncPrintf("F DT2\n"); } -void EnfHG_SetupIntro(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_SetupIntro(EnfHG* this, PlayState* play) { Animation_PlayLoop(&this->skin.skelAnime, &gPhantomHorseIdleAnim); this->actionFunc = EnfHG_Intro; this->actor.world.pos.x = GND_BOSSROOM_CENTER_X; @@ -106,10 +106,10 @@ void EnfHG_SetupIntro(EnfHG* this, GlobalContext* globalCtx) { this->actor.world.pos.z = GND_BOSSROOM_CENTER_Z; } -void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Intro(EnfHG* this, PlayState* play) { static Vec3f audioVec = { 0.0f, 0.0f, 50.0f }; s32 pad64; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); BossGanondrof* bossGnd = (BossGanondrof*)this->actor.parent; s32 pad58; s32 pad54; @@ -136,7 +136,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { case INTRO_START: if (GET_EVENTCHKINF(EVENTCHKINF_72)) { if (this->timers[0] == 55) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_SHUTTER, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_SHUTTER, GND_BOSSROOM_CENTER_X + 0.0f, GND_BOSSROOM_CENTER_Y - 97.0f, GND_BOSSROOM_CENTER_Z + 308.0f, 0, 0, 0, (SHUTTER_PG_BARS << 6)); } @@ -145,22 +145,22 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } if (this->timers[0] == 0) { - EnfHG_SetupApproach(this, globalCtx, Rand_ZeroOne() * 5.99f); + EnfHG_SetupApproach(this, play, Rand_ZeroOne() * 5.99f); this->bossGndSignal = FHG_START_FIGHT; } break; } - func_80064520(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 8); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_80064520(play, &play->csCtx); + func_8002DF54(play, &this->actor, 8); + this->subCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); this->cutsceneState = INTRO_FENCE; this->timers[0] = 60; this->actor.world.pos.y = GND_BOSSROOM_CENTER_Y - 7.0f; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); SET_EVENTCHKINF(EVENTCHKINF_72); - Flags_SetSwitch(globalCtx, 0x23); + Flags_SetSwitch(play, 0x23); case INTRO_FENCE: player->actor.world.pos.x = GND_BOSSROOM_CENTER_X + 0.0f; player->actor.world.pos.y = GND_BOSSROOM_CENTER_Y + 7.0f; @@ -174,7 +174,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { this->subCamAt.y = GND_BOSSROOM_CENTER_Y + 47.0f; this->subCamAt.z = GND_BOSSROOM_CENTER_Z + 315.0f; if (this->timers[0] == 25) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_SHUTTER, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_SHUTTER, GND_BOSSROOM_CENTER_X + 0.0f, GND_BOSSROOM_CENTER_Y - 97.0f, GND_BOSSROOM_CENTER_Z + 308.0f, 0, 0, 0, (SHUTTER_PG_BARS << 6)); } @@ -191,7 +191,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_HORSE_GROAN); } if (this->timers[0] == 20) { - func_8002DF54(globalCtx, &this->actor, 9); + func_8002DF54(play, &this->actor, 9); } if (this->timers[0] == 1) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_OPENING_GANON); @@ -272,8 +272,8 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { -10.0f); } if (this->timers[0] == 90) { - globalCtx->envCtx.lightSettingOverride = 2; - globalCtx->envCtx.lightBlendRateOverride = 20; + play->envCtx.lightSettingOverride = 2; + play->envCtx.lightBlendRateOverride = 20; } if (this->timers[0] == 100) { this->bossGndSignal = FHG_LIGHTNING; @@ -330,8 +330,8 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { this->actor.world.pos.y += 2.0f * Math_SinS(this->gallopTimer * 0x5DC); Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, 0.05f); if (this->timers[0] == 75) { - TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, - SEGMENTED_TO_VIRTUAL(gPhantomGanonTitleCardTex), 160, 180, 128, 40); + TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gPhantomGanonTitleCardTex), + 160, 180, 128, 40); } if (this->timers[0] == 0) { this->cutsceneState = INTRO_RETREAT; @@ -352,7 +352,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { this->bossGndSignal = FHG_FINISH; } if (this->timers[0] == 170) { - func_8002DF54(globalCtx, &this->actor, 8); + func_8002DF54(play, &this->actor, 8); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_MASIC2); } Math_ApproachF(&this->subCamEye.z, this->subCamPanZ + (GND_BOSSROOM_CENTER_Z + 100.0f), 0.1f, @@ -364,18 +364,17 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { if ((fabsf(this->actor.world.pos.z - (GND_BOSSROOM_CENTER_Z + 400.0f - 0.5f)) < 300.0f) && !this->spawnedWarp) { this->spawnedWarp = true; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, - GND_BOSSROOM_CENTER_X + 0.0f, this->actor.world.pos.y + 50.0f, - GND_BOSSROOM_CENTER_Z + 400.0f - 0.5f, 0, this->actor.shape.rot.y, 0, - FHGFIRE_WARP_RETREAT); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, GND_BOSSROOM_CENTER_X + 0.0f, + this->actor.world.pos.y + 50.0f, GND_BOSSROOM_CENTER_Z + 400.0f - 0.5f, 0, + this->actor.shape.rot.y, 0, FHGFIRE_WARP_RETREAT); this->fhgFireKillWarp = true; } Math_ApproachF(&this->subCamAt.x, this->actor.world.pos.x, 0.2f, 50.0f); Math_ApproachF(&this->subCamAt.z, this->actor.world.pos.z, 0.2f, 50.0f); osSyncPrintf("TIME %d-------------------------------------------------\n", this->timers[0]); if (fabsf(this->actor.world.pos.z - (GND_BOSSROOM_CENTER_Z + 400.0f - 0.5f)) < 1.0f) { - globalCtx->envCtx.lightSettingOverride = 0; - globalCtx->envCtx.lightBlendRateOverride = 20; + play->envCtx.lightSettingOverride = 0; + play->envCtx.lightBlendRateOverride = 20; this->cutsceneState = INTRO_FINISH; Animation_MorphToLoop(&this->skin.skelAnime, &gPhantomHorseRunningAnim, -3.0f); this->bossGndSignal = FHG_START_FIGHT; @@ -384,32 +383,32 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { } break; case INTRO_FINISH: - EnfHG_Retreat(this, globalCtx); + EnfHG_Retreat(this, play); Math_ApproachF(&this->subCamEye.z, this->subCamPanZ + (GND_BOSSROOM_CENTER_Z + 100.0f), 0.1f, this->subCamVelFactor * 1.5f); Math_ApproachF(&this->subCamPanZ, -100.0f, 0.1f, 1.0f); Math_ApproachF(&this->subCamAt.y, (this->actor.world.pos.y + 70.0f) - 20.0f, 0.1f, this->subCamVelFactor * 10.0f); if (this->timers[1] == 0) { - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_800C08AC(globalCtx, this->subCamId, 0); + func_800C08AC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); this->actionFunc = EnfHG_Retreat; } break; } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } -void EnfHG_SetupApproach(EnfHG* this, GlobalContext* globalCtx, s16 paintingIndex) { +void EnfHG_SetupApproach(EnfHG* this, PlayState* play, s16 paintingIndex) { s16 oppositeIndex[6] = { 3, 4, 5, 0, 1, 2 }; Animation_MorphToLoop(&this->skin.skelAnime, &gPhantomHorseRunningAnim, 0.0f); @@ -447,9 +446,9 @@ void EnfHG_SetupApproach(EnfHG* this, GlobalContext* globalCtx, s16 paintingInde this->actor.scale.z = 0.001f; this->approachRate = 0.0f; - this->warpColorFilterR = globalCtx->lightCtx.fogColor[0]; - this->warpColorFilterG = globalCtx->lightCtx.fogColor[1]; - this->warpColorFilterB = globalCtx->lightCtx.fogColor[2]; + this->warpColorFilterR = play->lightCtx.fogColor[0]; + this->warpColorFilterG = play->lightCtx.fogColor[1]; + this->warpColorFilterB = play->lightCtx.fogColor[2]; this->warpColorFilterUnk1 = 0.0f; this->warpColorFilterUnk2 = 0.0f; this->turnRot = 0; @@ -457,7 +456,7 @@ void EnfHG_SetupApproach(EnfHG* this, GlobalContext* globalCtx, s16 paintingInde this->spawnedWarp = false; } -void EnfHG_Approach(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Approach(EnfHG* this, PlayState* play) { osSyncPrintf("STANDBY !!\n"); osSyncPrintf("XP2 = %f\n", this->actor.world.pos.x); osSyncPrintf("ZP2 = %f\n", this->actor.world.pos.z); @@ -485,15 +484,15 @@ void EnfHG_Approach(EnfHG* this, GlobalContext* globalCtx) { this->actionFunc = EnfHG_Attack; Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_HORSE_NEIGH); this->timers[0] = 40; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, - this->actor.world.pos.x, this->actor.world.pos.y + 50.0f, this->actor.world.pos.z, 0, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, + this->actor.world.pos.y + 50.0f, this->actor.world.pos.z, 0, this->actor.shape.rot.y + 0x8000, 0, FHGFIRE_WARP_EMERGE); this->fhgFireKillWarp = false; } } } -void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Attack(EnfHG* this, PlayState* play) { osSyncPrintf("KABE OUT !!\n"); this->bossGndInPainting = false; SkelAnime_Update(&this->skin.skelAnime); @@ -509,9 +508,9 @@ void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx) { Math_ApproachF(&this->warpColorFilterB, 255.0f, 1.0f, 10.0f); Math_ApproachF(&this->warpColorFilterUnk1, -60.0f, 1.0f, 5.0f); } else { - Math_ApproachF(&this->warpColorFilterR, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->warpColorFilterG, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->warpColorFilterB, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterR, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterG, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterB, play->lightCtx.fogColor[0], 1.0f, 10.0f); Math_ApproachF(&this->warpColorFilterUnk1, 0.0f, 1.0f, 5.0f); if (this->timers[1] == 29) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_MASIC2); @@ -519,9 +518,9 @@ void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx) { } if (this->hitTimer == 0) { if (this->timers[1] == 24) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, - this->actor.world.pos.x, (this->actor.world.pos.y + 100.0f) + 25.0f, - this->actor.world.pos.z, 0, 0, 0, FHGFIRE_LIGHTNING_STRIKE); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->actor.world.pos.x, + (this->actor.world.pos.y + 100.0f) + 25.0f, this->actor.world.pos.z, 0, 0, 0, + FHGFIRE_LIGHTNING_STRIKE); } if (this->timers[1] == 45) { Animation_MorphToLoop(&this->skin.skelAnime, &gPhantomHorseAirAnim, 0.0f); @@ -557,7 +556,7 @@ void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx) { } if ((dxz < 300.0f) && !this->spawnedWarp) { this->spawnedWarp = true; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->inPaintingPos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->inPaintingPos.x, this->actor.world.pos.y + 50.0f, this->inPaintingPos.z, 0, this->actor.shape.rot.y, 0, FHGFIRE_WARP_RETREAT); this->fhgFireKillWarp = true; @@ -575,16 +574,16 @@ void EnfHG_Attack(EnfHG* this, GlobalContext* globalCtx) { } } -void EnfHG_Damage(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Damage(EnfHG* this, PlayState* play) { f32 dx; f32 dz; f32 dxz2; osSyncPrintf("REVISE !!\n"); SkelAnime_Update(&this->skin.skelAnime); - Math_ApproachF(&this->warpColorFilterR, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->warpColorFilterG, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); - Math_ApproachF(&this->warpColorFilterB, globalCtx->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterR, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterG, play->lightCtx.fogColor[0], 1.0f, 10.0f); + Math_ApproachF(&this->warpColorFilterB, play->lightCtx.fogColor[0], 1.0f, 10.0f); Math_ApproachF(&this->warpColorFilterUnk1, 0.0f, 1.0f, 5.0f); Math_ApproachF(&this->actor.scale.z, 0.011499999f, 1.0f, 0.002f); if (this->timers[0] != 0) { @@ -606,7 +605,7 @@ void EnfHG_Damage(EnfHG* this, GlobalContext* globalCtx) { dxz2 = sqrtf(SQ(dx) + SQ(dz)); if ((dxz2 < 300.0f) && (!this->spawnedWarp)) { this->spawnedWarp = true; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FHG_FIRE, this->inPaintingPos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FHG_FIRE, this->inPaintingPos.x, this->actor.world.pos.y + 50.0f, this->inPaintingPos.z, 0, this->actor.shape.rot.y + 0x8000, 0, FHGFIRE_WARP_RETREAT); } @@ -625,7 +624,7 @@ void EnfHG_Damage(EnfHG* this, GlobalContext* globalCtx) { } } -void EnfHG_Retreat(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Retreat(EnfHG* this, PlayState* play) { osSyncPrintf("KABE IN !!\n"); if (this->turnTarget != 0) { Math_ApproachS(&this->turnRot, this->turnTarget, 5, 2000); @@ -659,23 +658,23 @@ void EnfHG_Retreat(EnfHG* this, GlobalContext* globalCtx) { this->actor.draw = NULL; } else { paintingIdxReal = Rand_ZeroOne() * 5.99f; - EnfHG_SetupApproach(this, globalCtx, paintingIdxReal); + EnfHG_SetupApproach(this, play, paintingIdxReal); do { paintingIdxFake = Rand_ZeroOne() * 5.99f; } while (paintingIdxFake == paintingIdxReal); osSyncPrintf("ac1 = %x `````````````````````````````````````````````````\n", - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANONDROF, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANONDROF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, paintingIdxFake + GND_FAKE_BOSS)); } } } -void EnfHG_Done(EnfHG* this, GlobalContext* globalCtx) { +void EnfHG_Done(EnfHG* this, PlayState* play) { this->bossGndInPainting = false; } -void EnfHG_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnfHG_Update(Actor* thisx, PlayState* play) { s32 pad; EnfHG* this = (EnfHG*)thisx; u8 i; @@ -692,7 +691,7 @@ void EnfHG_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->hitTimer != 0) { this->hitTimer--; @@ -706,23 +705,23 @@ void EnfHG_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.z = (s16)(Math_SinS(this->hitTimer * 0x7000) * 1500.0f) * (this->hitTimer / 20.0f); } -void EnfHG_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnfHG_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { } -void EnfHG_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnfHG_Draw(Actor* thisx, PlayState* play) { EnfHG* this = (EnfHG*)thisx; BossGanondrof* bossGnd = (BossGanondrof*)this->actor.parent; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fhg.c", 2439); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_fhg.c", 2439); + func_80093D18(play->state.gfxCtx); POLY_OPA_DISP = ((bossGnd->work[GND_INVINC_TIMER] & 4) && (bossGnd->flyMode == GND_FLY_PAINTING)) ? Gfx_SetFog(POLY_OPA_DISP, 255, 50, 0, 0, 900, 1099) : Gfx_SetFog(POLY_OPA_DISP, (u32)this->warpColorFilterR, (u32)this->warpColorFilterG, (u32)this->warpColorFilterB, 0, (s32)this->warpColorFilterUnk1 + 995, (s32)this->warpColorFilterUnk2 + 1000); - func_800A6330(&this->actor, globalCtx, &this->skin, EnfHG_PostDraw, SKIN_TRANSFORM_IS_FHG); - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fhg.c", 2480); + func_800A6330(&this->actor, play, &this->skin, EnfHG_PostDraw, SKIN_TRANSFORM_IS_FHG); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_fhg.c", 2480); } diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.h b/src/overlays/actors/ovl_En_fHG/z_en_fhg.h index 40585eccf7..2bde639715 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.h +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.h @@ -6,7 +6,7 @@ struct EnfHG; -typedef void (*EnfHGActionFunc)(struct EnfHG*, GlobalContext*); +typedef void (*EnfHGActionFunc)(struct EnfHG*, PlayState*); typedef enum { /* 0 */ FHG_NO_SIGNAL, diff --git a/src/overlays/actors/ovl_End_Title/z_end_title.c b/src/overlays/actors/ovl_End_Title/z_end_title.c index 3cae2af60b..01247830c1 100644 --- a/src/overlays/actors/ovl_End_Title/z_end_title.c +++ b/src/overlays/actors/ovl_End_Title/z_end_title.c @@ -8,11 +8,11 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void EndTitle_Init(Actor* thisx, GlobalContext* globalCtx); -void EndTitle_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EndTitle_Update(Actor* thisx, GlobalContext* globalCtx); -void EndTitle_DrawFull(Actor* thisx, GlobalContext* globalCtx); -void EndTitle_DrawNintendoLogo(Actor* thisx, GlobalContext* globalCtx); +void EndTitle_Init(Actor* thisx, PlayState* play); +void EndTitle_Destroy(Actor* thisx, PlayState* play); +void EndTitle_Update(Actor* thisx, PlayState* play); +void EndTitle_DrawFull(Actor* thisx, PlayState* play); +void EndTitle_DrawNintendoLogo(Actor* thisx, PlayState* play); const ActorInit End_Title_InitVars = { ACTOR_END_TITLE, @@ -28,7 +28,7 @@ const ActorInit End_Title_InitVars = { #include "overlays/ovl_End_Title/ovl_End_Title.c" -void EndTitle_Init(Actor* thisx, GlobalContext* globalCtx) { +void EndTitle_Init(Actor* thisx, PlayState* play) { EndTitle* this = (EndTitle*)thisx; this->endAlpha = 0; @@ -39,37 +39,37 @@ void EndTitle_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EndTitle_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EndTitle_Destroy(Actor* thisx, PlayState* play) { } -void EndTitle_Update(Actor* thisx, GlobalContext* globalCtx) { +void EndTitle_Update(Actor* thisx, PlayState* play) { } // Used in the castle courtyard -void EndTitle_DrawFull(Actor* thisx, GlobalContext* globalCtx) { +void EndTitle_DrawFull(Actor* thisx, PlayState* play) { MtxF* mf; EndTitle* this = (EndTitle*)thisx; - s32 frameCount = globalCtx->csCtx.frames; - Player* player = GET_PLAYER(globalCtx); + s32 frameCount = play->csCtx.frames; + Player* player = GET_PLAYER(play); mf = &player->mf_9E0; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 403); + OPEN_DISPS(play->state.gfxCtx, "../z_end_title.c", 403); // Draw the Triforce on Link's left hand - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Mult(mf, MTXMODE_NEW); Matrix_Translate(0.0f, 150.0f, 170.0f, MTXMODE_APPLY); Matrix_Scale(0.13f, 0.13f, 0.13f, MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD(0xBB8), MTXMODE_APPLY); Matrix_RotateY(0.0f, MTXMODE_APPLY); Matrix_RotateZ(0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_end_title.c", 412), G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_end_title.c", 412), G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sTriforceDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 417); + CLOSE_DISPS(play->state.gfxCtx, "../z_end_title.c", 417); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 419); + OPEN_DISPS(play->state.gfxCtx, "../z_end_title.c", 419); // Draw title cards on the screen if ((frameCount > 890) && (this->endAlpha < 200)) { @@ -107,24 +107,24 @@ void EndTitle_DrawFull(Actor* thisx, GlobalContext* globalCtx) { gSPTextureRectangle(OVERLAY_DISP++, 104 << 2, 177 << 2, 216 << 2, 192 << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 515); + CLOSE_DISPS(play->state.gfxCtx, "../z_end_title.c", 515); } // Used in the Temple of Time -void EndTitle_DrawNintendoLogo(Actor* thisx, GlobalContext* globalCtx) { +void EndTitle_DrawNintendoLogo(Actor* thisx, PlayState* play) { EndTitle* this = (EndTitle*)thisx; s32 pad; - s32 frames = globalCtx->csCtx.frames; + s32 frames = play->csCtx.frames; if ((frames >= 1101) && (this->endAlpha < 255)) { this->endAlpha += 3; } - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 594); + OPEN_DISPS(play->state.gfxCtx, "../z_end_title.c", 594); OVERLAY_DISP = func_80093F34(OVERLAY_DISP); gDPSetPrimColor(OVERLAY_DISP++, 0, 0x80, 0, 0, 0, this->endAlpha); gSPDisplayList(OVERLAY_DISP++, sPresentedByNintendoDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 600); + CLOSE_DISPS(play->state.gfxCtx, "../z_end_title.c", 600); } diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 15da091acb..d31434d720 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -12,14 +12,14 @@ #define FLAGS ACTOR_FLAG_4 -#define WATER_SURFACE_Y(globalCtx) globalCtx->colCtx.colHeader->waterBoxes->ySurface +#define WATER_SURFACE_Y(play) play->colCtx.colHeader->waterBoxes->ySurface -void Fishing_Init(Actor* thisx, GlobalContext* globalCtx); -void Fishing_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx); -void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx); -void Fishing_DrawFish(Actor* thisx, GlobalContext* globalCtx); -void Fishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx); +void Fishing_Init(Actor* thisx, PlayState* play); +void Fishing_Destroy(Actor* thisx, PlayState* play); +void Fishing_UpdateFish(Actor* thisx, PlayState* play); +void Fishing_UpdateOwner(Actor* thisx, PlayState* play); +void Fishing_DrawFish(Actor* thisx, PlayState* play); +void Fishing_DrawOwner(Actor* thisx, PlayState* play); typedef struct { /* 0x00 */ u8 unk_00; @@ -741,7 +741,7 @@ static FishingPropInit sPondPropInits[POND_PROP_COUNT + 1] = { { FS_PROP_INIT_STOP, { 0 } }, }; -void Fishing_InitPondProps(Fishing* this, GlobalContext* globalCtx) { +void Fishing_InitPondProps(Fishing* this, PlayState* play) { FishingProp* prop = &sPondProps[0]; Vec3f colliderPos; s16 i; @@ -811,8 +811,8 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void Fishing_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Fishing* this = (Fishing*)thisx; u16 fishCount; s16 i; @@ -829,12 +829,12 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { if (thisx->params < 100) { D_80B7E074 = 0; sFishingMain = this; - Collider_InitJntSph(globalCtx, &sFishingMain->collider); - Collider_SetJntSph(globalCtx, &sFishingMain->collider, thisx, &sJntSphInit, sFishingMain->colliderElements); + Collider_InitJntSph(play, &sFishingMain->collider); + Collider_SetJntSph(play, &sFishingMain->collider, thisx, &sJntSphInit, sFishingMain->colliderElements); thisx->params = 1; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishingOwnerSkel, &gFishingOwnerAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingOwnerSkel, &gFishingOwnerAnim, NULL, NULL, 0); Animation_MorphToLoop(&this->skelAnime, &gFishingOwnerAnim, 0.0f); thisx->update = Fishing_UpdateOwner; @@ -862,7 +862,7 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } D_80B7A684 = 20; - globalCtx->specialEffects = sEffects; + play->specialEffects = sEffects; gTimeSpeed = 1; D_80B7E0AC = 0; D_80B7E0A6 = 10; @@ -885,10 +885,10 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { D_80B7E07D = (HIGH_SCORE(HS_FISHING) & 0xFF0000) >> 0x10; if ((D_80B7E07D & 7) == 7) { - globalCtx->roomCtx.unk_74[0] = 90; + play->roomCtx.unk_74[0] = 90; D_80B7E076 = 1; } else { - globalCtx->roomCtx.unk_74[0] = 40; + play->roomCtx.unk_74[0] = 40; D_80B7E076 = 0; } @@ -946,10 +946,10 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } } - Fishing_InitPondProps(this, globalCtx); - Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_KANBAN, 53.0f, -17.0f, 982.0f, 0, 0, 0, + Fishing_InitPondProps(this, play); + Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_KANBAN, 53.0f, -17.0f, 982.0f, 0, 0, 0, ENKANBAN_FISHING); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_FISHING, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); + Actor_Spawn(&play->actorCtx, play, ACTOR_FISHING, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); if ((KREG(1) == 1) || ((D_80B7E07D & 3) == 3)) { if (sLinkAge != LINK_AGE_CHILD) { @@ -962,15 +962,15 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } for (i = 0; i < fishCount; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_FISHING, sFishInits[i].pos.x, sFishInits[i].pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_FISHING, sFishInits[i].pos.x, sFishInits[i].pos.y, sFishInits[i].pos.z, 0, Rand_ZeroFloat(0x10000), 0, 100 + i); } } else { if ((thisx->params < 115) || (thisx->params == 200)) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, NULL, NULL, 0); Animation_MorphToLoop(&this->skelAnime, &gFishingFishAnim, 0.0f); } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, NULL, NULL, 0); Animation_MorphToLoop(&this->skelAnime, &gFishingLoachAnim, 0.0f); } @@ -978,10 +978,10 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { if (thisx->params == 200) { this->unk_158 = 100; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); thisx->targetMode = 0; thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); } else { this->unk_158 = 10; this->unk_15A = 10; @@ -1007,20 +1007,20 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void Fishing_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void Fishing_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Fishing* this = (Fishing*)thisx; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); if (thisx->params == 200) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } else if (thisx->params == 1) { - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } } -void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { +void Fishing_UpdateEffects(FishingEffect* effect, PlayState* play) { f32 rippleY; s16 i; @@ -1053,7 +1053,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { Math_ApproachF(&effect->unk_30, effect->unk_34, 0.1f, 0.1f); effect->alpha -= 10; - if (effect->pos.y > (WATER_SURFACE_Y(globalCtx) - 5.0f)) { + if (effect->pos.y > (WATER_SURFACE_Y(play) - 5.0f)) { effect->accel.y = 0.0f; effect->vel.y = 0.0f; effect->alpha -= 5; @@ -1064,7 +1064,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { } } else if (effect->type == FS_EFF_BUBBLE) { if (effect->unk_2C == 0) { - rippleY = WATER_SURFACE_Y(globalCtx); + rippleY = WATER_SURFACE_Y(play); } else { rippleY = 69.0f; } @@ -1075,7 +1075,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { if (Rand_ZeroOne() < 0.3f) { Vec3f pos = effect->pos; pos.y = rippleY; - Fishing_SpawnRipple(NULL, globalCtx->specialEffects, &pos, 20.0f, 60.0f, 150, 90); + Fishing_SpawnRipple(NULL, play->specialEffects, &pos, 20.0f, 60.0f, 150, 90); } } } else if (effect->type == FS_EFF_DUST_SPLASH) { @@ -1084,25 +1084,25 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { effect->accel.y = 0.0f; } - if (effect->pos.y <= WATER_SURFACE_Y(globalCtx)) { + if (effect->pos.y <= WATER_SURFACE_Y(play)) { effect->type = FS_EFF_NONE; if (Rand_ZeroOne() < 0.5f) { Vec3f pos = effect->pos; - pos.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(NULL, globalCtx->specialEffects, &pos, 40.0f, 110.0f, 150, 90); + pos.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(NULL, play->specialEffects, &pos, 40.0f, 110.0f, 150, 90); } } } else if (effect->type == FS_EFF_RAIN_DROP) { - if (effect->pos.y < WATER_SURFACE_Y(globalCtx)) { + if (effect->pos.y < WATER_SURFACE_Y(play)) { f32 sqDistXZ = SQ(effect->pos.x) + SQ(effect->pos.z); if (sqDistXZ > SQ(920.0f)) { - effect->pos.y = WATER_SURFACE_Y(globalCtx) + ((sqrtf(sqDistXZ) - 920.0f) * 0.11f); + effect->pos.y = WATER_SURFACE_Y(play) + ((sqrtf(sqDistXZ) - 920.0f) * 0.11f); effect->timer = KREG(17) + 2; effect->type = FS_EFF_RAIN_SPLASH; effect->unk_30 = (KREG(18) + 30) * 0.001f; } else { - effect->pos.y = WATER_SURFACE_Y(globalCtx) + 3.0f; + effect->pos.y = WATER_SURFACE_Y(play) + 3.0f; effect->timer = 0; if (Rand_ZeroOne() < 0.75f) { effect->type = FS_EFF_RAIN_RIPPLE; @@ -1132,7 +1132,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { Math_ApproachS(&sEffOwnerHatRot.z, -0x4000, 20, 100); sqDistXZ = SQ(effect->pos.x) + SQ(effect->pos.z); - bottomY = WATER_SURFACE_Y(globalCtx) + ((sqrtf(sqDistXZ) - 920.0f) * 0.147f); + bottomY = WATER_SURFACE_Y(play) + ((sqrtf(sqDistXZ) - 920.0f) * 0.147f); if (effect->pos.y > (bottomY - 10.0f)) { effect->pos.y -= 0.1f; @@ -1140,8 +1140,8 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { if ((effect->timer % 16) == 0) { Vec3f pos = effect->pos; - pos.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(NULL, globalCtx->specialEffects, &pos, 30.0f, 300.0f, 150, 90); + pos.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(NULL, play->specialEffects, &pos, 30.0f, 300.0f, 150, 90); } if (effect->unk_2C >= 0) { @@ -1149,12 +1149,12 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { } if (effect->unk_2C == 30) { - Message_StartTextbox(globalCtx, 0x40B3, NULL); + Message_StartTextbox(play, 0x40B3, NULL); } - if ((effect->unk_2C >= 100) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT)) { - if (Message_ShouldAdvance(globalCtx) || (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { - Message_CloseTextbox(globalCtx); + if ((effect->unk_2C >= 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT)) { + if (Message_ShouldAdvance(play) || (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { + Message_CloseTextbox(play); Rupees_ChangeBy(-50); effect->unk_2C = -1; } @@ -1166,14 +1166,14 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { } } -void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { +void Fishing_DrawEffects(FishingEffect* effect, PlayState* play) { u8 materialFlag = 0; f32 rotY; s16 i; s32 pad; FishingEffect* firstEffect = effect; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 2271); + OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 2271); Matrix_Push(); @@ -1192,7 +1192,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->unk_30, 1.0f, effect->unk_30, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2305), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2305), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRippleModelDL); @@ -1213,10 +1213,10 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 180, 180, 180, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2346), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2346), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingDustSplashModelDL); @@ -1237,14 +1237,14 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 40, 90, 80, effect->alpha); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, effect->timer + (i * 3), - (effect->timer + (i * 3)) * 5, 32, 64, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, effect->timer + (i * 3), (effect->timer + (i * 3)) * 5, + 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2394), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2394), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingWaterDustModelDL); @@ -1264,10 +1264,10 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2423), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2423), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingBubbleModelDL); @@ -1292,7 +1292,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { Matrix_RotateZ(effect->unk_3C, MTXMODE_APPLY); Matrix_Scale(0.002f, 1.0f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2467), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2467), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRainDropModelDL); @@ -1300,7 +1300,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { effect++; } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); effect = firstEffect + 30; materialFlag = 0; @@ -1316,7 +1316,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->unk_30, 1.0f, effect->unk_30, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2504), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2504), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRippleModelDL); @@ -1341,11 +1341,11 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateY(rotY, MTXMODE_APPLY); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2541), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2541), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRainSplashModelDL); @@ -1362,7 +1362,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { Matrix_Scale(effect->unk_30, effect->unk_30, effect->unk_30, MTXMODE_APPLY); Matrix_Translate(-1250.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2560), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2560), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingOwnerHatDL); @@ -1370,28 +1370,28 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 2565); + CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 2565); } -void Fishing_DrawStreamSplash(GlobalContext* globalCtx) { +void Fishing_DrawStreamSplash(PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 2572); + OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 2572); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames * 1, - globalCtx->gameplayFrames * 8, 32, 64, 1, -(globalCtx->gameplayFrames * 2), 0, 16, 16)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->gameplayFrames * 1, play->gameplayFrames * 8, 32, 64, 1, + -(play->gameplayFrames * 2), 0, 16, 16)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, 50); Matrix_Translate(670.0f, -24.0f, -600.0f, MTXMODE_NEW); Matrix_Scale(0.02f, 1.0f, 0.02f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2598), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 2598), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFishingStreamSplashDL)); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 2613); + CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 2613); } s32 func_80B6C2EC(Vec3f* vec) { @@ -1405,7 +1405,7 @@ s32 func_80B6C2EC(Vec3f* vec) { return false; } -void Fishing_UpdateLine(GlobalContext* globalCtx, Vec3f* basePos, Vec3f* pos, Vec3f* rot, Vec3f* unk) { +void Fishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot, Vec3f* unk) { s16 i; s16 k; f32 dx; @@ -1470,14 +1470,14 @@ void Fishing_UpdateLine(GlobalContext* globalCtx, Vec3f* basePos, Vec3f* pos, Ve sqDistXZ = SQ((pos + i)->x) + SQ((pos + i)->z); if (sqDistXZ > SQ(920.0f)) { - phi_f12 = ((sqrtf(sqDistXZ) - 920.0f) * 0.11f) + WATER_SURFACE_Y(globalCtx); + phi_f12 = ((sqrtf(sqDistXZ) - 920.0f) * 0.11f) + WATER_SURFACE_Y(play); } else { - phi_f12 = WATER_SURFACE_Y(globalCtx); + phi_f12 = WATER_SURFACE_Y(play); } if (D_80B7E0B6 == 2) { if (spD8 < phi_f12) { - phi_f12 = ((sqrtf(sqDistXZ) - 920.0f) * 0.147f) + WATER_SURFACE_Y(globalCtx); + phi_f12 = ((sqrtf(sqDistXZ) - 920.0f) * 0.147f) + WATER_SURFACE_Y(play); if (spD8 > phi_f12) { phi_f2 = (spD8 - phi_f12) * 0.05f; if (phi_f2 > 0.29999998f) { @@ -1562,7 +1562,7 @@ void Fishing_UpdateLinePos(Vec3f* pos) { } } -void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u8 hookIndex) { +void Fishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookIndex) { f32 dx; f32 dy; f32 dz; @@ -1572,15 +1572,15 @@ void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u f32 offsetY; Vec3f posSrc = { 0.0f, 0.0f, 1.0f }; Vec3f posStep; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 2963); + OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 2963); Matrix_Push(); - if ((D_80B7A694 == 3) && ((pos->y > WATER_SURFACE_Y(globalCtx)) || ((D_80B7A68C != 0) && hookIndex))) { + if ((D_80B7A694 == 3) && ((pos->y > WATER_SURFACE_Y(play)) || ((D_80B7A68C != 0) && hookIndex))) { offsetY = 0.0f; - } else if (pos->y < WATER_SURFACE_Y(globalCtx)) { + } else if (pos->y < WATER_SURFACE_Y(play)) { offsetY = -1.0f; } else { offsetY = -3.0f; @@ -1615,13 +1615,13 @@ void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u Matrix_Scale(0.0039999997f, 0.0039999997f, 0.005f, MTXMODE_APPLY); Matrix_RotateY(M_PI, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3029), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3029), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL); Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3034), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3034), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL); @@ -1631,7 +1631,7 @@ void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u Matrix_Push(); if (D_80B7A690 != 0) { - FishingEffect* effect = globalCtx->specialEffects; + FishingEffect* effect = play->specialEffects; MtxF mf; Matrix_MultVec3f(&sZeroVec, &effect->pos); @@ -1651,17 +1651,17 @@ void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u Matrix_Translate(-1250.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3085), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3085), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingOwnerHatDL); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 3098); + CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 3098); } -void Fishing_UpdateSinkingLure(GlobalContext* globalCtx) { +void Fishing_UpdateSinkingLure(PlayState* play) { s16 i; f32 dx; f32 dy; @@ -1676,7 +1676,7 @@ void Fishing_UpdateSinkingLure(GlobalContext* globalCtx) { Vec3f sp88; f32 offsetX; f32 offsetZ; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); posSrc.z = 0.85f; @@ -1684,7 +1684,7 @@ void Fishing_UpdateSinkingLure(GlobalContext* globalCtx) { if (D_80B7A6D4 != 0) { offsetY = -1.0f; - } else if (sLurePos.y < WATER_SURFACE_Y(globalCtx)) { + } else if (sLurePos.y < WATER_SURFACE_Y(play)) { offsetY = 0.5f; } else { offsetY = -5.0f; @@ -1731,16 +1731,16 @@ static f32 sSinkingLureSizes[] = { 0.9f, 0.85f, 0.8f, 0.7f, 0.8f, 1.0f, 1.2f, 1.1f, 1.0f, 0.8f, }; -void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { +void Fishing_DrawSinkingLure(PlayState* play) { s16 i; f32 scale; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 3209); + OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 3209); - Fishing_UpdateSinkingLure(globalCtx); + Fishing_UpdateSinkingLure(play); - if (sLurePos.y < WATER_SURFACE_Y(globalCtx)) { - func_80093D18(globalCtx->state.gfxCtx); + if (sLurePos.y < WATER_SURFACE_Y(play)) { + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gFishingSinkingLureSegmentMaterialDL); @@ -1749,15 +1749,15 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3239), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3239), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingSinkingLureSegmentModelDL); } } } else { - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gFishingSinkingLureSegmentMaterialDL); @@ -1766,36 +1766,36 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3265), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3265), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingSinkingLureSegmentModelDL); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 3271); + CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 3271); } -void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* lineRot) { +void Fishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) { Vec3f posSrc; Vec3f posStep; Vec3f hookPos[2]; s16 i; s16 spB4 = D_80B7E144; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 3287); + OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 3287); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Push(); if (D_80B7A6D4 != 0) { Vec3f posTemp = sLurePos; sLurePos = sSinkingLureBasePos; - Fishing_DrawSinkingLure(globalCtx); + Fishing_DrawSinkingLure(play); sLurePos = posTemp; } @@ -1831,9 +1831,9 @@ void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* li Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); Matrix_RotateY(M_PI / 2, MTXMODE_APPLY); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3369), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3369), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureFloatDL); @@ -1845,12 +1845,12 @@ void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* li posSrc.x = 500.0f; posSrc.z = -300.0f; Matrix_MultVec3f(&posSrc, &hookPos[0]); - Fishing_DrawLureHook(globalCtx, &hookPos[0], &sLureHookRefPos[0], 0); + Fishing_DrawLureHook(play, &hookPos[0], &sLureHookRefPos[0], 0); posSrc.x = 2100.0f; posSrc.z = -50.0f; Matrix_MultVec3f(&posSrc, &hookPos[1]); - Fishing_DrawLureHook(globalCtx, &hookPos[1], &sLureHookRefPos[1], 1); + Fishing_DrawLureHook(play, &hookPos[1], &sLureHookRefPos[1], 1); } POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); @@ -1881,7 +1881,7 @@ void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* li Matrix_RotateX(rx, MTXMODE_APPLY); Matrix_Scale(D_80B7E14C, 1.0f, dist, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3444), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3444), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLineModelDL); } else { @@ -1909,7 +1909,7 @@ void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* li Matrix_RotateX(rx, MTXMODE_APPLY); Matrix_Scale(D_80B7E14C, 1.0f, dist, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3475), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3475), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLineModelDL); break; @@ -1920,16 +1920,16 @@ void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* li Matrix_RotateX((lineRot + i)->x, MTXMODE_APPLY); Matrix_Scale(D_80B7E14C, 1.0f, 0.005f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3492), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3492), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLineModelDL); } } Matrix_Pop(); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 3500); + CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 3500); } static f32 sRodScales[22] = { @@ -1945,16 +1945,16 @@ static f32 sRodBendRatios[22] = { static Vec3f sRodTipOffset = { 0.0f, 0.0f, 0.0f }; -void Fishing_DrawRod(GlobalContext* globalCtx) { +void Fishing_DrawRod(PlayState* play) { s16 i; f32 spC8; f32 spC4; f32 spC0; - Input* input = &globalCtx->state.input[0]; - Player* player = GET_PLAYER(globalCtx); + Input* input = &play->state.input[0]; + Player* player = GET_PLAYER(play); s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 3600); + OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 3600); if (D_80B7FDA8 != 0) { D_80B7FDA8--; @@ -2022,7 +2022,7 @@ void Fishing_DrawRod(GlobalContext* globalCtx) { } } - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gFishingRodMaterialDL); @@ -2058,7 +2058,7 @@ void Fishing_DrawRod(GlobalContext* globalCtx) { Matrix_Push(); Matrix_Scale(sRodScales[i], sRodScales[i], 0.52f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3809), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 3809), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (i < 5) { @@ -2082,12 +2082,12 @@ void Fishing_DrawRod(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 3838); + CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 3838); } static Vec3f D_80B7AF94 = { 0.0f, 0.0f, 0.0f }; -void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { +void Fishing_UpdateLure(Fishing* this, PlayState* play) { f32 spE4; f32 spE0; s16 phi_v0; @@ -2098,12 +2098,12 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { f32 phi_f16; f32 spC8; s16 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f spA8; Vec3f sp9C; Vec3f sp90; - Input* input = &globalCtx->state.input[0]; + Input* input = &play->state.input[0]; Vec3f sp80; f32 sp7C; f32 sp78; @@ -2174,7 +2174,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sLurePos, &D_80B7AF94, &sProjectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sLurePos, &D_80B7AF94, &sProjectedW); if (D_80B7A694 == 0) { Math_ApproachF(&D_80B7E108, -800.0f, 1.0f, 20.0f); @@ -2204,7 +2204,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { if (D_80B7E0B4 == 0) { if ((D_80B7E0B0 == 0) && (player->unk_860 == 1)) { D_80B7E0B4 = 37; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); } } else { sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI; @@ -2274,7 +2274,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { (sLurePos.z > 1350.0f) || (sLurePos.z < 1100.0f) || (sLurePos.y < 45.0f)) { sp80 = this->actor.world.pos; this->actor.prevPos = this->actor.world.pos = sLurePos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 30.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_6); this->actor.world.pos = sp80; @@ -2294,7 +2294,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } } - spE4 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(globalCtx); + spE4 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(play); if (sLurePos.y <= spE4) { sLurePos.y = spE4; D_80B7E0E8.x = D_80B7E0E8.y = D_80B7E0E8.z = 0.0f; @@ -2305,7 +2305,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { func_80078914(&D_80B7AF94, NA_SE_EN_FANTOM_FLOAT - SFX_FLAG); } } else { - spE4 = WATER_SURFACE_Y(globalCtx); + spE4 = WATER_SURFACE_Y(play); if (sLurePos.y <= spE4) { D_80B7A694 = 2; @@ -2318,7 +2318,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { D_80B7E0A2 = 10; } - if ((sLurePos.y <= spE4) && (spE4 < spE0) && (spE4 == WATER_SURFACE_Y(globalCtx))) { + if ((sLurePos.y <= spE4) && (spE4 < spE0) && (spE4 == WATER_SURFACE_Y(play))) { D_80B7E114 = 10; func_80078914(&D_80B7AF94, NA_SE_EV_BOMB_DROP_WATER); D_80B7E0F8.y = 0.0f; @@ -2334,15 +2334,15 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { spA8 = sLurePos; spA8.x += (sp9C.x * 3.0f); - spA8.y = WATER_SURFACE_Y(globalCtx); + spA8.y = WATER_SURFACE_Y(play); spA8.z += (sp9C.z * 3.0f); - Fishing_SpawnDustSplash(NULL, globalCtx->specialEffects, &spA8, &sp9C, + Fishing_SpawnDustSplash(NULL, play->specialEffects, &spA8, &sp9C, Rand_ZeroFloat(0.02f) + 0.025f); } spA8 = sLurePos; - spA8.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(NULL, globalCtx->specialEffects, &spA8, 100.0f, 800.0f, 150, 90); + spA8.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(NULL, play->specialEffects, &spA8, 100.0f, 800.0f, 150, 90); } } else { Math_ApproachZeroF(&D_80B7E148, 1.0f, 0.05f); @@ -2359,13 +2359,13 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { break; case 2: - if (sLurePos.y <= WATER_SURFACE_Y(globalCtx)) { + if (sLurePos.y <= WATER_SURFACE_Y(play)) { sLurePos.y += D_80B7E0E8.y; Math_ApproachZeroF(&D_80B7E0E8.y, 1.0f, 1.0f); if (D_80B7E0B6 != 2) { - Math_ApproachF(&sLurePos.y, WATER_SURFACE_Y(globalCtx), 0.5f, 1.0f); + Math_ApproachF(&sLurePos.y, WATER_SURFACE_Y(play), 0.5f, 1.0f); } } @@ -2397,7 +2397,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } spDC = 0x4000; - spE4 = WATER_SURFACE_Y(globalCtx); + spE4 = WATER_SURFACE_Y(play); spC8 = SQ(sLurePos.x) + SQ(sLurePos.z); if (spC8 < SQ(920.0f)) { @@ -2471,7 +2471,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } } } else { - spE4 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(globalCtx); + spE4 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(play); if (sLurePos.y <= spE4) { sLurePos.y = spE4; spDC = 0x500; @@ -2521,11 +2521,11 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } else { D_80B7E104 = -0.5f; } - } else if (sReelLinePos[LINE_SEG_COUNT - 1].y < (WATER_SURFACE_Y(globalCtx) + phi_f0)) { + } else if (sReelLinePos[LINE_SEG_COUNT - 1].y < (WATER_SURFACE_Y(play) + phi_f0)) { if (D_80B7E0B6 == 2) { sp58 = this->actor.world.pos; this->actor.prevPos = this->actor.world.pos = sLurePos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 30.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_6); this->actor.world.pos = sp58; @@ -2541,7 +2541,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { D_80B7E120 = 1; } } else { - D_80B7E128.y = fabsf(sReelLinePos[LINE_SEG_COUNT - 1].y - WATER_SURFACE_Y(globalCtx)) * 0.2f; + D_80B7E128.y = fabsf(sReelLinePos[LINE_SEG_COUNT - 1].y - WATER_SURFACE_Y(play)) * 0.2f; if (D_80B7E128.y > 1.5f) { D_80B7E128.y = 1.5f; } @@ -2569,7 +2569,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { Math_ApproachF(&D_80B7E154, 1000.0f, 1.0f, 0.2f); } - if (sReelLinePos[LINE_SEG_COUNT - 1].y > (WATER_SURFACE_Y(globalCtx) + 4.0f)) { + if (sReelLinePos[LINE_SEG_COUNT - 1].y > (WATER_SURFACE_Y(play) + 4.0f)) { Math_ApproachF(&D_80B7E148, 3.0f, 1.0f, 0.2f); } else { Math_ApproachF(&D_80B7E148, 1.0f, 1.0f, 0.2f); @@ -2595,8 +2595,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { D_80B7A6CC = 3; } - if ((sLurePos.y <= (WATER_SURFACE_Y(globalCtx) + 4.0f)) && - (sLurePos.y >= (WATER_SURFACE_Y(globalCtx) - 4.0f))) { + if ((sLurePos.y <= (WATER_SURFACE_Y(play) + 4.0f)) && (sLurePos.y >= (WATER_SURFACE_Y(play) - 4.0f))) { phi_v0 = 63; if (CHECK_BTN_ALL(input->cur.button, BTN_A) || (D_80B7E138 > 1.0f)) { @@ -2605,8 +2604,8 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { if ((D_80B7E0AE & phi_v0) == 0) { spA8 = sLurePos; - spA8.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(NULL, globalCtx->specialEffects, &spA8, 30.0f, 300.0f, 150, 90); + spA8.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(NULL, play->specialEffects, &spA8, 30.0f, 300.0f, 150, 90); } } break; @@ -2645,7 +2644,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { } } -s32 func_80B70A2C(Fishing* this, GlobalContext* globalCtx, u8 ignorePosCheck) { +s32 func_80B70A2C(Fishing* this, PlayState* play, u8 ignorePosCheck) { s16 i; s16 count; f32 scale; @@ -2654,7 +2653,7 @@ s32 func_80B70A2C(Fishing* this, GlobalContext* globalCtx, u8 ignorePosCheck) { f32 speedXZ; f32 angle; - if ((this->actor.world.pos.y < (WATER_SURFACE_Y(globalCtx) - 10.0f)) && !ignorePosCheck) { + if ((this->actor.world.pos.y < (WATER_SURFACE_Y(play) - 10.0f)) && !ignorePosCheck) { return false; } @@ -2679,24 +2678,24 @@ s32 func_80B70A2C(Fishing* this, GlobalContext* globalCtx, u8 ignorePosCheck) { pos = this->actor.world.pos; pos.x += vel.x * 3.0f; - pos.y = WATER_SURFACE_Y(globalCtx); + pos.y = WATER_SURFACE_Y(play); pos.z += vel.z * 3.0f; - Fishing_SpawnDustSplash(&this->actor.projectedPos, globalCtx->specialEffects, &pos, &vel, + Fishing_SpawnDustSplash(&this->actor.projectedPos, play->specialEffects, &pos, &vel, (Rand_ZeroFloat(0.02f) + 0.025f) * scale); } pos = this->actor.world.pos; - pos.y = WATER_SURFACE_Y(globalCtx); + pos.y = WATER_SURFACE_Y(play); - Fishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &pos, 100.0f, 800.0f, 150, 90); + Fishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &pos, 100.0f, 800.0f, 150, 90); this->unk_151 = 30; return true; } -void func_80B70CF0(Fishing* this, GlobalContext* globalCtx) { +void func_80B70CF0(Fishing* this, PlayState* play) { s16 count; s16 i; f32 scale; @@ -2729,7 +2728,7 @@ void func_80B70CF0(Fishing* this, GlobalContext* globalCtx) { pos.y += (vel.y * 3.0f); pos.z += (vel.z * 3.0f); - Fishing_SpawnDustSplash(&this->actor.projectedPos, globalCtx->specialEffects, &pos, &vel, + Fishing_SpawnDustSplash(&this->actor.projectedPos, play->specialEffects, &pos, &vel, (Rand_ZeroFloat(0.02f) + 0.025f) * scale); } } @@ -2824,7 +2823,7 @@ void func_80B71278(Fishing* this, u8 arg1) { Audio_PlayActorSound2(&this->actor, sfxId); } -void Fishing_HandleAquariumDialog(Fishing* this, GlobalContext* globalCtx) { +void Fishing_HandleAquariumDialog(Fishing* this, PlayState* play) { if (sLinkAge == LINK_AGE_CHILD) { if ((HIGH_SCORE(HS_FISHING) & 0x7F) != 0) { if (HIGH_SCORE(HS_FISHING) & 0x80) { @@ -2851,23 +2850,23 @@ void Fishing_HandleAquariumDialog(Fishing* this, GlobalContext* globalCtx) { if (this->unk_1D4 == 0) { this->actor.flags |= ACTOR_FLAG_0; - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { D_80B7A678 = D_80B7E078; this->unk_1D3 = 1; } else { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->actor, play); } } else { this->unk_1D4--; this->actor.flags &= ~ACTOR_FLAG_0; } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { this->unk_1D3 = 0; this->unk_1D4 = 20; } } -void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { +void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { s16 i; s16 sp134 = 10; f32 sp130; @@ -2889,9 +2888,9 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { s16 spF0; s16 spEE; Fishing* this = (Fishing*)thisx; - GlobalContext* globalCtx = globalCtx2; - Player* player = GET_PLAYER(globalCtx); - Input* input = &globalCtx->state.input[0]; + PlayState* play = play2; + Player* player = GET_PLAYER(play); + Input* input = &play->state.input[0]; f32 spD8; f32 phi_f0; f32 phi_f2; @@ -2962,7 +2961,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } else { phi_f0 = 1.0f; phi_f2 = 1.0f; - if (this->actor.world.pos.y > WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y > WATER_SURFACE_Y(play)) { phi_f0 = (KREG(64) * 0.1f) + 1.5f; phi_f2 = 3.0f; } @@ -3023,7 +3022,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { switch (this->unk_158) { case 100: - Fishing_HandleAquariumDialog(this, globalCtx); + Fishing_HandleAquariumDialog(this, play); this->actor.uncullZoneForward = 500.0f; this->actor.uncullZoneScale = 300.0f; @@ -3033,8 +3032,8 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { 255, 255, 255); this->unk_1AC = D_80B7E078; - sp100.y = (f32)Math_SinS(globalCtx->gameplayFrames * 300) * 1; - sp100.z = (f32)Math_SinS(globalCtx->gameplayFrames * 230) * 2; + sp100.y = (f32)Math_SinS(play->gameplayFrames * 300) * 1; + sp100.z = (f32)Math_SinS(play->gameplayFrames * 230) * 2; this->actor.world.pos.x = 130.0f; this->actor.world.pos.y = 55.0f + sp100.y; this->actor.world.pos.z = 1300.0f + sp100.z; @@ -3044,7 +3043,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { spC4.x = Rand_CenteredFloat(5.0f) + 130.0f; spC4.y = 40.0f; spC4.z = Rand_CenteredFloat(5.0f) + 1280.0f; - Fishing_SpawnBubble(NULL, globalCtx->specialEffects, &spC4, Rand_ZeroFloat(0.02f) + 0.03f, 1); + Fishing_SpawnBubble(NULL, play->specialEffects, &spC4, Rand_ZeroFloat(0.02f) + 0.03f, 1); } Math_ApproachS(&this->unk_172, (Math_SinS(this->unk_15C * 0x800) * 2500.0f) + 2500.0f, 2, 0x7D0); @@ -3096,7 +3095,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_17A[1] = 50; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if ((gSaveContext.dayTime >= CLOCK_TIME(18, 0)) && (gSaveContext.dayTime <= CLOCK_TIME(18, 0) + 27)) { this->unk_158 = 7; this->unk_17A[3] = (s16)Rand_ZeroFloat(150.0f) + 200; @@ -3126,7 +3125,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_158 = 1; this->unk_17A[0] = (s16)Rand_ZeroFloat(30.0f) + 10; this->unk_1B4.x = Rand_CenteredFloat(300.0f); - this->unk_1B4.y = (WATER_SURFACE_Y(globalCtx) - 50.0f) - Rand_ZeroFloat(50.0f); + this->unk_1B4.y = (WATER_SURFACE_Y(play) - 50.0f) - Rand_ZeroFloat(50.0f); this->unk_1B4.z = Rand_CenteredFloat(300.0f); this->unk_190 = 1.0f; this->unk_194 = 2000.0f; @@ -3188,7 +3187,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_194 = 4000.0f; Math_ApproachF(&this->unk_1B0, 4096.0f, 1.0f, 256.0f); - if ((globalCtx->gameplayFrames % 32) == 0) { + if ((play->gameplayFrames % 32) == 0) { this->unk_1B4.x = Rand_CenteredFloat(600.0f); this->unk_1B4.z = Rand_CenteredFloat(600.0f); this->unk_1B4.y = -120.0f; @@ -3212,7 +3211,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { KREG(2) = 0; this->unk_158 = -2; this->actor.world.rot.x = this->actor.shape.rot.x = 0; - this->unk_1B4.y = WATER_SURFACE_Y(globalCtx) + 10.0f; + this->unk_1B4.y = WATER_SURFACE_Y(play) + 10.0f; this->unk_1B4.x = Rand_ZeroFloat(50.0f); this->unk_1B4.z = Rand_ZeroFloat(50.0f); } @@ -3230,13 +3229,12 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachS(&this->unk_166, -0x1000, 0x14, 0x100); - if (this->actor.world.pos.y < (WATER_SURFACE_Y(globalCtx) - 20.0f)) { + if (this->actor.world.pos.y < (WATER_SURFACE_Y(play) - 20.0f)) { Math_ApproachF(&this->actor.speedXZ, 0.5f, 1.0f, 0.1f); } else { Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 0.01f); - if ((this->actor.speedXZ == 0.0f) || - (this->actor.world.pos.y > (WATER_SURFACE_Y(globalCtx) - 5.0f))) { + if ((this->actor.speedXZ == 0.0f) || (this->actor.world.pos.y > (WATER_SURFACE_Y(play) - 5.0f))) { this->unk_1B4.x = Rand_ZeroFloat(300.0f); this->unk_1B4.z = Rand_ZeroFloat(300.0f); this->unk_1B4.y = this->actor.floorHeight + 10.0f; @@ -3244,11 +3242,11 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1B0 = 0.0f; spB8 = this->fishMouthPos; - spB8.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &spB8, 10.0f, 300.0f, - 150, 90); - Fishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &spB8, 30.0f, 400.0f, - 150, 90); + spB8.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &spB8, 10.0f, 300.0f, 150, + 90); + Fishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &spB8, 30.0f, 400.0f, 150, + 90); Audio_PlayActorSound2(&this->actor, NA_SE_PL_CATCH_BOOMERANG); break; @@ -3427,7 +3425,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1B0 = 4096.0f; Math_ApproachF(&this->actor.speedXZ, this->unk_188 * 0.8f, 1.0f, 1.0f); - if ((D_80B7A694 != 3) || (sLurePos.y > (WATER_SURFACE_Y(globalCtx) + 5.0f)) || + if ((D_80B7A694 != 3) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { this->unk_158 = this->unk_15A; this->unk_17A[0] = 0; @@ -3452,7 +3450,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1B4 = sLurePos; Math_ApproachF(&this->actor.speedXZ, this->unk_188, 1.0f, 1.0f); - if ((D_80B7A694 != 3) || (this->unk_17A[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(globalCtx) + 5.0f)) || + if ((D_80B7A694 != 3) || (this->unk_17A[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { this->unk_17A[0] = 0; @@ -3460,7 +3458,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_190 = 1.0f; this->unk_194 = 2000.0f; } else if (sp124 < 10.0f) { - if (func_80B70A2C(this, globalCtx, false)) { + if (func_80B70A2C(this, play, false)) { func_80B71278(this, 0); } @@ -3515,7 +3513,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1B4 = sLurePos; Math_ApproachF(&this->actor.speedXZ, 2.0f, 1.0f, 1.0f); - if ((D_80B7A694 != 3) || (this->unk_17A[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(globalCtx) + 5.0f)) || + if ((D_80B7A694 != 3) || (this->unk_17A[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { this->unk_17A[0] = 0; @@ -3523,12 +3521,12 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_158 = this->unk_15A; this->unk_194 = 2000.0f; } else if (sp124 < 10.0f) { - if (sLurePos.y > (WATER_SURFACE_Y(globalCtx) - 10.0f)) { + if (sLurePos.y > (WATER_SURFACE_Y(play) - 10.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_JUMP_OUT_WATER); func_80078884(NA_SE_PL_CATCH_BOOMERANG); } - func_80B70A2C(this, globalCtx, false); + func_80B70A2C(this, play, false); this->unk_158 = 5; this->unk_190 = 1.2f; this->unk_194 = 5000.0f; @@ -3607,7 +3605,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } } - if (this->actor.world.pos.y < WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y < WATER_SURFACE_Y(play)) { if (this->unk_17A[1] > 30) { phi_v0_2 = 7; } else { @@ -3817,7 +3815,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { player->unk_860 = 3; func_800A9F6C(0.0f, 1, 3, 1); D_80B7E084++; - func_80064520(globalCtx, &globalCtx->csCtx); + func_80064520(play, &play->csCtx); D_80B7A6CC = 100; D_80B7FEC8 = 45.0f; D_80B7A694 = 5; @@ -3825,9 +3823,9 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_194 = 500.0f; this->unk_19C = 5000.0f; - if (this->actor.world.pos.y <= WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y <= WATER_SURFACE_Y(play)) { func_80B71278(this, 1); - func_80B70A2C(this, globalCtx, true); + func_80B70A2C(this, play, true); } goto case_6; } @@ -3902,11 +3900,11 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { if (this->unk_17A[0] <= 50) { switch (this->unk_1D5) { case 0: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { - if (Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - if (globalCtx->msgCtx.choiceIndex == 0) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { + if (Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + if (play->msgCtx.choiceIndex == 0) { if (D_80B7A670 == 0.0f) { D_80B7A670 = this->unk_1AC; D_80B7E07C = this->unk_150; @@ -3916,7 +3914,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { ((s16)this->unk_1AC < (s16)D_80B7A670)) { this->unk_1D5 = 1; this->unk_17A[0] = 0x3C; - Message_StartTextbox(globalCtx, 0x4098, NULL); + Message_StartTextbox(play, 0x4098, NULL); } else { f32 temp1 = D_80B7A670; s16 temp2 = D_80B7E07C; @@ -3934,11 +3932,11 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { - if (Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - if (globalCtx->msgCtx.choiceIndex != 0) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { + if (Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + if (play->msgCtx.choiceIndex != 0) { f32 temp1 = D_80B7A670; s16 temp2 = D_80B7E07C; D_80B7A670 = this->unk_1AC; @@ -3962,14 +3960,13 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_17A[0] = 0; this->unk_190 = 1.0f; this->unk_194 = 2000.0f; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); if (this->unk_150 == 0) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, 0, 0, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, 0, 0, 0); Animation_MorphToLoop(&this->skelAnime, &gFishingFishAnim, 0.0f); } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, 0, 0, - 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, 0, 0, 0); Animation_MorphToLoop(&this->skelAnime, &gFishingLoachAnim, 0.0f); } } @@ -4003,7 +4000,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { if (sp124 < 20.0f) { Math_ApproachS(&this->unk_170, 0x4E20, 2, 0xFA0); - if ((this->unk_17A[2] == 0) && func_80B70A2C(this, globalCtx, false)) { + if ((this->unk_17A[2] == 0) && func_80B70A2C(this, play, false)) { func_80B71278(this, Rand_ZeroFloat(1.99f)); this->unk_17A[2] = (s16)Rand_ZeroFloat(20.0f) + 20; } @@ -4027,7 +4024,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachS(&this->unk_172, (Math_SinS(this->unk_15C * 0x1000) * 5000.0f) + 5000.0f, 2, 0x7D0); if (this->unk_158 != 6) { - if (this->actor.world.pos.y > WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y > WATER_SURFACE_Y(play)) { this->unk_190 = 1.5f; this->unk_194 = 5000.0f; @@ -4104,31 +4101,30 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->actor.shape.rot.y = this->actor.world.rot.y; if ((this->unk_158 != -1) && (this->unk_158 != -2) && (this->unk_158 != -25)) { - if ((this->actor.world.pos.y > WATER_SURFACE_Y(globalCtx)) && - (this->actor.prevPos.y <= WATER_SURFACE_Y(globalCtx))) { - func_80B70A2C(this, globalCtx, true); + if ((this->actor.world.pos.y > WATER_SURFACE_Y(play)) && (this->actor.prevPos.y <= WATER_SURFACE_Y(play))) { + func_80B70A2C(this, play, true); func_80B71278(this, 1); this->unk_184 = this->actor.velocity.y; this->actor.velocity.y = 0.0f; this->unk_16A = Rand_CenteredFloat(32768.0f); - } else if ((this->actor.world.pos.y < WATER_SURFACE_Y(globalCtx)) && - (this->actor.prevPos.y >= WATER_SURFACE_Y(globalCtx))) { + } else if ((this->actor.world.pos.y < WATER_SURFACE_Y(play)) && + (this->actor.prevPos.y >= WATER_SURFACE_Y(play))) { if (this->unk_184 < -5.0f) { this->unk_184 = -5.0f; } this->actor.world.rot.x = -0xFA0; - func_80B70A2C(this, globalCtx, true); + func_80B70A2C(this, play, true); this->unk_1D2 = 20; func_80B71278(this, 0); } } - if ((this->actor.world.pos.y < WATER_SURFACE_Y(globalCtx)) && - (this->actor.world.pos.y > (WATER_SURFACE_Y(globalCtx) - 10.0f)) && ((this->unk_15C & 1) == 0) && + if ((this->actor.world.pos.y < WATER_SURFACE_Y(play)) && + (this->actor.world.pos.y > (WATER_SURFACE_Y(play) - 10.0f)) && ((this->unk_15C & 1) == 0) && (this->actor.speedXZ > 0.0f)) { Vec3f pos = this->actor.world.pos; - pos.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &pos, 80.0f, 500.0f, 150, 90); + pos.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &pos, 80.0f, 500.0f, 150, 90); } if ((this->actor.speedXZ > 0.0f) || (this->unk_158 == 5)) { @@ -4139,7 +4135,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->actor.world.pos.y -= spD8; this->actor.prevPos.y -= spD8; this->actor.velocity.y = -1.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 30.0f, 100.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 100.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_6); this->actor.world.pos.y += spD8; this->actor.prevPos.y += spD8; @@ -4151,13 +4147,13 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - if (this->actor.world.pos.y > WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y > WATER_SURFACE_Y(play)) { this->unk_184 = Rand_ZeroFloat(3.0f) + 3.0f; this->actor.velocity.x = this->actor.world.pos.x * -0.003f; this->actor.velocity.z = this->actor.world.pos.z * -0.003f; Audio_PlayActorSound2(&this->actor, NA_SE_EV_FISH_LEAP); - func_80B70CF0(this, globalCtx); + func_80B70CF0(this, play); if (Rand_ZeroOne() < 0.5f) { this->unk_16A = 0x4000; @@ -4184,7 +4180,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { pos.x = Rand_CenteredFloat(10.0f) + this->actor.world.pos.x; pos.z = Rand_CenteredFloat(10.0f) + this->actor.world.pos.z; pos.y = this->actor.floorHeight + 5.0f; - Fishing_SpawnWaterDust(&this->actor.projectedPos, globalCtx->specialEffects, &pos, + Fishing_SpawnWaterDust(&this->actor.projectedPos, play->specialEffects, &pos, (this->unk_1AC * 0.005f) + 0.15f); } } @@ -4203,14 +4199,13 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { pos.x = Rand_CenteredFloat(range) + this->actor.world.pos.x; pos.y = Rand_CenteredFloat(range) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(range) + this->actor.world.pos.z; - Fishing_SpawnBubble(&this->actor.projectedPos, globalCtx->specialEffects, &pos, - Rand_ZeroFloat(0.035f) + 0.04f, 0); + Fishing_SpawnBubble(&this->actor.projectedPos, play->specialEffects, &pos, Rand_ZeroFloat(0.035f) + 0.04f, + 0); } } } -s32 Fishing_FishOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 Fishing_FishOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Fishing* this = (Fishing*)thisx; if (limbIndex == 0xD) { @@ -4232,7 +4227,7 @@ s32 Fishing_FishOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void Fishing_FishPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void Fishing_FishPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Fishing* this = (Fishing*)thisx; if (limbIndex == 0xD) { @@ -4240,8 +4235,7 @@ void Fishing_FishPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } } -s32 Fishing_LoachOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 Fishing_LoachOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Fishing* this = (Fishing*)thisx; if (limbIndex == 3) { @@ -4255,7 +4249,7 @@ s32 Fishing_LoachOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void Fishing_LoachPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void Fishing_LoachPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f sLoachMouthOffset = { 500.0f, 500.0f, 0.0f }; Fishing* this = (Fishing*)thisx; @@ -4264,10 +4258,10 @@ void Fishing_LoachPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL } } -void Fishing_DrawFish(Actor* thisx, GlobalContext* globalCtx) { +void Fishing_DrawFish(Actor* thisx, PlayState* play) { Fishing* this = (Fishing*)thisx; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD_ALT(this->unk_162 + this->actor.shape.rot.y), MTXMODE_APPLY); @@ -4279,17 +4273,16 @@ void Fishing_DrawFish(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(BINANG_TO_RAD(this->unk_16C) - (M_PI / 2), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, this->unk_16C * 10.0f * 0.01f, MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, Fishing_FishOverrideLimbDraw, Fishing_FishPostLimbDraw, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + Fishing_FishOverrideLimbDraw, Fishing_FishPostLimbDraw, this); } else { Matrix_Translate(0.0f, 0.0f, 3000.0f, MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(this->unk_16C), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -3000.0f, MTXMODE_APPLY); Matrix_RotateY(-(M_PI / 2), MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, Fishing_LoachOverrideLimbDraw, Fishing_LoachPostLimbDraw, - this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + Fishing_LoachOverrideLimbDraw, Fishing_LoachPostLimbDraw, this); } } @@ -4325,9 +4318,9 @@ void Fishing_HandleLilyPadContact(FishingProp* prop, Vec3f* entityPos, u8 fishTi } } -void Fishing_UpdatePondProps(GlobalContext* globalCtx) { +void Fishing_UpdatePondProps(PlayState* play) { FishingProp* prop = &sPondProps[0]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* actor; s16 i; @@ -4336,7 +4329,7 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) { prop->shouldDraw = false; prop->timer++; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &prop->pos, &prop->projectedPos, &sProjectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &prop->pos, &prop->projectedPos, &sProjectedW); if ((prop->projectedPos.z < prop->drawDistance) && (fabsf(prop->projectedPos.x) < (100.0f + prop->projectedPos.z))) { @@ -4347,7 +4340,7 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) { if (prop->type == FS_PROP_REED) { Fishing_HandleReedContact(prop, &player->actor.world.pos); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + actor = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (actor != NULL) { if (!((actor->id == ACTOR_FISHING) && (actor->params >= 100))) { actor = actor->next; @@ -4361,7 +4354,7 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) { } else if (prop->type == FS_PROP_LILY_PAD) { Fishing_HandleLilyPadContact(prop, &player->actor.world.pos, 0); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head; + actor = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (actor != NULL) { if (!((actor->id == ACTOR_FISHING) && (actor->params >= 100))) { actor = actor->next; @@ -4373,7 +4366,7 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) { Math_ApproachS(&prop->lilyPadAngle, 0, 20, 80); prop->pos.y = - (Math_SinS(prop->timer * 0x1000) * prop->lilyPadOffset) + (WATER_SURFACE_Y(globalCtx) + 2.0f); + (Math_SinS(prop->timer * 0x1000) * prop->lilyPadOffset) + (WATER_SURFACE_Y(play) + 2.0f); Math_ApproachZeroF(&prop->lilyPadOffset, 0.1f, 0.02f); } } @@ -4383,17 +4376,17 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) { } if (sSubCamId == SUB_CAM_ID_DONE) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &sFishingMain->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &sFishingMain->collider.base); } } -void Fishing_DrawPondProps(GlobalContext* globalCtx) { +void Fishing_DrawPondProps(PlayState* play) { u8 materialFlag = 0; FishingProp* prop = &sPondProps[0]; s16 i; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 7704); + OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 7704); Matrix_Push(); @@ -4411,7 +4404,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_RotateX(prop->rotX, MTXMODE_APPLY); Matrix_RotateY(prop->reedAngle, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 7726), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 7726), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingReedModelDL); } @@ -4433,7 +4426,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW); Matrix_Scale(prop->scale, prop->scale, prop->scale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 7748), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 7748), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingWoodPostModelDL); } @@ -4458,7 +4451,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, 20.0f, MTXMODE_APPLY); Matrix_RotateY(prop->rotY, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 7774), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 7774), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLilyPadModelDL); } @@ -4481,7 +4474,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_Scale(prop->scale, prop->scale, prop->scale, MTXMODE_APPLY); Matrix_RotateY(prop->rotY, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 7798), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 7798), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingRockModelDL); } @@ -4492,12 +4485,12 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 7805); + CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 7805); } -void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { +void Fishing_UpdateGroupFishes(PlayState* play) { s16 groupContactFlags = 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); FishingGroupFish* fish = &sGroupFishes[0]; f32 dy; f32 dx; @@ -4535,7 +4528,7 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { groupContactFlags |= 1; } else if (D_80B7A898 != 0.0f) { sFishGroupAngle1 += 0.05f; - basePos[0].y = WATER_SURFACE_Y(globalCtx) - 5.0f; + basePos[0].y = WATER_SURFACE_Y(play) - 5.0f; } else { Math_ApproachF(&sFishGroupAngle1, 0.7f, 1.0f, 0.001f); } @@ -4552,7 +4545,7 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { groupContactFlags |= 2; } else if (D_80B7A898 != 0.0f) { sFishGroupAngle2 -= 0.05f; - basePos[1].y = WATER_SURFACE_Y(globalCtx) - 5.0f; + basePos[1].y = WATER_SURFACE_Y(play) - 5.0f; } else { Math_ApproachF(&sFishGroupAngle2, 2.3f, 1.0f, 0.001f); } @@ -4569,7 +4562,7 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { groupContactFlags |= 4; } else if (D_80B7A898 != 0.0f) { sFishGroupAngle3 -= 0.05f; - basePos[2].y = WATER_SURFACE_Y(globalCtx) - 5.0f; + basePos[2].y = WATER_SURFACE_Y(play) - 5.0f; } else { Math_ApproachF(&sFishGroupAngle3, 4.6f, 1.0f, 0.001f); } @@ -4584,7 +4577,7 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { if (fish->type != FS_GROUP_FISH_NONE) { fish->timer++; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &fish->pos, &fish->projectedPos, &sProjectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &fish->pos, &fish->projectedPos, &sProjectedW); if ((fish->projectedPos.z < 400.0f) && (fabsf(fish->projectedPos.x) < (100.0f + fish->projectedPos.z))) { fish->shouldDraw = true; @@ -4622,8 +4615,8 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { } ripplePos = fish->pos; - ripplePos.y = WATER_SURFACE_Y(globalCtx); - Fishing_SpawnRipple(&fish->projectedPos, globalCtx->specialEffects, &ripplePos, 20.0f, + ripplePos.y = WATER_SURFACE_Y(play); + Fishing_SpawnRipple(&fish->projectedPos, play->specialEffects, &ripplePos, 20.0f, Rand_ZeroFloat(50.0f) + 100.0f, 150, 90); if (fish->unk_28 < 1.5f) { @@ -4681,7 +4674,7 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { D_80B7A898 = 0.0f; } -void Fishing_DrawGroupFishes(GlobalContext* globalCtx) { +void Fishing_DrawGroupFishes(PlayState* play) { u8 materialFlag = 0; FishingGroupFish* fish = &sGroupFishes[0]; f32 scale; @@ -4696,7 +4689,7 @@ void Fishing_DrawGroupFishes(GlobalContext* globalCtx) { if (1) {} - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 8048); + OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 8048); for (i = 0; i < GROUP_FISH_COUNT; i++) { if (fish->type != FS_GROUP_FISH_NONE) { @@ -4712,7 +4705,7 @@ void Fishing_DrawGroupFishes(GlobalContext* globalCtx) { Matrix_RotateX(BINANG_TO_RAD_ALT2(-(f32)fish->unk_3C), MTXMODE_APPLY); Matrix_Scale(fish->unk_2C * scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 8093), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 8093), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishModelDL); } @@ -4720,12 +4713,12 @@ void Fishing_DrawGroupFishes(GlobalContext* globalCtx) { fish++; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 8099); + CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 8099); } static u16 D_80B7AFB8[] = { 0x4096, 0x408D, 0x408E, 0x408F, 0x4094, 0x4095 }; -void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { +void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) { switch (this->unk_15C) { case 0: if (D_80B7E0AC == 0) { @@ -4744,7 +4737,7 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { this->actor.textId = 0x4097; } - if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { + if (Actor_ProcessTalkRequest(&this->actor, play)) { if (D_80B7E0AC == 0) { this->unk_15C = 1; if (sLinkAge != LINK_AGE_CHILD) { @@ -4756,15 +4749,15 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { this->unk_15C = 10; } } else { - func_8002F2CC(&this->actor, globalCtx, 100.0f); + func_8002F2CC(&this->actor, play, 100.0f); } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.rupees >= 20) { Rupees_ChangeBy(-20); @@ -4773,15 +4766,15 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x407D; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_15C = 2; } else { - Message_ContinueTextbox(globalCtx, 0x407E); + Message_ContinueTextbox(play, 0x407E); this->unk_15C = 3; } break; case 1: - Message_ContinueTextbox(globalCtx, 0x2D); + Message_ContinueTextbox(play, 0x2D); this->unk_15C = 3; break; } @@ -4789,46 +4782,46 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { break; case 2: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); - Message_ContinueTextbox(globalCtx, 0x407F); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + Message_ContinueTextbox(play, 0x407F); this->unk_15C = 4; } break; case 3: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->unk_15C = 0; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) { this->unk_15C = 0; } break; case 4: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: D_80B7A678 = D_80B7E078; - Message_ContinueTextbox(globalCtx, 0x4080); + Message_ContinueTextbox(play, 0x4080); this->unk_15C = 5; break; case 1: - Message_ContinueTextbox(globalCtx, 0x407F); + Message_ContinueTextbox(play, 0x407F); break; } } break; case 5: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - globalCtx->interfaceCtx.unk_260 = 1; - globalCtx->startPlayerFishing(globalCtx); + play->interfaceCtx.unk_260 = 1; + play->startPlayerFishing(play); D_80B7E0AC = 1; D_80B7A684 = 20; this->unk_15C = 0; @@ -4841,12 +4834,12 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { case 10: if (D_80B7A68C != 0) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: - Message_ContinueTextbox(globalCtx, 0x40B2); + Message_ContinueTextbox(play, 0x40B2); D_80B7A688 = 1; D_80B7A68C = 0; this->unk_15C = 20; @@ -4857,10 +4850,10 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { } } } else { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (D_80B7A670 == 0.0f) { this->actor.textId = 0x408C; @@ -4882,12 +4875,12 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { this->actor.textId = 0x409B; this->unk_15C = 11; } - Message_ContinueTextbox(globalCtx, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); break; case 1: if (D_80B7A680 > 36000) { D_80B7A680 = 30000; - Message_ContinueTextbox(globalCtx, 0x4088); + Message_ContinueTextbox(play, 0x4088); } else { if (D_80B7E076 == 0) { if (D_80B7E082 == 0) { @@ -4896,9 +4889,9 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { } if ((D_80B7E0B6 == 2) && (D_80B7AFB8[D_80B7E082] == 0x408D)) { - Message_ContinueTextbox(globalCtx, 0x40AF); + Message_ContinueTextbox(play, 0x40AF); } else { - Message_ContinueTextbox(globalCtx, D_80B7AFB8[D_80B7E082]); + Message_ContinueTextbox(play, D_80B7AFB8[D_80B7E082]); } D_80B7E082++; @@ -4917,9 +4910,9 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { break; case 2: if (D_80B7E084 == 0) { - Message_ContinueTextbox(globalCtx, 0x4085); + Message_ContinueTextbox(play, 0x4085); } else if (sLinkAge == LINK_AGE_CHILD) { - Message_ContinueTextbox(globalCtx, 0x4092); + Message_ContinueTextbox(play, 0x4092); } this->unk_15C = 22; break; @@ -4929,12 +4922,12 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { break; case 11: - if (((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) && - Message_ShouldAdvance(globalCtx)) { + if (((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) && + Message_ShouldAdvance(play)) { s32 getItemId; - Message_CloseTextbox(globalCtx); + Message_CloseTextbox(play); if (D_80B7E07C == 0) { D_80B7E078 = D_80B7A670; @@ -5001,31 +4994,31 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { } this->actor.parent = NULL; - func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, getItemId, 2000.0f, 1000.0f); this->unk_15C = 23; } break; case 20: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); this->unk_15C = 0; } break; case 21: - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { - Message_CloseTextbox(globalCtx); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: this->unk_15C = 0; break; case 1: if (D_80B7E084 == 0) { - Message_ContinueTextbox(globalCtx, 0x4085); + Message_ContinueTextbox(play, 0x4085); } else if (sLinkAge == LINK_AGE_CHILD) { - Message_ContinueTextbox(globalCtx, 0x4092); + Message_ContinueTextbox(play, 0x4092); } this->unk_15C = 22; break; @@ -5034,35 +5027,35 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) { break; case 22: - if (globalCtx) {} + if (play) {} - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { this->unk_15C = 0; if (D_80B7A68C != 0) { D_80B7A688 = 1; D_80B7A68C = 0; } D_80B7E0AC = 0; - globalCtx->interfaceCtx.unk_260 = 0; + play->interfaceCtx.unk_260 = 0; } break; case 23: D_80B7A674 = false; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->unk_15C = 24; } else { - func_8002F434(&this->actor, globalCtx, GI_SCALE_GOLD, 2000.0f, 1000.0f); + func_8002F434(&this->actor, play, GI_SCALE_GOLD, 2000.0f, 1000.0f); } break; case 24: D_80B7A674 = false; - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (D_80B7E07C == 0) { this->unk_15C = 0; } else { - Message_StartTextbox(globalCtx, 0x409C, NULL); + Message_StartTextbox(play, 0x409C, NULL); this->unk_15C = 20; } } @@ -5081,8 +5074,8 @@ static Vec3s sSinkingLureLocationPos[] = { { 553, -48, -508 }, }; -void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Fishing* this = (Fishing*)thisx; Vec3f sp114; Vec3f sp108; @@ -5093,8 +5086,8 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { f32 subCamAtMaxVelFrac; f32 lureDistXZ; s32 pad; - Player* player = GET_PLAYER(globalCtx); - Input* input = &globalCtx->state.input[0]; + Player* player = GET_PLAYER(play); + Input* input = &play->state.input[0]; if (0) { // Strings existing only in rodata @@ -5117,13 +5110,13 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { SkelAnime_Update(&this->skelAnime); - if ((D_80B7A684 != 0) || (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE)) { + if ((D_80B7A684 != 0) || (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) { this->actor.flags &= ~ACTOR_FLAG_0; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_5; } - if ((this->actor.xzDistToPlayer < 120.0f) || (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE)) { + if ((this->actor.xzDistToPlayer < 120.0f) || (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE)) { headRotTarget = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; } else { headRotTarget = 0; @@ -5137,7 +5130,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachS(&this->unk_164, headRotTarget, 3, 0x1388); - if (((globalCtx->gameplayFrames % 32) == 0) && (Rand_ZeroOne() < 0.3f)) { + if (((play->gameplayFrames % 32) == 0) && (Rand_ZeroOne() < 0.3f)) { this->unk_162 = 4; } @@ -5160,7 +5153,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { KREG(77) = 0; D_80B7A688 = 0; D_80B7A68C = 1; - Message_StartTextbox(globalCtx, 0x4087, NULL); + Message_StartTextbox(play, 0x4087, NULL); } } @@ -5178,22 +5171,22 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { if (D_80B7A67C != 0) { D_80B7A67C--; if (D_80B7A67C == 0) { - Message_StartTextbox(globalCtx, D_80B7E086, NULL); + Message_StartTextbox(play, D_80B7E086, NULL); } } - Fishing_HandleOwnerDialog(this, globalCtx); + Fishing_HandleOwnerDialog(this, play); D_80B7E14C = 0.0015f; D_80B7A680++; if ((D_80B7E0AC != 0) && D_80B7A674) { - Fishing_UpdateLure(this, globalCtx); + Fishing_UpdateLure(this, play); } - Fishing_UpdateEffects(globalCtx->specialEffects, globalCtx); - Fishing_UpdatePondProps(globalCtx); - Fishing_UpdateGroupFishes(globalCtx); + Fishing_UpdateEffects(play->specialEffects, play); + Fishing_UpdatePondProps(play); + Fishing_UpdateGroupFishes(play); if ((D_80B7E0AC != 0) && (D_80B7A6CC == 0) && (player->actor.world.pos.z > 1360.0f) && (fabsf(player->actor.world.pos.x) < 25.0f)) { @@ -5236,10 +5229,10 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { case 1: { Camera* mainCam; - sSubCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + sSubCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); sSubCamEye.x = mainCam->eye.x; sSubCamEye.y = mainCam->eye.y; sSubCamEye.z = mainCam->eye.z; @@ -5347,17 +5340,17 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { break; case 3: { - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = sSubCamEye; mainCam->eyeNext = sSubCamEye; mainCam->at = sSubCamAt; - func_800C08AC(globalCtx, sSubCamId, 0); - func_80064534(globalCtx, &globalCtx->csCtx); + func_800C08AC(play, sSubCamId, 0); + func_80064534(play, &play->csCtx); D_80B7A6CC = 0; sSubCamId = SUB_CAM_ID_DONE; - Environment_EnableUnderwaterLights(globalCtx, 0); - globalCtx->envCtx.adjFogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjFogNear = 0; player->unk_860 = -5; D_80B7E0B0 = 5; break; @@ -5366,19 +5359,19 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { case 10: { Camera* mainCam; - func_80064520(globalCtx, &globalCtx->csCtx); - sSubCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, &this->actor, 5); - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + func_80064520(play, &play->csCtx); + sSubCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 5); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); sSubCamEye.x = mainCam->eye.x; sSubCamEye.y = mainCam->eye.y; sSubCamEye.z = mainCam->eye.z; sSubCamAt.x = mainCam->at.x; sSubCamAt.y = mainCam->at.y; sSubCamAt.z = mainCam->at.z; - Message_StartTextbox(globalCtx, 0x409E, NULL); + Message_StartTextbox(play, 0x409E, NULL); D_80B7A6CC = 11; func_800A9F6C(0.0f, 150, 10, 10); // fallthrough @@ -5388,39 +5381,39 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { player->actor.world.pos.z = 1360.0f; player->actor.speedXZ = 0.0f; - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = sSubCamEye; mainCam->eyeNext = sSubCamEye; mainCam->at = sSubCamAt; - func_800C08AC(globalCtx, sSubCamId, 0); - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_800C08AC(play, sSubCamId, 0); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); D_80B7A6CC = 0; sSubCamId = SUB_CAM_ID_DONE; D_80B7A6D0 = 30; - Environment_EnableUnderwaterLights(globalCtx, 0); - globalCtx->envCtx.adjFogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjFogNear = 0; } break; case 20: { Camera* mainCam; - func_80064520(globalCtx, &globalCtx->csCtx); - sSubCamId = Play_CreateSubCamera(globalCtx); - Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); - func_8002DF54(globalCtx, &this->actor, 5); - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + func_80064520(play, &play->csCtx); + sSubCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); + func_8002DF54(play, &this->actor, 5); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); sSubCamEye.x = mainCam->eye.x; sSubCamEye.y = mainCam->eye.y; sSubCamEye.z = mainCam->eye.z; sSubCamAt.x = mainCam->at.x; sSubCamAt.y = mainCam->at.y; sSubCamAt.z = mainCam->at.z; - Message_StartTextbox(globalCtx, 0x409A, NULL); + Message_StartTextbox(play, 0x409A, NULL); D_80B7A6CC = 21; D_80B7FEC8 = 45.0f; D_80B7A6D0 = 10; @@ -5428,10 +5421,10 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } case 21: - if ((D_80B7A6D0 == 0) && Message_ShouldAdvance(globalCtx)) { + if ((D_80B7A6D0 == 0) && Message_ShouldAdvance(play)) { D_80B7A6CC = 22; D_80B7A6D0 = 40; - func_8002DF54(globalCtx, &this->actor, 0x1C); + func_8002DF54(play, &this->actor, 0x1C); D_80B7FEE4 = 0.0f; } break; @@ -5446,7 +5439,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachF(&D_80B7FEE4, 71.0f, 0.5f, 3.0f); Matrix_RotateY(BINANG_TO_RAD_ALT(player->actor.shape.rot.y), MTXMODE_NEW); - sp114.x = Math_SinS(globalCtx->gameplayFrames * 0x1000); + sp114.x = Math_SinS(play->gameplayFrames * 0x1000); sp114.y = D_80B7FEE4; sp114.z = -5.0f; if (sLinkAge == LINK_AGE_CHILD) { @@ -5484,13 +5477,13 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } if (D_80B7A6D0 == 0) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) || - (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { - if (Message_ShouldAdvance(globalCtx)) { - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { + if (Message_ShouldAdvance(play)) { + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); - Message_CloseTextbox(globalCtx); - if (globalCtx->msgCtx.choiceIndex == 0) { + Message_CloseTextbox(play); + if (play->msgCtx.choiceIndex == 0) { D_80B7E0B6 = 2; D_80B7E082 = 0; } @@ -5498,17 +5491,17 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { mainCam->eye = sSubCamEye; mainCam->eyeNext = sSubCamEye; mainCam->at = sSubCamAt; - func_800C08AC(globalCtx, sSubCamId, 0); - func_80064534(globalCtx, &globalCtx->csCtx); - func_8002DF54(globalCtx, &this->actor, 7); + func_800C08AC(play, sSubCamId, 0); + func_80064534(play, &play->csCtx); + func_8002DF54(play, &this->actor, 7); D_80B7A6CC = 0; sSubCamId = SUB_CAM_ID_DONE; player->unk_860 = -5; D_80B7E0B0 = 5; D_80B7A6D4 = 0; D_80B7E0A6 = 20; - Environment_EnableUnderwaterLights(globalCtx, 0); - globalCtx->envCtx.adjFogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjFogNear = 0; } } } @@ -5519,36 +5512,36 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } if (sSubCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); + Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); Math_ApproachF(&sSubCamVelFactor, 1.0f, 1.0f, 0.02f); - if (sSubCamEye.y <= (WATER_SURFACE_Y(globalCtx) + 1.0f)) { - Environment_EnableUnderwaterLights(globalCtx, 1); + if (sSubCamEye.y <= (WATER_SURFACE_Y(play) + 1.0f)) { + Environment_EnableUnderwaterLights(play, 1); if (D_80B7E076 != 0) { - globalCtx->envCtx.adjFogNear = -0xB2; + play->envCtx.adjFogNear = -0xB2; } else { - globalCtx->envCtx.adjFogNear = -0x2E; + play->envCtx.adjFogNear = -0x2E; } } else { - Environment_EnableUnderwaterLights(globalCtx, 0); - globalCtx->envCtx.adjFogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjFogNear = 0; } } - if ((player->actor.floorHeight < (WATER_SURFACE_Y(globalCtx) - 3.0f)) && + if ((player->actor.floorHeight < (WATER_SURFACE_Y(play) - 3.0f)) && (player->actor.world.pos.y < (player->actor.floorHeight + 3.0f)) && (player->actor.speedXZ > 1.0f) && - ((globalCtx->gameplayFrames % 2) == 0)) { + ((play->gameplayFrames % 2) == 0)) { Vec3f pos; pos.x = Rand_CenteredFloat(20.0f) + player->actor.world.pos.x; pos.z = Rand_CenteredFloat(20.0f) + player->actor.world.pos.z; pos.y = player->actor.floorHeight + 5.0f; - Fishing_SpawnWaterDust(NULL, globalCtx->specialEffects, &pos, 0.5f); + Fishing_SpawnWaterDust(NULL, play->specialEffects, &pos, 0.5f); } - if ((player->actor.floorHeight < WATER_SURFACE_Y(globalCtx)) && - (player->actor.floorHeight > (WATER_SURFACE_Y(globalCtx) - 10.0f)) && (player->actor.speedXZ >= 4.0f) && - ((globalCtx->gameplayFrames % 4) == 0)) { + if ((player->actor.floorHeight < WATER_SURFACE_Y(play)) && + (player->actor.floorHeight > (WATER_SURFACE_Y(play) - 10.0f)) && (player->actor.speedXZ >= 4.0f) && + ((play->gameplayFrames % 4) == 0)) { s16 i; for (i = 0; i < 10; i++) { @@ -5566,18 +5559,18 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { pos = player->actor.world.pos; pos.x += 2.0f * vel.x; - pos.y = WATER_SURFACE_Y(globalCtx); + pos.y = WATER_SURFACE_Y(play); pos.z += 2.0f * vel.z; - Fishing_SpawnDustSplash(NULL, globalCtx->specialEffects, &pos, &vel, Rand_ZeroFloat(0.01f) + 0.020000001f); + Fishing_SpawnDustSplash(NULL, play->specialEffects, &pos, &vel, Rand_ZeroFloat(0.01f) + 0.020000001f); } } if (sREG(15) != 0) { if (D_80B7A654 != (sREG(15) - 1)) { if (D_80B7A654 == 0) { - globalCtx->envCtx.stormRequest = STORM_REQUEST_START; + play->envCtx.stormRequest = STORM_REQUEST_START; } else { - globalCtx->envCtx.stormRequest = STORM_REQUEST_STOP; + play->envCtx.stormRequest = STORM_REQUEST_STOP; } } @@ -5585,10 +5578,10 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } if (sREG(14) == 1) { - globalCtx->envCtx.stormRequest = STORM_REQUEST_START; + play->envCtx.stormRequest = STORM_REQUEST_START; } if (sREG(14) == -1) { - globalCtx->envCtx.stormRequest = STORM_REQUEST_STOP; + play->envCtx.stormRequest = STORM_REQUEST_STOP; } sREG(14) = 0; @@ -5601,16 +5594,15 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { D_80B7E077--; } - if ((D_80B7E077 == 1) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) && - ((D_80B7A680 & 0xFFF) == 0xFFF)) { + if ((D_80B7E077 == 1) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && ((D_80B7A680 & 0xFFF) == 0xFFF)) { D_80B7E077 = 200; if (Rand_ZeroOne() < 0.5f) { D_80B7A654 = (u8)Rand_ZeroFloat(10.0f) + 5; - globalCtx->envCtx.stormRequest = STORM_REQUEST_START; + play->envCtx.stormRequest = STORM_REQUEST_START; } else { D_80B7A654 = 0; - globalCtx->envCtx.stormRequest = STORM_REQUEST_STOP; + play->envCtx.stormRequest = STORM_REQUEST_STOP; } } @@ -5642,12 +5634,11 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachZeroF(&D_80B7A658, 1.0f, 2.0f); } - globalCtx->envCtx.adjLight1Color[0] = globalCtx->envCtx.adjLight1Color[1] = globalCtx->envCtx.adjLight1Color[2] = - D_80B7A658; + play->envCtx.adjLight1Color[0] = play->envCtx.adjLight1Color[1] = play->envCtx.adjLight1Color[2] = D_80B7A658; if ((u8)D_80B7A650 > 0) { s32 pad; - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); s16 i; s32 pad1; Vec3f pos; @@ -5660,24 +5651,23 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { rot.z = (Camera_GetInputDirYaw(mainCam) * -(M_PI / 0x8000)) + rot.y; for (i = 0; i < (u8)D_80B7A650; i++) { - pos.x = Rand_CenteredFloat(700.0f) + globalCtx->view.eye.x; + pos.x = Rand_CenteredFloat(700.0f) + play->view.eye.x; pos.y = (Rand_ZeroFloat(100.0f) + 150.0f) - 170.0f; - pos.z = Rand_CenteredFloat(700.0f) + globalCtx->view.eye.z; + pos.z = Rand_CenteredFloat(700.0f) + play->view.eye.z; if (pos.z < 1160.0f) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &pos, &projectedPos, &sProjectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &projectedPos, &sProjectedW); if (projectedPos.z < 0.0f) { i--; } else { - Fishing_SpawnRainDrop(globalCtx->specialEffects, &pos, &rot); + Fishing_SpawnRainDrop(play->specialEffects, &pos, &rot); } } } } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sStreamSoundPos, &sStreamSoundProjectedPos, - &sProjectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sStreamSoundPos, &sStreamSoundProjectedPos, &sProjectedW); func_80078914(&sStreamSoundProjectedPos, NA_SE_EV_WATER_WALL - SFX_FLAG); @@ -5685,14 +5675,13 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { if (BREG(26) != 0) { BREG(26) = 0; - Message_StartTextbox(globalCtx, 0x407B + BREG(27), NULL); + Message_StartTextbox(play, 0x407B + BREG(27), NULL); } osSyncPrintf("HI_SCORE = %x\n", HIGH_SCORE(HS_FISHING)); } -s32 Fishing_OwnerOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx) { +s32 Fishing_OwnerOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Fishing* this = (Fishing*)thisx; if (limbIndex == 8) { // Head @@ -5702,9 +5691,9 @@ s32 Fishing_OwnerOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return 0; } -void Fishing_OwnerPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void Fishing_OwnerPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { if (limbIndex == 8) { // Head - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 9134); + OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 9134); Matrix_MultVec3f(&sZeroVec, &sOwnerHeadPos); if (D_80B7A688 == 1) { @@ -5713,7 +5702,7 @@ void Fishing_OwnerPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL gSPDisplayList(POLY_OPA_DISP++, SEGMENTED_TO_VIRTUAL(gFishingOwnerHairDL)); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 9142); + CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 9142); } } @@ -5723,29 +5712,28 @@ static void* sFishingOwnerEyeTexs[] = { gFishingOwnerEyeClosedTex, }; -void Fishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx) { +void Fishing_DrawOwner(Actor* thisx, PlayState* play) { s32 pad; Fishing* this = (Fishing*)thisx; - Input* input = &globalCtx->state.input[0]; + Input* input = &play->state.input[0]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 9156); + OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 9156); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if ((this->actor.projectedPos.z < 1500.0f) && (fabsf(this->actor.projectedPos.x) < (100.0f + this->actor.projectedPos.z))) { gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sFishingOwnerEyeTexs[this->unk_160])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, Fishing_OwnerOverrideLimbDraw, Fishing_OwnerPostLimbDraw, - this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + Fishing_OwnerOverrideLimbDraw, Fishing_OwnerPostLimbDraw, this); } - Fishing_DrawPondProps(globalCtx); - Fishing_DrawEffects(globalCtx->specialEffects, globalCtx); - Fishing_DrawGroupFishes(globalCtx); - Fishing_DrawStreamSplash(globalCtx); + Fishing_DrawPondProps(play); + Fishing_DrawEffects(play->specialEffects, play); + Fishing_DrawGroupFishes(play); + Fishing_DrawStreamSplash(play); if (D_80B7E0A6 != 0) { D_80B7E0A6--; @@ -5766,10 +5754,10 @@ void Fishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx) { } if ((D_80B7E0AC != 0) && D_80B7A674) { - Fishing_DrawRod(globalCtx); + Fishing_DrawRod(play); Fishing_UpdateLinePos(sReelLinePos); - Fishing_UpdateLine(globalCtx, &sRodTipPos, sReelLinePos, sReelLineRot, sReelLineUnk); - Fishing_DrawLureAndLine(globalCtx, sReelLinePos, sReelLineRot); + Fishing_UpdateLine(play, &sRodTipPos, sReelLinePos, sReelLineRot, sReelLineUnk); + Fishing_DrawLureAndLine(play, sReelLinePos, sReelLineRot); D_80B7A6C4 = input->rel.stick_x; D_80B7A6C8 = input->rel.stick_y; @@ -5780,17 +5768,17 @@ void Fishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(130.0f, 40.0f, 1300.0f, MTXMODE_NEW); Matrix_Scale(0.08f, 0.12f, 0.14f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 9297), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 9297), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 9298), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fishing.c", 9298), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingAquariumBottomDL); gSPDisplayList(POLY_XLU_DISP++, gFishingAquariumContainerDL); if ((D_80B7E0AC != 0) && (D_80B7E0B6 == 2)) { - Fishing_DrawSinkingLure(globalCtx); + Fishing_DrawSinkingLure(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 9305); + CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 9305); } diff --git a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c index 5b97e40730..f9d36293d1 100644 --- a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c +++ b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c @@ -9,12 +9,12 @@ #define FLAGS 0 -void ItemBHeart_Init(Actor* thisx, GlobalContext* globalCtx); -void ItemBHeart_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ItemBHeart_Update(Actor* thisx, GlobalContext* globalCtx); -void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx); +void ItemBHeart_Init(Actor* thisx, PlayState* play); +void ItemBHeart_Destroy(Actor* thisx, PlayState* play); +void ItemBHeart_Update(Actor* thisx, PlayState* play); +void ItemBHeart_Draw(Actor* thisx, PlayState* play); -void func_80B85264(ItemBHeart* this, GlobalContext* globalCtx); +void func_80B85264(ItemBHeart* this, PlayState* play); const ActorInit Item_B_Heart_InitVars = { ACTOR_ITEM_B_HEART, @@ -35,10 +35,10 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; -void ItemBHeart_Init(Actor* thisx, GlobalContext* globalCtx) { +void ItemBHeart_Init(Actor* thisx, PlayState* play) { ItemBHeart* this = (ItemBHeart*)thisx; - if (Flags_GetCollectible(globalCtx, 0x1F)) { + if (Flags_GetCollectible(play, 0x1F)) { Actor_Kill(&this->actor); } else { Actor_ProcessInitChain(&this->actor, sInitChain); @@ -46,23 +46,23 @@ void ItemBHeart_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ItemBHeart_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemBHeart_Destroy(Actor* thisx, PlayState* play) { } -void ItemBHeart_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemBHeart_Update(Actor* thisx, PlayState* play) { ItemBHeart* this = (ItemBHeart*)thisx; - func_80B85264(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - if (Actor_HasParent(&this->actor, globalCtx)) { - Flags_SetCollectible(globalCtx, 0x1F); + func_80B85264(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + if (Actor_HasParent(&this->actor, play)) { + Flags_SetCollectible(play, 0x1F); Actor_Kill(&this->actor); } else { - func_8002F434(&this->actor, globalCtx, GI_HEART_CONTAINER_2, 30.0f, 40.0f); + func_8002F434(&this->actor, play, GI_HEART_CONTAINER_2, 30.0f, 40.0f); } } -void func_80B85264(ItemBHeart* this, GlobalContext* globalCtx) { +void func_80B85264(ItemBHeart* this, PlayState* play) { f32 yOffset; this->unk_164++; @@ -75,14 +75,14 @@ void func_80B85264(ItemBHeart* this, GlobalContext* globalCtx) { this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; } -void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemBHeart_Draw(Actor* thisx, PlayState* play) { ItemBHeart* this = (ItemBHeart*)thisx; Actor* actorIt; u8 flag = false; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 506); + OPEN_DISPS(play->state.gfxCtx, "../z_item_b_heart.c", 506); - actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + actorIt = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (actorIt != NULL) { if ((actorIt->id == ACTOR_DOOR_WARP1) && (actorIt->projectedPos.z > this->actor.projectedPos.z)) { @@ -93,18 +93,18 @@ void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (flag) { - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 551), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_item_b_heart.c", 551), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGiHeartBorderDL); gSPDisplayList(POLY_XLU_DISP++, gGiHeartContainerDL); } else { - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 557), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_item_b_heart.c", 557), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGiHeartBorderDL); gSPDisplayList(POLY_OPA_DISP++, gGiHeartContainerDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 561); + CLOSE_DISPS(play->state.gfxCtx, "../z_item_b_heart.c", 561); } 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 0be39f481a..ba29d03285 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -8,19 +8,19 @@ #define FLAGS ACTOR_FLAG_4 -void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx); -void ItemEtcetera_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ItemEtcetera_Update(Actor* thisx, GlobalContext* globalCtx); -void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx); -void ItemEtcetera_Draw(Actor* thisx, GlobalContext* globalCtx); +void ItemEtcetera_Init(Actor* thisx, PlayState* play); +void ItemEtcetera_Destroy(Actor* thisx, PlayState* play); +void ItemEtcetera_Update(Actor* thisx, PlayState* play); +void ItemEtcetera_DrawThroughLens(Actor* thisx, PlayState* play); +void ItemEtcetera_Draw(Actor* thisx, PlayState* play); -void func_80B857D0(ItemEtcetera* this, GlobalContext* globalCtx); -void func_80B85824(ItemEtcetera* this, GlobalContext* globalCtx); -void func_80B858B4(ItemEtcetera* this, GlobalContext* globalCtx); -void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, GlobalContext* globalCtx); -void ItemEtcetera_MoveFireArrowDown(ItemEtcetera* this, GlobalContext* globalCtx); -void func_80B85B28(ItemEtcetera* this, GlobalContext* globalCtx); -void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, GlobalContext* globalCtx); +void func_80B857D0(ItemEtcetera* this, PlayState* play); +void func_80B85824(ItemEtcetera* this, PlayState* play); +void func_80B858B4(ItemEtcetera* this, PlayState* play); +void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, PlayState* play); +void ItemEtcetera_MoveFireArrowDown(ItemEtcetera* this, PlayState* play); +void func_80B85B28(ItemEtcetera* this, PlayState* play); +void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, PlayState* play); const ActorInit Item_Etcetera_InitVars = { ACTOR_ITEM_ETCETERA, @@ -56,7 +56,7 @@ void ItemEtcetera_SetupAction(ItemEtcetera* this, ItemEtceteraActionFunc actionF this->actionFunc = actionFunc; } -void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_Init(Actor* thisx, PlayState* play) { ItemEtcetera* this = (ItemEtcetera*)thisx; s32 pad; s32 type; @@ -64,7 +64,7 @@ void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { type = this->actor.params & 0xFF; osSyncPrintf("no = %d\n", type); - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[type]); + objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[type]); osSyncPrintf("bank_ID = %d\n", objBankIndex); if (objBankIndex < 0) { ASSERT(0, "0", "../z_item_etcetera.c", 241); @@ -105,46 +105,46 @@ void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ItemEtcetera_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_Destroy(Actor* thisx, PlayState* play) { } -void func_80B857D0(ItemEtcetera* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { +void func_80B857D0(ItemEtcetera* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.objBankIndex = this->objBankIndex; this->actor.draw = this->drawFunc; this->actionFunc = this->futureActionFunc; } } -void func_80B85824(ItemEtcetera* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B85824(ItemEtcetera* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { if ((this->actor.params & 0xFF) == 1) { SET_EVENTCHKINF(EVENTCHKINF_31); - Flags_SetSwitch(globalCtx, 0xB); + Flags_SetSwitch(play, 0xB); } Actor_Kill(&this->actor); } else { - func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f); + func_8002F434(&this->actor, play, this->getItemId, 30.0f, 50.0f); } } -void func_80B858B4(ItemEtcetera* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B858B4(ItemEtcetera* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { if ((this->actor.params & 0xFF) == 1) { SET_EVENTCHKINF(EVENTCHKINF_31); - Flags_SetSwitch(globalCtx, 0xB); + Flags_SetSwitch(play, 0xB); } Actor_Kill(&this->actor); } else { if (0) {} // Necessary to match - func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f); - if ((globalCtx->gameplayFrames & 0xD) == 0) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f); + func_8002F434(&this->actor, play, this->getItemId, 30.0f, 50.0f); + if ((play->gameplayFrames & 0xD) == 0) { + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f); } } } -void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, GlobalContext* globalCtx) { +void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, PlayState* play) { static Vec3f velocity = { 0.0f, 0.2f, 0.0f }; static Vec3f accel = { 0.0f, 0.05f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; @@ -158,30 +158,30 @@ void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(12.0f) + this->actor.world.pos.x; pos.y = (Rand_ZeroOne() * 6.0f) + this->actor.world.pos.y; pos.z = Rand_CenteredFloat(12.0f) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 5000, 16); + EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, 5000, 16); } -void ItemEtcetera_MoveFireArrowDown(ItemEtcetera* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); +void ItemEtcetera_MoveFireArrowDown(ItemEtcetera* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); Actor_MoveForward(&this->actor); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - ItemEtcetera_SpawnSparkles(this, globalCtx); + ItemEtcetera_SpawnSparkles(this, play); } this->actor.shape.rot.y += 0x400; - func_80B85824(this, globalCtx); + func_80B85824(this, play); } -void func_80B85B28(ItemEtcetera* this, GlobalContext* globalCtx) { - if (Flags_GetTreasure(globalCtx, (this->actor.params >> 8) & 0x1F)) { +void func_80B85B28(ItemEtcetera* this, PlayState* play) { + if (Flags_GetTreasure(play, (this->actor.params >> 8) & 0x1F)) { Actor_Kill(&this->actor); } } -void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[0] != NULL)) { - LOG_NUM("(game_play->demo_play.npcdemopnt[0]->dousa)", globalCtx->csCtx.npcActions[0]->action, +void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[0] != NULL)) { + LOG_NUM("(game_play->demo_play.npcdemopnt[0]->dousa)", play->csCtx.npcActions[0]->action, "../z_item_etcetera.c", 441); - if (globalCtx->csCtx.npcActions[0]->action == 2) { + if (play->csCtx.npcActions[0]->action == 2) { this->actor.draw = ItemEtcetera_Draw; this->actor.gravity = -0.1f; this->actor.minVelocityY = -4.0f; @@ -194,24 +194,24 @@ void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, GlobalContext* globalCtx) } } -void ItemEtcetera_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_Update(Actor* thisx, PlayState* play) { ItemEtcetera* this = (ItemEtcetera*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_DrawThroughLens(Actor* thisx, PlayState* play) { ItemEtcetera* this = (ItemEtcetera*)thisx; - if (globalCtx->actorCtx.lensActive) { - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, this->giDrawId); + if (play->actorCtx.lensActive) { + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); + GetItem_Draw(play, this->giDrawId); } } -void ItemEtcetera_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_Draw(Actor* thisx, PlayState* play) { ItemEtcetera* this = (ItemEtcetera*)thisx; - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, this->giDrawId); + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); + GetItem_Draw(play, this->giDrawId); } 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 d72c64ea98..cb881828e5 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h @@ -6,7 +6,7 @@ struct ItemEtcetera; -typedef void (*ItemEtceteraActionFunc)(struct ItemEtcetera*, GlobalContext*); +typedef void (*ItemEtceteraActionFunc)(struct ItemEtcetera*, PlayState*); typedef struct ItemEtcetera { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c index eb174f693a..dbb11d8888 100644 --- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c +++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c @@ -8,12 +8,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void ItemInbox_Init(Actor* thisx, GlobalContext* globalCtx); -void ItemInbox_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ItemInbox_Update(Actor* thisx, GlobalContext* globalCtx); -void ItemInbox_Draw(Actor* thisx, GlobalContext* globalCtx); +void ItemInbox_Init(Actor* thisx, PlayState* play); +void ItemInbox_Destroy(Actor* thisx, PlayState* play); +void ItemInbox_Update(Actor* thisx, PlayState* play); +void ItemInbox_Draw(Actor* thisx, PlayState* play); -void ItemInbox_Wait(ItemInbox* this, GlobalContext* globalCtx); +void ItemInbox_Wait(ItemInbox* this, PlayState* play); const ActorInit Item_Inbox_InitVars = { ACTOR_ITEM_INBOX, @@ -27,32 +27,32 @@ const ActorInit Item_Inbox_InitVars = { (ActorFunc)ItemInbox_Draw, }; -void ItemInbox_Init(Actor* thisx, GlobalContext* globalCtx) { +void ItemInbox_Init(Actor* thisx, PlayState* play) { ItemInbox* this = (ItemInbox*)thisx; this->actionFunc = ItemInbox_Wait; Actor_SetScale(&this->actor, 0.2); } -void ItemInbox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemInbox_Destroy(Actor* thisx, PlayState* play) { } -void ItemInbox_Wait(ItemInbox* this, GlobalContext* globalCtx) { - if (Flags_GetTreasure(globalCtx, (this->actor.params >> 8) & 0x1F)) { +void ItemInbox_Wait(ItemInbox* this, PlayState* play) { + if (Flags_GetTreasure(play, (this->actor.params >> 8) & 0x1F)) { Actor_Kill(&this->actor); } } -void ItemInbox_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemInbox_Update(Actor* thisx, PlayState* play) { ItemInbox* this = (ItemInbox*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ItemInbox_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemInbox_Draw(Actor* thisx, PlayState* play) { ItemInbox* this = (ItemInbox*)thisx; - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, this->actor.params & 0xFF); + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); + GetItem_Draw(play, this->actor.params & 0xFF); } diff --git a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h index 0845653abc..3bf3cf1570 100644 --- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h +++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h @@ -6,7 +6,7 @@ struct ItemInbox; -typedef void (*ItemInboxActionFunc)(struct ItemInbox*, GlobalContext*); +typedef void (*ItemInboxActionFunc)(struct ItemInbox*, PlayState*); typedef struct ItemInbox { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c b/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c index 9d40009151..9ea386ff6b 100644 --- a/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c +++ b/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c @@ -9,18 +9,18 @@ #define FLAGS ACTOR_FLAG_4 -void ItemOcarina_Init(Actor* thisx, GlobalContext* globalCtx); -void ItemOcarina_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ItemOcarina_Update(Actor* thisx, GlobalContext* globalCtx); -void ItemOcarina_Draw(Actor* thisx, GlobalContext* globalCtx); +void ItemOcarina_Init(Actor* thisx, PlayState* play); +void ItemOcarina_Destroy(Actor* thisx, PlayState* play); +void ItemOcarina_Update(Actor* thisx, PlayState* play); +void ItemOcarina_Draw(Actor* thisx, PlayState* play); -void ItemOcarina_GetThrown(ItemOcarina* this, GlobalContext* globalCtx); -void ItemOcarina_Fly(ItemOcarina* this, GlobalContext* globalCtx); -void ItemOcarina_WaitInWater(ItemOcarina* this, GlobalContext* globalCtx); -void ItemOcarina_StartSoTCutscene(ItemOcarina* this, GlobalContext* globalCtx); -void func_80B864EC(ItemOcarina* this, GlobalContext* globalCtx); -void func_80B865E0(ItemOcarina* this, GlobalContext* globalCtx); -void ItemOcarina_DoNothing(ItemOcarina* this, GlobalContext* globalCtx); +void ItemOcarina_GetThrown(ItemOcarina* this, PlayState* play); +void ItemOcarina_Fly(ItemOcarina* this, PlayState* play); +void ItemOcarina_WaitInWater(ItemOcarina* this, PlayState* play); +void ItemOcarina_StartSoTCutscene(ItemOcarina* this, PlayState* play); +void func_80B864EC(ItemOcarina* this, PlayState* play); +void func_80B865E0(ItemOcarina* this, PlayState* play); +void ItemOcarina_DoNothing(ItemOcarina* this, PlayState* play); const ActorInit Item_Ocarina_InitVars = { ACTOR_ITEM_OCARINA, @@ -38,7 +38,7 @@ void ItemOcarina_SetupAction(ItemOcarina* this, ItemOcarinaActionFunc actionFunc this->actionFunc = actionFunc; } -void ItemOcarina_Init(Actor* thisx, GlobalContext* globalCtx) { +void ItemOcarina_Init(Actor* thisx, PlayState* play) { ItemOcarina* this = (ItemOcarina*)thisx; s32 params = thisx->params; @@ -61,7 +61,7 @@ void ItemOcarina_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(thisx); return; } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ELF_MSG2, 299.0f, -140.0f, 884.0f, 0, 4, 1, 0x3800); + Actor_Spawn(&play->actorCtx, play, ACTOR_ELF_MSG2, 299.0f, -140.0f, 884.0f, 0, 4, 1, 0x3800); Actor_SetScale(thisx, 0.2f); break; default: @@ -73,10 +73,10 @@ void ItemOcarina_Init(Actor* thisx, GlobalContext* globalCtx) { this->spinRotOffset = 0x400; } -void ItemOcarina_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemOcarina_Destroy(Actor* thisx, PlayState* play) { } -void ItemOcarina_Fly(ItemOcarina* this, GlobalContext* globalCtx) { +void ItemOcarina_Fly(ItemOcarina* this, PlayState* play) { Vec3f ripplePos; func_8002D7EC(&this->actor); @@ -90,7 +90,7 @@ void ItemOcarina_Fly(ItemOcarina* this, GlobalContext* globalCtx) { } } - if (globalCtx->csCtx.frames == 881) { + if (play->csCtx.frames == 881) { this->actor.world.pos.x = 250.0f; this->actor.world.pos.y = 60.0f; this->actor.world.pos.z = 1075.0f; @@ -99,9 +99,9 @@ void ItemOcarina_Fly(ItemOcarina* this, GlobalContext* globalCtx) { this->actor.velocity.z = -7.0f; } - if (globalCtx->csCtx.frames == 897) { - EffectSsGRipple_Spawn(globalCtx, &this->actor.world.pos, 100, 500, 0); - EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, 0, 0, 1, 0); + if (play->csCtx.frames == 897) { + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 100, 500, 0); + EffectSsGSplash_Spawn(play, &this->actor.world.pos, 0, 0, 1, 0); this->actor.velocity.x = 0.0f; this->actor.velocity.y = 0.0f; this->actor.velocity.z = 0.0f; @@ -112,15 +112,15 @@ void ItemOcarina_Fly(ItemOcarina* this, GlobalContext* globalCtx) { } // landed in water - if (globalCtx->csCtx.frames == 906) { + if (play->csCtx.frames == 906) { ripplePos.x = 274.0f; ripplePos.y = -60.0f; ripplePos.z = 907.0f; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 0); } } -void ItemOcarina_GetThrown(ItemOcarina* this, GlobalContext* globalCtx) { +void ItemOcarina_GetThrown(ItemOcarina* this, PlayState* play) { this->actor.gravity = -0.3f; this->actor.minVelocityY = -5.0f; this->actor.velocity.x = 0.0f; @@ -129,7 +129,7 @@ void ItemOcarina_GetThrown(ItemOcarina* this, GlobalContext* globalCtx) { ItemOcarina_SetupAction(this, ItemOcarina_Fly); } -void func_80B864EC(ItemOcarina* this, GlobalContext* globalCtx) { +void func_80B864EC(ItemOcarina* this, PlayState* play) { func_8002D7EC(&this->actor); this->actor.shape.rot.x += this->spinRotOffset * 2; this->actor.shape.rot.y += this->spinRotOffset * 3; @@ -142,7 +142,7 @@ void func_80B864EC(ItemOcarina* this, GlobalContext* globalCtx) { } } - if (globalCtx->csCtx.frames == 220) { + if (play->csCtx.frames == 220) { this->actor.world.pos.x = 144.0f; this->actor.world.pos.y = 80.0f; this->actor.world.pos.z = 1686.0f; @@ -154,7 +154,7 @@ void func_80B864EC(ItemOcarina* this, GlobalContext* globalCtx) { } } -void func_80B865E0(ItemOcarina* this, GlobalContext* globalCtx) { +void func_80B865E0(ItemOcarina* this, PlayState* play) { this->actor.gravity = -0.3f; this->actor.minVelocityY = -5.0f; this->actor.velocity.x = 0.0f; @@ -163,41 +163,41 @@ void func_80B865E0(ItemOcarina* this, GlobalContext* globalCtx) { ItemOcarina_SetupAction(this, func_80B864EC); } -void ItemOcarina_DoNothing(ItemOcarina* this, GlobalContext* globalCtx) { +void ItemOcarina_DoNothing(ItemOcarina* this, PlayState* play) { } -void ItemOcarina_StartSoTCutscene(ItemOcarina* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gHyruleFieldZeldaSongOfTimeCs); +void ItemOcarina_StartSoTCutscene(ItemOcarina* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gHyruleFieldZeldaSongOfTimeCs); gSaveContext.cutsceneTrigger = 1; } } -void ItemOcarina_WaitInWater(ItemOcarina* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void ItemOcarina_WaitInWater(ItemOcarina* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { SET_EVENTCHKINF(EVENTCHKINF_43); - Flags_SetSwitch(globalCtx, 3); + Flags_SetSwitch(play, 3); this->actionFunc = ItemOcarina_StartSoTCutscene; this->actor.draw = NULL; } else { - func_8002F434(&this->actor, globalCtx, GI_OCARINA_OOT, 30.0f, 50.0f); + func_8002F434(&this->actor, play, GI_OCARINA_OOT, 30.0f, 50.0f); - if ((globalCtx->gameplayFrames & 13) == 0) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f); + if ((play->gameplayFrames & 13) == 0) { + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f); } } } -void ItemOcarina_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemOcarina_Update(Actor* thisx, PlayState* play) { ItemOcarina* this = (ItemOcarina*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ItemOcarina_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemOcarina_Draw(Actor* thisx, PlayState* play) { ItemOcarina* this = (ItemOcarina*)thisx; - func_8002EBCC(thisx, globalCtx, 0); - func_8002ED80(thisx, globalCtx, 0); - GetItem_Draw(globalCtx, GID_OCARINA_TIME); + func_8002EBCC(thisx, play, 0); + func_8002ED80(thisx, play, 0); + GetItem_Draw(play, GID_OCARINA_TIME); } diff --git a/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h b/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h index f653ae443f..9a02b99ed0 100644 --- a/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h +++ b/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h @@ -6,7 +6,7 @@ struct ItemOcarina; -typedef void (*ItemOcarinaActionFunc)(struct ItemOcarina*, GlobalContext*); +typedef void (*ItemOcarinaActionFunc)(struct ItemOcarina*, PlayState*); typedef struct ItemOcarina { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c index 3c915ee9f3..f8c8457061 100644 --- a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c +++ b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c @@ -10,13 +10,13 @@ #define FLAGS ACTOR_FLAG_4 -void ItemShield_Init(Actor* thisx, GlobalContext* globalCtx); -void ItemShield_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ItemShield_Update(Actor* thisx, GlobalContext* globalCtx); -void ItemShield_Draw(Actor* thisx, GlobalContext* globalCtx); +void ItemShield_Init(Actor* thisx, PlayState* play); +void ItemShield_Destroy(Actor* thisx, PlayState* play); +void ItemShield_Update(Actor* thisx, PlayState* play); +void ItemShield_Draw(Actor* thisx, PlayState* play); -void func_80B86F68(ItemShield* this, GlobalContext* globalCtx); -void func_80B86BC8(ItemShield* this, GlobalContext* globalCtx); +void func_80B86F68(ItemShield* this, PlayState* play); +void func_80B86BC8(ItemShield* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -57,7 +57,7 @@ void ItemShield_SetupAction(ItemShield* this, ItemShieldActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ItemShield_Init(Actor* thisx, GlobalContext* globalCtx) { +void ItemShield_Init(Actor* thisx, PlayState* play) { ItemShield* this = (ItemShield*)thisx; s32 i; @@ -85,25 +85,25 @@ void ItemShield_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetScale(&this->actor, 0.01f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); osSyncPrintf(VT_FGCOL(GREEN) "Item_Shild %d \n" VT_RST, this->actor.params); } -void ItemShield_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemShield_Destroy(Actor* thisx, PlayState* play) { ItemShield* this = (ItemShield*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80B86AC8(ItemShield* this, GlobalContext* globalCtx) { +void func_80B86AC8(ItemShield* this, PlayState* play) { Actor_MoveForward(&this->actor); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Actor_Kill(&this->actor); return; } - func_8002F434(&this->actor, globalCtx, GI_SHIELD_DEKU, 30.0f, 50.0f); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + func_8002F434(&this->actor, play, GI_SHIELD_DEKU, 30.0f, 50.0f); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->timer--; if (this->timer < 60) { @@ -119,12 +119,12 @@ void func_80B86AC8(ItemShield* this, GlobalContext* globalCtx) { } } -void func_80B86BC8(ItemShield* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B86BC8(ItemShield* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { Actor_Kill(&this->actor); return; } - func_8002F434(&this->actor, globalCtx, GI_SHIELD_DEKU, 30.0f, 50.0f); + func_8002F434(&this->actor, play, GI_SHIELD_DEKU, 30.0f, 50.0f); if (this->collider.base.acFlags & AC_HIT) { ItemShield_SetupAction(this, func_80B86AC8); this->actor.velocity.y = 4.0f; @@ -134,11 +134,11 @@ void func_80B86BC8(ItemShield* this, GlobalContext* globalCtx) { this->timer = 160; } else { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_80B86CA8(ItemShield* this, GlobalContext* globalCtx) { +void func_80B86CA8(ItemShield* this, PlayState* play) { static Vec3f D_80B871F4 = { 0.0f, 0.0f, 0.0f }; static f32 D_80B87200[] = { 0.3f, 0.6f, 0.9f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.85f, 0.7f, 0.55f, 0.4f, 0.25f, 0.1f, 0.0f }; @@ -148,7 +148,7 @@ void func_80B86CA8(ItemShield* this, GlobalContext* globalCtx) { s32 temp; Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); this->actor.shape.yOffset = ABS(Math_SinS(this->actor.shape.rot.x)) * 1500.0f; for (i = 0; i < 8; i++) { @@ -156,8 +156,7 @@ void func_80B86CA8(ItemShield* this, GlobalContext* globalCtx) { D_80B871F4.x = this->unk_1A8[i].x; D_80B871F4.y = this->unk_1A8[i].y + (this->actor.shape.yOffset * 0.01f) + (D_80B87200[temp] * -10.0f * 0.2f); D_80B871F4.z = this->unk_1A8[i].z; - EffectSsFireTail_SpawnFlame(globalCtx, &this->actor, &D_80B871F4, D_80B87200[temp] * 0.2f, -1, - D_80B87240[temp]); + EffectSsFireTail_SpawnFlame(play, &this->actor, &D_80B871F4, D_80B87200[temp] * 0.2f, -1, D_80B87240[temp]); if (this->unk_19E[i] != 0) { this->unk_19E[i]--; } else if (this->timer > 16) { @@ -182,9 +181,9 @@ void func_80B86CA8(ItemShield* this, GlobalContext* globalCtx) { } } -void func_80B86F68(ItemShield* this, GlobalContext* globalCtx) { +void func_80B86F68(ItemShield* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); MtxF* shield = &player->shieldMf; this->actor.world.pos.x = shield->xw; @@ -209,21 +208,21 @@ void func_80B86F68(ItemShield* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0; } -void ItemShield_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemShield_Update(Actor* thisx, PlayState* play) { ItemShield* this = (ItemShield*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ItemShield_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemShield_Draw(Actor* thisx, PlayState* play) { ItemShield* this = (ItemShield*)thisx; if (!(this->unk_19C & 2)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_item_shield.c", 457); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_item_shield.c", 460), + OPEN_DISPS(play->state.gfxCtx, "../z_item_shield.c", 457); + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_item_shield.c", 460), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, SEGMENTED_TO_VIRTUAL(gLinkChildDekuShieldDL)); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_item_shield.c", 465); + CLOSE_DISPS(play->state.gfxCtx, "../z_item_shield.c", 465); } } diff --git a/src/overlays/actors/ovl_Item_Shield/z_item_shield.h b/src/overlays/actors/ovl_Item_Shield/z_item_shield.h index 7daf0d0131..c7984f4a4d 100644 --- a/src/overlays/actors/ovl_Item_Shield/z_item_shield.h +++ b/src/overlays/actors/ovl_Item_Shield/z_item_shield.h @@ -6,7 +6,7 @@ struct ItemShield; -typedef void (*ItemShieldActionFunc)(struct ItemShield*, GlobalContext*); +typedef void (*ItemShieldActionFunc)(struct ItemShield*, PlayState*); typedef struct ItemShield { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index 30a624c692..327325dea3 100644 --- a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -9,14 +9,14 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void MagicDark_Init(Actor* thisx, GlobalContext* globalCtx); -void MagicDark_Destroy(Actor* thisx, GlobalContext* globalCtx); -void MagicDark_OrbUpdate(Actor* thisx, GlobalContext* globalCtx); -void MagicDark_OrbDraw(Actor* thisx, GlobalContext* globalCtx); -void MagicDark_DiamondUpdate(Actor* thisx, GlobalContext* globalCtx); -void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx); +void MagicDark_Init(Actor* thisx, PlayState* play); +void MagicDark_Destroy(Actor* thisx, PlayState* play); +void MagicDark_OrbUpdate(Actor* thisx, PlayState* play); +void MagicDark_OrbDraw(Actor* thisx, PlayState* play); +void MagicDark_DiamondUpdate(Actor* thisx, PlayState* play); +void MagicDark_DiamondDraw(Actor* thisx, PlayState* play); -void MagicDark_DimLighting(GlobalContext* globalCtx, f32 intensity); +void MagicDark_DimLighting(PlayState* play, f32 intensity); const ActorInit Magic_Dark_InitVars = { ACTOR_MAGIC_DARK, @@ -35,9 +35,9 @@ const ActorInit Magic_Dark_InitVars = { // unused static Color_RGBA8 D_80B88B10[] = { { 50, 100, 150, 200 }, { 255, 200, 150, 100 } }; -void MagicDark_Init(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_Init(Actor* thisx, PlayState* play) { MagicDark* this = (MagicDark*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!LINK_IS_ADULT) { this->scale = 0.4f; @@ -62,19 +62,19 @@ void MagicDark_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void MagicDark_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_Destroy(Actor* thisx, PlayState* play) { if (gSaveContext.nayrusLoveTimer == 0) { - func_800876C8(globalCtx); + func_800876C8(play); } } -void MagicDark_DiamondUpdate(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_DiamondUpdate(Actor* thisx, PlayState* play) { MagicDark* this = (MagicDark*)thisx; u8 phi_a0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 pad; s16 nayrusLoveTimer = gSaveContext.nayrusLoveTimer; - s32 msgMode = globalCtx->msgCtx.msgMode; + s32 msgMode = play->msgCtx.msgMode; if (1) {} @@ -122,7 +122,7 @@ void MagicDark_DiamondUpdate(Actor* thisx, GlobalContext* globalCtx) { } thisx->world.rot.y += 0x3E8; - thisx->shape.rot.y = thisx->world.rot.y + Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); + thisx->shape.rot.y = thisx->world.rot.y + Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); this->timer++; gSaveContext.nayrusLoveTimer = nayrusLoveTimer + 1; @@ -133,12 +133,12 @@ void MagicDark_DiamondUpdate(Actor* thisx, GlobalContext* globalCtx) { } } -void MagicDark_DimLighting(GlobalContext* globalCtx, f32 intensity) { +void MagicDark_DimLighting(PlayState* play, f32 intensity) { s32 i; f32 colorScale; f32 fogScale; - if (globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5) { + if (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5) { intensity = CLAMP_MIN(intensity, 0.0f); intensity = CLAMP_MAX(intensity, 1.0f); fogScale = intensity - 0.2f; @@ -147,11 +147,11 @@ void MagicDark_DimLighting(GlobalContext* globalCtx, f32 intensity) { fogScale = 0.0f; } - globalCtx->envCtx.adjFogNear = (850.0f - globalCtx->envCtx.lightSettings.fogNear) * fogScale; + play->envCtx.adjFogNear = (850.0f - play->envCtx.lightSettings.fogNear) * fogScale; if (intensity == 0.0f) { - for (i = 0; i < ARRAY_COUNT(globalCtx->envCtx.adjFogColor); i++) { - globalCtx->envCtx.adjFogColor[i] = 0; + for (i = 0; i < ARRAY_COUNT(play->envCtx.adjFogColor); i++) { + play->envCtx.adjFogColor[i] = 0; } } else { colorScale = intensity * 5.0f; @@ -160,28 +160,28 @@ void MagicDark_DimLighting(GlobalContext* globalCtx, f32 intensity) { colorScale = 1.0f; } - for (i = 0; i < ARRAY_COUNT(globalCtx->envCtx.adjFogColor); i++) { - globalCtx->envCtx.adjFogColor[i] = -(s16)(globalCtx->envCtx.lightSettings.fogColor[i] * colorScale); + for (i = 0; i < ARRAY_COUNT(play->envCtx.adjFogColor); i++) { + play->envCtx.adjFogColor[i] = -(s16)(play->envCtx.lightSettings.fogColor[i] * colorScale); } } } } -void MagicDark_OrbUpdate(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_OrbUpdate(Actor* thisx, PlayState* play) { MagicDark* this = (MagicDark*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); func_8002F974(&this->actor, NA_SE_PL_MAGIC_SOUL_BALL - SFX_FLAG); if (this->timer < 35) { - MagicDark_DimLighting(globalCtx, this->timer * (1 / 45.0f)); + MagicDark_DimLighting(play, this->timer * (1 / 45.0f)); Math_SmoothStepToF(&thisx->scale.x, this->scale * (1 / 12.000001f), 0.05f, 0.01f, 0.0001f); Actor_SetScale(&this->actor, thisx->scale.x); } else if (this->timer < 55) { Actor_SetScale(&this->actor, thisx->scale.x * 0.9f); Math_SmoothStepToF(&this->orbOffset.y, player->bodyPartsPos[PLAYER_BODYPART_WAIST].y, 0.5f, 3.0f, 1.0f); if (this->timer > 48) { - MagicDark_DimLighting(globalCtx, (54 - this->timer) * 0.2f); + MagicDark_DimLighting(play, (54 - this->timer) * 0.2f); } } else { thisx->update = MagicDark_DiamondUpdate; @@ -195,17 +195,17 @@ void MagicDark_OrbUpdate(Actor* thisx, GlobalContext* globalCtx) { this->timer++; } -void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_DiamondDraw(Actor* thisx, PlayState* play) { MagicDark* this = (MagicDark*)thisx; s32 pad; - u16 gameplayFrames = globalCtx->gameplayFrames; + u16 gameplayFrames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_magic_dark.c", 525); + OPEN_DISPS(play->state.gfxCtx, "../z_magic_dark.c", 525); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 heightDiff; this->actor.world.pos.x = player->bodyPartsPos[PLAYER_BODYPART_WAIST].x; @@ -219,26 +219,25 @@ void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(this->actor.shape.rot.y), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_magic_dark.c", 553), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_magic_dark.c", 553), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 255, 255, (s32)(this->primAlpha * 0.6f) & 0xFF); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 128); gSPDisplayList(POLY_XLU_DISP++, sDiamondMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames * 2, gameplayFrames * -4, 32, 32, 1, - 0, gameplayFrames * -16, 64, 32)); + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames * 2, gameplayFrames * -4, + 32, 32, 1, 0, gameplayFrames * -16, 64, 32)); gSPDisplayList(POLY_XLU_DISP++, sDiamondModelDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_magic_dark.c", 570); + CLOSE_DISPS(play->state.gfxCtx, "../z_magic_dark.c", 570); } -void MagicDark_OrbDraw(Actor* thisx, GlobalContext* globalCtx) { +void MagicDark_OrbDraw(Actor* thisx, PlayState* play) { MagicDark* this = (MagicDark*)thisx; Vec3f pos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; - f32 sp6C = globalCtx->state.frames & 0x1F; + f32 sp6C = play->state.frames & 0x1F; if (this->timer < 32) { pos.x = @@ -257,30 +256,30 @@ void MagicDark_OrbDraw(Actor* thisx, GlobalContext* globalCtx) { return; } - pos.x -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * - Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)))); - pos.y -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)))); - pos.z -= (this->actor.scale.x * 300.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * - Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)))); + pos.x -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * + Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)))); + pos.y -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)))); + pos.z -= (this->actor.scale.x * 300.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * + Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)))); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_magic_dark.c", 619); + OPEN_DISPS(play->state.gfxCtx, "../z_magic_dark.c", 619); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 0, 150, 255, 255); Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_Push(); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_magic_dark.c", 632), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_magic_dark.c", 632), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Matrix_RotateZ(sp6C * (M_PI / 32), MTXMODE_APPLY); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); Matrix_Pop(); Matrix_RotateZ(-sp6C * (M_PI / 32), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_magic_dark.c", 639), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_magic_dark.c", 639), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_magic_dark.c", 643); + CLOSE_DISPS(play->state.gfxCtx, "../z_magic_dark.c", 643); } 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 fb3447af6d..4be4d7ddfb 100644 --- a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -8,12 +8,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void MagicFire_Init(Actor* thisx, GlobalContext* globalCtx); -void MagicFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void MagicFire_Update(Actor* thisx, GlobalContext* globalCtx); -void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx); +void MagicFire_Init(Actor* thisx, PlayState* play); +void MagicFire_Destroy(Actor* thisx, PlayState* play); +void MagicFire_Update(Actor* thisx, PlayState* play); +void MagicFire_Draw(Actor* thisx, PlayState* play); -void MagicFire_UpdateBeforeCast(Actor* thisx, GlobalContext* globalCtx); +void MagicFire_UpdateBeforeCast(Actor* thisx, PlayState* play); typedef enum { /* 0x00 */ DF_ACTION_INITIALIZE, @@ -74,7 +74,7 @@ static u8 sVertexIndices[] = { 14, 20, 21, 23, 28, 30, 33, 34, 40, 41, 43, 48, 50, 55, 57, 62, 64, 65, 73, 74, }; -void MagicFire_Init(Actor* thisx, GlobalContext* globalCtx) { +void MagicFire_Init(Actor* thisx, PlayState* play) { MagicFire* this = (MagicFire*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -83,24 +83,23 @@ void MagicFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionTimer = 0; this->alphaMultiplier = -3.0f; Actor_SetScale(&this->actor, 0.0f); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.update = MagicFire_UpdateBeforeCast; this->actionTimer = 20; this->actor.room = -1; } -void MagicFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { - func_800876C8(globalCtx); +void MagicFire_Destroy(Actor* thisx, PlayState* play) { + func_800876C8(play); } -void MagicFire_UpdateBeforeCast(Actor* thisx, GlobalContext* globalCtx) { +void MagicFire_UpdateBeforeCast(Actor* thisx, PlayState* play) { MagicFire* this = (MagicFire*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if ((globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) || - (globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED)) { + if ((play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) || (play->msgCtx.msgMode == MSGMODE_SONG_PLAYED)) { Actor_Kill(&this->actor); return; } @@ -113,15 +112,14 @@ void MagicFire_UpdateBeforeCast(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos = player->actor.world.pos; } -void MagicFire_Update(Actor* thisx, GlobalContext* globalCtx) { +void MagicFire_Update(Actor* thisx, PlayState* play) { MagicFire* this = (MagicFire*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; if (1) {} this->actor.world.pos = player->actor.world.pos; - if ((globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) || - (globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED)) { + if ((play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK) || (play->msgCtx.msgMode == MSGMODE_SONG_PLAYED)) { Actor_Kill(&this->actor); return; } @@ -134,7 +132,7 @@ void MagicFire_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.radius = (this->actor.scale.x * 325.0f); this->collider.dim.height = (this->actor.scale.y * 450.0f); this->collider.dim.yShift = (this->actor.scale.y * -225.0f); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); switch (this->action) { case DF_ACTION_INITIALIZE: @@ -209,16 +207,16 @@ void MagicFire_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) { +void MagicFire_Draw(Actor* thisx, PlayState* play) { MagicFire* this = (MagicFire*)thisx; s32 pad1; - u32 gameplayFrames = globalCtx->gameplayFrames; + u32 gameplayFrames = play->gameplayFrames; s32 pad2; s32 i; u8 alpha; if (this->action > 0) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_magic_fire.c", 682); + OPEN_DISPS(play->state.gfxCtx, "../z_magic_fire.c", 682); POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (u8)(s32)(60 * this->screenTintIntensity), (u8)(s32)(20 * this->screenTintIntensity), (u8)(s32)(0 * this->screenTintIntensity), @@ -226,11 +224,11 @@ void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE); gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); gDPFillRectangle(POLY_XLU_DISP++, 0, 0, 319, 239); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, 255, 200, 0, (u8)(this->alphaMultiplier * 255)); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, (u8)(this->alphaMultiplier * 255)); Matrix_Scale(0.15f, 0.15f, 0.15f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_magic_fire.c", 715), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_magic_fire.c", 715), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_XLU_DISP++); gSPTexture(POLY_XLU_DISP++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); @@ -242,11 +240,11 @@ void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetTileSize(POLY_XLU_DISP++, 1, 0, 0, 252, 252); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 512, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (gameplayFrames * 2) % 512, 511 - ((gameplayFrames * 5) % 512), 64, 64, 1, (gameplayFrames * 2) % 256, 255 - ((gameplayFrames * 20) % 256), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, sModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_magic_fire.c", 750); + CLOSE_DISPS(play->state.gfxCtx, "../z_magic_fire.c", 750); alpha = (s32)(this->alphaMultiplier * 255); for (i = 0; i < 36; i++) { 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 34dd4647b3..d9658a4b57 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -8,16 +8,16 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void MagicWind_Init(Actor* thisx, GlobalContext* globalCtx); -void MagicWind_Destroy(Actor* thisx, GlobalContext* globalCtx); -void MagicWind_Update(Actor* thisx, GlobalContext* globalCtx); -void MagicWind_Draw(Actor* thisx, GlobalContext* globalCtx); +void MagicWind_Init(Actor* thisx, PlayState* play); +void MagicWind_Destroy(Actor* thisx, PlayState* play); +void MagicWind_Update(Actor* thisx, PlayState* play); +void MagicWind_Draw(Actor* thisx, PlayState* play); -void MagicWind_Shrink(MagicWind* this, GlobalContext* globalCtx); -void MagicWind_WaitForTimer(MagicWind* this, GlobalContext* globalCtx); -void MagicWind_FadeOut(MagicWind* this, GlobalContext* globalCtx); -void MagicWind_WaitAtFullSize(MagicWind* this, GlobalContext* globalCtx); -void MagicWind_Grow(MagicWind* this, GlobalContext* globalCtx); +void MagicWind_Shrink(MagicWind* this, PlayState* play); +void MagicWind_WaitForTimer(MagicWind* this, PlayState* play); +void MagicWind_FadeOut(MagicWind* this, PlayState* play); +void MagicWind_WaitAtFullSize(MagicWind* this, PlayState* play); +void MagicWind_Grow(MagicWind* this, PlayState* play); const ActorInit Magic_Wind_InitVars = { ACTOR_MAGIC_WIND, @@ -41,11 +41,11 @@ void MagicWind_SetupAction(MagicWind* this, MagicWindFunc actionFunc) { this->actionFunc = actionFunc; } -void MagicWind_Init(Actor* thisx, GlobalContext* globalCtx) { +void MagicWind_Init(Actor* thisx, PlayState* play) { MagicWind* this = (MagicWind*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (!SkelCurve_Init(globalCtx, &this->skelCurve, &sSkel, &sAnim)) { + if (!SkelCurve_Init(play, &this->skelCurve, &sSkel, &sAnim)) { // "Magic_Wind_Actor_ct (): Construct failed" osSyncPrintf("Magic_Wind_Actor_ct():コンストラクト失敗\n"); } @@ -66,10 +66,10 @@ void MagicWind_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void MagicWind_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void MagicWind_Destroy(Actor* thisx, PlayState* play) { MagicWind* this = (MagicWind*)thisx; - SkelCurve_Destroy(globalCtx, &this->skelCurve); - func_800876C8(globalCtx); + SkelCurve_Destroy(play, &this->skelCurve); + func_800876C8(play); // "wipe out" LOG_STRING("消滅", "../z_magic_wind.c", 505); } @@ -82,8 +82,8 @@ void MagicWind_UpdateAlpha(f32 alpha) { } } -void MagicWind_WaitForTimer(MagicWind* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void MagicWind_WaitForTimer(MagicWind* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->timer > 0) { this->timer--; @@ -95,17 +95,17 @@ void MagicWind_WaitForTimer(MagicWind* this, GlobalContext* globalCtx) { func_8002F7DC(&player->actor, NA_SE_PL_MAGIC_WIND_NORMAL); MagicWind_UpdateAlpha(1.0f); MagicWind_SetupAction(this, MagicWind_Grow); - SkelCurve_Update(globalCtx, &this->skelCurve); + SkelCurve_Update(play, &this->skelCurve); } -void MagicWind_Grow(MagicWind* this, GlobalContext* globalCtx) { - if (SkelCurve_Update(globalCtx, &this->skelCurve)) { +void MagicWind_Grow(MagicWind* this, PlayState* play) { + if (SkelCurve_Update(play, &this->skelCurve)) { MagicWind_SetupAction(this, MagicWind_WaitAtFullSize); this->timer = 50; } } -void MagicWind_WaitAtFullSize(MagicWind* this, GlobalContext* globalCtx) { +void MagicWind_WaitAtFullSize(MagicWind* this, PlayState* play) { if (this->timer > 0) { this->timer--; } else { @@ -114,7 +114,7 @@ void MagicWind_WaitAtFullSize(MagicWind* this, GlobalContext* globalCtx) { } } -void MagicWind_FadeOut(MagicWind* this, GlobalContext* globalCtx) { +void MagicWind_FadeOut(MagicWind* this, PlayState* play) { if (this->timer > 0) { MagicWind_UpdateAlpha((f32)this->timer * (1.0f / 30.0f)); this->timer--; @@ -123,57 +123,56 @@ void MagicWind_FadeOut(MagicWind* this, GlobalContext* globalCtx) { } } -void MagicWind_Shrink(MagicWind* this, GlobalContext* globalCtx) { - if (SkelCurve_Update(globalCtx, &this->skelCurve)) { +void MagicWind_Shrink(MagicWind* this, PlayState* play) { + if (SkelCurve_Update(play, &this->skelCurve)) { Actor_Kill(&this->actor); } } -void MagicWind_Update(Actor* thisx, GlobalContext* globalCtx) { +void MagicWind_Update(Actor* thisx, PlayState* play) { MagicWind* this = (MagicWind*)thisx; - if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || - globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { + if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) { Actor_Kill(thisx); return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 MagicWind_OverrideLimbDraw(GlobalContext* globalCtx, SkelCurve* skelCurve, s32 limbIndex, void* thisx) { +s32 MagicWind_OverrideLimbDraw(PlayState* play, SkelCurve* skelCurve, s32 limbIndex, void* thisx) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_magic_wind.c", 615); + OPEN_DISPS(play->state.gfxCtx, "../z_magic_wind.c", 615); if (limbIndex == 1) { gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * 9) & 0xFF, - 0xFF - ((globalCtx->state.frames * 0xF) & 0xFF), 0x40, 0x40, 1, - (globalCtx->state.frames * 0xF) & 0xFF, - 0xFF - ((globalCtx->state.frames * 0x1E) & 0xFF), 0x40, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (play->state.frames * 9) & 0xFF, + 0xFF - ((play->state.frames * 0xF) & 0xFF), 0x40, 0x40, 1, + (play->state.frames * 0xF) & 0xFF, 0xFF - ((play->state.frames * 0x1E) & 0xFF), + 0x40, 0x40)); } else if (limbIndex == 2) { gSPSegment(POLY_XLU_DISP++, 9, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * 3) & 0xFF, - 0xFF - ((globalCtx->state.frames * 5) & 0xFF), 0x40, 0x40, 1, - (globalCtx->state.frames * 6) & 0xFF, - 0xFF - ((globalCtx->state.frames * 0xA) & 0xFF), 0x40, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (play->state.frames * 3) & 0xFF, + 0xFF - ((play->state.frames * 5) & 0xFF), 0x40, 0x40, 1, + (play->state.frames * 6) & 0xFF, 0xFF - ((play->state.frames * 0xA) & 0xFF), 0x40, + 0x40)); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_magic_wind.c", 646); + CLOSE_DISPS(play->state.gfxCtx, "../z_magic_wind.c", 646); return true; } -void MagicWind_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void MagicWind_Draw(Actor* thisx, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MagicWind* this = (MagicWind*)thisx; OPEN_DISPS(gfxCtx, "../z_magic_wind.c", 661); if (this->actionFunc != MagicWind_WaitForTimer) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 25); - SkelCurve_Draw(&this->actor, globalCtx, &this->skelCurve, MagicWind_OverrideLimbDraw, NULL, 1, NULL); + SkelCurve_Draw(&this->actor, 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 26a302e7aa..e9521f7002 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h @@ -6,7 +6,7 @@ struct MagicWind; -typedef void (*MagicWindFunc)(struct MagicWind* this, GlobalContext* globalCtx); +typedef void (*MagicWindFunc)(struct MagicWind* this, PlayState* play); typedef struct MagicWind { /* 0x0000 */ Actor actor; 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 12ebe35c89..5e43c811d8 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) -void MirRay_Init(Actor* thisx, GlobalContext* globalCtx); -void MirRay_Destroy(Actor* thisx, GlobalContext* globalCtx); -void MirRay_Update(Actor* thisx, GlobalContext* globalCtx); -void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx); +void MirRay_Init(Actor* thisx, PlayState* play); +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); @@ -126,8 +126,8 @@ void MirRay_SetupCollider(MirRay* this) { // 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, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void MirRay_MakeShieldLight(MirRay* this, PlayState* play) { + Player* player = GET_PLAYER(play); MirRayDataEntry* dataEntry = &sMirRayData[this->actor.params]; Vec3f reflectionPt; Vec3s lightPt; @@ -158,7 +158,7 @@ void MirRay_MakeShieldLight(MirRay* this, GlobalContext* globalCtx) { } } -void MirRay_Init(Actor* thisx, GlobalContext* globalCtx) { +void MirRay_Init(Actor* thisx, PlayState* play) { s32 pad; MirRay* this = (MirRay*)thisx; MirRayDataEntry* dataEntry = &sMirRayData[this->actor.params]; @@ -187,7 +187,7 @@ void MirRay_Init(Actor* thisx, GlobalContext* globalCtx) { Lights_PointNoGlowSetInfo(&this->lightInfo, this->sourcePt.x, this->sourcePt.y, this->sourcePt.z, 255, 255, 255, 100); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); this->shieldCorners[0].x = -536.0f; this->shieldCorners[0].y = -939.0f; @@ -208,15 +208,15 @@ void MirRay_Init(Actor* thisx, GlobalContext* globalCtx) { this->shieldCorners[5].y = -800.0f; if (dataEntry->params & 2) { - Collider_InitJntSph(globalCtx, &this->colliderSph); - Collider_SetJntSph(globalCtx, &this->colliderSph, &this->actor, &sJntSphInit, &this->colliderSphItem); + Collider_InitJntSph(play, &this->colliderSph); + Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInit, &this->colliderSphItem); if (!(dataEntry->params & 4)) { // Beams not from mirrors MirRay_SetupCollider(this); } } - Collider_InitQuad(globalCtx, &this->shieldRay); - Collider_SetQuad(globalCtx, &this->shieldRay, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->shieldRay); + Collider_SetQuad(play, &this->shieldRay, &this->actor, &sQuadInit); // Spirit Temple top room mirrors if ((this->actor.params == 5) || (this->actor.params == 7) || (this->actor.params == 8)) { @@ -224,22 +224,22 @@ void MirRay_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void MirRay_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void MirRay_Destroy(Actor* thisx, PlayState* play) { MirRay* this = (MirRay*)thisx; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); if (sMirRayData[this->actor.params].params & 2) { - Collider_DestroyJntSph(globalCtx, &this->colliderSph); + Collider_DestroyJntSph(play, &this->colliderSph); } - Collider_DestroyQuad(globalCtx, &this->shieldRay); + Collider_DestroyQuad(play, &this->shieldRay); } -void MirRay_Update(Actor* thisx, GlobalContext* globalCtx) { +void MirRay_Update(Actor* thisx, PlayState* play) { s32 pad; MirRay* this = (MirRay*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); D_80B8E670 = 0; @@ -248,12 +248,12 @@ void MirRay_Update(Actor* thisx, GlobalContext* globalCtx) { if (sMirRayData[this->actor.params].params & 4) { // Beams from mirrors MirRay_SetupCollider(this); } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); } if (this->reflectIntensity > 0.0f) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->shieldRay.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->shieldRay.base); } - MirRay_MakeShieldLight(this, globalCtx); + MirRay_MakeShieldLight(this, play); if (this->reflectIntensity > 0.0f) { func_8002F8F0(&player->actor, NA_SE_IT_SHIELD_BEAM - SFX_FLAG); @@ -261,13 +261,13 @@ void MirRay_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void MirRay_SetIntensity(MirRay* this, GlobalContext* globalCtx) { +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(globalCtx); + Player* player = GET_PLAYER(play); MtxF* shieldMtx = &player->shieldMf; this->reflectIntensity = 0.0f; @@ -305,8 +305,8 @@ void MirRay_SetIntensity(MirRay* this, GlobalContext* globalCtx) { // 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, GlobalContext* globalCtx, MirRayShieldReflection* reflection) { - Player* player = GET_PLAYER(globalCtx); +void MirRay_SetupReflectionPolys(MirRay* this, PlayState* play, MirRayShieldReflection* reflection) { + Player* player = GET_PLAYER(play); MtxF* shieldMtx; s32 i; Vec3f posA; @@ -331,7 +331,7 @@ void MirRay_SetupReflectionPolys(MirRay* this, GlobalContext* globalCtx, MirRayS posB.x = sp60[0] + posA.x; posB.y = sp60[1] + posA.y; posB.z = sp60[2] + posA.z; - if (BgCheck_AnyLineTest1(&globalCtx->colCtx, &posA, &posB, &posResult, &outPoly, 1)) { + if (BgCheck_AnyLineTest1(&play->colCtx, &posA, &posB, &posResult, &outPoly, 1)) { reflection[i].reflectionPoly = outPoly; } else { reflection[i].reflectionPoly = NULL; @@ -360,8 +360,8 @@ void MirRay_RemoveSimilarReflections(MirRayShieldReflection* reflection) { } // Creates the reflected beam's collider (to interact with objects) and places and orients the shield images -void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldReflection* reflection) { - Player* player = GET_PLAYER(globalCtx); +void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection* reflection) { + Player* player = GET_PLAYER(play); s32 i; f32 temp_f0; Vec3f vecB; @@ -473,29 +473,29 @@ void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldRe } } -void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { +void MirRay_Draw(Actor* thisx, PlayState* play) { MirRay* this = (MirRay*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; MirRayShieldReflection reflection[6]; s32 temp; this->reflectIntensity = 0.0f; - if ((D_80B8E670 == 0) && !this->unLit && Player_HasMirrorShieldSetToDraw(globalCtx)) { + if ((D_80B8E670 == 0) && !this->unLit && Player_HasMirrorShieldSetToDraw(play)) { Matrix_Mult(&player->shieldMf, MTXMODE_NEW); - MirRay_SetIntensity(this, globalCtx); + MirRay_SetIntensity(this, play); if (!(this->reflectIntensity <= 0.0f)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_mir_ray.c", 966); + OPEN_DISPS(play->state.gfxCtx, "../z_mir_ray.c", 966); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Scale(1.0f, 1.0f, this->reflectIntensity * 5.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_mir_ray.c", 972), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_mir_ray.c", 972), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 150, (s16)(temp = this->reflectIntensity * 100.0f)); gSPDisplayList(POLY_XLU_DISP++, gShieldBeamGlowDL); - MirRay_SetupReflectionPolys(this, globalCtx, reflection); + MirRay_SetupReflectionPolys(this, play, reflection); MirRay_RemoveSimilarReflections(reflection); - MirRay_ReflectedBeam(this, globalCtx, reflection); + MirRay_ReflectedBeam(this, play, reflection); if (reflection[0].reflectionPoly == NULL) { reflection[0].opacity = 0; @@ -512,7 +512,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(reflection[i].pos.x, reflection[i].pos.y, reflection[i].pos.z, MTXMODE_NEW); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); Matrix_Mult(&reflection[i].mtx, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_mir_ray.c", 1006), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_mir_ray.c", 1006), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); 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); @@ -522,7 +522,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { D_80B8E670 = 1; - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_mir_ray.c", 1027); + CLOSE_DISPS(play->state.gfxCtx, "../z_mir_ray.c", 1027); } } } diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index fb1d0489ac..a0a4dbeb51 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -11,21 +11,21 @@ #define FLAGS ACTOR_FLAG_22 -void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBean_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjBean_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjBean_Init(Actor* thisx, PlayState* play); +void ObjBean_Destroy(Actor* thisx, PlayState* play); +void ObjBean_Update(Actor* thisx, PlayState* play); +void ObjBean_Draw(Actor* thisx, PlayState* play); -void ObjBean_WaitForPlayer(ObjBean* this, GlobalContext* globalCtx); -void ObjBean_Fly(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_WaitForPlayer(ObjBean* this, PlayState* play); +void ObjBean_Fly(ObjBean* this, PlayState* play); void ObjBean_SetupFly(ObjBean* this); -void ObjBean_WaitForWater(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_WaitForWater(ObjBean* this, PlayState* play); void ObjBean_SetupWaitForWater(ObjBean* this); void ObjBean_SetupGrowWaterPhase1(ObjBean* this); -void ObjBean_GrowWaterPhase1(ObjBean* this, GlobalContext* globalCtx); -void ObjBean_GrowWaterPhase2(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_GrowWaterPhase1(ObjBean* this, PlayState* play); +void ObjBean_GrowWaterPhase2(ObjBean* this, PlayState* play); void ObjBean_SetupGrowWaterPhase2(ObjBean* this); -void ObjBean_GrowWaterPhase3(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_GrowWaterPhase3(ObjBean* this, PlayState* play); void ObjBean_SetupGrowWaterPhase3(ObjBean* this); void ObjBean_SetupGrown(ObjBean* this); void ObjBean_FlattenLeaves(ObjBean* this); @@ -34,32 +34,32 @@ void ObjBean_LeavesStill(ObjBean* this); void ObjBean_SetupShakeLeaves(ObjBean* this); void ObjBean_ShakeLeaves(ObjBean* this); void ObjBean_SetupWaitForBean(ObjBean* this); -void ObjBean_WaitForBean(ObjBean* this, GlobalContext* globalCtx); -void func_80B8FE3C(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_WaitForBean(ObjBean* this, PlayState* play); +void func_80B8FE3C(ObjBean* this, PlayState* play); void func_80B8FE00(ObjBean* this); void func_80B8FE6C(ObjBean* this); -void func_80B8FEAC(ObjBean* this, GlobalContext* globalCtx); +void func_80B8FEAC(ObjBean* this, PlayState* play); void func_80B8FF50(ObjBean* this); void ObjBean_SetupGrowWaterPhase4(ObjBean* this); -void func_80B8FF8C(ObjBean* this, GlobalContext* globalCtx); -void func_80B90050(ObjBean* this, GlobalContext* globalCtx); +void func_80B8FF8C(ObjBean* this, PlayState* play); +void func_80B90050(ObjBean* this, PlayState* play); void func_80B90010(ObjBean* this); void func_80B908EC(ObjBean* this); -void func_80B90918(ObjBean* this, GlobalContext* globalCtx); +void func_80B90918(ObjBean* this, PlayState* play); void func_80B90970(ObjBean* this); -void func_80B909B0(ObjBean* this, GlobalContext* globalCtx); +void func_80B909B0(ObjBean* this, PlayState* play); void func_80B909F8(ObjBean* this); -void func_80B90A34(ObjBean* this, GlobalContext* globalCtx); +void func_80B90A34(ObjBean* this, PlayState* play); void ObjBean_SetupWaitForPlayer(ObjBean* this); -void ObjBean_GrowWaterPhase4(ObjBean* this, GlobalContext* globalCtx); -void ObjBean_GrowWaterPhase5(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_GrowWaterPhase4(ObjBean* this, PlayState* play); +void ObjBean_GrowWaterPhase5(ObjBean* this, PlayState* play); void ObjBean_SetupGrowWaterPhase5(ObjBean* this); void ObjBean_SetupShakeLeavesFast(ObjBean* this); void ObjBean_ShakeLeavesFast(ObjBean* this); void ObjBean_Grow(ObjBean* this); void ObjBean_SetupGrow(ObjBean* this); void ObjBean_SetupWaitForStepOff(ObjBean* this); -void ObjBean_WaitForStepOff(ObjBean* this, GlobalContext* globalCtx); +void ObjBean_WaitForStepOff(ObjBean* this, PlayState* play); #define BEAN_STATE_DRAW_LEAVES (1 << 0) #define BEAN_STATE_DRAW_SOIL (1 << 1) @@ -125,15 +125,15 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1600, ICHAIN_STOP), }; -void ObjBean_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_InitCollider(Actor* thisx, PlayState* play) { ObjBean* this = (ObjBean*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); } -void ObjBean_InitDynaPoly(ObjBean* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void ObjBean_InitDynaPoly(ObjBean* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader; s32 pad2; @@ -143,14 +143,14 @@ void ObjBean_InitDynaPoly(ObjBean* this, GlobalContext* globalCtx, CollisionHead DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_bean.c", 374, this->dyna.actor.id, this->dyna.actor.params); } } -void ObjBean_FindFloor(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_FindFloor(ObjBean* this, PlayState* play) { Vec3f vec; s32 sp20; @@ -158,7 +158,7 @@ void ObjBean_FindFloor(ObjBean* this, GlobalContext* globalCtx) { vec.y = this->dyna.actor.world.pos.y + 29.999998f; vec.z = this->dyna.actor.world.pos.z; this->dyna.actor.floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &sp20, &this->dyna.actor, &vec); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &sp20, &this->dyna.actor, &vec); } void func_80B8EBC8(ObjBean* this) { @@ -225,18 +225,18 @@ void ObjBean_SetDrawMode(ObjBean* this, u8 drawFlag) { this->stateFlags |= drawFlag; } -void ObjBean_SetupPathCount(ObjBean* this, GlobalContext* globalCtx) { - this->pathCount = globalCtx->setupPathList[(this->dyna.actor.params >> 8) & 0x1F].count - 1; +void ObjBean_SetupPathCount(ObjBean* this, PlayState* play) { + this->pathCount = play->setupPathList[(this->dyna.actor.params >> 8) & 0x1F].count - 1; this->currentPointIndex = 0; this->nextPointIndex = 1; } -void ObjBean_SetupPath(ObjBean* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[(this->dyna.actor.params >> 8) & 0x1F]; +void ObjBean_SetupPath(ObjBean* this, PlayState* play) { + Path* path = &play->setupPathList[(this->dyna.actor.params >> 8) & 0x1F]; Math_Vec3s_ToVec3f(&this->pathPoints, SEGMENTED_TO_VIRTUAL(path->points)); } -void ObjBean_FollowPath(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_FollowPath(ObjBean* this, PlayState* play) { Path* path; Vec3f acell; Vec3f pathPointsFloat; @@ -250,7 +250,7 @@ void ObjBean_FollowPath(ObjBean* this, GlobalContext* globalCtx) { f32 mag; Math_StepToF(&this->dyna.actor.speedXZ, sBeanSpeeds[this->unk_1F6].velocity, sBeanSpeeds[this->unk_1F6].accel); - path = &globalCtx->setupPathList[(this->dyna.actor.params >> 8) & 0x1F]; + path = &play->setupPathList[(this->dyna.actor.params >> 8) & 0x1F]; nextPathPoint = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->nextPointIndex]; Math_Vec3s_ToVec3f(&pathPointsFloat, nextPathPoint); @@ -285,8 +285,8 @@ void ObjBean_FollowPath(ObjBean* this, GlobalContext* globalCtx) { } } -s32 ObjBean_CheckForHorseTrample(ObjBean* this, GlobalContext* globalCtx) { - Actor* currentActor = globalCtx->actorCtx.actorLists[ACTORCAT_BG].head; +s32 ObjBean_CheckForHorseTrample(ObjBean* this, PlayState* play) { + Actor* currentActor = play->actorCtx.actorLists[ACTORCAT_BG].head; while (currentActor != NULL) { if ((currentActor->id == ACTOR_EN_HORSE) && @@ -299,7 +299,7 @@ s32 ObjBean_CheckForHorseTrample(ObjBean* this, GlobalContext* globalCtx) { return false; } -void ObjBean_Break(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_Break(ObjBean* this, PlayState* play) { Vec3f pos; Vec3f velocity; f32 temp_f20; @@ -339,7 +339,7 @@ void ObjBean_Break(ObjBean* this, GlobalContext* globalCtx) { gravity = -100; arg5 = 64; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, gravity, arg5, 40, 3, 0, scale, 0, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, gravity, arg5, 40, 3, 0, scale, 0, 0, (s16)((scale >> 3) + 40), -1, 1, sBreakDlists[i & 1]); } } @@ -463,13 +463,13 @@ void ObjBean_Grown(ObjBean* this) { } } -void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_Init(Actor* thisx, PlayState* play) { s32 path; ObjBean* this = (ObjBean*)thisx; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); if (LINK_AGE_IN_YEARS == YEARS_ADULT) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) || (mREG(1) == 1)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || (mREG(1) == 1)) { path = (this->dyna.actor.params >> 8) & 0x1F; if (path == 0x1F) { osSyncPrintf(VT_COL(RED, WHITE)); @@ -480,7 +480,7 @@ void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->dyna.actor); return; } - if (globalCtx->setupPathList[path].count < 3) { + if (play->setupPathList[path].count < 3) { osSyncPrintf(VT_COL(RED, WHITE)); // "Incorrect number of path data" osSyncPrintf("パスデータ数が不正(%s %d)(arg_data %xH)\n", "../z_obj_bean.c", 921, @@ -489,24 +489,24 @@ void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->dyna.actor); return; } - ObjBean_SetupPathCount(this, globalCtx); - ObjBean_SetupPath(this, globalCtx); + ObjBean_SetupPathCount(this, play); + ObjBean_SetupPath(this, play); ObjBean_Move(this); ObjBean_SetupWaitForPlayer(this); - ObjBean_InitDynaPoly(this, globalCtx, &gMagicBeanPlatformCol, DPM_UNK3); + ObjBean_InitDynaPoly(this, play, &gMagicBeanPlatformCol, DPM_UNK3); this->stateFlags |= BEAN_STATE_DYNAPOLY_SET; - ObjBean_InitCollider(&this->dyna.actor, globalCtx); + ObjBean_InitCollider(&this->dyna.actor, play); this->stateFlags |= BEAN_STATE_COLLIDER_SET; ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 8.8f); - ObjBean_FindFloor(this, globalCtx); + ObjBean_FindFloor(this, play); this->unk_1F6 = this->dyna.actor.home.rot.z & 3; } else { Actor_Kill(&this->dyna.actor); return; } - } else if ((Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) != 0) || (mREG(1) == 1)) { + } else if ((Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) != 0) || (mREG(1) == 1)) { ObjBean_SetupWaitForWater(this); } else { ObjBean_SetupWaitForBean(this); @@ -516,14 +516,14 @@ void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(魔法の豆の木リフト)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void ObjBean_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_Destroy(Actor* thisx, PlayState* play) { ObjBean* this = (ObjBean*)thisx; if (this->stateFlags & BEAN_STATE_DYNAPOLY_SET) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } if (this->stateFlags & BEAN_STATE_COLLIDER_SET) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } if (D_80B90E30 == this) { D_80B90E30 = NULL; @@ -536,14 +536,14 @@ void ObjBean_SetupWaitForBean(ObjBean* this) { this->dyna.actor.textId = 0x2F; } -void ObjBean_WaitForBean(ObjBean* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->dyna.actor, globalCtx)) { - if (func_8002F368(globalCtx) == EXCH_ITEM_BEAN) { +void ObjBean_WaitForBean(ObjBean* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, play)) { + if (func_8002F368(play) == EXCH_ITEM_BEAN) { func_80B8FE00(this); - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); } } else { - func_8002F298(&this->dyna.actor, globalCtx, 40.0f, EXCH_ITEM_BEAN); + func_8002F298(&this->dyna.actor, play, 40.0f, EXCH_ITEM_BEAN); } } @@ -554,7 +554,7 @@ void func_80B8FE00(ObjBean* this) { } // Link is looking at the soft soil -void func_80B8FE3C(ObjBean* this, GlobalContext* globalCtx) { +void func_80B8FE3C(ObjBean* this, PlayState* play) { if (this->timer <= 0) { func_80B8FE6C(this); } @@ -567,7 +567,7 @@ void func_80B8FE6C(ObjBean* this) { } // The leaves are visable and growing -void func_80B8FEAC(ObjBean* this, GlobalContext* globalCtx) { +void func_80B8FEAC(ObjBean* this, PlayState* play) { s32 temp_v1 = true; temp_v1 &= Math_StepToF(&this->dyna.actor.scale.y, 0.16672663f, 0.01f); @@ -590,7 +590,7 @@ void func_80B8FF50(ObjBean* this) { this->unk_1B6.x = 0x33E9; } -void func_80B8FF8C(ObjBean* this, GlobalContext* globalCtx) { +void func_80B8FF8C(ObjBean* this, PlayState* play) { this->unk_1B6.x -= 0x960; this->dyna.actor.scale.y = Math_SinS(this->unk_1B6.x) * 0.17434467f; this->dyna.actor.scale.x = this->dyna.actor.scale.z = Math_CosS(this->unk_1B6.x) * 0.12207746f; @@ -607,7 +607,7 @@ void func_80B90010(ObjBean* this) { } // Control is returned to the player and the leaves start to flatten out -void func_80B90050(ObjBean* this, GlobalContext* globalCtx) { +void func_80B90050(ObjBean* this, PlayState* play) { s16 temp_a0; f32 temp_f2; @@ -629,19 +629,19 @@ void ObjBean_SetupWaitForWater(ObjBean* this) { ObjBean_SetupLeavesStill(this); } -void ObjBean_WaitForWater(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_WaitForWater(ObjBean* this, PlayState* play) { this->transformFunc(this); - if (!(this->stateFlags & BEAN_STATE_BEEN_WATERED) && Flags_GetEnv(globalCtx, 5) && (D_80B90E30 == NULL) && + if (!(this->stateFlags & BEAN_STATE_BEEN_WATERED) && Flags_GetEnv(play, 5) && (D_80B90E30 == NULL) && (this->dyna.actor.xzDistToPlayer < 50.0f)) { ObjBean_SetupGrowWaterPhase1(this); D_80B90E30 = this; - OnePointCutscene_Init(globalCtx, 2210, -99, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 2210, -99, &this->dyna.actor, CAM_ID_MAIN); this->dyna.actor.flags |= ACTOR_FLAG_4; return; } - if ((D_80B90E30 == this) && !Flags_GetEnv(globalCtx, 5)) { + if ((D_80B90E30 == this) && !Flags_GetEnv(play, 5)) { D_80B90E30 = NULL; if (D_80B90E30) {} } @@ -655,7 +655,7 @@ void ObjBean_SetupGrowWaterPhase1(ObjBean* this) { } // Camera moves and leaves move quickly -void ObjBean_GrowWaterPhase1(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_GrowWaterPhase1(ObjBean* this, PlayState* play) { this->transformFunc(this); if (this->timer <= 0) { ObjBean_SetupGrowWaterPhase2(this); @@ -669,7 +669,7 @@ void ObjBean_SetupGrowWaterPhase2(ObjBean* this) { } // BeanStalk is visable and is growing -void ObjBean_GrowWaterPhase2(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_GrowWaterPhase2(ObjBean* this, PlayState* play) { this->transformFunc(this); this->stalkSizeMultiplier += 0.001f; this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y + (s16)(this->stalkSizeMultiplier * 700000.0f); @@ -687,7 +687,7 @@ void ObjBean_SetupGrowWaterPhase3(ObjBean* this) { } // Fully grown and drops items -void ObjBean_GrowWaterPhase3(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_GrowWaterPhase3(ObjBean* this, PlayState* play) { s32 i; Vec3f itemDropPos; @@ -700,7 +700,7 @@ void ObjBean_GrowWaterPhase3(ObjBean* this, GlobalContext* globalCtx) { itemDropPos.y = this->dyna.actor.world.pos.y - 25.0f; itemDropPos.z = this->dyna.actor.world.pos.z; for (i = 0; i < 3; i++) { - Item_DropCollectible(globalCtx, &itemDropPos, ITEM00_FLEXIBLE); + Item_DropCollectible(play, &itemDropPos, ITEM00_FLEXIBLE); } this->stateFlags |= BEAN_STATE_BEEN_WATERED; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); @@ -718,7 +718,7 @@ void ObjBean_SetupGrowWaterPhase4(ObjBean* this) { } // Return control back to the player and start to shrink back down -void ObjBean_GrowWaterPhase4(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_GrowWaterPhase4(ObjBean* this, PlayState* play) { this->transformFunc(this); this->stalkSizeMultiplier -= 0.001f; this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y + (s16)(this->stalkSizeMultiplier * 700000.0f); @@ -736,7 +736,7 @@ void ObjBean_SetupGrowWaterPhase5(ObjBean* this) { this->timer = 30; } -void ObjBean_GrowWaterPhase5(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_GrowWaterPhase5(ObjBean* this, PlayState* play) { this->transformFunc(this); if (this->timer <= 0) { func_80B8FF50(this); @@ -749,13 +749,13 @@ void ObjBean_SetupWaitForPlayer(ObjBean* this) { ObjBean_SetDrawMode(this, BEAN_STATE_DRAW_PLANT); } -void ObjBean_WaitForPlayer(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_WaitForPlayer(ObjBean* this, PlayState* play) { if (func_8004356C(&this->dyna)) { // Player is standing on ObjBean_SetupFly(this); - if (globalCtx->sceneNum == SCENE_SPOT10) { // Lost woods - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_LOST_WOODS); + if (play->sceneNum == SCENE_SPOT10) { // Lost woods + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_LOST_WOODS); } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_GENERIC); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_GENERIC); } } ObjBean_UpdatePosition(this); @@ -768,17 +768,17 @@ void ObjBean_SetupFly(ObjBean* this) { this->dyna.actor.flags |= ACTOR_FLAG_4; // Never stop updating } -void ObjBean_Fly(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_Fly(ObjBean* this, PlayState* play) { Camera* mainCam; - ObjBean_FollowPath(this, globalCtx); + ObjBean_FollowPath(this, play); if (this->currentPointIndex == this->pathCount) { - ObjBean_SetupPathCount(this, globalCtx); - ObjBean_SetupPath(this, globalCtx); + ObjBean_SetupPathCount(this, play); + ObjBean_SetupPath(this, play); ObjBean_SetupWaitForStepOff(this); this->dyna.actor.flags &= ~ACTOR_FLAG_4; // Never stop updating (disable) - mainCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; + mainCam = play->cameraPtrs[CAM_ID_MAIN]; if ((mainCam->setting == CAM_SET_BEAN_LOST_WOODS) || (mainCam->setting == CAM_SET_BEAN_GENERIC)) { Camera_ChangeSetting(mainCam, CAM_SET_NORMAL0); @@ -788,13 +788,13 @@ void ObjBean_Fly(ObjBean* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_PL_PLANT_MOVE - SFX_FLAG); - if (globalCtx->sceneNum == SCENE_SPOT10) { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_LOST_WOODS); + if (play->sceneNum == SCENE_SPOT10) { + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_LOST_WOODS); } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_GENERIC); + Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_GENERIC); } } else if (this->stateFlags & BEAN_STATE_PLAYER_ON_TOP) { - mainCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; + mainCam = play->cameraPtrs[CAM_ID_MAIN]; if ((mainCam->setting == CAM_SET_BEAN_LOST_WOODS) || (mainCam->setting == CAM_SET_BEAN_GENERIC)) { Camera_ChangeSetting(mainCam, CAM_SET_NORMAL0); @@ -809,7 +809,7 @@ void ObjBean_SetupWaitForStepOff(ObjBean* this) { ObjBean_SetDrawMode(this, BEAN_STATE_DRAW_PLANT); } -void ObjBean_WaitForStepOff(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_WaitForStepOff(ObjBean* this, PlayState* play) { if (!func_80043590(&this->dyna)) { ObjBean_SetupWaitForPlayer(this); } @@ -821,10 +821,10 @@ void func_80B908EC(ObjBean* this) { ObjBean_SetDrawMode(this, 0); } -void func_80B90918(ObjBean* this, GlobalContext* globalCtx) { +void func_80B90918(ObjBean* this, PlayState* play) { if (!func_8004356C(&this->dyna)) { - ObjBean_SetupPathCount(this, globalCtx); - ObjBean_SetupPath(this, globalCtx); + ObjBean_SetupPathCount(this, play); + ObjBean_SetupPath(this, play); ObjBean_Move(this); func_80B90970(this); } @@ -837,8 +837,8 @@ void func_80B90970(ObjBean* this) { func_80B8EDF4(this); } -void func_80B909B0(ObjBean* this, GlobalContext* globalCtx) { - if (ObjBean_CheckForHorseTrample(this, globalCtx)) { +void func_80B909B0(ObjBean* this, PlayState* play) { + if (ObjBean_CheckForHorseTrample(this, play)) { this->timer = 100; } else if (this->timer <= 0) { func_80B909F8(this); @@ -851,21 +851,21 @@ void func_80B909F8(ObjBean* this) { this->timer = 30; } -void func_80B90A34(ObjBean* this, GlobalContext* globalCtx) { - s32 trampled = ObjBean_CheckForHorseTrample(this, globalCtx); +void func_80B90A34(ObjBean* this, PlayState* play) { + s32 trampled = ObjBean_CheckForHorseTrample(this, play); func_80B8EE24(this); if (trampled) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } if ((this->timer <= 0) && (!trampled)) { func_80B8EBC8(this); ObjBean_SetupWaitForPlayer(this); } } -void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_Update(Actor* thisx, PlayState* play) { s32 pad; ObjBean* this = (ObjBean*)thisx; @@ -873,28 +873,28 @@ void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->stateFlags & BEAN_STATE_DRAW_PLANT) { ObjBean_Move(this); if (this->dyna.actor.xzDistToPlayer < 150.0f) { this->collider.dim.radius = this->dyna.actor.scale.x * 640.0f + 0.5f; Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - ObjBean_FindFloor(this, globalCtx); + ObjBean_FindFloor(this, play); this->dyna.actor.shape.shadowDraw = ActorShadow_DrawCircle; this->dyna.actor.shape.shadowScale = this->dyna.actor.scale.x * 88.0f; - if (ObjBean_CheckForHorseTrample(this, globalCtx)) { + if (ObjBean_CheckForHorseTrample(this, play)) { osSyncPrintf(VT_FGCOL(CYAN)); // "Horse and bean tree lift collision" osSyncPrintf("馬と豆の木リフト衝突!!!\n"); osSyncPrintf(VT_RST); - ObjBean_Break(this, globalCtx); - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + ObjBean_Break(this, play); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); func_80B908EC(this); } } else { @@ -910,35 +910,35 @@ void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjBean_DrawSoftSoilSpot(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_DrawSoftSoilSpot(ObjBean* this, PlayState* play) { Matrix_Translate(this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, this->dyna.actor.home.pos.z, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.home.rot.y), MTXMODE_APPLY); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, gMagicBeanSoftSoilDL); + Gfx_DrawDListOpa(play, gMagicBeanSoftSoilDL); } -void ObjBean_DrawBeanstalk(ObjBean* this, GlobalContext* globalCtx) { +void ObjBean_DrawBeanstalk(ObjBean* this, PlayState* play) { Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.shape.rot.y), MTXMODE_APPLY); Matrix_Scale(0.1f, this->stalkSizeMultiplier, 0.1f, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, gMagicBeanStemDL); + Gfx_DrawDListOpa(play, gMagicBeanStemDL); } -void ObjBean_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_Draw(Actor* thisx, PlayState* play) { ObjBean* this = (ObjBean*)thisx; if (this->stateFlags & BEAN_STATE_DRAW_SOIL) { - Gfx_DrawDListOpa(globalCtx, gMagicBeanSeedlingDL); + Gfx_DrawDListOpa(play, gMagicBeanSeedlingDL); } if (this->stateFlags & BEAN_STATE_DRAW_PLANT) { - Gfx_DrawDListOpa(globalCtx, gMagicBeanPlatformDL); + Gfx_DrawDListOpa(play, gMagicBeanPlatformDL); } if (this->stateFlags & BEAN_STATE_DRAW_LEAVES) { - ObjBean_DrawSoftSoilSpot(this, globalCtx); + ObjBean_DrawSoftSoilSpot(this, play); } if (this->stateFlags & BEAN_STATE_DRAW_STALK) { - ObjBean_DrawBeanstalk(this, globalCtx); + ObjBean_DrawBeanstalk(this, play); } } diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h index aca116f15e..317db48216 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h @@ -6,7 +6,7 @@ struct ObjBean; -typedef void (*ObjBeanActionFunc)(struct ObjBean*, GlobalContext*); +typedef void (*ObjBeanActionFunc)(struct ObjBean*, PlayState*); typedef void (*ObjBeanTransformFunc)(struct ObjBean*); typedef struct ObjBean { 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 27ddda3c9e..d2a1d00bc8 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c @@ -9,9 +9,9 @@ #define FLAGS 0 -void ObjBlockstop_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBlockstop_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjBlockstop_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjBlockstop_Init(Actor* thisx, PlayState* play); +void ObjBlockstop_Destroy(Actor* thisx, PlayState* play); +void ObjBlockstop_Update(Actor* thisx, PlayState* play); const ActorInit Obj_Blockstop_InitVars = { ACTOR_OBJ_BLOCKSTOP, @@ -25,29 +25,29 @@ const ActorInit Obj_Blockstop_InitVars = { NULL, }; -void ObjBlockstop_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBlockstop_Init(Actor* thisx, PlayState* play) { ObjBlockstop* this = (ObjBlockstop*)thisx; - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { Actor_Kill(&this->actor); } else { this->actor.world.pos.y++; } } -void ObjBlockstop_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjBlockstop_Destroy(Actor* thisx, PlayState* play) { } -void ObjBlockstop_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBlockstop_Update(Actor* thisx, PlayState* play) { ObjBlockstop* this = (ObjBlockstop*)thisx; DynaPolyActor* dynaPolyActor; Vec3f sp4C; s32 bgId; s32 pad; - if (BgCheck_EntityLineTest2(&globalCtx->colCtx, &this->actor.home.pos, &this->actor.world.pos, &sp4C, + 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(&globalCtx->colCtx, bgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_OBJ_OSHIHIKI) { if ((dynaPolyActor->actor.params & 0x000F) == PUSHBLOCK_HUGE_START_ON || @@ -57,7 +57,7 @@ void ObjBlockstop_Update(Actor* thisx, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); } - Flags_SetSwitch(globalCtx, this->actor.params); + Flags_SetSwitch(play, this->actor.params); Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index 90ab302d86..c64c71e296 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -10,13 +10,13 @@ #define FLAGS 0 -void ObjBombiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBombiwa_InitCollision(Actor* thisx, GlobalContext* globalCtx); -void ObjBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjBombiwa_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjBombiwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjBombiwa_Init(Actor* thisx, PlayState* play); +void ObjBombiwa_InitCollision(Actor* thisx, PlayState* play); +void ObjBombiwa_Destroy(Actor* thisx, PlayState* play); +void ObjBombiwa_Update(Actor* thisx, PlayState* play); +void ObjBombiwa_Draw(Actor* thisx, PlayState* play); -void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx); +void ObjBombiwa_Break(ObjBombiwa* this, PlayState* play); const ActorInit Obj_Bombiwa_InitVars = { ACTOR_OBJ_BOMBIWA, @@ -63,18 +63,18 @@ static s16 sEffectScales[] = { 17, 14, 10, 8, 7, 5, 3, 2, }; -void ObjBombiwa_InitCollision(Actor* thisx, GlobalContext* globalCtx) { +void ObjBombiwa_InitCollision(Actor* thisx, PlayState* play) { ObjBombiwa* this = (ObjBombiwa*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); } -void ObjBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBombiwa_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); - ObjBombiwa_InitCollision(thisx, globalCtx); - if ((Flags_GetSwitch(globalCtx, thisx->params & 0x3F) != 0)) { + ObjBombiwa_InitCollision(thisx, play); + if ((Flags_GetSwitch(play, thisx->params & 0x3F) != 0)) { Actor_Kill(thisx); } else { CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); @@ -89,14 +89,14 @@ void ObjBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjBombiwa_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjBombiwa* this = (ObjBombiwa*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx) { +void ObjBombiwa_Break(ObjBombiwa* this, PlayState* play) { Vec3f pos; Vec3f velocity; Gfx* dlist; @@ -114,21 +114,21 @@ void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx) { velocity.z = (Rand_ZeroOne() - 0.5f) * 15.0f; scale = sEffectScales[i]; arg5 = (scale >= 11) ? 37 : 33; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -400, arg5, 10, 2, 0, scale, 1, 0, 80, KAKERA_COLOR_NONE, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -400, arg5, 10, 2, 0, scale, 1, 0, 80, KAKERA_COLOR_NONE, OBJECT_BOMBIWA, dlist); } - func_80033480(globalCtx, &this->actor.world.pos, 60.0f, 8, 100, 160, 1); + func_80033480(play, &this->actor.world.pos, 60.0f, 8, 100, 160, 1); } -void ObjBombiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBombiwa_Update(Actor* thisx, PlayState* play) { ObjBombiwa* this = (ObjBombiwa*)thisx; s32 pad; - if ((func_80033684(globalCtx, &this->actor) != NULL) || + if ((func_80033684(play, &this->actor) != NULL) || ((this->collider.base.acFlags & AC_HIT) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x40000040))) { - ObjBombiwa_Break(this, globalCtx); - Flags_SetSwitch(globalCtx, this->actor.params & 0x3F); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); + ObjBombiwa_Break(this, play); + Flags_SetSwitch(play, this->actor.params & 0x3F); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); if (((this->actor.params >> 0xF) & 1) != 0) { func_80078884(NA_SE_SY_CORRECT_CHIME); } @@ -136,12 +136,12 @@ void ObjBombiwa_Update(Actor* thisx, GlobalContext* globalCtx) { } else { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.xzDistToPlayer < 800.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } -void ObjBombiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_bombiwa_DL_0009E0); +void ObjBombiwa_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_bombiwa_DL_0009E0); } diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index bf7edd9690..0e9204fd8a 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -10,15 +10,15 @@ #define FLAGS 0 -void ObjComb_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjComb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjComb_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjComb_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjComb_Init(Actor* thisx, PlayState* play); +void ObjComb_Destroy(Actor* thisx, PlayState* play); +void ObjComb_Update(Actor* thisx, PlayState* play); +void ObjComb_Draw(Actor* thisx, PlayState* play); -void ObjComb_Break(ObjComb* this, GlobalContext* globalCtx); -void ObjComb_ChooseItemDrop(ObjComb* this, GlobalContext* globalCtx); +void ObjComb_Break(ObjComb* this, PlayState* play); +void ObjComb_ChooseItemDrop(ObjComb* this, PlayState* play); void ObjComb_SetupWait(ObjComb* this); -void ObjComb_Wait(ObjComb* this, GlobalContext* globalCtx); +void ObjComb_Wait(ObjComb* this, PlayState* play); const ActorInit Obj_Comb_InitVars = { ACTOR_OBJ_COMB, @@ -66,7 +66,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 900, ICHAIN_STOP), }; -void ObjComb_Break(ObjComb* this, GlobalContext* globalCtx) { +void ObjComb_Break(ObjComb* this, PlayState* play) { Vec3f pos1; Vec3f pos; Vec3f velocity; @@ -117,22 +117,22 @@ void ObjComb_Break(ObjComb* this, GlobalContext* globalCtx) { arg5 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, gravity, arg5, arg6, 4, 0, scale, 0, 0, 80, - KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_FIELD_KEEP, dlist); + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, gravity, arg5, arg6, 4, 0, scale, 0, 0, 80, KAKERA_COLOR_NONE, + OBJECT_GAMEPLAY_FIELD_KEEP, dlist); } pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y - 10.0f; pos.z = this->actor.world.pos.z; - func_80033480(globalCtx, &pos, 40.0f, 6, 70, 60, 1); + func_80033480(play, &pos, 40.0f, 6, 70, 60, 1); } -void ObjComb_ChooseItemDrop(ObjComb* this, GlobalContext* globalCtx) { +void ObjComb_ChooseItemDrop(ObjComb* this, PlayState* play) { s16 params = this->actor.params & 0x1F; if ((params > 0) || (params < ITEM00_MAX)) { // conditional always true. May have been intended to be && if (params == ITEM00_HEART_PIECE) { - if (Flags_GetCollectible(globalCtx, (this->actor.params >> 8) & 0x3F)) { + if (Flags_GetCollectible(play, (this->actor.params >> 8) & 0x3F)) { params = -1; } else { params = (params | (((this->actor.params >> 8) & 0x3F) << 8)); @@ -141,32 +141,32 @@ void ObjComb_ChooseItemDrop(ObjComb* this, GlobalContext* globalCtx) { params = -1; } if (params >= 0) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, params); + Item_DropCollectible(play, &this->actor.world.pos, params); } } } -void ObjComb_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjComb_Init(Actor* thisx, PlayState* play) { ObjComb* this = (ObjComb*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); ObjComb_SetupWait(this); } -void ObjComb_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjComb_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjComb* this = (ObjComb*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void ObjComb_SetupWait(ObjComb* this) { this->actionFunc = ObjComb_Wait; } -void ObjComb_Wait(ObjComb* this, GlobalContext* globalCtx) { +void ObjComb_Wait(ObjComb* this, PlayState* play) { s32 dmgFlags; this->unk_1B0 -= 50; @@ -180,33 +180,33 @@ void ObjComb_Wait(ObjComb* this, GlobalContext* globalCtx) { if (dmgFlags & 0x4001F866) { this->unk_1B0 = 1500; } else { - ObjComb_Break(this, globalCtx); - ObjComb_ChooseItemDrop(this, globalCtx); + ObjComb_Break(this, play); + ObjComb_ChooseItemDrop(this, play); Actor_Kill(&this->actor); } } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actor.update != NULL) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void ObjComb_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjComb_Update(Actor* thisx, PlayState* play) { ObjComb* this = (ObjComb*)thisx; this->unk_1B2 += 0x2EE0; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.shape.rot.x = Math_SinS(this->unk_1B2) * this->unk_1B0 + this->actor.home.rot.x; } -void ObjComb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjComb_Draw(Actor* thisx, PlayState* play) { ObjComb* this = (ObjComb*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_comb.c", 369); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_comb.c", 369); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + (118.0f * this->actor.scale.y), this->actor.world.pos.z, MTXMODE_NEW); @@ -216,12 +216,12 @@ void ObjComb_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0, -(this->actor.scale.y * 118.0f), 0, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_comb.c", 394), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_comb.c", 394), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFieldBeehiveDL); Collider_UpdateSpheres(0, &this->collider); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_comb.c", 402); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_comb.c", 402); } diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h index bb690b0b6d..3a6ce86413 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h @@ -6,7 +6,7 @@ struct ObjComb; -typedef void (*ObjCombActionFunc)(struct ObjComb*, GlobalContext*); +typedef void (*ObjCombActionFunc)(struct ObjComb*, PlayState*); typedef struct ObjComb { /* 0x0000 */ Actor actor; 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 2d3ed78ee2..57410a47af 100644 --- a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void ObjDekujr_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjDekujr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjDekujr_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjDekujr_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjDekujr_Init(Actor* thisx, PlayState* play); +void ObjDekujr_Destroy(Actor* thisx, PlayState* play); +void ObjDekujr_Update(Actor* thisx, PlayState* play); +void ObjDekujr_Draw(Actor* thisx, PlayState* play); -void ObjDekujr_ComeUp(ObjDekujr* this, GlobalContext* globalCtx); +void ObjDekujr_ComeUp(ObjDekujr* this, PlayState* play); const ActorInit Obj_Dekujr_InitVars = { ACTOR_OBJ_DEKUJR, @@ -40,7 +40,7 @@ static ColliderCylinderInitToActor sCylinderInit = { { 60, 80, 0, { 0, 0, 0 } }, }; -void ObjDekujr_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjDekujr_Init(Actor* thisx, PlayState* play) { ObjDekujr* this = (ObjDekujr*)thisx; s32 pad; @@ -59,16 +59,16 @@ void ObjDekujr_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(thisx); } else { ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); sCylinderInit.base.actor = thisx; - Collider_SetCylinderToActor(globalCtx, &this->collider, &sCylinderInit); + Collider_SetCylinderToActor(play, &this->collider, &sCylinderInit); thisx->colChkInfo.mass = MASS_IMMOVABLE; - thisx->textId = func_80037C30(globalCtx, 0xF); + thisx->textId = func_80037C30(play, 0xF); Actor_SetScale(thisx, 0.4f); } } -void ObjDekujr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjDekujr_Destroy(Actor* thisx, PlayState* play) { } void ObjDekujr_SetInitialPos(CsCmdActorAction* npcAction, Vec3f* initPos) { @@ -83,7 +83,7 @@ void ObjDekujr_SetFinalPos(CsCmdActorAction* npcAction, Vec3f* finalPos) { finalPos->z = npcAction->endPos.z; } -void ObjDekujr_ComeUp(ObjDekujr* this, GlobalContext* globalCtx) { +void ObjDekujr_ComeUp(ObjDekujr* this, PlayState* play) { CsCmdActorAction* csCmdNPCAction; Vec3f initPos; Vec3f finalPos; @@ -91,14 +91,14 @@ void ObjDekujr_ComeUp(ObjDekujr* this, GlobalContext* globalCtx) { f32 actionLength; f32 gravity; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { this->unk_19C = 2; this->unk_19B = 0; } else { - if (globalCtx->csCtx.frames == 351) { + if (play->csCtx.frames == 351) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_COME_UP_DEKU_JR); } - csCmdNPCAction = globalCtx->csCtx.npcActions[1]; + csCmdNPCAction = play->csCtx.npcActions[1]; if (csCmdNPCAction != NULL) { ObjDekujr_SetInitialPos(csCmdNPCAction, &initPos); ObjDekujr_SetFinalPos(csCmdNPCAction, &finalPos); @@ -110,7 +110,7 @@ void ObjDekujr_ComeUp(ObjDekujr* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = csCmdNPCAction->urot.y; this->actor.shape.rot.z = csCmdNPCAction->urot.z; this->actor.velocity = velocity; - if (csCmdNPCAction->endFrame >= globalCtx->csCtx.frames) { + if (csCmdNPCAction->endFrame >= play->csCtx.frames) { actionLength = csCmdNPCAction->endFrame - csCmdNPCAction->startFrame; this->actor.velocity.x = (finalPos.x - initPos.x) / actionLength; gravity = this->actor.gravity; @@ -125,46 +125,45 @@ void ObjDekujr_ComeUp(ObjDekujr* this, GlobalContext* globalCtx) { } } -void ObjDekujr_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjDekujr_Update(Actor* thisx, PlayState* play) { ObjDekujr* this = (ObjDekujr*)thisx; s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if ((gSaveContext.cutsceneIndex >= 0xFFF0) && (this->unk_19B == 0)) { this->unk_19C = 0; this->unk_19B = 1; } if (this->unk_19B == 1) { - ObjDekujr_ComeUp(this, globalCtx); + ObjDekujr_ComeUp(this, play); this->actor.world.pos.x += this->actor.velocity.x; this->actor.world.pos.y += this->actor.velocity.y; this->actor.world.pos.z += this->actor.velocity.z; } else { - func_80037D98(globalCtx, &this->actor, 0xF, &this->unk_1A0); + func_80037D98(play, &this->actor, 0xF, &this->unk_1A0); Actor_SetFocus(&this->actor, 40.0f); } } -void ObjDekujr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjDekujr_Draw(Actor* thisx, PlayState* play) { u32 frameCount; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 370); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_dekujr.c", 370); - func_80093D18(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 379), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_dekujr.c", 379), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_dekujr_DL_0030D0); - frameCount = globalCtx->state.frames; - gSPSegment( - POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frameCount % 128, 0, 32, 32, 1, frameCount % 128, 0, 32, 32)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 399), + frameCount = play->state.frames; + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frameCount % 128, 0, 32, 32, 1, frameCount % 128, 0, 32, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_dekujr.c", 399), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_dekujr_DL_0032D8); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 409); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_dekujr.c", 409); } diff --git a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c index 74b52faff6..131b7ac791 100644 --- a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c +++ b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c @@ -9,15 +9,15 @@ #define FLAGS 0 -void ObjElevator_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjElevator_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjElevator_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjElevator_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjElevator_Init(Actor* thisx, PlayState* play); +void ObjElevator_Destroy(Actor* thisx, PlayState* play); +void ObjElevator_Update(Actor* thisx, PlayState* play); +void ObjElevator_Draw(Actor* thisx, PlayState* play); void func_80B92C5C(ObjElevator* this); -void func_80B92C80(ObjElevator* this, GlobalContext* globalCtx); +void func_80B92C80(ObjElevator* this, PlayState* play); void func_80B92D20(ObjElevator* this); -void func_80B92D44(ObjElevator* this, GlobalContext* globalCtx); +void func_80B92D44(ObjElevator* this, PlayState* play); const ActorInit Obj_Elevator_InitVars = { ACTOR_OBJ_ELEVATOR, @@ -43,7 +43,7 @@ void ObjElevator_SetupAction(ObjElevator* this, ObjElevatorActionFunc actionFunc this->actionFunc = actionFunc; } -void func_80B92B08(ObjElevator* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flag) { +void func_80B92B08(ObjElevator* this, PlayState* play, CollisionHeader* collision, s32 flag) { s16 pad1; CollisionHeader* colHeader = NULL; s16 pad2; @@ -51,18 +51,18 @@ void func_80B92B08(ObjElevator* this, GlobalContext* globalCtx, CollisionHeader* DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_elevator.c", 136, thisx->id, thisx->params); } } -void ObjElevator_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjElevator_Init(Actor* thisx, PlayState* play) { ObjElevator* this = (ObjElevator*)thisx; f32 temp_f0; - func_80B92B08(this, globalCtx, &object_d_elevator_Col_000360, DPM_PLAYER); + func_80B92B08(this, play, &object_d_elevator_Col_000360, DPM_PLAYER); Actor_SetScale(thisx, sScales[thisx->params & 1]); Actor_ProcessInitChain(thisx, sInitChain); temp_f0 = (thisx->params >> 8) & 0xF; @@ -71,17 +71,17 @@ void ObjElevator_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(Dungeon Elevator)(arg_data 0x%04x)\n", thisx->params); } -void ObjElevator_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjElevator_Destroy(Actor* thisx, PlayState* play) { ObjElevator* this = (ObjElevator*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80B92C5C(ObjElevator* this) { ObjElevator_SetupAction(this, func_80B92C80); } -void func_80B92C80(ObjElevator* this, GlobalContext* globalCtx) { +void func_80B92C80(ObjElevator* this, PlayState* play) { f32 sub; Actor* thisx = &this->dyna.actor; @@ -100,7 +100,7 @@ void func_80B92D20(ObjElevator* this) { ObjElevator_SetupAction(this, func_80B92D44); } -void func_80B92D44(ObjElevator* this, GlobalContext* globalCtx) { +void func_80B92D44(ObjElevator* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (fabsf(Math_SmoothStepToF(&thisx->world.pos.y, this->unk_168, 1.0f, this->unk_16C, 0.0f)) < 0.001f) { @@ -111,15 +111,15 @@ void func_80B92D44(ObjElevator* this, GlobalContext* globalCtx) { } } -void ObjElevator_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjElevator_Update(Actor* thisx, PlayState* play) { ObjElevator* this = (ObjElevator*)thisx; if (this->actionFunc) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } this->unk_170 = this->dyna.unk_160; } -void ObjElevator_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_d_elevator_DL_000180); +void ObjElevator_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_d_elevator_DL_000180); } diff --git a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h index 735355f508..e77d04a9ae 100644 --- a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h +++ b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h @@ -6,7 +6,7 @@ struct ObjElevator; -typedef void (*ObjElevatorActionFunc)(struct ObjElevator*, GlobalContext*); +typedef void (*ObjElevatorActionFunc)(struct ObjElevator*, PlayState*); typedef struct ObjElevator { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c index 54bf0cf852..012b8e5588 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void ObjHamishi_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHamishi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHamishi_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHamishi_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHamishi_Init(Actor* thisx, PlayState* play); +void ObjHamishi_Destroy(Actor* thisx, PlayState* play); +void ObjHamishi_Update(Actor* thisx, PlayState* play); +void ObjHamishi_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Hamishi_InitVars = { ACTOR_OBJ_HAMISHI, @@ -59,11 +59,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 500, ICHAIN_STOP), }; -void ObjHamishi_InitCollision(Actor* thisx, GlobalContext* globalCtx) { +void ObjHamishi_InitCollision(Actor* thisx, PlayState* play) { ObjHamishi* this = (ObjHamishi*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); } @@ -90,7 +90,7 @@ void ObjHamishi_Shake(ObjHamishi* this) { } } -void ObjHamishi_Break(ObjHamishi* this, GlobalContext* globalCtx) { +void ObjHamishi_Break(ObjHamishi* this, PlayState* play) { s32 pad; Vec3f velocity; Vec3f pos; @@ -126,30 +126,30 @@ void ObjHamishi_Break(ObjHamishi* this, GlobalContext* globalCtx) { gravity = -320; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, gravity, phi_v0, 30, 5, 0, - sEffectScales[i], 3, 0, 70, 1, OBJECT_GAMEPLAY_FIELD_KEEP, gSilverRockFragmentsDL); + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, gravity, phi_v0, 30, 5, 0, sEffectScales[i], + 3, 0, 70, 1, OBJECT_GAMEPLAY_FIELD_KEEP, gSilverRockFragmentsDL); } - func_80033480(globalCtx, &this->actor.world.pos, 140.0f, 6, 180, 90, 1); - func_80033480(globalCtx, &this->actor.world.pos, 140.0f, 12, 80, 90, 1); + func_80033480(play, &this->actor.world.pos, 140.0f, 6, 180, 90, 1); + func_80033480(play, &this->actor.world.pos, 140.0f, 12, 80, 90, 1); } -void ObjHamishi_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHamishi_Init(Actor* thisx, PlayState* play) { ObjHamishi* this = (ObjHamishi*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.uncullZoneForward += 1000.0f; } if (this->actor.shape.rot.y == 0) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.home.rot.y = Rand_ZeroFloat(65536.0f); } - ObjHamishi_InitCollision(&this->actor, globalCtx); + ObjHamishi_InitCollision(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->actor.params & 0x3F)) { Actor_Kill(&this->actor); return; } @@ -157,16 +157,16 @@ void ObjHamishi_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 80.0f; } -void ObjHamishi_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjHamishi_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjHamishi* this = (ObjHamishi*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void ObjHamishi_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHamishi_Update(Actor* thisx, PlayState* play) { ObjHamishi* this = (ObjHamishi*)thisx; - CollisionCheckContext* colChkCtx = &globalCtx->colChkCtx; + CollisionCheckContext* colChkCtx = &play->colChkCtx; ObjHamishi_Shake(this); @@ -178,30 +178,30 @@ void ObjHamishi_Update(Actor* thisx, GlobalContext* globalCtx) { this->shakePosSize = 2.0f; this->shakeRotSize = 400.0f; } else { - ObjHamishi_Break(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); - Flags_SetSwitch(globalCtx, this->actor.params & 0x3F); + ObjHamishi_Break(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + Flags_SetSwitch(play, this->actor.params & 0x3F); Actor_Kill(&this->actor); } } else { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.xzDistToPlayer < 600.0f) { - CollisionCheck_SetAC(globalCtx, colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, colChkCtx, &this->collider.base); } } } -void ObjHamishi_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_hamishi.c", 399); +void ObjHamishi_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx, "../z_obj_hamishi.c", 399); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_hamishi.c", 404), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_hamishi.c", 404), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 170, 130, 255); gSPDisplayList(POLY_OPA_DISP++, gSilverRockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_hamishi.c", 411); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_hamishi.c", 411); } diff --git a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c index 2665ac068d..1247640c05 100644 --- a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c +++ b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c @@ -9,10 +9,10 @@ #define FLAGS 0 -void ObjHana_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHana_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHana_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHana_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHana_Init(Actor* thisx, PlayState* play); +void ObjHana_Destroy(Actor* thisx, PlayState* play); +void ObjHana_Update(Actor* thisx, PlayState* play); +void ObjHana_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Hana_InitVars = { ACTOR_OBJ_HANA, @@ -69,7 +69,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; -void ObjHana_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHana_Init(Actor* thisx, PlayState* play) { ObjHana* this = (ObjHana*)thisx; s16 type = this->actor.params & 3; HanaParams* params = &sHanaParams[type]; @@ -78,8 +78,8 @@ void ObjHana_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, params->scale); this->actor.shape.yOffset = params->yOffset; if (params->radius >= 0) { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = params->radius; this->collider.dim.height = params->height; @@ -91,22 +91,22 @@ void ObjHana_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjHana_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjHana_Destroy(Actor* thisx, PlayState* play) { ObjHana* this = (ObjHana*)thisx; if (sHanaParams[this->actor.params & 3].radius >= 0) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void ObjHana_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHana_Update(Actor* thisx, PlayState* play) { ObjHana* this = (ObjHana*)thisx; if (sHanaParams[this->actor.params & 3].radius >= 0 && this->actor.xzDistToPlayer < 400.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void ObjHana_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sHanaParams[thisx->params & 3].dList); +void ObjHana_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sHanaParams[thisx->params & 3].dList); } diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index b255867c65..7e6a59abbb 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -9,13 +9,13 @@ #define FLAGS 0 -void ObjHsblock_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHsblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHsblock_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHsblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHsblock_Init(Actor* thisx, PlayState* play); +void ObjHsblock_Destroy(Actor* thisx, PlayState* play); +void ObjHsblock_Update(Actor* thisx, PlayState* play); +void ObjHsblock_Draw(Actor* thisx, PlayState* play); -void func_80B93DF4(ObjHsblock* this, GlobalContext* globalCtx); -void func_80B93E5C(ObjHsblock* this, GlobalContext* globalCtx); +void func_80B93DF4(ObjHsblock* this, PlayState* play); +void func_80B93E5C(ObjHsblock* this, PlayState* play); void func_80B93D90(ObjHsblock* this); void func_80B93DB0(ObjHsblock* this); @@ -52,34 +52,34 @@ void ObjHsblock_SetupAction(ObjHsblock* this, ObjHsblockActionFunc actionFunc) { this->actionFunc = actionFunc; } -void func_80B93B68(ObjHsblock* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlags) { +void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision, s32 moveFlags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2[2]; DynaPolyActor_Init(&this->dyna, moveFlags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_hsblock.c", 163, this->dyna.actor.id, this->dyna.actor.params); } } -void func_80B93BF0(ObjHsblock* this, GlobalContext* globalCtx) { +void func_80B93BF0(ObjHsblock* this, PlayState* play) { if ((this->dyna.actor.params >> 5) & 1) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_OBJ_ICE_POLY, - this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, - this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, 1); + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_ICE_POLY, this->dyna.actor.world.pos.x, + this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.world.rot.x, + this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, 1); } } -void ObjHsblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHsblock_Init(Actor* thisx, PlayState* play) { ObjHsblock* this = (ObjHsblock*)thisx; - func_80B93B68(this, globalCtx, sCollisionHeaders[thisx->params & 3], DPM_UNK); + func_80B93B68(this, play, sCollisionHeaders[thisx->params & 3], DPM_UNK); Actor_ProcessInitChain(thisx, sInitChain); - func_80B93BF0(this, globalCtx); + func_80B93BF0(this, play); switch (thisx->params & 3) { case 0: @@ -87,7 +87,7 @@ void ObjHsblock_Init(Actor* thisx, GlobalContext* globalCtx) { func_80B93D90(this); break; case 1: - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { func_80B93D90(this); } else { func_80B93DB0(this); @@ -99,10 +99,10 @@ void ObjHsblock_Init(Actor* thisx, GlobalContext* globalCtx) { mREG(15) = 255; } -void ObjHsblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjHsblock_Destroy(Actor* thisx, PlayState* play) { ObjHsblock* this = (ObjHsblock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80B93D90(ObjHsblock* this) { @@ -115,8 +115,8 @@ void func_80B93DB0(ObjHsblock* this) { ObjHsblock_SetupAction(this, func_80B93DF4); } -void func_80B93DF4(ObjHsblock* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { +void func_80B93DF4(ObjHsblock* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { func_80B93E38(this); } } @@ -125,7 +125,7 @@ void func_80B93E38(ObjHsblock* this) { ObjHsblock_SetupAction(this, func_80B93E5C); } -void func_80B93E5C(ObjHsblock* this, GlobalContext* globalCtx) { +void func_80B93E5C(ObjHsblock* this, PlayState* play) { Math_SmoothStepToF(&this->dyna.actor.velocity.y, 16.0f, 0.1f, 0.8f, 0.0f); if (fabsf(Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 0.3f, this->dyna.actor.velocity.y, 0.3f)) < 0.001f) { @@ -135,27 +135,27 @@ void func_80B93E5C(ObjHsblock* this, GlobalContext* globalCtx) { } } -void ObjHsblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHsblock_Update(Actor* thisx, PlayState* play) { ObjHsblock* this = (ObjHsblock*)thisx; if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } Actor_SetFocus(thisx, D_80B940C0[thisx->params & 3]); } -void ObjHsblock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjHsblock_Draw(Actor* thisx, PlayState* play) { Color_RGB8* color; Color_RGB8 defaultColor; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_hsblock.c", 365); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_hsblock.c", 365); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_hsblock.c", 369), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_hsblock.c", 369), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (globalCtx->sceneNum == SCENE_HIDAN) { + if (play->sceneNum == SCENE_HIDAN) { color = &sFireTempleColor; } else { defaultColor.r = mREG(13); @@ -167,5 +167,5 @@ void ObjHsblock_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 255); gSPDisplayList(POLY_OPA_DISP++, sDLists[thisx->params & 3]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_hsblock.c", 399); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_hsblock.c", 399); } diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h index ee43e0cad8..6548ca9b97 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h @@ -6,7 +6,7 @@ struct ObjHsblock; -typedef void (*ObjHsblockActionFunc)(struct ObjHsblock*, GlobalContext*); +typedef void (*ObjHsblockActionFunc)(struct ObjHsblock*, PlayState*); typedef struct ObjHsblock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index bca9ca500a..4135b3e103 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -9,13 +9,13 @@ #define FLAGS ACTOR_FLAG_4 -void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjIcePoly_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjIcePoly_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjIcePoly_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjIcePoly_Init(Actor* thisx, PlayState* play); +void ObjIcePoly_Destroy(Actor* thisx, PlayState* play); +void ObjIcePoly_Update(Actor* thisx, PlayState* play); +void ObjIcePoly_Draw(Actor* thisx, PlayState* play); -void ObjIcePoly_Idle(ObjIcePoly* this, GlobalContext* globalCtx); -void ObjIcePoly_Melt(ObjIcePoly* this, GlobalContext* globalCtx); +void ObjIcePoly_Idle(ObjIcePoly* this, PlayState* play); +void ObjIcePoly_Melt(ObjIcePoly* this, PlayState* play); const ActorInit Obj_Ice_Poly_InitVars = { ACTOR_OBJ_ICE_POLY, @@ -74,7 +74,7 @@ static s16 sOffsetY[] = { -25, 0, -20 }; static Color_RGBA8 sColorWhite = { 250, 250, 250, 255 }; static Color_RGBA8 sColorGray = { 180, 180, 180, 255 }; -void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjIcePoly_Init(Actor* thisx, PlayState* play) { ObjIcePoly* this = (ObjIcePoly*)thisx; this->unk_151 = (thisx->params >> 8) & 0xFF; @@ -85,10 +85,10 @@ void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetScale(thisx, sScale[thisx->params]); thisx->world.pos.y = sOffsetY[thisx->params] + thisx->home.pos.y; - Collider_InitCylinder(globalCtx, &this->colliderIce); - Collider_SetCylinder(globalCtx, &this->colliderIce, thisx, &sCylinderInitIce); - Collider_InitCylinder(globalCtx, &this->colliderHard); - Collider_SetCylinder(globalCtx, &this->colliderHard, thisx, &sCylinderInitHard); + Collider_InitCylinder(play, &this->colliderIce); + Collider_SetCylinder(play, &this->colliderIce, thisx, &sCylinderInitIce); + Collider_InitCylinder(play, &this->colliderHard); + Collider_SetCylinder(play, &this->colliderHard, thisx, &sCylinderInitHard); Collider_UpdateCylinder(thisx, &this->colliderIce); Collider_UpdateCylinder(thisx, &this->colliderHard); thisx->colChkInfo.mass = MASS_IMMOVABLE; @@ -101,17 +101,17 @@ void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = ObjIcePoly_Idle; } -void ObjIcePoly_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjIcePoly_Destroy(Actor* thisx, PlayState* play) { s32 pad; ObjIcePoly* this = (ObjIcePoly*)thisx; if ((this->actor.params >= 0) && (this->actor.params < 3)) { - Collider_DestroyCylinder(globalCtx, &this->colliderIce); - Collider_DestroyCylinder(globalCtx, &this->colliderHard); + Collider_DestroyCylinder(play, &this->colliderIce); + Collider_DestroyCylinder(play, &this->colliderHard); } } -void ObjIcePoly_Idle(ObjIcePoly* this, GlobalContext* globalCtx) { +void ObjIcePoly_Idle(ObjIcePoly* this, PlayState* play) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 pad; Vec3f pos; @@ -119,26 +119,26 @@ void ObjIcePoly_Idle(ObjIcePoly* this, GlobalContext* globalCtx) { if (this->colliderIce.base.acFlags & AC_HIT) { this->meltTimer = -this->colliderIce.info.acHitInfo->toucher.damage; this->actor.focus.rot.y = this->actor.yawTowardsPlayer; - OnePointCutscene_Init(globalCtx, 5120, 40, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 5120, 40, &this->actor, CAM_ID_MAIN); this->actionFunc = ObjIcePoly_Melt; } else if (this->actor.parent != NULL) { this->actor.parent->freezeTimer = 40; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderIce.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderIce.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderIce.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderHard.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderIce.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderIce.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderIce.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderHard.base); } else { Actor_Kill(&this->actor); } pos.x = this->actor.world.pos.x + this->actor.scale.x * (Rand_S16Offset(15, 15) * (Rand_ZeroOne() < 0.5f ? -1 : 1)); pos.y = this->actor.world.pos.y + this->actor.scale.y * Rand_S16Offset(10, 90); pos.z = this->actor.world.pos.z + this->actor.scale.z * (Rand_S16Offset(15, 15) * (Rand_ZeroOne() < 0.5f ? -1 : 1)); - if ((globalCtx->gameplayFrames % 7) == 0) { - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &zeroVec, &zeroVec, &sColorWhite, &sColorGray, 2000, 5); + if ((play->gameplayFrames % 7) == 0) { + EffectSsKiraKira_SpawnDispersed(play, &pos, &zeroVec, &zeroVec, &sColorWhite, &sColorGray, 2000, 5); } } -void ObjIcePoly_Melt(ObjIcePoly* this, GlobalContext* globalCtx) { +void ObjIcePoly_Melt(ObjIcePoly* this, PlayState* play) { Vec3f accel; Vec3f vel; Vec3f pos; @@ -157,7 +157,7 @@ void ObjIcePoly_Melt(ObjIcePoly* this, GlobalContext* globalCtx) { pos.y = this->actor.world.pos.y + this->actor.scale.y * Rand_ZeroOne() * 50.0f; pos.z = this->actor.world.pos.z + this->actor.scale.x * (Rand_S16Offset(20, 20) * (Rand_ZeroOne() < 0.5f ? -1 : 1)); - func_8002829C(globalCtx, &pos, &vel, &accel, &sColorWhite, &sColorGray, + func_8002829C(play, &pos, &vel, &accel, &sColorWhite, &sColorGray, Rand_S16Offset(0x15E, 0x64) * this->actor.scale.x, this->actor.scale.x * 20.0f); } if (this->meltTimer < 0) { @@ -181,29 +181,29 @@ void ObjIcePoly_Melt(ObjIcePoly* this, GlobalContext* globalCtx) { } } -void ObjIcePoly_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjIcePoly_Update(Actor* thisx, PlayState* play) { s32 pad; ObjIcePoly* this = (ObjIcePoly*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjIcePoly_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjIcePoly_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjIcePoly* this = (ObjIcePoly*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_ice_poly.c", 421); - func_80093D84(globalCtx->state.gfxCtx); - func_8002ED80(&this->actor, globalCtx, 0); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_ice_poly.c", 421); + func_80093D84(play->state.gfxCtx); + func_8002ED80(&this->actor, play, 0); Matrix_RotateZYX(0x500, 0, -0x500, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_ice_poly.c", 428), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_ice_poly.c", 428), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, globalCtx->gameplayFrames % 0x100, 0x20, 0x10, 1, 0, - (globalCtx->gameplayFrames * 2) % 0x100, 0x40, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames % 0x100, 0x20, 0x10, 1, 0, + (play->gameplayFrames * 2) % 0x100, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, this->alpha); gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_ice_poly.c", 444); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_ice_poly.c", 444); } diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h index cb1c3e5bf3..8ebbe8d128 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h @@ -6,7 +6,7 @@ struct ObjIcePoly; -typedef void (*ObjIcePolyActionFunc)(struct ObjIcePoly*, GlobalContext*); +typedef void (*ObjIcePolyActionFunc)(struct ObjIcePoly*, PlayState*); typedef struct ObjIcePoly { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 6643b11ff1..4d47cff56e 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -10,17 +10,17 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_26) -void ObjKibako_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjKibako_Init(Actor* thisx, PlayState* play); +void ObjKibako_Destroy(Actor* thisx, PlayState* play); +void ObjKibako_Update(Actor* thisx, PlayState* play); +void ObjKibako_Draw(Actor* thisx, PlayState* play); void ObjKibako_SetupIdle(ObjKibako* this); -void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx); +void ObjKibako_Idle(ObjKibako* this, PlayState* play); void ObjKibako_SetupHeld(ObjKibako* this); -void ObjKibako_Held(ObjKibako* this, GlobalContext* globalCtx); +void ObjKibako_Held(ObjKibako* this, PlayState* play); void ObjKibako_SetupThrown(ObjKibako* this); -void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx); +void ObjKibako_Thrown(ObjKibako* this, PlayState* play); const ActorInit Obj_Kibako_InitVars = { ACTOR_OBJ_KIBAKO, @@ -63,13 +63,12 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void ObjKibako_SpawnCollectible(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_SpawnCollectible(ObjKibako* this, PlayState* play) { s16 collectible; collectible = this->actor.params & 0x1F; if ((collectible >= 0) && (collectible < ITEM00_MAX)) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, - collectible | (((this->actor.params >> 8) & 0x3F) << 8)); + Item_DropCollectible(play, &this->actor.world.pos, collectible | (((this->actor.params >> 8) & 0x3F) << 8)); } } @@ -80,36 +79,36 @@ void ObjKibako_ApplyGravity(ObjKibako* this) { } } -void ObjKibako_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako_InitCollider(Actor* thisx, PlayState* play) { ObjKibako* this = (ObjKibako*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); } -void ObjKibako_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako_Init(Actor* thisx, PlayState* play) { s32 pad; ObjKibako* this = (ObjKibako*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.gravity = -1.2f; this->actor.minVelocityY = -13.0f; - ObjKibako_InitCollider(&this->actor, globalCtx); + ObjKibako_InitCollider(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sCCInfoInit); ObjKibako_SetupIdle(this); // "wooden box" osSyncPrintf("(dungeon keep 木箱)(arg_data 0x%04x)\n", this->actor.params); } -void ObjKibako_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjKibako_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjKibako* this = (ObjKibako*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void ObjKibako_AirBreak(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_AirBreak(ObjKibako* this, PlayState* play) { s16 angle; s32 i; Vec3f* breakPos = &this->actor.world.pos; @@ -139,14 +138,13 @@ void ObjKibako_AirBreak(ObjKibako* this, GlobalContext* globalCtx) { } else { phi_s0 = 0x20; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, breakPos, -200, phi_s0, 10, 10, 0, - (Rand_ZeroOne() * 30.0f) + 10.0f, 0, 32, 60, KAKERA_COLOR_NONE, - OBJECT_GAMEPLAY_DANGEON_KEEP, gSmallWoodenBoxFragmentDL); + EffectSsKakera_Spawn(play, &pos, &velocity, breakPos, -200, phi_s0, 10, 10, 0, (Rand_ZeroOne() * 30.0f) + 10.0f, + 0, 32, 60, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gSmallWoodenBoxFragmentDL); } - func_80033480(globalCtx, &this->actor.world.pos, 40.0f, 3, 50, 140, 1); + func_80033480(play, &this->actor.world.pos, 40.0f, 3, 50, 140, 1); } -void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_WaterBreak(ObjKibako* this, PlayState* play) { s16 angle; s32 i; Vec3f* breakPos = &this->actor.world.pos; @@ -155,7 +153,7 @@ void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) { pos = *breakPos; pos.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 500); + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 500); for (i = 0, angle = 0; i < 12; i++, angle += 0x4E20) { f32 sn = Math_SinS(angle); @@ -174,9 +172,8 @@ void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) { pos.z += breakPos->z; temp_rand = Rand_ZeroOne(); phi_s0 = (temp_rand < 0.2f) ? 0x40 : 0x20; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, breakPos, -180, phi_s0, 30, 30, 0, - (Rand_ZeroOne() * 30.0f) + 10.0f, 0, 32, 70, KAKERA_COLOR_NONE, - OBJECT_GAMEPLAY_DANGEON_KEEP, gSmallWoodenBoxFragmentDL); + EffectSsKakera_Spawn(play, &pos, &velocity, breakPos, -180, phi_s0, 30, 30, 0, (Rand_ZeroOne() * 30.0f) + 10.0f, + 0, 32, 70, KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, gSmallWoodenBoxFragmentDL); } } @@ -185,37 +182,36 @@ void ObjKibako_SetupIdle(ObjKibako* this) { this->actor.colChkInfo.mass = MASS_HEAVY; } -void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_Idle(ObjKibako* this, PlayState* play) { s32 pad; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { ObjKibako_SetupHeld(this); } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.yDistToWater > 19.0f)) { - ObjKibako_WaterBreak(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - ObjKibako_SpawnCollectible(this, globalCtx); + ObjKibako_WaterBreak(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + ObjKibako_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else if (this->collider.base.acFlags & AC_HIT) { - ObjKibako_AirBreak(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - ObjKibako_SpawnCollectible(this, globalCtx); + ObjKibako_AirBreak(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + ObjKibako_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else { Actor_MoveForward(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 19.0f, 20.0f, 0.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 19.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 28.0f)) { this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; } if (this->actor.xzDistToPlayer < 600.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 180.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } if (this->actor.xzDistToPlayer < 100.0f) { - func_8002F580(&this->actor, globalCtx); + func_8002F580(&this->actor, play); } } } @@ -226,9 +222,9 @@ void ObjKibako_SetupHeld(ObjKibako* this) { func_8002F7DC(&this->actor, NA_SE_PL_PULL_UP_WOODBOX); } -void ObjKibako_Held(ObjKibako* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.curRoom.num; +void ObjKibako_Held(ObjKibako* this, PlayState* play) { + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.curRoom.num; if (fabsf(this->actor.speedXZ) < 0.1f) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_PUT_DOWN_WOODBOX); ObjKibako_SetupIdle(this); @@ -238,8 +234,7 @@ void ObjKibako_Held(ObjKibako* this, GlobalContext* globalCtx) { ObjKibako_ApplyGravity(this); func_8002D7EC(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 19.0f, 20.0f, 0.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 19.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } } @@ -250,42 +245,41 @@ void ObjKibako_SetupThrown(ObjKibako* this) { this->actionFunc = ObjKibako_Thrown; } -void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_Thrown(ObjKibako* this, PlayState* play) { s32 pad; s32 pad2; if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || (this->collider.base.atFlags & AT_HIT)) { - ObjKibako_AirBreak(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - ObjKibako_SpawnCollectible(this, globalCtx); + ObjKibako_AirBreak(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + ObjKibako_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { - ObjKibako_WaterBreak(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - ObjKibako_SpawnCollectible(this, globalCtx); + ObjKibako_WaterBreak(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + ObjKibako_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else { ObjKibako_ApplyGravity(this); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 19.0f, 20.0f, 0.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); + Actor_UpdateBgCheckInfo(play, &this->actor, 19.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } -void ObjKibako_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako_Update(Actor* thisx, PlayState* play) { s32 pad; ObjKibako* this = (ObjKibako*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjKibako_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjKibako* this = (ObjKibako*)thisx; - Gfx_DrawDListOpa(globalCtx, gSmallWoodenBoxDL); + Gfx_DrawDListOpa(play, gSmallWoodenBoxDL); } diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h index 1e5d3d48b6..9378a51ce7 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h @@ -6,7 +6,7 @@ struct ObjKibako; -typedef void (*ObjKibakoActionFunc)(struct ObjKibako*, GlobalContext*); +typedef void (*ObjKibakoActionFunc)(struct ObjKibako*, PlayState*); typedef struct ObjKibako { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index 378c5bad8c..6fc45b0c04 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -10,12 +10,12 @@ #define FLAGS 0 -void ObjKibako2_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako2_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako2_Draw(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako2_Idle(ObjKibako2* this, GlobalContext* globalCtx); -void ObjKibako2_Kill(ObjKibako2* this, GlobalContext* globalCtx); +void ObjKibako2_Init(Actor* thisx, PlayState* play); +void ObjKibako2_Destroy(Actor* thisx, PlayState* play); +void ObjKibako2_Update(Actor* thisx, PlayState* play); +void ObjKibako2_Draw(Actor* thisx, PlayState* play); +void ObjKibako2_Idle(ObjKibako2* this, PlayState* play); +void ObjKibako2_Kill(ObjKibako2* this, PlayState* play); const ActorInit Obj_Kibako2_InitVars = { ACTOR_OBJ_KIBAKO2, @@ -56,15 +56,15 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void ObjKibako2_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako2_InitCollider(Actor* thisx, PlayState* play) { ObjKibako2* this = (ObjKibako2*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); } -void ObjKibako2_Break(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_Break(ObjKibako2* this, PlayState* play) { s32 pad[2]; Vec3f* thisPos; Vec3f pos; @@ -97,24 +97,24 @@ void ObjKibako2_Break(ObjKibako2* this, GlobalContext* globalCtx) { } else { phi_s0 = 0x20; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -200, phi_s0, 28, 2, 0, (Rand_ZeroOne() * 30.0f) + 5.0f, - 0, 0, 70, KAKERA_COLOR_NONE, OBJECT_KIBAKO2, gLargeCrateFragmentDL); + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -200, phi_s0, 28, 2, 0, (Rand_ZeroOne() * 30.0f) + 5.0f, 0, 0, + 70, KAKERA_COLOR_NONE, OBJECT_KIBAKO2, gLargeCrateFragmentDL); } - func_80033480(globalCtx, thisPos, 90.0f, 6, 100, 160, 1); + func_80033480(play, thisPos, 90.0f, 6, 100, 160, 1); } -void ObjKibako2_SpawnCollectible(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_SpawnCollectible(ObjKibako2* this, PlayState* play) { s16 itemDropped; s16 collectibleFlagTemp; collectibleFlagTemp = this->collectibleFlag; itemDropped = this->dyna.actor.home.rot.x; if (itemDropped >= 0 && itemDropped < ITEM00_MAX) { - Item_DropCollectible(globalCtx, &this->dyna.actor.world.pos, itemDropped | (collectibleFlagTemp << 8)); + Item_DropCollectible(play, &this->dyna.actor.world.pos, itemDropped | (collectibleFlagTemp << 8)); } } -void ObjKibako2_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako2_Init(Actor* thisx, PlayState* play) { ObjKibako2* this = (ObjKibako2*)thisx; s16 pad; CollisionHeader* colHeader = NULL; @@ -122,9 +122,9 @@ void ObjKibako2_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - ObjKibako2_InitCollider(thisx, globalCtx); + ObjKibako2_InitCollider(thisx, play); CollisionHeader_GetVirtual(&gLargeCrateCol, &colHeader); - bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->collectibleFlag = this->dyna.actor.home.rot.z & 0x3F; this->dyna.bgId = bgId; this->actionFunc = ObjKibako2_Idle; @@ -135,45 +135,44 @@ void ObjKibako2_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.home.rot.x); } -void ObjKibako2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako2_Destroy(Actor* thisx, PlayState* play) { ObjKibako2* this = (ObjKibako2*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjKibako2_Idle(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_Idle(ObjKibako2* this, PlayState* play) { if ((this->collider.base.acFlags & AC_HIT) || (this->dyna.actor.home.rot.z != 0) || - func_80033684(globalCtx, &this->dyna.actor) != NULL) { - ObjKibako2_Break(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + func_80033684(play, &this->dyna.actor) != NULL) { + ObjKibako2_Break(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); this->dyna.actor.flags |= ACTOR_FLAG_4; - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; this->actionFunc = ObjKibako2_Kill; } else if (this->dyna.actor.xzDistToPlayer < 600.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void ObjKibako2_Kill(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_Kill(ObjKibako2* this, PlayState* play) { s16 params = this->dyna.actor.params; if ((params & 0x8000) == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SW, this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y, 0, - params | 0x8000); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, + this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y, 0, params | 0x8000); } - ObjKibako2_SpawnCollectible(this, globalCtx); + ObjKibako2_SpawnCollectible(this, play); Actor_Kill(&this->dyna.actor); } -void ObjKibako2_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako2_Update(Actor* thisx, PlayState* play) { ObjKibako2* this = (ObjKibako2*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjKibako2_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gLargeCrateDL); +void ObjKibako2_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gLargeCrateDL); } diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h index 04b980a99c..73f0e90b67 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h @@ -6,7 +6,7 @@ struct ObjKibako2; -typedef void (*ObjKibako2ActionFunc)(struct ObjKibako2*, GlobalContext*); +typedef void (*ObjKibako2ActionFunc)(struct ObjKibako2*, PlayState*); typedef struct ObjKibako2 { /* 0x0000 */ DynaPolyActor dyna; 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 a0e001db94..10d2ae4282 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -10,18 +10,18 @@ #define FLAGS ACTOR_FLAG_4 -void ObjLift_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjLift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjLift_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjLift_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjLift_Init(Actor* thisx, PlayState* play); +void ObjLift_Destroy(Actor* thisx, PlayState* play); +void ObjLift_Update(Actor* thisx, PlayState* play); +void ObjLift_Draw(Actor* thisx, PlayState* play); void func_80B9651C(ObjLift* this); void func_80B9664C(ObjLift* this); void func_80B967C0(ObjLift* this); -void func_80B96560(ObjLift* this, GlobalContext* globalCtx); -void func_80B96678(ObjLift* this, GlobalContext* globalCtx); -void func_80B96840(ObjLift* this, GlobalContext* globalCtx); +void func_80B96560(ObjLift* this, PlayState* play); +void func_80B96678(ObjLift* this, PlayState* play); +void func_80B96840(ObjLift* this, PlayState* play); const ActorInit Obj_Lift_InitVars = { ACTOR_OBJ_LIFT, @@ -60,14 +60,14 @@ void ObjLift_SetupAction(ObjLift* this, ObjLiftActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ObjLift_InitDynaPoly(ObjLift* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flags) { +void ObjLift_InitDynaPoly(ObjLift* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_lift.c", 188, @@ -75,7 +75,7 @@ void ObjLift_InitDynaPoly(ObjLift* this, GlobalContext* globalCtx, CollisionHead } } -void func_80B96160(ObjLift* this, GlobalContext* globalCtx) { +void func_80B96160(ObjLift* this, PlayState* play) { Vec3f pos; Vec3f velocity; Vec3f* temp_s3; @@ -91,24 +91,24 @@ void func_80B96160(ObjLift* this, GlobalContext* globalCtx) { velocity.x = sFragmentScales[i].x * this->dyna.actor.scale.x * 0.8f; velocity.y = Rand_ZeroOne() * 10.0f + 6.0f; velocity.z = sFragmentScales[i].z * this->dyna.actor.scale.z * 0.8f; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, temp_s3, -256, (Rand_ZeroOne() < 0.5f) ? 64 : 32, 15, 15, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, temp_s3, -256, (Rand_ZeroOne() < 0.5f) ? 64 : 32, 15, 15, 0, (Rand_ZeroOne() * 50.0f + 50.0f) * this->dyna.actor.scale.x, 0, 32, 50, KAKERA_COLOR_NONE, OBJECT_D_LIFT, gCollapsingPlatformDL); } if (((this->dyna.actor.params >> 1) & 1) == 0) { - func_80033480(globalCtx, &this->dyna.actor.world.pos, 120.0f, 12, 120, 100, 1); + func_80033480(play, &this->dyna.actor.world.pos, 120.0f, 12, 120, 100, 1); } else if (((this->dyna.actor.params >> 1) & 1) == 1) { - func_80033480(globalCtx, &this->dyna.actor.world.pos, 60.0f, 8, 60, 100, 1); + func_80033480(play, &this->dyna.actor.world.pos, 60.0f, 8, 60, 100, 1); } } -void ObjLift_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjLift_Init(Actor* thisx, PlayState* play) { ObjLift* this = (ObjLift*)thisx; - ObjLift_InitDynaPoly(this, globalCtx, &gCollapsingPlatformCol, DPM_PLAYER); + ObjLift_InitDynaPoly(this, play, &gCollapsingPlatformCol, DPM_PLAYER); - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 2) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 2) & 0x3F)) { Actor_Kill(&this->dyna.actor); return; } @@ -122,10 +122,10 @@ void ObjLift_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(Dungeon Lift)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void ObjLift_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjLift_Destroy(Actor* thisx, PlayState* play) { ObjLift* this = (ObjLift*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80B9651C(ObjLift* this) { @@ -133,7 +133,7 @@ void func_80B9651C(ObjLift* this) { ObjLift_SetupAction(this, func_80B96560); } -void func_80B96560(ObjLift* this, GlobalContext* globalCtx) { +void func_80B96560(ObjLift* this, PlayState* play) { s32 pad; s32 quakeIndex; @@ -142,7 +142,7 @@ void func_80B96560(ObjLift* this, GlobalContext* globalCtx) { if (((this->dyna.actor.params >> 8) & 7) == 7) { func_80B967C0(this); } else { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1); Quake_SetSpeed(quakeIndex, 10000); Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0); Quake_SetCountdown(quakeIndex, 20); @@ -159,7 +159,7 @@ void func_80B9664C(ObjLift* this) { ObjLift_SetupAction(this, func_80B96678); } -void func_80B96678(ObjLift* this, GlobalContext* globalCtx) { +void func_80B96678(ObjLift* this, PlayState* play) { if (this->timer <= 0) { func_80B967C0(this); } else { @@ -176,7 +176,7 @@ void func_80B96678(ObjLift* this, GlobalContext* globalCtx) { } if ((this->timer & 3) == 3) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 16, NA_SE_EV_BLOCK_SHAKE); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 16, NA_SE_EV_BLOCK_SHAKE); } } @@ -186,7 +186,7 @@ void func_80B967C0(ObjLift* this) { this->dyna.actor.shape.rot = this->dyna.actor.world.rot = this->dyna.actor.home.rot; } -void func_80B96840(ObjLift* this, GlobalContext* globalCtx) { +void func_80B96840(ObjLift* this, PlayState* play) { s32 pad; s32 bgId; Vec3f sp2C; @@ -195,27 +195,27 @@ void func_80B96840(ObjLift* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp2C, &this->dyna.actor.prevPos); sp2C.y += sMaxFallDistances[(this->dyna.actor.params >> 1) & 1]; this->dyna.actor.floorHeight = - BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &sp2C); + BgCheck_EntityRaycastFloor4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &sp2C); if ((this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) >= (sMaxFallDistances[(this->dyna.actor.params >> 1) & 1] - 0.001f)) { - func_80B96160(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 20, NA_SE_EV_BOX_BREAK); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 2) & 0x3F); + func_80B96160(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 20, NA_SE_EV_BOX_BREAK); + Flags_SetSwitch(play, (this->dyna.actor.params >> 2) & 0x3F); Actor_Kill(&this->dyna.actor); } } -void ObjLift_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjLift_Update(Actor* thisx, PlayState* play) { ObjLift* this = (ObjLift*)thisx; if (this->timer > 0) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjLift_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gCollapsingPlatformDL); +void ObjLift_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gCollapsingPlatformDL); } diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h index 7b3f717ac0..de25b3c1c6 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h @@ -6,7 +6,7 @@ struct ObjLift; -typedef void (*ObjLiftActionFunc)(struct ObjLift*, GlobalContext*); +typedef void (*ObjLiftActionFunc)(struct ObjLift*, PlayState*); typedef struct ObjLift { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index efbf86833e..0e50e075b3 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -17,23 +17,23 @@ typedef enum { /* 0x02 */ FACE_EYES_OPEN_SMILING } FaceTextureIndex; -void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjLightswitch_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjLightswitch_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjLightswitch_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjLightswitch_Init(Actor* thisx, PlayState* play); +void ObjLightswitch_Destroy(Actor* thisx, PlayState* play); +void ObjLightswitch_Update(Actor* thisx, PlayState* play); +void ObjLightswitch_Draw(Actor* thisx, PlayState* play); void ObjLightswitch_SetupOff(ObjLightswitch* this); -void ObjLightswitch_Off(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_Off(ObjLightswitch* this, PlayState* play); void ObjLightswitch_SetupTurnOn(ObjLightswitch* this); -void ObjLightswitch_TurnOn(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_TurnOn(ObjLightswitch* this, PlayState* play); void ObjLightswitch_SetupOn(ObjLightswitch* this); -void ObjLightswitch_On(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_On(ObjLightswitch* this, PlayState* play); void ObjLightswitch_SetupTurnOff(ObjLightswitch* this); -void ObjLightswitch_TurnOff(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_TurnOff(ObjLightswitch* this, PlayState* play); void ObjLightswitch_SetupDisappearDelay(ObjLightswitch* this); -void ObjLightswitch_DisappearDelay(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_DisappearDelay(ObjLightswitch* this, PlayState* play); void ObjLightswitch_SetupDisappear(ObjLightswitch* this); -void ObjLightswitch_Disappear(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightswitch_Disappear(ObjLightswitch* this, PlayState* play); const ActorInit Obj_Lightswitch_InitVars = { ACTOR_OBJ_LIGHTSWITCH, @@ -88,11 +88,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -void ObjLightswitch_InitCollider(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_InitCollider(ObjLightswitch* this, PlayState* play) { s32 pad; - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderItems); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderItems); Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y), this->actor.world.pos.z, &this->actor.shape.rot); @@ -100,36 +100,36 @@ void ObjLightswitch_InitCollider(ObjLightswitch* this, GlobalContext* globalCtx) Collider_UpdateSpheres(0, &this->collider); } -void ObjLightswitch_SetSwitchFlag(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_SetSwitchFlag(ObjLightswitch* this, PlayState* play) { Actor* thisx = &this->actor; // required s32 type; - if (!Flags_GetSwitch(globalCtx, this->actor.params >> 8 & 0x3F)) { + if (!Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { type = this->actor.params >> 4 & 3; - Flags_SetSwitch(globalCtx, this->actor.params >> 8 & 0x3F); + Flags_SetSwitch(play, this->actor.params >> 8 & 0x3F); if (type == OBJLIGHTSWITCH_TYPE_1) { - OnePointCutscene_AttentionSetSfx(globalCtx, thisx, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, thisx, NA_SE_SY_TRE_BOX_APPEAR); } else if (type == OBJLIGHTSWITCH_TYPE_BURN) { - OnePointCutscene_AttentionSetSfx(globalCtx, thisx, NA_SE_SY_ERROR); + OnePointCutscene_AttentionSetSfx(play, thisx, NA_SE_SY_ERROR); } else { - OnePointCutscene_AttentionSetSfx(globalCtx, thisx, NA_SE_SY_CORRECT_CHIME); + OnePointCutscene_AttentionSetSfx(play, thisx, NA_SE_SY_CORRECT_CHIME); } } } -void ObjLightswitch_ClearSwitchFlag(ObjLightswitch* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->actor.params >> 8 & 0x3F)) { - Flags_UnsetSwitch(globalCtx, this->actor.params >> 8 & 0x3F); +void ObjLightswitch_ClearSwitchFlag(ObjLightswitch* this, PlayState* play) { + if (Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { + Flags_UnsetSwitch(play, this->actor.params >> 8 & 0x3F); if ((this->actor.params >> 4 & 3) == OBJLIGHTSWITCH_TYPE_1) { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->actor, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, &this->actor, NA_SE_SY_TRE_BOX_APPEAR); } } } -void ObjLightswitch_SpawnDisappearEffects(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_SpawnDisappearEffects(ObjLightswitch* this, PlayState* play) { Vec3f pos; f32 s = Math_SinS(this->actor.shape.rot.y); f32 c = Math_CosS(this->actor.shape.rot.y); @@ -155,14 +155,13 @@ void ObjLightswitch_SpawnDisappearEffects(ObjLightswitch* this, GlobalContext* g pos.x = this->actor.world.pos.x + ((z * s) + (x * c)); pos.y = this->actor.world.pos.y + y + 10.0f; pos.z = this->actor.world.pos.z + ((z * c) - (x * s)); - EffectSsDeadDb_Spawn(globalCtx, &pos, &D_80B97F74, &D_80B97F74, 100, 0, 255, 255, 160, 160, 255, 0, 0, 1, 9, - true); + EffectSsDeadDb_Spawn(play, &pos, &D_80B97F74, &D_80B97F74, 100, 0, 255, 255, 160, 160, 255, 0, 0, 1, 9, true); } } -void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjLightswitch_Init(Actor* thisx, PlayState* play) { ObjLightswitch* this = (ObjLightswitch*)thisx; - s32 switchFlagSet = Flags_GetSwitch(globalCtx, this->actor.params >> 8 & 0x3F); + s32 switchFlagSet = Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F); s32 removeSelf = false; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -186,9 +185,9 @@ void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.rot.x = this->actor.home.rot.x = this->actor.shape.rot.x; this->actor.world.rot.z = this->actor.home.rot.z = this->actor.shape.rot.z; this->actor.flags |= ACTOR_FLAG_5; - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_OBJ_OSHIHIKI, - this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, - this->actor.home.rot.y, 0, (0xFF << 8) | PUSHBLOCK_SMALL_START_ON) == NULL) { + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_OBJ_OSHIHIKI, this->actor.home.pos.x, + this->actor.home.pos.y, this->actor.home.pos.z, 0, this->actor.home.rot.y, 0, + (0xFF << 8) | PUSHBLOCK_SMALL_START_ON) == NULL) { osSyncPrintf(VT_COL(RED, WHITE)); // "Push-pull block occurrence failure" osSyncPrintf("押引ブロック発生失敗(%s %d)(arg_data 0x%04x)\n", "../z_obj_lightswitch.c", 452, @@ -197,7 +196,7 @@ void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { removeSelf = true; } } - ObjLightswitch_InitCollider(this, globalCtx); + ObjLightswitch_InitCollider(this, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (removeSelf) { Actor_Kill(&this->actor); @@ -206,11 +205,11 @@ void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(光スイッチ)(arg_data 0x%04x)\n", this->actor.params); } -void ObjLightswitch_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjLightswitch_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjLightswitch* this = (ObjLightswitch*)thisx; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void ObjLightswitch_SetupOff(ObjLightswitch* this) { @@ -222,25 +221,25 @@ void ObjLightswitch_SetupOff(ObjLightswitch* this) { this->alpha = 255 << 6; } -void ObjLightswitch_Off(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_Off(ObjLightswitch* this, PlayState* play) { switch (this->actor.params >> 4 & 3) { case OBJLIGHTSWITCH_TYPE_STAY_ON: case OBJLIGHTSWITCH_TYPE_2: if (this->collider.base.acFlags & AC_HIT) { ObjLightswitch_SetupTurnOn(this); - ObjLightswitch_SetSwitchFlag(this, globalCtx); + ObjLightswitch_SetSwitchFlag(this, play); } break; case OBJLIGHTSWITCH_TYPE_1: if ((this->collider.base.acFlags & AC_HIT) && !(this->prevFrameACflags & AC_HIT)) { ObjLightswitch_SetupTurnOn(this); - ObjLightswitch_SetSwitchFlag(this, globalCtx); + ObjLightswitch_SetSwitchFlag(this, play); } break; case OBJLIGHTSWITCH_TYPE_BURN: if (this->collider.base.acFlags & AC_HIT) { ObjLightswitch_SetupDisappearDelay(this); - ObjLightswitch_SetSwitchFlag(this, globalCtx); + ObjLightswitch_SetSwitchFlag(this, play); } break; } @@ -253,7 +252,7 @@ void ObjLightswitch_SetupTurnOn(ObjLightswitch* this) { this->faceTextureIndex = FACE_EYES_CLOSED; } -void ObjLightswitch_TurnOn(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_TurnOn(ObjLightswitch* this, PlayState* play) { if (func_8005B198() == this->actor.category || this->toggleDelay <= 0) { if (this->timer == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_TRIFORCE_FLASH); @@ -289,24 +288,24 @@ void ObjLightswitch_SetupOn(ObjLightswitch* this) { this->timer = 0; } -void ObjLightswitch_On(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_On(ObjLightswitch* this, PlayState* play) { switch (this->actor.params >> 4 & 3) { case OBJLIGHTSWITCH_TYPE_STAY_ON: - if (!Flags_GetSwitch(globalCtx, this->actor.params >> 8 & 0x3F)) { + if (!Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) { ObjLightswitch_SetupTurnOff(this); } break; case OBJLIGHTSWITCH_TYPE_1: if (this->collider.base.acFlags & AC_HIT && !(this->prevFrameACflags & AC_HIT)) { ObjLightswitch_SetupTurnOff(this); - ObjLightswitch_ClearSwitchFlag(this, globalCtx); + ObjLightswitch_ClearSwitchFlag(this, play); } break; case OBJLIGHTSWITCH_TYPE_2: if (!(this->collider.base.acFlags & AC_HIT)) { if (this->timer >= 7) { ObjLightswitch_SetupTurnOff(this); - ObjLightswitch_ClearSwitchFlag(this, globalCtx); + ObjLightswitch_ClearSwitchFlag(this, play); } else { this->timer++; } @@ -325,7 +324,7 @@ void ObjLightswitch_SetupTurnOff(ObjLightswitch* this) { this->faceTextureIndex = FACE_EYES_OPEN; } -void ObjLightswitch_TurnOff(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_TurnOff(ObjLightswitch* this, PlayState* play) { if ((this->actor.params >> 4 & 3) != OBJLIGHTSWITCH_TYPE_1 || func_8005B198() == this->actor.category || this->toggleDelay <= 0) { this->timer--; @@ -350,7 +349,7 @@ void ObjLightswitch_SetupDisappearDelay(ObjLightswitch* this) { this->toggleDelay = 100; } -void ObjLightswitch_DisappearDelay(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_DisappearDelay(ObjLightswitch* this, PlayState* play) { if (func_8005B198() == this->actor.category || this->toggleDelay <= 0) { ObjLightswitch_SetupDisappear(this); } @@ -361,23 +360,23 @@ void ObjLightswitch_SetupDisappear(ObjLightswitch* this) { this->alpha = 255 << 6; } -void ObjLightswitch_Disappear(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_Disappear(ObjLightswitch* this, PlayState* play) { this->alpha -= 200; - ObjLightswitch_SpawnDisappearEffects(this, globalCtx); + ObjLightswitch_SpawnDisappearEffects(this, play); if (this->alpha < 0) { Actor_Kill(&this->actor); } } -void ObjLightswitch_Update(Actor* thisx, GlobalContext* globalCtx2) { +void ObjLightswitch_Update(Actor* thisx, PlayState* play2) { ObjLightswitch* this = (ObjLightswitch*)thisx; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; if (this->toggleDelay > 0) { this->toggleDelay--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { if ((this->actor.params & 1) == 1) { @@ -389,18 +388,18 @@ void ObjLightswitch_Update(Actor* thisx, GlobalContext* globalCtx2) { this->prevFrameACflags = this->collider.base.acFlags; this->collider.base.acFlags &= ~AC_HIT; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void ObjLightswitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_DrawOpa(ObjLightswitch* this, PlayState* play) { Actor* child; Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 809); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_lightswitch.c", 809); + func_80093D18(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, (u8)(this->color[0] >> 6), (u8)(this->color[1] >> 6), (u8)(this->color[2] >> 6), (u8)(this->alpha >> 6)); @@ -420,7 +419,7 @@ void ObjLightswitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) { pos.z = this->actor.world.pos.z; } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 841), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_lightswitch.c", 841), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sFaceTextures[this->faceTextureIndex])); gSPDisplayList(POLY_OPA_DISP++, object_lightswitch_DL_000260); @@ -430,27 +429,27 @@ void ObjLightswitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) { rot.z = this->actor.shape.rot.z + this->flameRingRot; Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 859), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_lightswitch.c", 859), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_lightswitch_DL_000398); rot.z = this->actor.shape.rot.z - this->flameRingRot; Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 873), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_lightswitch.c", 873), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_lightswitch_DL_000408); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 878); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_lightswitch.c", 878); } -void ObjLightswitch_DrawXlu(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_DrawXlu(ObjLightswitch* this, PlayState* play) { s32 pad; Vec3f sp68; Vec3s sp60; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 890); - func_80093D84(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_lightswitch.c", 890); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->color[0] >> 6), (u8)(this->color[1] >> 6), (u8)(this->color[2] >> 6), (u8)(this->alpha >> 6)); @@ -460,7 +459,7 @@ void ObjLightswitch_DrawXlu(ObjLightswitch* this, GlobalContext* globalCtx) { sp68.y = this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y); sp68.z = this->actor.world.pos.z; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 912), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_lightswitch.c", 912), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sFaceTextures[this->faceTextureIndex])); gSPDisplayList(POLY_XLU_DISP++, object_lightswitch_DL_000260); @@ -471,21 +470,21 @@ void ObjLightswitch_DrawXlu(ObjLightswitch* this, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(sp68.x, sp68.y, sp68.z, &sp60); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 930), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_lightswitch.c", 930), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_lightswitch_DL_000398); sp60.z = this->actor.shape.rot.z - this->flameRingRot; Matrix_SetTranslateRotateYXZ(sp68.x, sp68.y, sp68.z, &sp60); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 944), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_lightswitch.c", 944), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_lightswitch_DL_000408); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 949); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_lightswitch.c", 949); } -void ObjLightswitch_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjLightswitch_Draw(Actor* thisx, PlayState* play) { ObjLightswitch* this = (ObjLightswitch*)thisx; s32 alpha = this->alpha >> 6 & 0xFF; @@ -494,8 +493,8 @@ void ObjLightswitch_Draw(Actor* thisx, GlobalContext* globalCtx) { } if ((this->actor.params >> 4 & 3) == OBJLIGHTSWITCH_TYPE_BURN && (alpha > 0 || alpha < 255)) { - ObjLightswitch_DrawXlu(this, globalCtx); + ObjLightswitch_DrawXlu(this, play); } else { - ObjLightswitch_DrawOpa(this, globalCtx); + ObjLightswitch_DrawOpa(this, play); } } diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h index eace5a9054..b8420f2d4e 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h @@ -6,7 +6,7 @@ struct ObjLightswitch; -typedef void (*ObjLightswitchActionFunc)(struct ObjLightswitch*, GlobalContext*); +typedef void (*ObjLightswitchActionFunc)(struct ObjLightswitch*, PlayState*); typedef enum { /* 0 */ OBJLIGHTSWITCH_TYPE_STAY_ON, // doesn't turn off unless the switch flag is cleared some other way diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index 3a119ad36d..77a0f88c0f 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -9,11 +9,11 @@ #define FLAGS ACTOR_FLAG_4 -void ObjMakekinsuta_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMakekinsuta_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjMakekinsuta_Init(Actor* thisx, PlayState* play); +void ObjMakekinsuta_Update(Actor* thisx, PlayState* play); -void func_80B98320(ObjMakekinsuta* this, GlobalContext* globalCtx); -void ObjMakekinsuta_DoNothing(ObjMakekinsuta* this, GlobalContext* globalCtx); +void func_80B98320(ObjMakekinsuta* this, PlayState* play); +void ObjMakekinsuta_DoNothing(ObjMakekinsuta* this, PlayState* play); const ActorInit Obj_Makekinsuta_InitVars = { ACTOR_OBJ_MAKEKINSUTA, @@ -27,7 +27,7 @@ const ActorInit Obj_Makekinsuta_InitVars = { NULL, }; -void ObjMakekinsuta_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMakekinsuta_Init(Actor* thisx, PlayState* play) { ObjMakekinsuta* this = (ObjMakekinsuta*)thisx; if ((this->actor.params & 0x6000) == 0x4000) { @@ -44,10 +44,10 @@ void ObjMakekinsuta_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B98320; } -void func_80B98320(ObjMakekinsuta* this, GlobalContext* globalCtx) { +void func_80B98320(ObjMakekinsuta* this, PlayState* play) { if (this->unk_152 != 0) { - if (this->timer >= 60 && !func_8002DEEC(GET_PLAYER(globalCtx))) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SW, this->actor.world.pos.x, this->actor.world.pos.y, + if (this->timer >= 60 && !func_8002DEEC(GET_PLAYER(play))) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, (this->actor.params | 0x8000)); this->actionFunc = ObjMakekinsuta_DoNothing; } else { @@ -58,11 +58,11 @@ void func_80B98320(ObjMakekinsuta* this, GlobalContext* globalCtx) { } } -void ObjMakekinsuta_DoNothing(ObjMakekinsuta* this, GlobalContext* globalCtx) { +void ObjMakekinsuta_DoNothing(ObjMakekinsuta* this, PlayState* play) { } -void ObjMakekinsuta_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjMakekinsuta_Update(Actor* thisx, PlayState* play) { ObjMakekinsuta* this = (ObjMakekinsuta*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h index 3d7ebd0864..72aec99c56 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h @@ -6,7 +6,7 @@ struct ObjMakekinsuta; -typedef void (*ObjMakekinsutaActionFunc)(struct ObjMakekinsuta*, GlobalContext*); +typedef void (*ObjMakekinsutaActionFunc)(struct ObjMakekinsuta*, PlayState*); typedef struct ObjMakekinsuta { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c index 50704ed41a..d18d45b1d0 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c @@ -10,8 +10,8 @@ #define FLAGS ACTOR_FLAG_5 -void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjMakeoshihiki_Init(Actor* thisx, PlayState* play); +void ObjMakeoshihiki_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Makeoshihiki_InitVars = { ACTOR_OBJ_MAKEOSHIHIKI, ACTORCAT_PROP, FLAGS, @@ -46,16 +46,16 @@ static BlockConfig sBlocks[] = { static u32 sFlags[3][2] = { { 0, 0 }, { 1, 0 }, { 0, 1 } }; -static void (*sFlagSwitchFuncs[])(GlobalContext* globalCtx, s32 flag) = { Flags_UnsetSwitch, Flags_SetSwitch }; +static void (*sFlagSwitchFuncs[])(PlayState* play, s32 flag) = { Flags_UnsetSwitch, Flags_SetSwitch }; -void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMakeoshihiki_Init(Actor* thisx, PlayState* play) { BlockConfig* block = &sBlocks[thisx->home.rot.z & 1]; s32 typeIdx; Vec3f* spawnPos; - if (!((thisx->params >> 6) & 1) && Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + if (!((thisx->params >> 6) & 1) && Flags_GetSwitch(play, thisx->params & 0x3F)) { typeIdx = 1; - } else if (!((thisx->params >> 0xE) & 1) && Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + } else if (!((thisx->params >> 0xE) & 1) && Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { typeIdx = 2; } else { typeIdx = 0; @@ -63,9 +63,8 @@ void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx) { spawnPos = &block->posVecs[typeIdx]; - if (Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_OBJ_OSHIHIKI, spawnPos->x, spawnPos->y, - spawnPos->z, 0, block->rotY, 0, - ((block->color << 6) & 0xC0) | (block->type & 0xF) | 0xFF00) == NULL) { + if (Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_OBJ_OSHIHIKI, spawnPos->x, spawnPos->y, spawnPos->z, 0, + block->rotY, 0, ((block->color << 6) & 0xC0) | (block->type & 0xF) | 0xFF00) == NULL) { // "Push-pull block failure" osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("Error : 押し引きブロック発生失敗(%s %d)\n", "../z_obj_makeoshihiki.c", 194); @@ -80,7 +79,7 @@ void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(%s)(arg_data %04xF)(angleZ %d)\n", "../z_obj_makeoshihiki.c", thisx->params, thisx->home.rot.z); } -void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjMakeoshihiki_Draw(Actor* thisx, PlayState* play) { BlockConfig* block = &sBlocks[thisx->home.rot.z & 1]; s32 i; s32 sfxCond1; @@ -94,7 +93,7 @@ void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((thisx->params >> 6) & 1) { sfxCond1 = false; } else { - if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + if (Flags_GetSwitch(play, thisx->params & 0x3F)) { cond = true; } else { cond = false; @@ -105,7 +104,7 @@ void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((thisx->params >> 0xE) & 1) { sfxCond2 = false; } else { - if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) { cond2 = true; } else { cond2 = false; @@ -118,8 +117,8 @@ void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { } } - sFlagSwitchFuncs[sFlags[i][0]](globalCtx, thisx->params & 0x3F); - sFlagSwitchFuncs[sFlags[i][1]](globalCtx, (thisx->params >> 8) & 0x3F); + sFlagSwitchFuncs[sFlags[i][0]](play, thisx->params & 0x3F); + sFlagSwitchFuncs[sFlags[i][1]](play, (thisx->params >> 8) & 0x3F); if (block->unk_24[i] & 2) { ((ObjOshihiki*)thisx->child)->cantMove = true; diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index 002a9ed4ec..c1bd1853be 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -9,13 +9,13 @@ #define FLAGS 0 -void ObjMure_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMure_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjMure_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjMure_Init(Actor* thisx, PlayState* play); +void ObjMure_Destroy(Actor* thisx, PlayState* play); +void ObjMure_Update(Actor* thisx, PlayState* play); -void ObjMure_InitialAction(ObjMure* this, GlobalContext* globalCtx); -void ObjMure_CulledState(ObjMure* this, GlobalContext* globalCtx); -void ObjMure_ActiveState(ObjMure* this, GlobalContext* globalCtx); +void ObjMure_InitialAction(ObjMure* this, PlayState* play); +void ObjMure_CulledState(ObjMure* this, PlayState* play); +void ObjMure_ActiveState(ObjMure* this, PlayState* play); s32 ObjMure_GetMaxChildSpawns(ObjMure* this); @@ -59,7 +59,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1200, ICHAIN_STOP), }; -s32 ObjMure_SetCullingImpl(Actor* thisx, GlobalContext* globalCtx) { +s32 ObjMure_SetCullingImpl(Actor* thisx, PlayState* play) { ObjMure* this = (ObjMure*)thisx; s32 result; @@ -79,14 +79,14 @@ s32 ObjMure_SetCullingImpl(Actor* thisx, GlobalContext* globalCtx) { return result; } -s32 ObjMure_SetCulling(Actor* thisx, GlobalContext* globalCtx) { - if (!ObjMure_SetCullingImpl(thisx, globalCtx)) { +s32 ObjMure_SetCulling(Actor* thisx, PlayState* play) { + if (!ObjMure_SetCullingImpl(thisx, play)) { return false; } return true; } -void ObjMure_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure_Init(Actor* thisx, PlayState* play) { ObjMure* this = (ObjMure*)thisx; this->chNum = (thisx->params >> 0xC) & 0x0F; @@ -102,7 +102,7 @@ void ObjMure_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("Error 群れな敵 (%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 245, thisx->params); Actor_Kill(&this->actor); return; - } else if (!ObjMure_SetCulling(thisx, globalCtx)) { + } else if (!ObjMure_SetCulling(thisx, play)) { Actor_Kill(&this->actor); return; } @@ -115,7 +115,7 @@ void ObjMure_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjMure_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure_Destroy(Actor* thisx, PlayState* play) { } s32 ObjMure_GetMaxChildSpawns(ObjMure* this) { @@ -132,7 +132,7 @@ void ObjMure_GetSpawnPos(Vec3f* outPos, Vec3f* inPos, s32 ptn, s32 idx) { *outPos = *inPos; } -void ObjMure_SpawnActors0(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_SpawnActors0(ObjMure* this, PlayState* play) { ActorContext* ac; s32 i; Vec3f pos; @@ -149,10 +149,10 @@ void ObjMure_SpawnActors0(ObjMure* this, GlobalContext* globalCtx) { case OBJMURE_CHILD_STATE_1: break; case OBJMURE_CHILD_STATE_2: - ac = &globalCtx->actorCtx; + ac = &play->actorCtx; ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); this->children[i] = - Actor_Spawn(ac, globalCtx, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, + Actor_Spawn(ac, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type]); if (this->children[i] != NULL) { this->children[i]->flags |= ACTOR_FLAG_ENKUSA_CUT; @@ -162,10 +162,10 @@ void ObjMure_SpawnActors0(ObjMure* this, GlobalContext* globalCtx) { } break; default: - ac = &globalCtx->actorCtx; + ac = &play->actorCtx; ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); this->children[i] = - Actor_Spawn(ac, globalCtx, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, + Actor_Spawn(ac, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type]); if (this->children[i] != NULL) { this->children[i]->room = this->actor.room; @@ -177,8 +177,8 @@ void ObjMure_SpawnActors0(ObjMure* this, GlobalContext* globalCtx) { } } -void ObjMure_SpawnActors1(ObjMure* this, GlobalContext* globalCtx) { - ActorContext* ac = (ActorContext*)globalCtx; // fake match +void ObjMure_SpawnActors1(ObjMure* this, PlayState* play) { + ActorContext* ac = (ActorContext*)play; // fake match Actor* actor = &this->actor; Vec3f spawnPos; s32 maxChildren = ObjMure_GetMaxChildSpawns(this); @@ -188,9 +188,9 @@ void ObjMure_SpawnActors1(ObjMure* this, GlobalContext* globalCtx) { if (this->children[i] != NULL) { osSyncPrintf("Error : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 407, actor->params); } - ac = &globalCtx->actorCtx; + ac = &play->actorCtx; ObjMure_GetSpawnPos(&spawnPos, &actor->world.pos, this->ptn, i); - this->children[i] = Actor_Spawn(ac, globalCtx, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, spawnPos.z, + this->children[i] = Actor_Spawn(ac, play, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, spawnPos.z, actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, (this->type == 4 && i == 0) ? 1 : sSpawnParams[this->type]); if (this->children[i] != NULL) { @@ -203,18 +203,18 @@ void ObjMure_SpawnActors1(ObjMure* this, GlobalContext* globalCtx) { } } -void ObjMure_SpawnActors(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_SpawnActors(ObjMure* this, PlayState* play) { switch (this->svNum) { case 0: - ObjMure_SpawnActors0(this, globalCtx); + ObjMure_SpawnActors0(this, play); break; case 1: - ObjMure_SpawnActors1(this, globalCtx); + ObjMure_SpawnActors1(this, play); break; } } -void ObjMure_KillActorsImpl(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_KillActorsImpl(ObjMure* this, PlayState* play) { s32 maxChildren = ObjMure_GetMaxChildSpawns(this); s32 i; @@ -231,7 +231,7 @@ void ObjMure_KillActorsImpl(ObjMure* this, GlobalContext* globalCtx) { break; default: if (this->children[i] != NULL) { - if (Actor_HasParent(this->children[i], globalCtx)) { + if (Actor_HasParent(this->children[i], play)) { this->children[i] = NULL; } else { Actor_Kill(this->children[i]); @@ -243,11 +243,11 @@ void ObjMure_KillActorsImpl(ObjMure* this, GlobalContext* globalCtx) { } } -void ObjMure_KillActors(ObjMure* this, GlobalContext* globalCtx) { - ObjMure_KillActorsImpl(this, globalCtx); +void ObjMure_KillActors(ObjMure* this, PlayState* play) { + ObjMure_KillActorsImpl(this, play); } -void ObjMure_CheckChildren(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_CheckChildren(ObjMure* this, PlayState* play) { s32 maxChildren = ObjMure_GetMaxChildSpawns(this); s32 i; @@ -270,15 +270,15 @@ void ObjMure_CheckChildren(ObjMure* this, GlobalContext* globalCtx) { } } -void ObjMure_InitialAction(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_InitialAction(ObjMure* this, PlayState* play) { this->actionFunc = ObjMure_CulledState; } -void ObjMure_CulledState(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_CulledState(ObjMure* this, PlayState* play) { if (fabsf(this->actor.projectedPos.z) < sZClip[this->type]) { this->actionFunc = ObjMure_ActiveState; this->actor.flags |= ACTOR_FLAG_4; - ObjMure_SpawnActors(this, globalCtx); + ObjMure_SpawnActors(this, play); } } @@ -328,7 +328,7 @@ void ObjMure_SetChildToFollowPlayer(ObjMure* this, s32 idx1) { } // Fish, Bugs -void ObjMure_GroupBehavior0(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_GroupBehavior0(ObjMure* this, PlayState* play) { if (this->unk_1A4 <= 0) { if (this->unk_1A6) { this->unk_1A6 = false; @@ -362,7 +362,7 @@ void ObjMure_GroupBehavior0(ObjMure* this, GlobalContext* globalCtx) { } // Butterflies -void ObjMure_GroupBehavior1(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_GroupBehavior1(ObjMure* this, PlayState* play) { s32 maxChildren; s32 i; @@ -396,22 +396,22 @@ static ObjMureActionFunc sTypeGroupBehaviorFunc[] = { NULL, NULL, ObjMure_GroupBehavior0, ObjMure_GroupBehavior0, ObjMure_GroupBehavior1, }; -void ObjMure_ActiveState(ObjMure* this, GlobalContext* globalCtx) { - ObjMure_CheckChildren(this, globalCtx); +void ObjMure_ActiveState(ObjMure* this, PlayState* play) { + ObjMure_CheckChildren(this, play); if (sZClip[this->type] + 40.0f <= fabsf(this->actor.projectedPos.z)) { this->actionFunc = ObjMure_CulledState; this->actor.flags &= ~ACTOR_FLAG_4; - ObjMure_KillActors(this, globalCtx); + ObjMure_KillActors(this, play); } else if (sTypeGroupBehaviorFunc[this->type] != NULL) { - sTypeGroupBehaviorFunc[this->type](this, globalCtx); + sTypeGroupBehaviorFunc[this->type](this, play); } } -void ObjMure_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure_Update(Actor* thisx, PlayState* play) { ObjMure* this = (ObjMure*)thisx; if (this->unk_1A4 > 0) { this->unk_1A4--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h index e7c83d94bf..386c6ed0d8 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h @@ -6,7 +6,7 @@ struct ObjMure; -typedef void (*ObjMureActionFunc)(struct ObjMure*, GlobalContext*); +typedef void (*ObjMureActionFunc)(struct ObjMure*, PlayState*); #define OBJMURE_MAX_SPAWNS 15 diff --git a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c index 8ec37ecbf6..3187a7725b 100644 --- a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c +++ b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c @@ -15,15 +15,15 @@ typedef struct { s16 angle; } Mure2sScatteredShrubInfo; -void ObjMure2_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMure2_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjMure2_Init(Actor* thisx, PlayState* play); +void ObjMure2_Update(Actor* thisx, PlayState* play); void ObjMure2_SetPosShrubCircle(Vec3f* vec, ObjMure2* this); void ObjMure2_SetPosShrubScattered(Vec3f* vec, ObjMure2* this); void ObjMure2_SetPosRockCircle(Vec3f* vec, ObjMure2* this); -void ObjMure2_Wait(ObjMure2* this, GlobalContext* globalCtx); -void func_80B9A668(ObjMure2* this, GlobalContext* globalCtx); -void func_80B9A6F8(ObjMure2* this, GlobalContext* globalCtx); +void ObjMure2_Wait(ObjMure2* this, PlayState* play); +void func_80B9A668(ObjMure2* this, PlayState* play); +void func_80B9A6F8(ObjMure2* this, PlayState* play); void ObjMure2_SetupWait(ObjMure2* this); void func_80B9A658(ObjMure2* this); void func_80B9A6E8(ObjMure2* this); @@ -95,7 +95,7 @@ void ObjMure2_SetActorSpawnParams(s16* params, ObjMure2* this) { *params |= (dropTable << 8); } -void ObjMure2_SpawnActors(ObjMure2* this, GlobalContext* globalCtx) { +void ObjMure2_SpawnActors(ObjMure2* this, PlayState* play) { static ObjMure2SetPosFunc setPosFunc[] = { ObjMure2_SetPosShrubCircle, ObjMure2_SetPosShrubScattered, @@ -119,7 +119,7 @@ void ObjMure2_SpawnActors(ObjMure2* this, GlobalContext* globalCtx) { if (((this->currentActorNum >> i) & 1) == 0) { this->actorSpawnPtrList[i] = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, sActorSpawnIDs[actorNum], spawnPos[i].x, spawnPos[i].y, + Actor_Spawn(&play->actorCtx, play, sActorSpawnIDs[actorNum], spawnPos[i].x, spawnPos[i].y, spawnPos[i].z, this->actor.world.rot.x, 0, this->actor.world.rot.z, params); if (this->actorSpawnPtrList[i] != NULL) { this->actorSpawnPtrList[i]->room = this->actor.room; @@ -128,13 +128,13 @@ void ObjMure2_SpawnActors(ObjMure2* this, GlobalContext* globalCtx) { } } -void ObjMure2_CleanupAndDie(ObjMure2* this, GlobalContext* globalCtx) { +void ObjMure2_CleanupAndDie(ObjMure2* this, PlayState* play) { s32 i; for (i = 0; i < D_80B9A818[this->actor.params & 3]; i++) { if (((this->currentActorNum >> i) & 1) == 0) { if (this->actorSpawnPtrList[i] != NULL) { - if (Actor_HasParent(this->actorSpawnPtrList[i], globalCtx)) { + if (Actor_HasParent(this->actorSpawnPtrList[i], play)) { this->currentActorNum |= (1 << i); } else { Actor_Kill(this->actorSpawnPtrList[i]); @@ -165,11 +165,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), }; -void ObjMure2_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure2_Init(Actor* thisx, PlayState* play) { ObjMure2* this = (ObjMure2*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - if (globalCtx->csCtx.state != CS_STATE_IDLE) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.uncullZoneForward += 1200.0f; } ObjMure2_SetupWait(this); @@ -179,7 +179,7 @@ void ObjMure2_SetupWait(ObjMure2* this) { this->actionFunc = ObjMure2_Wait; } -void ObjMure2_Wait(ObjMure2* this, GlobalContext* globalCtx) { +void ObjMure2_Wait(ObjMure2* this, PlayState* play) { func_80B9A658(this); } @@ -187,11 +187,11 @@ void func_80B9A658(ObjMure2* this) { this->actionFunc = func_80B9A668; } -void func_80B9A668(ObjMure2* this, GlobalContext* globalCtx) { +void func_80B9A668(ObjMure2* this, PlayState* play) { if (Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z) < (sDistSquared1[this->actor.params & 3] * this->unk_184)) { this->actor.flags |= ACTOR_FLAG_4; - ObjMure2_SpawnActors(this, globalCtx); + ObjMure2_SpawnActors(this, play); func_80B9A6E8(this); } } @@ -200,23 +200,23 @@ void func_80B9A6E8(ObjMure2* this) { this->actionFunc = func_80B9A6F8; } -void func_80B9A6F8(ObjMure2* this, GlobalContext* globalCtx) { +void func_80B9A6F8(ObjMure2* this, PlayState* play) { func_80B9A534(this); if ((sDistSquared2[this->actor.params & 3] * this->unk_184) <= Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z)) { this->actor.flags &= ~ACTOR_FLAG_4; - ObjMure2_CleanupAndDie(this, globalCtx); + ObjMure2_CleanupAndDie(this, play); func_80B9A658(this); } } -void ObjMure2_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure2_Update(Actor* thisx, PlayState* play) { ObjMure2* this = (ObjMure2*)thisx; - if (globalCtx->csCtx.state == CS_STATE_IDLE) { + if (play->csCtx.state == CS_STATE_IDLE) { this->unk_184 = 1.0f; } else { this->unk_184 = 4.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h index c89e0139f4..a197e9f7b0 100644 --- a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h +++ b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h @@ -6,7 +6,7 @@ struct ObjMure2; -typedef void (*ObjMure2ActionFunc)(struct ObjMure2*, GlobalContext*); +typedef void (*ObjMure2ActionFunc)(struct ObjMure2*, PlayState*); typedef struct ObjMure2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c index 83634e255d..233acdba1f 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c @@ -8,16 +8,16 @@ #define FLAGS 0 -void ObjMure3_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMure3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjMure3_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjMure3_Init(Actor* thisx, PlayState* play); +void ObjMure3_Destroy(Actor* thisx, PlayState* play); +void ObjMure3_Update(Actor* thisx, PlayState* play); void func_80B9AF24(ObjMure3* this); -void func_80B9AF34(ObjMure3* this, GlobalContext* globalCtx); +void func_80B9AF34(ObjMure3* this, PlayState* play); void func_80B9AF54(ObjMure3* this); -void func_80B9AF64(ObjMure3* this, GlobalContext* globalCtx); +void func_80B9AF64(ObjMure3* this, PlayState* play); void func_80B9AFEC(ObjMure3* this); -void func_80B9AFFC(ObjMure3* this, GlobalContext* globalCtx); +void func_80B9AFFC(ObjMure3* this, PlayState* play); const ActorInit Obj_Mure3_InitVars = { ACTOR_OBJ_MURE3, @@ -39,14 +39,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), }; -void func_80B9A9D0(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9A9D0(ObjMure3* this, PlayState* play) { s32 i; Vec3f spawnPos; Math_Vec3f_Copy(&spawnPos, &this->actor.world.pos); for (i = 0; i < 5; i++, spawnPos.y += 20.0f) { if (!((this->unk_16C >> i) & 1)) { - this->unk_150[i] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_BLUE); + this->unk_150[i] = Item_DropCollectible2(play, &spawnPos, 0x4000 | ITEM00_RUPEE_BLUE); if (this->unk_150[i] != NULL) { this->unk_150[i]->actor.room = this->actor.room; } @@ -54,7 +54,7 @@ void func_80B9A9D0(ObjMure3* this, GlobalContext* globalCtx) { } } -void func_80B9AA90(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9AA90(ObjMure3* this, PlayState* play) { s32 i; Vec3f spawnPos; f32 sn = Math_SinS(this->actor.world.rot.y); @@ -67,7 +67,7 @@ void func_80B9AA90(ObjMure3* this, GlobalContext* globalCtx) { if (!((this->unk_16C >> i) & 1)) { spawnPos.x = this->actor.world.pos.x + (sn * radius); spawnPos.z = this->actor.world.pos.z + (cos * radius); - this->unk_150[i] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_GREEN); + this->unk_150[i] = Item_DropCollectible2(play, &spawnPos, 0x4000 | ITEM00_RUPEE_GREEN); if (this->unk_150[i] != NULL) { this->unk_150[i]->actor.room = this->actor.room; } @@ -75,7 +75,7 @@ void func_80B9AA90(ObjMure3* this, GlobalContext* globalCtx) { } } -void func_80B9ABA0(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9ABA0(ObjMure3* this, PlayState* play) { s32 i; Vec3f spawnPos; s16 yRot; @@ -86,7 +86,7 @@ void func_80B9ABA0(ObjMure3* this, GlobalContext* globalCtx) { if (!((this->unk_16C >> i) & 1)) { spawnPos.x = (Math_SinS(yRot) * 40.0f) + this->actor.world.pos.x; spawnPos.z = (Math_CosS(yRot) * 40.0f) + this->actor.world.pos.z; - this->unk_150[i] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_GREEN); + this->unk_150[i] = Item_DropCollectible2(play, &spawnPos, 0x4000 | ITEM00_RUPEE_GREEN); if (this->unk_150[i] != NULL) { this->unk_150[i]->actor.room = this->actor.room; } @@ -96,14 +96,14 @@ void func_80B9ABA0(ObjMure3* this, GlobalContext* globalCtx) { if (!((this->unk_16C >> 6) & 1)) { spawnPos.x = this->actor.world.pos.x; spawnPos.z = this->actor.world.pos.z; - this->unk_150[6] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_RED); + this->unk_150[6] = Item_DropCollectible2(play, &spawnPos, 0x4000 | ITEM00_RUPEE_RED); if (this->unk_150[6] != NULL) { this->unk_150[6]->actor.room = this->actor.room; } } } -void func_80B9ACE4(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9ACE4(ObjMure3* this, PlayState* play) { s16 count = sRupeeCounts[(this->actor.params >> 13) & 7]; s32 i; @@ -111,7 +111,7 @@ void func_80B9ACE4(ObjMure3* this, GlobalContext* globalCtx) { EnItem00** collectible = &this->unk_150[i]; if (!((this->unk_16C >> i) & 1) && (*collectible != NULL)) { - if (Actor_HasParent(&(*collectible)->actor, globalCtx) || ((*collectible)->actor.update == NULL)) { + if (Actor_HasParent(&(*collectible)->actor, play) || ((*collectible)->actor.update == NULL)) { this->unk_16C |= (1 << i); } else { Actor_Kill(&(*collectible)->actor); @@ -121,7 +121,7 @@ void func_80B9ACE4(ObjMure3* this, GlobalContext* globalCtx) { } } -void func_80B9ADCC(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9ADCC(ObjMure3* this, PlayState* play) { s16 count = sRupeeCounts[(this->actor.params >> 13) & 7]; s32 i; @@ -129,8 +129,8 @@ void func_80B9ADCC(ObjMure3* this, GlobalContext* globalCtx) { EnItem00** collectible = &this->unk_150[i]; if ((*collectible != NULL) && !((this->unk_16C >> i) & 1)) { - if (Actor_HasParent(&(*collectible)->actor, globalCtx)) { - Flags_SetSwitch(globalCtx, this->actor.params & 0x3F); + if (Actor_HasParent(&(*collectible)->actor, play)) { + Flags_SetSwitch(play, this->actor.params & 0x3F); } if ((*collectible)->actor.update == NULL) { this->unk_16C |= (1 << i); @@ -140,11 +140,11 @@ void func_80B9ADCC(ObjMure3* this, GlobalContext* globalCtx) { } } -void ObjMure3_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure3_Init(Actor* thisx, PlayState* play) { s32 pad; ObjMure3* this = (ObjMure3*)thisx; - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->actor.params & 0x3F)) { Actor_Kill(&this->actor); return; } @@ -152,14 +152,14 @@ void ObjMure3_Init(Actor* thisx, GlobalContext* globalCtx) { func_80B9AF24(this); } -void ObjMure3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure3_Destroy(Actor* thisx, PlayState* play) { } void func_80B9AF24(ObjMure3* this) { this->actionFunc = func_80B9AF34; } -void func_80B9AF34(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9AF34(ObjMure3* this, PlayState* play) { func_80B9AF54(this); } @@ -167,12 +167,12 @@ void func_80B9AF54(ObjMure3* this) { this->actionFunc = func_80B9AF64; } -void func_80B9AF64(ObjMure3* this, GlobalContext* globalCtx) { +void func_80B9AF64(ObjMure3* this, PlayState* play) { static ObjMure3SpawnFunc spawnFuncs[] = { func_80B9A9D0, func_80B9AA90, func_80B9ABA0 }; if (Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z) < SQ(1150.0f)) { this->actor.flags |= ACTOR_FLAG_4; - spawnFuncs[(this->actor.params >> 13) & 7](this, globalCtx); + spawnFuncs[(this->actor.params >> 13) & 7](this, play); func_80B9AFEC(this); } } @@ -181,17 +181,17 @@ void func_80B9AFEC(ObjMure3* this) { this->actionFunc = func_80B9AFFC; } -void func_80B9AFFC(ObjMure3* this, GlobalContext* globalCtx) { - func_80B9ADCC(this, globalCtx); +void func_80B9AFFC(ObjMure3* this, PlayState* play) { + func_80B9ADCC(this, play); if (Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z) >= SQ(1450.0f)) { this->actor.flags &= ~ACTOR_FLAG_4; - func_80B9ACE4(this, globalCtx); + func_80B9ACE4(this, play); func_80B9AF54(this); } } -void ObjMure3_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure3_Update(Actor* thisx, PlayState* play) { ObjMure3* this = (ObjMure3*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h index b4e71c1b9b..415babc61b 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h @@ -6,8 +6,8 @@ struct ObjMure3; -typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, GlobalContext*); -typedef void (*ObjMure3SpawnFunc)(struct ObjMure3*, GlobalContext*); +typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, PlayState*); +typedef void (*ObjMure3SpawnFunc)(struct ObjMure3*, PlayState*); typedef struct ObjMure3 { /* 0x0000 */ Actor actor; 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 f615a12e9d..f7581c443b 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -10,19 +10,19 @@ #define FLAGS ACTOR_FLAG_4 -void ObjOshihiki_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjOshihiki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjOshihiki_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjOshihiki_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjOshihiki_Init(Actor* thisx, PlayState* play); +void ObjOshihiki_Destroy(Actor* thisx, PlayState* play); +void ObjOshihiki_Update(Actor* thisx, PlayState* play); +void ObjOshihiki_Draw(Actor* thisx, PlayState* play); -void ObjOshihiki_SetupOnScene(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_OnScene(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_SetupOnActor(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_SetupPush(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_SetupFall(ObjOshihiki* this, GlobalContext* globalCtx); -void ObjOshihiki_Fall(ObjOshihiki* this, GlobalContext* globalCtx); +void ObjOshihiki_SetupOnScene(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_OnScene(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_SetupOnActor(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_SetupPush(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_SetupFall(ObjOshihiki* this, PlayState* play); +void ObjOshihiki_Fall(ObjOshihiki* this, PlayState* play); const ActorInit Obj_Oshihiki_InitVars = { ACTOR_OBJ_OSHIHIKI, @@ -83,14 +83,14 @@ static Vec2f sFaceDirection[] = { { -1.0f, -1.0f }, }; -void ObjOshihiki_InitDynapoly(ObjOshihiki* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void ObjOshihiki_InitDynapoly(ObjOshihiki* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG registration failure" @@ -139,12 +139,12 @@ void ObjOshihiki_ResetFloors(ObjOshihiki* this) { } } -ObjOshihiki* ObjOshihiki_GetBlockUnder(ObjOshihiki* this, GlobalContext* globalCtx) { +ObjOshihiki* ObjOshihiki_GetBlockUnder(ObjOshihiki* this, PlayState* play) { DynaPolyActor* dynaPolyActor; if ((this->floorBgIds[this->highestFloor] != BGCHECK_SCENE) && (fabsf(this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) < 0.001f)) { - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->floorBgIds[this->highestFloor]); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->floorBgIds[this->highestFloor]); if ((dynaPolyActor != NULL) && (dynaPolyActor->actor.id == ACTOR_OBJ_OSHIHIKI)) { return (ObjOshihiki*)dynaPolyActor; } @@ -173,7 +173,7 @@ void ObjOshihiki_UpdateInitPos(ObjOshihiki* this) { } } -s32 ObjOshihiki_NoSwitchPress(ObjOshihiki* this, DynaPolyActor* dyna, GlobalContext* globalCtx) { +s32 ObjOshihiki_NoSwitchPress(ObjOshihiki* this, DynaPolyActor* dyna, PlayState* play) { s16 dynaSwitchFlag; if (dyna == NULL) { @@ -183,13 +183,13 @@ s32 ObjOshihiki_NoSwitchPress(ObjOshihiki* this, DynaPolyActor* dyna, GlobalCont switch (dyna->actor.params & 0x33) { case 0x20: // Normal blue switch if ((dynaSwitchFlag == ((this->dyna.actor.params >> 8) & 0x3F)) && - Flags_GetSwitch(globalCtx, dynaSwitchFlag)) { + Flags_GetSwitch(play, dynaSwitchFlag)) { return 0; } break; case 0x30: // Inverse blue switch if ((dynaSwitchFlag == ((this->dyna.actor.params >> 8) & 0x3F)) && - !Flags_GetSwitch(globalCtx, dynaSwitchFlag)) { + !Flags_GetSwitch(play, dynaSwitchFlag)) { return 0; } break; @@ -198,7 +198,7 @@ s32 ObjOshihiki_NoSwitchPress(ObjOshihiki* this, DynaPolyActor* dyna, GlobalCont return 1; } -void ObjOshihiki_CheckType(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_CheckType(ObjOshihiki* this, PlayState* play) { switch (this->dyna.actor.params & 0xF) { case PUSHBLOCK_SMALL_START_ON: case PUSHBLOCK_MEDIUM_START_ON: @@ -208,7 +208,7 @@ void ObjOshihiki_CheckType(ObjOshihiki* this, GlobalContext* globalCtx) { case PUSHBLOCK_MEDIUM_START_OFF: case PUSHBLOCK_LARGE_START_OFF: case PUSHBLOCK_HUGE_START_OFF: - ObjOshihiki_InitDynapoly(this, globalCtx, &gPushBlockCol, 1); + ObjOshihiki_InitDynapoly(this, play, &gPushBlockCol, 1); break; default: // "Error : type cannot be determined" @@ -218,11 +218,11 @@ void ObjOshihiki_CheckType(ObjOshihiki* this, GlobalContext* globalCtx) { } } -void ObjOshihiki_SetScale(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetScale(ObjOshihiki* this, PlayState* play) { Actor_SetScale(&this->dyna.actor, sScales[this->dyna.actor.params & 0xF]); } -void ObjOshihiki_SetTexture(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetTexture(ObjOshihiki* this, PlayState* play) { switch (this->dyna.actor.params & 0xF) { case PUSHBLOCK_SMALL_START_ON: case PUSHBLOCK_MEDIUM_START_ON: @@ -241,7 +241,7 @@ void ObjOshihiki_SetTexture(ObjOshihiki* this, GlobalContext* globalCtx) { } } -void ObjOshihiki_SetColor(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetColor(ObjOshihiki* this, PlayState* play) { Color_RGB8* src; Color_RGB8* color = &this->color; s16 paramsColorIdx; @@ -250,7 +250,7 @@ void ObjOshihiki_SetColor(ObjOshihiki* this, GlobalContext* globalCtx) { paramsColorIdx = (this->dyna.actor.params >> 6) & 3; for (i = 0; i < ARRAY_COUNT(sScenes); i++) { - if (sScenes[i] == globalCtx->sceneNum) { + if (sScenes[i] == play->sceneNum) { break; } } @@ -267,14 +267,14 @@ void ObjOshihiki_SetColor(ObjOshihiki* this, GlobalContext* globalCtx) { } } -void ObjOshihiki_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjOshihiki_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjOshihiki* this = (ObjOshihiki*)thisx; - ObjOshihiki_CheckType(this, globalCtx); + ObjOshihiki_CheckType(this, play); if ((((this->dyna.actor.params >> 8) & 0xFF) >= 0) && (((this->dyna.actor.params >> 8) & 0xFF) <= 0x3F)) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { switch (this->dyna.actor.params & 0xF) { case PUSHBLOCK_SMALL_START_ON: case PUSHBLOCK_MEDIUM_START_ON: @@ -295,25 +295,25 @@ void ObjOshihiki_Init(Actor* thisx, GlobalContext* globalCtx2) { } } - ObjOshihiki_SetScale(this, globalCtx); - ObjOshihiki_SetTexture(this, globalCtx); + ObjOshihiki_SetScale(this, play); + ObjOshihiki_SetTexture(this, play); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - ObjOshihiki_SetColor(this, globalCtx); + ObjOshihiki_SetColor(this, play); ObjOshihiki_ResetFloors(this); - ObjOshihiki_SetupOnActor(this, globalCtx); + ObjOshihiki_SetupOnActor(this, play); // "(dungeon keep push-pull block)" osSyncPrintf("(dungeon keep 押し引きブロック)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void ObjOshihiki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjOshihiki_Destroy(Actor* thisx, PlayState* play) { s32 pad; ObjOshihiki* this = (ObjOshihiki*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjOshihiki_SetFloors(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetFloors(ObjOshihiki* this, PlayState* play) { s32 i; for (i = 0; i < 5; i++) { @@ -332,8 +332,8 @@ void ObjOshihiki_SetFloors(ObjOshihiki* this, GlobalContext* globalCtx) { floorPoly = &this->floorPolys[i]; floorBgId = &this->floorBgIds[i]; - this->floorHeights[i] = BgCheck_EntityRaycastFloor6(&globalCtx->colCtx, floorPoly, floorBgId, &this->dyna.actor, - &colCheckPoint, 0.0f); + this->floorHeights[i] = + BgCheck_EntityRaycastFloor6(&play->colCtx, floorPoly, floorBgId, &this->dyna.actor, &colCheckPoint, 0.0f); } } @@ -353,15 +353,15 @@ s16 ObjOshihiki_GetHighestFloor(ObjOshihiki* this) { return highestFloor; } -void ObjOshihiki_SetGround(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetGround(ObjOshihiki* this, PlayState* play) { ObjOshihiki_ResetFloors(this); - ObjOshihiki_SetFloors(this, globalCtx); + ObjOshihiki_SetFloors(this, play); this->highestFloor = ObjOshihiki_GetHighestFloor(this); this->dyna.actor.floorHeight = this->floorHeights[this->highestFloor]; } -s32 ObjOshihiki_CheckFloor(ObjOshihiki* this, GlobalContext* globalCtx) { - ObjOshihiki_SetGround(this, globalCtx); +s32 ObjOshihiki_CheckFloor(ObjOshihiki* this, PlayState* play) { + ObjOshihiki_SetGround(this, play); if ((this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) >= -0.001f) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; @@ -371,7 +371,7 @@ s32 ObjOshihiki_CheckFloor(ObjOshihiki* this, GlobalContext* globalCtx) { return 0; } -s32 ObjOshihiki_CheckGround(ObjOshihiki* this, GlobalContext* globalCtx) { +s32 ObjOshihiki_CheckGround(ObjOshihiki* this, PlayState* play) { if (this->dyna.actor.world.pos.y <= BGCHECK_Y_MIN + 10.0f) { // "Warning : Push-pull block fell too much" osSyncPrintf("Warning : 押し引きブロック落ちすぎた(%s %d)(arg_data 0x%04x)\n", "../z_obj_oshihiki.c", 809, @@ -386,7 +386,7 @@ s32 ObjOshihiki_CheckGround(ObjOshihiki* this, GlobalContext* globalCtx) { return 0; } -s32 ObjOshihiki_CheckWall(GlobalContext* globalCtx, s16 angle, f32 direction, ObjOshihiki* this) { +s32 ObjOshihiki_CheckWall(PlayState* play, s16 angle, f32 direction, ObjOshihiki* this) { f32 maxDist = ((direction >= 0.0f) ? 1.0f : -1.0f) * (300.0f * this->dyna.actor.scale.x + 20.0f - 0.5f); f32 sn = Math_SinS(angle); f32 cs = Math_CosS(angle); @@ -410,20 +410,20 @@ s32 ObjOshihiki_CheckWall(GlobalContext* globalCtx, s16 angle, f32 direction, Ob faceVtxNext.x = faceVtx.x + maxDist * sn; faceVtxNext.y = faceVtx.y; faceVtxNext.z = faceVtx.z + maxDist * cs; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &faceVtx, &faceVtxNext, &posResult, &outPoly, true, false, - false, true, &bgId, &this->dyna.actor, 0.0f)) { + if (BgCheck_EntityLineTest3(&play->colCtx, &faceVtx, &faceVtxNext, &posResult, &outPoly, true, false, false, + true, &bgId, &this->dyna.actor, 0.0f)) { return true; } } return false; } -s32 ObjOshihiki_MoveWithBlockUnder(ObjOshihiki* this, GlobalContext* globalCtx) { +s32 ObjOshihiki_MoveWithBlockUnder(ObjOshihiki* this, PlayState* play) { s32 pad; - ObjOshihiki* blockUnder = ObjOshihiki_GetBlockUnder(this, globalCtx); + ObjOshihiki* blockUnder = ObjOshihiki_GetBlockUnder(this, play); if ((blockUnder != NULL) && (blockUnder->stateFlags & PUSHBLOCK_SETUP_PUSH) && - !ObjOshihiki_CheckWall(globalCtx, blockUnder->dyna.unk_158, blockUnder->direction, this)) { + !ObjOshihiki_CheckWall(play, blockUnder->dyna.unk_158, blockUnder->direction, this)) { this->blockUnder = blockUnder; } @@ -442,23 +442,23 @@ s32 ObjOshihiki_MoveWithBlockUnder(ObjOshihiki* this, GlobalContext* globalCtx) return false; } -void ObjOshihiki_SetupOnScene(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetupOnScene(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_SETUP_ON_SCENE; this->actionFunc = ObjOshihiki_OnScene; this->dyna.actor.gravity = 0.0f; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; } -void ObjOshihiki_OnScene(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_OnScene(ObjOshihiki* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->stateFlags |= PUSHBLOCK_ON_SCENE; if ((this->timer <= 0) && (fabsf(this->dyna.unk_150) > 0.001f)) { if (ObjOshihiki_StrongEnough(this) && - !ObjOshihiki_CheckWall(globalCtx, this->dyna.unk_158, this->dyna.unk_150, this)) { + !ObjOshihiki_CheckWall(play, this->dyna.unk_158, this->dyna.unk_150, this)) { this->direction = this->dyna.unk_150; - ObjOshihiki_SetupPush(this, globalCtx); + ObjOshihiki_SetupPush(this, play); } else { player->stateFlags2 &= ~PLAYER_STATE2_4; this->dyna.unk_150 = 0.0f; @@ -469,37 +469,37 @@ void ObjOshihiki_OnScene(ObjOshihiki* this, GlobalContext* globalCtx) { } } -void ObjOshihiki_SetupOnActor(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetupOnActor(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_SETUP_ON_ACTOR; this->actionFunc = ObjOshihiki_OnActor; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; this->dyna.actor.gravity = -1.0f; } -void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { s32 bgId; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); DynaPolyActor* dynaPolyActor; this->stateFlags |= PUSHBLOCK_ON_ACTOR; Actor_MoveForward(&this->dyna.actor); - if (ObjOshihiki_CheckFloor(this, globalCtx)) { + if (ObjOshihiki_CheckFloor(this, play)) { bgId = this->floorBgIds[this->highestFloor]; if (bgId == BGCHECK_SCENE) { - ObjOshihiki_SetupOnScene(this, globalCtx); + ObjOshihiki_SetupOnScene(this, play); } else { - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if (dynaPolyActor != NULL) { func_800434A8(dynaPolyActor); func_80043538(dynaPolyActor); if ((this->timer <= 0) && (fabsf(this->dyna.unk_150) > 0.001f)) { - if (ObjOshihiki_StrongEnough(this) && ObjOshihiki_NoSwitchPress(this, dynaPolyActor, globalCtx) && - !ObjOshihiki_CheckWall(globalCtx, this->dyna.unk_158, this->dyna.unk_150, this)) { + if (ObjOshihiki_StrongEnough(this) && ObjOshihiki_NoSwitchPress(this, dynaPolyActor, play) && + !ObjOshihiki_CheckWall(play, this->dyna.unk_158, this->dyna.unk_150, this)) { this->direction = this->dyna.unk_150; - ObjOshihiki_SetupPush(this, globalCtx); + ObjOshihiki_SetupPush(this, play); } else { player->stateFlags2 &= ~PLAYER_STATE2_4; this->dyna.unk_150 = 0.0f; @@ -509,36 +509,36 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) { this->dyna.unk_150 = 0.0f; } } else { - ObjOshihiki_SetupOnScene(this, globalCtx); + ObjOshihiki_SetupOnScene(this, play); } } } else { bgId = this->floorBgIds[this->highestFloor]; if (bgId == BGCHECK_SCENE) { - ObjOshihiki_SetupFall(this, globalCtx); + ObjOshihiki_SetupFall(this, play); } else { - dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if ((dynaPolyActor != NULL) && (dynaPolyActor->unk_15C & 1)) { func_800434A8(dynaPolyActor); func_80043538(dynaPolyActor); this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } else { - ObjOshihiki_SetupFall(this, globalCtx); + ObjOshihiki_SetupFall(this, play); } } } } -void ObjOshihiki_SetupPush(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetupPush(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_SETUP_PUSH; this->actionFunc = ObjOshihiki_Push; this->dyna.actor.gravity = 0.0f; } -void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 pushDistSigned; s32 stopFlag; @@ -550,17 +550,17 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { thisx->world.pos.x = thisx->home.pos.x + (pushDistSigned * this->yawSin); thisx->world.pos.z = thisx->home.pos.z + (pushDistSigned * this->yawCos); - if (!ObjOshihiki_CheckFloor(this, globalCtx)) { + if (!ObjOshihiki_CheckFloor(this, play)) { thisx->home.pos.x = thisx->world.pos.x; thisx->home.pos.z = thisx->world.pos.z; player->stateFlags2 &= ~PLAYER_STATE2_4; this->dyna.unk_150 = 0.0f; this->pushDist = 0.0f; this->pushSpeed = 0.0f; - ObjOshihiki_SetupFall(this, globalCtx); + ObjOshihiki_SetupFall(this, play); } else if (stopFlag) { - player = GET_PLAYER(globalCtx); - if (ObjOshihiki_CheckWall(globalCtx, this->dyna.unk_158, this->dyna.unk_150, this)) { + player = GET_PLAYER(play); + if (ObjOshihiki_CheckWall(play, this->dyna.unk_158, this->dyna.unk_150, this)) { Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND); } @@ -572,24 +572,24 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { this->pushSpeed = 0.0f; this->timer = 10; if (this->floorBgIds[this->highestFloor] == BGCHECK_SCENE) { - ObjOshihiki_SetupOnScene(this, globalCtx); + ObjOshihiki_SetupOnScene(this, play); } else { - ObjOshihiki_SetupOnActor(this, globalCtx); + ObjOshihiki_SetupOnActor(this, play); } } Audio_PlayActorSound2(thisx, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } -void ObjOshihiki_SetupFall(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetupFall(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_SETUP_FALL; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; this->dyna.actor.gravity = -1.0f; - ObjOshihiki_SetGround(this, globalCtx); + ObjOshihiki_SetGround(this, play); this->actionFunc = ObjOshihiki_Fall; } -void ObjOshihiki_Fall(ObjOshihiki* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void ObjOshihiki_Fall(ObjOshihiki* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->stateFlags |= PUSHBLOCK_FALL; if (fabsf(this->dyna.unk_150) > 0.001f) { @@ -597,21 +597,20 @@ void ObjOshihiki_Fall(ObjOshihiki* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~PLAYER_STATE2_4; } Actor_MoveForward(&this->dyna.actor); - if (ObjOshihiki_CheckGround(this, globalCtx)) { + if (ObjOshihiki_CheckGround(this, play)) { if (this->floorBgIds[this->highestFloor] == BGCHECK_SCENE) { - ObjOshihiki_SetupOnScene(this, globalCtx); + ObjOshihiki_SetupOnScene(this, play); } else { - ObjOshihiki_SetupOnActor(this, globalCtx); + ObjOshihiki_SetupOnActor(this, play); } Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Audio_PlayActorSound2(&this->dyna.actor, - SurfaceType_GetSfx(&globalCtx->colCtx, this->floorPolys[this->highestFloor], - this->floorBgIds[this->highestFloor]) + - SFX_FLAG); + Audio_PlayActorSound2(&this->dyna.actor, SurfaceType_GetSfx(&play->colCtx, this->floorPolys[this->highestFloor], + this->floorBgIds[this->highestFloor]) + + SFX_FLAG); } } -void ObjOshihiki_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjOshihiki_Update(Actor* thisx, PlayState* play) { s32 pad; ObjOshihiki* this = (ObjOshihiki*)thisx; @@ -630,26 +629,26 @@ void ObjOshihiki_Update(Actor* thisx, GlobalContext* globalCtx) { this->yawCos = Math_CosS(this->dyna.actor.world.rot.y); if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void ObjOshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjOshihiki_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjOshihiki* this = (ObjOshihiki*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_oshihiki.c", 1289); - if (ObjOshihiki_MoveWithBlockUnder(this, globalCtx)) { + OPEN_DISPS(play->state.gfxCtx, "../z_obj_oshihiki.c", 1289); + if (ObjOshihiki_MoveWithBlockUnder(this, play)) { Matrix_Translate(this->underDistX * 10.0f, 0.0f, this->underDistZ * 10.0f, MTXMODE_APPLY); } this->stateFlags &= ~PUSHBLOCK_MOVE_UNDER; - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(this->texture)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_oshihiki.c", 1308), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_oshihiki.c", 1308), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BMORI1: @@ -666,5 +665,5 @@ void ObjOshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { } gSPDisplayList(POLY_OPA_DISP++, gPushBlockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_oshihiki.c", 1334); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_oshihiki.c", 1334); } diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h index 33098f64b6..ac4a135c4c 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h @@ -27,7 +27,7 @@ typedef enum { #define PUSHBLOCK_SETUP_FALL (1 << 7) #define PUSHBLOCK_MOVE_UNDER (1 << 8) -typedef void (*ObjOshihikiActionFunc)(struct ObjOshihiki*, GlobalContext*); +typedef void (*ObjOshihikiActionFunc)(struct ObjOshihiki*, PlayState*); typedef struct ObjOshihiki { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c index aacb2362e6..1cfc9697e2 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c @@ -8,12 +8,12 @@ #define FLAGS ACTOR_FLAG_4 -void ObjRoomtimer_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjRoomtimer_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjRoomtimer_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjRoomtimer_Init(Actor* thisx, PlayState* play); +void ObjRoomtimer_Destroy(Actor* thisx, PlayState* play); +void ObjRoomtimer_Update(Actor* thisx, PlayState* play); -void func_80B9D054(ObjRoomtimer* this, GlobalContext* globalCtx); -void func_80B9D0B0(ObjRoomtimer* this, GlobalContext* globalCtx); +void func_80B9D054(ObjRoomtimer* this, PlayState* play); +void func_80B9D0B0(ObjRoomtimer* this, PlayState* play); const ActorInit Obj_Roomtimer_InitVars = { ACTOR_OBJ_ROOMTIMER, @@ -27,7 +27,7 @@ const ActorInit Obj_Roomtimer_InitVars = { (ActorFunc)NULL, }; -void ObjRoomtimer_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjRoomtimer_Init(Actor* thisx, PlayState* play) { ObjRoomtimer* this = (ObjRoomtimer*)thisx; s16 params = this->actor.params; @@ -46,7 +46,7 @@ void ObjRoomtimer_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B9D054; } -void ObjRoomtimer_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjRoomtimer_Destroy(Actor* thisx, PlayState* play) { ObjRoomtimer* this = (ObjRoomtimer*)thisx; if ((this->actor.params != 0x3FF) && (gSaveContext.timer1Value > 0)) { @@ -54,36 +54,36 @@ void ObjRoomtimer_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B9D054(ObjRoomtimer* this, GlobalContext* globalCtx) { +void func_80B9D054(ObjRoomtimer* this, PlayState* play) { if (this->actor.params != 0x3FF) { func_80088B34(this->actor.params); } - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actionFunc = func_80B9D0B0; } -void func_80B9D0B0(ObjRoomtimer* this, GlobalContext* globalCtx) { - if (Flags_GetTempClear(globalCtx, this->actor.room)) { +void func_80B9D0B0(ObjRoomtimer* this, PlayState* play) { + if (Flags_GetTempClear(play, this->actor.room)) { if (this->actor.params != 0x3FF) { gSaveContext.timer1State = 10; } - Flags_SetClear(globalCtx, this->actor.room); - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetClear(play, this->actor.room); + Flags_SetSwitch(play, this->switchFlag); func_80078884(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->actor); } else { if ((this->actor.params != 0x3FF) && (gSaveContext.timer1Value == 0)) { Audio_PlaySoundGeneral(NA_SE_OC_ABYSS, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - Play_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); Actor_Kill(&this->actor); } } } -void ObjRoomtimer_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjRoomtimer_Update(Actor* thisx, PlayState* play) { ObjRoomtimer* this = (ObjRoomtimer*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h index 6c31a11b5f..2f1b08d9c9 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h @@ -7,7 +7,7 @@ struct ObjRoomtimer; -typedef void (*ObjRoomtimerActionFunc)(struct ObjRoomtimer*, GlobalContext*); +typedef void (*ObjRoomtimerActionFunc)(struct ObjRoomtimer*, PlayState*); typedef struct ObjRoomtimer { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index a78f053cf2..872b5830e8 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -15,39 +15,39 @@ // switch flag: (this->dyna.actor.params >> 8 & 0x3F) // frozen: this->dyna.actor.params >> 7 & 1 -void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjSwitch_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjSwitch_Init(Actor* thisx, PlayState* play); +void ObjSwitch_Destroy(Actor* thisx, PlayState* play); +void ObjSwitch_Update(Actor* thisx, PlayState* play); +void ObjSwitch_Draw(Actor* thisx, PlayState* play); void ObjSwitch_FloorUpInit(ObjSwitch* this); -void ObjSwitch_FloorUp(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_FloorUp(ObjSwitch* this, PlayState* play); void ObjSwitch_FloorPressInit(ObjSwitch* this); -void ObjSwitch_FloorPress(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_FloorPress(ObjSwitch* this, PlayState* play); void ObjSwitch_FloorDownInit(ObjSwitch* this); -void ObjSwitch_FloorDown(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_FloorDown(ObjSwitch* this, PlayState* play); void ObjSwitch_FloorReleaseInit(ObjSwitch* this); -void ObjSwitch_FloorRelease(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_FloorRelease(ObjSwitch* this, PlayState* play); void ObjSwitch_EyeFrozenInit(ObjSwitch* this); -void ObjSwitch_EyeInit(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_EyeInit(ObjSwitch* this, PlayState* play); void ObjSwitch_EyeOpenInit(ObjSwitch* this); -void ObjSwitch_EyeOpen(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_EyeOpen(ObjSwitch* this, PlayState* play); void ObjSwitch_EyeClosingInit(ObjSwitch* this); -void ObjSwitch_EyeClosing(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_EyeClosing(ObjSwitch* this, PlayState* play); void ObjSwitch_EyeClosedInit(ObjSwitch* this); -void ObjSwitch_EyeClosed(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_EyeClosed(ObjSwitch* this, PlayState* play); void ObjSwitch_EyeOpeningInit(ObjSwitch* this); -void ObjSwitch_EyeOpening(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_EyeOpening(ObjSwitch* this, PlayState* play); void ObjSwitch_CrystalOffInit(ObjSwitch* this); -void ObjSwitch_CrystalOff(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_CrystalOff(ObjSwitch* this, PlayState* play); void ObjSwitch_CrystalTurnOnInit(ObjSwitch* this); -void ObjSwitch_CrystalTurnOn(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_CrystalTurnOn(ObjSwitch* this, PlayState* play); void ObjSwitch_CrystalOnInit(ObjSwitch* this); -void ObjSwitch_CrystalOn(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_CrystalOn(ObjSwitch* this, PlayState* play); void ObjSwitch_CrystalTurnOffInit(ObjSwitch* this); -void ObjSwitch_CrystalTurnOff(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_CrystalTurnOff(ObjSwitch* this, PlayState* play); const ActorInit Obj_Switch_InitVars = { ACTOR_OBJ_SWITCH, @@ -182,14 +182,14 @@ void ObjSwitch_RotateY(Vec3f* dest, Vec3f* src, s16 angle) { dest->z = src->z * c - src->x * s; } -void ObjSwitch_InitDynaPoly(ObjSwitch* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 moveFlag) { +void ObjSwitch_InitDynaPoly(ObjSwitch* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { // "Warning : move BG registration failure" @@ -198,11 +198,11 @@ void ObjSwitch_InitDynaPoly(ObjSwitch* this, GlobalContext* globalCtx, Collision } } -void ObjSwitch_InitJntSphCollider(ObjSwitch* this, GlobalContext* globalCtx, ColliderJntSphInit* colliderJntSphInit) { +void ObjSwitch_InitJntSphCollider(ObjSwitch* this, PlayState* play, ColliderJntSphInit* colliderJntSphInit) { ColliderJntSph* colliderJntSph = &this->jntSph.col; - Collider_InitJntSph(globalCtx, colliderJntSph); - Collider_SetJntSph(globalCtx, colliderJntSph, &this->dyna.actor, colliderJntSphInit, this->jntSph.items); + Collider_InitJntSph(play, colliderJntSph); + Collider_SetJntSph(play, colliderJntSph, &this->dyna.actor, colliderJntSphInit, this->jntSph.items); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + this->dyna.actor.shape.yOffset * this->dyna.actor.scale.y, @@ -211,14 +211,14 @@ void ObjSwitch_InitJntSphCollider(ObjSwitch* this, GlobalContext* globalCtx, Col Collider_UpdateSpheres(0, colliderJntSph); } -void ObjSwitch_InitTrisCollider(ObjSwitch* this, GlobalContext* globalCtx, ColliderTrisInit* colliderTrisInit) { +void ObjSwitch_InitTrisCollider(ObjSwitch* this, PlayState* play, ColliderTrisInit* colliderTrisInit) { ColliderTris* colliderTris = &this->tris.col; s32 i; s32 j; Vec3f pos[3]; - Collider_InitTris(globalCtx, colliderTris); - Collider_SetTris(globalCtx, colliderTris, &this->dyna.actor, colliderTrisInit, this->tris.items); + Collider_InitTris(play, colliderTris); + Collider_SetTris(play, colliderTris, &this->dyna.actor, colliderTrisInit, this->tris.items); for (i = 0; i < 2; i++) { for (j = 0; j < 3; j++) { @@ -230,42 +230,42 @@ void ObjSwitch_InitTrisCollider(ObjSwitch* this, GlobalContext* globalCtx, Colli } } -Actor* ObjSwitch_SpawnIce(ObjSwitch* this, GlobalContext* globalCtx) { +Actor* ObjSwitch_SpawnIce(ObjSwitch* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - return Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_OBJ_ICE_POLY, thisx->world.pos.x, - thisx->world.pos.y, thisx->world.pos.z, thisx->world.rot.x, thisx->world.rot.y, - thisx->world.rot.z, (this->dyna.actor.params >> 8 & 0x3F) << 8); + return Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_OBJ_ICE_POLY, thisx->world.pos.x, thisx->world.pos.y, + thisx->world.pos.z, thisx->world.rot.x, thisx->world.rot.y, thisx->world.rot.z, + (this->dyna.actor.params >> 8 & 0x3F) << 8); } -void ObjSwitch_SetOn(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_SetOn(ObjSwitch* this, PlayState* play) { s32 pad; s32 subType; - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { this->cooldownOn = false; } else { subType = (this->dyna.actor.params >> 4 & 7); - Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F)); + Flags_SetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F)); if (subType == OBJSWITCH_SUBTYPE_ONCE || subType == OBJSWITCH_SUBTYPE_SYNC) { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_CORRECT_CHIME); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_CORRECT_CHIME); } else { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); } this->cooldownOn = true; } } -void ObjSwitch_SetOff(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_SetOff(ObjSwitch* this, PlayState* play) { this->cooldownOn = false; - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { - Flags_UnsetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F)); + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { + Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F)); if ((this->dyna.actor.params >> 4 & 7) == OBJSWITCH_SUBTYPE_TOGGLE) { - OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); + OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); this->cooldownOn = true; } } @@ -278,16 +278,16 @@ void ObjSwitch_UpdateTwoTexScrollXY(ObjSwitch* this) { this->y2TexScroll = (this->y2TexScroll - 1) & 0x7F; } -void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Init(Actor* thisx, PlayState* play) { ObjSwitch* this = (ObjSwitch*)thisx; s32 switchFlagSet; s32 type; - switchFlagSet = Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F)); + switchFlagSet = Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F)); type = (this->dyna.actor.params & 7); if (type == OBJSWITCH_TYPE_FLOOR || type == OBJSWITCH_TYPE_FLOOR_RUSTY) { - ObjSwitch_InitDynaPoly(this, globalCtx, &gFloorSwitchCol, DPM_PLAYER); + ObjSwitch_InitDynaPoly(this, play, &gFloorSwitchCol, DPM_PLAYER); } Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -299,11 +299,11 @@ void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->dyna.actor, sHeights[type]); if (type == OBJSWITCH_TYPE_FLOOR_RUSTY) { - ObjSwitch_InitTrisCollider(this, globalCtx, &sRustyFloorTrisInit); + ObjSwitch_InitTrisCollider(this, play, &sRustyFloorTrisInit); } else if (type == OBJSWITCH_TYPE_EYE) { - ObjSwitch_InitTrisCollider(this, globalCtx, &trisColliderEye); + ObjSwitch_InitTrisCollider(this, play, &trisColliderEye); } else if (type == OBJSWITCH_TYPE_CRYSTAL || type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) { - ObjSwitch_InitJntSphCollider(this, globalCtx, &sCrystalJntSphereInit); + ObjSwitch_InitJntSphCollider(this, play, &sCrystalJntSphereInit); } if (type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) { @@ -313,7 +313,7 @@ void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - if ((this->dyna.actor.params >> 7 & 1) && (ObjSwitch_SpawnIce(this, globalCtx) == NULL)) { + if ((this->dyna.actor.params >> 7 & 1) && (ObjSwitch_SpawnIce(this, play) == NULL)) { osSyncPrintf(VT_FGCOL(RED)); osSyncPrintf("Error : 氷発生失敗 (%s %d)\n", "../z_obj_switch.c", 732); osSyncPrintf(VT_RST); @@ -347,24 +347,24 @@ void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("(Dungeon switch)(arg_data 0x%04x)\n", this->dyna.actor.params); } -void ObjSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Destroy(Actor* thisx, PlayState* play) { ObjSwitch* this = (ObjSwitch*)thisx; switch (this->dyna.actor.params & 7) { case OBJSWITCH_TYPE_FLOOR: case OBJSWITCH_TYPE_FLOOR_RUSTY: - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); break; } switch (this->dyna.actor.params & 7) { case OBJSWITCH_TYPE_FLOOR_RUSTY: case OBJSWITCH_TYPE_EYE: - Collider_DestroyTris(globalCtx, &this->tris.col); + Collider_DestroyTris(play, &this->tris.col); break; case OBJSWITCH_TYPE_CRYSTAL: case OBJSWITCH_TYPE_CRYSTAL_TARGETABLE: - Collider_DestroyJntSph(globalCtx, &this->jntSph.col); + Collider_DestroyJntSph(play, &this->jntSph.col); break; } } @@ -374,39 +374,39 @@ void ObjSwitch_FloorUpInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_FloorUp; } -void ObjSwitch_FloorUp(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorUp(ObjSwitch* this, PlayState* play) { if ((this->dyna.actor.params & 7) == OBJSWITCH_TYPE_FLOOR_RUSTY) { if (this->tris.col.base.acFlags & AC_HIT) { ObjSwitch_FloorPressInit(this); - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); this->tris.col.base.acFlags &= ~AC_HIT; } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->tris.col.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->tris.col.base); } } else { switch (this->dyna.actor.params >> 4 & 7) { case OBJSWITCH_SUBTYPE_ONCE: if (func_8004356C(&this->dyna)) { ObjSwitch_FloorPressInit(this); - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); } break; case OBJSWITCH_SUBTYPE_TOGGLE: if ((this->dyna.unk_160 & 2) && !(this->unk_17F & 2)) { ObjSwitch_FloorPressInit(this); - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); } break; case OBJSWITCH_SUBTYPE_HOLD: if (func_800435B4(&this->dyna)) { ObjSwitch_FloorPressInit(this); - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); } break; case OBJSWITCH_SUBTYPE_HOLD_INVERTED: if (func_800435B4(&this->dyna)) { ObjSwitch_FloorPressInit(this); - ObjSwitch_SetOff(this, globalCtx); + ObjSwitch_SetOff(this, play); } break; } @@ -418,7 +418,7 @@ void ObjSwitch_FloorPressInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_FloorPress(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorPress(ObjSwitch* this, PlayState* play) { if ((this->dyna.actor.params >> 4 & 7) == OBJSWITCH_SUBTYPE_HOLD_INVERTED || !this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { this->dyna.actor.scale.y -= 99.0f / 2000.0f; @@ -436,28 +436,28 @@ void ObjSwitch_FloorDownInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_FloorDown; } -void ObjSwitch_FloorDown(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorDown(ObjSwitch* this, PlayState* play) { switch (this->dyna.actor.params >> 4 & 7) { case OBJSWITCH_SUBTYPE_ONCE: - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { ObjSwitch_FloorReleaseInit(this); } break; case OBJSWITCH_SUBTYPE_TOGGLE: if ((this->dyna.unk_160 & 2) && !(this->unk_17F & 2)) { ObjSwitch_FloorReleaseInit(this); - ObjSwitch_SetOff(this, globalCtx); + ObjSwitch_SetOff(this, play); } break; case OBJSWITCH_SUBTYPE_HOLD: case OBJSWITCH_SUBTYPE_HOLD_INVERTED: - if (!func_800435B4(&this->dyna) && !Player_InCsMode(globalCtx)) { + if (!func_800435B4(&this->dyna) && !Player_InCsMode(play)) { if (this->releaseTimer <= 0) { ObjSwitch_FloorReleaseInit(this); if ((this->dyna.actor.params >> 4 & 7) == OBJSWITCH_SUBTYPE_HOLD) { - ObjSwitch_SetOff(this, globalCtx); + ObjSwitch_SetOff(this, play); } else { - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); } } } else { @@ -472,7 +472,7 @@ void ObjSwitch_FloorReleaseInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_FloorRelease(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorRelease(ObjSwitch* this, PlayState* play) { s16 subType = (this->dyna.actor.params >> 4 & 7); if (((subType != OBJSWITCH_SUBTYPE_TOGGLE) && (subType != OBJSWITCH_SUBTYPE_HOLD_INVERTED)) || !this->cooldownOn || @@ -508,8 +508,8 @@ void ObjSwitch_EyeFrozenInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_EyeInit; } -void ObjSwitch_EyeInit(ObjSwitch* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { +void ObjSwitch_EyeInit(ObjSwitch* this, PlayState* play) { + if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { ObjSwitch_EyeClosedInit(this); } else { ObjSwitch_EyeOpenInit(this); @@ -521,10 +521,10 @@ void ObjSwitch_EyeOpenInit(ObjSwitch* this) { this->eyeTexIndex = 0; } -void ObjSwitch_EyeOpen(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeOpen(ObjSwitch* this, PlayState* play) { if (ObjSwitch_EyeIsHit(this) || (this->dyna.actor.params >> 7 & 1)) { ObjSwitch_EyeClosingInit(this); - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); this->dyna.actor.params &= ~0x80; } } @@ -534,7 +534,7 @@ void ObjSwitch_EyeClosingInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_EyeClosing(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeClosing(ObjSwitch* this, PlayState* play) { if (!this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { this->eyeTexIndex++; if (this->eyeTexIndex >= 3) { @@ -549,10 +549,10 @@ void ObjSwitch_EyeClosedInit(ObjSwitch* this) { this->eyeTexIndex = 3; } -void ObjSwitch_EyeClosed(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeClosed(ObjSwitch* this, PlayState* play) { switch (this->dyna.actor.params >> 4 & 7) { case OBJSWITCH_SUBTYPE_ONCE: - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { ObjSwitch_EyeOpeningInit(this); this->dyna.actor.params &= ~0x80; } @@ -560,7 +560,7 @@ void ObjSwitch_EyeClosed(ObjSwitch* this, GlobalContext* globalCtx) { case OBJSWITCH_SUBTYPE_TOGGLE: if (ObjSwitch_EyeIsHit(this) || (this->dyna.actor.params >> 7 & 1)) { ObjSwitch_EyeOpeningInit(this); - ObjSwitch_SetOff(this, globalCtx); + ObjSwitch_SetOff(this, play); this->dyna.actor.params &= ~0x80; } break; @@ -572,7 +572,7 @@ void ObjSwitch_EyeOpeningInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_EyeOpening(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeOpening(ObjSwitch* this, PlayState* play) { if ((this->dyna.actor.params >> 4 & 7) != OBJSWITCH_SUBTYPE_TOGGLE || !this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { this->eyeTexIndex--; @@ -591,27 +591,27 @@ void ObjSwitch_CrystalOffInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_CrystalOff; } -void ObjSwitch_CrystalOff(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalOff(ObjSwitch* this, PlayState* play) { switch (this->dyna.actor.params >> 4 & 7) { case OBJSWITCH_SUBTYPE_ONCE: if ((this->jntSph.col.base.acFlags & AC_HIT) && this->disableAcTimer <= 0) { this->disableAcTimer = 10; - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); ObjSwitch_CrystalTurnOnInit(this); } break; case OBJSWITCH_SUBTYPE_SYNC: if (((this->jntSph.col.base.acFlags & AC_HIT) && this->disableAcTimer <= 0) || - Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { + Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { this->disableAcTimer = 10; - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); ObjSwitch_CrystalTurnOnInit(this); } break; case OBJSWITCH_SUBTYPE_TOGGLE: if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->unk_17F & 2) && this->disableAcTimer <= 0) { this->disableAcTimer = 10; - ObjSwitch_SetOn(this, globalCtx); + ObjSwitch_SetOn(this, play); ObjSwitch_CrystalTurnOnInit(this); } ObjSwitch_UpdateTwoTexScrollXY(this); @@ -624,7 +624,7 @@ void ObjSwitch_CrystalTurnOnInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_CrystalTurnOn(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalTurnOn(ObjSwitch* this, PlayState* play) { if (!this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { ObjSwitch_CrystalOnInit(this); if ((this->dyna.actor.params >> 4 & 7) == OBJSWITCH_SUBTYPE_TOGGLE) { @@ -642,20 +642,20 @@ void ObjSwitch_CrystalOnInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_CrystalOn; } -void ObjSwitch_CrystalOn(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalOn(ObjSwitch* this, PlayState* play) { switch (this->dyna.actor.params >> 4 & 7) { case OBJSWITCH_SUBTYPE_ONCE: case OBJSWITCH_SUBTYPE_SYNC: - if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8 & 0x3F))) { + if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) { ObjSwitch_CrystalTurnOffInit(this); } break; case OBJSWITCH_SUBTYPE_TOGGLE: if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->unk_17F & 2) && this->disableAcTimer <= 0) { this->disableAcTimer = 10; - globalCtx = globalCtx; + play = play; ObjSwitch_CrystalTurnOffInit(this); - ObjSwitch_SetOff(this, globalCtx); + ObjSwitch_SetOff(this, play); } break; } @@ -667,7 +667,7 @@ void ObjSwitch_CrystalTurnOffInit(ObjSwitch* this) { this->cooldownTimer = 100; } -void ObjSwitch_CrystalTurnOff(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalTurnOff(ObjSwitch* this, PlayState* play) { if ((this->dyna.actor.params >> 4 & 7) != OBJSWITCH_SUBTYPE_TOGGLE || !this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { ObjSwitch_CrystalOffInit(this); @@ -676,7 +676,7 @@ void ObjSwitch_CrystalTurnOff(ObjSwitch* this, GlobalContext* globalCtx) { } } -void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Update(Actor* thisx, PlayState* play) { ObjSwitch* this = (ObjSwitch*)thisx; if (this->releaseTimer > 0) { @@ -686,7 +686,7 @@ void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { this->cooldownTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); switch (this->dyna.actor.params & 7) { case OBJSWITCH_TYPE_FLOOR: @@ -696,34 +696,34 @@ void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { case OBJSWITCH_TYPE_EYE: this->unk_17F = this->tris.col.base.acFlags; this->tris.col.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->tris.col.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->tris.col.base); break; case OBJSWITCH_TYPE_CRYSTAL: case OBJSWITCH_TYPE_CRYSTAL_TARGETABLE: - if (!Player_InCsMode(globalCtx) && this->disableAcTimer > 0) { + if (!Player_InCsMode(play) && this->disableAcTimer > 0) { this->disableAcTimer--; } this->unk_17F = this->jntSph.col.base.acFlags; this->jntSph.col.base.acFlags &= ~AC_HIT; if (this->disableAcTimer <= 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->jntSph.col.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->jntSph.col.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->jntSph.col.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->jntSph.col.base); break; } } -void ObjSwitch_DrawFloor(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_DrawFloor(ObjSwitch* this, PlayState* play) { static Gfx* floorSwitchDLists[] = { gFloorSwitch1DL, gFloorSwitch3DL, gFloorSwitch2DL, gFloorSwitch2DL }; - Gfx_DrawDListOpa(globalCtx, floorSwitchDLists[(this->dyna.actor.params >> 4 & 7)]); + Gfx_DrawDListOpa(play, floorSwitchDLists[(this->dyna.actor.params >> 4 & 7)]); } -void ObjSwitch_DrawFloorRusty(ObjSwitch* this, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gRustyFloorSwitchDL); +void ObjSwitch_DrawFloorRusty(ObjSwitch* this, PlayState* play) { + Gfx_DrawDListOpa(play, gRustyFloorSwitchDL); } -void ObjSwitch_DrawEye(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_DrawEye(ObjSwitch* this, PlayState* play) { static void* eyeTextures[][4] = { { gEyeSwitchGoldOpenTex, gEyeSwitchGoldOpeningTex, gEyeSwitchGoldClosingTex, gEyeSwitchGoldClosedTex }, { gEyeSwitchSilverOpenTex, gEyeSwitchSilverHalfTex, gEyeSwitchSilverClosedTex, gEyeSwitchSilverClosedTex }, @@ -732,18 +732,18 @@ void ObjSwitch_DrawEye(ObjSwitch* this, GlobalContext* globalCtx) { s32 pad; s32 subType = (this->dyna.actor.params >> 4 & 7); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_switch.c", 1459); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1459); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_switch.c", 1462), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_switch.c", 1462), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[subType][this->eyeTexIndex])); gSPDisplayList(POLY_OPA_DISP++, eyeDlists[subType]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_switch.c", 1471); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1471); } -void ObjSwitch_DrawCrystal(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_DrawCrystal(ObjSwitch* this, PlayState* play) { static Gfx* xluDLists[] = { gCrystalSwitchCoreXluDL, gCrystalSwitchDiamondXluDL, NULL, NULL, gCrystalSwitchCoreXluDL }; static Gfx* opaDLists[] = { gCrystalSwitchCoreOpaDL, gCrystalSwitchDiamondOpaDL, NULL, NULL, @@ -753,23 +753,23 @@ void ObjSwitch_DrawCrystal(ObjSwitch* this, GlobalContext* globalCtx) { s32 subType; subType = (this->dyna.actor.params >> 4 & 7); - func_8002ED80(&this->dyna.actor, globalCtx, 0); + func_8002ED80(&this->dyna.actor, play, 0); if (1) {} - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_switch.c", 1494); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1494); - func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_switch.c", 1497), + func_80093D84(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_switch.c", 1497), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, xluDLists[subType]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_switch.c", 1502); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1502); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_switch.c", 1507); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1507); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_switch.c", 1511), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_switch.c", 1511), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (subType == OBJSWITCH_SUBTYPE_TOGGLE) { @@ -778,19 +778,19 @@ void ObjSwitch_DrawCrystal(ObjSwitch* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, this->crystalColor.r, this->crystalColor.g, this->crystalColor.b, 128); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->x1TexScroll, this->y1TexScroll, 0x20, 0x20, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->x1TexScroll, this->y1TexScroll, 0x20, 0x20, 1, this->x2TexScroll, this->y2TexScroll, 0x20, 0x20)); gSPDisplayList(POLY_OPA_DISP++, opaDLists[subType]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_switch.c", 1533); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1533); } static ObjSwitchActionFunc sDrawFuncs[] = { ObjSwitch_DrawFloor, ObjSwitch_DrawFloorRusty, ObjSwitch_DrawEye, ObjSwitch_DrawCrystal, ObjSwitch_DrawCrystal, }; -void ObjSwitch_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Draw(Actor* thisx, PlayState* play) { ObjSwitch* this = (ObjSwitch*)thisx; - sDrawFuncs[(this->dyna.actor.params & 7)](this, globalCtx); + sDrawFuncs[(this->dyna.actor.params & 7)](this, play); } diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h index 323d09ebb2..f5c12673eb 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h @@ -6,7 +6,7 @@ struct ObjSwitch; -typedef void (*ObjSwitchActionFunc)(struct ObjSwitch*, GlobalContext*); +typedef void (*ObjSwitchActionFunc)(struct ObjSwitch*, PlayState*); typedef enum { /* 0 */ OBJSWITCH_TYPE_FLOOR, diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 71027e2d83..e8ec11ac3d 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -11,10 +11,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_10) -void ObjSyokudai_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjSyokudai_Init(Actor* thisx, PlayState* play); +void ObjSyokudai_Destroy(Actor* thisx, PlayState* play); +void ObjSyokudai_Update(Actor* thisx, PlayState* play); +void ObjSyokudai_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Syokudai_InitVars = { ACTOR_OBJ_SYOKUDAI, @@ -77,7 +77,7 @@ static InitChainEntry sInitChain[] = { static s32 sLitTorchCount; -void ObjSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSyokudai_Init(Actor* thisx, PlayState* play) { static u8 sColTypesStand[] = { 0x09, 0x0B, 0x0B }; s32 pad; ObjSyokudai* this = (ObjSyokudai*)thisx; @@ -86,20 +86,20 @@ void ObjSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - Collider_InitCylinder(globalCtx, &this->colliderStand); - Collider_SetCylinder(globalCtx, &this->colliderStand, &this->actor, &sCylInitStand); + Collider_InitCylinder(play, &this->colliderStand); + Collider_SetCylinder(play, &this->colliderStand, &this->actor, &sCylInitStand); this->colliderStand.base.colType = sColTypesStand[this->actor.params >> 0xC]; - Collider_InitCylinder(globalCtx, &this->colliderFlame); - Collider_SetCylinder(globalCtx, &this->colliderFlame, &this->actor, &sCylInitFlame); + Collider_InitCylinder(play, &this->colliderFlame); + Collider_SetCylinder(play, &this->colliderFlame, &this->actor, &sCylInitFlame); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Lights_PointGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y + 70.0f, this->actor.world.pos.z, 255, 255, 180, -1); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); - if ((this->actor.params & 0x400) || ((torchType != 2) && Flags_GetSwitch(globalCtx, this->actor.params & 0x3F))) { + if ((this->actor.params & 0x400) || ((torchType != 2) && Flags_GetSwitch(play, this->actor.params & 0x3F))) { this->litTimer = -1; } @@ -108,17 +108,17 @@ void ObjSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 60.0f); } -void ObjSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSyokudai_Destroy(Actor* thisx, PlayState* play) { s32 pad; ObjSyokudai* this = (ObjSyokudai*)thisx; - Collider_DestroyCylinder(globalCtx, &this->colliderStand); - Collider_DestroyCylinder(globalCtx, &this->colliderFlame); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->colliderStand); + Collider_DestroyCylinder(play, &this->colliderFlame); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjSyokudai* this = (ObjSyokudai*)thisx; s32 torchCount = (this->actor.params >> 6) & 0xF; s32 switchFlag = this->actor.params & 0x3F; @@ -140,28 +140,28 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { if (torchCount == 10) { torchCount = 24; } - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &waterSurface, &dummy) && + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, + &dummy) && ((waterSurface - this->actor.world.pos.y) > 52.0f)) { this->litTimer = 0; if (torchType == 1) { - Flags_UnsetSwitch(globalCtx, switchFlag); + Flags_UnsetSwitch(play, switchFlag); if (torchCount != 0) { this->litTimer = 1; } } } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); interactionType = 0; if (this->actor.params & 0x400) { this->litTimer = -1; } if (torchCount != 0) { - if (Flags_GetSwitch(globalCtx, switchFlag)) { + if (Flags_GetSwitch(play, switchFlag)) { if (this->litTimer == 0) { this->litTimer = -1; if (torchType == 0) { - OnePointCutscene_Attention(globalCtx, &this->actor); + OnePointCutscene_Attention(play, &this->actor); } } else if (this->litTimer > 0) { this->litTimer = -1; @@ -212,14 +212,14 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { if (torchCount == 0) { this->litTimer = -1; if (torchType != 2) { - Flags_SetSwitch(globalCtx, switchFlag); - OnePointCutscene_Attention(globalCtx, &this->actor); + Flags_SetSwitch(play, switchFlag); + OnePointCutscene_Attention(play, &this->actor); } } else { sLitTorchCount++; if (sLitTorchCount >= torchCount) { - Flags_SetSwitch(globalCtx, switchFlag); - OnePointCutscene_Attention(globalCtx, &this->actor); + Flags_SetSwitch(play, switchFlag); + OnePointCutscene_Attention(play, &this->actor); this->litTimer = -1; } else { this->litTimer = (litTimeScale * 50) + 110; @@ -232,11 +232,11 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { } Collider_UpdateCylinder(&this->actor, &this->colliderStand); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderStand.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderStand.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderStand.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderStand.base); Collider_UpdateCylinder(&this->actor, &this->colliderFlame); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderFlame.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderFlame.base); if (this->litTimer > 0) { this->litTimer--; @@ -257,7 +257,7 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { this->flameTexScroll++; } -void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSyokudai_Draw(Actor* thisx, PlayState* play) { static Gfx* displayLists[] = { gGoldenTorchDL, gTimedTorchDL, gWoodenTorchDL }; s32 pad; ObjSyokudai* this = (ObjSyokudai*)thisx; @@ -265,10 +265,10 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { timerMax = (((this->actor.params >> 6) & 0xF) * 50) + 100; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_syokudai.c", 707); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_syokudai.c", 707); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_syokudai.c", 714), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_syokudai.c", 714), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, displayLists[(u16)this->actor.params >> 0xC]); @@ -283,11 +283,11 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { } flameScale *= 0.0027f; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - (this->flameTexScroll * -20) & 0x1FF, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->flameTexScroll * -20) & 0x1FF, + 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); @@ -295,14 +295,14 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, 52.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateY( - BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - 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(flameScale, flameScale, flameScale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_syokudai.c", 745), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_syokudai.c", 745), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_syokudai.c", 749); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_syokudai.c", 749); } 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 978856f81f..6e3224537a 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -9,21 +9,21 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_27) -void ObjTimeblock_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjTimeblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjTimeblock_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjTimeblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTimeblock_Init(Actor* thisx, PlayState* play); +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, GlobalContext* globalCtx); -s32 ObjTimeblock_WaitForSong(ObjTimeblock* this, GlobalContext* globalCtx); -void ObjTimeblock_DoNothing(ObjTimeblock* this, GlobalContext* globalCtx); -void ObjTimeblock_Normal(ObjTimeblock* this, GlobalContext* globalCtx); -void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, GlobalContext* globalCtx); -void ObjTimeblock_AltBehaviourNotVisible(ObjTimeblock* this, GlobalContext* globalCtx); +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); const ActorInit Obj_Timeblock_InitVars = { ACTOR_OBJ_TIMEBLOCK, @@ -82,21 +82,21 @@ u32 ObjTimeblock_CalculateIsVisible(ObjTimeblock* this) { } } -void ObjTimeblock_SpawnDemoEffect(ObjTimeblock* this, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0, +void ObjTimeblock_SpawnDemoEffect(ObjTimeblock* this, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, + this->dyna.actor.world.pos.z, 0, 0, 0, sSizeOptions[(this->dyna.actor.params >> 8) & 1].demoEffectParams); } -void ObjTimeblock_ToggleSwitchFlag(GlobalContext* globalCtx, s32 flag) { - if (Flags_GetSwitch(globalCtx, flag)) { - Flags_UnsetSwitch(globalCtx, flag); +void ObjTimeblock_ToggleSwitchFlag(PlayState* play, s32 flag) { + if (Flags_GetSwitch(play, flag)) { + Flags_UnsetSwitch(play, flag); } else { - Flags_SetSwitch(globalCtx, flag); + Flags_SetSwitch(play, flag); } } -void ObjTimeblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjTimeblock_Init(Actor* thisx, PlayState* play) { ObjTimeblock* this = (ObjTimeblock*)thisx; s32 pad; CollisionHeader* colHeader = NULL; @@ -106,7 +106,7 @@ void ObjTimeblock_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gSongOfTimeBlockCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, 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[(this->dyna.actor.params >> 8) & 1].scale); @@ -121,7 +121,7 @@ void ObjTimeblock_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->dyna.actor, sSizeOptions[(this->dyna.actor.params >> 8) & 1].height); - this->unk_174 = (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) ? true : false; + this->unk_174 = (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) ? true : false; this->unk_175 = ((this->dyna.actor.params >> 15) & 1) ? true : false; this->isVisible = ObjTimeblock_CalculateIsVisible(this); @@ -139,14 +139,14 @@ void ObjTimeblock_Init(Actor* thisx, GlobalContext* globalCtx) { (this->dyna.actor.params >> 10) & 1); } -void ObjTimeblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjTimeblock_Destroy(Actor* thisx, PlayState* play) { s32 pad; ObjTimeblock* this = (ObjTimeblock*)thisx; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, GlobalContext* globalCtx) { +u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, PlayState* play) { if (this->isVisible && func_80043590(&this->dyna)) { return false; } @@ -155,7 +155,7 @@ u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, GlobalContext* globalCtx) { Vec3f distance; f32 blockSize; - func_8002DBD0(&this->dyna.actor, &distance, &GET_PLAYER(globalCtx)->actor.world.pos); + func_8002DBD0(&this->dyna.actor, &distance, &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(distance.x) || blockSize < fabsf(distance.z)) { @@ -166,12 +166,12 @@ u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, GlobalContext* globalCtx) { return false; } -s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (ObjTimeblock_PlayerIsInRange(this, globalCtx)) { + if (ObjTimeblock_PlayerIsInRange(this, play)) { if (player->stateFlags2 & PLAYER_STATE2_24) { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->songObserverFunc = ObjTimeblock_WaitForSong; } else { player->stateFlags2 |= PLAYER_STATE2_23; @@ -180,11 +180,11 @@ s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, GlobalContext* globalCtx) { return false; } -s32 ObjTimeblock_WaitForSong(ObjTimeblock* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { +s32 ObjTimeblock_WaitForSong(ObjTimeblock* this, PlayState* play) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { this->songObserverFunc = ObjTimeblock_WaitForOcarina; } - if (globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_TIME) { + if (play->msgCtx.lastPlayedSong == OCARINA_SONG_TIME) { if (this->unk_172 == 254) { this->songEndTimer = 110; } else { @@ -201,42 +201,42 @@ void ObjTimeblock_SetupDoNothing(ObjTimeblock* this) { this->actionFunc = ObjTimeblock_DoNothing; } -void ObjTimeblock_DoNothing(ObjTimeblock* this, GlobalContext* globalCtx) { +void ObjTimeblock_DoNothing(ObjTimeblock* this, PlayState* play) { } void ObjTimeblock_SetupNormal(ObjTimeblock* this) { this->actionFunc = ObjTimeblock_Normal; } -void ObjTimeblock_Normal(ObjTimeblock* this, GlobalContext* globalCtx) { +void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play) { u32 newIsVisible; - if (this->songObserverFunc(this, globalCtx) && this->demoEffectTimer <= 0) { - ObjTimeblock_SpawnDemoEffect(this, globalCtx); + if (this->songObserverFunc(this, play) && this->demoEffectTimer <= 0) { + ObjTimeblock_SpawnDemoEffect(this, play); this->demoEffectTimer = 160; // Possibly points the camera to this actor - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); // "◯◯◯◯ Time Block Attention Camera (frame counter %d)\n" - osSyncPrintf("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", globalCtx->state.frames); + osSyncPrintf("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", play->state.frames); this->demoEffectFirstPartTimer = 12; if (this->unk_177 == 0) { this->dyna.actor.params ^= 0x8000; } else { - ObjTimeblock_ToggleSwitchFlag(globalCtx, this->dyna.actor.params & 0x3F); + ObjTimeblock_ToggleSwitchFlag(play, this->dyna.actor.params & 0x3F); } } - this->unk_172 = globalCtx->msgCtx.lastPlayedSong; + this->unk_172 = play->msgCtx.lastPlayedSong; if (this->demoEffectFirstPartTimer > 0) { this->demoEffectFirstPartTimer--; if (this->demoEffectFirstPartTimer == 0) { if (this->unk_177 == 0) { this->unk_175 = ((this->dyna.actor.params >> 15) & 1) ? true : false; } else { - this->unk_174 = (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) ? true : false; + this->unk_174 = (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) ? true : false; } } } @@ -252,35 +252,35 @@ void ObjTimeblock_Normal(ObjTimeblock* this, GlobalContext* globalCtx) { } } -void func_80BA06AC(ObjTimeblock* this, GlobalContext* globalCtx) { +void func_80BA06AC(ObjTimeblock* this, PlayState* play) { s32 switchFlag = this->dyna.actor.params & 0x3F; - this->unk_172 = globalCtx->msgCtx.lastPlayedSong; + this->unk_172 = play->msgCtx.lastPlayedSong; if (this->demoEffectFirstPartTimer > 0 && --this->demoEffectFirstPartTimer == 0) { - this->unk_174 = (Flags_GetSwitch(globalCtx, switchFlag)) ? true : false; + this->unk_174 = (Flags_GetSwitch(play, switchFlag)) ? true : false; } this->isVisible = ObjTimeblock_CalculateIsVisible(this); - this->unk_176 = (Flags_GetSwitch(globalCtx, switchFlag)) ? true : false; + this->unk_176 = (Flags_GetSwitch(play, switchFlag)) ? true : false; } void ObjTimeblock_SetupAltBehaviorVisible(ObjTimeblock* this) { this->actionFunc = ObjTimeblock_AltBehaviorVisible; } -void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, GlobalContext* globalCtx) { - if (this->songObserverFunc(this, globalCtx) && this->demoEffectTimer <= 0) { +void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, PlayState* play) { + if (this->songObserverFunc(this, play) && this->demoEffectTimer <= 0) { this->demoEffectFirstPartTimer = 12; - ObjTimeblock_SpawnDemoEffect(this, globalCtx); + ObjTimeblock_SpawnDemoEffect(this, play); this->demoEffectTimer = 160; - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); // "Time Block Attention Camera (frame counter)" - osSyncPrintf("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", globalCtx->state.frames); - ObjTimeblock_ToggleSwitchFlag(globalCtx, this->dyna.actor.params & 0x3F); + osSyncPrintf("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", play->state.frames); + ObjTimeblock_ToggleSwitchFlag(play, this->dyna.actor.params & 0x3F); } - func_80BA06AC(this, globalCtx); + func_80BA06AC(this, play); if (this->demoEffectTimer == 50) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); @@ -295,53 +295,53 @@ void ObjTimeblock_SetupAltBehaviourNotVisible(ObjTimeblock* this) { this->actionFunc = ObjTimeblock_AltBehaviourNotVisible; } -void ObjTimeblock_AltBehaviourNotVisible(ObjTimeblock* this, GlobalContext* globalCtx) { +void ObjTimeblock_AltBehaviourNotVisible(ObjTimeblock* this, PlayState* play) { s32 switchFlag = this->dyna.actor.params & 0x3F; - s8 switchFlagIsSet = (Flags_GetSwitch(globalCtx, switchFlag)) ? true : false; + s8 switchFlagIsSet = (Flags_GetSwitch(play, switchFlag)) ? true : false; if (this->unk_176 ^ switchFlagIsSet && switchFlagIsSet ^ (((this->dyna.actor.params >> 15) & 1) ? true : false)) { if (this->demoEffectTimer <= 0) { - ObjTimeblock_SpawnDemoEffect(this, globalCtx); + ObjTimeblock_SpawnDemoEffect(this, play); this->demoEffectTimer = 160; } this->demoEffectFirstPartTimer = 12; } - func_80BA06AC(this, globalCtx); + func_80BA06AC(this, play); if (this->isVisible && this->demoEffectTimer <= 0) { ObjTimeblock_SetupAltBehaviorVisible(this); } } -void ObjTimeblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjTimeblock_Update(Actor* thisx, PlayState* play) { ObjTimeblock* this = (ObjTimeblock*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->demoEffectTimer > 0) { this->demoEffectTimer--; } if (this->isVisible) { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EC50(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_8003EBF8(play, &play->colCtx.dyna, this->dyna.bgId); } } -void ObjTimeblock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjTimeblock_Draw(Actor* thisx, PlayState* play) { if (((ObjTimeblock*)thisx)->isVisible) { Color_RGB8* primColor = &sPrimColors[thisx->home.rot.z & 7]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_timeblock.c", 762); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_timeblock.c", 762); - func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_timeblock.c", 766), + func_80093D18(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_timeblock.c", 766), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, primColor->r, primColor->g, primColor->b, 255); gSPDisplayList(POLY_OPA_DISP++, gSongOfTimeBlockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_timeblock.c", 772); + 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 7b890b1cb2..9bd393b194 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h @@ -6,8 +6,8 @@ struct ObjTimeblock; -typedef s32 (*ObjTimeblockSongObserverFunc)(struct ObjTimeblock*, GlobalContext*); -typedef void (*ObjTimeblockActionFunc)(struct ObjTimeblock*, GlobalContext*); +typedef s32 (*ObjTimeblockSongObserverFunc)(struct ObjTimeblock*, PlayState*); +typedef void (*ObjTimeblockActionFunc)(struct ObjTimeblock*, PlayState*); typedef struct ObjTimeblock { /* 0x0000 */ DynaPolyActor dyna; 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 378bc614a7..232892d88b 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -11,25 +11,25 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23) -void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjTsubo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjTsubo_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjTsubo_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTsubo_Init(Actor* thisx, PlayState* play); +void ObjTsubo_Destroy(Actor* thisx, PlayState* play); +void ObjTsubo_Update(Actor* thisx, PlayState* play); +void ObjTsubo_Draw(Actor* thisx, PlayState* play); -void ObjTsubo_SpawnCollectible(ObjTsubo* this, GlobalContext* globalCtx); +void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play); void ObjTsubo_ApplyGravity(ObjTsubo* this); -s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx); -void ObjTsubo_InitCollider(Actor* thisx, GlobalContext* globalCtx); -void ObjTsubo_AirBreak(ObjTsubo* this, GlobalContext* globalCtx); -void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx); +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, GlobalContext* globalCtx); +void ObjTsubo_WaitForObject(ObjTsubo* this, PlayState* play); void ObjTsubo_SetupIdle(ObjTsubo* this); -void ObjTsubo_Idle(ObjTsubo* this, GlobalContext* globalCtx); +void ObjTsubo_Idle(ObjTsubo* this, PlayState* play); void ObjTsubo_SetupLiftedUp(ObjTsubo* this); -void ObjTsubo_LiftedUp(ObjTsubo* this, GlobalContext* globalCtx); +void ObjTsubo_LiftedUp(ObjTsubo* this, PlayState* play); void ObjTsubo_SetupThrown(ObjTsubo* this); -void ObjTsubo_Thrown(ObjTsubo* this, GlobalContext* globalCtx); +void ObjTsubo_Thrown(ObjTsubo* this, PlayState* play); static s16 D_80BA1B50 = 0; static s16 D_80BA1B54 = 0; @@ -82,12 +82,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; -void ObjTsubo_SpawnCollectible(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play) { s16 dropParams = this->actor.params & 0x1F; if ((dropParams >= 0) && (dropParams < ITEM00_MAX)) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, - (dropParams | (((this->actor.params >> 9) & 0x3F) << 8))); + Item_DropCollectible(play, &this->actor.world.pos, (dropParams | (((this->actor.params >> 9) & 0x3F) << 8))); } } @@ -98,7 +97,7 @@ void ObjTsubo_ApplyGravity(ObjTsubo* this) { } } -s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx) { +s32 ObjTsubo_SnapToFloor(ObjTsubo* this, PlayState* play) { CollisionPoly* floorPoly; Vec3f pos; s32 bgID; @@ -107,7 +106,7 @@ s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 20.0f; pos.z = this->actor.world.pos.z; - floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &floorPoly, &bgID, &this->actor, &pos); + floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &floorPoly, &bgID, &this->actor, &pos); if (floorY > BGCHECK_Y_MIN) { this->actor.world.pos.y = floorY; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); @@ -118,25 +117,25 @@ s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx) { } } -void ObjTsubo_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void ObjTsubo_InitCollider(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); } -void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjTsubo_Init(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - ObjTsubo_InitCollider(&this->actor, globalCtx); + ObjTsubo_InitCollider(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, sColChkInfoInit); - if (!ObjTsubo_SnapToFloor(this, globalCtx)) { + if (!ObjTsubo_SnapToFloor(this, play)) { Actor_Kill(&this->actor); return; } - this->objTsuboBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[(this->actor.params >> 8) & 1]); + this->objTsuboBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[(this->actor.params >> 8) & 1]); if (this->objTsuboBankIndex < 0) { osSyncPrintf("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_obj_tsubo.c", 410); Actor_Kill(&this->actor); @@ -146,14 +145,14 @@ void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjTsubo_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjTsubo_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjTsubo* this = (ObjTsubo*)thisx; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void ObjTsubo_AirBreak(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_AirBreak(ObjTsubo* this, PlayState* play) { s32 pad; f32 rand; s16 angle; @@ -182,14 +181,14 @@ void ObjTsubo_AirBreak(ObjTsubo* this, GlobalContext* globalCtx) { } else { arg5 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, -240, arg5, 10, 10, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -240, arg5, 10, 10, 0, (Rand_ZeroOne() * 95.0f) + 15.0f, 0, 32, 60, KAKERA_COLOR_NONE, sObjectIds[(this->actor.params >> 8) & 1], D_80BA1B8C[(this->actor.params >> 8) & 1]); } - func_80033480(globalCtx, &this->actor.world.pos, 30.0f, 4, 20, 50, 1); + func_80033480(play, &this->actor.world.pos, 30.0f, 4, 20, 50, 1); } -void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_WaterBreak(ObjTsubo* this, PlayState* play) { s32 pad[2]; s16 angle; Vec3f pos = this->actor.world.pos; @@ -198,7 +197,7 @@ void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx) { s32 i; pos.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 400); + 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); @@ -211,7 +210,7 @@ void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx) { velocity.z = pos.z * 0.2f; Math_Vec3f_Sum(&pos, &this->actor.world.pos, &pos); phi_s0 = (Rand_ZeroOne() < .2f) ? 64 : 32; - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, -180, phi_s0, 30, 30, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -180, phi_s0, 30, 30, 0, (Rand_ZeroOne() * 95.0f) + 15.0f, 0, 32, 70, KAKERA_COLOR_NONE, sObjectIds[(this->actor.params >> 8) & 1], D_80BA1B8C[(this->actor.params >> 8) & 1]); } @@ -221,8 +220,8 @@ void ObjTsubo_SetupWaitForObject(ObjTsubo* this) { this->actionFunc = ObjTsubo_WaitForObject; } -void ObjTsubo_WaitForObject(ObjTsubo* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objTsuboBankIndex)) { +void ObjTsubo_WaitForObject(ObjTsubo* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objTsuboBankIndex)) { this->actor.draw = ObjTsubo_Draw; this->actor.objBankIndex = this->objTsuboBankIndex; ObjTsubo_SetupIdle(this); @@ -234,39 +233,39 @@ void ObjTsubo_SetupIdle(ObjTsubo* this) { this->actionFunc = ObjTsubo_Idle; } -void ObjTsubo_Idle(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_Idle(ObjTsubo* this, PlayState* play) { s32 pad; s16 temp_v0; s32 phi_v1; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { ObjTsubo_SetupLiftedUp(this); } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.yDistToWater > 15.0f)) { - ObjTsubo_WaterBreak(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); - ObjTsubo_SpawnCollectible(this, globalCtx); + ObjTsubo_WaterBreak(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + ObjTsubo_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else if ((this->collider.base.acFlags & AC_HIT) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x4FC1FFFC)) { - ObjTsubo_AirBreak(this, globalCtx); - ObjTsubo_SpawnCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + ObjTsubo_AirBreak(this, play); + ObjTsubo_SpawnCollectible(this, play); + SoundSource_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(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 150.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } if (this->actor.xzDistToPlayer < 100.0f) { - temp_v0 = this->actor.yawTowardsPlayer - GET_PLAYER(globalCtx)->actor.world.rot.y; + 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 - func_8002F434(&this->actor, globalCtx, GI_NONE, 30.0f, 30.0f); + func_8002F434(&this->actor, play, GI_NONE, 30.0f, 30.0f); } } } @@ -279,13 +278,13 @@ void ObjTsubo_SetupLiftedUp(ObjTsubo* this) { this->actor.flags |= ACTOR_FLAG_4; } -void ObjTsubo_LiftedUp(ObjTsubo* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.curRoom.num; +void ObjTsubo_LiftedUp(ObjTsubo* this, PlayState* play) { + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.curRoom.num; ObjTsubo_SetupThrown(this); ObjTsubo_ApplyGravity(this); func_8002D7EC(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_7); } } @@ -301,19 +300,19 @@ void ObjTsubo_SetupThrown(ObjTsubo* this) { this->actionFunc = ObjTsubo_Thrown; } -void ObjTsubo_Thrown(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_Thrown(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, globalCtx); - ObjTsubo_SpawnCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + ObjTsubo_AirBreak(this, play); + ObjTsubo_SpawnCollectible(this, play); + SoundSource_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, globalCtx); - ObjTsubo_SpawnCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + ObjTsubo_WaterBreak(this, play); + ObjTsubo_SpawnCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); Actor_Kill(&this->actor); } else { ObjTsubo_ApplyGravity(this); @@ -322,20 +321,20 @@ void ObjTsubo_Thrown(ObjTsubo* this, GlobalContext* globalCtx) { Math_StepToS(&D_80BA1B5C, D_80BA1B58, 0x64); this->actor.shape.rot.x += D_80BA1B54; this->actor.shape.rot.y += D_80BA1B5C; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f, + 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(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } -void ObjTsubo_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjTsubo_Update(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjTsubo_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, D_80BA1B84[(thisx->params >> 8) & 1]); +void ObjTsubo_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, D_80BA1B84[(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 c8abce6503..62ea296f8b 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h @@ -6,7 +6,7 @@ struct ObjTsubo; -typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, GlobalContext*); +typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, PlayState*); typedef struct ObjTsubo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index d6d979dfb3..c9a1e9afb7 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -10,23 +10,23 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_27) -void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjWarp2block_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjWarp2block_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjWarp2block_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjWarp2block_Init(Actor* thisx, PlayState* play); +void ObjWarp2block_Destroy(Actor* thisx, PlayState* play); +void ObjWarp2block_Update(Actor* thisx, PlayState* play); +void ObjWarp2block_Draw(Actor* thisx, PlayState* play); -void ObjWarp2block_Spawn(ObjWarp2block* this, GlobalContext* globalCtx); -s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx); -void ObjWarp2block_SwapWithChild(ObjWarp2block* this, GlobalContext* globalCtx); -s32 func_80BA2218(ObjWarp2block* this, GlobalContext* globalCtx); -s32 func_80BA228C(ObjWarp2block* this, GlobalContext* globalCtx); -s32 func_80BA2304(ObjWarp2block* this, GlobalContext* globalCtx); +void ObjWarp2block_Spawn(ObjWarp2block* this, PlayState* play); +s32 func_80BA1ECC(ObjWarp2block* this, PlayState* play); +void ObjWarp2block_SwapWithChild(ObjWarp2block* this, PlayState* play); +s32 func_80BA2218(ObjWarp2block* this, PlayState* play); +s32 func_80BA228C(ObjWarp2block* this, PlayState* play); +s32 func_80BA2304(ObjWarp2block* this, PlayState* play); void ObjWarp2block_SetInactive(ObjWarp2block* this); -void ObjWarp2block_DoNothing(ObjWarp2block* this, GlobalContext* globalCtx); +void ObjWarp2block_DoNothing(ObjWarp2block* this, PlayState* play); void func_80BA24E8(ObjWarp2block* this); -void func_80BA24F8(ObjWarp2block* this, GlobalContext* globalCtx); +void func_80BA24F8(ObjWarp2block* this, PlayState* play); void func_80BA2600(ObjWarp2block* this); -void func_80BA2610(ObjWarp2block* this, GlobalContext* globalCtx); +void func_80BA2610(ObjWarp2block* this, PlayState* play); const ActorInit Obj_Warp2block_InitVars = { ACTOR_OBJ_WARP2BLOCK, @@ -64,17 +64,16 @@ static Color_RGB8 sColors[] = { { 80, 110, 140 }, { 70, 160, 225 }, { 80, 100, 130 }, { 100, 110, 190 }, }; -void ObjWarp2block_Spawn(ObjWarp2block* this, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0, - sSpawnData[(this->dyna.actor.params >> 8) & 1].params); +void ObjWarp2block_Spawn(ObjWarp2block* this, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, + this->dyna.actor.world.pos.z, 0, 0, 0, sSpawnData[(this->dyna.actor.params >> 8) & 1].params); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->dyna.actor.child->world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.child->world.pos.x, this->dyna.actor.child->world.pos.y, this->dyna.actor.child->world.pos.z, 0, 0, 0, sSpawnData[(this->dyna.actor.child->params >> 8) & 1].params); } -s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx) { +s32 func_80BA1ECC(ObjWarp2block* this, PlayState* play) { s32 pad; Actor* temp_a3; Player* player; @@ -86,7 +85,7 @@ s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx) { } temp_a3 = this->dyna.actor.child; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if ((this->dyna.actor.xzDistToPlayer <= sDistances[(((this->dyna.actor.params >> 0xB) & 7))]) || (temp_a3->xzDistToPlayer <= sDistances[(((temp_a3->params >> 0xB) & 7))])) { @@ -110,7 +109,7 @@ s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx) { return 1; } -void ObjWarp2block_SwapWithChild(ObjWarp2block* this, GlobalContext* globalCtx) { +void ObjWarp2block_SwapWithChild(ObjWarp2block* this, PlayState* play) { Vec3f tempVec; Vec3s tempRot; s32 temp; @@ -148,18 +147,18 @@ void ObjWarp2block_SwapWithChild(ObjWarp2block* this, GlobalContext* globalCtx) this->dyna.actor.child->params = (this->dyna.actor.child->params & 0x8000) | (temp & 0x7FFF); if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos) < 0.01f) { - Flags_UnsetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_UnsetSwitch(play, this->dyna.actor.params & 0x3F); } else { - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); } } -s32 func_80BA2218(ObjWarp2block* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80BA2218(ObjWarp2block* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (func_80BA1ECC(this, globalCtx)) { + if (func_80BA1ECC(this, play)) { if (player->stateFlags2 & PLAYER_STATE2_24) { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->func_168 = func_80BA228C; } else { player->stateFlags2 |= PLAYER_STATE2_23; @@ -169,12 +168,12 @@ s32 func_80BA2218(ObjWarp2block* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BA228C(ObjWarp2block* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { +s32 func_80BA228C(ObjWarp2block* this, PlayState* play) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { this->func_168 = func_80BA2218; } - if (globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_TIME) { + if (play->msgCtx.lastPlayedSong == OCARINA_SONG_TIME) { if (this->unk_172 == 0xFE) { this->unk_16E = 0x6E; } else { @@ -187,16 +186,16 @@ s32 func_80BA228C(ObjWarp2block* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BA2304(ObjWarp2block* this, GlobalContext* globalCtx) { - s32 ret = this->func_168(this, globalCtx); +s32 func_80BA2304(ObjWarp2block* this, PlayState* play) { + s32 ret = this->func_168(this, play); - this->unk_172 = globalCtx->msgCtx.lastPlayedSong; + this->unk_172 = play->msgCtx.lastPlayedSong; return ret; } -void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjWarp2block_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjWarp2block* this = (ObjWarp2block*)thisx; CollisionHeader* collisionHeader; @@ -210,12 +209,12 @@ void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx2) { if ((this->dyna.actor.params >> 0xF) & 1) { func_80BA24E8(this); - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { this->dyna.actor.draw = NULL; } DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gSongOfTimeBlockCol, &collisionHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, collisionHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, collisionHeader); } else { ObjWarp2block_SetInactive(this); } @@ -224,10 +223,10 @@ void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx2) { this->dyna.actor.home.rot.z & 7, (this->dyna.actor.params >> 0xB) & 7); } -void ObjWarp2block_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjWarp2block_Destroy(Actor* thisx, PlayState* play) { ObjWarp2block* this = (ObjWarp2block*)thisx; if ((this->dyna.actor.params >> 0xF) & 1) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -236,22 +235,22 @@ void ObjWarp2block_SetInactive(ObjWarp2block* this) { this->dyna.actor.draw = NULL; } -void ObjWarp2block_DoNothing(ObjWarp2block* this, GlobalContext* globalCtx) { +void ObjWarp2block_DoNothing(ObjWarp2block* this, PlayState* play) { } void func_80BA24E8(ObjWarp2block* this) { this->actionFunc = func_80BA24F8; } -void func_80BA24F8(ObjWarp2block* this, GlobalContext* globalCtx) { - Actor* current = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; +void func_80BA24F8(ObjWarp2block* this, PlayState* play) { + Actor* current = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (current != NULL) { if (current->id == ACTOR_OBJ_WARP2BLOCK && !((current->params >> 0xF) & 1) && ((this->dyna.actor.params & 0x3F) == (current->params & 0x3F))) { this->dyna.actor.child = current; - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { - ObjWarp2block_SwapWithChild(this, globalCtx); + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + ObjWarp2block_SwapWithChild(this, play); this->dyna.actor.draw = ObjWarp2block_Draw; } func_80BA2600(this); @@ -274,18 +273,18 @@ void func_80BA2600(ObjWarp2block* this) { this->actionFunc = func_80BA2610; } -void func_80BA2610(ObjWarp2block* this, GlobalContext* globalCtx) { - if ((func_80BA2304(this, globalCtx) != 0) && (this->unk_16C <= 0)) { - ObjWarp2block_Spawn(this, globalCtx); +void func_80BA2610(ObjWarp2block* this, PlayState* play) { + if ((func_80BA2304(this, play) != 0) && (this->unk_16C <= 0)) { + ObjWarp2block_Spawn(this, play); this->unk_16C = 0xA0; - OnePointCutscene_Attention(globalCtx, &this->dyna.actor); + OnePointCutscene_Attention(play, &this->dyna.actor); this->unk_170 = 0xC; } if (this->unk_170 > 0) { this->unk_170--; if (this->unk_170 == 0) { - ObjWarp2block_SwapWithChild(this, globalCtx); + ObjWarp2block_SwapWithChild(this, play); } } if (this->unk_16C == 0x32) { @@ -293,27 +292,27 @@ void func_80BA2610(ObjWarp2block* this, GlobalContext* globalCtx) { } } -void ObjWarp2block_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjWarp2block_Update(Actor* thisx, PlayState* play) { ObjWarp2block* this = (ObjWarp2block*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_16C > 0) { this->unk_16C--; } } -void ObjWarp2block_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjWarp2block_Draw(Actor* thisx, PlayState* play) { Color_RGB8* sp44; sp44 = &sColors[thisx->home.rot.z & 7]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_warp2block.c", 584); - func_80093D18(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_obj_warp2block.c", 584); + func_80093D18(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_warp2block.c", 588), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_warp2block.c", 588), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sp44->r, sp44->g, sp44->b, 255); gSPDisplayList(POLY_OPA_DISP++, gSongOfTimeBlockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_warp2block.c", 594); + CLOSE_DISPS(play->state.gfxCtx, "../z_obj_warp2block.c", 594); } diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h index 9b9dd991ee..3e09d976c2 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h @@ -6,8 +6,8 @@ struct ObjWarp2block; -typedef void (*ObjWarp2blockActionFunc)(struct ObjWarp2block*, GlobalContext*); -typedef s32 (*ObjWarp2blockFunc168)(struct ObjWarp2block*, GlobalContext*); +typedef void (*ObjWarp2blockActionFunc)(struct ObjWarp2block*, PlayState*); +typedef s32 (*ObjWarp2blockFunc168)(struct ObjWarp2block*, PlayState*); typedef struct ObjWarp2block { /* 0x0000 */ DynaPolyActor dyna; 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 60735d4955..45f59c6bee 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -11,27 +11,27 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) -void ObjectKankyo_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjectKankyo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjectKankyo_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjectKankyo_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjectKankyo_Init(Actor* thisx, PlayState* play); +void ObjectKankyo_Destroy(Actor* thisx, PlayState* play); +void ObjectKankyo_Update(Actor* thisx, PlayState* play); +void ObjectKankyo_Draw(Actor* thisx, PlayState* play); void ObjectKankyo_SetupAction(ObjectKankyo* this, ObjectKankyoActionFunc func); -void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_Snow(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_Lightning(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_InitBeams(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_WaitForSunGraveSparkObject(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_WaitForBeamObject(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_Beams(ObjectKankyo* this, GlobalContext* globalCtx); +void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_Snow(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_Lightning(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_InitBeams(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_WaitForSunGraveSparkObject(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_WaitForBeamObject(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_Beams(ObjectKankyo* this, PlayState* play); -void ObjectKankyo_DrawFairies(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_DrawSnow(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_DrawLightning(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this, GlobalContext* globalCtx); -void ObjectKankyo_DrawBeams(ObjectKankyo* this, GlobalContext* globalCtx); +void ObjectKankyo_DrawFairies(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_DrawSnow(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_DrawLightning(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_DrawBeams(ObjectKankyo* this, PlayState* play); extern Mtx D_01000000; @@ -64,7 +64,7 @@ void ObjectKankyo_SetupAction(ObjectKankyo* this, ObjectKankyoActionFunc action) this->actionFunc = action; } -void ObjectKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Init(Actor* thisx, PlayState* play) { ObjectKankyo* this = (ObjectKankyo*)thisx; s32 pad; s16 i; @@ -100,7 +100,7 @@ void ObjectKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { case 4: this->effects[0].alpha = 0; this->effects[0].amplitude = 0.0f; - Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ITEMACTION); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION); this->requiredObjectLoaded = false; ObjectKankyo_SetupAction(this, ObjectKankyo_SunGraveSparkInit); break; @@ -160,14 +160,14 @@ void ObjectKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjectKankyo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Destroy(Actor* thisx, PlayState* play) { Actor_Kill(thisx); } -void ObjectKankyo_Snow(ObjectKankyo* this, GlobalContext* globalCtx) { +void ObjectKankyo_Snow(ObjectKankyo* this, PlayState* play) { } -void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { +void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play) { static Vec3f sSoundPos = { 0.0f, 0.0f, 0.0f }; Player* player; f32 dist; @@ -188,14 +188,14 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { s16 i; Vec3f viewForwards; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); - if (globalCtx->sceneNum == SCENE_SPOT04 && gSaveContext.sceneSetupIndex == 7) { - dist = Math3D_Vec3f_DistXYZ(&this->prevEyePos, &globalCtx->view.eye); + if (play->sceneNum == SCENE_SPOT04 && gSaveContext.sceneSetupIndex == 7) { + dist = Math3D_Vec3f_DistXYZ(&this->prevEyePos, &play->view.eye); - this->prevEyePos.x = globalCtx->view.eye.x; - this->prevEyePos.y = globalCtx->view.eye.y; - this->prevEyePos.z = globalCtx->view.eye.z; + this->prevEyePos.x = play->view.eye.x; + this->prevEyePos.y = play->view.eye.y; + this->prevEyePos.z = play->view.eye.z; dist /= 30.0f; if (dist > 1.0f) { @@ -203,7 +203,7 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { } func_800F436C(&sSoundPos, NA_SE_EV_NAVY_FLY - SFX_FLAG, (0.4f * dist) + 0.6f); - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 473: func_800788CC(NA_SE_VO_NA_HELLO_3); break; @@ -222,17 +222,17 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { } } - if (globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX] < 64 && + if (play->envCtx.precipitation[PRECIP_SNOW_MAX] < 64 && (gSaveContext.entranceIndex != ENTR_SPOT04_0 || gSaveContext.sceneSetupIndex != 4 || - globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX])) { - globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX] += 16; + play->envCtx.precipitation[PRECIP_SNOW_MAX])) { + play->envCtx.precipitation[PRECIP_SNOW_MAX] += 16; } - for (i = 0; i < globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX]; i++) { + for (i = 0; i < play->envCtx.precipitation[PRECIP_SNOW_MAX]; i++) { // spawn in front of the camera - dx = globalCtx->view.at.x - globalCtx->view.eye.x; - dy = globalCtx->view.at.y - globalCtx->view.eye.y; - dz = globalCtx->view.at.z - globalCtx->view.eye.z; + dx = play->view.at.x - play->view.eye.x; + dy = play->view.at.y - play->view.eye.y; + dz = play->view.at.z - play->view.eye.z; dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); viewForwards.x = dx / dist; @@ -245,9 +245,9 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { switch (this->effects[i].state) { case 0: // init - this->effects[i].base.x = globalCtx->view.eye.x + viewForwardsX * 80.0f; - this->effects[i].base.y = globalCtx->view.eye.y + viewForwardsY * 80.0f; - this->effects[i].base.z = globalCtx->view.eye.z + viewForwardsZ * 80.0f; + this->effects[i].base.x = play->view.eye.x + viewForwardsX * 80.0f; + this->effects[i].base.y = play->view.eye.y + viewForwardsY * 80.0f; + this->effects[i].base.z = play->view.eye.z + viewForwardsZ * 80.0f; this->effects[i].pos.x = (Rand_ZeroOne() - 0.5f) * 160.0f; this->effects[i].pos.y = 30.0f; @@ -266,9 +266,9 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { case 1: // blinking fairies / inactive fairy trails case 2: // fairy trails this->effects[i].alphaTimer++; - baseX = globalCtx->view.eye.x + viewForwards.x * 80.0f; - baseY = globalCtx->view.eye.y + viewForwards.y * 80.0f; - baseZ = globalCtx->view.eye.z + viewForwards.z * 80.0f; + baseX = play->view.eye.x + viewForwards.x * 80.0f; + baseY = play->view.eye.y + viewForwards.y * 80.0f; + baseZ = play->view.eye.z + viewForwards.z * 80.0f; this->effects[i].prevPos.x = this->effects[i].pos.x; this->effects[i].prevPos.y = this->effects[i].pos.y; @@ -450,53 +450,53 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) { } } -void ObjectKankyo_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Update(Actor* thisx, PlayState* play) { ObjectKankyo* this = (ObjectKankyo*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjectKankyo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Draw(Actor* thisx, PlayState* play) { ObjectKankyo* this = (ObjectKankyo*)thisx; switch (this->actor.params) { case 0: - ObjectKankyo_DrawFairies(this, globalCtx); + ObjectKankyo_DrawFairies(this, play); break; case 2: - ObjectKankyo_DrawLightning(this, globalCtx); + ObjectKankyo_DrawLightning(this, play); break; case 3: - ObjectKankyo_DrawSnow(this, globalCtx); + ObjectKankyo_DrawSnow(this, play); break; case 4: - ObjectKankyo_DrawSunGraveSpark(this, globalCtx); + ObjectKankyo_DrawSunGraveSpark(this, play); break; case 5: - ObjectKankyo_DrawBeams(this, globalCtx); + ObjectKankyo_DrawBeams(this, play); break; } } -void ObjectKankyo_DrawFairies(ObjectKankyo* this2, GlobalContext* globalCtx2) { +void ObjectKankyo_DrawFairies(ObjectKankyo* this2, PlayState* play2) { ObjectKankyo* this = this2; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 alphaScale; Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; Vec3f vec2 = { 0.0f, 0.0f, 0.0f }; s16 i; - if (!(globalCtx->cameraPtrs[CAM_ID_MAIN]->unk_14C & 0x100)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 807); + if (!(play->cameraPtrs[CAM_ID_MAIN]->unk_14C & 0x100)) { + OPEN_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 807); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gSun1Tex)); gSPDisplayList(POLY_XLU_DISP++, gKokiriDustMoteMaterialDL); - for (i = 0; i < globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX]; i++) { + for (i = 0; i < play->envCtx.precipitation[PRECIP_SNOW_MAX]; i++) { Matrix_Translate(this->effects[i].base.x + this->effects[i].pos.x, this->effects[i].base.y + this->effects[i].pos.y, this->effects[i].base.z + this->effects[i].pos.z, MTXMODE_NEW); @@ -558,18 +558,18 @@ void ObjectKankyo_DrawFairies(ObjectKankyo* this2, GlobalContext* globalCtx2) { break; } - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZ(DEG_TO_RAD(globalCtx->state.frames * 20.0f), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 913), G_MTX_LOAD); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + Matrix_RotateZ(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_object_kankyo.c", 913), G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gKokiriDustMoteModelDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 922); + CLOSE_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 922); } } -void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { +void ObjectKankyo_DrawSnow(ObjectKankyo* this2, PlayState* play2) { ObjectKankyo* this = this2; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 dist; f32 dx; f32 dy; @@ -585,33 +585,32 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { s32 pad; s32 pad2; - if (!(globalCtx->cameraPtrs[CAM_ID_MAIN]->unk_14C & 0x100)) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 958); - if (globalCtx->envCtx.precipitation[PRECIP_SNOW_CUR] < globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX]) { - if (globalCtx->state.frames % 16 == 0) { - globalCtx->envCtx.precipitation[PRECIP_SNOW_CUR] += 2; + if (!(play->cameraPtrs[CAM_ID_MAIN]->unk_14C & 0x100)) { + OPEN_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 958); + if (play->envCtx.precipitation[PRECIP_SNOW_CUR] < play->envCtx.precipitation[PRECIP_SNOW_MAX]) { + if (play->state.frames % 16 == 0) { + play->envCtx.precipitation[PRECIP_SNOW_CUR] += 2; } - } else if (globalCtx->envCtx.precipitation[PRECIP_SNOW_CUR] > - globalCtx->envCtx.precipitation[PRECIP_SNOW_MAX]) { - if (globalCtx->state.frames % 16 == 0) { - globalCtx->envCtx.precipitation[PRECIP_SNOW_CUR] -= 2; + } else if (play->envCtx.precipitation[PRECIP_SNOW_CUR] > play->envCtx.precipitation[PRECIP_SNOW_MAX]) { + if (play->state.frames % 16 == 0) { + play->envCtx.precipitation[PRECIP_SNOW_CUR] -= 2; } } - for (i = 0; i < globalCtx->envCtx.precipitation[PRECIP_SNOW_CUR]; i++) { + for (i = 0; i < play->envCtx.precipitation[PRECIP_SNOW_CUR]; i++) { switch (this->effects[i].state) { case 0: // spawn in front of the camera - dx = globalCtx->view.at.x - globalCtx->view.eye.x; - dy = globalCtx->view.at.y - globalCtx->view.eye.y; - dz = globalCtx->view.at.z - globalCtx->view.eye.z; + dx = play->view.at.x - play->view.eye.x; + dy = play->view.at.y - play->view.eye.y; + dz = play->view.at.z - play->view.eye.z; dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); // fake temp = dz / dist; - this->effects[i].base.x = globalCtx->view.eye.x + dx / dist * 80.0f; - this->effects[i].base.y = globalCtx->view.eye.y + dy / dist * 80.0f; - this->effects[i].base.z = globalCtx->view.eye.z + temp * 80.0f; + this->effects[i].base.x = play->view.eye.x + dx / dist * 80.0f; + this->effects[i].base.y = play->view.eye.y + dy / dist * 80.0f; + this->effects[i].base.z = play->view.eye.z + temp * 80.0f; this->effects[i].pos.x = (Rand_ZeroOne() - 0.5f) * 160.0f; this->effects[i].pos.y = 80.0f; @@ -626,14 +625,14 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { break; case 1: - dx = globalCtx->view.at.x - globalCtx->view.eye.x; - dy = globalCtx->view.at.y - globalCtx->view.eye.y; - dz = globalCtx->view.at.z - globalCtx->view.eye.z; + dx = play->view.at.x - play->view.eye.x; + dy = play->view.at.y - play->view.eye.y; + dz = play->view.at.z - play->view.eye.z; dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); - baseX = globalCtx->view.eye.x + dx / dist * 80.0f; - baseY = globalCtx->view.eye.y + dy / dist * 80.0f; - baseZ = globalCtx->view.eye.z + dz / dist * 80.0f; + baseX = play->view.eye.x + dx / dist * 80.0f; + baseY = play->view.eye.y + dy / dist * 80.0f; + baseZ = play->view.eye.z + dz / dist * 80.0f; this->effects[i].dirPhase.x += 0.049999997f * Rand_ZeroOne(); this->effects[i].dirPhase.z += 0.049999997f * Rand_ZeroOne(); @@ -642,7 +641,7 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { this->effects[i].pos.y += -this->effects[i].speed; if (this->effects[i].base.y + this->effects[i].pos.y < this->actor.world.pos.y || - this->effects[i].base.y + this->effects[i].pos.y < globalCtx->view.eye.y - 150.0f) { + this->effects[i].base.y + this->effects[i].pos.y < play->view.eye.y - 150.0f) { this->effects[i].state++; } @@ -690,12 +689,11 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 200, 200, 180); gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 200, 180); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1107), - G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_object_kankyo.c", 1107), G_MTX_LOAD); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gDust5Tex)); - func_80094C50(globalCtx->state.gfxCtx); + func_80094C50(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &D_01000000, G_MTX_MODELVIEW | G_MTX_NOPUSH | G_MTX_MUL); gDPPipeSync(POLY_XLU_DISP++); @@ -705,16 +703,16 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { gDPPipeSync(POLY_XLU_DISP++); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1127); + CLOSE_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 1127); } } -void ObjectKankyo_Lightning(ObjectKankyo* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[0] != NULL) { +void ObjectKankyo_Lightning(ObjectKankyo* this, PlayState* play) { + if (play->csCtx.state != 0 && play->csCtx.npcActions[0] != NULL) { switch (this->effects[0].state) { case 0: this->effects[0].timer = 0; - if (globalCtx->csCtx.npcActions[0]->action == 2) { + if (play->csCtx.npcActions[0]->action == 2) { this->effects[0].state++; } break; @@ -726,7 +724,7 @@ void ObjectKankyo_Lightning(ObjectKankyo* this, GlobalContext* globalCtx) { break; case 2: - if (globalCtx->csCtx.npcActions[0]->action == 1) { + if (play->csCtx.npcActions[0]->action == 1) { this->effects[0].state = 0; } break; @@ -734,34 +732,34 @@ void ObjectKankyo_Lightning(ObjectKankyo* this, GlobalContext* globalCtx) { } } -void ObjectKankyo_DrawLightning(ObjectKankyo* this, GlobalContext* globalCtx) { +void ObjectKankyo_DrawLightning(ObjectKankyo* this, PlayState* play) { s32 pad; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1182); + OPEN_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 1182); if (this->effects[0].state == 1) { - Matrix_Translate(globalCtx->csCtx.npcActions[0]->startPos.x, globalCtx->csCtx.npcActions[0]->startPos.y, - globalCtx->csCtx.npcActions[0]->startPos.z, MTXMODE_NEW); + Matrix_Translate(play->csCtx.npcActions[0]->startPos.x, play->csCtx.npcActions[0]->startPos.y, + play->csCtx.npcActions[0]->startPos.z, MTXMODE_NEW); Matrix_RotateX(DEG_TO_RAD(20), MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(20), MTXMODE_APPLY); Matrix_Scale(2.0f, 5.0f, 2.0f, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 128); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, 128); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1213), G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_object_kankyo.c", 1213), G_MTX_LOAD); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEffLightningTextures[this->effects[0].timer])); - func_80094C50(globalCtx->state.gfxCtx); + func_80094C50(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &D_01000000, G_MTX_MODELVIEW | G_MTX_NOPUSH | G_MTX_MUL); gDPPipeSync(POLY_XLU_DISP++); gSPDisplayList(POLY_XLU_DISP++, gEffLightningDL); gDPPipeSync(POLY_XLU_DISP++); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1233); + CLOSE_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 1233); } -void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, GlobalContext* globalCtx) { - s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_SPOT02_OBJECTS); +void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, PlayState* play) { + s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_SPOT02_OBJECTS); if (objBankIndex < 0) { ASSERT(0, "0", "../z_object_kankyo.c", 1251); @@ -771,8 +769,8 @@ void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, GlobalContext* globalCtx ObjectKankyo_SetupAction(this, ObjectKankyo_WaitForSunGraveSparkObject); } -void ObjectKankyo_WaitForSunGraveSparkObject(ObjectKankyo* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { +void ObjectKankyo_WaitForSunGraveSparkObject(ObjectKankyo* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { this->requiredObjectLoaded = true; this->effects[0].alpha = 0; this->actor.objBankIndex = this->requiredObjBankIndex; @@ -781,9 +779,9 @@ void ObjectKankyo_WaitForSunGraveSparkObject(ObjectKankyo* this, GlobalContext* } } -void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0) { - if (globalCtx->csCtx.npcActions[1] != NULL && globalCtx->csCtx.npcActions[1]->action == 2) { +void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, PlayState* play) { + if (play->csCtx.state != 0) { + if (play->csCtx.npcActions[1] != NULL && play->csCtx.npcActions[1]->action == 2) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BIRI_SPARK - SFX_FLAG); if ((s16)this->effects[0].alpha + 20 > 255) { this->effects[0].alpha = 255; @@ -795,17 +793,16 @@ void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, GlobalContext* globalCtx) { } } -void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, GlobalContext* globalCtx2) { +void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, PlayState* play2) { ObjectKankyo* this = this2; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Vec3f start; Vec3f end; f32 weight; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1324); - if (globalCtx->csCtx.state != 0) { - if (globalCtx->csCtx.npcActions[1] != NULL && globalCtx->csCtx.npcActions[1]->action == 2 && - this->requiredObjectLoaded) { + OPEN_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 1324); + if (play->csCtx.state != 0) { + if (play->csCtx.npcActions[1] != NULL && play->csCtx.npcActions[1]->action == 2 && this->requiredObjectLoaded) { // apparently, light waves with larger amplitudes look brighter, so the name 'amplitude' kind of works here if (this->effects[0].state == 0) { this->effects[0].amplitude += 1.0f / 7.0f; @@ -825,20 +822,20 @@ void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, GlobalContext* globalCt this->effects[0].timer = 0; } - start.x = globalCtx->csCtx.npcActions[1]->startPos.x; - start.y = globalCtx->csCtx.npcActions[1]->startPos.y; - start.z = globalCtx->csCtx.npcActions[1]->startPos.z; + start.x = play->csCtx.npcActions[1]->startPos.x; + start.y = play->csCtx.npcActions[1]->startPos.y; + start.z = play->csCtx.npcActions[1]->startPos.z; - end.x = globalCtx->csCtx.npcActions[1]->endPos.x; - end.y = globalCtx->csCtx.npcActions[1]->endPos.y; - end.z = globalCtx->csCtx.npcActions[1]->endPos.z; + end.x = play->csCtx.npcActions[1]->endPos.x; + end.y = play->csCtx.npcActions[1]->endPos.y; + end.z = play->csCtx.npcActions[1]->endPos.z; - weight = Environment_LerpWeight(globalCtx->csCtx.npcActions[1]->endFrame, - globalCtx->csCtx.npcActions[1]->startFrame, globalCtx->csCtx.frames); + weight = Environment_LerpWeight(play->csCtx.npcActions[1]->endFrame, play->csCtx.npcActions[1]->startFrame, + play->csCtx.frames); Matrix_Translate((end.x - start.x) * weight + start.x, (end.y - start.y) * weight + start.y, (end.z - start.z) * weight + start.z, MTXMODE_NEW); Matrix_Scale(this->effects[0].size, this->effects[0].size, this->effects[0].size, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (u8)(105 * this->effects[0].amplitude) + 150, 255, (u8)(105 * this->effects[0].amplitude) + 150, this->effects[0].alpha); @@ -846,9 +843,8 @@ void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, GlobalContext* globalCt (u8)(255 * this->effects[0].amplitude), 255 - (u8)(255 * this->effects[0].amplitude), this->effects[0].alpha); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1416), - G_MTX_LOAD); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_object_kankyo.c", 1416), G_MTX_LOAD); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80BA5900[this->effects[0].timer])); gDPPipeSync(POLY_XLU_DISP++); @@ -858,11 +854,11 @@ void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, GlobalContext* globalCt } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1432); + CLOSE_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 1432); } -void ObjectKankyo_InitBeams(ObjectKankyo* this, GlobalContext* globalCtx) { - s32 objectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_DEMO_KEKKAI); +void ObjectKankyo_InitBeams(ObjectKankyo* this, PlayState* play) { + s32 objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_DEMO_KEKKAI); if (objectIndex < 0) { ASSERT(0, "0", "../z_object_kankyo.c", 1449); @@ -872,20 +868,20 @@ void ObjectKankyo_InitBeams(ObjectKankyo* this, GlobalContext* globalCtx) { ObjectKankyo_SetupAction(this, ObjectKankyo_WaitForBeamObject); } -void ObjectKankyo_WaitForBeamObject(ObjectKankyo* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { +void ObjectKankyo_WaitForBeamObject(ObjectKankyo* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { this->requiredObjectLoaded = true; this->actor.objBankIndex = this->requiredObjBankIndex; ObjectKankyo_SetupAction(this, ObjectKankyo_Beams); } } -void ObjectKankyo_Beams(ObjectKankyo* this, GlobalContext* globalCtx) { +void ObjectKankyo_Beams(ObjectKankyo* this, PlayState* play) { u8 i; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { for (i = 0; i < 6; i++) { - if (globalCtx->csCtx.npcActions[i + 1] != NULL && globalCtx->csCtx.npcActions[i + 1]->action == 2) { + if (play->csCtx.npcActions[i + 1] != NULL && play->csCtx.npcActions[i + 1]->action == 2) { if (this->effects[i].size == 0.1f) { func_800F3F3C(11); } @@ -895,7 +891,7 @@ void ObjectKankyo_Beams(ObjectKankyo* this, GlobalContext* globalCtx) { } } -void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { +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 }, @@ -904,7 +900,7 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { { 0, 200, 0 }, { 0, 50, 255 }, { 100, 0, 200 }, { 200, 0, 0 }, { 200, 255, 0 }, { 255, 120, 0 }, }; ObjectKankyo* this = this2; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; 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 }; @@ -912,7 +908,7 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { f32 beamYaw[] = { 29.9f, 90.0f, 150.0f, 30.0f, 90.0f, -30.1f }; f32 beamPitch[] = { 103.4f, 103.8f, 103.6f, -103.4f, -103.5f, 103.5f }; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1539); + OPEN_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 1539); if (this->requiredObjectLoaded) { for (i = 0; i < 6; i++) { @@ -921,21 +917,19 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { Matrix_RotateY(DEG_TO_RAD(beamYaw[i]), MTXMODE_APPLY); Matrix_RotateX(DEG_TO_RAD(beamPitch[i]), MTXMODE_APPLY); Matrix_Scale(this->effects[i].size, 0.1f, this->effects[i].size, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, sBeamPrimColors[i].r, sBeamPrimColors[i].g, sBeamPrimColors[i].b, 128); gDPSetEnvColor(POLY_XLU_DISP++, sBeamEnvColors[i].r, sBeamEnvColors[i].g, sBeamEnvColors[i].b, 128); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1586), - G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_object_kankyo.c", 1586), G_MTX_LOAD); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames * 5, - globalCtx->state.frames * 10, 32, 64, 1, globalCtx->state.frames * 5, - globalCtx->state.frames * 10, 32, 64)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->state.frames * 5, play->state.frames * 10, 32, + 64, 1, play->state.frames * 5, play->state.frames * 10, 32, 64)); gSPDisplayList(POLY_XLU_DISP++, gDemoKekkaiDL_005FF0); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1607); + CLOSE_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 1607); } diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h index 9b9a699753..48a2c9d27e 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h @@ -6,7 +6,7 @@ struct ObjectKankyo; -typedef void (*ObjectKankyoActionFunc)(struct ObjectKankyo*, GlobalContext*); +typedef void (*ObjectKankyoActionFunc)(struct ObjectKankyo*, PlayState*); typedef struct ObjectKankyoEffect { /* 0x00 */ u8 state; diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index 4879970ad0..832c63b9f1 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -9,12 +9,12 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void OceffSpot_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffSpot_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffSpot_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffSpot_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffSpot_Init(Actor* thisx, PlayState* play); +void OceffSpot_Destroy(Actor* thisx, PlayState* play); +void OceffSpot_Update(Actor* thisx, PlayState* play); +void OceffSpot_Draw(Actor* thisx, PlayState* play); -void OceffSpot_GrowCylinder(OceffSpot* this, GlobalContext* globalCtx); +void OceffSpot_GrowCylinder(OceffSpot* this, PlayState* play); const ActorInit Oceff_Spot_InitVars = { ACTOR_OCEFF_SPOT, @@ -39,7 +39,7 @@ void OceffSpot_SetupAction(OceffSpot* this, OceffSpotActionFunc actionFunc) { this->actionFunc = actionFunc; } -void OceffSpot_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffSpot_Init(Actor* thisx, PlayState* play) { s32 pad; OceffSpot* this = (OceffSpot*)thisx; @@ -48,11 +48,11 @@ void OceffSpot_Init(Actor* thisx, GlobalContext* globalCtx) { Lights_PointNoGlowSetInfo(&this->lightInfo1, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); - this->lightNode1 = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo1); + this->lightNode1 = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo1); Lights_PointNoGlowSetInfo(&this->lightInfo2, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); - this->lightNode2 = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo2); + this->lightNode2 = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo2); if (YREG(15)) { this->actor.scale.y = 2.4f; } else { @@ -62,28 +62,27 @@ void OceffSpot_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_174 = 0.0f; } -void OceffSpot_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffSpot_Destroy(Actor* thisx, PlayState* play) { s32 pad; OceffSpot* this = (OceffSpot*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode1); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode2); - func_800876C8(globalCtx); - if ((gSaveContext.nayrusLoveTimer != 0) && (globalCtx->actorCtx.actorLists[ACTORCAT_PLAYER].length != 0)) { + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode1); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode2); + func_800876C8(play); + if ((gSaveContext.nayrusLoveTimer != 0) && (play->actorCtx.actorLists[ACTORCAT_PLAYER].length != 0)) { player->stateFlags3 |= PLAYER_STATE3_6; } } -void OceffSpot_End(OceffSpot* this, GlobalContext* globalCtx) { +void OceffSpot_End(OceffSpot* this, PlayState* play) { if (this->unk_174 > 0.0f) { this->unk_174 -= 0.05f; } else { Actor_Kill(&this->actor); - if (gTimeSpeed != 400 && globalCtx->msgCtx.unk_E40E == 0 && - GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_1) { - if (globalCtx->msgCtx.ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE || - globalCtx->msgCtx.ocarinaMode != OCARINA_MODE_08) { + if (gTimeSpeed != 400 && play->msgCtx.unk_E40E == 0 && GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_1) { + if (play->msgCtx.ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE || + play->msgCtx.ocarinaMode != OCARINA_MODE_08) { gSaveContext.sunsSongState = SUNSSONG_START; osSyncPrintf(VT_FGCOL(YELLOW)); // "Sun's Song Flag" @@ -91,7 +90,7 @@ void OceffSpot_End(OceffSpot* this, GlobalContext* globalCtx) { osSyncPrintf(VT_RST); } } else { - globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; + play->msgCtx.ocarinaMode = OCARINA_MODE_04; osSyncPrintf(VT_FGCOL(YELLOW)); // "Ocarina End" osSyncPrintf("z_oceff_spot オカリナ終了\n"); @@ -100,7 +99,7 @@ void OceffSpot_End(OceffSpot* this, GlobalContext* globalCtx) { } } -void OceffSpot_Wait(OceffSpot* this, GlobalContext* globalCtx) { +void OceffSpot_Wait(OceffSpot* this, PlayState* play) { if (this->timer > 0) { this->timer--; } else { @@ -108,7 +107,7 @@ void OceffSpot_Wait(OceffSpot* this, GlobalContext* globalCtx) { } } -void OceffSpot_GrowCylinder(OceffSpot* this, GlobalContext* globalCtx) { +void OceffSpot_GrowCylinder(OceffSpot* this, PlayState* play) { if (this->unk_174 < 1.0f) { this->unk_174 += 0.05f; } else { @@ -117,14 +116,14 @@ void OceffSpot_GrowCylinder(OceffSpot* this, GlobalContext* globalCtx) { } } -void OceffSpot_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffSpot_Update(Actor* thisx, PlayState* play) { OceffSpot* this = (OceffSpot*)thisx; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 temp; temp = (1.0f - cosf(this->unk_174 * M_PI)) * 0.5f; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.scale.z = 0.42f * temp; this->actor.scale.x = 0.42f * temp; @@ -133,7 +132,7 @@ void OceffSpot_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.y += 5.0f; temp = (2.0f - this->unk_174) * this->unk_174; - Environment_AdjustLights(globalCtx, temp * 0.5F, 880.0f, 0.2f, 0.9f); + Environment_AdjustLights(play, temp * 0.5F, 880.0f, 0.2f, 0.9f); Lights_PointNoGlowSetInfo(&this->lightInfo1, (s16)this->actor.world.pos.x, (s16)this->actor.world.pos.y + 55.0f, (s16)this->actor.world.pos.z, (s32)(255.0f * temp), (s32)(255.0f * temp), @@ -146,20 +145,20 @@ void OceffSpot_Update(Actor* thisx, GlobalContext* globalCtx) { (s32)(255.0f * temp), (s32)(255.0f * temp), (s32)(200.0f * temp), (s16)(100.0f * temp)); } -void OceffSpot_Draw(Actor* thisx, GlobalContext* globalCtx) { +void OceffSpot_Draw(Actor* thisx, PlayState* play) { OceffSpot* this = (OceffSpot*)thisx; - u32 scroll = globalCtx->state.frames & 0xFFFF; + u32 scroll = play->state.frames & 0xFFFF; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_spot.c", 466); + OPEN_DISPS(play->state.gfxCtx, "../z_oceff_spot.c", 466); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_spot.c", 469), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_oceff_spot.c", 469), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sCylinderMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 32, 1, - 0, scroll * (-8), 32, 32)); + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 32, 1, 0, + scroll * (-8), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, sCylinderModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_spot.c", 485); + CLOSE_DISPS(play->state.gfxCtx, "../z_oceff_spot.c", 485); } diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h index a63890e53a..a96f1878af 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h @@ -6,7 +6,7 @@ struct OceffSpot; -typedef void (*OceffSpotActionFunc)(struct OceffSpot*, GlobalContext*); +typedef void (*OceffSpotActionFunc)(struct OceffSpot*, PlayState*); typedef struct OceffSpot { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index ad0aebf89b..f9f93a07c6 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -8,15 +8,15 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) -void OceffStorm_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffStorm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffStorm_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffStorm_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffStorm_Init(Actor* thisx, PlayState* play); +void OceffStorm_Destroy(Actor* thisx, PlayState* play); +void OceffStorm_Update(Actor* thisx, PlayState* play); +void OceffStorm_Draw(Actor* thisx, PlayState* play); -void OceffStorm_Draw2(Actor* thisx, GlobalContext* globalCtx); +void OceffStorm_Draw2(Actor* thisx, PlayState* play); -void OceffStorm_DefaultAction(OceffStorm* this, GlobalContext* globalCtx); -void OceffStorm_UnkAction(OceffStorm* this, GlobalContext* globalCtx); +void OceffStorm_DefaultAction(OceffStorm* this, PlayState* play); +void OceffStorm_UnkAction(OceffStorm* this, PlayState* play); const ActorInit Oceff_Storm_InitVars = { ACTOR_OCEFF_STORM, @@ -34,7 +34,7 @@ void OceffStorm_SetupAction(OceffStorm* this, OceffStormActionFunc actionFunc) { this->actionFunc = actionFunc; } -void OceffStorm_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffStorm_Init(Actor* thisx, PlayState* play) { OceffStorm* this = (OceffStorm*)thisx; OceffStorm_SetupAction(this, OceffStorm_DefaultAction); this->posYOffAdd = 0; @@ -50,22 +50,22 @@ void OceffStorm_Init(Actor* thisx, GlobalContext* globalCtx) { OceffStorm_SetupAction(this, OceffStorm_UnkAction); this->actor.draw = OceffStorm_Draw2; } else { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OKARINA_EFFECT, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OKARINA_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y - 30.0f, this->actor.world.pos.z, 0, 0, 0, 1); } } -void OceffStorm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffStorm_Destroy(Actor* thisx, PlayState* play) { OceffStorm* this = (OceffStorm*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_800876C8(globalCtx); + func_800876C8(play); if (gSaveContext.nayrusLoveTimer != 0) { player->stateFlags3 |= PLAYER_STATE3_6; } } -void OceffStorm_DefaultAction(OceffStorm* this, GlobalContext* globalCtx) { +void OceffStorm_DefaultAction(OceffStorm* this, PlayState* play) { if (this->counter < 20) { this->primColorAlpha = (s8)(this->counter * 5.0f); } else if (this->counter > 80) { @@ -104,29 +104,29 @@ void OceffStorm_DefaultAction(OceffStorm* this, GlobalContext* globalCtx) { } } -void OceffStorm_UnkAction(OceffStorm* this, GlobalContext* globalCtx) { +void OceffStorm_UnkAction(OceffStorm* this, PlayState* play) { if (this->primColorAlpha < 100) { this->primColorAlpha += 5; } //! @bug Actor_Kill is never called so the actor will stay alive forever } -void OceffStorm_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffStorm_Update(Actor* thisx, PlayState* play) { OceffStorm* this = (OceffStorm*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->actor.world.pos = player->actor.world.pos; - this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); - this->actionFunc(this, globalCtx); + this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); + this->actionFunc(this, play); } #include "overlays/ovl_Oceff_Storm/ovl_Oceff_Storm.c" -void OceffStorm_Draw2(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFFF; +void OceffStorm_Draw2(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFFF; OceffStorm* this = (OceffStorm*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_storm.c", 449); + OPEN_DISPS(play->state.gfxCtx, "../z_oceff_storm.c", 449); gDPPipeSync(POLY_XLU_DISP++); @@ -137,22 +137,22 @@ void OceffStorm_Draw2(Actor* thisx, GlobalContext* globalCtx) { gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 200, 200, 150, this->primColorAlpha); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 8, scroll * 4, 64, 64, 1, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 8, scroll * 4, 64, 64, 1, scroll * 4, scroll * 4, 64, 64)); gSPTextureRectangle(POLY_XLU_DISP++, 0, 0, (SCREEN_WIDTH << 2), (SCREEN_HEIGHT << 2), G_TX_RENDERTILE, 0, 0, 140, (1 << 15) | (31 << 10) | 884); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_storm.c", 477); + CLOSE_DISPS(play->state.gfxCtx, "../z_oceff_storm.c", 477); } -void OceffStorm_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFFF; +void OceffStorm_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFFF; OceffStorm* this = (OceffStorm*)thisx; Vtx* vtxPtr = sCylinderVtx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_storm.c", 486); + OPEN_DISPS(play->state.gfxCtx, "../z_oceff_storm.c", 486); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 200, 255); gDPSetEnvColor(POLY_XLU_DISP++, 150, 150, 0, 128); @@ -162,15 +162,15 @@ void OceffStorm_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[0].v.cn[3] = vtxPtr[6].v.cn[3] = vtxPtr[16].v.cn[3] = vtxPtr[25].v.cn[3] = this->vtxAlpha >> 1; vtxPtr[10].v.cn[3] = vtxPtr[22].v.cn[3] = this->vtxAlpha; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_storm.c", 498), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_oceff_storm.c", 498), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sCylinderMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 4, (0 - scroll) * 8, 32, 32, - 1, scroll * 8, (0 - scroll) * 12, 32, 32)); + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 4, (0 - scroll) * 8, 32, 32, 1, + scroll * 8, (0 - scroll) * 12, 32, 32)); gSPDisplayList(POLY_XLU_DISP++, sCylinderModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_storm.c", 512); + CLOSE_DISPS(play->state.gfxCtx, "../z_oceff_storm.c", 512); - OceffStorm_Draw2(&this->actor, globalCtx); + OceffStorm_Draw2(&this->actor, play); } diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h index a566d5896f..e4b831a208 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h @@ -6,7 +6,7 @@ struct OceffStorm; -typedef void (*OceffStormActionFunc)(struct OceffStorm*, GlobalContext*); +typedef void (*OceffStormActionFunc)(struct OceffStorm*, PlayState*); typedef struct OceffStorm { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index a39b5206a9..a88788c9a8 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void OceffWipe_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffWipe_Init(Actor* thisx, PlayState* play); +void OceffWipe_Destroy(Actor* thisx, PlayState* play); +void OceffWipe_Update(Actor* thisx, PlayState* play); +void OceffWipe_Draw(Actor* thisx, PlayState* play); const ActorInit Oceff_Wipe_InitVars = { ACTOR_OCEFF_WIPE, @@ -26,29 +26,29 @@ const ActorInit Oceff_Wipe_InitVars = { (ActorFunc)OceffWipe_Draw, }; -void OceffWipe_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe_Init(Actor* thisx, PlayState* play) { OceffWipe* this = (OceffWipe*)thisx; Actor_SetScale(&this->actor, 0.1f); this->timer = 0; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; osSyncPrintf(VT_FGCOL(CYAN) " WIPE arg_data = %d\n" VT_RST, this->actor.params); } -void OceffWipe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe_Destroy(Actor* thisx, PlayState* play) { OceffWipe* this = (OceffWipe*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_800876C8(globalCtx); + func_800876C8(play); if (gSaveContext.nayrusLoveTimer != 0) { player->stateFlags3 |= PLAYER_STATE3_6; } } -void OceffWipe_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe_Update(Actor* thisx, PlayState* play) { OceffWipe* this = (OceffWipe*)thisx; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; if (this->timer < 100) { this->timer++; } else { @@ -63,8 +63,8 @@ static u8 sAlphaIndices[] = { 0x10, 0x22, 0x01, 0x20, 0x12, 0x01, 0x12, 0x21, 0x01, 0x02, }; -void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFF; +void OceffWipe_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFF; OceffWipe* this = (OceffWipe*)thisx; f32 z; s32 pad; @@ -74,10 +74,10 @@ void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = GET_ACTIVE_CAM(globalCtx)->eye; - Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); + eye = GET_ACTIVE_CAM(play)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play)); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe.c", 346); + OPEN_DISPS(play->state.gfxCtx, "../z_oceff_wipe.c", 346); if (this->timer < 32) { z = Math_SinS(this->timer << 9) * 1400; @@ -101,14 +101,14 @@ void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[i * 2 + 1].v.cn[3] = alphaTable[sAlphaIndices[i] & 0xF]; } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe.c", 375), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_oceff_wipe.c", 375), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params != OCEFF_WIPE_ZL) { @@ -120,9 +120,9 @@ void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { } gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 - scroll, scroll * (-2), 32, 32, 1, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 - scroll, scroll * (-2), 32, 32, 1, 0 - scroll, scroll * (-2), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, sFrustumDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe.c", 398); + CLOSE_DISPS(play->state.gfxCtx, "../z_oceff_wipe.c", 398); } diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index 66637178bc..d8b4b40b53 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void OceffWipe2_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe2_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffWipe2_Init(Actor* thisx, PlayState* play); +void OceffWipe2_Destroy(Actor* thisx, PlayState* play); +void OceffWipe2_Update(Actor* thisx, PlayState* play); +void OceffWipe2_Draw(Actor* thisx, PlayState* play); const ActorInit Oceff_Wipe2_InitVars = { ACTOR_OCEFF_WIPE2, @@ -26,29 +26,29 @@ const ActorInit Oceff_Wipe2_InitVars = { (ActorFunc)OceffWipe2_Draw, }; -void OceffWipe2_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe2_Init(Actor* thisx, PlayState* play) { OceffWipe2* this = (OceffWipe2*)thisx; Actor_SetScale(&this->actor, 0.1f); this->timer = 0; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; osSyncPrintf(VT_FGCOL(CYAN) " WIPE2 arg_data = %d\n" VT_RST, this->actor.params); } -void OceffWipe2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe2_Destroy(Actor* thisx, PlayState* play) { OceffWipe2* this = (OceffWipe2*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_800876C8(globalCtx); + func_800876C8(play); if (gSaveContext.nayrusLoveTimer != 0) { player->stateFlags3 |= PLAYER_STATE3_6; } } -void OceffWipe2_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe2_Update(Actor* thisx, PlayState* play) { OceffWipe2* this = (OceffWipe2*)thisx; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; if (this->timer < 100) { this->timer++; } else { @@ -58,8 +58,8 @@ void OceffWipe2_Update(Actor* thisx, GlobalContext* globalCtx) { #include "overlays/ovl_Oceff_Wipe2/ovl_Oceff_Wipe2.c" -void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFF; +void OceffWipe2_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFF; OceffWipe2* this = (OceffWipe2*)thisx; f32 z; u8 alpha; @@ -68,8 +68,8 @@ void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = GET_ACTIVE_CAM(globalCtx)->eye; - Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); + eye = GET_ACTIVE_CAM(play)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play)); if (this->timer < 32) { z = Math_SinS(this->timer << 9) * 1330; } else { @@ -87,24 +87,24 @@ void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[11].v.cn[3] = vtxPtr[13].v.cn[3] = vtxPtr[15].v.cn[3] = vtxPtr[16].v.cn[3] = vtxPtr[18].v.cn[3] = vtxPtr[20].v.cn[3] = alpha; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe2.c", 390); + OPEN_DISPS(play->state.gfxCtx, "../z_oceff_wipe2.c", 390); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe2.c", 400), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_oceff_wipe2.c", 400), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 100, 0, 128); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 6, scroll * (-6), 64, 64, 1, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 6, scroll * (-6), 64, 64, 1, scroll * (-6), 0, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, sFrustumDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe2.c", 417); + CLOSE_DISPS(play->state.gfxCtx, "../z_oceff_wipe2.c", 417); } diff --git a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index 0b7ca33c3d..e17a5ab0de 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void OceffWipe3_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe3_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffWipe3_Init(Actor* thisx, PlayState* play); +void OceffWipe3_Destroy(Actor* thisx, PlayState* play); +void OceffWipe3_Update(Actor* thisx, PlayState* play); +void OceffWipe3_Draw(Actor* thisx, PlayState* play); const ActorInit Oceff_Wipe3_InitVars = { ACTOR_OCEFF_WIPE3, @@ -28,30 +28,30 @@ const ActorInit Oceff_Wipe3_InitVars = { #include "overlays/ovl_Oceff_Wipe3/ovl_Oceff_Wipe3.c" -void OceffWipe3_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe3_Init(Actor* thisx, PlayState* play) { OceffWipe3* this = (OceffWipe3*)thisx; Actor_SetScale(&this->actor, 0.1f); this->counter = 0; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; // it's actually WIPE3... osSyncPrintf(VT_FGCOL(CYAN) " WIPE2 arg_data = %d\n" VT_RST, this->actor.params); } -void OceffWipe3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe3_Destroy(Actor* thisx, PlayState* play) { OceffWipe3* this = (OceffWipe3*)thisx; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_800876C8(globalCtx); + func_800876C8(play); if (gSaveContext.nayrusLoveTimer != 0) { player->stateFlags3 |= PLAYER_STATE3_6; } } -void OceffWipe3_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe3_Update(Actor* thisx, PlayState* play) { OceffWipe3* this = (OceffWipe3*)thisx; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; if (this->counter < 100) { this->counter++; } else { @@ -59,8 +59,8 @@ void OceffWipe3_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFFF; +void OceffWipe3_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFFF; OceffWipe3* this = (OceffWipe3*)thisx; f32 z; u8 alpha; @@ -69,8 +69,8 @@ void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = GET_ACTIVE_CAM(globalCtx)->eye; - Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); + eye = GET_ACTIVE_CAM(play)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play)); if (this->counter < 32) { z = Math_SinS(this->counter << 9) * 1330; } else { @@ -88,24 +88,24 @@ void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[11].v.cn[3] = vtxPtr[13].v.cn[3] = vtxPtr[15].v.cn[3] = vtxPtr[17].v.cn[3] = vtxPtr[19].v.cn[3] = vtxPtr[21].v.cn[3] = alpha; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe3.c", 343); + OPEN_DISPS(play->state.gfxCtx, "../z_oceff_wipe3.c", 343); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe3.c", 353), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_oceff_wipe3.c", 353), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 128); gSPDisplayList(POLY_XLU_DISP++, sMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 12, scroll * (-12), 64, 64, 1, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 12, scroll * (-12), 64, 64, 1, scroll * 8, scroll * (-8), 64, 64)); gSPDisplayList(POLY_XLU_DISP++, sFrustumDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe3.c", 370); + CLOSE_DISPS(play->state.gfxCtx, "../z_oceff_wipe3.c", 370); } diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index 27011c4474..dfac5a6cc0 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -9,10 +9,10 @@ #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) -void OceffWipe4_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe4_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffWipe4_Init(Actor* thisx, PlayState* play); +void OceffWipe4_Destroy(Actor* thisx, PlayState* play); +void OceffWipe4_Update(Actor* thisx, PlayState* play); +void OceffWipe4_Draw(Actor* thisx, PlayState* play); const ActorInit Oceff_Wipe4_InitVars = { ACTOR_OCEFF_WIPE4, @@ -26,25 +26,25 @@ const ActorInit Oceff_Wipe4_InitVars = { (ActorFunc)OceffWipe4_Draw, }; -void OceffWipe4_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe4_Init(Actor* thisx, PlayState* play) { OceffWipe4* this = (OceffWipe4*)thisx; Actor_SetScale(&this->actor, 0.1f); this->timer = 0; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; osSyncPrintf(VT_FGCOL(CYAN) " WIPE4 arg_data = %d\n" VT_RST, this->actor.params); } -void OceffWipe4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe4_Destroy(Actor* thisx, PlayState* play) { OceffWipe4* this = (OceffWipe4*)thisx; - func_800876C8(globalCtx); + func_800876C8(play); } -void OceffWipe4_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe4_Update(Actor* thisx, PlayState* play) { OceffWipe4* this = (OceffWipe4*)thisx; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; if (this->timer < 50) { this->timer++; } else { @@ -54,8 +54,8 @@ void OceffWipe4_Update(Actor* thisx, GlobalContext* globalCtx) { #include "overlays/ovl_Oceff_Wipe4/ovl_Oceff_Wipe4.c" -void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll = globalCtx->state.frames & 0xFFF; +void OceffWipe4_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFFF; OceffWipe4* this = (OceffWipe4*)thisx; f32 z; u8 alpha; @@ -64,8 +64,8 @@ void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = GET_ACTIVE_CAM(globalCtx)->eye; - Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); + eye = GET_ACTIVE_CAM(play)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play)); if (this->timer < 16) { z = Math_SinS(this->timer * 1024) * 1330.0f; } else { @@ -83,16 +83,16 @@ void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[11].v.cn[3] = vtxPtr[13].v.cn[3] = vtxPtr[15].v.cn[3] = vtxPtr[17].v.cn[3] = vtxPtr[19].v.cn[3] = vtxPtr[21].v.cn[3] = alpha; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe4.c", 314); + OPEN_DISPS(play->state.gfxCtx, "../z_oceff_wipe4.c", 314); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe4.c", 324), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_oceff_wipe4.c", 324), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params == OCEFF_WIPE4_UNUSED) { @@ -102,9 +102,9 @@ void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { } gSPDisplayList(POLY_XLU_DISP++, sMaterial2DL); - gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 64, 1, + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 64, 1, scroll * (-1), scroll, 32, 32)); gSPDisplayList(POLY_XLU_DISP++, &sMaterial2DL[11]); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe4.c", 344); + CLOSE_DISPS(play->state.gfxCtx, "../z_oceff_wipe4.c", 344); } diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 8c67cafec2..9b80174380 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -11,14 +11,14 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) -void ShotSun_Init(Actor* thisx, GlobalContext* globalCtx); -void ShotSun_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ShotSun_Update(Actor* thisx, GlobalContext* globalCtx); +void ShotSun_Init(Actor* thisx, PlayState* play); +void ShotSun_Destroy(Actor* thisx, PlayState* play); +void ShotSun_Update(Actor* thisx, PlayState* play); -void ShotSun_SpawnFairy(ShotSun* this, GlobalContext* globalCtx); -void ShotSun_TriggerFairy(ShotSun* this, GlobalContext* globalCtx); -void func_80BADF0C(ShotSun* this, GlobalContext* globalCtx); -void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx); +void ShotSun_SpawnFairy(ShotSun* this, PlayState* play); +void ShotSun_TriggerFairy(ShotSun* this, PlayState* play); +void func_80BADF0C(ShotSun* this, PlayState* play); +void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play); const ActorInit Shot_Sun_InitVars = { ACTOR_SHOT_SUN, @@ -52,7 +52,7 @@ static ColliderCylinderInit sCylinderInit = { { 30, 60, 0, { 0, 0, 0 } }, }; -void ShotSun_Init(Actor* thisx, GlobalContext* globalCtx) { +void ShotSun_Init(Actor* thisx, PlayState* play) { ShotSun* this = (ShotSun*)thisx; s32 params; @@ -66,23 +66,23 @@ void ShotSun_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80BADF0C; this->actor.flags |= ACTOR_FLAG_27; } else { - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actionFunc = ShotSun_UpdateHyliaSun; this->actor.flags &= ~ACTOR_FLAG_0; } } -void ShotSun_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ShotSun_Destroy(Actor* thisx, PlayState* play) { ShotSun* this = (ShotSun*)thisx; s32 params = this->actor.params & 0xFF; if (params != 0x40 && params != 0x41) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void ShotSun_SpawnFairy(ShotSun* this, GlobalContext* globalCtx) { +void ShotSun_SpawnFairy(ShotSun* this, PlayState* play) { s32 params = this->actor.params & 0xFF; s32 fairyType; @@ -99,27 +99,27 @@ void ShotSun_SpawnFairy(ShotSun* this, GlobalContext* globalCtx) { } //! @bug fairyType may be uninitialized - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.home.pos.x, this->actor.home.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, fairyType); Actor_Kill(&this->actor); } } -void ShotSun_TriggerFairy(ShotSun* this, GlobalContext* globalCtx) { +void ShotSun_TriggerFairy(ShotSun* this, PlayState* play) { if ((func_8005B198() == this->actor.category) || (this->timer != 0)) { this->actionFunc = ShotSun_SpawnFairy; this->timer = 50; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_KANKYO, this->actor.home.pos.x, this->actor.home.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, 0x11); func_80078914(&this->actor.projectedPos, NA_SE_EV_TRE_BOX_APPEAR); } } -void func_80BADF0C(ShotSun* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BADF0C(ShotSun* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s32 params = this->actor.params & 0xFF; @@ -135,13 +135,13 @@ void func_80BADF0C(ShotSun* this, GlobalContext* globalCtx) { } } if (this->unk_1A4 == 1) { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->unk_1A4 = 2; - } else if (this->unk_1A4 == 2 && globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - if ((params == 0x40 && globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) || - (params == 0x41 && globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS)) { + } else if (this->unk_1A4 == 2 && play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + if ((params == 0x40 && play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) || + (params == 0x41 && play->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS)) { this->actionFunc = ShotSun_TriggerFairy; - OnePointCutscene_Attention(globalCtx, &this->actor); + OnePointCutscene_Attention(play, &this->actor); this->timer = 0; } else { this->unk_1A4 = 0; @@ -151,9 +151,9 @@ void func_80BADF0C(ShotSun* this, GlobalContext* globalCtx) { } } -void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) { +void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play) { Vec3s cylinderPos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnItem00* collectible; s32 pad; Vec3f spawnPos; @@ -162,8 +162,8 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_CORRECT_CHIME); osSyncPrintf(VT_FGCOL(CYAN) "SHOT_SUN HIT!!!!!!!\n" VT_RST); if (INV_CONTENT(ITEM_ARROW_FIRE) == ITEM_NONE) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_ETCETERA, 700.0f, -800.0f, 7261.0f, 0, 0, 0, 7); - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gLakeHyliaFireArrowsCS); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, 700.0f, -800.0f, 7261.0f, 0, 0, 0, 7); + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gLakeHyliaFireArrowsCS); if (1) {} gSaveContext.cutsceneTrigger = 1; } else { @@ -171,7 +171,7 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) { spawnPos.y = -800.0f; spawnPos.z = 7261.0f; - collectible = Item_DropCollectible(globalCtx, &spawnPos, ITEM00_MAGIC_LARGE); + collectible = Item_DropCollectible(play, &spawnPos, ITEM00_MAGIC_LARGE); if (collectible != NULL) { collectible->unk_15A = 6000; collectible->actor.speedXZ = 0.0f; @@ -181,21 +181,21 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) { } else { if (!(this->actor.xzDistToPlayer > 120.0f) && gSaveContext.dayTime >= CLOCK_TIME(6, 30) && gSaveContext.dayTime < CLOCK_TIME(7, 30)) { - cylinderPos.x = player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + globalCtx->envCtx.sunPos.x * (1.0f / 6.0f); + cylinderPos.x = player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + play->envCtx.sunPos.x * (1.0f / 6.0f); cylinderPos.y = - player->bodyPartsPos[PLAYER_BODYPART_HEAD].y - 30.0f + globalCtx->envCtx.sunPos.y * (1.0f / 6.0f); - cylinderPos.z = player->bodyPartsPos[PLAYER_BODYPART_HEAD].z + globalCtx->envCtx.sunPos.z * (1.0f / 6.0f); + player->bodyPartsPos[PLAYER_BODYPART_HEAD].y - 30.0f + play->envCtx.sunPos.y * (1.0f / 6.0f); + cylinderPos.z = player->bodyPartsPos[PLAYER_BODYPART_HEAD].z + play->envCtx.sunPos.z * (1.0f / 6.0f); this->hitboxPos = cylinderPos; Collider_SetCylinderPosition(&this->collider, &cylinderPos); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -void ShotSun_Update(Actor* thisx, GlobalContext* globalCtx) { +void ShotSun_Update(Actor* thisx, PlayState* play) { ShotSun* this = (ShotSun*)thisx; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h index 19fd705f88..51b2d0e6f4 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h @@ -6,7 +6,7 @@ struct ShotSun; -typedef void (*ShotSunActionFunc)(struct ShotSun*, GlobalContext*); +typedef void (*ShotSunActionFunc)(struct ShotSun*, PlayState*); typedef struct ShotSun { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 2e8ce570f1..8f4ead6521 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -115,7 +115,7 @@ typedef struct { /* 0x00 */ s8 type; /* 0x04 */ union { void* ptr; - void (*func)(GlobalContext*, Player*, CsCmdActorAction*); + void (*func)(PlayState*, Player*, CsCmdActorAction*); }; } struct_80854B18; // size = 0x08 @@ -127,231 +127,231 @@ typedef struct { /* 0x08 */ s16 unk_08; } struct_80858AC8; // size = 0x0A -void func_80833770(GlobalContext* globalCtx, Player* this); -void func_80833790(GlobalContext* globalCtx, Player* this); -void func_8083379C(GlobalContext* globalCtx, Player* this); -void func_8083377C(GlobalContext* globalCtx, Player* this); -void func_808337D4(GlobalContext* globalCtx, Player* this); -void func_80833910(GlobalContext* globalCtx, Player* this); -void func_80833984(GlobalContext* globalCtx, Player* this); -void func_8083399C(GlobalContext* globalCtx, Player* this, s8 actionParam); -s32 func_8083485C(Player* this, GlobalContext* globalCtx); -s32 func_808349DC(Player* this, GlobalContext* globalCtx); -s32 func_80834A2C(Player* this, GlobalContext* globalCtx); -s32 func_80834B5C(Player* this, GlobalContext* globalCtx); -s32 func_80834C74(Player* this, GlobalContext* globalCtx); -s32 func_8083501C(Player* this, GlobalContext* globalCtx); -s32 func_808351D4(Player* this, GlobalContext* globalCtx); -s32 func_808353D8(Player* this, GlobalContext* globalCtx); -s32 func_80835588(Player* this, GlobalContext* globalCtx); -s32 func_808356E8(Player* this, GlobalContext* globalCtx); -s32 func_80835800(Player* this, GlobalContext* globalCtx); -s32 func_80835884(Player* this, GlobalContext* globalCtx); -s32 func_808358F0(Player* this, GlobalContext* globalCtx); -s32 func_808359FC(Player* this, GlobalContext* globalCtx); -s32 func_80835B60(Player* this, GlobalContext* globalCtx); -s32 func_80835C08(Player* this, GlobalContext* globalCtx); -void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item); -void func_80839F90(Player* this, GlobalContext* globalCtx); -s32 func_80838A14(Player* this, GlobalContext* globalCtx); -s32 func_80839800(Player* this, GlobalContext* globalCtx); -s32 func_8083B040(Player* this, GlobalContext* globalCtx); -s32 func_8083B998(Player* this, GlobalContext* globalCtx); -s32 func_8083B644(Player* this, GlobalContext* globalCtx); -s32 func_8083BDBC(Player* this, GlobalContext* globalCtx); -s32 func_8083C1DC(Player* this, GlobalContext* globalCtx); -s32 func_8083C2B0(Player* this, GlobalContext* globalCtx); -s32 func_8083C544(Player* this, GlobalContext* globalCtx); -s32 func_8083C61C(GlobalContext* globalCtx, Player* this); -void func_8083CA20(GlobalContext* globalCtx, Player* this); -void func_8083CA54(GlobalContext* globalCtx, Player* this); -void func_8083CA9C(GlobalContext* globalCtx, Player* this); -s32 func_8083E0FC(Player* this, GlobalContext* globalCtx); -s32 func_8083E5A8(Player* this, GlobalContext* globalCtx); -s32 func_8083EB44(Player* this, GlobalContext* globalCtx); -s32 func_8083F7BC(Player* this, GlobalContext* globalCtx); -void func_80840450(Player* this, GlobalContext* globalCtx); -void func_808407CC(Player* this, GlobalContext* globalCtx); -void func_80840BC8(Player* this, GlobalContext* globalCtx); -void func_80840DE4(Player* this, GlobalContext* globalCtx); -void func_808414F8(Player* this, GlobalContext* globalCtx); -void func_8084170C(Player* this, GlobalContext* globalCtx); -void func_808417FC(Player* this, GlobalContext* globalCtx); -void func_8084193C(Player* this, GlobalContext* globalCtx); -void func_80841BA8(Player* this, GlobalContext* globalCtx); -void func_80842180(Player* this, GlobalContext* globalCtx); -void func_8084227C(Player* this, GlobalContext* globalCtx); -void func_8084279C(Player* this, GlobalContext* globalCtx); -void func_808423EC(Player* this, GlobalContext* globalCtx); -void func_8084251C(Player* this, GlobalContext* globalCtx); -void func_80843188(Player* this, GlobalContext* globalCtx); -void func_808435C4(Player* this, GlobalContext* globalCtx); -void func_8084370C(Player* this, GlobalContext* globalCtx); -void func_8084377C(Player* this, GlobalContext* globalCtx); -void func_80843954(Player* this, GlobalContext* globalCtx); -void func_80843A38(Player* this, GlobalContext* globalCtx); -void func_80843CEC(Player* this, GlobalContext* globalCtx); -void func_8084411C(Player* this, GlobalContext* globalCtx); -void func_80844708(Player* this, GlobalContext* globalCtx); -void func_80844A44(Player* this, GlobalContext* globalCtx); -void func_80844AF4(Player* this, GlobalContext* globalCtx); -void func_80844E68(Player* this, GlobalContext* globalCtx); -void func_80845000(Player* this, GlobalContext* globalCtx); -void func_80845308(Player* this, GlobalContext* globalCtx); -void func_80845668(Player* this, GlobalContext* globalCtx); -void func_808458D0(Player* this, GlobalContext* globalCtx); -void func_80845CA4(Player* this, GlobalContext* globalCtx); -void func_80845EF8(Player* this, GlobalContext* globalCtx); -void func_80846050(Player* this, GlobalContext* globalCtx); -void func_80846120(Player* this, GlobalContext* globalCtx); -void func_80846260(Player* this, GlobalContext* globalCtx); -void func_80846358(Player* this, GlobalContext* globalCtx); -void func_80846408(Player* this, GlobalContext* globalCtx); -void func_808464B0(Player* this, GlobalContext* globalCtx); -void func_80846578(Player* this, GlobalContext* globalCtx); -void func_80846648(GlobalContext* globalCtx, Player* this); -void func_80846660(GlobalContext* globalCtx, Player* this); -void func_808467D4(GlobalContext* globalCtx, Player* this); -void func_808468A8(GlobalContext* globalCtx, Player* this); -void func_808468E8(GlobalContext* globalCtx, Player* this); -void func_80846978(GlobalContext* globalCtx, Player* this); -void func_808469BC(GlobalContext* globalCtx, Player* this); -void func_80846A68(GlobalContext* globalCtx, Player* this); -void func_8084B1D8(Player* this, GlobalContext* globalCtx); -void func_8084B530(Player* this, GlobalContext* globalCtx); -void func_8084B78C(Player* this, GlobalContext* globalCtx); -void func_8084B898(Player* this, GlobalContext* globalCtx); -void func_8084B9E4(Player* this, GlobalContext* globalCtx); -void func_8084BBE4(Player* this, GlobalContext* globalCtx); -void func_8084BDFC(Player* this, GlobalContext* globalCtx); -void func_8084BF1C(Player* this, GlobalContext* globalCtx); -void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input); -void func_8084C5F8(Player* this, GlobalContext* globalCtx); -void func_8084C760(Player* this, GlobalContext* globalCtx); -void func_8084C81C(Player* this, GlobalContext* globalCtx); -void func_8084CC98(Player* this, GlobalContext* globalCtx); -void func_8084D3E4(Player* this, GlobalContext* globalCtx); -void func_8084D610(Player* this, GlobalContext* globalCtx); -void func_8084D7C4(Player* this, GlobalContext* globalCtx); -void func_8084D84C(Player* this, GlobalContext* globalCtx); -void func_8084DAB4(Player* this, GlobalContext* globalCtx); -void func_8084DC48(Player* this, GlobalContext* globalCtx); -void func_8084E1EC(Player* this, GlobalContext* globalCtx); -void func_8084E30C(Player* this, GlobalContext* globalCtx); -void func_8084E368(Player* this, GlobalContext* globalCtx); -void func_8084E3C4(Player* this, GlobalContext* globalCtx); -void func_8084E604(Player* this, GlobalContext* globalCtx); -void func_8084E6D4(Player* this, GlobalContext* globalCtx); -void func_8084E9AC(Player* this, GlobalContext* globalCtx); -void func_8084EAC0(Player* this, GlobalContext* globalCtx); -void func_8084ECA4(Player* this, GlobalContext* globalCtx); -void func_8084EED8(Player* this, GlobalContext* globalCtx); -void func_8084EFC0(Player* this, GlobalContext* globalCtx); -void func_8084F104(Player* this, GlobalContext* globalCtx); -void func_8084F390(Player* this, GlobalContext* globalCtx); -void func_8084F608(Player* this, GlobalContext* globalCtx); -void func_8084F698(Player* this, GlobalContext* globalCtx); -void func_8084F710(Player* this, GlobalContext* globalCtx); -void func_8084F88C(Player* this, GlobalContext* globalCtx); -void func_8084F9A0(Player* this, GlobalContext* globalCtx); -void func_8084F9C0(Player* this, GlobalContext* globalCtx); -void func_8084FA54(Player* this, GlobalContext* globalCtx); -void func_8084FB10(Player* this, GlobalContext* globalCtx); -void func_8084FBF4(Player* this, GlobalContext* globalCtx); -s32 func_8084FCAC(Player* this, GlobalContext* globalCtx); +void func_80833770(PlayState* play, Player* this); +void func_80833790(PlayState* play, Player* this); +void func_8083379C(PlayState* play, Player* this); +void func_8083377C(PlayState* play, Player* this); +void func_808337D4(PlayState* play, Player* this); +void func_80833910(PlayState* play, Player* this); +void func_80833984(PlayState* play, Player* this); +void func_8083399C(PlayState* play, Player* this, s8 actionParam); +s32 func_8083485C(Player* this, PlayState* play); +s32 func_808349DC(Player* this, PlayState* play); +s32 func_80834A2C(Player* this, PlayState* play); +s32 func_80834B5C(Player* this, PlayState* play); +s32 func_80834C74(Player* this, PlayState* play); +s32 func_8083501C(Player* this, PlayState* play); +s32 func_808351D4(Player* this, PlayState* play); +s32 func_808353D8(Player* this, PlayState* play); +s32 func_80835588(Player* this, PlayState* play); +s32 func_808356E8(Player* this, PlayState* play); +s32 func_80835800(Player* this, PlayState* play); +s32 func_80835884(Player* this, PlayState* play); +s32 func_808358F0(Player* this, PlayState* play); +s32 func_808359FC(Player* this, PlayState* play); +s32 func_80835B60(Player* this, PlayState* play); +s32 func_80835C08(Player* this, PlayState* play); +void func_80835F44(PlayState* play, Player* this, s32 item); +void func_80839F90(Player* this, PlayState* play); +s32 func_80838A14(Player* this, PlayState* play); +s32 func_80839800(Player* this, PlayState* play); +s32 func_8083B040(Player* this, PlayState* play); +s32 func_8083B998(Player* this, PlayState* play); +s32 func_8083B644(Player* this, PlayState* play); +s32 func_8083BDBC(Player* this, PlayState* play); +s32 func_8083C1DC(Player* this, PlayState* play); +s32 func_8083C2B0(Player* this, PlayState* play); +s32 func_8083C544(Player* this, PlayState* play); +s32 func_8083C61C(PlayState* play, Player* this); +void func_8083CA20(PlayState* play, Player* this); +void func_8083CA54(PlayState* play, Player* this); +void func_8083CA9C(PlayState* play, Player* this); +s32 func_8083E0FC(Player* this, PlayState* play); +s32 func_8083E5A8(Player* this, PlayState* play); +s32 func_8083EB44(Player* this, PlayState* play); +s32 func_8083F7BC(Player* this, PlayState* play); +void func_80840450(Player* this, PlayState* play); +void func_808407CC(Player* this, PlayState* play); +void func_80840BC8(Player* this, PlayState* play); +void func_80840DE4(Player* this, PlayState* play); +void func_808414F8(Player* this, PlayState* play); +void func_8084170C(Player* this, PlayState* play); +void func_808417FC(Player* this, PlayState* play); +void func_8084193C(Player* this, PlayState* play); +void func_80841BA8(Player* this, PlayState* play); +void func_80842180(Player* this, PlayState* play); +void func_8084227C(Player* this, PlayState* play); +void func_8084279C(Player* this, PlayState* play); +void func_808423EC(Player* this, PlayState* play); +void func_8084251C(Player* this, PlayState* play); +void func_80843188(Player* this, PlayState* play); +void func_808435C4(Player* this, PlayState* play); +void func_8084370C(Player* this, PlayState* play); +void func_8084377C(Player* this, PlayState* play); +void func_80843954(Player* this, PlayState* play); +void func_80843A38(Player* this, PlayState* play); +void func_80843CEC(Player* this, PlayState* play); +void func_8084411C(Player* this, PlayState* play); +void func_80844708(Player* this, PlayState* play); +void func_80844A44(Player* this, PlayState* play); +void func_80844AF4(Player* this, PlayState* play); +void func_80844E68(Player* this, PlayState* play); +void func_80845000(Player* this, PlayState* play); +void func_80845308(Player* this, PlayState* play); +void func_80845668(Player* this, PlayState* play); +void func_808458D0(Player* this, PlayState* play); +void func_80845CA4(Player* this, PlayState* play); +void func_80845EF8(Player* this, PlayState* play); +void func_80846050(Player* this, PlayState* play); +void func_80846120(Player* this, PlayState* play); +void func_80846260(Player* this, PlayState* play); +void func_80846358(Player* this, PlayState* play); +void func_80846408(Player* this, PlayState* play); +void func_808464B0(Player* this, PlayState* play); +void func_80846578(Player* this, PlayState* play); +void func_80846648(PlayState* play, Player* this); +void func_80846660(PlayState* play, Player* this); +void func_808467D4(PlayState* play, Player* this); +void func_808468A8(PlayState* play, Player* this); +void func_808468E8(PlayState* play, Player* this); +void func_80846978(PlayState* play, Player* this); +void func_808469BC(PlayState* play, Player* this); +void func_80846A68(PlayState* play, Player* this); +void func_8084B1D8(Player* this, PlayState* play); +void func_8084B530(Player* this, PlayState* play); +void func_8084B78C(Player* this, PlayState* play); +void func_8084B898(Player* this, PlayState* play); +void func_8084B9E4(Player* this, PlayState* play); +void func_8084BBE4(Player* this, PlayState* play); +void func_8084BDFC(Player* this, PlayState* play); +void func_8084BF1C(Player* this, PlayState* play); +void Player_UpdateCommon(Player* this, PlayState* play, Input* input); +void func_8084C5F8(Player* this, PlayState* play); +void func_8084C760(Player* this, PlayState* play); +void func_8084C81C(Player* this, PlayState* play); +void func_8084CC98(Player* this, PlayState* play); +void func_8084D3E4(Player* this, PlayState* play); +void func_8084D610(Player* this, PlayState* play); +void func_8084D7C4(Player* this, PlayState* play); +void func_8084D84C(Player* this, PlayState* play); +void func_8084DAB4(Player* this, PlayState* play); +void func_8084DC48(Player* this, PlayState* play); +void func_8084E1EC(Player* this, PlayState* play); +void func_8084E30C(Player* this, PlayState* play); +void func_8084E368(Player* this, PlayState* play); +void func_8084E3C4(Player* this, PlayState* play); +void func_8084E604(Player* this, PlayState* play); +void func_8084E6D4(Player* this, PlayState* play); +void func_8084E9AC(Player* this, PlayState* play); +void func_8084EAC0(Player* this, PlayState* play); +void func_8084ECA4(Player* this, PlayState* play); +void func_8084EED8(Player* this, PlayState* play); +void func_8084EFC0(Player* this, PlayState* play); +void func_8084F104(Player* this, PlayState* play); +void func_8084F390(Player* this, PlayState* play); +void func_8084F608(Player* this, PlayState* play); +void func_8084F698(Player* this, PlayState* play); +void func_8084F710(Player* this, PlayState* play); +void func_8084F88C(Player* this, PlayState* play); +void func_8084F9A0(Player* this, PlayState* play); +void func_8084F9C0(Player* this, PlayState* play); +void func_8084FA54(Player* this, PlayState* play); +void func_8084FB10(Player* this, PlayState* play); +void func_8084FBF4(Player* this, PlayState* play); +s32 func_8084FCAC(Player* this, PlayState* play); void func_8084FF7C(Player* this); void func_8085002C(Player* this); -s32 func_80850224(Player* this, GlobalContext* globalCtx); -void func_808502D0(Player* this, GlobalContext* globalCtx); -void func_808505DC(Player* this, GlobalContext* globalCtx); -void func_8085063C(Player* this, GlobalContext* globalCtx); -void func_8085076C(Player* this, GlobalContext* globalCtx); -void func_808507F4(Player* this, GlobalContext* globalCtx); -void func_80850AEC(Player* this, GlobalContext* globalCtx); -void func_80850C68(Player* this, GlobalContext* globalCtx); -void func_80850E84(Player* this, GlobalContext* globalCtx); -void func_80851008(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851030(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851050(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851094(GlobalContext* globalCtx, Player* this, void* anim); -void func_808510B4(GlobalContext* globalCtx, Player* this, void* anim); -void func_808510D4(GlobalContext* globalCtx, Player* this, void* anim); -void func_808510F4(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851114(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851134(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851154(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851174(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851194(GlobalContext* globalCtx, Player* this, void* anim); -void func_808511B4(GlobalContext* globalCtx, Player* this, void* anim); -void func_808511D4(GlobalContext* globalCtx, Player* this, void* anim); -void func_808511FC(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851248(GlobalContext* globalCtx, Player* this, void* anim); -void func_80851294(GlobalContext* globalCtx, Player* this, void* anim); -void func_808512E0(GlobalContext* globalCtx, Player* this, void* arg2); -void func_80851368(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808513BC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808514C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_8085157C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808515A4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851688(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851750(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851788(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851828(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808518DC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_8085190C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851998(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808519C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808519EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851A50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851B90(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851BE8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851CA4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851D2C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851D80(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851DEC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851E28(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851E64(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851E90(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851ECC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851F84(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80851FB0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852048(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852080(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852174(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808521B8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808521F4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852234(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_8085225C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852280(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852358(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852388(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852298(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852328(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852480(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852450(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808524B0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808524D0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852514(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852544(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852554(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852564(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808525C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852608(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852648(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808526EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_8085283C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808528C8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852944(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_808529D0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852C50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2); -void func_80852E14(Player* this, GlobalContext* globalCtx); -s32 Player_IsDroppingFish(GlobalContext* globalCtx); -s32 Player_StartFishing(GlobalContext* globalCtx); -s32 func_80852F38(GlobalContext* globalCtx, Player* this); -s32 func_80852FFC(GlobalContext* globalCtx, Actor* actor, s32 csMode); -void func_80853080(Player* this, GlobalContext* globalCtx); -s32 Player_InflictDamage(GlobalContext* globalCtx, s32 damage); -void func_80853148(GlobalContext* globalCtx, Actor* actor); +s32 func_80850224(Player* this, PlayState* play); +void func_808502D0(Player* this, PlayState* play); +void func_808505DC(Player* this, PlayState* play); +void func_8085063C(Player* this, PlayState* play); +void func_8085076C(Player* this, PlayState* play); +void func_808507F4(Player* this, PlayState* play); +void func_80850AEC(Player* this, PlayState* play); +void func_80850C68(Player* this, PlayState* play); +void func_80850E84(Player* this, PlayState* play); +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); +void func_80851094(PlayState* play, Player* this, void* anim); +void func_808510B4(PlayState* play, Player* this, void* anim); +void func_808510D4(PlayState* play, Player* this, void* anim); +void func_808510F4(PlayState* play, Player* this, void* anim); +void func_80851114(PlayState* play, Player* this, void* anim); +void func_80851134(PlayState* play, Player* this, void* anim); +void func_80851154(PlayState* play, Player* this, void* anim); +void func_80851174(PlayState* play, Player* this, void* anim); +void func_80851194(PlayState* play, Player* this, void* anim); +void func_808511B4(PlayState* play, Player* this, void* anim); +void func_808511D4(PlayState* play, Player* this, void* anim); +void func_808511FC(PlayState* play, Player* this, void* anim); +void func_80851248(PlayState* play, Player* this, void* anim); +void func_80851294(PlayState* play, Player* this, void* anim); +void func_808512E0(PlayState* play, Player* this, void* arg2); +void func_80851368(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808513BC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808514C0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_8085157C(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808515A4(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851688(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851750(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851788(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851828(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808518DC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_8085190C(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851998(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808519C0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808519EC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851A50(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851B90(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851BE8(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851CA4(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851D2C(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851D80(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851DEC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851E28(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851E64(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851E90(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851ECC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851F84(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851FB0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852048(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852080(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852174(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808521B8(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808521F4(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852234(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_8085225C(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852280(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852358(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852388(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852298(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852328(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852480(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852450(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808524B0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808524D0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852514(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852544(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852554(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852564(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808525C0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852608(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852648(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808526EC(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_8085283C(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808528C8(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852944(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_808529D0(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80852E14(Player* this, PlayState* play); +s32 Player_IsDroppingFish(PlayState* play); +s32 Player_StartFishing(PlayState* play); +s32 func_80852F38(PlayState* play, Player* this); +s32 func_80852FFC(PlayState* play, Actor* actor, s32 csMode); +void func_80853080(Player* this, PlayState* play); +s32 Player_InflictDamage(PlayState* play, s32 damage); +void func_80853148(PlayState* play, Actor* actor); // .bss part 1 static s32 D_80858AA0; @@ -1082,7 +1082,7 @@ static s8 sItemActionParams[] = { PLAYER_AP_SWORD_BGS, }; -static s32 (*D_80853EDC[])(Player* this, GlobalContext* globalCtx) = { +static s32 (*D_80853EDC[])(Player* this, PlayState* play) = { func_8083485C, func_8083485C, func_8083485C, func_808349DC, func_808349DC, func_808349DC, func_8083485C, func_8083485C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_808356E8, func_808356E8, func_80835800, @@ -1095,7 +1095,7 @@ static s32 (*D_80853EDC[])(Player* this, GlobalContext* globalCtx) = { func_8083485C, func_8083485C, func_8083485C, func_8083485C, }; -static void (*D_80853FE8[])(GlobalContext* globalCtx, Player* this) = { +static void (*D_80853FE8[])(PlayState* play, Player* this) = { func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_8083377C, func_80833790, func_8083379C, func_8083379C, func_8083379C, func_8083379C, func_8083379C, func_8083379C, func_8083379C, func_8083379C, func_80833910, func_80833910, func_808337D4, func_808337D4, func_80833984, @@ -1310,26 +1310,26 @@ s32 func_80832224(Player* this) { this->unk_6AD = 0; } -s32 func_8083224C(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 func_8083224C(PlayState* play) { + Player* this = GET_PLAYER(play); return CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_8); } -void func_80832264(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime, anim); +void func_80832264(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_PlayOnce(play, &this->skelAnime, anim); } -void func_80832284(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime, anim); +void func_80832284(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_PlayLoop(play, &this->skelAnime, anim); } -void func_808322A4(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_PlayLoopSetSpeed(globalCtx, &this->skelAnime, anim, 2.0f / 3.0f); +void func_808322A4(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, anim, 2.0f / 3.0f); } -void func_808322D0(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, 2.0f / 3.0f); +void func_808322D0(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 2.0f / 3.0f); } void func_808322FC(Player* this) { @@ -1343,13 +1343,13 @@ void func_80832318(Player* this) { this->meleeWeaponInfo[0].active = this->meleeWeaponInfo[1].active = this->meleeWeaponInfo[2].active = 0; } -void func_80832340(GlobalContext* globalCtx, Player* this) { +void func_80832340(PlayState* play, Player* this) { Camera* subCam; if (this->subCamId != CAM_ID_NONE) { - subCam = globalCtx->cameraPtrs[this->subCamId]; + subCam = play->cameraPtrs[this->subCamId]; if ((subCam != NULL) && (subCam->csId == 1100)) { - OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + OnePointCutscene_EndCutscene(play, this->subCamId); this->subCamId = CAM_ID_NONE; } } @@ -1357,7 +1357,7 @@ void func_80832340(GlobalContext* globalCtx, Player* this) { this->stateFlags2 &= ~(PLAYER_STATE2_10 | PLAYER_STATE2_11); } -void func_808323B4(GlobalContext* globalCtx, Player* this) { +void func_808323B4(PlayState* play, Player* this) { Actor* heldActor = this->heldActor; if ((heldActor != NULL) && !Player_HoldsHookshot(this)) { @@ -1369,12 +1369,12 @@ void func_808323B4(GlobalContext* globalCtx, Player* this) { } if (Player_GetExplosiveHeld(this) >= 0) { - func_8083399C(globalCtx, this, PLAYER_AP_NONE); + func_8083399C(play, this, PLAYER_AP_NONE); this->heldItemId = ITEM_NONE_FE; } } -void func_80832440(GlobalContext* globalCtx, Player* this) { +void func_80832440(PlayState* play, Player* this) { if ((this->stateFlags1 & PLAYER_STATE1_11) && (this->heldActor == NULL)) { if (this->interactRangeActor != NULL) { if (this->getItemId == GI_NONE) { @@ -1389,8 +1389,8 @@ void func_80832440(GlobalContext* globalCtx, Player* this) { func_80832318(this); this->unk_6AD = 0; - func_80832340(globalCtx, this); - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + func_80832340(play, this); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); this->stateFlags1 &= ~(PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_20 | PLAYER_STATE1_21); this->stateFlags2 &= ~(PLAYER_STATE2_4 | PLAYER_STATE2_7 | PLAYER_STATE2_18); @@ -1401,18 +1401,18 @@ void func_80832440(GlobalContext* globalCtx, Player* this) { this->unk_845 = this->unk_844 = 0; } -s32 func_80832528(GlobalContext* globalCtx, Player* this) { +s32 func_80832528(PlayState* play, Player* this) { if (this->heldItemActionParam >= PLAYER_AP_FISHING_POLE) { - func_80835F44(globalCtx, this, ITEM_NONE); + func_80835F44(play, this, ITEM_NONE); return 1; } else { return 0; } } -void func_80832564(GlobalContext* globalCtx, Player* this) { - func_80832440(globalCtx, this); - func_808323B4(globalCtx, this); +void func_80832564(PlayState* play, Player* this) { + func_80832440(play, this); + func_808323B4(play, this); } s32 func_80832594(Player* this, s32 arg1, s32 arg2) { @@ -1427,9 +1427,9 @@ s32 func_80832594(Player* this, s32 arg1, s32 arg2) { return this->unk_850 > arg2; } -void func_80832630(GlobalContext* globalCtx) { - if (globalCtx->actorCtx.freezeFlashTimer == 0) { - globalCtx->actorCtx.freezeFlashTimer = 1; +void func_80832630(PlayState* play) { + if (play->actorCtx.freezeFlashTimer == 0) { + play->actorCtx.freezeFlashTimer = 1; } } @@ -1549,31 +1549,30 @@ void func_80832924(Player* this, struct_80832924* entry) { } while (cont); } -void func_80832B0C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, +void func_80832B0C(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -6.0f); +} + +void func_80832B78(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_Change(play, &this->skelAnime, anim, 2.0f / 3.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -6.0f); } -void func_80832B78(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 2.0f / 3.0f, 0.0f, Animation_GetLastFrame(anim), - ANIMMODE_ONCE, -6.0f); +void func_80832BE8(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f); } -void func_80832BE8(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f); +void func_80832C2C(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); } -void func_80832C2C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); +void func_80832C6C(PlayState* play, Player* this, LinkAnimationHeader* anim) { + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -16.0f); } -void func_80832C6C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -16.0f); -} - -s32 func_80832CB0(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, anim); +s32 func_80832CB0(PlayState* play, Player* this, LinkAnimationHeader* anim) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, anim); return 1; } else { return 0; @@ -1639,7 +1638,7 @@ void func_80832E48(Player* this, s32 flags) { func_808322FC(this); } -void func_80832F54(GlobalContext* globalCtx, Player* this, s32 flags) { +void func_80832F54(PlayState* play, Player* this, s32 flags) { if (flags & 0x200) { func_80832D20(this); } else if ((flags & 0x100) || (this->skelAnime.moveFlags != 0)) { @@ -1651,44 +1650,44 @@ void func_80832F54(GlobalContext* globalCtx, Player* this, s32 flags) { this->skelAnime.moveFlags = flags; func_80832210(this); - AnimationContext_DisableQueue(globalCtx); + AnimationContext_DisableQueue(play); } -void func_80832FFC(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, playbackSpeed); - func_80832F54(globalCtx, this, flags); +void func_80832FFC(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, playbackSpeed); + func_80832F54(play, this, flags); } -void func_8083303C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_80832FFC(globalCtx, this, anim, flags, 1.0f); +void func_8083303C(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + func_80832FFC(play, this, anim, flags, 1.0f); } -void func_80833064(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_80832FFC(globalCtx, this, anim, flags, 2.0f / 3.0f); +void func_80833064(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + func_80832FFC(play, this, anim, flags, 2.0f / 3.0f); } -void func_8083308C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - func_80833064(globalCtx, this, anim, 0x1C); +void func_8083308C(PlayState* play, Player* this, LinkAnimationHeader* anim) { + func_80833064(play, this, anim, 0x1C); } -void func_808330AC(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { - LinkAnimation_PlayLoopSetSpeed(globalCtx, &this->skelAnime, anim, playbackSpeed); - func_80832F54(globalCtx, this, flags); +void func_808330AC(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { + LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, anim, playbackSpeed); + func_80832F54(play, this, flags); } -void func_808330EC(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_808330AC(globalCtx, this, anim, flags, 1.0f); +void func_808330EC(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + func_808330AC(play, this, anim, flags, 1.0f); } -void func_80833114(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, s32 flags) { - func_808330AC(globalCtx, this, anim, flags, 2.0f / 3.0f); +void func_80833114(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { + func_808330AC(play, this, anim, flags, 2.0f / 3.0f); } -void func_8083313C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { - func_80833114(globalCtx, this, anim, 0x1C); +void func_8083313C(PlayState* play, Player* this, LinkAnimationHeader* anim) { + func_80833114(play, this, anim, 0x1C); } -void func_8083315C(GlobalContext* globalCtx, Player* this) { +void func_8083315C(PlayState* play, Player* this) { s8 phi_v1; s8 phi_v0; @@ -1697,7 +1696,7 @@ void func_8083315C(GlobalContext* globalCtx, Player* this) { func_80077D10(&D_808535D4, &D_808535D8, sControlInput); - D_808535DC = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)) + D_808535D8; + D_808535DC = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)) + D_808535D8; this->unk_846 = (this->unk_846 + 1) % 4; @@ -1713,8 +1712,8 @@ void func_8083315C(GlobalContext* globalCtx, Player* this) { this->unk_84B[this->unk_846] = phi_v0; } -void func_8083328C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* linkAnim) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, linkAnim, D_808535E8); +void func_8083328C(PlayState* play, Player* this, LinkAnimationHeader* linkAnim) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, linkAnim, D_808535E8); } s32 func_808332B8(Player* this) { @@ -1725,7 +1724,7 @@ s32 func_808332E4(Player* this) { return (this->stateFlags1 & PLAYER_STATE1_24); } -void func_808332F4(Player* this, GlobalContext* globalCtx) { +void func_808332F4(Player* this, PlayState* play) { GetItemEntry* giEntry = &sGetItemTable[this->getItemId - 1]; this->unk_862 = ABS(giEntry->gi); @@ -1819,7 +1818,7 @@ void func_80833638(Player* this, PlayerFunc82C arg1) { func_808326F0(this); } -void func_80833664(GlobalContext* globalCtx, Player* this, s8 actionParam) { +void func_80833664(PlayState* play, Player* this, s8 actionParam) { LinkAnimationHeader* current = this->skelAnime.animation; LinkAnimationHeader** iter = D_80853914 + this->modelAnimType; u32 i; @@ -1833,7 +1832,7 @@ void func_80833664(GlobalContext* globalCtx, Player* this, s8 actionParam) { iter += PLAYER_ANIMTYPE_MAX; } - func_8083399C(globalCtx, this, actionParam); + func_8083399C(play, this, actionParam); if (i < PLAYER_ANIMGROUP_MAX) { this->skelAnime.animation = GET_PLAYER_ANIM(i, this->modelAnimType); @@ -1852,17 +1851,17 @@ s8 Player_ItemToActionParam(s32 item) { } } -void func_80833770(GlobalContext* globalCtx, Player* this) { +void func_80833770(PlayState* play, Player* this) { } -void func_8083377C(GlobalContext* globalCtx, Player* this) { +void func_8083377C(PlayState* play, Player* this) { this->unk_85C = 1.0f; } -void func_80833790(GlobalContext* globalCtx, Player* this) { +void func_80833790(PlayState* play, Player* this) { } -void func_8083379C(GlobalContext* globalCtx, Player* this) { +void func_8083379C(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_3; if (this->heldItemActionParam != PLAYER_AP_SLINGSHOT) { @@ -1872,27 +1871,27 @@ void func_8083379C(GlobalContext* globalCtx, Player* this) { } } -void func_808337D4(GlobalContext* globalCtx, Player* this) { +void func_808337D4(PlayState* play, Player* this) { s32 explosiveType; ExplosiveInfo* explosiveInfo; Actor* spawnedActor; if (this->stateFlags1 & PLAYER_STATE1_11) { - func_80832528(globalCtx, this); + func_80832528(play, this); return; } explosiveType = Player_GetExplosiveHeld(this); explosiveInfo = &sExplosiveInfos[explosiveType]; - spawnedActor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, explosiveInfo->actorId, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, - this->actor.shape.rot.y, 0, 0); + spawnedActor = + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, explosiveInfo->actorId, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 0); if (spawnedActor != NULL) { - if ((explosiveType != 0) && (globalCtx->bombchuBowlingStatus != 0)) { - globalCtx->bombchuBowlingStatus--; - if (globalCtx->bombchuBowlingStatus == 0) { - globalCtx->bombchuBowlingStatus = -1; + if ((explosiveType != 0) && (play->bombchuBowlingStatus != 0)) { + play->bombchuBowlingStatus--; + if (play->bombchuBowlingStatus == 0) { + play->bombchuBowlingStatus = -1; } } else { Inventory_ChangeAmmo(explosiveInfo->itemId, -1); @@ -1906,20 +1905,20 @@ void func_808337D4(GlobalContext* globalCtx, Player* this) { } } -void func_80833910(GlobalContext* globalCtx, Player* this) { +void func_80833910(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_3; this->unk_860 = -3; this->heldActor = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_ARMS_HOOK, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_ARMS_HOOK, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 0); } -void func_80833984(GlobalContext* globalCtx, Player* this) { +void func_80833984(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_24; } -void func_8083399C(GlobalContext* globalCtx, Player* this, s8 actionParam) { +void func_8083399C(PlayState* play, Player* this, s8 actionParam) { this->unk_860 = 0; this->unk_85C = 0.0f; this->unk_858 = 0.0f; @@ -1929,7 +1928,7 @@ void func_8083399C(GlobalContext* globalCtx, Player* this, s8 actionParam) { this->stateFlags1 &= ~(PLAYER_STATE1_3 | PLAYER_STATE1_24); - D_80853FE8[actionParam](globalCtx, this); + D_80853FE8[actionParam](play, this); Player_SetModelGroup(this, this->modelGroup); } @@ -2021,11 +2020,11 @@ s32 func_80833C98(s32 item1, s32 actionParam) { } } -s32 func_80833CDC(GlobalContext* globalCtx, s32 index) { +s32 func_80833CDC(PlayState* play, s32 index) { if (index >= 4) { return ITEM_NONE; - } else if (globalCtx->bombchuBowlingStatus != 0) { - return (globalCtx->bombchuBowlingStatus > 0) ? ITEM_BOMBCHU : ITEM_NONE; + } else if (play->bombchuBowlingStatus != 0) { + return (play->bombchuBowlingStatus > 0) ? ITEM_BOMBCHU : ITEM_NONE; } else if (index == 0) { return B_BTN_ITEM; } else if (index == 1) { @@ -2037,7 +2036,7 @@ s32 func_80833CDC(GlobalContext* globalCtx, s32 index) { } } -void func_80833DF8(Player* this, GlobalContext* globalCtx) { +void func_80833DF8(Player* this, PlayState* play) { s32 maskActionParam; s32 item; s32 i; @@ -2054,7 +2053,7 @@ void func_80833DF8(Player* this, GlobalContext* globalCtx) { if (this->itemActionParam >= PLAYER_AP_FISHING_POLE) { if (!func_80833C50(this, B_BTN_ITEM) && !func_80833C50(this, C_BTN_ITEM(0)) && !func_80833C50(this, C_BTN_ITEM(1)) && !func_80833C50(this, C_BTN_ITEM(2))) { - func_80835F44(globalCtx, this, ITEM_NONE); + func_80835F44(play, this, ITEM_NONE); return; } } @@ -2065,7 +2064,7 @@ void func_80833DF8(Player* this, GlobalContext* globalCtx) { } } - item = func_80833CDC(globalCtx, i); + item = func_80833CDC(play, i); if (item >= ITEM_NONE_FE) { for (i = 0; i < ARRAY_COUNT(D_80854388); i++) { if (CHECK_BTN_ALL(sControlInput->cur.button, D_80854388[i])) { @@ -2073,18 +2072,18 @@ void func_80833DF8(Player* this, GlobalContext* globalCtx) { } } - item = func_80833CDC(globalCtx, i); + item = func_80833CDC(play, i); if ((item < ITEM_NONE_FE) && (Player_ItemToActionParam(item) == this->heldItemActionParam)) { D_80853618 = true; } } else { this->heldItemButton = i; - func_80835F44(globalCtx, this, item); + func_80835F44(play, this, item); } } } -void func_808340DC(Player* this, GlobalContext* globalCtx) { +void func_808340DC(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 phi_f2; f32 phi_f12; @@ -2128,26 +2127,26 @@ void func_808340DC(Player* this, GlobalContext* globalCtx) { phi_f0 *= 2.0f; } - LinkAnimation_Change(globalCtx, &this->skelAnime2, anim, phi_f0, phi_f12, phi_f14, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime2, anim, phi_f0, phi_f12, phi_f14, ANIMMODE_ONCE, 0.0f); this->stateFlags1 &= ~PLAYER_STATE1_8; } -void func_80834298(Player* this, GlobalContext* globalCtx) { +void func_80834298(Player* this, PlayState* play) { if ((this->actor.category == ACTORCAT_PLAYER) && !(this->stateFlags1 & PLAYER_STATE1_8) && ((this->heldItemActionParam == this->itemActionParam) || (this->stateFlags1 & PLAYER_STATE1_22)) && - (gSaveContext.health != 0) && (globalCtx->csCtx.state == CS_STATE_IDLE) && (this->csMode == 0) && - (globalCtx->shootingGalleryStatus == 0) && (globalCtx->activeCamId == CAM_ID_MAIN) && - (globalCtx->transitionTrigger != TRANS_TRIGGER_START) && (gSaveContext.timer1State != 10)) { - func_80833DF8(this, globalCtx); + (gSaveContext.health != 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->csMode == 0) && + (play->shootingGalleryStatus == 0) && (play->activeCamId == CAM_ID_MAIN) && + (play->transitionTrigger != TRANS_TRIGGER_START) && (gSaveContext.timer1State != 10)) { + func_80833DF8(this, play); } if (this->stateFlags1 & PLAYER_STATE1_8) { - func_808340DC(this, globalCtx); + func_808340DC(this, play); } } -s32 func_80834380(GlobalContext* globalCtx, Player* this, s32* itemPtr, s32* typePtr) { +s32 func_80834380(PlayState* play, Player* this, s32* itemPtr, s32* typePtr) { if (LINK_IS_ADULT) { *itemPtr = ITEM_BOW; if (this->stateFlags1 & PLAYER_STATE1_23) { @@ -2161,15 +2160,15 @@ s32 func_80834380(GlobalContext* globalCtx, Player* this, s32* itemPtr, s32* typ } if (gSaveContext.minigameState == 1) { - return globalCtx->interfaceCtx.hbaAmmo; - } else if (globalCtx->shootingGalleryStatus != 0) { - return globalCtx->shootingGalleryStatus; + return play->interfaceCtx.hbaAmmo; + } else if (play->shootingGalleryStatus != 0) { + return play->shootingGalleryStatus; } else { return AMMO(*itemPtr); } } -s32 func_8083442C(Player* this, GlobalContext* globalCtx) { +s32 func_8083442C(Player* this, PlayState* play) { s32 item; s32 arrowType; s32 magicArrowType; @@ -2186,17 +2185,17 @@ s32 func_8083442C(Player* this, GlobalContext* globalCtx) { if (this->unk_860 >= 0) { func_8002F7DC(&this->actor, D_80854398[ABS(this->unk_860) - 1]); - if (!Player_HoldsHookshot(this) && (func_80834380(globalCtx, this, &item, &arrowType) > 0)) { + if (!Player_HoldsHookshot(this) && (func_80834380(play, this, &item, &arrowType) > 0)) { magicArrowType = arrowType - ARROW_FIRE; if (this->unk_860 >= 0) { if ((magicArrowType >= 0) && (magicArrowType <= 2) && - !func_80087708(globalCtx, sMagicArrowCosts[magicArrowType], 0)) { + !func_80087708(play, sMagicArrowCosts[magicArrowType], 0)) { arrowType = ARROW_NORMAL; } this->heldActor = Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ARROW, this->actor.world.pos.x, + &play->actorCtx, &this->actor, play, ACTOR_EN_ARROW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, arrowType); } } @@ -2208,7 +2207,7 @@ s32 func_8083442C(Player* this, GlobalContext* globalCtx) { return 0; } -void func_80834594(GlobalContext* globalCtx, Player* this) { +void func_80834594(PlayState* play, Player* this) { if (this->heldItemActionParam != PLAYER_AP_NONE) { if (func_8008F2BC(this, this->heldItemActionParam) >= 0) { func_808328EC(this, NA_SE_IT_SWORD_PUTAWAY); @@ -2217,7 +2216,7 @@ void func_80834594(GlobalContext* globalCtx, Player* this) { } } - func_80835F44(globalCtx, this, this->heldItemId); + func_80835F44(play, this, this->heldItemId); if (func_8008F2BC(this, this->heldItemActionParam) >= 0) { func_808328EC(this, NA_SE_IT_SWORD_PICKOUT); @@ -2226,21 +2225,21 @@ void func_80834594(GlobalContext* globalCtx, Player* this) { } } -void func_80834644(GlobalContext* globalCtx, Player* this) { +void func_80834644(PlayState* play, Player* this) { if (func_80834A2C == this->func_82C) { - func_80834594(globalCtx, this); + func_80834594(play, this); } func_80833638(this, D_80853EDC[this->heldItemActionParam]); this->unk_834 = 0; this->unk_6AC = 0; - func_808323B4(globalCtx, this); + func_808323B4(play, this); this->stateFlags1 &= ~PLAYER_STATE1_8; } -LinkAnimationHeader* func_808346C4(GlobalContext* globalCtx, Player* this) { +LinkAnimationHeader* func_808346C4(PlayState* play, Player* this) { func_80833638(this, func_80834B5C); - func_808323B4(globalCtx, this); + func_808323B4(play, this); if (this->unk_870 < 0.5f) { return D_808543A4[Player_HoldsTwoHandedWeapon(this)]; @@ -2249,18 +2248,18 @@ LinkAnimationHeader* func_808346C4(GlobalContext* globalCtx, Player* this) { } } -s32 func_80834758(GlobalContext* globalCtx, Player* this) { +s32 func_80834758(PlayState* play, Player* this) { LinkAnimationHeader* anim; f32 frame; if (!(this->stateFlags1 & (PLAYER_STATE1_22 | PLAYER_STATE1_23 | PLAYER_STATE1_29)) && - (globalCtx->shootingGalleryStatus == 0) && (this->heldItemActionParam == this->itemActionParam) && + (play->shootingGalleryStatus == 0) && (this->heldItemActionParam == this->itemActionParam) && (this->currentShield != PLAYER_SHIELD_NONE) && !Player_IsChildWithHylianShield(this) && func_80833BCC(this) && CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { - anim = func_808346C4(globalCtx, this); + anim = func_808346C4(play, this); frame = Animation_GetLastFrame(anim); - LinkAnimation_Change(globalCtx, &this->skelAnime2, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime2, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); func_8002F7DC(&this->actor, NA_SE_IT_SHIELD_POSTURE); return 1; @@ -2269,8 +2268,8 @@ s32 func_80834758(GlobalContext* globalCtx, Player* this) { } } -s32 func_8083485C(Player* this, GlobalContext* globalCtx) { - if (func_80834758(globalCtx, this)) { +s32 func_8083485C(Player* this, PlayState* play) { + if (func_80834758(play, this)) { return 1; } else { return 0; @@ -2288,7 +2287,7 @@ void func_80834894(Player* this) { func_8002F7DC(&this->actor, NA_SE_IT_SHIELD_REMOVE); } -void func_808348EC(GlobalContext* globalCtx, Player* this) { +void func_808348EC(PlayState* play, Player* this) { struct_808540F4* ptr = &D_808540F4[this->unk_15A]; f32 temp; @@ -2296,15 +2295,15 @@ void func_808348EC(GlobalContext* globalCtx, Player* this) { temp = (this->skelAnime2.playSpeed < 0.0f) ? temp - 1.0f : temp; if (LinkAnimation_OnFrame(&this->skelAnime2, temp)) { - func_80834594(globalCtx, this); + func_80834594(play, this); } func_80833B54(this); } -s32 func_8083499C(Player* this, GlobalContext* globalCtx) { +s32 func_8083499C(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_8) { - func_808340DC(this, globalCtx); + func_808340DC(this, play); } else { return 0; } @@ -2312,39 +2311,39 @@ s32 func_8083499C(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_808349DC(Player* this, GlobalContext* globalCtx) { - if (func_80834758(globalCtx, this) || func_8083499C(this, globalCtx)) { +s32 func_808349DC(Player* this, PlayState* play) { + if (func_80834758(play, this) || func_8083499C(this, play)) { return 1; } else { return 0; } } -s32 func_80834A2C(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime2) || +s32 func_80834A2C(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime2) || ((Player_ItemToActionParam(this->heldItemId) == this->heldItemActionParam) && - (D_80853614 = (D_80853614 || - ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (globalCtx->shootingGalleryStatus == 0)))))) { + (D_80853614 = + (D_80853614 || ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)))))) { func_80833638(this, D_80853EDC[this->heldItemActionParam]); this->unk_834 = 0; this->unk_6AC = 0; D_80853618 = D_80853614; - return this->func_82C(this, globalCtx); + return this->func_82C(this, play); } if (func_80833350(this) != 0) { - func_808348EC(globalCtx, this); - func_80832264(globalCtx, this, func_80833338(this)); + func_808348EC(play, this); + func_80832264(play, this, func_80833338(this)); this->unk_6AC = 0; } else { - func_808348EC(globalCtx, this); + func_808348EC(play, this); } return 1; } -s32 func_80834B5C(Player* this, GlobalContext* globalCtx) { - LinkAnimation_Update(globalCtx, &this->skelAnime2); +s32 func_80834B5C(Player* this, PlayState* play) { + LinkAnimation_Update(play, &this->skelAnime2); if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { func_80834894(this); @@ -2356,14 +2355,14 @@ s32 func_80834B5C(Player* this, GlobalContext* globalCtx) { } } -s32 func_80834BD4(Player* this, GlobalContext* globalCtx) { +s32 func_80834BD4(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 frame; - if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { - anim = func_808346C4(globalCtx, this); + if (LinkAnimation_Update(play, &this->skelAnime2)) { + anim = func_808346C4(play, this); frame = Animation_GetLastFrame(anim); - LinkAnimation_Change(globalCtx, &this->skelAnime2, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime2, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); } this->stateFlags1 |= PLAYER_STATE1_22; @@ -2372,25 +2371,25 @@ s32 func_80834BD4(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_80834C74(Player* this, GlobalContext* globalCtx) { +s32 func_80834C74(Player* this, PlayState* play) { D_80853614 = D_80853618; - if (D_80853614 || LinkAnimation_Update(globalCtx, &this->skelAnime2)) { + if (D_80853614 || LinkAnimation_Update(play, &this->skelAnime2)) { func_80833638(this, D_80853EDC[this->heldItemActionParam]); - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_0, this->modelAnimType)); + LinkAnimation_PlayLoop(play, &this->skelAnime2, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_0, this->modelAnimType)); this->unk_6AC = 0; - this->func_82C(this, globalCtx); + this->func_82C(this, play); return 0; } return 1; } -s32 func_80834D2C(Player* this, GlobalContext* globalCtx) { +s32 func_80834D2C(Player* this, PlayState* play) { LinkAnimationHeader* anim; if (this->heldItemActionParam != PLAYER_AP_BOOMERANG) { - if (!func_8083442C(this, globalCtx)) { + if (!func_8083442C(this, play)) { return 0; } @@ -2399,36 +2398,35 @@ s32 func_80834D2C(Player* this, GlobalContext* globalCtx) { } else { anim = &gPlayerAnim_002CA0; } - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, anim); + LinkAnimation_PlayOnce(play, &this->skelAnime2, anim); } else { func_80833638(this, func_80835884); this->unk_834 = 10; - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, &gPlayerAnim_002628); + LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_002628); } if (this->stateFlags1 & PLAYER_STATE1_23) { - func_80832284(globalCtx, this, &gPlayerAnim_003380); + func_80832284(play, this, &gPlayerAnim_003380); } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !func_80833B54(this)) { - func_80832284(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_0, this->modelAnimType)); + func_80832284(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_0, this->modelAnimType)); } return 1; } -s32 func_80834E44(GlobalContext* globalCtx) { - return (globalCtx->shootingGalleryStatus > 0) && CHECK_BTN_ALL(sControlInput->press.button, BTN_B); +s32 func_80834E44(PlayState* play) { + return (play->shootingGalleryStatus > 0) && CHECK_BTN_ALL(sControlInput->press.button, BTN_B); } -s32 func_80834E7C(GlobalContext* globalCtx) { - return (globalCtx->shootingGalleryStatus != 0) && - ((globalCtx->shootingGalleryStatus < 0) || +s32 func_80834E7C(PlayState* play) { + return (play->shootingGalleryStatus != 0) && + ((play->shootingGalleryStatus < 0) || CHECK_BTN_ANY(sControlInput->cur.button, BTN_A | BTN_B | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)); } -s32 func_80834EB8(Player* this, GlobalContext* globalCtx) { +s32 func_80834EB8(Player* this, PlayState* play) { if ((this->unk_6AD == 0) || (this->unk_6AD == 2)) { - if (func_80833BCC(this) || - (Camera_CheckValidMode(Play_GetCamera(globalCtx, CAM_ID_MAIN), CAM_MODE_BOWARROW) == 0)) { + if (func_80833BCC(this) || (Camera_CheckValidMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_BOWARROW) == 0)) { return 1; } this->unk_6AD = 2; @@ -2437,11 +2435,11 @@ s32 func_80834EB8(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_80834F2C(Player* this, GlobalContext* globalCtx) { +s32 func_80834F2C(Player* this, PlayState* play) { if ((this->doorType == PLAYER_DOORTYPE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_25)) { - if (D_80853614 || func_80834E44(globalCtx)) { - if (func_80834D2C(this, globalCtx)) { - return func_80834EB8(this, globalCtx); + if (D_80853614 || func_80834E44(play)) { + if (func_80834D2C(this, play)) { + return func_80834EB8(this, play); } } } @@ -2463,37 +2461,37 @@ s32 func_80834FBC(Player* this) { return 0; } -s32 func_8083501C(Player* this, GlobalContext* globalCtx) { +s32 func_8083501C(Player* this, PlayState* play) { if (this->unk_860 >= 0) { this->unk_860 = -this->unk_860; } - if ((!Player_HoldsHookshot(this) || func_80834FBC(this)) && !func_80834758(globalCtx, this) && - !func_80834F2C(this, globalCtx)) { + if ((!Player_HoldsHookshot(this) || func_80834FBC(this)) && !func_80834758(play, this) && + !func_80834F2C(this, play)) { return 0; } return 1; } -s32 func_808350A4(GlobalContext* globalCtx, Player* this) { +s32 func_808350A4(PlayState* play, Player* this) { s32 item; s32 arrowType; if (this->heldActor != NULL) { if (!Player_HoldsHookshot(this)) { - func_80834380(globalCtx, this, &item, &arrowType); + func_80834380(play, this, &item, &arrowType); if (gSaveContext.minigameState == 1) { - globalCtx->interfaceCtx.hbaAmmo--; - } else if (globalCtx->shootingGalleryStatus != 0) { - globalCtx->shootingGalleryStatus--; + play->interfaceCtx.hbaAmmo--; + } else if (play->shootingGalleryStatus != 0) { + play->shootingGalleryStatus--; } else { Inventory_ChangeAmmo(item, -1); } - if (globalCtx->shootingGalleryStatus == 1) { - globalCtx->shootingGalleryStatus = -10; + if (play->shootingGalleryStatus == 1) { + play->shootingGalleryStatus = -10; } func_8083264C(this, 150, 10, 150, 0); @@ -2514,7 +2512,7 @@ s32 func_808350A4(GlobalContext* globalCtx, Player* this) { static u16 D_808543DC[] = { NA_SE_IT_BOW_FLICK, NA_SE_IT_SLING_FLICK }; -s32 func_808351D4(Player* this, GlobalContext* globalCtx) { +s32 func_808351D4(Player* this, PlayState* play) { s32 sp2C; if (!Player_HoldsHookshot(this)) { @@ -2527,10 +2525,10 @@ s32 func_808351D4(Player* this, GlobalContext* globalCtx) { this->unk_6AE |= 0x100; if ((this->unk_836 == 0) && (func_80833350(this) == 0) && (this->skelAnime.animation == &gPlayerAnim_0026E8)) { - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, D_808543CC[sp2C]); + LinkAnimation_PlayOnce(play, &this->skelAnime2, D_808543CC[sp2C]); this->unk_836 = -1; - } else if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, D_808543D4[sp2C]); + } else if (LinkAnimation_Update(play, &this->skelAnime2)) { + LinkAnimation_PlayLoop(play, &this->skelAnime2, D_808543D4[sp2C]); this->unk_836 = 1; } else if (this->unk_836 == 1) { this->unk_836 = 2; @@ -2540,17 +2538,17 @@ s32 func_808351D4(Player* this, GlobalContext* globalCtx) { this->unk_834--; } - func_80834EB8(this, globalCtx); + func_80834EB8(this, play); - if ((this->unk_836 > 0) && ((this->unk_860 < 0) || (!D_80853618 && !func_80834E7C(globalCtx)))) { + if ((this->unk_836 > 0) && ((this->unk_860 < 0) || (!D_80853618 && !func_80834E7C(play)))) { func_80833638(this, func_808353D8); if (this->unk_860 >= 0) { if (sp2C == 0) { - if (!func_808350A4(globalCtx, this)) { + if (!func_808350A4(play, this)) { func_8002F7DC(&this->actor, D_808543DC[ABS(this->unk_860) - 1]); } } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_808350A4(globalCtx, this); + func_808350A4(play, this); } } this->unk_834 = 10; @@ -2562,22 +2560,21 @@ s32 func_808351D4(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_808353D8(Player* this, GlobalContext* globalCtx) { - LinkAnimation_Update(globalCtx, &this->skelAnime2); +s32 func_808353D8(Player* this, PlayState* play) { + LinkAnimation_Update(play, &this->skelAnime2); if (Player_HoldsHookshot(this) && !func_80834FBC(this)) { return 1; } - if (!func_80834758(globalCtx, this) && - (D_80853614 || ((this->unk_860 < 0) && D_80853618) || func_80834E44(globalCtx))) { + if (!func_80834758(play, this) && (D_80853614 || ((this->unk_860 < 0) && D_80853618) || func_80834E44(play))) { this->unk_860 = ABS(this->unk_860); - if (func_8083442C(this, globalCtx)) { + if (func_8083442C(this, play)) { if (Player_HoldsHookshot(this)) { this->unk_836 = 1; } else { - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, &gPlayerAnim_0026B8); + LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_0026B8); } } } else { @@ -2596,7 +2593,7 @@ s32 func_808353D8(Player* this, GlobalContext* globalCtx) { func_80833638(this, func_8083501C); } else { func_80833638(this, func_80835588); - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, &gPlayerAnim_0026B0); + LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_0026B0); } this->unk_834 = 0; @@ -2605,8 +2602,8 @@ s32 func_808353D8(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_80835588(Player* this, GlobalContext* globalCtx) { - if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || LinkAnimation_Update(globalCtx, &this->skelAnime2)) { +s32 func_80835588(Player* this, PlayState* play) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || LinkAnimation_Update(play, &this->skelAnime2)) { func_80833638(this, func_8083501C); } @@ -2624,37 +2621,37 @@ void func_808355DC(Player* this) { this->targetYaw = this->actor.shape.rot.y; } -s32 func_80835644(GlobalContext* globalCtx, Player* this, Actor* arg2) { +s32 func_80835644(PlayState* play, Player* this, Actor* arg2) { if (arg2 == NULL) { - func_80832564(globalCtx, this); - func_80839F90(this, globalCtx); + func_80832564(play, this); + func_80839F90(this, play); return 1; } return 0; } -void func_80835688(Player* this, GlobalContext* globalCtx) { - if (!func_80835644(globalCtx, this, this->heldActor)) { +void func_80835688(Player* this, PlayState* play) { + if (!func_80835644(play, this, this->heldActor)) { func_80833638(this, func_808356E8); - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, &gPlayerAnim_002E10); + LinkAnimation_PlayLoop(play, &this->skelAnime2, &gPlayerAnim_002E10); } } -s32 func_808356E8(Player* this, GlobalContext* globalCtx) { +s32 func_808356E8(Player* this, PlayState* play) { Actor* heldActor = this->heldActor; if (heldActor == NULL) { - func_80834644(globalCtx, this); + func_80834644(play, this); } - if (func_80834758(globalCtx, this)) { + if (func_80834758(play, this)) { return 1; } if (this->stateFlags1 & PLAYER_STATE1_11) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, &gPlayerAnim_002E10); + if (LinkAnimation_Update(play, &this->skelAnime2)) { + LinkAnimation_PlayLoop(play, &this->skelAnime2, &gPlayerAnim_002E10); } if ((heldActor->id == ACTOR_EN_NIW) && (this->actor.velocity.y <= 0.0f)) { @@ -2666,62 +2663,62 @@ s32 func_808356E8(Player* this, GlobalContext* globalCtx) { return 1; } - return func_8083485C(this, globalCtx); + return func_8083485C(this, play); } void func_808357E8(Player* this, Gfx** dLists) { this->leftHandDLists = &dLists[gSaveContext.linkAge]; } -s32 func_80835800(Player* this, GlobalContext* globalCtx) { - if (func_80834758(globalCtx, this)) { +s32 func_80835800(Player* this, PlayState* play) { + if (func_80834758(play, this)) { return 1; } if (this->stateFlags1 & PLAYER_STATE1_25) { func_80833638(this, func_80835B60); - } else if (func_80834F2C(this, globalCtx)) { + } else if (func_80834F2C(this, play)) { return 1; } return 0; } -s32 func_80835884(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { +s32 func_80835884(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime2)) { func_80833638(this, func_808358F0); - LinkAnimation_PlayLoop(globalCtx, &this->skelAnime2, &gPlayerAnim_002638); + LinkAnimation_PlayLoop(play, &this->skelAnime2, &gPlayerAnim_002638); } - func_80834EB8(this, globalCtx); + func_80834EB8(this, play); return 1; } -s32 func_808358F0(Player* this, GlobalContext* globalCtx) { +s32 func_808358F0(Player* this, PlayState* play) { LinkAnimationHeader* animSeg = this->skelAnime.animation; if ((func_808334E4(this) == animSeg) || (func_80833528(this) == animSeg) || (func_808335B0(this) == animSeg) || (func_808335F4(this) == animSeg)) { - AnimationContext_SetCopyAll(globalCtx, this->skelAnime.limbCount, this->skelAnime2.jointTable, + AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime2.jointTable, this->skelAnime.jointTable); } else { - LinkAnimation_Update(globalCtx, &this->skelAnime2); + LinkAnimation_Update(play, &this->skelAnime2); } - func_80834EB8(this, globalCtx); + func_80834EB8(this, play); if (!D_80853618) { func_80833638(this, func_808359FC); - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, + LinkAnimation_PlayOnce(play, &this->skelAnime2, (this->unk_870 < 0.5f) ? &gPlayerAnim_002608 : &gPlayerAnim_002600); } return 1; } -s32 func_808359FC(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { +s32 func_808359FC(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime2)) { func_80833638(this, func_80835B60); this->unk_834 = 0; } else if (LinkAnimation_OnFrame(&this->skelAnime2, 6.0f)) { @@ -2729,8 +2726,8 @@ s32 func_808359FC(Player* this, GlobalContext* globalCtx) { f32 posZ = (Math_CosS(this->actor.shape.rot.y) * 10.0f) + this->actor.world.pos.z; s32 yaw = (this->unk_664 != NULL) ? this->actor.shape.rot.y + 14000 : this->actor.shape.rot.y; EnBoom* boomerang = - (EnBoom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOOM, posX, this->actor.world.pos.y + 30.0f, - posZ, this->actor.focus.rot.x, yaw, 0, 0); + (EnBoom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOOM, posX, this->actor.world.pos.y + 30.0f, posZ, + this->actor.focus.rot.x, yaw, 0, 0); this->boomerangActor = &boomerang->actor; if (boomerang != NULL) { @@ -2749,14 +2746,14 @@ s32 func_808359FC(Player* this, GlobalContext* globalCtx) { return 1; } -s32 func_80835B60(Player* this, GlobalContext* globalCtx) { - if (func_80834758(globalCtx, this)) { +s32 func_80835B60(Player* this, PlayState* play) { + if (func_80834758(play, this)) { return 1; } if (!(this->stateFlags1 & PLAYER_STATE1_25)) { func_80833638(this, func_80835C08); - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, &gPlayerAnim_0025F8); + LinkAnimation_PlayOnce(play, &this->skelAnime2, &gPlayerAnim_0025F8); func_808357E8(this, D_80125EF8); func_8002F7DC(&this->actor, NA_SE_PL_CATCH_BOOMERANG); func_80832698(this, NA_SE_VO_LI_SWORD_N); @@ -2766,15 +2763,15 @@ s32 func_80835B60(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_80835C08(Player* this, GlobalContext* globalCtx) { - if (!func_80835800(this, globalCtx) && LinkAnimation_Update(globalCtx, &this->skelAnime2)) { +s32 func_80835C08(Player* this, PlayState* play) { + if (!func_80835800(this, play) && LinkAnimation_Update(play, &this->skelAnime2)) { func_80833638(this, func_80835800); } return 1; } -s32 func_80835C58(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s32 flags) { +s32 func_80835C58(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) { if (func == this->func_674) { return 0; } @@ -2783,7 +2780,7 @@ s32 func_80835C58(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s3 AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); this->stateFlags2 &= ~(PLAYER_STATE2_24 | PLAYER_STATE2_25); } else if (func_808507F4 == this->func_674) { - func_80832340(globalCtx, this); + func_80832340(play, this); } this->func_674 = func; @@ -2794,7 +2791,7 @@ s32 func_80835C58(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s3 } if (!(flags & 1) && !(this->stateFlags1 & PLAYER_STATE1_11)) { - func_80834644(globalCtx, this); + func_80834644(play, this); this->stateFlags1 &= ~PLAYER_STATE1_22; } @@ -2811,40 +2808,40 @@ s32 func_80835C58(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s3 return 1; } -void func_80835DAC(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s32 flags) { +void func_80835DAC(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) { s32 temp; temp = this->skelAnime.moveFlags; this->skelAnime.moveFlags = 0; - func_80835C58(globalCtx, this, func, flags); + func_80835C58(play, this, func, flags); this->skelAnime.moveFlags = temp; } -void func_80835DE4(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s32 flags) { +void func_80835DE4(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) { s32 temp; if (this->itemActionParam >= 0) { temp = this->itemActionParam; this->itemActionParam = this->heldItemActionParam; - func_80835C58(globalCtx, this, func, flags); + func_80835C58(play, this, func, flags); this->itemActionParam = temp; Player_SetModels(this, Player_ActionToModelGroup(this, this->itemActionParam)); } } -void func_80835E44(GlobalContext* globalCtx, s16 camSetting) { - if (!func_800C0CB8(globalCtx)) { +void func_80835E44(PlayState* play, s16 camSetting) { + if (!func_800C0CB8(play)) { if (camSetting == CAM_SET_SCENE_TRANSITION) { Interface_ChangeAlpha(2); } } else { - Camera_ChangeSetting(Play_GetCamera(globalCtx, CAM_ID_MAIN), camSetting); + Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), camSetting); } } -void func_80835EA4(GlobalContext* globalCtx, s32 arg1) { - func_80835E44(globalCtx, CAM_SET_TURN_AROUND); - Camera_SetCameraData(Play_GetCamera(globalCtx, CAM_ID_MAIN), 4, 0, 0, arg1, 0, 0); +void func_80835EA4(PlayState* play, s32 arg1) { + func_80835E44(play, CAM_SET_TURN_AROUND); + Camera_SetCameraData(Play_GetCamera(play, CAM_ID_MAIN), 4, 0, 0, arg1, 0, 0); } void func_80835EFC(Player* this) { @@ -2859,7 +2856,7 @@ void func_80835EFC(Player* this) { } } -void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { +void func_80835F44(PlayState* play, Player* this, s32 item) { s8 actionParam; s32 temp; s32 nextAnimType; @@ -2876,28 +2873,28 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && ((actionParam == PLAYER_AP_HOOKSHOT) || (actionParam == PLAYER_AP_LONGSHOT)))) { - if ((globalCtx->bombchuBowlingStatus == 0) && + if ((play->bombchuBowlingStatus == 0) && (((actionParam == PLAYER_AP_STICK) && (AMMO(ITEM_STICK) == 0)) || ((actionParam == PLAYER_AP_BEAN) && (AMMO(ITEM_BEAN) == 0)) || (temp = Player_ActionToExplosive(this, actionParam), ((temp >= 0) && ((AMMO(sExplosiveInfos[temp].itemId) == 0) || - (globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length >= 3)))))) { + (play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length >= 3)))))) { func_80078884(NA_SE_SY_ERROR); } else if (actionParam == PLAYER_AP_LENS) { - if (func_80087708(globalCtx, 0, 3)) { - if (globalCtx->actorCtx.lensActive) { - Actor_DisableLens(globalCtx); + if (func_80087708(play, 0, 3)) { + if (play->actorCtx.lensActive) { + Actor_DisableLens(play); } else { - globalCtx->actorCtx.lensActive = true; + play->actorCtx.lensActive = true; } - func_80078884((globalCtx->actorCtx.lensActive) ? NA_SE_SY_GLASSMODE_ON : NA_SE_SY_GLASSMODE_OFF); + func_80078884((play->actorCtx.lensActive) ? NA_SE_SY_GLASSMODE_ON : NA_SE_SY_GLASSMODE_OFF); } else { func_80078884(NA_SE_SY_ERROR); } } else if (actionParam == PLAYER_AP_NUT) { if (AMMO(ITEM_NUT) != 0) { - func_8083C61C(globalCtx, this); + func_8083C61C(play, this); } else { func_80078884(NA_SE_SY_ERROR); } @@ -2922,7 +2919,7 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { (actionParam >= PLAYER_AP_BOTTLE_FISH)) { if (!func_8008E9C4(this) || ((actionParam >= PLAYER_AP_BOTTLE_POTION_RED) && (actionParam <= PLAYER_AP_BOTTLE_FAIRY))) { - TitleCard_Clear(globalCtx, &globalCtx->actorCtx.titleCtx); + TitleCard_Clear(play, &play->actorCtx.titleCtx); this->unk_6AD = 4; this->itemActionParam = actionParam; } @@ -2939,8 +2936,8 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { this->stateFlags1 |= PLAYER_STATE1_8; } else { func_80835EFC(this); - func_808323B4(globalCtx, this); - func_80833664(globalCtx, this, actionParam); + func_808323B4(play, this); + func_80833664(play, this, actionParam); } } else { D_80853614 = D_80853618 = true; @@ -2949,16 +2946,16 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { } } -void func_80836448(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { +void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { s32 cond = func_808332B8(this); - func_80832564(globalCtx, this); + func_80832564(play, this); - func_80835C58(globalCtx, this, cond ? func_8084E368 : func_80843CEC, 0); + func_80835C58(play, this, cond ? func_8084E368 : func_80843CEC, 0); this->stateFlags1 |= PLAYER_STATE1_7; - func_80832264(globalCtx, this, anim); + func_80832264(play, this, anim); if (anim == &gPlayerAnim_002878) { this->skelAnime.endFrame = 84.0f; } @@ -2969,18 +2966,18 @@ void func_80836448(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* if (this->actor.category == ACTORCAT_PLAYER) { func_800F47BC(); - if (Inventory_ConsumeFairy(globalCtx)) { - globalCtx->gameOverCtx.state = GAMEOVER_REVIVE_START; + if (Inventory_ConsumeFairy(play)) { + play->gameOverCtx.state = GAMEOVER_REVIVE_START; this->unk_84F = 1; } else { - globalCtx->gameOverCtx.state = GAMEOVER_DEATH_START; + play->gameOverCtx.state = GAMEOVER_DEATH_START; func_800F6AB0(0); Audio_PlayFanfare(NA_BGM_GAME_OVER); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } - OnePointCutscene_Init(globalCtx, 9806, cond ? 120 : 60, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 9806, cond ? 120 : 60, &this->actor, CAM_ID_MAIN); ShrinkWindow_SetVal(0x20); } } @@ -2993,12 +2990,12 @@ s32 func_808365C8(Player* this) { (Player_ItemToActionParam(this->heldItemId) == this->heldItemActionParam)); } -s32 func_80836670(Player* this, GlobalContext* globalCtx) { +s32 func_80836670(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_23) && (this->actor.parent != NULL) && Player_HoldsHookshot(this)) { - func_80835C58(globalCtx, this, func_80850AEC, 1); + func_80835C58(play, this, func_80850AEC, 1); this->stateFlags3 |= PLAYER_STATE3_7; - func_80832264(globalCtx, this, &gPlayerAnim_002C90); - func_80832F54(globalCtx, this, 0x9B); + func_80832264(play, this, &gPlayerAnim_002C90); + func_80832F54(play, this, 0x9B); func_80832224(this); this->currentYaw = this->actor.shape.rot.y; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; @@ -3009,48 +3006,48 @@ s32 func_80836670(Player* this, GlobalContext* globalCtx) { } if (func_808365C8(this)) { - func_80834298(this, globalCtx); + func_80834298(this, play); if (func_8084E604 == this->func_674) { return 1; } } - if (!this->func_82C(this, globalCtx)) { + if (!this->func_82C(this, play)) { return 0; } if (this->unk_830 != 0.0f) { if ((func_80833350(this) == 0) || (this->linearVelocity != 0.0f)) { - AnimationContext_SetCopyFalse(globalCtx, this->skelAnime.limbCount, this->skelAnime2.jointTable, + AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->skelAnime2.jointTable, this->skelAnime.jointTable, D_80853410); } Math_StepToF(&this->unk_830, 0.0f, 0.25f); - AnimationContext_SetInterp(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetInterp(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable, 1.0f - this->unk_830); } else if ((func_80833350(this) == 0) || (this->linearVelocity != 0.0f)) { - AnimationContext_SetCopyTrue(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable, D_80853410); } else { - AnimationContext_SetCopyAll(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable); } return 1; } -s32 func_80836898(GlobalContext* globalCtx, Player* this, PlayerFuncA74 func) { +s32 func_80836898(PlayState* play, Player* this, PlayerFuncA74 func) { this->func_A74 = func; - func_80835C58(globalCtx, this, func_808458D0, 0); + func_80835C58(play, this, func_808458D0, 0); this->stateFlags2 |= PLAYER_STATE2_6; - return func_80832528(globalCtx, this); + return func_80832528(play, this); } -void func_808368EC(Player* this, GlobalContext* globalCtx) { +void func_808368EC(Player* this, PlayState* play) { s16 previousYaw = this->actor.shape.rot.y; if (!(this->stateFlags2 & (PLAYER_STATE2_5 | PLAYER_STATE2_6))) { if ((this->unk_664 != NULL) && - ((globalCtx->actorCtx.targetCtx.unk_4B != 0) || (this->actor.category != ACTORCAT_PLAYER))) { + ((play->actorCtx.targetCtx.unk_4B != 0) || (this->actor.category != ACTORCAT_PLAYER))) { Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos), 4000); } else if ((this->stateFlags1 & PLAYER_STATE1_17) && @@ -3108,7 +3105,7 @@ s32 func_80836AB8(Player* this, s32 arg1) { return var; } -void func_80836BEC(Player* this, GlobalContext* globalCtx) { +void func_80836BEC(Player* this, PlayState* play) { s32 sp1C = 0; s32 zTrigPressed = CHECK_BTN_ALL(sControlInput->cur.button, BTN_Z); Actor* actorToTarget; @@ -3120,7 +3117,7 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) { this->stateFlags1 &= ~PLAYER_STATE1_30; } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) || (this->csMode != 0) || + if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != 0) || (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->stateFlags3 & PLAYER_STATE3_7)) { this->unk_66C = 0; } else if (zTrigPressed || (this->stateFlags2 & PLAYER_STATE2_13) || (this->unk_684 != NULL)) { @@ -3139,7 +3136,7 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) { sp1C = 1; } - cond = func_8083224C(globalCtx); + cond = func_8083224C(play); if (cond || (this->unk_66C != 0) || (this->stateFlags1 & (PLAYER_STATE1_12 | PLAYER_STATE1_25))) { if (!cond) { if (!(this->stateFlags1 & PLAYER_STATE1_25) && @@ -3147,9 +3144,9 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) { CHECK_BTN_ALL(sControlInput->press.button, BTN_Z)) { if (this->actor.category == ACTORCAT_PLAYER) { - actorToTarget = globalCtx->actorCtx.targetCtx.arrowPointedActor; + actorToTarget = play->actorCtx.targetCtx.arrowPointedActor; } else { - actorToTarget = &GET_PLAYER(globalCtx)->actor; + actorToTarget = &GET_PLAYER(play)->actor; } holdTarget = (gSaveContext.zTargetSetting != 0) || (this->actor.category != ACTORCAT_PLAYER); @@ -3157,7 +3154,7 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) { if ((actorToTarget != NULL) && !(actorToTarget->flags & ACTOR_FLAG_27)) { if ((actorToTarget == this->unk_664) && (this->actor.category == ACTORCAT_PLAYER)) { - actorToTarget = globalCtx->actorCtx.targetCtx.unk_94; + actorToTarget = play->actorCtx.targetCtx.unk_94; } if (actorToTarget != this->unk_664) { @@ -3212,13 +3209,13 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) { } } -s32 func_80836FAC(GlobalContext* globalCtx, Player* this, f32* arg2, s16* arg3, f32 arg4) { +s32 func_80836FAC(PlayState* play, Player* this, f32* arg2, s16* arg3, f32 arg4) { f32 temp_f2; f32 temp_f0; f32 temp_f14; f32 temp_f12; - if ((this->unk_6AD != 0) || (globalCtx->transitionTrigger == TRANS_TRIGGER_START) || + if ((this->unk_6AD != 0) || (play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0)) { *arg2 = 0.0f; *arg3 = this->actor.shape.rot.y; @@ -3264,12 +3261,12 @@ s32 func_8083721C(Player* this) { return Math_StepToF(&this->linearVelocity, 0.0f, REG(43) / 100.0f); } -s32 func_80837268(Player* this, f32* arg1, s16* arg2, f32 arg3, GlobalContext* globalCtx) { - if (!func_80836FAC(globalCtx, this, arg1, arg2, arg3)) { +s32 func_80837268(Player* this, f32* arg1, s16* arg2, f32 arg3, PlayState* play) { + if (!func_80836FAC(play, this, arg1, arg2, arg3)) { *arg2 = this->actor.shape.rot.y; if (this->unk_664 != NULL) { - if ((globalCtx->actorCtx.targetCtx.unk_4B != 0) && !(this->stateFlags2 & PLAYER_STATE2_6)) { + if ((play->actorCtx.targetCtx.unk_4B != 0) && !(this->stateFlags2 & PLAYER_STATE2_6)) { *arg2 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos); return 0; } @@ -3279,7 +3276,7 @@ s32 func_80837268(Player* this, f32* arg1, s16* arg2, f32 arg3, GlobalContext* g return 0; } else { - *arg2 += Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); + *arg2 += Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); return 1; } } @@ -3296,17 +3293,17 @@ static s8 D_80854430[] = { 13, 1, 2, 3, 12, 5, 4, 9, 10, 11, 8, 7, -6 }; static s8 D_80854440[] = { 10, 8, -7 }; static s8 D_80854444[] = { 0, 12, 5, -4 }; -static s32 (*D_80854448[])(Player* this, GlobalContext* globalCtx) = { +static s32 (*D_80854448[])(Player* this, PlayState* play) = { func_8083B998, func_80839800, func_8083E5A8, func_8083E0FC, func_8083B644, func_8083F7BC, func_8083C1DC, func_80850224, func_8083C544, func_8083EB44, func_8083BDBC, func_8083C2B0, func_80838A14, func_8083B040, }; -s32 func_80837348(GlobalContext* globalCtx, Player* this, s8* arg2, s32 arg3) { +s32 func_80837348(PlayState* play, Player* this, s8* arg2, s32 arg3) { s32 i; if (!(this->stateFlags1 & (PLAYER_STATE1_0 | PLAYER_STATE1_7 | PLAYER_STATE1_29))) { if (arg3 != 0) { - D_808535E0 = func_80836670(this, globalCtx); + D_808535E0 = func_80836670(this, play); if (func_8084E604 == this->func_674) { return 1; } @@ -3319,13 +3316,13 @@ s32 func_80837348(GlobalContext* globalCtx, Player* this, s8* arg2, s32 arg3) { if (!(this->stateFlags1 & PLAYER_STATE1_8) && (func_80834A2C != this->func_82C)) { while (*arg2 >= 0) { - if (D_80854448[*arg2](this, globalCtx)) { + if (D_80854448[*arg2](this, play)) { return 1; } arg2++; } - if (D_80854448[-(*arg2)](this, globalCtx)) { + if (D_80854448[-(*arg2)](this, play)) { return 1; } } @@ -3334,16 +3331,16 @@ s32 func_80837348(GlobalContext* globalCtx, Player* this, s8* arg2, s32 arg3) { return 0; } -s32 func_808374A0(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, f32 arg3) { +s32 func_808374A0(PlayState* play, Player* this, SkelAnime* skelAnime, f32 arg3) { f32 sp24; s16 sp22; if ((skelAnime->endFrame - arg3) <= skelAnime->curFrame) { - if (func_80837348(globalCtx, this, D_80854418, 1)) { + if (func_80837348(play, this, D_80854418, 1)) { return 0; } - if (func_80837268(this, &sp24, &sp22, 0.018f, globalCtx)) { + if (func_80837268(this, &sp24, &sp22, 0.018f, play)) { return 1; } } @@ -3351,7 +3348,7 @@ s32 func_808374A0(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, return -1; } -void func_80837530(GlobalContext* globalCtx, Player* this, s32 arg2) { +void func_80837530(PlayState* play, Player* this, s32 arg2) { if (arg2 != 0) { this->unk_858 = 0.0f; } else { @@ -3361,7 +3358,7 @@ void func_80837530(GlobalContext* globalCtx, Player* this, s32 arg2) { this->stateFlags1 |= PLAYER_STATE1_12; if (this->actor.category == ACTORCAT_PLAYER) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_M_THUNDER, this->bodyPartsPos[PLAYER_BODYPART_WAIST].x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_M_THUNDER, this->bodyPartsPos[PLAYER_BODYPART_WAIST].x, this->bodyPartsPos[PLAYER_BODYPART_WAIST].y, this->bodyPartsPos[PLAYER_BODYPART_WAIST].z, 0, 0, 0, Player_GetMeleeWeaponHeld(this) | arg2); } @@ -3404,7 +3401,7 @@ s32 func_808375D8(Player* this) { return 1; } -void func_80837704(GlobalContext* globalCtx, Player* this) { +void func_80837704(PlayState* play, Player* this) { LinkAnimationHeader* anim; if ((this->meleeWeaponAnimation >= PLAYER_MWA_RIGHT_SLASH_1H) && @@ -3415,14 +3412,13 @@ void func_80837704(GlobalContext* globalCtx, Player* this) { } func_80832318(this); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 8.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, - -9.0f); - func_80837530(globalCtx, this, 0x200); + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 8.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -9.0f); + func_80837530(play, this, 0x200); } -void func_808377DC(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_80844E68, 1); - func_80837704(globalCtx, this); +void func_808377DC(PlayState* play, Player* this) { + func_80835C58(play, this, func_80844E68, 1); + func_80837704(play, this); } static s8 D_80854480[] = { @@ -3494,12 +3490,12 @@ static u32 D_80854488[][2] = { { 0x00000002, 0x08000000 }, { 0x00000040, 0x40000000 }, }; -void func_80837948(GlobalContext* globalCtx, Player* this, s32 arg2) { +void func_80837948(PlayState* play, Player* this, s32 arg2) { s32 pad; u32 flags; s32 temp; - func_80835C58(globalCtx, this, func_808502D0, 0); + func_80835C58(play, this, func_808502D0, 0); this->unk_844 = 8; if (!((arg2 >= PLAYER_MWA_FLIPSLASH_FINISH) && (arg2 <= PLAYER_MWA_JUMPSLASH_FINISH))) { func_80832318(this); @@ -3516,9 +3512,9 @@ void func_80837948(GlobalContext* globalCtx, Player* this, s32 arg2) { this->meleeWeaponAnimation = arg2; - func_808322D0(globalCtx, this, D_80854190[arg2].unk_00); + func_808322D0(play, this, D_80854190[arg2].unk_00); if ((arg2 != PLAYER_MWA_FLIPSLASH_START) && (arg2 != PLAYER_MWA_JUMPSLASH_START)) { - func_80832F54(globalCtx, this, 0x209); + func_80832F54(play, this, 0x209); } this->currentYaw = this->actor.shape.rot.y; @@ -3553,12 +3549,12 @@ void func_80837AFC(Player* this, s32 timer) { this->unk_88F = 0; } -s32 func_80837B18(GlobalContext* globalCtx, Player* this, s32 damage) { +s32 func_80837B18(PlayState* play, Player* this, s32 damage) { if ((this->invincibilityTimer != 0) || (this->actor.category != ACTORCAT_PLAYER)) { return 1; } - return Health_ChangeBy(globalCtx, damage); + return Health_ChangeBy(play, damage); } void func_80837B60(Player* this) { @@ -3566,9 +3562,9 @@ void func_80837B60(Player* this) { func_80832E48(this, 3); } -void func_80837B9C(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084411C, 0); - func_80832284(globalCtx, this, &gPlayerAnim_003040); +void func_80837B9C(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084411C, 0); + func_80832284(play, this, &gPlayerAnim_003040); this->unk_850 = 1; if (this->unk_6AD != 3) { this->unk_6AD = 0; @@ -3580,7 +3576,7 @@ static LinkAnimationHeader* D_808544B0[] = { &gPlayerAnim_002F70, &gPlayerAnim_002528, &gPlayerAnim_002DC8, &gPlayerAnim_0024F0, }; -void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f32 arg4, s16 arg5, s32 arg6) { +void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, s16 arg5, s32 arg6) { LinkAnimationHeader* sp2C = NULL; LinkAnimationHeader** sp28; @@ -3592,10 +3588,10 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f func_8002F7DC(&this->actor, NA_SE_PL_DAMAGE); - if (!func_80837B18(globalCtx, this, 0 - this->actor.colChkInfo.damage)) { + if (!func_80837B18(play, this, 0 - this->actor.colChkInfo.damage)) { this->stateFlags2 &= ~PLAYER_STATE2_7; if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(this->stateFlags1 & PLAYER_STATE1_27)) { - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); } return; } @@ -3603,7 +3599,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f func_80837AE0(this, arg6); if (arg2 == 3) { - func_80835C58(globalCtx, this, func_8084FB10, 0); + func_80835C58(play, this, func_8084FB10, 0); sp2C = &gPlayerAnim_002FD0; @@ -3613,18 +3609,18 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f func_8002F7DC(&this->actor, NA_SE_PL_FREEZE_S); func_80832698(this, NA_SE_VO_LI_FREEZE); } else if (arg2 == 4) { - func_80835C58(globalCtx, this, func_8084FBF4, 0); + func_80835C58(play, this, func_8084FBF4, 0); func_8083264C(this, 255, 80, 150, 0); - func_808322A4(globalCtx, this, &gPlayerAnim_002F00); + func_808322A4(play, this, &gPlayerAnim_002F00); func_80832224(this); this->unk_850 = 20; } else { arg5 -= this->actor.shape.rot.y; if (this->stateFlags1 & PLAYER_STATE1_27) { - func_80835C58(globalCtx, this, func_8084E30C, 0); + func_80835C58(play, this, func_8084E30C, 0); func_8083264C(this, 180, 20, 50, 0); this->linearVelocity = 4.0f; @@ -3635,7 +3631,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } else if ((arg2 == 1) || (arg2 == 2) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21))) { - func_80835C58(globalCtx, this, func_8084377C, 0); + func_80835C58(play, this, func_8084377C, 0); this->stateFlags3 |= PLAYER_STATE3_1; @@ -3649,7 +3645,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f this->linearVelocity = 3.0f; this->actor.velocity.y = 6.0f; - func_80832C2C(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_3, this->modelAnimType)); + func_80832C2C(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_3, this->modelAnimType)); func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } else { this->actor.speedXZ = arg3; @@ -3681,7 +3677,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f sp28 = D_808544B0; - func_80835C58(globalCtx, this, func_8084370C, 0); + func_80835C58(play, this, func_8084370C, 0); func_80833C3C(this); if (this->actor.colChkInfo.damage < 5) { @@ -3713,12 +3709,12 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f } } - func_80832564(globalCtx, this); + func_80832564(play, this); this->stateFlags1 |= PLAYER_STATE1_26; if (sp2C != NULL) { - func_808322D0(globalCtx, this, sp2C); + func_808322D0(play, this, sp2C); } } @@ -3736,12 +3732,12 @@ s32 func_8083816C(s32 arg0) { return (arg0 == 4) || (arg0 == 7) || (arg0 == 12); } -void func_8083819C(Player* this, GlobalContext* globalCtx) { +void func_8083819C(Player* this, PlayState* play) { if (this->currentShield == PLAYER_SHIELD_DEKU) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_SHIELD, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1); - Inventory_DeleteEquipment(globalCtx, EQUIP_TYPE_SHIELD); - Message_StartTextbox(globalCtx, 0x305F, NULL); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_SHIELD, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 1); + Inventory_DeleteEquipment(play, EQUIP_TYPE_SHIELD); + Message_StartTextbox(play, 0x305F, NULL); } } @@ -3768,14 +3764,14 @@ void func_808382BC(Player* this) { } } -s32 func_808382DC(Player* this, GlobalContext* globalCtx) { +s32 func_808382DC(Player* this, PlayState* play) { s32 pad; s32 sp68 = false; s32 sp64; if (this->unk_A86 != 0) { - if (!Player_InBlockingCsMode(globalCtx, this)) { - Player_InflictDamage(globalCtx, -16); + if (!Player_InBlockingCsMode(play, this)) { + Player_InflictDamage(play, -16); this->unk_A86 = 0; } } else { @@ -3786,33 +3782,33 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { func_80832698(this, NA_SE_VO_LI_DAMAGE_S); if (sp68) { - Play_TriggerRespawn(globalCtx); - Scene_SetTransitionForNextEntrance(globalCtx); + Play_TriggerRespawn(play); + Scene_SetTransitionForNextEntrance(play); } else { // Special case for getting crushed in Forest Temple's Checkboard Ceiling Hall or Shadow Temple's // Falling Spike Trap Room, to respawn the player in a specific place - if (((globalCtx->sceneNum == SCENE_BMORI1) && (globalCtx->roomCtx.curRoom.num == 15)) || - ((globalCtx->sceneNum == SCENE_HAKADAN) && (globalCtx->roomCtx.curRoom.num == 10))) { + if (((play->sceneNum == SCENE_BMORI1) && (play->roomCtx.curRoom.num == 15)) || + ((play->sceneNum == SCENE_HAKADAN) && (play->roomCtx.curRoom.num == 10))) { static SpecialRespawnInfo checkboardCeilingRespawn = { { 1992.0f, 403.0f, -3432.0f }, 0 }; static SpecialRespawnInfo fallingSpikeTrapRespawn = { { 1200.0f, -1343.0f, 3850.0f }, 0 }; SpecialRespawnInfo* respawnInfo; - if (globalCtx->sceneNum == SCENE_BMORI1) { + if (play->sceneNum == SCENE_BMORI1) { respawnInfo = &checkboardCeilingRespawn; } else { respawnInfo = &fallingSpikeTrapRespawn; } - Play_SetupRespawnPoint(globalCtx, RESPAWN_MODE_DOWN, 0xDFF); + Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0xDFF); gSaveContext.respawn[RESPAWN_MODE_DOWN].pos = respawnInfo->pos; gSaveContext.respawn[RESPAWN_MODE_DOWN].yaw = respawnInfo->yaw; } - Play_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); } func_80832698(this, NA_SE_VO_LI_TAKEN_AWAY); - globalCtx->unk_11DE9 = true; + play->unk_11DE9 = true; func_80078884(NA_SE_OC_ABYSS); } else if ((this->unk_8A1 != 0) && ((this->unk_8A1 >= 2) || (this->invincibilityTimer == 0))) { u8 sp5C[] = { 2, 1, 1 }; @@ -3824,7 +3820,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { } this->actor.colChkInfo.damage += this->unk_8A0; - func_80837C0C(globalCtx, this, sp5C[this->unk_8A1 - 1], this->unk_8A4, this->unk_8A8, this->unk_8A2, 20); + func_80837C0C(play, this, sp5C[this->unk_8A1 - 1], this->unk_8A4, this->unk_8A8, this->unk_8A2, 20); } else { sp64 = (this->shieldQuad.base.acFlags & AC_BOUNCED) != 0; @@ -3843,7 +3839,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { s32 sp54 = func_80843188 == this->func_674; if (!func_808332B8(this)) { - func_80835C58(globalCtx, this, func_808435C4, 0); + func_80835C58(play, this, func_808435C4, 0); } if (!(this->unk_84F = sp54)) { @@ -3854,9 +3850,9 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { } else { anim = D_808543B4[Player_HoldsTwoHandedWeapon(this)]; } - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, anim); + LinkAnimation_PlayOnce(play, &this->skelAnime2, anim); } else { - func_80832264(globalCtx, this, D_808543C4[Player_HoldsTwoHandedWeapon(this)]); + func_80832264(play, this, D_808543C4[Player_HoldsTwoHandedWeapon(this)]); } } @@ -3867,7 +3863,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { } if (sp64 && (this->shieldQuad.info.acHitInfo->toucher.effect == 1)) { - func_8083819C(this, globalCtx); + func_8083819C(this, play); } return 0; @@ -3900,7 +3896,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { sp4C = 0; } - func_80837C0C(globalCtx, this, sp4C, 4.0f, 5.0f, Actor_WorldYawTowardActor(ac, &this->actor), 20); + func_80837C0C(play, this, sp4C, 4.0f, 5.0f, Actor_WorldYawTowardActor(ac, &this->actor), 20); } else if (this->invincibilityTimer != 0) { return 0; } else { @@ -3908,15 +3904,15 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { s32 sp48 = func_80838144(D_808535E4); if (((this->actor.wallPoly != NULL) && - SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId)) || + SurfaceType_IsWallDamage(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) || ((sp48 >= 0) && - SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) && + SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) && (this->unk_A79 >= D_808544F4[sp48])) || ((sp48 >= 0) && ((this->currentTunic != PLAYER_TUNIC_GORON) || (this->unk_A79 >= D_808544F4[sp48])))) { this->unk_A79 = 0; this->actor.colChkInfo.damage = 4; - func_80837C0C(globalCtx, this, 0, 4.0f, 5.0f, this->actor.shape.rot.y, 20); + func_80837C0C(play, this, 0, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } else { return 0; } @@ -3927,11 +3923,11 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { return 1; } -void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, GlobalContext* globalCtx, u16 sfxId) { - func_80835C58(globalCtx, this, func_8084411C, 1); +void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* play, u16 sfxId) { + func_80835C58(play, this, func_8084411C, 1); if (anim != NULL) { - func_808322D0(globalCtx, this, anim); + func_808322D0(play, this, anim); } this->actor.velocity.y = arg2 * D_808535E8; @@ -3944,11 +3940,11 @@ void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, GlobalCont this->stateFlags1 |= PLAYER_STATE1_18; } -void func_808389E8(Player* this, LinkAnimationHeader* anim, f32 arg2, GlobalContext* globalCtx) { - func_80838940(this, anim, arg2, globalCtx, NA_SE_VO_LI_SWORD_N); +void func_808389E8(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* play) { + func_80838940(this, anim, arg2, play, NA_SE_VO_LI_SWORD_N); } -s32 func_80838A14(Player* this, GlobalContext* globalCtx) { +s32 func_80838A14(Player* this, PlayState* play) { s32 sp3C; LinkAnimationHeader* sp38; f32 sp34; @@ -3986,7 +3982,7 @@ s32 func_80838A14(Player* this, GlobalContext* globalCtx) { } if (sp3C != 0) { - func_80835C58(globalCtx, this, func_80845668, 0); + func_80835C58(play, this, func_80845668, 0); this->stateFlags1 |= PLAYER_STATE1_18; @@ -4025,8 +4021,8 @@ s32 func_80838A14(Player* this, GlobalContext* globalCtx) { this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND; - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, sp38, 1.3f); - AnimationContext_DisableQueue(globalCtx); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, sp38, 1.3f); + AnimationContext_DisableQueue(play); this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; @@ -4034,7 +4030,7 @@ s32 func_80838A14(Player* this, GlobalContext* globalCtx) { } } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->unk_88C == 1) && (this->unk_88D >= 3)) { temp = (this->wallHeight * 0.08f) + 5.5f; - func_808389E8(this, &gPlayerAnim_002FE0, temp, globalCtx); + func_808389E8(this, &gPlayerAnim_002FE0, temp, play); this->linearVelocity = 2.5f; return 1; @@ -4043,9 +4039,9 @@ s32 func_80838A14(Player* this, GlobalContext* globalCtx) { return 0; } -void func_80838E70(GlobalContext* globalCtx, Player* this, f32 arg2, s16 arg3) { - func_80835C58(globalCtx, this, func_80845CA4, 0); - func_80832440(globalCtx, this); +void func_80838E70(PlayState* play, Player* this, f32 arg2, s16 arg3) { + func_80835C58(play, this, func_80845CA4, 0); + func_80832440(play, this); this->unk_84F = 1; this->unk_850 = 1; @@ -4053,26 +4049,26 @@ void func_80838E70(GlobalContext* globalCtx, Player* this, f32 arg2, s16 arg3) { this->unk_450.x = (Math_SinS(arg3) * arg2) + this->actor.world.pos.x; this->unk_450.z = (Math_CosS(arg3) * arg2) + this->actor.world.pos.z; - func_80832264(globalCtx, this, func_80833338(this)); + func_80832264(play, this, func_80833338(this)); } -void func_80838F18(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084D610, 0); - func_80832C6C(globalCtx, this, &gPlayerAnim_003328); +void func_80838F18(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084D610, 0); + func_80832C6C(play, this, &gPlayerAnim_003328); } -void func_80838F5C(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084F88C, 0); +void func_80838F5C(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084F88C, 0); this->stateFlags1 |= PLAYER_STATE1_29 | PLAYER_STATE1_31; - Camera_ChangeSetting(Play_GetCamera(globalCtx, CAM_ID_MAIN), CAM_SET_FREE0); + Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_FREE0); } -s32 func_80838FB8(GlobalContext* globalCtx, Player* this) { - if ((globalCtx->transitionTrigger == TRANS_TRIGGER_OFF) && (this->stateFlags1 & PLAYER_STATE1_31)) { - func_80838F5C(globalCtx, this); - func_80832284(globalCtx, this, &gPlayerAnim_003040); +s32 func_80838FB8(PlayState* play, Player* this) { + if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (this->stateFlags1 & PLAYER_STATE1_31)) { + func_80838F5C(play, this); + func_80832284(play, this, &gPlayerAnim_003040); func_80832698(this, NA_SE_VO_LI_FALL_S); func_800788CC(NA_SE_OC_SECRET_WARP_IN); return 1; @@ -4089,7 +4085,7 @@ s32 func_80838FB8(GlobalContext* globalCtx, Player* this) { * The start of each group is indexed by `sReturnEntranceGroupIndices` values. * The resulting groups are then indexed by the spawn value. * - * The spawn value (`GlobalContext.curSpawn`) is set to a different value depending on the entrance used to enter the + * The spawn value (`PlayState.curSpawn`) is set to a different value depending on the entrance used to enter the * scene, which allows these dynamic "return entrances" to link back to the previous scene. * * Note: grottos and normal fairy fountains use `ENTR_RETURN_GROTTO` @@ -4134,7 +4130,7 @@ u8 sReturnEntranceGroupIndices[] = { 0, // ENTR_RETURN_DAIYOUSEI_IZUMI }; -s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u32 bgId) { +s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) { s32 exitIndex; s32 temp; s32 sp34; @@ -4144,10 +4140,10 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u if (this->actor.category == ACTORCAT_PLAYER) { exitIndex = 0; - if (!(this->stateFlags1 & PLAYER_STATE1_7) && (globalCtx->transitionTrigger == TRANS_TRIGGER_OFF) && + if (!(this->stateFlags1 & PLAYER_STATE1_7) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (this->csMode == 0) && !(this->stateFlags1 & PLAYER_STATE1_0) && (((poly != NULL) && - (exitIndex = SurfaceType_GetSceneExitIndex(&globalCtx->colCtx, poly, bgId), exitIndex != 0)) || + (exitIndex = SurfaceType_GetSceneExitIndex(&play->colCtx, poly, bgId), exitIndex != 0)) || (func_8083816C(D_808535E4) && (this->unk_A7A == 12)))) { sp34 = this->unk_A84 - (s32)this->actor.world.pos.y; @@ -4158,39 +4154,39 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u } if (exitIndex == 0) { - Play_TriggerVoidOut(globalCtx); - Scene_SetTransitionForNextEntrance(globalCtx); + Play_TriggerVoidOut(play); + Scene_SetTransitionForNextEntrance(play); } else { - globalCtx->nextEntranceIndex = globalCtx->setupExitList[exitIndex - 1]; + play->nextEntranceIndex = play->setupExitList[exitIndex - 1]; - if (globalCtx->nextEntranceIndex == ENTR_RETURN_GROTTO) { + if (play->nextEntranceIndex == ENTR_RETURN_GROTTO) { gSaveContext.respawnFlag = 2; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE; + play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; + play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; - } else if (globalCtx->nextEntranceIndex >= ENTR_RETURN_YOUSEI_IZUMI_YOKO) { - globalCtx->nextEntranceIndex = - sReturnEntranceGroupData[sReturnEntranceGroupIndices[globalCtx->nextEntranceIndex - + } else if (play->nextEntranceIndex >= ENTR_RETURN_YOUSEI_IZUMI_YOKO) { + play->nextEntranceIndex = + sReturnEntranceGroupData[sReturnEntranceGroupIndices[play->nextEntranceIndex - ENTR_RETURN_YOUSEI_IZUMI_YOKO] + - globalCtx->curSpawn]; - Scene_SetTransitionForNextEntrance(globalCtx); + play->curSpawn]; + Scene_SetTransitionForNextEntrance(play); } else { - if (SurfaceType_GetSlope(&globalCtx->colCtx, poly, bgId) == 2) { - gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = globalCtx->nextEntranceIndex; - Play_TriggerVoidOut(globalCtx); + if (SurfaceType_GetSlope(&play->colCtx, poly, bgId) == 2) { + gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = play->nextEntranceIndex; + Play_TriggerVoidOut(play); gSaveContext.respawnFlag = -2; } gSaveContext.retainWeatherMode = true; - Scene_SetTransitionForNextEntrance(globalCtx); + Scene_SetTransitionForNextEntrance(play); } - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->transitionTrigger = TRANS_TRIGGER_START; } if (!(this->stateFlags1 & (PLAYER_STATE1_23 | PLAYER_STATE1_29)) && !(this->stateFlags2 & PLAYER_STATE2_18) && !func_808332B8(this) && - (temp = func_80041D4C(&globalCtx->colCtx, poly, bgId), (temp != 10)) && + (temp = func_80041D4C(&play->colCtx, poly, bgId), (temp != 10)) && ((sp34 < 100) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { if (temp == 11) { @@ -4217,7 +4213,7 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u } else { yaw = this->actor.world.rot.y; } - func_80838E70(globalCtx, this, 400.0f, yaw); + func_80838E70(play, this, 400.0f, yaw); } } else { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { @@ -4227,28 +4223,28 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u this->stateFlags1 |= PLAYER_STATE1_0 | PLAYER_STATE1_29; - func_80835E44(globalCtx, CAM_SET_SCENE_TRANSITION); + func_80835E44(play, CAM_SET_SCENE_TRANSITION); return 1; } else { - if (globalCtx->transitionTrigger == TRANS_TRIGGER_OFF) { + if (play->transitionTrigger == TRANS_TRIGGER_OFF) { if ((this->actor.world.pos.y < -4000.0f) || (((this->unk_A7A == 5) || (this->unk_A7A == 12)) && ((D_80853600 < 100.0f) || (this->fallDistance > 400.0f) || - ((globalCtx->sceneNum != SCENE_HAKADAN) && (this->fallDistance > 200.0f)))) || - ((globalCtx->sceneNum == SCENE_GANON_FINAL) && (this->fallDistance > 320.0f))) { + ((play->sceneNum != SCENE_HAKADAN) && (this->fallDistance > 200.0f)))) || + ((play->sceneNum == SCENE_GANON_FINAL) && (this->fallDistance > 320.0f))) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->unk_A7A == 5) { - Play_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); } else { - Play_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); } - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; func_80078884(NA_SE_OC_ABYSS); } else { - func_80838F5C(globalCtx, this); + func_80838F5C(play, this); this->unk_850 = 9999; if (this->unk_A7A == 5) { this->unk_84F = -1; @@ -4275,28 +4271,28 @@ void func_808395DC(Player* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3) { arg3->z = arg1->z + ((arg2->z * cos) - (arg2->x * sin)); } -Actor* Player_SpawnFairy(GlobalContext* globalCtx, Player* this, Vec3f* arg2, Vec3f* arg3, s32 type) { +Actor* Player_SpawnFairy(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3, s32 type) { Vec3f pos; func_808395DC(this, arg2, arg3, &pos); - return Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, pos.x, pos.y, pos.z, 0, 0, 0, type); + return Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, pos.x, pos.y, pos.z, 0, 0, 0, type); } -f32 func_808396F4(GlobalContext* globalCtx, Player* this, Vec3f* arg2, Vec3f* arg3, CollisionPoly** arg4, s32* arg5) { +f32 func_808396F4(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3, CollisionPoly** arg4, s32* arg5) { func_808395DC(this, &this->actor.world.pos, arg2, arg3); - return BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, arg4, arg5, arg3); + return BgCheck_EntityRaycastFloor3(&play->colCtx, arg4, arg5, arg3); } -f32 func_8083973C(GlobalContext* globalCtx, Player* this, Vec3f* arg2, Vec3f* arg3) { +f32 func_8083973C(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3) { CollisionPoly* sp24; s32 sp20; - return func_808396F4(globalCtx, this, arg2, arg3, &sp24, &sp20); + return func_808396F4(play, this, arg2, arg3, &sp24, &sp20); } -s32 func_80839768(GlobalContext* globalCtx, Player* this, Vec3f* arg2, CollisionPoly** arg3, s32* arg4, Vec3f* arg5) { +s32 func_80839768(PlayState* play, Player* this, Vec3f* arg2, CollisionPoly** arg3, s32* arg4, Vec3f* arg5) { Vec3f sp44; Vec3f sp38; @@ -4306,10 +4302,10 @@ s32 func_80839768(GlobalContext* globalCtx, Player* this, Vec3f* arg2, Collision func_808395DC(this, &this->actor.world.pos, arg2, &sp38); - return BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp44, &sp38, arg5, arg3, true, false, false, true, arg4); + return BgCheck_EntityLineTest1(&play->colCtx, &sp44, &sp38, arg5, arg3, true, false, false, true, arg4); } -s32 func_80839800(Player* this, GlobalContext* globalCtx) { +s32 func_80839800(Player* this, PlayState* play) { DoorShutter* doorShutter; EnDoor* door; // Can also be DoorKiller* s32 doorDirection; @@ -4332,7 +4328,7 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { if (this->doorType <= PLAYER_DOORTYPE_AJAR) { doorActor->textId = 0xD0; - func_80853148(globalCtx, doorActor); + func_80853148(play, doorActor); return 0; } @@ -4353,7 +4349,7 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { this->linearVelocity = 0.1f; } - func_80838E70(globalCtx, this, 50.0f, this->actor.shape.rot.y); + func_80838E70(play, this, 50.0f, this->actor.shape.rot.y); this->unk_84F = 0; this->unk_447 = this->doorType; @@ -4369,18 +4365,18 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { if (this->doorTimer != 0) { this->unk_850 = 0; - func_80832B0C(globalCtx, this, func_80833338(this)); + func_80832B0C(play, this, func_80833338(this)); this->skelAnime.endFrame = 0.0f; } else { this->linearVelocity = 0.1f; } if (doorShutter->dyna.actor.category == ACTORCAT_DOOR) { - this->unk_46A = globalCtx->transiActorCtx.list[(u16)doorShutter->dyna.actor.params >> 10] + this->unk_46A = play->transiActorCtx.list[(u16)doorShutter->dyna.actor.params >> 10] .sides[(doorDirection > 0) ? 0 : 1] .effects; - Actor_DisableLens(globalCtx); + Actor_DisableLens(play); } } else { // This actor can be either EnDoor or DoorKiller. @@ -4401,8 +4397,8 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { sp5C = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_12, this->modelAnimType); } - func_80835C58(globalCtx, this, func_80845EF8, 0); - func_80832528(globalCtx, this); + func_80835C58(play, this, func_80845EF8, 0); + func_80832528(play, this); if (doorDirection < 0) { this->actor.shape.rot.y = doorActor->shape.rot.y; @@ -4416,14 +4412,14 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { this->actor.world.pos.x = doorActor->world.pos.x + sp6C * sp74; this->actor.world.pos.z = doorActor->world.pos.z + sp6C * sp78; - func_8083328C(globalCtx, this, sp5C); + func_8083328C(play, this, sp5C); if (this->doorTimer != 0) { this->skelAnime.endFrame = 0.0f; } func_80832224(this); - func_80832F54(globalCtx, this, 0x28F); + func_80832F54(play, this, 0x28F); if (doorActor->parent != NULL) { doorDirection = -doorDirection; @@ -4433,22 +4429,22 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { if (this->doorType != PLAYER_DOORTYPE_FAKE) { this->stateFlags1 |= PLAYER_STATE1_29; - Actor_DisableLens(globalCtx); + Actor_DisableLens(play); if (((doorActor->params >> 7) & 7) == 3) { sp4C.x = doorActor->world.pos.x - (sp6C * sp74); sp4C.y = doorActor->world.pos.y + 10.0f; sp4C.z = doorActor->world.pos.z - (sp6C * sp78); - BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp58, &sp4C); + BgCheck_EntityRaycastFloor1(&play->colCtx, &sp58, &sp4C); - if (func_80839034(globalCtx, this, sp58, BGCHECK_SCENE)) { + if (func_80839034(play, this, sp58, BGCHECK_SCENE)) { gSaveContext.entranceSpeed = 2.0f; gSaveContext.entranceSound = NA_SE_OC_DOOR_OPEN; } } else { - Camera_ChangeDoorCam(Play_GetCamera(globalCtx, CAM_ID_MAIN), doorActor, - globalCtx->transiActorCtx.list[(u16)doorActor->params >> 10] + Camera_ChangeDoorCam(Play_GetCamera(play, CAM_ID_MAIN), doorActor, + play->transiActorCtx.list[(u16)doorActor->params >> 10] .sides[(doorDirection > 0) ? 0 : 1] .effects, 0, 38.0f * D_808535EC, 26.0f * D_808535EC, 10.0f * D_808535EC); @@ -4457,19 +4453,18 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { } if ((this->doorType != PLAYER_DOORTYPE_FAKE) && (doorActor->category == ACTORCAT_DOOR)) { - frontRoom = globalCtx->transiActorCtx.list[(u16)doorActor->params >> 10] - .sides[(doorDirection > 0) ? 0 : 1] - .room; + frontRoom = + play->transiActorCtx.list[(u16)doorActor->params >> 10].sides[(doorDirection > 0) ? 0 : 1].room; - if ((frontRoom >= 0) && (frontRoom != globalCtx->roomCtx.curRoom.num)) { - func_8009728C(globalCtx, &globalCtx->roomCtx, frontRoom); + if ((frontRoom >= 0) && (frontRoom != play->roomCtx.curRoom.num)) { + func_8009728C(play, &play->roomCtx, frontRoom); } } - doorActor->room = globalCtx->roomCtx.curRoom.num; + doorActor->room = play->roomCtx.curRoom.num; if (((attachedActor = doorActor->child) != NULL) || ((attachedActor = doorActor->parent) != NULL)) { - attachedActor->room = globalCtx->roomCtx.curRoom.num; + attachedActor->room = play->roomCtx.curRoom.num; } return 1; @@ -4479,10 +4474,10 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { return 0; } -void func_80839E88(Player* this, GlobalContext* globalCtx) { +void func_80839E88(Player* this, PlayState* play) { LinkAnimationHeader* anim; - func_80835C58(globalCtx, this, func_80840450, 1); + func_80835C58(play, this, func_80840450, 1); if (this->unk_870 < 0.5f) { anim = func_808334E4(this); @@ -4493,27 +4488,27 @@ void func_80839E88(Player* this, GlobalContext* globalCtx) { } this->unk_874 = this->unk_870; - func_80832284(globalCtx, this, anim); + func_80832284(play, this, anim); this->currentYaw = this->actor.shape.rot.y; } -void func_80839F30(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_808407CC, 1); - func_80832B0C(globalCtx, this, func_80833338(this)); +void func_80839F30(Player* this, PlayState* play) { + func_80835C58(play, this, func_808407CC, 1); + func_80832B0C(play, this, func_80833338(this)); this->currentYaw = this->actor.shape.rot.y; } -void func_80839F90(Player* this, GlobalContext* globalCtx) { +void func_80839F90(Player* this, PlayState* play) { if (func_8008E9C4(this)) { - func_80839E88(this, globalCtx); + func_80839E88(this, play); } else if (func_80833B2C(this)) { - func_80839F30(this, globalCtx); + func_80839F30(this, play); } else { - func_80853080(this, globalCtx); + func_80853080(this, play); } } -void func_80839FFC(Player* this, GlobalContext* globalCtx) { +void func_80839FFC(Player* this, PlayState* play) { PlayerFunc674 func; if (func_8008E9C4(this)) { @@ -4524,47 +4519,47 @@ void func_80839FFC(Player* this, GlobalContext* globalCtx) { func = func_80840BC8; } - func_80835C58(globalCtx, this, func, 1); + func_80835C58(play, this, func, 1); } -void func_8083A060(Player* this, GlobalContext* globalCtx) { - func_80839FFC(this, globalCtx); +void func_8083A060(Player* this, PlayState* play) { + func_80839FFC(this, play); if (func_8008E9C4(this)) { this->unk_850 = 1; } } -void func_8083A098(Player* this, LinkAnimationHeader* anim, GlobalContext* globalCtx) { - func_8083A060(this, globalCtx); - func_8083328C(globalCtx, this, anim); +void func_8083A098(Player* this, LinkAnimationHeader* anim, PlayState* play) { + func_8083A060(this, play); + func_8083328C(play, this, anim); } s32 func_8083A0D4(Player* this) { return (this->interactRangeActor != NULL) && (this->heldActor == NULL); } -void func_8083A0F4(GlobalContext* globalCtx, Player* this) { +void func_8083A0F4(PlayState* play, Player* this) { if (func_8083A0D4(this)) { Actor* interactRangeActor = this->interactRangeActor; s32 interactActorId = interactRangeActor->id; if (interactActorId == ACTOR_BG_TOKI_SWD) { this->interactRangeActor->parent = &this->actor; - func_80835C58(globalCtx, this, func_8084F608, 0); + func_80835C58(play, this, func_8084F608, 0); this->stateFlags1 |= PLAYER_STATE1_29; } else { LinkAnimationHeader* anim; if (interactActorId == ACTOR_BG_HEAVY_BLOCK) { - func_80835C58(globalCtx, this, func_80846120, 0); + func_80835C58(play, this, func_80846120, 0); this->stateFlags1 |= PLAYER_STATE1_29; anim = &gPlayerAnim_002F98; } else if ((interactActorId == ACTOR_EN_ISHI) && ((interactRangeActor->params & 0xF) == 1)) { - func_80835C58(globalCtx, this, func_80846260, 0); + func_80835C58(play, this, func_80846260, 0); anim = &gPlayerAnim_0032B0; } else if (((interactActorId == ACTOR_EN_BOMBF) || (interactActorId == ACTOR_EN_KUSA)) && (Player_GetStrength() <= PLAYER_STR_NONE)) { - func_80835C58(globalCtx, this, func_80846408, 0); + func_80835C58(play, this, func_80846408, 0); this->actor.world.pos.x = (Math_SinS(interactRangeActor->yawTowardsPlayer) * 20.0f) + interactRangeActor->world.pos.x; this->actor.world.pos.z = @@ -4572,54 +4567,54 @@ void func_8083A0F4(GlobalContext* globalCtx, Player* this) { this->currentYaw = this->actor.shape.rot.y = interactRangeActor->yawTowardsPlayer + 0x8000; anim = &gPlayerAnim_003060; } else { - func_80835C58(globalCtx, this, func_80846050, 0); + func_80835C58(play, this, func_80846050, 0); anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_13, this->modelAnimType); } - func_80832264(globalCtx, this, anim); + func_80832264(play, this, anim); } } else { - func_80839F90(this, globalCtx); + func_80839F90(this, play); this->stateFlags1 &= ~PLAYER_STATE1_11; } } -void func_8083A2F8(GlobalContext* globalCtx, Player* this) { - func_80835DAC(globalCtx, this, func_8084B530, 0); +void func_8083A2F8(PlayState* play, Player* this) { + func_80835DAC(play, this, func_8084B530, 0); this->stateFlags1 |= PLAYER_STATE1_6 | PLAYER_STATE1_29; if (this->actor.textId != 0) { - Message_StartTextbox(globalCtx, this->actor.textId, this->targetActor); + Message_StartTextbox(play, this->actor.textId, this->targetActor); this->unk_664 = this->targetActor; } } -void func_8083A360(GlobalContext* globalCtx, Player* this) { - func_80835DAC(globalCtx, this, func_8084CC98, 0); +void func_8083A360(PlayState* play, Player* this) { + func_80835DAC(play, this, func_8084CC98, 0); } -void func_8083A388(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084B78C, 0); +void func_8083A388(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084B78C, 0); } -void func_8083A3B0(GlobalContext* globalCtx, Player* this) { +void func_8083A3B0(PlayState* play, Player* this) { s32 sp1C = this->unk_850; s32 sp18 = this->unk_84F; - func_80835DAC(globalCtx, this, func_8084BF1C, 0); + func_80835DAC(play, this, func_8084BF1C, 0); this->actor.velocity.y = 0.0f; this->unk_850 = sp1C; this->unk_84F = sp18; } -void func_8083A40C(GlobalContext* globalCtx, Player* this) { - func_80835DAC(globalCtx, this, func_8084C760, 0); +void func_8083A40C(PlayState* play, Player* this) { + func_80835DAC(play, this, func_8084C760, 0); } -void func_8083A434(GlobalContext* globalCtx, Player* this) { - func_80835DAC(globalCtx, this, func_8084E6D4, 0); +void func_8083A434(PlayState* play, Player* this) { + func_80835DAC(play, this, func_8084E6D4, 0); this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_29; @@ -4632,7 +4627,7 @@ void func_8083A434(GlobalContext* globalCtx, Player* this) { } } -s32 func_8083A4A8(Player* this, GlobalContext* globalCtx) { +s32 func_8083A4A8(Player* this, PlayState* play) { s16 yawDiff; LinkAnimationHeader* anim; f32 temp; @@ -4651,19 +4646,19 @@ s32 func_8083A4A8(Player* this, GlobalContext* globalCtx) { temp = (IREG(68) / 100.0f) + ((IREG(69) * this->linearVelocity) / 1000.0f); } - func_80838940(this, anim, temp, globalCtx, NA_SE_VO_LI_AUTO_JUMP); + func_80838940(this, anim, temp, play, NA_SE_VO_LI_AUTO_JUMP); this->unk_850 = 1; return 1; } -void func_8083A5C4(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2, f32 arg3, LinkAnimationHeader* arg4) { +void func_8083A5C4(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3, LinkAnimationHeader* arg4) { f32 nx = COLPOLY_GET_NORMAL(arg2->normal.x); f32 nz = COLPOLY_GET_NORMAL(arg2->normal.z); - func_80835C58(globalCtx, this, func_8084BBE4, 0); - func_80832564(globalCtx, this); - func_80832264(globalCtx, this, arg4); + func_80835C58(play, this, func_8084BBE4, 0); + func_80832564(play, this); + func_80832264(play, this, arg4); this->actor.world.pos.x -= (arg3 + 1.0f) * nx; this->actor.world.pos.z -= (arg3 + 1.0f) * nz; @@ -4673,7 +4668,7 @@ void func_8083A5C4(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2, func_80832CFC(this); } -s32 func_8083A6AC(Player* this, GlobalContext* globalCtx) { +s32 func_8083A6AC(Player* this, PlayState* play) { CollisionPoly* sp84; s32 sp80; Vec3f sp74; @@ -4695,7 +4690,7 @@ s32 func_8083A6AC(Player* this, GlobalContext* globalCtx) { sp74.y = this->actor.world.pos.y; sp74.z = this->actor.prevPos.z + (sp74.z * temp1); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp74, &sp68, &sp84, true, false, false, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp74, &sp68, &sp84, true, false, false, true, &sp80) && (ABS(sp84->normal.y) < 600)) { f32 nx = COLPOLY_GET_NORMAL(sp84->normal.x); @@ -4707,20 +4702,20 @@ s32 func_8083A6AC(Player* this, GlobalContext* globalCtx) { sp54 = Math3D_UDistPlaneToPos(nx, ny, nz, sp84->dist, &this->actor.world.pos); sp50 = D_80853604 == 6; - if (!sp50 && (func_80041DB8(&globalCtx->colCtx, sp84, sp80) & 8)) { + if (!sp50 && (func_80041DB8(&play->colCtx, sp84, sp80) & 8)) { sp50 = 1; } - func_8083A5C4(globalCtx, this, sp84, sp54, sp50 ? &gPlayerAnim_002D88 : &gPlayerAnim_002F10); + func_8083A5C4(play, this, sp84, sp54, sp50 ? &gPlayerAnim_002D88 : &gPlayerAnim_002F10); if (sp50) { - func_80836898(globalCtx, this, func_8083A3B0); + func_80836898(play, this, func_8083A3B0); this->currentYaw += 0x8000; this->actor.shape.rot.y = this->currentYaw; this->stateFlags1 |= PLAYER_STATE1_21; - func_80832F54(globalCtx, this, 0x9F); + func_80832F54(play, this, 0x9F); this->unk_850 = -1; this->unk_84F = sp50; @@ -4738,14 +4733,14 @@ s32 func_8083A6AC(Player* this, GlobalContext* globalCtx) { return 0; } -void func_8083A9B8(Player* this, LinkAnimationHeader* anim, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084BDFC, 0); - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, 1.3f); +void func_8083A9B8(Player* this, LinkAnimationHeader* anim, PlayState* play) { + func_80835C58(play, this, func_8084BDFC, 0); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 1.3f); } static Vec3f D_8085451C = { 0.0f, 0.0f, 100.0f }; -void func_8083AA10(Player* this, GlobalContext* globalCtx) { +void func_8083AA10(Player* this, PlayState* play) { s32 sp5C; CollisionPoly* sp58; s32 sp54; @@ -4758,7 +4753,7 @@ void func_8083AA10(Player* this, GlobalContext* globalCtx) { if (!(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - if (!func_80838FB8(globalCtx, this)) { + if (!func_80838FB8(play, this)) { if (D_80853604 == 8) { this->actor.world.pos.x = this->actor.prevPos.x; this->actor.world.pos.z = this->actor.prevPos.z; @@ -4782,8 +4777,8 @@ void func_8083AA10(Player* this, GlobalContext* globalCtx) { sp5C = (s16)(this->currentYaw - this->actor.shape.rot.y); - func_80835C58(globalCtx, this, func_8084411C, 1); - func_80832440(globalCtx, this); + func_80835C58(play, this, func_8084411C, 1); + func_80832440(play, this); this->unk_89E = this->unk_A82; @@ -4793,24 +4788,23 @@ void func_8083AA10(Player* this, GlobalContext* globalCtx) { if ((D_80853604 == 11) && !(this->stateFlags1 & PLAYER_STATE1_11)) { - sp40 = func_808396F4(globalCtx, this, &D_8085451C, &sp44, &sp58, &sp54); + sp40 = func_808396F4(play, this, &D_8085451C, &sp44, &sp58, &sp54); sp3C = this->actor.world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, sp44.x, sp44.z, &sp3C, &sp50) && + if (WaterBox_GetSurface1(play, &play->colCtx, sp44.x, sp44.z, &sp3C, &sp50) && ((sp3C - sp40) > 50.0f)) { - func_808389E8(this, &gPlayerAnim_003158, 6.0f, globalCtx); - func_80835C58(globalCtx, this, func_80844A44, 0); + func_808389E8(this, &gPlayerAnim_003158, 6.0f, play); + func_80835C58(play, this, func_80844A44, 0); return; } } - func_8083A4A8(this, globalCtx); + func_8083A4A8(this, play); return; } - if ((D_80853604 == 9) || (D_80853600 <= this->ageProperties->unk_34) || - !func_8083A6AC(this, globalCtx)) { - func_80832284(globalCtx, this, &gPlayerAnim_003040); + if ((D_80853604 == 9) || (D_80853600 <= this->ageProperties->unk_34) || !func_8083A6AC(this, play)) { + func_80832284(play, this, &gPlayerAnim_003040); return; } } @@ -4820,7 +4814,7 @@ void func_8083AA10(Player* this, GlobalContext* globalCtx) { } } -s32 func_8083AD4C(GlobalContext* globalCtx, Player* this) { +s32 func_8083AD4C(PlayState* play, Player* this) { s32 cameraMode; if (this->unk_6AD == 2) { @@ -4837,12 +4831,12 @@ s32 func_8083AD4C(GlobalContext* globalCtx, Player* this) { cameraMode = CAM_MODE_FIRSTPERSON; } - return Camera_ChangeMode(Play_GetCamera(globalCtx, CAM_ID_MAIN), cameraMode); + return Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), cameraMode); } -s32 func_8083ADD4(GlobalContext* globalCtx, Player* this) { +s32 func_8083ADD4(PlayState* play, Player* this) { if (this->unk_6AD == 3) { - func_80835C58(globalCtx, this, func_80852E14, 0); + func_80835C58(play, this, func_80852E14, 0); if (this->unk_46A != 0) { this->stateFlags1 |= PLAYER_STATE1_29; } @@ -4871,18 +4865,18 @@ void func_8083AE40(Player* this, s16 objectId) { } } -void func_8083AF44(GlobalContext* globalCtx, Player* this, s32 magicSpell) { - func_80835DE4(globalCtx, this, func_808507F4, 0); +void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) { + func_80835DE4(play, this, func_808507F4, 0); this->unk_84F = magicSpell - 3; - func_80087708(globalCtx, sMagicSpellCosts[magicSpell], 4); + func_80087708(play, sMagicSpellCosts[magicSpell], 4); - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, &gPlayerAnim_002D28, 0.83f); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_002D28, 0.83f); if (magicSpell == 5) { - this->subCamId = OnePointCutscene_Init(globalCtx, 1100, -101, NULL, CAM_ID_MAIN); + this->subCamId = OnePointCutscene_Init(play, 1100, -101, NULL, CAM_ID_MAIN); } else { - func_80835EA4(globalCtx, 10); + func_80835EA4(play, 10); } } @@ -4907,7 +4901,7 @@ static LinkAnimationHeader* D_80854548[] = { &gPlayerAnim_003198, }; -s32 func_8083B040(Player* this, GlobalContext* globalCtx) { +s32 func_8083B040(Player* this, PlayState* play) { s32 sp2C; s32 sp28; GetItemEntry* giEntry; @@ -4916,17 +4910,17 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { if ((this->unk_6AD != 0) && (func_808332B8(this) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & PLAYER_STATE1_23))) { - if (!func_8083ADD4(globalCtx, this)) { + if (!func_8083ADD4(play, this)) { if (this->unk_6AD == 4) { sp2C = Player_ActionToMagicSpell(this, this->itemActionParam); if (sp2C >= 0) { if ((sp2C != 3) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) { - func_8083AF44(globalCtx, this, sp2C); + func_8083AF44(play, this, sp2C); } else { - func_80835C58(globalCtx, this, func_8085063C, 1); + func_80835C58(play, this, func_8085063C, 1); this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; - func_80832264(globalCtx, this, func_80833338(this)); - func_80835EA4(globalCtx, 4); + func_80832264(play, this, func_80833338(this)); + func_80835EA4(play, 4); } func_80832224(this); @@ -4942,8 +4936,8 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { (((this->itemActionParam == PLAYER_AP_BOTTLE_POE) && (this->exchangeItemId == EXCH_ITEM_POE)) || (this->exchangeItemId == EXCH_ITEM_BLUE_FIRE))))))) { - if ((globalCtx->actorCtx.titleCtx.delayTimer == 0) && (globalCtx->actorCtx.titleCtx.alpha == 0)) { - func_80835DE4(globalCtx, this, func_8084F104, 0); + if ((play->actorCtx.titleCtx.delayTimer == 0) && (play->actorCtx.titleCtx.alpha == 0)) { + func_80835DE4(play, this, func_8084F104, 0); if (sp2C >= 0) { giEntry = &sGetItemTable[D_80854528[sp2C] - 1]; @@ -4969,7 +4963,7 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { ((this->exchangeItemId != EXCH_ITEM_BEAN) || (this->itemActionParam == PLAYER_AP_BEAN))) { if (this->exchangeItemId == EXCH_ITEM_BEAN) { Inventory_ChangeAmmo(ITEM_BEAN, -1); - func_80835DE4(globalCtx, this, func_8084279C, 0); + func_80835DE4(play, this, func_8084279C, 0); this->stateFlags1 |= PLAYER_STATE1_29; this->unk_850 = 0x50; this->unk_84F = -1; @@ -4979,20 +4973,20 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { } else if (sp2C == EXCH_ITEM_LETTER_RUTO) { this->unk_84F = 1; this->actor.textId = 0x4005; - func_80835EA4(globalCtx, 1); + func_80835EA4(play, 1); } else { this->unk_84F = 2; this->actor.textId = 0xCF; - func_80835EA4(globalCtx, 4); + func_80835EA4(play, 4); } this->actor.flags |= ACTOR_FLAG_8; this->exchangeItemId = sp2C; if (this->unk_84F < 0) { - func_80832B0C(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_32, this->modelAnimType)); + func_80832B0C(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_32, this->modelAnimType)); } else { - func_80832264(globalCtx, this, D_80854548[this->unk_84F]); + func_80832264(play, this, D_80854548[this->unk_84F]); } func_80832224(this); @@ -5003,31 +4997,31 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { sp2C = Player_ActionToBottle(this, this->itemActionParam); if (sp2C >= 0) { if (sp2C == 0xC) { - func_80835DE4(globalCtx, this, func_8084EED8, 0); - func_808322D0(globalCtx, this, &gPlayerAnim_002650); - func_80835EA4(globalCtx, 3); + func_80835DE4(play, this, func_8084EED8, 0); + func_808322D0(play, this, &gPlayerAnim_002650); + func_80835EA4(play, 3); } else if ((sp2C > 0) && (sp2C < 4)) { - func_80835DE4(globalCtx, this, func_8084EFC0, 0); - func_808322D0(globalCtx, this, &gPlayerAnim_002688); - func_80835EA4(globalCtx, (sp2C == 1) ? 1 : 5); + func_80835DE4(play, this, func_8084EFC0, 0); + func_808322D0(play, this, &gPlayerAnim_002688); + func_80835EA4(play, (sp2C == 1) ? 1 : 5); } else { - func_80835DE4(globalCtx, this, func_8084EAC0, 0); - func_80832B78(globalCtx, this, &gPlayerAnim_002668); - func_80835EA4(globalCtx, 2); + func_80835DE4(play, this, func_8084EAC0, 0); + func_80832B78(play, this, &gPlayerAnim_002668); + func_80835EA4(play, 2); } } else { - func_80835DE4(globalCtx, this, func_8084E3C4, 0); - func_808322D0(globalCtx, this, &gPlayerAnim_0030A0); + func_80835DE4(play, this, func_8084E3C4, 0); + func_808322D0(play, this, &gPlayerAnim_0030A0); this->stateFlags2 |= PLAYER_STATE2_27; - func_80835EA4(globalCtx, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); + func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); if (this->unk_6A8 != NULL) { this->stateFlags2 |= PLAYER_STATE2_25; - Camera_SetParam(Play_GetCamera(globalCtx, CAM_ID_MAIN), 8, this->unk_6A8); + Camera_SetParam(Play_GetCamera(play, CAM_ID_MAIN), 8, this->unk_6A8); } } - } else if (func_8083AD4C(globalCtx, this)) { + } else if (func_8083AD4C(play, this)) { if (!(this->stateFlags1 & PLAYER_STATE1_23)) { - func_80835C58(globalCtx, this, func_8084B1D8, 1); + func_80835C58(play, this, func_8084B1D8, 1); this->unk_850 = 13; func_8083B010(this); } @@ -5051,7 +5045,7 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083B644(Player* this, GlobalContext* globalCtx) { +s32 func_8083B644(Player* this, PlayState* play) { Actor* sp34 = this->targetActor; Actor* sp30 = this->unk_664; Actor* sp2C = NULL; @@ -5117,7 +5111,7 @@ s32 func_8083B644(Player* this, GlobalContext* globalCtx) { } this->currentMask = D_80858AA4; - func_80853148(globalCtx, sp34); + func_80853148(play, sp34); return 1; } } @@ -5127,9 +5121,9 @@ s32 func_8083B644(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083B8F4(Player* this, GlobalContext* globalCtx) { +s32 func_8083B8F4(Player* this, PlayState* play) { if (!(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_23)) && - Camera_CheckValidMode(Play_GetCamera(globalCtx, CAM_ID_MAIN), CAM_MODE_FIRSTPERSON)) { + Camera_CheckValidMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_FIRSTPERSON)) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (func_808332B8(this) && (this->actor.yDistToWater < this->ageProperties->unk_2C))) { this->unk_6AD = 1; @@ -5140,9 +5134,9 @@ s32 func_8083B8F4(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083B998(Player* this, GlobalContext* globalCtx) { +s32 func_8083B998(Player* this, PlayState* play) { if (this->unk_6AD != 0) { - func_8083B040(this, globalCtx); + func_8083B040(this, play); return 1; } @@ -5150,16 +5144,16 @@ s32 func_8083B998(Player* this, GlobalContext* globalCtx) { (this->unk_664->naviEnemyId != NAVI_ENEMY_NONE))) { this->stateFlags2 |= PLAYER_STATE2_21; } else if ((this->naviTextId == 0) && !func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && - (YREG(15) != 0x10) && (YREG(15) != 0x20) && !func_8083B8F4(this, globalCtx)) { + (YREG(15) != 0x10) && (YREG(15) != 0x20) && !func_8083B8F4(this, play)) { func_80078884(NA_SE_SY_ERROR); } return 0; } -void func_8083BA90(GlobalContext* globalCtx, Player* this, s32 arg2, f32 xzVelocity, f32 yVelocity) { - func_80837948(globalCtx, this, arg2); - func_80835C58(globalCtx, this, func_80844AF4, 0); +void func_8083BA90(PlayState* play, Player* this, s32 arg2, f32 xzVelocity, f32 yVelocity) { + func_80837948(play, this, arg2); + func_80835C58(play, this, func_80844AF4, 0); this->stateFlags3 |= PLAYER_STATE3_1; @@ -5185,32 +5179,32 @@ s32 func_8083BB20(Player* this) { return 0; } -s32 func_8083BBA0(Player* this, GlobalContext* globalCtx) { +s32 func_8083BBA0(Player* this, PlayState* play) { if (func_8083BB20(this) && (D_808535E4 != 7)) { - func_8083BA90(globalCtx, this, PLAYER_MWA_JUMPSLASH_START, 3.0f, 4.5f); + func_8083BA90(play, this, PLAYER_MWA_JUMPSLASH_START, 3.0f, 4.5f); return 1; } return 0; } -void func_8083BC04(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80844708, 0); - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, - GET_PLAYER_ANIM(PLAYER_ANIMGROUP_16, this->modelAnimType), 1.25f * D_808535E8); +void func_8083BC04(Player* this, PlayState* play) { + func_80835C58(play, this, func_80844708, 0); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_16, this->modelAnimType), + 1.25f * D_808535E8); } -s32 func_8083BC7C(Player* this, GlobalContext* globalCtx) { +s32 func_8083BC7C(Player* this, PlayState* play) { if ((this->unk_84B[this->unk_846] == 0) && (D_808535E4 != 7)) { - func_8083BC04(this, globalCtx); + func_8083BC04(this, play); return 1; } return 0; } -void func_8083BCD0(Player* this, GlobalContext* globalCtx, s32 arg2) { - func_80838940(this, D_80853D4C[arg2][0], !(arg2 & 1) ? 5.8f : 3.5f, globalCtx, NA_SE_VO_LI_SWORD_N); +void func_8083BCD0(Player* this, PlayState* play, s32 arg2) { + func_80838940(this, D_80853D4C[arg2][0], !(arg2 & 1) ? 5.8f : 3.5f, play, NA_SE_VO_LI_SWORD_N); if (arg2) {} @@ -5225,33 +5219,33 @@ void func_8083BCD0(Player* this, GlobalContext* globalCtx, s32 arg2) { func_8002F7DC(&this->actor, ((arg2 << 0xE) == 0x8000) ? NA_SE_PL_ROLL : NA_SE_PL_SKIP); } -s32 func_8083BDBC(Player* this, GlobalContext* globalCtx) { +s32 func_8083BDBC(Player* this, PlayState* play) { s32 sp2C; if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && - (globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (D_808535E4 != 7) && - (SurfaceType_GetSlope(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) != 1)) { + (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (D_808535E4 != 7) && + (SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) != 1)) { sp2C = this->unk_84B[this->unk_846]; if (sp2C <= 0) { if (func_80833BCC(this)) { if (this->actor.category != ACTORCAT_PLAYER) { if (sp2C < 0) { - func_808389E8(this, &gPlayerAnim_002FE0, REG(69) / 100.0f, globalCtx); + func_808389E8(this, &gPlayerAnim_002FE0, REG(69) / 100.0f, play); } else { - func_8083BC04(this, globalCtx); + func_8083BC04(this, play); } } else { if ((Player_GetMeleeWeaponHeld(this) != 0) && func_808365C8(this)) { - func_8083BA90(globalCtx, this, PLAYER_MWA_JUMPSLASH_START, 5.0f, 5.0f); + func_8083BA90(play, this, PLAYER_MWA_JUMPSLASH_START, 5.0f, 5.0f); } else { - func_8083BC04(this, globalCtx); + func_8083BC04(this, play); } } return 1; } } else { - func_8083BCD0(this, globalCtx, sp2C); + func_8083BCD0(this, play, sp2C); return 1; } } @@ -5259,7 +5253,7 @@ s32 func_8083BDBC(Player* this, GlobalContext* globalCtx) { return 0; } -void func_8083BF50(Player* this, GlobalContext* globalCtx) { +void func_8083BF50(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 sp30; @@ -5284,29 +5278,29 @@ void func_8083BF50(Player* this, GlobalContext* globalCtx) { sp30 /= 12.0f; } - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, 4.0f * sp30); this->currentYaw = this->actor.shape.rot.y; } -void func_8083C0B8(Player* this, GlobalContext* globalCtx) { - func_80839FFC(this, globalCtx); - func_8083BF50(this, globalCtx); +void func_8083C0B8(Player* this, PlayState* play) { + func_80839FFC(this, play); + func_8083BF50(this, play); } -void func_8083C0E8(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80840BC8, 1); - func_80832264(globalCtx, this, func_80833338(this)); +void func_8083C0E8(Player* this, PlayState* play) { + func_80835C58(play, this, func_80840BC8, 1); + func_80832264(play, this, func_80833338(this)); this->currentYaw = this->actor.shape.rot.y; } -void func_8083C148(Player* this, GlobalContext* globalCtx) { +void func_8083C148(Player* this, PlayState* play) { if (!(this->stateFlags3 & PLAYER_STATE3_7)) { func_8083B010(this); if (this->stateFlags1 & PLAYER_STATE1_27) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } else { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } if (this->unk_6AD < 4) { this->unk_6AD = 0; @@ -5316,14 +5310,14 @@ void func_8083C148(Player* this, GlobalContext* globalCtx) { this->stateFlags1 &= ~(PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_20); } -s32 func_8083C1DC(Player* this, GlobalContext* globalCtx) { +s32 func_8083C1DC(Player* this, PlayState* play) { if (!func_80833B54(this) && (D_808535E0 == 0) && !(this->stateFlags1 & PLAYER_STATE1_23) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { - if (func_8083BC7C(this, globalCtx)) { + if (func_8083BC7C(this, play)) { return 1; } if ((this->unk_837 == 0) && (this->heldItemActionParam >= PLAYER_AP_SWORD_MASTER)) { - func_80835F44(globalCtx, this, ITEM_NONE); + func_80835F44(play, this, ITEM_NONE); } else { this->stateFlags2 ^= PLAYER_STATE2_20; } @@ -5332,18 +5326,18 @@ s32 func_8083C1DC(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083C2B0(Player* this, GlobalContext* globalCtx) { +s32 func_8083C2B0(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 frame; - if ((globalCtx->shootingGalleryStatus == 0) && (this->currentShield != PLAYER_SHIELD_NONE) && + if ((play->shootingGalleryStatus == 0) && (this->currentShield != PLAYER_SHIELD_NONE) && CHECK_BTN_ALL(sControlInput->cur.button, BTN_R) && (Player_IsChildWithHylianShield(this) || (!func_80833B2C(this) && (this->unk_664 == NULL)))) { func_80832318(this); - func_808323B4(globalCtx, this); + func_808323B4(play, this); - if (func_80835C58(globalCtx, this, func_80843188, 0)) { + if (func_80835C58(play, this, func_80843188, 0)) { this->stateFlags1 |= PLAYER_STATE1_22; if (!Player_IsChildWithHylianShield(this)) { @@ -5364,10 +5358,10 @@ s32 func_8083C2B0(Player* this, GlobalContext* globalCtx) { } frame = Animation_GetLastFrame(anim); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); if (Player_IsChildWithHylianShield(this)) { - func_80832F54(globalCtx, this, 4); + func_80832F54(play, this, 4); } func_8002F7DC(&this->actor, NA_SE_IT_SHIELD_POSTURE); @@ -5400,12 +5394,12 @@ void func_8083C50C(Player* this) { } } -s32 func_8083C544(Player* this, GlobalContext* globalCtx) { +s32 func_8083C544(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetMeleeWeaponHeld(this) != 0) && (this->unk_844 == 1) && (this->heldItemActionParam != PLAYER_AP_STICK)) { if ((this->heldItemActionParam != PLAYER_AP_SWORD_BGS) || (gSaveContext.swordHealth > 0.0f)) { - func_808377DC(globalCtx, this); + func_808377DC(play, this); return 1; } } @@ -5416,11 +5410,11 @@ s32 func_8083C544(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083C61C(GlobalContext* globalCtx, Player* this) { - if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && +s32 func_8083C61C(PlayState* play, Player* this) { + if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (AMMO(ITEM_NUT) != 0)) { - func_80835C58(globalCtx, this, func_8084E604, 0); - func_80832264(globalCtx, this, &gPlayerAnim_003048); + func_80835C58(play, this, func_8084E604, 0); + func_80832264(play, this, &gPlayerAnim_003048); this->unk_6AD = 0; return 1; } @@ -5433,18 +5427,18 @@ static struct_80854554 D_80854554[] = { { &gPlayerAnim_002680, &gPlayerAnim_002678, 5, 3 }, }; -s32 func_8083C6B8(GlobalContext* globalCtx, Player* this) { +s32 func_8083C6B8(PlayState* play, Player* this) { Vec3f sp24; if (D_80853614) { if (Player_GetBottleHeld(this) >= 0) { - func_80835C58(globalCtx, this, func_8084ECA4, 0); + func_80835C58(play, this, func_8084ECA4, 0); if (this->actor.yDistToWater > 12.0f) { this->unk_850 = 1; } - func_808322D0(globalCtx, this, D_80854554[this->unk_850].unk_00); + func_808322D0(play, this, D_80854554[this->unk_850].unk_00); func_8002F7DC(&this->actor, NA_SE_IT_SWORD_SWING); func_80832698(this, NA_SE_VO_LI_AUTO_JUMP); @@ -5456,15 +5450,15 @@ s32 func_8083C6B8(GlobalContext* globalCtx, Player* this) { sp24.y += 50.0f; if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.world.pos.z > 1300.0f) || - BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &sp24, 20.0f)) { + BgCheck_SphVsFirstPoly(&play->colCtx, &sp24, 20.0f)) { func_80078884(NA_SE_SY_ERROR); return 0; } - func_80835C58(globalCtx, this, func_80850C68, 0); + func_80835C58(play, this, func_80850C68, 0); this->unk_860 = 1; func_80832210(this); - func_80832264(globalCtx, this, &gPlayerAnim_002C30); + func_80832264(play, this, &gPlayerAnim_002C30); return 1; } else { return 0; @@ -5474,7 +5468,7 @@ s32 func_8083C6B8(GlobalContext* globalCtx, Player* this) { return 0; } -void func_8083C858(Player* this, GlobalContext* globalCtx) { +void func_8083C858(Player* this, PlayState* play) { PlayerFunc674 func; if (func_80833BCC(this)) { @@ -5483,64 +5477,64 @@ void func_8083C858(Player* this, GlobalContext* globalCtx) { func = func_80842180; } - func_80835C58(globalCtx, this, func, 1); - func_80832BE8(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_2, this->modelAnimType)); + func_80835C58(play, this, func, 1); + func_80832BE8(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_2, this->modelAnimType)); this->unk_89C = 0; this->unk_864 = this->unk_868 = 0.0f; } -void func_8083C8DC(Player* this, GlobalContext* globalCtx, s16 arg2) { +void func_8083C8DC(Player* this, PlayState* play, s16 arg2) { this->actor.shape.rot.y = this->currentYaw = arg2; - func_8083C858(this, globalCtx); + func_8083C858(this, play); } -s32 func_8083C910(GlobalContext* globalCtx, Player* this, f32 arg2) { +s32 func_8083C910(PlayState* play, Player* this, f32 arg2) { WaterBox* sp2C; f32 sp28; sp28 = this->actor.world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp28, - &sp2C) != 0) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp28, &sp2C) != + 0) { sp28 -= this->actor.world.pos.y; if (this->ageProperties->unk_24 <= sp28) { - func_80835C58(globalCtx, this, func_8084D7C4, 0); - func_80832C6C(globalCtx, this, &gPlayerAnim_0032F0); + func_80835C58(play, this, func_8084D7C4, 0); + func_80832C6C(play, this, &gPlayerAnim_0032F0); this->stateFlags1 |= PLAYER_STATE1_27 | PLAYER_STATE1_29; this->unk_850 = 20; this->linearVelocity = 2.0f; - Player_SetBootData(globalCtx, this); + Player_SetBootData(play, this); return 0; } } - func_80838E70(globalCtx, this, arg2, this->actor.shape.rot.y); + func_80838E70(play, this, arg2, this->actor.shape.rot.y); this->stateFlags1 |= PLAYER_STATE1_29; return 1; } -void func_8083CA20(GlobalContext* globalCtx, Player* this) { - if (func_8083C910(globalCtx, this, 180.0f)) { +void func_8083CA20(PlayState* play, Player* this) { + if (func_8083C910(play, this, 180.0f)) { this->unk_850 = -20; } } -void func_8083CA54(GlobalContext* globalCtx, Player* this) { +void func_8083CA54(PlayState* play, Player* this) { this->linearVelocity = 2.0f; gSaveContext.entranceSpeed = 2.0f; - if (func_8083C910(globalCtx, this, 120.0f)) { + if (func_8083C910(play, this, 120.0f)) { this->unk_850 = -15; } } -void func_8083CA9C(GlobalContext* globalCtx, Player* this) { +void func_8083CA9C(PlayState* play, Player* this) { if (gSaveContext.entranceSpeed < 0.1f) { gSaveContext.entranceSpeed = 0.1f; } this->linearVelocity = gSaveContext.entranceSpeed; - if (func_8083C910(globalCtx, this, 800.0f)) { + if (func_8083C910(play, this, 800.0f)) { this->unk_850 = -80 / this->linearVelocity; if (this->unk_850 < -20) { this->unk_850 = -20; @@ -5548,84 +5542,84 @@ void func_8083CA9C(GlobalContext* globalCtx, Player* this) { } } -void func_8083CB2C(Player* this, s16 yaw, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_808414F8, 1); - LinkAnimation_CopyJointToMorph(globalCtx, &this->skelAnime); +void func_8083CB2C(Player* this, s16 yaw, PlayState* play) { + func_80835C58(play, this, func_808414F8, 1); + LinkAnimation_CopyJointToMorph(play, &this->skelAnime); this->unk_864 = this->unk_868 = 0.0f; this->currentYaw = yaw; } -void func_8083CB94(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80840DE4, 1); - func_80832BE8(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType)); +void func_8083CB94(Player* this, PlayState* play) { + func_80835C58(play, this, func_80840DE4, 1); + func_80832BE8(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType)); } -void func_8083CBF0(Player* this, s16 yaw, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_808423EC, 1); - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_0024F8, 2.2f, 0.0f, +void func_8083CBF0(Player* this, s16 yaw, PlayState* play) { + func_80835C58(play, this, func_808423EC, 1); + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_0024F8, 2.2f, 0.0f, Animation_GetLastFrame(&gPlayerAnim_0024F8), ANIMMODE_ONCE, -6.0f); this->linearVelocity = 8.0f; this->currentYaw = yaw; } -void func_8083CC9C(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084193C, 1); - func_80832BE8(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_25, this->modelAnimType)); +void func_8083CC9C(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084193C, 1); + func_80832BE8(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_25, this->modelAnimType)); this->unk_868 = 0.0f; } -void func_8083CD00(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084251C, 1); - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, &gPlayerAnim_0024E8, 2.0f); +void func_8083CD00(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084251C, 1); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_0024E8, 2.0f); } -void func_8083CD54(GlobalContext* globalCtx, Player* this, s16 yaw) { +void func_8083CD54(PlayState* play, Player* this, s16 yaw) { this->currentYaw = yaw; - func_80835C58(globalCtx, this, func_80841BA8, 1); + func_80835C58(play, this, func_80841BA8, 1); this->unk_87E = 1200; this->unk_87E *= D_808535E8; - LinkAnimation_Change(globalCtx, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_26, this->modelAnimType), 1.0f, - 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f); + LinkAnimation_Change(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_26, this->modelAnimType), 1.0f, 0.0f, + 0.0f, ANIMMODE_LOOP, -6.0f); } -void func_8083CE0C(Player* this, GlobalContext* globalCtx) { +void func_8083CE0C(Player* this, PlayState* play) { LinkAnimationHeader* anim; - func_80835C58(globalCtx, this, func_80840BC8, 1); + func_80835C58(play, this, func_80840BC8, 1); if (this->unk_870 < 0.5f) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_28, this->modelAnimType); } else { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_27, this->modelAnimType); } - func_80832264(globalCtx, this, anim); + func_80832264(play, this, anim); this->currentYaw = this->actor.shape.rot.y; } -void func_8083CEAC(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80840450, 1); - func_80832B0C(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_7, this->modelAnimType)); +void func_8083CEAC(Player* this, PlayState* play) { + func_80835C58(play, this, func_80840450, 1); + func_80832B0C(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_7, this->modelAnimType)); this->unk_850 = 1; } -void func_8083CF10(Player* this, GlobalContext* globalCtx) { +void func_8083CF10(Player* this, PlayState* play) { if (this->linearVelocity != 0.0f) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); } else { - func_8083CE0C(this, globalCtx); + func_8083CE0C(this, play); } } -void func_8083CF5C(Player* this, GlobalContext* globalCtx) { +void func_8083CF5C(Player* this, PlayState* play) { if (this->linearVelocity != 0.0f) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); } else { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } } -s32 func_8083CFA8(GlobalContext* globalCtx, Player* this, f32 arg2, s32 splashScale) { +s32 func_8083CFA8(PlayState* play, Player* this, f32 arg2, s32 splashScale) { f32 sp3C = fabsf(arg2); WaterBox* sp38; f32 sp34; @@ -5636,11 +5630,11 @@ s32 func_8083CFA8(GlobalContext* globalCtx, Player* this, f32 arg2, s32 splashSc splashPos.x = this->bodyPartsPos[PLAYER_BODYPART_WAIST].x; splashPos.z = this->bodyPartsPos[PLAYER_BODYPART_WAIST].z; sp34 = this->actor.world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, splashPos.x, splashPos.z, &sp34, &sp38)) { + if (WaterBox_GetSurface1(play, &play->colCtx, splashPos.x, splashPos.z, &sp34, &sp38)) { if ((sp34 - this->actor.world.pos.y) < 100.0f) { splashType = (sp3C <= 10.0f) ? 0 : 1; splashPos.y = sp34; - EffectSsGSplash_Spawn(globalCtx, &splashPos, NULL, NULL, splashType, splashScale); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, splashType, splashScale); return 1; } } @@ -5649,25 +5643,25 @@ s32 func_8083CFA8(GlobalContext* globalCtx, Player* this, f32 arg2, s32 splashSc return 0; } -void func_8083D0A8(GlobalContext* globalCtx, Player* this, f32 arg2) { +void func_8083D0A8(PlayState* play, Player* this, f32 arg2) { this->stateFlags1 |= PLAYER_STATE1_18; this->stateFlags1 &= ~PLAYER_STATE1_27; - func_80832340(globalCtx, this); - if (func_8083CFA8(globalCtx, this, arg2, 500)) { + func_80832340(play, this); + if (func_8083CFA8(play, this, arg2, 500)) { func_8002F7DC(&this->actor, NA_SE_EV_JUMP_OUT_WATER); } - Player_SetBootData(globalCtx, this); + Player_SetBootData(play, this); } -s32 func_8083D12C(GlobalContext* globalCtx, Player* this, Input* arg2) { +s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { if (!(this->stateFlags1 & PLAYER_STATE1_10) && !(this->stateFlags2 & PLAYER_STATE2_10)) { if ((arg2 == NULL) || (CHECK_BTN_ALL(arg2->press.button, BTN_A) && (ABS(this->unk_6C2) < 12000) && (this->currentBoots != PLAYER_BOOTS_IRON))) { - func_80835C58(globalCtx, this, func_8084DC48, 0); - func_80832264(globalCtx, this, &gPlayerAnim_003308); + func_80835C58(play, this, func_8084DC48, 0); + func_80832264(play, this, &gPlayerAnim_003308); this->unk_6C2 = 0; this->stateFlags2 |= PLAYER_STATE2_10; @@ -5689,7 +5683,7 @@ s32 func_8083D12C(GlobalContext* globalCtx, Player* this, Input* arg2) { this->stateFlags2 &= ~PLAYER_STATE2_10; if (arg2 != NULL) { - func_80835C58(globalCtx, this, func_8084E1EC, 1); + func_80835C58(play, this, func_8084E1EC, 1); if (this->stateFlags1 & PLAYER_STATE1_10) { this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_11 | PLAYER_STATE1_29; @@ -5698,11 +5692,11 @@ s32 func_8083D12C(GlobalContext* globalCtx, Player* this, Input* arg2) { this->unk_850 = 2; } - func_80832340(globalCtx, this); - func_80832B0C(globalCtx, this, + func_80832340(play, this); + func_80832B0C(play, this, (this->stateFlags1 & PLAYER_STATE1_11) ? &gPlayerAnim_003318 : &gPlayerAnim_003300); - if (func_8083CFA8(globalCtx, this, this->actor.velocity.y, 500)) { + if (func_8083CFA8(play, this, this->actor.velocity.y, 500)) { func_8002F7DC(&this->actor, NA_SE_PL_FACE_UP); } @@ -5714,32 +5708,32 @@ s32 func_8083D12C(GlobalContext* globalCtx, Player* this, Input* arg2) { return 0; } -void func_8083D330(GlobalContext* globalCtx, Player* this) { - func_80832284(globalCtx, this, &gPlayerAnim_0032F0); +void func_8083D330(PlayState* play, Player* this) { + func_80832284(play, this, &gPlayerAnim_0032F0); this->unk_6C2 = 16000; this->unk_850 = 1; } -void func_8083D36C(GlobalContext* globalCtx, Player* this) { +void func_8083D36C(PlayState* play, Player* this) { if ((this->currentBoots != PLAYER_BOOTS_IRON) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_80832564(globalCtx, this); + func_80832564(play, this); if ((this->currentBoots != PLAYER_BOOTS_IRON) && (this->stateFlags2 & PLAYER_STATE2_10)) { this->stateFlags2 &= ~PLAYER_STATE2_10; - func_8083D12C(globalCtx, this, 0); + func_8083D12C(play, this, 0); this->unk_84F = 1; } else if (func_80844A44 == this->func_674) { - func_80835C58(globalCtx, this, func_8084DC48, 0); - func_8083D330(globalCtx, this); + func_80835C58(play, this, func_8084DC48, 0); + func_8083D330(play, this); } else { - func_80835C58(globalCtx, this, func_8084D610, 1); - func_80832B0C(globalCtx, this, + func_80835C58(play, this, func_8084D610, 1); + func_80832B0C(play, this, (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) ? &gPlayerAnim_003330 : &gPlayerAnim_0032E0); } } if (!(this->stateFlags1 & PLAYER_STATE1_27) || (this->actor.yDistToWater < this->ageProperties->unk_2C)) { - if (func_8083CFA8(globalCtx, this, this->actor.velocity.y, 500)) { + if (func_8083CFA8(play, this, this->actor.velocity.y, 500)) { func_8002F7DC(&this->actor, NA_SE_EV_DIVE_INTO_WATER); if (this->fallDistance > 800.0f) { @@ -5753,10 +5747,10 @@ void func_8083D36C(GlobalContext* globalCtx, Player* this) { this->stateFlags1 &= ~(PLAYER_STATE1_18 | PLAYER_STATE1_19); this->unk_854 = 0.0f; - Player_SetBootData(globalCtx, this); + Player_SetBootData(play, this); } -void func_8083D53C(GlobalContext* globalCtx, Player* this) { +void func_8083D53C(PlayState* play, Player* this) { if (this->actor.yDistToWater < this->ageProperties->unk_2C) { Audio_SetBaseFilter(0); this->unk_840 = 0; @@ -5775,19 +5769,19 @@ void func_8083D53C(GlobalContext* globalCtx, Player* this) { (func_8084D610 != this->func_674) && (func_8084D84C != this->func_674) && (func_8084DAB4 != this->func_674) && (func_8084DC48 != this->func_674) && (func_8084E1EC != this->func_674) && (func_8084D7C4 != this->func_674))) { - func_8083D36C(globalCtx, this); + func_8083D36C(play, this); return; } } else if ((this->stateFlags1 & PLAYER_STATE1_27) && (this->actor.yDistToWater < this->ageProperties->unk_24)) { if ((this->skelAnime.moveFlags == 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) { - func_8083CD54(globalCtx, this, this->actor.shape.rot.y); + func_8083CD54(play, this, this->actor.shape.rot.y); } - func_8083D0A8(globalCtx, this, this->actor.velocity.y); + func_8083D0A8(play, this, this->actor.velocity.y); } } } -void func_8083D6EC(GlobalContext* globalCtx, Player* this) { +void func_8083D6EC(PlayState* play, Player* this) { Vec3f ripplePos; f32 temp1; f32 temp2; @@ -5853,12 +5847,12 @@ void func_8083D6EC(GlobalContext* globalCtx, Player* this) { ripplePos.x = (Rand_ZeroOne() * 10.0f) + this->actor.world.pos.x; ripplePos.y = this->actor.world.pos.y + this->actor.yDistToWater; ripplePos.z = (Rand_ZeroOne() * 10.0f) + this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 0); if ((this->linearVelocity > 4.0f) && !func_808332B8(this) && ((this->actor.world.pos.y + this->actor.yDistToWater) < this->bodyPartsPos[PLAYER_BODYPART_WAIST].y)) { - func_8083CFA8(globalCtx, this, 20.0f, + func_8083CFA8(play, this, 20.0f, (fabsf(this->linearVelocity) * 50.0f) + (this->actor.yDistToWater * 5.0f)); } } @@ -5877,7 +5871,7 @@ void func_8083D6EC(GlobalContext* globalCtx, Player* this) { } for (i = 0; i < numBubbles; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 20.0f, 10.0f, 20.0f, 0.13f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 20.0f, 10.0f, 20.0f, 0.13f); } } } @@ -5903,7 +5897,7 @@ s32 func_8083DB98(Player* this, s32 arg1) { static Vec3f D_8085456C = { 0.0f, 100.0f, 40.0f }; -void func_8083DC54(Player* this, GlobalContext* globalCtx) { +void func_8083DC54(Player* this, PlayState* play) { s16 sp46; s16 temp2; f32 temp1; @@ -5922,7 +5916,7 @@ void func_8083DC54(Player* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.focus.rot.x, -20000, 10, 4000, 800); } else { sp46 = 0; - temp1 = func_8083973C(globalCtx, this, &D_8085456C, &sp34); + temp1 = func_8083973C(play, this, &D_8085456C, &sp34); if (temp1 > BGCHECK_Y_MIN) { temp2 = Math_Atan2S(40.0f, this->actor.world.pos.y - temp1); sp46 = CLAMP(temp2, -4000, 4000); @@ -5934,7 +5928,7 @@ void func_8083DC54(Player* this, GlobalContext* globalCtx) { func_80836AB8(this, func_8002DD78(this) || func_808334B4(this)); } -void func_8083DDC8(Player* this, GlobalContext* globalCtx) { +void func_8083DDC8(Player* this, PlayState* play) { s16 temp1; s16 temp2; @@ -5949,7 +5943,7 @@ void func_8083DDC8(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->unk_6C0, temp2, 200); this->unk_6AE |= 0x168; } else { - func_8083DC54(this, globalCtx); + func_8083DC54(this, play); } } @@ -5980,7 +5974,7 @@ static struct_80854578 D_80854578[] = { { &gPlayerAnim_0033A8, -34.16f, 7.91f }, }; -s32 func_8083E0FC(Player* this, GlobalContext* globalCtx) { +s32 func_8083E0FC(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; f32 unk_04; f32 unk_08; @@ -5992,7 +5986,7 @@ s32 func_8083E0FC(Player* this, GlobalContext* globalCtx) { sp38 = Math_CosS(rideActor->actor.shape.rot.y); sp34 = Math_SinS(rideActor->actor.shape.rot.y); - func_80836898(globalCtx, this, func_8083A360); + func_80836898(play, this, func_8083A360); this->stateFlags1 |= PLAYER_STATE1_23; this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER; @@ -6013,12 +6007,12 @@ s32 func_8083E0FC(Player* this, GlobalContext* globalCtx) { this->unk_878 = rideActor->actor.world.pos.y - this->actor.world.pos.y; this->currentYaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; - Actor_MountHorse(globalCtx, this, &rideActor->actor); - func_80832264(globalCtx, this, D_80854578[temp].anim); - func_80832F54(globalCtx, this, 0x9B); + Actor_MountHorse(play, this, &rideActor->actor); + func_80832264(play, this, D_80854578[temp].anim); + func_80832F54(play, this, 0x9B); this->actor.parent = this->rideActor; func_80832224(this); - Actor_DisableLens(globalCtx); + Actor_DisableLens(play); return 1; } @@ -6038,7 +6032,7 @@ static LinkAnimationHeader* D_80854590[] = { &gPlayerAnim_0031D0, }; -s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* floorPoly) { +s32 func_8083E318(PlayState* play, Player* this, CollisionPoly* floorPoly) { s32 pad; s16 playerVelYaw; Vec3f slopeNormal; @@ -6047,8 +6041,8 @@ s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* floorPo f32 slopeSlowdownSpeedStep; s16 velYawToDownwardSlope; - if (!Player_InBlockingCsMode(globalCtx, this) && (func_8084F390 != this->func_674) && - (SurfaceType_GetSlope(&globalCtx->colCtx, floorPoly, this->actor.floorBgId) == 1)) { + if (!Player_InBlockingCsMode(play, this) && (func_8084F390 != this->func_674) && + (SurfaceType_GetSlope(&play->colCtx, floorPoly, this->actor.floorBgId) == 1)) { // Get direction of movement relative to the downward direction of the slope playerVelYaw = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); @@ -6068,12 +6062,12 @@ s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* floorPo Math_StepToF(&this->pushedSpeed, slopeSlowdownSpeed, slopeSlowdownSpeedStep); } else { // moving downward on the slope, causing player to slip - func_80835C58(globalCtx, this, func_8084F390, 0); - func_80832564(globalCtx, this); + func_80835C58(play, this, func_8084F390, 0); + func_80832564(play, this); if (D_80853610 >= 0) { this->unk_84F = 1; } - func_80832BE8(globalCtx, this, D_80854590[this->unk_84F]); + func_80832BE8(play, this, D_80854590[this->unk_84F]); this->linearVelocity = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z)); this->currentYaw = playerVelYaw; return true; @@ -6088,28 +6082,28 @@ static s32 D_80854598[] = { 0xFFDB0871, 0xF8310000, 0x00940470, 0xF3980000, 0xFFB504A9, 0x0C9F0000, 0x08010402, }; -void func_8083E4C4(GlobalContext* globalCtx, Player* this, GetItemEntry* giEntry) { +void func_8083E4C4(PlayState* play, Player* this, GetItemEntry* giEntry) { s32 dropType = giEntry->field & 0x1F; if (!(giEntry->field & 0x80)) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, dropType | 0x8000); + Item_DropCollectible(play, &this->actor.world.pos, dropType | 0x8000); if ((dropType != ITEM00_BOMBS_A) && (dropType != ITEM00_ARROWS_SMALL) && (dropType != ITEM00_ARROWS_MEDIUM) && (dropType != ITEM00_ARROWS_LARGE) && (dropType != ITEM00_RUPEE_GREEN) && (dropType != ITEM00_RUPEE_BLUE) && (dropType != ITEM00_RUPEE_RED) && (dropType != ITEM00_RUPEE_PURPLE) && (dropType != ITEM00_RUPEE_ORANGE)) { - Item_Give(globalCtx, giEntry->itemId); + Item_Give(play, giEntry->itemId); } } else { - Item_Give(globalCtx, giEntry->itemId); + Item_Give(play, giEntry->itemId); } func_80078884((this->getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM); } -s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { +s32 func_8083E5A8(Player* this, PlayState* play) { Actor* interactedActor; - if (iREG(67) || (((interactedActor = this->interactRangeActor) != NULL) && - TitleCard_Clear(globalCtx, &globalCtx->actorCtx.titleCtx))) { + if (iREG(67) || + (((interactedActor = this->interactRangeActor) != NULL) && TitleCard_Clear(play, &play->actorCtx.titleCtx))) { if (iREG(67) || (this->getItemId > GI_NONE)) { if (iREG(67)) { this->getItemId = iREG(68); @@ -6124,14 +6118,14 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { iREG(67) = false; - if ((Item_CheckObtainability(giEntry->itemId) == ITEM_NONE) || (globalCtx->sceneNum == SCENE_BOWLING)) { - func_808323B4(globalCtx, this); + if ((Item_CheckObtainability(giEntry->itemId) == ITEM_NONE) || (play->sceneNum == SCENE_BOWLING)) { + func_808323B4(play, this); func_8083AE40(this, giEntry->objectId); if (!(this->stateFlags2 & PLAYER_STATE2_10) || (this->currentBoots == PLAYER_BOOTS_IRON)) { - func_80836898(globalCtx, this, func_8083A434); - func_808322D0(globalCtx, this, &gPlayerAnim_002788); - func_80835EA4(globalCtx, 9); + func_80836898(play, this, func_8083A434); + func_808322D0(play, this, &gPlayerAnim_002788); + func_80835EA4(play, 9); } this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_11 | PLAYER_STATE1_29; @@ -6139,7 +6133,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { return 1; } - func_8083E4C4(globalCtx, this, giEntry); + func_8083E4C4(play, this, giEntry); this->getItemId = GI_NONE; } } else if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && !(this->stateFlags1 & PLAYER_STATE1_11) && @@ -6156,7 +6150,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { } } - func_80836898(globalCtx, this, func_8083A434); + func_80836898(play, this, func_8083A434); this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_11 | PLAYER_STATE1_29; func_8083AE40(this, giEntry->objectId); this->actor.world.pos.x = @@ -6168,12 +6162,12 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { if ((giEntry->itemId != ITEM_NONE) && (giEntry->gi >= 0) && (Item_CheckObtainability(giEntry->itemId) == ITEM_NONE)) { - func_808322D0(globalCtx, this, this->ageProperties->unk_98); - func_80832F54(globalCtx, this, 0x28F); + func_808322D0(play, this, this->ageProperties->unk_98); + func_80832F54(play, this, 0x28F); chest->unk_1F4 = 1; - Camera_ChangeSetting(Play_GetCamera(globalCtx, CAM_ID_MAIN), CAM_SET_SLOW_CHEST_CS); + Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_SLOW_CHEST_CS); } else { - func_80832264(globalCtx, this, &gPlayerAnim_002DF8); + func_80832264(play, this, &gPlayerAnim_002DF8); chest->unk_1F4 = -1; } @@ -6187,13 +6181,13 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { this->itemActionParam = PLAYER_AP_NONE; this->modelAnimType = PLAYER_ANIMTYPE_0; this->heldItemActionParam = this->itemActionParam; - func_80836898(globalCtx, this, func_8083A0F4); + func_80836898(play, this, func_8083A0F4); if (sp24 == PLAYER_AP_SWORD_MASTER) { this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_AP_LAST_USED); - func_8083399C(globalCtx, this, PLAYER_AP_LAST_USED); + func_8083399C(play, this, PLAYER_AP_LAST_USED); } else { - func_80835F44(globalCtx, this, ITEM_LAST_USED); + func_80835F44(play, this, ITEM_LAST_USED); } } else { s32 strength = Player_GetStrength(); @@ -6203,7 +6197,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { return 0; } - func_80836898(globalCtx, this, func_8083A0F4); + func_80836898(play, this, func_8083A0F4); } func_80832224(this); @@ -6216,9 +6210,9 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { return 0; } -void func_8083EA94(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80846578, 1); - func_80832264(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_29, this->modelAnimType)); +void func_8083EA94(Player* this, PlayState* play) { + func_80835C58(play, this, func_80846578, 1); + func_80832264(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_29, this->modelAnimType)); } s32 func_8083EAF0(Player* this, Actor* actor) { @@ -6230,15 +6224,15 @@ s32 func_8083EAF0(Player* this, Actor* actor) { return 1; } -s32 func_8083EB44(Player* this, GlobalContext* globalCtx) { +s32 func_8083EB44(Player* this, PlayState* play) { if ((this->stateFlags1 & PLAYER_STATE1_11) && (this->heldActor != NULL) && CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { - if (!func_80835644(globalCtx, this, this->heldActor)) { + if (!func_80835644(play, this, this->heldActor)) { if (!func_8083EAF0(this, this->heldActor)) { - func_80835C58(globalCtx, this, func_808464B0, 1); - func_80832264(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_30, this->modelAnimType)); + func_80835C58(play, this, func_808464B0, 1); + func_80832264(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_30, this->modelAnimType)); } else { - func_8083EA94(this, globalCtx); + func_8083EA94(this, play); } } return 1; @@ -6247,14 +6241,13 @@ s32 func_8083EB44(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083EC18(Player* this, GlobalContext* globalCtx, u32 arg2) { +s32 func_8083EC18(Player* this, PlayState* play, u32 arg2) { if (this->wallHeight >= 79.0f) { if (!(this->stateFlags1 & PLAYER_STATE1_27) || (this->currentBoots == PLAYER_BOOTS_IRON) || (this->actor.yDistToWater < this->ageProperties->unk_2C)) { s32 sp8C = (arg2 & 8) ? 2 : 0; - if ((sp8C != 0) || (arg2 & 2) || - func_80041E4C(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { + if ((sp8C != 0) || (arg2 & 2) || func_80041E4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { f32 phi_f20; CollisionPoly* wallPoly = this->actor.wallPoly; f32 sp80; @@ -6274,7 +6267,7 @@ s32 func_8083EC18(Player* this, GlobalContext* globalCtx, u32 arg2) { Vec3f* sp44 = &sp50[0]; s32 pad; - CollisionPoly_GetVerticesByBgId(wallPoly, this->actor.wallBgId, &globalCtx->colCtx, sp50); + CollisionPoly_GetVerticesByBgId(wallPoly, this->actor.wallBgId, &play->colCtx, sp50); sp80 = phi_f12 = sp44->x; sp7C = phi_f14 = sp44->z; @@ -6315,7 +6308,7 @@ s32 func_8083EC18(Player* this, GlobalContext* globalCtx, u32 arg2) { f32 sp34 = this->wallDistance; LinkAnimationHeader* sp30; - func_80836898(globalCtx, this, func_8083A3B0); + func_80836898(play, this, func_8083A3B0); this->stateFlags1 |= PLAYER_STATE1_21; this->stateFlags1 &= ~PLAYER_STATE1_27; @@ -6344,8 +6337,8 @@ s32 func_8083EC18(Player* this, GlobalContext* globalCtx, u32 arg2) { this->actor.world.pos.z = (sp34 * wallPolyNormalZ) + sp7C; func_80832224(this); Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos); - func_80832264(globalCtx, this, sp30); - func_80832F54(globalCtx, this, 0x9F); + func_80832264(play, this, sp30); + func_80832F54(play, this, 0x9F); return 1; } @@ -6356,12 +6349,12 @@ s32 func_8083EC18(Player* this, GlobalContext* globalCtx, u32 arg2) { return 0; } -void func_8083F070(Player* this, LinkAnimationHeader* anim, GlobalContext* globalCtx) { - func_80835DAC(globalCtx, this, func_8084C5F8, 0); - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, (4.0f / 3.0f)); +void func_8083F070(Player* this, LinkAnimationHeader* anim, PlayState* play) { + func_80835DAC(play, this, func_8084C5F8, 0); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, (4.0f / 3.0f)); } -s32 func_8083F0C8(Player* this, GlobalContext* globalCtx, u32 arg2) { +s32 func_8083F0C8(Player* this, PlayState* play, u32 arg2) { CollisionPoly* wallPoly; Vec3f sp50[3]; f32 sp4C; @@ -6372,7 +6365,7 @@ s32 func_8083F0C8(Player* this, GlobalContext* globalCtx, u32 arg2) { if (!LINK_IS_ADULT && !(this->stateFlags1 & PLAYER_STATE1_27) && (arg2 & 0x30)) { wallPoly = this->actor.wallPoly; - CollisionPoly_GetVerticesByBgId(wallPoly, this->actor.wallBgId, &globalCtx->colCtx, sp50); + CollisionPoly_GetVerticesByBgId(wallPoly, this->actor.wallBgId, &play->colCtx, sp50); sp4C = phi_f2 = sp50[0].x; sp44 = phi_f12 = sp50[0].z; @@ -6404,15 +6397,15 @@ s32 func_8083F0C8(Player* this, GlobalContext* globalCtx, u32 arg2) { f32 wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); f32 sp30 = this->wallDistance; - func_80836898(globalCtx, this, func_8083A40C); + func_80836898(play, this, func_8083A40C); this->stateFlags2 |= PLAYER_STATE2_18; this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; this->actor.world.pos.x = sp4C + (sp30 * wallPolyNormalX); this->actor.world.pos.z = sp44 + (sp30 * wallPolyNormalZ); func_80832224(this); this->actor.prevPos = this->actor.world.pos; - func_80832264(globalCtx, this, &gPlayerAnim_002708); - func_80832F54(globalCtx, this, 0x9D); + func_80832264(play, this, &gPlayerAnim_002708); + func_80832F54(play, this, 0x9D); return 1; } @@ -6422,7 +6415,7 @@ s32 func_8083F0C8(Player* this, GlobalContext* globalCtx, u32 arg2) { return 0; } -s32 func_8083F360(GlobalContext* globalCtx, Player* this, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { +s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { CollisionPoly* wallPoly; s32 sp78; Vec3f sp6C; @@ -6443,14 +6436,14 @@ s32 func_8083F360(GlobalContext* globalCtx, Player* this, f32 arg1, f32 arg2, f3 sp60.z = this->actor.world.pos.z + (arg3 * yawCos); sp60.y = sp6C.y = this->actor.world.pos.y + arg1; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp6C, &sp60, &sp54, &this->actor.wallPoly, true, false, false, - true, &sp78)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &sp6C, &sp60, &sp54, &this->actor.wallPoly, true, false, false, true, + &sp78)) { wallPoly = this->actor.wallPoly; this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_WALL_INTERACT; this->actor.wallBgId = sp78; - D_808535F0 = func_80041DB8(&globalCtx->colCtx, wallPoly, sp78); + D_808535F0 = func_80041DB8(&play->colCtx, wallPoly, sp78); wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); @@ -6469,11 +6462,11 @@ s32 func_8083F360(GlobalContext* globalCtx, Player* this, f32 arg1, f32 arg2, f3 return 0; } -s32 func_8083F524(GlobalContext* globalCtx, Player* this) { - return func_8083F360(globalCtx, this, 26.0f, this->ageProperties->unk_38 + 5.0f, 30.0f, 0.0f); +s32 func_8083F524(PlayState* play, Player* this) { + return func_8083F360(play, this, 26.0f, this->ageProperties->unk_38 + 5.0f, 30.0f, 0.0f); } -s32 func_8083F570(Player* this, GlobalContext* globalCtx) { +s32 func_8083F570(Player* this, PlayState* play) { s16 temp; if ((this->linearVelocity != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (D_808535F0 & 0x30)) { @@ -6484,19 +6477,19 @@ s32 func_8083F570(Player* this, GlobalContext* globalCtx) { } if (ABS(temp) > 0x4000) { - func_80835C58(globalCtx, this, func_8084C81C, 0); + func_80835C58(play, this, func_8084C81C, 0); if (this->linearVelocity > 0.0f) { this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; - func_80832264(globalCtx, this, &gPlayerAnim_002700); - func_80832F54(globalCtx, this, 0x9D); - OnePointCutscene_Init(globalCtx, 9601, 999, NULL, CAM_ID_MAIN); + func_80832264(play, this, &gPlayerAnim_002700); + func_80832F54(play, this, 0x9D); + OnePointCutscene_Init(play, 9601, 999, NULL, CAM_ID_MAIN); } else { this->actor.shape.rot.y = this->actor.wallYaw; - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_002708, -1.0f, + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_002708, -1.0f, Animation_GetLastFrame(&gPlayerAnim_002708), 0.0f, ANIMMODE_ONCE, 0.0f); - func_80832F54(globalCtx, this, 0x9D); - OnePointCutscene_Init(globalCtx, 9602, 999, NULL, CAM_ID_MAIN); + func_80832F54(play, this, 0x9D); + OnePointCutscene_Init(play, 9602, 999, NULL, CAM_ID_MAIN); } this->currentYaw = this->actor.shape.rot.y; @@ -6509,25 +6502,25 @@ s32 func_8083F570(Player* this, GlobalContext* globalCtx) { return 0; } -void func_8083F72C(Player* this, LinkAnimationHeader* anim, GlobalContext* globalCtx) { - if (!func_80836898(globalCtx, this, func_8083A388)) { - func_80835C58(globalCtx, this, func_8084B78C, 0); +void func_8083F72C(Player* this, LinkAnimationHeader* anim, PlayState* play) { + if (!func_80836898(play, this, func_8083A388)) { + func_80835C58(play, this, func_8084B78C, 0); } - func_80832264(globalCtx, this, anim); + func_80832264(play, this, anim); func_80832224(this); this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; } -s32 func_8083F7BC(Player* this, GlobalContext* globalCtx) { +s32 func_8083F7BC(Player* this, PlayState* play) { DynaPolyActor* wallPolyActor; if (!(this->stateFlags1 & PLAYER_STATE1_11) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (D_80853608 < 0x3000)) { - if (((this->linearVelocity > 0.0f) && func_8083EC18(this, globalCtx, D_808535F0)) || - func_8083F0C8(this, globalCtx, D_808535F0)) { + if (((this->linearVelocity > 0.0f) && func_8083EC18(this, play, D_808535F0)) || + func_8083F0C8(this, play, D_808535F0)) { return 1; } @@ -6539,14 +6532,14 @@ s32 func_8083F7BC(Player* this, GlobalContext* globalCtx) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A)) { if ((this->actor.wallBgId != BGCHECK_SCENE) && - ((wallPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId)) != NULL)) { + ((wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId)) != NULL)) { if (wallPolyActor->actor.id == ACTOR_BG_HEAVY_BLOCK) { if (Player_GetStrength() < PLAYER_STR_GOLD_G) { return 0; } - func_80836898(globalCtx, this, func_8083A0F4); + func_80836898(play, this, func_8083A0F4); this->stateFlags1 |= PLAYER_STATE1_11; this->interactRangeActor = &wallPolyActor->actor; this->getItemId = GI_NONE; @@ -6561,7 +6554,7 @@ s32 func_8083F7BC(Player* this, GlobalContext* globalCtx) { this->unk_3C4 = NULL; } - func_8083F72C(this, &gPlayerAnim_0030F8, globalCtx); + func_8083F72C(this, &gPlayerAnim_0030F8, play); return 1; } @@ -6571,13 +6564,13 @@ s32 func_8083F7BC(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_8083F9D0(GlobalContext* globalCtx, Player* this) { +s32 func_8083F9D0(PlayState* play, Player* this) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && ((this->stateFlags2 & PLAYER_STATE2_4) || CHECK_BTN_ALL(sControlInput->cur.button, BTN_A))) { DynaPolyActor* wallPolyActor = NULL; if (this->actor.wallBgId != BGCHECK_SCENE) { - wallPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId); + wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); } if (&wallPolyActor->actor == this->unk_3C4) { @@ -6589,39 +6582,39 @@ s32 func_8083F9D0(GlobalContext* globalCtx, Player* this) { } } - func_80839FFC(this, globalCtx); - func_80832264(globalCtx, this, &gPlayerAnim_003100); + func_80839FFC(this, play); + func_80832264(play, this, &gPlayerAnim_003100); this->stateFlags2 &= ~PLAYER_STATE2_4; return 1; } -void func_8083FAB8(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084B898, 0); +void func_8083FAB8(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084B898, 0); this->stateFlags2 |= PLAYER_STATE2_4; - func_80832264(globalCtx, this, &gPlayerAnim_0030F0); + func_80832264(play, this, &gPlayerAnim_0030F0); } -void func_8083FB14(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084B9E4, 0); +void func_8083FB14(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084B9E4, 0); this->stateFlags2 |= PLAYER_STATE2_4; - func_80832264(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_35, this->modelAnimType)); + func_80832264(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_35, this->modelAnimType)); } -void func_8083FB7C(Player* this, GlobalContext* globalCtx) { +void func_8083FB7C(Player* this, PlayState* play) { this->stateFlags1 &= ~(PLAYER_STATE1_21 | PLAYER_STATE1_27); - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); this->linearVelocity = -0.4f; } -s32 func_8083FBC0(Player* this, GlobalContext* globalCtx) { +s32 func_8083FBC0(Player* this, PlayState* play) { if (!CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && ((D_808535F0 & 8) || (D_808535F0 & 2) || - func_80041E4C(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId))) { + func_80041E4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId))) { return 0; } - func_8083FB7C(this, globalCtx); + func_8083FB7C(this, play); func_80832698(this, NA_SE_VO_LI_AUTO_JUMP); return 1; } @@ -6645,7 +6638,7 @@ s32 func_8083FC68(Player* this, f32 arg1, s16 arg2) { return 0; } -s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, GlobalContext* globalCtx) { +s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { s16 sp2E = *arg2 - this->targetYaw; u16 sp2C = ABS(sp2E); @@ -6668,7 +6661,7 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, GlobalContext* globalCtx) if (this->unk_664 != NULL) { return func_8083FC68(this, *arg1, *arg2); } else { - func_8083DC54(this, globalCtx); + func_8083DC54(this, play); if ((*arg1 != 0.0f) && (sp2C < 6000)) { return 1; } else if (*arg1 > Math_SinS((0x4000 - (sp2C >> 1))) * 200.0f) { @@ -6698,11 +6691,11 @@ s32 func_8083FFB8(Player* this, f32* arg1, s16* arg2) { return 0; } -s32 func_80840058(Player* this, f32* arg1, s16* arg2, GlobalContext* globalCtx) { - func_8083DC54(this, globalCtx); +s32 func_80840058(Player* this, f32* arg1, s16* arg2, PlayState* play) { + func_8083DC54(this, play); if ((*arg1 != 0.0f) || (ABS(this->unk_87C) > 400)) { - s16 temp1 = *arg2 - Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); + s16 temp1 = *arg2 - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); u16 temp2 = (ABS(temp1) - 0x2000) & 0xFFFF; if ((temp2 < 0x4000) || (this->unk_87C != 0)) { @@ -6729,8 +6722,8 @@ void func_80840138(Player* this, f32 arg1, s16 arg2) { Math_StepToF(&this->unk_870, this->unk_874, 0.3f); } -void func_808401B0(GlobalContext* globalCtx, Player* this) { - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, func_808334E4(this), this->unk_868, func_80833528(this), +void func_808401B0(PlayState* play, Player* this) { + LinkAnimation_BlendToJoint(play, &this->skelAnime, func_808334E4(this), this->unk_868, func_80833528(this), this->unk_868, this->unk_870, this->blendTable); } @@ -6781,7 +6774,7 @@ void func_8084029C(Player* this, f32 arg1) { } } -void func_80840450(Player* this, GlobalContext* globalCtx) { +void func_80840450(Player* this, PlayState* play) { f32 sp44; s16 sp42; s32 temp1; @@ -6798,41 +6791,41 @@ void func_80840450(Player* this, GlobalContext* globalCtx) { } if (this->unk_850 != 0) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); - func_80832284(globalCtx, this, func_808334E4(this)); + func_80832284(play, this, func_808334E4(this)); this->unk_850 = 0; this->stateFlags3 &= ~PLAYER_STATE3_3; } func_80833C3C(this); } else { - func_808401B0(globalCtx, this); + func_808401B0(play, this); } func_8083721C(this); - if (!func_80837348(globalCtx, this, D_808543E0, 1)) { + if (!func_80837348(play, this, D_808543E0, 1)) { if (!func_80833B54(this) && (!func_80833B2C(this) || (func_80834B5C != this->func_82C))) { - func_8083CF10(this, globalCtx); + func_8083CF10(this, play); return; } - func_80837268(this, &sp44, &sp42, 0.0f, globalCtx); + func_80837268(this, &sp44, &sp42, 0.0f, play); temp1 = func_8083FC68(this, sp44, sp42); if (temp1 > 0) { - func_8083C8DC(this, globalCtx, sp42); + func_8083C8DC(this, play, sp42); return; } if (temp1 < 0) { - func_8083CBF0(this, sp42, globalCtx); + func_8083CBF0(this, sp42, play); return; } if (sp44 > 4.0f) { - func_8083CC9C(this, globalCtx); + func_8083CC9C(this, play); return; } @@ -6863,58 +6856,58 @@ void func_80840450(Player* this, GlobalContext* globalCtx) { } } -void func_808407CC(Player* this, GlobalContext* globalCtx) { +void func_808407CC(Player* this, PlayState* play) { f32 sp3C; s16 sp3A; s32 temp1; s16 temp2; s32 temp3; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); - func_80832264(globalCtx, this, func_80833338(this)); + func_80832264(play, this, func_80833338(this)); } func_8083721C(this); - if (!func_80837348(globalCtx, this, D_808543E8, 1)) { + if (!func_80837348(play, this, D_808543E8, 1)) { if (func_80833B54(this)) { - func_8083CEAC(this, globalCtx); + func_8083CEAC(this, play); return; } if (!func_80833B2C(this)) { - func_80835DAC(globalCtx, this, func_80840BC8, 1); + func_80835DAC(play, this, func_80840BC8, 1); this->currentYaw = this->actor.shape.rot.y; return; } if (func_80834B5C == this->func_82C) { - func_8083CEAC(this, globalCtx); + func_8083CEAC(this, play); return; } - func_80837268(this, &sp3C, &sp3A, 0.0f, globalCtx); + func_80837268(this, &sp3C, &sp3A, 0.0f, play); - temp1 = func_8083FD78(this, &sp3C, &sp3A, globalCtx); + temp1 = func_8083FD78(this, &sp3C, &sp3A, play); if (temp1 > 0) { - func_8083C8DC(this, globalCtx, sp3A); + func_8083C8DC(this, play, sp3A); return; } if (temp1 < 0) { - func_8083CB2C(this, sp3A, globalCtx); + func_8083CB2C(this, sp3A, play); return; } if (sp3C > 4.9f) { - func_8083CC9C(this, globalCtx); + func_8083CC9C(this, play); func_80833C3C(this); return; } if (sp3C != 0.0f) { - func_8083CB94(this, globalCtx); + func_8083CB94(this, play); return; } @@ -6922,12 +6915,12 @@ void func_808407CC(Player* this, GlobalContext* globalCtx) { temp3 = ABS(temp2); if (temp3 > 800) { - func_8083CD54(globalCtx, this, sp3A); + func_8083CD54(play, this, sp3A); } } } -void func_808409CC(GlobalContext* globalCtx, Player* this) { +void func_808409CC(PlayState* play, Player* this) { LinkAnimationHeader* anim; LinkAnimationHeader** animPtr; s32 heathIsCritical; @@ -6943,7 +6936,7 @@ void func_808409CC(GlobalContext* globalCtx, Player* this) { if (this->stateFlags1 & PLAYER_STATE1_11) { anim = func_80833338(this); } else { - sp38 = globalCtx->roomCtx.curRoom.behaviorType2; + sp38 = play->roomCtx.curRoom.behaviorType2; if (heathIsCritical) { if (this->unk_6AC >= 0) { sp38 = 7; @@ -6971,11 +6964,11 @@ void func_808409CC(GlobalContext* globalCtx, Player* this) { } } - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, (2.0f / 3.0f) * D_808535E8, 0.0f, - Animation_GetLastFrame(anim), ANIMMODE_ONCE, -6.0f); + LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f) * D_808535E8, 0.0f, Animation_GetLastFrame(anim), + ANIMMODE_ONCE, -6.0f); } -void func_80840BC8(Player* this, GlobalContext* globalCtx) { +void func_80840BC8(Player* this, PlayState* play) { s32 sp44; s32 sp40; f32 sp3C; @@ -6983,7 +6976,7 @@ void func_80840BC8(Player* this, GlobalContext* globalCtx) { s16 temp; sp44 = func_80833350(this); - sp40 = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp40 = LinkAnimation_Update(play, &this->skelAnime); if (sp44 > 0) { func_808333FC(this, sp44 - 1); @@ -6997,47 +6990,47 @@ void func_80840BC8(Player* this, GlobalContext* globalCtx) { this->skelAnime.jointTable[0].y = (this->skelAnime.jointTable[0].y + ((this->unk_850 & 1) * 0x50)) - 0x28; } else { func_80832DBC(this); - func_808409CC(globalCtx, this); + func_808409CC(play, this); } } func_8083721C(this); if (this->unk_850 == 0) { - if (!func_80837348(globalCtx, this, D_80854418, 1)) { + if (!func_80837348(play, this, D_80854418, 1)) { if (func_80833B54(this)) { - func_8083CEAC(this, globalCtx); + func_8083CEAC(this, play); return; } if (func_80833B2C(this)) { - func_80839F30(this, globalCtx); + func_80839F30(this, play); return; } - func_80837268(this, &sp3C, &sp3A, 0.018f, globalCtx); + func_80837268(this, &sp3C, &sp3A, 0.018f, play); if (sp3C != 0.0f) { - func_8083C8DC(this, globalCtx, sp3A); + func_8083C8DC(this, play, sp3A); return; } temp = sp3A - this->actor.shape.rot.y; if (ABS(temp) > 800) { - func_8083CD54(globalCtx, this, sp3A); + func_8083CD54(play, this, sp3A); return; } Math_ScaledStepToS(&this->actor.shape.rot.y, sp3A, 1200); this->currentYaw = this->actor.shape.rot.y; if (func_80833338(this) == this->skelAnime.animation) { - func_8083DC54(this, globalCtx); + func_8083DC54(this, play); } } } } -void func_80840DE4(Player* this, GlobalContext* globalCtx) { +void func_80840DE4(Player* this, PlayState* play) { f32 frames; f32 coeff; f32 sp44; @@ -7071,44 +7064,44 @@ void func_80840DE4(Player* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = direction * (this->linearVelocity * coeff); - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 0.0f) || LinkAnimation_OnFrame(&this->skelAnime, frames * 0.5f)) { func_808327F8(this, this->linearVelocity); } - if (!func_80837348(globalCtx, this, D_808543F4, 1)) { + if (!func_80837348(play, this, D_808543F4, 1)) { if (func_80833B54(this)) { - func_8083CEAC(this, globalCtx); + func_8083CEAC(this, play); return; } if (!func_80833B2C(this)) { - func_80853080(this, globalCtx); + func_80853080(this, play); return; } - func_80837268(this, &sp44, &sp42, 0.0f, globalCtx); - temp1 = func_8083FD78(this, &sp44, &sp42, globalCtx); + func_80837268(this, &sp44, &sp42, 0.0f, play); + temp1 = func_8083FD78(this, &sp44, &sp42, play); if (temp1 > 0) { - func_8083C8DC(this, globalCtx, sp42); + func_8083C8DC(this, play, sp42); return; } if (temp1 < 0) { - func_8083CB2C(this, sp42, globalCtx); + func_8083CB2C(this, sp42, play); return; } if (sp44 > 4.9f) { - func_8083CC9C(this, globalCtx); + func_8083CC9C(this, play); func_80833C3C(this); return; } if ((sp44 == 0.0f) && (this->linearVelocity == 0.0f)) { - func_80839F30(this, globalCtx); + func_80839F30(this, play); return; } @@ -7127,15 +7120,15 @@ void func_80840DE4(Player* this, GlobalContext* globalCtx) { } } -void func_80841138(Player* this, GlobalContext* globalCtx) { +void func_80841138(Player* this, PlayState* play) { f32 temp1; f32 temp2; if (this->unk_864 < 1.0f) { temp1 = R_UPDATE_RATE * 0.5f; func_8084029C(this, REG(35) / 1000.0f); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, - GET_PLAYER_ANIM(PLAYER_ANIMGROUP_31, this->modelAnimType), this->unk_868); + LinkAnimation_LoadToJoint(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_31, this->modelAnimType), + this->unk_868); this->unk_864 += 1 * temp1; if (this->unk_864 >= 1.0f) { this->unk_864 = 1.0f; @@ -7146,8 +7139,8 @@ void func_80841138(Player* this, GlobalContext* globalCtx) { if (temp2 < 0.0f) { temp1 = 1.0f; func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->linearVelocity)); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, - GET_PLAYER_ANIM(PLAYER_ANIMGROUP_31, this->modelAnimType), this->unk_868); + LinkAnimation_LoadToJoint(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_31, this->modelAnimType), + this->unk_868); } else { temp1 = (REG(37) / 1000.0f) * temp2; if (temp1 < 1.0f) { @@ -7156,26 +7149,25 @@ void func_80841138(Player* this, GlobalContext* globalCtx) { temp1 = 1.0f; func_8084029C(this, 1.2f + ((REG(38) / 1000.0f) * temp2)); } - LinkAnimation_LoadToMorph(globalCtx, &this->skelAnime, - GET_PLAYER_ANIM(PLAYER_ANIMGROUP_31, this->modelAnimType), this->unk_868); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, &gPlayerAnim_002DD0, - this->unk_868 * (16.0f / 29.0f)); + LinkAnimation_LoadToMorph(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_31, this->modelAnimType), + this->unk_868); + LinkAnimation_LoadToJoint(play, &this->skelAnime, &gPlayerAnim_002DD0, this->unk_868 * (16.0f / 29.0f)); } } if (temp1 < 1.0f) { - LinkAnimation_InterpJointMorph(globalCtx, &this->skelAnime, 1.0f - temp1); + LinkAnimation_InterpJointMorph(play, &this->skelAnime, 1.0f - temp1); } } -void func_8084140C(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084170C, 1); - func_80832B0C(globalCtx, this, &gPlayerAnim_002DA0); +void func_8084140C(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084170C, 1); + func_80832B0C(play, this, &gPlayerAnim_002DA0); } -s32 func_80841458(Player* this, f32* arg1, s16* arg2, GlobalContext* globalCtx) { +s32 func_80841458(Player* this, f32* arg1, s16* arg2, PlayState* play) { if (this->linearVelocity > 6.0f) { - func_8084140C(this, globalCtx); + func_8084140C(this, play); return 1; } @@ -7191,31 +7183,31 @@ s32 func_80841458(Player* this, f32* arg1, s16* arg2, GlobalContext* globalCtx) return 0; } -void func_808414F8(Player* this, GlobalContext* globalCtx) { +void func_808414F8(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 sp2C; s16 sp2A; - func_80841138(this, globalCtx); + func_80841138(this, play); - if (!func_80837348(globalCtx, this, D_80854400, 1)) { + if (!func_80837348(play, this, D_80854400, 1)) { if (!func_80833C04(this)) { - func_8083C8DC(this, globalCtx, this->currentYaw); + func_8083C8DC(this, play, this->currentYaw); return; } - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); - sp2C = func_8083FD78(this, &sp34, &sp32, globalCtx); + func_80837268(this, &sp34, &sp32, 0.0f, play); + sp2C = func_8083FD78(this, &sp34, &sp32, play); if (sp2C >= 0) { - if (!func_80841458(this, &sp34, &sp32, globalCtx)) { + if (!func_80841458(this, &sp34, &sp32, play)) { if (sp2C != 0) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); } else if (sp34 > 4.9f) { - func_8083CC9C(this, globalCtx); + func_8083CC9C(this, play); } else { - func_8083CB94(this, globalCtx); + func_8083CB94(this, play); } } } else { @@ -7225,53 +7217,53 @@ void func_808414F8(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->currentYaw, sp32, sp2A * 0.1f); if ((sp34 == 0.0f) && (this->linearVelocity == 0.0f)) { - func_80839F30(this, globalCtx); + func_80839F30(this, play); } } } } -void func_808416C0(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_808417FC, 1); - func_80832264(globalCtx, this, &gPlayerAnim_002DA8); +void func_808416C0(Player* this, PlayState* play) { + func_80835C58(play, this, func_808417FC, 1); + func_80832264(play, this, &gPlayerAnim_002DA8); } -void func_8084170C(Player* this, GlobalContext* globalCtx) { +void func_8084170C(Player* this, PlayState* play) { s32 sp34; f32 sp30; s16 sp2E; - sp34 = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp34 = LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); - if (!func_80837348(globalCtx, this, D_80854400, 1)) { - func_80837268(this, &sp30, &sp2E, 0.0f, globalCtx); + if (!func_80837348(play, this, D_80854400, 1)) { + func_80837268(this, &sp30, &sp2E, 0.0f, play); if (this->linearVelocity == 0.0f) { this->currentYaw = this->actor.shape.rot.y; - if (func_8083FD78(this, &sp30, &sp2E, globalCtx) > 0) { - func_8083C858(this, globalCtx); + if (func_8083FD78(this, &sp30, &sp2E, play) > 0) { + func_8083C858(this, play); } else if ((sp30 != 0.0f) || (sp34 != 0)) { - func_808416C0(this, globalCtx); + func_808416C0(this, play); } } } } -void func_808417FC(Player* this, GlobalContext* globalCtx) { +void func_808417FC(Player* this, PlayState* play) { s32 sp1C; - sp1C = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp1C = LinkAnimation_Update(play, &this->skelAnime); - if (!func_80837348(globalCtx, this, D_80854400, 1)) { + if (!func_80837348(play, this, D_80854400, 1)) { if (sp1C != 0) { - func_80839F30(this, globalCtx); + func_80839F30(this, play); } } } -void func_80841860(GlobalContext* globalCtx, Player* this) { +void func_80841860(PlayState* play, Player* this) { f32 frame; LinkAnimationHeader* sp38 = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_24, this->modelAnimType); LinkAnimationHeader* sp34 = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_25, this->modelAnimType); @@ -7281,51 +7273,51 @@ void func_80841860(GlobalContext* globalCtx, Player* this) { func_8084029C(this, (REG(30) / 1000.0f) + ((REG(32) / 1000.0f) * this->linearVelocity)); frame = this->unk_868 * (16.0f / 29.0f); - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, sp34, frame, sp38, frame, this->unk_870, this->blendTable); + LinkAnimation_BlendToJoint(play, &this->skelAnime, sp34, frame, sp38, frame, this->unk_870, this->blendTable); } -void func_8084193C(Player* this, GlobalContext* globalCtx) { +void func_8084193C(Player* this, PlayState* play) { f32 sp3C; s16 sp3A; s32 temp1; s16 temp2; s32 temp3; - func_80841860(globalCtx, this); + func_80841860(play, this); - if (!func_80837348(globalCtx, this, D_80854408, 1)) { + if (!func_80837348(play, this, D_80854408, 1)) { if (!func_80833C04(this)) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } - func_80837268(this, &sp3C, &sp3A, 0.0f, globalCtx); + func_80837268(this, &sp3C, &sp3A, 0.0f, play); if (func_80833B2C(this)) { - temp1 = func_8083FD78(this, &sp3C, &sp3A, globalCtx); + temp1 = func_8083FD78(this, &sp3C, &sp3A, play); } else { temp1 = func_8083FC68(this, sp3C, sp3A); } if (temp1 > 0) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } if (temp1 < 0) { if (func_80833B2C(this)) { - func_8083CB2C(this, sp3A, globalCtx); + func_8083CB2C(this, sp3A, play); } else { - func_8083CBF0(this, sp3A, globalCtx); + func_8083CBF0(this, sp3A, play); } return; } if ((this->linearVelocity < 3.6f) && (sp3C < 4.0f)) { if (!func_8008E9C4(this) && func_80833B2C(this)) { - func_8083CB94(this, globalCtx); + func_8083CB94(this, play); } else { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } return; } @@ -7348,34 +7340,34 @@ void func_8084193C(Player* this, GlobalContext* globalCtx) { } } -void func_80841BA8(Player* this, GlobalContext* globalCtx) { +void func_80841BA8(Player* this, PlayState* play) { f32 sp34; s16 sp32; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (Player_HoldsTwoHandedWeapon(this)) { - AnimationContext_SetLoadFrame(globalCtx, func_80833338(this), 0, this->skelAnime.limbCount, + AnimationContext_SetLoadFrame(play, func_80833338(this), 0, this->skelAnime.limbCount, this->skelAnime.morphTable); - AnimationContext_SetCopyTrue(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime.morphTable, D_80853410); } - func_80837268(this, &sp34, &sp32, 0.018f, globalCtx); + func_80837268(this, &sp34, &sp32, 0.018f, play); - if (!func_80837348(globalCtx, this, D_80854414, 1)) { + if (!func_80837348(play, this, D_80854414, 1)) { if (sp34 != 0.0f) { this->actor.shape.rot.y = sp32; - func_8083C858(this, globalCtx); + func_8083C858(this, play); } else if (Math_ScaledStepToS(&this->actor.shape.rot.y, sp32, this->unk_87E)) { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } this->currentYaw = this->actor.shape.rot.y; } } -void func_80841CC4(Player* this, s32 arg1, GlobalContext* globalCtx) { +void func_80841CC4(Player* this, s32 arg1, PlayState* play) { LinkAnimationHeader* anim; s16 target; f32 rate; @@ -7390,11 +7382,11 @@ void func_80841CC4(Player* this, s32 arg1, GlobalContext* globalCtx) { if ((this->modelAnimType == PLAYER_ANIMTYPE_3) || ((this->unk_89C == 0) && (this->unk_6C4 <= 0.0f))) { if (arg1 == 0) { - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, - GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), this->unk_868); + LinkAnimation_LoadToJoint(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), + this->unk_868); } else { - LinkAnimation_LoadToMorph(globalCtx, &this->skelAnime, - GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), this->unk_868); + LinkAnimation_LoadToMorph(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), + this->unk_868); } return; } @@ -7419,17 +7411,15 @@ void func_80841CC4(Player* this, s32 arg1, GlobalContext* globalCtx) { } if (arg1 == 0) { - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, - GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), this->unk_868, anim, - this->unk_868, rate, this->blendTable); + LinkAnimation_BlendToJoint(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), + this->unk_868, anim, this->unk_868, rate, this->blendTable); } else { - LinkAnimation_BlendToMorph(globalCtx, &this->skelAnime, - GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), this->unk_868, anim, - this->unk_868, rate, this->blendTable); + LinkAnimation_BlendToMorph(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), + this->unk_868, anim, this->unk_868, rate, this->blendTable); } } -void func_80841EE4(Player* this, GlobalContext* globalCtx) { +void func_80841EE4(Player* this, PlayState* play) { f32 temp1; f32 temp2; @@ -7437,7 +7427,7 @@ void func_80841EE4(Player* this, GlobalContext* globalCtx) { temp1 = R_UPDATE_RATE * 0.5f; func_8084029C(this, REG(35) / 1000.0f); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), + LinkAnimation_LoadToJoint(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_1, this->modelAnimType), this->unk_868); this->unk_864 += 1 * temp1; @@ -7453,7 +7443,7 @@ void func_80841EE4(Player* this, GlobalContext* globalCtx) { temp1 = 1.0f; func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->linearVelocity)); - func_80841CC4(this, 0, globalCtx); + func_80841CC4(this, 0, play); } else { temp1 = (REG(37) / 1000.0f) * temp2; if (temp1 < 1.0f) { @@ -7463,128 +7453,127 @@ void func_80841EE4(Player* this, GlobalContext* globalCtx) { func_8084029C(this, 1.2f + ((REG(38) / 1000.0f) * temp2)); } - func_80841CC4(this, 1, globalCtx); + func_80841CC4(this, 1, play); - LinkAnimation_LoadToJoint(globalCtx, &this->skelAnime, func_80833438(this), - this->unk_868 * (20.0f / 29.0f)); + LinkAnimation_LoadToJoint(play, &this->skelAnime, func_80833438(this), this->unk_868 * (20.0f / 29.0f)); } } if (temp1 < 1.0f) { - LinkAnimation_InterpJointMorph(globalCtx, &this->skelAnime, 1.0f - temp1); + LinkAnimation_InterpJointMorph(play, &this->skelAnime, 1.0f - temp1); } } -void func_80842180(Player* this, GlobalContext* globalCtx) { +void func_80842180(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; this->stateFlags2 |= PLAYER_STATE2_5; - func_80841EE4(this, globalCtx); + func_80841EE4(this, play); - if (!func_80837348(globalCtx, this, D_80854424, 1)) { + if (!func_80837348(play, this, D_80854424, 1)) { if (func_80833C04(this)) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } - func_80837268(this, &sp2C, &sp2A, 0.018f, globalCtx); + func_80837268(this, &sp2C, &sp2A, 0.018f, play); if (!func_8083C484(this, &sp2C, &sp2A)) { func_8083DF68(this, sp2C, sp2A); - func_8083DDC8(this, globalCtx); + func_8083DDC8(this, play); if ((this->linearVelocity == 0.0f) && (sp2C == 0.0f)) { - func_8083C0B8(this, globalCtx); + func_8083C0B8(this, play); } } } } -void func_8084227C(Player* this, GlobalContext* globalCtx) { +void func_8084227C(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; this->stateFlags2 |= PLAYER_STATE2_5; - func_80841EE4(this, globalCtx); + func_80841EE4(this, play); - if (!func_80837348(globalCtx, this, D_80854430, 1)) { + if (!func_80837348(play, this, D_80854430, 1)) { if (!func_80833C04(this)) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } - func_80837268(this, &sp2C, &sp2A, 0.0f, globalCtx); + func_80837268(this, &sp2C, &sp2A, 0.0f, play); if (!func_8083C484(this, &sp2C, &sp2A)) { - if ((func_80833B2C(this) && (sp2C != 0.0f) && (func_8083FD78(this, &sp2C, &sp2A, globalCtx) <= 0)) || + if ((func_80833B2C(this) && (sp2C != 0.0f) && (func_8083FD78(this, &sp2C, &sp2A, play) <= 0)) || (!func_80833B2C(this) && (func_8083FC68(this, sp2C, sp2A) <= 0))) { - func_80839F90(this, globalCtx); + func_80839F90(this, play); return; } func_8083DF68(this, sp2C, sp2A); - func_8083DDC8(this, globalCtx); + func_8083DDC8(this, play); if ((this->linearVelocity == 0) && (sp2C == 0)) { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } } } } -void func_808423EC(Player* this, GlobalContext* globalCtx) { +void func_808423EC(Player* this, PlayState* play) { s32 sp34; f32 sp30; s16 sp2E; - sp34 = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp34 = LinkAnimation_Update(play, &this->skelAnime); - if (!func_80837348(globalCtx, this, D_80854408, 1)) { + if (!func_80837348(play, this, D_80854408, 1)) { if (!func_80833C04(this)) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } - func_80837268(this, &sp30, &sp2E, 0.0f, globalCtx); + func_80837268(this, &sp30, &sp2E, 0.0f, play); if ((this->skelAnime.morphWeight == 0.0f) && (this->skelAnime.curFrame > 5.0f)) { func_8083721C(this); if ((this->skelAnime.curFrame > 10.0f) && (func_8083FC68(this, sp30, sp2E) < 0)) { - func_8083CBF0(this, sp2E, globalCtx); + func_8083CBF0(this, sp2E, play); return; } if (sp34 != 0) { - func_8083CD00(this, globalCtx); + func_8083CD00(this, play); } } } } -void func_8084251C(Player* this, GlobalContext* globalCtx) { +void func_8084251C(Player* this, PlayState* play) { s32 sp34; f32 sp30; s16 sp2E; - sp34 = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp34 = LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); - if (!func_80837348(globalCtx, this, D_80854440, 1)) { - func_80837268(this, &sp30, &sp2E, 0.0f, globalCtx); + if (!func_80837348(play, this, D_80854440, 1)) { + func_80837268(this, &sp30, &sp2E, 0.0f, play); if (this->linearVelocity == 0.0f) { this->currentYaw = this->actor.shape.rot.y; if (func_8083FC68(this, sp30, sp2E) > 0) { - func_8083C858(this, globalCtx); + func_8083C858(this, play); return; } if ((sp30 != 0.0f) || (sp34 != 0)) { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } } } @@ -7599,32 +7588,32 @@ void func_8084260C(Vec3f* src, Vec3f* dest, f32 arg2, f32 arg3, f32 arg4) { static Vec3f D_808545B4 = { 0.0f, 0.0f, 0.0f }; static Vec3f D_808545C0 = { 0.0f, 0.0f, 0.0f }; -s32 func_8084269C(GlobalContext* globalCtx, Player* this) { +s32 func_8084269C(PlayState* play, Player* this) { Vec3f sp2C; if ((this->unk_89E == 0) || (this->unk_89E == 1)) { func_8084260C(&this->actor.shape.feetPos[FOOT_LEFT], &sp2C, this->actor.floorHeight - this->actor.shape.feetPos[FOOT_LEFT].y, 7.0f, 5.0f); - func_800286CC(globalCtx, &sp2C, &D_808545B4, &D_808545C0, 50, 30); + func_800286CC(play, &sp2C, &D_808545B4, &D_808545C0, 50, 30); func_8084260C(&this->actor.shape.feetPos[FOOT_RIGHT], &sp2C, this->actor.floorHeight - this->actor.shape.feetPos[FOOT_RIGHT].y, 7.0f, 5.0f); - func_800286CC(globalCtx, &this->actor.shape.feetPos[FOOT_RIGHT], &D_808545B4, &D_808545C0, 50, 30); + func_800286CC(play, &this->actor.shape.feetPos[FOOT_RIGHT], &D_808545B4, &D_808545C0, 50, 30); return 1; } return 0; } -void func_8084279C(Player* this, GlobalContext* globalCtx) { - func_80832CB0(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_33, this->modelAnimType)); +void func_8084279C(Player* this, PlayState* play) { + func_80832CB0(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_33, this->modelAnimType)); if (DECR(this->unk_850) == 0) { - if (!func_8083B040(this, globalCtx)) { - func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_34, this->modelAnimType), globalCtx); + if (!func_8083B040(this, play)) { + func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_34, this->modelAnimType), play); } this->actor.flags &= ~ACTOR_FLAG_8; - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); } } @@ -7638,9 +7627,9 @@ s32 func_8084285C(Player* this, f32 arg1, f32 arg2, f32 arg3) { return 0; } -s32 func_808428D8(Player* this, GlobalContext* globalCtx) { +s32 func_808428D8(Player* this, PlayState* play) { if (!Player_IsChildWithHylianShield(this) && (Player_GetMeleeWeaponHeld(this) != 0) && D_80853614) { - func_80832264(globalCtx, this, &gPlayerAnim_002EC8); + func_80832264(play, this, &gPlayerAnim_002EC8); this->unk_84F = 1; this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H; this->currentYaw = this->actor.shape.rot.y + this->unk_6BE; @@ -7650,37 +7639,36 @@ s32 func_808428D8(Player* this, GlobalContext* globalCtx) { return 0; } -s32 func_80842964(Player* this, GlobalContext* globalCtx) { - return func_8083B040(this, globalCtx) || func_8083B644(this, globalCtx) || func_8083E5A8(this, globalCtx); +s32 func_80842964(Player* this, PlayState* play) { + return func_8083B040(this, play) || func_8083B644(this, play) || func_8083E5A8(this, play); } -void func_808429B4(GlobalContext* globalCtx, s32 speed, s32 y, s32 countdown) { - s32 quakeIdx = Quake_Add(Play_GetCamera(globalCtx, CAM_ID_MAIN), 3); +void func_808429B4(PlayState* play, s32 speed, s32 y, s32 countdown) { + s32 quakeIdx = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3); Quake_SetSpeed(quakeIdx, speed); Quake_SetQuakeValues(quakeIdx, y, 0, 0, 0); Quake_SetCountdown(quakeIdx, countdown); } -void func_80842A28(GlobalContext* globalCtx, Player* this) { - func_808429B4(globalCtx, 27767, 7, 20); - globalCtx->actorCtx.unk_02 = 4; +void func_80842A28(PlayState* play, Player* this) { + func_808429B4(play, 27767, 7, 20); + play->actorCtx.unk_02 = 4; func_8083264C(this, 255, 20, 150, 0); func_8002F7DC(&this->actor, NA_SE_IT_HAMMER_HIT); } -void func_80842A88(GlobalContext* globalCtx, Player* this) { +void func_80842A88(PlayState* play, Player* this) { Inventory_ChangeAmmo(ITEM_STICK, -1); - func_80835F44(globalCtx, this, ITEM_NONE); + func_80835F44(play, this, ITEM_NONE); } -s32 func_80842AC4(GlobalContext* globalCtx, Player* this) { +s32 func_80842AC4(PlayState* play, Player* this) { if ((this->heldItemActionParam == PLAYER_AP_STICK) && (this->unk_85C > 0.5f)) { if (AMMO(ITEM_STICK) != 0) { - EffectSsStick_Spawn(globalCtx, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND], - this->actor.shape.rot.y + 0x8000); + EffectSsStick_Spawn(play, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND], this->actor.shape.rot.y + 0x8000); this->unk_85C = 0.5f; - func_80842A88(globalCtx, this); + func_80842A88(play, this); func_8002F7DC(&this->actor, NA_SE_IT_WOODSTICK_BROKEN); } @@ -7690,13 +7678,13 @@ s32 func_80842AC4(GlobalContext* globalCtx, Player* this) { return 0; } -s32 func_80842B7C(GlobalContext* globalCtx, Player* this) { +s32 func_80842B7C(PlayState* play, Player* this) { if (this->heldItemActionParam == PLAYER_AP_SWORD_BGS) { if (!gSaveContext.bgsFlag && (gSaveContext.swordHealth > 0.0f)) { if ((gSaveContext.swordHealth -= 1.0f) <= 0.0f) { - EffectSsStick_Spawn(globalCtx, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND], + EffectSsStick_Spawn(play, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND], this->actor.shape.rot.y + 0x8000); - func_800849EC(globalCtx); + func_800849EC(play); func_8002F7DC(&this->actor, NA_SE_IT_MAJIN_SWORD_BROKEN); } } @@ -7707,9 +7695,9 @@ s32 func_80842B7C(GlobalContext* globalCtx, Player* this) { return 0; } -void func_80842CF0(GlobalContext* globalCtx, Player* this) { - func_80842AC4(globalCtx, this); - func_80842B7C(globalCtx, this); +void func_80842CF0(PlayState* play, Player* this) { + func_80842AC4(play, this); + func_80842B7C(play, this); } static LinkAnimationHeader* D_808545CC[] = { @@ -7719,13 +7707,13 @@ static LinkAnimationHeader* D_808545CC[] = { &gPlayerAnim_002B18, }; -void func_80842D20(GlobalContext* globalCtx, Player* this) { +void func_80842D20(PlayState* play, Player* this) { s32 pad; s32 sp28; if (func_80843188 != this->func_674) { - func_80832440(globalCtx, this); - func_80835C58(globalCtx, this, func_808505DC, 0); + func_80832440(play, this); + func_80835C58(play, this, func_808505DC, 0); if (func_8008E9C4(this)) { sp28 = 2; @@ -7733,15 +7721,15 @@ void func_80842D20(GlobalContext* globalCtx, Player* this) { sp28 = 0; } - func_808322D0(globalCtx, this, D_808545CC[Player_HoldsTwoHandedWeapon(this) + sp28]); + func_808322D0(play, this, D_808545CC[Player_HoldsTwoHandedWeapon(this) + sp28]); } func_8083264C(this, 180, 20, 100, 0); this->linearVelocity = -18.0f; - func_80842CF0(globalCtx, this); + func_80842CF0(play, this); } -s32 func_80842DF4(GlobalContext* globalCtx, Player* this) { +s32 func_80842DF4(PlayState* play, Player* this) { f32 phi_f2; CollisionPoly* sp78; s32 sp74; @@ -7767,26 +7755,26 @@ s32 func_80842DF4(GlobalContext* globalCtx, Player* this) { sp68.y = this->meleeWeaponInfo[0].tip.y + (sp50.y * phi_f2); sp68.z = this->meleeWeaponInfo[0].tip.z + (sp50.z * phi_f2); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp68, &this->meleeWeaponInfo[0].tip, &sp5C, &sp78, - true, false, false, true, &sp74) && - !SurfaceType_IsIgnoredByEntities(&globalCtx->colCtx, sp78, sp74) && - (func_80041D4C(&globalCtx->colCtx, sp78, sp74) != 6) && - (func_8002F9EC(globalCtx, &this->actor, sp78, sp74, &sp5C) == 0)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &sp68, &this->meleeWeaponInfo[0].tip, &sp5C, &sp78, true, + false, false, true, &sp74) && + !SurfaceType_IsIgnoredByEntities(&play->colCtx, sp78, sp74) && + (func_80041D4C(&play->colCtx, sp78, sp74) != 6) && + (func_8002F9EC(play, &this->actor, sp78, sp74, &sp5C) == 0)) { if (this->heldItemActionParam == PLAYER_AP_HAMMER) { - func_80832630(globalCtx); - func_80842A28(globalCtx, this); - func_80842D20(globalCtx, this); + func_80832630(play); + func_80842A28(play, this); + func_80842D20(play, this); return 1; } if (this->linearVelocity >= 0.0f) { - sp48 = func_80041F10(&globalCtx->colCtx, sp78, sp74); + sp48 = func_80041F10(&play->colCtx, sp78, sp74); if (sp48 == 0xA) { - CollisionCheck_SpawnShieldParticlesWood(globalCtx, &sp5C, &this->actor.projectedPos); + CollisionCheck_SpawnShieldParticlesWood(play, &sp5C, &this->actor.projectedPos); } else { - CollisionCheck_SpawnShieldParticles(globalCtx, &sp5C); + CollisionCheck_SpawnShieldParticles(play, &sp5C); if (sp48 == 0xB) { func_8002F7DC(&this->actor, NA_SE_IT_WALL_HIT_SOFT); } else { @@ -7794,15 +7782,15 @@ s32 func_80842DF4(GlobalContext* globalCtx, Player* this) { } } - func_80842CF0(globalCtx, this); + func_80842CF0(play, this); this->linearVelocity = -14.0f; func_8083264C(this, 180, 20, 100, 0); } } } } else { - func_80842D20(globalCtx, this); - func_80832630(globalCtx); + func_80842D20(play, this); + func_80832630(play); return 1; } } @@ -7814,16 +7802,16 @@ s32 func_80842DF4(GlobalContext* globalCtx, Player* this) { Actor* at = this->meleeWeaponQuads[temp1 ? 1 : 0].base.at; if ((at != NULL) && (at->id != ACTOR_EN_KANBAN)) { - func_80832630(globalCtx); + func_80832630(play); } } - if ((func_80842AC4(globalCtx, this) == 0) && (this->heldItemActionParam != PLAYER_AP_HAMMER)) { - func_80842B7C(globalCtx, this); + if ((func_80842AC4(play, this) == 0) && (this->heldItemActionParam != PLAYER_AP_HAMMER)) { + func_80842B7C(play, this); if (this->actor.colChkInfo.atHitEffect == 1) { this->actor.colChkInfo.damage = 8; - func_80837C0C(globalCtx, this, 4, 0.0f, 0.0f, this->actor.shape.rot.y, 20); + func_80837C0C(play, this, 4, 0.0f, 0.0f, this->actor.shape.rot.y, 20); return 1; } } @@ -7833,7 +7821,7 @@ s32 func_80842DF4(GlobalContext* globalCtx, Player* this) { return 0; } -void func_80843188(Player* this, GlobalContext* globalCtx) { +void func_80843188(Player* this, PlayState* play) { f32 sp54; f32 sp50; s16 sp4E; @@ -7843,9 +7831,9 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { s16 sp46; f32 sp40; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (!Player_IsChildWithHylianShield(this)) { - func_80832284(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_21, this->modelAnimType)); + func_80832284(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_21, this->modelAnimType)); } this->unk_850 = 1; this->unk_84F = 0; @@ -7853,7 +7841,7 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { if (!Player_IsChildWithHylianShield(this)) { this->stateFlags1 |= PLAYER_STATE1_22; - func_80836670(this, globalCtx); + func_80836670(this, play); this->stateFlags1 &= ~PLAYER_STATE1_22; } @@ -7862,7 +7850,7 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { if (this->unk_850 != 0) { sp54 = sControlInput->rel.stick_y * 100; sp50 = sControlInput->rel.stick_x * -120; - sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); + sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); sp40 = Math_CosS(sp4E); sp4C = (Math_SinS(sp4E) * sp50) + (sp54 * sp40); @@ -7888,7 +7876,7 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->unk_6BE, sp4A, sp46); if (this->unk_84F != 0) { - if (!func_80842DF4(globalCtx, this)) { + if (!func_80842DF4(play, this)) { if (this->skelAnime.curFrame < 2.0f) { func_80833A20(this, 1); } @@ -7896,23 +7884,23 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { this->unk_850 = 1; this->unk_84F = 0; } - } else if (!func_80842964(this, globalCtx)) { - if (func_8083C2B0(this, globalCtx)) { - func_808428D8(this, globalCtx); + } else if (!func_80842964(this, play)) { + if (func_8083C2B0(this, play)) { + func_808428D8(this, play); } else { this->stateFlags1 &= ~PLAYER_STATE1_22; func_80832318(this); if (Player_IsChildWithHylianShield(this)) { - func_8083A060(this, globalCtx); - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_002400, 1.0f, + func_8083A060(this, play); + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_002400, 1.0f, Animation_GetLastFrame(&gPlayerAnim_002400), 0.0f, ANIMMODE_ONCE, 0.0f); - func_80832F54(globalCtx, this, 4); + func_80832F54(play, this, 4); } else { if (this->itemActionParam < 0) { func_8008EC70(this); } - func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_22, this->modelAnimType), globalCtx); + func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_22, this->modelAnimType), play); } func_8002F7DC(&this->actor, NA_SE_IT_SHIELD_REMOVE); @@ -7929,7 +7917,7 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { this->unk_6AE |= 0xC1; } -void func_808435C4(Player* this, GlobalContext* globalCtx) { +void func_808435C4(Player* this, PlayState* play) { s32 temp; LinkAnimationHeader* anim; f32 frames; @@ -7937,35 +7925,35 @@ void func_808435C4(Player* this, GlobalContext* globalCtx) { func_8083721C(this); if (this->unk_84F == 0) { - D_808535E0 = func_80836670(this, globalCtx); - if ((func_80834B5C == this->func_82C) || (func_808374A0(globalCtx, this, &this->skelAnime2, 4.0f) > 0)) { - func_80835C58(globalCtx, this, func_80840450, 1); + D_808535E0 = func_80836670(this, play); + if ((func_80834B5C == this->func_82C) || (func_808374A0(play, this, &this->skelAnime2, 4.0f) > 0)) { + func_80835C58(play, this, func_80840450, 1); } } else { - temp = func_808374A0(globalCtx, this, &this->skelAnime, 4.0f); - if ((temp != 0) && ((temp > 0) || LinkAnimation_Update(globalCtx, &this->skelAnime))) { - func_80835C58(globalCtx, this, func_80843188, 1); + temp = func_808374A0(play, this, &this->skelAnime, 4.0f); + if ((temp != 0) && ((temp > 0) || LinkAnimation_Update(play, &this->skelAnime))) { + func_80835C58(play, this, func_80843188, 1); this->stateFlags1 |= PLAYER_STATE1_22; Player_SetModelsForHoldingShield(this); anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_20, this->modelAnimType); frames = Animation_GetLastFrame(anim); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, 1.0f, frames, frames, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, frames, frames, ANIMMODE_ONCE, 0.0f); } } } -void func_8084370C(Player* this, GlobalContext* globalCtx) { +void func_8084370C(Player* this, PlayState* play) { s32 sp1C; func_8083721C(this); - sp1C = func_808374A0(globalCtx, this, &this->skelAnime, 16.0f); - if ((sp1C != 0) && (LinkAnimation_Update(globalCtx, &this->skelAnime) || (sp1C > 0))) { - func_80839F90(this, globalCtx); + sp1C = func_808374A0(play, this, &this->skelAnime, 16.0f); + if ((sp1C != 0) && (LinkAnimation_Update(play, &this->skelAnime) || (sp1C > 0))) { + func_80839F90(this, play); } } -void func_8084377C(Player* this, GlobalContext* globalCtx) { +void func_8084377C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; func_808382BC(this); @@ -7986,22 +7974,22 @@ void func_8084377C(Player* this, GlobalContext* globalCtx) { } } - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->unk_850 != 0) { this->unk_850--; if (this->unk_850 == 0) { - func_80853080(this, globalCtx); + func_80853080(this, play); } } else if ((this->stateFlags1 & PLAYER_STATE1_29) || (!(this->cylinder.base.acFlags & AC_HIT) && (this->unk_8A1 == 0))) { if (this->stateFlags1 & PLAYER_STATE1_29) { this->unk_850++; } else { - func_80835C58(globalCtx, this, func_80843954, 0); + func_80835C58(play, this, func_80843954, 0); this->stateFlags1 |= PLAYER_STATE1_26; } - func_80832264(globalCtx, this, + func_80832264(play, this, (this->currentYaw != this->actor.shape.rot.y) ? &gPlayerAnim_002F60 : &gPlayerAnim_002DB8); func_80832698(this, NA_SE_VO_LI_FREEZE); } @@ -8012,21 +8000,21 @@ void func_8084377C(Player* this, GlobalContext* globalCtx) { } } -void func_80843954(Player* this, GlobalContext* globalCtx) { +void func_80843954(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; func_808382BC(this); func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->linearVelocity == 0.0f)) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->linearVelocity == 0.0f)) { if (this->stateFlags1 & PLAYER_STATE1_29) { this->unk_850++; } else { - func_80835C58(globalCtx, this, func_80843A38, 0); + func_80835C58(play, this, func_80843A38, 0); this->stateFlags1 |= PLAYER_STATE1_26; } - func_808322D0(globalCtx, this, + func_808322D0(play, this, (this->currentYaw != this->actor.shape.rot.y) ? &gPlayerAnim_002F68 : &gPlayerAnim_002DC0); this->currentYaw = this->actor.shape.rot.y; } @@ -8037,18 +8025,18 @@ static struct_80832924 D_808545DC[] = { { 0, -0x401E }, }; -void func_80843A38(Player* this, GlobalContext* globalCtx) { +void func_80843A38(Player* this, PlayState* play) { s32 sp24; this->stateFlags2 |= PLAYER_STATE2_5; func_808382BC(this); if (this->stateFlags1 & PLAYER_STATE1_29) { - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); } else { - sp24 = func_808374A0(globalCtx, this, &this->skelAnime, 16.0f); - if ((sp24 != 0) && (LinkAnimation_Update(globalCtx, &this->skelAnime) || (sp24 > 0))) { - func_80839F90(this, globalCtx); + sp24 = func_808374A0(play, this, &this->skelAnime, 16.0f); + if ((sp24 != 0) && (LinkAnimation_Update(play, &this->skelAnime) || (sp24 > 0))) { + func_80839F90(this, play); } } @@ -8057,16 +8045,16 @@ void func_80843A38(Player* this, GlobalContext* globalCtx) { static Vec3f D_808545E4 = { 0.0f, 0.0f, 5.0f }; -void func_80843AE8(GlobalContext* globalCtx, Player* this) { +void func_80843AE8(PlayState* play, Player* this) { if (this->unk_850 != 0) { if (this->unk_850 > 0) { this->unk_850--; if (this->unk_850 == 0) { if (this->stateFlags1 & PLAYER_STATE1_27) { - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_003328, 1.0f, 0.0f, + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_003328, 1.0f, 0.0f, Animation_GetLastFrame(&gPlayerAnim_003328), ANIMMODE_ONCE, -16.0f); } else { - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_002878, 1.0f, 99.0f, + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_002878, 1.0f, 99.0f, Animation_GetLastFrame(&gPlayerAnim_002878), ANIMMODE_ONCE, 0.0f); } gSaveContext.healthAccumulator = 0x140; @@ -8075,9 +8063,9 @@ void func_80843AE8(GlobalContext* globalCtx, Player* this) { } else if (gSaveContext.healthAccumulator == 0) { this->stateFlags1 &= ~PLAYER_STATE1_7; if (this->stateFlags1 & PLAYER_STATE1_27) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } else { - func_80853080(this, globalCtx); + func_80853080(this, play); } this->unk_A87 = 20; func_80837AFC(this, -20); @@ -8085,11 +8073,11 @@ void func_80843AE8(GlobalContext* globalCtx, Player* this) { } } else if (this->unk_84F != 0) { this->unk_850 = 60; - Player_SpawnFairy(globalCtx, this, &this->actor.world.pos, &D_808545E4, FAIRY_REVIVE_DEATH); + Player_SpawnFairy(play, this, &this->actor.world.pos, &D_808545E4, FAIRY_REVIVE_DEATH); func_8002F7DC(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); - OnePointCutscene_Init(globalCtx, 9908, 125, &this->actor, CAM_ID_MAIN); - } else if (globalCtx->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) { - globalCtx->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU; + OnePointCutscene_Init(play, 9908, 125, &this->actor, CAM_ID_MAIN); + } else if (play->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) { + play->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU; } } @@ -8100,20 +8088,20 @@ static struct_80832924 D_808545F0[] = { { 0, -0x40AA }, }; -void func_80843CEC(Player* this, GlobalContext* globalCtx) { +void func_80843CEC(Player* this, PlayState* play) { if (this->currentTunic != PLAYER_TUNIC_GORON) { - if ((globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (D_808535E4 == 9) || + if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (D_808535E4 == 9) || ((func_80838144(D_808535E4) >= 0) && - !SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { + !SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { func_8083821C(this); } } func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->actor.category == ACTORCAT_PLAYER) { - func_80843AE8(globalCtx, this); + func_80843AE8(play, this); } return; } @@ -8140,7 +8128,7 @@ static FallImpactInfo D_80854600[] = { { -16, 255, 140, 150, NA_SE_VO_LI_LAND_DAMAGE_S }, }; -s32 func_80843E64(GlobalContext* globalCtx, Player* this) { +s32 func_80843E64(PlayState* play, Player* this) { s32 sp34; if ((D_808535E4 == 6) || (D_808535E4 == 9)) { @@ -8165,12 +8153,12 @@ s32 func_80843E64(GlobalContext* globalCtx, Player* this) { impactInfo = &D_80854600[impactIndex]; - if (Player_InflictDamage(globalCtx, impactInfo->damage)) { + if (Player_InflictDamage(play, impactInfo->damage)) { return -1; } func_80837AE0(this, 40); - func_808429B4(globalCtx, 32967, 2, 30); + func_808429B4(play, 32967, 2, 30); func_8083264C(this, impactInfo->unk_01, impactInfo->unk_02, impactInfo->unk_03, 0); func_8002F7DC(&this->actor, NA_SE_PL_BODY_HIT); func_80832698(this, impactInfo->sfxId); @@ -8197,20 +8185,20 @@ s32 func_80843E64(GlobalContext* globalCtx, Player* this) { return 0; } -void func_8084409C(GlobalContext* globalCtx, Player* this, f32 speedXZ, f32 velocityY) { +void func_8084409C(PlayState* play, Player* this, f32 speedXZ, f32 velocityY) { Actor* heldActor = this->heldActor; - if (!func_80835644(globalCtx, this, heldActor)) { + if (!func_80835644(play, this, heldActor)) { heldActor->world.rot.y = this->actor.shape.rot.y; heldActor->speedXZ = speedXZ; heldActor->velocity.y = velocityY; - func_80834644(globalCtx, this); + func_80834644(play, this); func_8002F7DC(&this->actor, NA_SE_PL_THROW); func_80832698(this, NA_SE_VO_LI_SWORD_N); } } -void func_8084411C(Player* this, GlobalContext* globalCtx) { +void func_8084411C(Player* this, PlayState* play) { f32 sp4C; s16 sp4A; @@ -8220,27 +8208,27 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { this->actor.gravity = -1.2f; } - func_80837268(this, &sp4C, &sp4A, 0.0f, globalCtx); + func_80837268(this, &sp4C, &sp4A, 0.0f, play); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->stateFlags1 & PLAYER_STATE1_11) { Actor* heldActor = this->heldActor; - if (!func_80835644(globalCtx, this, heldActor) && (heldActor->id == ACTOR_EN_NIW) && + if (!func_80835644(play, this, heldActor) && (heldActor->id == ACTOR_EN_NIW) && CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { - func_8084409C(globalCtx, this, this->linearVelocity + 2.0f, this->actor.velocity.y + 2.0f); + func_8084409C(play, this, this->linearVelocity + 2.0f, this->actor.velocity.y + 2.0f); } } - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (!(this->stateFlags2 & PLAYER_STATE2_19)) { func_8083DFE0(this, &sp4C, &sp4A); } - func_80836670(this, globalCtx); + func_80836670(this, play); - if (((this->stateFlags2 & PLAYER_STATE2_19) && (this->unk_84F == 2)) || !func_8083BBA0(this, globalCtx)) { + if (((this->stateFlags2 & PLAYER_STATE2_19) && (this->unk_84F == 2)) || !func_8083BBA0(this, play)) { if (this->actor.velocity.y < 0.0f) { if (this->unk_850 >= 0) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->unk_850 == 0) || @@ -8250,7 +8238,7 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { this->stateFlags1 &= ~PLAYER_STATE1_2; } - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_003020, 1.0f, 0.0f, 0.0f, + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_003020, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 8.0f); this->unk_850 = -1; } @@ -8264,18 +8252,18 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { !(this->stateFlags2 & PLAYER_STATE2_19) && !(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_27)) && (this->linearVelocity > 0.0f)) { if ((this->wallHeight >= 150.0f) && (this->unk_84B[this->unk_846] == 0)) { - func_8083EC18(this, globalCtx, D_808535F0); + func_8083EC18(this, play, D_808535F0); } else if ((this->unk_88C >= 2) && (this->wallHeight < 150.0f) && (((this->actor.world.pos.y - this->actor.floorHeight) + this->wallHeight) > (70.0f * this->ageProperties->unk_08))) { - AnimationContext_DisableQueue(globalCtx); + AnimationContext_DisableQueue(play); if (this->stateFlags1 & PLAYER_STATE1_2) { func_80832698(this, NA_SE_VO_LI_HOOKSHOT_HANG); } else { func_80832698(this, NA_SE_VO_LI_HANG); } this->actor.world.pos.y += this->wallHeight; - func_8083A5C4(globalCtx, this, this->actor.wallPoly, this->wallDistance, + func_8083A5C4(play, this, this->actor.wallPoly, this->wallDistance, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_39, this->modelAnimType)); this->actor.shape.rot.y = this->currentYaw += 0x8000; this->stateFlags1 |= PLAYER_STATE1_13; @@ -8303,14 +8291,14 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_15, this->modelAnimType); } else if ((this->fallDistance < 800) && (this->unk_84B[this->unk_846] == 0) && !(this->stateFlags1 & PLAYER_STATE1_11)) { - func_8083BC04(this, globalCtx); + func_8083BC04(this, play); return; } - sp3C = func_80843E64(globalCtx, this); + sp3C = func_80843E64(play, this); if (sp3C > 0) { - func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_14, this->modelAnimType), globalCtx); + func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_14, this->modelAnimType), play); this->skelAnime.endFrame = 8.0f; if (sp3C == 1) { this->unk_850 = 10; @@ -8318,7 +8306,7 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { this->unk_850 = 20; } } else if (sp3C == 0) { - func_8083A098(this, anim, globalCtx); + func_8083A098(this, anim, play); } } } @@ -8330,7 +8318,7 @@ static struct_80832924 D_8085460C[] = { { 0, -0x2812 }, }; -void func_80844708(Player* this, GlobalContext* globalCtx) { +void func_80844708(Player* this, PlayState* play) { Actor* cylinderOc; s32 temp; s32 sp44; @@ -8342,19 +8330,19 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { this->stateFlags2 |= PLAYER_STATE2_5; cylinderOc = NULL; - sp44 = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp44 = LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 8.0f)) { func_80837AFC(this, -10); } - if (func_80842964(this, globalCtx) == 0) { + if (func_80842964(this, play) == 0) { if (this->unk_850 != 0) { Math_StepToF(&this->linearVelocity, 0.0f, 2.0f); - temp = func_808374A0(globalCtx, this, &this->skelAnime, 5.0f); + temp = func_808374A0(play, this, &this->skelAnime, 5.0f); if ((temp != 0) && ((temp > 0) || sp44)) { - func_8083A060(this, globalCtx); + func_8083A060(this, play); } } else { if (this->linearVelocity >= 7.0f) { @@ -8367,15 +8355,15 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { if (cylinderOc != NULL) { cylinderOc->home.rot.y = 1; } else if (this->actor.wallBgId != BGCHECK_SCENE) { - wallPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId); + wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); if ((wallPolyActor != NULL) && (wallPolyActor->actor.id == ACTOR_OBJ_KIBAKO2)) { wallPolyActor->actor.home.rot.z = 1; } } - func_80832264(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_17, this->modelAnimType)); + func_80832264(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_17, this->modelAnimType)); this->linearVelocity = -this->linearVelocity; - func_808429B4(globalCtx, 33267, 3, 12); + func_808429B4(play, 33267, 3, 12); func_8083264C(this, 255, 20, 150, 0); func_8002F7DC(&this->actor, NA_SE_PL_BODY_HIT); func_80832698(this, NA_SE_VO_LI_CLIMB_END); @@ -8384,13 +8372,13 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { } } - if ((this->skelAnime.curFrame < 15.0f) || !func_80850224(this, globalCtx)) { + if ((this->skelAnime.curFrame < 15.0f) || !func_80850224(this, play)) { if (this->skelAnime.curFrame >= 20.0f) { - func_8083A060(this, globalCtx); + func_8083A060(this, play); return; } - func_80837268(this, &sp38, &sp36, 0.018f, globalCtx); + func_80837268(this, &sp38, &sp36, 0.018f, play); sp38 *= 1.5f; if ((sp38 < 3.0f) || (this->unk_84B[this->unk_846] != 0)) { @@ -8399,7 +8387,7 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { func_8083DF68(this, sp38, this->actor.shape.rot.y); - if (func_8084269C(globalCtx, this)) { + if (func_8084269C(play, this)) { func_8002F8F0(&this->actor, NA_SE_PL_ROLL_DUST - SFX_FLAG); } @@ -8409,52 +8397,52 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { } } -void func_80844A44(Player* this, GlobalContext* globalCtx) { +void func_80844A44(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, &gPlayerAnim_003160); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, &gPlayerAnim_003160); } Math_StepToF(&this->linearVelocity, 0.0f, 0.05f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.colChkInfo.damage = 0x10; - func_80837C0C(globalCtx, this, 1, 4.0f, 5.0f, this->actor.shape.rot.y, 20); + func_80837C0C(play, this, 1, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } } -void func_80844AF4(Player* this, GlobalContext* globalCtx) { +void func_80844AF4(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; this->stateFlags2 |= PLAYER_STATE2_5; this->actor.gravity = -1.2f; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); - if (!func_80842DF4(globalCtx, this)) { + if (!func_80842DF4(play, this)) { func_8084285C(this, 6.0f, 7.0f, 99.0f); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_80837268(this, &sp2C, &sp2A, 0.0f, globalCtx); + func_80837268(this, &sp2C, &sp2A, 0.0f, play); func_8083DFE0(this, &sp2C, &this->currentYaw); return; } - if (func_80843E64(globalCtx, this) >= 0) { + if (func_80843E64(play, this) >= 0) { this->meleeWeaponAnimation += 2; - func_80837948(globalCtx, this, this->meleeWeaponAnimation); + func_80837948(play, this, this->meleeWeaponAnimation); this->unk_845 = 3; func_808328A0(this); } } } -s32 func_80844BE4(Player* this, GlobalContext* globalCtx) { +s32 func_80844BE4(Player* this, PlayState* play) { s32 temp; - if (func_8083ADD4(globalCtx, this)) { + if (func_8083ADD4(play, this)) { this->stateFlags2 |= PLAYER_STATE2_17; } else { if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { @@ -8464,7 +8452,7 @@ s32 func_80844BE4(Player* this, GlobalContext* globalCtx) { temp = D_80854380[Player_HoldsTwoHandedWeapon(this)]; } - func_80837948(globalCtx, this, temp); + func_80837948(play, this, temp); func_80837AFC(this, -8); this->stateFlags2 |= PLAYER_STATE2_17; @@ -8479,25 +8467,25 @@ s32 func_80844BE4(Player* this, GlobalContext* globalCtx) { return 1; } -void func_80844CF8(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80845000, 1); +void func_80844CF8(Player* this, PlayState* play) { + func_80835C58(play, this, func_80845000, 1); } -void func_80844D30(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80845308, 1); +void func_80844D30(Player* this, PlayState* play) { + func_80835C58(play, this, func_80845308, 1); } -void func_80844D68(Player* this, GlobalContext* globalCtx) { - func_80839FFC(this, globalCtx); +void func_80844D68(Player* this, PlayState* play) { + func_80839FFC(this, play); func_80832318(this); - func_80832B0C(globalCtx, this, D_80854368[Player_HoldsTwoHandedWeapon(this)]); + func_80832B0C(play, this, D_80854368[Player_HoldsTwoHandedWeapon(this)]); this->currentYaw = this->actor.shape.rot.y; } -void func_80844DC8(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80844E68, 1); +void func_80844DC8(Player* this, PlayState* play) { + func_80835C58(play, this, func_80844E68, 1); this->unk_868 = 0.0f; - func_80832284(globalCtx, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); + func_80832284(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); this->unk_850 = 1; } @@ -8505,24 +8493,24 @@ void func_80844E3C(Player* this) { Math_StepToF(&this->unk_858, 1.0f, 0.02f); } -void func_80844E68(Player* this, GlobalContext* globalCtx) { +void func_80844E68(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; this->stateFlags1 |= PLAYER_STATE1_12; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); func_808355DC(this); this->stateFlags1 &= ~PLAYER_STATE1_17; - func_80832284(globalCtx, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); + func_80832284(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); this->unk_850 = -1; } func_8083721C(this); - if (!func_80842964(this, globalCtx) && (this->unk_850 != 0)) { + if (!func_80842964(this, play) && (this->unk_850 != 0)) { func_80844E3C(this); if (this->unk_850 < 0) { @@ -8530,22 +8518,22 @@ void func_80844E68(Player* this, GlobalContext* globalCtx) { this->unk_845 = 0; this->unk_850 = 1; } else if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { - func_80844D68(this, globalCtx); + func_80844D68(this, play); } - } else if (!func_80844BE4(this, globalCtx)) { - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); + } else if (!func_80844BE4(this, play)) { + func_80837268(this, &sp34, &sp32, 0.0f, play); - temp = func_80840058(this, &sp34, &sp32, globalCtx); + temp = func_80840058(this, &sp34, &sp32, play); if (temp > 0) { - func_80844CF8(this, globalCtx); + func_80844CF8(this, play); } else if (temp < 0) { - func_80844D30(this, globalCtx); + func_80844D30(this, play); } } } } -void func_80845000(Player* this, GlobalContext* globalCtx) { +void func_80845000(Player* this, PlayState* play) { s16 temp1; s32 temp2; f32 sp5C; @@ -8574,18 +8562,18 @@ void func_80845000(Player* this, GlobalContext* globalCtx) { sp58 = CLAMP(sp5C * 0.5f, 0.5f, 1.0f); - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, D_80854360[Player_HoldsTwoHandedWeapon(this)], 0.0f, + LinkAnimation_BlendToJoint(play, &this->skelAnime, D_80854360[Player_HoldsTwoHandedWeapon(this)], 0.0f, D_80854370[Player_HoldsTwoHandedWeapon(this)], this->unk_868 * (21.0f / 29.0f), sp58, this->blendTable); - if (!func_80842964(this, globalCtx) && !func_80844BE4(this, globalCtx)) { + if (!func_80842964(this, play) && !func_80844BE4(this, play)) { func_80844E3C(this); - func_80837268(this, &sp54, &sp52, 0.0f, globalCtx); + func_80837268(this, &sp54, &sp52, 0.0f, play); - temp4 = func_80840058(this, &sp54, &sp52, globalCtx); + temp4 = func_80840058(this, &sp54, &sp52, play); if (temp4 < 0) { - func_80844D30(this, globalCtx); + func_80844D30(this, play); return; } @@ -8608,12 +8596,12 @@ void func_80845000(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f); if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f)) { - func_80844DC8(this, globalCtx); + func_80844DC8(this, play); } } } -void func_80845308(Player* this, GlobalContext* globalCtx) { +void func_80845308(Player* this, PlayState* play) { f32 sp5C; f32 sp58; f32 sp54; @@ -8642,18 +8630,18 @@ void func_80845308(Player* this, GlobalContext* globalCtx) { sp58 = CLAMP(sp5C * 0.5f, 0.5f, 1.0f); - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, D_80854360[Player_HoldsTwoHandedWeapon(this)], 0.0f, + LinkAnimation_BlendToJoint(play, &this->skelAnime, D_80854360[Player_HoldsTwoHandedWeapon(this)], 0.0f, D_80854378[Player_HoldsTwoHandedWeapon(this)], this->unk_868 * (21.0f / 29.0f), sp58, this->blendTable); - if (!func_80842964(this, globalCtx) && !func_80844BE4(this, globalCtx)) { + if (!func_80842964(this, play) && !func_80844BE4(this, play)) { func_80844E3C(this); - func_80837268(this, &sp54, &sp52, 0.0f, globalCtx); + func_80837268(this, &sp54, &sp52, 0.0f, play); - temp4 = func_80840058(this, &sp54, &sp52, globalCtx); + temp4 = func_80840058(this, &sp54, &sp52, play); if (temp4 > 0) { - func_80844CF8(this, globalCtx); + func_80844CF8(this, play); return; } @@ -8676,19 +8664,19 @@ void func_80845308(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f); if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f) && (sp5C == 0.0f)) { - func_80844DC8(this, globalCtx); + func_80844DC8(this, play); } } } -void func_80845668(Player* this, GlobalContext* globalCtx) { +void func_80845668(Player* this, PlayState* play) { s32 sp3C; f32 temp1; s32 temp2; f32 temp3; this->stateFlags2 |= PLAYER_STATE2_5; - sp3C = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp3C = LinkAnimation_Update(play, &this->skelAnime); if (this->skelAnime.animation == &gPlayerAnim_002D48) { this->linearVelocity = 1.0f; @@ -8710,12 +8698,12 @@ void func_80845668(Player* this, GlobalContext* globalCtx) { temp1 += 1.0f; } - func_80838940(this, NULL, temp1, globalCtx, NA_SE_VO_LI_AUTO_JUMP); + func_80838940(this, NULL, temp1, play, NA_SE_VO_LI_AUTO_JUMP); this->unk_850 = -1; return; } } else { - temp2 = func_808374A0(globalCtx, this, &this->skelAnime, 4.0f); + temp2 = func_808374A0(play, this, &this->skelAnime, 4.0f); if (temp2 == 0) { this->stateFlags1 &= ~(PLAYER_STATE1_14 | PLAYER_STATE1_18); @@ -8723,7 +8711,7 @@ void func_80845668(Player* this, GlobalContext* globalCtx) { } if ((sp3C != 0) || (temp2 > 0)) { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); this->stateFlags1 &= ~(PLAYER_STATE1_14 | PLAYER_STATE1_18); return; } @@ -8732,7 +8720,7 @@ void func_80845668(Player* this, GlobalContext* globalCtx) { if (this->skelAnime.animation == &gPlayerAnim_0032E8) { if (LinkAnimation_OnFrame(&this->skelAnime, 30.0f)) { - func_8083D0A8(globalCtx, this, 10.0f); + func_8083D0A8(play, this, 10.0f); } temp3 = 50.0f; } else if (this->skelAnime.animation == &gPlayerAnim_002D40) { @@ -8756,19 +8744,19 @@ void func_80845668(Player* this, GlobalContext* globalCtx) { } } -void func_808458D0(Player* this, GlobalContext* globalCtx) { +void func_808458D0(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (((this->stateFlags1 & PLAYER_STATE1_11) && (this->heldActor != NULL) && (this->getItemId == GI_NONE)) || - !func_80836670(this, globalCtx)) { - this->func_A74(globalCtx, this); + !func_80836670(this, play)) { + this->func_A74(play, this); } } -s32 func_80845964(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2, f32 arg3, s16 arg4, s32 arg5) { +s32 func_80845964(PlayState* play, Player* this, CsCmdActorAction* arg2, f32 arg3, s16 arg4, s32 arg5) { if ((arg5 != 0) && (this->linearVelocity == 0.0f)) { - return LinkAnimation_Update(globalCtx, &this->skelAnime); + return LinkAnimation_Update(play, &this->skelAnime); } if (arg5 != 2) { @@ -8776,7 +8764,7 @@ s32 func_80845964(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2 f32 selfDistX = arg2->endPos.x - this->actor.world.pos.x; f32 selfDistZ = arg2->endPos.z - this->actor.world.pos.z; f32 sp28 = sqrtf(SQ(selfDistX) + SQ(selfDistZ)) / sp34; - s32 sp24 = (arg2->endFrame - globalCtx->csCtx.frames) + 1; + s32 sp24 = (arg2->endFrame - play->csCtx.frames) + 1; arg4 = Math_Atan2S(selfDistZ, selfDistX); @@ -8797,52 +8785,52 @@ s32 func_80845964(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2 } this->stateFlags2 |= PLAYER_STATE2_5; - func_80841EE4(this, globalCtx); + func_80841EE4(this, play); func_8083DF68(this, arg3, arg4); if ((arg3 == 0.0f) && (this->linearVelocity == 0.0f)) { - func_8083BF50(this, globalCtx); + func_8083BF50(this, play); } return 0; } -s32 func_80845BA0(GlobalContext* arg0, Player* arg1, f32* arg2, s32 arg3) { - f32 dx = arg1->unk_450.x - arg1->actor.world.pos.x; - f32 dz = arg1->unk_450.z - arg1->actor.world.pos.z; +s32 func_80845BA0(PlayState* play, Player* this, f32* arg2, s32 arg3) { + f32 dx = this->unk_450.x - this->actor.world.pos.x; + f32 dz = this->unk_450.z - this->actor.world.pos.z; s32 sp2C = sqrtf(SQ(dx) + SQ(dz)); - s16 yaw = Math_Vec3f_Yaw(&arg1->actor.world.pos, &arg1->unk_450); + s16 yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_450); if (sp2C < arg3) { *arg2 = 0.0f; - yaw = arg1->actor.shape.rot.y; + yaw = this->actor.shape.rot.y; } - if (func_80845964(arg0, arg1, NULL, *arg2, yaw, 2)) { + if (func_80845964(play, this, NULL, *arg2, yaw, 2)) { return 0; } return sp2C; } -s32 func_80845C68(GlobalContext* globalCtx, s32 arg1) { +s32 func_80845C68(PlayState* play, s32 arg1) { if (arg1 == 0) { - Play_SetupRespawnPoint(globalCtx, RESPAWN_MODE_DOWN, 0xDFF); + Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0xDFF); } gSaveContext.respawn[RESPAWN_MODE_DOWN].data = 0; return arg1; } -void func_80845CA4(Player* this, GlobalContext* globalCtx) { +void func_80845CA4(Player* this, PlayState* play) { f32 sp3C; s32 temp; f32 sp34; s32 sp30; s32 pad; - if (!func_8083B040(this, globalCtx)) { + if (!func_8083B040(this, play)) { if (this->unk_850 == 0) { - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (DECR(this->doorTimer) == 0) { this->linearVelocity = 0.1f; @@ -8851,7 +8839,7 @@ void func_80845CA4(Player* this, GlobalContext* globalCtx) { } else if (this->unk_84F == 0) { sp3C = 5.0f * D_808535E8; - if (func_80845BA0(globalCtx, this, &sp3C, -1) < 30) { + if (func_80845BA0(play, this, &sp3C, -1) < 30) { this->unk_84F = 1; this->stateFlags1 |= PLAYER_STATE1_29; @@ -8876,33 +8864,33 @@ void func_80845CA4(Player* this, GlobalContext* globalCtx) { sp30 = -1; } - temp = func_80845BA0(globalCtx, this, &sp34, sp30); + temp = func_80845BA0(play, this, &sp34, sp30); if ((this->unk_850 == 0) || ((temp == 0) && (this->linearVelocity == 0.0f) && - (Play_GetCamera(globalCtx, CAM_ID_MAIN)->unk_14C & 0x10))) { + (Play_GetCamera(play, CAM_ID_MAIN)->unk_14C & 0x10))) { - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); - func_80845C68(globalCtx, gSaveContext.respawn[RESPAWN_MODE_DOWN].data); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); + func_80845C68(play, gSaveContext.respawn[RESPAWN_MODE_DOWN].data); - if (!func_8083B644(this, globalCtx)) { - func_8083CF5C(this, globalCtx); + if (!func_8083B644(this, play)) { + func_8083CF5C(this, play); } } } } if (this->stateFlags1 & PLAYER_STATE1_11) { - func_80836670(this, globalCtx); + func_80836670(this, play); } } -void func_80845EF8(Player* this, GlobalContext* globalCtx) { +void func_80845EF8(Player* this, PlayState* play) { s32 sp2C; this->stateFlags2 |= PLAYER_STATE2_5; - sp2C = LinkAnimation_Update(globalCtx, &this->skelAnime); + sp2C = LinkAnimation_Update(play, &this->skelAnime); - func_80836670(this, globalCtx); + func_80836670(this, play); if (sp2C) { if (this->unk_850 == 0) { @@ -8911,34 +8899,34 @@ void func_80845EF8(Player* this, GlobalContext* globalCtx) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } } else { - func_8083C0E8(this, globalCtx); - if (globalCtx->roomCtx.prevRoom.num >= 0) { - func_80097534(globalCtx, &globalCtx->roomCtx); + func_8083C0E8(this, play); + if (play->roomCtx.prevRoom.num >= 0) { + func_80097534(play, &play->roomCtx); } - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); - Play_SetupRespawnPoint(globalCtx, RESPAWN_MODE_DOWN, 0xDFF); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); + Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0xDFF); } return; } if (!(this->stateFlags1 & PLAYER_STATE1_29) && LinkAnimation_OnFrame(&this->skelAnime, 15.0f)) { - globalCtx->func_11D54(this, globalCtx); + play->func_11D54(this, play); } } -void func_80846050(Player* this, GlobalContext* globalCtx) { +void func_80846050(Player* this, PlayState* play) { func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80839F90(this, globalCtx); - func_80835688(this, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80839F90(this, play); + func_80835688(this, play); return; } if (LinkAnimation_OnFrame(&this->skelAnime, 4.0f)) { Actor* interactRangeActor = this->interactRangeActor; - if (!func_80835644(globalCtx, this, interactRangeActor)) { + if (!func_80835644(play, this, interactRangeActor)) { this->heldActor = interactRangeActor; this->actor.child = interactRangeActor; interactRangeActor->parent = &this->actor; @@ -8958,10 +8946,10 @@ static struct_80832924 D_8085461C[] = { { NA_SE_VO_LI_SWORD_N, -0x20E6 }, }; -void func_80846120(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->unk_850++ > 20)) { - if (!func_8083B040(this, globalCtx)) { - func_8083A098(this, &gPlayerAnim_002FA0, globalCtx); +void func_80846120(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_850++ > 20)) { + if (!func_8083B040(this, play)) { + func_8083A098(this, &gPlayerAnim_002FA0, play); } return; } @@ -8983,18 +8971,18 @@ void func_80846120(Player* this, GlobalContext* globalCtx) { heldActor->velocity.y = Math_CosS(heldActor->shape.rot.x) * 40.0f; heldActor->gravity = -2.0f; heldActor->minVelocityY = -30.0f; - func_808323B4(globalCtx, this); + func_808323B4(play, this); return; } func_80832924(this, D_8085461C); } -void func_80846260(Player* this, GlobalContext* globalCtx) { +void func_80846260(Player* this, PlayState* play) { func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, &gPlayerAnim_0032C0); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, &gPlayerAnim_0032C0); this->unk_850 = 1; return; } @@ -9015,14 +9003,14 @@ void func_80846260(Player* this, GlobalContext* globalCtx) { } } else if (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { - func_80835C58(globalCtx, this, func_80846358, 1); - func_80832264(globalCtx, this, &gPlayerAnim_0032B8); + func_80835C58(play, this, func_80846358, 1); + func_80832264(play, this, &gPlayerAnim_0032B8); } } -void func_80846358(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80839F90(this, globalCtx); +void func_80846358(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80839F90(this, play); return; } @@ -9032,15 +9020,15 @@ void func_80846358(Player* this, GlobalContext* globalCtx) { heldActor->world.rot.y = this->actor.shape.rot.y; heldActor->speedXZ = 10.0f; heldActor->velocity.y = 20.0f; - func_80834644(globalCtx, this); + func_80834644(play, this); func_8002F7DC(&this->actor, NA_SE_PL_THROW); func_80832698(this, NA_SE_VO_LI_SWORD_N); } } -void func_80846408(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, &gPlayerAnim_003070); +void func_80846408(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, &gPlayerAnim_003070); this->unk_850 = 15; return; } @@ -9048,49 +9036,49 @@ void func_80846408(Player* this, GlobalContext* globalCtx) { if (this->unk_850 != 0) { this->unk_850--; if (this->unk_850 == 0) { - func_8083A098(this, &gPlayerAnim_003068, globalCtx); + func_8083A098(this, &gPlayerAnim_003068, play); this->stateFlags1 &= ~PLAYER_STATE1_11; func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } } } -void func_808464B0(Player* this, GlobalContext* globalCtx) { +void func_808464B0(Player* this, PlayState* play) { func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80839F90(this, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80839F90(this, play); return; } if (LinkAnimation_OnFrame(&this->skelAnime, 4.0f)) { Actor* heldActor = this->heldActor; - if (!func_80835644(globalCtx, this, heldActor)) { + if (!func_80835644(play, this, heldActor)) { heldActor->velocity.y = 0.0f; heldActor->speedXZ = 0.0f; - func_80834644(globalCtx, this); + func_80834644(play, this); if (heldActor->id == ACTOR_EN_BOM_CHU) { - func_8083B8F4(this, globalCtx); + func_8083B8F4(this, play); } } } } -void func_80846578(Player* this, GlobalContext* globalCtx) { +void func_80846578(Player* this, PlayState* play) { f32 sp34; s16 sp32; func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime) || - ((this->skelAnime.curFrame >= 8.0f) && func_80837268(this, &sp34, &sp32, 0.018f, globalCtx))) { - func_80839F90(this, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime) || + ((this->skelAnime.curFrame >= 8.0f) && func_80837268(this, &sp34, &sp32, 0.018f, play))) { + func_80839F90(this, play); return; } if (LinkAnimation_OnFrame(&this->skelAnime, 3.0f)) { - func_8084409C(globalCtx, this, this->linearVelocity + 8.0f, 12.0f); + func_8084409C(play, this, this->linearVelocity + 8.0f, 12.0f); } } @@ -9154,39 +9142,38 @@ static ColliderQuadInit D_808546A0 = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -void func_8084663C(Actor* thisx, GlobalContext* globalCtx) { +void func_8084663C(Actor* thisx, PlayState* play) { } -void func_80846648(GlobalContext* globalCtx, Player* this) { +void func_80846648(PlayState* play, Player* this) { this->actor.update = func_8084663C; this->actor.draw = NULL; } -void func_80846660(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084F710, 0); - if ((globalCtx->sceneNum == SCENE_SPOT06) && (gSaveContext.sceneSetupIndex >= 4)) { +void func_80846660(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084F710, 0); + if ((play->sceneNum == SCENE_SPOT06) && (gSaveContext.sceneSetupIndex >= 4)) { this->unk_84F = 1; } this->stateFlags1 |= PLAYER_STATE1_29; - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_003298, 2.0f / 3.0f, 0.0f, 24.0f, ANIMMODE_ONCE, - 0.0f); + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_003298, 2.0f / 3.0f, 0.0f, 24.0f, ANIMMODE_ONCE, 0.0f); this->actor.world.pos.y += 800.0f; } static u8 D_808546F0[] = { ITEM_SWORD_MASTER, ITEM_SWORD_KOKIRI }; -void func_80846720(GlobalContext* globalCtx, Player* this, s32 arg2) { +void func_80846720(PlayState* play, Player* this, s32 arg2) { s32 item = D_808546F0[(void)0, gSaveContext.linkAge]; s32 actionParam = sItemActionParams[item]; func_80835EFC(this); - func_808323B4(globalCtx, this); + func_808323B4(play, this); this->heldItemId = item; this->nextModelGroup = Player_ActionToModelGroup(this, actionParam); - func_8083399C(globalCtx, this, actionParam); - func_80834644(globalCtx, this); + func_8083399C(play, this, actionParam); + func_80834644(play, this); if (arg2 != 0) { func_8002F7DC(&this->actor, NA_SE_IT_SWORD_PICKOUT); @@ -9195,53 +9182,53 @@ void func_80846720(GlobalContext* globalCtx, Player* this, s32 arg2) { static Vec3f D_808546F4 = { -1.0f, 69.0f, 20.0f }; -void func_808467D4(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084E9AC, 0); +void func_808467D4(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084E9AC, 0); this->stateFlags1 |= PLAYER_STATE1_29; Math_Vec3f_Copy(&this->actor.world.pos, &D_808546F4); this->currentYaw = this->actor.shape.rot.y = -0x8000; - LinkAnimation_Change(globalCtx, &this->skelAnime, this->ageProperties->unk_A0, 2.0f / 3.0f, 0.0f, 0.0f, - ANIMMODE_ONCE, 0.0f); - func_80832F54(globalCtx, this, 0x28F); + LinkAnimation_Change(play, &this->skelAnime, this->ageProperties->unk_A0, 2.0f / 3.0f, 0.0f, 0.0f, ANIMMODE_ONCE, + 0.0f); + func_80832F54(play, this, 0x28F); if (LINK_IS_ADULT) { - func_80846720(globalCtx, this, 0); + func_80846720(play, this, 0); } this->unk_850 = 20; } -void func_808468A8(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084F9A0, 0); - func_80832F54(globalCtx, this, 0x9B); +void func_808468A8(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084F9A0, 0); + func_80832F54(play, this, 0x9B); } -void func_808468E8(GlobalContext* globalCtx, Player* this) { - func_808389E8(this, &gPlayerAnim_002FE0, 12.0f, globalCtx); - func_80835C58(globalCtx, this, func_8084F9C0, 0); +void func_808468E8(PlayState* play, Player* this) { + func_808389E8(this, &gPlayerAnim_002FE0, 12.0f, play); + func_80835C58(play, this, func_8084F9C0, 0); this->stateFlags1 |= PLAYER_STATE1_29; this->fallStartHeight = this->actor.world.pos.y; - OnePointCutscene_Init(globalCtx, 5110, 40, &this->actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 5110, 40, &this->actor, CAM_ID_MAIN); } -void func_80846978(GlobalContext* globalCtx, Player* this) { - func_80837C0C(globalCtx, this, 1, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); +void func_80846978(PlayState* play, Player* this) { + func_80837C0C(play, this, 1, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); } -void func_808469BC(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084F698, 0); +void func_808469BC(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084F698, 0); this->actor.draw = NULL; this->stateFlags1 |= PLAYER_STATE1_29; } static s16 D_80854700[] = { ACTOR_MAGIC_WIND, ACTOR_MAGIC_DARK, ACTOR_MAGIC_FIRE }; -Actor* func_80846A00(GlobalContext* globalCtx, Player* this, s32 arg2) { - return Actor_Spawn(&globalCtx->actorCtx, globalCtx, D_80854700[arg2], this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); +Actor* func_80846A00(PlayState* play, Player* this, s32 arg2) { + return Actor_Spawn(&play->actorCtx, play, D_80854700[arg2], this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 0); } -void func_80846A68(GlobalContext* globalCtx, Player* this) { +void func_80846A68(PlayState* play, Player* this) { this->actor.draw = NULL; - func_80835C58(globalCtx, this, func_8085076C, 0); + func_80835C58(play, this, func_8085076C, 0); this->stateFlags1 |= PLAYER_STATE1_29; } @@ -9256,36 +9243,35 @@ static EffectBlureInit2 D_8085470C = { static Vec3s D_80854730 = { -57, 3377, 0 }; -void Player_InitCommon(Player* this, GlobalContext* globalCtx, FlexSkeletonHeader* skelHeader) { +void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHeader) { this->ageProperties = &sAgeProperties[gSaveContext.linkAge]; Actor_ProcessInitChain(&this->actor, sInitChain); this->meleeWeaponEffectIndex = TOTAL_EFFECT_COUNT; this->currentYaw = this->actor.world.rot.y; - func_80834644(globalCtx, this); + func_80834644(play, this); - SkelAnime_InitLink(globalCtx, &this->skelAnime, skelHeader, - GET_PLAYER_ANIM(PLAYER_ANIMGROUP_0, this->modelAnimType), 9, this->jointTable, this->morphTable, - PLAYER_LIMB_MAX); + SkelAnime_InitLink(play, &this->skelAnime, skelHeader, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_0, this->modelAnimType), 9, + this->jointTable, this->morphTable, PLAYER_LIMB_MAX); this->skelAnime.baseTransl = D_80854730; - SkelAnime_InitLink(globalCtx, &this->skelAnime2, skelHeader, func_80833338(this), 9, this->jointTable2, + SkelAnime_InitLink(play, &this->skelAnime2, skelHeader, func_80833338(this), 9, this->jointTable2, this->morphTable2, PLAYER_LIMB_MAX); this->skelAnime2.baseTransl = D_80854730; - Effect_Add(globalCtx, &this->meleeWeaponEffectIndex, EFFECT_BLURE2, 0, 0, &D_8085470C); + Effect_Add(play, &this->meleeWeaponEffectIndex, EFFECT_BLURE2, 0, 0, &D_8085470C); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, this->ageProperties->unk_04); this->subCamId = CAM_ID_NONE; - Collider_InitCylinder(globalCtx, &this->cylinder); - Collider_SetCylinder(globalCtx, &this->cylinder, &this->actor, &D_80854624); - Collider_InitQuad(globalCtx, &this->meleeWeaponQuads[0]); - Collider_SetQuad(globalCtx, &this->meleeWeaponQuads[0], &this->actor, &D_80854650); - Collider_InitQuad(globalCtx, &this->meleeWeaponQuads[1]); - Collider_SetQuad(globalCtx, &this->meleeWeaponQuads[1], &this->actor, &D_80854650); - Collider_InitQuad(globalCtx, &this->shieldQuad); - Collider_SetQuad(globalCtx, &this->shieldQuad, &this->actor, &D_808546A0); + Collider_InitCylinder(play, &this->cylinder); + Collider_SetCylinder(play, &this->cylinder, &this->actor, &D_80854624); + Collider_InitQuad(play, &this->meleeWeaponQuads[0]); + Collider_SetQuad(play, &this->meleeWeaponQuads[0], &this->actor, &D_80854650); + Collider_InitQuad(play, &this->meleeWeaponQuads[1]); + Collider_SetQuad(play, &this->meleeWeaponQuads[1], &this->actor, &D_80854650); + Collider_InitQuad(play, &this->shieldQuad); + Collider_SetQuad(play, &this->shieldQuad, &this->actor, &D_808546A0); } -static void (*D_80854738[])(GlobalContext* globalCtx, Player* this) = { +static void (*D_80854738[])(PlayState* play, Player* this) = { func_80846648, func_808467D4, func_80846660, func_808468A8, func_808468E8, func_808469BC, func_80846A68, func_80846978, func_8083CA54, func_8083CA54, func_8083CA54, func_8083CA54, func_8083CA54, func_8083CA20, func_8083CA54, func_8083CA9C, @@ -9293,36 +9279,36 @@ static void (*D_80854738[])(GlobalContext* globalCtx, Player* this) = { static Vec3f D_80854778 = { 0.0f, 50.0f, 0.0f }; -void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { +void Player_Init(Actor* thisx, PlayState* play2) { Player* this = (Player*)thisx; - GlobalContext* globalCtx = globalCtx2; - SceneTableEntry* scene = globalCtx->loadedScene; + PlayState* play = play2; + SceneTableEntry* scene = play->loadedScene; u32 titleFileSize; s32 initMode; s32 respawnFlag; s32 respawnMode; - globalCtx->shootingGalleryStatus = globalCtx->bombchuBowlingStatus = 0; + play->shootingGalleryStatus = play->bombchuBowlingStatus = 0; - globalCtx->playerInit = Player_InitCommon; - globalCtx->playerUpdate = Player_UpdateCommon; - globalCtx->isPlayerDroppingFish = Player_IsDroppingFish; - globalCtx->startPlayerFishing = Player_StartFishing; - globalCtx->grabPlayer = func_80852F38; - globalCtx->startPlayerCutscene = func_80852FFC; - globalCtx->func_11D54 = func_80853080; - globalCtx->damagePlayer = Player_InflictDamage; - globalCtx->talkWithPlayer = func_80853148; + play->playerInit = Player_InitCommon; + play->playerUpdate = Player_UpdateCommon; + play->isPlayerDroppingFish = Player_IsDroppingFish; + play->startPlayerFishing = Player_StartFishing; + play->grabPlayer = func_80852F38; + play->startPlayerCutscene = func_80852FFC; + play->func_11D54 = func_80853080; + play->damagePlayer = Player_InflictDamage; + play->talkWithPlayer = func_80853148; thisx->room = -1; this->ageProperties = &sAgeProperties[gSaveContext.linkAge]; this->itemActionParam = this->heldItemActionParam = -1; this->heldItemId = ITEM_NONE; - func_80835F44(globalCtx, this, ITEM_NONE); - Player_SetEquipmentData(globalCtx, this); + func_80835F44(play, this, ITEM_NONE); + Player_SetEquipmentData(play, this); this->prevBoots = this->currentBoots; - Player_InitCommon(this, globalCtx, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]); + Player_InitCommon(this, play, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]); this->giObjectSegment = (void*)(((u32)ZeldaArena_MallocDebug(0x3008, "../z_player.c", 17175) + 8) & ~0xF); respawnFlag = gSaveContext.respawnFlag; @@ -9347,8 +9333,8 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { thisx->params = gSaveContext.respawn[respawnMode].playerParams; } - globalCtx->actorCtx.flags.tempSwch = gSaveContext.respawn[respawnMode].tempSwchFlags & 0xFFFFFF; - globalCtx->actorCtx.flags.tempCollect = gSaveContext.respawn[respawnMode].tempCollectFlags; + play->actorCtx.flags.tempSwch = gSaveContext.respawn[respawnMode].tempSwchFlags & 0xFFFFFF; + play->actorCtx.flags.tempCollect = gSaveContext.respawn[respawnMode].tempCollectFlags; } } @@ -9358,23 +9344,22 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { if ((gSaveContext.sceneSetupIndex < 4) && (gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].field & 0x4000) && - ((globalCtx->sceneNum != SCENE_DDAN) || GET_EVENTCHKINF(EVENTCHKINF_B0)) && - ((globalCtx->sceneNum != SCENE_NIGHT_SHOP) || GET_EVENTCHKINF(EVENTCHKINF_25))) { - TitleCard_InitPlaceName(globalCtx, &globalCtx->actorCtx.titleCtx, this->giObjectSegment, 160, 120, 144, - 24, 20); + ((play->sceneNum != SCENE_DDAN) || GET_EVENTCHKINF(EVENTCHKINF_B0)) && + ((play->sceneNum != SCENE_NIGHT_SHOP) || GET_EVENTCHKINF(EVENTCHKINF_25))) { + TitleCard_InitPlaceName(play, &play->actorCtx.titleCtx, this->giObjectSegment, 160, 120, 144, 24, 20); } } gSaveContext.showTitleCard = true; } - if (func_80845C68(globalCtx, (respawnFlag == 2) ? 1 : 0) == 0) { + if (func_80845C68(play, (respawnFlag == 2) ? 1 : 0) == 0) { gSaveContext.respawn[RESPAWN_MODE_DOWN].playerParams = (thisx->params & 0xFF) | 0xD00; } gSaveContext.respawn[RESPAWN_MODE_DOWN].data = 1; - if (globalCtx->sceneNum <= SCENE_GANONTIKA_SONOGO) { - gSaveContext.infTable[INFTABLE_1AX_INDEX] |= gBitFlags[globalCtx->sceneNum]; + if (play->sceneNum <= SCENE_GANONTIKA_SONOGO) { + gSaveContext.infTable[INFTABLE_1AX_INDEX] |= gBitFlags[play->sceneNum]; } initMode = (thisx->params & 0xF00) >> 8; @@ -9384,11 +9369,11 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { } } - D_80854738[initMode](globalCtx, this); + D_80854738[initMode](play, this); if (initMode != 0) { if ((gSaveContext.gameMode == 0) || (gSaveContext.gameMode == 3)) { - this->naviActor = Player_SpawnFairy(globalCtx, this, &thisx->world.pos, &D_80854778, FAIRY_NAVI); + this->naviActor = Player_SpawnFairy(play, this, &thisx->world.pos, &D_80854778, FAIRY_NAVI); if (gSaveContext.dogParams != 0) { gSaveContext.dogParams |= 0x8000; } @@ -9397,7 +9382,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { if (gSaveContext.nayrusLoveTimer != 0) { gSaveContext.unk_13F0 = 3; - func_80846A00(globalCtx, this, 1); + func_80846A00(play, this, 1); this->stateFlags3 &= ~PLAYER_STATE3_6; } @@ -9406,7 +9391,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { gSaveContext.entranceSound = 0; } - Map_SavePlayerInitialInfo(globalCtx); + Map_SavePlayerInitialInfo(play); MREG(64) = 0; } @@ -9472,8 +9457,8 @@ static f32 D_80854784[] = { 120.0f, 240.0f, 360.0f }; static u8 sDiveDoActions[] = { DO_ACTION_1, DO_ACTION_2, DO_ACTION_3, DO_ACTION_4, DO_ACTION_5, DO_ACTION_6, DO_ACTION_7, DO_ACTION_8 }; -void func_808473D4(GlobalContext* globalCtx, Player* this) { - if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) && (this->actor.category == ACTORCAT_PLAYER)) { +void func_808473D4(PlayState* play, Player* this) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && (this->actor.category == ACTORCAT_PLAYER)) { Actor* heldActor = this->heldActor; Actor* interactRangeActor = this->interactRangeActor; s32 sp24; @@ -9481,7 +9466,7 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) { s32 sp1C = func_808332B8(this); s32 doAction = DO_ACTION_NONE; - if (!Player_InBlockingCsMode(globalCtx, this)) { + if (!Player_InBlockingCsMode(play, this)) { if (this->stateFlags1 & PLAYER_STATE1_20) { doAction = DO_ACTION_RETURN; } else if ((this->heldItemActionParam == PLAYER_AP_FISHING_POLE) && (this->unk_860 != 0)) { @@ -9553,16 +9538,16 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) { !Player_IsChildWithHylianShield(this))) { if ((!(this->stateFlags1 & PLAYER_STATE1_14) && (sp20 <= 0) && (func_8008E9C4(this) || - ((D_808535E4 != 7) && (func_80833B2C(this) || - ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && - !(this->stateFlags1 & PLAYER_STATE1_22) && (sp20 == 0))))))) { + ((D_808535E4 != 7) && + (func_80833B2C(this) || ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && + !(this->stateFlags1 & PLAYER_STATE1_22) && (sp20 == 0))))))) { doAction = DO_ACTION_ATTACK; - } else if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && - func_80833BCC(this) && (sp20 > 0)) { + } else if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && func_80833BCC(this) && + (sp20 > 0)) { doAction = DO_ACTION_JUMP; } else if ((this->heldItemActionParam >= PLAYER_AP_SWORD_MASTER) || ((this->stateFlags2 & PLAYER_STATE2_20) && - (globalCtx->actorCtx.targetCtx.arrowPointedActor == NULL))) { + (play->actorCtx.targetCtx.arrowPointedActor == NULL))) { doAction = DO_ACTION_PUTAWAY; } } @@ -9576,17 +9561,17 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) { this->unk_837--; } - Interface_SetDoAction(globalCtx, doAction); + Interface_SetDoAction(play, doAction); if (this->stateFlags2 & PLAYER_STATE2_21) { if (this->unk_664 != NULL) { - Interface_SetNaviCall(globalCtx, 0x1E); + Interface_SetNaviCall(play, 0x1E); } else { - Interface_SetNaviCall(globalCtx, 0x1D); + Interface_SetNaviCall(play, 0x1D); } - Interface_SetNaviCall(globalCtx, 0x1E); + Interface_SetNaviCall(play, 0x1E); } else { - Interface_SetNaviCall(globalCtx, 0x1F); + Interface_SetNaviCall(play, 0x1F); } } } @@ -9622,7 +9607,7 @@ s32 func_80847A78(Player* this) { static Vec3f D_80854798 = { 0.0f, 18.0f, 0.0f }; -void func_80847BA0(GlobalContext* globalCtx, Player* this) { +void func_80847BA0(PlayState* play, Player* this) { u8 spC7 = 0; CollisionPoly* floorPoly; Vec3f spB4; @@ -9671,7 +9656,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { } Math_Vec3f_Copy(&spB4, &this->actor.world.pos); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, spAC, spB0, spA8, spA4); + Actor_UpdateBgCheckInfo(play, &this->actor, spAC, spB0, spA8, spA4); if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { this->actor.velocity.y = 0.0f; @@ -9683,7 +9668,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { floorPoly = this->actor.floorPoly; if (floorPoly != NULL) { - this->unk_A7A = func_80041EA4(&globalCtx->colCtx, floorPoly, this->actor.floorBgId); + this->unk_A7A = func_80041EA4(&play->colCtx, floorPoly, this->actor.floorBgId); this->unk_A82 = this->unk_89E; if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { @@ -9696,37 +9681,37 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { if (this->stateFlags2 & PLAYER_STATE2_9) { this->unk_89E = 1; } else { - this->unk_89E = SurfaceType_GetSfx(&globalCtx->colCtx, floorPoly, this->actor.floorBgId); + this->unk_89E = SurfaceType_GetSfx(&play->colCtx, floorPoly, this->actor.floorBgId); } } if (this->actor.category == ACTORCAT_PLAYER) { - Audio_SetCodeReverb(SurfaceType_GetEcho(&globalCtx->colCtx, floorPoly, this->actor.floorBgId)); + Audio_SetCodeReverb(SurfaceType_GetEcho(&play->colCtx, floorPoly, this->actor.floorBgId)); if (this->actor.floorBgId == BGCHECK_SCENE) { Environment_ChangeLightSetting( - globalCtx, SurfaceType_GetLightSettingIndex(&globalCtx->colCtx, floorPoly, this->actor.floorBgId)); + play, SurfaceType_GetLightSettingIndex(&play->colCtx, floorPoly, this->actor.floorBgId)); } else { - func_80043508(&globalCtx->colCtx, this->actor.floorBgId); + func_80043508(&play->colCtx, this->actor.floorBgId); } } // This block extracts the conveyor properties from the floor poly - sConveyorSpeedIndex = SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, floorPoly, this->actor.floorBgId); + sConveyorSpeedIndex = SurfaceType_GetConveyorSpeed(&play->colCtx, floorPoly, this->actor.floorBgId); if (sConveyorSpeedIndex != 0) { - sIsFloorConveyor = SurfaceType_IsFloorConveyor(&globalCtx->colCtx, floorPoly, this->actor.floorBgId); + sIsFloorConveyor = SurfaceType_IsFloorConveyor(&play->colCtx, floorPoly, this->actor.floorBgId); if ((!sIsFloorConveyor && (this->actor.yDistToWater > 20.0f) && (this->currentBoots != PLAYER_BOOTS_IRON)) || (sIsFloorConveyor && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { - sConveyorYaw = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, floorPoly, this->actor.floorBgId) * - (0x10000 / 64); + sConveyorYaw = + SurfaceType_GetConveyorDirection(&play->colCtx, floorPoly, this->actor.floorBgId) * (0x10000 / 64); } else { sConveyorSpeedIndex = 0; } } } - func_80839034(globalCtx, this, floorPoly, this->actor.floorBgId); + func_80839034(play, this, floorPoly, this->actor.floorBgId); this->actor.bgCheckFlags &= ~BGCHECKFLAG_PLAYER_WALL_INTERACT; @@ -9740,7 +9725,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { D_80854798.z = this->ageProperties->unk_38 + 10.0f; if (!(this->stateFlags2 & PLAYER_STATE2_18) && - func_80839768(globalCtx, this, &D_80854798, &spA0, &sp9C, &D_80858AA8)) { + func_80839768(play, this, &D_80854798, &spA0, &sp9C, &D_80858AA8)) { this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_WALL_INTERACT; if (this->actor.wallPoly != spA0) { this->actor.wallPoly = spA0; @@ -9751,7 +9736,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { sp9A = this->actor.shape.rot.y - (s16)(this->actor.wallYaw + 0x8000); - D_808535F0 = func_80041DB8(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId); + D_808535F0 = func_80041DB8(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId); D_80853608 = ABS(sp9A); @@ -9794,23 +9779,23 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { sp68.z = this->actor.world.pos.z - (spB0 * wallPolyNormalZ); sp68.y = this->actor.world.pos.y + this->ageProperties->unk_0C; - sp64 = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp7C, &sp68); + sp64 = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp7C, &sp68); wallHeight = sp64 - this->actor.world.pos.y; this->wallHeight = wallHeight; if ((this->wallHeight < 18.0f) || - BgCheck_EntityCheckCeiling(&globalCtx->colCtx, &sp60, &this->actor.world.pos, + BgCheck_EntityCheckCeiling(&play->colCtx, &sp60, &this->actor.world.pos, (sp64 - this->actor.world.pos.y) + 20.0f, &sp78, &sp74, &this->actor)) { this->wallHeight = 399.96002f; } else { D_80854798.y = (sp64 + 5.0f) - this->actor.world.pos.y; - if (func_80839768(globalCtx, this, &D_80854798, &sp78, &sp74, &D_80858AA8) && + if (func_80839768(play, this, &D_80854798, &sp78, &sp74, &D_80858AA8) && (temp3 = this->actor.wallYaw - Math_Atan2S(sp78->normal.z, sp78->normal.x), ABS(temp3) < 0x4000) && - !func_80041E18(&globalCtx->colCtx, sp78, sp74)) { + !func_80041E18(&play->colCtx, sp78, sp74)) { this->wallHeight = 399.96002f; - } else if (func_80041DE4(&globalCtx->colCtx, wallPoly, this->actor.wallBgId) == 0) { + } else if (func_80041DE4(&play->colCtx, wallPoly, this->actor.wallBgId) == 0) { if (this->ageProperties->unk_1C <= this->wallHeight) { if (ABS(sp7C->normal.y) > 28000) { if (this->ageProperties->unk_14 <= this->wallHeight) { @@ -9844,7 +9829,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - D_808535E4 = func_80041D4C(&globalCtx->colCtx, floorPoly, this->actor.floorBgId); + D_808535E4 = func_80041D4C(&play->colCtx, floorPoly, this->actor.floorBgId); if (!func_80847A78(this)) { f32 floorPolyNormalX; @@ -9856,7 +9841,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { s32 pad3; if (this->actor.floorBgId != BGCHECK_SCENE) { - func_800434C8(&globalCtx->colCtx, this->actor.floorBgId); + func_800434C8(&play->colCtx, this->actor.floorBgId); } floorPolyNormalX = COLPOLY_GET_NORMAL(floorPoly->normal.x); @@ -9877,7 +9862,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { D_80853610 = Math_Atan2S(1.0f, (-(floorPolyNormalX * sp4C) - (floorPolyNormalZ * sp44)) * invFloorPolyNormalY); - func_8083E318(globalCtx, this, floorPoly); + func_8083E318(play, this, floorPoly); } } else { func_80847A78(this); @@ -9891,7 +9876,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { } } -void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) { +void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { u8 seqMode; s32 pad; Actor* unk_664; @@ -9901,11 +9886,11 @@ void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) { seqMode = SEQ_MODE_DEFAULT; if (this->csMode != 0) { - Camera_ChangeMode(Play_GetCamera(globalCtx, CAM_ID_MAIN), CAM_MODE_NORMAL); + Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_NORMAL); } else if (!(this->stateFlags1 & PLAYER_STATE1_20)) { if ((this->actor.parent != NULL) && (this->stateFlags3 & PLAYER_STATE3_7)) { camMode = CAM_MODE_HOOKSHOT; - Camera_SetParam(Play_GetCamera(globalCtx, CAM_ID_MAIN), 8, this->actor.parent); + Camera_SetParam(Play_GetCamera(play, CAM_ID_MAIN), 8, this->actor.parent); } else if (func_8084377C == this->func_674) { camMode = CAM_MODE_STILL; } else if (this->stateFlags2 & PLAYER_STATE2_8) { @@ -9922,12 +9907,12 @@ void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) { } else { camMode = CAM_MODE_BATTLE; } - Camera_SetParam(Play_GetCamera(globalCtx, CAM_ID_MAIN), 8, unk_664); + Camera_SetParam(Play_GetCamera(play, CAM_ID_MAIN), 8, unk_664); } else if (this->stateFlags1 & PLAYER_STATE1_12) { camMode = CAM_MODE_CHARGE; } else if (this->stateFlags1 & PLAYER_STATE1_25) { camMode = CAM_MODE_FOLLOWBOOMERANG; - Camera_SetParam(Play_GetCamera(globalCtx, CAM_ID_MAIN), 8, this->boomerangActor); + Camera_SetParam(Play_GetCamera(play, CAM_ID_MAIN), 8, this->boomerangActor); } else if (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14)) { if (func_80833B2C(this)) { camMode = CAM_MODE_HANGZ; @@ -9962,18 +9947,18 @@ void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) { } } - Camera_ChangeMode(Play_GetCamera(globalCtx, CAM_ID_MAIN), camMode); + Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), camMode); } else { // First person mode seqMode = SEQ_MODE_STILL; } - if (globalCtx->actorCtx.targetCtx.bgmEnemy != NULL) { + if (play->actorCtx.targetCtx.bgmEnemy != NULL) { seqMode = SEQ_MODE_ENEMY; - Audio_SetBgmEnemyVolume(sqrtf(globalCtx->actorCtx.targetCtx.bgmEnemy->xyzDistToPlayerSq)); + Audio_SetBgmEnemyVolume(sqrtf(play->actorCtx.targetCtx.bgmEnemy->xyzDistToPlayerSq)); } - if (globalCtx->sceneNum != SCENE_TURIBORI) { + if (play->sceneNum != SCENE_TURIBORI) { Audio_SetSequenceMode(seqMode); } } @@ -9985,11 +9970,11 @@ static Vec3f D_808547B0 = { 0.0f, 0.5f, 0.0f }; static Color_RGBA8 D_808547BC = { 255, 255, 100, 255 }; static Color_RGBA8 D_808547C0 = { 255, 50, 0, 0 }; -void func_80848A04(GlobalContext* globalCtx, Player* this) { +void func_80848A04(PlayState* play, Player* this) { f32 temp; if (this->unk_85C == 0.0f) { - func_80835F44(globalCtx, this, 0xFF); + func_80835F44(play, this, 0xFF); return; } @@ -10006,11 +9991,11 @@ void func_80848A04(GlobalContext* globalCtx, Player* this) { this->unk_85C = temp; } - func_8002836C(globalCtx, &this->meleeWeaponInfo[0].tip, &D_808547A4, &D_808547B0, &D_808547BC, &D_808547C0, + func_8002836C(play, &this->meleeWeaponInfo[0].tip, &D_808547A4, &D_808547B0, &D_808547BC, &D_808547C0, temp * 200.0f, 0, 8); } -void func_80848B44(GlobalContext* globalCtx, Player* this) { +void func_80848B44(PlayState* play, Player* this) { Vec3f shockPos; Vec3f* randBodyPart; s32 shockScale; @@ -10031,12 +10016,12 @@ void func_80848B44(GlobalContext* globalCtx, Player* this) { shockPos.y = (Rand_CenteredFloat(5.0f) + randBodyPart->y) - this->actor.world.pos.y; shockPos.z = (Rand_CenteredFloat(5.0f) + randBodyPart->z) - this->actor.world.pos.z; - EffectSsFhgFlash_SpawnShock(globalCtx, &this->actor, &shockPos, shockScale, FHGFLASH_SHOCK_PLAYER); + EffectSsFhgFlash_SpawnShock(play, &this->actor, &shockPos, shockScale, FHGFLASH_SHOCK_PLAYER); func_8002F8F0(&this->actor, NA_SE_PL_SPARK - SFX_FLAG); } } -void func_80848C74(GlobalContext* globalCtx, Player* this) { +void func_80848C74(PlayState* play, Player* this) { s32 spawnedFlame; u8* timerPtr; s32 timerStep; @@ -10062,7 +10047,7 @@ void func_80848C74(GlobalContext* globalCtx, Player* this) { sp58 = 0; } - func_8083819C(this, globalCtx); + func_8083819C(this, play); for (i = 0; i < PLAYER_BODYPART_MAX; i++, timerPtr++) { timerStep = sp58 + sp54; @@ -10082,21 +10067,21 @@ void func_80848C74(GlobalContext* globalCtx, Player* this) { flameIntensity = (*timerPtr - 25.0f) * 0.02f; flameIntensity = CLAMP(flameIntensity, 0.0f, 1.0f); - EffectSsFireTail_SpawnFlameOnPlayer(globalCtx, flameScale, i, flameIntensity); + EffectSsFireTail_SpawnFlameOnPlayer(play, flameScale, i, flameIntensity); } } if (spawnedFlame) { func_8002F7DC(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); - if (globalCtx->sceneNum == SCENE_JYASINBOSS) { + if (play->sceneNum == SCENE_JYASINBOSS) { dmgCooldown = 0; } else { dmgCooldown = 7; } - if ((dmgCooldown & globalCtx->gameplayFrames) == 0) { - Player_InflictDamage(globalCtx, -1); + if ((dmgCooldown & play->gameplayFrames) == 0) { + Player_InflictDamage(play, -1); } } else { this->isBurning = false; @@ -10130,7 +10115,7 @@ static Vec3f D_80854814 = { 0.0f, 0.0f, 200.0f }; static f32 sWaterConveyorSpeeds[] = { 2.0f, 4.0f, 7.0f }; static f32 sFloorConveyorSpeeds[] = { 0.5f, 1.0f, 3.0f }; -void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { +void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { s32 pad; sControlInput = input; @@ -10167,26 +10152,26 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { this->unk_890--; } - func_808473D4(globalCtx, this); - func_80836BEC(this, globalCtx); + func_808473D4(play, this); + func_80836BEC(this, play); if ((this->heldItemActionParam == PLAYER_AP_STICK) && (this->unk_860 != 0)) { - func_80848A04(globalCtx, this); + func_80848A04(play, this); } else if ((this->heldItemActionParam == PLAYER_AP_FISHING_POLE) && (this->unk_860 < 0)) { this->unk_860++; } if (this->shockTimer != 0) { - func_80848B44(globalCtx, this); + func_80848B44(play, this); } if (this->isBurning) { - func_80848C74(globalCtx, this); + func_80848C74(play, this); } if ((this->stateFlags3 & PLAYER_STATE3_6) && (gSaveContext.nayrusLoveTimer != 0) && (gSaveContext.unk_13F0 == 0)) { gSaveContext.unk_13F0 = 3; - func_80846A00(globalCtx, this, 1); + func_80846A00(play, this, 1); this->stateFlags3 &= ~PLAYER_STATE3_6; } @@ -10196,7 +10181,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { Actor_MoveForward(&this->actor); } - func_80847BA0(globalCtx, this); + func_80847BA0(play, this); } else { f32 temp_f0; f32 phi_f12; @@ -10204,7 +10189,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { if (this->currentBoots != this->prevBoots) { if (this->currentBoots == PLAYER_BOOTS_IRON) { if (this->stateFlags1 & PLAYER_STATE1_27) { - func_80832340(globalCtx, this); + func_80832340(play, this); if (this->ageProperties->unk_2C < this->actor.yDistToWater) { this->stateFlags2 |= PLAYER_STATE2_10; } @@ -10212,7 +10197,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { } else { if (this->stateFlags1 & PLAYER_STATE1_27) { if ((this->prevBoots == PLAYER_BOOTS_IRON) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_8083D36C(globalCtx, this); + func_8083D36C(play, this); this->stateFlags2 &= ~PLAYER_STATE2_10; } } @@ -10223,10 +10208,10 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { if ((this->actor.parent == NULL) && (this->stateFlags1 & PLAYER_STATE1_23)) { this->actor.parent = this->rideActor; - func_8083A360(globalCtx, this); + func_8083A360(play, this); this->stateFlags1 |= PLAYER_STATE1_23; - func_80832264(globalCtx, this, &gPlayerAnim_0033B8); - func_80832F54(globalCtx, this, 0x9B); + func_80832264(play, this, &gPlayerAnim_0033B8); + func_80832F54(play, this, 0x9B); this->unk_850 = 99; } @@ -10241,7 +10226,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { Math_ScaledStepToS(&this->unk_6C2, 0, 400); func_80032CB4(this->unk_3A8, 20, 80, 6); - this->actor.shape.face = this->unk_3A8[0] + ((globalCtx->gameplayFrames & 32) ? 0 : 3); + this->actor.shape.face = this->unk_3A8[0] + ((play->gameplayFrames & 32) ? 0 : 3); if (this->currentMask == PLAYER_MASK_BUNNY) { func_8085002C(this); @@ -10289,7 +10274,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { func_8002D868(&this->actor); - if ((this->pushedSpeed != 0.0f) && !Player_InCsMode(globalCtx) && + if ((this->pushedSpeed != 0.0f) && !Player_InCsMode(play) && !(this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21)) && (func_80845668 != this->func_674) && (func_808507F4 != this->func_674)) { this->actor.velocity.x += this->pushedSpeed * Math_SinS(this->pushedYaw); @@ -10297,7 +10282,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { } func_8002D7EC(&this->actor); - func_80847BA0(globalCtx, this); + func_80847BA0(play, this); } else { D_808535E4 = 0; this->unk_A7A = 0; @@ -10309,13 +10294,13 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { Vec3f sp4C; if (!(rideActor->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_808396F4(globalCtx, this, &D_80854814, &sp4C, &sp5C, &sp58); + func_808396F4(play, this, &D_80854814, &sp4C, &sp5C, &sp58); } else { sp5C = rideActor->actor.floorPoly; sp58 = rideActor->actor.floorBgId; } - if ((sp5C != NULL) && func_80839034(globalCtx, this, sp5C, sp58)) { + if ((sp5C != NULL) && func_80839034(play, this, sp5C, sp58)) { if (DREG(25) != 0) { DREG(25) = 0; } else { @@ -10353,23 +10338,23 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { Math_StepToF(&this->pushedSpeed, 0.0f, (this->stateFlags1 & PLAYER_STATE1_27) ? 0.5f : 1.0f); } - if (!Player_InBlockingCsMode(globalCtx, this) && !(this->stateFlags2 & PLAYER_STATE2_18)) { - func_8083D53C(globalCtx, this); + if (!Player_InBlockingCsMode(play, this) && !(this->stateFlags2 & PLAYER_STATE2_18)) { + func_8083D53C(play, this); if ((this->actor.category == ACTORCAT_PLAYER) && (gSaveContext.health == 0)) { if (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21)) { - func_80832440(globalCtx, this); - func_80837B9C(this, globalCtx); + func_80832440(play, this); + func_80837B9C(this, play); } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & PLAYER_STATE1_27)) { - func_80836448(globalCtx, this, + func_80836448(play, this, func_808332B8(this) ? &gPlayerAnim_003310 : (this->shockTimer != 0) ? &gPlayerAnim_002F08 : &gPlayerAnim_002878); } } else { - if ((this->actor.parent == NULL) && ((globalCtx->transitionTrigger == TRANS_TRIGGER_START) || - (this->unk_A87 != 0) || !func_808382DC(this, globalCtx))) { - func_8083AA10(this, globalCtx); + if ((this->actor.parent == NULL) && ((play->transitionTrigger == TRANS_TRIGGER_START) || + (this->unk_A87 != 0) || !func_808382DC(this, play))) { + func_8083AA10(this, play); } else { this->fallStartHeight = this->actor.world.pos.y; } @@ -10377,17 +10362,16 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { } } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (this->csMode != 6) && - !(this->stateFlags1 & PLAYER_STATE1_23) && !(this->stateFlags2 & PLAYER_STATE2_7) && - (this->actor.category == ACTORCAT_PLAYER)) { - CsCmdActorAction* linkActionCsCmd = globalCtx->csCtx.linkAction; + if ((play->csCtx.state != CS_STATE_IDLE) && (this->csMode != 6) && !(this->stateFlags1 & PLAYER_STATE1_23) && + !(this->stateFlags2 & PLAYER_STATE2_7) && (this->actor.category == ACTORCAT_PLAYER)) { + CsCmdActorAction* linkActionCsCmd = play->csCtx.linkAction; if ((linkActionCsCmd != NULL) && (D_808547C4[linkActionCsCmd->action] != 0)) { - func_8002DF54(globalCtx, NULL, 6); + func_8002DF54(play, NULL, 6); func_80832210(this); } else if ((this->csMode == 0) && !(this->stateFlags2 & PLAYER_STATE2_10) && - (globalCtx->csCtx.state != CS_STATE_UNSKIPPABLE_INIT)) { - func_8002DF54(globalCtx, NULL, 0x31); + (play->csCtx.state != CS_STATE_UNSKIPPABLE_INIT)) { + func_8002DF54(play, NULL, 0x31); func_80832210(this); } } @@ -10397,13 +10381,13 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { !(this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21 | PLAYER_STATE1_26))) { this->unk_6AD = 3; } else if (func_80852E14 != this->func_674) { - func_80852944(globalCtx, this, NULL); + func_80852944(play, this, NULL); } } else { this->prevCsMode = 0; } - func_8083D6EC(globalCtx, this); + func_8083D6EC(play, this); if ((this->unk_664 == NULL) && (this->naviTextId == 0)) { this->stateFlags2 &= ~(PLAYER_STATE2_1 | PLAYER_STATE2_21); @@ -10416,7 +10400,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { this->stateFlags3 &= ~PLAYER_STATE3_4; func_80847298(this); - func_8083315C(globalCtx, this); + func_8083315C(play, this); if (this->stateFlags1 & PLAYER_STATE1_27) { D_808535E8 = 0.5f; @@ -10429,17 +10413,17 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { D_80858AA4 = this->currentMask; if (!(this->stateFlags3 & PLAYER_STATE3_2)) { - this->func_674(this, globalCtx); + this->func_674(this, play); } - Player_UpdateCamAndSeqModes(globalCtx, this); + Player_UpdateCamAndSeqModes(play, this); if (this->skelAnime.moveFlags & 8) { - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, (this->skelAnime.moveFlags & 4) ? 1.0f : this->ageProperties->unk_08); } - func_808368EC(this, globalCtx); + func_808368EC(this, play); if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_8)) { this->targetActorDistance = 0.0f; @@ -10495,19 +10479,19 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { if (!(this->stateFlags2 & PLAYER_STATE2_14)) { if (!(this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_23))) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder.base); } if (!(this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_26)) && (this->invincibilityTimer <= 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder.base); if (this->invincibilityTimer < 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinder.base); } } } - AnimationContext_SetNextQueue(globalCtx); + AnimationContext_SetNextQueue(play); } Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); @@ -10521,18 +10505,18 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { this->stateFlags3 &= ~PLAYER_STATE3_2; - Collider_ResetCylinderAC(globalCtx, &this->cylinder.base); + Collider_ResetCylinderAC(play, &this->cylinder.base); - Collider_ResetQuadAT(globalCtx, &this->meleeWeaponQuads[0].base); - Collider_ResetQuadAT(globalCtx, &this->meleeWeaponQuads[1].base); + Collider_ResetQuadAT(play, &this->meleeWeaponQuads[0].base); + Collider_ResetQuadAT(play, &this->meleeWeaponQuads[1].base); - Collider_ResetQuadAC(globalCtx, &this->shieldQuad.base); - Collider_ResetQuadAT(globalCtx, &this->shieldQuad.base); + Collider_ResetQuadAC(play, &this->shieldQuad.base); + Collider_ResetQuadAT(play, &this->shieldQuad.base); } static Vec3f D_80854838 = { 0.0f, 0.0f, -30.0f }; -void Player_Update(Actor* thisx, GlobalContext* globalCtx) { +void Player_Update(Actor* thisx, PlayState* play) { static Vec3f sDogSpawnPos; Player* this = (Player*)thisx; s32 dogParams; @@ -10540,17 +10524,17 @@ void Player_Update(Actor* thisx, GlobalContext* globalCtx) { Input sp44; Actor* dog; - if (func_8084FCAC(this, globalCtx)) { + if (func_8084FCAC(this, play)) { if (gSaveContext.dogParams < 0) { - if (Object_GetIndex(&globalCtx->objectCtx, OBJECT_DOG) < 0) { + if (Object_GetIndex(&play->objectCtx, OBJECT_DOG) < 0) { gSaveContext.dogParams = 0; } else { gSaveContext.dogParams &= 0x7FFF; func_808395DC(this, &this->actor.world.pos, &D_80854838, &sDogSpawnPos); dogParams = gSaveContext.dogParams; - dog = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_DOG, sDogSpawnPos.x, sDogSpawnPos.y, - sDogSpawnPos.z, 0, this->actor.shape.rot.y, 0, dogParams | 0x8000); + dog = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DOG, sDogSpawnPos.x, sDogSpawnPos.y, sDogSpawnPos.z, + 0, this->actor.shape.rot.y, 0, dogParams | 0x8000); if (dog != NULL) { dog->room = 0; } @@ -10562,20 +10546,20 @@ void Player_Update(Actor* thisx, GlobalContext* globalCtx) { } if ((this->heldActor != NULL) && (this->heldActor->update == NULL)) { - func_808323B4(globalCtx, this); + func_808323B4(play, this); } if (this->stateFlags1 & (PLAYER_STATE1_5 | PLAYER_STATE1_29)) { bzero(&sp44, sizeof(sp44)); } else { - sp44 = globalCtx->state.input[0]; + sp44 = play->state.input[0]; if (this->unk_88E != 0) { sp44.cur.button &= ~(BTN_A | BTN_B | BTN_CUP); sp44.press.button &= ~(BTN_A | BTN_B | BTN_CUP); } } - Player_UpdateCommon(this, globalCtx, &sp44); + Player_UpdateCommon(this, play, &sp44); } MREG(52) = this->actor.world.pos.x; @@ -10594,21 +10578,20 @@ static Gfx* sMaskDlists[PLAYER_MASK_MAX - 1] = { static Vec3s D_80854864 = { 0, 0, 0 }; -void Player_DrawGameplay(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* cullDList, - OverrideLimbDrawOpa overrideLimbDraw) { +void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, OverrideLimbDrawOpa overrideLimbDraw) { static s32 D_8085486C = 255; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 19228); + OPEN_DISPS(play->state.gfxCtx, "../z_player.c", 19228); gSPSegment(POLY_OPA_DISP++, 0x0C, cullDList); gSPSegment(POLY_XLU_DISP++, 0x0C, cullDList); - Player_DrawImpl(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, lod, + Player_DrawImpl(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, lod, this->currentTunic, this->currentBoots, this->actor.shape.face, overrideLimbDraw, Player_PostLimbDrawGameplay, this); if ((overrideLimbDraw == Player_OverrideLimbDrawGameplayDefault) && (this->currentMask != PLAYER_MASK_NONE)) { - Mtx* sp70 = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Mtx)); + Mtx* sp70 = Graph_Alloc(play->state.gfxCtx, 2 * sizeof(Mtx)); if (this->currentMask == PLAYER_MASK_BUNNY) { Vec3s sp68; @@ -10656,25 +10639,25 @@ void Player_DrawGameplay(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* c this->actor.world.pos.z, &D_80854864); Matrix_Scale(4.0f, 4.0f, 4.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player.c", 19317), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player.c", 19317), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 32, 1, 0, - (globalCtx->gameplayFrames * -15) % 128, 16, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 16, 32, 1, 0, (play->gameplayFrames * -15) % 128, + 16, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, D_8085486C); gDPSetEnvColor(POLY_XLU_DISP++, 120, 90, 30, 128); gSPDisplayList(POLY_XLU_DISP++, gHoverBootsCircleDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 19328); + CLOSE_DISPS(play->state.gfxCtx, "../z_player.c", 19328); } -void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void Player_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Player* this = (Player*)thisx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 19346); + OPEN_DISPS(play->state.gfxCtx, "../z_player.c", 19346); if (!(this->stateFlags2 & PLAYER_STATE2_29)) { OverrideLimbDrawOpa overrideLimbDraw = Player_OverrideLimbDrawGameplayDefault; @@ -10687,8 +10670,8 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { lod = 1; } - func_80093C80(globalCtx); - func_80093D84(globalCtx->state.gfxCtx); + func_80093C80(play); + func_80093D84(play->state.gfxCtx); if (this->invincibilityTimer > 0) { this->unk_88F += CLAMP(50 - this->invincibilityTimer, 8, 40); @@ -10696,13 +10679,13 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { Gfx_SetFog2(POLY_OPA_DISP, 255, 0, 0, 0, 0, 4000 - (s32)(Math_CosS(this->unk_88F * 256) * 2000.0f)); } - func_8002EBCC(&this->actor, globalCtx, 0); - func_8002ED80(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, play, 0); + func_8002ED80(&this->actor, play, 0); if (this->unk_6AD != 0) { Vec3f projectedHeadPos; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->actor.focus.pos, &projectedHeadPos); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->actor.focus.pos, &projectedHeadPos); if (projectedHeadPos.z < -4.0f) { overrideLimbDraw = Player_OverrideLimbDrawGameplayFirstPerson; } @@ -10713,8 +10696,8 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { } if (this->stateFlags2 & PLAYER_STATE2_26) { - f32 sp78 = BINANG_TO_RAD_ALT2((u16)(globalCtx->gameplayFrames * 600)); - f32 sp74 = BINANG_TO_RAD_ALT2((u16)(globalCtx->gameplayFrames * 1000)); + f32 sp78 = BINANG_TO_RAD_ALT2((u16)(play->gameplayFrames * 600)); + f32 sp74 = BINANG_TO_RAD_ALT2((u16)(play->gameplayFrames * 1000)); Matrix_Push(); this->actor.scale.y = -this->actor.scale.y; @@ -10729,7 +10712,7 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(1.1f, 0.95f, 1.05f, MTXMODE_APPLY); Matrix_RotateY(-sp74, MTXMODE_APPLY); Matrix_RotateX(-sp78, MTXMODE_APPLY); - Player_DrawGameplay(globalCtx, this, lod, gCullFrontDList, overrideLimbDraw); + Player_DrawGameplay(play, this, lod, gCullFrontDList, overrideLimbDraw); this->actor.scale.y = -this->actor.scale.y; Matrix_Pop(); } @@ -10737,50 +10720,50 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { gSPClearGeometryMode(POLY_OPA_DISP++, G_CULL_BOTH); gSPClearGeometryMode(POLY_XLU_DISP++, G_CULL_BOTH); - Player_DrawGameplay(globalCtx, this, lod, gCullBackDList, overrideLimbDraw); + Player_DrawGameplay(play, this, lod, gCullBackDList, overrideLimbDraw); if (this->invincibilityTimer > 0) { - POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); } if (this->stateFlags2 & PLAYER_STATE2_14) { f32 scale = (this->unk_84F >> 1) * 22.0f; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (0 - globalCtx->gameplayFrames) % 128, 32, 32, 1, - 0, (globalCtx->gameplayFrames * -2) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (0 - play->gameplayFrames) % 128, 32, 32, 1, 0, + (play->gameplayFrames * -2) % 128, 32, 32)); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player.c", 19459), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player.c", 19459), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, 255); gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL); } if (this->unk_862 > 0) { - Player_DrawGetItem(globalCtx, this); + Player_DrawGetItem(play, this); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 19473); + CLOSE_DISPS(play->state.gfxCtx, "../z_player.c", 19473); } -void Player_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void Player_Destroy(Actor* thisx, PlayState* play) { Player* this = (Player*)thisx; - Effect_Delete(globalCtx, this->meleeWeaponEffectIndex); + Effect_Delete(play, this->meleeWeaponEffectIndex); - Collider_DestroyCylinder(globalCtx, &this->cylinder); - Collider_DestroyQuad(globalCtx, &this->meleeWeaponQuads[0]); - Collider_DestroyQuad(globalCtx, &this->meleeWeaponQuads[1]); - Collider_DestroyQuad(globalCtx, &this->shieldQuad); + Collider_DestroyCylinder(play, &this->cylinder); + Collider_DestroyQuad(play, &this->meleeWeaponQuads[0]); + Collider_DestroyQuad(play, &this->meleeWeaponQuads[1]); + Collider_DestroyQuad(play, &this->shieldQuad); - func_800876C8(globalCtx); + func_800876C8(play); - gSaveContext.linkAge = globalCtx->linkAgeOnLoad; + gSaveContext.linkAge = play->linkAgeOnLoad; } -s16 func_8084ABD8(GlobalContext* globalCtx, Player* this, s32 arg2, s16 arg3) { +s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) { s32 temp1; s16 temp2; s16 temp3; @@ -10808,8 +10791,7 @@ s16 func_8084ABD8(GlobalContext* globalCtx, Player* this, s32 arg2, s16 arg3) { } this->unk_6AE |= 2; - return func_80836AB8(this, (globalCtx->shootingGalleryStatus != 0) || func_8002DD78(this) || func_808334B4(this)) - - arg3; + return func_80836AB8(this, (play->shootingGalleryStatus != 0) || func_8002DD78(this) || func_808334B4(this)) - arg3; } void func_8084AEEC(Player* this, f32* arg1, f32 arg2, s16 arg3) { @@ -10883,7 +10865,7 @@ void func_8084B000(Player* this) { this->actor.gravity = 0.0f; } -void func_8084B158(GlobalContext* globalCtx, Player* this, Input* input, f32 arg3) { +void func_8084B158(PlayState* play, Player* this, Input* input, f32 arg3) { f32 temp; if ((input != NULL) && CHECK_BTN_ANY(input->press.button, BTN_A | BTN_B)) { @@ -10899,10 +10881,10 @@ void func_8084B158(GlobalContext* globalCtx, Player* this, Input* input, f32 arg } this->skelAnime.playSpeed = temp; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); } -void func_8084B1D8(Player* this, GlobalContext* globalCtx) { +void func_8084B1D8(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_27) { func_8084B000(this); func_8084AEEC(this, &this->linearVelocity, 0, this->actor.shape.rot.y); @@ -10911,40 +10893,40 @@ void func_8084B1D8(Player* this, GlobalContext* globalCtx) { } if ((this->unk_6AD == 2) && (func_8002DD6C(this) || func_808332E4(this))) { - func_80836670(this, globalCtx); + func_80836670(this, play); } if ((this->csMode != 0) || (this->unk_6AD == 0) || (this->unk_6AD >= 4) || func_80833B54(this) || - (this->unk_664 != NULL) || !func_8083AD4C(globalCtx, this) || + (this->unk_664 != NULL) || !func_8083AD4C(play, this) || (((this->unk_6AD == 2) && (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_R) || func_80833B2C(this) || (!func_8002DD78(this) && !func_808334B4(this)))) || ((this->unk_6AD == 1) && CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)))) { - func_8083C148(this, globalCtx); + func_8083C148(this, play); func_80078884(NA_SE_SY_CAMERA_ZOOM_UP); } else if ((DECR(this->unk_850) == 0) || (this->unk_6AD != 2)) { if (func_8008F128(this)) { this->unk_6AE |= 0x43; } else { - this->actor.shape.rot.y = func_8084ABD8(globalCtx, this, 0, 0); + this->actor.shape.rot.y = func_8084ABD8(play, this, 0, 0); } } this->currentYaw = this->actor.shape.rot.y; } -s32 func_8084B3CC(GlobalContext* globalCtx, Player* this) { - if (globalCtx->shootingGalleryStatus != 0) { - func_80832564(globalCtx, this); - func_80835C58(globalCtx, this, func_8084FA54, 0); +s32 func_8084B3CC(PlayState* play, Player* this) { + if (play->shootingGalleryStatus != 0) { + func_80832564(play, this); + func_80835C58(play, this, func_8084FA54, 0); if (!func_8002DD6C(this) || Player_HoldsHookshot(this)) { - func_80835F44(globalCtx, this, 3); + func_80835F44(play, this, 3); } this->stateFlags1 |= PLAYER_STATE1_20; - func_80832264(globalCtx, this, func_80833338(this)); + func_80832264(play, this, func_80833338(this)); func_80832210(this); func_8083B010(this); return 1; @@ -10958,41 +10940,41 @@ void func_8084B498(Player* this) { (INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY) ? PLAYER_AP_OCARINA_FAIRY : PLAYER_AP_OCARINA_TIME; } -s32 func_8084B4D4(GlobalContext* globalCtx, Player* this) { +s32 func_8084B4D4(PlayState* play, Player* this) { if (this->stateFlags3 & PLAYER_STATE3_5) { this->stateFlags3 &= ~PLAYER_STATE3_5; func_8084B498(this); this->unk_6AD = 4; - func_8083B040(this, globalCtx); + func_8083B040(this, play); return 1; } return 0; } -void func_8084B530(Player* this, GlobalContext* globalCtx) { +void func_8084B530(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - func_80836670(this, globalCtx); + func_80836670(this, play); - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_8; if (!CHECK_FLAG_ALL(this->targetActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { this->stateFlags2 &= ~PLAYER_STATE2_13; } - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); - if (!func_8084B4D4(globalCtx, this) && !func_8084B3CC(globalCtx, this) && !func_8083ADD4(globalCtx, this)) { - if ((this->targetActor != this->interactRangeActor) || !func_8083E5A8(this, globalCtx)) { + if (!func_8084B4D4(play, this) && !func_8084B3CC(play, this) && !func_8083ADD4(play, this)) { + if ((this->targetActor != this->interactRangeActor) || !func_8083E5A8(this, play)) { if (this->stateFlags1 & PLAYER_STATE1_23) { s32 sp24 = this->unk_850; - func_8083A360(globalCtx, this); + func_8083A360(play, this); this->unk_850 = sp24; } else if (func_808332B8(this)) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } else { - func_80853080(this, globalCtx); + func_80853080(this, play); } } } @@ -11002,20 +10984,20 @@ void func_8084B530(Player* this, GlobalContext* globalCtx) { } if (this->stateFlags1 & PLAYER_STATE1_23) { - func_8084CC98(this, globalCtx); + func_8084CC98(this, play); } else if (func_808332B8(this)) { - func_8084D610(this, globalCtx); - } else if (!func_8008E9C4(this) && LinkAnimation_Update(globalCtx, &this->skelAnime)) { + func_8084D610(this, play); + } else if (!func_8008E9C4(this) && LinkAnimation_Update(play, &this->skelAnime)) { if (this->skelAnime.moveFlags != 0) { func_80832DBC(this); if ((this->targetActor->category == ACTORCAT_NPC) && (this->heldItemActionParam != PLAYER_AP_FISHING_POLE)) { - func_808322D0(globalCtx, this, &gPlayerAnim_0031A0); + func_808322D0(play, this, &gPlayerAnim_0031A0); } else { - func_80832284(globalCtx, this, func_80833338(this)); + func_80832284(play, this, func_80833338(this)); } } else { - func_808322A4(globalCtx, this, &gPlayerAnim_0031A8); + func_808322A4(play, this, &gPlayerAnim_0031A8); } } @@ -11024,30 +11006,30 @@ void func_8084B530(Player* this, GlobalContext* globalCtx) { } } -void func_8084B78C(Player* this, GlobalContext* globalCtx) { +void func_8084B78C(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; - func_8083F524(globalCtx, this); + func_8083F524(play, this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - if (!func_8083F9D0(globalCtx, this)) { - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime)) { + if (!func_8083F9D0(play, this)) { + func_80837268(this, &sp34, &sp32, 0.0f, play); temp = func_8083FFB8(this, &sp34, &sp32); if (temp > 0) { - func_8083FAB8(this, globalCtx); + func_8083FAB8(this, play); } else if (temp < 0) { - func_8083FB14(this, globalCtx); + func_8083FB14(this, play); } } } } -void func_8084B840(GlobalContext* globalCtx, Player* this, f32 arg2) { +void func_8084B840(PlayState* play, Player* this, f32 arg2) { if (this->actor.wallBgId != BGCHECK_SCENE) { - DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId); + DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); if (dynaPolyActor != NULL) { func_8002DFA4(dynaPolyActor, arg2, this->actor.world.rot.y); @@ -11060,14 +11042,14 @@ static struct_80832924 D_80854870[] = { { NA_SE_PL_SLIP, -0x1015 }, }; -void func_8084B898(Player* this, GlobalContext* globalCtx) { +void func_8084B898(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; - if (func_80832CB0(globalCtx, this, &gPlayerAnim_003108)) { + if (func_80832CB0(play, this, &gPlayerAnim_003108)) { this->unk_850 = 1; } else if (this->unk_850 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 11.0f)) { @@ -11076,22 +11058,22 @@ void func_8084B898(Player* this, GlobalContext* globalCtx) { } func_80832924(this, D_80854870); - func_8083F524(globalCtx, this); + func_8083F524(play, this); - if (!func_8083F9D0(globalCtx, this)) { - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); + if (!func_8083F9D0(play, this)) { + func_80837268(this, &sp34, &sp32, 0.0f, play); temp = func_8083FFB8(this, &sp34, &sp32); if (temp < 0) { - func_8083FB14(this, globalCtx); + func_8083FB14(this, play); } else if (temp == 0) { - func_8083F72C(this, &gPlayerAnim_0030E0, globalCtx); + func_8083F72C(this, &gPlayerAnim_0030E0, play); } else { this->stateFlags2 |= PLAYER_STATE2_4; } } if (this->stateFlags2 & PLAYER_STATE2_4) { - func_8084B840(globalCtx, this, 2.0f); + func_8084B840(play, this, 2.0f); this->linearVelocity = 2.0f; } } @@ -11103,7 +11085,7 @@ static struct_80832924 D_80854878[] = { static Vec3f D_80854880 = { 0.0f, 26.0f, -40.0f }; -void func_8084B9E4(Player* this, GlobalContext* globalCtx) { +void func_8084B9E4(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 sp70; s16 sp6E; @@ -11118,7 +11100,7 @@ void func_8084B9E4(Player* this, GlobalContext* globalCtx) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_36, this->modelAnimType); this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; - if (func_80832CB0(globalCtx, this, anim)) { + if (func_80832CB0(play, this, anim)) { this->unk_850 = 1; } else { if (this->unk_850 == 0) { @@ -11130,29 +11112,28 @@ void func_8084B9E4(Player* this, GlobalContext* globalCtx) { } } - func_8083F524(globalCtx, this); + func_8083F524(play, this); - if (!func_8083F9D0(globalCtx, this)) { - func_80837268(this, &sp70, &sp6E, 0.0f, globalCtx); + if (!func_8083F9D0(play, this)) { + func_80837268(this, &sp70, &sp6E, 0.0f, play); temp1 = func_8083FFB8(this, &sp70, &sp6E); if (temp1 > 0) { - func_8083FAB8(this, globalCtx); + func_8083FAB8(this, play); } else if (temp1 == 0) { - func_8083F72C(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_37, this->modelAnimType), globalCtx); + func_8083F72C(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_37, this->modelAnimType), play); } else { this->stateFlags2 |= PLAYER_STATE2_4; } } if (this->stateFlags2 & PLAYER_STATE2_4) { - temp2 = func_8083973C(globalCtx, this, &D_80854880, &sp5C) - this->actor.world.pos.y; + temp2 = func_8083973C(play, this, &D_80854880, &sp5C) - this->actor.world.pos.y; if (fabsf(temp2) < 20.0f) { sp44.x = this->actor.world.pos.x; sp44.z = this->actor.world.pos.z; sp44.y = sp5C.y; - if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp44, &sp5C, &sp38, &sp54, true, false, false, true, - &sp50)) { - func_8084B840(globalCtx, this, -2.0f); + if (!BgCheck_EntityLineTest1(&play->colCtx, &sp44, &sp5C, &sp38, &sp54, true, false, false, true, &sp50)) { + func_8084B840(play, this, -2.0f); return; } } @@ -11160,7 +11141,7 @@ void func_8084B9E4(Player* this, GlobalContext* globalCtx) { } } -void func_8084BBE4(Player* this, GlobalContext* globalCtx) { +void func_8084BBE4(Player* this, PlayState* play) { f32 sp3C; s16 sp3A; LinkAnimationHeader* anim; @@ -11168,9 +11149,9 @@ void func_8084BBE4(Player* this, GlobalContext* globalCtx) { this->stateFlags2 |= PLAYER_STATE2_6; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { // clang-format off - anim = (this->unk_84F > 0) ? &gPlayerAnim_002F28 : GET_PLAYER_ANIM(PLAYER_ANIMGROUP_40, this->modelAnimType); func_80832284(globalCtx, this, anim); + anim = (this->unk_84F > 0) ? &gPlayerAnim_002F28 : GET_PLAYER_ANIM(PLAYER_ANIMGROUP_40, this->modelAnimType); func_80832284(play, this, anim); // clang-format on } else if (this->unk_84F == 0) { if (this->skelAnime.animation == &gPlayerAnim_002F10) { @@ -11192,14 +11173,14 @@ void func_8084BBE4(Player* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->currentYaw, 0x800); if (this->unk_84F != 0) { - func_80837268(this, &sp3C, &sp3A, 0.0f, globalCtx); + func_80837268(this, &sp3C, &sp3A, 0.0f, play); if (this->unk_847[this->unk_846] >= 0) { if (this->unk_84F > 0) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_38, this->modelAnimType); } else { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_41, this->modelAnimType); } - func_8083A9B8(this, anim, globalCtx); + func_8083A9B8(this, anim, play); return; } @@ -11210,18 +11191,18 @@ void func_8084BBE4(Player* this, GlobalContext* globalCtx) { } else { this->linearVelocity = 0.8f; } - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); this->stateFlags1 &= ~(PLAYER_STATE1_13 | PLAYER_STATE1_14); } } } -void func_8084BDFC(Player* this, GlobalContext* globalCtx) { +void func_8084BDFC(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832E48(this, 1); - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); return; } @@ -11238,7 +11219,7 @@ void func_8084BEE4(Player* this) { func_8002F7DC(&this->actor, (this->unk_84F != 0) ? NA_SE_PL_WALK_WALL : NA_SE_PL_WALK_LADDER); } -void func_8084BF1C(Player* this, GlobalContext* globalCtx) { +void func_8084BF1C(Player* this, PlayState* play) { static Vec3f D_8085488C = { 0.0f, 0.0f, 26.0f }; s32 sp84; s32 sp80; @@ -11281,20 +11262,20 @@ void func_8084BF1C(Player* this, GlobalContext* globalCtx) { if (this->unk_850 >= 0) { if ((this->actor.wallPoly != NULL) && (this->actor.wallBgId != BGCHECK_SCENE)) { - DynaPolyActor* wallPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId); + DynaPolyActor* wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); if (wallPolyActor != NULL) { Math_Vec3f_Diff(&wallPolyActor->actor.world.pos, &wallPolyActor->actor.prevPos, &sp6C); Math_Vec3f_Sum(&this->actor.world.pos, &sp6C, &this->actor.world.pos); } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 26.0f, 6.0f, this->ageProperties->unk_00, + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 6.0f, this->ageProperties->unk_00, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); - func_8083F360(globalCtx, this, 26.0f, this->ageProperties->unk_3C, 50.0f, -20.0f); + func_8083F360(play, this, 26.0f, this->ageProperties->unk_3C, 50.0f, -20.0f); } - if ((this->unk_850 < 0) || !func_8083FBC0(this, globalCtx)) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime) != 0) { + if ((this->unk_850 < 0) || !func_8083FBC0(this, play)) { + if (LinkAnimation_Update(play, &this->skelAnime) != 0) { if (this->unk_850 < 0) { this->unk_850 = ABS(this->unk_850) & 1; return; @@ -11305,42 +11286,42 @@ void func_8084BF1C(Player* this, GlobalContext* globalCtx) { if (sp84 > 0) { D_8085488C.y = this->ageProperties->unk_40; - temp_f0 = func_8083973C(globalCtx, this, &D_8085488C, &sp5C); + temp_f0 = func_8083973C(play, this, &D_8085488C, &sp5C); if (this->actor.world.pos.y < temp_f0) { if (this->unk_84F != 0) { this->actor.world.pos.y = temp_f0; this->stateFlags1 &= ~PLAYER_STATE1_21; - func_8083A5C4(globalCtx, this, this->actor.wallPoly, this->ageProperties->unk_3C, + func_8083A5C4(play, this, this->actor.wallPoly, this->ageProperties->unk_3C, &gPlayerAnim_003000); this->currentYaw += 0x8000; this->actor.shape.rot.y = this->currentYaw; - func_8083A9B8(this, &gPlayerAnim_003000, globalCtx); + func_8083A9B8(this, &gPlayerAnim_003000, play); this->stateFlags1 |= PLAYER_STATE1_14; } else { - func_8083F070(this, this->ageProperties->unk_CC[this->unk_850], globalCtx); + func_8083F070(this, this->ageProperties->unk_CC[this->unk_850], play); } } else { this->skelAnime.prevTransl = this->ageProperties->unk_4A[sp68]; - func_80832264(globalCtx, this, this->ageProperties->unk_AC[sp68]); + func_80832264(play, this, this->ageProperties->unk_AC[sp68]); } } else { if ((this->actor.world.pos.y - this->actor.floorHeight) < 15.0f) { if (this->unk_84F != 0) { - func_8083FB7C(this, globalCtx); + func_8083FB7C(this, play); } else { if (this->unk_850 != 0) { this->skelAnime.prevTransl = this->ageProperties->unk_44; } - func_8083F070(this, this->ageProperties->unk_C4[this->unk_850], globalCtx); + func_8083F070(this, this->ageProperties->unk_C4[this->unk_850], play); this->unk_850 = 1; } } else { sp68 ^= 1; this->skelAnime.prevTransl = this->ageProperties->unk_62[sp68]; anim1 = this->ageProperties->unk_AC[sp68]; - LinkAnimation_Change(globalCtx, &this->skelAnime, anim1, -1.0f, Animation_GetLastFrame(anim1), - 0.0f, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime, anim1, -1.0f, Animation_GetLastFrame(anim1), 0.0f, + ANIMMODE_ONCE, 0.0f); } } this->unk_850 ^= 1; @@ -11350,11 +11331,11 @@ void func_8084BF1C(Player* this, GlobalContext* globalCtx) { if (sp80 > 0) { this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->unk_850]; - func_80832264(globalCtx, this, anim2); + func_80832264(play, this, anim2); } else { this->skelAnime.prevTransl = this->ageProperties->unk_86[this->unk_850]; - LinkAnimation_Change(globalCtx, &this->skelAnime, anim2, -1.0f, Animation_GetLastFrame(anim2), - 0.0f, ANIMMODE_ONCE, 0.0f); + LinkAnimation_Change(play, &this->skelAnime, anim2, -1.0f, Animation_GetLastFrame(anim2), 0.0f, + ANIMMODE_ONCE, 0.0f); } } else { this->stateFlags2 |= PLAYER_STATE2_12; @@ -11390,7 +11371,7 @@ static struct_80832924 D_808548A8[] = { { NA_SE_PL_WALK_LADDER, -0x81E }, }; -void func_8084C5F8(Player* this, GlobalContext* globalCtx) { +void func_8084C5F8(Player* this, PlayState* play) { s32 temp; f32* sp38; CollisionPoly* sp34; @@ -11399,15 +11380,15 @@ void func_8084C5F8(Player* this, GlobalContext* globalCtx) { this->stateFlags2 |= PLAYER_STATE2_6; - temp = func_808374A0(globalCtx, this, &this->skelAnime, 4.0f); + temp = func_808374A0(play, this, &this->skelAnime, 4.0f); if (temp == 0) { this->stateFlags1 &= ~PLAYER_STATE1_21; return; } - if ((temp > 0) || LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083C0E8(this, globalCtx); + if ((temp > 0) || LinkAnimation_Update(play, &this->skelAnime)) { + func_8083C0E8(this, play); this->stateFlags1 &= ~PLAYER_STATE1_21; return; } @@ -11423,8 +11404,8 @@ void func_8084C5F8(Player* this, GlobalContext* globalCtx) { sp24.x = this->actor.world.pos.x; sp24.y = this->actor.world.pos.y + 20.0f; sp24.z = this->actor.world.pos.z; - if (BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &sp34, &sp30, &sp24) != 0.0f) { - this->unk_89E = func_80041F10(&globalCtx->colCtx, sp34, sp30); + if (BgCheck_EntityRaycastFloor3(&play->colCtx, &sp34, &sp30, &sp24) != 0.0f) { + this->unk_89E = func_80041F10(&play->colCtx, sp34, sp30); func_808328A0(this); } } @@ -11435,17 +11416,17 @@ static struct_80832924 D_808548B4[] = { { 0, 0x3050 }, { 0, 0x3058 }, { 0, 0x3060 }, { 0, -0x3068 }, }; -void func_8084C760(Player* this, GlobalContext* globalCtx) { +void func_8084C760(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (!(this->stateFlags1 & PLAYER_STATE1_0)) { if (this->skelAnime.moveFlags != 0) { this->skelAnime.moveFlags = 0; return; } - if (!func_8083F570(this, globalCtx)) { + if (!func_8083F570(this, play)) { this->linearVelocity = sControlInput->rel.stick_y * 0.03f; } } @@ -11460,11 +11441,11 @@ static struct_80832924 D_808548D8[] = { { 0, 0x303C }, { 0, 0x3044 }, { 0, 0x304C }, { 0, -0x3054 }, }; -void func_8084C81C(Player* this, GlobalContext* globalCtx) { +void func_8084C81C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083C0E8(this, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083C0E8(this, play); this->stateFlags2 &= ~PLAYER_STATE2_18; return; } @@ -11487,7 +11468,7 @@ static Vec3f D_8085492C[] = { { -60.0f, -20.0f, 0.0f }, }; -s32 func_8084C89C(GlobalContext* globalCtx, Player* this, s32 arg2, f32* arg3) { +s32 func_8084C89C(PlayState* play, Player* this, s32 arg2, f32* arg3) { EnHorse* rideActor = (EnHorse*)this->rideActor; f32 sp50; f32 sp4C; @@ -11499,14 +11480,13 @@ s32 func_8084C89C(GlobalContext* globalCtx, Player* this, s32 arg2, f32* arg3) { sp50 = rideActor->actor.world.pos.y + 20.0f; sp4C = rideActor->actor.world.pos.y - 20.0f; - *arg3 = func_8083973C(globalCtx, this, &D_808548FC[arg2], &sp40); + *arg3 = func_8083973C(play, this, &D_808548FC[arg2], &sp40); - return (sp4C < *arg3) && (*arg3 < sp50) && - !func_80839768(globalCtx, this, &D_80854914[arg2], &sp30, &sp2C, &sp34) && - !func_80839768(globalCtx, this, &D_8085492C[arg2], &sp30, &sp2C, &sp34); + return (sp4C < *arg3) && (*arg3 < sp50) && !func_80839768(play, this, &D_80854914[arg2], &sp30, &sp2C, &sp34) && + !func_80839768(play, this, &D_8085492C[arg2], &sp30, &sp2C, &sp34); } -s32 func_8084C9BC(Player* this, GlobalContext* globalCtx) { +s32 func_8084C9BC(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; s32 sp38; f32 sp34; @@ -11515,25 +11495,25 @@ s32 func_8084C9BC(Player* this, GlobalContext* globalCtx) { this->unk_850 = 99; } else { sp38 = (this->mountSide < 0) ? 0 : 1; - if (!func_8084C89C(globalCtx, this, sp38, &sp34)) { + if (!func_8084C89C(play, this, sp38, &sp34)) { sp38 ^= 1; - if (!func_8084C89C(globalCtx, this, sp38, &sp34)) { + if (!func_8084C89C(play, this, sp38, &sp34)) { return 0; } else { this->mountSide = -this->mountSide; } } - if ((globalCtx->csCtx.state == CS_STATE_IDLE) && (globalCtx->transitionMode == TRANS_MODE_OFF) && + if ((play->csCtx.state == CS_STATE_IDLE) && (play->transitionMode == TRANS_MODE_OFF) && (EN_HORSE_CHECK_1(rideActor) || EN_HORSE_CHECK_4(rideActor))) { this->stateFlags2 |= PLAYER_STATE2_22; if (EN_HORSE_CHECK_1(rideActor) || (EN_HORSE_CHECK_4(rideActor) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A))) { rideActor->actor.child = NULL; - func_80835DAC(globalCtx, this, func_8084D3E4, 0); + func_80835DAC(play, this, func_8084D3E4, 0); this->unk_878 = sp34 - rideActor->actor.world.pos.y; - func_80832264(globalCtx, this, (this->mountSide < 0) ? &gPlayerAnim_003390 : &gPlayerAnim_0033A0); + func_80832264(play, this, (this->mountSide < 0) ? &gPlayerAnim_003390 : &gPlayerAnim_0033A0); return 1; } } @@ -11605,7 +11585,7 @@ static struct_80832924 D_808549A4[] = { { NA_SE_PL_CALM_PAT, 0x884 }, { NA_SE_PL_CALM_PAT, -0x888 }, }; -void func_8084CC98(Player* this, GlobalContext* globalCtx) { +void func_8084CC98(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; u8* arr; @@ -11614,7 +11594,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { func_8084CBF4(this, 1.0f, 10.0f); if (this->unk_850 == 0) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { this->skelAnime.animation = &gPlayerAnim_0033B8; this->unk_850 = 99; return; @@ -11628,7 +11608,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { } if (LinkAnimation_OnFrame(&this->skelAnime, arr[1])) { - func_8002DE74(globalCtx, this); + func_8002DE74(play, this); func_8002F7DC(&this->actor, NA_SE_PL_SIT_ON_HORSE); return; } @@ -11636,7 +11616,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { return; } - func_8002DE74(globalCtx, this); + func_8002DE74(play, this); this->skelAnime.prevTransl = D_8085499C; if ((rideActor->animationIdx != this->unk_850) && ((rideActor->animationIdx >= 2) || (this->unk_850 >= 2))) { @@ -11651,41 +11631,41 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { } else if (rand < 0.2f) { temp = 1; } - func_80832264(globalCtx, this, D_8085498C[temp]); + func_80832264(play, this, D_8085498C[temp]); } else { this->skelAnime.animation = D_80854944[this->unk_850 - 2]; - Animation_SetMorph(globalCtx, &this->skelAnime, 8.0f); + Animation_SetMorph(play, &this->skelAnime, 8.0f); if (this->unk_850 < 4) { - func_80834644(globalCtx, this); + func_80834644(play, this); this->unk_84F = 0; } } } if (this->unk_850 == 1) { - if ((D_808535E0 != 0) || func_8083224C(globalCtx)) { - func_80832264(globalCtx, this, &gPlayerAnim_0033C8); - } else if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if ((D_808535E0 != 0) || func_8083224C(play)) { + func_80832264(play, this, &gPlayerAnim_0033C8); + } else if (LinkAnimation_Update(play, &this->skelAnime)) { this->unk_850 = 99; } else if (this->skelAnime.animation == &gPlayerAnim_0033B8) { func_80832924(this, D_808549A4); } } else { this->skelAnime.curFrame = rideActor->curFrame; - LinkAnimation_AnimateFrame(globalCtx, &this->skelAnime); + LinkAnimation_AnimateFrame(play, &this->skelAnime); } - AnimationContext_SetCopyAll(globalCtx, this->skelAnime.limbCount, this->skelAnime.morphTable, + AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.morphTable, this->skelAnime.jointTable); - if ((globalCtx->csCtx.state != CS_STATE_IDLE) || (this->csMode != 0)) { + if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != 0)) { if (this->csMode == 7) { this->csMode = 0; } this->unk_6AD = 0; this->unk_84F = 0; } else if ((this->unk_850 < 2) || (this->unk_850 >= 4)) { - D_808535E0 = func_80836670(this, globalCtx); + D_808535E0 = func_80836670(this, play); if (D_808535E0 != 0) { this->unk_84F = 0; } @@ -11698,11 +11678,11 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { this->currentYaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; if ((this->csMode != 0) || - (!func_8083224C(globalCtx) && ((rideActor->actor.speedXZ != 0.0f) || !func_8083B644(this, globalCtx)) && - !func_8083C1DC(this, globalCtx))) { + (!func_8083224C(play) && ((rideActor->actor.speedXZ != 0.0f) || !func_8083B644(this, play)) && + !func_8083C1DC(this, play))) { if (D_808535E0 == 0) { if (this->unk_84F != 0) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime2)) { + if (LinkAnimation_Update(play, &this->skelAnime2)) { rideActor->stateFlags &= ~ENHORSE_FLAG_8; this->unk_84F = 0; } @@ -11713,7 +11693,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { func_80832698(this, NA_SE_VO_LI_LASH); } - AnimationContext_SetCopyAll(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable); } else { if (LinkAnimation_OnFrame(&this->skelAnime2, 10.0f)) { @@ -11721,7 +11701,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { func_80832698(this, NA_SE_VO_LI_LASH); } - AnimationContext_SetCopyTrue(globalCtx, this->skelAnime.limbCount, this->skelAnime.jointTable, + AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable, D_80853410); } } else { @@ -11736,26 +11716,26 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { } if (anim != NULL) { - LinkAnimation_PlayOnce(globalCtx, &this->skelAnime2, anim); + LinkAnimation_PlayOnce(play, &this->skelAnime2, anim); this->unk_84F = 1; } } } if (this->stateFlags1 & PLAYER_STATE1_20) { - if (!func_8083AD4C(globalCtx, this) || CHECK_BTN_ANY(sControlInput->press.button, BTN_A) || + if (!func_8083AD4C(play, this) || CHECK_BTN_ANY(sControlInput->press.button, BTN_A) || func_80833BCC(this)) { this->unk_6AD = 0; this->stateFlags1 &= ~PLAYER_STATE1_20; } else { - this->unk_6BE = func_8084ABD8(globalCtx, this, 1, -5000) - this->actor.shape.rot.y; + this->unk_6BE = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y; this->unk_6BE += 5000; this->unk_6B0 = -5000; } return; } - if ((this->csMode != 0) || (!func_8084C9BC(this, globalCtx) && !func_8083B040(this, globalCtx))) { + if ((this->csMode != 0) || (!func_8084C9BC(this, play) && !func_8083B040(this, play))) { if (this->unk_664 != NULL) { if (func_8002DD78(this) != 0) { this->unk_6BE = func_8083DB98(this, 1) - this->actor.shape.rot.y; @@ -11768,7 +11748,7 @@ void func_8084CC98(Player* this, GlobalContext* globalCtx) { } } else { if (func_8002DD78(this) != 0) { - this->unk_6BE = func_8084ABD8(globalCtx, this, 1, -5000) - this->actor.shape.rot.y; + this->unk_6BE = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y; this->unk_6BE += 5000; this->unk_6B0 = -5000; } @@ -11783,14 +11763,14 @@ static struct_80832924 D_808549C4[] = { { NA_SE_PL_SLIPDOWN, -0x819 }, }; -void func_8084D3E4(Player* this, GlobalContext* globalCtx) { +void func_8084D3E4(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_6; func_8084CBF4(this, 1.0f, 10.0f); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { EnHorse* rideActor = (EnHorse*)this->rideActor; - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); this->stateFlags1 &= ~PLAYER_STATE1_23; this->actor.parent = NULL; AREG(6) = 0; @@ -11802,7 +11782,7 @@ void func_8084D3E4(Player* this, GlobalContext* globalCtx) { gSaveContext.horseData.angle = rideActor->actor.shape.rot.y; } } else { - Camera_ChangeSetting(Play_GetCamera(globalCtx, CAM_ID_MAIN), CAM_SET_NORMAL0); + Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_NORMAL0); if (this->mountSide < 0) { D_808549C4[0].field = 0x2828; @@ -11822,26 +11802,26 @@ void func_8084D530(Player* this, f32* arg1, f32 arg2, s16 arg3) { func_80832924(this, D_808549D0); } -void func_8084D574(GlobalContext* globalCtx, Player* this, s16 arg2) { - func_80835C58(globalCtx, this, func_8084D84C, 0); +void func_8084D574(PlayState* play, Player* this, s16 arg2) { + func_80835C58(play, this, func_8084D84C, 0); this->actor.shape.rot.y = this->currentYaw = arg2; - func_80832C6C(globalCtx, this, &gPlayerAnim_0032F0); + func_80832C6C(play, this, &gPlayerAnim_0032F0); } -void func_8084D5CC(GlobalContext* globalCtx, Player* this) { - func_80835C58(globalCtx, this, func_8084DAB4, 0); - func_80832C6C(globalCtx, this, &gPlayerAnim_0032F0); +void func_8084D5CC(PlayState* play, Player* this) { + func_80835C58(play, this, func_8084DAB4, 0); + func_80832C6C(play, this, &gPlayerAnim_0032F0); } -void func_8084D610(Player* this, GlobalContext* globalCtx) { +void func_8084D610(Player* this, PlayState* play) { f32 sp34; s16 sp32; - func_80832CB0(globalCtx, this, &gPlayerAnim_003328); + func_80832CB0(play, this, &gPlayerAnim_003328); func_8084B000(this); - if (!func_8083224C(globalCtx) && !func_80837348(globalCtx, this, D_80854444, 1) && - !func_8083D12C(globalCtx, this, sControlInput)) { + if (!func_8083224C(play) && !func_80837348(play, this, D_80854444, 1) && + !func_8083D12C(play, this, sControlInput)) { if (this->unk_6AD != 1) { this->unk_6AD = 0; } @@ -11851,11 +11831,11 @@ void func_8084D610(Player* this, GlobalContext* globalCtx) { sp32 = this->actor.shape.rot.y; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_15, this->modelAnimType), globalCtx); + func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_15, this->modelAnimType), play); func_808328A0(this); } } else { - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); + func_80837268(this, &sp34, &sp32, 0.0f, play); if (sp34 != 0.0f) { s16 temp = this->actor.shape.rot.y - sp32; @@ -11865,9 +11845,9 @@ void func_8084D610(Player* this, GlobalContext* globalCtx) { } if (func_80833C04(this)) { - func_8084D5CC(globalCtx, this); + func_8084D5CC(play, this); } else { - func_8084D574(globalCtx, this, sp32); + func_8084D574(play, this, sp32); } } } @@ -11876,44 +11856,44 @@ void func_8084D610(Player* this, GlobalContext* globalCtx) { } } -void func_8084D7C4(Player* this, GlobalContext* globalCtx) { - if (!func_8083B040(this, globalCtx)) { +void func_8084D7C4(Player* this, PlayState* play) { + if (!func_8083B040(this, play)) { this->stateFlags2 |= PLAYER_STATE2_5; - func_8084B158(globalCtx, this, NULL, this->linearVelocity); + func_8084B158(play, this, NULL, this->linearVelocity); func_8084B000(this); if (DECR(this->unk_850) == 0) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } } } -void func_8084D84C(Player* this, GlobalContext* globalCtx) { +void func_8084D84C(Player* this, PlayState* play) { f32 sp34; s16 sp32; s16 temp; this->stateFlags2 |= PLAYER_STATE2_5; - func_8084B158(globalCtx, this, sControlInput, this->linearVelocity); + func_8084B158(play, this, sControlInput, this->linearVelocity); func_8084B000(this); - if (!func_80837348(globalCtx, this, D_80854444, 1) && !func_8083D12C(globalCtx, this, sControlInput)) { - func_80837268(this, &sp34, &sp32, 0.0f, globalCtx); + if (!func_80837348(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { + func_80837268(this, &sp34, &sp32, 0.0f, play); temp = this->actor.shape.rot.y - sp32; if ((sp34 == 0.0f) || (ABS(temp) > 0x6000) || (this->currentBoots == PLAYER_BOOTS_IRON)) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } else if (func_80833C04(this)) { - func_8084D5CC(globalCtx, this); + func_8084D5CC(play, this); } func_8084D530(this, &this->linearVelocity, sp34, sp32); } } -s32 func_8084D980(GlobalContext* globalCtx, Player* this, f32* arg2, s16* arg3) { +s32 func_8084D980(PlayState* play, Player* this, f32* arg2, s16* arg3) { LinkAnimationHeader* anim; s16 temp1; s32 temp2; @@ -11930,7 +11910,7 @@ s32 func_8084D980(GlobalContext* globalCtx, Player* this, f32* arg2, s16* arg3) *arg3 = this->currentYaw; } } else { - temp2 = func_8083FD78(this, arg2, arg3, globalCtx); + temp2 = func_8083FD78(this, arg2, arg3, play); if (temp2 > 0) { anim = &gPlayerAnim_0032F0; @@ -11944,62 +11924,62 @@ s32 func_8084D980(GlobalContext* globalCtx, Player* this, f32* arg2, s16* arg3) } if (anim != this->skelAnime.animation) { - func_80832C6C(globalCtx, this, anim); + func_80832C6C(play, this, anim); return 1; } return 0; } -void func_8084DAB4(Player* this, GlobalContext* globalCtx) { +void func_8084DAB4(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; - func_8084B158(globalCtx, this, sControlInput, this->linearVelocity); + func_8084B158(play, this, sControlInput, this->linearVelocity); func_8084B000(this); - if (!func_80837348(globalCtx, this, D_80854444, 1) && !func_8083D12C(globalCtx, this, sControlInput)) { - func_80837268(this, &sp2C, &sp2A, 0.0f, globalCtx); + if (!func_80837348(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { + func_80837268(this, &sp2C, &sp2A, 0.0f, play); if (sp2C == 0.0f) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); } else if (!func_80833C04(this)) { - func_8084D574(globalCtx, this, sp2A); + func_8084D574(play, this, sp2A); } else { - func_8084D980(globalCtx, this, &sp2C, &sp2A); + func_8084D980(play, this, &sp2C, &sp2A); } func_8084D530(this, &this->linearVelocity, sp2C, sp2A); } } -void func_8084DBC4(GlobalContext* globalCtx, Player* this, f32 arg2) { +void func_8084DBC4(PlayState* play, Player* this, f32 arg2) { f32 sp2C; s16 sp2A; - func_80837268(this, &sp2C, &sp2A, 0.0f, globalCtx); + func_80837268(this, &sp2C, &sp2A, 0.0f, play); func_8084AEEC(this, &this->linearVelocity, sp2C * 0.5f, sp2A); func_8084AEEC(this, &this->actor.velocity.y, arg2, this->currentYaw); } -void func_8084DC48(Player* this, GlobalContext* globalCtx) { +void func_8084DC48(Player* this, PlayState* play) { f32 sp2C; this->stateFlags2 |= PLAYER_STATE2_5; this->actor.gravity = 0.0f; - func_80836670(this, globalCtx); + func_80836670(this, play); - if (!func_8083B040(this, globalCtx)) { + if (!func_8083B040(this, play)) { if (this->currentBoots == PLAYER_BOOTS_IRON) { - func_80838F18(globalCtx, this); + func_80838F18(play, this); return; } if (this->unk_84F == 0) { if (this->unk_850 == 0) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime) || + if (LinkAnimation_Update(play, &this->skelAnime) || ((this->skelAnime.curFrame >= 22.0f) && !CHECK_BTN_ALL(sControlInput->cur.button, BTN_A))) { - func_8083D330(globalCtx, this); + func_8083D330(play, this); } else if (LinkAnimation_OnFrame(&this->skelAnime, 20.0f) != 0) { this->actor.velocity.y = -2.0f; } @@ -12008,60 +11988,60 @@ void func_8084DC48(Player* this, GlobalContext* globalCtx) { return; } - func_8084B158(globalCtx, this, sControlInput, this->actor.velocity.y); + func_8084B158(play, this, sControlInput, this->actor.velocity.y); this->unk_6C2 = 16000; - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !func_8083E5A8(this, globalCtx) && + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !func_8083E5A8(this, play) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.yDistToWater < D_80854784[CUR_UPG_VALUE(UPG_SCALE)])) { - func_8084DBC4(globalCtx, this, -2.0f); + func_8084DBC4(play, this, -2.0f); } else { this->unk_84F++; - func_80832C6C(globalCtx, this, &gPlayerAnim_003328); + func_80832C6C(play, this, &gPlayerAnim_003328); } } else if (this->unk_84F == 1) { - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); func_8084B000(this); if (this->unk_6C2 < 10000) { this->unk_84F++; this->unk_850 = this->actor.yDistToWater; - func_80832C6C(globalCtx, this, &gPlayerAnim_0032F0); + func_80832C6C(play, this, &gPlayerAnim_0032F0); } - } else if (!func_8083D12C(globalCtx, this, sControlInput)) { + } else if (!func_8083D12C(play, this, sControlInput)) { sp2C = (this->unk_850 * 0.018f) + 4.0f; if (this->stateFlags1 & PLAYER_STATE1_11) { sControlInput = NULL; } - func_8084B158(globalCtx, this, sControlInput, fabsf(this->actor.velocity.y)); + func_8084B158(play, this, sControlInput, fabsf(this->actor.velocity.y)); Math_ScaledStepToS(&this->unk_6C2, -10000, 800); if (sp2C > 8.0f) { sp2C = 8.0f; } - func_8084DBC4(globalCtx, this, sp2C); + func_8084DBC4(play, this, sp2C); } } } -void func_8084DF6C(GlobalContext* globalCtx, Player* this) { +void func_8084DF6C(PlayState* play, Player* this) { this->unk_862 = 0; this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); this->getItemId = GI_NONE; - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); } -void func_8084DFAC(GlobalContext* globalCtx, Player* this) { - func_8084DF6C(globalCtx, this); +void func_8084DFAC(PlayState* play, Player* this) { + func_8084DF6C(play, this); func_808322FC(this); - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); this->currentYaw = this->actor.shape.rot.y; } -s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { +s32 func_8084DFF4(PlayState* play, Player* this) { GetItemEntry* giEntry; s32 temp1; s32 temp2; @@ -12074,8 +12054,8 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { giEntry = &sGetItemTable[this->getItemId - 1]; this->unk_84F = 1; - Message_StartTextbox(globalCtx, giEntry->textId, &this->actor); - Item_Give(globalCtx, giEntry->itemId); + Message_StartTextbox(play, giEntry->textId, &this->actor); + Item_Give(play, giEntry->itemId); if (((this->getItemId >= GI_RUPEE_GREEN) && (this->getItemId <= GI_RUPEE_RED)) || ((this->getItemId >= GI_RUPEE_PURPLE) && (this->getItemId <= GI_RUPEE_GOLD)) || @@ -12094,14 +12074,14 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { Audio_PlayFanfare(temp1); } } else { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { if (this->getItemId == GI_GAUNTLETS_SILVER) { - globalCtx->nextEntranceIndex = ENTR_SPOT11_0; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = ENTR_SPOT11_0; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.nextCutsceneIndex = 0xFFF1; - globalCtx->transitionType = TRANS_TYPE_SANDSTORM_END; + play->transitionType = TRANS_TYPE_SANDSTORM_END; this->stateFlags1 &= ~PLAYER_STATE1_29; - func_80852FFC(globalCtx, NULL, 8); + func_80852FFC(play, NULL, 8); } this->getItemId = GI_NONE; } @@ -12110,20 +12090,20 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { return 0; } -void func_8084E1EC(Player* this, GlobalContext* globalCtx) { +void func_8084E1EC(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - if (!(this->stateFlags1 & PLAYER_STATE1_10) || func_8084DFF4(globalCtx, this)) { - func_8084DF6C(globalCtx, this); - func_80838F18(globalCtx, this); - func_80832340(globalCtx, this); + if (LinkAnimation_Update(play, &this->skelAnime)) { + if (!(this->stateFlags1 & PLAYER_STATE1_10) || func_8084DFF4(play, this)) { + func_8084DF6C(play, this); + func_80838F18(play, this); + func_80832340(play, this); } } else { if ((this->stateFlags1 & PLAYER_STATE1_10) && LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) { - func_808332F4(this, globalCtx); - func_80832340(globalCtx, this); - func_80835EA4(globalCtx, 8); + func_808332F4(this, play); + func_80832340(play, this); + func_80835EA4(play, 8); } else if (LinkAnimation_OnFrame(&this->skelAnime, 5.0f)) { func_80832698(this, NA_SE_VO_LI_BREATH_DRINK); } @@ -12133,21 +12113,21 @@ void func_8084E1EC(Player* this, GlobalContext* globalCtx) { func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); } -void func_8084E30C(Player* this, GlobalContext* globalCtx) { +void func_8084E30C(Player* this, PlayState* play) { func_8084B000(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80838F18(globalCtx, this); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80838F18(play, this); } func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); } -void func_8084E368(Player* this, GlobalContext* globalCtx) { +void func_8084E368(Player* this, PlayState* play) { func_8084B000(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80843AE8(globalCtx, this); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80843AE8(play, this); } func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); @@ -12157,14 +12137,14 @@ static s16 sWarpSongEntrances[] = { ENTR_SPOT05_2, ENTR_SPOT17_4, ENTR_SPOT06_8, ENTR_SPOT11_5, ENTR_SPOT02_7, ENTR_TOKINOMA_7, }; -void func_8084E3C4(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_808322A4(globalCtx, this, &gPlayerAnim_0030A8); +void func_8084E3C4(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_808322A4(play, this, &gPlayerAnim_0030A8); this->unk_850 = 1; if (this->stateFlags2 & (PLAYER_STATE2_23 | PLAYER_STATE2_25)) { this->stateFlags2 |= PLAYER_STATE2_24; } else { - func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY); + func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); } return; } @@ -12173,37 +12153,37 @@ void func_8084E3C4(Player* this, GlobalContext* globalCtx) { return; } - if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); if ((this->targetActor != NULL) && (this->targetActor == this->unk_6A8)) { - func_80853148(globalCtx, this->targetActor); + func_80853148(play, this->targetActor); } else if (this->naviTextId < 0) { this->targetActor = this->naviActor; this->naviActor->textId = -this->naviTextId; - func_80853148(globalCtx, this->targetActor); - } else if (!func_8083B040(this, globalCtx)) { - func_8083A098(this, &gPlayerAnim_003098, globalCtx); + func_80853148(play, this->targetActor); + } else if (!func_8083B040(this, play)) { + func_8083A098(this, &gPlayerAnim_003098, play); } this->stateFlags2 &= ~(PLAYER_STATE2_23 | PLAYER_STATE2_24 | PLAYER_STATE2_25); this->unk_6A8 = NULL; - } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_02) { - gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex = sWarpSongEntrances[globalCtx->msgCtx.lastPlayedSong]; + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_02) { + gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex = sWarpSongEntrances[play->msgCtx.lastPlayedSong]; gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams = 0x5FF; - gSaveContext.respawn[RESPAWN_MODE_RETURN].data = globalCtx->msgCtx.lastPlayedSong; + gSaveContext.respawn[RESPAWN_MODE_RETURN].data = play->msgCtx.lastPlayedSong; this->csMode = 0; this->stateFlags1 &= ~PLAYER_STATE1_29; - func_80852FFC(globalCtx, NULL, 8); - globalCtx->mainCamera.unk_14C &= ~8; + func_80852FFC(play, NULL, 8); + play->mainCamera.unk_14C &= ~8; this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; this->stateFlags2 |= PLAYER_STATE2_27; - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0xF) == NULL) { - Environment_WarpSongLeave(globalCtx); + if (Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0xF) == NULL) { + Environment_WarpSongLeave(play); } gSaveContext.seqId = (u8)NA_BGM_DISABLED; @@ -12211,12 +12191,12 @@ void func_8084E3C4(Player* this, GlobalContext* globalCtx) { } } -void func_8084E604(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083A098(this, &gPlayerAnim_003050, globalCtx); +void func_8084E604(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083A098(this, &gPlayerAnim_003050, play); } else if (LinkAnimation_OnFrame(&this->skelAnime, 3.0f)) { Inventory_ChangeAmmo(ITEM_NUT, -1); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, this->bodyPartsPos[PLAYER_BODYPART_R_HAND].x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, this->bodyPartsPos[PLAYER_BODYPART_R_HAND].x, this->bodyPartsPos[PLAYER_BODYPART_R_HAND].y, this->bodyPartsPos[PLAYER_BODYPART_R_HAND].z, 4000, this->actor.shape.rot.y, 0, ARROW_NUT); func_80832698(this, NA_SE_VO_LI_SWORD_N); @@ -12232,29 +12212,29 @@ static struct_80832924 D_808549E0[] = { { 0, -0x287B }, }; -void func_8084E6D4(Player* this, GlobalContext* globalCtx) { +void func_8084E6D4(Player* this, PlayState* play) { s32 cond; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_850 != 0) { if (this->unk_850 >= 2) { this->unk_850--; } - if (func_8084DFF4(globalCtx, this) && (this->unk_850 == 1)) { + if (func_8084DFF4(play, this) && (this->unk_850 == 1)) { cond = ((this->targetActor != NULL) && (this->exchangeItemId < 0)) || (this->stateFlags3 & PLAYER_STATE3_5); if (cond || (gSaveContext.healthAccumulator == 0)) { if (cond) { - func_8084DF6C(globalCtx, this); + func_8084DF6C(play, this); this->exchangeItemId = EXCH_ITEM_NONE; - if (func_8084B4D4(globalCtx, this) == 0) { - func_80853148(globalCtx, this->targetActor); + if (func_8084B4D4(play, this) == 0) { + func_80853148(play, this->targetActor); } } else { - func_8084DFAC(globalCtx, this); + func_8084DFAC(play, this); } } } @@ -12265,24 +12245,24 @@ void func_8084E6D4(Player* this, GlobalContext* globalCtx) { this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); if (this->getItemId != GI_ICE_TRAP) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y + 100.0f, this->actor.world.pos.z, 0, 0, 0, 0); - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } else { this->actor.colChkInfo.damage = 0; - func_80837C0C(globalCtx, this, 3, 0.0f, 0.0f, 0, 20); + func_80837C0C(play, this, 3, 0.0f, 0.0f, 0, 20); } return; } if (this->skelAnime.animation == &gPlayerAnim_002DF8) { - func_808322D0(globalCtx, this, &gPlayerAnim_002788); + func_808322D0(play, this, &gPlayerAnim_002788); } else { - func_808322D0(globalCtx, this, &gPlayerAnim_002780); + func_808322D0(play, this, &gPlayerAnim_002780); } this->unk_850 = 2; - func_80835EA4(globalCtx, 9); + func_80835EA4(play, 9); } } else { if (this->unk_850 == 0) { @@ -12293,11 +12273,11 @@ void func_8084E6D4(Player* this, GlobalContext* globalCtx) { } if (this->skelAnime.animation == &gPlayerAnim_002788) { - Math_ScaledStepToS(&this->actor.shape.rot.y, Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000, 4000); + Math_ScaledStepToS(&this->actor.shape.rot.y, Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000, 4000); } if (LinkAnimation_OnFrame(&this->skelAnime, 21.0f)) { - func_808332F4(this, globalCtx); + func_808332F4(this, play); } } } @@ -12315,15 +12295,15 @@ static struct_80832924 D_808549F4[] = { { 0, -0x280F }, }; -void func_8084E9AC(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { +void func_8084E9AC(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F == 0) { if (DECR(this->unk_850) == 0) { this->unk_84F = 1; this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } } else { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } } else { if (LINK_IS_ADULT && LinkAnimation_OnFrame(&this->skelAnime, 158.0f)) { @@ -12343,8 +12323,8 @@ static u8 D_808549FC[] = { 0x01, 0x03, 0x02, 0x04, 0x04, }; -void func_8084EAC0(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { +void func_8084EAC0(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_850 == 0) { if (this->itemActionParam == PLAYER_AP_BOTTLE_POE) { s32 rand = Rand_S16Offset(-1, 3); @@ -12358,7 +12338,7 @@ void func_8084EAC0(Player* this, GlobalContext* globalCtx) { } if (rand < 0) { - Health_ChangeBy(globalCtx, -0x10); + Health_ChangeBy(play, -0x10); } else { gSaveContext.healthAccumulator = rand * 0x10; } @@ -12370,7 +12350,7 @@ void func_8084EAC0(Player* this, GlobalContext* globalCtx) { } if (sp28 & 2) { - Magic_Fill(globalCtx); + Magic_Fill(play); } if (sp28 & 4) { @@ -12378,18 +12358,18 @@ void func_8084EAC0(Player* this, GlobalContext* globalCtx) { } } - func_808322A4(globalCtx, this, &gPlayerAnim_002670); + func_808322A4(play, this, &gPlayerAnim_002670); this->unk_850 = 1; return; } - func_8083C0E8(this, globalCtx); - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + func_8083C0E8(this, play); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); } else if (this->unk_850 == 1) { if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.unk_13F0 != 9)) { - func_80832B78(globalCtx, this, &gPlayerAnim_002660); + func_80832B78(play, this, &gPlayerAnim_002660); this->unk_850 = 2; - Player_UpdateBottleHeld(globalCtx, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); } func_80832698(this, NA_SE_VO_LI_DRINK - SFX_FLAG); } else if ((this->unk_850 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 29.0f)) { @@ -12404,7 +12384,7 @@ static BottleCatchInfo D_80854A04[] = { { ACTOR_EN_INSECT, ITEM_BUG, 0x21, 0x7A }, }; -void func_8084ECA4(Player* this, GlobalContext* globalCtx) { +void func_8084ECA4(Player* this, PlayState* play) { struct_80854554* sp24; BottleCatchInfo* catchInfo; s32 temp; @@ -12413,18 +12393,18 @@ void func_8084ECA4(Player* this, GlobalContext* globalCtx) { sp24 = &D_80854554[this->unk_850]; func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F != 0) { if (this->unk_850 == 0) { - Message_StartTextbox(globalCtx, D_80854A04[this->unk_84F - 1].textId, &this->actor); + Message_StartTextbox(play, D_80854A04[this->unk_84F - 1].textId, &this->actor); Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); this->unk_850 = 1; - } else if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->unk_84F = 0; - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); } } else { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } } else { if (this->unk_84F == 0) { @@ -12451,9 +12431,9 @@ void func_8084ECA4(Player* this, GlobalContext* globalCtx) { this->unk_850 = 0; this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; this->interactRangeActor->parent = &this->actor; - Player_UpdateBottleHeld(globalCtx, this, catchInfo->itemId, ABS(catchInfo->actionParam)); - func_808322D0(globalCtx, this, sp24->unk_04); - func_80835EA4(globalCtx, 4); + Player_UpdateBottleHeld(play, this, catchInfo->itemId, ABS(catchInfo->actionParam)); + func_808322D0(play, this, sp24->unk_04); + func_80835EA4(play, 4); } } } @@ -12468,16 +12448,16 @@ void func_8084ECA4(Player* this, GlobalContext* globalCtx) { static Vec3f D_80854A1C = { 0.0f, 0.0f, 5.0f }; -void func_8084EED8(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083C0E8(this, globalCtx); - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); +void func_8084EED8(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083C0E8(this, play); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); return; } if (LinkAnimation_OnFrame(&this->skelAnime, 37.0f)) { - Player_SpawnFairy(globalCtx, this, &this->leftHandPos, &D_80854A1C, FAIRY_REVIVE_BOTTLE); - Player_UpdateBottleHeld(globalCtx, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_SpawnFairy(play, this, &this->leftHandPos, &D_80854A1C, FAIRY_REVIVE_BOTTLE); + Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); func_8002F7DC(&this->actor, NA_SE_EV_BOTTLE_CAP_OPEN); func_8002F7DC(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } else if (LinkAnimation_OnFrame(&this->skelAnime, 47.0f)) { @@ -12496,24 +12476,24 @@ static struct_80832924 D_80854A34[] = { { NA_SE_EV_BOTTLE_CAP_OPEN, -0x828 }, }; -void func_8084EFC0(Player* this, GlobalContext* globalCtx) { +void func_8084EFC0(Player* this, PlayState* play) { func_8083721C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083C0E8(this, globalCtx); - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083C0E8(this, play); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); return; } if (LinkAnimation_OnFrame(&this->skelAnime, 76.0f)) { BottleDropInfo* dropInfo = &D_80854A28[this->itemActionParam - PLAYER_AP_BOTTLE_FISH]; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, dropInfo->actorId, + Actor_Spawn(&play->actorCtx, play, dropInfo->actorId, (Math_SinS(this->actor.shape.rot.y) * 5.0f) + this->leftHandPos.x, this->leftHandPos.y, (Math_CosS(this->actor.shape.rot.y) * 5.0f) + this->leftHandPos.z, 0x4000, this->actor.shape.rot.y, 0, dropInfo->actorParams); - Player_UpdateBottleHeld(globalCtx, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE); return; } @@ -12524,12 +12504,12 @@ static struct_80832924 D_80854A3C[] = { { NA_SE_PL_PUT_OUT_ITEM, -0x81E }, }; -void func_8084F104(Player* this, GlobalContext* globalCtx) { +void func_8084F104(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_850 < 0) { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } else if (this->exchangeItemId == EXCH_ITEM_NONE) { Actor* targetActor = this->targetActor; @@ -12538,7 +12518,7 @@ void func_8084F104(Player* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_8; } - func_80853148(globalCtx, targetActor); + func_80853148(play, targetActor); } else { GetItemEntry* giEntry = &sGetItemTable[D_80854528[this->exchangeItemId - 1] - 1]; @@ -12551,25 +12531,25 @@ void func_8084F104(Player* this, GlobalContext* globalCtx) { } if (this->unk_850 == 0) { - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); if ((this->itemActionParam == PLAYER_AP_CHICKEN) || (this->itemActionParam == PLAYER_AP_POCKET_CUCCO)) { func_8002F7DC(&this->actor, NA_SE_EV_CHICKEN_CRY_M); } this->unk_850 = 1; - } else if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_8; this->unk_862 = 0; if (this->unk_84F == 1) { - func_80832264(globalCtx, this, &gPlayerAnim_002698); + func_80832264(play, this, &gPlayerAnim_002698); this->unk_850 = -1; } else { - func_8083C0E8(this, globalCtx); + func_8083C0E8(this, play); } - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); } } } else if (this->unk_850 >= 0) { @@ -12581,20 +12561,20 @@ void func_8084F104(Player* this, GlobalContext* globalCtx) { } } -void func_8084F308(Player* this, GlobalContext* globalCtx) { +void func_8084F308(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, &gPlayerAnim_003128); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, &gPlayerAnim_003128); } if (func_80832594(this, 0, 100)) { - func_80839F90(this, globalCtx); + func_80839F90(this, play); this->stateFlags2 &= ~PLAYER_STATE2_7; } } -void func_8084F390(Player* this, GlobalContext* globalCtx) { +void func_8084F390(Player* this, PlayState* play) { CollisionPoly* floorPoly; f32 sp50; f32 sp4C; @@ -12604,15 +12584,15 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) { Vec3f slopeNormal; this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; - LinkAnimation_Update(globalCtx, &this->skelAnime); - func_8084269C(globalCtx, this); + LinkAnimation_Update(play, &this->skelAnime); + func_8084269C(play, this); func_800F4138(&this->actor.projectedPos, NA_SE_PL_SLIP_LEVEL - SFX_FLAG, this->actor.speedXZ); - if (func_8083B040(this, globalCtx) == 0) { + if (func_8083B040(this, play) == 0) { floorPoly = this->actor.floorPoly; if (floorPoly == NULL) { - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); return; } @@ -12632,7 +12612,7 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) { sp4C = (sp50 * sp50) * 0.015f; sp48 = slopeNormal.y * 0.01f; - if (SurfaceType_GetSlope(&globalCtx->colCtx, floorPoly, this->actor.floorBgId) != 1) { + if (SurfaceType_GetSlope(&play->colCtx, floorPoly, this->actor.floorBgId) != 1) { sp50 = 0; sp48 = slopeNormal.y * 10.0f; } @@ -12649,7 +12629,7 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) { } else { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_43, this->modelAnimType); } - func_8083A098(this, anim, globalCtx); + func_8083A098(this, anim, play); } Math_SmoothStepToS(&this->currentYaw, downwardSlopeYaw, 10, 4000, 800); @@ -12657,28 +12637,28 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) { } } -void func_8084F608(Player* this, GlobalContext* globalCtx) { - if ((DECR(this->unk_850) == 0) && func_8083ADD4(globalCtx, this)) { - func_80852280(globalCtx, this, NULL); - func_80835C58(globalCtx, this, func_80852E14, 0); - func_80852E14(this, globalCtx); +void func_8084F608(Player* this, PlayState* play) { + if ((DECR(this->unk_850) == 0) && func_8083ADD4(play, this)) { + func_80852280(play, this, NULL); + func_80835C58(play, this, func_80852E14, 0); + func_80852E14(this, play); } } -void func_8084F698(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_8084F608, 0); +void func_8084F698(Player* this, PlayState* play) { + func_80835C58(play, this, func_8084F608, 0); this->unk_850 = 40; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x10); + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x10); } -void func_8084F710(Player* this, GlobalContext* globalCtx) { +void func_8084F710(Player* this, PlayState* play) { s32 pad; - if ((this->unk_84F != 0) && (globalCtx->csCtx.frames < 0x131)) { + if ((this->unk_84F != 0) && (play->csCtx.frames < 0x131)) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; } else if (D_80853600 < 150.0f) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_850 == 0) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; @@ -12686,89 +12666,89 @@ void func_8084F710(Player* this, GlobalContext* globalCtx) { this->unk_850 = 1; } } else { - if ((globalCtx->sceneNum == SCENE_SPOT04) && func_8083ADD4(globalCtx, this)) { + if ((play->sceneNum == SCENE_SPOT04) && func_8083ADD4(play, this)) { return; } - func_80853080(this, globalCtx); + func_80853080(this, play); } } Math_SmoothStepToF(&this->actor.velocity.y, 2.0f, 0.3f, 8.0f, 0.5f); } - if ((globalCtx->sceneNum == SCENE_KENJYANOMA) && func_8083ADD4(globalCtx, this)) { + if ((play->sceneNum == SCENE_KENJYANOMA) && func_8083ADD4(play, this)) { return; } - if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.linkAction != NULL)) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.linkAction != NULL)) { f32 sp28 = this->actor.world.pos.y; - func_808529D0(globalCtx, this, globalCtx->csCtx.linkAction); + func_808529D0(play, this, play->csCtx.linkAction); this->actor.world.pos.y = sp28; } } -void func_8084F88C(Player* this, GlobalContext* globalCtx) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_8084F88C(Player* this, PlayState* play) { + LinkAnimation_Update(play, &this->skelAnime); - if ((this->unk_850++ > 8) && (globalCtx->transitionTrigger == TRANS_TRIGGER_OFF)) { + if ((this->unk_850++ > 8) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { if (this->unk_84F != 0) { - if (globalCtx->sceneNum == 9) { - Play_TriggerRespawn(globalCtx); - globalCtx->nextEntranceIndex = ENTR_ICE_DOUKUTO_0; + if (play->sceneNum == 9) { + Play_TriggerRespawn(play); + play->nextEntranceIndex = ENTR_ICE_DOUKUTO_0; } else if (this->unk_84F < 0) { - Play_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); } else { - Play_TriggerVoidOut(globalCtx); + Play_TriggerVoidOut(play); } - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; func_80078884(NA_SE_OC_ABYSS); } else { - globalCtx->transitionType = TRANS_TYPE_FADE_BLACK; + play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = 0xFF; } - globalCtx->transitionTrigger = TRANS_TRIGGER_START; + play->transitionTrigger = TRANS_TRIGGER_START; } } -void func_8084F9A0(Player* this, GlobalContext* globalCtx) { - func_80839800(this, globalCtx); +void func_8084F9A0(Player* this, PlayState* play) { + func_80839800(this, play); } -void func_8084F9C0(Player* this, GlobalContext* globalCtx) { +void func_8084F9C0(Player* this, PlayState* play) { this->actor.gravity = -1.0f; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (this->actor.velocity.y < 0.0f) { - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); } else if (this->actor.velocity.y < 6.0f) { Math_StepToF(&this->linearVelocity, 3.0f, 0.5f); } } -void func_8084FA54(Player* this, GlobalContext* globalCtx) { +void func_8084FA54(Player* this, PlayState* play) { this->unk_6AD = 2; - func_8083AD4C(globalCtx, this); - LinkAnimation_Update(globalCtx, &this->skelAnime); - func_80836670(this, globalCtx); + func_8083AD4C(play, this); + LinkAnimation_Update(play, &this->skelAnime); + func_80836670(this, play); - this->unk_6BE = func_8084ABD8(globalCtx, this, 1, 0) - this->actor.shape.rot.y; + this->unk_6BE = func_8084ABD8(play, this, 1, 0) - this->actor.shape.rot.y; this->unk_6AE |= 0x80; - if (globalCtx->shootingGalleryStatus < 0) { - globalCtx->shootingGalleryStatus++; - if (globalCtx->shootingGalleryStatus == 0) { - func_8083C148(this, globalCtx); + if (play->shootingGalleryStatus < 0) { + play->shootingGalleryStatus++; + if (play->shootingGalleryStatus == 0) { + func_8083C148(this, play); } } } -void func_8084FB10(Player* this, GlobalContext* globalCtx) { +void func_8084FB10(Player* this, PlayState* play) { if (this->unk_84F >= 0) { if (this->unk_84F < 6) { this->unk_84F++; @@ -12776,30 +12756,30 @@ void func_8084FB10(Player* this, GlobalContext* globalCtx) { if (func_80832594(this, 1, 100)) { this->unk_84F = -1; - EffectSsIcePiece_SpawnBurst(globalCtx, &this->actor.world.pos, this->actor.scale.x); + EffectSsIcePiece_SpawnBurst(play, &this->actor.world.pos, this->actor.scale.x); func_8002F7DC(&this->actor, NA_SE_PL_ICE_BROKEN); } else { this->stateFlags2 |= PLAYER_STATE2_14; } - if ((globalCtx->gameplayFrames % 4) == 0) { - Player_InflictDamage(globalCtx, -1); + if ((play->gameplayFrames % 4) == 0) { + Player_InflictDamage(play, -1); } } else { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80839F90(this, globalCtx); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80839F90(this, play); func_80837AFC(this, -20); } } } -void func_8084FBF4(Player* this, GlobalContext* globalCtx) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_8084FBF4(Player* this, PlayState* play) { + LinkAnimation_Update(play, &this->skelAnime); func_808382BC(this); - if (((this->unk_850 % 25) != 0) || func_80837B18(globalCtx, this, -1)) { + if (((this->unk_850 % 25) != 0) || func_80837B18(play, this, -1)) { if (DECR(this->unk_850) == 0) { - func_80839F90(this, globalCtx); + func_80839F90(this, play); } } @@ -12807,8 +12787,8 @@ void func_8084FBF4(Player* this, GlobalContext* globalCtx) { func_8002F8F0(&this->actor, NA_SE_VO_LI_TAKEN_AWAY - SFX_FLAG + this->ageProperties->unk_92); } -s32 func_8084FCAC(Player* this, GlobalContext* globalCtx) { - sControlInput = &globalCtx->state.input[0]; +s32 func_8084FCAC(Player* this, PlayState* play) { + sControlInput = &play->state.input[0]; if ((CHECK_BTN_ALL(sControlInput->cur.button, BTN_A | BTN_L | BTN_R) && CHECK_BTN_ALL(sControlInput->press.button, BTN_B)) || @@ -12817,7 +12797,7 @@ s32 func_8084FCAC(Player* this, GlobalContext* globalCtx) { D_808535D0 ^= 1; if (D_808535D0) { - Camera_ChangeMode(Play_GetCamera(globalCtx, CAM_ID_MAIN), CAM_MODE_BOWARROWZ); + Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_BOWARROWZ); } } @@ -12843,7 +12823,7 @@ s32 func_8084FCAC(Player* this, GlobalContext* globalCtx) { s16 angle; s16 temp; - angle = temp = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); + angle = temp = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DDOWN)) { angle = temp + 0x8000; @@ -12866,7 +12846,7 @@ s32 func_8084FCAC(Player* this, GlobalContext* globalCtx) { this->actor.velocity.x = 0.0f; if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DLEFT)) { - Flags_SetTempClear(globalCtx, globalCtx->roomCtx.curRoom.num); + Flags_SetTempClear(play, play->roomCtx.curRoom.num); } Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); @@ -12931,16 +12911,16 @@ void func_8085002C(Player* this) { } } -s32 func_80850224(Player* this, GlobalContext* globalCtx) { - if (func_8083C6B8(globalCtx, this) == 0) { +s32 func_80850224(Player* this, PlayState* play) { + if (func_8083C6B8(play, this) == 0) { if (func_8083BB20(this) != 0) { s32 sp24 = func_80837818(this); - func_80837948(globalCtx, this, sp24); + func_80837948(play, this, sp24); if (sp24 >= PLAYER_MWA_SPIN_ATTACK_1H) { this->stateFlags2 |= PLAYER_STATE2_17; - func_80837530(globalCtx, this, 0); + func_80837530(play, this, 0); return 1; } } else { @@ -12953,12 +12933,12 @@ s32 func_80850224(Player* this, GlobalContext* globalCtx) { static Vec3f D_80854A40 = { 0.0f, 40.0f, 45.0f }; -void func_808502D0(Player* this, GlobalContext* globalCtx) { +void func_808502D0(Player* this, PlayState* play) { struct_80854190* sp44 = &D_80854190[this->meleeWeaponAnimation]; this->stateFlags2 |= PLAYER_STATE2_5; - if (!func_80842DF4(globalCtx, this)) { + if (!func_80842DF4(play, this)) { func_8084285C(this, 0.0f, sp44->unk_0C, sp44->unk_0D); if ((this->stateFlags2 & PLAYER_STATE2_30) && (this->heldItemActionParam != PLAYER_AP_HAMMER) && @@ -12968,14 +12948,14 @@ void func_808502D0(Player* this, GlobalContext* globalCtx) { } if (this->linearVelocity > 12.0f) { - func_8084269C(globalCtx, this); + func_8084269C(play, this); } Math_StepToF(&this->linearVelocity, 0.0f, 5.0f); func_8083C50C(this); - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - if (!func_80850224(this, globalCtx)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + if (!func_80850224(this, play)) { u8 sp43 = this->skelAnime.moveFlags; LinkAnimationHeader* sp3C; @@ -12992,7 +12972,7 @@ void func_808502D0(Player* this, GlobalContext* globalCtx) { sp3C = &gPlayerAnim_002AC8; } - func_8083A098(this, sp3C, globalCtx); + func_8083A098(this, sp3C, play); this->skelAnime.moveFlags = sp43; this->stateFlags3 |= PLAYER_STATE3_3; @@ -13004,7 +12984,7 @@ void func_808502D0(Player* this, GlobalContext* globalCtx) { Vec3f shockwavePos; f32 sp2C; - shockwavePos.y = func_8083973C(globalCtx, this, &D_80854A40, &shockwavePos); + shockwavePos.y = func_8083973C(play, this, &D_80854A40, &shockwavePos); sp2C = this->actor.world.pos.y - shockwavePos.y; Math_ScaledStepToS(&this->actor.focus.rot.x, Math_Atan2S(45.0f, sp2C), 800); @@ -13015,65 +12995,65 @@ void func_808502D0(Player* this, GlobalContext* globalCtx) { ((this->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_FINISH) && LinkAnimation_OnFrame(&this->skelAnime, 2.0f))) && (sp2C > -40.0f) && (sp2C < 40.0f)) { - func_80842A28(globalCtx, this); - EffectSsBlast_SpawnWhiteShockwave(globalCtx, &shockwavePos, &zeroVec, &zeroVec); + func_80842A28(play, this); + EffectSsBlast_SpawnWhiteShockwave(play, &shockwavePos, &zeroVec, &zeroVec); } } } } } -void func_808505DC(Player* this, GlobalContext* globalCtx) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_808505DC(Player* this, PlayState* play) { + LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); if (this->skelAnime.curFrame >= 6.0f) { - func_80839FFC(this, globalCtx); + func_80839FFC(this, play); } } -void func_8085063C(Player* this, GlobalContext* globalCtx) { +void func_8085063C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - LinkAnimation_Update(globalCtx, &this->skelAnime); - func_80836670(this, globalCtx); + LinkAnimation_Update(play, &this->skelAnime); + func_80836670(this, play); if (this->unk_850 == 0) { - Message_StartTextbox(globalCtx, 0x3B, &this->actor); + Message_StartTextbox(play, 0x3B, &this->actor); this->unk_850 = 1; return; } - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { s32 respawnData = gSaveContext.respawn[RESPAWN_MODE_TOP].data; - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { gSaveContext.respawnFlag = 3; - globalCtx->transitionTrigger = TRANS_TRIGGER_START; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex; - globalCtx->transitionType = TRANS_TYPE_FADE_WHITE_FAST; - func_80088AF0(globalCtx); + play->transitionTrigger = TRANS_TRIGGER_START; + play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex; + play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; + func_80088AF0(play); return; } - if (globalCtx->msgCtx.choiceIndex == 1) { + if (play->msgCtx.choiceIndex == 1) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = -respawnData; gSaveContext.fw.set = 0; func_80078914(&gSaveContext.respawn[RESPAWN_MODE_TOP].pos, NA_SE_PL_MAGIC_WIND_VANISH); } - func_80853080(this, globalCtx); - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + func_80853080(this, play); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); } } -void func_8085076C(Player* this, GlobalContext* globalCtx) { +void func_8085076C(Player* this, PlayState* play) { s32 respawnData = gSaveContext.respawn[RESPAWN_MODE_TOP].data; if (this->unk_850 > 20) { this->actor.draw = Player_Draw; this->actor.world.pos.y += 60.0f; - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); return; } @@ -13124,27 +13104,27 @@ static struct_80832924 D_80854A8C[][2] = { }, }; -void func_808507F4(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { +void func_808507F4(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F < 0) { if ((this->itemActionParam == PLAYER_AP_NAYRUS_LOVE) || (gSaveContext.unk_13F0 == 0)) { - func_80839FFC(this, globalCtx); - func_8005B1A4(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + func_80839FFC(this, play); + func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); } } else { if (this->unk_850 == 0) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, D_80854A58[this->unk_84F], 0.83f); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A58[this->unk_84F], 0.83f); - if (func_80846A00(globalCtx, this, this->unk_84F) != NULL) { + if (func_80846A00(play, this, this->unk_84F) != NULL) { this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; if ((this->unk_84F != 0) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) { gSaveContext.unk_13F0 = 1; } } else { - func_800876C8(globalCtx); + func_800876C8(play); } } else { - LinkAnimation_PlayLoopSetSpeed(globalCtx, &this->skelAnime, D_80854A64[this->unk_84F], 0.83f); + LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, D_80854A64[this->unk_84F], 0.83f); if (this->unk_84F == 0) { this->unk_850 = -10; @@ -13159,7 +13139,7 @@ void func_808507F4(Player* this, GlobalContext* globalCtx) { if (this->unk_850 == 0) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = 1; - Play_SetupRespawnPoint(globalCtx, RESPAWN_MODE_TOP, 0x6FF); + Play_SetupRespawnPoint(play, RESPAWN_MODE_TOP, 0x6FF); gSaveContext.fw.set = 1; gSaveContext.fw.pos.x = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.x; gSaveContext.fw.pos.y = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.y; @@ -13181,7 +13161,7 @@ void func_808507F4(Player* this, GlobalContext* globalCtx) { this->stateFlags1 &= ~(PLAYER_STATE1_28 | PLAYER_STATE1_29); } } else if (D_80854A7C[this->unk_84F] < this->unk_850++) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, D_80854A70[this->unk_84F], 0.83f); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A70[this->unk_84F], 0.83f); this->currentYaw = this->actor.shape.rot.y; this->unk_84F = -1; } @@ -13191,20 +13171,20 @@ void func_808507F4(Player* this, GlobalContext* globalCtx) { func_8083721C(this); } -void func_80850AEC(Player* this, GlobalContext* globalCtx) { +void func_80850AEC(Player* this, PlayState* play) { f32 temp; this->stateFlags2 |= PLAYER_STATE2_5; - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, &gPlayerAnim_002C98); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, &gPlayerAnim_002C98); } Math_Vec3f_Sum(&this->actor.world.pos, &this->actor.velocity, &this->actor.world.pos); if (func_80834FBC(this)) { Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos); - func_80847BA0(globalCtx, this); + func_80847BA0(play, this); temp = this->actor.world.pos.y - this->actor.floorHeight; if (temp > 20.0f) { @@ -13215,7 +13195,7 @@ void func_80850AEC(Player* this, GlobalContext* globalCtx) { this->actor.world.pos.y -= temp; this->linearVelocity = 1.0f; this->actor.velocity.y = 0.0f; - func_80837B9C(this, globalCtx); + func_80837B9C(this, play); this->stateFlags2 &= ~PLAYER_STATE2_10; this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND; this->stateFlags1 |= PLAYER_STATE1_2; @@ -13229,7 +13209,7 @@ void func_80850AEC(Player* this, GlobalContext* globalCtx) { } } -void func_80850C68(Player* this, GlobalContext* globalCtx) { +void func_80850C68(Player* this, PlayState* play) { if ((this->unk_850 != 0) && ((this->unk_858 != 0.0f) || (this->unk_85C != 0.0f))) { f32 updateScale = R_UPDATE_RATE * 0.5f; @@ -13238,36 +13218,36 @@ void func_80850C68(Player* this, GlobalContext* globalCtx) { this->skelAnime.curFrame -= this->skelAnime.animLength; } - LinkAnimation_BlendToJoint(globalCtx, &this->skelAnime, &gPlayerAnim_002C38, this->skelAnime.curFrame, + LinkAnimation_BlendToJoint(play, &this->skelAnime, &gPlayerAnim_002C38, this->skelAnime.curFrame, (this->unk_858 < 0.0f) ? &gPlayerAnim_002C18 : &gPlayerAnim_002C20, 5.0f, fabsf(this->unk_858), this->blendTable); - LinkAnimation_BlendToMorph(globalCtx, &this->skelAnime, &gPlayerAnim_002C38, this->skelAnime.curFrame, + LinkAnimation_BlendToMorph(play, &this->skelAnime, &gPlayerAnim_002C38, this->skelAnime.curFrame, (this->unk_85C < 0.0f) ? &gPlayerAnim_002C28 : &gPlayerAnim_002C10, 5.0f, fabsf(this->unk_85C), D_80858AD8); - LinkAnimation_InterpJointMorph(globalCtx, &this->skelAnime, 0.5f); - } else if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + LinkAnimation_InterpJointMorph(play, &this->skelAnime, 0.5f); + } else if (LinkAnimation_Update(play, &this->skelAnime)) { this->unk_860 = 2; - func_80832284(globalCtx, this, &gPlayerAnim_002C38); + func_80832284(play, this, &gPlayerAnim_002C38); this->unk_850 = 1; } func_8083721C(this); if (this->unk_860 == 0) { - func_80853080(this, globalCtx); + func_80853080(this, play); } else if (this->unk_860 == 3) { - func_80835C58(globalCtx, this, func_80850E84, 0); - func_80832B0C(globalCtx, this, &gPlayerAnim_002C00); + func_80835C58(play, this, func_80850E84, 0); + func_80832B0C(play, this, &gPlayerAnim_002C00); } } -void func_80850E84(Player* this, GlobalContext* globalCtx) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->unk_860 == 0)) { - func_8083A098(this, &gPlayerAnim_002C08, globalCtx); +void func_80850E84(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_860 == 0)) { + func_8083A098(this, &gPlayerAnim_002C08, play); } } -static void (*D_80854AA4[])(GlobalContext*, Player*, void*) = { +static void (*D_80854AA4[])(PlayState*, Player*, void*) = { NULL, func_80851008, func_80851030, func_80851094, func_808510B4, func_808510D4, func_808510F4, func_80851114, func_80851134, func_80851154, func_80851174, func_808511D4, func_808511FC, func_80851294, func_80851050, func_80851194, func_808511B4, func_80851248, func_808512E0, @@ -13500,106 +13480,106 @@ static struct_80854B18 D_80854E50[] = { { 12, &gPlayerAnim_002450 }, }; -void func_80850ED8(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { +void func_80850ED8(PlayState* play, Player* this, LinkAnimationHeader* anim) { func_80832DB0(this); - func_80832B0C(globalCtx, this, anim); + func_80832B0C(play, this, anim); func_80832210(this); } -void func_80850F1C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { +void func_80850F1C(PlayState* play, Player* this, LinkAnimationHeader* anim) { func_80832DB0(this); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, Animation_GetLastFrame(anim), - ANIMMODE_ONCE, -8.0f); + LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, + -8.0f); func_80832210(this); } -void func_80850F9C(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim) { +void func_80850F9C(PlayState* play, Player* this, LinkAnimationHeader* anim) { func_80832DB0(this); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f); + LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f); func_80832210(this); } -void func_80851008(GlobalContext* globalCtx, Player* this, void* anim) { +void func_80851008(PlayState* play, Player* this, void* anim) { func_80832210(this); } -void func_80851030(GlobalContext* globalCtx, Player* this, void* anim) { - func_80850ED8(globalCtx, this, anim); +void func_80851030(PlayState* play, Player* this, void* anim) { + func_80850ED8(play, this, anim); } -void func_80851050(GlobalContext* globalCtx, Player* this, void* anim) { +void func_80851050(PlayState* play, Player* this, void* anim) { func_80832DB0(this); - func_80832C2C(globalCtx, this, anim); + func_80832C2C(play, this, anim); func_80832210(this); } -void func_80851094(GlobalContext* globalCtx, Player* this, void* anim) { - func_80850F1C(globalCtx, this, anim); +void func_80851094(PlayState* play, Player* this, void* anim) { + func_80850F1C(play, this, anim); } -void func_808510B4(GlobalContext* globalCtx, Player* this, void* anim) { - func_80850F9C(globalCtx, this, anim); +void func_808510B4(PlayState* play, Player* this, void* anim) { + func_80850F9C(play, this, anim); } -void func_808510D4(GlobalContext* globalCtx, Player* this, void* anim) { - func_8083308C(globalCtx, this, anim); +void func_808510D4(PlayState* play, Player* this, void* anim) { + func_8083308C(play, this, anim); } -void func_808510F4(GlobalContext* globalCtx, Player* this, void* anim) { - func_8083303C(globalCtx, this, anim, 0x9C); +void func_808510F4(PlayState* play, Player* this, void* anim) { + func_8083303C(play, this, anim, 0x9C); } -void func_80851114(GlobalContext* globalCtx, Player* this, void* anim) { - func_8083313C(globalCtx, this, anim); +void func_80851114(PlayState* play, Player* this, void* anim) { + func_8083313C(play, this, anim); } -void func_80851134(GlobalContext* globalCtx, Player* this, void* anim) { - func_808330EC(globalCtx, this, anim, 0x9C); +void func_80851134(PlayState* play, Player* this, void* anim) { + func_808330EC(play, this, anim, 0x9C); } -void func_80851154(GlobalContext* globalCtx, Player* this, void* anim) { - func_80832264(globalCtx, this, anim); +void func_80851154(PlayState* play, Player* this, void* anim) { + func_80832264(play, this, anim); } -void func_80851174(GlobalContext* globalCtx, Player* this, void* anim) { - func_80832284(globalCtx, this, anim); +void func_80851174(PlayState* play, Player* this, void* anim) { + func_80832284(play, this, anim); } -void func_80851194(GlobalContext* globalCtx, Player* this, void* anim) { - func_808322D0(globalCtx, this, anim); +void func_80851194(PlayState* play, Player* this, void* anim) { + func_808322D0(play, this, anim); } -void func_808511B4(GlobalContext* globalCtx, Player* this, void* anim) { - func_808322A4(globalCtx, this, anim); +void func_808511B4(PlayState* play, Player* this, void* anim) { + func_808322A4(play, this, anim); } -void func_808511D4(GlobalContext* globalCtx, Player* this, void* anim) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_808511D4(PlayState* play, Player* this, void* anim) { + LinkAnimation_Update(play, &this->skelAnime); } -void func_808511FC(GlobalContext* globalCtx, Player* this, void* anim) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80850F9C(globalCtx, this, anim); +void func_808511FC(PlayState* play, Player* this, void* anim) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80850F9C(play, this, anim); this->unk_850 = 1; } } -void func_80851248(GlobalContext* globalCtx, Player* this, void* anim) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { +void func_80851248(PlayState* play, Player* this, void* anim) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); - func_808322A4(globalCtx, this, anim); + func_808322A4(play, this, anim); } } -void func_80851294(GlobalContext* globalCtx, Player* this, void* anim) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083313C(globalCtx, this, anim); +void func_80851294(PlayState* play, Player* this, void* anim) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083313C(play, this, anim); this->unk_850 = 1; } } -void func_808512E0(GlobalContext* globalCtx, Player* this, void* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_808512E0(PlayState* play, Player* this, void* arg2) { + LinkAnimation_Update(play, &this->skelAnime); func_80832924(this, arg2); } @@ -13615,33 +13595,33 @@ void func_80851314(Player* this) { } } -void func_80851368(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80851368(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->stateFlags1 |= PLAYER_STATE1_27; this->stateFlags2 |= PLAYER_STATE2_10; this->stateFlags1 &= ~(PLAYER_STATE1_18 | PLAYER_STATE1_19); - func_80832284(globalCtx, this, &gPlayerAnim_0032F0); + func_80832284(play, this, &gPlayerAnim_0032F0); } -void func_808513BC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808513BC(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->actor.gravity = 0.0f; if (this->unk_84F == 0) { - if (func_8083D12C(globalCtx, this, NULL)) { + if (func_8083D12C(play, this, NULL)) { this->unk_84F = 1; } else { - func_8084B158(globalCtx, this, NULL, fabsf(this->actor.velocity.y)); + func_8084B158(play, this, NULL, fabsf(this->actor.velocity.y)); Math_ScaledStepToS(&this->unk_6C2, -10000, 800); func_8084AEEC(this, &this->actor.velocity.y, 4.0f, this->currentYaw); } return; } - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { + if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F == 1) { - func_80832C6C(globalCtx, this, &gPlayerAnim_003328); + func_80832C6C(play, this, &gPlayerAnim_003328); } else { - func_80832284(globalCtx, this, &gPlayerAnim_003328); + func_80832284(play, this, &gPlayerAnim_003328); } } @@ -13649,67 +13629,67 @@ void func_808513BC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); } -void func_808514C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808514C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { func_80851314(this); if (func_808332B8(this)) { - func_808513BC(globalCtx, this, 0); + func_808513BC(play, this, 0); return; } - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (func_8008F128(this) || (this->stateFlags1 & PLAYER_STATE1_11)) { - func_80836670(this, globalCtx); + func_80836670(this, play); return; } if ((this->interactRangeActor != NULL) && (this->interactRangeActor->textId == 0xFFFF)) { - func_8083E5A8(this, globalCtx); + func_8083E5A8(this, play); } } -void func_8085157C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_8085157C(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); } -void func_808515A4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808515A4(PlayState* play, Player* this, CsCmdActorAction* arg2) { LinkAnimationHeader* anim; if (func_808332B8(this)) { - func_80851368(globalCtx, this, 0); + func_80851368(play, this, 0); return; } anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_44, this->modelAnimType); if ((this->unk_446 == 6) || (this->unk_446 == 0x2E)) { - func_80832264(globalCtx, this, anim); + func_80832264(play, this, anim); } else { func_80832DB0(this); - LinkAnimation_Change(globalCtx, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, Animation_GetLastFrame(anim), + LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, Animation_GetLastFrame(anim), ANIMMODE_LOOP, -4.0f); } func_80832210(this); } -void func_80851688(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (func_8084B3CC(globalCtx, this) == 0) { - if ((this->csMode == 0x31) && (globalCtx->csCtx.state == CS_STATE_IDLE)) { - func_8002DF54(globalCtx, NULL, 7); +void func_80851688(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (func_8084B3CC(play, this) == 0) { + if ((this->csMode == 0x31) && (play->csCtx.state == CS_STATE_IDLE)) { + func_8002DF54(play, NULL, 7); return; } if (func_808332B8(this) != 0) { - func_808513BC(globalCtx, this, 0); + func_808513BC(play, this, 0); return; } - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if (func_8008F128(this) || (this->stateFlags1 & PLAYER_STATE1_11)) { - func_80836670(this, globalCtx); + func_80836670(this, play); } } } @@ -13719,12 +13699,12 @@ static struct_80832924 D_80855188[] = { { 0, -0x3030 }, }; -void func_80851750(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80851750(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); func_80832924(this, D_80855188); } -void func_80851788(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80851788(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->stateFlags1 &= ~PLAYER_STATE1_25; this->currentYaw = this->actor.shape.rot.y = this->actor.world.rot.y = @@ -13737,18 +13717,18 @@ void func_80851788(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } } -void func_80851828(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80851828(PlayState* play, Player* this, CsCmdActorAction* arg2) { f32 sp1C = 2.5f; - func_80845BA0(globalCtx, this, &sp1C, 10); + func_80845BA0(play, this, &sp1C, 10); - if (globalCtx->sceneNum == SCENE_BDAN_BOSS) { + if (play->sceneNum == SCENE_BDAN_BOSS) { if (this->unk_850 == 0) { - if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { return; } } else { - if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { return; } } @@ -13760,31 +13740,31 @@ void func_80851828(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } } -void func_808518DC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_8083CEAC(this, globalCtx); +void func_808518DC(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_8083CEAC(this, play); } -void func_8085190C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_8085190C(PlayState* play, Player* this, CsCmdActorAction* arg2) { func_80851314(this); if (this->unk_850 != 0) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80832284(globalCtx, this, func_808334E4(this)); + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80832284(play, this, func_808334E4(this)); this->unk_850 = 0; } func_80833C3C(this); } else { - func_808401B0(globalCtx, this); + func_808401B0(play, this); } } -void func_80851998(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80845964(globalCtx, this, arg2, 0.0f, 0, 0); +void func_80851998(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80845964(play, this, arg2, 0.0f, 0, 0); } -void func_808519C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80845964(globalCtx, this, arg2, 0.0f, 0, 1); +void func_808519C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80845964(play, this, arg2, 0.0f, 0, 1); } // unused @@ -13795,11 +13775,11 @@ static LinkAnimationHeader* D_80855190[] = { static Vec3f D_80855198 = { -1.0f, 70.0f, 20.0f }; -void func_808519EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808519EC(PlayState* play, Player* this, CsCmdActorAction* arg2) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80855198); this->actor.shape.rot.y = -0x8000; - func_808322D0(globalCtx, this, this->ageProperties->unk_9C); - func_80832F54(globalCtx, this, 0x28F); + func_808322D0(play, this, this->ageProperties->unk_9C); + func_80832F54(play, this, 0x28F); } static struct_808551A4 D_808551A4[] = { @@ -13812,11 +13792,11 @@ static struct_80832924 D_808551AC[] = { { 0, -0x4027 }, }; -void func_80851A50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80851A50(PlayState* play, Player* this, CsCmdActorAction* arg2) { struct_808551A4* sp2C; Gfx** dLists; - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); if ((LINK_IS_ADULT && LinkAnimation_OnFrame(&this->skelAnime, 70.0f)) || (!LINK_IS_ADULT && LinkAnimation_OnFrame(&this->skelAnime, 87.0f))) { @@ -13843,8 +13823,8 @@ void func_80851A50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } } -void func_80851B90(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_002860, -(2.0f / 3.0f), 12.0f, 12.0f, ANIMMODE_ONCE, +void func_80851B90(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_002860, -(2.0f / 3.0f), 12.0f, 12.0f, ANIMMODE_ONCE, 0.0f); } @@ -13852,24 +13832,24 @@ static struct_80832924 D_808551B4[] = { { 0, -0x281E }, }; -void func_80851BE8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80851BE8(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); this->unk_850++; if (this->unk_850 >= 180) { if (this->unk_850 == 180) { - LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_003298, (2.0f / 3.0f), 10.0f, + LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_003298, (2.0f / 3.0f), 10.0f, Animation_GetLastFrame(&gPlayerAnim_003298), ANIMMODE_ONCE, -8.0f); } func_80832924(this, D_808551B4); } } -void func_80851CA4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->unk_850 == 0) && +void func_80851CA4(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_850 == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_80832264(globalCtx, this, &gPlayerAnim_002DB8); + func_80832264(play, this, &gPlayerAnim_002DB8); this->unk_850 = 1; } @@ -13878,8 +13858,8 @@ void func_80851CA4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } } -void func_80851D2C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80850F1C(globalCtx, this, &gPlayerAnim_0030A0); +void func_80851D2C(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80850F1C(play, this, &gPlayerAnim_0030A0); func_8084B498(this); Player_SetModels(this, Player_ActionToModelGroup(this, this->itemActionParam)); } @@ -13888,53 +13868,53 @@ static struct_80832924 D_808551B8[] = { { NA_SE_IT_SWORD_PICKOUT, -0x80C }, }; -void func_80851D80(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80851D80(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 6.0f)) { - func_80846720(globalCtx, this, 0); + func_80846720(play, this, 0); } else { func_80832924(this, D_808551B8); } } -void func_80851DEC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80851DEC(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); Math_StepToS(&this->actor.shape.face, 0, 1); } -void func_80851E28(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80851E28(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); Math_StepToS(&this->actor.shape.face, 2, 1); } -void func_80851E64(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80833064(globalCtx, this, &gPlayerAnim_003318, 0x98); +void func_80851E64(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80833064(play, this, &gPlayerAnim_003318, 0x98); } -void func_80851E90(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_8083303C(globalCtx, this, &gPlayerAnim_002408, 0x9C); +void func_80851E90(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_8083303C(play, this, &gPlayerAnim_002408, 0x9C); func_80832698(this, NA_SE_VO_LI_GROAN); } -void func_80851ECC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_808330EC(globalCtx, this, &gPlayerAnim_002428, 0x9C); +void func_80851ECC(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_808330EC(play, this, &gPlayerAnim_002428, 0x9C); } } -void func_80851F14(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, struct_80832924* arg3) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_808322A4(globalCtx, this, anim); +void func_80851F14(PlayState* play, Player* this, LinkAnimationHeader* anim, struct_80832924* arg3) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_808322A4(play, this, anim); this->unk_850 = 1; } else if (this->unk_850 == 0) { func_80832924(this, arg3); } } -void func_80851F84(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80851F84(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->actor.shape.shadowDraw = NULL; - func_80851134(globalCtx, this, &gPlayerAnim_002420); + func_80851134(play, this, &gPlayerAnim_002420); } static struct_80832924 D_808551BC[] = { @@ -13943,9 +13923,9 @@ static struct_80832924 D_808551BC[] = { { NA_SE_PL_SLIPDOWN, -0x900 }, }; -void func_80851FB0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_808330EC(globalCtx, this, &gPlayerAnim_002430, 0x9C); +void func_80851FB0(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_808330EC(play, this, &gPlayerAnim_002430, 0x9C); this->unk_850 = 1; } else if (this->unk_850 == 0) { func_80832924(this, D_808551BC); @@ -13962,24 +13942,24 @@ static struct_80832924 D_808551C8[] = { { 0, -0x4860 }, }; -void func_80852048(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80852048(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); func_80832924(this, D_808551C8); } -void func_80852080(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80833064(globalCtx, this, &gPlayerAnim_002340, 0x9D); +void func_80852080(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80833064(play, this, &gPlayerAnim_002340, 0x9D); func_80832698(this, NA_SE_VO_LI_FALL_L); } -void func_808520BC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808520BC(PlayState* play, Player* this, CsCmdActorAction* arg2) { f32 startX = arg2->startPos.x; f32 startY = arg2->startPos.y; f32 startZ = arg2->startPos.z; f32 distX = (arg2->endPos.x - startX); f32 distY = (arg2->endPos.y - startY); f32 distZ = (arg2->endPos.z - startZ); - f32 sp4 = (f32)(globalCtx->csCtx.frames - arg2->startFrame) / (f32)(arg2->endFrame - arg2->startFrame); + f32 sp4 = (f32)(play->csCtx.frames - arg2->startFrame) / (f32)(arg2->endFrame - arg2->startFrame); this->actor.world.pos.x = distX * sp4 + startX; this->actor.world.pos.y = distY * sp4 + startY; @@ -13991,43 +13971,43 @@ static struct_80832924 D_808551D8[] = { { NA_SE_PL_BOUND, -0x101E }, }; -void func_80852174(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_808520BC(globalCtx, this, arg2); - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80852174(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_808520BC(play, this, arg2); + LinkAnimation_Update(play, &this->skelAnime); func_80832924(this, D_808551D8); } -void func_808521B8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808521B8(PlayState* play, Player* this, CsCmdActorAction* arg2) { if (arg2 != NULL) { - func_808520BC(globalCtx, this, arg2); + func_808520BC(play, this, arg2); } - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); } -void func_808521F4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80832B0C(globalCtx, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_44, this->modelAnimType)); +void func_808521F4(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80832B0C(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_44, this->modelAnimType)); func_80832210(this); } -void func_80852234(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80852234(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); } -void func_8085225C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80832F54(globalCtx, this, 0x98); +void func_8085225C(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80832F54(play, this, 0x98); } -void func_80852280(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852280(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->actor.draw = Player_Draw; } -void func_80852298(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_8083313C(globalCtx, this, &gPlayerAnim_002378); +void func_80852298(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_8083313C(play, this, &gPlayerAnim_002378); this->unk_850 = 1; } else if (this->unk_850 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) { - func_80846720(globalCtx, this, 1); + func_80846720(play, this, 1); } } } @@ -14037,8 +14017,8 @@ static struct_80832924 D_808551E0[] = { { 0, -0x3018 }, }; -void func_80852328(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80851F14(globalCtx, this, &gPlayerAnim_002770, D_808551E0); +void func_80852328(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80851F14(play, this, &gPlayerAnim_002770, D_808551E0); } static struct_80832924 D_808551E8[] = { @@ -14046,25 +14026,25 @@ static struct_80832924 D_808551E8[] = { { 0, -0x4023 }, }; -void func_80852358(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80851F14(globalCtx, this, &gPlayerAnim_002830, D_808551E8); +void func_80852358(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80851F14(play, this, &gPlayerAnim_002830, D_808551E8); } -void func_80852388(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_808322A4(globalCtx, this, &gPlayerAnim_002468); +void func_80852388(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_808322A4(play, this, &gPlayerAnim_002468); this->unk_850 = 1; } - if ((this->unk_850 != 0) && (globalCtx->csCtx.frames >= 900)) { + if ((this->unk_850 != 0) && (play->csCtx.frames >= 900)) { this->rightHandType = PLAYER_MODELTYPE_LH_OPEN; } else { this->rightHandType = PLAYER_MODELTYPE_RH_FF; } } -void func_80852414(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* anim, struct_80832924* arg3) { - func_80851294(globalCtx, this, anim); +void func_80852414(PlayState* play, Player* this, LinkAnimationHeader* anim, struct_80832924* arg3) { + func_80851294(play, this, anim); if (this->unk_850 == 0) { func_80832924(this, arg3); } @@ -14075,64 +14055,64 @@ static struct_80832924 D_808551F0[] = { { 0, -0x3021 }, }; -void func_80852450(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80852414(globalCtx, this, &gPlayerAnim_002378, D_808551F0); +void func_80852450(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80852414(play, this, &gPlayerAnim_002378, D_808551F0); } static struct_80832924 D_808551F8[] = { { NA_SE_PL_KNOCK, -0x84E }, }; -void func_80852480(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80852414(globalCtx, this, &gPlayerAnim_0027D0, D_808551F8); +void func_80852480(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80852414(play, this, &gPlayerAnim_0027D0, D_808551F8); } -void func_808524B0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80837704(globalCtx, this); +void func_808524B0(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80837704(play, this); } -void func_808524D0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808524D0(PlayState* play, Player* this, CsCmdActorAction* arg2) { sControlInput->press.button |= BTN_B; - func_80844E68(this, globalCtx); + func_80844E68(this, play); } -void func_80852514(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80844E68(this, globalCtx); +void func_80852514(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80844E68(this, play); } -void func_80852544(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852544(PlayState* play, Player* this, CsCmdActorAction* arg2) { } -void func_80852554(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852554(PlayState* play, Player* this, CsCmdActorAction* arg2) { } -void func_80852564(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852564(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->stateFlags3 |= PLAYER_STATE3_1; this->linearVelocity = 2.0f; this->actor.velocity.y = -1.0f; - func_80832264(globalCtx, this, &gPlayerAnim_002DB0); + func_80832264(play, this, &gPlayerAnim_002DB0); func_80832698(this, NA_SE_VO_LI_FALL_L); } -static void (*D_808551FC[])(Player* this, GlobalContext* globalCtx) = { +static void (*D_808551FC[])(Player* this, PlayState* play) = { func_8084377C, func_80843954, func_80843A38, }; -void func_808525C0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - D_808551FC[this->unk_850](this, globalCtx); +void func_808525C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { + D_808551FC[this->unk_850](this, play); } -void func_80852608(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - func_80846720(globalCtx, this, 0); - func_808322D0(globalCtx, this, &gPlayerAnim_002838); +void func_80852608(PlayState* play, Player* this, CsCmdActorAction* arg2) { + func_80846720(play, this, 0); + func_808322D0(play, this, &gPlayerAnim_002838); } -void func_80852648(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - LinkAnimation_Update(globalCtx, &this->skelAnime); +void func_80852648(PlayState* play, Player* this, CsCmdActorAction* arg2) { + LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) { this->heldItemActionParam = this->itemActionParam = PLAYER_AP_NONE; @@ -14141,7 +14121,7 @@ void func_80852648(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg this->leftHandDLists = D_80125E08; Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER); gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; - Inventory_DeleteEquipment(globalCtx, EQUIP_TYPE_SWORD); + Inventory_DeleteEquipment(play, EQUIP_TYPE_SWORD); } } @@ -14155,7 +14135,7 @@ static Vec3s D_80855210[2][2] = { { { -200, 500, 0 }, { 600, 400, 600 } }, }; -void func_808526EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808526EC(PlayState* play, Player* this, CsCmdActorAction* arg2) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; static Color_RGBA8 envColor = { 0, 128, 128, 0 }; @@ -14164,7 +14144,7 @@ void func_808526EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg Vec3f sp34; Vec3s* ptr; - func_80851294(globalCtx, this, D_80855208[linkAge]); + func_80851294(play, this, D_80855208[linkAge]); if (this->rightHandType != PLAYER_MODELTYPE_RH_FF) { this->rightHandType = PLAYER_MODELTYPE_RH_FF; @@ -14179,38 +14159,38 @@ void func_808526EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg SkinMatrix_Vec3fMtxFMultXYZ(&this->shieldMf, &sp34, &sparklePos); - EffectSsKiraKira_SpawnDispersed(globalCtx, &sparklePos, &zeroVec, &zeroVec, &primColor, &envColor, 600, -10); + EffectSsKiraKira_SpawnDispersed(play, &sparklePos, &zeroVec, &zeroVec, &primColor, &envColor, 600, -10); } -void func_8085283C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { - func_80852944(globalCtx, this, arg2); +void func_8085283C(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { + func_80852944(play, this, arg2); } else if (this->unk_850 == 0) { - Item_Give(globalCtx, ITEM_SWORD_MASTER); - func_80846720(globalCtx, this, 0); + Item_Give(play, ITEM_SWORD_MASTER); + func_80846720(play, this, 0); } else { func_8084E988(this); } } -void func_808528C8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { +void func_808528C8(PlayState* play, Player* this, CsCmdActorAction* arg2) { + if (LinkAnimation_Update(play, &this->skelAnime)) { func_8084285C(this, 0.0f, 99.0f, this->skelAnime.endFrame - 8.0f); } if (this->heldItemActionParam != PLAYER_AP_SWORD_MASTER) { - func_80846720(globalCtx, this, 1); + func_80846720(play, this, 1); } } -void func_80852944(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852944(PlayState* play, Player* this, CsCmdActorAction* arg2) { if (func_808332B8(this)) { - func_80838F18(globalCtx, this); - func_80832340(globalCtx, this); + func_80838F18(play, this); + func_80832340(play, this); } else { - func_8083C148(this, globalCtx); - if (!func_8083B644(this, globalCtx)) { - func_8083E5A8(this, globalCtx); + func_8083C148(this, play); + if (!func_8083B644(this, play)) { + func_8083E5A8(this, play); } } @@ -14218,17 +14198,17 @@ void func_80852944(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg this->unk_6AD = 0; } -void func_808529D0(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_808529D0(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->actor.world.pos.x = arg2->startPos.x; this->actor.world.pos.y = arg2->startPos.y; - if ((globalCtx->sceneNum == SCENE_SPOT04) && !LINK_IS_ADULT) { + if ((play->sceneNum == SCENE_SPOT04) && !LINK_IS_ADULT) { this->actor.world.pos.y -= 1.0f; } this->actor.world.pos.z = arg2->startPos.z; this->currentYaw = this->actor.shape.rot.y = arg2->rot.y; } -void func_80852A54(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { +void func_80852A54(PlayState* play, Player* this, CsCmdActorAction* arg2) { f32 dx = arg2->startPos.x - (s32)this->actor.world.pos.x; f32 dy = arg2->startPos.y - (s32)this->actor.world.pos.y; f32 dz = arg2->startPos.z - (s32)this->actor.world.pos.z; @@ -14236,18 +14216,18 @@ void func_80852A54(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg s16 yawDiff = arg2->rot.y - this->actor.shape.rot.y; if ((this->linearVelocity == 0.0f) && ((dist > 50.0f) || (ABS(yawDiff) > 0x4000))) { - func_808529D0(globalCtx, this, arg2); + func_808529D0(play, this, arg2); } this->skelAnime.moveFlags = 0; func_80832DB0(this); } -void func_80852B4C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2, struct_80854B18* arg3) { +void func_80852B4C(PlayState* play, Player* this, CsCmdActorAction* arg2, struct_80854B18* arg3) { if (arg3->type > 0) { - D_80854AA4[arg3->type](globalCtx, this, arg3->ptr); + D_80854AA4[arg3->type](play, this, arg3->ptr); } else if (arg3->type < 0) { - arg3->func(globalCtx, this, arg2); + arg3->func(play, this, arg2); } if ((D_80858AA0 & 4) && !(this->skelAnime.moveFlags & 4)) { @@ -14256,19 +14236,19 @@ void func_80852B4C(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } } -void func_80852C0C(GlobalContext* globalCtx, Player* this, s32 csMode) { +void func_80852C0C(PlayState* play, Player* this, s32 csMode) { if ((csMode != 1) && (csMode != 8) && (csMode != 0x31) && (csMode != 7)) { - func_808323B4(globalCtx, this); + func_808323B4(play, this); } } -void func_80852C50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - CsCmdActorAction* linkCsAction = globalCtx->csCtx.linkAction; +void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2) { + CsCmdActorAction* linkCsAction = play->csCtx.linkAction; s32 pad; s32 sp24; - if (globalCtx->csCtx.state == CS_STATE_UNSKIPPABLE_INIT) { - func_8002DF54(globalCtx, NULL, 7); + if (play->csCtx.state == CS_STATE_UNSKIPPABLE_INIT) { + func_8002DF54(play, NULL, 7); this->unk_446 = 0; func_80832210(this); return; @@ -14283,9 +14263,9 @@ void func_80852C50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg sp24 = D_808547C4[linkCsAction->action]; if (sp24 >= 0) { if ((sp24 == 3) || (sp24 == 4)) { - func_80852A54(globalCtx, this, linkCsAction); + func_80852A54(play, this, linkCsAction); } else { - func_808529D0(globalCtx, this, linkCsAction); + func_808529D0(play, this, linkCsAction); } } @@ -14293,8 +14273,8 @@ void func_80852C50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg func_80832DBC(this); osSyncPrintf("TOOL MODE=%d\n", sp24); - func_80852C0C(globalCtx, this, ABS(sp24)); - func_80852B4C(globalCtx, this, linkCsAction, &D_80854B18[ABS(sp24)]); + func_80852C0C(play, this, ABS(sp24)); + func_80852B4C(play, this, linkCsAction, &D_80854B18[ABS(sp24)]); this->unk_850 = 0; this->unk_84F = 0; @@ -14302,43 +14282,43 @@ void func_80852C50(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } sp24 = D_808547C4[this->unk_446]; - func_80852B4C(globalCtx, this, linkCsAction, &D_80854E50[ABS(sp24)]); + func_80852B4C(play, this, linkCsAction, &D_80854E50[ABS(sp24)]); } -void func_80852E14(Player* this, GlobalContext* globalCtx) { +void func_80852E14(Player* this, PlayState* play) { if (this->csMode != this->prevCsMode) { D_80858AA0 = this->skelAnime.moveFlags; func_80832DBC(this); this->prevCsMode = this->csMode; osSyncPrintf("DEMO MODE=%d\n", this->csMode); - func_80852C0C(globalCtx, this, this->csMode); - func_80852B4C(globalCtx, this, NULL, &D_80854B18[this->csMode]); + func_80852C0C(play, this, this->csMode); + func_80852B4C(play, this, NULL, &D_80854B18[this->csMode]); } - func_80852B4C(globalCtx, this, NULL, &D_80854E50[this->csMode]); + func_80852B4C(play, this, NULL, &D_80854E50[this->csMode]); } -s32 Player_IsDroppingFish(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_IsDroppingFish(PlayState* play) { + Player* this = GET_PLAYER(play); return (func_8084EFC0 == this->func_674) && (this->itemActionParam == PLAYER_AP_BOTTLE_FISH); } -s32 Player_StartFishing(GlobalContext* globalCtx) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_StartFishing(PlayState* play) { + Player* this = GET_PLAYER(play); - func_80832564(globalCtx, this); - func_80835F44(globalCtx, this, ITEM_FISHING_POLE); + func_80832564(play, this); + func_80835F44(play, this, ITEM_FISHING_POLE); return 1; } -s32 func_80852F38(GlobalContext* globalCtx, Player* this) { - if (!Player_InBlockingCsMode(globalCtx, this) && (this->invincibilityTimer >= 0) && !func_8008F128(this) && +s32 func_80852F38(PlayState* play, Player* this) { + if (!Player_InBlockingCsMode(play, this) && (this->invincibilityTimer >= 0) && !func_8008F128(this) && !(this->stateFlags3 & PLAYER_STATE3_7)) { - func_80832564(globalCtx, this); - func_80835C58(globalCtx, this, func_8084F308, 0); - func_80832264(globalCtx, this, &gPlayerAnim_003120); + func_80832564(play, this); + func_80835C58(play, this, func_8084F308, 0); + func_80832264(play, this, &gPlayerAnim_003120); this->stateFlags2 |= PLAYER_STATE2_7; func_80832224(this); func_80832698(this, NA_SE_VO_LI_HELD); @@ -14349,12 +14329,12 @@ s32 func_80852F38(GlobalContext* globalCtx, Player* this) { } // Sets up player cutscene -s32 func_80852FFC(GlobalContext* globalCtx, Actor* actor, s32 csMode) { - Player* this = GET_PLAYER(globalCtx); +s32 func_80852FFC(PlayState* play, Actor* actor, s32 csMode) { + Player* this = GET_PLAYER(play); - if (!Player_InBlockingCsMode(globalCtx, this)) { - func_80832564(globalCtx, this); - func_80835C58(globalCtx, this, func_80852E14, 0); + if (!Player_InBlockingCsMode(play, this)) { + func_80832564(play, this); + func_80835C58(play, this, func_80852E14, 0); this->csMode = csMode; this->unk_448 = actor; func_80832224(this); @@ -14364,16 +14344,16 @@ s32 func_80852FFC(GlobalContext* globalCtx, Actor* actor, s32 csMode) { return 0; } -void func_80853080(Player* this, GlobalContext* globalCtx) { - func_80835C58(globalCtx, this, func_80840BC8, 1); - func_80832B0C(globalCtx, this, func_80833338(this)); +void func_80853080(Player* this, PlayState* play) { + func_80835C58(play, this, func_80840BC8, 1); + func_80832B0C(play, this, func_80833338(this)); this->currentYaw = this->actor.shape.rot.y; } -s32 Player_InflictDamage(GlobalContext* globalCtx, s32 damage) { - Player* this = GET_PLAYER(globalCtx); +s32 Player_InflictDamage(PlayState* play, s32 damage) { + Player* this = GET_PLAYER(play); - if (!Player_InBlockingCsMode(globalCtx, this) && !func_80837B18(globalCtx, this, damage)) { + if (!Player_InBlockingCsMode(play, this) && !func_80837B18(play, this, damage)) { this->stateFlags2 &= ~PLAYER_STATE2_7; return 1; } @@ -14382,8 +14362,8 @@ s32 Player_InflictDamage(GlobalContext* globalCtx, s32 damage) { } // Start talking with the given actor -void func_80853148(GlobalContext* globalCtx, Actor* actor) { - Player* this = GET_PLAYER(globalCtx); +void func_80853148(PlayState* play, Actor* actor) { + Player* this = GET_PLAYER(play); s32 pad; if ((this->targetActor != NULL) || (actor == this->naviActor) || @@ -14395,9 +14375,9 @@ void func_80853148(GlobalContext* globalCtx, Actor* actor) { this->exchangeItemId = EXCH_ITEM_NONE; if (actor->textId == 0xFFFF) { - func_8002DF54(globalCtx, actor, 1); + func_8002DF54(play, actor, 1); actor->flags |= ACTOR_FLAG_8; - func_80832528(globalCtx, this); + func_80832528(play, this); } else { if (this->actor.flags & ACTOR_FLAG_8) { this->actor.textId = 0; @@ -14409,32 +14389,31 @@ void func_80853148(GlobalContext* globalCtx, Actor* actor) { if (this->stateFlags1 & PLAYER_STATE1_23) { s32 sp24 = this->unk_850; - func_80832528(globalCtx, this); - func_8083A2F8(globalCtx, this); + func_80832528(play, this); + func_8083A2F8(play, this); this->unk_850 = sp24; } else { if (func_808332B8(this)) { - func_80836898(globalCtx, this, func_8083A2F8); - func_80832C6C(globalCtx, this, &gPlayerAnim_003328); + func_80836898(play, this, func_8083A2F8); + func_80832C6C(play, this, &gPlayerAnim_003328); } else if ((actor->category != ACTORCAT_NPC) || (this->heldItemActionParam == PLAYER_AP_FISHING_POLE)) { - func_8083A2F8(globalCtx, this); + func_8083A2F8(play, this); if (!func_8008E9C4(this)) { if ((actor != this->naviActor) && (actor->xzDistToPlayer < 40.0f)) { - func_808322D0(globalCtx, this, &gPlayerAnim_002DF0); + func_808322D0(play, this, &gPlayerAnim_002DF0); } else { - func_80832284(globalCtx, this, func_80833338(this)); + func_80832284(play, this, func_80833338(this)); } } } else { - func_80836898(globalCtx, this, func_8083A2F8); - func_808322D0(globalCtx, this, - (actor->xzDistToPlayer < 40.0f) ? &gPlayerAnim_002DF0 : &gPlayerAnim_0031A0); + func_80836898(play, this, func_8083A2F8); + func_808322D0(play, this, (actor->xzDistToPlayer < 40.0f) ? &gPlayerAnim_002DF0 : &gPlayerAnim_0031A0); } if (this->skelAnime.animation == &gPlayerAnim_002DF0) { - func_80832F54(globalCtx, this, 0x19); + func_80832F54(play, this, 0x19); } func_80832224(this); @@ -14445,6 +14424,6 @@ void func_80853148(GlobalContext* globalCtx, Actor* actor) { if ((this->naviActor == this->targetActor) && ((this->targetActor->textId & 0xFF00) != 0x200)) { this->naviActor->flags |= ACTOR_FLAG_8; - func_80835EA4(globalCtx, 0xB); + func_80835EA4(play, 0xB); } } diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c index b3671e9e75..72d25ee670 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c @@ -20,16 +20,16 @@ #define rScaleStep regs[10] #define rScaleStepDecay regs[11] -u32 EffectSsBlast_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsBlast_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsBlast_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Blast_InitVars = { EFFECT_SS_BLAST, EffectSsBlast_Init, }; -u32 EffectSsBlast_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsBlastParams* initParams = (EffectSsBlastParams*)initParamsx; this->pos = initParams->pos; @@ -55,8 +55,8 @@ u32 EffectSsBlast_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mf; s32 pad; f32 radius; @@ -65,9 +65,9 @@ void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { radius = this->rScale * 0.0025f; - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA); - func_800BFCB8(globalCtx, &mf, &this->pos); + func_800BFCB8(play, &mf, &this->pos); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA); Matrix_Put(&mf); Matrix_Scale(radius, radius, radius, MTXMODE_APPLY); @@ -78,7 +78,7 @@ void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_blast.c", 204); } -void EffectSsBlast_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBlast_Update(PlayState* play, u32 index, EffectSs* this) { Math_StepToS(&this->rPrimColorA, 0, this->rAlphaTarget); this->rScale += this->rScaleStep; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c index 6410907b6b..3c0f0be5af 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c @@ -10,16 +10,16 @@ #define rScale regs[0] #define rTexIdx regs[1] -u32 EffectSsBomb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBomb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsBomb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsBomb_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsBomb_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Bomb_InitVars = { EFFECT_SS_BOMB, EffectSsBomb_Init, }; -u32 EffectSsBomb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsBomb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsBombInitParams* initParams = (EffectSsBombInitParams*)initParamsx; Math_Vec3f_Copy(&this->pos, &initParams->pos); @@ -35,14 +35,14 @@ u32 EffectSsBomb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* return 1; } -void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBomb_Draw(PlayState* play, u32 index, EffectSs* this) { static void* explosionTextures[] = { gEffBombExplosion1Tex, gEffBombExplosion2Tex, gEffBombExplosion3Tex, gEffBombExplosion4Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -60,7 +60,7 @@ void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -82,7 +82,7 @@ void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_bomb.c", 214); } -void EffectSsBomb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBomb_Update(PlayState* play, u32 index, EffectSs* this) { if ((this->life < 21) && (this->life > 16)) { this->rTexIdx = (20 - this->life); } else { diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c index 6ed20efdd1..d71fc6ab1e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c @@ -19,10 +19,10 @@ #define rScaleStep regs[9] #define rDepth regs[10] -u32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBomb2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsBomb2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsBomb2_DrawFade(PlayState* play, u32 index, EffectSs* this); +void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this); +void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Bomb2_InitVars = { EFFECT_SS_BOMB2, @@ -34,7 +34,7 @@ static EffectSsDrawFunc sDrawFuncs[] = { EffectSsBomb2_DrawLayered, }; -u32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsBomb2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsBomb2InitParams* initParams = (EffectSsBomb2InitParams*)initParamsx; @@ -59,12 +59,12 @@ u32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void } // unused in the original game. looks like EffectSsBomb but with color -void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBomb2_DrawFade(PlayState* play, u32 index, EffectSs* this) { static void* textures[] = { gEffBombExplosion1Tex, gEffBombExplosion2Tex, gEffBombExplosion3Tex, gEffBombExplosion4Tex, gEffBombExplosion5Tex, gEffBombExplosion6Tex, gEffBombExplosion7Tex, gEffBombExplosion8Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -78,7 +78,7 @@ void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this) scale = this->rScale * 0.01f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); @@ -99,12 +99,12 @@ void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx, "../z_eff_ss_bomb2.c", 345); } -void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this) { static void* textures[] = { gEffBombExplosion1Tex, gEffBombExplosion2Tex, gEffBombExplosion3Tex, gEffBombExplosion4Tex, gEffBombExplosion5Tex, gEffBombExplosion6Tex, gEffBombExplosion7Tex, gEffBombExplosion8Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -124,7 +124,7 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th scale = this->rScale * 0.01f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); @@ -150,7 +150,7 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th Matrix_Translate(0.0f, 0.0f, depth, MTXMODE_APPLY); Matrix_RotateZ((this->life * 0.02f) + 180.0f, MTXMODE_APPLY); Matrix_Scale(layer2Scale, layer2Scale, layer2Scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_ss_bomb2.c", 448), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_eff_ss_bomb2.c", 448), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion3DL); layer2Scale -= 0.15f; @@ -164,7 +164,7 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th CLOSE_DISPS(gfxCtx, "../z_eff_ss_bomb2.c", 456); } -void EffectSsBomb2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this) { s32 divisor; this->rTexIdx = (23 - this->life) / 3; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c index 47610698a2..547070b7f0 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c @@ -9,16 +9,16 @@ #define rScale regs[0] -u32 EffectSsBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsBubble_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsBubble_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Bubble_InitVars = { EFFECT_SS_BUBBLE, EffectSsBubble_Init, }; -u32 EffectSsBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsBubbleInitParams* initParams = (EffectSsBubbleInitParams*)initParamsx; //! @bug Rand_ZeroOne in the macro means a random number is generated for both parts of the macro. @@ -37,8 +37,8 @@ u32 EffectSsBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsBubble_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale = this->rScale / 100.0f; OPEN_DISPS(gfxCtx, "../z_eff_ss_bubble.c", 154); @@ -56,7 +56,7 @@ void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_bubble.c", 179); } -void EffectSsBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBubble_Update(PlayState* play, u32 index, EffectSs* this) { WaterBox* waterBox; f32 waterSurfaceY; Vec3f ripplePos; @@ -64,7 +64,7 @@ void EffectSsBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) waterSurfaceY = this->pos.y; // kill bubble if it's out of range of a water box - if (!WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->pos.x, this->pos.z, &waterSurfaceY, &waterBox)) { + if (!WaterBox_GetSurface1(play, &play->colCtx, this->pos.x, this->pos.z, &waterSurfaceY, &waterBox)) { this->life = -1; return; } @@ -73,7 +73,7 @@ void EffectSsBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) ripplePos.x = this->pos.x; ripplePos.y = waterSurfaceY; ripplePos.z = this->pos.z; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 0, 80, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 0, 80, 0); this->life = -1; } else { this->life++; diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c index 2bae49547f..aafa2e6c18 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c @@ -18,18 +18,18 @@ #define rObjBankIdx regs[10] #define rYAccelStep regs[11] // has no effect due to how it's implemented -u32 EffectSsDFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_D_Fire_InitVars = { EFFECT_SS_D_FIRE, EffectSsDFire_Init, }; -u32 EffectSsDFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsDFireInitParams* initParams = (EffectSsDFireInitParams*)initParamsx; - s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_DODONGO); + s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_DODONGO); if (objBankIndex >= 0) { this->pos = initParams->pos; @@ -43,7 +43,7 @@ u32 EffectSsDFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void this->rObjBankIdx = objBankIndex; this->draw = EffectSsDFire_Draw; this->update = EffectSsDFire_Update; - this->rTexIdx = ((s16)(globalCtx->state.frames % 4) ^ 3); + this->rTexIdx = ((s16)(play->state.frames % 4) ^ 3); this->rPrimColorR = 255; this->rPrimColorG = 255; this->rPrimColorB = 50; @@ -58,8 +58,8 @@ u32 EffectSsDFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void static void* sTextures[] = { gDodongoFire0Tex, gDodongoFire1Tex, gDodongoFire2Tex, gDodongoFire3Tex }; -void EffectSsDFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -69,17 +69,17 @@ void EffectSsDFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Mtx* mtx; f32 scale; - object = globalCtx->objectCtx.status[this->rObjBankIdx].segment; + object = play->objectCtx.status[this->rObjBankIdx].segment; OPEN_DISPS(gfxCtx, "../z_eff_ss_d_fire.c", 276); - if (Object_GetIndex(&globalCtx->objectCtx, OBJECT_DODONGO) > -1) { + if (Object_GetIndex(&play->objectCtx, OBJECT_DODONGO) > -1) { gSegments[6] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); scale = this->rScale / 100.0f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); @@ -99,7 +99,7 @@ void EffectSsDFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_d_fire.c", 330); } -void EffectSsDFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this) { this->rTexIdx++; this->rTexIdx &= 3; this->rScale += this->rScaleStep; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c index 7a31f6fa18..d9c4ab840d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c @@ -20,16 +20,16 @@ #define rPlaySound regs[10] #define rReg11 regs[11] -u32 EffectSsDeadDb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDeadDb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDeadDb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDeadDb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDeadDb_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsDeadDb_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Dead_Db_InitVars = { EFFECT_SS_DEAD_DB, EffectSsDeadDb_Init, }; -u32 EffectSsDeadDb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDeadDb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsDeadDbInitParams* initParams = (EffectSsDeadDbInitParams*)initParamsx; this->pos = initParams->pos; @@ -62,8 +62,8 @@ static void* sTextures[] = { gEffEnemyDeathFlame9Tex, gEffEnemyDeathFlame10Tex, }; -void EffectSsDeadDb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsDeadDb_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -93,7 +93,7 @@ void EffectSsDeadDb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_dead_db.c", 247); } -void EffectSsDeadDb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDeadDb_Update(PlayState* play, u32 index, EffectSs* this) { f32 w; f32 pad; @@ -131,7 +131,7 @@ void EffectSsDeadDb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) } if (this->rPlaySound && (this->rTextIdx == 1)) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->pos, &this->vec, &w); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->pos, &this->vec, &w); Audio_PlaySoundGeneral(NA_SE_EN_EXTINCT, &this->vec, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c index c484ffc98e..9754684344 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c @@ -19,16 +19,16 @@ #define rAlphaStep regs[10] #define rAlphaMode regs[11] // if mode is 0 alpha decreases over time, otherwise it increases -u32 EffectSsDeadDd_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDeadDd_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDeadDd_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDeadDd_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsDeadDd_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Dead_Dd_InitVars = { EFFECT_SS_DEAD_DD, EffectSsDeadDd_Init, }; -u32 EffectSsDeadDd_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { s32 i; EffectSsDeadDdInitParams* initParams = (EffectSsDeadDdInitParams*)initParamsx; @@ -89,8 +89,8 @@ u32 EffectSsDeadDd_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsDeadDd_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsDeadDd_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -120,7 +120,7 @@ void EffectSsDeadDd_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_dead_dd.c", 259); } -void EffectSsDeadDd_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDeadDd_Update(PlayState* play, u32 index, EffectSs* this) { this->rScale += this->rScaleStep; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c index 01c08c5013..3c1f2f5390 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c @@ -17,16 +17,16 @@ #define rAlphaStep regs[10] #define rHalfOfLife regs[11] -u32 EffectSsDeadDs_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDeadDs_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsDeadDs_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Dead_Ds_InitVars = { EFFECT_SS_DEAD_DS, EffectSsDeadDs_Init, }; -u32 EffectSsDeadDs_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsDeadDsInitParams* initParams = (EffectSsDeadDsInitParams*)initParamsx; this->pos = initParams->pos; @@ -45,7 +45,7 @@ u32 EffectSsDeadDs_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; f32 scale; s32 pad1; @@ -55,10 +55,10 @@ void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Vec3f pos; CollisionPoly* floorPoly; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead_ds.c", 157); + OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead_ds.c", 157); scale = this->rScale * 0.01f; - func_80094BC4(globalCtx->state.gfxCtx); + func_80094BC4(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, this->rAlpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); pos = this->pos; @@ -71,12 +71,12 @@ void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { sp44.y = pos.y - this->velocity.y; sp44.z = pos.z - this->velocity.z; - if (BgCheck_EntitySphVsWall1(&globalCtx->colCtx, &this->pos, &pos, &sp44, 1.5f, &floorPoly, 1.0f)) { + if (BgCheck_EntitySphVsWall1(&play->colCtx, &this->pos, &pos, &sp44, 1.5f, &floorPoly, 1.0f)) { func_80038A28(floorPoly, this->pos.x, this->pos.y, this->pos.z, &mf); Matrix_Put(&mf); } else { pos.y++; - temp = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &floorPoly, &pos); + temp = BgCheck_EntityRaycastFloor1(&play->colCtx, &floorPoly, &pos); if (floorPoly != NULL) { func_80038A28(floorPoly, this->pos.x, temp + 1.5f, this->pos.z, &mf); @@ -99,16 +99,16 @@ void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_RotateZYX(this->rRoll, this->rPitch, this->rYaw, MTXMODE_APPLY); Matrix_RotateX(1.57f, MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_ss_dead_ds.c", 246), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_eff_ss_dead_ds.c", 246), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); gSPDisplayList(POLY_XLU_DISP++, gLensFlareCircleDL); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead_ds.c", 255); + CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead_ds.c", 255); } -void EffectSsDeadDs_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDeadDs_Update(PlayState* play, u32 index, EffectSs* this) { if (this->life < this->rHalfOfLife) { this->rScale += this->rScaleStep; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c index fe5e74fe62..9dca9b51b0 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c @@ -9,15 +9,15 @@ #define rSfxId regs[10] #define rRepeatMode regs[11] // sound is replayed every update. unused in the original game -u32 EffectSsDeadSound_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDeadSound_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDeadSound_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDeadSound_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Dead_Sound_InitVars = { EFFECT_SS_DEAD_SOUND, EffectSsDeadSound_Init, }; -u32 EffectSsDeadSound_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDeadSound_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsDeadSoundInitParams* initParams = (EffectSsDeadSoundInitParams*)initParamsx; this->pos = initParams->pos; @@ -34,7 +34,7 @@ u32 EffectSsDeadSound_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, return 1; } -void EffectSsDeadSound_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDeadSound_Update(PlayState* play, u32 index, EffectSs* this) { switch (this->rRepeatMode) { case DEADSOUND_REPEAT_MODE_OFF: this->rRepeatMode--; // decrement to 0 so sound only plays once diff --git a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c index 677b1d782e..6db3b2803f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c @@ -19,9 +19,9 @@ #define rScale regs[9] #define rLifespan regs[10] -u32 EffectSsDtBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDtBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDtBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDtBubble_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsDtBubble_Update(PlayState* play, u32 index, EffectSs* this); static Color_RGBA8 sPrimColors[] = { { 255, 255, 100, 255 }, { 150, 255, 255, 255 }, { 100, 255, 255, 255 } }; static Color_RGBA8 sEnvColors[] = { { 170, 0, 0, 255 }, { 0, 100, 0, 255 }, { 0, 0, 255, 255 } }; @@ -31,7 +31,7 @@ EffectSsInit Effect_Ss_Dt_Bubble_InitVars = { EffectSsDtBubble_Init, }; -u32 EffectSsDtBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsDtBubbleInitParams* initParams = (EffectSsDtBubbleInitParams*)initParamsx; //! @bug Rand_ZeroOne in the macro means a random number is generated for both parts of the macro. @@ -72,8 +72,8 @@ u32 EffectSsDtBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v return 1; } -void EffectSsDtBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsDtBubble_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale; OPEN_DISPS(gfxCtx, "../z_eff_ss_dt_bubble.c", 201); @@ -94,7 +94,7 @@ void EffectSsDtBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx, "../z_eff_ss_dt_bubble.c", 236); } -void EffectSsDtBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDtBubble_Update(PlayState* play, u32 index, EffectSs* this) { f32 rand; if (this->rRandXZ == 1) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c index e205df31ae..724b9dd448 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c @@ -21,10 +21,10 @@ #define rDrawFlags regs[11] #define rLifespan regs[12] -u32 EffectSsDust_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDust_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBlast_UpdateFire(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDust_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsBlast_UpdateFire(PlayState* play, u32 index, EffectSs* this); +void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Dust_InitVars = { EFFECT_SS_DUST, @@ -36,7 +36,7 @@ static EffectSsUpdateFunc sUpdateFuncs[] = { EffectSsBlast_UpdateFire, }; -u32 EffectSsDust_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { s32 randColorOffset; EffectSsDustInitParams* initParams = (EffectSsDustInitParams*)initParamsx; @@ -76,11 +76,11 @@ u32 EffectSsDust_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* return 1; } -void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this) { static void* dustTextures[] = { gDust1Tex, gDust2Tex, gDust3Tex, gDust4Tex, gDust5Tex, gDust6Tex, gDust7Tex, gDust8Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -94,7 +94,7 @@ void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { scale = this->rScale * 0.0025f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -128,7 +128,7 @@ void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_dust.c", 389); } -void EffectSsDust_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsDust_Update(PlayState* play, u32 index, EffectSs* this) { this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f; this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f; @@ -146,7 +146,7 @@ void EffectSsDust_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { } // this update mode is unused in the original game -void EffectSsBlast_UpdateFire(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsBlast_UpdateFire(PlayState* play, u32 index, EffectSs* this) { this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f; this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c index 380e8522e3..df1aee1582 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c @@ -18,16 +18,16 @@ #define rFlags regs[8] #define rScroll regs[9] -u32 EffectSsEnFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsEnFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsEnFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_En_Fire_InitVars = { EFFECT_SS_EN_FIRE, EffectSsEnFire_Init, }; -u32 EffectSsEnFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsEnFireInitParams* initParams = (EffectSsEnFireInitParams*)initParamsx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -63,8 +63,8 @@ u32 EffectSsEnFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsEnFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale; s16 camYaw; s32 pad[3]; @@ -73,12 +73,12 @@ void EffectSsEnFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx, "../z_eff_en_fire.c", 169); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); - camYaw = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000); + camYaw = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000); Matrix_RotateY(BINANG_TO_RAD(camYaw), MTXMODE_APPLY); scale = Math_SinS(this->life * 0x333) * (this->rScale * 0.00005f); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_en_fire.c", 180), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_eff_en_fire.c", 180), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); redGreen = this->life - 5; @@ -87,12 +87,12 @@ void EffectSsEnFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { redGreen = 0; } - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, redGreen * 12.7f, 0, 0, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0x0, 0x80, redGreen * 12.7f, redGreen * 12.7f, 0, 255); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->rScroll * -0x14) & 0x1FF, - 0x20, 0x80)); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->rScroll * -0x14) & 0x1FF, 0x20, 0x80)); if (((this->rFlags & 0x7FFF) != 0) || (this->life < 18)) { gSPDisplayList(POLY_XLU_DISP++, gEffFire2DL); @@ -113,7 +113,7 @@ typedef struct { /* 0x14C */ Vec3s firePos[10]; } FireActorS; -void EffectSsEnFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this) { this->rScroll++; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index 13d8e44dc9..5d0393b492 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c @@ -21,17 +21,17 @@ #define rAlphaMode regs[11] #define rScale regs[12] -u32 EffectSsEnIce_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsEnIce_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsEnIce_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsEnIce_UpdateFlying(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_En_Ice_InitVars = { EFFECT_SS_EN_ICE, EffectSsEnIce_Init, }; -u32 EffectSsEnIce_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsEnIceInitParams* initParams = (EffectSsEnIceInitParams*)initParamsx; if (initParams->type == 0) { @@ -85,8 +85,8 @@ u32 EffectSsEnIce_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsEnIce_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; Vec3f hiliteLightDir; @@ -94,7 +94,7 @@ void EffectSsEnIce_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { f32 alpha; scale = this->rScale * 0.01f; - gameplayFrames = globalCtx->gameplayFrames; + gameplayFrames = play->gameplayFrames; OPEN_DISPS(gfxCtx, "../z_eff_en_ice.c", 235); @@ -120,10 +120,10 @@ void EffectSsEnIce_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { hiliteLightDir.y = 0.0f; hiliteLightDir.z = 89.8f; - func_80093D84(globalCtx->state.gfxCtx); - func_8002EB44(&this->pos, &globalCtx->view.eye, &hiliteLightDir, globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); + func_8002EB44(&this->pos, &play->view.eye, &hiliteLightDir, play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 0x20, 0x10, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 0x20, 0x10, 1, 0, (gameplayFrames * 2) & 0xFF, 0x40, 0x20)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA); @@ -133,7 +133,7 @@ void EffectSsEnIce_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_en_ice.c", 294); } -void EffectSsEnIce_UpdateFlying(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) { s16 rand; if ((this->actor != NULL) && (this->actor->update != NULL)) { @@ -160,6 +160,6 @@ void EffectSsEnIce_UpdateFlying(GlobalContext* globalCtx, u32 index, EffectSs* t } } -void EffectSsEnIce_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this) { this->rPitch += this->rRotSpeed; // rRotSpeed is not initialized so this does nothing } diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index fe68b956cd..3954704ec2 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -12,9 +12,9 @@ #define rScoreIdx regs[2] #define rScale regs[3] -u32 EffectSsExtra_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsExtra_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsExtra_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsExtra_Update(PlayState* play, u32 index, EffectSs* this); static s16 sScores[] = { 30, 60, 100 }; @@ -23,17 +23,17 @@ EffectSsInit Effect_Ss_Extra_InitVars = { EffectSsExtra_Init, }; -u32 EffectSsExtra_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsExtraInitParams* initParams = (EffectSsExtraInitParams*)initParamsx; s32 pad; s32 objBankIndex; u32 oldSeg6; - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_YABUSAME_POINT); + objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_YABUSAME_POINT); - if ((objBankIndex >= 0) && Object_IsLoaded(&globalCtx->objectCtx, objBankIndex)) { + if ((objBankIndex >= 0) && Object_IsLoaded(&play->objectCtx, objBankIndex)) { oldSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); this->pos = initParams->pos; this->velocity = initParams->velocity; this->accel = initParams->accel; @@ -58,28 +58,28 @@ static void* sTextures[] = { object_yabusame_point_Tex_000900, }; -void EffectSsExtra_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; f32 scale = this->rScale / 100.0f; - void* object = globalCtx->objectCtx.status[this->rObjBankIdx].segment; + void* object = play->objectCtx.status[this->rObjBankIdx].segment; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_extra.c", 168); + OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_extra.c", 168); gSegments[6] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_ss_extra.c", 186), + func_80093D84(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_eff_ss_extra.c", 186), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[this->rScoreIdx])); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_yabusame_point_DL_000DC0)); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_extra.c", 194); + CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_extra.c", 194); } -void EffectSsExtra_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsExtra_Update(PlayState* play, u32 index, EffectSs* this) { if (this->rTimer != 0) { this->rTimer -= 1; } else { @@ -87,6 +87,6 @@ void EffectSsExtra_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { } if (this->rTimer == 1) { - globalCtx->interfaceCtx.unk_23C = sScores[this->rScoreIdx]; + play->interfaceCtx.unk_23C = sScores[this->rScoreIdx]; } } diff --git a/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c b/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c index d57bc2bfde..6144adc755 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c @@ -13,16 +13,16 @@ #define rYaw regs[10] #define rScale regs[11] -u32 EffectSsFcircle_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsFcircle_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFcircle_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsFcircle_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsFcircle_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsFcircle_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Fcircle_InitVars = { EFFECT_SS_FCIRCLE, EffectSsFcircle_Init, }; -u32 EffectSsFcircle_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsFcircle_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsFcircleInitParams* initParams = (EffectSsFcircleInitParams*)initParamsx; this->pos = initParams->pos; @@ -42,8 +42,8 @@ u32 EffectSsFcircle_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo return 1; } -void EffectSsFcircle_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsFcircle_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 yScale; f32 xzScale; @@ -60,10 +60,10 @@ void EffectSsFcircle_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_RotateY(BINANG_TO_RAD(this->rYaw), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_fcircle.c", 163), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 128, 0, 32, 64, 1, 0, - ((globalCtx->gameplayFrames) * -0xF) % 256, 32, 64)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, 0, 32, 64, 1, 0, + ((play->gameplayFrames) * -0xF) % 256, 32, 64)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 220, 0, (this->life * 12.75f)); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPDisplayList(POLY_XLU_DISP++, this->gfx); @@ -71,7 +71,7 @@ void EffectSsFcircle_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_fcircle.c", 186); } -void EffectSsFcircle_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsFcircle_Update(PlayState* play, u32 index, EffectSs* this) { Actor* actor = this->actor; if (actor != NULL) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index a0c9593613..bb0ee385d6 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -14,11 +14,11 @@ #define rParam regs[4] #define rScale regs[8] -u32 EffectSsFhgFlash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsFhgFlash_DrawLightBall(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFhgFlash_UpdateLightBall(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFhgFlash_DrawShock(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFhgFlash_UpdateShock(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsFhgFlash_DrawLightBall(PlayState* play, u32 index, EffectSs* this); +void EffectSsFhgFlash_UpdateLightBall(PlayState* play, u32 index, EffectSs* this); +void EffectSsFhgFlash_DrawShock(PlayState* play, u32 index, EffectSs* this); +void EffectSsFhgFlash_UpdateShock(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Fhg_Flash_InitVars = { EFFECT_SS_FHG_FLASH, @@ -28,7 +28,7 @@ EffectSsInit Effect_Ss_Fhg_Flash_InitVars = { static UNK_TYPE D_809A5178[258]; static Gfx D_809A5100[15]; -u32 EffectSsFhgFlash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsFhgFlashInitParams* initParams = (EffectSsFhgFlashInitParams*)initParamsx; s32 pad; s32 objBankIdx; @@ -37,11 +37,11 @@ u32 EffectSsFhgFlash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v void* oldSeg6; if (initParams->type == FHGFLASH_LIGHTBALL) { - objBankIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_FHG); + objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FHG); - if ((objBankIdx > -1) && Object_IsLoaded(&globalCtx->objectCtx, objBankIdx)) { + if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { oldSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIdx].segment); this->rObjBankIdx = objBankIdx; this->pos = initParams->pos; this->velocity = initParams->velocity; @@ -84,14 +84,14 @@ static Color_RGB8 sColors[] = { { 255, 0, 255 }, { 255, 150, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, }; -void EffectSsFhgFlash_DrawLightBall(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsFhgFlash_DrawLightBall(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; void* object; scale = this->rScale / 100.0f; - object = globalCtx->objectCtx.status[this->rObjBankIdx].segment; + object = play->objectCtx.status[this->rObjBankIdx].segment; OPEN_DISPS(gfxCtx, "../z_eff_fhg_flash.c", 268); @@ -99,11 +99,11 @@ void EffectSsFhgFlash_DrawLightBall(GlobalContext* globalCtx, u32 index, EffectS Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSegments[6] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->rAlpha); gDPSetEnvColor(POLY_XLU_DISP++, sColors[this->rParam].r, sColors[this->rParam].g, sColors[this->rParam].b, 0); gDPPipeSync(POLY_XLU_DISP++); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ((this->rXZRot / 32768.0f) * 3.1416f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_fhg_flash.c", 326), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -112,8 +112,8 @@ void EffectSsFhgFlash_DrawLightBall(GlobalContext* globalCtx, u32 index, EffectS CLOSE_DISPS(gfxCtx, "../z_eff_fhg_flash.c", 330); } -void EffectSsFhgFlash_DrawShock(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsFhgFlash_DrawShock(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; @@ -125,12 +125,12 @@ void EffectSsFhgFlash_DrawShock(GlobalContext* globalCtx, u32 index, EffectSs* t Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); if (this->rParam != FHGFLASH_SHOCK_NO_ACTOR) { - func_80094044(globalCtx->state.gfxCtx); + func_80094044(play->state.gfxCtx); Matrix_RotateX((this->rXZRot / 32768.0f) * 1.1416f, MTXMODE_APPLY); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_DECAL2); } else { - func_80093D84(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + func_80093D84(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2); } @@ -145,7 +145,7 @@ void EffectSsFhgFlash_DrawShock(GlobalContext* globalCtx, u32 index, EffectSs* t CLOSE_DISPS(gfxCtx, "../z_eff_fhg_flash.c", 399); } -void EffectSsFhgFlash_UpdateLightBall(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsFhgFlash_UpdateLightBall(PlayState* play, u32 index, EffectSs* this) { s16 rand = (Rand_ZeroOne() * 20000.0f); this->rXZRot = (this->rXZRot + rand) + 0x4000; @@ -168,7 +168,7 @@ void EffectSsFhgFlash_UpdateLightBall(GlobalContext* globalCtx, u32 index, Effec } } -void EffectSsFhgFlash_UpdateShock(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsFhgFlash_UpdateShock(PlayState* play, u32 index, EffectSs* this) { s16 randBodyPart; Player* player; BossGanondrof* phantomGanon; @@ -178,7 +178,7 @@ void EffectSsFhgFlash_UpdateShock(GlobalContext* globalCtx, u32 index, EffectSs* this->rXZRot = (this->rXZRot + rand) + 0x4000; if (this->rParam == FHGFLASH_SHOCK_PLAYER) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); randBodyPart = Rand_ZeroFloat(PLAYER_BODYPART_MAX - 0.1f); this->pos.x = player->bodyPartsPos[randBodyPart].x + Rand_CenteredFloat(10.0f); this->pos.y = player->bodyPartsPos[randBodyPart].y + Rand_CenteredFloat(15.0f); diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c index a160f3be1d..adba706315 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c @@ -21,16 +21,16 @@ #define rBodyPart regs[11] #define rType regs[12] -u32 EffectSsFireTail_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFireTail_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsFireTail_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Fire_Tail_InitVars = { EFFECT_SS_FIRE_TAIL, EffectSsFireTail_Init, }; -u32 EffectSsFireTail_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsFireTailInitParams* initParams = (EffectSsFireTailInitParams*)initParamsx; this->pos = initParams->pos; @@ -65,8 +65,8 @@ u32 EffectSsFireTail_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v return 1; } -void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; s16 yaw; Vec3f scale; @@ -86,14 +86,14 @@ void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_Translate(this->pos.x + this->actor->world.pos.x, this->pos.y + this->actor->world.pos.y, this->pos.z + this->actor->world.pos.z, MTXMODE_NEW); } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 bodyPart = this->rBodyPart; this->pos.x = - player->bodyPartsPos[bodyPart].x - (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * 5.0f); + player->bodyPartsPos[bodyPart].x - (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * 5.0f); this->pos.y = player->bodyPartsPos[bodyPart].y; this->pos.z = - player->bodyPartsPos[bodyPart].z - (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * 5.0f); + player->bodyPartsPos[bodyPart].z - (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * 5.0f); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); } @@ -101,11 +101,11 @@ void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); } - yaw = Math_Vec3f_Yaw(&scale, &this->vec) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); + yaw = Math_Vec3f_Yaw(&scale, &this->vec) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); temp1 = fabsf(Math_CosS(yaw)); temp2 = Math_SinS(yaw); dist = Math_Vec3f_DistXZ(&scale, &this->vec) / (this->rReg10 * 0.1f); - Matrix_RotateY(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000)), MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000)), MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(temp2 * this->rReg2 * dist), MTXMODE_APPLY); temp2 = 1.0f - ((f32)(this->life + 1) / this->rLifespan); temp2 = 1.0f - SQ(temp2); @@ -119,14 +119,14 @@ void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_Scale(1.0f, temp1, 1.0f / temp1, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_fire_tail.c", 238), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_eff_fire_tail.c", 238), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, 255); gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - (globalCtx->state.frames * -0x14) & 0x1FF, 32, 128)); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (play->state.frames * -0x14) & 0x1FF, 32, 128)); if (this->rType != 0) { gSPDisplayList(POLY_XLU_DISP++, gEffFire2DL); @@ -137,6 +137,6 @@ void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx, "../z_eff_fire_tail.c", 273); } -void EffectSsFireTail_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsFireTail_Update(PlayState* play, u32 index, EffectSs* this) { this->rScale *= 0.9f; } diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c index e910da2b10..f094b5405d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c @@ -7,16 +7,16 @@ #include "z_eff_ss_g_fire.h" #include "objects/gameplay_keep/gameplay_keep.h" -u32 EffectSsGFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGFire_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsGFire_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_G_Fire_InitVars = { EFFECT_SS_G_FIRE, EffectSsGFire_Init, }; -u32 EffectSsGFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsGFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsGFireInitParams* initParams = (EffectSsGFireInitParams*)initParamsx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -42,16 +42,16 @@ u32 EffectSsGFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsGFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGFire_Draw(PlayState* play, u32 index, EffectSs* this) { void* fireFootprintTextures[] = { gEffFireFootprint1Tex, gEffFireFootprint2Tex, gEffFireFootprint3Tex, gEffFireFootprint4Tex, gEffFireFootprint5Tex, gEffFireFootprint6Tex, gEffFireFootprint7Tex, gEffFireFootprint8Tex, }; s16 texIdx = (this->rgTexIdx / 100) % 7; - EffectSs_DrawGEffect(globalCtx, this, fireFootprintTextures[texIdx]); + EffectSs_DrawGEffect(play, this, fireFootprintTextures[texIdx]); } -void EffectSsGFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGFire_Update(PlayState* play, u32 index, EffectSs* this) { this->rgTexIdx += this->rgTexIdxStep; } diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c b/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c index 6392fd3fc9..f7459fc247 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c @@ -7,16 +7,16 @@ #include "z_eff_ss_g_magma.h" #include "objects/gameplay_keep/gameplay_keep.h" -u32 EffectSsGMagma_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGMagma_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGMagma_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGMagma_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGMagma_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsGMagma_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_G_Magma_InitVars = { EFFECT_SS_G_MAGMA, EffectSsGMagma_Init, }; -u32 EffectSsGMagma_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsGMagma_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsGMagmaInitParams* initParams = (EffectSsGMagmaInitParams*)initParamsx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -46,16 +46,16 @@ static void* sTextures[] = { gEffMagmaBubble5Tex, gEffMagmaBubble6Tex, gEffMagmaBubble7Tex, gEffMagmaBubble8Tex, }; -void EffectSsGMagma_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGMagma_Draw(PlayState* play, u32 index, EffectSs* this) { s16 texIdx = this->rgTexIdx / 100; if (texIdx > 7) { texIdx = 7; } - EffectSs_DrawGEffect(globalCtx, this, sTextures[texIdx]); + EffectSs_DrawGEffect(play, this, sTextures[texIdx]); } -void EffectSsGMagma_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGMagma_Update(PlayState* play, u32 index, EffectSs* this) { this->rgTexIdx += this->rgTexIdxStep; } diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c index 6d0071a242..9bd5f2dd54 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c @@ -20,9 +20,9 @@ #define rObjBankIdx regs[10] #define rScale regs[11] -u32 EffectSsGMagma2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGMagma2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGMagma2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGMagma2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGMagma2_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsGMagma2_Update(PlayState* play, u32 index, EffectSs* this); static void* sTextures[] = { object_kingdodongo_Tex_02E4E0, object_kingdodongo_Tex_02E8E0, object_kingdodongo_Tex_02ECE0, @@ -37,15 +37,15 @@ EffectSsInit Effect_Ss_G_Magma2_InitVars = { EffectSsGMagma2_Init, }; -u32 EffectSsGMagma2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { - s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_KINGDODONGO); +u32 EffectSsGMagma2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_KINGDODONGO); s32 pad; - if ((objBankIndex >= 0) && Object_IsLoaded(&globalCtx->objectCtx, objBankIndex)) { + if ((objBankIndex >= 0) && Object_IsLoaded(&play->objectCtx, objBankIndex)) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EffectSsGMagma2InitParams* initParams = (EffectSsGMagma2InitParams*)initParamsx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment); this->rObjBankIdx = objBankIndex; this->pos = initParams->pos; this->velocity = zeroVec; @@ -71,14 +71,14 @@ u32 EffectSsGMagma2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo return 0; } -void EffectSsGMagma2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsGMagma2_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; void* object; scale = this->rScale / 100.0f; - object = globalCtx->objectCtx.status[this->rObjBankIdx].segment; + object = play->objectCtx.status[this->rObjBankIdx].segment; OPEN_DISPS(gfxCtx, "../z_eff_ss_g_magma2.c", 261); @@ -103,7 +103,7 @@ void EffectSsGMagma2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_g_magma2.c", 311); } -void EffectSsGMagma2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGMagma2_Update(PlayState* play, u32 index, EffectSs* this) { this->rTimer += this->rUpdateRate; if (this->rTimer >= 10) { diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c index cb9bba2c3c..bda34732ef 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c @@ -20,16 +20,16 @@ #define rEnvColorA regs[10] #define rLifespan regs[11] -u32 EffectSsGRipple_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGRipple_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGRipple_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGRipple_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsGRipple_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_G_Ripple_InitVars = { EFFECT_SS_G_RIPPLE, EffectSsGRipple_Init, }; -u32 EffectSsGRipple_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { s32 pad; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; WaterBox* waterBox; @@ -54,13 +54,13 @@ u32 EffectSsGRipple_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo this->rEnvColorG = 255; this->rEnvColorB = 255; this->rEnvColorA = 255; - this->rWaterBoxNum = WaterBox_GetSurface2(globalCtx, &globalCtx->colCtx, &initParams->pos, 3.0f, &waterBox); + this->rWaterBoxNum = WaterBox_GetSurface2(play, &play->colCtx, &initParams->pos, 3.0f, &waterBox); return 1; } -void EffectSsGRipple_DrawRipple(GlobalContext* globalCtx, EffectSs* this, void* segment) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsGRipple_DrawRipple(PlayState* play, EffectSs* this, void* segment) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 radius; s32 pad; MtxF mfTrans; @@ -71,12 +71,12 @@ void EffectSsGRipple_DrawRipple(GlobalContext* globalCtx, EffectSs* this, void* OPEN_DISPS(gfxCtx, "../z_eff_ss_g_ripple.c", 199); - if (globalCtx) {} + if (play) {} radius = this->rRadius * 0.0025f; - if ((this->rWaterBoxNum != -1) && (this->rWaterBoxNum < globalCtx->colCtx.colHeader->numWaterBoxes)) { - yPos = (this->rWaterBoxNum + globalCtx->colCtx.colHeader->waterBoxes)->ySurface; + if ((this->rWaterBoxNum != -1) && (this->rWaterBoxNum < play->colCtx.colHeader->numWaterBoxes)) { + yPos = (this->rWaterBoxNum + play->colCtx.colHeader->waterBoxes)->ySurface; } else { yPos = this->pos.y; } @@ -101,13 +101,13 @@ void EffectSsGRipple_DrawRipple(GlobalContext* globalCtx, EffectSs* this, void* CLOSE_DISPS(gfxCtx, "../z_eff_ss_g_ripple.c", 247); } -void EffectSsGRipple_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGRipple_Draw(PlayState* play, u32 index, EffectSs* this) { if (this->rLifespan == 0) { - EffectSsGRipple_DrawRipple(globalCtx, this, gEffWaterRippleTex); + EffectSsGRipple_DrawRipple(play, this, gEffWaterRippleTex); } } -void EffectSsGRipple_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGRipple_Update(PlayState* play, u32 index, EffectSs* this) { f32 radius; f32 primAlpha; f32 envAlpha; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c index f3a362ef9d..301ff54cd9 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c @@ -19,17 +19,17 @@ #define rScale regs[9] #define rScaleStep regs[10] -u32 EffectSsGSpk_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGSpk_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGSpk_UpdateNoAccel(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGSpk_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGSpk_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsGSpk_UpdateNoAccel(PlayState* play, u32 index, EffectSs* this); +void EffectSsGSpk_Draw(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_G_Spk_InitVars = { EFFECT_SS_G_SPK, EffectSsGSpk_Init, }; -u32 EffectSsGSpk_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsGSpk_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsGSpkInitParams* initParams = (EffectSsGSpkInitParams*)initParamsx; Math_Vec3f_Copy(&this->pos, &initParams->pos); @@ -65,14 +65,14 @@ u32 EffectSsGSpk_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* return 1; } -void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGSpk_Draw(PlayState* play, u32 index, EffectSs* this) { static void* sparkTextures[] = { gEffSpark1Tex, gEffSpark2Tex, gEffSpark3Tex, gEffSpark4Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -86,7 +86,7 @@ void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { scale = this->rScale * 0.0025f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); @@ -106,7 +106,7 @@ void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_g_spk.c", 255); } -void EffectSsGSpk_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGSpk_Update(PlayState* play, u32 index, EffectSs* this) { this->accel.x = (Rand_ZeroOne() - 0.5f) * 3.0f; this->accel.z = (Rand_ZeroOne() - 0.5f) * 3.0f; @@ -129,7 +129,7 @@ void EffectSsGSpk_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { // this update mode is unused in the original game // with this update mode, the sparks dont move randomly in the xz plane, appearing to be on top of each other -void EffectSsGSpk_UpdateNoAccel(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGSpk_UpdateNoAccel(PlayState* play, u32 index, EffectSs* this) { if (this->actor != NULL) { if ((this->actor->category == ACTORCAT_EXPLOSIVE) && (this->actor->update != NULL)) { this->pos.x += (Math_SinS(this->actor->world.rot.y) * this->actor->speedXZ); diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c index 3a143db79a..1b3bb43061 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c @@ -11,16 +11,16 @@ // this ends up having no effect because the texture provided does not use segment 6 #define rType regs[11] -u32 EffectSsGSplash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGSplash_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsGSplash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGSplash_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsGSplash_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_G_Splash_InitVars = { EFFECT_SS_G_SPLASH, EffectSsGSplash_Init, }; -u32 EffectSsGSplash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsGSplash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsGSplashInitParams* initParams = (EffectSsGSplashInitParams*)initParamsx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -89,7 +89,7 @@ u32 EffectSsGSplash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo return 1; } -void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGSplash_Draw(PlayState* play, u32 index, EffectSs* this) { static void* waterSplashTextures[] = { gEffWaterSplash1Tex, gEffWaterSplash2Tex, gEffWaterSplash3Tex, gEffWaterSplash4Tex, gEffWaterSplash5Tex, gEffWaterSplash6Tex, gEffWaterSplash7Tex, gEffWaterSplash8Tex, @@ -102,7 +102,7 @@ void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if (texIdx > 7) { texIdx = 7; } - EffectSs_DrawGEffect(globalCtx, this, waterSplashTextures[texIdx]); + EffectSs_DrawGEffect(play, this, waterSplashTextures[texIdx]); break; case 1: @@ -110,7 +110,7 @@ void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if (texIdx > 7) { texIdx = 7; } - EffectSs_DrawGEffect(globalCtx, this, waterSplashTextures[texIdx]); + EffectSs_DrawGEffect(play, this, waterSplashTextures[texIdx]); break; case 2: @@ -118,7 +118,7 @@ void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if (texIdx > 7) { texIdx = 7; } - EffectSs_DrawGEffect(globalCtx, this, waterSplashTextures[texIdx]); + EffectSs_DrawGEffect(play, this, waterSplashTextures[texIdx]); break; default: @@ -126,13 +126,13 @@ void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { } } -void EffectSsGSplash_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsGSplash_Update(PlayState* play, u32 index, EffectSs* this) { Vec3f newSplashPos; if ((this->rType == 1) && (this->life == 5)) { newSplashPos = this->pos; newSplashPos.y += ((this->rgScale * 20) * 0.002f); - EffectSsGSplash_Spawn(globalCtx, &newSplashPos, 0, 0, 2, this->rgScale / 2); + EffectSsGSplash_Spawn(play, &newSplashPos, 0, 0, 2, this->rgScale / 2); } this->rgTexIdx += this->rgTexIdxStep; diff --git a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c index 643b3749b8..7d4cd5711e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c +++ b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c @@ -15,25 +15,25 @@ #define rObjBankIdx regs[5] #define rMinLife regs[6] -u32 EffectSsHahen_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsHahen_DrawGray(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsHahen_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsHahen_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsHahen_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsHahen_DrawGray(PlayState* play, u32 index, EffectSs* this); +void EffectSsHahen_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsHahen_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Hahen_InitVars = { EFFECT_SS_HAHEN, EffectSsHahen_Init, }; -void EffectSsHahen_CheckForObject(EffectSs* this, GlobalContext* globalCtx) { - if (((this->rObjBankIdx = Object_GetIndex(&globalCtx->objectCtx, this->rObjId)) < 0) || - !Object_IsLoaded(&globalCtx->objectCtx, this->rObjBankIdx)) { +void EffectSsHahen_CheckForObject(EffectSs* this, PlayState* play) { + if (((this->rObjBankIdx = Object_GetIndex(&play->objectCtx, this->rObjId)) < 0) || + !Object_IsLoaded(&play->objectCtx, this->rObjBankIdx)) { this->life = -1; this->draw = NULL; } } -u32 EffectSsHahen_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsHahen_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsHahenInitParams* initParams = (EffectSsHahenInitParams*)initParamsx; this->pos = initParams->pos; @@ -44,7 +44,7 @@ u32 EffectSsHahen_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void if (initParams->dList != NULL) { this->gfx = initParams->dList; this->rObjId = initParams->objId; - EffectSsHahen_CheckForObject(this, globalCtx); + EffectSsHahen_CheckForObject(this, play); } else { this->gfx = SEGMENTED_TO_VIRTUAL(gEffFragments1DL); this->rObjId = -1; @@ -66,15 +66,15 @@ u32 EffectSsHahen_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsHahen_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsHahen_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale = this->rScale * 0.001f; OPEN_DISPS(gfxCtx, "../z_eff_hahen.c", 208); if (this->rObjId != -1) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); } Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); @@ -83,22 +83,22 @@ void EffectSsHahen_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_hahen.c", 228), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, this->gfx); CLOSE_DISPS(gfxCtx, "../z_eff_hahen.c", 236); } // in the original game this function is hardcoded to be used only by the skull pots in Shadow Temple -void EffectSsHahen_DrawGray(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsHahen_DrawGray(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale = this->rScale * 0.001f; OPEN_DISPS(gfxCtx, "../z_eff_hahen.c", 253); if (this->rObjId != -1) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); } Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); @@ -107,7 +107,7 @@ void EffectSsHahen_DrawGray(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_hahen.c", 271), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); gDPSetCombineLERP(POLY_OPA_DISP++, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0); gDPSetPrimColor(POLY_OPA_DISP++, 0x0, 0x01, 100, 100, 120, 255); @@ -116,8 +116,8 @@ void EffectSsHahen_DrawGray(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx, "../z_eff_hahen.c", 288); } -void EffectSsHahen_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { - Player* player = GET_PLAYER(globalCtx); +void EffectSsHahen_Update(PlayState* play, u32 index, EffectSs* this) { + Player* player = GET_PLAYER(play); this->rPitch += 55; this->rYaw += 10; @@ -127,6 +127,6 @@ void EffectSsHahen_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { } if (this->rObjId != -1) { - EffectSsHahen_CheckForObject(this, globalCtx); + EffectSsHahen_CheckForObject(this, play); } } diff --git a/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c b/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c index 7a626e406f..54360e44d8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c +++ b/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c @@ -17,9 +17,9 @@ #define rEnvColorB regs[7] #define rScale regs[8] -u32 EffectSsHitMark_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsHitMark_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsHitMark_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsHitMark_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsHitMark_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsHitMark_Update(PlayState* play, u32 index, EffectSs* this); static Color_RGB8 sColors[] = { { 255, 255, 255 }, { 255, 255, 0 }, { 255, 255, 255 }, { 255, 0, 0 }, { 255, 200, 100 }, { 200, 150, 0 }, @@ -41,7 +41,7 @@ EffectSsInit Effect_Ss_HitMark_InitVars = { EffectSsHitMark_Init, }; -u32 EffectSsHitMark_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsHitMark_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { s32 colorIdx; EffectSsHitMarkInitParams* initParams = (EffectSsHitMarkInitParams*)initParamsx; this->pos = initParams->pos; @@ -69,8 +69,8 @@ u32 EffectSsHitMark_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo return 1; } -void EffectSsHitMark_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsHitMark_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -84,7 +84,7 @@ void EffectSsHitMark_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); scale = this->rScale / 100.0f; SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -101,7 +101,7 @@ void EffectSsHitMark_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_hitmark.c", 341); } -void EffectSsHitMark_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsHitMark_Update(PlayState* play, u32 index, EffectSs* this) { s32 colorIdx; if (this->rType == EFFECT_HITMARK_DUST) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c index 9b8eea3fb8..4ec66c7cb5 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c @@ -13,16 +13,16 @@ #define rRotSpeed regs[3] #define rScale regs[4] -u32 EffectSsIcePiece_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsIcePiece_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsIcePiece_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsIcePiece_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsIcePiece_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Ice_Piece_InitVars = { EFFECT_SS_ICE_PIECE, EffectSsIcePiece_Init, }; -u32 EffectSsIcePiece_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsIcePiece_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsIcePieceInitParams* initParams = (EffectSsIcePieceInitParams*)initParamsx; this->pos = initParams->pos; @@ -42,15 +42,15 @@ u32 EffectSsIcePiece_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v return 1; } -void EffectSsIcePiece_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; u32 frames; f32 alpha; scale = this->rScale * 0.01f; - frames = globalCtx->state.frames; + frames = play->state.frames; OPEN_DISPS(gfxCtx, "../z_eff_ice_piece.c", 161); @@ -67,18 +67,18 @@ void EffectSsIcePiece_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_RotateX(BINANG_TO_RAD(this->rPitch), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_ice_piece.c", 185), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, (s32)alpha & 0xFF); - func_8003435C(&this->pos, globalCtx); + func_8003435C(&this->pos, play); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (1 * frames) % 256, 0x20, 0x10, 1, 0, (2 * frames) % 256, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (1 * frames) % 256, 0x20, 0x10, 1, 0, (2 * frames) % 256, 0x40, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment1DL); CLOSE_DISPS(gfxCtx, "../z_eff_ice_piece.c", 209); } -void EffectSsIcePiece_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsIcePiece_Update(PlayState* play, u32 index, EffectSs* this) { this->rPitch += this->rRotSpeed; this->velocity.x = this->velocity.x * 0.85f; this->velocity.y = this->velocity.y * 0.85f; diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c index 002a054866..8e90937d01 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c @@ -11,26 +11,26 @@ #define rAlpha regs[1] #define rScale regs[2] -u32 EffectSsIceSmoke_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsIceSmoke_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsIceSmoke_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsIceSmoke_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Ice_Smoke_InitVars = { EFFECT_SS_ICE_SMOKE, EffectSsIceSmoke_Init, }; -u32 EffectSsIceSmoke_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsIceSmokeInitParams* initParams = (EffectSsIceSmokeInitParams*)initParamsx; s32 pad; s32 objBankIdx; void* oldSeg6; - objBankIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_FZ); + objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FZ); - if ((objBankIdx > -1) && Object_IsLoaded(&globalCtx->objectCtx, objBankIdx)) { + if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { oldSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIdx].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIdx].segment); Math_Vec3f_Copy(&this->pos, &initParams->pos); Math_Vec3f_Copy(&this->velocity, &initParams->velocity); Math_Vec3f_Copy(&this->accel, &initParams->accel); @@ -50,36 +50,35 @@ u32 EffectSsIceSmoke_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v return 0; } -void EffectSsIceSmoke_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; void* object; Mtx* mtx; f32 scale; s32 objBankIdx; - object = globalCtx->objectCtx.status[this->rObjBankIdx].segment; + object = play->objectCtx.status[this->rObjBankIdx].segment; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_ice_smoke.c", 155); + OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_ice_smoke.c", 155); - objBankIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_FZ); + objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FZ); - if ((objBankIdx > -1) && Object_IsLoaded(&globalCtx->objectCtx, objBankIdx)) { + if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { gDPPipeSync(POLY_XLU_DISP++); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSegments[6] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamStartDL)); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 235, 235, this->rAlpha); - gSPSegment( - POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->life * 3, this->life * 15, 32, 64, 1, 0, 0, 32, 32)); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->life * 3, this->life * 15, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); scale = this->rScale * 0.0001f; Matrix_Scale(scale, scale, 1.0f, MTXMODE_APPLY); - mtx = Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_ss_ice_smoke.c", 196); + mtx = Matrix_NewMtx(play->state.gfxCtx, "../z_eff_ss_ice_smoke.c", 196); if (mtx != NULL) { gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -89,15 +88,15 @@ void EffectSsIceSmoke_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) this->life = -1; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_ice_smoke.c", 210); + CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_ice_smoke.c", 210); } -void EffectSsIceSmoke_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsIceSmoke_Update(PlayState* play, u32 index, EffectSs* this) { s32 objBankIdx; - objBankIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_FZ); + objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FZ); - if ((objBankIdx > -1) && Object_IsLoaded(&globalCtx->objectCtx, objBankIdx)) { + if ((objBankIdx > -1) && Object_IsLoaded(&play->objectCtx, objBankIdx)) { if (this->rAlpha < 100) { this->rAlpha += 10; } diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c index 237ecb963b..b33b012e75 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c @@ -14,16 +14,16 @@ #define rXZScale regs[5] #define rScaleMax regs[6] -u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsKFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsKFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsKFire_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_K_Fire_InitVars = { EFFECT_SS_K_FIRE, EffectSsKFire_Init, }; -u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsKFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsKFireInitParams* initParams = (EffectSsKFireInitParams*)initParamsx; this->pos = initParams->pos; @@ -40,8 +40,8 @@ u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 xzScale; f32 yScale; @@ -53,10 +53,10 @@ void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(xzScale, yScale, xzScale, MTXMODE_APPLY); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - globalCtx->state.frames * this->rScroll, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, play->state.frames * this->rScroll, 0x20, + 0x80)); if (this->rType >= 100) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, this->rAlpha); @@ -69,20 +69,20 @@ void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if (1) {} gDPPipeSync(POLY_XLU_DISP++); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); if ((index & 1) != 0) { Matrix_RotateY(M_PI, MTXMODE_APPLY); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_k_fire.c", 215), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_eff_k_fire.c", 215), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); CLOSE_DISPS(gfxCtx, "../z_eff_k_fire.c", 220); } -void EffectSsKFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsKFire_Update(PlayState* play, u32 index, EffectSs* this) { if (this->rXZScale < this->rScaleMax) { this->rXZScale += 4; this->rYScale += 4; diff --git a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c index b1ef28263d..96a094e826 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c @@ -20,18 +20,18 @@ #define rObjBankIdx regs[11] #define rColorIdx regs[12] -u32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsKakera_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsKakera_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsKakera_Update(PlayState* play, u32 index, EffectSs* this); -void func_809A9BA8(EffectSs* this, GlobalContext* globalCtx); +void func_809A9BA8(EffectSs* this, PlayState* play); EffectSsInit Effect_Ss_Kakera_InitVars = { EFFECT_SS_KAKERA, EffectSsKakera_Init, }; -u32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsKakera_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsKakeraInitParams* initParams = (EffectSsKakeraInitParams*)initParamsx; s32 objId; @@ -49,7 +49,7 @@ u32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi this->rObjId = KAKERA_OBJECT_DEFAULT; } else { this->rObjId = initParams->objId; - func_809A9BA8(this, globalCtx); + func_809A9BA8(this, play); } } else { @@ -86,9 +86,9 @@ f32 func_809A9818(f32 arg0, f32 arg1) { return ((temp_f2 * 2.0f) - arg1) + arg0; } -void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this) { static Color_RGB8 colors[] = { { 255, 255, 255 }, { 235, 170, 130 } }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; f32 scale; s32 colorIdx; @@ -100,9 +100,9 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if (this->rObjId != KAKERA_OBJECT_DEFAULT) { if ((((this->rReg4 >> 7) & 1) << 7) == 0x80) { - gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); } else { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); } } @@ -114,7 +114,7 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if ((((this->rReg4 >> 7) & 1) << 7) == 0x80) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_kakera.c", 268), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(play->state.gfxCtx); if (colorIdx >= 0) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, colors[colorIdx].r, colors[colorIdx].g, colors[colorIdx].b, 255); @@ -124,7 +124,7 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { } else { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_kakera.c", 286), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(play->state.gfxCtx); if (colorIdx >= 0) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, colors[colorIdx].r, colors[colorIdx].g, colors[colorIdx].b, 255); @@ -136,10 +136,10 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_kakera.c", 302); } -void func_809A9BA8(EffectSs* this, GlobalContext* globalCtx) { - this->rObjBankIdx = Object_GetIndex(&globalCtx->objectCtx, this->rObjId); +void func_809A9BA8(EffectSs* this, PlayState* play) { + this->rObjBankIdx = Object_GetIndex(&play->objectCtx, this->rObjId); - if ((this->rObjBankIdx < 0) || !Object_IsLoaded(&globalCtx->objectCtx, this->rObjBankIdx)) { + if ((this->rObjBankIdx < 0) || !Object_IsLoaded(&play->objectCtx, this->rObjBankIdx)) { this->life = 0; this->draw = NULL; } @@ -346,9 +346,9 @@ s32 func_809AA0EC(EffectSs* this) { return true; } -void func_809AA230(EffectSs* this, GlobalContext* globalCtx) { +void func_809AA230(EffectSs* this, PlayState* play) { static f32 D_809AA5B0[] = { 10.0f, 20.0f, 40.0f }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->rReg8 == 0) { if ((((this->rReg4 >> 4) & 1) * 0x10) == 0x10) { @@ -373,7 +373,7 @@ void func_809AA230(EffectSs* this, GlobalContext* globalCtx) { break; case 1: if (this->velocity.y < 0.0f) { - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->pos, D_809AA5B0[(this->rReg4 >> 2) & 3])) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->pos, D_809AA5B0[(this->rReg4 >> 2) & 3])) { this->velocity.x *= func_809A9818(0.9f, 0.2f); this->velocity.y *= -0.8f; this->velocity.z *= func_809A9818(0.9f, 0.2f); @@ -385,13 +385,13 @@ void func_809AA230(EffectSs* this, GlobalContext* globalCtx) { } break; case 2: - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->pos, D_809AA5B0[(this->rReg4 >> 2) & 3])) {} + if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->pos, D_809AA5B0[(this->rReg4 >> 2) & 3])) {} break; } } } -void EffectSsKakera_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsKakera_Update(PlayState* play, u32 index, EffectSs* this) { switch (((this->rReg4 >> 5) & 3) << 5) { case 0x20: this->rPitch += 0xB; @@ -413,9 +413,9 @@ void EffectSsKakera_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) this->life = 0; } - func_809AA230(this, globalCtx); + func_809AA230(this, play); if (this->rObjId != KAKERA_OBJECT_DEFAULT) { - func_809A9BA8(this, globalCtx); + func_809A9BA8(this, play); } } diff --git a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c index 535d4e7b5b..72e3779602 100644 --- a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c +++ b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c @@ -21,18 +21,18 @@ #define rScale regs[11] #define rLifespan regs[12] -u32 EffectSsKiraKira_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsKiraKira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_809AABF0(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_809AACAC(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_809AAD6C(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsKiraKira_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsKiraKira_Draw(PlayState* play, u32 index, EffectSs* this); +void func_809AABF0(PlayState* play, u32 index, EffectSs* this); +void func_809AACAC(PlayState* play, u32 index, EffectSs* this); +void func_809AAD6C(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_KiraKira_InitVars = { EFFECT_SS_KIRAKIRA, EffectSsKiraKira_Init, }; -u32 EffectSsKiraKira_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsKiraKira_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsKiraKiraInitParams* initParams = (EffectSsKiraKiraInitParams*)initParamsx; this->pos = initParams->pos; @@ -74,7 +74,7 @@ u32 EffectSsKiraKira_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v return 1; } -void EffectSsKiraKira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsKiraKira_Draw(PlayState* play, u32 index, EffectSs* this) { GraphicsContext* gfxCtx; f32 scale; s32 pad; @@ -87,14 +87,14 @@ void EffectSsKiraKira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Mtx* mtx; scale = this->rScale / 10000.0f; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_eff_ss_kirakira.c", 257); SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetRotateZYX(&mfRotY, 0, 0, this->rYaw); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfRotY, &mfTrans11DA0RotY); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0RotY, &mfScale, &mfResult); gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -113,7 +113,7 @@ void EffectSsKiraKira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx, "../z_eff_ss_kirakira.c", 301); } -void func_809AABF0(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void func_809AABF0(PlayState* play, u32 index, EffectSs* this) { this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f; this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f; this->rEnvColorA += this->rAlphaStep; @@ -129,7 +129,7 @@ void func_809AABF0(GlobalContext* globalCtx, u32 index, EffectSs* this) { this->rYaw += this->rRotSpeed; } -void func_809AACAC(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void func_809AACAC(PlayState* play, u32 index, EffectSs* this) { this->velocity.x *= 0.95f; this->velocity.z *= 0.95f; this->accel.x = Rand_CenteredFloat(0.2f); @@ -147,6 +147,6 @@ void func_809AACAC(GlobalContext* globalCtx, u32 index, EffectSs* this) { this->rYaw += this->rRotSpeed; } -void func_809AAD6C(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void func_809AAD6C(PlayState* play, u32 index, EffectSs* this) { this->rScale = this->rEnvColorA * Math_SinS((32768.0f / this->rLifespan) * this->life); } diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c index 746ffbd937..956865822c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c @@ -20,16 +20,16 @@ #define rYaw regs[10] #define rLifespan regs[11] -u32 EffectSsLightning_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsLightning_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsLightning_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsLightning_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsLightning_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Lightning_InitVars = { EFFECT_SS_LIGHTNING, EffectSsLightning_Init, }; -u32 EffectSsLightning_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsLightning_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsLightningInitParams* initParams = (EffectSsLightningInitParams*)initParamsx; this->pos = initParams->pos; @@ -53,7 +53,7 @@ u32 EffectSsLightning_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, return 1; } -void EffectSsLightning_NewLightning(GlobalContext* globalCtx, Vec3f* pos, s16 yaw, EffectSs* this) { +void EffectSsLightning_NewLightning(PlayState* play, Vec3f* pos, s16 yaw, EffectSs* this) { EffectSs newLightning; EffectSs_Delete(&newLightning); @@ -63,15 +63,15 @@ void EffectSsLightning_NewLightning(GlobalContext* globalCtx, Vec3f* pos, s16 ya newLightning.rYaw = yaw; newLightning.life = newLightning.rLifespan; - EffectSs_Insert(globalCtx, &newLightning); + EffectSs_Insert(play, &newLightning); } -void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsLightning_Draw(PlayState* play, u32 index, EffectSs* this) { static void* lightningTextures[] = { gEffLightning1Tex, gEffLightning2Tex, gEffLightning3Tex, gEffLightning4Tex, gEffLightning5Tex, gEffLightning6Tex, gEffLightning7Tex, gEffLightning8Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfResult; MtxF mfTrans; MtxF mfScale; @@ -96,7 +96,7 @@ void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) xzScale = yScale * 0.6f; SkinMatrix_SetScale(&mfScale, xzScale, yScale, xzScale); SkinMatrix_SetRotateZYX(&mfRotate, this->vec.x, this->vec.y, this->rYaw); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfRotate, &mfTrans11DA0Rotate); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0Rotate, &mfScale, &mfResult); @@ -117,7 +117,7 @@ void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx, "../z_eff_ss_lightning.c", 281); } -void EffectSsLightning_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsLightning_Update(PlayState* play, u32 index, EffectSs* this) { s32 pad; Vec3f pos; s16 yaw; @@ -131,13 +131,13 @@ void EffectSsLightning_Update(GlobalContext* globalCtx, u32 index, EffectSs* thi pos.y = this->pos.y + (Math_SinS(this->rYaw - 0x4000) * scale); scale = Math_CosS(this->rYaw - 0x4000) * scale; - pos.x = this->pos.x - (Math_CosS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx))) * scale); - pos.z = this->pos.z + (Math_SinS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx))) * scale); + pos.x = this->pos.x - (Math_CosS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(play))) * scale); + pos.z = this->pos.z + (Math_SinS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(play))) * scale); - EffectSsLightning_NewLightning(globalCtx, &pos, yaw, this); + EffectSsLightning_NewLightning(play, &pos, yaw, this); if (Rand_ZeroOne() < 0.1f) { - EffectSsLightning_NewLightning(globalCtx, &pos, (this->rYaw * 2) - yaw, this); + EffectSsLightning_NewLightning(play, &pos, (this->rYaw * 2) - yaw, this); } } } diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c index 6379fd2111..b99dbe859a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c @@ -19,16 +19,16 @@ #define rDirection regs[9] #define rScale regs[10] -u32 EffectSsSibuki_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsSibuki_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsSibuki_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsSibuki_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsSibuki_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsSibuki_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Sibuki_InitVars = { EFFECT_SS_SIBUKI, EffectSsSibuki_Init, }; -u32 EffectSsSibuki_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsSibuki_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsSibukiInitParams* initParams = (EffectSsSibukiInitParams*)initParamsx; this->pos = initParams->pos; @@ -59,8 +59,8 @@ u32 EffectSsSibuki_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsSibuki_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsSibuki_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale = this->rScale / 100.0f; OPEN_DISPS(gfxCtx, "../z_eff_ss_sibuki.c", 163); @@ -78,11 +78,11 @@ void EffectSsSibuki_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_sibuki.c", 198); } -void EffectSsSibuki_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsSibuki_Update(PlayState* play, u32 index, EffectSs* this) { s32 pad[3]; f32 xzVelScale; s16 yaw; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->pos.y <= player->actor.floorHeight) { this->life = 0; @@ -92,7 +92,7 @@ void EffectSsSibuki_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) this->rMoveDelay--; if (this->rMoveDelay == 0) { - yaw = Camera_GetInputDirYaw(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + yaw = Camera_GetInputDirYaw(Play_GetCamera(play, CAM_ID_MAIN)); xzVelScale = ((200.0f + KREG(20)) * 0.01f) + ((0.1f * Rand_ZeroOne()) * (KREG(23) + 20.0f)); if (this->rDirection != 0) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c index 78bcfd1c87..7f11a00c76 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c @@ -18,16 +18,16 @@ #define rTexIdx regs[8] #define rScale regs[9] -u32 EffectSsSibuki2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsSibuki2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsSibuki2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsSibuki2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsSibuki2_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsSibuki2_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Sibuki2_InitVars = { EFFECT_SS_SIBUKI2, EffectSsSibuki2_Init, }; -u32 EffectSsSibuki2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsSibuki2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsSibuki2InitParams* initParams = (EffectSsSibuki2InitParams*)initParamsx; this->pos = initParams->pos; @@ -50,13 +50,13 @@ u32 EffectSsSibuki2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo return 1; } -void EffectSsSibuki2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsSibuki2_Draw(PlayState* play, u32 index, EffectSs* this) { static void* bubbleTextures[] = { gEffUnusedBubbles1Tex, gEffUnusedBubbles1Tex, gEffUnusedBubbles2Tex, gEffUnusedBubbles3Tex, gEffUnusedBubbles4Tex, gEffUnusedBubbles5Tex, gEffUnusedBubbles6Tex, gEffUnusedBubbles7Tex, gEffUnusedBubbles8Tex, }; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 scale = this->rScale / 100.0f; OPEN_DISPS(gfxCtx, "../z_eff_ss_sibuki2.c", 158); @@ -74,7 +74,7 @@ void EffectSsSibuki2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_sibuki2.c", 198); } -void EffectSsSibuki2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsSibuki2_Update(PlayState* play, u32 index, EffectSs* this) { if (this->rTexIdx < 8) { this->rTexIdx++; } diff --git a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c index babae25179..dd3d93f6f5 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c +++ b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c @@ -8,15 +8,15 @@ #define rUnused regs[1] -u32 EffectSsSolderSrchBall_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsSolderSrchBall_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsSolderSrchBall_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsSolderSrchBall_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars = { EFFECT_SS_SOLDER_SRCH_BALL, EffectSsSolderSrchBall_Init, }; -u32 EffectSsSolderSrchBall_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsSolderSrchBall_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsSolderSrchBallInitParams* initParams = (EffectSsSolderSrchBallInitParams*)initParamsx; this->pos = initParams->pos; @@ -29,13 +29,13 @@ u32 EffectSsSolderSrchBall_Init(GlobalContext* globalCtx, u32 index, EffectSs* t return 1; } -void EffectSsSolderSrchBall_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsSolderSrchBall_Update(PlayState* play, u32 index, EffectSs* this) { s32 pad; f32 playerPosDiffX; f32 playerPosDiffY; f32 playerPosDiffZ; s16* linkDetected; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); linkDetected = this->actor; @@ -43,7 +43,7 @@ void EffectSsSolderSrchBall_Update(GlobalContext* globalCtx, u32 index, EffectSs playerPosDiffY = player->actor.world.pos.y - this->pos.y; playerPosDiffZ = player->actor.world.pos.z - this->pos.z; - if (!BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->pos, 30.0f)) { + if (!BgCheck_SphVsFirstPoly(&play->colCtx, &this->pos, 30.0f)) { if (sqrtf(SQ(playerPosDiffX) + SQ(playerPosDiffY) + SQ(playerPosDiffZ)) < 70.0f) { *linkDetected = true; } diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c index 7683469feb..e35e3c5852 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c @@ -11,9 +11,9 @@ #define rObjBankIdx regs[0] #define rYaw regs[1] -u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsStick_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsStick_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsStick_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsStick_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsStick_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Stick_InitVars = { EFFECT_SS_STICK, @@ -25,7 +25,7 @@ typedef struct { /* 0x04 */ Gfx* displayList; } StickDrawInfo; -u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsStick_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { StickDrawInfo drawInfo[] = { { OBJECT_LINK_BOY, gLinkAdultBrokenGiantsKnifeBladeDL }, // adult, broken sword { OBJECT_LINK_CHILD, gLinkChildLinkDekuStickDL }, // child, broken stick @@ -33,7 +33,7 @@ u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void StickDrawInfo* ageInfoEntry = gSaveContext.linkAge + drawInfo; EffectSsStickInitParams* initParams = (EffectSsStickInitParams*)initParamsx; - this->rObjBankIdx = Object_GetIndex(&globalCtx->objectCtx, ageInfoEntry->objectID); + this->rObjBankIdx = Object_GetIndex(&play->objectCtx, ageInfoEntry->objectID); this->gfx = ageInfoEntry->displayList; this->vec = this->pos = initParams->pos; this->rYaw = initParams->yaw; @@ -48,8 +48,8 @@ u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsStick_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsStick_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; OPEN_DISPS(gfxCtx, "../z_eff_ss_stick.c", 153); @@ -61,18 +61,18 @@ void EffectSsStick_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_RotateZYX(0, this->rYaw, 0, MTXMODE_APPLY); } else { Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - Matrix_RotateZYX(0, this->rYaw, globalCtx->state.frames * 10000, MTXMODE_APPLY); + Matrix_RotateZYX(0, this->rYaw, play->state.frames * 10000, MTXMODE_APPLY); } gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_ss_stick.c", 176), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); func_80093D18(gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIdx].segment); gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList); gSPDisplayList(POLY_OPA_DISP++, this->gfx); CLOSE_DISPS(gfxCtx, "../z_eff_ss_stick.c", 188); } -void EffectSsStick_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsStick_Update(PlayState* play, u32 index, EffectSs* this) { } diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c index 9f666f1055..d713fca766 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c @@ -9,9 +9,9 @@ #define rReg0 regs[0] -u32 EffectSsStone1_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsStone1_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsStone1_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsStone1_Draw(PlayState* play, u32 index, EffectSs* this); +void EffectSsStone1_Update(PlayState* play, u32 index, EffectSs* this); EffectSsInit Effect_Ss_Stone1_InitVars = { EFFECT_SS_STONE1, @@ -35,7 +35,7 @@ static EffStoneDrawInfo sDrawInfo[] = { { gUnknownEffStone1Tex, { 255, 255, 255, 255 }, { 0, 255, 255, 255 } }, }; -u32 EffectSsStone1_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsStone1_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsStone1InitParams* initParams = (EffectSsStone1InitParams*)initParamsx; Vec3f pos = initParams->pos; @@ -49,8 +49,8 @@ u32 EffectSsStone1_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi return 1; } -void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsStone1_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; EffStoneDrawInfo* drawParams = &sDrawInfo[this->life]; Vec3f mfVec; f32 mfW; @@ -58,7 +58,7 @@ void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx, "../z_eff_ss_stone1.c", 154); - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->pos, &mfVec, &mfW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->pos, &mfVec, &mfW); scale = (mfW < 1500.0f) ? 3.0f : (mfW / 1500.0f) * 3.0f; Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); @@ -74,7 +74,7 @@ void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx, "../z_eff_ss_stone1.c", 183); } -void EffectSsStone1_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsStone1_Update(PlayState* play, u32 index, EffectSs* this) { if ((this->life == 6) && (this->rReg0 != 0)) { iREG(50) = 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 aabd9b4642..d3f3231d3b 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1454,7 +1454,7 @@ void FileChoose_LoadGame(GameState* thisx) { gSaveContext.fileNum = this->buttonIndex; Sram_OpenSave(&this->sramCtx); gSaveContext.gameMode = 0; - SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); this->state.running = false; } diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index 389e3fa2fd..e2079b6d05 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -13,7 +13,7 @@ void Opening_SetupTitleScreen(OpeningContext* this) { Sram_InitDebugSave(); gSaveContext.cutsceneIndex = 0xFFF3; gSaveContext.sceneSetupIndex = 7; - SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } void func_80803C5C(OpeningContext* this) { diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 6f4bff4964..d049487952 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -37,7 +37,7 @@ void Select_LoadGame(SelectContext* this, s32 entranceIndex) { gSaveContext.showTitleCard = true; gWeatherMode = WEATHER_MODE_CLEAR; this->state.running = false; - SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } // "Translation" (Actual name) diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index fd46213bab..bd0c094e82 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -2,7 +2,7 @@ #include "textures/parameter_static/parameter_static.h" #include "textures/icon_item_static/icon_item_static.h" -void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { +void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { static s16 D_8082A070[][4] = { { 255, 0, 0, 255 }, { 255, 70, 0, 150 }, @@ -56,8 +56,8 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx { 0x02, 0xFF, 0x13, 0xFE }, { 0xFF, 0x17, 0xFD, 0x16 }, { 0xFF, 0x17, 0x15, 0x18 }, { 0x15, 0x0C, 0xFD, 0x18 }, { 0xFF, 0x10, 0x16, 0x04 }, { 0x00, 0x00, 0x00, 0x00 }, }; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; s16 sp226; s16 sp224; s16 sp222; @@ -90,7 +90,7 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx if (pauseCtx->stickRelX < -30) { phi_s0 = D_8082A1AC[phi_s3][2]; if (phi_s0 == -3) { - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); pauseCtx->unk_1E4 = 0; } else { while (phi_s0 >= 0) { @@ -103,7 +103,7 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx } else if (pauseCtx->stickRelX > 30) { phi_s0 = D_8082A1AC[phi_s3][3]; if (phi_s0 == -2) { - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); pauseCtx->unk_1E4 = 0; } else { while (phi_s0 >= 0) { 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 361a96fc7f..dd703fa86b 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c @@ -79,8 +79,8 @@ void KaleidoScope_DrawDebugEditorText(Gfx** gfxp) { GfxPrint_Destroy(&printer); } -void KaleidoScope_DrawDigit(GlobalContext* globalCtx, s32 digit, s32 rectLeft, s32 rectTop) { - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_debug.c", 208); +void KaleidoScope_DrawDigit(PlayState* play, s32 digit, s32 rectLeft, s32 rectTop) { + OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_debug.c", 208); gDPLoadTextureBlock(POLY_OPA_DISP++, ((u8*)gCounterDigit0Tex + (8 * 16 * digit)), G_IM_FMT_I, G_IM_SIZ_8b, 8, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, @@ -88,16 +88,16 @@ void KaleidoScope_DrawDigit(GlobalContext* globalCtx, s32 digit, s32 rectLeft, s gSPTextureRectangle(POLY_OPA_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + 8) << 2, (rectTop + 16) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_debug.c", 220); + CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_debug.c", 220); } -void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { +void KaleidoScope_DrawDebugEditor(PlayState* play) { static s16 curSection = 0; static s16 curRow = 0; static s32 prevDBtnInput = 0; static s32 heldDBtnTimer = 0; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; Gfx* gfx; Gfx* gfxRef; s16 spD8[4]; @@ -108,12 +108,12 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { s16 y; s32 dBtnInput = input->cur.button & (BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT); - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_debug.c", 402); + OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_debug.c", 402); pauseCtx->stickRelX = input->rel.stick_x; pauseCtx->stickRelY = input->rel.stick_y; - func_800944C4(globalCtx->state.gfxCtx); + func_800944C4(play->state.gfxCtx); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); @@ -138,7 +138,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); // Current Health Quarter (X / 4) - KaleidoScope_DrawDigit(globalCtx, (gSaveContext.health % 0x10) / 4, 194, 15); + KaleidoScope_DrawDigit(play, (gSaveContext.health % 0x10) / 4, 194, 15); gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); @@ -162,7 +162,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { } for (i = 0, x = 68; i < 4; i++, x += 10) { - KaleidoScope_DrawDigit(globalCtx, spD8[i], x, 15); + KaleidoScope_DrawDigit(play, spD8[i], x, 15); } // Health capacity @@ -173,8 +173,8 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { spD8[3] -= 10; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], 146, 15); - KaleidoScope_DrawDigit(globalCtx, spD8[3], 156, 15); + KaleidoScope_DrawDigit(play, spD8[2], 146, 15); + KaleidoScope_DrawDigit(play, spD8[3], 156, 15); // Health spD8[2] = 0; @@ -184,8 +184,8 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { spD8[3] -= 10; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], 172, 15); - KaleidoScope_DrawDigit(globalCtx, spD8[3], 182, 15); + KaleidoScope_DrawDigit(play, spD8[2], 172, 15); + KaleidoScope_DrawDigit(play, spD8[3], 182, 15); // Inventory for (slot = 0, i = 0, y = 35; i < 4; i++, y += 15) { @@ -209,8 +209,8 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { spD8[2] = spD8[3] = 0; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], x, y); - KaleidoScope_DrawDigit(globalCtx, spD8[3], x + 10, y); + KaleidoScope_DrawDigit(play, spD8[2], x, y); + KaleidoScope_DrawDigit(play, spD8[3], x + 10, y); } } @@ -227,24 +227,24 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { spD8[2] = spD8[3] = 0; } - KaleidoScope_DrawDigit(globalCtx, spD8[3], spD8[1], 98); + KaleidoScope_DrawDigit(play, spD8[3], spD8[1], 98); spD8[1] += 10; } // Upgrades for (spD8[1] = 78, i = 0; i < 8; i++, spD8[1] += 12) { - KaleidoScope_DrawDigit(globalCtx, CUR_UPG_VALUE(i), spD8[1], 115); + KaleidoScope_DrawDigit(play, CUR_UPG_VALUE(i), spD8[1], 115); } // Equipment for (spD8[1] = 202, i = 0; i < 4; i++, spD8[1] += 12) { - KaleidoScope_DrawDigit(globalCtx, ALL_EQUIP_VALUE(i), spD8[1], 115); + KaleidoScope_DrawDigit(play, ALL_EQUIP_VALUE(i), spD8[1], 115); } // Dungeon Items for (spD8[1] = 78, i = 0; i < 12; i++, spD8[1] += 12) { spD8[2] = gSaveContext.inventory.dungeonItems[i] & gEquipMasks[0]; - KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 132); + KaleidoScope_DrawDigit(play, spD8[2], spD8[1], 132); } // Medallions @@ -253,7 +253,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST + i)) { spD8[2] = 1; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 149); + KaleidoScope_DrawDigit(play, spD8[2], spD8[1], 149); } // Spiritual Stones @@ -262,7 +262,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD + i)) { spD8[2] = 1; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 149); + KaleidoScope_DrawDigit(play, spD8[2], spD8[1], 149); } // Songs @@ -271,7 +271,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { if (CHECK_QUEST_ITEM(QUEST_SONG_MINUET + i)) { spD8[2] = 1; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 166); + KaleidoScope_DrawDigit(play, spD8[2], spD8[1], 166); } // Other Quest Items @@ -280,7 +280,7 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { if (CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY + i)) { spD8[2] = 1; } - KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 185); + KaleidoScope_DrawDigit(play, spD8[2], spD8[1], 185); } // GS Tokens @@ -297,14 +297,13 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { spD8[3] -= 10; } - KaleidoScope_DrawDigit(globalCtx, spD8[1], 145, 185); - KaleidoScope_DrawDigit(globalCtx, spD8[2], 155, 185); - KaleidoScope_DrawDigit(globalCtx, spD8[3], 165, 185); + KaleidoScope_DrawDigit(play, spD8[1], 145, 185); + KaleidoScope_DrawDigit(play, spD8[2], 155, 185); + KaleidoScope_DrawDigit(play, spD8[3], 165, 185); // Heart Pieces (X / 4) - KaleidoScope_DrawDigit(globalCtx, - ((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> QUEST_HEART_PIECE_COUNT, - 210, 185); + KaleidoScope_DrawDigit( + play, ((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> QUEST_HEART_PIECE_COUNT, 210, 185); // Handles navigating the menu to different sections with the D-Pad // When the same direction is held, registers the input periodically based on a timer @@ -383,13 +382,13 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { case 2: if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - Health_ChangeBy(globalCtx, -4); + Health_ChangeBy(play, -4); } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - Health_ChangeBy(globalCtx, 4); + Health_ChangeBy(play, 4); } else if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) { - Health_ChangeBy(globalCtx, -0x10); + Health_ChangeBy(play, -0x10); } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { - Health_ChangeBy(globalCtx, 0x10); + Health_ChangeBy(play, 0x10); } break; @@ -645,5 +644,5 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { pauseCtx->debugState = 0; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_debug.c", 861); + CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_debug.c", 861); } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index c64249a381..470300f989 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -16,8 +16,8 @@ static u8 sEquipmentItemOffsets[] = { static s16 sEquipTimer = 0; -void KaleidoScope_DrawEquipmentImage(GlobalContext* globalCtx, void* source, u32 width, u32 height) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u32 height) { + PauseContext* pauseCtx = &play->pauseCtx; u8* curTexture; s32 vtxIndex; s32 textureCount; @@ -27,7 +27,7 @@ void KaleidoScope_DrawEquipmentImage(GlobalContext* globalCtx, void* source, u32 s32 pad; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_equipment.c", 68); + OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_equipment.c", 68); gDPPipeSync(POLY_OPA_DISP++); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); @@ -78,11 +78,11 @@ void KaleidoScope_DrawEquipmentImage(GlobalContext* globalCtx, void* source, u32 vtxIndex += 4; } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_equipment.c", 122); + CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_equipment.c", 122); } -void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_DrawPlayerWork(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; Vec3f pos; Vec3s rot; f32 scale; @@ -106,16 +106,16 @@ void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx) { rot.y = 32300; rot.x = rot.z = 0; - Player_DrawPause(globalCtx, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &rot, scale, + Player_DrawPause(play, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &rot, scale, SWORD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD)), TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC)), SHIELD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD)), BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS))); } -void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; +void KaleidoScope_DrawEquipment(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; u16 i; u16 j; u16 k; @@ -132,7 +132,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { s16 cursorY; volatile s16 oldCursorPoint; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_equipment.c", 219); + OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_equipment.c", 219); gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, ZREG(39), ZREG(40), ZREG(41), pauseCtx->alpha); @@ -203,7 +203,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { if (cursorY == pauseCtx->cursorY[PAUSE_EQUIP]) { pauseCtx->cursorX[PAUSE_EQUIP] = cursorX; pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); cursorMoveResult = 3; } } @@ -239,7 +239,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { if (cursorY == pauseCtx->cursorY[PAUSE_EQUIP]) { pauseCtx->cursorX[PAUSE_EQUIP] = cursorX; pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); cursorMoveResult = 3; } } @@ -343,7 +343,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { continue; } - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); break; } } @@ -384,7 +384,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { continue; } - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); break; } } @@ -488,7 +488,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { } } - Interface_LoadItemIcon1(globalCtx, 0); + Interface_LoadItemIcon1(play, 0); } Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -536,7 +536,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { } } - func_800949A8(globalCtx->state.gfxCtx); + func_800949A8(play->state.gfxCtx); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); @@ -548,57 +548,56 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { point = CUR_UPG_VALUE(sChildUpgrades[i]); if (1) {} if ((point != 0) && (CUR_UPG_VALUE(sChildUpgrades[i]) != 0)) { - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[sChildUpgradeItemBases[i] + point - 1], 32, 32, 0); } } else { if ((i == 0) && (CUR_UPG_VALUE(sAdultUpgrades[i]) == 0)) { KaleidoScope_DrawQuadTextureRGBA32( - globalCtx->state.gfxCtx, - gItemIcons[sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1], 32, 32, 0); + play->state.gfxCtx, gItemIcons[sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1], + 32, 32, 0); } else if (CUR_UPG_VALUE(sAdultUpgrades[i]) != 0) { KaleidoScope_DrawQuadTextureRGBA32( - globalCtx->state.gfxCtx, - gItemIcons[sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1], 32, 32, 0); + play->state.gfxCtx, gItemIcons[sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1], + 32, 32, 0); } } for (k = 0, bit = rowStart, point = 4; k < 3; k++, point += 4, temp++, bit++) { if (((u32)i == 0) && (k == 2) && (gSaveContext.bgsFlag != 0)) { - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBiggoronSwordIconTex, 32, 32, point); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gBiggoronSwordIconTex, 32, 32, point); } else if ((i == 0) && (k == 2) && (gBitFlags[bit + 1] & gSaveContext.inventory.equipment)) { - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBrokenGiantsKnifeIconTex, 32, 32, point); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gBrokenGiantsKnifeIconTex, 32, 32, point); } else if (gBitFlags[bit] & gSaveContext.inventory.equipment) { - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[ITEM_SWORD_KOKIRI + temp], 32, - 32, point); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[ITEM_SWORD_KOKIRI + temp], 32, 32, + point); } } } - KaleidoScope_DrawPlayerWork(globalCtx); + KaleidoScope_DrawPlayerWork(play); if ((pauseCtx->unk_1E4 == 7) && (sEquipTimer == 10)) { - KaleidoScope_SetupPlayerPreRender(globalCtx); + KaleidoScope_SetupPlayerPreRender(play); } if ((pauseCtx->unk_1E4 == 7) && (sEquipTimer == 9)) { //! @bug: This function shouldn't take any arguments - KaleidoScope_ProcessPlayerPreRender(globalCtx); + KaleidoScope_ProcessPlayerPreRender(play); } gSPSegment(POLY_OPA_DISP++, 0x07, pauseCtx->playerSegment); gSPSegment(POLY_OPA_DISP++, 0x08, pauseCtx->iconItemSegment); gSPSegment(POLY_OPA_DISP++, 0x09, pauseCtx->iconItem24Segment); gSPSegment(POLY_OPA_DISP++, 0x0A, pauseCtx->nameSegment); - gSPSegment(POLY_OPA_DISP++, 0x0B, globalCtx->interfaceCtx.mapSegment); + gSPSegment(POLY_OPA_DISP++, 0x0B, play->interfaceCtx.mapSegment); gSPSegment(POLY_OPA_DISP++, 0x0C, pauseCtx->iconItemAltSegment); - func_800949A8(globalCtx->state.gfxCtx); - KaleidoScope_DrawEquipmentImage(globalCtx, pauseCtx->playerSegment, PAUSE_EQUIP_PLAYER_WIDTH, - PAUSE_EQUIP_PLAYER_HEIGHT); + func_800949A8(play->state.gfxCtx); + KaleidoScope_DrawEquipmentImage(play, pauseCtx->playerSegment, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT); if (gUpgradeMasks[0]) {} - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_equipment.c", 609); + CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_equipment.c", 609); } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 4b166156b5..155dbd4d2f 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -77,12 +77,12 @@ void KaleidoScope_SetItemCursorVtx(PauseContext* pauseCtx) { KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_ITEM] * 4, pauseCtx->itemVtx); } -void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { +void KaleidoScope_DrawItemSelect(PlayState* play) { static s16 magicArrowEffectsR[] = { 255, 100, 255 }; static s16 magicArrowEffectsG[] = { 0, 100, 255 }; static s16 magicArrowEffectsB[] = { 0, 255, 100 }; - Input* input = &globalCtx->state.input[0]; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + Input* input = &play->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; u16 i; u16 j; u16 cursorItem; @@ -94,9 +94,9 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { s16 oldCursorPoint; s16 moveCursorResult; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_item.c", 234); + OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_item.c", 234); - func_800949A8(globalCtx->state.gfxCtx); + func_800949A8(play->state.gfxCtx); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); @@ -156,7 +156,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { pauseCtx->cursorX[PAUSE_ITEM] = cursorX; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); moveCursorResult = 2; } @@ -188,7 +188,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { pauseCtx->cursorX[PAUSE_ITEM] = cursorX; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); moveCursorResult = 2; } @@ -235,7 +235,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { continue; } - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); break; } } @@ -271,7 +271,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { continue; } - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); break; } } @@ -467,13 +467,13 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { } gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[j + 0], 4, 0); - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[gSaveContext.inventory.items[i]], 32, - 32, 0); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[gSaveContext.inventory.items[i]], 32, 32, + 0); } } if (pauseCtx->cursorSpecialPos == 0) { - KaleidoScope_DrawCursor(globalCtx, PAUSE_ITEM); + KaleidoScope_DrawCursor(play, PAUSE_ITEM); } gDPPipeSync(POLY_OPA_DISP++); @@ -482,19 +482,19 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { for (i = 0; i < 15; i++) { if ((gAmmoItems[i] != ITEM_NONE) && (gSaveContext.inventory.items[i] != ITEM_NONE)) { - KaleidoScope_DrawAmmoCount(pauseCtx, globalCtx->state.gfxCtx, gSaveContext.inventory.items[i]); + KaleidoScope_DrawAmmoCount(pauseCtx, play->state.gfxCtx, gSaveContext.inventory.items[i]); } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_item.c", 516); + CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_item.c", 516); } static s16 sCButtonPosX[] = { 660, 900, 1140 }; static s16 sCButtonPosY[] = { 1100, 920, 1100 }; -void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { +void KaleidoScope_UpdateItemEquip(PlayState* play) { static s16 D_8082A488 = 0; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + PauseContext* pauseCtx = &play->pauseCtx; Vtx* bowItemVtx; u16 offsetX; u16 offsetY; @@ -597,7 +597,7 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { } else { gSaveContext.equips.buttonItems[2] = gSaveContext.equips.buttonItems[1]; gSaveContext.equips.cButtonSlots[1] = gSaveContext.equips.cButtonSlots[0]; - Interface_LoadItemIcon2(globalCtx, 2); + Interface_LoadItemIcon2(play, 2); } } else { gSaveContext.equips.buttonItems[2] = ITEM_NONE; @@ -614,7 +614,7 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { } else { gSaveContext.equips.buttonItems[3] = gSaveContext.equips.buttonItems[1]; gSaveContext.equips.cButtonSlots[2] = gSaveContext.equips.cButtonSlots[0]; - Interface_LoadItemIcon2(globalCtx, 3); + Interface_LoadItemIcon2(play, 3); } } else { gSaveContext.equips.buttonItems[3] = ITEM_NONE; @@ -634,18 +634,18 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { (gSaveContext.equips.buttonItems[2] <= ITEM_BOW_ARROW_LIGHT)) { gSaveContext.equips.buttonItems[2] = gSaveContext.equips.buttonItems[1]; gSaveContext.equips.cButtonSlots[1] = gSaveContext.equips.cButtonSlots[0]; - Interface_LoadItemIcon2(globalCtx, 2); + Interface_LoadItemIcon2(play, 2); } else if ((gSaveContext.equips.buttonItems[3] >= ITEM_BOW_ARROW_FIRE) && (gSaveContext.equips.buttonItems[3] <= ITEM_BOW_ARROW_LIGHT)) { gSaveContext.equips.buttonItems[3] = gSaveContext.equips.buttonItems[1]; gSaveContext.equips.cButtonSlots[2] = gSaveContext.equips.cButtonSlots[0]; - Interface_LoadItemIcon2(globalCtx, 3); + Interface_LoadItemIcon2(play, 3); } } gSaveContext.equips.buttonItems[1] = pauseCtx->equipTargetItem; gSaveContext.equips.cButtonSlots[0] = pauseCtx->equipTargetSlot; - Interface_LoadItemIcon1(globalCtx, 1); + Interface_LoadItemIcon1(play, 1); osSyncPrintf("C左sl_item_no=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetItem, gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2], @@ -672,7 +672,7 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { } else { gSaveContext.equips.buttonItems[1] = gSaveContext.equips.buttonItems[2]; gSaveContext.equips.cButtonSlots[0] = gSaveContext.equips.cButtonSlots[1]; - Interface_LoadItemIcon2(globalCtx, 1); + Interface_LoadItemIcon2(play, 1); } } else { gSaveContext.equips.buttonItems[1] = ITEM_NONE; @@ -689,7 +689,7 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { } else { gSaveContext.equips.buttonItems[3] = gSaveContext.equips.buttonItems[2]; gSaveContext.equips.cButtonSlots[2] = gSaveContext.equips.cButtonSlots[1]; - Interface_LoadItemIcon2(globalCtx, 3); + Interface_LoadItemIcon2(play, 3); } } else { gSaveContext.equips.buttonItems[3] = ITEM_NONE; @@ -708,17 +708,17 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { if ((gSaveContext.equips.buttonItems[1] >= ITEM_BOW_ARROW_FIRE) && (gSaveContext.equips.buttonItems[1] <= ITEM_BOW_ARROW_LIGHT)) { gSaveContext.equips.buttonItems[1] = gSaveContext.equips.buttonItems[2]; - Interface_LoadItemIcon2(globalCtx, 1); + Interface_LoadItemIcon2(play, 1); } else if ((gSaveContext.equips.buttonItems[3] >= ITEM_BOW_ARROW_FIRE) && (gSaveContext.equips.buttonItems[3] <= ITEM_BOW_ARROW_LIGHT)) { gSaveContext.equips.buttonItems[3] = gSaveContext.equips.buttonItems[2]; - Interface_LoadItemIcon2(globalCtx, 3); + Interface_LoadItemIcon2(play, 3); } } gSaveContext.equips.buttonItems[2] = pauseCtx->equipTargetItem; gSaveContext.equips.cButtonSlots[1] = pauseCtx->equipTargetSlot; - Interface_LoadItemIcon1(globalCtx, 2); + Interface_LoadItemIcon1(play, 2); osSyncPrintf("C下sl_item_no=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetItem, gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2], @@ -745,7 +745,7 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { } else { gSaveContext.equips.buttonItems[1] = gSaveContext.equips.buttonItems[3]; gSaveContext.equips.cButtonSlots[0] = gSaveContext.equips.cButtonSlots[2]; - Interface_LoadItemIcon2(globalCtx, 1); + Interface_LoadItemIcon2(play, 1); } } else { gSaveContext.equips.buttonItems[1] = ITEM_NONE; @@ -762,7 +762,7 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { } else { gSaveContext.equips.buttonItems[2] = gSaveContext.equips.buttonItems[3]; gSaveContext.equips.cButtonSlots[1] = gSaveContext.equips.cButtonSlots[2]; - Interface_LoadItemIcon2(globalCtx, 2); + Interface_LoadItemIcon2(play, 2); } } else { gSaveContext.equips.buttonItems[2] = ITEM_NONE; @@ -781,17 +781,17 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { if ((gSaveContext.equips.buttonItems[1] >= ITEM_BOW_ARROW_FIRE) && (gSaveContext.equips.buttonItems[1] <= ITEM_BOW_ARROW_LIGHT)) { gSaveContext.equips.buttonItems[1] = gSaveContext.equips.buttonItems[3]; - Interface_LoadItemIcon2(globalCtx, 1); + Interface_LoadItemIcon2(play, 1); } else if ((gSaveContext.equips.buttonItems[2] >= ITEM_BOW_ARROW_FIRE) && (gSaveContext.equips.buttonItems[2] <= ITEM_BOW_ARROW_LIGHT)) { gSaveContext.equips.buttonItems[2] = gSaveContext.equips.buttonItems[3]; - Interface_LoadItemIcon2(globalCtx, 2); + Interface_LoadItemIcon2(play, 2); } } gSaveContext.equips.buttonItems[3] = pauseCtx->equipTargetItem; gSaveContext.equips.cButtonSlots[2] = pauseCtx->equipTargetSlot; - Interface_LoadItemIcon1(globalCtx, 3); + Interface_LoadItemIcon1(play, 3); osSyncPrintf("C右sl_item_no=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetItem, gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2], diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c index 2b70f02a8e..849b6b7ba8 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c @@ -7,7 +7,7 @@ #include "textures/icon_item_dungeon_static/icon_item_dungeon_static.h" #include "textures/icon_item_nes_static/icon_item_nes_static.h" -void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { +void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) { static void* dungeonItemTexs[] = { gBossKeyIconTex, gCompassIconTex, @@ -34,8 +34,8 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC static s16 mapBgPulseB = 140 / 8; static u16 mapBgPulseTimer = 20; static u16 mapBgPulseStage = 0; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + PauseContext* pauseCtx = &play->pauseCtx; s16 i; s16 j; s16 oldCursorPoint; @@ -53,7 +53,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC if (pauseCtx->cursorSpecialPos == 0) { if (pauseCtx->stickRelX > 30) { if (pauseCtx->cursorX[PAUSE_MAP] != 0) { - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); } else { pauseCtx->cursorX[PAUSE_MAP] = 1; pauseCtx->cursorPoint[PAUSE_MAP] = 0; @@ -62,14 +62,14 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC if (!CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.mapIndex)) { pauseCtx->cursorPoint[PAUSE_MAP]++; if (!CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.mapIndex)) { - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); } } } } } else if (pauseCtx->stickRelX < -30) { if (pauseCtx->cursorX[PAUSE_MAP] == 0) { - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); } else { pauseCtx->cursorX[PAUSE_MAP] = 0; pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->dungeonMapSlot; @@ -77,7 +77,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE + gMapData->floorTexIndexOffset[gSaveContext.mapIndex][pauseCtx->cursorPoint[PAUSE_MAP] - 3]; - KaleidoScope_UpdateDungeonMap(globalCtx); + KaleidoScope_UpdateDungeonMap(play); } } @@ -134,7 +134,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC gMapData->floorTexIndexOffset[gSaveContext.mapIndex][pauseCtx->cursorPoint[PAUSE_MAP] - 3]; pauseCtx->dungeonMapSlot = pauseCtx->cursorPoint[PAUSE_MAP]; if (i != R_MAP_TEX_INDEX) { - KaleidoScope_UpdateDungeonMap(globalCtx); + KaleidoScope_UpdateDungeonMap(play); } } } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { @@ -166,7 +166,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC R_MAP_TEX_INDEX_BASE + gMapData ->floorTexIndexOffset[gSaveContext.mapIndex][pauseCtx->cursorPoint[PAUSE_MAP] - 3]; - KaleidoScope_UpdateDungeonMap(globalCtx); + KaleidoScope_UpdateDungeonMap(play); } } } else { @@ -305,7 +305,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gGoldSkulltulaIconTex, 24, 24, 8); } - if ((globalCtx->sceneNum >= SCENE_YDAN) && (globalCtx->sceneNum <= SCENE_TAKARAYA)) { + if ((play->sceneNum >= SCENE_YDAN) && (play->sceneNum <= SCENE_TAKARAYA)) { stepR = (mapBgPulseR - mapBgPulseColors[mapBgPulseStage][0]) / mapBgPulseTimer; stepG = (mapBgPulseG - mapBgPulseColors[mapBgPulseStage][1]) / mapBgPulseTimer; stepB = (mapBgPulseB - mapBgPulseColors[mapBgPulseStage][2]) / mapBgPulseTimer; @@ -350,7 +350,7 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC CLOSE_DISPS(gfxCtx, "../z_kaleido_map_PAL.c", 388); } -void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { +void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) { static void* cloudTexs[] = { gWorldMapCloud16Tex, gWorldMapCloud15Tex, gWorldMapCloud14Tex, gWorldMapCloud13Tex, gWorldMapCloud12Tex, gWorldMapCloud11Tex, gWorldMapCloud10Tex, gWorldMapCloud9Tex, @@ -398,7 +398,7 @@ void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx gPauseCurrentPositionFRATex, }; static u16 D_8082A6D4 = 0; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + PauseContext* pauseCtx = &play->pauseCtx; s16 i; s16 j; s16 t; @@ -422,7 +422,7 @@ void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++; if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] > 11) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 11; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); break; } } while (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] == 0); @@ -433,7 +433,7 @@ void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--; if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] < 0) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 0; - KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT); + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); break; } } while (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] == 0); @@ -687,7 +687,7 @@ void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx } if (pauseCtx->cursorSpecialPos == 0) { - KaleidoScope_DrawCursor(globalCtx, PAUSE_MAP); + KaleidoScope_DrawCursor(play, PAUSE_MAP); } gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[176], 16, 0); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c index 22b0cc231a..fd39d5ed16 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c @@ -2,9 +2,9 @@ static s16 D_8082A6E0[] = { 100, 255 }; -void KaleidoScope_UpdatePrompt(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; - Input* input = &globalCtx->state.input[0]; +void KaleidoScope_UpdatePrompt(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = &play->state.input[0]; s8 relStickX = input->rel.stick_x; s16 step; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h index f0bc3df461..e8d8af8e40 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h @@ -11,26 +11,26 @@ extern u8 gSlotAgeReqs[]; extern u8 gEquipAgeReqs[EQUIP_TYPE_MAX][4]; extern u8 gAreaGsFlags[]; -void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfxCtx); +void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx); s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point); -void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx); -void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx); -void KaleidoScope_DrawEquipment(GlobalContext* globalCtx); +void KaleidoScope_DrawDebugEditor(PlayState* play); +void KaleidoScope_DrawPlayerWork(PlayState* play); +void KaleidoScope_DrawEquipment(PlayState* play); void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx); -void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx); -void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx); -void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx); -void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx); -void KaleidoScope_UpdatePrompt(GlobalContext* globalCtx); +void KaleidoScope_DrawItemSelect(PlayState* play); +void KaleidoScope_UpdateItemEquip(PlayState* play); +void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx); +void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx); +void KaleidoScope_UpdatePrompt(PlayState* play); Gfx* KaleidoScope_QuadTextureIA4(Gfx* gfx, void* texture, s16 width, s16 height, u16 point); Gfx* KaleidoScope_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, u16 point); -void KaleidoScope_MoveCursorToSpecialPos(GlobalContext* globalCtx, u16 specialPos); +void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, u16 specialPos); void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, u16 width, u16 height, u16 point); void KaleidoScope_ProcessPlayerPreRender(); -void KaleidoScope_SetupPlayerPreRender(GlobalContext* globalCtx); -void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex); -void KaleidoScope_UpdateDungeonMap(GlobalContext* globalCtx); +void KaleidoScope_SetupPlayerPreRender(PlayState* play); +void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex); +void KaleidoScope_UpdateDungeonMap(PlayState* play); -void PauseMapMark_Draw(GlobalContext* globalCtx); +void PauseMapMark_Draw(PlayState* play); #endif diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 67b9e84dbb..ba31e5b42a 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -230,14 +230,14 @@ static u8 D_808321A8[5]; static PreRender sPlayerPreRender; static void* sPreRenderCvg; -void KaleidoScope_SetupPlayerPreRender(GlobalContext* globalCtx) { +void KaleidoScope_SetupPlayerPreRender(PlayState* play) { Gfx* gfx; Gfx* gfxRef; void* fbuf; - fbuf = globalCtx->state.gfxCtx->curFrameBuffer; + fbuf = play->state.gfxCtx->curFrameBuffer; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 496); + OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 496); gfxRef = POLY_OPA_DISP; gfx = Graph_GfxPlusOne(gfxRef); @@ -253,7 +253,7 @@ void KaleidoScope_SetupPlayerPreRender(GlobalContext* globalCtx) { SREG(33) |= 1; - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 509); + CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 509); } void KaleidoScope_ProcessPlayerPreRender(void) { @@ -309,8 +309,8 @@ void KaleidoScope_OverridePalIndexCI4(u8* texture, s32 size, s32 targetIndex, s3 } } -void KaleidoScope_MoveCursorToSpecialPos(GlobalContext* globalCtx, u16 specialPos) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, u16 specialPos) { + PauseContext* pauseCtx = &play->pauseCtx; pauseCtx->cursorSpecialPos = specialPos; pauseCtx->pageSwitchTimer = 0; @@ -330,8 +330,8 @@ void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, CLOSE_DISPS(gfxCtx, "../z_kaleido_scope_PAL.c", 758); } -void KaleidoScope_SetDefaultCursor(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_SetDefaultCursor(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; s16 s; s16 i; @@ -428,11 +428,11 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) { } } -void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) { + PauseContext* pauseCtx = &play->pauseCtx; u16 temp; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 955); + OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 955); temp = pauseCtx->unk_1E4; @@ -464,7 +464,7 @@ void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 985); + CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 985); } Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, void** textures) { @@ -501,7 +501,7 @@ Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, void** textures) { return gfx; } -void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { +void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { static s16 D_8082ACF4[][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 255, 255, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 255, 255, 0 }, { 0, 255, 50 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 255, 50 }, @@ -512,7 +512,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { static s16 D_8082AD48 = 0; static s16 D_8082AD4C = 0; static s16 D_8082AD50 = 0; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + PauseContext* pauseCtx = &play->pauseCtx; s16 stepR; s16 stepG; s16 stepB; @@ -619,7 +619,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->itemPageVtx, sSelectItemTexs[gSaveContext.language]); - KaleidoScope_DrawItemSelect(globalCtx); + KaleidoScope_DrawItemSelect(play); } if (pauseCtx->pageIndex != PAUSE_EQUIP) { @@ -637,7 +637,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->equipPageVtx, sEquipmentTexs[gSaveContext.language]); - KaleidoScope_DrawEquipment(globalCtx); + KaleidoScope_DrawEquipment(play); } if (pauseCtx->pageIndex != PAUSE_QUEST) { @@ -656,7 +656,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->questPageVtx, sQuestStatusTexs[gSaveContext.language]); - KaleidoScope_DrawQuestStatus(globalCtx, gfxCtx); + KaleidoScope_DrawQuestStatus(play, gfxCtx); } if (pauseCtx->pageIndex != PAUSE_MAP) { @@ -676,16 +676,16 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->mapPageVtx, sMapTexs[gSaveContext.language]); if (sInDungeonScene) { - KaleidoScope_DrawDungeonMap(globalCtx, gfxCtx); + KaleidoScope_DrawDungeonMap(play, gfxCtx); func_800949A8(gfxCtx); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.mapIndex)) { - PauseMapMark_Draw(globalCtx); + PauseMapMark_Draw(play); } } else { - KaleidoScope_DrawWorldMap(globalCtx, gfxCtx); + KaleidoScope_DrawWorldMap(play, gfxCtx); } } @@ -704,7 +704,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->itemPageVtx, sSelectItemTexs[gSaveContext.language]); - KaleidoScope_DrawItemSelect(globalCtx); + KaleidoScope_DrawItemSelect(play); break; case PAUSE_MAP: @@ -720,20 +720,20 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->mapPageVtx, sMapTexs[gSaveContext.language]); if (sInDungeonScene) { - KaleidoScope_DrawDungeonMap(globalCtx, gfxCtx); + KaleidoScope_DrawDungeonMap(play, gfxCtx); func_800949A8(gfxCtx); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (pauseCtx->cursorSpecialPos == 0) { - KaleidoScope_DrawCursor(globalCtx, PAUSE_MAP); + KaleidoScope_DrawCursor(play, PAUSE_MAP); } if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.mapIndex)) { - PauseMapMark_Draw(globalCtx); + PauseMapMark_Draw(play); } } else { - KaleidoScope_DrawWorldMap(globalCtx, gfxCtx); + KaleidoScope_DrawWorldMap(play, gfxCtx); } break; @@ -751,10 +751,10 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->questPageVtx, sQuestStatusTexs[gSaveContext.language]); - KaleidoScope_DrawQuestStatus(globalCtx, gfxCtx); + KaleidoScope_DrawQuestStatus(play, gfxCtx); if (pauseCtx->cursorSpecialPos == 0) { - KaleidoScope_DrawCursor(globalCtx, PAUSE_QUEST); + KaleidoScope_DrawCursor(play, PAUSE_QUEST); } break; @@ -770,10 +770,10 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->equipPageVtx, sEquipmentTexs[gSaveContext.language]); - KaleidoScope_DrawEquipment(globalCtx); + KaleidoScope_DrawEquipment(play); if (pauseCtx->cursorSpecialPos == 0) { - KaleidoScope_DrawCursor(globalCtx, PAUSE_EQUIP); + KaleidoScope_DrawCursor(play, PAUSE_EQUIP); } break; } @@ -782,7 +782,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { func_800949A8(gfxCtx); if ((pauseCtx->state == 7) || ((pauseCtx->state >= 8) && (pauseCtx->state < 0x12))) { - KaleidoScope_UpdatePrompt(globalCtx); + KaleidoScope_UpdatePrompt(play); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA); @@ -890,7 +890,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../z_kaleido_scope_PAL.c", 1577); } -void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { +void KaleidoScope_DrawInfoPanel(PlayState* play) { static void* D_8082AD54[3] = { gPauseToEquipENGTex, gPauseToEquipGERTex, @@ -937,7 +937,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { static s16 D_808321A2; static s16 D_808321A4; static s16 D_808321A6; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + PauseContext* pauseCtx = &play->pauseCtx; s16 stepR; s16 stepG; s16 stepB; @@ -946,7 +946,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { s16 i; s16 j; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 1676); + OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 1676); stepR = ABS(D_808321A0 - D_8082ADF0[D_8082AE04][0]) / D_8082AE00; stepG = ABS(D_808321A2 - D_8082ADF0[D_8082AE04][1]) / D_8082AE00; @@ -1074,7 +1074,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, -144.0f, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 1755), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 1755), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 90, 100, 130, 255); @@ -1100,7 +1100,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { j = (pauseCtx->cursorSpecialPos * 4) - 32; pauseCtx->cursorVtx[0].v.ob[0] = pauseCtx->infoPanelVtx[j].v.ob[0]; pauseCtx->cursorVtx[0].v.ob[1] = pauseCtx->infoPanelVtx[j].v.ob[1]; - KaleidoScope_DrawCursor(globalCtx, pauseCtx->pageIndex); + KaleidoScope_DrawCursor(play, pauseCtx->pageIndex); } temp = pauseCtx->infoPanelOffsetY - 80; @@ -1177,7 +1177,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gGoldSkulltulaIconTex, 24, 24, 0); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gGoldSkulltulaIconTex, 24, 24, 0); } } } else if ((pauseCtx->unk_1E4 < 3) || (pauseCtx->unk_1E4 == 7) || (pauseCtx->unk_1E4 == 8)) { @@ -1324,11 +1324,11 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 2032); + CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 2032); } -void KaleidoScope_UpdateNamePanel(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_UpdateNamePanel(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; u16 sp2A; if ((pauseCtx->namedItem != pauseCtx->cursorItem[pauseCtx->pageIndex]) || @@ -1387,8 +1387,8 @@ void KaleidoScope_UpdateNamePanel(GlobalContext* globalCtx) { } } -void func_808237B4(GlobalContext* globalCtx, Input* input) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void func_808237B4(PlayState* play, Input* input) { + PauseContext* pauseCtx = &play->pauseCtx; s32 cond = false; s32 mode; @@ -1572,11 +1572,11 @@ static s16 D_8082B0E4[] = { 0x0019, 0x000D, 0x0001, 0x0001, 0x000D, 0x0015, 0x000F, 0x000D, 0x000C, 0x0001, 0x0000, }; -s16 func_80823A0C(GlobalContext* globalCtx, Vtx* vtx, s16 arg2, s16 arg3) { +s16 func_80823A0C(PlayState* play, Vtx* vtx, s16 arg2, s16 arg3) { static s16 D_8082B110 = 0; static s16 D_8082B114 = 1; static s16 D_8082B118 = 0; - PauseContext* pauseCtx = &globalCtx->pauseCtx; + PauseContext* pauseCtx = &play->pauseCtx; s16* ptr1; s16* ptr2; s16* ptr3; @@ -1765,8 +1765,8 @@ static s16 D_8082B1F8[] = { 48, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, }; -void KaleidoScope_InitVertices(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { + PauseContext* pauseCtx = &play->pauseCtx; s16 phi_t1; s16 phi_t2; s16 phi_t2_2; @@ -1783,14 +1783,14 @@ void KaleidoScope_InitVertices(GlobalContext* globalCtx, GraphicsContext* gfxCtx } pauseCtx->itemPageVtx = Graph_Alloc(gfxCtx, 60 * sizeof(Vtx)); - func_80823A0C(globalCtx, pauseCtx->itemPageVtx, 0, 0); + func_80823A0C(play, pauseCtx->itemPageVtx, 0, 0); pauseCtx->equipPageVtx = Graph_Alloc(gfxCtx, 60 * sizeof(Vtx)); - func_80823A0C(globalCtx, pauseCtx->equipPageVtx, 1, 0); + func_80823A0C(play, pauseCtx->equipPageVtx, 1, 0); if (!sInDungeonScene) { pauseCtx->mapPageVtx = Graph_Alloc(gfxCtx, 248 * sizeof(Vtx)); - phi_t3 = func_80823A0C(globalCtx, pauseCtx->mapPageVtx, 4, 32); + phi_t3 = func_80823A0C(play, pauseCtx->mapPageVtx, 4, 32); for (phi_t2 = 0, phi_t5 = 58; phi_t2 < 15; phi_t2++, phi_t3 += 4, phi_t5 -= 9) { pauseCtx->mapPageVtx[phi_t3 + 2].v.ob[0] = -108; @@ -1836,11 +1836,11 @@ void KaleidoScope_InitVertices(GlobalContext* globalCtx, GraphicsContext* gfxCtx pauseCtx->mapPageVtx[phi_t3 - 2].v.tc[1] = pauseCtx->mapPageVtx[phi_t3 - 1].v.tc[1] = 0x40; } else { pauseCtx->mapPageVtx = Graph_Alloc(gfxCtx, 128 * sizeof(Vtx)); - func_80823A0C(globalCtx, pauseCtx->mapPageVtx, 2, 17); + func_80823A0C(play, pauseCtx->mapPageVtx, 2, 17); } pauseCtx->questPageVtx = Graph_Alloc(gfxCtx, 60 * sizeof(Vtx)); - func_80823A0C(globalCtx, pauseCtx->questPageVtx, 3, 0); + func_80823A0C(play, pauseCtx->questPageVtx, 3, 0); pauseCtx->cursorVtx = Graph_Alloc(gfxCtx, 20 * sizeof(Vtx)); @@ -2207,11 +2207,11 @@ void KaleidoScope_InitVertices(GlobalContext* globalCtx, GraphicsContext* gfxCtx pauseCtx->infoPanelVtx = Graph_Alloc(gfxCtx, 28 * sizeof(Vtx)); pauseCtx->saveVtx = Graph_Alloc(gfxCtx, 80 * sizeof(Vtx)); - func_80823A0C(globalCtx, pauseCtx->saveVtx, 5, 5); + func_80823A0C(play, pauseCtx->saveVtx, 5, 5); } -void KaleidoScope_DrawGameOver(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void KaleidoScope_DrawGameOver(PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_kaleido_scope_PAL.c", 3122); @@ -2255,12 +2255,12 @@ void KaleidoScope_DrawGameOver(GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_kaleido_scope_PAL.c", 3169); } -void KaleidoScope_Draw(GlobalContext* globalCtx) { - Input* input = &globalCtx->state.input[0]; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void KaleidoScope_Draw(PlayState* play) { + Input* input = &play->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 3188); + OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 3188); pauseCtx->stickRelX = input->rel.stick_x; pauseCtx->stickRelY = input->rel.stick_y; @@ -2276,30 +2276,30 @@ void KaleidoScope_Draw(GlobalContext* globalCtx) { if (pauseCtx->debugState == 0) { KaleidoScope_SetView(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); - func_800949A8(globalCtx->state.gfxCtx); - KaleidoScope_InitVertices(globalCtx, globalCtx->state.gfxCtx); - KaleidoScope_DrawPages(globalCtx, globalCtx->state.gfxCtx); + func_800949A8(play->state.gfxCtx); + KaleidoScope_InitVertices(play, play->state.gfxCtx); + KaleidoScope_DrawPages(play, play->state.gfxCtx); - func_800949A8(globalCtx->state.gfxCtx); + func_800949A8(play->state.gfxCtx); gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); KaleidoScope_SetView(pauseCtx, 0.0f, 0.0f, 64.0f); if (!((pauseCtx->state >= 8) && (pauseCtx->state <= 0x11))) { - KaleidoScope_DrawInfoPanel(globalCtx); + KaleidoScope_DrawInfoPanel(play); } } if ((pauseCtx->state >= 0xB) && (pauseCtx->state <= 0x11)) { - KaleidoScope_DrawGameOver(globalCtx); + KaleidoScope_DrawGameOver(play); } if ((pauseCtx->debugState == 1) || (pauseCtx->debugState == 2)) { - KaleidoScope_DrawDebugEditor(globalCtx); + KaleidoScope_DrawDebugEditor(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 3254); + CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 3254); } void KaleidoScope_GrayOutTextureRGBA32(u32* texture, u16 pixelCount) { @@ -2323,15 +2323,15 @@ void KaleidoScope_GrayOutTextureRGBA32(u32* texture, u16 pixelCount) { } } -void func_808265BC(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void func_808265BC(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; pauseCtx->eye.x += D_8082ABAC[pauseCtx->mode] * ZREG(46); pauseCtx->eye.z += D_8082ABCC[pauseCtx->mode] * ZREG(46); pauseCtx->unk_1EA += 4 * ZREG(46); if (pauseCtx->unk_1EA == (64 * ZREG(47))) { - func_80084BF4(globalCtx, 1); + func_80084BF4(play, 1); gSaveContext.buttonStatus[0] = D_8082AB6C[pauseCtx->pageIndex][0]; gSaveContext.buttonStatus[1] = D_8082AB6C[pauseCtx->pageIndex][1]; gSaveContext.buttonStatus[2] = D_8082AB6C[pauseCtx->pageIndex][2]; @@ -2341,15 +2341,15 @@ void func_808265BC(GlobalContext* globalCtx) { pauseCtx->unk_1E4 = 0; pauseCtx->state++; pauseCtx->alpha = 255; - Interface_LoadActionLabelB(globalCtx, DO_ACTION_SAVE); + Interface_LoadActionLabelB(play, DO_ACTION_SAVE); } else if (pauseCtx->unk_1EA == 64) { pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode]; pauseCtx->mode = (u16)(pauseCtx->pageIndex * 2) + 1; } } -void KaleidoScope_UpdateCursorSize(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScope_UpdateCursorSize(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; s32 temp1; s32 temp2; s32 temp3; @@ -2433,8 +2433,8 @@ void KaleidoScope_UpdateCursorSize(GlobalContext* globalCtx) { pauseCtx->cursorVtx[14].v.ob[1] = pauseCtx->cursorVtx[15].v.ob[1] = pauseCtx->cursorVtx[12].v.ob[1] - 16; } -void KaleidoScope_LoadDungeonMap(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void KaleidoScope_LoadDungeonMap(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; s32 pad; DmaMgr_SendRequest1(interfaceCtx->mapSegment, (u32)_map_48x85_staticSegmentRomStart + (R_MAP_TEX_INDEX * 2040), @@ -2445,37 +2445,37 @@ void KaleidoScope_LoadDungeonMap(GlobalContext* globalCtx) { "../z_kaleido_scope_PAL.c", 3471); } -void KaleidoScope_UpdateDungeonMap(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void KaleidoScope_UpdateDungeonMap(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; - osSyncPrintf("MAP DMA = %d\n", globalCtx->interfaceCtx.mapPaletteIndex); + osSyncPrintf("MAP DMA = %d\n", play->interfaceCtx.mapPaletteIndex); - KaleidoScope_LoadDungeonMap(globalCtx); - Map_SetFloorPalettesData(globalCtx, pauseCtx->dungeonMapSlot - 3); + KaleidoScope_LoadDungeonMap(play); + Map_SetFloorPalettesData(play, pauseCtx->dungeonMapSlot - 3); - if ((globalCtx->sceneNum >= SCENE_YDAN) && (globalCtx->sceneNum <= SCENE_TAKARAYA)) { + if ((play->sceneNum >= SCENE_YDAN) && (play->sceneNum <= SCENE_TAKARAYA)) { if ((VREG(30) + 3) == pauseCtx->cursorPoint[PAUSE_MAP]) { KaleidoScope_OverridePalIndexCI4(interfaceCtx->mapSegment, 2040, interfaceCtx->mapPaletteIndex, 14); } } - if ((globalCtx->sceneNum >= SCENE_YDAN) && (globalCtx->sceneNum <= SCENE_TAKARAYA)) { + if ((play->sceneNum >= SCENE_YDAN) && (play->sceneNum <= SCENE_TAKARAYA)) { if ((VREG(30) + 3) == pauseCtx->cursorPoint[PAUSE_MAP]) { KaleidoScope_OverridePalIndexCI4(interfaceCtx->mapSegment + 0x800, 2040, interfaceCtx->mapPaletteIndex, 14); } } } -void KaleidoScope_Update(GlobalContext* globalCtx) { +void KaleidoScope_Update(PlayState* play) { static s16 D_8082B258 = 0; static s16 D_8082B25C = 10; static s16 D_8082B260 = 0; - PauseContext* pauseCtx = &globalCtx->pauseCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; - Player* player = GET_PLAYER(globalCtx); - Input* input = &globalCtx->state.input[0]; + PauseContext* pauseCtx = &play->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + GameOverContext* gameOverCtx = &play->gameOverCtx; + Player* player = GET_PLAYER(play); + Input* input = &play->state.input[0]; u32 size; u32 size0; u32 size1; @@ -2493,14 +2493,14 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { if ((!pauseCtx->unk_1E4 || (pauseCtx->unk_1E4 == 8)) && (pauseCtx->state == 6)) { pauseCtx->stickRelX = input->rel.stick_x; pauseCtx->stickRelY = input->rel.stick_y; - KaleidoScope_UpdateCursorSize(globalCtx); + KaleidoScope_UpdateCursorSize(play); KaleidoScope_HandlePageToggles(pauseCtx, input); } else if ((pauseCtx->pageIndex == PAUSE_QUEST) && ((pauseCtx->unk_1E4 < 3) || (pauseCtx->unk_1E4 == 5))) { - KaleidoScope_UpdateCursorSize(globalCtx); + KaleidoScope_UpdateCursorSize(play); } if (pauseCtx->state == 6) { - KaleidoScope_UpdateNamePanel(globalCtx); + KaleidoScope_UpdateNamePanel(play); } } @@ -2522,9 +2522,9 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { pauseCtx->unk_204 = -314.0f; //! @bug messed up alignment, should match `ALIGN64` - pauseCtx->playerSegment = (void*)(((u32)globalCtx->objectCtx.spaceStart + 0x30) & ~0x3F); + pauseCtx->playerSegment = (void*)(((u32)play->objectCtx.spaceStart + 0x30) & ~0x3F); - size1 = func_80091738(globalCtx, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime); + size1 = func_80091738(play, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime); osSyncPrintf("プレイヤー size1=%x\n", size1); pauseCtx->iconItemSegment = (void*)ALIGN16((u32)pauseCtx->playerSegment + size1); @@ -2551,7 +2551,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { pauseCtx->iconItemAltSegment = (void*)ALIGN16((u32)pauseCtx->iconItem24Segment + size); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -2578,7 +2578,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { interfaceCtx->mapPalette[28] = 6; interfaceCtx->mapPalette[29] = 99; - KaleidoScope_UpdateDungeonMap(globalCtx); + KaleidoScope_UpdateDungeonMap(play); break; default: @@ -2613,7 +2613,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { osSyncPrintf("サイズ=%x\n", size2 + size1 + size0 + size); osSyncPrintf("item_name I_N_PT=%x\n", 0x800); - Interface_SetDoAction(globalCtx, DO_ACTION_DECIDE); + Interface_SetDoAction(play, DO_ACTION_DECIDE); osSyncPrintf("サイズ=%x\n", size2 + size1 + size0 + size + 0x800); if (((void)0, gSaveContext.worldMapArea) < 22) { @@ -2641,8 +2641,8 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { PreRender_SetValuesSave(&sPlayerPreRender, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT, pauseCtx->playerSegment, NULL, sPreRenderCvg); - KaleidoScope_DrawPlayerWork(globalCtx); - KaleidoScope_SetupPlayerPreRender(globalCtx); + KaleidoScope_DrawPlayerWork(play); + KaleidoScope_SetupPlayerPreRender(play); for (i = 0; i < ARRAY_COUNT(pauseCtx->worldMapPoints); i++) { pauseCtx->worldMapPoints[i] = 0; @@ -2870,7 +2870,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { case 4: if (pauseCtx->unk_1F4 == 160.0f) { - KaleidoScope_SetDefaultCursor(globalCtx); + KaleidoScope_SetDefaultCursor(play); KaleidoScope_ProcessPlayerPreRender(); } @@ -2888,14 +2888,14 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { pauseCtx->state = 5; } - func_808265BC(globalCtx); + func_808265BC(play); break; case 5: pauseCtx->alpha += (u16)(255 / (WREG(6) + WREG(4))); - func_808265BC(globalCtx); + func_808265BC(play); if (pauseCtx->state == 6) { - KaleidoScope_UpdateNamePanel(globalCtx); + KaleidoScope_UpdateNamePanel(play); } break; @@ -2903,7 +2903,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { switch (pauseCtx->unk_1E4) { case 0: if (CHECK_BTN_ALL(input->press.button, BTN_START)) { - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); pauseCtx->state = 0x12; WREG(2) = -6240; func_800F64E0(0); @@ -2923,7 +2923,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { break; case 1: - func_808237B4(globalCtx, globalCtx->state.input); + func_808237B4(play, play->state.input); break; case 2: @@ -2935,7 +2935,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { break; case 3: - KaleidoScope_UpdateItemEquip(globalCtx); + KaleidoScope_UpdateItemEquip(play); break; case 4: @@ -2946,7 +2946,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { if (CHECK_BTN_ALL(input->press.button, BTN_START)) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); pauseCtx->state = 0x12; WREG(2) = -6240; func_800F64E0(0); @@ -2997,7 +2997,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { case 8: if (CHECK_BTN_ALL(input->press.button, BTN_START)) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); pauseCtx->state = 0x12; WREG(2) = -6240; func_800F64E0(0); @@ -3043,7 +3043,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { case 1: if (CHECK_BTN_ALL(input->press.button, BTN_A)) { if (pauseCtx->promptChoice != 0) { - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_ENABLED; gSaveContext.unk_13EA = 0; @@ -3056,15 +3056,15 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - Play_SaveSceneFlags(globalCtx); - gSaveContext.savedSceneNum = globalCtx->sceneNum; - Sram_WriteSave(&globalCtx->sramCtx); + Play_SaveSceneFlags(play); + gSaveContext.savedSceneNum = play->sceneNum; + Sram_WriteSave(&play->sramCtx); pauseCtx->unk_1EC = 4; D_8082B25C = 3; } } else if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B)) { - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); pauseCtx->unk_1EC = 2; WREG(2) = -6240; YREG(8) = pauseCtx->unk_204; @@ -3079,7 +3079,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { case 4: if (CHECK_BTN_ALL(input->press.button, BTN_B) || CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START) || (--D_8082B25C == 0)) { - Interface_SetDoAction(globalCtx, DO_ACTION_NONE); + Interface_SetDoAction(play, DO_ACTION_NONE); gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = BTN_ENABLED; gSaveContext.unk_13EA = 0; @@ -3139,7 +3139,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { Interface_ChangeAlpha(1); //! @bug messed up alignment, should match `ALIGN64` - pauseCtx->iconItemSegment = (void*)(((u32)globalCtx->objectCtx.spaceStart + 0x30) & ~0x3F); + pauseCtx->iconItemSegment = (void*)(((u32)play->objectCtx.spaceStart + 0x30) & ~0x3F); size0 = (u32)_icon_item_staticSegmentRomEnd - (u32)_icon_item_staticSegmentRomStart; osSyncPrintf("icon_item size0=%x\n", size0); DmaMgr_SendRequest1(pauseCtx->iconItemSegment, (u32)_icon_item_staticSegmentRomStart, size0, @@ -3294,9 +3294,9 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); pauseCtx->promptChoice = 0; - Play_SaveSceneFlags(globalCtx); - gSaveContext.savedSceneNum = globalCtx->sceneNum; - Sram_WriteSave(&globalCtx->sramCtx); + Play_SaveSceneFlags(play); + gSaveContext.savedSceneNum = play->sceneNum; + Sram_WriteSave(&play->sramCtx); pauseCtx->state = 0xF; D_8082B25C = 3; } @@ -3321,7 +3321,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { if (pauseCtx->promptChoice == 0) { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - Play_SaveSceneFlags(globalCtx); + Play_SaveSceneFlags(play); switch (gSaveContext.entranceIndex) { case ENTR_YDAN_0: @@ -3394,10 +3394,10 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { pauseCtx->state = 0; R_UPDATE_RATE = 3; R_PAUSE_MENU_MODE = 0; - func_800981B8(&globalCtx->objectCtx); - func_800418D0(&globalCtx->colCtx, globalCtx); + func_800981B8(&play->objectCtx); + func_800418D0(&play->colCtx, play); if (pauseCtx->promptChoice == 0) { - Play_TriggerRespawn(globalCtx); + Play_TriggerRespawn(play); gSaveContext.respawnFlag = -2; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.health = 0x30; @@ -3415,8 +3415,8 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { osSyncPrintf("Z_MAGIC_NOW_NOW=%d\n", gSaveContext.unk_13F6); osSyncPrintf(VT_RST); } else { - globalCtx->state.running = false; - SET_NEXT_GAMESTATE(&globalCtx->state, Opening_Init, OpeningContext); + play->state.running = false; + SET_NEXT_GAMESTATE(&play->state, Opening_Init, OpeningContext); } } } @@ -3442,7 +3442,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { pauseCtx->unk_1F8 = 160.0f; pauseCtx->unk_1F4 = 160.0f; pauseCtx->namedItem = PAUSE_ITEM_NONE; - globalCtx->interfaceCtx.startAlpha = 0; + play->interfaceCtx.startAlpha = 0; } break; @@ -3450,10 +3450,10 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { pauseCtx->state = 0; R_UPDATE_RATE = 3; R_PAUSE_MENU_MODE = 0; - func_800981B8(&globalCtx->objectCtx); - func_800418D0(&globalCtx->colCtx, globalCtx); + func_800981B8(&play->objectCtx); + func_800418D0(&play->colCtx, play); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -3472,7 +3472,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { case SCENE_MIZUSIN_BS: case SCENE_JYASINBOSS: case SCENE_HAKADAN_BS: - Map_InitData(globalCtx, globalCtx->interfaceCtx.mapRoomNum); + Map_InitData(play, play->interfaceCtx.mapRoomNum); break; } @@ -3487,7 +3487,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { gSaveContext.unk_13EA = 0; Interface_ChangeAlpha(gSaveContext.unk_13EE); player->targetActor = NULL; - Player_SetEquipmentData(globalCtx, player); + Player_SetEquipmentData(play, player); osSyncPrintf(VT_RST); break; } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index 3da61f1dfa..88f6f231a7 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -34,17 +34,17 @@ static const u32 sLineBytesImageSizes[] = { 0, 1, 2, 2 }; extern PauseMapMarksData gPauseMapMarkDataTable[]; -void PauseMapMark_Init(GlobalContext* globalCtx) { +void PauseMapMark_Init(PlayState* play) { gBossMarkState = 0; gBossMarkScale = 1.0f; gLoadedPauseMarkDataTable = gPauseMapMarkDataTable; } -void PauseMapMark_Clear(GlobalContext* globalCtx) { +void PauseMapMark_Clear(PlayState* play) { gLoadedPauseMarkDataTable = NULL; } -void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { +void PauseMapMark_DrawForDungeon(PlayState* play) { PauseMapMarkData* mapMarkData; PauseMapMarkPoint* markPoint; PauseMapMarkInfo* markInfo; @@ -53,15 +53,15 @@ void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { mapMarkData = &gLoadedPauseMarkDataTable[R_MAP_TEX_INDEX >> 1][i]; - OPEN_DISPS(globalCtx->state.gfxCtx, "../z_lmap_mark.c", 182); + OPEN_DISPS(play->state.gfxCtx, "../z_lmap_mark.c", 182); while (true) { if (mapMarkData->markType == PAUSE_MAP_MARK_NONE) { break; } - if ((mapMarkData->markType == PAUSE_MAP_MARK_BOSS) && (globalCtx->sceneNum >= SCENE_YDAN_BOSS) && - (globalCtx->sceneNum <= SCENE_GANON_FINAL)) { + if ((mapMarkData->markType == PAUSE_MAP_MARK_BOSS) && (play->sceneNum >= SCENE_YDAN_BOSS) && + (play->sceneNum <= SCENE_GANON_FINAL)) { if (gBossMarkState == 0) { Math_ApproachF(&gBossMarkScale, 1.5f, 1.0f, 0.041f); if (gBossMarkScale == 1.5f) { @@ -80,7 +80,7 @@ void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { Matrix_Push(); - if ((globalCtx->pauseCtx.state == 4) || (globalCtx->pauseCtx.state >= 0x12)) { + if ((play->pauseCtx.state == 4) || (play->pauseCtx.state >= 0x12)) { Matrix_Translate(-36.0f, 101.0f, 0.0f, MTXMODE_APPLY); } else { Matrix_Translate(-36.0f, 21.0f, 0.0f, MTXMODE_APPLY); @@ -95,10 +95,10 @@ void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { s32 display; if (mapMarkData->markType == PAUSE_MAP_MARK_CHEST) { - if (Flags_GetTreasure(globalCtx, markPoint->chestFlag)) { + if (Flags_GetTreasure(play, markPoint->chestFlag)) { display = false; } else { - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN_BOSS: case SCENE_DDAN_BOSS: case SCENE_BDAN_BOSS: @@ -129,7 +129,7 @@ void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { Matrix_Push(); Matrix_Translate(GREG(92) + markPoint->x, GREG(93) + markPoint->y, 0.0f, MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_lmap_mark.c", 272), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_lmap_mark.c", 272), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Matrix_Pop(); @@ -144,13 +144,13 @@ void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) { Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_lmap_mark.c", 286); + CLOSE_DISPS(play->state.gfxCtx, "../z_lmap_mark.c", 286); } -void PauseMapMark_Draw(GlobalContext* globalCtx) { - PauseMapMark_Init(globalCtx); +void PauseMapMark_Draw(PlayState* play) { + PauseMapMark_Init(play); - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: @@ -161,9 +161,9 @@ void PauseMapMark_Draw(GlobalContext* globalCtx) { case SCENE_HAKADAN: case SCENE_HAKADANCH: case SCENE_ICE_DOUKUTO: - PauseMapMark_DrawForDungeon(globalCtx); + PauseMapMark_DrawForDungeon(play); break; } - PauseMapMark_Clear(globalCtx); + PauseMapMark_Clear(play); } diff --git a/tools/bootstrap_actors.py b/tools/bootstrap_actors.py index 4052788270..741113ba13 100644 --- a/tools/bootstrap_actors.py +++ b/tools/bootstrap_actors.py @@ -146,13 +146,13 @@ def bootstrap(ovl_path, ovl_text): decs = "" if init_func != "0x00000000" and init_func != "Actor_Noop": - decs += "void " + init_func_name + "(" + struct_name + "* this, GlobalContext* globalCtx);\n" + decs += "void " + init_func_name + "(" + struct_name + "* this, PlayState* play);\n" if destroy_func != "0x00000000" and destroy_func != "Actor_Noop": - decs += "void " + destroy_func_name + "(" + struct_name + "* this, GlobalContext* globalCtx);\n" + decs += "void " + destroy_func_name + "(" + struct_name + "* this, PlayState* play);\n" if update_func != "0x00000000" and update_func != "Actor_Noop": - decs += "void " + update_func_name + "(" + struct_name + "* this, GlobalContext* globalCtx);\n" + decs += "void " + update_func_name + "(" + struct_name + "* this, PlayState* play);\n" if draw_func != "0x00000000" and draw_func != "Actor_Noop": - decs += "void " + draw_func_name + "(" + struct_name + "* this, GlobalContext* globalCtx);\n" + decs += "void " + draw_func_name + "(" + struct_name + "* this, PlayState* play);\n" init_vars = "const ActorInit " + init_vars_name + " =\n{\n" init_vars += indent + actor_id_name + ",\n" diff --git a/tools/bootstrap_fx.py b/tools/bootstrap_fx.py index 0d3187dd15..4f39262718 100755 --- a/tools/bootstrap_fx.py +++ b/tools/bootstrap_fx.py @@ -114,13 +114,13 @@ def bootstrap(ovl_path, ovl_text): ",\n" + indent + init_func_name + ",\n};\n*/" decs = "u32 " + init_func_name + \ - "(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);\n" + "(PlayState* play, u32 index, EffectSs* this, void* initParamsx);\n" decs += "void " + \ init_func_name[:-4] + \ - "Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);\n" + "Draw(PlayState* play, u32 index, EffectSs* this);\n" decs += "void " + \ init_func_name[:-4] + \ - "Update(GlobalContext* globalCtx, u32 index, EffectSs* this);\n" + "Update(PlayState* play, u32 index, EffectSs* this);\n" insert_pos = ovl_text.find("global.h>\n") diff --git a/tools/namefixer.py b/tools/namefixer.py index 8edb4b7910..c821997e9d 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -153,8 +153,8 @@ wordReplace = { "func_800D20CC": "Matrix_MtxFToYXZRotS", "func_800D2264": "Matrix_MtxFToZYXRotS", "func_800D23FC": "Matrix_RotateAxis", - "PLAYER": ("GET_PLAYER(globalCtx)", {"ignore": (-1, '"PLAYER"')}), # ignore "PLAYER" in sSoundBankNames - "ACTIVE_CAM": "GET_ACTIVE_CAM(globalCtx)", + "PLAYER": ("GET_PLAYER(play)", {"ignore": (-1, '"PLAYER"')}), # ignore "PLAYER" in sSoundBankNames + "ACTIVE_CAM": "GET_ACTIVE_CAM(play)", "SkinMatrix_SetRotateRPY": "SkinMatrix_SetRotateZYX", "SkinMatrix_SetScaleRotateYRPTranslate": "SkinMatrix_SetScaleRotateYXZTranslate", "SkinMatrix_SetScaleRotateYXZTranslate": "SkinMatrix_SetTranslateRotateYXZScale",